ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
org.osmf.net 

NetStreamSwitchManager  - AS3 OSMF

Packageorg.osmf.net
Classpublic class NetStreamSwitchManager
InheritanceNetStreamSwitchManager Inheritance NetStreamSwitchManagerBase Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

NetStreamSwitchManager is a default implementation of NetStreamSwitchManagerBase. It manages transitions between multi-bitrate (MBR) streams using configurable switching rules.



Public Properties
 PropertyDefined By
 InheritedautoSwitch : Boolean
Indicates whether the switching manager should automatically switch between streams.
NetStreamSwitchManagerBase
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcurrentIndex : uint
[read-only] Returns the current stream index that is rendering on the client.
NetStreamSwitchManagerBase
 InheritedmaxAllowedIndex : int
The highest stream index that the switching manager is allowed to switch to.
NetStreamSwitchManagerBase
Protected Properties
 PropertyDefined By
 Inherited_autoSwitch : Boolean
NetStreamSwitchManagerBase
  bandwidthLimit : Number
The multiplier to apply to the maximum bandwidth for the client.
NetStreamSwitchManager
 Inherited_maxAllowedIndex : int
NetStreamSwitchManagerBase
Public Methods
 MethodDefined By
  
NetStreamSwitchManager(connection:NetConnection, netStream:NetStream, resource:DynamicStreamingResource, metrics:NetStreamMetricsBase, switchingRules:Vector.<SwitchingRuleBase>, autoSwitch:Boolean = true)
Constructor.
NetStreamSwitchManager
 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
Initiate a switch to the stream with the given index.
NetStreamSwitchManagerBase
 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
Protected Methods
 MethodDefined By
  
Override this method to provide additional decisioning around allowing automatic switches to occur.
NetStreamSwitchManager
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

bandwidthLimit

property
bandwidthLimit:Number

The multiplier to apply to the maximum bandwidth for the client. The default is 140% of the highest bitrate stream.



Implementation
    protected function get bandwidthLimit():Number
    protected function set bandwidthLimit(value:Number):void
Constructor Detail

NetStreamSwitchManager

()Constructor
public function NetStreamSwitchManager(connection:NetConnection, netStream:NetStream, resource:DynamicStreamingResource, metrics:NetStreamMetricsBase, switchingRules:Vector.<SwitchingRuleBase>, autoSwitch:Boolean = true)

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Constructor.

Parameters
connection:NetConnection — The NetConnection for the NetStream that will be managed.
 
netStream:NetStream — The NetStream to manage.
 
resource:DynamicStreamingResource — The DynamicStreamingResource that is playing in the NetStream.
 
metrics:NetStreamMetricsBase — The provider of runtime metrics.
 
switchingRules:Vector.<SwitchingRuleBase> — The switching rules that this manager will use.
 
autoSwitch:Boolean (default = true)
Method Detail

canAutoSwitchNow

()method
protected function canAutoSwitchNow(newIndex:int):Boolean

Override this method to provide additional decisioning around allowing automatic switches to occur. This method will be invoked just prior to a switch request. If false is returned, that switch request will not take place.

By default, the implementation does the following:

1) When a switch down occurs, the stream being switched from has its failed count incremented. If, when the switching rules are evaluated again, a rule suggests switching up, since the stream previously failed, it won't be tried again until a duration (30s) elapses. This provides a better user experience by preventing a situation where the switch up is attempted but then fails almost immediately.

2) Once a stream item has 3 failures, there will be no more attempts to switch to it until an interval (5m) has expired. At the end of this interval, all failed counts are reset to zero.

Parameters

newIndex:int — The new index to switch to.

Returns
Boolean