Android 전용으로만 Picture-in-Picture(PiP) 모드를 활성화하는 플러터 플러그인입니다. 비디오 재생이나 다른 앱 콘텐츠 탐색 중 지속적인 작업을 수행할 때 이상적인 간단한 API를 제공하여 PiP 모드 진입 및 관리를 가능하게 합니다. 이 플러그인은 PiP에 필요한 Android 전용 라이프사이클 및 구성 설정을 처리하며, 기존 앱에의 통합을 단순화합니다. 최소한의 설정으로 전체 화면과 PiP 전환을 원활하게 지원합니다.
사용 사례
백그라운드에서의 비디오 재생
진행 중인 오디오 또는 비디오 통화
라이브 스트리밍 애플리케이션
내비게이션 중 작업 계속
미디어 플레이어 개선
주요 기능
안드로이드 전용 PiP 지원
PiP에 진입하기 위한 간단한 API
자동 라이프사이클 관리
필요한 최소 구성
모드 간 원활한 전환
적합한 대상
안드로이드 비디오 앱
미디어 플레이어
통신 앱
백그라운드 활동이 필요한 앱
간편한 PiP 통합을 찾는 개발자
고려 사항
iOS에서 사용 불가
Android SDK 26 이상 필요
Android 플랫폼에 한정
PiP 창 크기의 사용자 정의 없음
Android 시스템 수준의 권한에 의존합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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.