Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Working with Images, Sound, and Video > About using FLV video > Working with metadata | |||
You can use the onMetaData method to view the metadata information in your FLV file. Metadata includes information about your FLV file, such as duration, width, height, and frame rate. The metadata information that is added to your FLV file depends on the software you use to encode your FLV file or the software you use to add metadata information.
|
NOTE |
|
If your video file does not have metadata information, you can use tools to add metadata information to the file. |
To work with NetStream.onMetaData, you must have Flash Video that contains metadata. If you encode FLV files using Flash 8 Video Encoder, your FLV file will have metadata information in it (see the following example for a list of metadata in a FLV file encoded with Flash 8 Video Encoder).
|
NOTE |
|
Flash Video Exporter 1.2 and later (including Flash 8 Video Exporter), add the metadata to your FLV files. Sorenson Squeeze 4.1 and later also adds metadata to your video files. |
The following example uses NetStream.onMetaData to trace the metadata information of an FLV file encoded with Flash 8 Video Encoder.
// Create a NetConnection object.
var netConn:NetConnection = new NetConnection();
// Create a local streaming connection.
netConn.connect(null);
// Create a NetStream object and define an onStatus() function.
var nStream:NetStream = new NetStream(netConn);
// Attach the NetStream video feed to the Video object.
my_video.attachVideo(nStream);
// Set the buffer time.
nStream.setBufferTime(30);
// Being playing the FLV file.
nStream.play("http://www.helpexamples.com/flash/video/lights_short.flv");
// Trace the metadata.
nStream.onMetaData = function(myMeta) {
for (var i in myMeta) {
trace(i + ":\t" + myMeta[i])
}
};
You see the following information in the Output panel:
canSeekToEnd: true audiocodecid: 2 audiodelay: 0.038 audiodatarate: 96 videocodecid: 4 framerate: 15 videodatarate: 400 height: 213 width: 320 duration: 8.04
|
NOTE |
|
If your video does not have audio, the audio-related metadata information (such as |
You can also use the following format to display most metadata information. For example, the following code shows the duration of an FLV file:
nStream.onMetaData = function(myMeta) {
trace("FLV duration: " + myMeta.duration + " sec.");
};
This format cannot trace cuePoint metadata information. For information on tracing cue points, see Tracing cue points from an FLV file.
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001039.html