Packagecom.akamai.display
Classpublic class AkamaiMediaSprite
InheritanceAkamaiMediaSprite Inheritance flash.display.Sprite

AkamaiMediaSprite is a display component which simplifies the process of robustly playing back Akamai HDN 1 content and RTMP content from the Akamai network.

NOTE: As of HDCore 3.0, HDS (HTTP Dynamic Streaming) is no longer supported by this class.

The AkamaiMediaSprite class abstracts away the differences in the formats and accepts a string resource as the only required input. Type detection is performed automatically. The class makes available the underlying OvpConnection and NetStream to facilitate integration with control components. The video stream is scaled to automatically fit within the component, preserving its aspect ratio.

View the examples



Public Properties
 PropertyDefined By
  autoStart : Boolean
Sets playback to start automatically once a resource is loaded.
AkamaiMediaSprite
  duration : Number
[read-only] Returns the duration of the media in seconds.
AkamaiMediaSprite
  enableAlternateServerMapping : Boolean
AkamaiMediaSprite
  HDPrimaryToken : String
Primary token used to connect to Akamai HD 1.0 Streams.
AkamaiMediaSprite
  netStream : NetStream
[read-only] The NetStream instance being used to render the video.
AkamaiMediaSprite
  ovpConnection : OvpConnection
[read-only] The OvpConnection instance being used to render the video.
AkamaiMediaSprite
  rtmpConnectionAuth : String
The connection level auth token for playing secure RTMP VOD streams over Akamai.
AkamaiMediaSprite
  rtmpStreamAuth : String
The stream level auth token for playing secure RTMP live streams over Akamai.
AkamaiMediaSprite
  time : Number
[read-only]
AkamaiMediaSprite
  video : Video
[read-only] The Video class instance being used to render the video.
AkamaiMediaSprite
Public Methods
 MethodDefined By
  
AkamaiMediaSprite(width:Number = 320, height:Number = 180)
Constructor.
AkamaiMediaSprite
  
AkamaiMediaSprite
  
load(source:String, clipStartTime:Number, clipEndTime:Number):void
Initiates playback by accepting a string resource to any Akamai video resource, including MBR SMIL files and SBR streams across the HDN and RTMP networks.
AkamaiMediaSprite
  
start():Boolean
Starts the playback of a resource that has been preivously loaded.
AkamaiMediaSprite
Events
 Event Summary Defined By
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  Dispatched when the class has debug information.AkamaiMediaSprite
  Dispatched when the class encounters a fatal error.AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  Dispatched when the class has completed initializing the relevant NetConnection and NetStream objects for the resource.AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
  AkamaiMediaSprite
Property Detail
autoStartproperty
autoStart:Boolean

Sets playback to start automatically once a resource is loaded.


Implementation
    public function get autoStart():Boolean
    public function set autoStart(value:Boolean):void
durationproperty 
duration:Number  [read-only]

Returns the duration of the media in seconds.


Implementation
    public function get duration():Number
enableAlternateServerMappingproperty 
enableAlternateServerMapping:Boolean


Implementation
    public function get enableAlternateServerMapping():Boolean
    public function set enableAlternateServerMapping(value:Boolean):void
HDPrimaryTokenproperty 
HDPrimaryToken:String

Primary token used to connect to Akamai HD 1.0 Streams.


Implementation
    public function get HDPrimaryToken():String
    public function set HDPrimaryToken(value:String):void
netStreamproperty 
netStream:NetStream  [read-only]

The NetStream instance being used to render the video. This will be either an AkamaiHDNetstream or an AkamaiDynamicNetStream, depending on whether the resource points at Akamai HDN content or FMS MBR content. You may cast it appropriately to extract methods and properties that may be particular to each NetStream type. This property can only be accessed after the resource has been successfully loaded.


Implementation
    public function get netStream():NetStream
ovpConnectionproperty 
ovpConnection:OvpConnection  [read-only]

