1 Star 0 Fork 1

惊天 / fvp

forked from Gitee 极速下载 / fvp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

FVP

A plugin for official Flutter Video Player to support all desktop and mobile platforms, with hardware accelerated decoding and optimal rendering. Based on libmdk. You can also create your own players other than official video_player with backend player api

Prebuilt example can be download from artifacts of github actions.

More examples are here

Features

  • All platforms: Windows(including win7), Linux, macOS, iOS, Android.
  • You can choose official implementation or this plugin's
  • Optimal render api: d3d11 for windows, metal for macOS/iOS, OpenGL for Linux and Android
  • Hardware decoders are enabled by default
  • Minimal code change for existing Video Player apps
  • Support most formats via FFmpeg demuxer and software decoders if not supported by gpu. You can use your own ffmpeg 4.0~7.0(or master branch) by removing bundled ffmpeg dynamic library.
  • High performance. Lower cpu, gpu and memory load than libmpv based players.
  • Support audio without video
  • Small footprint. Only about 10MB size increase per cpu architecture(platform dependent).

How to Use

  • Add fvp in your pubspec.yaml dependencies: flutter pub add fvp
  • Add 2 lines in your video_player examples. It's OPTIONAL for official video_player unsupported platforms(i.e. windows and linux) since v0.16.0
import 'package:fvp/fvp.dart';

registerWith(); // in main(), or anywhere before creating a player

Then this plugin implementation will be used for all platforms. Without these lines the official implementation(if exists) will be used. You can also select the platforms to enable fvp implementation

registerWith(options: {'platforms': ['windows', 'macos', 'linux']}); // only these platforms will use this plugin implementation

To select other decoders, pass options like this

registerWith(options: {
    'video.decoders': ['D3D11', 'NVDEC', 'FFmpeg']
    //'lowLatency': 1, // optional for network streams
    }); // windows

The document lists all options for registerWith()

Backend Player API

import 'package:fvp/mdk.dart';

The plugin implements VideoPlayerPlatform via a thin wrapper on player.dart.

Now we also expose this backend player api so you can create your own players easily, and gain more features than official video_player, for example, play from a given position, loop in a range, decoder selection, media information detail etc. You can also reuse the Player instance without unconditionally create and dispose, changing the Player.media is enough. This is an example

Design

  • Playback control api in dart via ffi
  • Manage video renderers in platform specific manners. Receive player ptr via MethodChannel to construct player instance and set a renderer target.
  • Callbacks and events in C++ are notified by ReceivePort
  • Function with a one time callback is async and returns a future

Enable Subtitles

libass is required, and it's added to your app automatically for windows, macOS and android(remove ass.dll, libass.dylib and libass.so from mdk-sdk if you don't need it). For iOS, download and add ass.framework to your xcode project. For linux, system libass can be used, you may have to install manually via system package manager.

If required subtitle font is not found in the system(e.g. android), you can add assets/subfont.ttf in pubspec.yaml as the fallback.

Screenshots

fpv_android fvp_ios fvp_win fvp_win7 fvp_linux fvp_macos

BSD-3-Clause License Copyright 2022 Wang Bin. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

官方的 video_player 只提供移动端和web的实现,fvp (flutter video_player) 弥补了这个不足,支持除web外的所有平台,web继续使用官方实现 展开 收起
C/C++
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C/C++
1
https://gitee.com/andios/fvp.git
git@gitee.com:andios/fvp.git
andios
fvp
fvp
master

搜索帮助