2016-08-31 58 views
0

我创建了一个名为DecryptAudioPlayer类,它继承NSObject的,这个类refrenced一个AVPlayer,并观察该通知AVPlayerItemDidPlayToEndTimeNotification时init.like如下:迅速AVPlayerItemDidPlayToEndTimeNotification不行

override init() { 
    super.init() 
    NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.playToEnd(_:)), name: AVPlayerItemDidPlayToEndTimeNotification, object: nil) 
} 

和我的方法:

func playToEnd(notification:NSNotification) { 
    Log.printLog("notification:\(notification)") 
} 

但有时玩家的奥尔无法recived的AVPlayerItemDidPlayToEndTimeNotification,我很confused.it似乎AVPlayerItem可能不张贴AVPlayerItemDidPlayToEndTimeNotification当其结束时间,谁CA呃告诉我为什么?

+0

您是否在初始化播放器后添加了观察者。当然, – pkc456

+0

。玩家被DecryptAudioPlayer欠下,我将观察添加到欠款中。 – czjeep

+0

在通知对象中添加播放器的currentItem –

回答

0

我可以得到停滞的通知来解决问题。所以这个问题可能会被搁置一段时间。