2015-07-19 82 views
0

是否有可能使用swift訪問AVPlayerItem的playbackBufferEmpty屬性?使用swift訪問AVPlayerItem的playbackBufferEmpty屬性

我嘗試以下操作:

self.player.currentItem.addObserver(self, forKeyPath: "playbackBufferEmpty", options:NSKeyValueObservingOptions, context: nil) 

但讓編譯器錯誤消息:

不能援引 '的addObserver' 與 類型的參數列表「(DetailViewController,forKeyPath:字符串,選項: NSKeyValueObservingOptions.Type,上下文:無)'

回答

0

我解決了這個問題,這裏是解決方案:

self.player?.currentItem?.addObserver(self, forKeyPath: "playbackBufferEmpty", options: nil, context: nil)