renamed maximumBitRate to maxBitRate. Added applyModifiers support

This commit is contained in:
Ash Mishra
2018-11-26 14:50:31 -08:00
parent 12a482a8e3
commit 5ab8165c3d
5 changed files with 22 additions and 20 deletions

View File

@@ -51,7 +51,7 @@ static int const RCTVideoUnset = -1;
/* Keep track of any modifiers, need to be applied after each play */
float _volume;
float _rate;
float _maximumBitRate;
float _maxBitRate;
BOOL _muted;
BOOL _paused;
@@ -339,8 +339,7 @@ static int const RCTVideoUnset = -1;
_playerItem = playerItem;
[self addPlayerItemObservers];
[self setFilter:_filterName];
_playerItem.preferredPeakBitRate = _maximumBitRate;
[self setMaxBitRate:_maxBitRate];
[_player pause];
[_playerViewController.view removeFromSuperview];
@@ -382,11 +381,6 @@ static int const RCTVideoUnset = -1;
_videoLoadStarted = YES;
}
- (void)setMaximumBitRate:(float) maximumBitRate {
_maximumBitRate = maximumBitRate;
[self applyModifiers];
}
- (NSURL*) urlFilePath:(NSString*) filepath {
if ([filepath containsString:@"file://"]) {
return [NSURL URLWithString:filepath];
@@ -859,6 +853,12 @@ static int const RCTVideoUnset = -1;
[self applyModifiers];
}
- (void)setMaxBitRate:(float) maxBitRate {
_maxBitRate = maxBitRate;
[self applyModifiers];
}
- (void)applyModifiers
{
if (_muted) {
@@ -869,6 +869,8 @@ static int const RCTVideoUnset = -1;
[_player setMuted:NO];
}
_playerItem.preferredPeakBitRate = _maxBitRate;
[self setSelectedAudioTrack:_selectedAudioTrack];
[self setSelectedTextTrack:_selectedTextTrack];
[self setResizeMode:_resizeMode];
@@ -1469,4 +1471,4 @@ static int const RCTVideoUnset = -1;
return array[0];
}
@end
@end

View File

@@ -19,7 +19,7 @@ RCT_EXPORT_MODULE();
}
RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
RCT_EXPORT_VIEW_PROPERTY(maximumBitRate, float);
RCT_EXPORT_VIEW_PROPERTY(maxBitRate, float);
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
RCT_EXPORT_VIEW_PROPERTY(allowsExternalPlayback, BOOL);