Package | org.osmf.media |
Class | public class MediaElement |
Inheritance | MediaElement EventDispatcher Object |
Subclasses | BeaconElement, CompositeElement, HTMLElement, LoadableElementBase, ProxyElement |
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Programmatically, a media element encapsulates a set of media traits and a state space. The media traits represent the capabilities of the media element and are dynamic in nature. At one moment in time a media element might be seekable, at another moment it might not be. For example, this could occur if the media element is a video sequence containing unskippable ads.
A media element operates on a media resource. For example, if the media element represents a video player, the media resource might encapsulate a URL to a video stream. If the media element represents a complex media composition, the media resource URL might be a document that references the multiple resources used in the media composition.
Related API Elements
MediaResourceBase
Property | Defined By | ||
---|---|---|---|
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
container : IMediaContainer [read-only]
The media container that this element uses. | MediaElement | ||
metadataNamespaceURLs : Vector.<String> [read-only]
A Vector containing the namespace URLs for all Metadata
objects stored within this MediaElement. | MediaElement | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | ||
resource : MediaResourceBase
The media resource that this media element operates on. | MediaElement | ||
traitTypes : Vector.<String> [read-only]
A Vector of MediaTraitType values representing the trait types on this
media element. | MediaElement |
Method | Defined By | ||
---|---|---|---|
Constructor. | MediaElement | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | ||
Adds a Metadata object to this MediaElement under the specified namespace URL. | MediaElement | ||
Dispatches an event into the event flow. | EventDispatcher | ||
Returns the Metadata object that is stored under this MediaElement with
the specified namespace URL. | MediaElement | ||
Returns the media trait of the specified type. | MediaElement | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | ||
Indicates whether an object has a specified property defined. | Object | ||
Determines whether this media element has a media trait of the
specified type. | MediaElement | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Removes a listener from the EventDispatcher object. | EventDispatcher | ||
Removes the Metadata object that was stored under this MediaElement with
the specified namespace URL. | MediaElement | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object | ||
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Method | Defined By | ||
---|---|---|---|
Adds a new media trait to this media element. | MediaElement | ||
Removes a media trait from this media element. | MediaElement | ||
Sets up the traits for this media element. | MediaElement |
Event | Summary | Defined By | ||
---|---|---|---|---|
[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | |||
Dispatched when the element's container property changed. | MediaElement | |||
[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | |||
Dispatched when an error which impacts the operation of the media element occurs. | MediaElement | |||
Dispatched when a Metadata object has been added to this media element. | MediaElement | |||
Dispatched when a Metadata object has been removed from this media element. | MediaElement | |||
Dispatched when a trait is added to the media element. | MediaElement | |||
Dispatched when a trait is removed from the media element. | MediaElement |
container | property |
container:IMediaContainer
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
The media container that this element uses.
Implementation
public function get container():IMediaContainer
metadataNamespaceURLs | property |
resource | property |
resource:MediaResourceBase
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
The media resource that this media element operates on.
Implementation
public function get resource():MediaResourceBase
public function set resource(value:MediaResourceBase):void
traitTypes | property |
MediaElement | () | Constructor |
public function MediaElement()
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Constructor.
addMetadata | () | method |
public function addMetadata(namespaceURL:String, metadata:Metadata):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Adds a Metadata object to this MediaElement under the specified namespace URL.
Parameters
namespaceURL:String — The namespace URL used to store the Metadata.
| |
metadata:Metadata — The Metadata to add.
|
Throws
ArgumentError — if namespaceURL or metadata is null.
|
addTrait | () | method |
protected function addTrait(type:String, instance:org.osmf.traits:MediaTraitBase):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Adds a new media trait to this media element. If successful, dispatches a MediaElementEvent.
Parameters
type:String — The MediaTraitType for the media trait to add.
| |
instance:org.osmf.traits:MediaTraitBase — The media trait to add.
|
Throws
ArgumentError — If either parameter is null , or
if the specified type and the type of the media trait don't match,
or if a different instance of the specific trait class has already
been added.
|
getMetadata | () | method |
public function getMetadata(namespaceURL:String):Metadata
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Returns the Metadata object that is stored under this MediaElement with the specified namespace URL.
Parameters
namespaceURL:String — The namespace URL of the Metadata object to retrieve.
|
Metadata |
Throws
ArgumentError — If namespaceURL is null.
|
getTrait | () | method |
public function getTrait(type:String):org.osmf.traits:MediaTraitBase
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Returns the media trait of the specified type.
Parameters
type:String — The MediaTraitType for the media trait to return.
|
org.osmf.traits:MediaTraitBase — The retrieved trait or null if no such trait exists on this
media element.
|
Throws
ArgumentError — If the parameter is null .
|
hasTrait | () | method |
public function hasTrait(type:String):Boolean
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Determines whether this media element has a media trait of the specified type.
Parameters
type:String — The MediaTraitType for the media trait to check for.
|
Boolean — true if this media element has a media
trait of the specified class, false otherwise.
|
Throws
ArgumentError — If the parameter is null .
|
removeMetadata | () | method |
public function removeMetadata(namespaceURL:String):Metadata
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Removes the Metadata object that was stored under this MediaElement with the specified namespace URL.
Parameters
namespaceURL:String — The namespace URL of the Metadata to remove.
|
Metadata |
Throws
ArgumentError — If namespaceURL is null.
|
removeTrait | () | method |
protected function removeTrait(type:String):org.osmf.traits:MediaTraitBase
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Removes a media trait from this media element. If successful, dispatches a MediaElementEvent.
Parameters
type:String — The MediaTraitType for the media trait to remove.
|
org.osmf.traits:MediaTraitBase — The removed trait or null if no trait was
removed.
|
Throws
ArgumentError — If the parameter is null .
|
setupTraits | () | method |
protected function setupTraits():void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Sets up the traits for this media element. Occurs during construction. Subclasses should override this method and call addTrait for each trait of their own.
containerChange | Event |
org.osmf.events.ContainerChangeEvent
property ContainerChangeEvent.type =
org.osmf.events.ContainerChangeEvent.CONTAINER_CHANGE
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when the element's container property changed.
The ContainerChangeEvent.CONTAINER_CHANGE constant defines the value of the type property of the event object for a containerChange event.mediaError | Event |
org.osmf.events.MediaErrorEvent
property MediaErrorEvent.type =
org.osmf.events.MediaErrorEvent.MEDIA_ERROR
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when an error which impacts the operation of the media element occurs.
The MediaErrorEvent.MEDIA_ERROR constant defines the value of the type property of the event object for a mediaError event.metadataAdd | Event |
org.osmf.events.MediaElementEvent
property MediaElementEvent.type =
org.osmf.events.MediaElementEvent.METADATA_ADD
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when a Metadata object has been added to this media element.
The MediaElementEvent.METADATA_ADD constant defines the value of the type property of the event object for a metadataAdd event.metadataRemove | Event |
org.osmf.events.MediaElementEvent
property MediaElementEvent.type =
org.osmf.events.MediaElementEvent.METADATA_REMOVE
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when a Metadata object has been removed from this media element.
The MediaElementEvent.METADATA_REMOVE constant defines the value of the type property of the event object for a metadataRemove event.traitAdd | Event |
org.osmf.events.MediaElementEvent
property MediaElementEvent.type =
org.osmf.events.MediaElementEvent.TRAIT_ADD
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when a trait is added to the media element.
The MediaElementEvent.TRAIT_ADD constant defines the value of the type property of the event object for a traitAdd event.traitRemove | Event |
org.osmf.events.MediaElementEvent
property MediaElementEvent.type =
org.osmf.events.MediaElementEvent.TRAIT_REMOVE
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when a trait is removed from the media element.
The MediaElementEvent.TRAIT_REMOVE constant defines the value of the type property of the event object for a traitRemove event.Mon Nov 28 2011, 06:48 AM -08:00