diff --git a/demo.html b/demo.html index adaebed60..fc21def76 100644 --- a/demo.html +++ b/demo.html @@ -26,9 +26,6 @@ } - - - @@ -40,12 +37,12 @@ - - --> + - + diff --git a/video.js b/video.js index 4fbcdac5a..b6d73f864 100644 --- a/video.js +++ b/video.js @@ -29,8 +29,6 @@ var VideoJS = Class.extend({ // num: the current player's position in the videoJSPlayers array init: function(element, setOptions){ - if(!VideoJS.browserSupportsVideo()) return; - this.video = element; // Default Options @@ -38,20 +36,31 @@ var VideoJS = Class.extend({ num: 0, // Optional tracking of videoJSPLayers position controlsBelow: false, // Display control bar below video vs. on top 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 }; - // Override default options with set options if (typeof setOptions == "object") _V_.merge(this.options, setOptions); this.box = this.video.parentNode; + this.flashFallback = this.getFlashFallback(); + this.linksFallback = this.getLinksFallback(); this.percentLoaded = 0; - // if (this.canPlaySource()) { - // - // } + if (VideoJS.browserSupportsVideo()) { + if (this.canPlaySource() == false) { + this.hideLinksFallback(); + this.replaceWithFlash(); + return; + } + } else if (VideoJS.browserFlashVersion() >= this.options.flashVersion) { + this.hideLinksFallback(); + return; + } else { + return; + } - this.hideDownloadLinks(); + this.hideLinksFallback(); if (VideoJS.isIpad()) { this.options.controlsBelow = true; @@ -235,14 +244,32 @@ var VideoJS = Class.extend({ this.controls.appendChild(this.fullscreenControl); }, + // Get the download links block element + getLinksFallback: function(){ + return this.box.getElementsByTagName("P")[0]; + }, + // Hide no-video download paragraph - hideDownloadLinks: function(){ - var children = this.box.children; - for(var i=0; i