Packagecom.devnet.osmf.application
Classpublic class MediaDisplay
InheritanceMediaDisplay Inheritance flash.display.Sprite

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10.0.0

The MediaDisplay class instantiates the OSMF objects necessary to create a media player and wraps them in a component similar to the Flash FLVPlayback component. Use the MediaDisplay as a standalone media display area or combine it with the ControlBar component to add user interface controls.

Example: This example shows how to configure a MediaDisplay instance as a standalone player.

    
    import com.dancarrdesign.osmf.application.MediaDisplay;
    import com.dancarrdesign.osmf.events.CuePointEvent;
            
    // Create player.
    var mediaDisplay:MediaDisplay = new MediaDisplay();
    mediaDisplay.autoPlay = true;
    mediaDisplay.loop = true;
    mediaDisplay.addASCuePoint(0, "Cuepoint at 0 seconds");
    mediaDisplay.addASCuePoint(4, "Cuepoint at 4 seconds");
    mediaDisplay.addASCuePoint(8, "Cuepoint at 8 seconds");
    mediaDisplay.addEventListener(CuePointEvent.CUE_POINT, onCuePoint);
    mediaDisplay.setSize(768, 428);
    mediaDisplay.source = "http://mediapm.edgesuite.net/osmf/content/test/manifest-files/dynamic_Streaming.f4m";
    addChild(mediaDisplay);
            
    // Respond to cue point events.
    function onCuePoint( event:CuePointEvent ):void
    {
        trace(event.name + ", time = " + event.time);
    }
     

See also

Configuration
ControlBar


Public Properties
 PropertyDefined By
  autoPlay : Boolean
Sets the media to auto play when ready.
MediaDisplay
  autoRewind : Boolean
Sets the media to rewind to the beginning upon completion.
MediaDisplay
  backgroundAlpha : Number
Sets the background alpha of the OSMF container.
MediaDisplay
  backgroundColor : Number
Sets the background color of the OSMF container.
MediaDisplay
  boundingBox : Sprite
MediaDisplay
  buffering : Boolean
[read-only] True if the media is buffering.
MediaDisplay
  bufferLength : Number
[read-only] Length of the media buffer.
MediaDisplay
  bufferTime : Number
Sets the buffer time for the media.
MediaDisplay
  bytesLoaded : uint
[read-only] Number of bytes loaded for the current media.
MediaDisplay
  bytesTotal : uint
[read-only] Number of bytes total for the current media.
MediaDisplay
  clipChildren : Boolean
Sets the clipChildren property of the OSMF container.
MediaDisplay
  configFile : String
Sets the URL of the configuration file containing OSMF media playlist information written in custom XML markup.
MediaDisplay
  configuration : Configuration
[read-only] Reference to the Configuration object.
MediaDisplay
  container : MediaContainer
[read-only] Reference to the OSMF MediaContainer object.
MediaDisplay
  cuePoints : Array
An array of cue point objects each containing a name, time, and parameters property.
MediaDisplay
  cuePointsLoaded : Boolean
[read-only] True if cue points have been initialized for the current media.
MediaDisplay
  factory : MediaFactory
[read-only] Reference to the OSMF MediaFactory object.
MediaDisplay
  horizontalAlign : String
The horizontal alignment of the media in the OSMF container (left, center, right).
MediaDisplay
  loop : Boolean
Sets the media to loop upon completion.
MediaDisplay
  media : MediaElement
[read-only] Reference to the current OSMF MediaElement object.
MediaDisplay
  paused : Boolean
[read-only] True if the media is paused.
MediaDisplay
  player : MediaPlayer
[read-only] Reference to the OSMF MediaPlayer object.
MediaDisplay
  playheadTime : Number
[read-only] The playhead time of the current media.
MediaDisplay
  playing : Boolean
[read-only] True if the media is playing.
MediaDisplay
  scaleMode : String
Defines how the media will within the OSMF container area (none, letterbox, stretch, zoom).
MediaDisplay
  source : String
Sets the source URL for the media and overrides the configFile property.
MediaDisplay
  state : String
[read-only] The state of the current media.
MediaDisplay
  totalTime : Number
[read-only] The total time duration of the current media.
MediaDisplay
  verticalAlign : String
