Video.js-如何在一个页面中引用多个视频? [英] Video.js - How to reference multiple videos in one page?
问题描述
天哪,我找不到答案,我已经花了几个小时. 如何在video.js中同时引用多个视频?
My goodness, I cannot find an answer for this and I spent several hours already. How can you reference multiple videos at the same time in video.js?
API文档说:
引用播放器:您只需要确保您的视频标签具有ID即可.该示例嵌入代码的ID为"example_video_1".如果一页上有多个视频,请确保每个视频标签都有唯一的ID.
Referencing the Player: You just need to make sure your video tag has an ID. The example embed code has an ID of "example_video_1". If you have multiple videos on one page, make sure every video tag has a unique ID.
var myPlayer = V ("example_video_1");
var myPlayer = V("example_video_1");
此示例显示了一个ID,但没有显示如何同时引用多个ID.
This example shows a single ID, but it doesnt show how I can reference multiple IDs at the same time.
如果我有3个不同的标签:"video_1","video_2","video_3",我该如何引用它们?
If I have 3 different tags: "video_1", "video_2", "video_3", how do I reference them all?
我尝试了一个数组,但是没有用.我还尝试列出这样的视频:
I tried an array and it didnt work. I also tried listing the videos like this:
var myPlayer = _V_("video_1", "video_2");
也没有工作.
有人可以帮我吗?
谢谢.
推荐答案
您不能将多个ID传递给_V_()
.一次做一个:
You can't pass multiple ids to _V_()
. Either do them one at a time:
var myPlayer1 = _V_("video_1");
var myPlayer2 = _V_("video_2");
var myPlayer3 = _V_("video_3");
或者如果您希望将它们作为数组:
Or if you want them as an array:
var myPlayers = Array(_V_("video_1"), _V_("video_2"), _V_("video_3"));
myPlayers[1].play();
注意:这是为较旧版本的video.js编写的. _V_()
仍然有效,但已弃用:改为使用videojs()
.
Note: this was written for an older version of video.js. _V_()
still works but is deprecated: use videojs()
instead.
这篇关于Video.js-如何在一个页面中引用多个视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!