org.osmf.traits 套件提供建立特定媒體特性的建構區塊。特性會定義媒體元素的功能。
視呈現的媒體特質而定,媒體元素的不同實作會彙總不同的特性。例如,音效元素會彙總 IAudible、IPlayable、ITemporal 以及 ILoadable 特性。這些個別的特性會定義與特定媒體元素實作無關的媒體元素功能。至於具備 ILoadable 特性的媒體元素,這種特性提供媒體元素的載入和取消載入功能。同樣的,IPlayable 特性的實作提供媒體元素自我播放的能力。
特性會透過元素的 MediaElement.addTrait()
方法,新增至媒體元素。
媒體特性的實作乃是基於以下原則:
- 特性彼此無關。因此,媒體特性不會擴充其他媒體特性。
- 特性會傳送自己的事件。特性實作可以從 MediaTraitBase 類別衍生,如此可以擴充 EventDispatcher 以及實作 IMediaTrait,用於處理事件的傳送。
- 特性是由 MediaTraitType 列舉類別所識別。
- 特性應該實作為個別的類別。
特性介面專供媒體元素類別使用。它們是一般外向型實體,主要特性是有 getter 但沒有 setter,但是需要外部可設定之屬性的特性除外,例如 IAudible 的 volume 或 pan 屬性。
基礎特性類別專供 MediaElement 子類別實作之用。它們一般都有 setter 和 getter。
類別
| 類別 | 說明 |
---|
| AlternativeAudioTrait |
AlternativeAudioTrait defines the trait interface for media supporting alternative
audio streams. |
| AudioTrait |
AudioTrait defines the trait interface for media that have audio. |
| BufferTrait |
BufferTrait defines the trait interface for media that can use a data buffer. |
| DisplayObjectTrait |
DisplayObjectTrait defines the trait interface for media that expose a DisplayObject,
and which may have intrinsic dimensions. |
| DRMState |
DRMState is the enumeration of possible DRM-specific states that a
piece of media can be in. |
| DRMTrait |
DRMTrait defines the trait interface for media which can be
protected by digital rights management (DRM) technology. |
| DVRTrait |
DVRTrait defines the trait interface for media that can be played
while in the process of being recorded, as if with a digital video
recorder (DVR). |
| DynamicStreamTrait |
DynamicStreamTrait defines the trait interface for media supporting dynamic stream
switching. |
| LoaderBase |
LoaderBase is the base class for objects that are capable of loading
and unloading LoadTraits. |
| LoadState |
LoadState is the enumeration of possible states that a LoadTrait
can be in. |
| LoadTrait |
LoadTrait defines the trait interface for media that must be loaded before it
can be presented. |
| MediaTraitBase |
A MediaTraitBase is the encapsulation of a trait or capability that's
inherent to a MediaElement. |
| MediaTraitType |
MediaTraitType is the enumeration of all possible media trait types. |
| PlayState |
PlayState is the enumeration of possible states that a PlayTrait
can be in. |
| PlayTrait |
PlayTrait defines the trait interface for media whose playback can be started
and stopped. |
| SeekTrait |
SeekTrait defines the trait interface for media that can be instructed
to jump to a position in time. |
| TimeTrait |
TimeTrait defines the trait interface for media that have a duration and
a currentTime. |
| TraitEventDispatcher |
TraitEventDispatcher is a utility class that exposes a uniform
interface for receiving trait events from a MediaElement. |
© 2015 Adobe Systems Incorporated. All rights reserved.
Tue Jun 12 2018, 04:01 PM Z