套件 | org.osmf.metadata |
類別 | public class TimelineMetadata |
繼承 | TimelineMetadata ![]() ![]() ![]() |
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | Flash Player 10, AIR 1.5 |
TimelineMetadata uses the TimelineMarker class to represent both keys and values (i.e. a TimelineMarker will be stored as both key and value). A TimelineMetadata object dispatches a TimelineMetadataEvent when the currentTime property of the MediaElement's TimeTrait matches any of the time values in its collection of TimelineMarker objects.
屬性 | 定義自 | ||
---|---|---|---|
![]() | constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | |
numMarkers : int [唯讀]
The number of TimelineMarker objects contained within this object. | TimelineMetadata |
方法 | 定義自 | ||
---|---|---|---|
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。 | EventDispatcher | |
Adds the specified TimelineMarker to this object. | TimelineMetadata | ||
![]() |
會將事件傳送到事件流程。 | EventDispatcher | |
Returns the TimelineMarker at the specified index. | TimelineMetadata | ||
![]() |
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。 | EventDispatcher | |
![]() |
指出物件是否有已定義的指定屬性。 | Object | |
![]() |
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | |
![]() |
指出指定的屬性是否存在,以及是否可列舉。 | Object | |
![]() |
會從 EventDispatcher 物件移除偵聽程式。 | EventDispatcher | |
Removes the specified TimelineMarker from this object. | TimelineMetadata | ||
![]() |
為迴圈作業設定動態屬性的可用性。 | Object | |
![]() |
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | |
![]() |
會傳回指定之物件的字串形式。 | Object | |
![]() |
會傳回指定之物件的基本值。 | Object | |
![]() |
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。 | EventDispatcher |
事件 | 摘要 | 定義自 | ||
---|---|---|---|---|
![]() | [廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。 | EventDispatcher | ||
![]() | [廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。 | EventDispatcher |
numMarkers | 屬性 |
addMarker | () | 方法 |
public function addMarker(marker:org.osmf.metadata:TimelineMarker):void
Adds the specified TimelineMarker to this object. This class maintains the TimelineMarkers in time order. If another TimelineMarker with the same time value exists within this object, then the existing value will be overwritten.
參數
marker:org.osmf.metadata:TimelineMarker — The marker to add.
|
擲回值
ArgumentError — If marker is null or specifies an invalid time.
|
getMarkerAt | () | 方法 |
public function getMarkerAt(index:int):org.osmf.metadata:TimelineMarker
Returns the TimelineMarker at the specified index. Note that the markers are sorted by time.
參數
index:int — The index of the marker to return.
|
org.osmf.metadata:TimelineMarker |
removeMarker | () | 方法 |
public function removeMarker(marker:org.osmf.metadata:TimelineMarker):org.osmf.metadata:TimelineMarker
Removes the specified TimelineMarker from this object.
參數
marker:org.osmf.metadata:TimelineMarker — The marker to remove.
|
org.osmf.metadata:TimelineMarker |
擲回值
ArgumentError — If marker is null.
|
package { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import org.osmf.elements.VideoElement; import org.osmf.events.MediaElementEvent; import org.osmf.events.TimelineMetadataEvent; import org.osmf.media.MediaPlayerSprite; import org.osmf.media.URLResource; import org.osmf.metadata.CuePoint; import org.osmf.metadata.TimelineMetadata; public class TimelineMetadataExample extends Sprite { public function TimelineMetadataExample() { super(); stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; var mediaPlayerSprite:MediaPlayerSprite = new MediaPlayerSprite(); var urlResource:URLResource = new URLResource("rtmp://cp67126.edgefcs.net/ondemand/mp4:mediapm/osmf/content/test/cuepoints/spacealonehd_sounas_640_with_nav.f4v"); videoElement= new VideoElement(); videoElement.resource = urlResource; videoElement.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataAdd); addChild(mediaPlayerSprite); mediaPlayerSprite.media = videoElement; } private function onMetadataAdd(event:MediaElementEvent):void { if (event.namespaceURL == CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE) { var timelineMetadata:TimelineMetadata = videoElement.getMetadata(CuePoint.DYNAMIC_CUEPOINTS_NAMESPACE) as TimelineMetadata; timelineMetadata.addEventListener(TimelineMetadataEvent.MARKER_TIME_REACHED, onCuePoint); } } private function onCuePoint(event:TimelineMetadataEvent):void { var cuePoint:CuePoint = event.marker as CuePoint; trace("Cue Point at " + cuePoint.time); } private var videoElement:VideoElement; } }
Tue Jun 12 2018, 03:47 PM Z