added support for automaticallyWaitsToMinimizeStalling property on iOS
This commit is contained in:
parent
c29244bf89
commit
e3782c4ec6
@ -351,6 +351,9 @@ Indicates whether the player should only play the audio track and instead of dis
|
||||
|
||||
For this to work, the poster prop must be set.
|
||||
|
||||
#### automaticallyWaitsToMinimizeStalling
|
||||
A Boolean value that indicates whether the player should automatically delay playback in order to minimize stalling. For clients linked against iOS 10.0 and later
|
||||
|
||||
Platforms: all
|
||||
|
||||
#### bufferConfig
|
||||
|
1
Video.js
1
Video.js
@ -382,6 +382,7 @@ Video.propTypes = {
|
||||
poster: PropTypes.string,
|
||||
posterResizeMode: Image.propTypes.resizeMode,
|
||||
repeat: PropTypes.bool,
|
||||
automaticallyWaitsToMinimizeStalling: PropTypes.bool,
|
||||
allowsExternalPlayback: PropTypes.bool,
|
||||
selectedAudioTrack: PropTypes.shape({
|
||||
type: PropTypes.string.isRequired,
|
||||
|
@ -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,9 +868,15 @@ static int const RCTVideoUnset = -1;
|
||||
} else if([_ignoreSilentSwitch isEqualToString:@"obey"]) {
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
|
||||
}
|
||||
|
||||
if (@available(iOS 10.0, *) && _automaticallyWaitsToMinimizeStalling) {
|
||||
[_player playImmediatelyAtRate:1.0];
|
||||
} else {
|
||||
[_player play];
|
||||
[_player setRate:_rate];
|
||||
}
|
||||
[_player setRate:_rate];
|
||||
}
|
||||
|
||||
_paused = paused;
|
||||
}
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user