This is driving me bonkers! When trying to play a sound or any media element in a windows phone 8 app I get "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
And that is all it says. If I look at the stack trace it shows: at Windows.UI.Xaml.Controls.MediaElement.Play()
Example code is:
XAML:
MediaElement x:Name="sndClick" Source="Assets/Sounds/Click.wav" Volume="10" AutoPlay="False"
Code: sndClick.play();
I am trying to port a Windows 8 app to Windows Phone 8. The Windows 8 app works perfectly with the exact same code. This must be some issue with the Windows Phone. Everything else works, it just crashes when the phone trys to play media.
Not all the elements that play sounds crash the program, unless you click them a few times. Some elements always crash on the first click. No sounds ever play, even if the program doesn't crash with the exception it never plays any sounds.
ONE time (and only one time) it played the first couple frames of one of the animation files (.wmv) and then crashed.
It is a weird problem. All the code is copied from the working Windows 8 program and everything works except for the media. If I comment out the sound.play()'s and I disable the media player the program works fine.
At first I thought it might be that the resources weren't copying so I set the "Copy to Output Directory" to "Always Copy". No effect.
I tried the simulators and I tried it on physical hardware, it is the same on everything.
It isn't a resource issue, the simulators and the hardware have more than enough system resources, the whole app is only 22mb's.
It's not a codec issue, the animation is a .wmv file and the sounds are all .wav. Both should be natively supported on any windows device.
I have searched around and seen others with similar problems but I haven't seen any solutions. Does anybody know what is causing this issue and how to fix it? I would very much appreciate it.
I am pulling my hair out on this.
Thanks,
-RW