2016-08-31 59 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

我可以得到停滯的通知來解決問題。所以這個問題可能會被擱置一段時間。