netStream

Is there a way when you load an flv and use the netConection and then netStream to find out the end frame of the flv when it has loaded in?
Basically the last frame of the video.

The reason for this is if the video is finished I want it to go back to the first frame.

There is no property ._totalframes or method like onComplete for video, but may be you can calculate this with little Math.

currentFrame = my_ns.currentFps * my_ns.time
lastFrame = my_ns.currentFps * videoLength

also you can check the same with (time >= videoLength)

note that video doen’t have Length property like sound.duration, but this can be get it from any vedio player or Editing software.

Hope this will help you.
Regards
Ajo.k.jose

currentFrame = my_ns.currentFps * my_ns.time
lastFrame = currentFps * videoLength

also you can check the same with (time >= videoLength)

WHERE ARE YOU GETTING THESE VARIABLES FROM
videoLength
currentFps
???

.currentFps and .time are not variables proptities of netStream class

.currentFps - The number of frames per second being displayed.
.time - Read-only; the position of the playhead, in seconds.

for more info please see NetStream class or Communicationserver documentation

videoLength is a variable, that store total time of vedio in seconds.

any furthere doubts please feel free to ask
Ajo K Jose

var nConnection:NetConnection = new NetConnection ();
nConnection.connect(null);
var nStream:NetStream = new NetStream (nConnection);
vVideo.attachVideo (nStream);
nStream.play(“name_of_ur_flv.flv”);
nStream.onStatus = function (vInfo:Object):Void {

if (vInfo.code == "NetStream.Play.Stop") {
//if u want to play the video again u can use:
       this.seek(0);

}
}

Ah that works great
[AS]nStream.onStatus = function (vInfo:Object):Void {
if (vInfo.code == “NetStream.Play.Stop”) {
}
}
[/AS]

Thanks so much

hehehe…great! :wink:

offline it works fine !! But g-shock, when stream is down or stoped coz of low bandwidth .code return “NetStream.Play.Stop” . isn’t it? and that doesn’t mean that video completely Over. Please clear my Doubt.