godot icon indicating copy to clipboard operation
godot copied to clipboard

SamplePlayer don't work after incoming calls on iOS

Open florix91 opened this issue 9 years ago • 14 comments

Operating system or device - Godot version: 2.1.2

Issue description: Like title. SamplePlayers don't stream any audio from devices if app is open and comes an incoming call. I've tested with iphone 7 plus on latest ios version. Would love to try on different one but i can't because i don't have any.

Steps to reproduce: Open an app that has sampleplayers in it. Call with another phone the device that has the app open. Answer the call from app opened device. Close call. Try if sampleplayers still works.

Link to minimal example project:

florix91 avatar Feb 28 '17 02:02 florix91

I confirm this bug. Tested with iPhone 5s with latest iOS version.

lukaskotik avatar Mar 06 '17 22:03 lukaskotik

For me too. IPhone5 (32bit) Godot version: 2.1.2

sanja-sa avatar Mar 16 '17 10:03 sanja-sa

Hope this bug will be fixed pretty soon. I've had some private messages from some user downloading the app.

florix91 avatar Apr 04 '17 16:04 florix91

any volunteer for fixing this? :pray:

volzhs avatar Apr 17 '17 14:04 volzhs

Hope this be fixed at least for the 3.0, users are starting to tell me about this problem and I can't really fix it by my own. I think we just have to wait a little bit.

florix91 avatar May 24 '17 06:05 florix91

Time to ping my de facto iOS expert @BastiaanOlij :P

akien-mga avatar May 24 '17 06:05 akien-mga

should be done with 2.1.x too, until 3.1 out which support opengl es 2.

volzhs avatar May 24 '17 09:05 volzhs

I'll see if I can reproduce this over the weekend. I've noticed the compiler complaining about deprecated calls relating to the pausing and re-awaking of the application. I'll start looking into what those calls should be and whether it is pausing the audio stream correctly. Have to admit, not my forte but hey, I'll learn something new.

Also note on a side note that Apple is ending support for the 32bit architecture in iOS. Didn't realise the iPhone 5 was still a 32bit device and you need a 5S or 6 to use the 64bit architecture. You can still create a universal binary with both 64bit and 32bit binaries but I've been having a bunch of issues with compiling Godot 3 on 32bit because some of the newer APIs no longer have 32bit support. Thats worth investigating further as well but I think that will eventually become a dead end. Apple is not known for maintaining backwards compatibility over more then 2 generations.

BastiaanOlij avatar May 24 '17 11:05 BastiaanOlij

first of all, I really appreciate you will do some research on it. :) I don't know about architecture distribution about iOS. but still needs open gl es 2 spec for supporting almost mobile devices for now. (iOS and Android) I barely know about iOS but is bits related with handling sound problem?

volzhs avatar May 24 '17 14:05 volzhs

@volzhs no it just has to do with the CPU in the phone and Apple forcing us poor developers to move on.... :)

Just did a bit of reading. iPhone indeed forces playback to pause on a call, it then sends a audioPlayerBeginInterruption notification to the application.

Once the call is finished a audioPlayerEndInterruption notification is given BUT iOS leaves it up to the app to decide whether playback should resume.

Neither notifications are implemented in Godot so I suspect that is why playback isn't resumed.

Still looking into where the notifications need to be added, probably the application delegate, and whether I can just force it to resume playing or not.

More info: https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/HandlingAudioInterruptions/HandlingAudioInterruptions.html

BastiaanOlij avatar May 25 '17 07:05 BastiaanOlij

btw this can also be tested by starting Siri. there might be some code that deals with this in the native video functions, I remember something about playback being interrupted sometines

On 25 May 2017 at 04:38, Bastiaan Olij [email protected] wrote:

@volzhs https://github.com/volzhs no it just has to do with the CPU in the phone and Apple forcing us poor developers to move on.... :)

Just did a bit of reading. iPhone indeed forces playback to pause on a call, it then sends a audioPlayerBeginInterruption notification to the application.

Once the call is finished a audioPlayerEndInterruption notification is given BUT iOS leaves it up to the app to decide whether playback should resume.

Neither notifications are implemented in Godot so I suspect that is why playback isn't resumed.

Still looking into where the notifications need to be added, probably the application delegate, and whether I can just force it to resume playing or not.

More info: https://developer.apple.com/library/content/documentation/ Audio/Conceptual/AudioSessionProgrammingGuide/HandlingAudioInterruptions/ HandlingAudioInterruptions.html

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/7905#issuecomment-303945141, or mute the thread https://github.com/notifications/unsubscribe-auth/AGVmPStbhz8ZSe5nI2eOBtUzCH3WA9aUks5r9S_fgaJpZM4MN47Q .

punto- avatar May 25 '17 07:05 punto-

@punto- there is code for pausing video when the app looses focus. I'm still trying to piece together how this is supposed to work, I have not dealt with this part of iOS before :)

BastiaanOlij avatar May 25 '17 07:05 BastiaanOlij

I think the problem was that playback was paused when headphones are plugged or unplugged during the video, and we just force resume it, but those callbacks you mention don't ring a bell, so it might have been something else triggering the pause

On 25 May 2017 at 04:51, Bastiaan Olij [email protected] wrote:

@punto- https://github.com/punto- there is code for pausing video when the app looses focus. I'm still trying to piece together how this is supposed to work, I have not dealt with this part of iOS before :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/7905#issuecomment-303947302, or mute the thread https://github.com/notifications/unsubscribe-auth/AGVmPcM_6sv-MgM_7qgJfOTq-tDFuMPZks5r9TLngaJpZM4MN47Q .

punto- avatar May 25 '17 08:05 punto-

See #8916 which would fix this issue.

akien-mga avatar May 26 '17 07:05 akien-mga