mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 05:02:06 +00:00
add advanced option to change volume steps
This commit is contained in:
@ -45,6 +45,12 @@ const defaultConfig = {
|
|||||||
enabled: false,
|
enabled: false,
|
||||||
urgency: "normal",
|
urgency: "normal",
|
||||||
unpauseNotification: false
|
unpauseNotification: false
|
||||||
|
},
|
||||||
|
"precise-volume": {
|
||||||
|
enabled: false,
|
||||||
|
steps: 1, //percentage of volume to change
|
||||||
|
arrowsShortcut: true, //enable ArrowUp + ArrowDown local shortcuts
|
||||||
|
savedVolume: undefined //plugin save volume between session here
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -88,9 +88,10 @@ function changeVolume(increase, options) {
|
|||||||
const slider = document.querySelector("#volume-slider");
|
const slider = document.querySelector("#volume-slider");
|
||||||
|
|
||||||
// Apply volume change if valid
|
// Apply volume change if valid
|
||||||
|
const steps = options.steps / 100;
|
||||||
videoStream.volume = increase ?
|
videoStream.volume = increase ?
|
||||||
Math.min(videoStream.volume + 0.01, 1) :
|
Math.min(videoStream.volume + steps, 1) :
|
||||||
Math.max(videoStream.volume - 0.01, 0);
|
Math.max(videoStream.volume - steps, 0);
|
||||||
|
|
||||||
// Save the new volume
|
// Save the new volume
|
||||||
saveVolume(toPercent(videoStream.volume), options);
|
saveVolume(toPercent(videoStream.volume), options);
|
||||||
|
|||||||
Reference in New Issue
Block a user