diff --git a/html/poketube.ejs b/html/poketube.ejs
index 86d3760a..cb763daf 100644
--- a/html/poketube.ejs
+++ b/html/poketube.ejs
@@ -1805,6 +1805,32 @@ const urlParams = new URLSearchParams(window.location.search);
if (!urlParams.has('hl') && !urlParams.has('region') && languageCode && regionCode) {
location.href = currentURL + `®ion=${regionCode}&hl=${languageCode}`;
}
+let isMiddleButtonPressed = false;
+
+// Function to change video speed
+function changeVideoSpeed() {
+ if (isMiddleButtonPressed) {
+ video.playbackRate = 2; // Set the video speed to 2x
+ } else {
+ video.playbackRate = 1; // Set the video speed to 1x
+ }
+}
+
+// Event listener for mouse button press
+document.addEventListener('mousedown', function (event) {
+ if (event.button === 1) {
+ isMiddleButtonPressed = true;
+ changeVideoSpeed();
+ }
+});
+
+// Event listener for mouse button release
+document.addEventListener('mouseup', function (event) {
+ if (event.button === 1) {
+ isMiddleButtonPressed = false;
+ changeVideoSpeed();
+ }
+});
var anchor = document.getElementById("sub");