mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
add advanced option to change volume steps
This commit is contained in:
@ -86,11 +86,12 @@ function changeVolume(increase, options) {
|
||||
// Need to change both the slider and the actual volume
|
||||
const videoStream = document.querySelector(".video-stream");
|
||||
const slider = document.querySelector("#volume-slider");
|
||||
|
||||
|
||||
// Apply volume change if valid
|
||||
const steps = options.steps / 100;
|
||||
videoStream.volume = increase ?
|
||||
Math.min(videoStream.volume + 0.01, 1) :
|
||||
Math.max(videoStream.volume - 0.01, 0);
|
||||
Math.min(videoStream.volume + steps, 1) :
|
||||
Math.max(videoStream.volume - steps, 0);
|
||||
|
||||
// Save the new volume
|
||||
saveVolume(toPercent(videoStream.volume), options);
|
||||
|
||||
Reference in New Issue
Block a user