Skip to main content
transistor06
Known Participant
August 24, 2010
Answered

pre-load .flv file

  • August 24, 2010
  • 1 reply
  • 499 views

Hello again,

Seperate question:

I have created an SWF file that streams an FLV file.

What I would like to do is have the SWF load the FLV all at once at the beginning (the way a flash app might pre-load the interface).  Is this possible?

This way, when the SWF starts playing, the FLV will be loaded already, and will not have to buffer during playtime.

The FLV is only 300KB, and is an element in the interface itself, so I can't have it stuttering.

Thanks in advance!

This topic has been closed for replies.
Correct answer kglad

attached to the first frame where your component exists and its contentPath is defined, disable autoStart and, if flv is your component instance name, use:

flv.play();

flv.pause();

this.onEnterFrame=function()[

if(flv.bytesLoaded>=flv.bytesTotal){

delete this.onEnterFrame;

flv.play();

}

}

1 reply

kglad
Community Expert
Community Expert
August 24, 2010

yes, apply the play() method to your flvplayback component and immediately apply the pause() method.   you can use a loop to track the bytesLoaded and bytesTotal of your component.

transistor06
Known Participant
August 25, 2010

ok sounds great,

but where exactly do I enter these methods?

would it look something like this:

myflvplayback.play();

myflvplayback.pause();

or are they supposed to be on seperate frames that are looping?

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 25, 2010

attached to the first frame where your component exists and its contentPath is defined, disable autoStart and, if flv is your component instance name, use:

flv.play();

flv.pause();

this.onEnterFrame=function()[

if(flv.bytesLoaded>=flv.bytesTotal){

delete this.onEnterFrame;

flv.play();

}

}