Skip to content

Instantly share code, notes, and snippets.

@dwynne
Created October 4, 2011 20:49
Show Gist options
  • Select an option

  • Save dwynne/1262761 to your computer and use it in GitHub Desktop.

Select an option

Save dwynne/1262761 to your computer and use it in GitHub Desktop.
MediaElementJS Issue
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTML5 MediaElement</title>
<script src="../build/mediaelement.js"></script>
</head>
<body>
<video width="360" height="203" id="player1" src="http://video.ted.com/talks/podcast/AlGore_2006_480.mp4"
type="video/mp4" controls="controls" preload="auto">
</video>
<span id="time"></span>
<script>
var hasPlayedOnce = false;
MediaElement('player1', {
success: function (me) {
me.addEventListener('progress', function () {
document.getElementById('time').innerHTML = me.buffered.end(0);
if (!hasPlayedOnce && me.buffered.end(0) > 20) {
hasPlayedOnce = true;
me.play();
}
}, false);
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment