wurstbrotrest
wurstbrotrest

Reputation: 329

Triggering multiple videos with video-js functionality

Playing multiple videos with video-js functionality is actually possible:

Fiddle 1

However when wrapping a trigger such as a button around the function which invokes playVideo(), the video-js functionality breaks from the second video on.

Fiddle 2

...
$('#start').click(function() {
    ...
});
... 
// The rest of the code in Fiddle 2 is similar to Fiddle 1

What am I doing wrong?

Upvotes: 0

Views: 892

Answers (1)

gulli
gulli

Reputation: 36

You should pass a number to the playVideo() function as a parameter. In your examples they are set to 0.

Then turn

videojs(document.getElementsByClassName("video-js")[0], {}, function () {});

to

videojs(document.getElementsByClassName("video-js")[number], {}, function () {});

That´s it:

Demo: JS Fiddle

Upvotes: 1

Related Questions