Last active
August 29, 2015 14:00
-
-
Save singh1469/11169828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<h1>#1591 video loop demo </h1> | |
<div id='buto_tCMBn'></div> | |
<script> | |
//Pure HTML5 embed (note the `delivery` parameter that's passed into the player object) | |
(function (d, conf) { | |
var b = d.createElement('script'); | |
b.setAttribute('async', true); | |
b.src = '//embed.buto.tv/js/' + conf.object_id; | |
if (b.addEventListener) { | |
b.addEventListener('load', function () { | |
if (window.buto) buto.addPlayer(conf); | |
}, false); | |
} else if (b.readyState) { | |
b.onreadystatechange = function () { | |
if (window.buto) buto.addPlayer(conf); | |
}; | |
} | |
var s = d.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(b, s); | |
})(document, {object_id: 'tCMBn', element_id: 'buto_tCMBn', width: 640, height: 360, delivery: 'html5'}); </script> | |
<!-- //#1591 | |
scripts. | |
Done in pure JS, no jQuery here.... | |
--> | |
<script> | |
//wait till till the player in question is ready on the DOM | |
//in HTML5 events can only be fired by a DOM element which is why the container DIV fires the events | |
document.getElementById('buto_tCMBn').addEventListener('ready', function (e) { | |
var el = e.target; | |
//attach an event listener to replay video once it finishes | |
el.addEventListener('ended',function(e){ | |
buto.play('tCMBn'); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment