Troubleshooting this TutorialSometimes, even though you try hard to understand the information in a tutorial, things don't work out quite like you want it to. This page is here to help you resolve any problems you might be having with playing background music in XNA. The Common Mistakes section describes common problems that people have when doing the things in this tutorial, and how to resolve them. The Frequently Asked Questions section describes questions that people have that aren't related to mistakes, but rather, trying to understand the stuff better or exploring how it can be used. If your problem or concern isn't addressed here, feel free to add a comment below, so that I know where you're having trouble. I like to keep these pages fairly clean, so I may remove comments that I felt like have been addressed. If I remove your comment and you don't feel like the problem has been fixed, repost the question and we'll take another look at it. If a tutorial has a mistake in it, I will fix the mistake and reply to the comment with a brief explanation. However, after a couple of weeks I'll likely go back and remove the original comment as well as my reply, because, hopefully, the problem will have been fixed, and it won't be a concern any more. |
Common MistakesNone listed yet… |
Frequently Asked QuestionsNone listed yet… |
I'm having the issue that my song is playing on the pc, but not on the Xbox. I don't get any errors. Here's my code;
public void Play(String song)
{
if (MediaPlayer.GameHasControl)
{
MediaPlayer.IsRepeating = true;
MediaPlayer.IsMuted = false;
MediaPlayer.Volume = 1.0f;
s = Engine.Content.Load<Song>(song);
if (MediaPlayer.State != MediaState.Playing)
MediaPlayer.Play(s);
}
}
MediaPlayer.State allways remains MediaState.Stopped on the Xbox. On the PC it becomes MediaState.Playing and I can hear the music.
Do you have any idea what could go wrong?
Problem solved!
Removing "./" from the path name solved my problem!
I'm glad you got it working. Sounds like it was just a problem with dealing with the differences between how the Xbox and PC work with files.
Post preview:
Close preview