# Picture-in-Picture

ByteArk Player SDK for Flutter supports Picture-in-Picture (PiP) so viewers can keep watching in a floating window while using other apps.

# Platform setup

# iOS

Enable Background Mode "Audio, AirPlay, and Picture in Picture" in your Xcode project's Capabilities.

# Android

Configure the activity in android/app/src/main/AndroidManifest.xml:

<activity
  android:name=".MainActivity"
  android:supportsPictureInPicture="true"
  android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation">
</activity>
1
2
3
4
5

# Receive PiP events

final listener = ByteArkPlayerListener(
  onPlayerEnterPictureInPictureMode: () {
    debugPrint("Entered PiP mode");
  },
  onPlayerExitPictureInPictureMode: () {
    debugPrint("Exited PiP mode");
  },
);
1
2
3
4
5
6
7
8

Note

PiP behavior on Flutter depends on the native SDK. For more details, see the iOS Picture-in-Picture or Android Picture-in-Picture guides.