开发者

How to start next a Song or recognized that a song is finished while playing with AVPlayer?

开发者 https://www.devze.com 2023-04-04 00:59 出处:网络
How can I start next song immediately with AVPlayer? I have 开发者_如何学编程collections of song selected from iPod Library in MPMediaItemCollection.

How can I start next song immediately with AVPlayer? I have 开发者_如何学编程collections of song selected from iPod Library in MPMediaItemCollection.

Now how can i use AVPlayer for lists of songs to be played one by one??


For answer to your first question, You can use Notification for the same as

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(songFinished:)
                                             name:AVPlayerItemDidPlayToEndTimeNotification
                                           object:[yourAVPlayer currentItem]];

-(void)songFinished:(NSNotification *)notification
{
     //Do your next stuff here;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消