Questions tagged [mpmusicplayercontroller]

Use an MPMusicPlayerController object, or music player, to play media items from the device iPod library.

Use an object, or music player, to play media items from the device iPod library. There are two types of music player:

  • The application music player plays music locally within your app. It is not aware of the iPod app’s now-playing item, nor does it affect the iPod state.

  • The iPod music player employs the built-in iPod app on your behalf. On instantiation, it takes on the current iPod app state, such as the identification of the now-playing item. If a user switches away from your app while music is playing, that music continues to play. The iPod app then has your music player’s most recently-set repeat mode, shuffle mode, playback state, and now-playing item.

External Resources

374 questions
8
votes
1 answer

beginReceivingRemoteControlEvents not triggering events for Apple Music

I am playing Apple Music from my application , the apple music player code is as - -(void) submitAppleMusicTrackWithProductID: (NSString *) productID // productID in US is the last numbers after i= in the share URL from Apple Music { …
Anupam Mishra
  • 3,408
  • 5
  • 35
  • 63
8
votes
3 answers

Audio Session "Ducking" Broken in iOS 4...?

I've an app which uses the MPAudioPlayerController to access the iPod music library, and an AVAudioPlayer to overlay audio on top of the music. I've used this documentation as a guide. Specifically: Finally, you can enhance a category to…
levigroker
  • 2,087
  • 1
  • 21
  • 30
8
votes
2 answers

Background Audio and Remote Control Support using MPMusicPlayerController on iOS 4. Is this even possible?

I've spent two days on this and have gotten nowhere. I'm trying to use [MPMusicPlayerController applicationMusicPlayer] to play audio chosen from the user's iPod library and have it run in the background as well as support remote events. Now…
8
votes
1 answer

Can I get an audio session / apply audio units to playback from MPMusicPlayerController?

I'd like to take control of the audio coming from MPMusicPlayerController (i.e., playing from the iPod library). For example, I'd like to apply EQ to it or do DSP, reverb, that kind of thing. Is this possible? Is there an audio session that I can…
Simon Woodside
  • 7,175
  • 5
  • 50
  • 66
8
votes
4 answers

iOS7 MPMusicPlayerController states incorrect

I have an iOS7 application with music player. I'm using the following code to check playback state changes from the MPMusicPlayerController to update the UI. More precisely I toggle the look of the play button between play and…
swifferina
  • 293
  • 4
  • 16
7
votes
1 answer

How do I make my app work with the media control buttons on lock screen?

In recent iOS versions apps have some kind of access to the media control buttons on the lock screen, like the Play/Pause button: It looks like the buttons are supposed to work with the MPMusicPlayerController class, is that right? Is there a way…
zoul
  • 102,279
  • 44
  • 260
  • 354
7
votes
1 answer

Strange behavior of MPMusicPlayerController.currentPlaybackTime

While a song is being played, I tried to get currentPlaybackTime. NSLog(@"Playback: %f", appDelegate.appMusicPlayer.currentPlaybackTime); I always got "Playback: nan". The application gets the currentPlaybackTime correctly when running (not…
NorThanapon
  • 103
  • 1
  • 8
7
votes
0 answers

MPCPlayerRequestErrorDomain Code=1000 "Failed to send command 0"

let cloudServiceController = SKCloudServiceController() let musicPlayer = MPMusicPlayerController.systemMusicPlayer self.cloudServiceController.requestCapabilities { capabilities, error in guard…
Ninj
  • 71
  • 4
7
votes
4 answers

MPMusicPlayerController slow to respond when systemMusicPlayer, fast when application

I have a music app that uses the MPMusicPlayerController. I originally wrote it using the systemMusicPlayer option under iOS 9. I had some trouble with the player not shutting down correctly under certain circumstances so I switched to the…
wayneh
  • 4,393
  • 9
  • 35
  • 70
7
votes
1 answer

MPMusicPlayer Error Domain=MPErrorDomain Code=4?

I am having issue with Music player, most of the songs gives Error Error Domain=MPErrorDomain Code=4 The testing device has Apple music subscription and the tracks gives error on the app they are working fine in Apple music app! Here is the…
Kodr.F
  • 13,932
  • 13
  • 46
  • 91
7
votes
0 answers

iOS 9.3.2 Breaks MPMusicPlayerController

I'm trying to integrate Apple Music to my app, I managed to get it working flawlessly until this morning. After updating to iOS 9.3.2 nothing is the same: The permission system works the same (SKCloudServiceController) to retrieve the…
iMart1n
  • 71
  • 4
7
votes
2 answers

How to stop MPMusicPlayerController from playing when application terminate by user?

I have the following situation in my application: I have a music system in my application and I used MPMusicPlayerController to play music; every thing is working fine until now. My problem: When a user starts playing music in my application and…
Chirag Shah
  • 3,034
  • 1
  • 30
  • 61
7
votes
1 answer

Current playback queue for MPMusicPlayerController?

I realize that there's two ways to set the playback queue (with a query or with a collection of MPMediaItems), but once this has been done, is there a way to access the queue on MPMusicPlayerController without having to retain it myself? I'd like…
Mark
  • 7,167
  • 4
  • 44
  • 68
6
votes
1 answer

iOS: Displaying currently played track info in LockScreen?

As of iOS 5 we have access to MPNowPlayingInfoCenter to display info in the lockscreen and in the multimedia controls on the multitasking bar. I have an app that plays local audio files. I want to display info like the artist's name, the album and…
Alex1987
  • 9,397
  • 14
  • 70
  • 92
6
votes
0 answers

How to detect the end of a song in MusicKit?

I am attempting to use Apple's Music Kit within my application to listen to music. My issue is that the first song that plays will continually repeat. The first song plays correctly by using the following code: let mediaArray =…
1
2
3
24 25