Skip to content

Commit 0e90497

Browse files
authored
docs: update v4.0.0 to v4 wherever suitable (#87)
1 parent 164a530 commit 0e90497

2 files changed

Lines changed: 32 additions & 32 deletions

File tree

MIGRATION-v3-to-v4.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Migration Guide: v3.x.x → v4.0.0 🎬
1+
# Migration Guide: v3.x.x → v4 🎬
22

3-
This guide will help you migrate from `cached_video_player_plus` v3.x.x to v4.0.0.
3+
This guide will help you migrate from `cached_video_player_plus` v3.x.x to v4.
44

55
## Overview
66

7-
Version 4.0.0 introduces a major API restructure that simplifies usage while maintaining all existing functionality. The package now uses a class-based approach instead of the previous controller-widget pattern.
7+
Version 4 introduces a major API restructure that simplifies usage while maintaining all existing functionality. The package now uses a class-based approach instead of the previous controller-widget pattern.
88

99
_Translation: We Marie Kondo'd the API - everything that doesn't spark joy got yeeted into the digital void!_ ✨🗑️
1010

1111
## 💿 Storage Migration: get_storage → shared_preferences
1212

13-
Version 4.0.0 migrates from `get_storage` to `shared_preferences` for storing cached video metadata. This change improves compatibility and reduces dependencies.
13+
Version 4 migrates from `get_storage` to `shared_preferences` for storing cached video metadata. This change improves compatibility and reduces dependencies.
1414

1515
### 🔄 Automatic Migration
1616

@@ -44,11 +44,11 @@ _Don't worry, we'll clean up after ourselves - unlike that one roommate who neve
4444

4545
### 🗝️ Cache Key Prefix Change (No Action Needed)
4646

47-
In v4.0.0, the internal cache key prefix used for storing video cache metadata has changed:
47+
In v4, the internal cache key prefix used for storing video cache metadata has changed:
4848

4949
- **Before (v3.x.x):**
5050
- `cached_video_player_plus_video_expiration_of_`
51-
- **After (v4.0.0):**
51+
- **After (v4):**
5252
- `cached_video_player_plus_caching_time_of_`
5353

5454
This change is handled automatically by the package and does **not** require any action from developers. It is noted here for reference and transparency. All cache management and migration utilities are aware of this change and will continue to work as expected.
@@ -70,7 +70,7 @@ await controller.initialize();
7070
CachedVideoPlayerPlus(controller)
7171
```
7272

73-
**After (v4.0.0):**
73+
**After (v4):**
7474

7575
```dart
7676
// New class-based approach
@@ -126,7 +126,7 @@ final controller = CachedVideoPlayerPlusController.contentUri(
126126
```
127127

128128
```dart
129-
// After (v4.0.0)
129+
// After (v4)
130130
// Network videos
131131
final player = CachedVideoPlayerPlus.networkUrl(
132132
Uri.parse('https://example.com/video.mp4'),
@@ -152,13 +152,13 @@ final player = CachedVideoPlayerPlus.contentUri(
152152

153153
### 4. Deprecated Constructor Removal
154154

155-
The deprecated `CachedVideoPlayerPlusController.network()` constructor has been completely removed in v4.0.0:
155+
The deprecated `CachedVideoPlayerPlusController.network()` constructor has been completely removed in v4:
156156

157157
```dart
158158
// Before (v3.x.x) - This was already deprecated
159159
CachedVideoPlayerPlusController.network('https://example.com/video.mp4')
160160
161-
// Use this instead (available in both v3.x.x and v4.0.0)
161+
// Use this instead (available in both v3.x.x and v4)
162162
CachedVideoPlayerPlus.networkUrl(Uri.parse('https://example.com/video.mp4'))
163163
```
164164

@@ -172,7 +172,7 @@ _We finally put the deprecated constructor out of its misery. It had a good run,
172172
// Before (v3.x.x)
173173
invalidateCacheIfOlderThan: const Duration(days: 30) // Default was 30 days
174174
175-
// After (v4.0.0)
175+
// After (v4)
176176
invalidateCacheIfOlderThan: const Duration(days: 69) // Default is now 69 days
177177
```
178178

@@ -190,14 +190,14 @@ _Yes, we changed the default to 69 days. No, it's not a typo. Yes, we're adults
190190

191191
### 8. New Methods Added
192192

193-
v4.0.0 introduces several new methods not available in v3.x.x:
193+
v4 introduces several new methods not available in v3.x.x:
194194

195195
-`removeFileFromCacheByKey(String cacheKey)` - Remove cached files by custom cache key
196196
-`preCacheVideo(Uri url)` - Pre-cache videos without creating a player instance
197197

198198
### 9. Constructor Parameter Changes
199199

200-
**New Parameters in v4.0.0:**
200+
**New Parameters in v4:**
201201

202202
-`downloadHeaders` - Separate headers for downloading vs streaming
203203
-`cacheKey` - Custom cache key instead of URL-based key
@@ -207,7 +207,7 @@ _More parameters = more power = more responsibility. With great caching comes gr
207207

208208
### 10. Controller Access Changes - Using .controller Property
209209

210-
The biggest change in v4.0.0 is that most video operations now require accessing the `.controller` property. Here's what you need to know:
210+
The biggest change in v4 is that most video operations now require accessing the `.controller` property. Here's what you need to know:
211211

212212
**Video Control Methods:**
213213

@@ -221,7 +221,7 @@ controller.setLooping(true);
221221
```
222222

223223
```dart
224-
// After (v4.0.0) - Access through .controller property
224+
// After (v4) - Access through .controller property
225225
player.controller.play();
226226
player.controller.pause();
227227
player.controller.setVolume(0.69);
@@ -243,7 +243,7 @@ controller.value.errorDescription;
243243
```
244244

245245
```dart
246-
// After (v4.0.0)
246+
// After (v4)
247247
player.isInitialized; // Convenience property (new!)
248248
player.controller.value.isPlaying; // Through controller
249249
player.controller.value.position; // Through controller
@@ -267,7 +267,7 @@ controller.removeListener(listener);
267267
```
268268

269269
```dart
270-
// After (v4.0.0)
270+
// After (v4)
271271
player.controller.addListener(() {
272272
// Handle state changes
273273
if (player.controller.value.hasError) {
@@ -292,7 +292,7 @@ Widget build(BuildContext context) {
292292
```
293293

294294
```dart
295-
// After (v4.0.0)
295+
// After (v4)
296296
Widget build(BuildContext context) {
297297
return player.isInitialized
298298
? AspectRatio(
@@ -631,7 +631,7 @@ await player.initialize();
631631
**Solution:** Use `.networkUrl()` instead:
632632

633633
```dart
634-
// Before (this was deprecated in v3.x.x and removed in v4.0.0)
634+
// Before (this was deprecated in v3.x.x and removed in v4)
635635
CachedVideoPlayerPlusController.network('https://example.com/video.mp4')
636636
637637
// After
@@ -640,7 +640,7 @@ CachedVideoPlayerPlus.networkUrl(Uri.parse('https://example.com/video.mp4'))
640640

641641
## 📚 Complete Example
642642

643-
Here's a complete working example for v4.0.0 that demonstrates the new features:
643+
Here's a complete working example for v4 that demonstrates the new features:
644644

645645
_This example contains more features than a Swiss Army knife and is 42% more awesome than the previous version!_ 🔪✨
646646

@@ -665,7 +665,7 @@ class MyApp extends StatelessWidget {
665665
@override
666666
Widget build(BuildContext context) {
667667
return MaterialApp(
668-
title: 'Cached Video Player Plus v4.0.0 Demo',
668+
title: 'Cached Video Player Plus v4 Demo',
669669
home: VideoPlayerExample(),
670670
);
671671
}
@@ -685,16 +685,16 @@ class _VideoPlayerExampleState extends State<VideoPlayerExample> {
685685
void initState() {
686686
super.initState();
687687
688-
// Example with new v4.0.0 features
688+
// Example with new v4 features
689689
_player = CachedVideoPlayerPlus.networkUrl(
690690
Uri.parse(
691691
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
692692
),
693693
// Default is now 69 days, set to 30 if you want old v3.x.x behavior
694694
invalidateCacheIfOlderThan: const Duration(days: 30),
695-
// New v4.0.0 feature: custom cache key
695+
// New v4 feature: custom cache key
696696
cacheKey: 'big_buck_bunny_demo',
697-
// New v4.0.0 feature: separate download headers
697+
// New v4 feature: separate download headers
698698
httpHeaders: {
699699
'User-Agent': 'MyApp/1.0',
700700
'Range': 'bytes=0-80085', // For amazing streaming experience
@@ -717,7 +717,7 @@ class _VideoPlayerExampleState extends State<VideoPlayerExample> {
717717
super.dispose();
718718
}
719719
720-
// Example of using new v4.0.0 features
720+
// Example of using new v4 features
721721
Future<void> _preCacheAnotherVideo() async {
722722
await CachedVideoPlayerPlus.preCacheVideo(
723723
Uri.parse('https://sample-videos.com/zip/10/mp4/SampleVideo_1280x720_1mb.mp4'),
@@ -744,7 +744,7 @@ class _VideoPlayerExampleState extends State<VideoPlayerExample> {
744744
@override
745745
Widget build(BuildContext context) {
746746
return Scaffold(
747-
appBar: AppBar(title: const Text('Cached Video Player Plus v4.0.0')),
747+
appBar: AppBar(title: const Text('Cached Video Player Plus v4')),
748748
body: Center(
749749
child: _player.isInitialized
750750
? Column(
@@ -806,9 +806,9 @@ class _VideoPlayerExampleState extends State<VideoPlayerExample> {
806806
}
807807
```
808808

809-
## ✨ New Features in v4.0.0
809+
## ✨ New Features in v4
810810

811-
v4.0.0 introduces several new features that weren't available in v3.x.x:
811+
v4 introduces several new features that weren't available in v3.x.x:
812812

813813
_New features! Like getting surprise extra fries at the bottom of the bag, but for code! 🍟💻_
814814

@@ -877,7 +877,7 @@ final player = CachedVideoPlayerPlus.networkUrl(
877877

878878
## 🚀 Benefits of Migration
879879

880-
After migrating to v4.0.0, you'll benefit from:
880+
After migrating to v4, you'll benefit from:
881881

882882
1. **Simpler API**: Less boilerplate code and more intuitive usage
883883
2. **Better Performance**: Optimized caching logic and debug mode checks
@@ -896,7 +896,7 @@ If you encounter issues during migration:
896896
3. Check [existing issues](https://github.com/OutdatedGuy/cached_video_player_plus/issues)
897897
4. Create a new issue with:
898898
- Your current v3.x.x code
899-
- What you tried for v4.0.0
899+
- What you tried for v4
900900
- The specific error messages
901901

902902
_Remember: There are no stupid questions, only poorly documented APIs. We're here to help! 🤝💙_

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _Like `video_player`, but with a photographic memory and trust issues with the i
1818
**Drop-in replacement for `video_player`** _(well, mostly - see migration guide!)_
1919
**📱 Cross-platform support** _(Android, iOS, macOS, Web\*, Linux\*, Windows\*)_
2020

21-
## ✨ What's New in v4.0.0
21+
## ✨ What's New in v4
2222

2323
We Marie Kondo'd the entire API! Everything that didn't spark joy got yeeted into the digital void! ✨🗑️
2424

@@ -32,7 +32,7 @@ We Marie Kondo'd the entire API! Everything that didn't spark joy got yeeted int
3232
>
3333
> **🚨 BREAKING CHANGES AHEAD!**
3434
>
35-
> Version 4.0.0 introduces a total API restructuring, adding new features while maintaining all functionality. These changes introduce major breaking changes.
35+
> Version 4 introduces a total API restructuring, adding new features while maintaining all functionality. These changes introduce major breaking changes.
3636
3737
## Migrating from v3.x.x?
3838

0 commit comments

Comments
 (0)