source: [view]
dojo.provide("dojox.av.FLAudio");
dojo.experimental("dojox.av.FLAudio");
dojo.require("dojox.embed.Flash");
dojo.require("dojox.timing.doLater");
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();