Handling audio playback in app-background mode

109 views
Skip to first unread message

Mark Anderson

unread,
Mar 8, 2013, 10:02:50 AM3/8/13
to objectal-...@googlegroups.com
Hi everyone,

Question regarding the playback of audio when a user didEnterBackground:

How is this handled in ObjectAL? Is there a way to continue playback of audio when the user didEnterBackground AND/OR if the user turns the phone off? I.e similar behavior to iPod playback/ music playlist app?

Thanks!

Mark

boblemarin

unread,
Nov 4, 2013, 5:27:35 AM11/4/13
to objectal-...@googlegroups.com
Hi all,

I'm looking for the exact same thing, but with no luck.
Has anybody found a way to do app-background audio with ObjectAL ?

(In my case, I'm trying to listen to inter-app MIDI messages and play audio files while in background)

Thanks...

Joel Davis

unread,
Jun 9, 2015, 12:52:13 PM6/9/15
to objectal-...@googlegroups.com, comodo....@gmail.com
I realize that I'm replying to a old post, but I just ran into the same issue myself and this is what comes up when I search for this. It turns out to be quite simple, but hard to figure out for me.

To get background audio you need to do two things:

1) In your plist (in Xcode, choose Target->Capabilities), enable the BackgroundMode flag for "Audio and Airplay"
2) before you start using audio, do this:


[OALAudioSession sharedInstance].audioSessionCategory = AVAudioSessionCategoryPlayback;

(you may want to look at some of the other AVAudioSessionCategories, there might be a better fit).


I'm not sure if there is another more low-level background mode, but this was enough for me to get audio to continue when the phone is locked or if you're switching to other apps.


joel
Reply all
Reply to author
Forward
0 new messages