Skip to content

Instantly share code, notes, and snippets.

@Telematica
Last active January 29, 2016 18:59
Show Gist options
  • Save Telematica/7389a5acc523e0f5e2fb to your computer and use it in GitHub Desktop.
Save Telematica/7389a5acc523e0f5e2fb to your computer and use it in GitHub Desktop.
JS Misc Stuff
var defaults = {
'MDBykpSXsSE' : { min : 423, max : 430, current : 425 }
,'MDBykpSXsSE' : { min : 423, max : 430, current : 425 }
}
,video = document
.querySelector('video')
.addEventListener(
'timeupdate'
,function(e)
{
//Todo: match 'v' parameter vs videoIds
//location.search.replace('?','').split('&').forEach(function(a,b,c){console.log(values = a.split('=')); params[values[0]]=values[1]; });
if(e.target.currentTime > 430 || e.target.currentTime <= 424 )
{
e.target.currentTime=425;
}
}
);
//Page Visibility API
//https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
document.addEventListener(
'visibilitychange'
,function()
{
if(document.hidden)
{
video.pause();
return;
}
video.play();
}
,false
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment