added support for automaticallyWaitsToMinimizeStalling property on iOS
This commit is contained in:
@@ -54,6 +54,7 @@ static int const RCTVideoUnset = -1;
|
||||
float _rate;
|
||||
float _maxBitRate;
|
||||
|
||||
BOOL _automaticallyWaitsToMinimizeStalling;
|
||||
BOOL _muted;
|
||||
BOOL _paused;
|
||||
BOOL _repeat;
|
||||
@@ -376,6 +377,7 @@ static int const RCTVideoUnset = -1;
|
||||
_isExternalPlaybackActiveObserverRegistered = YES;
|
||||
|
||||
[self addPlayerTimeObserver];
|
||||
[self setAutomaticallyWaitsToMinimizeStalling:_automaticallyWaitsToMinimizeStalling];
|
||||
|
||||
//Perform on next run loop, otherwise onVideoLoadStart is nil
|
||||
if (self.onVideoLoadStart) {
|
||||
@@ -866,7 +868,13 @@ static int const RCTVideoUnset = -1;
|
||||
} else if([_ignoreSilentSwitch isEqualToString:@"obey"]) {
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
|
||||
}
|
||||
[_player play];
|
||||
|
||||
if (@available(iOS 10.0, *) && _automaticallyWaitsToMinimizeStalling) {
|
||||
[_player playImmediatelyAtRate:1.0];
|
||||
} else {
|
||||
[_player play];
|
||||
[_player setRate:_rate];
|
||||
}
|
||||
[_player setRate:_rate];
|
||||
}
|
||||
|
||||
@@ -953,6 +961,12 @@ static int const RCTVideoUnset = -1;
|
||||
_playerItem.preferredPeakBitRate = maxBitRate;
|
||||
}
|
||||
|
||||
- (void)setAutomaticallyWaitsToMinimizeStalling:(BOOL)waits
|
||||
{
|
||||
_automaticallyWaitsToMinimizeStalling = waits;
|
||||
_player.automaticallyWaitsToMinimizeStalling = waits;
|
||||
}
|
||||
|
||||
|
||||
- (void)applyModifiers
|
||||
{
|
||||
|
@@ -22,6 +22,7 @@ RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
|
||||
RCT_EXPORT_VIEW_PROPERTY(maxBitRate, float);
|
||||
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
|
||||
RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
|
||||
RCT_EXPORT_VIEW_PROPERTY(automaticallyWaitsToMinimizeStalling, BOOL);
|
||||
RCT_EXPORT_VIEW_PROPERTY(allowsExternalPlayback, BOOL);
|
||||
RCT_EXPORT_VIEW_PROPERTY(textTracks, NSArray);
|
||||
RCT_EXPORT_VIEW_PROPERTY(selectedTextTrack, NSDictionary);
|
||||
|
Reference in New Issue
Block a user