Play/pause HTML 5 video using JQuery
Your solution shows the issue here -- play
is not a jQuery function but a function of the DOM element. You therefore need to call it upon the DOM element. You give an example of how to do this with the native DOM functions. The jQuery equivalent -- if you wanted to do this to fit in with an existing jQuery selection -- would be $('#videoId').get(0).play()
. (get
gets the native DOM element from the jQuery selection.)
You can do
$('video').trigger('play');
$('video').trigger('pause');