2011-11-29 11:40:05 -08:00
|
|
|
// HTML5 Shiv. Must be in <head> to support older browsers.
|
|
|
|
document.createElement("video");document.createElement("audio");
|
|
|
|
|
2012-12-30 21:45:50 -08:00
|
|
|
goog.provide('_V_');
|
2012-12-31 15:25:56 -08:00
|
|
|
goog.provide('VideoJS');
|
2012-12-30 21:45:50 -08:00
|
|
|
|
2012-12-31 15:25:56 -08:00
|
|
|
var VideoJS = function(id, options, ready){
|
2011-11-30 11:53:08 -08:00
|
|
|
var tag; // Element of ID
|
2011-11-29 11:40:05 -08:00
|
|
|
|
|
|
|
// Allow for element or ID to be passed in
|
|
|
|
// String ID
|
|
|
|
if (typeof id == "string") {
|
|
|
|
|
|
|
|
// Adjust for jQuery ID syntax
|
|
|
|
if (id.indexOf("#") === 0) {
|
|
|
|
id = id.slice(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If a player instance has already been created for this ID return it.
|
|
|
|
if (_V_.players[id]) {
|
|
|
|
return _V_.players[id];
|
|
|
|
|
|
|
|
// Otherwise get element for ID
|
|
|
|
} else {
|
|
|
|
tag = _V_.el(id)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID is a media element
|
|
|
|
} else {
|
|
|
|
tag = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for a useable element
|
|
|
|
if (!tag || !tag.nodeName) { // re: nodeName, could be a box div also
|
2011-11-30 11:53:08 -08:00
|
|
|
throw new TypeError("The element or ID supplied is not valid. (VideoJS)"); // Returns
|
2011-11-29 11:40:05 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Element may have a player attr referring to an already created player instance.
|
|
|
|
// If not, set up a new player and return the instance.
|
2012-12-30 21:45:50 -08:00
|
|
|
return tag.player || new _V_.Player(tag, options, ready);
|
|
|
|
};
|
2011-11-29 11:40:05 -08:00
|
|
|
|
|
|
|
// Shortcut
|
2012-12-31 15:25:56 -08:00
|
|
|
// VideoJS = _V_;
|
2012-01-14 18:13:13 -08:00
|
|
|
|
|
|
|
// CDN Version. Used to target right flash swf.
|
|
|
|
CDN_VERSION = "GENERATED_CDN_VSN";
|
2011-11-29 11:40:05 -08:00
|
|
|
|
2012-12-30 21:45:50 -08:00
|
|
|
/**
|
|
|
|
* Global Player instance options
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
|
|
|
_V_.options = {
|
2011-11-29 11:40:05 -08:00
|
|
|
// Default order of fallback technology
|
2011-12-07 21:03:12 -08:00
|
|
|
techOrder: ["html5","flash"],
|
2011-12-07 21:29:21 -08:00
|
|
|
// techOrder: ["flash","html5"],
|
2011-12-07 21:03:12 -08:00
|
|
|
|
2011-12-07 21:29:21 -08:00
|
|
|
html5: {},
|
2012-01-27 15:04:25 -08:00
|
|
|
flash: { swf: "http://vjs.zencdn.net/c/video-js.swf" },
|
2011-11-29 11:40:05 -08:00
|
|
|
|
|
|
|
// Default of web browser is 300x150. Should rely on source width/height.
|
2012-04-06 16:42:09 -07:00
|
|
|
width: 300,
|
|
|
|
height: 150,
|
|
|
|
|
2011-12-01 15:47:12 -08:00
|
|
|
// defaultVolume: 0.85,
|
|
|
|
defaultVolume: 0.00, // The freakin seaguls are driving me crazy!
|
2011-11-29 11:40:05 -08:00
|
|
|
|
|
|
|
// Included control sets
|
2012-12-30 21:45:50 -08:00
|
|
|
// TODO: just use uppercase Class name
|
|
|
|
children: {
|
|
|
|
"mediaLoader": {},
|
2012-03-19 15:50:05 -07:00
|
|
|
"posterImage": {},
|
2012-12-31 15:25:56 -08:00
|
|
|
// // "textTrackDisplay": {},
|
2012-01-27 15:04:25 -08:00
|
|
|
"loadingSpinner": {},
|
|
|
|
"bigPlayButton": {},
|
2012-03-09 17:12:38 -08:00
|
|
|
"controlBar": {}
|
2012-01-27 15:04:25 -08:00
|
|
|
}
|
2011-11-29 11:40:05 -08:00
|
|
|
};
|
|
|
|
|
2012-12-30 21:45:50 -08:00
|
|
|
/**
|
|
|
|
* Global player list
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
|
|
|
_V_.players = {};
|
|
|
|
|
|
|
|
|
2012-01-13 09:26:18 -08:00
|
|
|
// Set CDN Version of swf
|
|
|
|
if (CDN_VERSION != "GENERATED_CDN_VSN") {
|
|
|
|
_V_.options.flash.swf = "http://vjs.zencdn.net/"+CDN_VERSION+"/video-js.swf"
|
2012-12-30 21:45:50 -08:00
|
|
|
}
|