{"id":14256033,"url":"https://github.com/fluttercommunity/chewie","last_synced_at":"2025-05-14T04:07:48.632Z","repository":{"id":37273006,"uuid":"113233163","full_name":"fluttercommunity/chewie","owner":"fluttercommunity","description":"The video player for Flutter with a heart of gold","archived":false,"fork":false,"pushed_at":"2025-04-17T17:08:31.000Z","size":38311,"stargazers_count":1994,"open_issues_count":421,"forks_count":1042,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-18T07:08:40.329Z","etag":null,"topics":["flutter","video-player"],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttercommunity.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2017-12-05T21:08:17.000Z","updated_at":"2025-04-18T02:23:42.000Z","dependencies_parsed_at":"2024-04-01T16:29:10.663Z","dependency_job_id":"6d6d7e82-0deb-439d-8217-58f1eadf0960","html_url":"https://github.com/fluttercommunity/chewie","commit_stats":{"total_commits":332,"total_committers":74,"mean_commits":4.486486486486487,"dds":0.8493975903614458,"last_synced_commit":"015a986d3fc6e2ee01c44890681d04ba59712324"},"previous_names":["brianegan/chewie"],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fchewie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fchewie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fchewie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fchewie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercommunity","download_url":"https://codeload.github.com/fluttercommunity/chewie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069446,"owners_count":22009556,"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":["flutter","video-player"],"created_at":"2024-08-22T06:01:11.620Z","updated_at":"2025-05-14T04:07:48.605Z","avatar_url":"https://github.com/fluttercommunity.png","language":"Dart","funding_links":[],"categories":["Dart"],"sub_categories":[],"readme":"# chewie\n\n[![Flutter Community: chewie](https://fluttercommunity.dev/_github/header/chewie)](https://github.com/fluttercommunity/community)\n\n[![Version](https://img.shields.io/pub/v/chewie.svg)](https://pub.dev/packages/chewie)\n![CI](https://github.com/brianegan/chewie/workflows/CI/badge.svg)\n[![Generic badge](https://img.shields.io/badge/platform-android%20|%20ios%20|%20web%20-blue.svg)](https://pub.dev/packages/chewie)\n\nThe video player for Flutter with a heart of gold. \n\nThe [`video_player`](https://pub.dartlang.org/packages/video_player) plugin provides low-level \naccess to video playback. \n\nChewie uses the `video_player` under the hood and wraps it in a friendly Material or Cupertino UI!\n\n## Table of Contents\n1.  🚨 [IMPORTANT!!! (READ THIS FIRST)](#-important-read-this-first)\n2.  🔀 [Flutter Version Compatibility](#-flutter-version-compatibility)\n3.  🖼️ [Preview](#%EF%B8%8F-preview)\n4.  ⬇️ [Installation](#%EF%B8%8F-installation)\n5.  🕹️ [Using it](#%EF%B8%8F-using-it)\n6.  ⚙️ [Options](#%EF%B8%8F-options)\n7.  🔡 [Subtitles](#-subtitles)\n8.  🧪 [Example](#-example)\n9.  ⏪ [Migrating from Chewie \u003c 0.9.0](#-migrating-from-chewie--090)\n10. 🗺️ [Roadmap](#%EF%B8%8F-roadmap)\n11. ⚠️ [Android warning](#%EF%B8%8F-android-warning)\n12. 📱 [iOS warning](#-ios-warning)\n\n\n## 🚨 IMPORTANT!!! (READ THIS FIRST)\nThis library is __NOT__ responsible for any issues caused by `video_player`, since it's merely a UI \nlayer on top of it. \n\nIn other words, if you see any `PlatformException`s being thrown in your app due to video playback,\nthey are exclusive to the `video_player` library. \n\nInstead, please raise an issue related to it with the [Flutter Team](https://github.com/flutter/flutter/issues/new/choose).\n\n## 🔀 Flutter Version Compatibility\n\nThis library will at the very least make a solid effort to support the second most recent version \nof Flutter released. In other words, it will adopt `N-1` version support at\nthe bare minimum.\n\nHowever, this cannot be guaranteed due to major changes between Flutter versions. Should that occur,\nfuture updates will be released as major or minor versions as needed.\n\n## 🖼️ Preview\n\n|                                MaterialControls                                 |                                MaterialDesktopControls                                 |\n|:-------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------:|\n| ![](https://github.com/brianegan/chewie/raw/master/assets/MaterialControls.png) | ![](https://github.com/brianegan/chewie/raw/master/assets/MaterialDesktopControls.png) |\n\n### CupertinoControls\n![](https://github.com/brianegan/chewie/raw/master/assets/CupertinoControls.png)\n\n## ⬇️ Installation\n\nIn your `pubspec.yaml` file within your Flutter Project add `chewie` and `video_player` under dependencies:\n\n```yaml\ndependencies:\n  chewie: \u003clatest_version\u003e\n  video_player: \u003clatest_version\u003e\n```\n\n## 🕹️ Using it\n\n```dart\nimport 'package:chewie/chewie.dart';\nimport 'package:video_player/video_player.dart';\n\nfinal videoPlayerController = VideoPlayerController.networkUrl(Uri.parse(\n    'https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4'));\n\nawait videoPlayerController.initialize();\n\nfinal chewieController = ChewieController(\n  videoPlayerController: videoPlayerController,\n  autoPlay: true,\n  looping: true,\n);\n\nfinal playerWidget = Chewie(\n  controller: chewieController,\n);\n```\n\nPlease make sure to dispose both controller widgets after use. For example, by overriding the dispose method of the a `StatefulWidget`:\n```dart\n@override\nvoid dispose() {\n  videoPlayerController.dispose();\n  chewieController.dispose();\n  super.dispose();\n}\n```\n\n## ⚙️ Options\n\n![](https://github.com/brianegan/chewie/raw/master/assets/Options.png)\n\nChewie has some options which control the video. These options appear by default in a `showModalBottomSheet` (similar to YT). By default, Chewie passes  `Playback speed` and `Subtitles` options as an `OptionItem`.\n\nTo add additional options, just add these lines to your `ChewieController`:\n\n```dart\nadditionalOptions: (context) {\n  return \u003cOptionItem\u003e[\n    OptionItem(\n      onTap: () =\u003e debugPrint('My option works!'),\n      iconData: Icons.chat,\n      title: 'My localized title',\n    ),\n    OptionItem(\n      onTap: () =\u003e\n          debugPrint('Another option that works!'),\n      iconData: Icons.chat,\n      title: 'Another localized title',\n    ),\n  ];\n},\n```\n\n### Customizing the modal sheet\n\nIf you don't like the default `showModalBottomSheet` for showing your options, you can override the View with the `optionsBuilder` method:\n\n```dart\noptionsBuilder: (context, defaultOptions) async {\n  await showDialog\u003cvoid\u003e(\n    context: context,\n    builder: (ctx) {\n      return AlertDialog(\n        content: ListView.builder(\n          itemCount: defaultOptions.length,\n          itemBuilder: (_, i) =\u003e ActionChip(\n            label: Text(defaultOptions[i].title),\n            onPressed: () =\u003e\n                defaultOptions[i].onTap!(),\n          ),\n        ),\n      );\n    },\n  );\n},\n```\n\nYour `additionalOptions` are already included here (if you provided `additionalOptions`)!\n\n### Translations\n\nWhat is an option without proper translation? \n\nTo add your translation strings add:\n\n```dart\noptionsTranslation: OptionsTranslation(\n  playbackSpeedButtonText: 'Wiedergabegeschwindigkeit',\n  subtitlesButtonText: 'Untertitel',\n  cancelButtonText: 'Abbrechen',\n),\n```\n\n## 🔡 Subtitles\n\n\u003e Since version 1.1.0, Chewie supports subtitles.\n\nChewie allows you to enhance the video playback experience with text overlays. You can add a `List\u003cSubtitle\u003e` to your `ChewieController` and fully customize their appearance using the `subtitleBuilder` function.\n\n### Showing Subtitles by Default\n\nChewie provides the `showSubtitles` flag, allowing you to control whether subtitles are displayed automatically when the video starts. By default, this flag is set to `false`.\n\n### Adding Subtitles\n\nHere’s an example of how to add subtitles to your `ChewieController`:\n\n```dart\nChewieController(\n  videoPlayerController: _videoPlayerController,\n  autoPlay: true,\n  looping: true,\n  subtitle: Subtitles([\n    Subtitle(\n      index: 0,\n      start: Duration.zero,\n      end: const Duration(seconds: 10),\n      text: 'Hello from subtitles',\n    ),\n    Subtitle(\n      index: 1,\n      start: const Duration(seconds: 10),\n      end: const Duration(seconds: 20),\n      text: 'What’s up? :)',\n    ),\n  ]),\n  showSubtitles: true, // Automatically display subtitles\n  subtitleBuilder: (context, subtitle) =\u003e Container(\n    padding: const EdgeInsets.all(10.0),\n    child: Text(\n      subtitle,\n      style: const TextStyle(color: Colors.white),\n    ),\n  ),\n);\n```\n\n### Subtitle Structure\n\nThe `Subtitle` model contains the following key attributes:\n\n- **`index`**: A unique identifier for the subtitle, useful for database integration.\n- **`start`**: The starting point of the subtitle, defined as a `Duration`.\n- **`end`**: The ending point of the subtitle, defined as a `Duration`.\n- **`text`**: The subtitle text that will be displayed.\n\nFor example, if your video is 10 minutes long and you want to add a subtitle that appears between `00:00` and `00:10`, you can define it like this:\n\n```dart\nSubtitle(\n  index: 0,\n  start: Duration.zero,\n  end: const Duration(seconds: 10),\n  text: 'Hello from subtitles',\n),\n```\n\n### Customizing Subtitles\n\nUse the `subtitleBuilder` function to customize how subtitles are rendered, allowing you to modify text styles, add padding, or apply other customizations to your subtitles.\n\n## 🧪 Example\n\nPlease run the app in the [`example/`](https://github.com/brianegan/chewie/tree/master/example) folder to start playing!\n\n## ⏪ Migrating from Chewie \u003c 0.9.0\n\nInstead of passing the `VideoPlayerController` and your options to the `Chewie` widget you now pass them to the `ChewieController` and pass that later to the `Chewie` widget.\n\n```dart\nfinal playerWidget = Chewie(\n  videoPlayerController,\n  autoPlay: true,\n  looping: true,\n);\n```\n\nbecomes\n\n```dart\nfinal chewieController = ChewieController(\n  videoPlayerController: videoPlayerController,\n  autoPlay: true,\n  looping: true,\n);\n\nfinal playerWidget = Chewie(\n  controller: chewieController,\n);\n```\n\n## 🗺️ Roadmap\n\n- [x] MaterialUI\n- [x] MaterialDesktopUI\n- [x] CupertinoUI\n- [x] Options with translations\n- [x] Subtitles\n- [x] CustomControls\n- [x] Auto-Rotate on FullScreen depending on Source Aspect-Ratio\n- [x] Live-Stream and UI\n- [x] AutoPlay\n- [x] Placeholder\n- [x] Looping\n- [x] Start video at\n- [x] Custom Progress-Bar colors\n- [x] Custom Overlay\n- [x] Allow Sleep (Wakelock)\n- [x] Playbackspeed Control \n- [x] Custom Route-Pagebuilder\n- [x] Custom Device-Orientation and SystemOverlay before and after fullscreen\n- [x] Custom ErrorBuilder\n- [ ] Support different resolutions of video\n- [ ] Re-design State-Manager with Provider\n- [ ] Screen-Mirroring / Casting (Google Chromecast)\n\n\n## ⚠️ Android warning\n\nThere is an open [issue](https://github.com/flutter/flutter/issues/165149) that the buffering state of a video is not reported correctly. With this, the loading state is always triggered, hiding controls to play, pause or seek the video. A workaround was implemented until this is fixed, however it can't be perfect and still hides controls if seeking backwards while the video is paused, as a result of lack of correct buffering information (see #912).\n\nAdd the following to partly fix this behavior:\n\n```dart\n  // Your init code can be above\n  videoController.addListener(yourListeningMethod);\n\n  // ...\n\n  bool wasPlayingBefore = false;\n  void yourListeningMethod() {\n    if (!videoController.value.isPlaying \u0026\u0026 !wasPlayingBefore) {\n      // -\u003e Workaround if seekTo another position while it was paused before.\n      //    On Android this might lead to infinite loading, so just play the\n      //    video again.\n      videoController.play();\n    }\n\n    wasPlayingBefore = videoController.value.isPlaying;\n\n  // ...\n  }\n```\n\nYou can also disable the loading spinner entirely to fix this problem in a more _complete_ way, however will remove the loading indicator if a video is buffering.\n\n```dart\n_chewieController = ChewieController(\n  videoPlayerController: _videoPlayerController,\n  progressIndicatorDelay: Platform.isAndroid ? const Duration(days: 1) : null,\n);\n```\n\n## 📱 iOS warning \n\nThe video_player plugin used by chewie will only work in iOS simulators if you are on flutter 1.26.0 or above. You may need to switch to the beta channel `flutter channel beta`\nPlease refer to this [issue](https://github.com/flutter/flutter/issues/14647).\n\n\n\n```\n000000000000000KKKKKKKKKKKKXXXXXXXXXXXXXKKKKKKKKKKKKKKKKKKKKKKKKKKK00\n000000000000000KKKKKKKKKKKKKXXXXXXXXXXKKKKKKKKKKKKKKKKKKKKKKKKKKKKK00\n000000000000000KKKKKKKKKKKKKXXXXXXK0xdoddoclodxOKKKKKKKKKKKKKKKKKKK00\n00000000000000KKKKKKKKKKKKKKKK0xoc:;;,;,,,,''';cldxO0KKKKKKKKKKKKK000\n00000000000000KKKKKKKKKKKKKKx:'',,,'.,'...;,'''',;:clk0KKKKKKKKKKK000\n00000000000000KKKKKKKKKKKKd;'',,,;;;'.,..,c;;,;;;;;:;;d0KKKKKKKKKK000\n00000000000000KKKKKKKKKKx,',;:ccl;,c;';,,ol::coolc:;;,,x0KKKKKKKKK000\n00000000000000KKKKKKKKOl;:;:clllll;;o;;;cooclddclllllc::kKKKKKKKKK000\n00000000000000KKKKKK0o;:ccclccccooo:ooc:ddoddloddolc;;;:c0KKKKKKK0000\n00000000000000KKKKKOccodolccclllooddddddxdxddxkkkkxxo;'';d0KKKKKK0000\n00000000000000KKKKkcoddolllllclloodxxxxdddxdddxxxddool:'.;O0KKKKK0000\n00000000000000000xloollcccc:cclclodkkxxxdddxxxkkxdlllolc,,x0KKKKK0000\n0000000000000000xccllccccc:;,'',;:dxkxxddddxkkkxdollcc:cc;d0KKKKKK000\n000000000000000kcc:::cllol:'......odxxdoccldxxxdollllc:;;:d0KKKKK0000\n00000000000000klc;;;clcc::;'...';;;:cll..',cdddolccccccc;:x0KKKKK0000\n0000000000000kdl;:cclllclllc::;,;.'.''o;,,'.;ccoooollllc:;x0KKKKK0000\n000000000000kol;:;::coolcc:::,.....,..cd,....':lolclolllc;x0KKKK00000\n00000000000Odl;:'cllol;''',;;;;::''.',:doc;,',::looc:lcol:x0K00000000\n0000000000Oxl:c,:lolc,..',:clllollodoc;cllolccloolllcclollO0K00000000\n0000000000xllc,:lool:'.,...o.;llxdo:loc;;ccodlolodldllolld00K0K000000\n000000000Ooc::coooc,,.',;:lx,,...':;o;l;':o:oolccocdoldloO0000KK00000\n00000000kol:clllc;;,.;::;:clllllolxc;.:c':ocldlccl;clldox000000000000\n000000Odll:cccc;:;,';cllooodoollcloll;c:.:d:ooo;cl;oloddkO00000000000\n0000OOddOdll;c,;;,,;;:cldodddoxdoodlcc:.,ox:o:lllocdlodx00O0000000000\n000Oxdl:::ll,:,:;,';c,:oloddolkxddxolc.'coccocolcccoooc;oxO00KOOOO000\ndc;,'...';c,,:c:::'c:';cldoo;:odolxoc:.,o:oldlxol;lddl,.,lkO0KdlcckKO\n'.......,:''';cll:cc,,;:l:c,,;:oc;cdc,.;::dldoxd:ldol;,'..,:lo,,,,kOk\n.......';'.',:clcll,,;:l:;'..''c:,;cl'.';dxoooxlddl;',''..,,;'...,ool\n.......,,.'';;:cld;.;,do:..;:,':c',:c''';xxdldocol'..';,.......',;;,;\n.......'..'',,coxc'';:do'.clc:lco',o;',;cOxdol:cc:.....'..oxd;','.'..\n'.......''..,:cxl;';;cx:''cll:clc'cl',:l:ko:c..;c:..';...,KNNl;:;ll:'\n.......''...;,ooc,,,:od'.':cccdd,,l''cl:co;;,..;;'..','..;d0O,;;:XXXK\n............'cll;',,lo'.'.::codl,c..:c;doc.,:.',....'...'......'l0XKk\n'............c;;,':lc.'',.;ccol;:,.:c.:o,;'.;'......,...',,.'...'.,;;\n.............',;;,cc..;,'';:lc':;..c'.c:;.,......,'..'...'',:,,;;,...\n..............',,;:'.';,',:c;.;;..';..,;,.........''..'...'kko.,,....\n...............;,:'..;''';:,..;''.''..''............'...'.lK0c';;c;'.\n...............,,'...,.',;''...''....,......'............'dOx',;:dd,'\n..............',.....'.,;..'..',..........'..............';:;',,ldo.'\n.............'''.'.....,'..',','..'...''..'............'.......,dx'.'\n.......................,...';,'..'.....,.'.............''.'......'..'\n...........'......'...',..'';,'..'.....................',';,..'....'.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fchewie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercommunity%2Fchewie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fchewie/lists"}