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.
flutter pub add fvp
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()
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
Upgrading binary dependencies can bring new features and backend bug fixes. For macOS and iOS, in your project dir, run
pod cache clean mdk
find . -name Podfile.lock -delete
rm -rf {mac,i}os/Pods
For other platforms, run
flutter pub cache clean
MethodChannel
to construct player instance and set a renderer target.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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。