show the volume button

This commit is contained in:
Anthony 2021-08-30 19:15:17 +02:00
parent 91fe871be3
commit ed62423c02
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
2 changed files with 5 additions and 0 deletions

View file

@ -262,10 +262,13 @@ export default React.memo<Props>(function VideoJs(props: Props) {
}
}
// unmute video when player hits "Tap to unmute button"
function unmuteAndHideHint() {
const player = playerRef.current;
if (player) {
// unmute the video
player.muted(false);
// turn the volume all the way up if it's at 0
if (player.volume() === 0) {
player.volume(1.0);
}

View file

@ -247,6 +247,7 @@ function VideoViewer(props: Props) {
if (typeof error === 'object' && error.name && error.name === 'NotAllowedError') {
console.log('running here!')
if (player.autoplay() && !player.muted()) {
document.getElementsByClassName('video-js--tap-to-unmute')[0].style.visibility = 'visible';
player.muted(true);
// another version had player.play()
player.play()
@ -255,6 +256,7 @@ function VideoViewer(props: Props) {
console.log('other block conditional');
player.muted(true);
player.play()
document.getElementsByClassName('video-js--tap-to-unmute')[0].style.visibility = 'visible';
}
setIsLoading(false);
setIsPlaying(false);