2011-01-14 64 views
2

所以在簡單的控制器的初始化我有這樣的代碼:AVPlayerItem和KVO - 我錯過了什麼?

self.playerItem = [AVPlayerItem playerItemWithURL:url]; 
[self.playerItem addObserver:self forKeyPath:@"status" options:0 context:nil]; 

應該從URL嘗試和負載的媒體,對不對?我正在實施

observeValueForKeyPath:ofObject:change:context: 

但是,此方法從未被調用。獨領風騷?

回答

6

playerItem開始被分配到AVPlayer對象(杜)

self.player = [AVPlayer playerWithPlayerItem:self.playerItem]; 
+3

這是有史以來最糟糕的框架後,工作! – 2015-03-31 14:15:05