如果我使用 KVO 来观察我的播放器项目,如下所示:
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url];
[playerItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:MyClassKVOContext];
[playerItem addObserver:self forKeyPath:@"playbackBufferEmpty" options:NSKeyValueObservingOptionNew context:MyClassKVOContext];
[playerItem addObserver:self forKeyPath:@"playbackLikelyToKeepUp" options:NSKeyValueObservingOptionNew context:MyClassKVOContext];
[playerItem addObserver:self forKeyPath:@"loadedTimeRanges" options:NSKeyValueObservingOptionNew context:MyClassKVOContext];
两个问题:
1) 项目播放完毕后,我是否需要移除我的观察者?(即在AVPlayerItemDidPlayToEndTimeNotification
)
2)如果我打电话[_avQueuePlayer removeAllItems]
,它是否也会删除每个项目的观察者?