MediaPlayer.Play method throwing DRM exception?!
I'm trying to add background music to my XNA 4-based Windows game. When I do
Song bgm = Content.Load<Song>("bgm");
MediaPlayer.Play(bgm);
in the MyGame.LoadContent
method, I get an Invali开发者_StackOverflowdOperationException
with the message "Song playback failed. Please verify that the song is not DRM protected. DRM protected songs are not supported for creator games." The song is in MP3 format and is not protected. I tried using a WAV instead and the result was the same.
It seems I'm not the only one having this problem. But the closest thing I've found to a solution is "use XACT".
Any ideas?
Edit: Also, why is my code snippet not syntax highlighted? It's highlighted in preview.
The problem in my case was that I had uninstalled Windows Media Player. For what it's worth, I'm running Windows 7 Professional 64-bit. I reinstalled WMP via the Windows Features dialog and the problem went away immediately. I didn't even have to restart.
The problem for me was that I was missing the ID_CAP_MEDIALIB capability in my WMAppManifest.xml.
<Capability Name="ID_CAP_MEDIALIB"/>
Hope this helps.
精彩评论