// now pause all active videos
$('.vid').get(0).pause();
$('.vid').get(1).pause();
$('.vid').get(2).pause();
That's what I have right now, but it's less than ideal. I'm a bit tired, so I could be missing something obvious, but how can I just tell it do pause all instances of .vid class on the page?
There's no real need for jQuery, the ES6 way (that should work in most modern browsers...)
For all
<video>
tags:or in your case (looking for the
.vid
class):Video.js stores all the players on the page in an Object in V.players so you could do the below.
Video JS 3.x
Normal JS
http://jsfiddle.net/3n1gm4/SNZAS/
jQuery
http://jsfiddle.net/3n1gm4/cJ8jx/
Video JS 4.x
Normal JS
jQuery
would
jQuery.each($('.vid'), pause)
work?
Try
more general? for all videos!