-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show mute toggle button if the tech supports muting volume (#5052)
Currently, VideoJS combines volume control with muted support, and these actions aren't actually the same. Muting/unmuting volume work independently from the volume control. For example, iOS doesn't support controlling volume programmatically but allows muting/unmuting volume. This change will display the volume control panel and mute toggle button if the tech supports muting volume. The volume slider will continue to be hidden if the platform doesn't allow programmatically control volume. If neither muting nor control volume is supported, volume panel will not be displayed. Fixes #4478.
- Loading branch information
Showing
7 changed files
with
112 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Check if muting volume is supported and if it isn't hide the mute toggle | ||
* button. | ||
* | ||
* @param {Component} self | ||
* A reference to the mute toggle button | ||
* | ||
* @param {Player} player | ||
* A reference to the player | ||
* | ||
* @private | ||
*/ | ||
const checkMuteSupport = function(self, player) { | ||
// hide mute toggle button if it's not supported by the current tech | ||
if (player.tech_ && !player.tech_.featuresMuteControl) { | ||
self.addClass('vjs-hidden'); | ||
} | ||
|
||
self.on(player, 'loadstart', function() { | ||
if (!player.tech_.featuresMuteControl) { | ||
self.addClass('vjs-hidden'); | ||
} else { | ||
self.removeClass('vjs-hidden'); | ||
} | ||
}); | ||
}; | ||
|
||
export default checkMuteSupport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters