{"id":15550035,"url":"https://github.com/outdatedguy/cached_video_player_plus","last_synced_at":"2025-03-21T22:32:13.032Z","repository":{"id":211804856,"uuid":"729989154","full_name":"OutdatedGuy/cached_video_player_plus","owner":"OutdatedGuy","description":"Original video_player plugin with the superpower of caching embedded in Android and iOS.","archived":false,"fork":false,"pushed_at":"2024-05-23T03:15:00.000Z","size":312,"stargazers_count":8,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-23T03:42:52.091Z","etag":null,"topics":["cached-video","caching"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/cached_video_player_plus","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/OutdatedGuy.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":["OutdatedGuy"]}},"created_at":"2023-12-11T00:18:50.000Z","updated_at":"2024-08-01T15:20:35.121Z","dependencies_parsed_at":null,"dependency_job_id":"4ac26419-561e-4b22-970a-1ca7b867a715","html_url":"https://github.com/OutdatedGuy/cached_video_player_plus","commit_stats":null,"previous_names":["outdatedguy/cached_video_player_plus"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OutdatedGuy%2Fcached_video_player_plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OutdatedGuy%2Fcached_video_player_plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OutdatedGuy%2Fcached_video_player_plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OutdatedGuy%2Fcached_video_player_plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OutdatedGuy","download_url":"https://codeload.github.com/OutdatedGuy/cached_video_player_plus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880449,"owners_count":20525507,"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":["cached-video","caching"],"created_at":"2024-10-02T13:47:41.466Z","updated_at":"2025-03-21T22:32:12.474Z","avatar_url":"https://github.com/OutdatedGuy.png","language":"Dart","readme":"# Cached Video Player Plus\n\nThe [video_player] plugin with the SUPER-POWER of caching using\n[flutter_cache_manager].\n\n[![pub package][package_svg]][package]\n[![GitHub][license_svg]](LICENSE)\n\n[![GitHub issues][issues_svg]][issues]\n[![GitHub issues closed][issues_closed_svg]][issues_closed]\n\n\u003chr /\u003e\n\n## Getting Started\n\n### 1. Add dependency\n\nAdd the `cached_video_player_plus` package to your `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  cached_video_player_plus: ^3.0.3\n```\n\n### 2. Follow the installation instructions\n\nFollow the installation [instructions of video_player][instructions] plugin.\n\n### 3. Import the package\n\nImport the `cached_video_player_plus` package into your Dart file:\n\n```dart\nimport 'package:cached_video_player_plus/cached_video_player_plus.dart';\n```\n\n### 4. Using the package (Android, iOS \u0026 macOS)\n\n#### If you are already using the [video_player] plugin\n\n1. Use the `CachedVideoPlayerPlusController` class instead of the\n   `VideoPlayerController`.\n1. Use the `CachedVideoPlayerPlus` class instead of the `VideoPlayer`.\n1. Use the `CachedVideoPlayerPlusValue` class instead of the\n   `VideoPlayerValue`.\n\n#### If you are not using the [video_player] plugin\n\n1. Create a `CachedVideoPlayerPlusController` instance and initialize it.\n\n   ```dart\n   final controller = CachedVideoPlayerPlusController.networkUrl(\n     Uri.parse(\n       'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',\n     ),\n     invalidateCacheIfOlderThan: const Duration(days: 69),\n   )..initialize().then((value) async {\n       controller.play();\n       setState(() {});\n     });\n   ```\n\n2. Pass the controller to the `CachedVideoPlayerPlus` widget.\n\n   ```dart\n   CachedVideoPlayerPlus(controller),\n   ```\n\n   OR\n\n   ```dart\n   return Scaffold(\n     body: Center(\n       child: controller.value.isInitialized\n           ? AspectRatio(\n               aspectRatio: controller.value.aspectRatio,\n               child: CachedVideoPlayerPlus(controller),\n             )\n           : const CircularProgressIndicator.adaptive(),\n     ),\n   );\n   ```\n\n3. Caching is only supported if the `CachedVideoPlayerPlusController`\n   initialization method is `network()` or `networkUrl()`.\n\n### 5. Using the package (Web)\n\nThe web platform does not support caching. So, the plugin will use the\n[video_player] plugin for the web platform.\n\nHowever, to achieve caching on the web platform, you can use the workaround\nof defining `Cache-Control` headers in the `httpHeaders` parameter of the\n`CachedVideoPlayerPlusController.network()` method.\n\n```dart\nfinal controller = CachedVideoPlayerPlusController.networkUrl(\n  Uri.parse(\n    'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',\n  ),\n  httpHeaders: {\n    'Cache-Control': 'max-age=3600',\n  },\n)..initialize().then((value) async {\n    controller.play();\n    setState(() {});\n  });\n```\n\n## How does it work?\n\nWhen the `initialize()` method is called, the package checks if the video file\nis cached or not. A video file is identified by its **URL**. If the video file\nis not cached, then it is downloaded and cached. If the video file is cached,\nthen it is played from the cache.\n\nIf the cached video file is older than the specified\n`invalidateCacheIfOlderThan` parameter, then the cached video file is deleted\nand a new video file is downloaded and cached.\n\nWhen cache of a video is not found, the video will be played from the network\nand will be cached in the background to be played from the cache the next time.\n\n### If you liked the package, then please give it a [Like 👍🏼][package] and [Star ⭐][repository]\n\n\u003c!-- Badges URLs --\u003e\n\n[package_svg]: https://img.shields.io/pub/v/cached_video_player_plus.svg?color=blueviolet\n[license_svg]: https://img.shields.io/github/license/OutdatedGuy/cached_video_player_plus.svg?color=purple\n[issues_svg]: https://img.shields.io/github/issues/OutdatedGuy/cached_video_player_plus.svg\n[issues_closed_svg]: https://img.shields.io/github/issues-closed/OutdatedGuy/cached_video_player_plus.svg?color=green\n\n\u003c!-- Links --\u003e\n\n[package]: https://pub.dev/packages/cached_video_player_plus\n[repository]: https://github.com/OutdatedGuy/cached_video_player_plus\n[issues]: https://github.com/OutdatedGuy/cached_video_player_plus/issues\n[issues_closed]: https://github.com/OutdatedGuy/cached_video_player_plus/issues?q=is%3Aissue+is%3Aclosed\n[video_player]: https://pub.dev/packages/video_player\n[flutter_cache_manager]: https://pub.dev/packages/flutter_cache_manager\n[instructions]: https://pub.dev/packages/video_player#installation\n","funding_links":["https://github.com/sponsors/OutdatedGuy"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutdatedguy%2Fcached_video_player_plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutdatedguy%2Fcached_video_player_plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutdatedguy%2Fcached_video_player_plus/lists"}