| Package | com.devnet.osmf.application |
| Class | public class MediaDisplay |
| Inheritance | MediaDisplay flash.display.Sprite |
| Language Version : | ActionScript 3.0 |
| Runtime Versions : | AIR 1.0, Flash Player 10.0.0 |
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
| Property | Defined 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 | ||
| Method | Defined 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 | ||
| Method | Defined 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 | ||
| 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 | ||||
| Constant | Defined 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 | ||
| autoPlay | property |
autoPlay:BooleanSets the media to auto play when ready.
public function get autoPlay():Boolean public function set autoPlay(value:Boolean):void| autoRewind | property |
autoRewind:BooleanSets the media to rewind to the beginning upon completion.
public function get autoRewind():Boolean public function set autoRewind(value:Boolean):void| backgroundAlpha | property |
backgroundAlpha:NumberSets the background alpha of the OSMF container.
public function get backgroundAlpha():Number public function set backgroundAlpha(value:Number):void| backgroundColor | property |
backgroundColor:NumberSets the background color of the OSMF container.
public function get backgroundColor():Number public function set backgroundColor(value:Number):void| boundingBox | property |
public var boundingBox:Sprite| buffering | property |
buffering:Boolean [read-only] True if the media is buffering.
public function get buffering():Boolean| bufferLength | property |
bufferLength:Number [read-only] Length of the media buffer.
public function get bufferLength():Number| bufferTime | property |
bufferTime:NumberSets the buffer time for the media.
public function get bufferTime():Number public function set bufferTime(value:Number):void| bytesLoaded | property |
bytesLoaded:uint [read-only] Number of bytes loaded for the current media.
public function get bytesLoaded():uint| bytesTotal | property |
bytesTotal:uint [read-only] Number of bytes total for the current media.
public function get bytesTotal():uint| clipChildren | property |
clipChildren:BooleanSets the clipChildren property of the OSMF container.
public function get clipChildren():Boolean public function set clipChildren(value:Boolean):void| configFile | property |
configFile:StringSets 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.
public function get configFile():String public function set configFile(value:String):void| configuration | property |
configuration:Configuration [read-only] Reference to the Configuration object.
public function get configuration():Configuration| container | property |
container:MediaContainer [read-only] Reference to the OSMF MediaContainer object.
public function get container():MediaContainer| cuePoints | property |
cuePoints:ArrayAn array of cue point objects each containing a name, time, and parameters property.
public function get cuePoints():Array public function set cuePoints(value:Array):void| cuePointsLoaded | property |
cuePointsLoaded:Boolean [read-only] True if cue points have been initialized for the current media.
public function get cuePointsLoaded():Boolean| factory | property |
factory:MediaFactory [read-only] Reference to the OSMF MediaFactory object.
public function get factory():MediaFactory| horizontalAlign | property |
horizontalAlign:StringThe horizontal alignment of the media in the OSMF container (left, center, right).
public function get horizontalAlign():String public function set horizontalAlign(value:String):void| loop | property |
loop:BooleanSets the media to loop upon completion.
public function get loop():Boolean public function set loop(value:Boolean):void| media | property |
media:MediaElement [read-only] Reference to the current OSMF MediaElement object.
public function get media():MediaElement| paused | property |
paused:Boolean [read-only] True if the media is paused.
public function get paused():Boolean| player | property |
player:MediaPlayer [read-only] Reference to the OSMF MediaPlayer object.
public function get player():MediaPlayer| playheadTime | property |
playheadTime:Number [read-only] The playhead time of the current media.
public function get playheadTime():Number| playing | property |
playing:Boolean [read-only] True if the media is playing.
public function get playing():Boolean| scaleMode | property |
scaleMode:StringDefines how the media will within the OSMF container area (none, letterbox, stretch, zoom).
public function get scaleMode():String public function set scaleMode(value:String):void| source | property |
source:StringSets the source URL for the media and overrides the configFile property.
public function get source():String public function set source(value:String):void| state | property |
state:String [read-only] The state of the current media.
public function get state():String| totalTime | property |
totalTime:Number [read-only] The total time duration of the current media.
public function get totalTime():Number| verticalAlign | property |
verticalAlign:StringThe vertical alignment of the media in the OSMF container (top, middle, bottom).
public function get verticalAlign():String public function set verticalAlign(value:String):void| volume | property |
volume:NumberSets the volume of the media (0-1).
public function get volume():Number public function set volume(value:Number):void| MediaDisplay | () | Constructor |
public function MediaDisplay()| addASCuePoint | () | method |
public function addASCuePoint(time:Number, name:String, parameters:Object = null):voidAdds 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):BooleanReturns true if the media player currently supports a capability.
Parameters
value:String — The capability to evaluate.
|
Boolean —
|
| canSeekTo | () | method |
public function canSeekTo(time:Number):BooleanReturns true if the media can seek to a specified time.
Parameters
time:Number — Time to evaluate against.
|
Boolean —
|
| findCuePoint | () | method |
public function findCuePoint(time:Number, type:String = null):ObjectSearches 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.
|
Object — Returns the cue point object if the match exists.
|
| findNearestCuePoint | () | method |
public function findNearestCuePoint(time:Number, type:String = null):ObjectFinds 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.
|
Object — Returns the cue point object if a match exists.
|
| has | () | method |
public function has(value:String):BooleanReturns true if the media player currently supports a feature.
Parameters
value:String — Feature to evaluate.
|
Boolean — Returns true if feature is supported.
|
| load | () | method |
public function load(src:String, duration:Number, isLive:Boolean = false):voidLoads 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):voidLoads a plugin from a resource URL.
Parameters
resource:String — The URL resource as a String.
|
| onCapabilityChange | () | method |
protected function onCapabilityChange(event:MediaPlayerCapabilityChangeEvent):voidParameters
event:MediaPlayerCapabilityChangeEvent |
| onConfigError | () | method |
protected function onConfigError(event:IOErrorEvent):voidParameters
event:IOErrorEvent |
| onConfigLoaded | () | method |
protected function onConfigLoaded(event:Event):voidParameters
event:Event |
| onCuePoint | () | method |
protected function onCuePoint(event:TimelineMetadataEvent):voidParameters
event:TimelineMetadataEvent |
| onCuePointAdd | () | method |
protected function onCuePointAdd(event:TimelineMetadataEvent):voidParameters
event:TimelineMetadataEvent |
| onMediaError | () | method |
protected function onMediaError(event:MediaErrorEvent):voidParameters
event:MediaErrorEvent |
| onMetadataAdd | () | method |
protected function onMetadataAdd(event:MediaElementEvent):voidParameters
event:MediaElementEvent |
| onPlaybackChange | () | method |
protected function onPlaybackChange(event:TimeEvent):voidParameters
event:TimeEvent |
| onPluginError | () | method |
protected function onPluginError(event:MediaFactoryEvent):voidParameters
event:MediaFactoryEvent |
| onPluginLoaded | () | method |
protected function onPluginLoaded(event:MediaFactoryEvent):voidParameters
event:MediaFactoryEvent |
| onProgressChange | () | method |
protected function onProgressChange(event:LoadEvent):voidParameters
event:LoadEvent |
| onSeekChange | () | method |
protected function onSeekChange(event:SeekEvent):voidParameters
event:SeekEvent |
| onStateChange | () | method |
protected function onStateChange(event:MediaPlayerStateChangeEvent):voidParameters
event:MediaPlayerStateChangeEvent |
| pause | () | method |
public function pause():voidPauses the media file.
| play | () | method |
public function play():voidPlays the media file.
| removeASCuePoint | () | method |
public function removeASCuePoint(time:Number):ObjectRemoves an ActionScript cue point from the player.
Parameters
time:Number — Time in seconds of the cuepoint to remove.
|
Object — Returns the removed cue point object.
|
| seek | () | method |
public function seek(time:Number):voidSeeks to a timecode in the media.
Parameters
time:Number — Number to seek to in seconds.
|
| setMedia | () | method |
public function setMedia(value:MediaElement):voidSet the media source in the player.
Parameters
value:MediaElement — Media element object.
|
| setSize | () | method |
public function setSize(w:Number, h:Number):voidSets 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():voidStops the media from playing.
| autoRewind | Event |
com.dancarrdesign.osmf.events.MediaEvent| bufferingStateEntered | Event |
com.dancarrdesign.osmf.events.MediaEvent| close | Event |
com.dancarrdesign.osmf.events.MediaEvent| complete | Event |
com.dancarrdesign.osmf.events.MediaEvent| configError | Event |
com.dancarrdesign.osmf.events.MediaEvent| configLoaded | Event |
com.dancarrdesign.osmf.events.MediaEvent| cuePoint | Event |
com.dancarrdesign.osmf.events.CuePointEvent| durationChange | Event |
com.dancarrdesign.osmf.events.MediaEvent| mediaElementCreate | Event |
org.osmf.events.MediaFactoryEvent| mediaError | Event |
org.osmf.events.MediaErrorEvent| mediaPlayerStateChange | Event |
org.osmf.events.MediaPlayerStateChangeEvent| mediaProgress | Event |
com.dancarrdesign.osmf.events.ProgressEvent| pausedStateEntered | Event |
com.dancarrdesign.osmf.events.MediaEvent| playbackError | Event |
com.dancarrdesign.osmf.events.MediaEvent| playheadUpdate | Event |
com.dancarrdesign.osmf.events.MediaEvent| playingStateEntered | Event |
com.dancarrdesign.osmf.events.MediaEvent| pluginLoad | Event |
org.osmf.events.MediaFactoryEvent| pluginLoadError | Event |
org.osmf.events.MediaFactoryEvent| ready | Event |
com.dancarrdesign.osmf.events.MediaEvent| seeked | Event |
com.dancarrdesign.osmf.events.MediaEvent| stateChange | Event |
com.dancarrdesign.osmf.events.MediaEvent| stoppedStateEntered | Event |
com.dancarrdesign.osmf.events.MediaEvent| volumeChanged | Event |
com.dancarrdesign.osmf.events.MediaEvent| ALIGN_BOTTOM | Constant |
public static const ALIGN_BOTTOM:String = bottom| ALIGN_CENTER | Constant |
public static const ALIGN_CENTER:String = center| ALIGN_LEFT | Constant |
public static const ALIGN_LEFT:String = left| ALIGN_MIDDLE | Constant |
public static const ALIGN_MIDDLE:String = middle| ALIGN_RIGHT | Constant |
public static const ALIGN_RIGHT:String = right| ALIGN_TOP | Constant |
public static const ALIGN_TOP:String = top| CAPABILITY_BUFFER | Constant |
public static const CAPABILITY_BUFFER:String = buffer| CAPABILITY_LOAD | Constant |
public static const CAPABILITY_LOAD:String = load| CAPABILITY_PAUSE | Constant |
public static const CAPABILITY_PAUSE:String = pause| CAPABILITY_PLAY | Constant |
public static const CAPABILITY_PLAY:String = play| CAPABILITY_SEEK | Constant |
public static const CAPABILITY_SEEK:String = seek| FEATURE_AUDIO | Constant |
public static const FEATURE_AUDIO:String = audio| FEATURE_DRM | Constant |
public static const FEATURE_DRM:String = drm| FEATURE_DVR | Constant |
public static const FEATURE_DVR:String = dvr| FEATURE_DYNAMIC_STREAM | Constant |
public static const FEATURE_DYNAMIC_STREAM:String = dynamicStream| SCALEMODE_LETTERBOX | Constant |
public static const SCALEMODE_LETTERBOX:String = letterbox| SCALEMODE_NONE | Constant |
public static const SCALEMODE_NONE:String = none| SCALEMODE_STRETCH | Constant |
public static const SCALEMODE_STRETCH:String = stretch| SCALEMODE_ZOOM | Constant |
public static const SCALEMODE_ZOOM:String = zoom