betterplayer

jhomlalaApache-2.0活跃维护

Flutter 跨平台视频播放器插件,支持 HLS、DASH、DRM、缓存、画中画和 VAST 广告,适合做短视频流和商业级播放场景。

Production-grade video player for Flutter (Android, iOS, Web, macOS, Windows, Linux) - HLS, DASH, DRM (Widevine & FairPlay), caching, PiP, VAST ads, and vertical video feeds.

1.36.0发布于 2026-11-08 20:34 UTC1,055star +3 / 7 天1,398fork同步于 2026-11-10 23:51 UTC

怎么上手

由 README 提炼,执行前请确认
flutter pub add better_player
硬件要求按 README 说明

README 未说明具体硬件要求;各平台使用系统原生媒体引擎(Android Media3/ExoPlayer、iOS/macOS AVPlayer、Web Shaka/HTML5、Windows/Linux libmpv),未提及显存或 GPU 型号。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

Flutter 全平台视频播放器,一个控制器搞定 HLS、DRM、缓存和 PiP

Flutter 跨平台视频播放器插件,支持 HLS、DASH、DRM、缓存、画中画和 VAST 广告,适合做短视频流和商业级播放场景。

核心能力

  • 用统一 BetterPlayerController 管理播放与 UI 控制
  • 原生支持 HLS/DASH 与 Widevine、FairPlay DRM
  • 内置离线缓存、画中画与播放列表
  • 支持 SRT、WebVTT、TTML、CEA-608/708 字幕
  • 内置 VAST/VMAP 客户端广告引擎与视频流组件

容易踩的坑

Windows 和 Linux 端依赖 libmpv 引擎,需确认目标环境已具备;Tizen 支持仍为实验性;从 0.0.x 或 better_player_plus 升级到 1.x 需按迁移指南改造 API。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本1.36.0
  1. 1.36.0最新正式版2026-11-08 · 2026-11-08 20:34 UTC

    better_player_tizen

    1.0.0

    • Added: Initial EXPERIMENTAL release of better_player_tizen for Tizen OS and Samsung Smart TVs using the native Tizen Multimedia <player.h> C API.
    • Added: Capture and upload of Tizen E2E test playback screenshot artifacts in CI/CD workflow.
    • Fixed: Added buffering start and end events, seek completion event, User-Agent header forwarding, dynamic video size change notifications, replay after completion, asset data source support, and linked capi-media-tool.

    better_player

    1.36.0

    • Added: Initial EXPERIMENTAL Tizen platform implementation in packages/better_player_tizen.
  2. 1.35.02026-11-08 · 2026-11-08 13:44 UTC
    查看更新说明

    better_player_platform_interface

    1.8.0

    • Added: getAudioTracks method to BetterPlayerPlatform to retrieve audio tracks from the native player.
    • Updated: Updated doc comment for setSpeed to reflect the new 10.0 limit.

    better_player_android

    1.13.0

    • Added: getAudioTracks implementation to query audio tracks from Media3 trackSelector.currentMappedTrackInfo.
    • Fixed: Improved setAudioTrack matching logic to resolve multi-audio tracks by index and language when container tracks lack explicit labels.

    better_player_ios

    1.13.0

    • Added: getAudioTracks implementation to query audible options on AVPlayer's current media asset.
    • Updated: Increased playback speed ceiling from 4.0 to 10.0 in setSpeed.

    better_player_macos

    1.8.0

    • Added: getAudioTracks implementation to query audible options on AVPlayer's current media asset.
    • Updated: Increased playback speed ceiling from 4.0 to 10.0 in setSpeed.

    better_player_windows

    1.5.0

    • Added: getAudioTracks implementation to query container and stream audio tracks from mpv track-list.
    • Updated: Increased playback speed ceiling from 4.0 to 10.0 in setSpeed.

    better_player_web

    1.6.0

    • Added: getAudioTracks implementation to query audio tracks from Shaka Player variant tracks and audio languages.

    better_player

    1.35.0

    • Added: BetterPlayerController.getAudioTracks() to discover and retrieve audio tracks from both HLS/DASH manifests and native container formats (MKV, MP4, WebM).
    • Updated: Increased playback speed ceiling from 4.0 to 10.0 across setSpeed().
    • Updated: Bumped federated sub-packages: better_player_platform_interface to ^1.8.0, better_player_android to ^1.13.0, better_player_ios to ^1.13.0, better_player_linux to ^1.1.0, better_player_macos to ^1.8.0, better_player_web to ^1.6.0, and better_player_windows to ^1.5.0.
  3. 1.34.02026-11-08 · 2026-11-08 09:58 UTC
    查看更新说明

    better_player_android

    1.12.0

    • Updated: Upgraded androidx.media3 to 1.11.1, androidx.lifecycle to 2.11.0, androidx.annotation to 1.11.0, and androidx.work:work-runtime to 2.12.0.
    • Updated: Removed legacy unused androidx.media:media dependency and imports.
    • Fixed: Pre-cache worker falsely reporting HTTP errors as completed downloads.
    • Fixed: Widevine DRM defaulting to L3 software security level when drmSecurityLevel is not specified.

    better_player_ios

    1.12.0

    • [BREAKING_CHANGE] Fixed: Resolved FairPlay key loading thread deadlocks by removing blocking DispatchSemaphore, made assetId strictly local per request to prevent race conditions, added thread-safe certificate caching with in-flight request deduplication, and scoped EZDRM URL path rewriting to EZDRM domains only. Non-EZDRM license servers now receive standard direct POST requests.
    • Fixed: CacheManager shared state race condition during concurrent pre-caching and dynamic maxCacheSize updates.

    better_player_macos

    1.7.0

    • [BREAKING_CHANGE] Fixed: Resolved FairPlay key loading thread deadlocks by removing blocking DispatchSemaphore, made assetId strictly local per request to prevent race conditions, added thread-safe certificate caching with in-flight request deduplication, and scoped EZDRM URL path rewriting to EZDRM domains only. Non-EZDRM license servers now receive standard direct POST requests.
    • Fixed: CacheManager shared state race condition during concurrent pre-caching and dynamic maxCacheSize updates.

    better_player_web

    1.5.0

    • Added: ClearKey DRM support on Web via Shaka Player clearKeys (supporting both standard and Base64Url JWKs and hex keys) and servers['org.w3.clearkey'] (for license servers).

    better_player

    1.34.0

    • [BREAKING_CHANGE] Updated: Streamlined BetterPlayerFeedController collection and lease methods. Replaced insertDataSources with insertAll({required int index, required List<PlayerDataSource> sources, List<String>? ids}), replaced replaceAt with replace({required int index, required PlayerDataSource dataSource, String? id}), replaced getLeaseNotifier(index) with leaseNotifier(index), and required named parameters on insert({required int index, required PlayerDataSource dataSource, String? id}). Removed unused feedConfiguration constructor parameter.
    • [BREAKING_CHANGE] Updated: Removed unused onProgress parameter from PlayerEngineController.preCache (all pre-cache events flow through preCacheProgressStream).
    • Added: Playback controls on BetterPlayerFeedController (play, pause, togglePlay, isPlaying, activeController) and dynamic autoPlay property.
    • Added: Feed navigation helpers (jumpTo, next, previous) and collection helpers (add, addAll, positional removeAt, retry with default active index) on BetterPlayerFeedController.
    • Fixed: Wired PlayerFeedConfiguration.autoPlay to feed playback and added PlayerFeedConfiguration.copyWith.
    • Fixed: Resolved byte truncation bug in BetterPlayerClearKeyUtils.generateKey preserving leading zero bytes in 16-byte DRM keys.
    • Fixed: Decoded network subtitles as UTF-8 via response bytes to prevent Latin-1 encoding corruption, and guarded against HTTP error response bodies.
    • Fixed: BetterPlayerPool active index protection during slot eviction, failed lease slot reuse, and concurrent bind state tracking.
    • Updated: Bumped federated sub-packages: better_player_android to ^1.12.0, better_player_ios to ^1.12.0, better_player_macos to ^1.7.0, and better_player_web to ^1.5.0.
  4. 1.33.02026-11-04 · 2026-11-04 12:45 UTC
    查看更新说明

    better_player_platform_interface

    1.7.1

    • Updated: Aligned analysis options with root analysis_options.yaml and resolved linter warnings across models and tests.

    better_player_android

    1.11.0

    • Updated: Modernized analysis_options.yaml to inherit root options and resolved static analysis lints.

    better_player_ios

    1.11.1

    • Updated: Modernized analysis_options.yaml to inherit root options and resolved static analysis lints.

    better_player_linux

    1.0.2

    • Updated: Modernized analysis_options.yaml to inherit root options and resolved static analysis lints.

    better_player_macos

    1.6.1

    • Updated: Modernized analysis_options.yaml to inherit root options and resolved static analysis lints.

    better_player_windows

    1.4.2

    • Updated: Modernized analysis_options.yaml to inherit root options and resolved static analysis lints.

    better_player_web

    1.4.1

    • Updated: Modernized analysis_options.yaml to inherit root options and resolved static analysis lints.

    better_player

    1.33.0

    • Added: Feed error handling with PlayerFeedConfiguration.errorBuilder, localized PlayerFeedErrorView, and BetterPlayerFeedController.retry.
    • Added: Feed list mutation methods on BetterPlayerFeedController (insertDataSources, removeAt, replaceAt, replaceAll) with stable item identifiers and PageView reactivity.
    • Added: Dynamic slot recycling and index shifting support in BetterPlayerPool via releaseItem and reindex.
    • Added: Quality of Experience (QoE) telemetry on BetterPlayerFeedController.metricsStream tracking time to first frame, preloading state, rebuffering stalls, and errors.
    • Fixed: Pooled feed slots no longer stay broken after a failed data source setup, with slots recovering cleanly on retry.
    • Added: Unit test coverage for PlayerEngineController, PlayerClosedCaption, and all core controller extensions (PlayerDataSourceExtension, PlayerEventsExtension, PlayerPlaybackExtension, PlayerPlaylistExtension, PlayerSubtitleExtension, PlayerTrackExtension, PlayerTranslationsExtension, PlayerViewStateExtension).
    • Updated: Replaced legacy package:flutter/material.dart and cupertino.dart imports with package:material_ui and package:cupertino_ui across controls and test suites.
    • Updated: Aligned packages/better_player analysis options with root analysis_options.yaml, enabling strict lint rules including unawaited_futures, avoid_catches_without_on_clauses, and typed function callbacks while resolving issues across controls, HLS parsing, data sources, and tests.
    • Updated: Resolved static analysis lints and enabled stricter rules across example app and platform packages.
    • Updated: Bumped federated sub-packages: better_player_platform_interface to ^1.7.1, better_player_android to ^1.11.0, better_player_ios to ^1.11.1, better_player_linux to ^1.0.2, better_player_macos to ^1.6.1, better_player_web to ^1.4.1, and better_player_windows to ^1.4.2.
  5. 1.32.02026-11-02 · 2026-11-02 20:28 UTC
    查看更新说明

    better_player_platform_interface

    1.7.0

    • Added: showExternalPlaybackPicker and externalPlaybackStream to BetterPlayerPlatform for native AirPlay, Cast, and Remote Playback routing.

    better_player_ios

    1.11.0

    • Added: Native AirPlay route picker (AVRoutePickerView) and externalPlaybackActive KVO state stream.
    • Updated: Bumped better_player_platform_interface dependency to ^1.7.0.

    better_player_macos

    1.6.0

    • Added: Native AirPlay route picker (AVRoutePickerView) and externalPlaybackActive KVO state stream.
    • Updated: Bumped better_player_platform_interface dependency to ^1.7.0.

    better_player_web

    1.4.0

    • Added: W3C Remote Playback API and WebKit AirPlay picker support (showExternalPlaybackPicker) and connection state stream.
    • Updated: Bumped better_player_platform_interface dependency to ^1.7.0.

    better_player

    1.32.0

    • Added: Native AirPlay and Remote Playback support across iOS, macOS, and Web with top-bar route picker controls, PlayerControlsConfiguration.enableAirPlay, BetterPlayerController.showAirPlayPicker(), BetterPlayerController.isExternalPlaybackSupported, and PlayerEventType.externalPlaybackChanged.
    • Added: PlayerCastExtension interface to integrate third-party casting backends without increasing core package size.
    • Updated: Bumped federated sub-packages: better_player_platform_interface to ^1.7.0, better_player_ios to ^1.11.0, better_player_macos to ^1.6.0, and better_player_web to ^1.4.0.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Better Player


    Why Better Player?

    Stop stitching video_player, separate UI packages, abandoned caching plugins, and custom DRM code together. Better Player packs the full video stack into a single, cohesive engine.

    FeatureBetter Playervideo_player + chewiemedia_kit
    App Size Overhead~1-2 MB (Native OS engines)~1-2 MB+30MB to 50MB (Bundled mpv binaries)
    Out-of-the-box UIBuilt-in & customizableChewie requiredBuilt-in
    HLS / DASHFull native supportBasicNative
    DRM (Widevine / FairPlay)Native supportNoneNone
    Smart CachingBuilt-in offline cacheNone (3rd party needed)None
    Subtitles & Closed CaptionsSRT, WebVTT, TTML, CEA-608 / CEA-708SRT onlyAdvanced
    Picture in Picture (PiP)Built-inNonePlatform-dependent
    PlaylistsBuilt-inNoneBuilt-in
    VAST / VMAP AdsClient-side ad engine (VAST 2.0-4.x, VMAP)NoneNone
    Telemetry & QoEReal-time video metrics, offline retention & cloud exportNoneNone
    Watermarking & Screen ShieldDynamic forensic overlays & native OS screen capture protectionNoneNone
    Video Feeds & PoolingBuilt-in (BetterPlayerFeed, BetterPlayerPool)NoneNone
    AirPlay & Remote PlaybackNative AirPlay (iOS/macOS) & Remote Playback (Web)None (3rd party needed)None

    📱 Visual Showcase


    📦 Quick Start

    1. Install

    flutter pub add better_player
    

    2. Basic Playback

    Play a network video with full controls in three lines:

    import 'package:better_player/better_player.dart';
    
    AspectRatio(
      aspectRatio: 16 / 9,
      child: BetterPlayer.network(
        "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
      ),
    )
    

    3. Production Playback (Caching, DRM & HLS)

    Configure caching, custom headers, or DRM with a single controller:

    final controller = BetterPlayerController(
      const PlayerConfiguration(
        aspectRatio: 16 / 9,
        autoPlay: true,
      ),
      betterPlayerDataSource: PlayerDataSource(
        DataSourceType.network,
        "https://example.com/stream.m3u8",
        // Cache video locally for instant playback:
        cacheConfiguration: const CacheConfiguration(useCache: true),
        // Or protect content with DRM:
        drmConfiguration: DrmConfiguration(
          drmType: DrmType.widevine,
          licenseUrl: "https://license.example.com",
        ),
      ),
    );
    
    BetterPlayer(controller: controller);
    

    🌐 Platform Packages

    Better Player uses a federated architecture. Each platform runs on its native, hardware-accelerated media engine:

    PlatformPackageEngineStatus
    Androidbetter_player_androidGoogle Media3 / ExoPlayerpub
    iOSbetter_player_iosApple AVPlayerpub
    macOSbetter_player_macosApple AVPlayerpub
    Webbetter_player_webShaka Player / HTML5pub
    Windowsbetter_player_windowslibmpvpub
    Linuxbetter_player_linuxlibmpvpub
    Tizen (Experimental)better_player_tizenTizen <player.h>Experimental

    🔄 Migration Guides

    Switching from another package? Follow the step-by-step migration guides:


    🤖 AI Coding Agents

    Better Player supports Dart package skills so tools like Cursor, Claude Code, Gemini, and Copilot understand the API out of the box:

    dart run skills@ get -p better_player
    

    📖 Resources & Docs


    🤝 Contributing

    Found a bug or missing a feature? Open an issue or submit a pull request.

    💼 Enterprise Support

    Need a custom video source adapter, bespoke DRM implementation, or tailored UI controls? I am available for consulting.

    Contact on LinkedIn →