Skip to main content
StephanMuellerAT
Participant
October 17, 2015
Question

Background Audio

  • October 17, 2015
  • 1 reply
  • 681 views

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:

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

Main.as:

  1. NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
  2. NativeApplication.nativeApplication.executeInBackground = true;
  3. 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!

This topic has been closed for replies.

1 reply

StephanMuellerAT
Participant
October 29, 2015

Wow, thanks Adobe for your support. /sarcasm off

Anki_AG_
Adobe Employee
Adobe Employee
October 30, 2015

Thanks for reporting the issue. We are looking into it.

Thanks,

Adobe Air Team