Packageflash.net
Classpublic dynamic class NetStreamPlayOptions
InheritanceNetStreamPlayOptions Inheritance EventDispatcher Inheritance Object

Language version: ActionScript 3.0
Runtime version: AIR 1.5

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 absoulte stream time at which the server switches between streams of different bitrates for Flash Media Server dynamic streaming.
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
 EventSummaryDefined 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
lenproperty
public var len:Number

Language version: ActionScript 3.0
Runtime version: AIR 1.5

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

offsetproperty 
public var offset:Number

Language version: ActionScript 3.0
Runtime version: AIR 2

The absoulte stream time at which the server switches between streams of different bitrates for Flash Media Server dynamic streaming. The offset property is used when a NetStream.play2() call is made with the NetStreamPlayTransitions.SWITCH transition mode. There are two switching modes: fast switch and standard switch. The default value of offset is -1 which is fast switch mode. Write ActionScript logic to decide when to use fast switch and when to use standard switch.

Fast switch

In fast switch mode, Flash Media Server switches to the new stream without waiting to play the data in the buffer. Any data buffered from the old stream past the offset is flushed. Fast switching is faster than standard switching because the buffered data from the old stream doesn't have to play out.

The default value of offset is -1, which is fast switch mode. When offset is -1, the switch occurs at the first available keyframe after netstream.time + 3, which is about 3 seconds later than the playback point. You can also set the offset property to any value greater than netstream.time. For example, to fast switch 5 seconds after the playback point, set the offset property to netstream.time + 5. If the value of offset is less than netstream.time, a NetStream.Play.Failed status event is sent.

Note: The offset property is absolute stream time, it is not an offset from the playback point. For example, to switch 5 seconds from the playback point, set the offset property to netstream.time + 5, not to 5.

Standard switch

To use standard switch instead of fast switch, set offset to a value greater than netstream.time + netstream.bufferLength.

Use standard switch when the client has a high bitrate in the buffer and wants to switch to a lower bandwidth due to bandwidth dropping (and not due to CPU issues or dropped frames). The client may want to play out the higher bitrate for as long as possible and switch to the lower bitrate at the end of the buffer (as in standard switching).

For more information, see "Fast switching between streams" in the Adobe Flash Media Server Developer's Guide.

See also

oldStreamNameproperty 
public var oldStreamName:String

Language version: ActionScript 3.0
Runtime version: AIR 1.5

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

startproperty 
public var start:Number

Language version: ActionScript 3.0
Runtime version: AIR 1.5

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

streamNameproperty 
public var streamName:String

Language version: ActionScript 3.0
Runtime version: AIR 1.5

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

transitionproperty 
public var transition:String

Language version: ActionScript 3.0
Runtime version: AIR 1.5

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 version: AIR 1.5

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

See also