Video.js - How to reference multiple videos in one page?

耗尽温柔 提交于 2019-12-04 15:38:17

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();

Note: this was written for an older version of video.js. _V_() still works but is deprecated: use videojs() instead.

This would also work:

var video = [];
video[1] = _V_("Video1");
video[2] = _V_("Video2");
video[3] = _V_("Video3");
video[4] = _V_("Video4");
video[5] = _V_("Video5");
video[6] = _V_("Video6");
video[7] = _V_("Video7");
video[8] = _V_("Video8");
video[9] = _V_("Video9");
video[10] = _V_("Video10");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!