Answer the question
In order to leave comments, you need to log in
How to keep volume level in video on page reload?
Good evening.
The video tag has "controls" hidden.
Added their own control styles.
<input type="range" step="0.1" min="0" max="1" value="1" id="volume" />
volumeControl.addEventListener('input', function () {
videoView.volume = volumeControl.value;
}, false);
Answer the question
In order to leave comments, you need to log in
Save to LocalStorage.
We write a listener and listen, when the volume value in the player is updated, we execute the following code/command:
When loading the page, check if the volume key is in localStorage...
For skills: https://learn.javascript.ru/localstorage Example with code here in case anyone needs it in the future. localStorage.setItem('volume', ЗНАЧЕНИЕ);
localStorage.getItem('volume');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question