mp3 Songs won't play on iOS

using XnaMediaPlayer = Microsoft.Xna.Framework.Media.MediaPlayer;

XnaMediaPlayer.Play(ContentHandler.Songs["Song1"]);
XnaMediaPlayer.IsRepeating = true;

The above code works great on Android, but the song doesn’t play on iOS. Song1 is in mp3 format and is being handled in the pipeline using “Mp3 Importer - MonoGame”.

It doesn’t crash on iOS, it just doesn’t play the song. Any ideas?

Thanks,
-Chris B.

Hi, I experienced the same problem.
Plus, I re-compiled an old application that worked well under 3.5 release of monogame (all the songs played perfectly) with newest 3.7.1 and no songs is audible (exactly as @trufun202 describes).
I made some tests: the songs (.mp3 files imported via content pipeline) are loaded perfectly. After the “Play(song)” statement the state of the songs is “playing”, but nothing is audible…
I tried with various format of mp3 and also with .ogg, with the same result.
Can anyone suggest a solution ?
Thanks.
-Romand

Can you use SoundEffect in the interim?

Yes, SoundEffect is a solution, even if it could be a little bit annoying to change all the songs-dependency in the old code…
Consider that I use songs for background music and sound effects for a lot of other things (noises, voices, etc.) over the background music…
In any case, the reason why the songs won’t play on iOS device (as they play before) remain unresolved…
Any idea?

I assume its a bug in the framework, maybe try going back a version? Hopefully someone with more knowledge will chime in.

Beware, using SoundEffect for music will export your music in WAV format and increase your deployable size.

I created a tool that converts OGG files into sound effects at run time. This keeps your deployable size down but increases memory usage and load time. I could host it if it is something you’re interested in.

I think it’s a bug, but I don’t find anything about it all around the web…
Have you reproduced it?
I know that importing mp3 songs as sound effect (via content pipeline) will increase about 5/10% in size (when converted in wav).
The real issue is that the same mp3, imported as song (via content pipeline) doubled its size (they are converted in wma) !
I am very interested in your code for decoding .ogg at runtime, and I will be very happy to review it :slight_smile:

Okay, I’ll host it tonight or this weekend as I have time

I made a simple github repo

Thanks a lot :slight_smile:
I’ll take a look asap!

Oh, one thing I should add, your oggStream needs to be fully loaded into memory for VorbisToWave to work. It would make more sense as just a byte array input and output than a stream

Ok, I tried to downgrade to release 3.6 and the above code works well. In simulator and in real devices the songs play fine.
So, it’s definitively confirmed it’s an issue of the latest 3.7 / 3.7.1 release of monogame.
I am very curious to discover the reasons of this bug…
Nobody can help us?

@Benjamin_W Your work is really impressive! It overcomes my current needs, but I will preserve it for next projects :+1:

1 Like

Can you file an issue on GitHub for this? It sounds like a regression.

1 Like

@Kimimaru For now I posted this issue into the “Monogame 3.7.1” topic.
First, I want receive more notifications from people whose experienced the same problem on playing songs on iOS environment.
Have you tried to reproduce it ?
Many thanks for your feedback.

I don’t have an iOS device so I can’t test, but the GitHub issue tracker is a better place to put it to draw more attention to it.

@Kimimaru Maybe you can try to test it using the Simulator (if you develop on Mac)… According to your suggestion, I am going to open an issue on GitHub.

Unfortunatelly, I don’t have a Mac either, so I can’t test this issue. Thanks for opening an issue!

@trufun202 Hi, have you resolved the issue? I am still in search for a solution. I have opened an issue on GitHub without contributions until now…
Please let me know any news.

For who interest, the issue was solved installing the 3.7.1 MG release from NuGet package. Probably, I had made mess with previous installations…

Glad you found a solution!

I have the same problem, im using the nuget version and not work :sweat: