From 54308bb6166b6385544bc1612cbb46790e1c5a88 Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Thu, 16 Dec 2010 13:15:34 -0800 Subject: [PATCH] Extracted flash.js. Changed video.js source file to main.js, to avoid confusion. --- dev/combine_sources.sh | 3 +- dev/src/flash.js | 74 ++++++++++++++++++++++++++++++++++ dev/src/html5.js | 1 + dev/src/{video.js => main.js} | 75 ----------------------------------- 4 files changed, 77 insertions(+), 76 deletions(-) create mode 100644 dev/src/flash.js rename dev/src/{video.js => main.js} (82%) diff --git a/dev/combine_sources.sh b/dev/combine_sources.sh index 5e0e28545..58badc8f9 100755 --- a/dev/combine_sources.sh +++ b/dev/combine_sources.sh @@ -2,8 +2,9 @@ # Combines Source Files. In terminal, sh combine_sources.sh cat src/_begin.js > combined.js -cat src/video.js >> combined.js +cat src/main.js >> combined.js cat src/html5.js >> combined.js +cat src/flash.js >> combined.js cat src/behaviors.js >> combined.js cat src/lib.js >> combined.js cat src/video-js.jquery.js >> combined.js diff --git a/dev/src/flash.js b/dev/src/flash.js new file mode 100644 index 000000000..30d2cc0c0 --- /dev/null +++ b/dev/src/flash.js @@ -0,0 +1,74 @@ +/* Flash Player Type +================================================================================ */ +VideoJS.fn.extend({ + + flashSupported: function(){ + if (!this.flashElement) { this.flashElement = this.getFlashElement(); } + // Check if object exists & Flash Player version is supported + return !!(this.flashElement && this.flashPlayerVersionSupported()); + }, + + flashInit: function(){ + this.replaceWithFlash(); + this.element = this.flashElement; + this.video.src = ""; // Stop video from downloading if HTML5 is still supported + var flashPlayerType = VideoJS.flashPlayers[this.options.flashPlayer]; + this.extend(flashPlayerType.api); + (flashPlayerType.init.context(this))(); + }, + + // Get Flash Fallback object element from Embed Code + getFlashElement: function(){ + var children = this.video.children; + for (var i=0,j=children.length; i= playerVersion; + } +}); + +/* Flash Object Fallback (Flash Player Type) +================================================================================ */ +VideoJS.flashPlayers = {}; +VideoJS.flashPlayers.htmlObject = { + flashPlayerVersion: 9, + init: function() { return true; }, + api: { // No video API available with HTML Object embed method + + width: function(width){ + if (width !== undefined) { + this.element.width = width; + this.box.style.width = width+"px"; + this.triggerResizeListeners(); + return this; + } + return this.element.width; + }, + + height: function(height){ + if (height !== undefined) { + this.element.height = height; + this.box.style.height = height+"px"; + this.triggerResizeListeners(); + return this; + } + return this.element.height; + } + } +}; \ No newline at end of file diff --git a/dev/src/html5.js b/dev/src/html5.js index f1f6bd76b..fc30133bb 100644 --- a/dev/src/html5.js +++ b/dev/src/html5.js @@ -1,6 +1,7 @@ /* HTML5 Player Type ================================================================================ */ VideoJS.fn.extend({ + html5Supported: function(){ if (VideoJS.browserSupportsVideo() && this.canPlaySource()) { return true; diff --git a/dev/src/video.js b/dev/src/main.js similarity index 82% rename from dev/src/video.js rename to dev/src/main.js index ecefc29ff..488353a61 100644 --- a/dev/src/video.js +++ b/dev/src/main.js @@ -141,81 +141,6 @@ var VideoJS = JRClass.extend({ VideoJS.fn = VideoJS.prototype; VideoJS.options = {}; // Globally set options -//////////////////////////////////////////////////////////////////////////////// -// Player Types -//////////////////////////////////////////////////////////////////////////////// - -/* Flash Object Fallback (Player Type) -================================================================================ */ -VideoJS.fn.extend({ - flashSupported: function(){ - if (!this.flashElement) { this.flashElement = this.getFlashElement(); } - // Check if object exists & Flash Player version is supported - if (this.flashElement && this.flashPlayerVersionSupported()) { - return true; - } else { - return false; - } - }, - flashInit: function(){ - this.replaceWithFlash(); - this.element = this.flashElement; - this.video.src = ""; // Stop video from downloading if HTML5 is still supported - var flashPlayerType = VideoJS.flashPlayers[this.options.flashPlayer]; - this.extend(flashPlayerType.api); - (flashPlayerType.init.context(this))(); - }, - // Get Flash Fallback object element from Embed Code - getFlashElement: function(){ - var children = this.video.children; - for (var i=0,j=children.length; i= playerVersion; - } -}); - -VideoJS.flashPlayers = {}; -VideoJS.flashPlayers.htmlObject = { - flashPlayerVersion: 9, - init: function() { return true; }, - api: { // No video API available with HTML Object embed method - width: function(width){ - if (width !== undefined) { - this.element.width = width; - this.box.style.width = width+"px"; - this.triggerResizeListeners(); - return this; - } - return this.element.width; - }, - height: function(height){ - if (height !== undefined) { - this.element.height = height; - this.box.style.height = height+"px"; - this.triggerResizeListeners(); - return this; - } - return this.element.height; - } - } -}; - - /* Download Links Fallback (Player Type) ================================================================================ */ VideoJS.fn.extend({