NCManager

Kind of class:class
Inherits from:none
Implements:
Classpath:mx.video.NCManager
File last modified:Tuesday, 18 December 2007, 16:08:42

Creates NetConnection for VideoPlayer, a
helper class for that user facing class.

NCManager supports a subset of SMIL to handle multiple streams
for multiple bandwidths. NCManager assumes any URL that does not
begin with "rtmp://", does not end with ".flv" and does not
have any parameters is a SMIL url. See SMILParser for more on SMIL
support.

See also:
  • SMILParser

Summary


Constructor
Class properties
Instance properties
Class methods
Instance methods
Event handlers

Constructor

NCManager

function NCManager (
)

Class properties

shortVersion

static shortVersion:String = "1.0.2"
(read)

version

static version:String = "1.0.2.7"
(read)

Instance properties

_appName

private _appName:String
(read)

_autoSenseBW

private _autoSenseBW:Boolean
(read)

_bitrate

private _bitrate:Number
(read)

_connTypeCounter

private _connTypeCounter:Number
(read)

_contentPath

private _contentPath:String
(read)

_fpadMgr

private _fpadMgr:FPADManager
(read)

_isRTMP

private _isRTMP:Boolean
(read)

_nc

private _nc:NetConnection
(read)

_ncConnected

private _ncConnected:Boolean
(read)

_ncUri

private _ncUri:String
(read)

_owner

private _owner:VideoPlayer
(read)

_payload

_payload:Number
(read)

_portNumber

private _portNumber:String
(read)

_protocol

private _protocol:String
(read)

_serverName

private _serverName:String
(read)

_smilMgr

private _smilMgr:SMILManager
(read)

_streamHeight

private _streamHeight:Number
(read)

_streamLength

private _streamLength:Number
(read)

_streamName

private _streamName:String
(read)

_streams

private _streams:Array
(read)

_streamWidth

private _streamWidth:Number
(read)

_timeout

private _timeout:Number
(read)

_timeoutIntervalId

private _timeoutIntervalId:Number
(read)

_tryNC

_tryNC:Array
(read)

_tryNCIntervalId

private _tryNCIntervalId:Number
(read)

_wrappedURL

private _wrappedURL:String
(read)

DEFAULT_TIMEOUT

DEFAULT_TIMEOUT:Number = 60000
(read)

Default connection timeout in milliseconds.

fallbackServerName

fallbackServerName:String
(read)

fallbackServerName is exposed in two ways:

User can supply second in smil and that base
attr will be taken as the fallbackServerName (note that only
the server name will be taken from this and not the application
name or anything else).

The second way is the user can directly set this by
accessing the ncMgr property in FLVPlayback or VideoPlayer and
set fallbackServerName property directly.

fpadZone

fpadZone:Number
(read)

Class methods

stripFrontAndBackWhiteSpace

static private function stripFrontAndBackWhiteSpace (
p_str:String) : String

Instance methods

_onFCSConnectTimeOut

public function _onFCSConnectTimeOut (
) : Void

Called on interval to timeout all connection attempts.

For creating rtmp connections.

See also:

bitrateMatch

private function bitrateMatch (
) : Void

matches bitrate with stream

canReuseOldConnection

private function canReuseOldConnection (
parseResults:Object) : Boolean

Compares connection info with previous NetConnection,
will reuse existing connection if possible.

cleanConns

public function cleanConns (
)

Stops all intervals, closes all unneeded connections, and other
cleanup related to the connectRTMP strategy of
pipelining connection attempts to different protocols and
ports.

For creating rtmp connections.

See also:

close

function close (
) : Void

See also:
Specified by:

connectAgain

function connectAgain (
) : Boolean

Returns:
  • true if will attempt to make another connection,
    false if already made attempt or no additional attempts
    are merited.
    #

connectFPAD

private function connectFPAD (
url:String) : Boolean

Top level function for downloading fpad XML from FMS 2.0
server. Creates and kicks off a FPADManager instance
which does all the work.

connectHTTP

private function connectHTTP (
) : Boolean

Handles creating NetConnection instance for
progressive download of FLV via http.

connectOnStatus

public function connectOnStatus (
target:NetConnection, info:Object) : Void

netStatus event listener when connecting

connectRTMP

private function connectRTMP (
) : Boolean

Top level function for creating NetConnectioninstance for streaming playback of FLV via rtmp. Actually
tries to create several different connections using different
protocols and ports in a pipeline, so multiple connection
attempts may be occurring simultaneously, and will use the
first one that connects successfully.

connectToURL

function connectToURL (
url:String) : Boolean

Returns:
  • true if connection made synchronously, false attempt
    made asynchronously so caller should expect a "connected"
    event coming.
    #

disconnectOnStatus

public function disconnectOnStatus (
target:NetConnection, info:Object) : Void

netStatus event listener for disconnecting extra
NetConnections that were opened in parallel

getBitrate

function getBitrate (
) : Number

For RTMP streams, returns value calculated from autodetection,
not value set via setBitrate().

getNetConnection

function getNetConnection (
) : NetConnection

getStreamHeight

function getStreamHeight (
) : Number

getStreamLength

function getStreamLength (
) : Number

getStreamLengthResult

public function getStreamLengthResult (
length:Number) : Void

Responder function to receive streamLength result from
server after making rpc

getStreamName

function getStreamName (
) : String

getStreamWidth

function getStreamWidth (
) : Number

getTimeout

function getTimeout (
) : Number

Get the timeout after which we give up on connection in
milliseconds.
#
Specified by:

getVideoPlayer

function getVideoPlayer (

helperDone

function helperDone (
helper:Object, success:Boolean)

Called by SMILManager when done.

initNCInfo

private function initNCInfo (
) : Void

initOtherInfo

private function initOtherInfo (
) : Void

isRTMP

function isRTMP (
) : Boolean

Specified by:

nextConnect

private function nextConnect (
) : Void

Does work of trying to open rtmp connections. Called either
by connectRTMP or on an interval set up in
that method.

For creating rtmp connections.

See also:

parseURL

private function parseURL (
url:String) : Object

Parses URL to determine if it is http or rtmp. If it is rtmp,
breaks it into pieces to extract server URL and port, application
name and stream name. If .flv is at the end of an rtmp URL, it
will be stripped off.

reconnect

function reconnect (
) : Void

reconnectOnStatus

public function reconnectOnStatus (
target:NetConnection, info:Object) : Void

netStatus event listener when reconnecting

setBitrate

function setBitrate (
b:Number) : Void

This value is only used with progressive download (HTTP), with
RTMP streaming uses autodetection.

setTimeout

function setTimeout (
t:Number) : Void

Set the timeout after which we give up on connection in
milliseconds.
#
Specified by:

setVideoPlayer

function setVideoPlayer (
v:VideoPlayer) : Void

tryFallBack

private function tryFallBack (
) : Void

Starts another pipelined connection attempt with
connectRTMP with the fallback server.

For creating rtmp connections.

See also:

Event handlers

onConnected

public function onConnected (
p_nc:NetConnection, p_bw:Number) : Void

Starts another pipelined connection attempt with
connectRTMP with the fallback server.

For creating rtmp connections.

See also:

onReconnected

public function onReconnected (
) : Void

dispatches reconnect event, called by
NetConnection.onBWDone