The vertical alignment of the media in the OSMF container (top, middle, bottom).
MediaDisplay
  volume : Number
Sets the volume of the media (0-1).
MediaDisplay
Public Methods
 MethodDefined By
  
MediaDisplay
  
addASCuePoint(time:Number, name:String, parameters:Object = null):void
Adds an ActionScript cue point marker to the media.
MediaDisplay
  
can(value:String):Boolean
Returns true if the media player currently supports a capability.
MediaDisplay
  
canSeekTo(time:Number):Boolean
Returns true if the media can seek to a specified time.
MediaDisplay
  
findCuePoint(time:Number, type:String = null):Object
Searches for a cue point at a specified time.
MediaDisplay
  
findNearestCuePoint(time:Number, type:String = null):Object
Finds the nearest cue point to a specific time.
MediaDisplay
  
has(value:String):Boolean
Returns true if the media player currently supports a feature.
MediaDisplay
  
load(src:String, duration:Number, isLive:Boolean = false):void
Loads media source from a URL.
MediaDisplay
  
loadPlugin(resource:String):void
Loads a plugin from a resource URL.
MediaDisplay
  
pause():void
Pauses the media file.
MediaDisplay
  
play():void
Plays the media file.
MediaDisplay
  
removeASCuePoint(time:Number):Object
Removes an ActionScript cue point from the player.
MediaDisplay
  
seek(time:Number):void
Seeks to a timecode in the media.
MediaDisplay
  
setMedia(value:MediaElement):void
Set the media source in the player.
MediaDisplay
  
setSize(w:Number, h:Number):void
Sets the size of the media display area.
MediaDisplay
  
stop():void
Stops the media from playing.
MediaDisplay
Protected Methods
 MethodDefined By
  
onCapabilityChange(event:MediaPlayerCapabilityChangeEvent):void
MediaDisplay
  
onConfigError(event:IOErrorEvent):void
MediaDisplay
  
onConfigLoaded(event:Event):void
MediaDisplay
  
onCuePoint(event:TimelineMetadataEvent):void
MediaDisplay
  
onCuePointAdd(event:TimelineMetadataEvent):void
MediaDisplay
  
onMediaError(event:MediaErrorEvent):void
MediaDisplay
  
onMetadataAdd(event:MediaElementEvent):void
MediaDisplay
  
onPlaybackChange(event:TimeEvent):void
MediaDisplay
  
onPluginError(event:MediaFactoryEvent):void
MediaDisplay
  
onPluginLoaded(event:MediaFactoryEvent):void
MediaDisplay
  
onProgressChange(event:LoadEvent):void
MediaDisplay
  
onSeekChange(event:SeekEvent):void
MediaDisplay
  
onStateChange(event:MediaPlayerStateChangeEvent):void
MediaDisplay
Events
 Event Summary Defined By
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
  MediaDisplay
Public Constants
 ConstantDefined By
  ALIGN_BOTTOM : String = bottom
[static]
MediaDisplay
  ALIGN_CENTER : String = center
[static]
MediaDisplay
  ALIGN_LEFT : String = left
[static]
MediaDisplay
  ALIGN_MIDDLE : String = middle
[static]
MediaDisplay
  ALIGN_RIGHT : String = right
[static]
MediaDisplay
  ALIGN_TOP : String = top
[static]
MediaDisplay
  CAPABILITY_BUFFER : String = buffer
[static]
MediaDisplay
  CAPABILITY_LOAD : String = load
[static]
MediaDisplay
  CAPABILITY_PAUSE : String = pause
[static]
MediaDisplay
  CAPABILITY_PLAY : String = play
[static]
MediaDisplay
  CAPABILITY_SEEK : String = seek
[static]
MediaDisplay
  FEATURE_AUDIO : String = audio
[static]
MediaDisplay
  FEATURE_DRM : String = drm
[static]
MediaDisplay
  FEATURE_DVR : String = dvr
[static]
MediaDisplay
  FEATURE_DYNAMIC_STREAM : String = dynamicStream
[static]
MediaDisplay
  SCALEMODE_LETTERBOX : String = letterbox
[static]
MediaDisplay
  SCALEMODE_NONE : String = none
