Package | cv |
Class | public class TempoLite |
Inheritance | TempoLite ![]() |
Implements | IMediaPlayer |
import cv.TempoLite; import cv.media.SoundPlayer; import cv.media.NetStreamPlayer; import cv.media.RTMPPlayer; import cv.media.ImagePlayer; import flash.events.Event; import cv.events.LoadEvent; import cv.events.PlayProgressEvent; import cv.events.MetaDataEvent; import cv.formats. var tempo:TempoLite = new TempoLite(null, [ASX, ATOM, B4S, M3U, PLS, XSPF]); tempo.debug = true; var nsP:NetStreamPlayer = new NetStreamPlayer(); nsP.video = vidScreen; tempo.addPlayer(nsP); nsP.debug = true; var sndP:SoundPlayer = new SoundPlayer(); sndP.debug = true; tempo.addPlayer(sndP); var imgP:ImagePlayer = new ImagePlayer(); this.addChildAt(imgP, 0); imgP.debug = true; tempo.addPlayer(imgP); var rtP:RTMPPlayer = new RTMPPlayer(); rtP.streamHost = "rtmp://cp34534.edgefcs.net/ondemand"; //rtP.video = vidScreen; //rtP.debug = true; //tempo.addPlayer(rtP); //tempo.load("images/2_1600.jpg"); //tempo.load({url:"34548/PodcastIntro", extOverride:"flv"}); //tempo.load("music/01 Sunrise Projector.mp3"); //tempo.loadPlayList("playlists/xspf_example.xml"); //tempo.loadPlayList("playlists/pls_example.pls"); //tempo.loadPlayList("playlists/m3u_example.m3u"); //tempo.loadPlayList("playlists/b4s_example.b4s"); //tempo.loadPlayList("playlists/asx_example.xml"); tempo.loadPlayList("playlists/atom_example.xml");
Property | Defined by | ||
---|---|---|---|
autoStart : Boolean
Whether a video will play immediately when a playlist is loaded.
| TempoLite | ||
autoStartIndex : int
If autoStart is true, the index of the item in the playlist to play first.
| TempoLite | ||
currentIndex : uint [read-only]
Retrieve the current index in the playlist.
| TempoLite | ||
currentItem : Object [read-only]
Retrieve the current item playing.
| TempoLite | ||
currentPercent : uint [read-only]
Retrieve the current play progress as a percent.
| TempoLite | ||
debug : Boolean = false
Enables/Disables debug traces
| TempoLite | ||
length : uint [read-only]
Retrieves the number of items in the playlist.
| TempoLite | ||
list : PlayList
[read-only]
Retrieve the current playlist in
PlayList format (enhanced array). | TempoLite | ||
loadCurrent : uint [read-only]
Retrieve the current bytes loaded of the current item.
| TempoLite | ||
loadTotal : uint [read-only]
Retrieve the total bytes to load of the current item.
| TempoLite | ||
metaData : Object [read-only]
Retrieve the metadata from the current item playing if available.
| TempoLite | ||
paused : Boolean [read-only]
If TempoLite is currently paused.
| TempoLite | ||
repeat : String
Sets whether repeat is enabled, or which type of repeat is enabled.
| TempoLite | ||
shuffle : Boolean
Whether to shuffle the playlist or not.
| TempoLite | ||
status : String [read-only]
Current status of media
| TempoLite | ||
timeCurrent : Number [read-only]
Retrieve the current play time of the current item playing.
| TempoLite | ||
timeLeft : Number [read-only]
Retrieve the play time remaining of the current item playing.
| TempoLite | ||
timeTotal : Number [read-only]
Retrieve the total play time of the current item playing.
| TempoLite | ||
volume : Number
A number from 0 to 1 determines volume.
| TempoLite |
Property | Defined by | ||
---|---|---|---|
_autoStart : Boolean = true | TempoLite | ||
_autoStartIndex : int = 0 | TempoLite | ||
_cM : IMediaPlayer | TempoLite | ||
_ext : String | TempoLite | ||
_list : PlayList | TempoLite | ||
_listShuffled : PlayList | TempoLite | ||
_parsers : Array | TempoLite | ||
_pause : Boolean = false | TempoLite | ||
_players : Array | TempoLite | ||
_repeat : Boolean = false | TempoLite | ||
_repeatAll : Boolean = false | TempoLite | ||
_shuffle : Boolean = false | TempoLite | ||
strRepeat : String | TempoLite | ||
_volume : Number = 0.5 | TempoLite |
Method | Defined by | ||
---|---|---|---|
TempoLite(players:Array = null, formats:Array = null)
Constructor.
| TempoLite | ||
addItem(item:*, index:int = -1):uint
Add an item to the playlist at the end, or at index specified.
| TempoLite | ||
addPlayer(player:IMediaPlayer):uint
Adds a player for use by TempoLite.
| TempoLite | ||
clearItems():void
Clears the current playlist.
| TempoLite | ||
isValid(ext:String, url:String):Boolean
| TempoLite | ||
load(item:*):void
Create a playlist of a single item and load the item.
| TempoLite | ||
loadPlayList(url:String):void
Loads a new playlist and clears any previous playlsit.
| TempoLite | ||
next():void
Plays the next item in the playlist.
| TempoLite | ||
pause(b:Boolean = true):void
Pauses the current playback.
| TempoLite | ||
play(pos:int = 0):void
Plays starting at the given position.
| TempoLite | ||
playItem(index:uint = 0):void
Plays the current item in the playlist, or at the
specified index in the playlist.
| TempoLite | ||
previous():void
Plays the previous item in the playlist.
| TempoLite | ||
removeItem(index:int = -1):void
Remove an item from the playlist from the end, or at index specified.
| TempoLite | ||
removePlayer(player:IMediaPlayer):void
Remove a player from TempoLite.
| TempoLite | ||
seek(time:*):void
Seek to a specific time (in seconds) in the current item playing.
| TempoLite | ||
seekPercent(percent:Number):void
Seek to a specific percent (0 - 1) in the current item playing.
| TempoLite | ||
stop():void
Stops the audio at the specified position.
| TempoLite | ||
stringToTime(text:String):int
[static]
Converts a time in 00:00:000 format and converts it back into a number.
| TempoLite | ||
timeToString(n:int):String
[static]
Converts milliseconds to a 00:00:000 format.
| TempoLite | ||
unload():void
Unloads the current item playing.
| TempoLite | ||
updateItem(index:uint, key:String, value:*):void
Updates a property of an Item in the playlist.
| TempoLite |
Method | Defined by | ||
---|---|---|---|
callPlayersMethod(methodName:String, methodValue:* = null):void
| TempoLite | ||
eventHandler(e:Event):void
| TempoLite | ||
getItemObject(item:*):Object
| TempoLite | ||
TempoLite | |||
loadedHandler(e:Event):void
| TempoLite | ||
loadItem(o:Object):void
| TempoLite | ||
metaDataHandler(e:MetaDataEvent):void
| TempoLite | ||
onNewPlaylist():void
| TempoLite | ||
playlistHandler(e:Event):void
| TempoLite | ||
setPlayersProp(propName:String, propValue:*):void
| TempoLite | ||
TempoLite | |||
trace2(... args):void
| TempoLite | ||
updateList():void
| TempoLite | ||
zero(n:int, isMS:Boolean = false):String
[static]
| TempoLite |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched from the PlayList when a change has occured | TempoLite | |||
Dispatched everytime a cue point is encountered | TempoLite | |||
Dispatched as a media file has completed loading | TempoLite | |||
Dispatched as a media file is loaded | TempoLite | |||
Dispatched as a media file begins loading | TempoLite | |||
Dispatched as metadata is receieved from a player | TempoLite | |||
Dispatched after Tempo has begun loading the next item, also at the end of an item playing | TempoLite | |||
Dispatched as a media file finishes playing | TempoLite | |||
Dispatched as a media file is playing | TempoLite | |||
Dispatched once as a media file first begins to play | TempoLite | |||
Dispatched after Tempo has begun loading the previous item | TempoLite | |||
Dispatched from the PlayListManager when ever an item is removed, or updated, or the entire list is updated | TempoLite | |||
Dispatched whenever the isPlaying, isReadyToPlay or isPause properties have changed. | TempoLite |
Constant | Defined by | ||
---|---|---|---|
NEW_PLAYLIST : String = "newPlaylist" [static]
| TempoLite | ||
NEXT : String = "next" [static]
| TempoLite | ||
PREVIOUS : String = "prev" [static]
| TempoLite | ||
REFRESH_PLAYLIST : String = "refreshPlaylist" [static]
| TempoLite | ||
REPEAT_ALL : String = "all" [static]
| TempoLite | ||
REPEAT_NONE : String = "none" [static]
| TempoLite | ||
REPEAT_TRACK : String = "track" [static]
| TempoLite | ||
VERSION : String = "3.0.2" [static]
The current version of TempoLite in use.
| TempoLite |
_autoStart | property |
protected var _autoStart:Boolean = true
autoStart | property |
autoStart:Boolean
[read-write]Whether a video will play immediately when a playlist is loaded.
Implementation public function get autoStart():Boolean
public function set autoStart(value:Boolean):void
_autoStartIndex | property |
protected var _autoStartIndex:int = 0
autoStartIndex | property |
autoStartIndex:int
[read-write]If autoStart is true, the index of the item in the playlist to play first.
Implementation public function get autoStartIndex():int
public function set autoStartIndex(value:int):void
_cM | property |
protected var _cM:IMediaPlayer
currentIndex | property |
currentIndex:uint
[read-only]Retrieve the current index in the playlist.
Implementation public function get currentIndex():uint
currentItem | property |
currentItem:Object
[read-only]Retrieve the current item playing.
Implementation public function get currentItem():Object
currentPercent | property |
currentPercent:uint
[read-only]Retrieve the current play progress as a percent.
Implementation public function get currentPercent():uint
debug | property |
public var debug:Boolean = false
Enables/Disables debug traces
_ext | property |
protected var _ext:String
length | property |
length:uint
[read-only]Retrieves the number of items in the playlist.
Implementation public function get length():uint
_list | property |
protected var _list:PlayList
list | property |
list:PlayList
[read-only]
Retrieve the current playlist in PlayList
format (enhanced array).
public function get list():PlayList
_listShuffled | property |
protected var _listShuffled:PlayList
loadCurrent | property |
loadCurrent:uint
[read-only]Retrieve the current bytes loaded of the current item.
Implementation public function get loadCurrent():uint
loadTotal | property |
loadTotal:uint
[read-only]Retrieve the total bytes to load of the current item.
Implementation public function get loadTotal():uint
metaData | property |
metaData:Object
[read-only]Retrieve the metadata from the current item playing if available.
Implementation public function get metaData():Object
_parsers | property |
protected var _parsers:Array
_pause | property |
protected var _pause:Boolean = false
paused | property |
paused:Boolean
[read-only]If TempoLite is currently paused.
Implementation public function get paused():Boolean
_players | property |
protected var _players:Array
_repeat | property |
protected var _repeat:Boolean = false
repeat | property |
repeat:String
[read-write]Sets whether repeat is enabled, or which type of repeat is enabled. Accepted values are:
The default value is TempoLite.REPEAT_NONE
.
public function get repeat():String
public function set repeat(value:String):void
_repeatAll | property |
protected var _repeatAll:Boolean = false
_shuffle | property |
protected var _shuffle:Boolean = false
shuffle | property |
shuffle:Boolean
[read-write]Whether to shuffle the playlist or not.
The default value is false
.
public function get shuffle():Boolean
public function set shuffle(value:Boolean):void
status | property |
status:String
[read-only]Current status of media
Implementation public function get status():String
strRepeat | property |
protected var strRepeat:String
timeCurrent | property |
timeCurrent:Number
[read-only]Retrieve the current play time of the current item playing.
Implementation public function get timeCurrent():Number
timeLeft | property |
timeLeft:Number
[read-only]Retrieve the play time remaining of the current item playing.
Implementation public function get timeLeft():Number
timeTotal | property |
timeTotal:Number
[read-only]Retrieve the total play time of the current item playing.
Implementation public function get timeTotal():Number
_volume | property |
protected var _volume:Number = 0.5
volume | property |
volume:Number
[read-write]A number from 0 to 1 determines volume.
The default value is 0.5
.
public function get volume():Number
public function set volume(value:Number):void
TempoLite | () | constructor |
public function TempoLite(players:Array = null, formats:Array = null)
Constructor. This creates a new TempoLite instance.
Parametersplayers:Array (default = null ) — An array of players to use with TempoLite
|
|
formats:Array (default = null )
|
addItem | () | method |
public function addItem(item:*, index:int = -1):uint
Add an item to the playlist at the end, or at index specified.
Parametersitem:* — item to be added.
|
|
index:int (default = -1 ) — where the item should be added in the playlist.
|
uint |
addPlayer | () | method |
public function addPlayer(player:IMediaPlayer):uint
Adds a player for use by TempoLite. Which can enable TempoLite to handle more types of media.
Parametersplayer:IMediaPlayer — The player to add
|
uint |
callPlayersMethod | () | method |
protected function callPlayersMethod(methodName:String, methodValue:* = null):void
Parameters
methodName:String |
|
methodValue:* (default = null )
|
clearItems | () | method |
public function clearItems():void
Clears the current playlist.
eventHandler | () | method |
protected function eventHandler(e:Event):void
Parameters
e:Event |
getItemObject | () | method |
protected function getItemObject(item:*):Object
Parameters
item:* |
Object |
getType | () | method |
isValid | () | method |
public function isValid(ext:String, url:String):Boolean
Parameters
ext:String |
|
url:String |
Boolean |
load | () | method |
public function load(item:*):void
Create a playlist of a single item and load the item.
Parametersitem:* — The url or the item object to be played.
|
loadedHandler | () | method |
protected function loadedHandler(e:Event):void
Parameters
e:Event |
loadItem | () | method |
protected function loadItem(o:Object):void
Parameters
o:Object |
loadPlayList | () | method |
public function loadPlayList(url:String):void
Loads a new playlist and clears any previous playlsit.
Parametersurl:String — The path to the playlist file.
|
metaDataHandler | () | method |
next | () | method |
public function next():void
Plays the next item in the playlist.
onNewPlaylist | () | method |
protected function onNewPlaylist():void
pause | () | method |
public function pause(b:Boolean = true):void
Pauses the current playback.
Parametersb:Boolean (default = true ) — Value to set pause to
|
play | () | method |
public function play(pos:int = 0):void
Plays starting at the given position.
Parameterspos:int (default = 0 ) — Position to play from
|
playItem | () | method |
public function playItem(index:uint = 0):void
Plays the current item in the playlist, or at the specified index in the playlist.
Parametersindex:uint (default = 0 ) — The index of the item to be played
|
playlistHandler | () | method |
protected function playlistHandler(e:Event):void
Parameters
e:Event |
previous | () | method |
removeItem | () | method |
public function removeItem(index:int = -1):void
Remove an item from the playlist from the end, or at index specified.
Parametersindex:int (default = -1 ) — The index of the item to be removed
|
See also
removePlayer | () | method |
public function removePlayer(player:IMediaPlayer):void
Remove a player from TempoLite.
Parametersplayer:IMediaPlayer — The player to be removed.
|
seek | () | method |
public function seek(time:*):void
Seek to a specific time (in seconds) in the current item playing. Pass a string of the time to seek relative to the current play time.
Parameterstime:* — Specific time to seek to, in seconds
|
seekPercent | () | method |
public function seekPercent(percent:Number):void
Seek to a specific percent (0 - 1) in the current item playing.
Parameterspercent:Number — Percentage to seek to
|
setPlayersProp | () | method |
protected function setPlayersProp(propName:String, propValue:*):void
Parameters
propName:String |
|
propValue:* |
shuffleList | () | method |
stop | () | method |
public function stop():void
Stops the audio at the specified position. Sets the position given as the pause position.
stringToTime | () | method |
public static function stringToTime(text:String):int
Converts a time in 00:00:000 format and converts it back into a number.
Parameterstext:String — The string to convert
|
int — The converted number
|
timeToString | () | method |
public static function timeToString(n:int):String
Converts milliseconds to a 00:00:000 format.
Parametersn:int — Milliseconds to convert
|
String — The converted string
|
trace2 | () | method |
protected function trace2(... args):void
Parameters
... args |
unload | () | method |
public function unload():void
Unloads the current item playing.
updateItem | () | method |
public function updateItem(index:uint, key:String, value:*):void
Updates a property of an Item in the playlist. This is used in situations where the metadata has been loaded, and the correct duration or title is updated for the playlist display. Dispatches the TempoLite.REFRESH_PLAYLIST event.
Parametersindex:uint — The index of the item to be updated
|
|
key:String — The property name (length, title, etc)
|
|
value:* — The value to update the prop to.
|
updateList | () | method |
protected function updateList():void
zero | () | method |
protected static function zero(n:int, isMS:Boolean = false):String
Parameters
n:int |
|
isMS:Boolean (default = false )
|
String |
change | event |
cuePoint | event |
loadComplete | event |
cv.events.LoadEvent
cv.events.LoadEvent.LOAD_COMPLETE
Dispatched as a 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 |
cv.events.LoadEvent
cv.events.LoadEvent.LOAD_START
Dispatched as a media file begins loading
Defines the value of the type
property of an
loadStart
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles |
false |
cancelable | false ; there is
no default behavior to cancel. |
time | The estimated duration of the media file. |
url | TThe url of the item being loaded. |
currentTarget | The object that is actively processing the event object with an event listener. |
index | The zero-based index in the DataProvider that contains the renderer. |
item | A reference to the data that belongs to the renderer. |
mediaType | The type of media being loaded, either "audio" or "video". |
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. |
metadata | event |
cv.events.MetaDataEvent
cv.events.MetaDataEvent.METADATA
Dispatched as metadata is receieved from a player
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. |
next | event |
flash.events.Event
Dispatched after Tempo 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 |
previous | event |
refreshPlaylist | event |
flash.events.Event
Dispatched from the PlayListManager when ever an item is removed, or updated, or the entire list is updated
status | event |
flash.events.Event
Dispatched whenever the isPlaying, isReadyToPlay or isPause properties have changed.
NEW_PLAYLIST | constant |
public static const NEW_PLAYLIST:String = "newPlaylist"
NEXT | constant |
public static const NEXT:String = "next"
PREVIOUS | constant |
public static const PREVIOUS:String = "prev"
REFRESH_PLAYLIST | constant |
public static const REFRESH_PLAYLIST:String = "refreshPlaylist"
REPEAT_ALL | constant |
public static const REPEAT_ALL:String = "all"
REPEAT_NONE | constant |
public static const REPEAT_NONE:String = "none"
REPEAT_TRACK | constant |
public static const REPEAT_TRACK:String = "track"
VERSION | constant |
public static const VERSION:String = "3.0.2"
The current version of TempoLite in use.