C
C#

help

❔ C# WPF playing background music

Dd56Wr2/3/2023
Hello, I have WPF app for game launcher/updater. I wanted to add background music, so I added this code to my UI.xaml: <MediaElement Name="backgroundMusicPlayer" LoadedBehavior="Play" Visibility="Hidden" Source="../Resources/Music/theme.mp3"/> In Visual Studio it works as expected, the music is being played. But if I build the solution, music is not playing. The "theme.mp3" resource has Build Action = Resource and Copy to Output Directory = Do not copy, since I need the mp3 inside the exe. Could someone point me to what I'm doing wrong? Thank you! Looks like mp3 can't be in resource, but has to be as standalone file for some reason. Now it works.
AAccord2/4/2023
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.

Looking for more? Join the community!