I have an flv that I am streaming into my flash project using the netStream object. It has a obj.duration of 15.03 seconds using the code below rounds off the value to 15 seconds. Oddly enough, this rounding off cuts out like the very last frame of the video and consequently produces a unfinished appearance.
My question is, is there any other way to code this so that the video plays its entire length?
_root.stop();
var netConn = new NetConnection();
netConn.connect(null);
var ns = new NetStream(netConn);
my_video.attachVideo(ns);
ns.setBufferTime(5);
ns.play("videos/indenial_25p_VP6_768K360_Stream.flv");
//ns.play("videos/indenial_25p_VP6_768K_Stream_001.flv");
//
getTotalTime = function () {
ns.onMetaData = function(obj) {
_global.videoDuration = obj.duration;
trace(obj.duration);
};
};
// monitors the current position of the playhead against the total playing time
onEnterFrame = function () {
getTotalTime();
totalPlayingTime = Math.round(_global.videoDuration);
currentPlayingTime = Math.round(ns.time);
//totalPlayingTime = _global.videoDuration;
//currentPlayingTime = ns.time;
//trace(totalPlayingTime)
//trace(currentPlayingTime)
if (totalPlayingTime == currentPlayingTime) {
//ns.seek(0);
// ns.pause();
ns.close();
// ns.play()
gotoAndPlay("end_denial");
}
};