Packagecom.akamai.media
Classpublic class MediaInspector
InheritanceMediaInspector Inheritance MediaInspectorBase Inheritance flash.events.EventDispatcher

MediaInspector is a stateless class that looks at a supplied URL and tries to determine the media type.

View the examples



Public Methods
 MethodDefined By
  
inspect(resource:String, maxBytesToRead:int, timeout:Number):void
[override] An asynchronous method to inspect a resource and try to determine which of the media types enumerated in the MediaType class the resource is referring to.
MediaInspector
Events
 Event Summary Defined By
 InheritedDispatched when the class is finished with the inspection.MediaInspectorBase
 InheritedDispatched when the class is in an error state.MediaInspectorBase
 InheritedDispatched when the inspection process has timed out, meaning no response from the server has been received.MediaInspectorBase
Public Constants
 ConstantDefined By
 InheritedINVALID_MAX_BYTES_TO_READ_ARGUMENT : String = Invalid argument for maxBytesToRead passed to method
[static]
MediaInspectorBase
 InheritedINVALID_TIMEOUT_ARGUMENT : String = Invalid argument for timeout passed to method
[static]
MediaInspectorBase
  TIMEOUT : Number = 5000
[static]
MediaInspector
Method Detail
inspect()method
override public function inspect(resource:String, maxBytesToRead:int, timeout:Number):void

An asynchronous method to inspect a resource and try to determine which of the media types enumerated in the MediaType class the resource is referring to.

Parameters

resource:String — The URL resource to inspect.
 
maxBytesToRead:int (default = NaN) — The maximum bytes the method will inspect before giving up. The default is 2 kilobytes. Note this only applies to cases where the class cannot determine the type by either the protocol or the file extension.
 
timeout:Number (default = NaN) — The number of milliseconds the class should wait for a request response. The default is 5000 (5 seconds).

See also

Constant Detail
TIMEOUTConstant
public static const TIMEOUT:Number = 5000

Examples
Example usage:
     mediaInspector = new MediaInspector();
     mediaInspector.addEventListener(MediaInspectorEvent.COMPLETE, onComplete);
     mediaInspector.addEventListener(MediaInspectorEvent.ERROR, onError);
     mediaInspector.addEventListener(MediaInspectorEvent.TIMEOUT, onTimeout);
     
     mediaInspector.inspect(url);
     
     private function onComplete(event:MediaInspectorEvent):void
     {
         switch (event.mediaType)
         {
             case MediaType.AMD_LIVE:
                 break;
             case MediaType.AMD_ONDEMAND:
                 break;
             case MediaType.AMD_PROGRESSIVE:
              break;
             case MediaType.FMS_MBR:
                 break;
             case MediaType.HDN_MBR:
                 break;
             case MediaType.HDN_SBR:
                 break;
             case MediaType.HDN_ADOBE_HTTP:
                 break;
             case MediaType.UNKNOWN:
                 break;
             }
         }