;

PDA

Click to See Complete Forum and Search --> : flv totalTime retuns 0 unless played through once???


var gotMilk
03-08-2007, 05:52 PM
when i trace totalTime on my flv it returns it as 0?
anyone know why?

when you watch the flv video through once and it rewinds back, the totalTime returns the correct time and not 0.

this is really mashing my head. please help.
this is the code i am using.


attachMovie("FLVPlayback", "media", 1, {x:2, y:2});
var stageW = 640;
var stageH = 480;
var playingMovie = false;
media.width = stageW;
media.height = stageH;
media.contentPath = "video.flv";
media.stop();


playbtn.onPress = function() {
playingMovie = true;
playbtn.removeMovieClip();
};
media.volumeBar = volBar;

// this is just to display the totalTime in a textbox instead of tracing.
_root.playtimer = media.totalTime;

this.onEnterFrame = function() {
_root.gbl = media.bytesLoaded;
_root.gbt = media.bytesTotal;
_root.bloaded = media.bytesLoaded;
_root.btotal = media.bytesTotal;
_root.percent = Math.ceil(_root.gbl/_root.gbt*100)+"%";
_root.lbp = Math.ceil(_root.gbl/_root.gbt*100);
if (playingMovie == true) {
media.play();
} else {
media.pause();
}
};

rdoyle720
03-09-2007, 01:31 PM
You can't read the totalTime until it's received the metadata for the .flv file. If you look in Flash Help under FLVPlayback.totalTime you'll see example code to retrieve that number.