Package selection guidance compiled from public package information, community data, and project usage.
A Flutter plugin that enables Picture-in-Picture (PiP) mode exclusively for Android. It provides a straightforward API to enter and manage PiP mode, ideal for video playback or ongoing tasks while navigating other app content. The plugin handles the Android-specific lifecycle and configuration required for PiP, simplifying integration into existing apps. Designed with minimal setup, it supports both full-screen and PiP transitions seamlessly.
Use cases
Video playback in background
Ongoing audio or video calls
Live streaming applications
Task continuation during navigation
Media player enhancements
Key features
Android-only PiP support
Simple API for entering PiP
Automatic lifecycle management
Minimal configuration required
Seamless transition between modes
Suitable for
Android video apps
Media players
Communication apps
Apps requiring background activity
Developers seeking easy PiP integration
Considerations
Not available on iOS
Requires Android SDK 26+
Limited to Android platform
No customization for PiP window size
Depends on Android system-level permissions
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
A complete Picture-In-Picture mode plugin for android API level 26+ (Android Oreo).
Provides methods to check feature availability, enter PIP mode, callbacks for mode change and PIP Actions support.
Add android:supportsPictureInPicture="true" to the activity on your AndroidManifest.xml.
Verify pip support
Use SimplePip.isPipAvailable and SimplePip.isPipActivated static getters to verify whether the device supports Picture In Picture feature and the feature is currently activated respectively.
Entering pip mode
Import simple_pip.dart file and call enterPipMode method.
To use the widget, you need to enable callbacks first.
Import pip_widget.dart file.
Add a PipWidget widget to your tree and give it a child and a pipChild.
[!Note]
builder and pipBuilder are deprecated. Use a Builder as the child or pipChild instead.
import'package:simple_pip_mode/pip_widget.dart';
classMyWidgetextendsStatelessWidget{
Widgetbuild(BuildContext context) {
returnPipWidget(
child: Text('This is built when PIP mode is not active'),
pipChild: Text('This is built when PIP mode is active'),
);
}
}
You can also pass callbacks directly to PipWidget.
Using PIP Actions
To use PIP actions, you need to specify a pipLayout preset on your PipWidget.
The current available action layout presets are focused on giving support to media reproduction controls. They are media, media_only_pause, media_live and mediaWithSeek10. Those are defined on the [PipActionsLayout] enum.
You can also add a onPipAction listener to handle actions callbacks from PipWidget. This can be defined on SimplePip(onPipAction: ...) too.
Every SimplePip method calls android native code, so make sure you only make a call to a SimplePip method when running in an Android device.
This includes SimplePip.isPipAvailable.
Calling SimplePip methods on a non-Android device will raise a MissingPluginException error.