且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在播放AVPlayer时开始播放歌曲或识别出歌曲已完成?

更新时间:2023-12-02 16:35:52

为了回答你的第一个问题,你可以使用Notification作为

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;
}