MediaPlayer.Play method throwing DRM exception?!
Asked Answered
C

2

6

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 InvalidOperationException 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.

Clayton answered 12/4, 2011 at 19:24 Comment(0)
C
5

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.

Clayton answered 18/4, 2011 at 13:55 Comment(1)
My guess is that XNA and/or DirectX use WMP dlls for the audio playback or DRM checking.Ananna
S
3

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.

Starstarboard answered 31/5, 2011 at 22:42 Comment(1)
I created a Mango version of my game, everything is a linked file except this manifest file and the tile icon (the two that cant be linked). Thanks, this fixed it for me.Madelene

© 2022 - 2024 — McMap. All rights reserved.