Simple plugin to implement Picture in Picture support for Android only.

Related tags

Media PIP
Overview

flutter_pip

Simple plugin to implement Picture in Picture support for Android only.

Android Setup

You need to declare that your app supports Picture in Picture mode by adding to your AndroidManifest.xml the following line:

">
<activity
    ...
    android:supportsPictureInPicture="true"
    ...>
activity>

Enter Picture in Picture mode:

int result = await FlutterPip.enterPictureInPictureMode();

If the result returns 0, the app has entered PiP mode successfully, if it return 1 then most probably this indicates that the device does not support PiP mode.

This function supports an optional parameter of type PipRatio, for example:

int result = await FlutterPip.enterPictureInPictureMode(
    PipRatio(
        width: ...
        height: ...
    )
);

Default values for pipRatio are width: 16 and height: 9. You also need to take in consideration that PiP mode only supports a value range from 0.418410 to 2.390000 for Aspect Ratio, going anything bellow the minimum or above the maximum will throw a PipRatioException exception.

To check whether the app is on Picture in Picture mode:

bool result = await FlutterPip.isInPictureInPictureMode();

Simply returns a boolean indicating if the app is on PiP mode or not.

PipWidget

This widget has two callbacks:

PipWidget(
    onResume: (bool pipMode) {
        ...
    },
    onSuspended: () {
        ...
    }
    child: ...
}

onResume is an Async callback that returns a boolean indicating if Picture in Picture mode is enable/disabled, this is useful in case your app were in PiP mode and you want to restore your Widget Tree UI.

onSuspended is just a simple callback that you can use to execute anything you want to do when the application is thrown in the background.

You might also like...

A Flutter audio-plugin to playing and recording sounds

A Flutter audio-plugin to playing and recording sounds

medcorder_audio Flutter record/play audio plugin. Developed for Evrone.com Funded by Medcorder Medcorder.com Getting Started For help getting started

Oct 29, 2022

Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library.

Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library.

Playify Playify is a Flutter plugin for play/pause/seek songs, fetching music metadata, and browsing music library. Playify was built using iOS's Medi

Dec 14, 2022

Flutter plugin for use Video.js in flutter web

Flutter plugin for use Video.js in flutter web

Flutter Video.js player Flutter plugin for use Video.js in flutter web Installation Add it to your package's pubspec.yaml file dependencies: video_j

Oct 17, 2022

Flutter plugin for sound. Audio recorder and player.

Flutter plugin for sound. Audio recorder and player.

Sounds Sounds is a Flutter package allowing you to play and record audio for both the android and ios platforms. Sounds provides both a high level API

Dec 8, 2022

Flutter plugin for playing or streaming YouTube videos inline using the official iFrame Player API.

Flutter plugin for playing or streaming YouTube videos inline using the official iFrame Player API.

Flutter plugin for playing or streaming YouTube videos inline using the official iFrame Player API. The package exposes almost all the API provided by iFrame Player API. So, it's 100% customizable.

Jan 2, 2023

Ncnn_yolox_flutter - a plugin to run YOLOX on ncnn

Ncnn_yolox_flutter - a plugin to run YOLOX on ncnn

ncnn_yolox_flutter This is a plugin to run YOLOX on ncnn. Demo on Android Real Device Simulator on iOS Real Device Simulator Stream How to use 1. Add

Dec 15, 2022

This Flutter plugin created to show how to use OpenCV and ZXing C++ libraries natively in Flutter with Dart FFI using the camera stream

OpenCV and ZXing C++ libraries natively in Flutter with Dart FFI using the camera stream

Oct 21, 2022

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications

🎧 assets_audio_player 🔊 Play music/audio stored in assets files (simultaneously) directly from Flutter (android / ios / web / macos). You can also u

Dec 24, 2022
Owner
null
Image Editor Plugin with simple, easy support for image editing using Paints, Text, Filters, Emoji and Sticker like stories.

ImageEditorPro Image Editor Plugin with simple, easy support for image editing using Paints, Text, Filters, Emoji and Sticker like stories. To start w

Zeeshan 206 Dec 2, 2022
Audio Input Mixer made in Flutter (UI only)

Audio Input Mixer UI Design in Flutter Audio Input Mixer made in Flutter (UI only) This project is an attempt to design a simple one screen Audio Mixe

Praharsh Bhatt 6 Jul 16, 2022
Flutter plugin that can support audio recording and level metering

flutter_audio_recorder English | 简体中文 Flutter Audio Record Plugin that supports Record Pause Resume Stop and provide access to audio level metering pr

RMBR ONE 108 Dec 13, 2022
A flutter plugin to handle Android / iOS camera

?? Overview Flutter plugin to add Camera support inside your project. CamerAwesome include a lot of useful features like: ?? Live camera flip ( switch

Apparence.io 511 Jan 5, 2023
A Flutter plugin to use speech recognition on iOS & Android (Swift/Java)

speech_recognition A flutter plugin to use the speech recognition iOS10+ / Android 4.1+ Basic Example Sytody, speech to todo app Installation Depend o

Erick Ghaumez 331 Dec 19, 2022
Flutter plugin for selecting multiple images from the Android and iOS image library

Flutter plugin for selecting multiple images from the Android and iOS image library, taking new pictures with the camera, and edit them before using such as rotating, cropping, adding sticker/filters.

Weta Vietnam 91 Dec 19, 2022
A Flutter audio plugin (Swift/Java) to play remote or local audio files on iOS / Android / MacOS and Web

AudioPlayer A Flutter audio plugin (Swift/Java) to play remote or local audio files on iOS / Android / MacOS and Web. Online demo Features Android / i

Erick Ghaumez 489 Dec 18, 2022
A Flutter media player plugin for iOS and android based on ijkplayer

Flutter media player plugin for android/iOS based on ijkplayer.

于飞白呀 1.4k Jan 4, 2023
Flutter plugin for sound. Audio recorder and player.

Flutter Sound user: your documentation is there The CHANGELOG file is here Overview Flutter Sound is a Flutter package allowing you to play and record

null 764 Jan 2, 2023
WebRTC plugin for Flutter Mobile/Desktop/Web

Flutter-WebRTC WebRTC plugin for Flutter Mobile/Desktop/Web Sponsored with ?? by Enterprise Grade APIs for Feeds & Chat. Try the Flutter Chat tutorial

Flutter WebRTC 3.4k Jan 8, 2023