Skip to main content
Pouradam
Inspiring
February 14, 2014
Answered

Looks impossible for an iOS Air App to play audio in standby!?

  • February 14, 2014
  • 1 reply
  • 2580 views

Hi there!

I have started this thread first in here:

http://forums.adobe.com/message/6095789

It appears so far (Air 4.0.0.1240) it is not yet possible for an Air Application to keep playing Audio files in background when iOS device enters STANDBY (pressing power button).

As far as I know, what an Air application CAN DO in this case is that:

1- you include this code in the Main class/Timeline of your Flash app:

import flash.desktop.NativeApplication;

NativeApplication.nativeApplication.executeInBackground = true;

2- add this code to the XML file:

...

<iPhone>

<InfoAdditions>

      <![CDATA[

          <key>UIBackgroundModes</key>

          <array>

                     <string>audio</string>

          </array>

          <key>UIDeviceFamily</key>

          <array>

                    <string>1</string>

                    <string>2</string>

          </array>

       ]]>

</InfoAdditions>

</iPhone>

...

Now your App has the ability of keep playing Audio files in Background (when iOS App is minimized, by pressing the HOME button).

BUT as soon as the device enters standby mode (i.e by pressing the POWER button) Audio playback Pauses/Stops!

So why is this feature needed?! well there are LOTS of "Audio player Apps" available (written in JAVA) they do continue playing the Audio in standby.

Imagine your App users need to listen to a long streaming audio file (such as an speech, mp3 etc.). what should they do??

you CAN prevent their device from going to Standby and let them listen the whole thing, But the question is whether they like to spend their whole battery on your App or not?!!?  

I suppose the key to solve this iissue is by finding a method to activate/use iOS "AVAudioSessionCategoryPlayback" class. is that possible already?!

Thanks a lot for your time and I highly hope someone out there tell me Hey! you are wrong! here is the solution...

Kind Regards,

       Ali

Technical details))

Adobe Flash Pro cs6

Air 4.0.0.1240 for ios

tested on Ipad 2/IPhone 5 (iOS 7)

tested with All cpu render mdes(Direct,GPU,CPU)

This topic has been closed for replies.
Correct answer Colin Holgate

Should I be Happy or Sad?! It worked perfectly without changing a line of Code with Air 3.7 as you said

Are you sure I can not submit that to Apple with Air 3.7?????!!!!


In order to be able to submit to Apple you must be using 4.0.0.1619 or later, and in December there were fixes to do with background audio (although that was for Android). The version you’re using is earlier than December.

So, get the version from here:

http://labs.adobe.com/downloads/air.html

and then to see if it’s fixed.

1 reply

Wolfgang Klopf
Inspiring
February 14, 2014

Maybe that's a bug in Air 4.0.0.1240. This app, compiled with Air 3.7 plays audio in the background without any problem:

https://itunes.apple.com/us/app/singapore-symphony-orchestra/id515675324?mt=8

Pouradam
PouradamAuthor
Inspiring
February 14, 2014

WOW!!!  your App is REALLY working I see!! I will check that out right now. The only problem exist with adobe Air 3.7 as far as I remember is that it ask user "this App wants to use your microphone". right?

But anyways, that is a small thing!

I will give it a try right now and will update this post shortly....

Thank youuuuuu so muchhhhhh.....will be right back

Colin Holgate
Inspiring
February 14, 2014

Before you get too excited, you won’t be able to submit an app using AIR 3.7. What you could do though is just switch from 4.0 to 3.7, and see if your app then works. Hopefully it won’t work, and there will be a setting that you have wrong. If it does work in 3.7 without you doing anything different, then AIR 4.0 needs fixing before you’ll be able to submit.