mirror of
https://github.com/videojs/video.js.git
synced 2025-01-02 06:32:07 +02:00
Added addVideos function by nicholasbs
This commit is contained in:
parent
63459dfac9
commit
51a10a8e17
16
video.js
16
video.js
@ -768,6 +768,22 @@ VideoJS.setup = function(options){
|
||||
}
|
||||
}
|
||||
|
||||
// Add video-js to the video tag or array of video tags (or IDs) passed in.
|
||||
// Typically used when videos are being added to a page dynamically.
|
||||
VideoJS.addVideos = function(videos, options) {
|
||||
videos = videos instanceof Array ? videos : [videos];
|
||||
var videoTag;
|
||||
for (var i=0; i<videos.length; i++) {
|
||||
if (typeof videos[i] == 'string') {
|
||||
videoTag = document.getElementById(videos[i]);
|
||||
} else { // assume DOM object
|
||||
videoTag = videos[i];
|
||||
}
|
||||
options = (options) ? _V_.merge(options, { num: videoJSPlayers.length }) : options;
|
||||
videoJSPlayers.push(new VideoJS(videoTag, options));
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the browser supports video.
|
||||
VideoJS.browserSupportsVideo = function() {
|
||||
if (typeof VideoJS.videoSupport != "undefined") return VideoJS.videoSupport;
|
||||
|
Loading…
Reference in New Issue
Block a user