{"id":19602525,"url":"https://github.com/wang-bin/fvp","last_synced_at":"2025-04-08T09:13:23.343Z","repository":{"id":60051633,"uuid":"540673185","full_name":"wang-bin/fvp","owner":"wang-bin","description":"Flutter video player plugin for all desktop+mobile platforms. download prebuilt examples from github actions. https://pub.dev/packages/fvp","archived":false,"fork":false,"pushed_at":"2025-03-31T04:44:20.000Z","size":570,"stargazers_count":236,"open_issues_count":34,"forks_count":40,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-01T08:44:35.565Z","etag":null,"topics":["d3d11","desktop","dolby-vision","flutter","hdr","metal","player","video"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wang-bin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["wang-bin"],"custom":["https://www.paypal.me/ibingow"]}},"created_at":"2022-09-24T01:34:12.000Z","updated_at":"2025-03-31T04:44:23.000Z","dependencies_parsed_at":"2022-09-24T11:11:44.551Z","dependency_job_id":"2d38c45e-9dc4-4d6a-8b7d-610f85ea2b2e","html_url":"https://github.com/wang-bin/fvp","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-bin%2Ffvp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-bin%2Ffvp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-bin%2Ffvp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wang-bin%2Ffvp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wang-bin","download_url":"https://codeload.github.com/wang-bin/fvp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809964,"owners_count":20999816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["d3d11","desktop","dolby-vision","flutter","hdr","metal","player","video"],"created_at":"2024-11-11T09:24:44.199Z","updated_at":"2025-04-08T09:13:23.315Z","avatar_url":"https://github.com/wang-bin.png","language":"Dart","funding_links":["https://github.com/sponsors/wang-bin","https://www.paypal.me/ibingow"],"categories":["Dart"],"sub_categories":[],"readme":"# FVP\n\nA plugin for official [Flutter Video Player](https://pub.dev/packages/video_player) to support all desktop and mobile platforms, with hardware accelerated decoding and optimal rendering. Based on [libmdk](https://github.com/wang-bin/mdk-sdk). You can also create your own players other than official `video_player` with [backend player api](#backend-player-api)\n\nPrebuilt example can be download from artifacts of [github actions](https://github.com/wang-bin/fvp/actions).\n\n[More examples are here](https://github.com/wang-bin/mdk-examples/tree/master/flutter)\n\nproject is create with `flutter create -t plugin --platforms=linux,macos,windows,android,ios -i objc -a java fvp`\n\n## Features\n- All platforms: Windows x64(including win7) and arm64, Linux x64 and arm64, macOS, iOS, Android(requires flutter \u003e 3.19 because of minSdk 21).\n- You can choose official implementation or this plugin's\n- Optimal render api: d3d11 for windows, metal for macOS/iOS, OpenGL for Linux and Android(Impeller support)\n- Hardware decoders are enabled by default\n- Dolby Vision support on all platforms\n- Minimal code change for existing [Video Player](https://pub.dev/packages/video_player) apps\n- Support most formats via FFmpeg demuxer and software decoders if not supported by gpu. You can use your own ffmpeg 4.0~7.1(or master branch) by removing bundled ffmpeg dynamic library.\n- High performance. Lower cpu, gpu and memory load than libmpv based players.\n- Support audio without video\n- HEVC, VP8 and VP9 transparent video\n- Small footprint. Only about 10MB size increase per cpu architecture(platform dependent).\n\n\n## How to Use\n\n- Add [fvp](https://pub.dev/packages/fvp) in your pubspec.yaml dependencies: `flutter pub add fvp`. Since flutter 3.27, fvp must be a direct dependency in your app's pubspec.yaml.\n- **(Optional)** Add 2 lines in your video_player examples. Without this step, this plugin will be used for video_player unsupported platforms(windows, linux), official implementation will be used otherwise.\n\n```dart\nimport 'package:fvp/fvp.dart' as fvp;\n\nfvp.registerWith(); // in main() or anywhere before creating a player. use fvp for all platforms.\n```\n\nYou can also select the platforms to enable fvp implementation\n\n```dart\nregisterWith(options: {'platforms': ['windows', 'macos', 'linux']}); // only these platforms will use this plugin implementation\n```\n\nTo select [other decoders](https://github.com/wang-bin/mdk-sdk/wiki/Decoders), pass options like this\n```dart\nfvp.registerWith(options: {\n    'video.decoders': ['D3D11', 'NVDEC', 'FFmpeg']\n    //'lowLatency': 1, // optional for network streams\n    }); // windows\n```\n\n[The document](https://pub.dev/documentation/fvp/latest/fvp/registerWith.html) lists all options for `registerWith()`\n\n### Error Handling\nErrors are usually produced when loading a media.\n```dart\n_controller.addListener(() {\n  if (_controller.value.hasError \u0026\u0026 !_controller.value.isCompleted) {\n    ...\n```\n\n### Backend Player API\n\n```dart\nimport 'package:fvp/mdk.dart';\n```\n\nThe plugin implements [VideoPlayerPlatform](https://pub.dev/packages/video_player_platform_interface) via [a thin wrapper](https://github.com/wang-bin/fvp/blob/master/lib/video_player_mdk.dart) on [player.dart](https://github.com/wang-bin/fvp/blob/master/lib/src/player.dart).\n\nNow we also expose this backend player api so you can create your own players easily, and gain more features than official [video_player](https://pub.dev/packages/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.\n[This is an example](https://github.com/wang-bin/mdk-examples/blob/master/flutter/simple/lib/multi_textures.dart)\n\n### VideoPlayerController Extensions\n\nWith this extension, we can leverage mature `video_player` code without rewriting a new one via backend player api, but gain more features, for example `snapshot()`, `record()`, `fastSeekTo()`, `setExternalSubtitle()`.\n\n\n```dart\nimport 'package:fvp/fvp.dart' as fvp;\n\nfvp.registerWith(); // in main() or anywhere before creating a player. use fvp for all platforms.\n\n// somewhere after controller is initialized\n_controller.record('rtmp://127.0.0.1/live/test');\n```\n\n# Upgrade Dependencies Manually\nUpgrading binary dependencies can bring new features and backend bug fixes. For macOS and iOS, in your project dir, run\n```bash\npod cache clean mdk\nfind . -name Podfile.lock -delete\nrm -rf {mac,i}os/Pods\n```\n\nFor other platforms, set environment var `FVP_DEPS_LATEST=1` and rebuilt, will upgrade to the latest sdk. If fvp is installed from pub.dev, run `flutter pub cache clean` is another option.\n\n\n# Design\n- Playback control api in dart via ffi\n- Manage video renderers in platform specific manners. Receive player ptr via `MethodChannel` to construct player instance and set a renderer target.\n- Callbacks and events in C++ are notified by ReceivePort\n- Function with a one time callback is async and returns a future\n\n\n# Enable Subtitles\n\nlibass 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](https://sourceforge.net/projects/mdk-sdk/files/deps/dep.7z/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.\n\nIf required subtitle font is not found in the system(e.g. android), you can add [assets/subfont.ttf](https://github.com/mpv-android/mpv-android/raw/master/app/src/main/assets/subfont.ttf) in pubspec.yaml assets as the fallback. Optionally you can also download the font file by fvp like this\n```dart\n  fvp.registerWith(options: {\n    'subtitleFontFile': 'https://github.com/mpv-android/mpv-android/raw/master/app/src/main/assets/subfont.ttf'\n  });\n```\n\n# DO NOT use flutter-snap\nFlutter can be installed by snap, but it will add some [enviroment vars(`CPLUS_INCLUDE_PATH` and `LIBRARY_PATH`) which may break C++ compiler](https://github.com/canonical/flutter-snap/blob/main/env.sh#L15-L18). It's not recommended to use snap, althrough building for linux is [fixed](https://github.com/wang-bin/fvp/commit/567c68270ba16b95b1198ae58850707ae4ad7b22), but it's not possible for android.\n\n# Screenshots\n![fpv_android](https://user-images.githubusercontent.com/785206/248862591-40f458e5-d7ca-4513-b709-b056deaaf421.jpeg)\n![fvp_ios](https://user-images.githubusercontent.com/785206/250348936-e5e1fb14-9c81-4652-8f53-37e8d64195a3.jpg)\n![fvp_win](https://user-images.githubusercontent.com/785206/248859525-920bdd51-6947-4a00-87b4-9c1a21a68d51.jpeg)\n![fvp_win7](https://user-images.githubusercontent.com/785206/266754957-883d05c9-a057-4c1c-b824-0dc385a13f78.jpg)\n![fvp_linux](https://user-images.githubusercontent.com/785206/248859533-ce2ad50b-2ead-43bb-bf25-6e2575c5ebe1.jpeg)\n![fvp_macos](https://user-images.githubusercontent.com/785206/248859538-71de39a4-c5f0-4c8f-9920-d7dfc6cd0d9a.jpg)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwang-bin%2Ffvp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwang-bin%2Ffvp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwang-bin%2Ffvp/lists"}