RTMPPlayer
| Kind of class: | class |
|---|---|
| Inherits from: | AbstractPlayer |
| Implements: | |
| Classpath: | mx.controls.streamingmedia.RTMPPlayer |
| File last modified: | Tuesday, 18 December 2007, 15:44:38 |
RTMPPlayer.as
Summary
Constructor
- RTMPPlayer (aMediaUrl:String, aMediaType:String, aVideoHolder:MovieClip, aTotalTime:Number)
- Constructor.
Instance properties
- _videoHolder : MovieClip
- Holds the video.
- _video : Video
- Embedded video object used to display video
- _sound : Sound
- Controls the volume of the video
- _nc_rtmp : RTMPConnection
- _nc_rtmpt : RTMPConnection
- _ns : PlayerNetStream
- _mediaUrl : String
- _mediaType : String
- _protocol : String
- _port : String
- _appUrl : String
- _streamName : String
- _totalTime : Number
- The total time of the video
- _isLoaded : Boolean
- Has the flv been loaded yet?
- _isLoading : Boolean
- is flv loading?
- _listeners : Array
- Lightweight event broadcaster
- _momentaryPlayId : Number
- The interval id used to briefly play the media when the playhead is
- _checkCompleteId : Number
- The interval id used to check for the buffer size in NetStream.
- _connectTimeOutId : Number
- The interval id used to report connection error after timeout.
- _conn_Id : Number
- The interval id used to send an extra rtmpt request if the
- _statusCount : Number
- Counter for number of (bufferLength == .001) received
- _playHeadPos : Number
- local variable to keep track of the play head position
- _isSeeking : Boolean
- boolean that shows seeking status
- _isPausing : Boolean
- boolean that shows pause status
- _isPlayPending : Boolean
- is play pending?
- _videoHeight : Number
- _videoWidth : Number
Instance properties inherited from AbstractPlayer
Instance methods
- init
- addListener (aListener:Object) : Void
- removeAllListeners : Void
- broadcastEvent (status:String) : Void
- The listeners must implement the "handlePlayer"
- bufferIsFull : Void
- resizeVideo : Void
- toString : String
- close : Void
- Close the player
- load : Void
- Make connection to the server and load the media without playing it.
- startStream (nc:NetConnection) : Void
- This is called when successfully connected to the server, and play the
- actualConnect : Void
- Make the actual connection to the server, if the protocol is rtmp and no port
- connectRtmpt : Void
- This is called if we are not getting a successful rtmp connection after 3 seconds
- play (startingPoint:Number) : Void
- Play the media starting at the specified starting point.
- pause : Void
- Stop playback of the media without moving the playhead.
- stop : Void
- Stop playback of the media and reset the playhead to zero.
- getPlayheadTime : Number
- setPlayheadTime (position:Number) : Void
- doneUpdateFrame : Void
- Stop the playback.
- playStopped : Void
- checkComplete : Void
- getMediaUrl : String
- setMediaUrl (aUrl:String) : Void
- getVolume : Number
- setVolume (aVol:Number) : Void
- getMediaBytesLoaded : Number
- getMediaBytesTotal : Number
- getTotalTime : Number
- setTotalTime (aTime:Number) : Void
- mediaLoaded : Void
- Called when the media is completely loaded.
- logError (error:String) : Void
- Log error from FlashCom server
- isSizeSet : Boolean
- isSizeChange : Boolean
- setSeeking (isSeeking:Boolean) : Void
Instance methods inherited from AbstractPlayer
Event handlers
- onConnectTimeOut : Void
- This is called when connection timeout.
Constructor
RTMPPlayer
function RTMPPlayer (
aMediaUrl:String,
aMediaType:String,
aVideoHolder:MovieClip,
aTotalTime:Number)
Constructor.
Instance properties
_appUrl
private _appUrl:String
(read)
_checkCompleteId
private _checkCompleteId:Number
(read)
The interval id used to check for the buffer size in NetStream.
This is used to broadcast the "complete" status when stops.
This is used to broadcast the "complete" status when stops.
_conn_Id
private _conn_Id:Number
(read)
The interval id used to send an extra rtmpt request if the
url is rtmp with no port specified.
url is rtmp with no port specified.
_connectTimeOutId
private _connectTimeOutId:Number
(read)
The interval id used to report connection error after timeout.
_isLoaded
private _isLoaded:Boolean
(read)
Has the flv been loaded yet?
_isLoading
private _isLoading:Boolean
(read)
is flv loading?
_isPausing
private _isPausing:Boolean
(read)
boolean that shows pause status
_isPlayPending
private _isPlayPending:Boolean
(read)
is play pending?
_isSeeking
private _isSeeking:Boolean
(read)
boolean that shows seeking status
_listeners
private _listeners:Array
(read)
Lightweight event broadcaster
_mediaType
private _mediaType:String
(read)
_mediaUrl
private _mediaUrl:String
(read)
_momentaryPlayId
private _momentaryPlayId:Number
(read)
The interval id used to briefly play the media when the playhead is
moved when playback is paused.
moved when playback is paused.
_nc_rtmp
_nc_rtmpt
_ns
_playHeadPos
private _playHeadPos:Number
(read)
local variable to keep track of the play head position
_port
private _port:String
(read)
_protocol
private _protocol:String
(read)
_sound
private _sound:Sound
(read)
Controls the volume of the video
_statusCount
private _statusCount:Number
(read)
Counter for number of (bufferLength == .001) received
_streamName
private _streamName:String
(read)
_totalTime
private _totalTime:Number
(read)
The total time of the video
_video
_video:Video
(read)
Embedded video object used to display video
_videoHeight
private _videoHeight:Number
(read)
_videoHolder
_videoHolder:MovieClip
(read)
Holds the video. Also used to control volume
_videoWidth
private _videoWidth:Number
(read)
Instance methods
actualConnect
private function actualConnect (
) : Void
Make the actual connection to the server, if the protocol is rtmp and no port
is specified. We make an extra rtmpt connection to the server after 1.5 seconds.
And use the connection whenever which one makes the connection first.
is specified. We make an extra rtmpt connection to the server after 1.5 seconds.
And use the connection whenever which one makes the connection first.
broadcastEvent
function broadcastEvent (
status:String) : Void
The listeners must implement the "handlePlayer"
function which takes the current status as a parameter.
function which takes the current status as a parameter.
checkComplete
function checkComplete (
) : Void
connectRtmpt
function connectRtmpt (
) : Void
This is called if we are not getting a successful rtmp connection after 3 seconds
stream if play is pending
stream if play is pending
doneUpdateFrame
function doneUpdateFrame (
) : Void
Stop the playback.
getMediaBytesLoaded
function getMediaBytesLoaded (
) : Number
Returns:
- The number of bytes of the media that has loaded.
Specified by:
getMediaBytesTotal
function getMediaBytesTotal (
) : Number
Returns:
- The total number of bytes of the media.
Specified by:
getPlayheadTime
function getPlayheadTime (
) : Number
Returns:
- The playhead position, measued in seconds since the start.
Specified by:
getTotalTime
function getTotalTime (
) : Number
Returns:
- The total time of the media in seconds. It is a property
that is manually set by the author.
Specified by:
init
private function init (
)
Initialize the FLVPlayer.
load
function load (
) : Void
Make connection to the server and load the media without playing it.
Specified by:
logError
function logError (
error:String) : Void
Log error from FlashCom server
Specified by:
mediaLoaded
function mediaLoaded (
) : Void
Called when the media is completely loaded.
Specified by:
pause
function pause (
) : Void
Stop playback of the media without moving the playhead.
Specified by:
play
function play (
startingPoint:Number) : Void
Play the media starting at the specified starting point. If the media
hasn't yet been loaded, load it.
hasn't yet been loaded, load it.
Parameters:
startingPoint:
The number of seconds into the media to start at.
This is an optional parameter. If omitted, playing will occur
at the current playhead position.
This is an optional parameter. If omitted, playing will occur
at the current playhead position.
Specified by:
setPlayheadTime
function setPlayheadTime (
position:Number) : Void
Specified by:
setTotalTime
function setTotalTime (
aTime:Number) : Void
startStream
private function startStream (
nc:NetConnection) : Void
This is called when successfully connected to the server, and play the
stream if play is pending.
stream if play is pending.
stop
function stop (
) : Void
Stop playback of the media and reset the playhead to zero.
toString
function toString (
) : String
Returns:
- A string representation of this player.
Event handlers
onConnectTimeOut
function onConnectTimeOut (
) : Void
This is called when connection timeout.