dojox/av/FLAudio (version 1.10)

Summary

Play MP3 files through the Flash SWF built in the DEFT project.

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()

Usage

var foo = new FLAudio(options);
dojox/av/FLAudio
Parameter Type Description
options Object

See the dojox/av/FLAudio reference documentation for more information.

Examples

Example 1

new dojox.av.FLAudio({
    initialVolume:.7,
    initialPan:0,
    autoPlay:false
});

Property Summary

  • _swfPathThe path to the video player SWF resource
  • allowNetworkingWhether SWF is restricted to a domain
  • allowScriptAccessWhether the SWF can access the container JS
  • idThe id of this widget and the id of the SWF movie.
  • initialPanFrom -1 to 1 (-1 is left, 1 is right, 0 is middle) Sets pan for all files unless changed with play or setPan
  • initialVolumeFrom 0-1 Sets volume for all files unless changed with doPlay or setVolume
  • isDebugSetting to true tells the SWF to output log messages to Firebug.
  • statusIntervalHow often in milliseconds that the status of the player is checked - both load and play

Method Summary

  • _normalizeUrl(_url) Checks that path is relative to HTML file or converts it to an absolute path.
  • _normalizeVolume(vol) Ensures volume is less than one
  • _sub(topic,method) helper for subscribing to topics
  • destroy() destroys flash
  • doPlay(options) Tell media to play, based on the options passed.
  • getPan(options) Set media pan, based on identifier in the options passed.
  • getPosition(options) Get the current time.
  • getVolume(options) Get media volume, based on identifier in the options passed.
  • init() Initialize the media.
  • load(options) Adds a media object to the playlist *This can be called repeatedly to add multiple items.
  • pause(options) Tell media to pause, based on identifier in the options passed.
  • setPan(options) Set media pan, based on identifier in the options passed.
  • setVolume(options) Set media volume, based on identifier in the options passed.
  • stop(options) Tell media to stop, based on identifier in the options passed.

Event Summary

Properties

_swfPath
Defined by: dojox/av/FLAudio

The path to the video player SWF resource

allowNetworking
Defined by: dojox/av/FLAudio

Whether SWF is restricted to a domain

allowScriptAccess
Defined by: dojox/av/FLAudio

Whether the SWF can access the container JS

id
Defined by: dojox/av/FLAudio

The id of this widget and the id of the SWF movie.

initialPan
Defined by: dojox/av/FLAudio

From -1 to 1 (-1 is left, 1 is right, 0 is middle) Sets pan for all files unless changed with play or setPan

initialVolume
Defined by: dojox/av/FLAudio

From 0-1 Sets volume for all files unless changed with doPlay or setVolume

isDebug
Defined by: dojox/av/FLAudio

Setting to true tells the SWF to output log messages to Firebug.

statusInterval
Defined by: dojox/av/FLAudio

How often in milliseconds that the status of the player is checked - both load and play

Methods

_normalizeUrl(_url)
Defined by dojox/av/FLAudio

Checks that path is relative to HTML file or converts it to an absolute path.

Parameter Type Description
_url undefined
Returns:string
_normalizeVolume(vol)
Defined by dojox/av/FLAudio

Ensures volume is less than one

Parameter Type Description
vol number
Returns:number
_sub(topic,method)
Defined by dojox/av/FLAudio

helper for subscribing to topics

Parameter Type Description
topic undefined
method undefined
destroy()
Defined by dojox/av/FLAudio

destroys flash

doPlay(options)
Defined by dojox/av/FLAudio

Tell media to play, based on the options passed.

Parameter Type Description
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 identify 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.
getPan(options)
Defined by dojox/av/FLAudio

Set media pan, based on identifier in the options passed.

Parameter Type Description
options Object

index:Number OR id:String OR url:String. See doPlay().

Returns:undefined
getPosition(options)
Defined by dojox/av/FLAudio

Get the current time.

Parameter Type Description
options Object

index:Number OR id:String OR url:String. See doPlay().

Returns:undefined
getVolume(options)
Defined by dojox/av/FLAudio

Get media volume, based on identifier in the options passed.

Parameter Type Description
options Object

index:Number OR id:String OR url:String. See doPlay().

Returns:undefined
init()
Defined by dojox/av/FLAudio

Initialize the media.

load(options)
Defined by dojox/av/FLAudio

Adds a media object to the playlist *This can be called repeatedly to add multiple items.

Parameter Type Description
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:any | boolean | undefined

The normalized url, which can be used to identify the audio.

pause(options)
Defined by dojox/av/FLAudio

Tell media to pause, based on identifier in the options passed.

Parameter Type Description
options Object

index:Number OR id:String OR url:String. See doPlay().

setPan(options)
Defined by dojox/av/FLAudio

Set media pan, based on identifier in the options passed.

Parameter Type Description
options Object
  • pan:Number (from -1 to 1)
  • index:Number OR id:String OR url:String (see doPlay())
setVolume(options)
Defined by dojox/av/FLAudio

Set media volume, based on identifier in the options passed.

Parameter Type Description
options Object

volume: Number 0 to 1 index:Number OR id:String OR url:String. See doPlay().

stop(options)
Defined by dojox/av/FLAudio

Tell media to stop, based on identifier in the options passed.

Parameter Type Description
options Object

index:Number OR id:String OR url:String. See doPlay().

Events

onAllLoaded()
Defined by: dojox/av/FLAudio

stub fired

Examples

Example 1

new dojox.av.FLAudio({
    initialVolume:.7,
    initialPan:0,
    autoPlay:false
});
onComplete(events)
Defined by: dojox/av/FLAudio

Fired at the end of a media file.

Parameter Type Description
events Array

Examples

Example 1

new dojox.av.FLAudio({
    initialVolume:.7,
    initialPan:0,
    autoPlay:false
});
onError(msg)
Defined by: dojox/av/FLAudio

stub fired when an error occurs

Parameter Type Description
msg undefined

Examples

Example 1

new dojox.av.FLAudio({
    initialVolume:.7,
    initialPan:0,
    autoPlay:false
});
onID3(evt)
Defined by: dojox/av/FLAudio

Fired when the ID3 data is received.

Parameter Type Description
evt undefined

Examples

Example 1

new dojox.av.FLAudio({
    initialVolume:.7,
    initialPan:0,
    autoPlay:false
});
onLoad()
Defined by: dojox/av/FLAudio

stub fired when SWF is ready

Examples

Example 1

new dojox.av.FLAudio({
    initialVolume:.7,
    initialPan:0,
    autoPlay:false
});
onLoadStatus(events)
Defined by: dojox/av/FLAudio
Parameter Type Description
events Array

Examples

Example 1

new dojox.av.FLAudio({
    initialVolume:.7,
    initialPan:0,
    autoPlay:false
});
onPlayStatus(events)
Defined by: dojox/av/FLAudio
Parameter Type Description
events Array

Examples

Example 1

new dojox.av.FLAudio({
    initialVolume:.7,
    initialPan:0,
    autoPlay:false
});
Error in the documentation? Can’t find what you are looking for? Let us know!