Working on autorotation of video player

This commit is contained in:
Ash Mishra 2018-08-02 10:32:50 -07:00
parent aa439470b3
commit 0c03932ada
2 changed files with 19 additions and 1 deletions

View File

@ -55,6 +55,7 @@ static int const RCTVideoUnset = -1;
BOOL _playWhenInactive;
NSString * _ignoreSilentSwitch;
NSString * _resizeMode;
BOOL _fullscreen;
BOOL _fullscreenPlayerPresented;
UIViewController * _presentingViewController;
}
@ -329,6 +330,8 @@ static int const RCTVideoUnset = -1;
_playbackRateObserverRegistered = YES;
[self addPlayerTimeObserver];
[self setFullscreen:_fullscreen];
//Perform on next run loop, otherwise onVideoLoadStart is nil
if(self.onVideoLoadStart) {
@ -994,7 +997,8 @@ static int const RCTVideoUnset = -1;
- (void)setFullscreen:(BOOL)fullscreen
{
if( fullscreen && !_fullscreenPlayerPresented )
_fullscreen = fullscreen;
if( fullscreen && !_fullscreenPlayerPresented && _player )
{
// Ensure player view controller is not null
if( !_playerViewController )

View File

@ -13,4 +13,18 @@
[_rctDelegate videoPlayerViewControllerDidDismiss:self];
}
- (BOOL)shouldAutorotate {
return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeLeft;
}
@end