【问题标题】:How to start next a Song or recognized that a song is finished while playing with AVPlayer?使用 AVPlayer 播放时如何开始下一首歌曲或识别歌曲已结束?
【发布时间】:2011-09-12 10:51:49
【问题描述】:

如何使用 AVPlayer 立即开始下一首歌曲?我有从MPMediaItemCollection 的 iPod 库中选择的歌曲集。

现在我如何使用 AVPlayer 来一一播放歌曲列表??

【问题讨论】:

    标签: iphone objective-c ios avplayer avqueueplayer


    【解决方案1】:

    对于您的第一个问题的答案,您可以使用通知与

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(songFinished:)
                                                 name:AVPlayerItemDidPlayToEndTimeNotification
                                               object:[yourAVPlayer currentItem]];
    
    -(void)songFinished:(NSNotification *)notification
    {
         //Do your next stuff here;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多