lucaconlaq
lucaconlaq

Reputation: 1541

AVPlayer (video) + MPMusicPlayerController (music)

is it possible to play an instance of AVPLayer (with a video) and in the same time use an instance of a MPMusicPlayerController to play an iTunes playlist?

I've tried several solution but every time I play the video the audio stops and every time I play the audio the video stops.

I play the AVPlayer with this code

AVPlayerItem *new = [AVPlayerItem playerItemWithAsset:videoAsset];

self.playerItem = new;
[player replaceCurrentItemWithPlayerItem:self.playerItem];
[self.playerItem seekToTime:kCMTimeZero];


[player play]; 

and the MPMusicPlayer with:

MPMediaItemCollection *items = (MPMediaItemCollection*) aNotification.object;

MPMusicPlayerController *p = [[MPMusicPlayerController alloc] init];
[p setQueueWithItemCollection:items];
[p play];

Upvotes: 0

Views: 823

Answers (1)

lucaconlaq
lucaconlaq

Reputation: 1541

as solution I've used two AVPLayer one for the music and one for the video

Upvotes: 1

Related Questions