Commit ebb237dc authored by Nicolas Gonzalez's avatar Nicolas Gonzalez
Browse files

RCTVideo.m formatting

parent 67a96332
Loading
Loading
Loading
Loading
+15 −2
Changes for ios/Video/RCTVideo.m: 15 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ static int const RCTVideoUnset = -1;
  /* Keep track of any modifiers, need to be applied after each play */
  float _volume;
  float _rate;
  float _maxBitRate;

  BOOL _muted;
  BOOL _paused;
  BOOL _repeat;
@@ -340,6 +342,7 @@ static int const RCTVideoUnset = -1;
      _playerItem = playerItem;
      [self addPlayerItemObservers];
      [self setFilter:_filterName];
      [self setMaxBitRate:_maxBitRate];
      
      [_player pause];
      [_playerViewController.view removeFromSuperview];
@@ -404,11 +407,14 @@ static int const RCTVideoUnset = -1;

- (void)playerItemPrepareText:(AVAsset *)asset assetOptions:(NSDictionary * __nullable)assetOptions withCallback:(void(^)(AVPlayerItem *))handler
{
  if (!_textTracks) {
  if (!_textTracks || _textTracks.count==0) {
    handler([AVPlayerItem playerItemWithAsset:asset]);
    return;
  }
  
  // AVPlayer can't airplay AVMutableCompositions
  _allowsExternalPlayback = NO;

  // sideload text tracks
  AVMutableComposition *mixComposition = [[AVMutableComposition alloc] init];
  
@@ -853,6 +859,12 @@ static int const RCTVideoUnset = -1;
  [self applyModifiers];
}

- (void)setMaxBitRate:(float) maxBitRate {
  _maxBitRate = maxBitRate;
  [self applyModifiers];
}


- (void)applyModifiers
{
  if (_muted) {
@@ -863,6 +875,8 @@ static int const RCTVideoUnset = -1;
    [_player setMuted:NO];
  }
  
  _playerItem.preferredPeakBitRate = _maxBitRate;
  
  [self setSelectedAudioTrack:_selectedAudioTrack];
  [self setSelectedTextTrack:_selectedTextTrack];
  [self setResizeMode:_resizeMode];
@@ -1281,7 +1295,6 @@ static int const RCTVideoUnset = -1;
    if (!asset) {
        return;
    }
    // TODO: filters don't work for HLS, check & return

    CIFilter *filter = [CIFilter filterWithName:filterName];
    _playerItem.videoComposition = [AVVideoComposition