Packagecom.akamai.stagevideo
Classpublic class StageVideoHelper
InheritanceStageVideoHelper Inheritance flash.events.EventDispatcher

This class is designed to help with setting up and using Flash Player 10.2 StageVideo technology with a fallback to the Video Object if StageVideo is not available on the end user's system

With stage video, the StageVideo object does not sit inside the Flash Player display list but sits behind the stage instead.

IMPORTANT NOTES ABOUT USING STAGE VIDEO
  1. StageVideo is only available in Flash Player version 10.2 and higher and must be developed with the Flex SDK 4.5 (Hero) or higher
  2. You must define the swf version with a compiler flag with -swf-version 11
  3. WMODE in the embed tag must be set to wmode="direct" to allow direct access the the client's GPU, otherwise GPU access will be denied and this class will be forced to fallback to the normal Video Object
  4. Due to the fact that the StageVideo Object sits behind the stage - When using stagevideo with Flex, you MUST set the s:Application backgroundAlpha="0"
  5. Due to the fact that the StageVideo Object sits behind the stage - When using stagevideo in Flash, you MUST make sure no DisplayObjects cover the stage



Public Properties
 PropertyDefined By
  height : Number
Accessor for the height property set on both StageVideo and Video objects.
StageVideoHelper
  stageVideo : Object
[read-only] Accessor to get the stageVideo object
StageVideoHelper
  stageVideoUsed : Boolean
[read-only] Accessor to get the current boolean value of stageVideoUsed.
StageVideoHelper
  status : String
[read-only] Accessor to get the current status that is active.
StageVideoHelper
  video : Video
[read-only] Accessor to get the Video object
StageVideoHelper
  videoCompositingStatus : String
[read-only] Accessor to get the current video compositing that is active.
StageVideoHelper
  videoDecodingStatus : String
[read-only] Accessor to get the current video decoding that is active.
StageVideoHelper
  videoHeight : uint
[read-only] Accessor to get the Video objects or the StageVideo objects videoHeight property
StageVideoHelper
  videoWidth : uint
[read-only] Accessor to get the Video objects or the StageVideo objects videoWidth property
StageVideoHelper
  visible : Boolean
Accessor for the visible property set on the video object only.
StageVideoHelper
  width : Number
Accessor for the width property set on both StageVideo and Video objects.
StageVideoHelper
  x : Number
Accessor for the x property set on both StageVideo and Video objects.
StageVideoHelper
  y : Number
Accessor for the y property set on both StageVideo and Video objects.
StageVideoHelper
Public Methods
 MethodDefined By
  
StageVideoHelper(stage:Stage, rect:Rectangle, displayObjectContainer:DisplayObjectContainer = null)
Constructor.
StageVideoHelper
  
attachNetStream(netStream:NetStream):void
StageVideoHelper
  
focus():void
Sets focus to the desired StageVideoHelper class since multiple instances can be instantianted and are stored in a static vector across all instances.
StageVideoHelper
  
gotoToFullScreen(player:Object, videoContainer:Object, usingFlex:Boolean = false, hidePlayer:Boolean = true):void
This method will find largest size that preserves aspect ratio of screen and create a fullScreenSourceRect at that size and put the stage into fullscreen mode.
StageVideoHelper
  
release():void
Releases the current StageVideoHelper class that has focus.
StageVideoHelper
Public Constants
 ConstantDefined By
  NETSTREAM_RENDER : String = render
[static]
StageVideoHelper
  RENDER_STATE : String = renderState
[static]
StageVideoHelper
  STAGE_VIDEO_AVAILABILITY : String = stageVideoAvailability
[static]
StageVideoHelper
  STATUS_STAGEVIDEO_ACCELERATED : String = StageVideo accelerated
[static] Status type
StageVideoHelper
  STATUS_STAGEVIDEO_SOFTWARE : String = StageVideo software
[static] Status type
StageVideoHelper
  STATUS_VIDEO_ACCELERATED : String = Video accelerated
[static] Status type
StageVideoHelper
  STATUS_VIDEO_SOFTWARE : String = Video software
[static] Status type
StageVideoHelper
Property Detail
heightproperty
height:Number

Accessor for the height property set on both StageVideo and Video objects. Default value is 240 pixels


Implementation
    public function get height():Number
    public function set height(value:Number):void
stageVideoproperty 
stageVideo:Object  [read-only]

Accessor to get the stageVideo object


Implementation
    public function get stageVideo():Object
stageVideoUsedproperty 
stageVideoUsed:Boolean  [read-only]

Accessor to get the current boolean value of stageVideoUsed.


Implementation
    public function get stageVideoUsed():Boolean
statusproperty 
status:String  [read-only]

Accessor to get the current status that is active. Possible String values that can be returned are

  1. StageVideo accelerated
  2. StageVideo software
  3. Video accelerated
  4. Video software


Implementation
    public function get status():String
videoproperty 
video:Video  [read-only]

Accessor to get the Video object


Implementation
    public function get video():Video
videoCompositingStatusproperty 
videoCompositingStatus:String  [read-only]

