Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/src/chewie_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -606,6 +608,9 @@ class ChewieController extends ChangeNotifier {
await videoPlayerController.seekTo(moment);
}

///-------------


Future<void> setVolume(double volume) async {
await videoPlayerController.setVolume(volume);
}
Expand Down
59 changes: 58 additions & 1 deletion lib/src/material/material_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ class _MaterialControlsState extends State<MaterialControls>
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,
Expand All @@ -271,11 +272,13 @@ class _MaterialControlsState extends State<MaterialControls>
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
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(),
],
Expand Down Expand Up @@ -335,6 +338,60 @@ class _MaterialControlsState extends State<MaterialControls>
);
}

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,
Expand Down