Page 1 of 1

Silent iOS

Posted: Fri Mar 14, 2025 1:19 am
by loofy2
Hello LÖVE Community,

I'm a mobile dev, and a long time fan of the platform.

Currently I'm working to release a product on iOS and Android.

Here's what brought me here.

There is no sound when I package the game for iOS. MacOS plays sound. Android plays sound. Everything is working fine except there is no sound, and it only happens on iOS.

I've tried different audio formats. WAV and MP3

I've tried stable 11.5 with SDL2, and the latest 12.0 branch with SDL3

I've tried on multiple iOS devices. Each one can play sound from other sources with no changes in configuration.

I even had a long chat about it with chatGPT.
https://chatgpt.com/share/67d38385-160c ... d4da2a2ca1

I can't seem to find the source of problem. I appreciate any suggestions.

Thank you 🐟

Re: Silent iOS

Posted: Sun Mar 16, 2025 8:50 pm
by loofy2
Digging deep into the code with the Xcode debugger,

- I can see that w_newSource is being called.

- An openal source is instantiated.

- the play function is triggered. a source is assigned to a pool

- alSourcePlay() is called with source = 2400

- alGetError() returns true

I've tried static and stream.

But, still no sound is playing

Re: Silent iOS

Posted: Mon Mar 17, 2025 1:59 am
by loofy2
I got sound to play!

But not in a good way.


I replaced love.cpp with the source code from LibSDL3's example for simple playback.

The app launches and immediately plays the tone the same way the browser does.

Which means the problem is likely something Love2d's source code

https://examples.libsdl.org/SDL3/audio/ ... e-playback

Re: Silent iOS

Posted: Mon Mar 17, 2025 2:31 am
by loofy2
Ok digging even deeper!

In iOS.mm the AVAudioSession is initialized with AVAudioSessionCategoryAmbient.

I changed the session category to AVAudioSessionCategoryPlayback, low and behold, the audio started to play.


The problem was that the silent mode switch was turned on, and when in Ambient mode the sound does not play.

Problem solved 😁👍