MediaPlayer stopping prematurely

I basically have the same problem as this guy had: Song cutting off prematurely
Unfortunately there was no perfect solution found in his case.

In my case I load my song through the pipeline tool with Content.Load and use MediaPlayer.Play(song) to play it. The song’s length as seen song.Duration.TotalSeconds correctly corresponds with the length of the audio file. However, the MediaPlayer stops around 1 second too early; you can hear it stop and the MediaPlayer.State is set to Stopped when this happens. The “solution” by adding an extra second of silence kind of works, but it is not exact, and looping or playing a new song doesn’t flow smoothly.

I have tried both the mp3. format and the .ogg format. The song is played correctly in Windows Media Player. My project is a Monogame Cross Platform Desktop Project. Is this a known bug or is there some trick to it? I have seen several forum posts about it, but no solution.

I seem to have pinpointed the error somewhat. For some reason MediaPlayer.PlayPosition is placed around 1.5 seconds ahead of the actual play position. This explains why the song ends earlier than expected. The question is why this happens and how one can fix it.

I circumvented the problem by not using MediaPlayer at all, and instead imported the .mp3-files as SoundEffects instead. In the pipeline tool, select the file and change the processor from Song to Sound Effect.

I just submitted a fix for this (#5821). It was triggering the song end when the last buffers had been queued, but was not waiting for those buffers to be played.