Remove audio manager range volume control by keys (#1489)

Co-authored-by: Alexis Faizeau <a.faizeau@workadventu.re>
This commit is contained in:
Alexis Faizeau 2021-10-02 15:55:54 +02:00 committed by GitHub
parent a7424b9329
commit 8c3b708981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,8 @@
audioManagerVolumeStore.setMuted(localUserStore.getAudioPlayerMuted()); audioManagerVolumeStore.setMuted(localUserStore.getAudioPlayerMuted());
changeVolume(); changeVolume();
loadAudioSettings();
unsubscriberFileStore = audioManagerFileStore.subscribe(() => { unsubscriberFileStore = audioManagerFileStore.subscribe(() => {
HTMLAudioPlayer.pause(); HTMLAudioPlayer.pause();
HTMLAudioPlayer.loop = get(audioManagerVolumeStore).loop; HTMLAudioPlayer.loop = get(audioManagerVolumeStore).loop;
@ -79,6 +81,11 @@
changeVolume(); changeVolume();
} }
function loadAudioSettings() {
audioManagerVolumeStore.setVolume(localUserStore.getAudioPlayerVolume());
audioManagerVolumeStore.setMuted(localUserStore.getAudioPlayerMuted());
}
function setVolume() { function setVolume() {
volume = parseFloat(audioPlayerVol.value); volume = parseFloat(audioPlayerVol.value);
audioManagerVolumeStore.setVolume(volume); audioManagerVolumeStore.setVolume(volume);
@ -88,6 +95,11 @@
changeVolume(); changeVolume();
} }
function disallowKeys() {
audioPlayerVol.blur();
return false;
}
function setDecrease() { function setDecrease() {
audioManagerVolumeStore.setDecreaseWhileTalking(decreaseWhileTalking); audioManagerVolumeStore.setDecreaseWhileTalking(decreaseWhileTalking);
} }
@ -116,7 +128,7 @@
</g> </g>
</svg> </svg>
</span> </span>
<input type="range" min="0" max="1" step="0.025" bind:this={audioPlayerVol} on:change={setVolume}> <input type="range" min="0" max="1" step="0.025" bind:this={audioPlayerVol} on:change={setVolume} on:keydown={disallowKeys}>
</div> </div>
<div class="audio-manager-reduce-conversation"> <div class="audio-manager-reduce-conversation">
<label> <label>