Skip to content

Instantly share code, notes, and snippets.

@ZReC
Forked from mxvin/gain
Created July 13, 2022 21:01
Show Gist options
  • Save ZReC/4b522e70ae0a90e95e7f12379dca91cd to your computer and use it in GitHub Desktop.
Save ZReC/4b522e70ae0a90e95e7f12379dca91cd to your computer and use it in GitHub Desktop.
Simple Gain / Boost Volume on any website (Youtube, Vimeo, Twitch etc) video by only one click of bookmark button. Copy code below, then create new bookmark, and fill code below to location address.
javascript:var g_6z; function cI_6z(){ var ctx_6z = new AudioContext(); var el_6z = document.querySelector("video") ? document.querySelector("video") : document.querySelector("audio")? document.querySelector("audio"):alert('Media DOM not exist. Aborting.'); if (el_6z){ g_6z = ctx_6z.createGain(); g_6z.gain.value = 1; var src_6z = ctx_6z.createMediaElementSource(el_6z); src_6z.connect(g_6z).connect(ctx_6z.destination); var p = document.createElement("div"); p.innerHTML = `<div class=vpc_6z id=vpc_6z><style>.vpc_6z{float:right;width:25%;position:fixed;bottom:0;padding:20px 20px;z-index:9999999;background:#444;color:#fff}.vpc_6z-hide{position:fixed;background:#444;padding:0;width:80px;height:30px;bottom:0;z-index:999999}.vpi_6z-hide{display:none}</style><button%20onclick='d=document.getElementById("vpi_6z"),"vpi_6z"==d.getAttribute("class")?d.setAttribute("class","vpi_6z-hide"):d.setAttribute("class","vpi_6z"),c=document.getElementById("vpc_6z"),"vpc_6z"==c.getAttribute("class")?c.setAttribute("class","vpc_6z-hide"):c.setAttribute("class","vpc_6z")'style=float:right;cursor:pointer;width:80px;height:30px>Toggle%20VP</button><div%20class=vpi_6z%20id=vpi_6z><button%20onclick='document.getElementById("vpc_6z").remove()'>Destroy%20Panel</button><h1>Volume%20Gain:%20<span%20id=volumeControl_e></span></h1><input%20max=100%20min=1%20onchange='v=this.value,cG_6z(v),document.getElementById("volumeControl_e").innerHTML=1*v+100,console.log(v)'style=width:100%%20type=range%20value=1></div></div>`;%20document.body.appendChild(p);%20}%20};%20function%20cG_6z(v){%20g_6z.gain.value%20=%20v;%20};%20cI_6z(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment