diff --git a/lib/src/chewie_player.dart b/lib/src/chewie_player.dart index 23d075b72..c858ff708 100644 --- a/lib/src/chewie_player.dart +++ b/lib/src/chewie_player.dart @@ -537,6 +537,8 @@ class ChewieController extends ChangeNotifier { bool get isFullScreen => _isFullScreen; bool get isPlaying => videoPlayerController.value.isPlaying; + ///-------------- + Future _initialize() async { await videoPlayerController.setLooping(looping); @@ -606,6 +608,9 @@ class ChewieController extends ChangeNotifier { await videoPlayerController.seekTo(moment); } + ///------------- + + Future setVolume(double volume) async { await videoPlayerController.setVolume(volume); } diff --git a/lib/src/material/material_controls.dart b/lib/src/material/material_controls.dart index 081f4b5cc..12de3df6d 100644 --- a/lib/src/material/material_controls.dart +++ b/lib/src/material/material_controls.dart @@ -255,6 +255,7 @@ class _MaterialControlsState extends State opacity: notifier.hideStuff ? 0.0 : 1.0, duration: const Duration(milliseconds: 300), child: Container( + color: Colors.black.withOpacity(0.35), height: barHeight + (chewieController.isFullScreen ? 10.0 : 0), padding: EdgeInsets.only( left: 20, @@ -271,11 +272,13 @@ class _MaterialControlsState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ if (chewieController.isLive) - const Expanded(child: Text('LIVE')) + const Expanded(child: Text('LIVE' , style: TextStyle(color: Colors.red),)) else _buildPosition(iconColor), if (chewieController.allowMuting) _buildMuteButton(controller), + if (!chewieController.isLive) _buildBackwardButton(), + if (!chewieController.isLive) _buildForwardButton(), const Spacer(), if (chewieController.allowFullScreen) _buildExpandButton(), ], @@ -335,6 +338,60 @@ class _MaterialControlsState extends State ); } + GestureDetector _buildForwardButton() { + return GestureDetector( + onTap: () { + controller.seekTo( + Duration(seconds: controller.value.position.inSeconds + 10)); + }, + child: AnimatedOpacity( + opacity: notifier.hideStuff ? 0.0 : 1.0, + duration: const Duration(milliseconds: 300), + child: Container( + height: barHeight + (chewieController.isFullScreen ? 15.0 : 0), + margin: const EdgeInsets.only(right: 12.0), + padding: const EdgeInsets.only( + left: 8.0, + right: 8.0, + ), + child: const Center( + child: Icon( + Icons.forward_10_rounded, + color: Colors.white, + ), + ), + ), + ), + ); + } + + GestureDetector _buildBackwardButton() { + return GestureDetector( + onTap: () { + controller.seekTo( + Duration(seconds: controller.value.position.inSeconds - 10)); + }, + child: AnimatedOpacity( + opacity: notifier.hideStuff ? 0.0 : 1.0, + duration: const Duration(milliseconds: 300), + child: Container( + height: barHeight + (chewieController.isFullScreen ? 15.0 : 0), + margin: const EdgeInsets.only(right: 12.0), + padding: const EdgeInsets.only( + left: 8.0, + right: 8.0, + ), + child: const Center( + child: Icon( + Icons.replay_10_rounded, + color: Colors.white, + ), + ), + ), + ), + ); + } + GestureDetector _buildExpandButton() { return GestureDetector( onTap: _onExpandCollapse,