Question

I am wondering if it would be possible to insert your own audio once the ios media library has taken over in an app?

Example: Playing a piece of audio after every song that says the number of songs you've listened to that day.

I know that because its a framework there is only so many things they let you do.

Was it helpful?

Solution

This should be doable. To start, you can add your class as an observer of the MPMusicPlayerControllerNowPlayingItemDidChangeNotification to be informed when the song in the iPod library changes. From there, you can tell the iPod library to pause, play your track, and then resume music playback afterwards.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(someSel:) name:MPMusicPlayerControllerNowPlayingItemDidChangeNotification object:nil];


[[MPMusicPlayerController iPodMusicPlayer] pause];
    // play your sound
[[MPMusicPlayerController iPodMusicPlayer] play];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top