FAQ Database Discussion Community

Does Media Player Framework need audio sessions to be managed?

I'd like to include a simple media player in my iOS 7+ app, and I've found some posts dealing with Media Player Framework and the MPMusicPlayerController, and I think that can meet my needs. However, I couldn't find the related documentation in Apple's docs, and instead I found that there...

Play Audio from other apps

So when I launch my app, I want to be able to tell when music from another app is playing (system, soundcloud, pandora, spotify, etc). I am able to do so with this: BOOL isOtherAudioPlaying = [[AVAudioSession sharedInstance] isOtherAudioPlaying]; if (isOtherAudioPlaying){ NSLog(@"Playing Music"); }else{ NSLog(@"Not Playing Music"); } And I...

Play music through ear speaker from user library

I'm making an app that allows the user to choose a music from his/her library and play it through the ear speaker. I got everything working, but this. I don't know how to play this audio through the ear speaker. The code I'm using to lay the audio is: let...

How to clear queue of MPMusicPlayerController and add new queue when Song finished according to requirement

After every song is finished I'm clearing the queue and then adding a new queue. However, the notification (playing/paused/stopped/playing/paused/playing/paused/paused) is called multiple times. It eventually stops the audio within the app and starts playing from iTunes. Can anyone help me with this? -(void)clearqueueAndAddNewQueue { NSMutableArray *allTheSongs = [[NSMutableArray alloc] initWithCapacity:0];...

Alertview when song is unavailable

I have a nice little query that when a user clicks a "play button," a title is called and if the song of that title exists in their iTunes, the song begins playing. I'm stuck now because I am not sure how to show an alertview when the song doesn't...

Get current position of MPMusicPlayer

I was wondering how to get the current position of an MPMusicPlayer. For example, if the music player is playing a song and it is currently at 0 minutes 23 seconds, how would I get that value as well as set it?

ios - How to play MPMediaItemCollection?

So, I already stored few mpmediaitemcollection in NSUserDefaults. I already retrieve it on UICollectionView. here is my code: func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { self.performSegueWithIdentifier("toList", sender: self) User.mdci = decodedPlaylistData[indexPath.row] as? MPMediaItemCollection getSongListInfo((decodedPlaylistData[indexPath.row] as? MPMediaItemCollection)!) MPMusicPlayerController().setQueueWithItemCollection((decodedPlaylistData[indexPath.row] as?...

How to play song URL on MPMusicplayerController?

So I want to play song using it's url using MPMusicPlayer. I already able to populate music info from MPMediaCollection to UITableView. What I want to do is when I tap tableview row it play song that have the same title in the tableview row. Here is my code how...