From dad33ef8851f6af64d15581c164f4432ab81c0b3 Mon Sep 17 00:00:00 2001 From: Tomasz Baranowicz <851131+tombaranowicz@users.noreply.github.com> Date: Fri, 5 Nov 2021 12:42:45 +0100 Subject: [PATCH] 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. --- ios/Video/RCTVideo.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index a757c08a..4226db9d 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -907,7 +907,7 @@ static int const RCTVideoUnset = -1; } - (void)setupPipController { - if (!_pipController && _playerLayer && [AVPictureInPictureController isPictureInPictureSupported]) { + if (!_pipController && _playerLayer && [AVPictureInPictureController isPictureInPictureSupported] && _pictureInPicture) { // Create new controller passing reference to the AVPlayerLayer _pipController = [[AVPictureInPictureController alloc] initWithPlayerLayer:_playerLayer]; _pipController.delegate = self;