Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ToddZeil committed Jan 18, 2024
1 parent d58b737 commit 827f58f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/src/chewie_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,7 @@ class ChewieState extends State<Chewie> {
).push(route);

if (kIsWeb) {
final prevPosition =
widget.controller.videoPlayerController.value.position;
widget.controller.videoPlayerController.initialize().then((_) async {
widget.controller._initialize();
widget.controller.videoPlayerController.seekTo(prevPosition);
await widget.controller.videoPlayerController.play();
widget.controller.videoPlayerController.pause();
});
_reInitializeControllers();
}

_isFullScreen = false;
Expand Down Expand Up @@ -245,6 +238,18 @@ class ChewieState extends State<Chewie> {
}
}
}

///When viewing full screen on web, returning from full screen causes original video to lose the picture.
///We re initialise controllers for web only when returning from full screen
void _reInitializeControllers() {
final prevPosition = widget.controller.videoPlayerController.value.position;
widget.controller.videoPlayerController.initialize().then((_) async {
widget.controller._initialize();
widget.controller.videoPlayerController.seekTo(prevPosition);
await widget.controller.videoPlayerController.play();
widget.controller.videoPlayerController.pause();
});
}
}

/// The ChewieController is used to configure and drive the Chewie Player
Expand Down

0 comments on commit 827f58f

Please sign in to comment.