Disable pipController init if pictureInPicture is false

Disable pipController init if pictureInPicture is set to false prevents going to PIP mode on iOS when the app goes to the background.
This commit is contained in:
Tomasz Baranowicz 2021-11-05 12:42:45 +01:00 committed by GitHub
parent 81ae785090
commit dad33ef885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -907,7 +907,7 @@ static int const RCTVideoUnset = -1;
} }
- (void)setupPipController { - (void)setupPipController {
if (!_pipController && _playerLayer && [AVPictureInPictureController isPictureInPictureSupported]) { if (!_pipController && _playerLayer && [AVPictureInPictureController isPictureInPictureSupported] && _pictureInPicture) {
// Create new controller passing reference to the AVPlayerLayer // Create new controller passing reference to the AVPlayerLayer
_pipController = [[AVPictureInPictureController alloc] initWithPlayerLayer:_playerLayer]; _pipController = [[AVPictureInPictureController alloc] initWithPlayerLayer:_playerLayer];
_pipController.delegate = self; _pipController.delegate = self;