One thing you can do is move the Content.Load<Song> method to Load and check if it plays in the update, and if not, play. For instance,
public void LoadContent(ConentManager content) { song = content.Load<Song>("music/game"); gameSongStartedPlaying = false; // this variable to hold if you have starting playing this song already MediaPlayer.IsRepeating = false; } public void Update(GameTime gameTime) { if(MediaPlayer.State == MediaState.Stopped && !gameSongStartedPlaying) { MediaPlayer.Play(song); gameSongStartedPlaying = true; } }
This should start playing the song on the first pass of the Update method, and not at the download stage, when the song is βplayingβ, and all resources after Content.Load<Song> are still loading (this would be the reason that your song ends earlier).
source share