diff --git a/front/dist/index.tmpl.html b/front/dist/index.tmpl.html index 062622b8..2c3aef43 100644 --- a/front/dist/index.tmpl.html +++ b/front/dist/index.tmpl.html @@ -88,9 +88,15 @@ - - - + + + + + + + + + diff --git a/front/dist/resources/style/style.css b/front/dist/resources/style/style.css index ff79245c..3ad0bdcf 100644 --- a/front/dist/resources/style/style.css +++ b/front/dist/resources/style/style.css @@ -403,6 +403,19 @@ body { visibility: hidden; display: none; } +#audioplayer_volume_icon_playing.low #audioplayer_volume_icon_playing_high { + visibility: hidden; + display: none; +} +#audioplayer_volume_icon_playing.low #audioplayer_volume_icon_playing_mid { + visibility: hidden; + display: none; +} +#audioplayer_volume_icon_playing.mid #audioplayer_volume_icon_playing_high { + visibility: hidden; + display: none; +} + #audioplayerctrl > #audioplayer_volume { width: 100%; background-color: rgba(0,0,0,0.5); diff --git a/front/src/WebRtc/AudioManager.ts b/front/src/WebRtc/AudioManager.ts index 60255a77..753cf7fb 100644 --- a/front/src/WebRtc/AudioManager.ts +++ b/front/src/WebRtc/AudioManager.ts @@ -11,7 +11,7 @@ enum audioStates { const audioPlayerDivId = "audioplayer"; const audioPlayerCtrlId = "audioplayerctrl"; const audioPlayerVolId = "audioplayer_volume"; -const audioPlayerMuteId = "audioplayer_volume_icon_playing"; +const audioPlayerVolumeIconId = "audioplayer_volume_icon_playing"; const animationTime = 500; class AudioManager { @@ -21,7 +21,7 @@ class AudioManager { private audioPlayerCtrl: HTMLDivElement; private audioPlayerElem: HTMLAudioElement | undefined; private audioPlayerVol: HTMLInputElement; - private audioPlayerMute: HTMLInputElement; + private audioPlayerVolumeIcon: HTMLInputElement; private volume = 1; private muted = false; @@ -32,14 +32,14 @@ class AudioManager { this.audioPlayerDiv = HtmlUtils.getElementByIdOrFail(audioPlayerDivId); this.audioPlayerCtrl = HtmlUtils.getElementByIdOrFail(audioPlayerCtrlId); this.audioPlayerVol = HtmlUtils.getElementByIdOrFail(audioPlayerVolId); - this.audioPlayerMute = HtmlUtils.getElementByIdOrFail(audioPlayerMuteId); + this.audioPlayerVolumeIcon = HtmlUtils.getElementByIdOrFail(audioPlayerVolumeIconId); this.volume = localUserStore.getAudioPlayerVolume(); this.audioPlayerVol.value = '' + this.volume; this.muted = localUserStore.getAudioPlayerMuted(); if (this.muted) { - this.audioPlayerMute.classList.add('muted'); + this.audioPlayerVolumeIcon.classList.add('muted'); } } @@ -93,7 +93,23 @@ class AudioManager { this.volumeReduced = reduceVolume; this.audioPlayerElem.volume = this.volume; - this.audioPlayerVol.value = '' + this.volume; + if (this.muted) { + this.audioPlayerVolumeIcon.classList.add('muted'); + this.audioPlayerVol.value = '0'; + } else { + this.audioPlayerVol.value = '' + this.volume; + this.audioPlayerVolumeIcon.classList.remove('muted'); + if (this.volume < 0.3) { + this.audioPlayerVolumeIcon.classList.add('low'); + } else if (this.volume < 0.7) { + this.audioPlayerVolumeIcon.classList.remove('low'); + this.audioPlayerVolumeIcon.classList.add('mid'); + } else { + this.audioPlayerVolumeIcon.classList.remove('low'); + this.audioPlayerVolumeIcon.classList.remove('mid'); + } + } + this.audioPlayerElem.muted = this.muted; } @@ -129,16 +145,12 @@ class AudioManager { this.muted = !this.muted; this.changeVolume(); localUserStore.setAudioPlayerMuted(this.muted); - - if (this.muted) { - this.audioPlayerMute.classList.add('muted'); - } else { - this.audioPlayerMute.classList.remove('muted'); - } } this.audioPlayerVol.oninput = (ev: Event)=> { this.setVolume(parseFloat((ev.currentTarget).value)); + this.muted = false; + localUserStore.setAudioPlayerMuted(this.muted); this.changeVolume(); (ev.currentTarget).blur();