Skip to content

Commit c2bc3bf

Browse files
committed
Add option to hide mute button
1 parent 0da5582 commit c2bc3bf

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

lib/src/chewie_player.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class ChewieController extends ChangeNotifier {
159159
this.allowedScreenSleep = true,
160160
this.isLive = false,
161161
this.allowFullScreen = true,
162+
this.allowMuting = true,
162163
this.systemOverlaysAfterFullScreen = SystemUiOverlay.values,
163164
this.deviceOrientationsAfterFullScreen = const [
164165
DeviceOrientation.portraitUp,
@@ -223,6 +224,9 @@ class ChewieController extends ChangeNotifier {
223224
/// Defines if the fullscreen control should be shown
224225
final bool allowFullScreen;
225226

227+
/// Defines if the mute control should be shown
228+
final bool allowMuting;
229+
226230
/// Defines the system overlays visible after exiting fullscreen
227231
final List<SystemUiOverlay> systemOverlaysAfterFullScreen;
228232

lib/src/cupertino_controls.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,10 @@ class _CupertinoControlsState extends State<CupertinoControls> {
381381
backgroundColor, iconColor, barHeight, buttonPadding)
382382
: Container(),
383383
Expanded(child: Container()),
384-
_buildMuteButton(
385-
controller, backgroundColor, iconColor, barHeight, buttonPadding),
384+
chewieController.allowMuting
385+
? _buildMuteButton(controller, backgroundColor, iconColor,
386+
barHeight, buttonPadding)
387+
: Container(),
386388
],
387389
),
388390
);

lib/src/material_controls.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ class _MaterialControlsState extends State<MaterialControls> {
9595
? Expanded(child: const Text('LIVE'))
9696
: _buildPosition(iconColor),
9797
chewieController.isLive ? const SizedBox() : _buildProgressBar(),
98-
_buildMuteButton(controller),
98+
chewieController.allowMuting
99+
? _buildMuteButton(controller)
100+
: Container(),
99101
chewieController.allowFullScreen
100102
? _buildExpandButton()
101103
: Container(),

0 commit comments

Comments
 (0)