Paquete | org.osmf.media |
Clase | public class MediaFactory |
Herencia | MediaFactory EventDispatcher Object |
Subclases | DefaultMediaFactory |
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
The factory operation takes a MediaResourceBase as input and produces a MediaElement as output.
The MediaFactory maintains a list of MediaFactoryItem objects, each of which encapsulates all the information necessary to create a specific MediaElement. The MediaFactory relies on the canHandleResourceFunction method of each MediaFactoryItem to find a MediaFactoryItem object that can handle the specified MediaResourceBase.
The factory interface also exposes methods for querying for specific MediaFactoryItem objects, and for loading plugins (which hold MediaFactoryItem objects).
Elementos de API relacionados
Propiedad | Definido por | ||
---|---|---|---|
constructor : Object
Una referencia a la clase de objeto o función constructora para una instancia de objeto determinada. | Object | ||
numItems : int [solo lectura]
The number of MediaFactoryItems managed by the factory. | MediaFactory |
Método | Definido por | ||
---|---|---|---|
Constructor. | MediaFactory | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra un objeto de detector de eventos con un objeto EventDispatcher, de modo que el detector reciba la notificación de un evento. | EventDispatcher | ||
Adds the specified MediaFactoryItem to the factory. | MediaFactory | ||
Returns a MediaElement that can be created based on the specified
MediaResourceBase. | MediaFactory | ||
Distribuye un evento en el flujo del evento. | EventDispatcher | ||
Gets the MediaFactoryItem at the specified index. | MediaFactory | ||
Returns the MediaFactoryItem with the specified ID or null if the
specified MediaFactoryItem does not exist in this factory. | MediaFactory | ||
Comprueba si el objeto EventDispatcher tiene detectores registrados para un tipo concreto de evento. | EventDispatcher | ||
Indica si un objeto tiene definida una propiedad especificada. | Object | ||
Indica si hay una instancia de la clase Object en la cadena de prototipo del objeto especificado como parámetro. | Object | ||
Load a plugin identified by the specified resource. | MediaFactory | ||
Indica si existe la propiedad especificada y si es enumerable. | Object | ||
Elimina un detector del objeto EventDispatcher. | EventDispatcher | ||
Removes the specified MediaFactoryItem from the factory. | MediaFactory | ||
Establece la disponibilidad de una propiedad dinámica para operaciones de bucle. | Object | ||
Devuelve la representación de cadena de este objeto, con formato según las convenciones específicas de configuración regional. | Object | ||
Devuelve la representación de cadena del objeto especificado. | Object | ||
Devuelve el valor simple del objeto especificado. | Object | ||
Comprueba si hay registrado un detector de eventos con este objeto EventDispatcher o con cualquiera de sus ascendientes para el tipo de evento concreto. | EventDispatcher |
Método | Definido por | ||
---|---|---|---|
Returns the most appropriate MediaFactoryItem for the specified resource
out of the MediaFactoryItems in the specified list. | MediaFactory |
Evento | Resumen | Definido por | ||
---|---|---|---|---|
[evento broadcast] Se distribuye cuando Flash Player o AIR pasan a estar activos. | EventDispatcher | |||
[evento broadcast] Se distribuye cuando Flash Player o de AIR pasan a estar inactivos. | EventDispatcher | |||
Dispatched when the MediaFactory has created a MediaElement. | MediaFactory | |||
Dispatched when the MediaFactory has successfully loaded a plugin. | MediaFactory | |||
Dispatched when the MediaFactory has failed to load a plugin due to an error. | MediaFactory |
numItems | propiedad |
MediaFactory | () | Información sobre |
public function MediaFactory()
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Constructor.
addItem | () | método |
public function addItem(item:MediaFactoryItem):void
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Adds the specified MediaFactoryItem to the factory. After the MediaFactoryItem has been added, for any MediaResourceBase that this MediaFactoryItem can handle, the factory will be able to create the corresponding media element. If a MediaFactoryItem with the same ID already exists in this factory, the new MediaFactoryItem object replaces it.
Parámetros
item:MediaFactoryItem — The MediaFactoryItem to add.
|
Emite
ArgumentError — If the argument is null or if the argument
has a null ID field.
|
createMediaElement | () | método |
public function createMediaElement(resource:MediaResourceBase):MediaElement
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Returns a MediaElement that can be created based on the specified MediaResourceBase.
Returns null
if the factory cannot
find a MediaFactoryItem object
capable of creating such a MediaElement in this factory.
Parámetros
resource:MediaResourceBase — The MediaResourceBase for which a corresponding
MediaElement should be created.
|
MediaElement — The MediaElement that was created or null if no such
MediaElement could be created from the resource.
|
getItemAt | () | método |
public function getItemAt(index:int):MediaFactoryItem
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Gets the MediaFactoryItem at the specified index.
Parámetros
index:int — The index in the list from which to retrieve the MediaFactoryItem.
|
MediaFactoryItem — The MediaFactoryItem at that index or null if there is none.
|
getItemById | () | método |
public function getItemById(id:String):MediaFactoryItem
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Returns the MediaFactoryItem with the specified ID or null
if the
specified MediaFactoryItem does not exist in this factory.
Parámetros
id:String — ID of the MediaFactoryItem to retrieve.
|
MediaFactoryItem — The MediaFactoryItem with the specified ID or null if the specified
MediaFactoryItem does not exist in this factory.
|
loadPlugin | () | método |
public function loadPlugin(resource:MediaResourceBase):void
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Load a plugin identified by the specified resource. The MediaFactory will not reload the plugin if it has already been loaded. Upon successful loading, the MediaFactoryItems within the plugin's PluginInfo property will be added to this MediaFactory, and a MediaFactoryEvent.PLUGIN_LOAD event will be dispatched. OtherwiseIf the load fails, a MediaFactoryEvent.PLUGIN_LOAD_ERROR event will be dispatched.
Parámetros
resource:MediaResourceBase — MediaResourceBase representing the plugin. For remote (dynamic)
plugins, use an URLResource pointing to the remote SWF to load. For local
(static) plugins, use a PluginInfoResource.
|
Emite
ArgumentError — If resource is null or resource is neither an URLResource
nor a PluginInfoResource.
|
removeItem | () | método |
public function removeItem(item:MediaFactoryItem):void
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Removes the specified MediaFactoryItem from the factory. If no such MediaFactoryItem exists in this factory, does nothing.
Parámetros
item:MediaFactoryItem — The MediaFactoryItem to remove.
|
Emite
ArgumentError — If the argument is null or if the argument
has a null ID field.
|
resolveItems | () | método |
protected function resolveItems(resource:MediaResourceBase, items:Vector.<MediaFactoryItem>):MediaFactoryItem
Returns the most appropriate MediaFactoryItem for the specified resource
out of the MediaFactoryItems in the specified list.
This method is invoked when createMediaElement
is invoked
with a resource that more than one MediaFactoryItem can handle. Subclasses
can override to select the most appropriate one.
The default behavior is to select the first item which is not "native" to
the framework, under the theory that plugins ought to take precedence over
core media types. It makes this decision based on the presence or absence
of an id value which starts with "org.osmf".
Parámetros
resource:MediaResourceBase | |
items:Vector.<MediaFactoryItem> |
MediaFactoryItem |
mediaElementCreate | Evento |
org.osmf.events.MediaFactoryEvent
propiedad MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.MEDIA_ELEMENT_CREATE
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Dispatched when the MediaFactory has created a MediaElement.
The MediaFactoryEvent.MEDIA_ELEMENT_CREATE constant defines the value of the type property of the event object for a mediaElementCreate event.pluginLoad | Evento |
org.osmf.events.MediaFactoryEvent
propiedad MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.PLUGIN_LOAD
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Dispatched when the MediaFactory has successfully loaded a plugin.
The MediaFactoryEvent.PLUGIN_LOAD constant defines the value of the type property of the event object for a pluginLoad event.pluginLoadError | Evento |
org.osmf.events.MediaFactoryEvent
propiedad MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.PLUGIN_LOAD_ERROR
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | OSMF 1.0 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Dispatched when the MediaFactory has failed to load a plugin due to an error.
The MediaFactoryEvent.PLUGIN_LOAD_ERROR constant defines the value of the type property of the event object for a pluginLoadError event.package org.osmf.media { import flash.display.Sprite; import org.osmf.events.MediaFactoryEvent; public class MediaFactoryExample extends Sprite { public function MediaFactoryExample() { // Construct a media factory, and listen to its plug-in related events: var factory:MediaFactory = new MediaFactory(); factory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD, onPluginLoaded); factory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD_ERROR, onPluginLoadError); // Instruct the factory to load the plug-in at the given url: factory.loadPlugin(new URLResource("http://myinvalidurl.com/foo.swf")); } private function onPluginLoaded(event:MediaFactoryEvent):void { // Use the factory to create a media-element related to the plugin: var factory:MediaFactory = event.target as MediaFactory; factory.createMediaElement(new URLResource("http://myinvalidurl.com/content")); } private function onPluginLoadError(event:MediaFactoryEvent):void { // Handle plug-in loading failure: trace("Plugin failed to load."); } } }
Tue Jun 12 2018, 02:12 PM Z