Package | cv.media |
Class | public class SoundPlayer |
Inheritance | SoundPlayer ![]() |
Implements | IMediaPlayer |
Property | Defined by | ||
---|---|---|---|
autoRewind : Boolean = false
Will automatically call stop (rewind) after playing complete.
| SoundPlayer | ||
autoStart : Boolean
Whether media will play automatically once loaded.
| SoundPlayer | ||
buffer : int
Gets or sets how long SoundPlayer should buffer the audio before
playing, in seconds.
| SoundPlayer | ||
currentPercent : uint [read-only]
Gets the current play progress in terms of percent
| SoundPlayer | ||
debug : Boolean = false
Enables/Disables debug traces
| SoundPlayer | ||
leftToLeft : Number
A value, from 0 (none) to 1 (all), specifying how much of the left
input is played in the left speaker.
| SoundPlayer | ||
leftToRight : Number
A value, from 0 (none) to 1 (all), specifying how much of the left
input is played in the right speaker.
| SoundPlayer | ||
loadCurrent : uint [read-only]
Gets the current load progress in terms of bytes
| SoundPlayer | ||
loadTotal : uint [read-only]
Gets the total size to be loaded in terms of bytes
| SoundPlayer | ||
metaData : Object [read-only]
Gets the metadata if available for the currently playing audio file
-MetaData
Flash Player 9 and later supports ID3 2.0 tags, specifically 2.3 and 2.4
-IDE 2.0 tag
COMM Sound.id3.comment
TABL Sound.id3.album
TCON Sound.id3.genre
TIT2 Sound.id3.songName
TPE1 Sound.id3.artist
TRCK Sound.id3.track
TYER Sound.id3.year
-ID3 Earlier
TFLT File type
TIME Time
TIT1 Content group description
TIT2 Title/song name/content description
TIT3 Subtitle/description refinement
TKEY Initial key
TLAN Languages
TLEN Length
TMED Media type
TOAL Original album/movie/show title
TOFN Original filename
TOLY Original lyricists/text writers
TOPE Original artists/performers
TORY Original release year
TOWN File owner/licensee
TPE1 Lead performers/soloists
TPE2 Band/orchestra/accompaniment
TPE3 Conductor/performer refinement
TPE4 Interpreted, remixed, or otherwise modified by
TPOS Part of a set
TPUB Publisher
TRCK Track number/position in set
TRDA Recording dates
TRSN Internet radio station name
TRSO Internet radio station owner
TSIZ Size
TSRC ISRC (international standard recording code)
TSSE Software/hardware and settings used for encoding
TYER Year
WXXX URL Link frame
| SoundPlayer | ||
pan : Number
The left-to-right panning of the sound, ranging from -1 (full pan
left) to 1 (full pan right).
| SoundPlayer | ||
paused : Boolean [read-only]
Returns the pause status of the player.
| SoundPlayer | ||
rightToLeft : Number
A value, from 0 (none) to 1 (all), specifying how much of the right
input is played in the left speaker.
| SoundPlayer | ||
rightToRight : Number
A value, from 0 (none) to 1 (all), specifying how much of the right
input is played in the right speaker.
| SoundPlayer | ||
status : String [read-only]
Returns the load status of the player.
| SoundPlayer | ||
timeCurrent : Number [read-only]
Gets the elapsed play time in milliseconds
| SoundPlayer | ||
timeLeft : Number [read-only]
Gets the remaining play time in milliseconds
| SoundPlayer | ||
timeTotal : Number [read-only]
Gets the total play time in milliseconds
| SoundPlayer | ||
volume : Number
Gets or sets the current volume, from 0 - 1
| SoundPlayer |
Property | Defined by | ||
---|---|---|---|
_autoStart : Boolean = true | SoundPlayer | ||
_buffer : int = 1 | SoundPlayer | ||
_isReadyToPlay : Boolean = false | SoundPlayer | ||
_leftToLeft : Number = 1 | SoundPlayer | ||
_leftToRight : Number = 0 | SoundPlayer | ||
_loadCurrent : uint | SoundPlayer | ||
_loadTotal : uint | SoundPlayer | ||
_metaData : Object | SoundPlayer | ||
_pan : Number = 0 | SoundPlayer | ||
_paused : Boolean = false | SoundPlayer | ||
pausePosition : int = 0 | SoundPlayer | ||
playTimer : Timer | SoundPlayer | ||
_rightToLeft : Number = 0 | SoundPlayer | ||
_rightToRight : Number = 1 | SoundPlayer | ||
sc : SoundChannel | SoundPlayer | ||
sendOnce : Boolean = false | SoundPlayer | ||
skipOnce : Boolean = false | SoundPlayer | ||
snd : Sound | SoundPlayer | ||
_status : String = "unloaded" | SoundPlayer | ||
strURL : String | SoundPlayer | ||
_volume : Number = .5 | SoundPlayer |
Method | Defined by | ||
---|---|---|---|
SoundPlayer | |||
isValid(ext:String, url:String):Boolean
Validates if the given filetype is compatible to be played with SoundPlayer.
| SoundPlayer | ||
load(item:*):void
Loads a new file to be played.
| SoundPlayer | ||
loadAsset(sound:Sound):void
Loads a sound from the library to be played.
| SoundPlayer | ||
pause(b:Boolean = true):void
Controls the pause of the audio
| SoundPlayer | ||
play(pos:int = 0):void
Plays the audio, starting at the given position.
| SoundPlayer | ||
seek(time:*):void
Seeks to time given in the audio.
| SoundPlayer | ||
seekPercent(n:Number):void
Seeks to the given percent in the audio
| SoundPlayer | ||
stop():void
Stops the audio at the specified position.
| SoundPlayer | ||
unload():void
Stops the audio, closes the sound class, and resets the metadata.
| SoundPlayer |
Method | Defined by | ||
---|---|---|---|
errorHandler(e:ErrorEvent):void
| SoundPlayer | ||
getEstimatedLength():int
| SoundPlayer | ||
progressHandler(e:ProgressEvent):void
| SoundPlayer | ||
setStatus(str:String):void
| SoundPlayer | ||
soundHandler(e:Event):void
| SoundPlayer | ||
trace2(... arguements):void
| SoundPlayer | ||
updateSoundTransform():void
| SoundPlayer |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when the media file has completed loading | SoundPlayer | |||
Dispatched as a media file is loaded | SoundPlayer | |||
Dispatched as a media file begins loading | SoundPlayer | |||
Dispatched as ID3 metadata is receieved from an MP3 | SoundPlayer | |||
Dispatched as a media file finishes playing | SoundPlayer | |||
Dispatched as a media file is playing | SoundPlayer | |||
Dispatched once as a media file first begins to play | SoundPlayer | |||
Dispatched when status has been updated. | SoundPlayer |
Constant | Defined by | ||
---|---|---|---|
VERSION : String = "3.0.3" [static]
The current version
| SoundPlayer |
autoRewind | property |
public var autoRewind:Boolean = false
Will automatically call stop (rewind) after playing complete. If disabled, this will pause the player instead.
_autoStart | property |
protected var _autoStart:Boolean = true
autoStart | property |
autoStart:Boolean
[read-write]Whether media will play automatically once loaded.
The default value is true
.
public function get autoStart():Boolean
public function set autoStart(value:Boolean):void
_buffer | property |
protected var _buffer:int = 1
buffer | property |
buffer:int
[read-write]Gets or sets how long SoundPlayer 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
debug | property |
public var debug:Boolean = false
Enables/Disables debug traces
_isReadyToPlay | property |
protected var _isReadyToPlay:Boolean = false
_leftToLeft | property |
protected var _leftToLeft:Number = 1
leftToLeft | property |
leftToLeft:Number
[read-write]A value, from 0 (none) to 1 (all), specifying how much of the left input is played in the left speaker.
Implementation public function get leftToLeft():Number
public function set leftToLeft(value:Number):void
_leftToRight | property |
protected var _leftToRight:Number = 0
leftToRight | property |
leftToRight:Number
[read-write]A value, from 0 (none) to 1 (all), specifying how much of the left input is played in the right speaker.
Implementation public function get leftToRight():Number
public function set leftToRight(value:Number):void
_loadCurrent | property |
protected var _loadCurrent:uint
loadCurrent | property |
loadCurrent:uint
[read-only]Gets the current load progress in terms of bytes
Implementation public function get loadCurrent():uint
_loadTotal | property |
protected var _loadTotal:uint
loadTotal | property |
loadTotal:uint
[read-only]Gets the total size to be loaded in terms of bytes
Implementation public function get loadTotal():uint
_metaData | property |
protected var _metaData:Object
metaData | property |
metaData:Object
[read-only]Gets the metadata if available for the currently playing audio file -MetaData Flash Player 9 and later supports ID3 2.0 tags, specifically 2.3 and 2.4 -IDE 2.0 tag COMM Sound.id3.comment TABL Sound.id3.album TCON Sound.id3.genre TIT2 Sound.id3.songName TPE1 Sound.id3.artist TRCK Sound.id3.track TYER Sound.id3.year -ID3 Earlier TFLT File type TIME Time TIT1 Content group description TIT2 Title/song name/content description TIT3 Subtitle/description refinement TKEY Initial key TLAN Languages TLEN Length TMED Media type TOAL Original album/movie/show title TOFN Original filename TOLY Original lyricists/text writers TOPE Original artists/performers TORY Original release year TOWN File owner/licensee TPE1 Lead performers/soloists TPE2 Band/orchestra/accompaniment TPE3 Conductor/performer refinement TPE4 Interpreted, remixed, or otherwise modified by TPOS Part of a set TPUB Publisher TRCK Track number/position in set TRDA Recording dates TRSN Internet radio station name TRSO Internet radio station owner TSIZ Size TSRC ISRC (international standard recording code) TSSE Software/hardware and settings used for encoding TYER Year WXXX URL Link frame
Implementation public function get metaData():Object
_pan | property |
protected var _pan:Number = 0
pan | property |
pan:Number
[read-write]The left-to-right panning of the sound, ranging from -1 (full pan left) to 1 (full pan right). A value of 0 represents no panning (balanced center between right and left).
Implementation public function get pan():Number
public function set pan(value:Number):void
_paused | property |
protected var _paused:Boolean = false
paused | property |
paused:Boolean
[read-only]Returns the pause status of the player.
Implementation public function get paused():Boolean
pausePosition | property |
protected var pausePosition:int = 0
playTimer | property |
protected var playTimer:Timer
_rightToLeft | property |
protected var _rightToLeft:Number = 0
rightToLeft | property |
rightToLeft:Number
[read-write]A value, from 0 (none) to 1 (all), specifying how much of the right input is played in the left speaker.
Implementation public function get rightToLeft():Number
public function set rightToLeft(value:Number):void
_rightToRight | property |
protected var _rightToRight:Number = 1
rightToRight | property |
rightToRight:Number
[read-write]A value, from 0 (none) to 1 (all), specifying how much of the right input is played in the right speaker.
Implementation public function get rightToRight():Number
public function set rightToRight(value:Number):void
sc | property |
protected var sc:SoundChannel
sendOnce | property |
protected var sendOnce:Boolean = false
skipOnce | property |
protected var skipOnce:Boolean = false
snd | property |
protected var snd:Sound
_status | property |
protected var _status:String = "unloaded"
status | property |
status:String
[read-only]Returns the load status of the player.
Implementation public function get status():String
strURL | property |
protected var strURL:String
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 |
protected var _volume:Number = .5
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
SoundPlayer | () | constructor |
public function SoundPlayer()
errorHandler | () | method |
protected function errorHandler(e:ErrorEvent):void
Parameters
e:ErrorEvent |
getEstimatedLength | () | method |
protected function getEstimatedLength():int
Returns
int |
isValid | () | method |
public function isValid(ext:String, url:String):Boolean
Validates if the given filetype is compatible to be played with SoundPlayer. The acceptable file types are :
ext:String — The file extension to be validated
|
|
url:String — The full file url if the extension is not enough
|
Boolean — Boolean of whether the extension was valid or not.
|
load | () | method |
public function load(item:*):void
Loads a new file to be played.
Parametersitem:* — The url of the file to be loaded
|
See also
loadAsset | () | method |
public function loadAsset(sound:Sound):void
Loads a sound from the library to be played. This cannot be used in conjunction with TempoLite since the location is not a url.
Parameterssound:Sound — The sound object from the library
|
See also
pause | () | method |
public function pause(b:Boolean = true):void
Controls the pause of the audio
Parametersb:Boolean (default = true ) — Whether to pause or not
|
See also
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
|
progressHandler | () | method |
protected function progressHandler(e:ProgressEvent):void
Parameters
e:ProgressEvent |
seek | () | method |
public function seek(time:*):void
Seeks to time given in the audio.
Parameterstime:* — Seconds into playback to seek to
|
See also
seekPercent | () | method |
public function seekPercent(n:Number):void
Seeks to the given percent in the audio
Parametersn:Number — Percent to seek to
|
See also
setStatus | () | method |
protected function setStatus(str:String):void
Parameters
str:String |
soundHandler | () | method |
protected function soundHandler(e:Event):void
Parameters
e:Event |
stop | () | method |
public function stop():void
Stops the audio at the specified position. Sets the position given as the pause position.
trace2 | () | method |
protected function trace2(... arguements):void
Parameters
... arguements |
unload | () | method |
public function unload():void
Stops the audio, closes the sound class, and resets the metadata.
See also
updateSoundTransform | () | method |
protected function updateSoundTransform():void
loadComplete | event |
cv.events.LoadEvent
cv.events.LoadEvent.LOAD_COMPLETE
Dispatched when the media file has completed loading
Defines the value of the type
property of an
loadComplete
event object.
loadProgress | event |
flash.events.ProgressEvent
cv.events.LoadEvent.LOAD_PROGRESS
Dispatched as a media file is loaded
Defines the value of the type
property of an
loadProgress
event object.
loadStart | event |
metadata | event |
cv.events.MetaDataEvent
cv.events.MetaDataEvent.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. |
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 |
status | event |
VERSION | constant |
public static const VERSION:String = "3.0.3"
The current version