Last active
January 29, 2020 23:50
-
-
Save 174n/e1dafbf2295dcccaf71c599c069cef41 to your computer and use it in GitHub Desktop.
UserScript for controlling playback speed in Jellyfin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Speed control - localhost:8096 | |
// @namespace Violentmonkey Scripts | |
// @include http://localhost:8096/* | |
// @grant none | |
// @version 1.0 | |
// @author - | |
// @description 1/30/2020, 12:16:50 AM | |
// ==/UserScript== | |
if(document.querySelector("body").innerText.indexOf("Value cannot be null") !== -1) | |
location.href = "http://localhost:8096/"; | |
let elem = document.createElement("input"); | |
elem.type="range"; | |
elem.value = 50; | |
elem.id="speedControl" | |
elem.addEventListener("change", e => { | |
document.querySelector("video").playbackRate = e.target.value / 50; | |
}); | |
const addRange = () => { | |
const buttons = document.querySelector(".buttons"); | |
if (buttons && !document.querySelector("#speedControl")) { | |
buttons.appendChild(elem); | |
} | |
} | |
setInterval(addRange, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment