I think the onComplete is only available via FMS, i think. There are a bunch of threads in the archives about this scenario but they can be difficult to find. Brian Lesser has some really good information on his site: http://echo.ryerson.ca/textPublisher/index.html
/** * This function is assigned to the playing stream onStatus in place * of the default onStatus handler above. * It writes all info.code messages to the text window as well * but also detects when the stream ends and * changes the button back to "Play" and closes the stream. * A stream has ended when two things happen in order: * 1. NetStream.Play.Stop, followed by * 2. NetStream.Buffer.Empty */ NetStreamPlay_onStatus = function(info){ writeln("NetStream.onStatus> info.code: " + info.code); if (info.code == "NetStream.Play.Stop"){ this.seenStop = true; } else if (info.code == "NetStream.Buffer.Empty" && this.seenStop){ this.close(); play_btn.setLabel("Play"); publish_btn.setEnabled(true); this.seenStop = false; } else if (info.code == "NetStream.Play.Start"){ this.seenStop = false; } } Hank Williams takes a different approach: http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2005-February/131759.html if you have set a buffer for the video, the first approach doesn't always seem to work. Dunc On 1/18/07, natalia Vikhtinskaya <[EMAIL PROTECTED]> wrote:
yes very close When the video is finished ns.time=228.528 and duration=228.66; So ns.time>=duration-0.5 give me good result. I don't know how flv was created. So this way allow me to find what I need. Thank you very much. 2007/1/18, Helen Triolo <[EMAIL PROTECTED]>: > > Does ns.time trace something close to duration, just not exactly equal > at the end? If so, just check for >= duration - somesmallamount (maybe > to do with the buffer size) instead of ==. Is this a progressive or > streamed flv, btw? > > I dug up this old flashcomm post from Brandon Krakowsky in case it's any > use: > > > I noticed that as well. I've never had good luck with > > "NetStream.Play.Stop". I think part of the problem is that > > some FLVs never get to the very end of the file - maybe .5 > > seconds before the end. > > The other part of the problem might be the encoder you're > > using. Flash 8 Encoder vs. Riva vs. Flix. > > > > I avoid the whole thing by monitoring the playhead inside of > > a setInterval or onEnterFrame, and comparing it to the > > totalTime. This way, I never have to worry about those > > objects not firing. Once again, I DO run into the problem > > where the playhead doesn't get all the way to the end, so > > tend to look for the playhead to be .5 seconds from the end, > > or more. Seems to do the trick everytime. Of course, if you > > can, make sure the videos have a little extra something at > > the end so they don't get cut off. > > > Helen > > natalia Vikhtinskaya wrote: > > > So as I understand no way to determine that video is finished with > > NetStream > > object? > > > > 2007/1/18, Karina Steffens <[EMAIL PROTECTED]>: > > > >> > >> Sorry, it's bee a while since I wrote that script, so I forgot to > >> mention > >> that movie_flv in my code is an AS2 Video Playback component that has > >> the > >> movie attached to it instead of a simple movie clip. It's located in > the > >> components panel. You might want to try theVideo.playheadTimeinstead, > >> but > >> if that doesn't work, you could try using this component instead. Or > >> better > >> yet, if you're using Flash 8, try the new video component that Muzak > >> mentioned (Flv Playback) which has a "complete" event. > >> > >> PS: I just saw Helen's post - that's definitely worth a try. > >> > >> Karina > >> > >> > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com