<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to Determine the Completion of a Flash Video (FLV) File (AS2)</title>
	<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Wed, 19 Nov 2008 04:27:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Jetty</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-286730</link>
		<pubDate>Wed, 08 Oct 2008 10:46:45 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-286730</guid>
					<description>Hi david,
I just want to get video complete message for a embedded video in a time line OR the meachanisim we need to use for getting the video playback complete message 
Pls send the code to my e-mail</description>
		<content:encoded><![CDATA[<p>Hi david,<br />
I just want to get video complete message for a embedded video in a time line OR the meachanisim we need to use for getting the video playback complete message<br />
Pls send the code to my e-mail
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Artur Trzebunia</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-249878</link>
		<pubDate>Mon, 18 Aug 2008 19:02:26 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-249878</guid>
					<description>David,

Thank you for pointing me to your blog site.  I've read the tutorials on working with cue points in Flash and understand this topic so much better.  I finally understand how Flash recognizes cue points with specific names.

I also understand your tutorial on how to determine when video reaches completion using onMetadata and onStatus.  Taking this a step forward, how do I tell the video to return to the beginning AND STOP once the video reaches the end or the stop button is pressed?  I've tried using ns.seek(0), but this statement returns the video to the beginning and starts playing again.

Thanks for all your help.</description>
		<content:encoded><![CDATA[<p>David,</p>
<p>Thank you for pointing me to your blog site.  I&#8217;ve read the tutorials on working with cue points in Flash and understand this topic so much better.  I finally understand how Flash recognizes cue points with specific names.</p>
<p>I also understand your tutorial on how to determine when video reaches completion using onMetadata and onStatus.  Taking this a step forward, how do I tell the video to return to the beginning AND STOP once the video reaches the end or the stop button is pressed?  I&#8217;ve tried using ns.seek(0), but this statement returns the video to the beginning and starts playing again.</p>
<p>Thanks for all your help.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: professional</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-224822</link>
		<pubDate>Sun, 20 Jul 2008 02:51:35 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-224822</guid>
					<description>Hello. I think you are eactly thinking like Sukrat. I really loved the post.</description>
		<content:encoded><![CDATA[<p>Hello. I think you are eactly thinking like Sukrat. I really loved the post.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nicholas</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-194796</link>
		<pubDate>Wed, 04 Jun 2008 23:49:28 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-194796</guid>
					<description>OK David,

I completely understand now. Except, if &quot;video4.flv&quot; is missing from the directory the videoPlayer continues to buffer. Rather than skip to the first video and start over.
The videoPlayer works and skips to the next .flv file, it is only when the last .flv is missing that it does not skip to the first .flv and start over.

Thank you very much for contribution thus far!
Nick.</description>
		<content:encoded><![CDATA[<p>OK David,</p>
<p>I completely understand now. Except, if &#8220;video4.flv&#8221; is missing from the directory the videoPlayer continues to buffer. Rather than skip to the first video and start over.<br />
The videoPlayer works and skips to the next .flv file, it is only when the last .flv is missing that it does not skip to the first .flv and start over.</p>
<p>Thank you very much for contribution thus far!<br />
Nick.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-194637</link>
		<pubDate>Wed, 04 Jun 2008 17:20:10 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-194637</guid>
					<description>Nicholas,

In the code you pasted, you already have a &lt;code&gt;complete&lt;/code&gt; handler present:

&lt;pre&gt;&lt;code&gt;listenerObject.complete = function(eventObject:Object):Void {
  currentlyPlaying++;
  if (currentlyPlaying &gt;= videoList.length) {
    currentlyPlaying = 0;
  }
  trace(currentlyPlaying);
  videoPlayer.contentPath = videoList[currentlyPlaying];
  videoPlayer.play();
};&lt;/code&gt;&lt;/pre&gt;

That event handler references &lt;code&gt;currentlyPlaying&lt;/code&gt; and &lt;code&gt;contentPath&lt;/code&gt;, and I'm proposing that you add a second event handler that does the same thing for a video that fails to load.  Your second event handler would presumably do the same thing &amp;#8212; to an extent.  The &lt;code&gt;stateChange&lt;/code&gt; event handler should probably &lt;em&gt;not&lt;/em&gt; loop &lt;code&gt;currentlyPlaying&lt;/code&gt; to the beginning again, because that loop would repeat forever in the off-chance that none of the video files are present.

So ... you'll continue to have your &lt;code&gt;complete&lt;/code&gt; handler, but you'll also add a &lt;code&gt;stateChange&lt;/code&gt; handler:

&lt;pre&gt;&lt;code&gt;listenerObject.complete = function(eventObject:Object):Void {
  currentlyPlaying++;
  if (currentlyPlaying &gt;= videoList.length) {
    currentlyPlaying = 0;
  }
  trace(currentlyPlaying);
  videoPlayer.contentPath = videoList[currentlyPlaying];
  videoPlayer.play();
};
listenerObject.stateChange = function(eventObject:Object):Void {
  if (eventObject.state == &amp;#34;connectionError&amp;#34;) {
    currentlyPlaying++;
    if (currentlyPlaying &lt; videoList.length) {
      videoPlayer.contentPath = videoList[currentlyPlaying];
      videoPlayer.play();
    }
  }
};
videoPlayer.addEventListener(&amp;#34;complete&amp;#34;, listenerObject);
videoPlayer.addEventListener(&amp;#34;stateChange&amp;#34;, listenerObject);&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Nicholas,</p>
<p>In the code you pasted, you already have a <code>complete</code> handler present:</p>
<pre><code>listenerObject.complete = function(eventObject:Object):Void {
  currentlyPlaying++;
  if (currentlyPlaying >= videoList.length) {
    currentlyPlaying = 0;
  }
  trace(currentlyPlaying);
  videoPlayer.contentPath = videoList[currentlyPlaying];
  videoPlayer.play();
};</code></pre>
<p>That event handler references <code>currentlyPlaying</code> and <code>contentPath</code>, and I&#8217;m proposing that you add a second event handler that does the same thing for a video that fails to load.  Your second event handler would presumably do the same thing &mdash; to an extent.  The <code>stateChange</code> event handler should probably <em>not</em> loop <code>currentlyPlaying</code> to the beginning again, because that loop would repeat forever in the off-chance that none of the video files are present.</p>
<p>So &#8230; you&#8217;ll continue to have your <code>complete</code> handler, but you&#8217;ll also add a <code>stateChange</code> handler:</p>
<pre><code>listenerObject.complete = function(eventObject:Object):Void {
  currentlyPlaying++;
  if (currentlyPlaying >= videoList.length) {
    currentlyPlaying = 0;
  }
  trace(currentlyPlaying);
  videoPlayer.contentPath = videoList[currentlyPlaying];
  videoPlayer.play();
};
listenerObject.stateChange = function(eventObject:Object):Void {
  if (eventObject.state == &quot;connectionError&quot;) {
    currentlyPlaying++;
    if (currentlyPlaying < videoList.length) {
      videoPlayer.contentPath = videoList[currentlyPlaying];
      videoPlayer.play();
    }
  }
};
videoPlayer.addEventListener(&quot;complete&quot;, listenerObject);
videoPlayer.addEventListener(&quot;stateChange&quot;, listenerObject);</code></pre>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nicholas</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-194499</link>
		<pubDate>Wed, 04 Jun 2008 09:23:28 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-194499</guid>
					<description>Hi Dave,

Thank you very much! ;)

Although, as good as you are at Flash I am unfortunately not.
With the above ActionScript you gave me, Do I replace the old script or simlply add it?

In regards to the updating of the currentlyPlaying and contentPath, I dont quite understand...

By any chance are your two books based on Flash? Because I would realy love to have a copy of my own!! Hope all goes well.

Thanks, Nick</description>
		<content:encoded><![CDATA[<p>Hi Dave,</p>
<p>Thank you very much! <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Although, as good as you are at Flash I am unfortunately not.<br />
With the above ActionScript you gave me, Do I replace the old script or simlply add it?</p>
<p>In regards to the updating of the currentlyPlaying and contentPath, I dont quite understand&#8230;</p>
<p>By any chance are your two books based on Flash? Because I would realy love to have a copy of my own!! Hope all goes well.</p>
<p>Thanks, Nick
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-193179</link>
		<pubDate>Mon, 02 Jun 2008 15:51:36 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-193179</guid>
					<description>Nicholas,

Times are a bit tight lately.  I'm working on two books at the moment, and it's taking quite a toll.  ;)

What you need, here, is a way to determine when an FLV load has gone bad.  The AS2 &lt;code&gt;FLVPlayback&lt;/code&gt; class features a &lt;code&gt;stateChange&lt;/code&gt; event that lets you know when the component starts playing, pausing, rewinding, and so on &amp;#8212; and it even includes info on connection errors, such as when an FLV file is not present.

Continuing on with your variable naming convention, consider the following new event handler:

&lt;pre&gt;&lt;code&gt;listenerObject.stateChange = function (eventObject:Object):Void {
  trace(eventObject.state);
};

videoPlayer.addEventListener(&quot;stateChange&quot;, listenerObject);&lt;/code&gt;&lt;/pre&gt;

When a video fails to load, you'll see &quot;connectionError&quot; in the Output panel.  Instead, you may want to increment &lt;code&gt;currentlyPlaying&lt;/code&gt; and update the &lt;code&gt;contentPath&lt;/code&gt; property again.  That would skip to the next video.  Or you could handle that particular sort of status change event in some other way.</description>
		<content:encoded><![CDATA[<p>Nicholas,</p>
<p>Times are a bit tight lately.  I&#8217;m working on two books at the moment, and it&#8217;s taking quite a toll.  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>What you need, here, is a way to determine when an FLV load has gone bad.  The AS2 <code>FLVPlayback</code> class features a <code>stateChange</code> event that lets you know when the component starts playing, pausing, rewinding, and so on &mdash; and it even includes info on connection errors, such as when an FLV file is not present.</p>
<p>Continuing on with your variable naming convention, consider the following new event handler:</p>
<pre><code>listenerObject.stateChange = function (eventObject:Object):Void {
  trace(eventObject.state);
};

videoPlayer.addEventListener("stateChange", listenerObject);</code></pre>
<p>When a video fails to load, you&#8217;ll see &#8220;connectionError&#8221; in the Output panel.  Instead, you may want to increment <code>currentlyPlaying</code> and update the <code>contentPath</code> property again.  That would skip to the next video.  Or you could handle that particular sort of status change event in some other way.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nicholas</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-193086</link>
		<pubDate>Mon, 02 Jun 2008 12:29:10 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-193086</guid>
					<description>Anyone out there??

:P

Nicholas.</description>
		<content:encoded><![CDATA[<p>Anyone out there??</p>
<p>:P</p>
<p>Nicholas.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nicholas</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-186937</link>
		<pubDate>Thu, 22 May 2008 03:01:09 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-186937</guid>
					<description>Hi David, thanks for that post.

I have managed to acomplish what I was after. Although, now I have run into a new problem.
I have created an FLVplayback component which loads .flv video files externaly, given the .flv is named one of the selected names in the array below.

Here is the ActionScript I have used thus far:

var videoList:Array = new Array();
videoList[0] = &quot;video1.flv&quot;;
videoList[1] = &quot;video2.flv&quot;;
videoList[2] = &quot;video3.flv&quot;;
videoList[3] = &quot;video4.flv&quot;;
var currentlyPlaying = 0;

videoPlayer.contentPath = videoList[currentlyPlaying];
videoPlayer.play();
videoPlayer.bufferingBar = bufferClip;
trace(currentlyPlaying);

var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
		currentlyPlaying++;
		if (currentlyPlaying &amp;#62;= videoList.length) {
			currentlyPlaying = 0;
		}
		trace(currentlyPlaying);
		videoPlayer.contentPath = videoList[currentlyPlaying];
		videoPlayer.play();
};
videoPlayer.addEventListener(&quot;complete&quot;, listenerObject);

If one of the .flv video files is missing from the directory the FLVplayback will continue to buffer and look for the missing .flv video file rather than continue to the next .flv video file.
Would you David or anyone out there possibly know the solution to this problem?

Many thanks, Nicholas.</description>
		<content:encoded><![CDATA[<p>Hi David, thanks for that post.</p>
<p>I have managed to acomplish what I was after. Although, now I have run into a new problem.<br />
I have created an FLVplayback component which loads .flv video files externaly, given the .flv is named one of the selected names in the array below.</p>
<p>Here is the ActionScript I have used thus far:</p>
<p>var videoList:Array = new Array();<br />
videoList[0] = &#8220;video1.flv&#8221;;<br />
videoList[1] = &#8220;video2.flv&#8221;;<br />
videoList[2] = &#8220;video3.flv&#8221;;<br />
videoList[3] = &#8220;video4.flv&#8221;;<br />
var currentlyPlaying = 0;</p>
<p>videoPlayer.contentPath = videoList[currentlyPlaying];<br />
videoPlayer.play();<br />
videoPlayer.bufferingBar = bufferClip;<br />
trace(currentlyPlaying);</p>
<p>var listenerObject:Object = new Object();<br />
listenerObject.complete = function(eventObject:Object):Void {<br />
		currentlyPlaying++;<br />
		if (currentlyPlaying &gt;= videoList.length) {<br />
			currentlyPlaying = 0;<br />
		}<br />
		trace(currentlyPlaying);<br />
		videoPlayer.contentPath = videoList[currentlyPlaying];<br />
		videoPlayer.play();<br />
};<br />
videoPlayer.addEventListener(&#8221;complete&#8221;, listenerObject);</p>
<p>If one of the .flv video files is missing from the directory the FLVplayback will continue to buffer and look for the missing .flv video file rather than continue to the next .flv video file.<br />
Would you David or anyone out there possibly know the solution to this problem?</p>
<p>Many thanks, Nicholas.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-185802</link>
		<pubDate>Mon, 19 May 2008 21:00:22 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-determine-completion-of-flv#comment-185802</guid>
					<description>&lt;strong&gt;To jeep ...&lt;/strong&gt;

Glad to hear that!  :)

&lt;strong&gt;To Nicholas ...&lt;/strong&gt;

What you describe &amp;#8212; overwriting FLV files on a server &amp;#8212; isn't something Flash Player can do (and I figure you know that), but by all means, the idea is a good one.  You can certainly upload and overwrite existing files with an FTP client.  As long as they're named the same thing (here, always video1.flv, video2.flv, and video3.flv), Flash Player will simply load the newest ones.  Just reference those files names in your code.  What's your question?</description>
		<content:encoded><![CDATA[<p><strong>To jeep &#8230;</strong></p>
<p>Glad to hear that!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>To Nicholas &#8230;</strong></p>
<p>What you describe &mdash; overwriting FLV files on a server &mdash; isn&#8217;t something Flash Player can do (and I figure you know that), but by all means, the idea is a good one.  You can certainly upload and overwrite existing files with an FTP client.  As long as they&#8217;re named the same thing (here, always video1.flv, video2.flv, and video3.flv), Flash Player will simply load the newest ones.  Just reference those files names in your code.  What&#8217;s your question?
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
