I have an HTML tag with a custom control panel, and in it I want the search bar and the volume panel to update their values in real time when the user smooths the range. This volume is currently being updated after the user configures the slider, and not while the user clicks and drags.
In HTML, I configured them as such:
<div id="video-controls">
<input type="range" id="seek-bar" value="0">
<input type="range" id="volume-bar" min="0" max="1" step="0.01" value="1">
</div>
And in my JavaScript, I connected them like this:
seekBar.addEventListener('change', function() {
var time = video.duration * (seekBar.value / 100);
video.currentTime = time;
});
video.addEventListener('timeupdate', function() {
var value = (100 / video.duration) * video.currentTime;
seekBar.value = value;
});
seekBar.addEventListener('mousedown', function() {
video.pause();
});
seekBar.addEventListener('mouseup', function() {
video.play();
});
volumeBar.addEventListener('change', function() {
video.volume = volumeBar.value;
});
JavaScript, jQuery, , . , , jQuery, . : jQuery, , , .