<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Viewing an FLV video&#8217;s metadata using a Flex VideoDisplay control</title>
	<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Fri, 05 Dec 2008 11:39:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: Tom</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6608</link>
		<author>Tom</author>
		<pubDate>Sun, 03 Feb 2008 11:19:16 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6608</guid>
		<description>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 ;-)</description>
		<content:encoded><![CDATA[<p>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 ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6607</link>
		<author>Tom</author>
		<pubDate>Sun, 03 Feb 2008 11:09:29 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6607</guid>
		<description>Very strange ... seem to be a bug! Instead of metadatareceived event I use this code:

&lt;code&gt;
private function handlerMetadataReceived (event:Event):void {
	
	if (video.metadata != null) {	
		trace ("Meta received! "   video.totalTime   "\n");
								
		this.removeEventListener(Event.ENTER_FRAME,handlerMetadataReceived);
	}
}
&lt;/code&gt;

And when I load a new source of video:

&lt;code&gt;
video.source = this.getVideoUrl(value.video,0,this._sessionID, this._userBP);
video.load();
this.addEventListener(Event.ENTER_FRAME, handlerMetadataReceived);
&lt;/code&gt;

Video is a VideoDisplay object. Works good for me, Is anyone could try to show 2 videos sequentially and load metadata?</description>
		<content:encoded><![CDATA[<p>Very strange &#8230; seem to be a bug! Instead of metadatareceived event I use this code:</p>
<p><code><br />
private function handlerMetadataReceived (event:Event):void {</p>
<p>	if (video.metadata != null) {<br />
		trace ("Meta received! "   video.totalTime   "\n");</p>
<p>		this.removeEventListener(Event.ENTER_FRAME,handlerMetadataReceived);<br />
	}<br />
}<br />
</code></p>
<p>And when I load a new source of video:</p>
<p><code><br />
video.source = this.getVideoUrl(value.video,0,this._sessionID, this._userBP);<br />
video.load();<br />
this.addEventListener(Event.ENTER_FRAME, handlerMetadataReceived);<br />
</code></p>
<p>Video is a VideoDisplay object. Works good for me, Is anyone could try to show 2 videos sequentially and load metadata?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6606</link>
		<author>Tom</author>
		<pubDate>Sun, 03 Feb 2008 10:56:02 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6606</guid>
		<description>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</description>
		<content:encoded><![CDATA[<p>Peter,</p>
<p>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!!! </p>
<p>Maybe handler needs to be added twice?? </p>
<p>Best,<br />
Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6590</link>
		<author>peterd</author>
		<pubDate>Sat, 02 Feb 2008 20:24:39 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6590</guid>
		<description>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</description>
		<content:encoded><![CDATA[<p>Tom,</p>
<p>Yeah, I&#8217;m not sure how many fixes get back-ported to the Flex 201 framework. I don&#8217;t suspect too many (we&#8217;re more focused on Flex 3 at the moment, naturally).<br />
As for VideoDisplay.smoothing, I know it has been mentioned/requested before. You may want to search the public Flex bug base at <a href="http://bugs.adobe.com/flex/" rel="nofollow">http://bugs.adobe.com/flex/</a> and file a bug report/feature request if there isn&#8217;t one already.</p>
<p>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.</p>
<p>Regards,<br />
Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6589</link>
		<author>Tom</author>
		<pubDate>Sat, 02 Feb 2008 20:06:09 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-6589</guid>
		<description>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 ???</description>
		<content:encoded><![CDATA[<p>Hi! Many thanks to you, that it&#8217;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 &#8230;) but why Adobe doesn&#8217;t make them available ???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Muzak</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-4951</link>
		<author>Muzak</author>
		<pubDate>Tue, 11 Dec 2007 13:53:43 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-4951</guid>
		<description>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:

&lt;pre class="code"&gt;
    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));
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>If you&#8217;re using Flex 2, don&#8217;t define the metadataReceived event in mxml, define it through ActionScript instead.<br />
The VideoDisplay class is missing the Event tag<br />
    [Event(name=&#8221;metadataReceived&#8221;)]<br />
So when defining metadataReceived through mxml you&#8217;ll get an error that no such method exists, allthough it is being dispatched. Adding it through ActionScript in a Script block works fine:</p>
<p>    myVideo.addEventListener(&#8221;metadataReceived&#8221;, metadataReceivedHandler);</p>
<p>I&#8217;m also not clear on why you use an Array to store the metadata data. I&#8217;d use an Object instead and also not exclude nested Array and Object data. For instance, when using Burak&#8217;s metadata injector, data is added with keyframe timestamps that can be used to stream video through PHP or Coldfusion:<br />
<a href="http://www.buraks.com/flvmdi/" rel="nofollow">http://www.buraks.com/flvmdi/</a><br />
<a href="http://www.realitystorm.com/experiments/flash/streamingFLV/" rel="nofollow">http://www.realitystorm.com/experiments/flash/streamingFLV/</a><br />
<a href="http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two" rel="nofollow">http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two</a></p>
<p>In your example that data is discarded.<br />
Here&#8217;s what I&#8217;m currently using instead:</p>
<pre class="code">
    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));
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Webalab</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-4150</link>
		<author>Webalab</author>
		<pubDate>Thu, 15 Nov 2007 00:31:14 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-4150</guid>
		<description>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 )</description>
		<content:encoded><![CDATA[<p>Just to keep it in mind, if the flv don&#8217;t have metadata the metadataReceived event wont be triggered.  so, it depends on the flv file as well&#8230;<br />
it will be nice a way to figure that out ( if the file has metadata or not )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-2394</link>
		<author>peterd</author>
		<pubDate>Mon, 17 Sep 2007 19:50:12 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-2394</guid>
		<description>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.

&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;!-- Flex 3 Nightly 182505 --&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            import mx.events.MetadataEvent;

            private function videoDisplay_metadataReceived(evt:MetadataEvent):void {
                lbl.text = evt.type;
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:VideoDisplay id="videoDisplay"
            source="http://www.helpexamples.com/flash/video/cuepoints.flv"
            metadataReceived="videoDisplay_metadataReceived(event);" /&#62;
    &#60;mx:Label id="lbl" text="--default--" /&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Rafael,</p>
<p>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&#8217;re using? If not, you can find out by typing &#8220;mxmlc -version&#8221; in your target /bin/ directory.</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- Flex 3 Nightly 182505 --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.MetadataEvent;

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

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

&lt;/mx:Application&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rafael</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-2390</link>
		<author>Rafael</author>
		<pubDate>Mon, 17 Sep 2007 18:33:23 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-2390</guid>
		<description>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???</description>
		<content:encoded><![CDATA[<p>I have the latest version and Still doesn&#8217;t work properly&#8230;</p>
<p>Severity and Description	Path	Resource	Location	Creation Time	Id<br />
Cannot resolve attribute &#8216;metadataReceived&#8217; for component type mx.controls.VideoDisplay.	documentos	uno.mxml	line 43	1190053854082	7932<br />
have any idea???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-2361</link>
		<author>peterd</author>
		<pubDate>Mon, 17 Sep 2007 13:50:01 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/09/15/viewing-an-flv-videos-metadata-using-a-flex-videodisplay-control/#comment-2361</guid>
		<description>kan,

The &lt;code&gt;metadataReceived&lt;/a&gt; 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 &lt;u&gt;http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html&lt;/u&gt;.

Peter</description>
		<content:encoded><![CDATA[<p>kan,</p>
<p>The <code>metadataReceived event must have been added in a newer version. I&#8217;m not sure exactly which build, but try grabbing a newer nightly build from the Adobe Labs site at <u><a href="http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html" rel="nofollow">http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html</a></u>.</p>
<p>Peter</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
