Aus öffentlichen Paketdaten erstellte Orientierung.
Ein Flutter-Plugin, das den Picture-in-Picture-Modus (PiP) ausschließlich für Android aktiviert. Es bietet eine einfache API zum Eintritt in und Verwaltung des PiP-Modus, ideal für Videowiedergabe oder laufende Aufgaben beim Navigieren durch andere App-Inhalte. Das Plugin verarbeitet die androidspezifischen Lebenszyklus- und Konfigurationsanforderungen für PiP und vereinfacht die Integration in bestehende Apps. Mit minimalem Setup ist es nahtlos sowohl für Vollbild- als auch für PiP-Übergänge geeignet.
Anwendungsfälle
Video-Wiedergabe im Hintergrund
Anstehende Audio- oder Videogespräche
Live-Streaming-Anwendungen
Aufgabenfortsetzung während der Navigation
Medienplayer-Verbesserungen
Hauptmerkmale
Nur für Android verfügbares PiP-Unterstützung
Einfache API zum Eintritt in PiP
Automatisches Lebenszyklus-Management
Minimale Konfiguration erforderlich
Nahtloser Wechsel zwischen Modi
Geeignet für
Android-Videoumgebungen
Mediaplayer
Kommunikations-Apps
Apps, die Hintergrundaktivität erfordern
Entwickler, die eine einfache PiP-Integration suchen
Hinweise
Nicht verfügbar auf iOS
Erfordert Android SDK 26+
Beschränkt auf die Android-Plattform
Keine Anpassung der PiP-Fenstergröße
Abhängig von Android-Systemberechtigungen
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
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.