Silent iOS

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
loofy2
Prole
Posts: 8
Joined: Fri Mar 14, 2025 1:11 am

Silent iOS

Post 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 🐟
loofy2
Prole
Posts: 8
Joined: Fri Mar 14, 2025 1:11 am

Re: Silent iOS

Post 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
loofy2
Prole
Posts: 8
Joined: Fri Mar 14, 2025 1:11 am

Re: Silent iOS

Post 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
loofy2
Prole
Posts: 8
Joined: Fri Mar 14, 2025 1:11 am

Re: Silent iOS

Post 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 😁👍
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests