Packagecom.akamai.hd
Classpublic class HDThumbnailGenerator
InheritanceHDThumbnailGenerator Inheritance flash.events.EventDispatcher

The HDThumbnail Generator provides a convenient mechanism for generating image thumbnails at any time offset within a live or ondemand stream. It does this by instantiating an instance of HDNetStream and then seeking and pausing it to the required time before taking a BitmapImage. Use this functionality sparingly and keep in mind that each thumb request will show up as a 'play' in your server logs. Additionally, thumb display will contest with primary stream for bandwidth. By default it will generate the thumb off the lowest bitrate rendition when presented with a MBR source. Do not request a new thumb until the previous request has been satisfied. In practice this will limit you to at least a 1s interval between thumb requests. If you are attaching this class to a scrub bar handle, do not attempt to generate a new thumb at the update interval of the handle. Wait for the user to hover at least 500ms in one location before generating at thumb at that offset.

If you use this class with token protected content, then you will need to provide a fresh (unexpired) token with each creaiton request.

Usage: creating a thumbnail at a point 57s in to a stream

     
     var tg:HDThumbnailGenerator = new HDThumbnailGenerator();
     tg.addEventListener(HDEvent.THUMBNAIL_READY,onThumbReady);
     tg.createThumb("http://mediapm.edgesuite.net/edgeflash/public/debug/assets/smil/earth2.smil",160,90,57);
     function onThumbReady(event:HDEvent):void
     {
             addChild(event.data as BitMap);
     }
     
     



Public Methods
 MethodDefined By
  
HDThumbnailGenerator(target:IEventDispatcher = null)
Constructor
HDThumbnailGenerator
  
captureImage(videoObj:Video, imageWidth:Number = 320, imageHeight:Number = 240):Bitmap
[static] Creates a screenshot from the Video object at a given size.
HDThumbnailGenerator
  
createThumb(source:Object, width:Number = 160, height:Number = 90, time:Number = 3):void
Creates a thumbnail for a stream at a given size and offset
HDThumbnailGenerator
Events
 Event Summary Defined By
  Dispatched if the class encounters an error while attempting to generate the thumbnail.HDThumbnailGenerator
  Dispatched if the stream cannot be found.HDThumbnailGenerator
  Dispatched once the thumbnail has been successfully created.HDThumbnailGenerator
Constructor Detail
HDThumbnailGenerator()Constructor
public function HDThumbnailGenerator(target:IEventDispatcher = null)

Constructor

Parameters
target:IEventDispatcher (default = null)
Method Detail
captureImage()method
public static function captureImage(videoObj:Video, imageWidth:Number = 320, imageHeight:Number = 240):Bitmap

Creates a screenshot from the Video object at a given size. Supports HDN1 only.

Parameters

videoObj:Video — The flash.media.Video object used for displaying the stream.
 
imageWidth:Number (default = 320) — The image width in pixels. Default is 320.
 
imageHeight:Number (default = 240) — The image height in pixels. Default is 240.

Returns
Bitmap

Throws
ArgumentError — if the Video object argument is null.
createThumb()method 
public function createThumb(source:Object, width:Number = 160, height:Number = 90, time:Number = 3):void

Creates a thumbnail for a stream at a given size and offset

Parameters

source:Object — the source file on which to generate the thumb. Can be a string reference to a SBR or MBR SMIL as well as an HDMBRObject instance.
 
width:Number (default = 160) — the thumb with in pixels
 
height:Number (default = 90) — the thumb height in pixels
 
time:Number (default = 3) — the offset into the stream at which the thumb should be generated. Specified in seconds relative to the start of the stream.

Event Detail
error Event
Event Object Type: com.akamai.hd.HDEvent
HDEvent.type property = com.akamai.hd.HDEvent

Dispatched if the class encounters an error while attempting to generate the thumbnail.

Data object carries a description of the error as a String.

streamnotfound Event  
Event Object Type: com.akamai.hd.HDEvent
HDEvent.type property = com.akamai.hd.HDEvent

Dispatched if the stream cannot be found.

Data object is empty.

thumbnailready Event  
Event Object Type: com.akamai.hd.HDEvent
HDEvent.type property = com.akamai.hd.HDEvent

Dispatched once the thumbnail has been successfully created.

Data object carries the thumbnail as a Bitmap.