Adobe Air on iPhone issue when phone rings

Hi there,

My app has a section for playing audio:

chnl = new SoundChannel();
mp3 = new Sound();
mp3.addEventListener(IOErrorEvent.IO_ERROR, onErr);
mp3.addEventListener(Event.COMPLETE, onComplete);
mp3.load(new URLRequest(fil.url));

While the sound is playing if the phone rings (or an alarm is activated), then the application stops playing, that is normal. But when I try to re-play the audio, it does not work anymore unless I close and re-open the app.

This does not happen if I minimize the app and re-launch it, or the phone rings on Android. It just happens on iPhone.

As a workaround, when I add this line:

SoundMixer.audioPlaybackMode  =  AudioPlaybackMode.VOICE;

The problem will solve! However, the audio will then only play through the earpiece, and not the Speaker. Even if I set:

SoundMixer.useSpeakerphoneForVoice = true;

Any ideas, please??

please read If you ask for help about code

not giving the AIR version you’re testing with is definitively a blocker

because you mention

not giving the iOS version you’re targeting does not help either

also you should definitively (re)read the doc for AudioPlaybackMode

it may be a bug in the implementation but the settings

SoundMixer.audioPlaybackMode  =  AudioPlaybackMode.VOICE;
SoundMixer.useSpeakerphoneForVoice = true;

does not make sense when you play media

you should try AudioPlaybackMode.MEDIA or AudioPlaybackMode.AMBIENT
but you didn’t say if you tried those

Thanks a lot for the reply and guidance.

Technical details:

SDK version (same issue with SDK 32.x)
iPhone 6S
iOS 14.0  (same issue on older versions)

I did not use:


because that is set by default.

When I use


the audio stops as soon as the app is not active, which is not what I want.

The same code works perfectly when compiled as APK, on Android (i.e when the phone rings)

I guess the main problem is because the “Deactivate” event does not fire when iPhone rings:
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivate);

It only fires when you press the Home button.

Is there a way that when the iPhone rings, we notice it through an event and execute code accordingly?


I’m not sure if there is a way to do this through AIR currently.

However you can use the our MediaPlayer ANE to detect audio interruptions and respond appropriately.

I have successfully stopped and resumed playback using the audio player in this extension.

1 Like

Thanks for the reply, yes you are absolutely right and we are currently using this same ANE in our apps, and with the help of this code:

_player.addEventListener(AudioPlayerEvent.INTERRUPTION_START, onCallStart);
_player.addEventListener(AudioPlayerEvent.INTERRUPTION_END, onCallStop);

we easily determine when the phone rings, and when it hangs, which is how we easily Pause and play the audio accordingly.

Due to the fact that in one of the upcoming iOS updates, there may be an unexpected problem with this ANE, we use air player as a fall back method.

So anyway, following your answer, I think there is no way to identify interruption Event without using an ANE, and on the other hand, since this method is a fall back if the ANE fails, it does not make sense to use the same ANE or another ANE to achieve that!

Maybe we should accept this as a problem with AIR player on iPhone.

Thank you very much for your guidance and for your time to respond. Good luck!

Okay, glad to hear you have already found this as a solution.

Can you clarify what you mean by “there may be an unexpected problem with this ANE”? If there is an issue with one of our extensions, please let us know and we will look into it.

1 Like

Oh sorry for the Misunderstanding, your ANEs are working all fine with no issues. Thank you very much for your efforts and pursuits. The prospect is that in the future, for example, a new iOS update “MAY” inadvertently cause a problem that is unknown to us. So far, even with beta 14, everything is working great! Thank you for your strong and hard-working team and wonderful ANEs.


admin edit:

@Yooni_Msh please use english for your messages
if you stay long enough on the forum you will be able to contact other users via private message