Highlighted

AIR 33 - iOS audio stops working after "interruption"

Contributor ,
Dec 03, 2019

Copy link to clipboard

Copied

Hi All,

 

This problem - reported and solved in AIR 26 - has reappeared in AIR 33: https://community.adobe.com/t5/air/audio-stops-working-after-receiving-call-on-ios/m-p/9152207#M4843...

 

In my Apache Flex app (Flex 4.16, AIR 33) running on iOS, all audio stops working if/when the user receives a phone call, if the phone just rings once, if a clock alarm goes off, etc.

 

If the user then leaves the app, i.e. presses the phone's home key, then returns, the problem goes away.

 

This is happening any time my app is 'interrupted', to use Apple's terminology. An interruption can consist of a phone call, an iPhone Clock app alarm going off, etc. I'm not a native iOS programmer, but my googling suggests that in the native iOS world apps listen for an AVAudioSessionInterruptionNotification to find out when these interruptions occur.

 

I've created bug reports in both the Adobe and Gamua bug databases ...
https://tracker.adobe.com/#/view/AIR-4198886
https://github.com/Gamua/Adobe-Runtime-Support/issues/161

... and have attached a minimal sample app to the Adobe bug report that demonstrates the problem.

 

At risk of stating the obvious .... this is a BIG problem!

 

If you're experiencing this problem please vote for the Adobe bug, add comments to the bugs, and/or reply to this post.

 

And, of course, if you have thoughts regarding a fix that can be implemented in my code, I'd love to hear about it.  🙂

 

Thanks,

 

Douglas

TOPICS
Development

Views

636

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

AIR 33 - iOS audio stops working after "interruption"

Contributor ,
Dec 03, 2019

Copy link to clipboard

Copied

Hi All,

 

This problem - reported and solved in AIR 26 - has reappeared in AIR 33: https://community.adobe.com/t5/air/audio-stops-working-after-receiving-call-on-ios/m-p/9152207#M4843...

 

In my Apache Flex app (Flex 4.16, AIR 33) running on iOS, all audio stops working if/when the user receives a phone call, if the phone just rings once, if a clock alarm goes off, etc.

 

If the user then leaves the app, i.e. presses the phone's home key, then returns, the problem goes away.

 

This is happening any time my app is 'interrupted', to use Apple's terminology. An interruption can consist of a phone call, an iPhone Clock app alarm going off, etc. I'm not a native iOS programmer, but my googling suggests that in the native iOS world apps listen for an AVAudioSessionInterruptionNotification to find out when these interruptions occur.

 

I've created bug reports in both the Adobe and Gamua bug databases ...
https://tracker.adobe.com/#/view/AIR-4198886
https://github.com/Gamua/Adobe-Runtime-Support/issues/161

... and have attached a minimal sample app to the Adobe bug report that demonstrates the problem.

 

At risk of stating the obvious .... this is a BIG problem!

 

If you're experiencing this problem please vote for the Adobe bug, add comments to the bugs, and/or reply to this post.

 

And, of course, if you have thoughts regarding a fix that can be implemented in my code, I'd love to hear about it.  🙂

 

Thanks,

 

Douglas

TOPICS
Development

Views

637

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 03, 2019 0
Enthusiast ,
Dec 03, 2019

Copy link to clipboard

Copied

This definitely is a problem, but I don't think AIR 33 is updated for iOS yet (https://airsdk.harman.com/assets/pdfs/Release_Notes_AIR_SDK.pdf). 

I still use AIR 32 for my apps.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 03, 2019 0
Contributor ,
Dec 03, 2019

Copy link to clipboard

Copied

Hi Lars_Laborious,

 

The reason I'm using AIR 33 for iOS is that I get the following error when I build with AIR 32 and attempt to upload my app with Application Loader (on Mac):

 

ERROR ITMS-90503: "Invalid Bundle. You've included the "arm64" value for the UIRequiredDeviceCapabilities key in your Xcode project, indicating that your app may only support 64-bit. Your binary, 'com.brightworks.LangMentor.deu', must only contain the 64-bit architecture slice. Learn more , (https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Ar...)."

 

Using AIR 33 solves this. So it seems that Harmon is doing a bit of work on the iOS side of AIR.

 

Their documentation is contradictory. On the one hand, their FAQ page says "HARMAN have released “version 33” which initially is only for Android platforms". On the other hand, the release notes for AIR 33.0.2.330 say "addresses an issue with packaging for iOS devices that had been present in the previous two releases". And if you read on ...

 

https://airsdk.harman.com/assets/pdfs/Release_Notes_AIR_SDK.pdf

 

... you'll see that the fix seems to relate to the error that I'm getting.

 

So it seems that I have to use AIR 33 for iOS if I'm developing on a Mac...  (?)

 

Douglas

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 03, 2019 0
Enthusiast ,
Dec 04, 2019

Copy link to clipboard

Copied

Ah, I missed that part. I'm using PC so the issue haven't occured for me on AIR 32. 

Hopefully they will fix the AIR 33 sound problem soon.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 04, 2019 0
Engaged ,
Dec 04, 2019

Copy link to clipboard

Copied

We're having issues with Video on iOS -- audio refuses to play via the built in speaker - and only plays via headphones..  Not sure if this is related but interested to know if you get audio via headphones without having to press home and reopen the app?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 04, 2019 0
Contributor ,
Dec 05, 2019

Copy link to clipboard

Copied

Hi Dews,

 

interested to know if you get audio via headphones without having to press home and reopen the app?

 

Just checked - I get the same problem whether I'm using headphones of the phone's speaker.

 

