Package | cv.media |
Class | public class AudioManager |
Inheritance | AudioManager ![]() |
Implements | IMediaManager |
See also
Property | Defined by | ||
---|---|---|---|
buffer : int
Gets or sets how long AudioManager should buffer the audio before playing, in seconds.
| AudioManager | ||
currentPercent : uint [read-only]
Gets the current play progress in terms of percent
| AudioManager | ||
isPause : Boolean [read-only]
If AudioManager is currently paused.
| AudioManager | ||
isPlaying : Boolean [read-only]
If AudioManager is currently playing.
| AudioManager | ||
loadCurrent : Number [read-only]
Gets the current load progress in terms of bytes
| AudioManager | ||
loadTotal : Number [read-only]
Gets the total size to be loaded in terms of bytes
| AudioManager | ||
metaData : Object [read-only]
Gets the metadata if available for the currently playing audio file
| AudioManager | ||
timeCurrent : Number [read-only]
Gets the elapsed play time in milliseconds
| AudioManager | ||
timeLeft : Number [read-only]
Gets the remaining play time in milliseconds
| AudioManager | ||
timeTotal : Number [read-only]
Gets the total play time in milliseconds
| AudioManager | ||
volume : Number
Gets or sets the current volume, from 0 - 1
| AudioManager |
Method | Defined by | ||
---|---|---|---|
AudioManager | |||
isValid(str:String):Boolean
Validates if the given filetype is compatible to be played with AudioManager.
| AudioManager | ||
load(s:String):void
Loads a new file to be played.
| AudioManager | ||
mute(b:Boolean = true):void
Controls the mute of the audio
| AudioManager | ||
pause(b:Boolean = true):void
Controls the pause of the audio
| AudioManager | ||
play(pos:int = 0):void
Plays the audio, starting at the given position.
| AudioManager | ||
seek(n:Number):void
Seeks to time given in the audio.
| AudioManager | ||
seekPercent(n:Number):void
Seeks to the given percent in the audio
| AudioManager | ||
stop(pos:int = 0):void
Stops the audio at the specified position.
| AudioManager | ||
unLoad():void
Stops the audio, closes the sound class, and resets the metadata.
| AudioManager |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched as ID3 metadata is receieved from an MP3 | AudioManager | |||
Dispatched when the media file has completed loading | AudioManager | |||
Dispatched as a media file is loaded | AudioManager | |||
Dispatched as a media file begins loading | AudioManager | |||
Dispatched after AudioManager has begun loading the next item, also at the end of an item playing | AudioManager | |||
Dispatched as a media file finishes playing | AudioManager | |||
Dispatched as a media file is playing | AudioManager | |||
Dispatched once as a media file first begins to play | AudioManager |
buffer | property |
buffer:int
[read-write]Gets or sets how long AudioManager should buffer the audio before playing, in seconds.
Implementation public function get buffer():int
public function set buffer(value:int):void
currentPercent | property |
currentPercent:uint
[read-only]Gets the current play progress in terms of percent
Implementation public function get currentPercent():uint
isPause | property |
isPause:Boolean
[read-only]If AudioManager is currently paused.
Implementation public function get isPause():Boolean
isPlaying | property |
isPlaying:Boolean
[read-only]If AudioManager is currently playing.
Implementation public function get isPlaying():Boolean
loadCurrent | property |
loadCurrent:Number
[read-only]Gets the current load progress in terms of bytes
Implementation public function get loadCurrent():Number
loadTotal | property |
loadTotal:Number
[read-only]Gets the total size to be loaded in terms of bytes
Implementation public function get loadTotal():Number
metaData | property |
metaData:Object
[read-only]Gets the metadata if available for the currently playing audio file
Implementation public function get metaData():Object
timeCurrent | property |
timeCurrent:Number
[read-only]Gets the elapsed play time in milliseconds
Implementation public function get timeCurrent():Number
timeLeft | property |
timeLeft:Number
[read-only]Gets the remaining play time in milliseconds
Implementation public function get timeLeft():Number
timeTotal | property |
timeTotal:Number
[read-only]Gets the total play time in milliseconds
Implementation public function get timeTotal():Number
volume | property |
volume:Number
[read-write]Gets or sets the current volume, from 0 - 1
Implementation public function get volume():Number
public function set volume(value:Number):void
AudioManager | () | constructor |
public function AudioManager()
isValid | () | method |
public function isValid(str:String):Boolean
Validates if the given filetype is compatible to be played with AudioManager. The only acceptable type is 'mp3'.
Parametersstr:String — The file extension to be validated
|
Boolean — Boolean of whether the extension was valid or not.
|
load | () | method |
public function load(s:String):void
Loads a new file to be played.
Parameterss:String — The url of the file to be loaded
|
See also
mute | () | method |
public function mute(b:Boolean = true):void
Controls the mute of the audio
Parametersb:Boolean (default = true ) — Whether to mute or not
|
pause | () | method |
public function pause(b:Boolean = true):void
Controls the pause of the audio
Parametersb:Boolean (default = true ) — Whether to pause or not
|
play | () | method |
public function play(pos:int = 0):void
Plays the audio, starting at the given position.
Parameterspos:int (default = 0 ) — Position to play from
|
seek | () | method |
public function seek(n:Number):void
Seeks to time given in the audio.
Parametersn:Number — Seconds into the audio to seek to
|
seekPercent | () | method |
public function seekPercent(n:Number):void
Seeks to the given percent in the audio
Parametersn:Number — Percent to seek to
|
stop | () | method |
public function stop(pos:int = 0):void
Stops the audio at the specified position. Sets the position given as the pause position.
Parameterspos:int (default = 0 ) — Position to stop at
|
unLoad | () | method |
public function unLoad():void
Stops the audio, closes the sound class, and resets the metadata.
audioMetadata | event |
cv.events.MetaDataEvent
cv.events.MetaDataEvent.AUDIO_METADATA
Dispatched as ID3 metadata is receieved from an MP3
Defines the value of the type
property of an audioMetadata
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is
no default behavior to cancel. |
data | The metadata object. |
currentTarget | The object that is actively processing the event object with an event listener. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
loadComplete | event |
loadProgress | event |
loadStart | event |
next | event |
flash.events.Event
Dispatched after AudioManager has begun loading the next item, also at the end of an item playing
playComplete | event |
playProgress | event |
cv.events.PlayProgressEvent
cv.events.PlayProgressEvent.PLAY_PROGRESS
Dispatched as a media file is playing
Defines the value of the type
property of an playProgress
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is
no default behavior to cancel. |
percent | The percentage of progress for the media playing. |
elapsed | The elapsed time of the media playing. |
remain | The remaining time of the media playing. |
total | The total time of the media playing. |
currentTarget | The object that is actively processing the event object with an event listener. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
playStart | event |