mirror of
https://github.com/videojs/video.js.git
synced 2025-07-17 01:42:41 +02:00
Upgraded to latest version
This commit is contained in:
@ -107,7 +107,8 @@ Set options when setting up the videos. The defaults are shown here.
|
|||||||
controlsHiding: true, // Hide controls when mouse is not over the video
|
controlsHiding: true, // Hide controls when mouse is not over the video
|
||||||
defaultVolume: 0.85, // Will be overridden by user's last volume if available
|
defaultVolume: 0.85, // Will be overridden by user's last volume if available
|
||||||
flashVersion: 9, // Required flash version for fallback
|
flashVersion: 9, // Required flash version for fallback
|
||||||
linksHiding: true // Hide download links when video is supported
|
linksHiding: true, // Hide download links when video is supported
|
||||||
|
flashIsDominant: false // Always use Flash when available
|
||||||
});
|
});
|
||||||
|
|
||||||
### Or as the second option of VideoJS.setup
|
### Or as the second option of VideoJS.setup
|
||||||
|
@ -15,9 +15,6 @@ You should have received a copy of the GNU Lesser General Public License
|
|||||||
along with VideoJS. If not, see <http://www.gnu.org/licenses/>.
|
along with VideoJS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Store a list of players on the page for reference
|
|
||||||
var videoJSPlayers = new Array();
|
|
||||||
|
|
||||||
// Using jresig's Class implementation http://ejohn.org/blog/simple-javascript-inheritance/
|
// Using jresig's Class implementation http://ejohn.org/blog/simple-javascript-inheritance/
|
||||||
(function(){var initializing=false, fnTest=/xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; this.JRClass = function(){}; JRClass.extend = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function JRClass() { if ( !initializing && this.init ) this.init.apply(this, arguments); } JRClass.prototype = prototype; JRClass.constructor = JRClass; JRClass.extend = arguments.callee; return JRClass;};})();
|
(function(){var initializing=false, fnTest=/xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; this.JRClass = function(){}; JRClass.extend = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function JRClass() { if ( !initializing && this.init ) this.init.apply(this, arguments); } JRClass.prototype = prototype; JRClass.constructor = JRClass; JRClass.extend = arguments.callee; return JRClass;};})();
|
||||||
|
|
||||||
@ -26,7 +23,6 @@ var VideoJS = JRClass.extend({
|
|||||||
|
|
||||||
// Initialize the player for the supplied video tag element
|
// Initialize the player for the supplied video tag element
|
||||||
// element: video tag
|
// element: video tag
|
||||||
// num: the current player's position in the videoJSPlayers array
|
|
||||||
init: function(element, setOptions){
|
init: function(element, setOptions){
|
||||||
|
|
||||||
// Allow an ID string or an element
|
// Allow an ID string or an element
|
||||||
@ -39,14 +35,18 @@ var VideoJS = JRClass.extend({
|
|||||||
// Hide default controls
|
// Hide default controls
|
||||||
this.video.controls = false;
|
this.video.controls = false;
|
||||||
|
|
||||||
|
// Store reference to player on the video element.
|
||||||
|
// So you can acess the player later: document.getElementById("video_id").player.play();
|
||||||
|
this.video.player = this;
|
||||||
|
|
||||||
// Default Options
|
// Default Options
|
||||||
this.options = {
|
this.options = {
|
||||||
num: 0, // Optional tracking of videoJSPLayers position
|
|
||||||
controlsBelow: false, // Display control bar below video vs. in front of
|
controlsBelow: false, // Display control bar below video vs. in front of
|
||||||
controlsHiding: true, // Hide controls when not over the video
|
controlsHiding: true, // Hide controls when not over the video
|
||||||
defaultVolume: 0.85, // Will be overridden by localStorage volume if available
|
defaultVolume: 0.85, // Will be overridden by localStorage volume if available
|
||||||
flashVersion: 9, // Required flash version for fallback
|
flashVersion: 9, // Required flash version for fallback
|
||||||
linksHiding: true // Hide download links when video is supported
|
linksHiding: true, // Hide download links when video is supported
|
||||||
|
flashIsDominant: false // Always use Flash when available
|
||||||
};
|
};
|
||||||
|
|
||||||
// Override default options with global options
|
// Override default options with global options
|
||||||
@ -66,8 +66,8 @@ var VideoJS = JRClass.extend({
|
|||||||
|
|
||||||
// Check if browser can play HTML5 video
|
// Check if browser can play HTML5 video
|
||||||
if (VideoJS.browserSupportsVideo()) {
|
if (VideoJS.browserSupportsVideo()) {
|
||||||
// Force flash fallback when there's no supported source
|
// Force flash fallback when there's no supported source, or flash is dominant
|
||||||
if (this.canPlaySource() == false) {
|
if (this.canPlaySource() == false || this.options.flashIsDominant) {
|
||||||
this.replaceWithFlash();
|
this.replaceWithFlash();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -693,7 +693,7 @@ var VideoJS = JRClass.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
nativeFullscreenOn: function(){
|
nativeFullscreenOn: function(){
|
||||||
if(typeof this.video.webkitEnterFullScreen == 'function' && false) {
|
if(typeof this.video.webkitEnterFullScreen == 'function') {
|
||||||
// Seems to be broken in Chromium/Chrome
|
// Seems to be broken in Chromium/Chrome
|
||||||
if (!navigator.userAgent.match("Chrome")) {
|
if (!navigator.userAgent.match("Chrome")) {
|
||||||
this.video.webkitEnterFullScreen();
|
this.video.webkitEnterFullScreen();
|
||||||
@ -831,7 +831,7 @@ var VideoJS = JRClass.extend({
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Convenience Functions (mini library)
|
// Convenience Functions (mini library)
|
||||||
// Functions not specific to video or VideoJS and could be replaced with a library like jQuery
|
// Functions not specific to video or VideoJS and could probably be replaced with a library like jQuery
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
var _V_ = {
|
var _V_ = {
|
||||||
addClass: function(element, classToAdd){
|
addClass: function(element, classToAdd){
|
||||||
@ -977,7 +977,7 @@ VideoJS.setup = function(videos, options){
|
|||||||
videos = VideoJS.getVideoJSTags();
|
videos = VideoJS.getVideoJSTags();
|
||||||
|
|
||||||
// If videos is not an array, add to an array
|
// If videos is not an array, add to an array
|
||||||
} else if (typeof videos != 'object') {
|
} else if (typeof videos != 'object' || videos.nodeType == 1) {
|
||||||
videos = [videos];
|
videos = [videos];
|
||||||
returnSingular = true;
|
returnSingular = true;
|
||||||
}
|
}
|
||||||
@ -1050,3 +1050,17 @@ Function.prototype.context = function(obj) {
|
|||||||
}
|
}
|
||||||
return temp
|
return temp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// jQuery Plugin
|
||||||
|
if (window.jQuery) {
|
||||||
|
(function($) {
|
||||||
|
$.fn.VideoJS = function(options) {
|
||||||
|
this.each(function() {
|
||||||
|
VideoJS.setup(this, options);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
})(jQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user