Highlighted

iOS Background audio activity changes between debug and publish version

New Here ,
Feb 02, 2016

Copy link to clipboard

Copied

I would like to get some help with a problem that I am experiencing when going from debug to publish version of the app. I am using Apache Flex 4.15 and Flash Builder 4.7. The app also uses a native extension to set the audio session category. The native extension was compiled using Apache Flex 4.15.0 sdk as well.

Initially there was a problem with the app not being able to play audio when the app is pushed to the background or the screen is locked. We struggled with this problem for a long time, but finally figured out that contrary to what many Adobe documents state, in order to actually stream HLS content in the background, it is not enough to just set the following key

<key>UIBackgroundModes</key>

            <array>               

               <string>audio</string>

            </array>

As stated by Apple audio session programming guide, the app must also set the proper audio session category. In our case, we set it in the native extension as follows

BOOL success = [[AVAudioSession sharedInstance]

                   

                    setCategory: AVAudioSessionCategoryPlayback

                   

                    error: &setCategoryError];

With these two settings in place, audio continues uninterrupted when the screen is locked (by user or timer), the app is pushed in the background, or the silent ring is set to silent.

We have also written some logic that causes the app to play the next track when one track completes streaming.

When debugging on an iOS device, when the app is pushed to the background or screen is locked, tracks switch as expected. But not when we compile the code for store publishing. We are puzzled as to why tracks switch fine when debugging but not when app is compiled for publishing. What could be causing this change in behavior? Any thoughts would be greatly appreciated.

TOPICS
Performance issues

Views

231

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

iOS Background audio activity changes between debug and publish version

New Here ,
Feb 02, 2016

Copy link to clipboard

Copied

I would like to get some help with a problem that I am experiencing when going from debug to publish version of the app. I am using Apache Flex 4.15 and Flash Builder 4.7. The app also uses a native extension to set the audio session category. The native extension was compiled using Apache Flex 4.15.0 sdk as well.

Initially there was a problem with the app not being able to play audio when the app is pushed to the background or the screen is locked. We struggled with this problem for a long time, but finally figured out that contrary to what many Adobe documents state, in order to actually stream HLS content in the background, it is not enough to just set the following key

<key>UIBackgroundModes</key>

            <array>               

               <string>audio</string>

            </array>

As stated by Apple audio session programming guide, the app must also set the proper audio session category. In our case, we set it in the native extension as follows

BOOL success = [[AVAudioSession sharedInstance]

                   

                    setCategory: AVAudioSessionCategoryPlayback

                   

                    error: &setCategoryError];

With these two settings in place, audio continues uninterrupted when the screen is locked (by user or timer), the app is pushed in the background, or the silent ring is set to silent.

We have also written some logic that causes the app to play the next track when one track completes streaming.

When debugging on an iOS device, when the app is pushed to the background or screen is locked, tracks switch as expected. But not when we compile the code for store publishing. We are puzzled as to why tracks switch fine when debugging but not when app is compiled for publishing. What could be causing this change in behavior? Any thoughts would be greatly appreciated.

TOPICS
Performance issues

Views

232

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
Feb 02, 2016 0

Have something to add?

Join the conversation