Background Audio
Hi,
I'm using Flex 4.6.0 / AIR 18.0 for creating a radio app for independent radio stations. Therefore, the feature of continuing playback of an mp3 stream when deactivating the app is a must. This can be achieved by the following settings (not a single thing can be different, otherwise playback just fades out when the app is deactivated/suspended):
application.xml:
- <key>UIBackgroundModes</key><array><string>audio</string></array>
Main.as:
- NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
- NativeApplication.nativeApplication.executeInBackground = true;
- SoundMixer.audioPlaybackMode = AudioPlaybackMode.MEDIA;
MyStreamPlayer.as:
- Sound() object
- SoundTransform() object
- URLRequest() object
- (If somebody needs a code snippet, let me know.)
When playing back the stream (no matter if the app is in background or active) and a call comes in, the stream is paused/silenced during that time. Exactly how it has to be.
The only weird thing about the behaviour is that when I leave the app (that continues playback) and, for example, go to iTunes and play a track, the iTunes track is played simultaneously to / over my my app's mp3 stream. My problem is that I don't know whether Apple is gonna reject my app because of this.. Because with other (I guess native) radio apps, this is not the case. Their stream stops when playing a track in iTunes after deactivating the radio app, and I have no clue how to achieve this because as I said in the beginning, the settings have to be exactly as mentioned above so playback doesn't stop when entering the background.
Can anybody help? Thanks!
