Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jonasfrey/1f9c43beb89ccaf2c5846a8adef7de2f to your computer and use it in GitHub Desktop.
Save jonasfrey/1f9c43beb89ccaf2c5846a8adef7de2f to your computer and use it in GitHub Desktop.
skip one second plus and minus with 'o' and 'u' on a sportschau live stream video
// remove that ugly shitty annoying blue gradient background
document.querySelector(".ardplayer-background").style.opacity = '0'
let o_media_player = document.querySelector(".mediaplayer");
let o_mod = await import('https://deno.land/x/f_o_html_from_o_js@3.5/mod.js')
let o_vid = document.querySelector('.ardplayer-mediacanvas')
let o_state = {
n_sec_current: 0,
n_speed_nor: 1,
n_counter: 0,
n_id_timeout_timechange: 0,
n_ms_timeout_timechange: 500,
};
window.o_state = o_state
let f_update_speed = async function(n_nor){
o_state.n_speed_nor += n_nor;
o_vid.playbackRate = o_state.n_speed_nor;
await o_state.o_js__speed._f_render();
}
o_vid?.parentElement?.appendChild(
await o_mod.f_o_html__and_make_renderable(
{
id: "improvements",
style: [
'position:absolute',
'left:0',
'top:0',
'z-index:111',
'font-size: 20px',
].join(';'),
a_o: [
Object.assign(
o_state,
{
o_js__time: {
f_o_jsh:()=>{
return {
b_render: o_state.n_counter != 0,
innerText: `${o_state.n_counter} sec`
}
}
}
}
).o_js__time,
Object.assign(
o_state,
{
o_js__speed: {
f_o_jsh:()=>{
return {
style: 'display:flex',
a_o: [
{
s_tag: "button",
innerText: "- (q)",
onpointerdown: async ()=>{
await f_update_speed(-0.25)
}
},
{
innerText: o_vid.playbackRate
},
{
s_tag: "button",
innerText: "+ (e)",
onpointerdown: async ()=>{
await f_update_speed(0.25)
}
},
]
}
}
}
}
).o_js__speed
]
}
)
)
let f_update_time = function(n_sec_delta){
o_state.n_sec_current = o_vid.currentTime+n_sec_delta
o_vid.currentTime = o_state.n_sec_current
o_vid.playbackRate = o_state.n_speed_nor
}
let f = async function(o_e){
let o = {
'a': -1,
'd': +1,
}
let n = o[o_e.key];
if(!n){
return;
}
clearTimeout(o_state.n_id_timeout_timechange);
o_state.n_counter+=n;
await o_state.o_js__time._f_render();
o_state.n_id_timeout_timechange = setTimeout(async ()=>{
f_update_time(o_state.n_counter);
o_state.n_counter = 0
await o_state.o_js__time._f_render();
}, o_state.n_ms_timeout_timechange)
}
let f2 = function(o_e){
let o = {
'q': -.25,
'e': .25,
}
let n = o[o_e.key];
if(!n){
return;
}
f_update_speed(n)
}
o_vid.onkeydown = async (o_e)=>{
await f(o_e)
f2(o_e)
}
document.onkeydown = async (o_e)=>{
await f(o_e)
f2(o_e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment