Skip to content

Instantly share code, notes, and snippets.

@brianmichel
Created May 11, 2010 02:59
Show Gist options
  • Save brianmichel/396869 to your computer and use it in GitHub Desktop.
Save brianmichel/396869 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<video id="video">
<source src="debacle_720p.mp4">
Video Not Supported
</video>
<script type="text/javascript">
var video = document.getElementById('video');
var rewind = document.getElementById('rewind');
var playpause = document.getElementById('playpause');
video.addEventListener('play', playing, false);
video.addEventListener('pause', paused, false);
playpause.addEventListener('click', playPauseToggle, false);
function playPauseToggle(e) {
if (playpause.value == 'Play') {
video.play();
playpause.value = 'Pause';
} else {
video.pause();
playpause.value = 'Play';
}
}
function playing(e) {
playpause.value = 'Pause';
playpause.onClick = function() { video.pause(); }
}
function paused(e) {
playpause.value = 'Play'
playpause.onClick = function() { video.play(); }
}
</script>
<input id="playpause" type="button" value="Play">
<input type="button" value="Pause">
<input id="rewind" type="button" value="Rewind" onclick="video.currentTime = 0;">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment