播放依赖 YouTube iFrame Player API,需遵守 YouTube API 服务条款;youtube_player_iframe_web 由 youtube_player_iframe 自动引入,一般无需手动添加;README 未说明网络与地区限制等运行前提
youtube_player_flutter
sarbagyasthaBSD-3-Clause更新放缓Flutter 插件,基于官方 iFrame Player API 在 App 内嵌播放或流式播放 YouTube 视频,省去跳转外部应用的麻烦。
A Flutter plugin for inline playback or streaming of YouTube videos using the official iFrame Player API.
flutter pub add youtube_player_flutterREADME 未说明
基于官方 iFrame API 的 Flutter YouTube 播放插件,可直接嵌入视频或直播
Flutter 插件,基于官方 iFrame Player API 在 App 内嵌播放或流式播放 YouTube 视频,省去跳转外部应用的麻烦。
核心能力
- 内置播放控件、进度条、拖动跳转和捏合全屏
- 提供直播流专用 UI
- youtube_player_iframe 暴露完整 iFrame API 供自建 UI
- 支持播放列表、元数据和缩略图懒加载组件
- 覆盖 Android、iOS、macOS、Web 四个平台
容易踩的坑
- youtube_player_iframe-v3.0.3youtube_player_iframe v3.0.3最新正式版2022-08-14 · 2022-08-14 15:15 UTC
- Fixed issues related to Fullscreen.
- Added
onInit&onFullscreenChangecallbacks to YoutubePlayerController. - Added Migrating to v3 section in the docs.
- Listed
Swipe up/down to enter/exit fullscreen modeas a feature in the docs. - Deprecated
autoPlayparam in YoutubePlayerParams, as it's no longer used. - Removed
hasPlayed,position&bufferedfrom YoutubePlayerValue, as these values can be accessed through YoutubePlayerController.
- v1.0.1-iframeyoutube_player_iframe v1.0.12020-07-17 · 2020-07-17 03:16 UTC
查看更新说明
- Fixed Disabled navigation inside the player. This solves the issue where tapping on actions would navigate to different web pages.
- Removed
foreceHDparam, in favor ofdesktopMode. ThedesktopModealso supports changing quality in fullscreen mode. - Added two new methods,
hideTopMenu()andhidePauseOverlay(). Visit ReadMe for more detail.
- v1.0.0+4youtube_player_iframe v1.0.0+42020-07-12 · 2020-07-12 07:31 UTC
查看更新说明
Initial release of youtube_player_iframe
- v7.0.0+2Version 7.0.0+22020-06-01 · 2020-06-01 04:40 UTC
查看更新说明
- Added
onEnterFullScreen&onExitFullScreencallback toYoutubePlayerBuilder. - Player switches back to normal mode on system back, if on fullscreen.
- Added
thumbnailparameter toYoutubePlayer, removedthumbnailUrl. Now any widget can be used as thumbnail. - Fixed issues with progress colors.
- Added
- v7.0.0+1Version 7.0.02020-05-31 · 2020-05-31 13:26 UTC
查看更新说明
- (Fixed) random crashes
- (Fixed) issues with orientation
- (Improvements) Added automatic fullscreen toggle wrt to orientation change
BREAKING CHANGE
- Requires iOS:
--ios-language swift, Xcode version>= 11 - Requires Android:
minSdkVersion 17 - Removed exported
WebViewwidget
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Packages
| Package | Version | Demo | Description | Platforms |
|---|---|---|---|---|
| youtube_player_flutter | Batteries-included YouTube player with built-in controls, gestures, and live stream UI | Android, iOS, macOS, Web | ||
| youtube_player_iframe | Full-control Flutter port of the YouTube iFrame API. Build your own UI. | Android, iOS, macOS, Web | ||
| youtube_player_iframe_web | Web platform implementation for youtube_player_iframe (added automatically) | Web |
Which package should I use?
youtube_player_flutter: just want a player that works
The quickest path to YouTube playback in your app. It ships with ready-made controls, a progress bar, drag-to-seek, pinch-to-fullscreen, and a live stream UI, all out of the box. Drop it in, point it at a video ID, and you're done.
flutter pub add youtube_player_flutter
Best for: apps that want a polished, functional player with minimal setup.
youtube_player_iframe: want full control over the player
A lower-level package that gives you the complete YouTube iFrame API. You own the UI; the package handles playback state, playlists, metadata, fullscreen transitions, thumbnails, and more. Includes a lazy-loading thumbnail widget perfect for video lists.
flutter pub add youtube_player_iframe
Best for: apps with a custom player design, complex playback logic, or playlist management needs.
youtube_player_iframe_web: you probably don't need to add this
This is the web platform implementation consumed automatically by youtube_player_iframe. You only need to add it directly if you're building a platform plugin or working inside this monorepo.
License
BSD-3-Clause. See LICENSE for details.
This project uses the YouTube IFrame Player API. By using these packages, you agree to the YouTube API Services Terms of Service.
API method documentation is adapted from the YouTube IFrame Player API Reference, © Google LLC, licensed under CC BY 4.0. See NOTICE for details.