开发者

AVPlayerItem and KVO - am i missing something?

开发者 https://www.devze.com 2023-02-04 02:25 出处:网络
so in the init of a simple Controller i have this code: self.playerItem = [AVPlayerItem playerItemWithURL:url];

so in the init of a simple Controller i have this code:

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

which should try and load media from the url, right? i'm implemeting

observeValueForKeyPath:ofObject:change:context:

however, this method开发者_如何学运维 is never called. Clueless?


playerItem starts working after being assigned to a AVPlayer object (duh)

self.player = [AVPlayer playerWithPlayerItem:self.playerItem];
0

精彩评论

暂无评论...
验证码 换一张
取 消