Save current state of observing in _playbackRateObserverRegistered property
This commit is contained in:
parent
5506805aac
commit
901f0cc9ab
@ -226,6 +226,7 @@ static NSString *const playbackRate = @"rate";
|
|||||||
_player = [AVPlayer playerWithPlayerItem:_playerItem];
|
_player = [AVPlayer playerWithPlayerItem:_playerItem];
|
||||||
_player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
|
_player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
|
||||||
[_player addObserver:self forKeyPath:playbackRate options:0 context:nil];
|
[_player addObserver:self forKeyPath:playbackRate options:0 context:nil];
|
||||||
|
_playbackRateObserverRegistered = YES;
|
||||||
|
|
||||||
const Float64 progressUpdateIntervalMS = _progressUpdateInterval / 1000;
|
const Float64 progressUpdateIntervalMS = _progressUpdateInterval / 1000;
|
||||||
// @see endScrubbing in AVPlayerDemoPlaybackViewController.m of https://developer.apple.com/library/ios/samplecode/AVPlayerDemo/Introduction/Intro.html
|
// @see endScrubbing in AVPlayerDemoPlaybackViewController.m of https://developer.apple.com/library/ios/samplecode/AVPlayerDemo/Introduction/Intro.html
|
||||||
@ -669,7 +670,8 @@ static NSString *const playbackRate = @"rate";
|
|||||||
- (void)removeFromSuperview
|
- (void)removeFromSuperview
|
||||||
{
|
{
|
||||||
[_player pause];
|
[_player pause];
|
||||||
[_player removeObserver:self forKeyPath:playbackRate];
|
[_player removeObserver:self forKeyPath:playbackRate];
|
||||||
|
_playbackRateObserverRegistered = NO;
|
||||||
_player = nil;
|
_player = nil;
|
||||||
|
|
||||||
[self removePlayerLayer];
|
[self removePlayerLayer];
|
||||||
|
Loading…
Reference in New Issue
Block a user