I have a video html5 tag embedded on page. I need to trigger an action when the user clicks the "Play Button". But I can't find how to bind that to my action. Is there an event for what I need? I'm using jQuery...
Thanks!
To detect if it's playing use the video. onplaying event to detect it's now loaded and playing e.g. video. onplaying = function() { console. log('Video is now loaded and playing'); } .
HTML Audio/Video DOM play() Method The play() method starts playing the current audio or video. Tip: Use the pause() method to pause the current audio/video.
The input event fires when the value of an <input> , <select> , or <textarea> element has been changed. The event also applies to elements with contenteditable enabled, and to any element when designMode is turned on. In the case of contenteditable and designMode , the event target is the editing host.
Does this W3C demo page help? http://www.w3.org/2010/05/video/mediaevents.html It appears the play event is simply 'play'.
For example:
$('video').bind('play', function (e) {
// do something
});
or
$('video').on('play', function (e) {
// do something
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With