| Pacote | org.osmf.elements |
| Classe | public class AudioElement |
| Herança | AudioElement LoadableElementBase MediaElement EventDispatcher Object |
| Versão da linguagem: | ActionScript 3.0 |
| Versão de produto: | OSMF 1.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
AudioElement can load and present any MP3 or AAC file. It supports MP3 files over HTTP, as well as audio-only streams from Flash Media Server.
The basic steps for creating and using an AudioElement are:
- Create a new URLResource pointing to the URL of the audio stream or file containing the sound to be loaded.
- Create the new AudioElement, passing the URLResource as a parameter.
- Create a new MediaPlayer.
- Assign the AudioElement to the MediaPlayer's
mediaproperty. - Control the media using the MediaPlayer's methods, properties, and events.
- When done with the AudioElement, set the MediaPlayer's
mediaproperty to null. This will unload the AudioElement.
Elementos da API relacionados
Propriedades públicas
| Propriedade | Definido por | ||
|---|---|---|---|
![]() | constructor : Object
Uma referência ao objeto de classe ou à função de construtor de uma determinada ocorrência de objeto. | Object | |
![]() | container : IMediaContainer [somente leitura]
The media container that this element uses. | MediaElement | |
| defaultDuration : Number
Defines the duration that the element's TimeTrait will expose until the
element's content is loaded. | AudioElement | ||
![]() | metadataNamespaceURLs : Vector.<String> [somente leitura]
A Vector containing the namespace URLs for all Metadata
objects stored within this MediaElement. | MediaElement | |
![]() | resource : MediaResourceBase
The media resource that this media element operates on. | MediaElement | |
![]() | traitTypes : Vector.<String> [somente leitura]
A Vector of MediaTraitType values representing the trait types on this
media element. | MediaElement | |
Propriedades protegidas
Métodos públicos
| Método | Definido por | ||
|---|---|---|---|
Constructor. | AudioElement | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra um objeto de ouvinte de evento em um objeto EventDispatcher, de forma que o ouvinte receba a notificação de um evento. | EventDispatcher | |
![]() |
Adds a Metadata object to this MediaElement under the specified namespace URL. | MediaElement | |
![]() |
Envia um evento para o fluxo de eventos. | 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 | |
![]() |
Verifica se o objeto EventDispatcher tem ouvintes registrados para um tipo específico de evento. | EventDispatcher | |
![]() |
Indica se um objeto tem uma propriedade especificada definida. | Object | |
![]() |
Determines whether this media element has a media trait of the
specified type. | MediaElement | |
![]() |
Indica se uma ocorrência da classe Object está na cadeia de protótipos do objeto especificado como o parâmetro. | Object | |
![]() |
Indica se a propriedade especificada existe e é enumerável. | Object | |
![]() |
Remove um ouvinte do objeto EventDispatcher. | EventDispatcher | |
![]() |
Removes the Metadata object that was stored under this MediaElement with
the specified namespace URL. | MediaElement | |
![]() |
Define a disponibilidade de uma propriedade dinâmica para operações de repetição. | Object | |
![]() |
Retorna a representação da string deste objeto, formatado segundo as convenções específicas para a localidade. | Object | |
![]() |
Retorna a representação de string do objeto especificado. | Object | |
![]() |
Retorna o valor primitivo do objeto especificado. | Object | |
![]() |
Verifica se um ouvinte de evento está registrado nesse objeto EventDispatcher ou em qualquer um de seus ancestrais para o tipo de evento especificado. | EventDispatcher | |
Métodos protegidos
Eventos
Detalhes da propriedade
defaultDuration | propriedade |
defaultDuration:Number| Versão da linguagem: | ActionScript 3.0 |
| Versão de produto: | OSMF 1.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Defines the duration that the element's TimeTrait will expose until the element's content is loaded. Setting this property to a positive value results in the element becoming temporal. Any other value will remove the element's TimeTrait, unless the loaded content is exposing a duration.
Implementação
public function get defaultDuration():Number public function set defaultDuration(value:Number):voidDetalhes do construtor
AudioElement | () | Construtor |
public function AudioElement(resource:URLResource = null, loader:LoaderBase = null)| Versão da linguagem: | ActionScript 3.0 |
| Versão de produto: | OSMF 1.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Constructor.
Parâmetrosresource:URLResource (default = null) — URLResource that points to the audio source that the AudioElement
will use.
| |
loader:LoaderBase (default = null) — Loader used to load the sound. This must be either a
NetLoader (for streaming audio) or a SoundLoader (for progressive audio).
If null, the appropriate Loader will be created based on the type of the
resource.
|
Lança
ArgumentError — If loader is neither a NetLoader nor a SoundLoader.
|
Elementos da API relacionados
Exemplos Como usar este exemplo
AudioElementExample.as
package
{
import flash.display.Sprite;
import org.osmf.elements.AudioElement;
import org.osmf.media.MediaPlayer;
import org.osmf.media.URLResource;
public class AudioElementExample extends Sprite
{
public function AudioElementExample()
{
super();
var mediaPlayer:MediaPlayer = new MediaPlayer();
var audioElement:AudioElement = new AudioElement();
audioElement.resource = new URLResource("http://mediapm.edgesuite.net/osmf/content/test/train_1500.mp3");
mediaPlayer.media = audioElement;
}
}
}
Wed Jun 13 2018, 11:10 AM Z
Ocultar propriedades públicas herdadas
Mostrar propriedades públicas herdadas