summaryrefslogtreecommitdiff
path: root/includes/js/dojox/av
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dojox/av')
-rw-r--r--includes/js/dojox/av/README40
-rw-r--r--includes/js/dojox/av/_base.js8
-rw-r--r--includes/js/dojox/av/_base/_ieFlash.js17
-rw-r--r--includes/js/dojox/av/_base/flash.js186
-rw-r--r--includes/js/dojox/av/_base/quicktime.js161
-rw-r--r--includes/js/dojox/av/resources/version.movbin0 -> 1667 bytes
-rw-r--r--includes/js/dojox/av/tests/flash.html39
-rw-r--r--includes/js/dojox/av/tests/quicktime.html24
-rw-r--r--includes/js/dojox/av/tests/resources/hfp.swfbin0 -> 13671 bytes
9 files changed, 475 insertions, 0 deletions
diff --git a/includes/js/dojox/av/README b/includes/js/dojox/av/README
new file mode 100644
index 0000000..828aa40
--- /dev/null
+++ b/includes/js/dojox/av/README
@@ -0,0 +1,40 @@
+-------------------------------------------------------------------------------
+DojoX Audio/Video
+-------------------------------------------------------------------------------
+Version 0.1
+Release date: 01/15/2008
+-------------------------------------------------------------------------------
+Project state:
+experimental
+-------------------------------------------------------------------------------
+Credits
+ Tom Trenka (ttrenka AT gmail.com)
+-------------------------------------------------------------------------------
+Project description
+
+DojoX A/V aims to bring audio and video capabilities to the Open Web, first
+by wrapping common media types (Flash and Quicktime) and then by providing
+easy to use objects to accomplish basic A/V tasks. As of version 0.1, only
+the base is included (Flash and Quicktime embedding mechanisms); in the near
+future, usable objects will appear, both in raw programmatic form and also with
+Dijit-compatible wrappers.
+-------------------------------------------------------------------------------
+Dependencies:
+
+DojoX A/V has no dependencies outside of the Dojo Base.
+-------------------------------------------------------------------------------
+Documentation
+
+TBD.
+-------------------------------------------------------------------------------
+Installation instructions
+
+Grab the following from the Dojo SVN Repository:
+http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/av.js
+http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/av/*
+
+Install into the following directory structure:
+/dojox/av/
+
+...which should be at the same level as your Dojo checkout.
+-------------------------------------------------------------------------------
diff --git a/includes/js/dojox/av/_base.js b/includes/js/dojox/av/_base.js
new file mode 100644
index 0000000..540a751
--- /dev/null
+++ b/includes/js/dojox/av/_base.js
@@ -0,0 +1,8 @@
+if(!dojo._hasResource["dojox.av._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.av._base"] = true;
+dojo.provide("dojox.av._base");
+
+dojo.require("dojox.av._base.flash");
+dojo.require("dojox.av._base.quicktime");
+
+}
diff --git a/includes/js/dojox/av/_base/_ieFlash.js b/includes/js/dojox/av/_base/_ieFlash.js
new file mode 100644
index 0000000..80869fd
--- /dev/null
+++ b/includes/js/dojox/av/_base/_ieFlash.js
@@ -0,0 +1,17 @@
+// *** Fricking Eolas. This is here to get around the Eolas issue. Sigh. ***************
+dojox.av.flash.place = function(node, kwArgs){
+ node=dojo.byId(node);
+ var o = dojox.av.flash.__ie_markup__(kwArgs);
+ if(o){
+ node.innerHTML = o.markup;
+ return window[o.id];
+ }
+ return null;
+}
+if(dojo._initFired){
+ dojox.av.flash.onInitialize();
+} else {
+ dojo.addOnLoad(function(){
+ dojox.av.flash.onInitialize();
+ });
+}
diff --git a/includes/js/dojox/av/_base/flash.js b/includes/js/dojox/av/_base/flash.js
new file mode 100644
index 0000000..f1eb27c
--- /dev/null
+++ b/includes/js/dojox/av/_base/flash.js
@@ -0,0 +1,186 @@
+if(!dojo._hasResource["dojox.av._base.flash"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.av._base.flash"] = true;
+dojo.provide("dojox.av._base.flash");
+
+(function(){
+ /*******************************************************
+ dojox.av.flash
+
+ Base functionality to insert a flash movie into
+ a document on the fly.
+
+ Support for Flash 6 is dropped in favor of Flash 8;
+ multiple movies are supported.
+ ******************************************************/
+
+ // TODO: solve the Eolas problem, the function that actually pushes
+ // Flash movie into the doc must be loaded from an external script.
+
+ // TODO: add Brad's ExpressInstall for automated installation.
+
+ var fMarkup, fVersion, __def__={
+ expressInstall: false,
+ width: 320,
+ height: 240,
+ style: null,
+ redirect: null,
+ params: []
+ };
+ var keyBase="dojox-av-flash-", keyCount=0;
+ function prep(kwArgs){
+ kwArgs=dojo.mixin(dojo.clone(__def__), kwArgs || {});
+ if(!("path" in kwArgs)){
+ console.error("dojox.av._base.flash(ctor):: no path reference to a Flash movie was provided.");
+ return null;
+ }
+ if(!("id" in kwArgs)){
+ kwArgs.id=(keyBase + keyCount++);
+ }
+ return kwArgs;
+ }
+
+ if(dojo.isIE){
+ // *** Internet Explorer branch ******************************************************************
+ fMarkup=function(kwArgs){
+ kwArgs=prep(kwArgs);
+ if(!kwArgs){ return null; }
+ var s='<object id="' + kwArgs.id + '" '
+ + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
+ + 'width="' + kwArgs.width + '" '
+ + 'height="' + kwArgs.height + '"'
+ + ((kwArgs.style)?' style="' + kwArgs.style + '"':'')
+ + '>'
+ + '<param name="movie" value="' + kwArgs.path + '" />';
+ for(var i=0, l=kwArgs.params.length; i<l; i++){
+ s += '<param name="' + kwArgs.params[i].key + '" value="' + kwArgs.params[i].value + '" />';
+ }
+ s += '</object>';
+ return { id: kwArgs.id, markup: s };
+ };
+
+ fVersion=(function(){
+ var testVersion=10, testObj=null;
+ while(!testObj && testVersion > 7){
+ try {
+ testObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + testVersion--);
+ } catch(e){ }
+ }
+ if(testObj){
+ var v = testObj.GetVariable("$version").split(" ")[1].split(",");
+ return {
+ major: (v[0]!=null)?parseInt(v[0]):0,
+ minor: (v[1]!=null)?parseInt(v[1]):0,
+ rev: (v[2]!=null)?parseInt(v[2]):0
+ };
+ }
+ return { major: 0, minor: 0, rev: 0 };
+ })();
+
+ // attach some cleanup for IE, thanks to deconcept :)
+ dojo.addOnUnload(function(){
+ var objs=dojo.query("object");
+ for(var i=objs.length-1; i>=0; i--){
+ objs[i].style.display="none";
+ for(var p in objs[i]){
+ if(p!="FlashVars" && dojo.isFunction(objs[i][p])){
+ objs[i][p]=function(){ };
+ }
+ }
+ }
+ });
+
+ // TODO: ...and double check this fix; is IE really firing onbeforeunload with any kind of href="#" link?
+ var beforeUnloadHandle = dojo.connect(dojo.global, "onbeforeunload", function(){
+ try{
+ if(__flash_unloadHandler){ __flash_unloadHandler=function(){ }; }
+ if(__flash_savedUnloadHandler){ __flash_savedUnloadHandler=function(){ }; }
+ } catch(e){ }
+ dojo.disconnect(beforeUnloadHandle);
+ });
+ } else {
+ // *** Sane browsers branch ******************************************************************
+ fMarkup=function(kwArgs){
+ kwArgs=prep(kwArgs);
+ if(!kwArgs){ return null; }
+ var s = '<embed type="application/x-shockwave-flash" '
+ + 'src="' + kwArgs.path + '" '
+ + 'id="' + kwArgs.id + '" '
+ + 'name="' + kwArgs.id + '" '
+ + 'width="' + kwArgs.width + '" '
+ + 'height="' + kwArgs.height + '"'
+ + (("style" in kwArgs)?' style="' + kwArgs.style + '"':'')
+ + 'swLiveConnect="true" '
+ + 'allowScriptAccess="sameDomain" '
+ + 'pluginspage="' + window.location.protocol + '//www.adobe.com/go/getflashplayer" ';
+ for(var i=0, l=kwArgs.params.length; i<l; i++){
+ s += ' ' + kwArgs.params[i].key + '="' + kwArgs.params[i].value + '"';
+ }
+ s += ' />'
+ return { id: kwArgs.id, markup: s };
+ };
+
+ fVersion=(function(){
+ var plugin = navigator.plugins["Shockwave Flash"];
+ if(plugin && plugin.description){
+ var v = plugin.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".");
+ return {
+ major: (v[0]!=null)?parseInt(v[0]):0,
+ minor: (v[1]!=null)?parseInt(v[1]):0,
+ rev: (v[2]!=null)?parseInt(v[2]):0
+ };
+ }
+ return { major: 0, minor: 0, rev: 0 };
+ })();
+ }
+
+ // *** the static object for inserting Flash movies ******************************************************
+ dojox.av.flash = {
+ minSupported : 8,
+ available: fVersion.major,
+ supported: (fVersion.major >= 8),
+ version: fVersion,
+ initialized: false,
+ onInitialize: function(){
+ dojox.av.flash.initialized=true;
+ },
+ __ie_markup__: function(kwArgs){
+ return fMarkup(kwArgs);
+ }
+ };
+
+ if(dojo.isIE){
+ // Ugh!
+ if(dojo._initFired){
+ var e=document.createElement("script");
+ e.type="text/javascript";
+ e.src=dojo.moduleUrl("dojox", "av/_base/_ieFlash.js");
+ e.defer=true;
+ document.getElementsByTagName("head")[0].appendChild(e);
+ } else {
+ // we can use document.write. What a kludge.
+ document.write('<scr'+'ipt defer type="text/javascript" src="' + dojo.moduleUrl("dojox", "av/_base/_ieFlash.js") + '">'
+ + '</scr'+'ipt>');
+ }
+ } else {
+ dojox.av.flash.place = function(node, kwArgs){
+ node=dojo.byId(node);
+ var o = fMarkup(kwArgs);
+ if(o){
+ node.innerHTML = o.markup;
+ return document[o.id];
+ }
+ return null;
+ }
+
+ if(dojo._initFired){
+ dojox.av.flash.onInitialize();
+ } else {
+ dojo.addOnLoad(function(){
+ console.log("firing off dojox.av.flash.onInitialize() for sane browsers.");
+ dojox.av.flash.onInitialize();
+ });
+ }
+ }
+})();
+
+}
diff --git a/includes/js/dojox/av/_base/quicktime.js b/includes/js/dojox/av/_base/quicktime.js
new file mode 100644
index 0000000..0c23a9e
--- /dev/null
+++ b/includes/js/dojox/av/_base/quicktime.js
@@ -0,0 +1,161 @@
+if(!dojo._hasResource["dojox.av._base.quicktime"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.av._base.quicktime"] = true;
+dojo.provide("dojox.av._base.quicktime");
+
+(function(){
+ /*******************************************************
+ dojox.av.quicktime
+
+ Base functionality to insert a QuickTime movie
+ into a document on the fly.
+ ******************************************************/
+
+ var qtMarkup, qtVersion, installed, __def__={
+ width: 320,
+ height: 240,
+ redirect: null,
+ params: []
+ };
+ var keyBase="dojox-av-quicktime-", keyCount=0;
+
+ // reference to the test movie we will use for getting QT info from the browser.
+ var testMovieUrl=dojo.moduleUrl("dojox", "av/resources/version.mov");
+
+ // *** private methods *********************************************************
+ function prep(kwArgs){
+ kwArgs = dojo.mixin(dojo.clone(__def__), kwArgs || {});
+ if(!("path" in kwArgs)){
+ console.error("dojox.av._base.quicktime(ctor):: no path reference to a QuickTime movie was provided.");
+ return null;
+ }
+ if(!("id" in kwArgs)){
+ kwArgs.id=(keyBase + keyCount++);
+ }
+ return kwArgs;
+ }
+
+ var getQTMarkup = 'This content requires the <a href="http://www.apple.com/quicktime/download/" title="Download and install QuickTime.">QuickTime plugin</a>.';
+ if(dojo.isIE){
+ installed = (function(){
+ try{
+ var o = new ActiveXObject("QuickTimeCheckObject.QuickTimeCheck.1");
+ if(o!==undefined){
+ return o.IsQuickTimeAvailable(0);
+ }
+ } catch(e){ }
+ return false;
+ })();
+
+ qtMarkup = function(kwArgs){
+ if(!installed){ return { id: null, markup: getQTMarkup }; }
+
+ kwArgs = prep(kwArgs);
+ if(!kwArgs){ return null; }
+ var s = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '
+ + 'codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" '
+ + 'id="' + kwArgs.id + '" '
+ + 'width="' + kwArgs.width + '" '
+ + 'height="' + kwArgs.height + '">'
+ + '<param name="src" value="' + kwArgs.path + '" />';
+ for(var i=0, l=kwArgs.params.length; i<l; i++){
+ s += '<param name="' + kwArgs.params[i].key + '" value="' + kwArgs.params[i].value + '" />';
+ }
+ s += '</object>';
+ return { id: kwArgs.id, markup: s };
+ }
+ } else {
+ installed = (function(){
+ for(var i=0, l=navigator.plugins.length; i<l; i++){
+ if(navigator.plugins[i].name.indexOf("QuickTime")>-1){
+ return true;
+ }
+ }
+ return false;
+ })();
+
+ qtMarkup = function(kwArgs){
+ if(!installed){ return { id: null, markup: getQTMarkup }; }
+
+ kwArgs = prep(kwArgs);
+ if(!kwArgs){ return null; }
+ var s = '<embed type="video/quicktime" src="' + kwArgs.path + '" '
+ + 'id="' + kwArgs.id + '" '
+ + 'name="' + kwArgs.id + '" '
+ + 'pluginspage="www.apple.com/quicktime/download" '
+ + 'enablejavascript="true" '
+ + 'width="' + kwArgs.width + '" '
+ + 'height="' + kwArgs.height + '"';
+ for(var i=0, l=kwArgs.params.length; i<l; i++){
+ s += ' ' + kwArgs.params[i].key + '="' + kwArgs.params[i].value + '"';
+ }
+ s += '></embed>';
+ return { id: kwArgs.id, markup: s };
+ }
+ }
+
+ qtVersion = { major: 0, minor: 0, rev: 0 };
+
+ // *** This is an offical kludge, but it seems to work everywhere. Sigh. *************************
+ dojo.addOnLoad(function(){
+ var n = document.createElement("div");
+ n.style.cssText = "top:0;left:0;width:1px;height:1px;overflow:hidden;position:absolute;";
+ var o = qtMarkup({ path: testMovieUrl, width:4, height:4 });
+
+ document.body.appendChild(n);
+ n.innerHTML = o.markup;
+ var qt = (dojo.isIE) ? dojo.byId(o.id) : document[o.id];
+
+ // Let Safari and IE have a moment to init the QT object before trying to query it.
+ setTimeout(function(){
+ var v = [ 0, 0, 0 ];
+ if(qt){
+ try {
+ v = qt.GetQuickTimeVersion().split(".");
+ qtVersion = { major: parseInt(v[0]||0), minor: parseInt(v[1]||0), rev: parseInt(v[2]||0) };
+ } catch(e){
+ qtVersion = { major: 0, minor: 0, rev: 0 };
+ }
+ }
+
+ dojox.av.quicktime.supported = v[0];
+ dojox.av.quicktime.version = qtVersion;
+ if(dojox.av.quicktime.supported){
+ dojox.av.quicktime.onInitialize();
+ }
+
+ // fricking IE. gonna end up leaving the movie in the doc, for some
+ // reason getting an unspecified error when trying to remove it.
+ if(!dojo.isIE){
+ document.body.removeChild(n);
+ } else {
+ // move it out of the way.
+ n.style.top = "-10000px";
+ n.style.visibility="hidden";
+ }
+ }, 10);
+ });
+
+ // *** The public interface. ****************************************************************
+ dojox.av.quicktime={
+ minSupported: 6,
+ available: installed,
+ supported: installed,
+ version: qtVersion,
+ initialized: false,
+ onInitialize: function(){ dojox.av.quicktime.initialized = true; }, // stub function to let you know when this is ready
+
+ place: function(/* DOMElement */node, /* Object */kwArgs){
+ node = dojo.byId(node);
+ var o = qtMarkup(kwArgs);
+ if(o){
+ node.innerHTML = o.markup;
+ if(o.id){
+ return (dojo.isIE)? dojo.byId(o.id) : document[o.id]; // QuickTimeObject
+ }
+ }
+ return null; // QuickTimeObject
+ }
+ };
+})();
+
+}
diff --git a/includes/js/dojox/av/resources/version.mov b/includes/js/dojox/av/resources/version.mov
new file mode 100644
index 0000000..4f2cb73
--- /dev/null
+++ b/includes/js/dojox/av/resources/version.mov
Binary files differ
diff --git a/includes/js/dojox/av/tests/flash.html b/includes/js/dojox/av/tests/flash.html
new file mode 100644
index 0000000..a3bb143
--- /dev/null
+++ b/includes/js/dojox/av/tests/flash.html
@@ -0,0 +1,39 @@
+<html>
+ <head>
+ <title>DojoX A/V Flash Detection Test</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../../dijit/tests/css/dijitTests.css";
+ </style>
+ <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
+ <script type="text/javascript">
+ dojo.require("dojox.av._base.flash");
+
+ /*******************************************************************
+ A note.
+
+ You *can* dojo.require dojox.av._base.flash on the fly (i.e.
+ after load), but if you do so, you *must* give Safari and IE
+ a little bit of time before you can start using any of the
+ methods. Quick tests showed that 200ms is more than enough,
+ but you should test intervals at your discretion.
+ ********************************************************************/
+ var testMovieUrl=dojo.moduleUrl("dojox", "av/tests/resources/hfp.swf");
+ dojo.connect(dojox.av.flash, "onInitialize", function(){
+ dojo.byId("results").innerHTML = dojo.toJson(dojox.av.flash.version);
+ dojox.av.flash.place(dojo.byId("flashHolder"), { path: testMovieUrl });
+ });
+ </script>
+ </head>
+ <body>
+ <h1>DojoX A/V: Flash detection tests.</h1>
+ <p>
+ This page is testing the base Flash movie generator.
+ </p>
+ <p>Installed Flash version: <span id="results"></span>.</p>
+ <div id="flashHolder">
+ A movie will be inserted here on load.
+ </div>
+ </body>
+</html>
diff --git a/includes/js/dojox/av/tests/quicktime.html b/includes/js/dojox/av/tests/quicktime.html
new file mode 100644
index 0000000..48e1426
--- /dev/null
+++ b/includes/js/dojox/av/tests/quicktime.html
@@ -0,0 +1,24 @@
+<html>
+ <head>
+ <title>DojoX A/V QuickTime Detection Test</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../../dijit/tests/css/dijitTests.css";
+ </style>
+ <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: false"></script>
+ <script type="text/javascript">
+ dojo.require("dojox.av._base.quicktime");
+ dojo.connect(dojox.av.quicktime, "onInitialize", function(){
+ dojo.byId("results").innerHTML = dojo.toJson(dojox.av.quicktime.version);
+ });
+ </script>
+ </head>
+ <body>
+ <h1>DojoX A/V: QuickTime detection tests.</h1>
+ <p>
+ This page is testing the base QuickTime movie generator. See the Firebug log for details.
+ </p>
+ <p>Installed QuickTime version: <span id="results"></span>.</p>
+ </body>
+</html>
diff --git a/includes/js/dojox/av/tests/resources/hfp.swf b/includes/js/dojox/av/tests/resources/hfp.swf
new file mode 100644
index 0000000..b878f69
--- /dev/null
+++ b/includes/js/dojox/av/tests/resources/hfp.swf
Binary files differ