Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flash.net 
NetStreamPlayOptions 
Packageflash.net
Classpublic dynamic class NetStreamPlayOptions
InheritanceNetStreamPlayOptions Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5, Flash Lite 4

The NetStreamPlayOptions class specifies the various options that can be passed to the NetStream.play2() method. You pass a NetStreamPlayOptions object to play2(), and the properties of the class specify the various options. The primary use case for this class is to implement transitions between streams dynamically, either to switch to streams of different bit rates and sizes or to swap to different content in a playlist.



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  len : Number
The duration of playback, in seconds, for the stream specified in streamName.
NetStreamPlayOptions
  offset : Number
The time in seconds in the stream playback at which the switch to a new stream should be made.
NetStreamPlayOptions
  oldStreamName : String
The name of the old stream or the stream to transition from.
NetStreamPlayOptions
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  start : Number
The start time, in seconds, for streamName.
NetStreamPlayOptions
  streamName : String
The name of the new stream to transition to or to play.
NetStreamPlayOptions
  transition : String
The mode in which streamName is played or transitioned to.
NetStreamPlayOptions
Public Methods
 MethodDefined By
  
Creates a NetStreamPlayOptions object to specify the options that are passed to the NetStream.play2() method.
NetStreamPlayOptions
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Property Detail

len

property
public var len:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5, Flash Lite 4

The duration of playback, in seconds, for the stream specified in streamName. The default value is -1, which means that Flash Player plays a live stream until it is no longer available or plays a recorded stream until it ends. If you pass 0 for len, Flash Player plays the single frame that is start seconds from the beginning of a recorded stream (assuming that start is equal to or greater than 0).

If you pass a positive number for len, Flash Player plays a live stream for len seconds after it becomes available, or plays a recorded stream for len seconds. (If a stream ends before len seconds, playback ends when the stream ends.)

If you pass a negative number other than -1 for len, Flash Player interprets the value as if it were -1.

See also

offset

property 
public var offset:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2, Flash Lite 4

The time in seconds in the stream playback at which the switch to a new stream should be made. The offset parameter is used when a NetStream.play2() call is made with the NetStreamPlayTransitions.SWITCH transition mode. Flash Media Server looks for the nearest switch point after the specified offset time and starts streaming the new stream from that point onwards.

When this property is specified, the server pre-empts the current stream and starts streaming the new stream from the specified index position right away, without waiting to find a Keyframe location. Any data that is already buffered from a previous stream after this offset is flushed. This technique can switch to a new stream more quickly than other techniques, because the buffered data from an older stream doesn't have to play out.

The offset value must be higher than the current playback time (Netstream.time) If the value is less, a NetStream.Play.Failed status event is sent.

The default value of offset is -1, which defaults the switching behavior to standard. In this mode, the server determines a good transition point between the streams forward in time from the point it receives the switch call, and switches at that point.

See also

oldStreamName

property 
public var oldStreamName:String

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5, Flash Lite 4

The name of the old stream or the stream to transition from. When NetStream.play2() is used to simply play a stream (not perform a transition), the value of this property should be either null or undefined. Otherwise, specify the stream to transition from.

See also

start

property 
public var start:Number

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5, Flash Lite 4

The start time, in seconds, for streamName. Valid values are -2, -1, and 0.

The default value for start is -2, which means that Flash Player first tries to play the live stream specified in streamName. If a live stream of that name is not found, Flash Player plays the recorded stream specified in streamName. If neither a live nor a recorded stream is found, Flash Player opens a live stream named streamName, even though no one is publishing on it. When someone does begin publishing on that stream, Flash Player begins playing it.

If you pass -1 for start, Flash Player plays only the live stream specified in streamName. If no live stream is found, Flash Player waits for it indefinitely if len is set to -1; if len is set to a different value, Flash Player waits for len seconds before it begins playing the next item in the playlist.

If you pass 0 or a positive number for start, Flash Player plays only a recorded stream named streamName, beginning start seconds from the beginning of the stream. If no recorded stream is found, Flash Player begins playing the next item in the playlist immediately.

If you pass a negative number other than -1 or -2 for start, Flash Player interprets the value as if it were -2.

See also

streamName

property 
public var streamName:String

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5, Flash Lite 4

The name of the new stream to transition to or to play. When oldStreamName is null or undefined, calling NetStream.play2() simply starts playback of streamName. If oldStreamName is specified, calling NetStream.play2() transitions oldStreamName to streamName using the transition mode specified in the transition property.

See also

transition

property 
public var transition:String

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5, Flash Lite 4

The mode in which streamName is played or transitioned to. Possible values are constants from the NetStreamPlayTransitions class. Depending on whether Netstream.play2() is called to play or transition a stream, the transition mode results in different behaviors. For more information on the transition modes, see the NetStreamPlayTransitions class.

See also

Constructor Detail

NetStreamPlayOptions

()Constructor
public function NetStreamPlayOptions()

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5, Flash Lite 4

Creates a NetStreamPlayOptions object to specify the options that are passed to the NetStream.play2() method.

See also