[static]
MediaDisplay
  SCALEMODE_STRETCH : String = stretch
[static]
MediaDisplay
  SCALEMODE_ZOOM : String = zoom
[static]
MediaDisplay
Property Detail
autoPlayproperty
autoPlay:Boolean

Sets the media to auto play when ready.


Implementation
    public function get autoPlay():Boolean
    public function set autoPlay(value:Boolean):void
autoRewindproperty 
autoRewind:Boolean

Sets the media to rewind to the beginning upon completion.


Implementation
    public function get autoRewind():Boolean
    public function set autoRewind(value:Boolean):void
backgroundAlphaproperty 
backgroundAlpha:Number

Sets the background alpha of the OSMF container.


Implementation
    public function get backgroundAlpha():Number
    public function set backgroundAlpha(value:Number):void
backgroundColorproperty 
backgroundColor:Number

Sets the background color of the OSMF container.


Implementation
    public function get backgroundColor():Number
    public function set backgroundColor(value:Number):void
boundingBoxproperty 
public var boundingBox:Sprite

bufferingproperty 
buffering:Boolean  [read-only]

True if the media is buffering.


Implementation
    public function get buffering():Boolean
bufferLengthproperty 
bufferLength:Number  [read-only]

Length of the media buffer.


Implementation
    public function get bufferLength():Number
bufferTimeproperty 
bufferTime:Number

Sets the buffer time for the media.


Implementation
    public function get bufferTime():Number
    public function set bufferTime(value:Number):void
bytesLoadedproperty 
bytesLoaded:uint  [read-only]

Number of bytes loaded for the current media.


Implementation
    public function get bytesLoaded():uint
bytesTotalproperty 
bytesTotal:uint  [read-only]

Number of bytes total for the current media.


Implementation
    public function get bytesTotal():uint
clipChildrenproperty 
clipChildren:Boolean

Sets the clipChildren property of the OSMF container.


Implementation
    public function get clipChildren():Boolean
    public function set clipChildren(value:Boolean):void
configFileproperty 
configFile:String

Sets the URL of the configuration file containing OSMF media playlist information written in custom XML markup. Note that this property is ignored if the source property is set.


Implementation
    public function get configFile():String
    public function set configFile(value:String):void
configurationproperty 
configuration:Configuration  [read-only]

Reference to the Configuration object.


Implementation
    public function get configuration():Configuration
containerproperty 
container:MediaContainer  [read-only]

Reference to the OSMF MediaContainer object.


Implementation
    public function get container():MediaContainer
cuePointsproperty 
cuePoints:Array

An array of cue point objects each containing a name, time, and parameters property.


Implementation
    public function get cuePoints():Array
    public function set cuePoints(value:Array):void
cuePointsLoadedproperty 
cuePointsLoaded:Boolean  [read-only]

True if cue points have been initialized for the current media.


Implementation
    public function get cuePointsLoaded():Boolean
factoryproperty 
factory:MediaFactory  [read-only]

Reference to the OSMF MediaFactory object.


Implementation
    public function get factory():MediaFactory
horizontalAlignproperty 
horizontalAlign:String

The horizontal alignment of the media in the OSMF container (left, center, right).


Implementation
    public function get horizontalAlign():String
    public function set horizontalAlign(value:String):void
loopproperty 
loop:Boolean

Sets the media to loop upon completion.


Implementation
    public function get loop():Boolean
    public function set loop(value:Boolean):void
mediaproperty 
media:MediaElement  [read-only]

Reference to the current OSMF MediaElement object.


Implementation
    public function get media():MediaElement
pausedproperty 
paused:Boolean  [read-only]

True if the media is paused.


Implementation
    public function get paused():Boolean
playerproperty 
player:MediaPlayer  [read-only]

Reference to the OSMF MediaPlayer object.


Implementation
    public function get player():MediaPlayer
playheadTimeproperty 
playheadTime:Number  [read-only]

The playhead time of the current media.


Implementation
    public function get playheadTime():Number
playingproperty 
playing:Boolean  [read-only]

True if the media is playing.


Implementation
    public function get playing():Boolean
scaleModeproperty 
scaleMode:String

Defines how the media will within the OSMF container area (none, letterbox, stretch, zoom).


Implementation
    public function get scaleMode():String
    public function set scaleMode(value:String):void
sourceproperty 
source:String

Sets the source URL for the media and overrides the configFile property.


Implementation
    public function get source():String
    public function set source(value:String):void
stateproperty 
state:String  [read-only]

The state of the current media.


Implementation
    public function get state():String
totalTimeproperty 
totalTime:Number  [read-only]

The total time duration of the current media.


Implementation
    public function get totalTime():Number
verticalAlignproperty 
verticalAlign:String

The vertical alignment of the media in the OSMF container (top, middle, bottom).


Implementation
    public function get verticalAlign():String
    public function set verticalAlign(value:String):void
volumeproperty 
volume:Number

Sets the volume of the media (0-1).


Implementation
    public function get volume():Number
    public function set volume(value:Number):void
Constructor Detail
MediaDisplay()Constructor
public function MediaDisplay()



Method Detail
addASCuePoint()method
public function addASCuePoint(time:Number, name:String, parameters:Object = null):void

Adds an ActionScript cue point marker to the media.

Parameters

time:Number — Time at which the cue point occurs
 
name:String — Name of the cue point.
 
parameters:Object (default = null) — Parameters (name/value pairs) to associate with the cue point.

can()method 
public function can(value:String):Boolean

Returns true if the media player currently supports a capability.

Parameters

value:String — The capability to evaluate.

Returns
Boolean
canSeekTo()method 
public function canSeekTo(time:Number):Boolean

Returns true if the media can seek to a specified time.

Parameters

time:Number — Time to evaluate against.

Returns
Boolean
findCuePoint()method 
public function findCuePoint(time:Number, type:String = null):Object

Searches for a cue point at a specified time.

Parameters

time:Number — Time in seconds to evaluate.
 
type:String (default = null) — Type of cue point to search for.

Returns
Object — Returns the cue point object if the match exists.
findNearestCuePoint()method 
public function findNearestCuePoint(time:Number, type:String = null):Object

Finds the nearest cue point to a specific time.

Parameters

time:Number — Time to evaluate against.
 
type:String (default = null) — Type of cue point to match.

Returns
Object — Returns the cue point object if a match exists.
has()method 
public function has(value:String):Boolean

Returns true if the media player currently supports a feature.

Parameters

value:String — Feature to evaluate.

Returns
Boolean — Returns true if feature is supported.
load()method 
public function load(src:String, duration:Number, isLive:Boolean = false):void

Loads media source from a URL.

Parameters

src:String — URL of media.
 
duration:Number (default = NaN) — Total time of media (currently ignored - used for compatibility with FLVPlayback code).
 
isLive:Boolean (default = false) — Defines whether the media is live video streaming from a Flash Media Server (currently ignored).

loadPlugin()method 
public function loadPlugin(resource:String):void

Loads a plugin from a resource URL.

Parameters

resource:String — The URL resource as a String.

onCapabilityChange()method 
protected function onCapabilityChange(event:MediaPlayerCapabilityChangeEvent):void

Parameters

event:MediaPlayerCapabilityChangeEvent

onConfigError()method 
protected function onConfigError(event:IOErrorEvent):void

Parameters

event:IOErrorEvent

onConfigLoaded()method 
protected function onConfigLoaded(event:Event):void

Parameters

event:Event

onCuePoint()method 
protected function onCuePoint(event:TimelineMetadataEvent):void

Parameters

event:TimelineMetadataEvent

onCuePointAdd()method 
protected function onCuePointAdd(event:TimelineMetadataEvent):void

Parameters

event:TimelineMetadataEvent

onMediaError()method 
protected function onMediaError(event:MediaErrorEvent):void

Parameters

event:MediaErrorEvent

onMetadataAdd()method 
protected function onMetadataAdd(event:MediaElementEvent):void

Parameters

event:MediaElementEvent

onPlaybackChange()method 
protected function onPlaybackChange(event:TimeEvent):void

Parameters

event:TimeEvent

onPluginError()method 
protected function onPluginError(event:MediaFactoryEvent):void

Parameters

event:MediaFactoryEvent

onPluginLoaded()method 
protected function onPluginLoaded(event:MediaFactoryEvent):void

