This project is read-only.

MediaPlayer.Play Gives NullReferenceException

Sep 18, 2011 at 11:13 PM

Is the XNA 3.0 audio stuff implemented? It doesn't seem like it's working.

Content.Load<Song>(filename) does seem to work, and returns me a physical object; albeit all the properties throw a NotImplementedExxception.

Then MediaPlayer.Play(song) with a Song instance throws a NullReferenceException.

Am I missing something? Is this supposed to work? (FYI, I also can't figure out what combination of path and build action to make SoundEffect find the file either.)

Jan 24, 2012 at 5:21 PM

Try setting the build action for the song to Content instead of Resource. I did this on XNA 4.0 with an MP3 and it worked, but it kept looping. Using MediaPlayer.Stop() would hopefully fix the problem.