Skip to content

Instantly share code, notes, and snippets.

@174n
Last active January 29, 2020 23:50
Show Gist options
  • Save 174n/e1dafbf2295dcccaf71c599c069cef41 to your computer and use it in GitHub Desktop.
Save 174n/e1dafbf2295dcccaf71c599c069cef41 to your computer and use it in GitHub Desktop.
UserScript for controlling playback speed in Jellyfin
// ==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