StreamCallContainer(
call: widget.call,
pictureInPictureConfiguration: const PictureInPictureConfiguration(
enablePictureInPicture: true,
),
)
Picture in Picture (PiP)
Picture in picture (PIP) keeps the call running and visible while you navigate to other apps.
Enable Picture-in-Picture
You can enable Picture in Picture by setting the enablePictureInPicture
property to true
in the PictureInPictureConfiguration
provided to StreamCallContainer
or StreamCallContent
widget.
Android
Android Configuration
To enable Picture in Picture on Android, you need to add the following configuration to your AndroidManifest.xml
file.
<activity android:name="VideoActivity"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
..
/>
Then you need to add this code to your MainActivity
class. It will enter Picture in Picture mode when the user leaves the app but only if the call is active.
import io.flutter.embedding.android.FlutterActivity
import io.getstream.video.flutter.stream_video_flutter.service.PictureInPictureHelper
class MainActivity: FlutterActivity() {
override fun onUserLeaveHint() {
super.onUserLeaveHint()
PictureInPictureHelper.enterPictureInPictureIfInCall(this)
}
}
Android Customization
For Android, you can customize the widget rendered while app is in Picture-in-Picture mode by providing callPictureInPictureBuilder
to PictureInPictureConfiguration
.
StreamCallContainer(
call: widget.call,
callContentBuilder: (
BuildContext context,
Call call,
CallState callState,
) {
return StreamCallContent(
call: call,
callState: callState,
pictureInPictureConfiguration: const PictureInPictureConfiguration(
enablePictureInPicture: true,
androidPiPConfiguration: AndroidPictureInPictureConfiguration(
callPictureInPictureBuilder: (context, call, callState) {
// YOUR CUSTOM WIDGET
},
)
),
);
},
);
iOS
Local camera feed in Picture-in-Picture mode
By default iOS is not allowing usage of local camera feed when app is in the background. That includes Picture in picture mode and Split View mode. To enable it you need to request the multitasking-camera-access permission directly from Apple (this will change from iOS 18).
If you already have the permission you have to enable local feed support in our PiP implementation by setting ignoreLocalParticipantVideo
to false
.
StreamCallContainer(
call: widget.call,
callContentBuilder: (
BuildContext context,
Call call,
CallState callState,
) {
return StreamCallContent(
call: call,
callState: callState,
pictureInPictureConfiguration: const PictureInPictureConfiguration(
enablePictureInPicture: true,
iOSPiPConfiguration: IOSPictureInPictureConfiguration(
ignoreLocalParticipantVideo: false,
)
),
);
},
);
Enabling PiP support with custom call content widget
If you are not using our StreamCallContent
and instead building custom call content widget you can still enable Picture in Picture mode by adding StreamPictureInPictureUiKitView
anywhere in the widget tree. This widget will handle the Picture in Picture mode in iOS for you.
StreamCallContainer(
call: widget.call,
callContentBuilder: (
BuildContext context,
Call call,
CallState callState,
) {
return Stack(
children: [
StreamPictureInPictureUiKitView(call: call),
// YOUR CUSTOM WIDGET
],
);
},
);
Done. Now after leaving the app, you’ll see that the call will be still alive in the background like the one below: