Video Reload
by Thunderbolt
HTML
<a href="javascript:
(function() {
var v = document.querySelector('video');
if(typeof v.playing === 'undefined'){
Object.defineProperty(HTMLMediaElement.prototype, 'playing', {
get: function(){
return !!(/* this.currentTime > 0 && !this.paused && !this.ended && */ this.readyState > 2);
}
})
}
setInterval(
function(){
var v = document.querySelector('video');
console.log('video is available: ' + v.playing);
if(v.playing!==true){
console.log('reload: ' + v);
var c = v.currentTime;
try{
v.load();
}catch(e){
v.src = v.src;
}
v.currentTime = c;
v.play();
alert('Video-Reload: Invalid state detected');
}
}
,15000);
})();">
Video-Reload</a>
CSS
a {
display: block;
height: 7em;
width: 300px;
line-height: 6em;
background-color: #080000;
text-decoration: none;
color: #FFFFFF;
text-align: center;
}
a:after{
content: "Ziehe mich in deine Lesezeichenleiste!";
position: absolute;
margin-left: -200px;
width: 300px;
margin-top: 1em;
text-align: center;
color: #FFFFFF;
}