The following example shows how you can determine when a Flash ActionScript 3.0 FLVPlayback control’s metadata is received by listening for the metadataReceived event.
Full code after the jump.
// ActionScript 3.0 /* Requires * - FLVPlayback control in Flash library */ import fl.video.FLVPlayback; import fl.video.MetadataEvent; var flvPlayback:FLVPlayback = new FLVPlayback(); flvPlayback.autoPlay = false; flvPlayback.addEventListener(MetadataEvent.METADATA_RECEIVED, flvPlayback_metadataReceived); flvPlayback.source = "http://www.helpexamples.com/flash/video/cuepoints.flv"; flvPlayback.skin = "SkinOverPlaySeekMute.swf"; flvPlayback.x = 10; flvPlayback.y = 10; addChild(flvPlayback); function flvPlayback_metadataReceived(evt:MetadataEvent):void { trace("duration:", evt.info.duration); // 16.334 trace("framerate:", evt.info.framerate); // 15 trace("width:", evt.info.width); // 320 trace("height:", evt.info.height); // 213 }
If we trace the MetadataEvent event object’s info property using the Flex SDK ObjectUtil class (see “Using the Flex SDK’s ObjectUtil class in your Flash CS4 documents”), we get the following output:
(Array)#0
[audiocodecid] 2
[audiodatarate] 96
[audiodelay] 0.038
[canSeekToEnd] true
[cuePoints] (Array)#1
[0] (Array)#2
[name] “point1″
[parameters] (Array)#3
[lights] “beginning”
[time] 0.418
[type] “navigation”
[1] (Array)#4
[name] “point2″
[parameters] (Array)#5
[lights] “middle”
[time] 7.748
[type] “navigation”
[2] (Array)#6
[name] “point3″
[parameters] (Array)#7
[lights] “end”
[time] 16.02
[type] “navigation”
[duration] 16.334
[framerate] 15
[height] 213
[videocodecid] 4
[videodatarate] 400
[width] 320
One Response to Determining when a video’s metadata is received on an FLVPlayback control in Flash using ActionScript 3.0
Leave a Reply Cancel reply
Recent Posts
- Getting started with the TLFTextField class in ActionScript 3.0 and Flash CS5
- Adding tick marks to a Slider control in Flash using ActionScript 3.0
- Creating a vertical Slider control in Flash using ActionScript 3.0
- Creating a custom context menu item in Flash using ActionScript 3.0
- Rotating a Sprite object around its x-axis in Flash using ActionScript 3.0 and Flash Player 10
- Detecting when the user changes the color in a ColorPicker control in Flash using ActionScript 3.0
- Getting the currently selected color as a hexadecimal value on a ColorPicker control in Flash using ActionScript 3.0
- Toggling the text field on the ColorPicker control in Flash using ActionScript 3.0
- Creating a vertical Slider control in Flash using ActionScript 3.0
- Setting the number of columns on a ColorPicker control in Flash using ActionScript 3.0
Categories
- Bitmap (1)
- Components (72)
- Button (19)
- CheckBox (2)
- ColorPicker (6)
- ComboBox (1)
- DataGrid (8)
- FLVPlayback (7)
- Label (9)
- ProgressBar (2)
- Slider (3)
- TextArea (1)
- TextInput (7)
- UILoader (7)
- ContextMenu (1)
- Embed (4)
- ExternalInterface (2)
- Flex (7)
- Font (2)
- General (5)
- Graphics (2)
- JSFL (14)
- Loader (3)
- LoadVars (3)
- Microphone (1)
- migration (12)
- MovieClip (1)
- MovieClipLoader (1)
- Sound (2)
- TextField (1)
- TLFTextField (1)
- TransitionManager (1)
- Tween (1)
- Uncategorized (1)
- URLLoader (4)
- URLVariables (1)
- Video (1)
- XML (2)
Advertising


This doesn’t work, I’ve no error but I don’t go in flvPlayback_metadataReceived(evt:MetadataEvent) function…
My metadata are defining with : ….send(“@setDataFrame”, “onMetaData”, metaData);