Douglas

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 05, 2019 0
Contributor ,
Dec 11, 2019

Copy link to clipboard

Copied

So far, I haven't found any solution for this. I assume that Harmon needs to make a fix. Does anyone know if there is any way to find out whether they've noticed these posts, or the bug reports that I've created?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2019 0
Contributor ,
Dec 13, 2019

Copy link to clipboard

Copied

Ack...  It looks as though all I needed to do was this:

SoundMixer.audioPlaybackMode = AudioPlaybackMode.AMBIENT;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2019 0
Engaged ,
Dec 15, 2019

Copy link to clipboard

Copied

Ty Douglas -- good news for us too - the issue appears to have gone away but I'm not seeing mention in any of the release notes since the builld we were using.  Anyway, not going to look a gift horse in the mouth though, just happy playback appears to be normal.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 15, 2019 0
Enthusiast ,
Dec 16, 2019

Copy link to clipboard

Copied

One thing to note though, is that using SoundMixer.audioPlaybackMode = AudioPlaybackMode.AMBIENT means that the sound can be toggled off  by using the sound switch on the side of iPhones and old iPads or the virtual sound icon (swipe up from the bottom or down from the top right corner on newer iPads).

 

This could be what you want, but you might get feedbacks from users who don't know why there is no sound in your app. That happened to me quite a few times, and each time I had to explain that perhaps they've just toggled the switch off. So, after a few bad reviews because of "lacking sound", I've stopped using that code.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 16, 2019 0
Contributor ,
Dec 16, 2019

Copy link to clipboard

Copied

Hi Dews & Lars_Laborious,

 

Dews - I'm not sure what you mean by "the issue seems to have gone away". At first I thought that you meant that it had been fixed in the latest version, but I've just downloaded AIR 33.0.2.338 - the current version - and I'm still seeing the problem. Perhaps you meant that my AudioPlaybackMode.AMBIENT fix made it go away?

 

Lars_Laborious - You're right - there will be users who want to use my app while their ringers are turned off. So this isn't an ideal solution - it's just a smaller problem.  🙂   Is there a way to detect a hardware switch toggle? If I can do that, I can at least alert my users when they try to play audio.

 

Douglas

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 16, 2019 0
Contributor ,
Dec 16, 2019

Copy link to clipboard

Copied

One more note - AudioPlaybackMode.AMBIENT combined with "hardware switch off" turns off the audio if one is listening via the phone's speaker, but not if listening via earphones.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 16, 2019 0
Enthusiast ,
Dec 16, 2019

Copy link to clipboard

Copied

I haven't tried it but Distriqt has an ANE that detects system volume events: https://airnativeextensions.com/extension/com.distriqt.Volume

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 16, 2019 1
Contributor ,
Dec 19, 2019

Copy link to clipboard

Copied

Yes, thanks Lars_Laborious, it looks as though the Distriqt Volume ANE would do the trick. 

 

I couldn't find the documentation for this feature, so I emailed Michael at Distriqt and he sent me this link - https://distriqt.github.io/ANE-Volume/u.Silent%20Switch. He also explained that a call to Volume.service.monitorMuteState(true) starts a background process which checks the state of the mute button once per second, and sends out a change state event if the state has changed. Also, a call to isMuted() will trigger a check, which will occur within 300 ms.

 

I'm going to wait a bit before I implement this workaround, and hope that Harman fixes this bug, but it's good to know that there's an at-least-semi-acceptable solution for this.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2019 0
Contributor ,
Dec 19, 2019

Copy link to clipboard

Copied

It looks like I may have found a solution, at least for those of us using the Flex framework.

 

This seems to work in my app:

 

NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE,onActivateApp);
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE,onDeactivateApp);

private function onActivateApp(event:Event):void {
   SoundMixer.audioPlaybackMode = AudioPlaybackMode.MEDIA;
}

private function onDeactivateApp(event:Event):void { 
   SoundMixer.audioPlaybackMode = AudioPlaybackMode.AMBIENT;
}

 

I'm not sure how one would get app-activate and app-deactivate events if one isn't using the Flex framework, but hopefully, there is some way to do this.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2019 0
Engaged ,
Dec 19, 2019

Copy link to clipboard

Copied

For me, at some stage, the mute button on or off, made no difference, I could only hear audio through the headphones.  By fixed, I mean currently, audio works as expected.  The only issue is that the mute switch does mute the audio.

 

It doesn't seem to make a difference what SoundMixer.audioPlaybackMode I set - a can always hear audio via headphones regardless of the mute switch position - just through the speakers of the phone - the mute switch, mutes the audio.  Phone calls, or minimizing the app pauses our video/audio - and opening Pandora for example, then maximizing our App, the audio continues as expected after clicking play again..  I'm using Feathers SDK 4.0/AIR 33

 

So the Distriq ANE solves this or just gives us access to the state of the mute switch so we can at least alert our users?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2019 0
Contributor ,
Dec 19, 2019

Copy link to clipboard

Copied

> So the Distriq ANE solves this or just gives us access to the state of the mute switch 

 

It just gives us access to the state of the mute switch.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 19, 2019 1
Contributor ,
Dec 26, 2019

Copy link to clipboard

Copied

I'm sorry to report that the possible solution I reported above, i.e. setting SoundMixer.audioPlaybackMode when the app deactivates and activates isn't working reliably. At first, it seemed to work. Now, it doesn't seem to work at all. Sigh.

 

So at this point our best options seem to be to a) hope that Harman fixes this soon, or b) keep audioPlaybackMode set to AMBIENT, and use the Distriqt Volume ANE, and show an alert any time the mute button is turned on.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 26, 2019 1