搜尋套件、儲存庫與 APP 分類

pip_flutter 封面
套件詳情v0.0.3

pip_flutter

適用於 Android 的全新 Flutter 畫中畫套件。當應用程式在前景執行時,應用程式也不會被終止。

近 30 天下載
93
喜歡數
60
Pub 分數
60

安裝套件

flutter pub add pip_flutter

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

pip_flutter 是一個 Flutter 套件,可在 Android 上啟用畫中畫(PiP)功能,讓應用程式即使最小化或切換到其他應用時,仍能在小浮動視窗中繼續運行。它確保應用程式在前景保持活躍狀態,不會被終止,從而提升媒體播放或持續任務的使用者體驗。此套件與 Android 的 PiP 模式無縫整合,非常適合影片播放器、即時串流或任何需要持續背景運作的應用。支援透過簡單設定步驟進行基本設定。

適用情境

  • 背景影片播放
  • 直播流應用程式
  • 正在進行的任務監控
  • 多任務使用者工作流程
  • 背景音頻與視覺反饋

主要特色

  • 僅限 Android 的畫中畫支援
  • 應用在背景中保持活躍
  • 所需設定最少
  • 浮在其他應用之上
  • 應用最小化時仍可工作

適合對象

  • 媒體應用
  • 教育工具
  • 遠端監控應用
  • 生產力應用
  • 需要持久化 UI 的應用

使用建議

  • 僅限Android平台
  • 需要 Android 8.0 或更高版本
  • 無 iOS 支援
  • 需要正確的清單配置
  • 可能需要額外權限

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

pip_flutter

A Flutter plugin for Android and ios for make video in picture in picture mode.


Picture in Picture Mode Flutter



Picture in Picture Mode Disable Picture in Picture Mode

A flutter package pip flutter which will help to put your video in pip mode.

Features 💚

  • Put your video in Picture in Picture mode.
  • Also mute sound and play and pause the video.
  • Make video in full screen mode,set play back speed of video

Installation

First, add pip_flutter as a dependency in your pubspec.yaml file.

Android

Add below permission in your AndroidManifest.xml file ,also specified picture in picture mode in your activity tag and add foreground service for when app is not in background that time app not kill and running in foregorund and also add update code of MainActivity.kt and add PipFlutterPlayerService.

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    
    <activity
            android:name=".MainActivity"
            android:supportsPictureInPicture="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:exported="true"/>
            
    <service
           android:name=".PipFlutterPlayerService"
           android:stopWithTask="false" />

IOS

In Xcode of your project set ios deployment info 11.0 and set in below code in your Info.plist file.

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSBonjourServices</key>
<array>
<string>_dartobservatory._tcp</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>processing</string>
<string>remote-notification</string>
</array>

How to use

  • PipFlutterPlayerConfiguration : Put this class for your video configuration.
PipFlutterPlayerConfiguration pipFlutterPlayerConfiguration =
const PipFlutterPlayerConfiguration(
  aspectRatio: 16 / 9,
  fit: BoxFit.contain,
);
  • PipFlutterPlayerDataSource : Put this class for declare your video type url and url.
PipFlutterPlayerDataSource dataSource = PipFlutterPlayerDataSource(
  PipFlutterPlayerDataSourceType.network,
  'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
);
  • PipFlutterPlayer :
PipFlutterPlayer(
controller: pipFlutterPlayerController,
key: pipFlutterPlayerKey,
),
  • Make your video in Pip mode put this code on your onTap.
pipFlutterPlayerController.enablePictureInPicture(pipFlutterPlayerKey);
  • And make your video in disable mode put this code on your onTap.
pipFlutterPlayerController.disablePictureInPicture();

Run the example app in the exmaple folder to find out more about how to use it.

所屬分類

依賴

依賴清單 7 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。