summaryrefslogtreecommitdiff
path: root/js/dojo-1.7.2/dojox/av
diff options
context:
space:
mode:
Diffstat (limited to 'js/dojo-1.7.2/dojox/av')
-rw-r--r--js/dojo-1.7.2/dojox/av/FLAudio.js379
-rw-r--r--js/dojo-1.7.2/dojox/av/FLVideo.js323
-rw-r--r--js/dojo-1.7.2/dojox/av/README65
-rw-r--r--js/dojo-1.7.2/dojox/av/_Media.js353
-rw-r--r--js/dojo-1.7.2/dojox/av/resources/audio.swfbin0 -> 7013 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/resources/version.movbin0 -> 1667 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/resources/video.swfbin0 -> 10523 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/PlayButton.js75
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/Player.js128
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/ProgressSlider.js134
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/Status.js115
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/VolumeButton.js187
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/PlayButton.html3
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/Player.css203
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/Player.html20
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/ProgressSlider.html6
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/Status.html7
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/VolumeButton.html7
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/images/dojoPlayerIcons.pngbin0 -> 5737 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/images/playerIconsbin0 -> 887 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/images/player_sprite.pngbin0 -> 6076 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/images/progressLoadedBk.pngbin0 -> 153 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/images/progressPositionBk.pngbin0 -> 157 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleNorm.pngbin0 -> 336 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleOver.pngbin0 -> 248 bytes
-rw-r--r--js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleSprite.pngbin0 -> 426 bytes
26 files changed, 2005 insertions, 0 deletions
diff --git a/js/dojo-1.7.2/dojox/av/FLAudio.js b/js/dojo-1.7.2/dojox/av/FLAudio.js
new file mode 100644
index 0000000..07fd946
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/FLAudio.js
@@ -0,0 +1,379 @@
+//>>built
+define("dojox/av/FLAudio", ['dojo', 'dojox/embed/Flash', 'dojox/timing/doLater'],function(dojo, dijit){
+
+dojo.experimental("dojox.av.FLVideo");
+
+dojo.declare("dojox.av.FLAudio", null, {
+
+ // summary:
+ // Play MP3 files through the Flash SWF built in the
+ // DEFT project.
+ // description:
+ // This class is brand new, so there is a lot of
+ // functionality not yet available. The initial
+ // purpose is for playing "event" sounds like button
+ // clicks, and for loading and controlling multiple
+ // sounds at once. As of yet, streaming is not supported
+ // and polling the sounds for events during playback
+ // may still be missing information. Markup is not
+ // supported, as it may not be needed.
+ //
+ // TODO:
+ // Streaming, playback events, crossdomain, CDN support,
+ // (alternate SWF location), global volume, ID3 tag,
+ // factor out doLater, onLoadStatus needs work,
+ // play(position) / seek()
+ //
+ // example:
+ // | new dojox.av.FLAudio({
+ // | initialVolume:.7,
+ // | initialPan:0,
+ // | autoPlay:false
+ // | });
+ //
+ // id: String?
+ // The id of this widget and the id of the SWF movie.
+ id:"",
+ //
+ // initialVolume: Number
+ // From 0-1
+ // Sets volume for all files unless changed with doPlay
+ // or setVolume
+ initialVolume: 0.7,
+ //
+ // initialPan: Number
+ // From -1 to 1 (-1 is left, 1 is right, 0 is middle)
+ // Sets pan for all files unless changed with play
+ // or setPan
+ initialPan: 0,
+ //
+ // autoPlay: Boolean
+ // If true, all files will play upon load. If false,
+ // they load and wait for doPlay() command.
+ //
+ // isDebug: Boolean?
+ // Setting to true tells the SWF to output log messages to Firebug.
+ isDebug: false,
+ //
+ // statusInterval: Number
+ // How often in milliseconds that the status of the
+ // player is checked - both load and play
+ statusInterval:200,
+ //
+ // _swfPath: Uri
+ // The path to the video player SWF resource
+ _swfPath: dojo.moduleUrl("dojox.av", "resources/audio.swf"),
+ //
+ //
+ // allowScriptAccess: String
+ // Whether the SWF can access the container JS
+ allowScriptAccess:"always",
+ //
+ // allowNetworking: String
+ // Whether SWF is restricted to a domain
+ allowNetworking: "all",
+ //
+
+ constructor: function(/*Object*/options){
+
+ // Provide this function for the SWF to ensure that the it is playing
+ // in HTML.
+ dojo.global.swfIsInHTML = function(){ return true; }
+
+ dojo.mixin(this, options || {});
+ if(!this.id){ this.id = "flaudio_"+new Date().getTime(); }
+ this.domNode = dojo.doc.createElement("div");
+ dojo.style(this.domNode, {
+ position:"relative",
+ width:"1px",
+ height:"1px",
+ top:"1px",
+ left:"1px"
+ });
+ dojo.body().appendChild(this.domNode);
+ this.init();
+ },
+
+ init: function(){
+ // summary:
+ // Initialize the media.
+ //
+ //
+ this._subs = [];
+ this.initialVolume = this._normalizeVolume(this.initialVolume);
+
+ var args = {
+ path:this._swfPath.uri,
+ width:"1px",
+ height:"1px",
+ minimumVersion:9, // this may need to be 10, not sure
+ expressInstall:true,
+ params:{
+ wmode:"transparent",
+ allowScriptAccess:this.allowScriptAccess,
+ allowNetworking:this.allowNetworking
+ },
+ // only pass in simple variables - no deep objects
+ vars:{
+ id:this.id,
+ autoPlay:this.autoPlay,
+ initialVolume:this.initialVolume,
+ initialPan:this.initialPan,
+ statusInterval:this.statusInterval,
+ isDebug:this.isDebug
+ }
+ };
+
+ this._sub("mediaError", "onError");
+ this._sub("filesProgress", "onLoadStatus");
+ this._sub("filesAllLoaded", "onAllLoaded");
+ this._sub("mediaPosition", "onPlayStatus");
+ this._sub("mediaEnd", "onComplete");
+ this._sub("mediaMeta", "onID3");
+
+ this._flashObject = new dojox.embed.Flash(args, this.domNode);
+ this._flashObject.onError = function(err){
+ console.warn("Flash Error:", err);
+ };
+ this._flashObject.onLoad = dojo.hitch(this, function(mov){
+ this.flashMedia = mov;
+ this.isPlaying = this.autoPlay;
+ this.isStopped = !this.autoPlay;
+ this.onLoad(this.flashMedia);
+ });
+ },
+
+ // ============== //
+ // Loading Files //
+ // ============== //
+
+ load: function(/*Object*/options){
+ // summary:
+ // Adds a media object to the playlist
+ // ***This can be called repeatedly to add multiple items.
+ // options: Object
+ // url: String
+ // (required) path to MP3 media
+ // url must be absolute or relative to SWF,
+ // not dojo or the html. An effort will be made
+ // to fix incorrect paths.
+ // id: String
+ // (optional) an identifier to later determine
+ // which media to control.
+ // returns:
+ // The normalized url, which can be used to identify the
+ // audio.
+ //
+ if(dojox.timing.doLater(this.flashMedia, this)){ return false; }
+ if(!options.url){
+ throw new Error("An url is required for loading media");
+ return false;
+ }else{
+ options.url = this._normalizeUrl(options.url);
+ }
+ this.flashMedia.load(options);
+
+ return options.url; // String
+ },
+
+ // ============================= //
+ // Methods to control the sound //
+ // ============================= //
+
+ doPlay: function(/*Object*/options){
+ // summary:
+ // Tell media to play, based on
+ // the options passed.
+ // options: Object
+ // volume: Number
+ // Sets the volume
+ // pan: Number
+ // Sets left/right pan
+ // index:Number OR id:String OR url:String
+ // Choose one of the above to indentify
+ // the media you wish to control. id is
+ // set by you. index is the order in which
+ // media was added (zero based)
+ // NOTE: lack of an identifier will default
+ // to first (or only) item.
+ // NOTE: Can't name this method "play()" as it causes
+ // an IE error.
+ this.flashMedia.doPlay(options);
+ },
+
+ pause: function(/*Object*/options){
+ // summary:
+ // Tell media to pause, based on identifier in
+ // the options passed.
+ // options: Object
+ // index:Number OR id:String OR url:String
+ // See doPlay()
+ //
+ this.flashMedia.pause(options);
+ },
+
+ stop: function(/*Object*/options){
+ // summary:
+ // Tell media to stop, based on identifier in
+ // the options passed.
+ // options:
+ // index:Number OR id:String OR url:String
+ // See doPlay()
+ //
+ this.flashMedia.doStop(options);
+ },
+
+ setVolume: function(/*Object*/options){
+ // summary:
+ // Set media volume, based on identifier in
+ // the options passed.
+ // options:
+ // volume: Number
+ // 0 to 1
+ // index:Number OR id:String OR url:String
+ // See doPlay()
+ //
+ this.flashMedia.setVolume(options);
+ },
+
+ setPan: function(/*Object*/options){
+ // summary:
+ // Set media pan, based on identifier in
+ // the options passed.
+ // options:
+ // pan:Number
+ // -1 to 1
+ // index:Number OR id:String OR url:String
+ // See doPlay()
+ //
+ this.flashMedia.setPan(options);
+ },
+
+ getVolume: function(/*Object*/options){
+ // summary:
+ // Get media volume, based on identifier in
+ // the options passed.
+ // options:
+ // index:Number OR id:String OR url:String
+ // See doPlay()
+ //
+ return this.flashMedia.getVolume(options);
+ },
+
+ getPan: function(/*Object*/options){
+ // summary:
+ // Set media pan, based on identifier in
+ // the options passed.
+ // options:
+ // index:Number OR id:String OR url:String
+ // See doPlay()
+ //
+ return this.flashMedia.getPan(options);
+ },
+
+ getPosition: function(/*Object*/options){
+ // summary:
+ // Get the current time.
+ // options:
+ // index:Number OR id:String OR url:String
+ // See doPlay()
+ //
+ return this.flashMedia.getPosition(options);
+ },
+
+ // ============= //
+ // Sound Events //
+ // ============= //
+ onError: function(msg){
+ // summary:
+ // stub fired when an error occurs
+ console.warn("SWF ERROR:", msg)
+ },
+
+ onLoadStatus: function(/*Array*/events){
+ // summary:
+ },
+
+ onAllLoaded: function(){
+ // summary:
+ // stub fired
+ },
+
+ onPlayStatus: function(/*Array*/events){
+ // summary:
+ },
+
+ onComplete: function(/*Array*/events){
+ // summary:
+ // Fired at the end of a media file.
+ },
+
+ onLoad: function(){
+ // summary:
+ // stub fired when SWF is ready
+ },
+ onID3: function(evt){
+ // summary:
+ // Fired when the ID3 data is received.
+ },
+
+
+
+ destroy: function(){
+ // summary:
+ // destroys flash
+ if(!this.flashMedia){
+ this._cons.push(dojo.connect(this, "onLoad", this, "destroy"));
+ return;
+ }
+ dojo.forEach(this._subs, function(s){
+ dojo.unsubscribe(s);
+ });
+ dojo.forEach(this._cons, function(c){
+ dojo.disconnect(c);
+ });
+ this._flashObject.destroy();
+ //dojo._destroyElement(this.flashDiv);
+ },
+
+
+
+ _sub: function(topic, method){
+ // summary:
+ // helper for subscribing to topics
+ dojo.subscribe(this.id+"/"+topic, this, method);
+ },
+
+ _normalizeVolume: function(vol){
+ // summary:
+ // Ensures volume is less than one
+ //
+ if(vol>1){
+ while(vol>1){
+ vol*=.1
+ }
+ }
+ return vol;
+ },
+
+ _normalizeUrl: function(_url){
+ // summary:
+ // Checks that path is relative to HTML file or
+ // convertes it to an absolute path.
+ //
+ if(_url && _url.toLowerCase().indexOf("http")<0){
+ //
+ // Appears to be a relative path. Attempt to convert it to absolute,
+ // so it will better target the SWF.
+ var loc = window.location.href.split("/");
+ loc.pop();
+ loc = loc.join("/")+"/";
+
+ _url = loc+_url;
+ }
+ return _url;
+ }
+
+});
+return dojox.av.FLAudio;
+});
diff --git a/js/dojo-1.7.2/dojox/av/FLVideo.js b/js/dojo-1.7.2/dojox/av/FLVideo.js
new file mode 100644
index 0000000..62adc8e
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/FLVideo.js
@@ -0,0 +1,323 @@
+//>>built
+define("dojox/av/FLVideo", ['dojo', 'dijit', 'dijit/_Widget', 'dojox/embed/Flash', 'dojox/av/_Media'],function(dojo, dijit){
+
+dojo.experimental("dojox.av.FLVideo");
+dojo.declare("dojox.av.FLVideo", [dijit._Widget, dojox.av._Media], {
+
+ // summary:
+ // Inserts a Flash FLV video into the HTML page and provides methods
+ // and events for controlling the video. Also plays the H264/M4V codec
+ // with a little trickery: change the '.M4V' extension to '.flv'.
+ //
+ // example:
+ //
+ // markup:
+ // | <div id="vid" initialVolume=".7",
+ // | mediaUrl="../resources/Grog.flv"
+ // | dojoType="dojox.av.FLVideo"></div>
+ // programmatic:
+ // | new dojox.av.FLVideo({
+ // | initialVolume:.7,
+ // | mediaUrl:"../resources/Grog.flv"
+ // | }, "vid");
+ //
+ // mediaUrl: String
+ // REQUIRED: The Url of the video file that will be played.
+ // NOTE: Must be either an absolute URL or relative to the HTML file.
+ // Relative paths will be converted to abslute paths
+ //
+ // _swfPath: Uri
+ // The path to the video player SWF resource
+ _swfPath: dojo.moduleUrl("dojox.av", "resources/video.swf"),
+ //
+ //
+ constructor: function(/*Object*/options){
+ // Provide this function for the SWF to ensure that the it is playing
+ // in HTML.
+ dojo.global.swfIsInHTML = function(){ return true; }
+ },
+
+ postCreate: function(){
+ // summary:
+ // Initialize the media.
+ //
+ //
+ this._subs = [];
+ this._cons = [];
+ this.mediaUrl = this._normalizeUrl(this.mediaUrl);
+ this.initialVolume = this._normalizeVolume(this.initialVolume);
+
+ var args = {
+ path:this._swfPath,
+ width:"100%",
+ height:"100%",
+ minimumVersion:9,
+ expressInstall:true,
+ params:{
+ allowFullScreen: this.allowFullScreen,
+ wmode:this.wmode,
+ allowScriptAccess:this.allowScriptAccess,
+ allowNetworking:this.allowNetworking
+ },
+ // only pass in simple variables - no deep objects
+ vars:{
+ videoUrl:this.mediaUrl,
+ id:this.id,
+ autoPlay:this.autoPlay,
+ volume:this.initialVolume,
+ isDebug:this.isDebug
+ }
+ };
+
+ // Setting up dojo.subscribes that listens to events
+ // from the player
+ this._sub("stageClick", "onClick");
+ this._sub("stageSized", "onSwfSized");
+ this._sub("mediaStatus", "onPlayerStatus");
+ this._sub("mediaMeta", "onMetaData");
+ this._sub("mediaError", "onError");
+ this._sub("mediaStart", "onStart");
+ this._sub("mediaEnd", "onEnd");
+
+ this._flashObject = new dojox.embed.Flash(args, this.domNode);
+ this._flashObject.onError = function(err){
+ console.error("Flash Error:", err);
+ };
+ this._flashObject.onLoad = dojo.hitch(this, function(mov){
+ this.flashMedia = mov;
+ this.isPlaying = this.autoPlay;
+ this.isStopped = !this.autoPlay;
+ this.onLoad(this.flashMedia);
+ this._initStatus();
+ this._update();
+ });
+ this.inherited(arguments);
+ },
+
+ // ============================= //
+ // Methods to control the player //
+ // ============================= //
+
+ play: function(/* String? */newUrl){
+ // summary:
+ // Plays the video. If an url is passed in, plays the new link.
+ this.isPlaying = true;
+ this.isStopped = false;
+ this.flashMedia.doPlay(this._normalizeUrl(newUrl));
+ },
+
+ pause: function(){
+ // summary:
+ // Pauses the video
+ this.isPlaying = false;
+ this.isStopped = false;
+ if(this.onPaused){
+ this.onPaused();
+ }
+ this.flashMedia.pause();
+ },
+
+ seek: function(/* Float */ time ){
+ // summary:
+ // Goes to the time passed in the argument
+ this.flashMedia.seek(time);
+ },
+
+
+ // ===================== //
+ // Player Getter/Setters //
+ // ===================== //
+
+ volume: function(/* Float */ vol){
+ // summary:
+ // Sets the volume of the video to the time in the
+ // argument - between 0 - 1.
+ //
+ if(vol){
+ if(!this.flashMedia) {
+ this.initialVolume = vol;
+ }
+ this.flashMedia.setVolume(this._normalizeVolume(vol));
+ }
+ if(!this.flashMedia || !this.flashMedia.doGetVolume) {
+ return this.initialVolume;
+ }
+ return this.flashMedia.getVolume(); // Float
+ },
+
+ // ============= //
+ // Player Events //
+ // ============= //
+
+ /*=====
+ onLoad: function(mov){
+ // summary:
+ // Fired when the SWF player has loaded
+ // NOT when the video has loaded
+ },
+
+ onDownloaded: function(percent){
+ // summary:
+ // Fires the amount of that the media has been
+ // downloaded. Number, 0-100
+ },
+
+ onClick: function(evt){
+ // summary:
+ // Fires when the player is clicked
+ // Could be used to toggle play/pause, or
+ // do an external activity, like opening a new
+ // window.
+ },
+
+ onSwfSized: function(data){
+ // summary:
+ // Fired on SWF resize, or when its
+ // toggled between fullscreen.
+ },
+
+ onMetaData: function(data, evt){
+ // summary:
+ // The video properties. Width, height, duration, etc.
+ // NOTE: if data is empty, this is an older FLV with no meta data.
+ // Duration cannot be determined. In original FLVs, duration
+ // could only be obtained with Flash Media Server.
+ // NOTE: Older FLVs can still return width and height
+ // and will do so on a second event call
+ },
+
+ onPosition: function( time){
+ // summary:
+ // The position of the playhead in seconds
+ },
+
+ onStart: function( data){
+ // summary:
+ // Fires when video starts
+ // Good for setting the play button to pause
+ // during an autoPlay for example
+ },
+
+ onPlay: function(data){
+ // summary:
+ // Fires when video starts and resumes
+ },
+
+ onPause: function(data){
+ // summary:
+ // Fires when the pause button is clicked
+ },
+
+ onEnd: function(data){
+ // summary:
+ // Fires when video ends
+ // Could be used to change pause button to play
+ // or show a post video graphic, like YouTube
+ },
+
+ onStop: function(){
+ // summary:
+ // Fire when the Stop button is clicked
+ // TODO: This is not hooked up yet and shouldn't
+ // fire.
+ },
+
+ onBuffer: function(isBuffering){
+ // summary:
+ // Fires a boolean to tell if media
+ // is paused for buffering or if buffering
+ // has finished
+ this.isBuffering = isBuffering;
+ },
+
+ onError: function(data, url){
+ // summary:
+ // Fired when the player encounters an error
+ // example:
+ // | console.warn("ERROR-"+data.type.toUpperCase()+":",
+ // | data.info.code, " - URL:", url);
+ },
+
+ onStatus: function(data){
+ // summary:
+ // Simple status
+ },
+
+ onPlayerStatus: function(data){
+ // summary:
+ // The status of the video from the SWF
+ // playing, stopped, bufering, etc.
+ },
+
+ onResize: function(){
+ // summary:
+ // Fired on page resize
+ },
+ =====*/
+
+ // =============== //
+ // Private Methods //
+ // =============== //
+
+ _checkBuffer: function(/* Float */time, /* Float */bufferLength){
+ // summary:
+ // Checks that there is a proper buffer time between
+ // current playhead time and the amount of data loaded.
+ // Works only on FLVs with a duration (not older). Pauses
+ // the video while continuing download.
+ //
+ if(this.percentDownloaded == 100){
+ if(this.isBuffering){
+ this.onBuffer(false);
+ this.flashMedia.doPlay();
+ }
+ return;
+ }
+
+ if(!this.isBuffering && bufferLength<.1){
+ this.onBuffer(true);
+ this.flashMedia.pause();
+ return;
+ }
+
+ var timePercentLoad = this.percentDownloaded*.01*this.duration;
+
+ // check if start buffer needed
+ if(!this.isBuffering && time+this.minBufferTime*.001>timePercentLoad){
+ this.onBuffer(true);
+ this.flashMedia.pause();
+
+ // check if end buffer needed
+ }else if(this.isBuffering && time+this.bufferTime*.001<=timePercentLoad){
+ this.onBuffer(false);
+ this.flashMedia.doPlay();
+ }
+
+ },
+ _update: function(){
+ // summary:
+ // Helper function to fire onPosition, check download progress,
+ // and check buffer.
+ var time = Math.min(this.getTime() || 0, this.duration);
+
+ var dObj = this.flashMedia.getLoaded();
+ this.percentDownloaded = Math.ceil(dObj.bytesLoaded/dObj.bytesTotal*100);
+ this.onDownloaded(this.percentDownloaded);
+ this.onPosition(time);
+ if(this.duration){
+ this._checkBuffer(time, dObj.buffer);
+ }
+ // FIXME: need to remove this on destroy
+ this._updateHandle = setTimeout(dojo.hitch(this, "_update"), this.updateTime);
+ },
+
+ destroy: function(){
+ clearTimeout(this._updateHandle);
+ dojo.disconnect(this._positionHandle);
+ this.inherited(arguments);
+ }
+
+});
+
+return dojox.av.FLVideo;
+});
diff --git a/js/dojo-1.7.2/dojox/av/README b/js/dojo-1.7.2/dojox/av/README
new file mode 100644
index 0000000..b249a2e
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/README
@@ -0,0 +1,65 @@
+-------------------------------------------------------------------------------
+DojoX Audio/Video
+-------------------------------------------------------------------------------
+Version 0.1
+Release date: 01/15/2008
+-------------------------------------------------------------------------------
+Project state:
+experimental
+-------------------------------------------------------------------------------
+Credits
+ Tom Trenka (ttrenka AT gmail.com)
+ Mike Wilcox (AnM8tR AT Yahoo.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 depends on dojox.embed, and uses Flash movies created in the deft
+project using Flex OSS 3. You do not need any of the deft code; compiled
+movies are included with dojox.av. If you want to modify the actual movies,
+you can look in the deft project (under the package deft.av).
+-------------------------------------------------------------------------------
+Documentation
+
+TBD.
+-------------------------------------------------------------------------------
+Included media:
+
+Video:
+test/video/Grog.flv and test/video/OldMan.flv are both created by Mike Wilcox
+and may be freely used and distributed in any way. I only ask for credit if
+widely shown.
+
+Audio:
+test/audio/Ola.mp3, test/audio/Hio.mp3, test/audio/FuzzWah.mp3 are from a
+sounds effects CD and are not to be redistributed. They will most likely
+be swapped out when a better open source option is avaialable.
+
+-------------------------------------------------------------------------------
+Installation instructions
+
+Grab the following from the Dojo SVN Repository:
+
+http://svn.dojotoolkit.org/src/dojox/trunk/embed/*
+http://svn.dojotoolkit.org/src/dojox/trunk/av/*
+
+Install into the following directory structure:
+/dojox/av/
+
+...which should be at the same level as your Dojo checkout.
+
+-------------------------------------------------------------------------------
+Change history
+
+2008-01-15 Initial checkin, with basic movie embedding code.
+2008-06-04 Removed the base code, after moving it into dojox.embed and modifying it.
+2008-08-14 Implemented FLVideo for Flash Video
+2009-02-08 Implemented FLAudio for Flash Audio
diff --git a/js/dojo-1.7.2/dojox/av/_Media.js b/js/dojo-1.7.2/dojox/av/_Media.js
new file mode 100644
index 0000000..4930b8d
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/_Media.js
@@ -0,0 +1,353 @@
+//>>built
+define("dojox/av/_Media", ['dojo'],function(dojo){
+
+dojo.experimental("dojox.av.FLVideo");
+
+ return dojo.declare("dojox.av._Media", null, {
+ // summary:
+ // Used as a mixin for dojox and AIR media
+ // description:
+ // Calculates the current status of the playing media and fires
+ // the appropriate events.
+ //
+ mediaUrl:"",
+ //
+ // initialVolume: Float?
+ // The initial volume setting of the player. Acccepts between 0 and 1.
+ initialVolume:1,
+ //
+ // autoPlay:Boolean?
+ // Whether the video automatically plays on load or not.
+ autoPlay: false,
+ //
+ // bufferTime: Number?
+ // Time in milliseconds that the video should be loaded before it will
+ // play. May pause and resume to build up buffer. Prevents stuttering.
+ // Note:
+ // Older FLVs, without a duration, cannot be buffered.
+ bufferTime: 2000,
+ //
+ // minBufferTime: Number
+ // Time in milliseconds bwteen the playhead time and loaded time that
+ // will trigger the buffer. When buffer is triggered, video will pause
+ // until the bufferTime amount is buffered.
+ // Note: Should be a small number, greater than zero.
+ minBufferTime:300,
+ //
+ // updateTime: Number
+ // How often, in milliseconds to get an update of the video position.
+ updateTime: 100,
+ //
+ // id: String?
+ // The id of this widget and the id of the SWF movie.
+ id:"",
+ //
+ // isDebug: Boolean?
+ // Setting to true tells the SWF to output log messages to Firebug.
+ isDebug: false,
+ //
+ // percentDownloaded: read-only-Number
+ // The percentage the media has downloaded; from 0-100
+ percentDownloaded:0,
+ //
+ // _flashObject: read-only-Object
+ // The dojox.embed object
+ _flashObject:null,
+ //
+ // flashMedia: read-only-SWF
+ // The SWF object. Methods are passed to this.
+ flashMedia:null,
+ //
+ // allowScriptAccess: String
+ // Whether the SWF can access the container JS
+ allowScriptAccess:"always",
+ //
+ // allowNetworking: String
+ // Whether SWF is restricted to a domain
+ allowNetworking: "all",
+ //
+ // wmode: String
+ // The render type of the SWF
+ wmode: "transparent",
+ //
+ // allowFullScreen: Boolean
+ // Whether to allow the SWF to go to fullscreen
+ allowFullScreen:true,
+
+ _initStatus: function(){
+ // summary:
+ // Connect mediaStatus to the media.
+ //
+ this.status = "ready";
+ this._positionHandle = dojo.connect(this, "onPosition", this, "_figureStatus");
+
+ },
+
+ // ============== //
+ // Player Getters //
+ // ============== //
+
+ getTime: function(){
+ // summary:
+ // Returns the current time of the video
+ // Note:
+ // Consider the onPosition event, which returns
+ // the time at a set interval. Too many trips to
+ // the SWF could impact performance.
+ return this.flashMedia.getTime(); // Float
+ },
+
+ // ============= //
+ // Player Events //
+ // ============= //
+
+ onLoad: function(/* SWF */ mov){
+ // summary:
+ // Fired when the SWF player has loaded
+ // NOT when the video has loaded
+ //
+ },
+
+ onDownloaded: function(/* Number */percent){
+ // summary:
+ // Fires the amount of that the media has been
+ // downloaded. Number, 0-100
+ },
+
+ onClick: function(/* Object */ evt){
+ // summary:
+ // TODO: Return x/y of click
+ // Fires when the player is clicked
+ // Could be used to toggle play/pause, or
+ // do an external activity, like opening a new
+ // window.
+ },
+
+ onSwfSized: function(/* Object */ data){
+ // summary:
+ // Fired on SWF resize, or when its
+ // toggled between fullscreen.
+ },
+
+ onMetaData: function(/* Object */ data, /* Object */ evt){
+ // summary:
+ // The video properties. Width, height, duration, etc.
+ // NOTE: if data is empty, this is an older FLV with no meta data.
+ // Duration cannot be determined. In original FLVs, duration
+ // could only be obtained with Flash Media Server.
+ // NOTE: Older FLVs can still return width and height
+ // and will do so on a second event call
+ console.warn("onMeta", data)
+ this.duration = data.duration;
+ },
+
+ onPosition: function(/* Float */ time){
+ // summary:
+ // The position of the playhead in seconds
+ },
+
+ onStart: function(/* Object */ data){
+ // summary:
+ // Fires when video starts
+ // Good for setting the play button to pause
+ // during an autoPlay for example
+ },
+
+ onPlay: function(/* Object */ data){
+ // summary:
+ // Fires when video starts and resumes
+ },
+
+ onPause: function(/* Object */ data){
+ // summary:
+ // Fires when the pause button is clicked
+ },
+
+ onEnd: function(/* Object */ data){
+ // summary:
+ // Fires when video ends
+ // Could be used to change pause button to play
+ // or show a post video graphic, like YouTube
+ },
+
+ onStop: function(){
+ // summary:
+ // Fire when the Stop button is clicked
+ // TODO: This is not hooked up yet and shouldn't
+ // fire.
+ },
+
+ onBuffer: function(/* Boolean */ isBuffering){
+ // summary:
+ // Fires a boolean to tell if media
+ // is paused for buffering or if buffering
+ // has finished
+ this.isBuffering = isBuffering;
+ },
+
+ onError: function(/* Object */ data, /* String */ url){
+ // summary:
+ // Fired when the player encounters an error
+ // example:
+ // | console.warn("ERROR-"+data.type.toUpperCase()+":",
+ // | data.info.code, " - URL:", url);
+ console.warn("ERROR-"+data.type.toUpperCase()+":", data.info.code, " - URL:", url);
+ },
+
+ onStatus: function(/* Object */data){
+ // summary:
+ // Simple status
+ },
+
+ onPlayerStatus: function(/* Object */data){
+ // summary:
+ // The status of the video from the SWF
+ // playing, stopped, bufering, etc.
+ },
+
+ onResize: function(){
+
+ },
+
+ _figureStatus: function(){
+ // summary:
+ // Calculate media status, based on playhead movement, and
+ // onStop and onStart events
+ // TODO:
+ // Figure in real status from the media for more accurate results.
+ //
+ var pos = this.getTime();
+ //console.log(pos, this.duration, (pos>this.duration-.5), (this.duration && pos>this.duration-.5))
+
+ if(this.status=="stopping"){
+ // stop was fired, need to fake pos==0
+ this.status = "stopped";
+ this.onStop(this._eventFactory());
+
+ }else if(this.status=="ending" && pos==this._prevPos){
+ this.status = "ended";
+ this.onEnd(this._eventFactory());
+
+ }else if(this.duration && pos>this.duration-.5){
+ this.status="ending"
+
+ }else if(pos===0 ){//|| this.status == "stopped"
+ if(this.status == "ready"){
+ //never played
+ }else{
+ //stopped
+ this.status = "stopped";
+ if(this._prevStatus != "stopped"){
+ this.onStop(this._eventFactory());
+ }
+ }
+
+ }else{
+ // pos > 0
+ if(this.status == "ready"){
+ //started
+ this.status = "started";
+ this.onStart(this._eventFactory());
+ this.onPlay(this._eventFactory());
+
+ }else if(this.isBuffering){
+ this.status = "buffering";
+
+ }else if(this.status == "started" || (this.status == "playing" && pos != this._prevPos)){
+ this.status = "playing";
+ //this.onPosition(this._eventFactory());
+
+ }else if(!this.isStopped && this.status == "playing" && pos == this._prevPos){
+ this.status = "paused";
+ console.warn("pause", pos, this._prevPos)
+ if(this.status != this._prevStatus){
+ this.onPause(this._eventFactory());
+ }
+
+ }else if((this.status == "paused" ||this.status == "stopped") && pos != this._prevPos){
+ this.status = "started";
+ this.onPlay(this._eventFactory());
+ }
+ }
+
+ this._prevPos = pos;
+ this._prevStatus = this.status;
+ this.onStatus(this.status);
+
+
+ },
+
+ _eventFactory: function(){
+ // summary:
+ // Creates a generic event object.
+ //
+ var evt = {
+ //position:this._channel.position,
+ //seconds:this.toSeconds(this._channel.position*.001),
+ //percentPlayed:this._getPercent(),
+ status:this.status
+ }
+ return evt; // Object
+ },
+
+
+
+ _sub: function(topic, method){
+ // summary:
+ // helper for subscribing to topics
+ dojo.subscribe(this.id+"/"+topic, this, method);
+ },
+
+ _normalizeVolume: function(vol){
+ // summary:
+ // Ensures volume is less than one
+ //
+ if(vol>1){
+ while(vol>1){
+ vol*=.1
+ }
+ }
+ return vol;
+ },
+
+ _normalizeUrl: function(_url){
+ // summary:
+ // Checks that path is relative to HTML file or
+ // convertes it to an absolute path.
+ //
+
+ console.log(" url:", _url);
+
+ if(_url && (_url.toLowerCase().indexOf("http")<0 || _url.indexOf("/") == 0)){
+ //
+ // Appears to be a relative path. Attempt to convert it to absolute,
+ // so it will better target the SWF.
+ var loc = window.location.href.split("/");
+ loc.pop();
+
+ loc = loc.join("/")+"/";
+ console.log(" loc:", loc);
+ _url = loc+_url;
+ }
+ return _url;
+ },
+
+ destroy: function(){
+ // summary:
+ // destroys flash
+ if(!this.flashMedia){
+ this._cons.push(dojo.connect(this, "onLoad", this, "destroy"));
+ return;
+ }
+ dojo.forEach(this._subs, function(s){
+ dojo.unsubscribe(s);
+ });
+ dojo.forEach(this._cons, function(c){
+ dojo.disconnect(c);
+ });
+ this._flashObject.destroy();
+ //dojo._destroyElement(this.flashDiv);
+
+ }
+ });
+});
diff --git a/js/dojo-1.7.2/dojox/av/resources/audio.swf b/js/dojo-1.7.2/dojox/av/resources/audio.swf
new file mode 100644
index 0000000..7162c35
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/resources/audio.swf
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/resources/version.mov b/js/dojo-1.7.2/dojox/av/resources/version.mov
new file mode 100644
index 0000000..4f2cb73
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/resources/version.mov
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/resources/video.swf b/js/dojo-1.7.2/dojox/av/resources/video.swf
new file mode 100644
index 0000000..5122311
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/resources/video.swf
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/widget/PlayButton.js b/js/dojo-1.7.2/dojox/av/widget/PlayButton.js
new file mode 100644
index 0000000..e7f09e0
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/PlayButton.js
@@ -0,0 +1,75 @@
+//>>built
+define("dojox/av/widget/PlayButton", ['dojo', 'dijit', 'dijit/_Widget', 'dijit/_TemplatedMixin'],function(dojo, dijit){
+
+dojo.declare("dojox.av.widget.PlayButton", [dijit._Widget, dijit._TemplatedMixin], {
+ // summary:
+ // A Play/Pause button widget to use with dojox.av.widget.Player
+ //
+ templateString: dojo.cache("dojox.av.widget","resources/PlayButton.html"),
+ //
+ postCreate: function(){
+ // summary:
+ // Intialize button.
+ this.showPlay();
+ },
+
+ setMedia: function(/* Object */med){
+ // summary:
+ // A common method to set the media in all Player widgets.
+ // May do connections and initializations.
+ //
+ this.media = med;
+ dojo.connect(this.media, "onEnd", this, "showPlay");
+ dojo.connect(this.media, "onStart", this, "showPause");
+ },
+
+ onClick: function(){
+ // summary:
+ // Fired on play or pause click.
+ //
+ if(this._mode=="play"){
+ this.onPlay();
+ }else{
+ this.onPause();
+ }
+ },
+
+ onPlay: function(){
+ // summary:
+ // Fired on play click.
+ //
+ if(this.media){
+ this.media.play();
+ }
+ this.showPause();
+ },
+ onPause: function(){
+ // summary:
+ // Fired on pause click.
+ //
+ if(this.media){
+ this.media.pause();
+ }
+ this.showPlay();
+ },
+ showPlay: function(){
+ // summary:
+ // Toggles the pause button invisible and the play
+ // button visible..
+ //
+ this._mode = "play";
+ dojo.removeClass(this.domNode, "Pause");
+ dojo.addClass(this.domNode, "Play");
+ },
+ showPause: function(){
+ // summary:
+ // Toggles the play button invisible and the pause
+ // button visible.
+ //
+ this._mode = "pause";
+ dojo.addClass(this.domNode, "Pause");
+ dojo.removeClass(this.domNode, "Play");
+ }
+});
+return dojox.av.widget.PlayButton;
+});
diff --git a/js/dojo-1.7.2/dojox/av/widget/Player.js b/js/dojo-1.7.2/dojox/av/widget/Player.js
new file mode 100644
index 0000000..a45bd8e
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/Player.js
@@ -0,0 +1,128 @@
+//>>built
+define("dojox/av/widget/Player", ['dojo', 'dijit', 'dijit/_Widget', 'dijit/_TemplatedMixin'],function(dojo, dijit){
+
+dojo.experimental("dojox.av.widget.Player");
+dojo.declare("dojox.av.widget.Player", [dijit._Widget, dijit._TemplatedMixin], {
+ // summary:
+ // A Media Player UI widget for all types of dojox.av and AIR media.
+ //
+ // description:
+ // Currently for markup only. All controls should reside as child
+ // nodes within the Player node. 'controlType' is used to determine
+ // the placement of the control. If no type or an unrecoginized type
+ // is used, it will be left-aligned in the same row as the volume.
+ // Note:
+ // Be sure to use 'controlType' as a node attribute. It is not a
+ // property of the widget.
+ //
+ // example:
+ // | <div dojoType="dojox.av.widget.Player" playerWidth="100%">
+ // | <div controlType="video" initialVolume=".1"
+ // | mediaUrl="video/Grog.flv" autoPlay="true"
+ // | isDebug="false" dojoType="dojox.av.FLVideo"></div>
+ // | <div controlType="play" dojoType="dojox.av.widget.PlayButton"></div>
+ // | <div controlType="volume" dojoType="dojox.av.widget.VolumeButton"></div>
+ // | <div controlType="progress" dojoType="dojox.av.widget.ProgressSlider"></div>
+ // | <div controlType="status" dojoType="dojox.av.widget.Status"></div>
+ // | </div>
+ //
+ // playerWidth: /* Number or String */
+ // Sets the width of the player (not the video size)
+ // Number will be converted to pixels
+ // String will be used literally. EX: "320px" or "100%"
+ playerWidth: "480px",
+ //
+ // TODO:
+ //playerHeight
+ //videoWidth: 320,
+ //videoHeight: 240,
+
+ widgetsInTemplate:true,
+ templateString: dojo.cache("dojox.av.widget","resources/Player.html"),
+
+ _fillContent: function(){
+ // summary
+ // Finding and collecting child nodes
+ if(!this.items && this.srcNodeRef){
+ this.items = [];
+ var nodes = dojo.query("*", this.srcNodeRef);
+ dojo.forEach(nodes, function(n){
+ this.items.push(n);
+ }, this);
+ }
+ },
+
+ postCreate: function(){
+ // summary:
+ // Do player styling, and place child widgets in the proper location.
+ //
+ dojo.style(this.domNode, "width", this.playerWidth+(dojo.isString(this.playerWidth)?"":"px"));
+
+ if(dojo.isString(this.playerWidth) && this.playerWidth.indexOf("%")){
+ dojo.connect(window, "resize", this, "onResize");
+ }
+ this.children = [];
+ var domNode;
+ dojo.forEach(this.items, function(n, i){
+ n.id = dijit.getUniqueId("player_control");
+ switch(dojo.attr(n, "controlType")){
+ case "play":
+ this.playContainer.appendChild(n); break;
+ case "volume" :
+ this.controlsBottom.appendChild(n); break;
+ case "status" :
+ this.statusContainer.appendChild(n); break;
+ case "progress":
+ case "slider":
+ this.progressContainer.appendChild(n); break;
+ case "video":
+ this.mediaNode = n;
+ this.playerScreen.appendChild(n); break;
+ default:
+
+ }
+ this.items[i] = n.id;
+ }, this);
+
+ },
+ startup: function(){
+ // summary:
+ // Fired when all children are ready. Set the media in
+ // all children with setMedia()
+ //
+ this.media = dijit.byId(this.mediaNode.id);
+ if(!dojo.isAIR){
+ dojo.style(this.media.domNode, "width", "100%");
+ dojo.style(this.media.domNode, "height", "100%");
+ }
+ dojo.forEach(this.items, function(id){
+ if(id !== this.mediaNode.id){
+ var child = dijit.byId(id);
+ this.children.push(child);
+ if(child){
+ child.setMedia(this.media, this);
+ }
+ }
+ }, this);
+ },
+
+ onResize: function(evt){
+ // summary:
+ // If a player size is a percentage, this will fire an onResize
+ // event for all children, passing the size of the player.
+ //
+ var dim = dojo.marginBox(this.domNode);
+ if(this.media && this.media.onResize !== null){
+ this.media.onResize(dim);
+ }
+ dojo.forEach(this.children, function(child){
+ if(child.onResize){
+ child.onResize(dim);
+ }
+ });
+ }
+
+});
+
+return dojox.av.widget.Player;
+});
diff --git a/js/dojo-1.7.2/dojox/av/widget/ProgressSlider.js b/js/dojo-1.7.2/dojox/av/widget/ProgressSlider.js
new file mode 100644
index 0000000..9b9e7dd
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/ProgressSlider.js
@@ -0,0 +1,134 @@
+//>>built
+define("dojox/av/widget/ProgressSlider", ['dojo', 'dijit', 'dijit/_Widget', 'dijit/_TemplatedMixin'],function(dojo, dijit){
+
+dojo.declare("dojox.av.widget.ProgressSlider", [dijit._Widget, dijit._TemplatedMixin], {
+ // summary:
+ // A custom slider widget to use with dojox.av.widget.Player.
+ // description:
+ // Displays the current playhead position of the media. Has two
+ // progress bars: one for playhead position, and one for download
+ // progress.
+ //
+ templateString: dojo.cache("dojox.av.widget","resources/ProgressSlider.html"),
+ postCreate: function(){
+ // summary:
+ // Initialize slider.
+ //
+ this.seeking = false;
+ this.handleWidth = dojo.marginBox(this.handle).w;
+ var dim = dojo.coords(this.domNode);
+ this.finalWidth = dim.w
+ this.width = dim.w-this.handleWidth;
+ this.x = dim.x;
+
+ dojo.setSelectable(this.domNode, false);
+ dojo.setSelectable(this.handle, false);
+ },
+ setMedia: function(/* Object */med, playerWidget){
+ // summary:
+ // A common method to set the media in all Player widgets.
+ // May do connections and initializations.
+ //
+ this.playerWidget = playerWidget;
+ this.media = med;
+ dojo.connect(this.media, "onMetaData", this, function(data){
+ if(data && data.duration){
+ this.duration = data.duration;
+ }
+ });
+ dojo.connect(this.media, "onEnd", this, function(){
+ dojo.disconnect(this.posCon);
+ this.setHandle(this.duration);
+ });
+ dojo.connect(this.media, "onStart", this, function(){
+ this.posCon = dojo.connect(this.media, "onPosition", this, "setHandle");
+ });
+
+ dojo.connect(this.media, "onDownloaded", this, function(percent){
+ this.setLoadedPosition(percent*.01);
+ this.width = this.finalWidth * .01 * percent;
+ });
+
+ },
+ onDrag: function(/* HTMLEvent */ evt){
+ // summary:
+ // Fired when the mouse is moved. Sets the slider.
+ //
+ var x = evt.clientX - this.x;
+ if(x<0) x = 0;
+ if(x>this.width-this.handleWidth) x=this.width-this.handleWidth;
+
+ var p = x/this.finalWidth;
+ this.media.seek( this.duration * p );
+ dojo.style(this.handle, "marginLeft", x+"px");
+ dojo.style(this.progressPosition, "width", x+"px");
+ },
+ startDrag: function(){
+ // summary:
+ // Fired onmousedown of the slider handle.
+ //
+ dojo.setSelectable(this.playerWidget.domNode, false);
+ this.seeking = true;
+ this.cmove = dojo.connect(dojo.doc, "mousemove", this, "onDrag");
+ this.cup = dojo.connect(dojo.doc, "mouseup", this, "endDrag");
+ },
+ endDrag: function(){
+ // summary:
+ // Fired on document.onmouseup.
+ //
+ dojo.setSelectable(this.playerWidget.domNode, true);
+ this.seeking = false;
+ if(this.cmove) dojo.disconnect(this.cmove);
+ if(this.cup) dojo.disconnect(this.cup);
+ this.handleOut();
+ },
+
+ setHandle: function(time){
+ // summary:
+ // Sets the slider handle (when it is not being dragged)
+ //
+ if(!this.seeking){
+ var w = this.width-this.handleWidth;
+ var p = time/this.duration;
+ var x = p*w;
+
+ dojo.style(this.handle, "marginLeft", x+"px");
+ dojo.style(this.progressPosition, "width", x+"px");
+ }
+ },
+
+ setLoadedPosition: function(decimal){
+ // summary:
+ // Sets the download progress bar to the percentage of how much
+ // the media has been downloaded.
+ dojo.style(this.progressLoaded, "width", (this.finalWidth*decimal)+"px");
+ },
+
+ handleOver: function(){
+ // summary:
+ // Highlights the slider handle on mouseover, and
+ // stays highlighted during drag.
+ //
+ dojo.addClass(this.handle, "over");
+ },
+ handleOut: function(){
+ // summary:
+ // Unhighlights handle onmouseover, or on endDrag.
+ //
+ if(!this.seeking){
+ dojo.removeClass(this.handle, "over");
+ }
+ },
+ onResize: function(playerDimensions){
+ // summary:
+ // Handles player resize. Need to recalculate the width of
+ // position an download bars.
+ var dim = dojo.coords(this.domNode);
+ this.finalWidth = dim.w;
+
+ }
+
+});
+
+return dojox.av.widget.ProgressSlider;
+});
diff --git a/js/dojo-1.7.2/dojox/av/widget/Status.js b/js/dojo-1.7.2/dojox/av/widget/Status.js
new file mode 100644
index 0000000..3ea8c96
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/Status.js
@@ -0,0 +1,115 @@
+//>>built
+define("dojox/av/widget/Status", ['dojo', 'dijit', 'dijit/_Widget', 'dijit/_TemplatedMixin'],function(dojo, dijit){
+
+dojo.declare("dojox.av.widget.Status", [dijit._Widget, dijit._TemplatedMixin], {
+ // summary:
+ // A Status widget to use with dojox.av.widget.Player
+ //
+ // description:
+ // Displays the name of the media file, and it's current status
+ // (playing, paused, buffering, etc.) in the middle. Displays
+ // the playhead time on the left and the duration on the right.
+ //
+ templateString: dojo.cache("dojox.av.widget","resources/Status.html"),
+
+ setMedia: function(/* Object */med){
+ // summary:
+ // A common method to set the media in all Player widgets.
+ // May do connections and initializations.
+ //
+ this.media = med;
+ dojo.connect(this.media, "onMetaData", this, function(data){
+ this.duration = data.duration;
+ this.durNode.innerHTML = this.toSeconds(this.duration);
+ });
+ dojo.connect(this.media, "onPosition", this, function(time){
+ this.timeNode.innerHTML = this.toSeconds(time);
+ });
+
+ var cons = ["onMetaData", "onPosition", "onStart", "onBuffer", "onPlay", "onPaused", "onStop", "onEnd", "onError", "onLoad"];
+ dojo.forEach(cons, function(c){
+ dojo.connect(this.media, c, this, c);
+ }, this);
+
+ },
+ onMetaData: function(data){
+ this.duration = data.duration;
+ this.durNode.innerHTML = this.toSeconds(this.duration);
+ if(this.media.title){
+ this.title = this.media.title;
+ }else{
+ var a = this.media.mediaUrl.split("/");
+ var b = a[a.length-1].split(".")[0];
+ this.title = b;
+ }
+ },
+ onBuffer: function(isBuffering){
+ this.isBuffering = isBuffering;
+ console.warn("status onBuffer", this.isBuffering);
+ if(this.isBuffering){
+ this.setStatus("buffering...");
+ }else{
+ this.setStatus("Playing");
+ }
+ },
+ onPosition:function(time){
+ //console.log("onPosition:", time)
+ // this.timeNode.innerHTML = this.toSeconds(time);
+ },
+ onStart: function(){
+ this.setStatus("Starting");
+ },
+ onPlay: function(){
+ this.setStatus("Playing");
+ },
+ onPaused: function(){
+ this.setStatus("Paused");
+ },
+ onStop: function(){
+ this.setStatus("Stopped");
+ },
+ onEnd: function(){
+ this.setStatus("Stopped");
+ },
+ onError: function(evt){
+ console.log("status error:", evt)
+ var msg = evt.info.code;
+ if(msg == "NetStream.Play.StreamNotFound"){
+ msg = "Stream Not Found"
+ }
+ this.setStatus("ERROR: "+ msg, true);
+ },
+ onLoad: function(){
+ this.setStatus("Loading...");
+ },
+
+ setStatus: function(str, isError){
+ if(isError){
+ dojo.addClass(this.titleNode, "statusError");
+ }else{
+ dojo.removeClass(this.titleNode, "statusError");
+ if(this.isBuffering){
+ str = "buffering...";
+ }
+ }
+ //console.log(this.titleNode, "title:",this.title, "str:",str)
+ this.titleNode.innerHTML = '<span class="statusTitle">'+this.title+'</span> <span class="statusInfo">'+str+'</span>';
+ },
+
+ toSeconds: function(time){
+ var ts = time.toString()
+
+ if(ts.indexOf(".")<0){
+ ts += ".00"
+ }else if(ts.length - ts.indexOf(".")==2){
+ ts+="0"
+ }else if(ts.length - ts.indexOf(".")>2){
+ ts = ts.substring(0, ts.indexOf(".")+3)
+ }
+ return ts;
+ }
+
+});
+
+return dojox.av.widget.Status;
+});
diff --git a/js/dojo-1.7.2/dojox/av/widget/VolumeButton.js b/js/dojo-1.7.2/dojox/av/widget/VolumeButton.js
new file mode 100644
index 0000000..a6ee77c
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/VolumeButton.js
@@ -0,0 +1,187 @@
+//>>built
+define("dojox/av/widget/VolumeButton", ['dojo', 'dijit', 'dijit/_Widget', 'dijit/_TemplatedMixin', 'dijit/form/Button'],function(dojo, dijit){
+
+dojo.declare("dojox.av.widget.VolumeButton", [dijit._Widget, dijit._TemplatedMixin], {
+ // summary:
+ // A volume widget to use with dojox.av.widget.Player
+ //
+ // description:
+ // Controls and displays the volume of the media. This widget
+ // opens a slider on click that is used to adjust the volume.
+ // The icon changes according to the volume level.
+ //
+ templateString: dojo.cache("dojox.av.widget","resources/VolumeButton.html"),
+ //
+ postCreate: function(){
+ // summary:
+ // Initialize the widget.
+ //
+ this.handleWidth = dojo.marginBox(this.handle).w;
+ this.width = dojo.marginBox(this.volumeSlider).w;
+ this.slotWidth = 100;
+ dojo.setSelectable(this.handle, false);
+ this.volumeSlider = this.domNode.removeChild(this.volumeSlider);
+ },
+ setMedia: function(/* Object */med){
+ // summary:
+ // A common method to set the media in all Player widgets.
+ // May do connections and initializations.
+ //
+ this.media = med;
+ this.updateIcon();
+ },
+ updateIcon: function(/*Float*/ vol){
+ // summary:
+ // Changes the icon on the button according to volume level.
+ //
+ vol = (vol===undefined) ? this.media.volume() : vol;
+ if(vol===0){
+ dojo.attr(this.domNode, "class", "Volume mute");
+ }else if(vol<.334){
+ dojo.attr(this.domNode, "class", "Volume low");
+ }else if(vol<.667){
+ dojo.attr(this.domNode, "class", "Volume med");
+ }else{
+ dojo.attr(this.domNode, "class", "Volume high");
+ }
+ },
+
+ onShowVolume: function(/*DOMEvent*/evt){
+ // summary:
+ // Shows the volume slider.
+ //
+ if(this.showing==undefined){
+ dojo.body().appendChild(this.volumeSlider);
+ this.showing = false;
+ }
+ if(!this.showing){
+
+ var TOPMARG = 2;
+ var LEFTMARG = 7;
+ var vol = this.media.volume();
+ var dim = this._getVolumeDim();
+ var hand = this._getHandleDim();
+ this.x = dim.x - this.width;
+
+
+
+ dojo.style(this.volumeSlider, "display", "");
+ dojo.style(this.volumeSlider, "top", dim.y+"px");
+ dojo.style(this.volumeSlider, "left", (this.x)+"px");
+
+ var x = (this.slotWidth * vol);
+
+ dojo.style(this.handle, "top", (TOPMARG+(hand.w/2))+"px");
+ dojo.style(this.handle, "left", (x+LEFTMARG+(hand.h/2))+"px");
+
+ this.showing = true;
+ //this.startDrag();
+
+ this.clickOff = dojo.connect(dojo.doc, "onmousedown", this, "onDocClick");
+ }else{
+ this.onHideVolume();
+ }
+ },
+ onDocClick: function(/*DOMEvent*/evt){
+ // summary:
+ // Fired on document.onmousedown. Checks if clicked inside
+ // of this widget or not.
+ //
+ if(!dojo.isDescendant(evt.target, this.domNode) && !dojo.isDescendant(evt.target, this.volumeSlider)){
+ this.onHideVolume();
+ }
+ },
+
+ onHideVolume: function(){
+ // summary:
+ // Hides volume slider.
+ //
+ this.endDrag();
+ dojo.style(this.volumeSlider, "display", "none");
+ this.showing = false;
+ },
+
+ onDrag: function(/*DOMEvent*/evt){
+ // summary:
+ // Fired on mousemove. Updates volume and position of
+ // slider handle.
+ var beg = this.handleWidth/2;
+ var end = beg + this.slotWidth
+ var x = evt.clientX - this.x;
+ if(x<beg) x = beg;
+ if(x>end) x=end;
+ dojo.style(this.handle, "left", (x)+"px");
+
+ var p = (x-beg)/(end-beg);
+ this.media.volume(p);
+ this.updateIcon(p);
+ },
+ startDrag: function(){
+ // summary:
+ // Fired on mousedown of the slider handle.
+ //
+ this.isDragging = true;
+ this.cmove = dojo.connect(dojo.doc, "mousemove", this, "onDrag");
+ this.cup = dojo.connect(dojo.doc, "mouseup", this, "endDrag");
+ },
+ endDrag: function(){
+ // summary:
+ // Fired on mouseup of the slider handle.
+ //
+ this.isDragging = false;
+ if(this.cmove) dojo.disconnect(this.cmove);
+ if(this.cup) dojo.disconnect(this.cup);
+ this.handleOut();
+ },
+
+ handleOver: function(){
+ // summary:
+ // Highlights the slider handle on mouseover, and
+ // stays highlighted during drag.
+ //
+ dojo.addClass(this.handle, "over");
+ },
+ handleOut: function(){
+ // summary:
+ // Unhighlights handle onmouseover, or on endDrag.
+ //
+ if(!this.isDragging){
+ dojo.removeClass(this.handle, "over");
+ }
+ },
+
+ _getVolumeDim: function(){
+ // summary:
+ // Gets dimensions of slider background node.
+ // Only uses dojo.coords once, unless the page
+ // or player is resized.
+ //
+ if(this._domCoords){
+ return this._domCoords;
+ }
+ this._domCoords = dojo.coords(this.domNode);
+ return this._domCoords;
+ },
+ _getHandleDim: function(){
+ // summary:
+ // Gets dimensions of slider handle.
+ // Only uses dojo.marginBox once.
+ if(this._handleCoords){
+ return this._handleCoords;
+ }
+ this._handleCoords = dojo.marginBox(this.handle);
+ return this._handleCoords;
+ },
+
+ onResize: function(/*Object*/playerDimensions){
+ // summary:
+ // Fired on player resize. Zeros dimensions
+ // so that it can be calculated again.
+ //
+ this.onHideVolume();
+ this._domCoords = null;
+ }
+});
+
+return dojox.av.widget.VolumeButton;
+});
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/PlayButton.html b/js/dojo-1.7.2/dojox/av/widget/resources/PlayButton.html
new file mode 100644
index 0000000..cd7c127
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/PlayButton.html
@@ -0,0 +1,3 @@
+<div class="PlayPauseToggle Pause" dojoAttachEvent="click:onClick">
+ <div class="icon"></div>
+</div> \ No newline at end of file
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/Player.css b/js/dojo-1.7.2/dojox/av/widget/resources/Player.css
new file mode 100644
index 0000000..3029e68
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/Player.css
@@ -0,0 +1,203 @@
+.playerContainer{
+ width:480px;
+ background:#76C8C4;
+ text-align:center;
+}
+.PlayerScreen{
+ background:#00FFFF;
+ width:320px;
+ height:240px;
+ margin-left:auto;
+ margin-right:auto;
+}
+.Controls{
+ height:85px;
+ background:#333333;
+ text-align:left;
+ width:100%;
+}
+.ControlsRight{
+ vertical-align:top;
+}
+.ControlsBottom{
+ vertical-align:bottom;
+}
+.StatusContainer{
+ width:100%;
+ height:100%;
+}
+.PlayContainer{
+ width:60px;
+ height:60px;
+}
+
+
+.Progress{
+ height:10px;
+}
+
+.Time, .Duration, .Status{
+ height:16px;
+ margin-top:0px;
+ color:#F5FFC8;
+ width:100%;
+}
+
+.Time{
+ padding-left:2px;
+}
+
+.Duration{
+ padding-right:2px;
+ text-align:right;
+}
+.StatusContainer{
+ padding:0;
+ border-collapse:collapse;
+}
+.Status{
+ height:20px;
+ background:#ff0000;
+ table-layout:fixed;
+}
+.Status.statusError .statusTitle, .Status.statusError .statusInfo{
+ color:#FF0000;
+}
+.Status .statusTitle{
+ font-weight:bold;
+ color:#A5B3E9;
+}
+.Status .statusInfo{
+ font-weight:normal;
+ color:#3770D6;
+}
+
+.Time, .Duration, .Status{
+ font-family:Verdana, Arial, Helvetica, sans-serif;
+ font-size:9px;
+ background:#000000;
+}
+
+.Time, .Duration{
+ width:60px;
+}
+
+.Volume{
+ width:30px;
+ height:30px;
+ float:right;
+ margin-right:2px;
+ margin-top:auto;
+ background-image:url(images/player_sprite.png);
+ background-repeat:no-repeat;
+ background-position:-1px -62px;
+ cursor:pointer;
+}
+.Volume:hover{
+ background-position:-33px -62px;
+}
+.PlayPauseToggle{
+ width:60px;
+ height:60px;
+ background-image:url(images/player_sprite.png);
+ background-repeat:no-repeat;
+ background-position:-1px -1px;
+ cursor:pointer;
+ vertical-align:middle;
+ line-height:60px;
+}
+.PlayPauseToggle:hover{
+ background-position:-63px -1px;
+ cursor:pointer;
+}
+.icon{
+ background-image:url(images/dojoPlayerIcons.png);
+ background-repeat:no-repeat;
+ width:22px;
+ height:22px;
+}
+
+.PlayPauseToggle .icon{
+ position:relative;
+ top:19px;
+ left:19px;
+ background-position:-1px -1px;
+}
+.PlayPauseToggle.Play .icon{
+ background-position:-1px -1px;
+}
+.PlayPauseToggle.Pause .icon{
+ background-position:-24px -1px;
+}
+
+
+
+.Progress{
+
+}
+.Progress, .ProgressLoaded, .ProgressPosition, .ProgressHandle{
+ height:10px;
+}
+.ProgressLoaded, .ProgressPosition, .ProgressHandle{
+ position:absolute;
+}
+.ProgressLoaded{
+background:url(images/progressLoadedBk.png) repeat-x;
+}
+.ProgressHandle{
+ background-image:url(images/sliderHandleSprite.png);
+ background-position:0px 0px;
+ width:15px;
+ margin-left:0px;
+ cursor:pointer;
+}
+.ProgressHandle.over{
+ background-position:-15px 0px;
+}
+.ProgressPosition{
+ background:url(images/progressPositionBk.png) repeat-x;
+ width:0px;
+}
+.VolumeSlider{
+ position:absolute;
+}
+.VolumeSliderBack{
+ width:128px;
+ height:30px;
+ background-image:url(images/player_sprite.png);
+ background-repeat:no-repeat;
+ background-position:-1px -95px;
+}
+.VolumeSliderHandle{
+ position:absolute;
+ width:12px;
+ height:14px;
+ background-image:url(images/player_sprite.png);
+ background-repeat:no-repeat;
+ background-position:-1px -140px;
+ cursor:pointer;
+}
+.VolumeSliderHandle.over{
+ background-position:-15px -138px;
+ cursor:pointer;
+}
+.Volume .icon{
+ background-position:-60px -43px;
+ width:18px;
+ height:16px;
+ position:relative;
+ top:7px;
+ left:7px;
+}
+.Volume.mute .icon{
+ background-position:-1px -43px;
+}
+.Volume.low .icon{
+ background-position:-20px -43px;
+}
+.Volume.med .icon{
+ background-position:-40px -43px;
+}
+.Volume.high .icon{
+ background-position:-60px -43px;
+} \ No newline at end of file
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/Player.html b/js/dojo-1.7.2/dojox/av/widget/resources/Player.html
new file mode 100644
index 0000000..6d464df
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/Player.html
@@ -0,0 +1,20 @@
+<div class="playerContainer">
+ <div class="PlayerScreen" dojoAttachPoint="playerScreen"></div>
+ <table class="Controls">
+ <tr>
+ <td colspan="2" dojoAttachPoint="progressContainer"></td>
+ </tr>
+ <tr>
+ <td class="PlayContainer" dojoAttachPoint="playContainer"></td>
+ <td class="ControlsRight">
+ <table class="StatusContainer">
+ <tr dojoAttachPoint="statusContainer">
+ </tr>
+ <tr>
+ <td colspan="3" class="ControlsBottom" dojoAttachPoint="controlsBottom"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</div>
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/ProgressSlider.html b/js/dojo-1.7.2/dojox/av/widget/resources/ProgressSlider.html
new file mode 100644
index 0000000..2691e02
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/ProgressSlider.html
@@ -0,0 +1,6 @@
+<div class="Progress" dojoAttachEvent="mousedown:startDrag">
+
+ <div class="ProgressLoaded" dojoAttachPoint="progressLoaded"></div>
+ <div class="ProgressPosition" dojoAttachPoint="progressPosition"></div>
+ <div class="ProgressHandle" dojoAttachPoint="handle" dojoAttachEvent="mouseover:handleOver, mouseout:handleOut"></div>
+</div> \ No newline at end of file
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/Status.html b/js/dojo-1.7.2/dojox/av/widget/resources/Status.html
new file mode 100644
index 0000000..63e411b
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/Status.html
@@ -0,0 +1,7 @@
+<table class="Status">
+ <tr>
+ <td class="Time"><span dojoAttachPoint="timeNode">0.00</span></td>
+ <td class="Status"><div dojoAttachPoint="titleNode">Loading...</div></td>
+ <td class="Duration"><span dojoAttachPoint="durNode">0.00</span></td>
+ </tr>
+</table>
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/VolumeButton.html b/js/dojo-1.7.2/dojox/av/widget/resources/VolumeButton.html
new file mode 100644
index 0000000..f5d3eb9
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/VolumeButton.html
@@ -0,0 +1,7 @@
+<div class="Volume" dojoAttachEvent="mousedown:onShowVolume">
+ <div class="VolumeSlider" dojoAttachPoint="volumeSlider">
+ <div class="VolumeSliderBack" dojoAttachPoint="volumeSliderBack"></div>
+ <div class="VolumeSliderHandle" dojoAttachPoint="handle" dojoAttachEvent="mousedown:startDrag, mouseup:endDrag, mouseover:handleOver, mouseout:handleOut"></div>
+ </div>
+ <div class="icon"></div>
+</div> \ No newline at end of file
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/images/dojoPlayerIcons.png b/js/dojo-1.7.2/dojox/av/widget/resources/images/dojoPlayerIcons.png
new file mode 100644
index 0000000..ea3aaf9
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/images/dojoPlayerIcons.png
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/images/playerIcons b/js/dojo-1.7.2/dojox/av/widget/resources/images/playerIcons
new file mode 100644
index 0000000..0a0ff8c
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/images/playerIcons
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/images/player_sprite.png b/js/dojo-1.7.2/dojox/av/widget/resources/images/player_sprite.png
new file mode 100644
index 0000000..01f721c
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/images/player_sprite.png
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/images/progressLoadedBk.png b/js/dojo-1.7.2/dojox/av/widget/resources/images/progressLoadedBk.png
new file mode 100644
index 0000000..b3bca11
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/images/progressLoadedBk.png
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/images/progressPositionBk.png b/js/dojo-1.7.2/dojox/av/widget/resources/images/progressPositionBk.png
new file mode 100644
index 0000000..9cbae27
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/images/progressPositionBk.png
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleNorm.png b/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleNorm.png
new file mode 100644
index 0000000..fda2e9f
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleNorm.png
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleOver.png b/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleOver.png
new file mode 100644
index 0000000..b3bec9f
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleOver.png
Binary files differ
diff --git a/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleSprite.png b/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleSprite.png
new file mode 100644
index 0000000..fe639ff
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/av/widget/resources/images/sliderHandleSprite.png
Binary files differ