2 Replies Latest reply on Apr 17, 2011 11:41 PM by Gheorghe Blanariu

    How can I get a loaded video's metadata?

    midimid Level 1

      Using OSMF 1.5 and I need to access a loaded video's metadata. I've seen a million ways to do this but none of them work. Can someone please post a simple example?

       

      Typically I can get as far as accessing a video's netstream client, but I always get an error saying "onMetaData" is undefined.

        • 1. Re: How can I get a loaded video's metadata?
          midimid Level 1

          OK - when I switch to an FLV, I can get onMetaData to work.

           

          So I suppose I need an example of onMetaData working with an rtmp URL. Is that even possible?

           

          I specifically just need the width/height of the stream's video (not the layout of the container).

          • 2. Re: How can I get a loaded video's metadata?
            Gheorghe Blanariu Adobe Employee

            Hi,

             

            It shouldn't be any difference between Progressive Download and Metadata regarding the onMetadata.

             

            This is an example code that access the metadata of an asset:

             

            ...

            media:MediaElement = new MediaElement(new URLResource(url));

             

            media.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataAdd);

            ..

             

            function onMetadataAdd(event:MediaElementEvent):void

            {

            var meta:Metadata = media.getMetadata(metadaNameSpace);

            if (meta.keys.indexOf(key) != -1)

            {

            var readValue:String = meta.getValue(key);

            }

             

            }

             

             

            Hope this helps,

             

            Gelu