How can I replace the iPod with my application icon when my application plays audio in the background?

I (and you) know how to play audio in the background.

But my question is, some music apps replace the iPod icon, which appears on the first page of the help application with an icon when they play sound in the background.

How can i do this?

+3
source share
2 answers

We can do this using AudioSession as the following code.

AudioSessionInitialize (
                         NULL,    // 'NULL' to use the default (main) run loop
                         NULL,    // 'NULL' to use the default run loop mode
                         NULL,    //  a reference to your interruption callback
                         NULL     //  data to pass to your interruption listener callback
                              );

UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty ( kAudioSessionProperty_AudioCategory, sizeof (sessionCategory), &sessionCategory );
AudioSessionSetActive(true);
+1
source

Here's the documentation:

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/RemoteControl/RemoteControl.html

, , .

AVAudioSession AVAudioSessionCategoryPlayback AVAudioPlayer, " " , AVAudioSession AVAudioPlayer.

0

Source: https://habr.com/ru/post/1759794/


All Articles