Skip to content

Instantly share code, notes, and snippets.

@brianmichel
Created May 10, 2010 21:04
Show Gist options
  • Save brianmichel/396543 to your computer and use it in GitHub Desktop.
Save brianmichel/396543 to your computer and use it in GitHub Desktop.
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(); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment