C#17mo ago

❔ C# WPF playing background music

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!
2 Replies
d56Wr17mo ago
Looks like mp3 can't be in resource, but has to be as standalone file for some reason. Now it works.
Accord17mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.