What's the simplest way to play an MP3 in WPF? [closed]
Question
Has to be free.
Solution
Use the MediaElement control.
This page seems to give a pretty in depth explanation: http://blogs.vbcity.com/xtab/archive/2008/06/10/9091.aspx
OTHER TIPS
Though I didn't actually mention it, I was hoping to find a way to play embedded MP3 resources, and neither MediaPlayer nor MediaElement support loading from streams (they accept a uri, but don't work with pack:// uris).
I ended up simply extracting the embedded MP3 to a temporary directory, playing it (with MediaPlayer), then deleting it when done. It involves a slight delay (of about 0.5-1 second) but seems to be the safest way to play an embedded resource.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow