setVideoPictureInPictureEnabled method
Picture-in-Picture for video calls: the remote video moves to a floating window when the app goes to the background during a video call, and the SDK closes it at call end. Call before the video call starts. Returns whether the device supports PiP.
Android: add android:supportsPictureInPicture="true" and android:resizeableActivity="true"
to MainActivity and forward onUserLeaveHint / onPictureInPictureModeChanged to
OmicallsdkPlugin. iOS 15+: needs audio in UIBackgroundModes; add the
com.apple.developer.avfoundation.multitasking-camera-access entitlement to keep sending
your camera while in PiP.
Implementation
Future<bool> setVideoPictureInPictureEnabled(bool enabled) async {
final action = OmiAction(
actionName: OmiActionName.SET_PICTURE_IN_PICTURE,
data: {'enabled': enabled},
);
return await _controller.action(action) == true;
}