Wednesday, 15 June 2011

javascript - Play pause html5 -



javascript - Play pause html5 -

i'm trying create button pause , play video , alter innerhtml when clicked. i've tried , cant understand why it's not working. can help please:

function play() { var video = document.getelementbyid("video1"); video.play(); } var playbutton = document.getelementbyid("play-pause"); playbutton.addeventlistener("click", function () { if (video.paused === true) { // play video video.play(); // update button text 'pause' playbutton.innerhtml = "pause"; } else { // pause video video.pause(); // update button text 'play' playbutton.innerhtml = "play"; } });

var video = document.getelementbyid("video1"); var playbutton = document.getelementbyid("play-pause"); playbutton.addeventlistener("click", function () { if (video.paused === true) { video.play(); playbutton.innerhtml = "pause"; } else { video.pause(); playbutton.innerhtml = "play"; } });

javascript html5 video

No comments:

Post a Comment