{ 17 comments… read them below or add one }

1 Nice September 16, 2007 at 8:48 am

humm…got error. I amusing Flex 2.01

Cannot resolve attribute ‘metadataReceived’ for component type mx.controls.VideoDisplay.

metadataReceived=”videoDisplay_metadataReceived(event);” />

Reply

2 Nice September 16, 2007 at 9:24 am

got, it only work in Flex 3.

Reply

3 Vegard September 16, 2007 at 11:55 am

Hi,

you seem to know a lot about flex and actionscript programming. I’ve been looking everywhere, but still haven’t found a working solution to this problem:

Flex 3 with Flash Player 9 supports h.264 encoded video. But VideoDisplay doesn’t? How should I program this?

I’ll be sooo grateful if you can help me find the answer!

Reply

4 peterd September 16, 2007 at 6:37 pm

Vegard,

Honestly, I haven’t tried H.264 w/ Flex yet, but it is high on my list of things to try. I haven’t verified anything, but I’d recommend starting with downloading the latest version of the Flex 3 Beta SDK from http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html and see if there have been any edits to the VideoDisplay component.

Sorry,
Peter

Reply

5 kan September 17, 2007 at 2:50 am

I same error “mx.controls.VideoDisplay”
I compling flex3 beta..
why??

I work this..

D:4.Language\__SDK\flex3sdk_b1_061107\bin>mxmlc -version
Version 3.0 build 172357

D:4.Language\__SDK\flex3sdk_b1_061107\bin>mxmlc D:4.Language\Flex\Source\blo
g.flexexamples.com\viewing_an_flv_videos_metadata_using_a_flex_videodisplay_control.mxml
Loading configuration file D:4.Language\__SDK\flex3sdk_b1_061107\frameworks\flex-config.xml
This beta will expire on Wed Oct 31 00:00:00 KST 2007.
D:4.Language\Flex\Source\blog.flexexamples.com\viewing_an_flv_videos_metadata_
using_a_flex_videodisplay_control.mxml(43): Error: Cannot resolve attribute ‘metadataReceiv
ed’ for component type mx.controls.VideoDisplay.

metadataReceived=”videoDisplay_metadataReceived(event);” />

Reply

6 peterd September 17, 2007 at 6:50 am

kan,

The metadataReceived event must have been added in a newer version. I'm not sure exactly which build, but try grabbing a newer nightly build from the Adobe Labs site at http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html.

Peter

Reply

7 Rafael September 17, 2007 at 11:33 am

I have the latest version and Still doesn’t work properly…

Severity and Description Path Resource Location Creation Time Id
Cannot resolve attribute ‘metadataReceived’ for component type mx.controls.VideoDisplay. documentos uno.mxml line 43 1190053854082 7932
have any idea???

Reply

8 peterd September 17, 2007 at 12:50 pm

Rafael,

I built a simple test case and it seems to be working for me in build 182505. Do you know which exact version of the SDK you’re using? If not, you can find out by typing “mxmlc -version” in your target /bin/ directory.

<?xml version="1.0" encoding="utf-8"?>
<!-- Flex 3 Nightly 182505 -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            import mx.events.MetadataEvent;

            private function videoDisplay_metadataReceived(evt:MetadataEvent):void {
                lbl.text = evt.type;
            }
        ]]>
    </mx:Script>

    <mx:VideoDisplay id="videoDisplay"
            source="http://www.helpexamples.com/flash/video/cuepoints.flv"
            metadataReceived="videoDisplay_metadataReceived(event);" />
    <mx:Label id="lbl" text="--default--" />

</mx:Application>

Reply

9 Webalab November 14, 2007 at 5:31 pm

Just to keep it in mind, if the flv don’t have metadata the metadataReceived event wont be triggered. so, it depends on the flv file as well…
it will be nice a way to figure that out ( if the file has metadata or not )

Reply

10 Muzak December 11, 2007 at 5:53 am

If you’re using Flex 2, don’t define the metadataReceived event in mxml, define it through ActionScript instead.
The VideoDisplay class is missing the Event tag
[Event(name="metadataReceived")]
So when defining metadataReceived through mxml you’ll get an error that no such method exists, allthough it is being dispatched. Adding it through ActionScript in a Script block works fine:

myVideo.addEventListener(“metadataReceived”, metadataReceivedHandler);

I’m also not clear on why you use an Array to store the metadata data. I’d use an Object instead and also not exclude nested Array and Object data. For instance, when using Burak’s metadata injector, data is added with keyframe timestamps that can be used to stream video through PHP or Coldfusion:
http://www.buraks.com/flvmdi/
http://www.realitystorm.com/experiments/flash/streamingFLV/
http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two

In your example that data is discarded.
Here’s what I’m currently using instead:

    var obj:Object = {};
    var item:String;
    // videoDisplay.metadata;
    var meta:Object = evt.info;
    var value:*;
        for (item in meta) {
            if (meta[item] is Array) {
                value = ArrayUtil.toArray(meta[item]);
            }else{
                value = meta[item]
            }
            obj[item] = value;
        }
    trace(ObjectUtil.toString(obj));

Reply

11 Tom February 2, 2008 at 12:06 pm

Hi! Many thanks to you, that it’s exactly what I am looking for since some days, before I looped until I have video.metadata != null in a ENTER_FRAME event handler ;-( very dirty !!! Strange that Adobe did not integrate it since Flex 2.0, like for smoothing property which is not available for VideoDisplay and Image controls (yes I know that can be fixed with mx_internal …) but why Adobe doesn’t make them available ???

Reply

12 peterd February 2, 2008 at 12:24 pm

Tom,

Yeah, I’m not sure how many fixes get back-ported to the Flex 201 framework. I don’t suspect too many (we’re more focused on Flex 3 at the moment, naturally).
As for VideoDisplay.smoothing, I know it has been mentioned/requested before. You may want to search the public Flex bug base at http://bugs.adobe.com/flex/ and file a bug report/feature request if there isn’t one already.

In fact, now is a great time to file any bugs/enhancement requests you may have. With Flex 3 development slowing down, Flex 4 planning is starting.

Regards,
Peter

Reply

13 Tom February 3, 2008 at 2:56 am

Peter,

I have a question about metadatareceived event: I load 2 videos sequentially, and before that I add an event listener at my video control: video.addEventListener(MetadataEvent.METADATA_RECEIVED, handlerMetadataReceived);, then I load the first video, ok handler is called, but when I load the second, handler is never called!!!

Maybe handler needs to be added twice??

Best,
Tom

Reply

14 Tom February 3, 2008 at 3:09 am

Very strange … seem to be a bug! Instead of metadatareceived event I use this code:


private function handlerMetadataReceived (event:Event):void {

if (video.metadata != null) {
trace ("Meta received! " video.totalTime "\n");

this.removeEventListener(Event.ENTER_FRAME,handlerMetadataReceived);
}
}

And when I load a new source of video:


video.source = this.getVideoUrl(value.video,0,this._sessionID, this._userBP);
video.load();
this.addEventListener(Event.ENTER_FRAME, handlerMetadataReceived);

Video is a VideoDisplay object. Works good for me, Is anyone could try to show 2 videos sequentially and load metadata?

Reply

15 Tom February 3, 2008 at 3:19 am

Oups!! I am sorry for my last couple of comments, actually I set autoPlay to false and now metadatareceived is dispatched for my 2 videos ;-)

Reply

16 Alvi April 9, 2009 at 4:40 am

hellow i am alvi,
this is nice blog i ever visit. keep it more up. thanks

Reply

17 paul May 8, 2009 at 3:20 am

Once again, you made my day. Thanks for the FLV metadata tip. :)

Reply

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: