官方的 video_player 只提供移动端和web的实现,fvp (flutter video_player) 弥补了这个不足,支持除web外的所有平台,web继续使用官方实现。fvp 是首个且目前唯一一个支持所有移动和桌面端的 video_player 插件。使用起来非常方便,只需两行代码即可让原有的基于 video_player 的项目支持桌面系统。
特点:
-
使用ge平台性能最优的渲染器: windows上使用D3D11, macOS 和 iOS 用 Metal,其他用 OpenGL
-
默认开启硬解加速解码
-
可通过参数选择哪些系统使用此插件,其他系统使用官方实现
-
支持更多格式
-
性能优异。比所有其他播放器的软件包有更好的性能,包括cpu、gpu、内存占用方面,比如比较流行的基于libmpv的media_kit
-
提供一套功能更丰富的接口。如果video_player不满足你的需求,可以选择这套接口。
使用方式:
-
pubspec.yaml 添加依赖: flutter pub add fvp
-
增加2行代码,
import 'package:fvp/fvp.dart'; registerWith(); // in main(), or anywhere before creating a player
评论