On Windows Phone 8, I am able to play WAV files with the below code, but not MP3 files. Is there anything special I have to do?
My requirement is to play MP3s one after per user's choice, one after another. I play them all one after another on the same xaml Page. The MP3s are included as Content (copy always).
private void PlayAudioTrack(string audiofilename)
{
try
{
using (var stream = TitleContainer.OpenStream(@"Audio/" + audiofilename))
{
var effect = SoundEffect.FromStream(stream);
FrameworkDispatcher.Update();
effect.Play();
}
}
catch
{
//....
}
}