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呃告诉我为什么?
您是否在初始化播放器后添加了观察者。当然, – pkc456
。玩家被DecryptAudioPlayer欠下,我将观察添加到欠款中。 – czjeep
在通知对象中添加播放器的currentItem –