I am trying to play audio in my Silverlight for Windows Phone 7 app. I have an MP3 audio file with its build action set to resource. To play the sound, I use:
SoundEffectInstance sfi = null;
...
Stream source = Application.GetResourceStream(new Uri("/Bird Calls;component/Crow.mp3", UriKind.Relative)).Stream;
Microsoft.Xna.Framework.Audio.SoundEffect effect = SoundEffect.FromStream(source);
sfi = effect.CreateInstance();
sfi.Play();
This code throws a InvalidOperationException at the SoundEffect.FromStream method.