Commit 3ba26eb4 authored by Ash Mishra's avatar Ash Mishra
Browse files

Working on autorotation of video player

parent 3c0323fb
Loading
Loading
Loading
Loading
+5 −4
Changes for ios/Video/RCTVideo.m: 5 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ static int const RCTVideoUnset = -1;
  BOOL _playWhenInactive;
  NSString * _ignoreSilentSwitch;
  NSString * _resizeMode;
  BOOL _fullscreen;
  BOOL _fullscreenPlayerPresented;
  UIViewController * _presentingViewController;
#if __has_include(<react-native-video/RCTVideoCache.h>)
@@ -342,6 +343,8 @@ static int const RCTVideoUnset = -1;
        
      [self addPlayerTimeObserver];

      [self setFullscreen:_fullscreen];
        
      //Perform on next run loop, otherwise onVideoLoadStart is nil
      if (self.onVideoLoadStart) {
        id uri = [source objectForKey:@"uri"];
@@ -1085,10 +1088,8 @@ static int const RCTVideoUnset = -1;

- (void)setFullscreen:(BOOL)fullscreen
{
  if( fullscreen && !_fullscreenPlayerPresented )
  {
    // Ensure player view controller is not null
    if( !_playerViewController )
  _fullscreen = fullscreen;
  if( fullscreen && !_fullscreenPlayerPresented && _player )
    {
      [self usePlayerViewController];
    }
+14 −0
Changes for ios/Video/RCTVideoPlayerViewController.m: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,4 +13,18 @@
  [_rctDelegate videoPlayerViewControllerDidDismiss:self];
}

- (BOOL)shouldAutorotate {
  return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
  
  return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
  
  return UIInterfaceOrientationLandscapeLeft;
}

@end