Sorry, maybe I do something wrong but I can not get playheadTime
var movie_flv:mx.controls.MediaDisplay;
var nc:NetConnection=new NetConnection();
nc.connect(null);
var ns:NetStream=new NetStream(nc);
ns.setBufferTime(3);
ns.onStatus=function(info){
if (info.code=="NetStream.Buffer.Full"){
bufferClip._visible=false;
}
if (info.code=="NetStream.BufferEmpty"){
bufferClip._visible=true;
}
if (info.code=="NetStream.Play.Stop"){ //this place
not always works/ So when video finished
ns.seek(0);
}
}
theVideo.attachVideo(ns);
ns.play("video/shoeshdmaster_vp6520.flv");
var videoInterval=setInterval(videoStatus,10);
ns["onMetaData"]=function(obj){
duration=obj.duration;
}
function videoStatus(){
trace(movie_flv.playheadTime) ///trace undefined
}
2007/1/18, Karina Steffens <[EMAIL PROTECTED]>:
Privyet Natasha,
Here's how I solved it:
Private var movie_flv:mx.controls.MediaDisplay;
private var t:Number;
private var lastCheck:Number;
Private var play_btn //ToggleButton
....
Private function checkStatus(){
if (play_btn.selected && movie_flv.playheadTime &&
movie_flv.playheadTime == lastCheck){
stopMovie()
}else{
lastCheck = movie_flv.playheadTime;
}
}
public function stopMovie(){
//This is where you execute you stop movie code, sent from
checkStatus or remotely
clearInterval(t)
play_btn.selected = false;
movie_flv.stop()
lastCheck = 0;
//Etc...
}
//And when you start playing:
t = setInterval(this, "checkStatus", 2000)
----------
And of course, this code can modified to suit your needs. You can also
replace the setInterval with onEnterFrame=checkStatus; and delete
enterFrame; in the stopMovie() handler or equivalent. The play_btn in my
code refers to a custom ToggleButton that switches between
playing(selected) and paused(deselected) states. You might still be able
to
use that check with a different toggle button control, or alternatively,
set
a flag variable to check if the movie is currently paused.
Hope this helps,
Karina
> -----Original Message-----
> From: natalia Vikhtinskaya [mailto:[EMAIL PROTECTED]
> Sent: 18 January 2007 10:00
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] how to know that thae video is finished?
>
> Thank you very much for help. I used this for two different
> flv videos.Ichecked status for both:
> For one I have this trace
>
> NetStream.Play.Start
>
> NetStream.Buffer.Full
>
> NetStream.Buffer.Flush
> NetStream.Buffer.Empty
>
> and for another
>
> NetStream.Play.Start
>
> NetStream.Buffer.Full
>
> NetStream.Buffer.Flush
>
> NetStream.Play.Stop
>
>
>
> I am not big expert in video. Can anybody explain why one
> video has status NetStream.Play.Stop and another not? And how
> to write script that find that video is finished for any video.
>
>
>
> 2007/1/18, Matthias Dittgen <[EMAIL PROTECTED]>:
> >
> > use this:
> >
> > myNetStream.onStatus = function(infoObject:Object):Void {
> > if (debug==true)
> > {
> > status_txt.text += "status (" + this.time + " seconds)\n";
> > status_txt.text += "\t Level: " + infoObject.level + "\n";
> > status_txt.text += "\t Code: " + infoObject.code + "\n\n";
> > }
> > if (infoObject.code=="NetStream.Play.Stop")
> > {
> > // VIDEO FINISHED..
> > // use some Delegate.create(...) here
> > }
> > }
> >
> > HTH,
> > Matthias
> > _______________________________________________
> > [email protected]
> > 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
> >
> _______________________________________________
> [email protected]
> 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
>
_______________________________________________
[email protected]
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
_______________________________________________
[email protected]
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