A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: flv totalTime retuns 0 unless played through once???

  1. #1
    IT'S GON' RAIN !!! var gotMilk's Avatar
    Join Date
    Apr 2004
    Location
    Yorkshire, England, UK
    Posts
    372

    flv totalTime retuns 0 unless played through once???

    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.

    PHP Code:
    attachMovie("FLVPlayback""media"1, {x:2y: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();
        }
    }; 

    Professional quality freelance work done by Varstudios
    Visit us here http://www.varstudios.com/services



  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center