The OvpConnection instance being used to render the video. To access the actual NetConnection, should you need it, you may use ovpConnection.netConnection. This property can only be accessed after the resource has been successfully loaded.


Implementation
    public function get ovpConnection():OvpConnection
rtmpConnectionAuthproperty 
rtmpConnectionAuth:String

The connection level auth token for playing secure RTMP VOD streams over Akamai.


Implementation
    public function get rtmpConnectionAuth():String
    public function set rtmpConnectionAuth(value:String):void
rtmpStreamAuthproperty 
rtmpStreamAuth:String

The stream level auth token for playing secure RTMP live streams over Akamai.


Implementation
    public function get rtmpStreamAuth():String
    public function set rtmpStreamAuth(value:String):void
timeproperty 
time:Number  [read-only]


Implementation
    public function get time():Number
videoproperty 
video:Video  [read-only]

The Video class instance being used to render the video.


Implementation
    public function get video():Video
Constructor Detail
AkamaiMediaSprite()Constructor
public function AkamaiMediaSprite(width:Number = 320, height:Number = 180)

Constructor. The desired width and height of the component should be passed in as arguments.

Parameters
width:Number (default = 320) — the width of the component in pixels
 
height:Number (default = 180) — the height of the component in pixels
Method Detail
closeAndDestroy()method
public function closeAndDestroy():void

load()method 
public function load(source:String, clipStartTime:Number, clipEndTime:Number):void

Initiates playback by accepting a string resource to any Akamai video resource, including MBR SMIL files and SBR streams across the HDN and RTMP networks. If autoStart is true (which is the default behavior), then the stream will also begin playing the moment it is loaded. Once the content is loaded, meaning the relevant NetConnection and NetStream have been established, then the OvpEvent.LOADED will be dispatched.

Parameters

source:String — the string resource that points at the video content
 
clipStartTime:Number (default = NaN) — of the media in seconds
 
clipEndTime:Number (default = NaN) — of the media in seconds

See also

start()method 
public function start():Boolean

Starts the playback of a resource that has been preivously loaded. If auotStart is true then this method will be called automatically by the class once the resource is loaded.

Returns
Boolean

See also

Event Detail
asyncerror Event
Event Object Type: org.openvideoplayer.events.OvpEvent

bandwidth Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

caption Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

complete Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

cpu Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

datamessage Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

deadconnection Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

debug Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

Dispatched when the class has debug information. Note that debug dmessages from the underlying netStreams are also bubbled up.

error Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

Dispatched when the class encounters a fatal error. The data property in this case will contain an error string.

fcsubscribe Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

fcunsubscribe Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

id3 Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

isbuffering Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

islivestream Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

isplayinglive Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

loaded Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

Dispatched when the class has completed initializing the relevant NetConnection and NetStream objects for the resource.

metadata Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

progress Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

switchAcknowledged Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

switchComplete Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

switchRequested Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

switchstart Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

trickModeTimerTick Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

unsubscribed Event  
Event Object Type: org.openvideoplayer.events.OvpEvent

Examples
Example usage:
     var player:AkamaiMediaSprite = new AkamaiMediaSprite(640,360);
     player.addEventListener(OvpEvent.LOADED,onLoaded);
     player.addEventListener(OvpEvent.ERROR,onError);
     addChild(player);
     player.load("http://mediapm.edgesuite.net/edgeflash/public/debug/assets/smil/earth2.smil");
     
     private function onLoaded(event:OvpEvent):void
     {
             // You can access the underlying NetStream here in order to set listeners and apply control
             // commands such as seek(), pause() and resume().
             var netStream:NetStream = player.netStream;
     
             // You can access the underlying OvpConnection object here in order to set listeners or call
             // server side methods.
             var ovpConnection:OvpConnection = player.ovpConnection;
     }
     private function onError(event:OvpEvent):void
     {
             trace("the loader encountered a fatal error: " + (event.data as String));
     }