Accessor to get the current video compositing that is active. Possible String values that can be returned are:

  1. GPU
  2. SOFTWARE


Implementation
    public function get videoCompositingStatus():String
videoDecodingStatusproperty 
videoDecodingStatus:String  [read-only]

Accessor to get the current video decoding that is active. Possible String values that can be returned are:

  1. GPU
  2. SOFTWARE


Implementation
    public function get videoDecodingStatus():String
videoHeightproperty 
videoHeight:uint  [read-only]

Accessor to get the Video objects or the StageVideo objects videoHeight property


Implementation
    public function get videoHeight():uint
videoWidthproperty 
videoWidth:uint  [read-only]

Accessor to get the Video objects or the StageVideo objects videoWidth property


Implementation
    public function get videoWidth():uint
visibleproperty 
visible:Boolean

Accessor for the visible property set on the video object only. If the StageVideo object is being used then the Video object visible property gets set to false automaticlly. Default value is true


Implementation
    public function get visible():Boolean
    public function set visible(value:Boolean):void
widthproperty 
width:Number

Accessor for the width property set on both StageVideo and Video objects. Default value is 320 pixels


Implementation
    public function get width():Number
    public function set width(value:Number):void
xproperty 
x:Number

Accessor for the x property set on both StageVideo and Video objects. Default value is 0 pixels


Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number

Accessor for the y property set on both StageVideo and Video objects. Default value is 0 pixels


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
StageVideoHelper()Constructor
public function StageVideoHelper(stage:Stage, rect:Rectangle, displayObjectContainer:DisplayObjectContainer = null)

Constructor.

Parameters
stage:Stage — Reference to a Stage object for access to stage properties and to add event listeners and children to the display list of the stage.
 
rect:Rectangle — Rectangle object to define the x, y, width, and height of the Video or StageVideo object.
 
displayObjectContainer:DisplayObjectContainer (default = null) — Default value is null. Optional parameter, if supplied the Video object will be added as a child of DisplayObjectContainer, otherwise the Video object will be added as a child of the stage parameter supplied.
Method Detail
attachNetStream()method
public function attachNetStream(netStream:NetStream):void

Parameters

netStream:NetStream — Instance of a NetStream object to be attached the Video or the StageVideo object in this class

focus()method 
public function focus():void

Sets focus to the desired StageVideoHelper class since multiple instances can be instantianted and are stored in a static vector across all instances. This method will set the view port on all instnaces and set the focus menber variable to "this" instance of the StageVideoHelper class.

gotoToFullScreen()method 
public function gotoToFullScreen(player:Object, videoContainer:Object, usingFlex:Boolean = false, hidePlayer:Boolean = true):void

This method will find largest size that preserves aspect ratio of screen and create a fullScreenSourceRect at that size and put the stage into fullscreen mode. It will also take the Video object out of the displayObjectContainer if the displayObjectContainer is not null and add it to the player object at the highest display list index.

Parameters

player:Object
  1. If you are using StageVideo then the player visiblity will be set to false so that the stage is completely empty when going to fullscreen.
  2. If a displayObjectContainer has been defined in the constructor AND the Video Object is in use, NOT the StageVideo object, then this method will call addChild or addElement (based on the usingFlex Boolean value) to set the Video object to the highest index of the display list in the player.
  3. If a displayObjectContainer has NOT been defined in the constructor AND the Video Object is in use, NOT the StageVideo object, then this methods will simply store the player instance to be used in other fullscreen operations.
 
videoContainer:Object — This method will simply store this DisplayObject for use when exiting fullscreen mode by the FullScreenEvent.FULL_SCREEN event listener handler. If a displayObjectContainer has been defined in the constructor AND the Video Object is in use, NOT the StageVideo object, the Video object will be added back to the displayObjectContainer upon exiting of fullscreen mode
 
usingFlex:Boolean (default = false) — Set to true if you are using MXML visual elements so that addElement is called instead of addChild
 
hidePlayer:Boolean (default = true)

release()method 
public function release():void

Releases the current StageVideoHelper class that has focus. If there is more than one instance being stored in the static instances vector it will look for the instance that matches "this" and remove it from the vector and release for garbage collection.

Constant Detail
NETSTREAM_RENDERConstant
public static const NETSTREAM_RENDER:String = render

RENDER_STATEConstant 
public static const RENDER_STATE:String = renderState

STAGE_VIDEO_AVAILABILITYConstant 
public static const STAGE_VIDEO_AVAILABILITY:String = stageVideoAvailability

STATUS_STAGEVIDEO_ACCELERATEDConstant 
public static const STATUS_STAGEVIDEO_ACCELERATED:String = StageVideo accelerated

Status type

STATUS_STAGEVIDEO_SOFTWAREConstant 
public static const STATUS_STAGEVIDEO_SOFTWARE:String = StageVideo software

Status type

STATUS_VIDEO_ACCELERATEDConstant 
public static const STATUS_VIDEO_ACCELERATED:String = Video accelerated

Status type

STATUS_VIDEO_SOFTWAREConstant 
public static const STATUS_VIDEO_SOFTWARE:String = Video software

Status type