I am working on PIP mode, as per the requirement in PIP mode I need to start another player as soon as current AVPlayer ends. Currently PIP mode closes automatically as it ends. Creating new AVPictureInPictureController object isn't starting in PIP mode.
BOOL isPiPActive = NO;
if ((nil != _mPictureInPictureController) {
isPiPActive = _mPictureInPictureController.isPictureInPictureActive;
}
_mPictureInPictureController = [[AVPictureInPictureController alloc] initWithPlayerLayer:aNewPlayerLayer];
if (isPiPActive) {
NSLog(@"PIP Active by previous layer");
[_mPictureInPictureController startPictureInPicture];
}
Can anyone suggest how we can play new AVPlayer to continue in PIP?