Question

Has to be free.

Was it helpful?

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

Check out my blog post on using NAudio to replace the audio playback mechanism in babysmash. It explains how to play MP3 files directly from embedded resources without the need to save to a temporary file.

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
scroll top