Parameters

event:MediaFactoryEvent

onProgressChange()method 
protected function onProgressChange(event:LoadEvent):void

Parameters

event:LoadEvent

onSeekChange()method 
protected function onSeekChange(event:SeekEvent):void

Parameters

event:SeekEvent

onStateChange()method 
protected function onStateChange(event:MediaPlayerStateChangeEvent):void

Parameters

event:MediaPlayerStateChangeEvent

pause()method 
public function pause():void

Pauses the media file.

play()method 
public function play():void

Plays the media file.

removeASCuePoint()method 
public function removeASCuePoint(time:Number):Object

Removes an ActionScript cue point from the player.

Parameters

time:Number — Time in seconds of the cuepoint to remove.

Returns
Object — Returns the removed cue point object.
seek()method 
public function seek(time:Number):void

Seeks to a timecode in the media.

Parameters

time:Number — Number to seek to in seconds.

setMedia()method 
public function setMedia(value:MediaElement):void

Set the media source in the player.

Parameters

value:MediaElement — Media element object.

setSize()method 
public function setSize(w:Number, h:Number):void

Sets the size of the media display area.

Parameters

w:Number — Number representing the new width.
 
h:Number — Number representing the new height.

stop()method 
public function stop():void

Stops the media from playing.

Event Detail
autoRewind Event
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

bufferingStateEntered Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

close Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

complete Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

configError Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

configLoaded Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

cuePoint Event  
Event Object Type: com.dancarrdesign.osmf.events.CuePointEvent

durationChange Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

mediaElementCreate Event  
Event Object Type: org.osmf.events.MediaFactoryEvent

mediaError Event  
Event Object Type: org.osmf.events.MediaErrorEvent

mediaPlayerStateChange Event  
Event Object Type: org.osmf.events.MediaPlayerStateChangeEvent

mediaProgress Event  
Event Object Type: com.dancarrdesign.osmf.events.ProgressEvent

pausedStateEntered Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

playbackError Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

playheadUpdate Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

playingStateEntered Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

pluginLoad Event  
Event Object Type: org.osmf.events.MediaFactoryEvent

pluginLoadError Event  
Event Object Type: org.osmf.events.MediaFactoryEvent

ready Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

seeked Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

stateChange Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

stoppedStateEntered Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

volumeChanged Event  
Event Object Type: com.dancarrdesign.osmf.events.MediaEvent

Constant Detail
ALIGN_BOTTOMConstant
public static const ALIGN_BOTTOM:String = bottom

ALIGN_CENTERConstant 
public static const ALIGN_CENTER:String = center

ALIGN_LEFTConstant 
public static const ALIGN_LEFT:String = left

ALIGN_MIDDLEConstant 
public static const ALIGN_MIDDLE:String = middle

ALIGN_RIGHTConstant 
public static const ALIGN_RIGHT:String = right

ALIGN_TOPConstant 
public static const ALIGN_TOP:String = top

CAPABILITY_BUFFERConstant 
public static const CAPABILITY_BUFFER:String = buffer

CAPABILITY_LOADConstant 
public static const CAPABILITY_LOAD:String = load

CAPABILITY_PAUSEConstant 
public static const CAPABILITY_PAUSE:String = pause

CAPABILITY_PLAYConstant 
public static const CAPABILITY_PLAY:String = play

CAPABILITY_SEEKConstant 
public static const CAPABILITY_SEEK:String = seek

FEATURE_AUDIOConstant 
public static const FEATURE_AUDIO:String = audio

FEATURE_DRMConstant 
public static const FEATURE_DRM:String = drm

FEATURE_DVRConstant 
public static const FEATURE_DVR:String = dvr

FEATURE_DYNAMIC_STREAMConstant 
public static const FEATURE_DYNAMIC_STREAM:String = dynamicStream

SCALEMODE_LETTERBOXConstant 
public static const SCALEMODE_LETTERBOX:String = letterbox

SCALEMODE_NONEConstant 
public static const SCALEMODE_NONE:String = none

SCALEMODE_STRETCHConstant 
public static const SCALEMODE_STRETCH:String = stretch

SCALEMODE_ZOOMConstant 
public static const SCALEMODE_ZOOM:String = zoom