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

套件詳情v1.7.5

flutter_in_app_pip

一個 Flutter 套件,可輕鬆在 Flutter 應用程式中實作畫中畫功能。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2560
喜歡數
62
Pub 分數
160

安裝套件

flutter pub add flutter_in_app_pip

套件介紹

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

一個 Flutter 套件,可簡化在 Flutter 應用中實作畫中畫(PiP)模式。它讓使用者能在瀏覽應用其他部分或切換至其他應用時,繼續於小浮動視窗中觀看影片內容。此套件支援 Android、iOS、Web、macOS、Windows 與 Linux 多個平台,為不同裝置提供一致的 PiP 經驗。非常適合媒體密集型應用,例如影片播放器、即時串流或視訊會議工具。

適用情境

  • 背景影片播放
  • 畫中畫直播
  • 視訊會議應用
  • 需要多任務處理的媒體應用
  • 帶有影片內容的教育類應用程式

主要特色

  • 跨平台畫中畫支援
  • 簡單 API 結合
  • 浮動視頻窗口
  • 自動畫中畫狀態管理
  • 支援 Android、iOS、Web、macOS、Windows 和 Linux

適合對象

  • 媒體應用開發者
  • 影片串流平台
  • 互動式學習應用
  • 需要後台視頻播放的應用
  • 面向多個平台的開發者

使用建議

  • 需要平台特定權限
  • 部分網頁瀏覽器上的畫中畫行為受限
  • iOS PiP 可能需要額外設定
  • 並非所有裝置都支援畫中畫模式
  • Web PiP 支持因瀏覽器而異

原始 README

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

In App PiP for Flutter

A Flutter Package to help easily implement in-app PiP(Picture in Picture) in a flutter application. Written completely in dart.

Features

  • Easily Implement PiP(Picture in Picture) in app.

  • Navigatable PiP Widget which allows navigation inside the PiP Window.

  • Automatically Handle showing different widgets in the original view when in pip and when not in pip.

  • Provides the ability to update the size of the pip widget later after starting pip.

  • Provides the ability to set the borders to which pip can be dragged.

  • Provides the ability to make the window resizable(pinch-in/out).

  • Provides the ability to make the window non-movable.

  • Provides the ability to set the initial corner of the PIP window.

  • Provides the ability to set minimum and maximum size of the PIP window, if resizable.

Getting started

  • Import the package.

  • Replace your MaterialApp with PiPMaterialApp (If using MaterialApp.router, you can replace it with PiPMaterialApp.router).

  • Optionally provide the pip parameters. These correspond to various parameters such as height and width of your pip widget.

Usage

After replacing your MaterialApp with PiPMaterialApp, use

 PictureInPicture.startPiP(pipWidget: MyPiPWidget());

to start PiP view in your app.

When you wish to stop PiP, use

PictureInPicture.stopPiP();

Use PiPWidget for additional functionalities like handling events on close of pip e.g.

PictureInPicture.startPiP(
    pipWidget:PiPWidget(
      child: ChildWidget(),
      onPiPClose: (){
      //Handle closing events e.g. dispose controllers.
      
      },
      elevation: 10,        //Optional
      pipBorderRadius: 10,  //Optional
      )
);

Use NavigatablePiPWidget for Navigation inside the PiP Window e.g.

PictureInPicture.startPiP(
    pipWidget:NavigatablePiPWidget(
      child: ChildWidget(),
      onPiPClose: (){
      //Handle closing events e.g. dispose controllers.
      
      },
      elevation: 10,        //Optional
      pipBorderRadius: 10,  //Optional
      )
);

Additionally, you can also use PiPCapableWidget to handle the view changes in case of PiP start and stop e.g.

PiPCapableWidget(
    whileNotInPip: ChildToShowWhileNotInPiP(),
    whileInPip: ChildToShowWhileInPiP(),      //Optional
);

Update the parameters of the pip view like below:

PictureInPicture.updatePiPParams(
                    pipParams: PiPParams(
                        pipWindowHeight: 144,
                        pipWindowWidth: 256,
                        bottomSpace: 64,
                        leftSpace: 64,
                        rightSpace: 64,
                        topSpace: 64,
                        maxSize: Size(256, 144),
                        minSize: Size(144, 108),
                        movable: true,
                        resizable: false,
                        initialCorner: PIPViewCorner.bottomRight,
                        ),
                  );

Note

That's it. Enjoy! Also, this package is 100% compatible with my other flutter plugin android_pip

所屬分類

原始碼儲存庫

使用此套件的專案