Background Audio Playback Support on iOS (Mobile)

With AIR 3, we are now able to inform iOS whether or not application audio should continue playing while the application is not in focus. We do this through manipulation of the AIR application descriptor file.

Locate the iPhone node within your descriptor file and within the InfoAdditions node, insert a new <key> with a value of “UIBackgroundModes”. Directly underneath this <key>, provide an <array> node with a <string> node nested within it. The value of this <string> node will be “audio”.

That’s all there is to it. Now compile to iOS as normal.

    <!-- iOS specific capabilities -->
    <iPhone>
        <InfoAdditions>
            <![CDATA[

                <key>UIDeviceFamily</key>
                <array>
                    <string>1</string>
                    <string>2</string>
                </array>

                <key>UIStatusBarStyle</key>
                <string>UIStatusBarStyleBlackOpaque</string>

                <key>UIRequiresPersistentWiFi</key>
                <string>YES</string>

                <key>UIBackgroundModes</key>
                <array>
                    <string>audio</string>
                </array>

            ]]>
        </InfoAdditions>
        <requestedDisplayResolution>high</requestedDisplayResolution>
    </iPhone>

This will enable any application audio to continue playback while our AIR for iOS mobile application runs in the background.

Get What's New in Adobe AIR 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.