Skip to content

Commit 7eacc09

Browse files
committed
Added workaround information for android to README
1 parent 45c7fca commit 7eacc09

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Chewie uses the `video_player` under the hood and wraps it in a friendly Materia
2424
8. 🧪 [Example](#-example)
2525
9.[Migrating from Chewie < 0.9.0](#-migrating-from-chewie--090)
2626
10. 🗺️ [Roadmap](#%EF%B8%8F-roadmap)
27-
11. 📱 [iOS warning](#-ios-warning-)
27+
11. ⚠️ [Android warning](#-android-warning-)
28+
12. 📱 [iOS warning](#-ios-warning-)
2829

2930

3031
## 🚨 IMPORTANT!!! (READ THIS FIRST)
@@ -286,6 +287,33 @@ final playerWidget = Chewie(
286287
- [ ] Screen-Mirroring / Casting (Google Chromecast)
287288

288289

290+
## ⚠️ Android warning
291+
292+
There 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).
293+
294+
Add the following to partly fix this behavior:
295+
296+
```dart
297+
// Your init code can be above
298+
videoController.addListener(yourListeningMethod);
299+
300+
// ...
301+
302+
bool wasPlayingBefore = false;
303+
void yourListeningMethod() {
304+
if (!videoController.value.isPlaying && !wasPlayingBefore) {
305+
// -> Workaround if seekTo another position while it was paused before.
306+
// On Android this might lead to infinite loading, so just play the
307+
// video again.
308+
videoController.play();
309+
}
310+
311+
wasPlayingBefore = videoController.value.isPlaying;
312+
313+
// ...
314+
}
315+
```
316+
289317
## 📱 iOS warning
290318

291319
The 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`

0 commit comments

Comments
 (0)