9.
Type the following code in the Actions panel:
// 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])
}
};
10.
Select Control > Test Movie to test your code.
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
If your video does not have audio, the audio-related metadata information (such as
audiodatarate
metadata during encoding.
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
points, see
"Tracing cue points from an FLV file" on page
622
Working with Images, Sound, and Video
) returns
because no audio information is added to the
undefined
metadata information. For information on tracing cue
cuePoint
611.
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?