html5 - Clicking HTML 5 Video element to play, pause video, breaks play button -


i'm trying video able play , pause youtube (using both play , pause button, , clicking video itself.)

<video width="600" height="409" id="videoplayer" controls="controls">  <!-- mp4 video -->  <source src="video.mp4" type="video/mp4"> </video>   <script>     var videoplayer = document.getelementbyid('videoplayer');      // auto play, half volume.     videoplayer.play()     videoplayer.volume = 0.5;      // play / pause.     videoplayer.addeventlistener('click', function () {         if (videoplayer.paused == false) {             videoplayer.pause();             videoplayer.firstchild.nodevalue = 'play';         } else {             videoplayer.play();             videoplayer.firstchild.nodevalue = 'pause';         }     }); </script> 

do have ideas why break play , pause control button?

not bring old post landed on question in search same solution. ended coming of own. figured i'd contribute.

html:

<video class="video"><source src=""></video> 

javascript: "jquery"

$('.video').click(function(){this.paused?this.play():this.pause();}); 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -