Package | fl.video |
Class | public class NCManager |
Inheritance | NCManager Object |
Implements | INCManager |
Subclasses | NCManagerNative |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
NetConnection
object for the VideoPlayer class, a
helper class for that user facing class.
The NCManager class searches a URL and assumes the following:
- If the URL string host starts with a valid FMS streaming protocol (such as rtmp://, rtmps://, or rtmpt://) it infers that the URL is streaming from an FMS.
- If it does not stream from an FMS and if the URL contains a question mark (?), it infers that the URL points to an SMIL file.
- If it does not stream from an FMS and if it does not contain a question mark (?), the NCManager class checks to see whether it ends in .flv. If it ends in .flv, it infers it is for a progressive download FLV. Otherwise, it is an SMIL file to download and parse.
Property | Defined By | ||
---|---|---|---|
bitrate : Number
When streaming from Flash Media Server (FMS), the bitrate property
returns the value calculated from autodetection,
not the value set through the bitrate() property. | NCManager | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
fallbackServerName : String
Exposes the fallbackServerName property indirectly or directly. | NCManager | ||
isRTMP : Boolean [read-only]
Whether the URL is for RTMP streaming from a Flash Media Server (FMS)
or a progressive download. | NCManager | ||
netConnection : NetConnection [read-only]
Reference to the NetConnection object. | NCManager | ||
streamHeight : int [read-only]
Height of the stream, in pixels. | NCManager | ||
streamLength : Number [read-only]
Length of the stream, in seconds. | NCManager | ||
streamName : String [read-only]
The stream name passed into the
NetStream.play() method. | NCManager | ||
streamWidth : int [read-only]
Width of the stream, in pixels. | NCManager | ||
timeout : uint
The time in milliseconds after which attempts to make a connection stop. | NCManager | ||
videoPlayer : VideoPlayer
The VideoPlayer object that owns this object. | NCManager |
Method | Defined By | ||
---|---|---|---|
Creates a new NCManager instance. | NCManager | ||
Closes the NetConnection. | NCManager | ||
Called by the VideoPlayer object if the connection is
successfully made but the stream is not found. | NCManager | ||
Called by the VideoPlayer object to ask for a connection to the
URL. | NCManager | ||
Allows getting of the fallbackServerName, fpadZone, objectEncoding,
and proxyType properties. | NCManager | ||
Indicates whether an object has a specified property defined. | Object | ||
Called by any helper object doing a task for the
NCManager object to signal it has completed
and whether it was successful. | NCManager | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Called by the VideoPlayer object to ask for reconnection
after the connection is lost. | NCManager | ||
Allows setting of the fallbackServerName, fpadZone, objectEncoding,
and proxyType properties. | NCManager | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
Constant | Defined By | ||
---|---|---|---|
DEFAULT_TIMEOUT : uint = 60000
The default timeout in milliseconds. | NCManager | ||
SHORT_VERSION : String = "2.1" [static]
State variable indicating the short version number of the component. | NCManager | ||
VERSION : String = "2.1.0.23" [static]
State variable indicating the long version number of the component. | NCManager |
bitrate | property |
bitrate:Number
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
When streaming from Flash Media Server (FMS), the bitrate
property
returns the value calculated from autodetection,
not the value set through the bitrate()
property.
Implementation
public function get bitrate():Number
public function set bitrate(value:Number):void
Related API Elements
fallbackServerName | property |
public var fallbackServerName:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Exposes the fallbackServerName
property indirectly or directly.
- Indirectly—Supply a second <meta base> in SMIL.
The
fallbackServerName
property uses that base attribute. (ThefallbackServerName
property uses the server name only, nothing else.) - Directly—Access the
ncMgr
property in FLVPlayback or VideoPlayer and set thefallbackServerName
property or use thesetProperty()
method.
Related API Elements
isRTMP | property |
isRTMP:Boolean
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Whether the URL is for RTMP streaming from a Flash Media Server (FMS)
or a progressive download. If the
stream is an RTMP stream from an FMS, then true
. If the stream is a
progressive download of an HTTP, local or other file, then false
.
Implementation
public function get isRTMP():Boolean
Related API Elements
netConnection | property |
netConnection:NetConnection
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Reference to the NetConnection object.
Implementation
public function get netConnection():NetConnection
Related API Elements
streamHeight | property |
streamHeight:int
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Height of the stream, in pixels. After the
VideoPlayer.ncConnected()
method is called, if the streamHeight
property is less than 0, that indicates to the VideoPlayer object that there is no stream
height information. If the
VideoPlayer object has the scaleMode
property set
to VideoScaleMode.MAINTAIN_ASPECT_RATIO
or VideoScaleMode.NO_SCALE
,
then this value will be used and the resizing will
happen instantly, rather than waiting.
Implementation
public function get streamHeight():int
Related API Elements
streamLength | property |
streamLength:Number
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Length of the stream, in seconds. After the VideoPlayer.ncConnected()
method
is called, if it returns undefined, null
or less than 0,
then the VideoPlayer object knows that there is no stream length information.
If stream length information is returned, it overrides any existing steam length information
including information set by the totalTime
parameter of the
VideoPlayer.play()
method or the
VideoPlayer.load()
method or information received from the FLV file's metadata.
Implementation
public function get streamLength():Number
Related API Elements
streamName | property |
streamWidth | property |
streamWidth:int
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Width of the stream, in pixels. After the
VideoPlayer.ncConnected()
method is called, if the streamWidth
property
is less than 0, that indicates to the VideoPlayer object that there is no stream width
information. If the VideoPlayer object has the scaleMode
property set
to VideoScaleMode.MAINTAIN_ASPECT_RATIO
or VideoScaleMode.NO_SCALE
,
then this value is used and the resizing happens instantly, rather than waiting.
Implementation
public function get streamWidth():int
Related API Elements
timeout | property |
timeout:uint
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The time in milliseconds after which attempts to make a connection stop.
Implementation
public function get timeout():uint
public function set timeout(value:uint):void
Related API Elements
videoPlayer | property |
videoPlayer:VideoPlayer
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The VideoPlayer object that owns this object.
Implementation
public function get videoPlayer():VideoPlayer
public function set videoPlayer(value:VideoPlayer):void
Related API Elements
NCManager | () | Constructor |
public function NCManager()
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Creates a new NCManager instance.
close | () | method |
public function close():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Closes the NetConnection.
Related API Elements
connectAgain | () | method |
public function connectAgain():Boolean
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Called by the VideoPlayer object if the connection is successfully made but the stream is not found. If multiple alternate interpretations of the RTMP URL are possible, it tries to connect to the server with a different URL and hand back a different stream name.
This can be necessary in cases where the URL is something like rtmp://servername/path1/path2/path3. When passing in an application name and an instance name, open the NetConnection object with rtmp://servername/path1/path2, or use the default instance so the stream is opened with path2/path3. In general, this is possible whenever there are more than two parts to the path but not possible if there are only two (there should never be only one).
ReturnsBoolean — If an attempt is made to make another connection, then true .
If an attempt has already been made or no additional attempts
are merited, then false .
|
Related API Elements
connectToURL | () | method |
public function connectToURL(url:String):Boolean
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Called by the VideoPlayer object to ask for a connection to the
URL. Once a connection is successful or failed, then call the
VideoPlayer.ncConnected()
method. If the connection has failed, then
set nc = null
before calling.
Parameters
url:String — The URL to which the VideoPlayer object requests connection.
|
Boolean — If a connection is made synchronously, true . If an attempt is
made asynchronously so caller should expect a "connected"
event coming, false .
|
Related API Elements
getProperty | () | method |
public function getProperty(propertyName:String):*
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Allows getting of the fallbackServerName
, fpadZone
, objectEncoding
,
and proxyType
properties. See setProperty()
for
an explanation of these properties.
Parameters
propertyName:String — The name of the property that the getProperty
method is calling.
|
* — String representation of the fallbackServerName, fpadZone, objectEncoding, and proxyType properties.
|
Related API Elements
helperDone | () | method |
public function helperDone(helper:Object, success:Boolean):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Called by any helper object doing a task for the NCManager object to signal it has completed and whether it was successful. The NCManager object uses this with SMILManager.
Parameters
helper:Object — The helper object.
| |
success:Boolean — A setting to signal when a task is completed. If success is
true , then the task was completed successfully; otherwise false .
|
Related API Elements
reconnect | () | method |
public function reconnect():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Called by the VideoPlayer object to ask for reconnection
after the connection is lost. Once the connection is either successful
or failed, call the VideoPlayer.ncReconnected()
method. If the
connection failed, set nc = null
before calling.
Related API Elements
setProperty | () | method |
public function setProperty(propertyName:String, value:*):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Allows setting of the fallbackServerName
, fpadZone
, objectEncoding
,
and proxyType
properties.
The fallbackServerName
property specifies a Flash Media Server (FMS) URL
to be used if the primary server address derived from the URL passed
into connectToURL()
cannot be reached. This property can also be set
directly through the fallbackServerName
property.
The fpadZone
property specifies the fpadZone
property for Flash Media Server (FMS).
If the returned value is not a number (NaN),
then no zone is set.
The fpadZone
property must be set before
the connection process begins to have effect.
If you do not want to set a zone, set the fpadZone
property to NaN
.
NaN
.
The objectEncoding
property specifies the value to be used for the objectEncoding
property on NetConnection
instances. Default is flash.net.ObjectEncoding.AMF0
.
The proxyType
property specifies the value to be used for the proxyType
property on NetConnection
instances. Default is "best".
Parameters
propertyName:String — The name of the property that the setProperty
method is calling.
| |
value:* — The property value.
|
Related API Elements
DEFAULT_TIMEOUT | Constant |
public const DEFAULT_TIMEOUT:uint = 60000
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The default timeout in milliseconds.
Related API Elements
SHORT_VERSION | Constant |
public static const SHORT_VERSION:String = "2.1"
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
State variable indicating the short version number of the component. The version number is useful when you have a FLA file and need to know the component version. To determine the component version, type the following code trace into the FLA file:
FLVPlayback.SHORT_VERSION
The SHORT_VERSION
variable includes only the major
and minor version numbers, for example, 2.0. The VERSION
variable includes
the major and minor version numbers as well as the revision and build numbers,
for example, 2.0.0.11.
Related API Elements
VERSION | Constant |
public static const VERSION:String = "2.1.0.23"
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
State variable indicating the long version number of the component. The version number is useful when you have a FLA file and need to know the component version. To determine the component version, type the following code trace into the FLA file:
FLVPlayback.VERSION
The VERSION
variable includes
the major and minor version numbers as well as the revision and build numbers,
for example, 2.0.0.11. The SHORT_VERSION
variable includes only the major
and minor version numbers, for example, 2.0.
Related API Elements
To run the example, follow these steps:
- Add the FLVPlayback component in the library.
- Replace
testVideoPath
with an absolute or relative path to an FLV file. - Save this code as NCManagerExample.as in the same directory as your FLA file.
- Set the Document class in the FLA file to NCManagerExample.
package { import fl.video.VideoEvent; import fl.video.VideoPlayer; import flash.display.Sprite; public class NCManagerExample extends Sprite { private var videoPath:String = "http://www.helpexamples.com/flash/video/sheep.flv" private var player:VideoPlayer; public function NCManagerExample() { player = new VideoPlayer(); player.play(videoPath); player.addEventListener(VideoEvent.READY,announceRTMS); addChild(player); } private function announceRTMS(e:VideoEvent):void { var player:VideoPlayer = e.target as VideoPlayer; if(player.ncMgr.isRTMP) { trace("Video is streaming"); } else { trace("Video is progressively downloading"); } } } }
Wed Nov 21 2018, 06:34 AM -08:00