";if(q.w3c||s){n+=''}q.width=q.height=q.id=q.w3c=q.src=null;for(var l in q){if(q[l]!==null){n+=''}}var o="";if(t){for(var m in t){if(t[m]!==null){o+=m+"="+(typeof t[m]=="object"?g(t[m]):t[m])+"&"}}o=o.substring(0,o.length-1);n+='"}n+="";return n}function d(m,p,l){var k=flashembed.getVersion();f(this,{getContainer:function(){return m},getConf:function(){return p},getVersion:function(){return k},getFlashvars:function(){return l},getApi:function(){return m.firstChild},getHTML:function(){return a(p,l)}});var q=p.version;var r=p.expressInstall;var o=!q||flashembed.isSupported(q);if(o){p.onFail=p.version=p.expressInstall=null;m.innerHTML=a(p,l)}else{if(q&&r&&flashembed.isSupported([6,65])){f(p,{src:r});l={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};m.innerHTML=a(p,l)}else{if(m.innerHTML.replace(/\s/g,"")!==""){}else{m.innerHTML="Flash version "+q+" or greater is required
"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"
"+(m.tagName=="A"?"Click here to download latest version
":"Download latest version from here
");if(m.tagName=="A"){m.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"}}}}}if(!o&&p.onFail){var n=p.onFail.call(this);if(typeof n=="string"){m.innerHTML=n}}if(document.all){window[p.id]=document.getElementById(p.id)}}window.flashembed=function(l,m,k){if(typeof l=="string"){var n=document.getElementById(l);if(n){l=n}else{c(function(){flashembed(l,m,k)});return}}if(!l){return}if(typeof m=="string"){m={src:m}}var o=f({},i);f(o,m);return new d(l,o,k)};f(window.flashembed,{getVersion:function(){var m=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var l=navigator.plugins["Shockwave Flash"].description;if(typeof l!="undefined"){l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var n=parseInt(l.replace(/^(.*)\..*$/,"$1"),10);var r=/r/.test(l)?parseInt(l.replace(/^.*r(.*)$/,"$1"),10):0;m=[n,r]}}else{if(window.ActiveXObject){try{var p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(q){try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");m=[6,0];p.AllowScriptAccess="always"}catch(k){if(m[0]==6){return m}}try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(o){}}if(typeof p=="object"){l=p.GetVariable("$version");if(typeof l!="undefined"){l=l.replace(/^\S+\s+(.*)$/,"$1").split(",");m=[parseInt(l[0],10),parseInt(l[2],10)]}}}}return m},isSupported:function(k){var m=flashembed.getVersion();var l=(m[0]>k[0])||(m[0]==k[0]&&m[1]>=k[1]);return l},domReady:c,asString:g,getHTML:a});if(e){jQuery.fn.flashembed=function(l,k){var m=null;this.each(function(){m=flashembed(this,l,k)});return l.api===false?this:m}}})();
(function(){
var DomReady = window.DomReady = {};
// Everything that has to do with properly supporting our document ready event. Brought over from the most awesome jQuery.
var userAgent = navigator.userAgent.toLowerCase();
// Figure out what browser is being used
var browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
safari: /webkit/.test(userAgent),
opera: /opera/.test(userAgent),
msie: (/msie/.test(userAgent)) && (!/opera/.test( userAgent )),
mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent))
};
var readyBound = false;
var isReady = false;
var readyList = [];
// Handle when the DOM is ready
function domReady() {
// Make sure that the DOM is not already loaded
if(!isReady) {
// Remember that the DOM is ready
isReady = true;
if(readyList) {
for(var fn = 0; fn < readyList.length; fn++) {
readyList[fn].call(window, []);
}
readyList = [];
}
}
};
// From Simon Willison. A safe way to fire onload w/o screwing up everyone else.
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
};
// does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload.
function bindReady() {
if(readyBound) {
return;
}
readyBound = true;
// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
if (document.addEventListener && !browser.opera) {
// Use the handy event callback
document.addEventListener("DOMContentLoaded", domReady, false);
}
// If IE is used and is not in a frame
// Continually check to see if the document is ready
if (browser.msie && window == top) (function(){
if (isReady) return;
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(error) {
setTimeout(arguments.callee, 0);
return;
}
// and execute any waiting functions
domReady();
})();
if(browser.opera) {
document.addEventListener( "DOMContentLoaded", function () {
if (isReady) return;
for (var i = 0; i < document.styleSheets.length; i++)
if (document.styleSheets[i].disabled) {
setTimeout( arguments.callee, 0 );
return;
}
// and execute any waiting functions
domReady();
}, false);
}
if(browser.safari) {
var numStyles;
(function(){
if (isReady) return;
if (document.readyState != "loaded" && document.readyState != "complete") {
setTimeout( arguments.callee, 0 );
return;
}
if (numStyles === undefined) {
var links = document.getElementsByTagName("link");
for (var i=0; i < links.length; i++) {
if(links[i].getAttribute('rel') == 'stylesheet') {
numStyles++;
}
}
var styles = document.getElementsByTagName("style");
numStyles += styles.length;
}
if (document.styleSheets.length != numStyles) {
setTimeout( arguments.callee, 0 );
return;
}
// and execute any waiting functions
domReady();
})();
}
// A fallback to window.onload, that will always work
addLoadEvent(domReady);
};
// This is the public function that people can use to hook up ready.
DomReady.ready = function(fn, args) {
// Attach the listeners
bindReady();
// If the DOM is already ready
if (isReady) {
// Execute the function immediately
fn.call(window, []);
} else {
// Add the function to the wait list
readyList.push( function() { return fn.call(window, []); } );
}
};
bindReady();
})();
/*
* HTML 5 media compatibility layer.
*
* Copyright 2010 Dave Hall .
*
* This script is part of the html5media project. The html5media project enables
* HTML5 video and audio tags in all major browsers.
*
* The html5media project is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* The html5media project is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with html5media. If not, see.
*
* Developed by Dave Hall.
*
*
*/
(function(window, document, undefined) {
"use strict";
// Tagnames for the different types of media tag.
var VIDEO_TAG = "video";
var AUDIO_TAG = "audio";
// If no video tag is supported, go ahead and enable all HTML5 elements.
if (!document.createElement(VIDEO_TAG).canPlayType) {
document.createElement(AUDIO_TAG);
document.createElement("source");
}
// Checks whether this is a broken Android implementation.
var isBrokenAndroid = window.navigator.userAgent.toLowerCase().match(/android 2\.[12]/) !== null;
// Checks if this is opera.
var isOpera = window.navigator.userAgent.toLowerCase().match(/opera/) !== null;
// Checks whether the given element can play the fiven format.
function canPlayFormat(element, format) {
return element.canPlayType(format) || (isBrokenAndroid && format.search("mp4") > -1);
}
// Scans over elements with the given tag name, creating fallbacks if required.
function scanElementsByTagName(tagName) {
var elements = document.getElementsByTagName(tagName);
var elementsList = [];
for (var n = 0; n < elements.length; n++) {
elementsList.push(elements[n]);
}
for (n = 0; n < elementsList.length; n++) {
var element = elementsList[n];
var requiresFallback = true;
// Test if the media tag is supported.
if (element.canPlayType) {
// If the media has a src attribute, and can play it, then all is good.
if (element.src) {
if (canPlayFormat(element, guessFormat(tagName, element.src))) {
requiresFallback = false;
}
} else {
// Check for source child attributes.
var sources = element.getElementsByTagName("source");
for (var m = 0; m < sources.length; m++) {
var source = sources[m];
if (canPlayFormat(element, guessFormat(tagName, source.src, source.type))) {
requiresFallback = false;
break;
}
}
}
}
// If cannot play media, create the fallback.
if (requiresFallback || html5media.forceFallback(tagName, element)) {
html5media.createFallback(tagName, element);
} else {
// HACK: Enables playback in android phones.
if (isBrokenAndroid) {
element.addEventListener("click", function() {
this.play();
}, false);
}
}
}
}
/**
* Replaces all video tags with flowplayer video player if the browser does
* not support either the video tag the h.264 codex.
*
* This is run automatically on document ready, but can be run manually
* again after dynamically creating HTML5 video tags.
*/
function html5media() {
scanElementsByTagName("video");
scanElementsByTagName("audio");
}
/**
* Callback to allow conditional forcing of the fallback player.
*
* Return true to force the flash fallback. The default implementation never
* forces the flash fallback.
*/
html5media.forceFallback = function(tagName, element) {
return false;
};
// Removes the final filename from the given path.
function dirname(path) {
return path.split("/").slice(0, -1).join("/") + "/";
}
/**
* The locations of the flowplayer and flowplayer controls SWF files.
*
* Override this if they are not located in the same folder as the
*/
var scriptRoot = (function() {
var scripts = document.getElementsByTagName("script");
for (var n = 0; n < scripts.length; n++) {
var script = scripts[n];
if (script.src.match(/html5media(\.min|)\.js/)) {
return dirname(script.src);
}
}
return "";
}());
html5media.flowplayerSwf = scriptRoot + "flowplayer.swf";
html5media.flowplayerAudioSwf = scriptRoot + "flowplayer.audio.swf";
html5media.flowplayerControlsSwf = scriptRoot + "flowplayer.controls.swf";
html5media.expressInstallSwf = scriptRoot + "expressInstall.swf";
// Known media formats.
var THEORA_FORMAT = 'video/ogg; codecs="theora, vorbis"';
var H264_FORMAT = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"';
var VORBIS_FORMAT = 'audio/ogg; codecs="vorbis"';
var WEBM_FORMAT = 'video/webm;';
var M4A_FORMAT = 'audio/x-m4a;';
var MP3_FORMAT = 'audio/mpeg;';
var WAV_FORMAT = 'audio/wav; codecs="1"';
/**
* The video format to assume if it cannot be determined what format a media
* file is.
*/
var assumedFormats = {
video: H264_FORMAT,
audio: MP3_FORMAT
};
/**
* Formats that the fallback Flash player is able to understand.
*/
var fallbackFormats = [H264_FORMAT, M4A_FORMAT, MP3_FORMAT];
/**
* Known file extensions that can be used to guess media formats in the
* absence of other information.
*/
var fileExtensions = {
video: {
"ogg": THEORA_FORMAT,
"ogv": THEORA_FORMAT,
"avi": H264_FORMAT,
"mp4": H264_FORMAT,
"mkv": H264_FORMAT,
"h264": H264_FORMAT,
"264": H264_FORMAT,
"avc": H264_FORMAT,
"m4v": H264_FORMAT,
"3gp": H264_FORMAT,
"3gpp": H264_FORMAT,
"3g2": H264_FORMAT,
"mpg": H264_FORMAT,
"mpeg": H264_FORMAT,
"webm": WEBM_FORMAT
},
audio: {
"ogg": VORBIS_FORMAT,
"oga": VORBIS_FORMAT,
"aac": M4A_FORMAT,
"m4a": M4A_FORMAT,
"mp3": MP3_FORMAT,
"wav": WAV_FORMAT
}
};
// Trys to determine the format of a given video file.
function guessFormat(tag, src, type) {
// An explicit type is always best.
if (type) {
return type;
}
// Try to match based on file extension.
var extensionMatch = (/\.([a-z1-9]+)(\?|#|\s|$)/i).exec(src);
if (extensionMatch) {
var format = fileExtensions[tag][extensionMatch[1]];
if (format) {
return format;
}
}
return assumedFormats[tag];
}
// Detects presence of HTML5 attributes.
function hasAttr(element, attr) {
var val = element.getAttribute(attr);
return !!val || typeof val == "string";
}
// Standardizes URLs to avoid confusing Flowplayer.
function fixPath(url) {
var link = document.createElement("a");
link.href = url;
return link.href;
}
// Calculates the given dimension of the given element.
function getDimension(element, dimension, fallback) {
// Attempt to use it's attribute value.
var result = element.getAttribute(dimension);
if (result) {
return result + "px";
}
// Attempt to use it's computed style.
var style;
if (element.currentStyle) {
style = element.currentStyle[dimension];
} else if (window.getComputedStyle) {
style = document.defaultView.getComputedStyle(element, null).getPropertyValue(dimension);
} else {
return fallback;
}
if (style == "auto") {
return fallback;
}
return style;
}
// Extracts the mimetype from a format string.
function getMimeType(format) {
return format.match(/\s*([\w-]+\/[\w-]+)(;|\s|$)/)[1];
}
// Checks whether the two formats are equivalent.
function formatMatches(format1, format2) {
return (getMimeType(format1) == getMimeType(format2));
}
/**
* Callback for adding custom configuration options to Flowplayer before it
* launches. This callback is supplied with the tagname of the element being
* replaced ("video" or "audio"), the element being replaced, and the
* generated Flowplayer configuration.
*
* This callback should return the updated Flowplayer configuration. By
* The default implementation leaves the generated configuration intact.
*/
html5media.configureFlowplayer = function(element, config) {
return config;
};
/**
* Default callback for creating a fallback for html5 media tags.
*
* This implementation creates flowplayer instances, but this can
* theoretically be used to support all different types of flash player.
*/
html5media.createFallback = function(tagName, element) {
var hasControls = hasAttr(element, "controls");
// Standardize the src and poster.
var poster = element.getAttribute("poster") || "";
var src = element.getAttribute("src") || "";
if (!src) {
// Find a compatible fallback file.
var sources = element.getElementsByTagName("source");
for (var sn = 0; sn < sources.length; sn++) {
var source = sources[sn];
var srcValue = source.getAttribute("src");
if (srcValue) {
for (var fn = 0; fn < fallbackFormats.length; fn++) {
var fallbackFormat = fallbackFormats[fn];
if (formatMatches(fallbackFormat, guessFormat(tagName, srcValue, source.getAttribute("type")))) {
src = srcValue;
break;
}
}
}
if (src) {
break;
}
}
}
// If there is no src, then fail silently for now.
if (!src) {
return;
}
// Create the replacement element div.
var replacement = document.createElement("span");
replacement.id = element.id;
replacement.style.cssText = element.style.cssText;
replacement.className = element.className;
replacement.title = element.title;
replacement.style.display = "block";
replacement.style.width = getDimension(element, "width", "300px");
if (tagName == "audio") {
replacement.style.height = "26px";
} else {
replacement.style.height = getDimension(element, "height", "200px");
}
// Replace the element with the div.
element.parentNode.replaceChild(replacement, element);
var preload = (element.getAttribute("preload") || "").toLowerCase();
// Activate flowplayer.
var playlist = [];
if (poster) {
playlist.push({url: fixPath(poster)});
}
if (src) {
playlist.push({
url: fixPath(src),
autoPlay: hasAttr(element, "autoplay"),
autoBuffering: hasAttr(element, "autobuffer") || (hasAttr(element, "preload") && (preload === "" || preload == "auto")),
onBeforeFinish: function() {
return !hasAttr(element, "loop");
}
});
}
// Determine which plugins should be loaded.
var plugins = {
controls: hasControls && {
url: fixPath(html5media.flowplayerControlsSwf),
opacity: 0.8,
backgroundColor: "#181818",
backgroundGradient: "none",
fullscreen: tagName == VIDEO_TAG,
autoHide: tagName == VIDEO_TAG && {
fullscreenOnly: false,
enabled: true,
hideStyle: "fade",
mouseOutDelay: 0
} || {
enabled: false
}
} || null
};
// HACK: Opera cannot autohide controls, for some reason.
if (isOpera && plugins.controls) {
plugins.controls.autoHide.enabled = false;
}
// Audio-specific config.
if (tagName == "audio") {
// Load the audio plugin.
plugins.audio = {
url: fixPath(html5media.flowplayerAudioSwf)
};
// HACK: The Flowplayer audio plugin requires that the controls plugin is present.
if (!hasControls) {
plugins.controls = {
url: fixPath(html5media.flowplayerControlsSwf),
display: "none"
};
replacement.style.height = 0;
}
// HACK: Disable autoBuffering, since a flowplayer audio bug can cause uncontrollable autoplaying.
playlist[playlist.length - 1].autoBuffering = false;
}
// Load the Flowplayer.
var config = {
play: null,
playlist: playlist,
clip: {
scaling: "fit",
fadeInSpeed: 0,
fadeOutSpeed: 0
},
canvas: {
backgroundGradient: "none",
backgroundColor: "#000000"
},
plugins: plugins
};
config = html5media.configureFlowplayer(element, config);
flowplayer(replacement, {
src: fixPath(html5media.flowplayerSwf),
expressInstall: fixPath(html5media.expressInstallSwf),
wmode: "opaque"
}, config);
};
// Automatically execute the html5media function on page load.
DomReady.ready(html5media);
// Expose html5media to the global object.
window.html5media = html5media;
})(this, document);