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: