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
Instance properties inherited from AbstractPlayer
Instance methods
Instance methods inherited from AbstractPlayer
Event handlers

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.

_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.

_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.

_nc_rtmp

private _nc_rtmp:RTMPConnection
(read)

_nc_rtmpt

private _nc_rtmpt:RTMPConnection
(read)

_ns

private _ns:PlayerNetStream
(read)

_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.

addListener

function addListener (
aListener:Object) : Void

Specified by:

broadcastEvent

function broadcastEvent (
status:String) : Void

The listeners must implement the "handlePlayer"
function which takes the current status as a parameter.

bufferIsFull

function bufferIsFull (
) : Void

Specified by:

checkComplete

function checkComplete (
) : Void

close

function close (
) : Void

Close the player
Specified by:

connectRtmpt

function connectRtmpt (
) : Void

This is called if we are not getting a successful rtmp connection after 3 seconds
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.

getMediaBytesTotal

function getMediaBytesTotal (
) : Number

Returns:
  • The total number of bytes of the media.

getMediaUrl

function getMediaUrl (
) : String

Specified by:

getPlayheadTime

function getPlayheadTime (
) : Number

Returns:
  • The playhead position, measued in seconds since the start.

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:

getVolume

function getVolume (
) : Number

Specified by:

init

private function init (
)

Initialize the FLVPlayer.

isSizeChange

function isSizeChange (
) : Boolean

Specified by:

isSizeSet

function isSizeSet (
) : Boolean

Specified by:

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.
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.
Specified by:

playStopped

function playStopped (
) : Void

Specified by:

removeAllListeners

function removeAllListeners (
) : Void

resizeVideo

function resizeVideo (
) : Void

Specified by:

setMediaUrl

function setMediaUrl (
aUrl:String) : Void

Specified by:

setPlayheadTime

function setPlayheadTime (
position:Number) : Void

setSeeking

function setSeeking (
isSeeking:Boolean) : Void

Specified by:

setTotalTime

function setTotalTime (
aTime:Number) : Void

setVolume

function setVolume (
aVol:Number) : Void

Specified by:

startStream

private function startStream (
nc:NetConnection) : Void

This is called when successfully connected to the server, and play the
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.