Skip to content

Commit

Permalink
docs: added instructions for web platform (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
OutdatedGuy authored Dec 11, 2023
1 parent 12b0621 commit ab855d5
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Import the `cached_video_player_plus` package into your Dart file:
import 'package:cached_video_player_plus/cached_video_player_plus.dart';
```

### 4. Use the package
### 4. Using the package (Android & iOS)

#### If you are already using the [video_player] plugin

Expand Down Expand Up @@ -78,6 +78,27 @@ return Scaffold(
);
```

### 5. Using the package (Web)

The web platform does not support caching. So, the plugin will use the
[video_player] plugin for the web platform.

However, to achieve caching on the web platform, you can use the workaround
of defining `Cache-Control` headers in the `httpHeaders` parameter of the
`CachedVideoPlayerPlusController.network()` method.

```dart
final controller = CachedVideoPlayerPlusController.network(
"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
httpHeaders: {
"Cache-Control": "max-age=3600",
},
)..initialize().then((value) {
controller.play();
setState(() {});
});
```

## Credits

This package is a cloned and modified version of the [cached_video_player]
Expand Down

0 comments on commit ab855d5

Please sign in to comment.