ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
org.osmf.media 

DefaultMediaFactory  - AS3 OSMF

Packageorg.osmf.media
Classpublic class DefaultMediaFactory
InheritanceDefaultMediaFactory Inheritance MediaFactory Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

DefaultMediaFactory is the default implementation of MediaFactory.

The default media factory can construct media elements of the following types:

  • VideoElement, using either:
    • NetLoader (streaming or progressive)
    • RTMPDynamicStreamingNetLoader (MBR streaming)
    • HTTPStreamingNetLoader (HTTP streaming), if the CONFIG::FLASH_10_1 compiler flag is set to true
    • F4MLoader (Flash Media Manifest files)
    • DVRCastNetLoader (DVRCast)
  • SoundElement, using either:
    • SoundLoader (progressive)
    • NetLoader (streaming)
  • ImageElement
  • SWFElement

View the examples



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritednumItems : int
[read-only] The number of MediaFactoryItems managed by the factory.
MediaFactory
Public Methods
 MethodDefined By
  
Constructor.
DefaultMediaFactory
 Inherited
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
 Inherited
Adds the specified MediaFactoryItem to the factory.
MediaFactory
 Inherited
Returns a MediaElement that can be created based on the specified MediaResourceBase.
MediaFactory
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Gets the MediaFactoryItem at the specified index.
MediaFactory
 Inherited
Returns the MediaFactoryItem with the specified ID or null if the specified MediaFactoryItem does not exist in this factory.
MediaFactory
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Load a plugin identified by the specified resource.
MediaFactory
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Removes the specified MediaFactoryItem from the factory.
MediaFactory
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Protected Methods
 MethodDefined By
 Inherited
Returns the most appropriate MediaFactoryItem for the specified resource out of the MediaFactoryItems in the specified list.
MediaFactory
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
 InheritedDispatched when the MediaFactory has created a MediaElement.MediaFactory
 InheritedDispatched when the MediaFactory has successfully loaded a plugin.MediaFactory
 InheritedDispatched when the MediaFactory has failed to load a plugin due to an error.MediaFactory
Constructor Detail

DefaultMediaFactory

()Constructor
public function DefaultMediaFactory()

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Constructor.

DefaultMediaFactoryExample.as

This example demonstrates how to manually use the DefaultMediaFactory class to instantiate a video element.
    
package org.osmf.media
{
    import flash.display.Sprite;
    
    import org.osmf.containers.MediaContainer;

    public class DefaultMediaFactoryExample extends Sprite
    {
        public function DefaultMediaFactoryExample()
        {
            // Construct a default media factory:
            var factory:DefaultMediaFactory = new DefaultMediaFactory();
            
            // Request the factory to create a media element that matches the passed URL:
            var media:MediaElement = factory.createMediaElement(new URLResource("http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.flv"));
            
            // Add a media container, and player to have the constructed VideoElement
            // play back:  
            var mediaContainer:MediaContainer = new MediaContainer();
            addChild(mediaContainer);
            mediaContainer.width = 640;
            mediaContainer.height = 500;
            mediaContainer.addMediaElement(media);
            new MediaPlayer(media);
        }
        
    }
}