FLVPlayback.metadata

Availability

Flash Player 8.

Edition

Flash Professional 8.

Usage

my_FLVPlybk.metadata

Description

Property; an object that is a metadata information packet that is received from a call to the NetSteam.onMetaData() callback function, if available. Read only.

If the FLV file is encoded with the Flash CS3 encoder, the metadata property contains the following information. Older FLV files contain only the height, width, and duration values.

Parameter

Description

canSeekToEnd

A Boolean value that is true if the FLV file is encoded with a keyframe on the last frame that allows seeking to the end of a progressive download movie clip. It is false if the FLV file is not encoded with a keyframe on the last frame.

cuePoints

An array of objects, one for each cue point embedded in the FLV file. Value is undefined if the FLV file does not contain any cue points. Each object has the following properties:

  • type  a string that specifies the type of cue point as either "navigation" or "event".
  • name  a string that is the name of the cue point.
  • time  a number that is the time of the cue point in seconds with a precision of three decimal places (milliseconds).
  • parameters  an optional object that has name-value pairs that are designated by the user when creating the cue points.
audiocodecid

A number that indicates the audio codec (code/decode technique) that was used.

audiodelay

A number that indicates what time in the FLV file "time 0" of the original FLV file exists. The video content needs to be delayed by a small amount to properly synchronize the audio.

audiodatarate

A number that is the kilobytes per second of audio.

videocodecid

A number that is the codec version that was used to encode the video.

framerate

A number that is the frame rate of the FLV file.

videodatarate

A number that is the video data rate of the FLV file.

height

A number that is the height of the FLV file.

width

A number that is the width of the FLV file.

duration

A number that specifies the duration of the FLV file in seconds.

Example

The following example shows in the Output panel a sampling of metadata values from the FLV file cuepoints.flv. It displays the data when the metadataReceived event occurs.

Drag an FLVPlayback component to the Stage, and give it an instance name of my_FLVPlybk. Then add the following code to the Actions panel on Frame 1 of the Timeline:

/**
 Requires:
  - FLVPlayback component on the Stage with an instance name of my_FLVPlybk
*/
import mx.video.*;
var listenerObject:Object = new Object();
listenerObject.metadataReceived = function(eventObject:Object):Void {
        trace("canSeekToEnd is " + my_FLVPlybk.metadata.canSeekToEnd);
        trace("Number of cue points is " + my_FLVPlybk.metadata.cuePoints.length);
        trace("Frame rate is " + my_FLVPlybk.metadata.framerate);
        trace("Height is " + my_FLVPlybk.metadata.height);
        trace("Width is " + my_FLVPlybk.metadata.width);
        trace("Duration is " + my_FLVPlybk.metadata.duration + " seconds");
};
my_FLVPlybk.addEventListener("metadataReceived", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/cuepoints.flv";

See also

FLVPlayback.metadataLoaded, FLVPlayback.metadataReceived