Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
8bc165ca48
14
RCTVideo.m
14
RCTVideo.m
@ -22,6 +22,7 @@ static NSString *const playbackRate = @"rate";
|
|||||||
|
|
||||||
/* Required to publish events */
|
/* Required to publish events */
|
||||||
RCTEventDispatcher *_eventDispatcher;
|
RCTEventDispatcher *_eventDispatcher;
|
||||||
|
BOOL _playbackRateObserverRegistered;
|
||||||
|
|
||||||
bool _pendingSeek;
|
bool _pendingSeek;
|
||||||
float _pendingSeekTime;
|
float _pendingSeekTime;
|
||||||
@ -51,6 +52,7 @@ static NSString *const playbackRate = @"rate";
|
|||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
_eventDispatcher = eventDispatcher;
|
_eventDispatcher = eventDispatcher;
|
||||||
|
|
||||||
|
_playbackRateObserverRegistered = NO;
|
||||||
_playbackStalled = NO;
|
_playbackStalled = NO;
|
||||||
_rate = 1.0;
|
_rate = 1.0;
|
||||||
_volume = 1.0;
|
_volume = 1.0;
|
||||||
@ -241,9 +243,16 @@ static NSString *const playbackRate = @"rate";
|
|||||||
[_playerViewController.view removeFromSuperview];
|
[_playerViewController.view removeFromSuperview];
|
||||||
_playerViewController = nil;
|
_playerViewController = nil;
|
||||||
|
|
||||||
|
if (_playbackRateObserverRegistered) {
|
||||||
|
[_player removeObserver:self forKeyPath:playbackRate context:nil];
|
||||||
|
_playbackRateObserverRegistered = NO;
|
||||||
|
}
|
||||||
|
|
||||||
_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
|
||||||
@ -697,7 +706,10 @@ static NSString *const playbackRate = @"rate";
|
|||||||
- (void)removeFromSuperview
|
- (void)removeFromSuperview
|
||||||
{
|
{
|
||||||
[_player pause];
|
[_player pause];
|
||||||
[_player removeObserver:self forKeyPath:playbackRate];
|
if (_playbackRateObserverRegistered) {
|
||||||
|
[_player removeObserver:self forKeyPath:playbackRate context:nil];
|
||||||
|
_playbackRateObserverRegistered = NO;
|
||||||
|
}
|
||||||
_player = nil;
|
_player = nil;
|
||||||
|
|
||||||
[self removePlayerLayer];
|
[self removePlayerLayer];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-video",
|
"name": "react-native-video",
|
||||||
"version": "0.8.0-rc",
|
"version": "0.8.0",
|
||||||
"description": "A <Video /> element for react-native",
|
"description": "A <Video /> element for react-native",
|
||||||
"main": "Video.js",
|
"main": "Video.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
Loading…
Reference in New Issue
Block a user