Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

auto-preloading, without autoplay


I'd really love to be able to preload as well, but to be much use to me (in my current application), it would also need to be playlist aware.

Then, just to push this even further, to be able to use the RSS feed to tell the player which playlist items to start preloading would be just the cream on this cake.

The application: the site I'm developing on has a number of playlists that run [graphic1][graphic2][flv][graphic3]. These are only called by the user who is already pretty much committed to watching the clip (they know what's coming).

The first two graphics are on screen for a total of 20 seconds (unless skipped) and it would be wonderful to be able to start the flv preloading in the background while people look at the images. On a slower (but no dialup) connection, this would ensure that at least 1/2 of our video was ready to play unless the user intervened.

67 Community Answers

JW Player

User  
0 rated :

If you really want to preload, Google something like "javascript image preloader".

Image preloaders have been around for many years, but aren't used much anymore with broadband being widespread.

Here's a javascript image preload using an array from:

http://builder.com.com/5100-6371-5214317.html

<script language="JavaScript">
function preloader()
{
// counter var i = 0;
// create object imageObj = new Image();
// set image list images = new Array();
images[0]="image1.jpg"
images[1]="image2.jpg"
images[2]="image3.jpg"
images[3]="image4.jpg"
// start preloading
for(i=0; i<=3; i++)
{
imageObj.src=images[i];
}
}
</script>

And there are hundreds more examples around. Just be aware of the bandwidth consumption and don't ever say we didn't warn you.

JW Player

User  
0 rated :

Thanks for giving the heads up on that option for images, but I can't see that this would work with flash video. Please correct me if I'm wrong and this would work for video, but I thought that imageObj was specifically image only.

As you say, there's not too much point in preloading images most of the time due to the increasing of connection speeds - we're just not as far ahead of the curve for video data rates yet.

Thanks again for solving the image issue :)

JW Player

User  
0 rated :

Thanks Will,

I did Google search and turned up pretty much what you've found. These require me to either do this myself inside the Flash (which I don't have the software or know-how to do, or I probably wouldn't be here asking - I'm sure it's pretty easy if one has these skills).

All the things I've found (and the two you specifically pointed to) are for preloading Flash Movies themselves (SWF), whereas my goal is to preload a Flash Video element (FLV) to pass to the Flash Media Player to play. (Very fine definition difference there: movie vs video). Nothing I can find look like doing videos (FLV), only Movies (SWF).

The longer this goes on, the more I think it's something that would need to be added to the player itself. Maybe I should pull down the Flash demo and have a play - will need to decide how important it is...

JeroenW - I've read that you used to have code in previous versions of the player which did this exact thing. Could you please indicate if I should look into forging my own path or whether this functionality may reappear?

Thanks everyone for looking to help those of us who'd like to do this - I really appreciate it.

JeroenW

JW Player Support Agent  
0 rated :

@Josh: you might be able to get this to work with a small hack: in the PlayerController.as, in the setPlayItem(), you could send a start and a stop command to the models.

The start will setup the streaming and the stop will immediately pause the stream…

JW Player

User  
0 rated :

A lot of discussion, but I really do not see a reason, why the player do not provide the *option*. The default should be *off*, but the user who wants to use this featruere should be able to do this on their choice. :s

JW Player

User  
0 rated :

Until something better comes along, how about loading the player with 'autostart', 'true' and sending the player a pause command.

You will need the additional javascript code from this page [url=http://www.jeroenwijering.com/extras/javascript.html]JAVASCRIPT CONTROL EXAMPLES[/url]

Additional javascript:
bc.. <script type="text/javascript">
// some variables to save
var currentPosition;
var currentVolume;
var currentItem;

// these functions are caught by the JavascriptView object of the player.
function sendEvent(typ,prm)
{
thisMovie("mpl").sendEvent(typ,prm);
};
function getUpdate(typ,pr1,pr2,pid)
{
if(typ == "time")
{
currentPosition = pr1;
}
else if(typ == "volume")
{
currentVolume = pr1;
}
else if(typ == "item")
{
currentItem = pr1; setTimeout("getItemData(currentItem)",100);
}
var id = document.getElementById(typ);
id.innerHTML = typ+ ": "+Math.round(pr1);
pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
if(pid != "null")
{
document.getElementById("pid").innerHTML = "(received from the player with id _"+pid+"_)";
}
};

// These functions are caught by the feeder object of the player.
function loadFile(obj) { thisMovie("mpl").loadFile(obj); };
function addItem(obj,idx) { thisMovie("mpl").addItem(obj,idx); }
function removeItem(idx) { thisMovie("mpl").removeItem(idx); }
function getItemData(idx)
{
var obj = thisMovie("mpl").itemData(idx);
var nodes = "";
for(var i in obj)
{
nodes += "<li>"+i+": "+obj[i]+"</li>";
}
document.getElementById("data").innerHTML = nodes;
};

// This is a javascript handler for the player and is always needed.
function thisMovie(movieName)
{
if(navigator.appName.indexOf("Microsoft") != -1)
{
return window[movieName];
}
else
{
return document[movieName];
}
};
</script>
<code>

Your HTML <body> should look something like this:
<code>
<body>

<div id="player">
<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a>
to see this player.
</div>

<script type="text/javascript">
var so = new SWFObject('flvplayer.swf', 'mpl', '200', '100', '7');
so.addVariable('displayheight', '100');
so.addVariable('file', 'http://my.domain.com/path-to-file/video.flv');
so.addVariable('width', '200');
so.addVariable('height', '100');
so.addVariable('enablejs', 'true');
so.addVariable('javascriptid', 'mpl');
so.addVariable('autostart', 'true');
so.write('player');
var t = setTimeout("sendEvent('playpause')", 100);
</script>

</body>



*Note that if you change the "javascriptid" of the player, you must also change ALL occurrences of "mpl" in the additional javascript code.*

By varying the time ( currently set at 100 milliseconds ) in this line:
bc.. var t = setTimeout("sendEvent('playpause')", 100);


you can let a few frames of the video play, which will show an image in the player.

JW Player

User  
0 rated :

Hmmmmm....

Let's try that again so the code shows clearly.

Until something better comes along, how about loading the player with 'autostart', 'true' and sending the player a pause command.

You will need the additional javascript code from this page [url=http://www.jeroenwijering.com/extras/javascript.html]JAVASCRIPT CONTROL EXAMPLES[/url]

Additional javascript:
bc.. <script type="text/javascript">
// some variables to save
var currentPosition;
var currentVolume;
var currentItem;

// these functions are caught by the JavascriptView object of the player.
function sendEvent(typ,prm)
{
thisMovie("mpl").sendEvent(typ,prm);
};
function getUpdate(typ,pr1,pr2,pid)
{
if(typ == "time")
{
currentPosition = pr1;
}
else if(typ == "volume")
{
currentVolume = pr1;
}
else if(typ == "item")
{
currentItem = pr1; setTimeout("getItemData(currentItem)",100);
}
var id = document.getElementById(typ);
id.innerHTML = typ+ ": "+Math.round(pr1);
pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
if(pid != "null")
{
document.getElementById("pid").innerHTML = "(received from the player with id _"+pid+"_)";
}
};

// These functions are caught by the feeder object of the player.
function loadFile(obj) { thisMovie("mpl").loadFile(obj); };
function addItem(obj,idx) { thisMovie("mpl").addItem(obj,idx); }
function removeItem(idx) { thisMovie("mpl").removeItem(idx); }
function getItemData(idx)
{
var obj = thisMovie("mpl").itemData(idx);
var nodes = "";
for(var i in obj)
{
nodes += "<li>"+i+": "+obj[i]+"</li>";
}
document.getElementById("data").innerHTML = nodes;
};

// This is a javascript handler for the player and is always needed.
function thisMovie(movieName)
{
if(navigator.appName.indexOf("Microsoft") != -1)
{
return window[movieName];
}
else
{
return document[movieName];
}
};
</script>



Your HTML <body> should look something like this:
bc.. <body>

<div id="player">
<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a>
to see this player.
</div>

<script type="text/javascript">
var so = new SWFObject('flvplayer.swf', 'mpl', '200', '100', '7');
so.addVariable('displayheight', '100');
so.addVariable('file', 'http://my.domain.com/path-to-file/video.flv');
so.addVariable('width', '200');
so.addVariable('height', '100');
so.addVariable('enablejs', 'true');
so.addVariable('javascriptid', 'mpl');
so.addVariable('autostart', 'true');
so.write('player');
var t = setTimeout("sendEvent('playpause')", 100);
</script>

</body>



*Note that if you change the "javascriptid" of the player, you must also change ALL occurrences of "mpl" in the additional javascript code.*

By varying the time ( currently set at 100 milliseconds ) in this line:
bc.. var t = setTimeout("sendEvent('playpause')", 100);


you can let a few frames of the video play, which will show an image in the player.

JW Player

User  
0 rated :

Thanks again for those coming through with suggestions. The issue for me is that the video isn't the first item in the playlist, so I effectively need it to be preloading while something else plays.

I think this means that a load/javascript pause isn't going to work for me - is that right? This would only work to cache the currently playing movie...?

JW Player

User  
0 rated :

@Josh,

Well, you could have the movie that you want to cache as number 1 and 3 on your playlist.

Autostart/pause number 1
Load and play number 2
Later, the user selects and plays number 3 which has been cached.

I'm not sure if number 1 will continue to download if you start number 2 -- it would have to be tested.

JW Player

User  
0 rated :

Funny, I think the opposite fonction would be much more interesting !
Think about people with slow connexion, dealing with many flash content pages (like thoses stupid myspace blogs !)and waiting for all files to load ! A "stop" button would be great, stopping the video (of course !) AND stopping file loading, to keep bandwidth for another flash objet to load...

JW Player

User  
0 rated :

@Dan,

It seems that web sites that have to deal with users on low-bandwidth connections like to have preloading. Maybe entertain the user with a small clip while the larger video loads at least enough to play smoothly without pausing to download some more of the file.

JW Player

User  
0 rated :

On error in downloading flv can we show image with no video available?

JeroenW

JW Player Support Agent  
0 rated :

You can always load an image that says something like “please wait – buffeing video”.

JW Player

User  
0 rated :

Can you not do this within the actionscript? I am a complete newbie so sorry if its a stupid question.

JW Player

User  
0 rated :

@Ogaden
_Can you not do this within the actionscript?_
by this, i presume you mean preload? -
yes, but it would mean a majour rebuilding of the player,
and it would not help, the way many people imagine! - so it is not really worthwhile to do!

the simplest and quite effective way to preload, is to have an invisible and muted player fetch the file - so that it is already in the cache when the user wants to play it. this takes no change of the player, and is about as effective as any more complicated method would be...

JW Player

User  
0 rated :

I think the day will come that Jeroen is going to give us the prebuffering option back :)

JW Player

User  
0 rated :

@me - in the meantime you can use the method describe in the previous posting -
use an invisible and muted player to fetch the song/video to cache,
its simple, effective and takes no modification of the players...

JW Player

User  
0 rated :

Javascript preloads are fine when you are talking about 5 or 10 videos - it works a treat, but when you have a website with 2,000 or 4,000 videos it is not the way to go - in fact its impossible. I like the preload idea as an option in flash vars....

JW Player

User  
0 rated :

@CoolPics et al

_you have a website with 2,000 or 4,000 videos it is not the way to go - in fact its impossible_
you dont want to start downloading whole sites indiscriminately anyhow (or not with a player then, but a _downloader_)

when preloading using javascript and an extra hidden player, the action is all clientside and the number of media on the site is completely irrelevant.

the trick is to just have the other player get the next media in the list while the first is playing -
then it is ready in the cache for immediate playing by the first player...

BUT - to me, there is a _huge paradox_ in the whole discussion on preloading:

when people are on lines fast enough, preloading is not needed.
when people are on slower lines, in general preloading will not help -
because you will just block the line with two videos instead of one (or a longer wait before playing).

so instead of making changes to the player, that wont make people happy anyway
or make complicated scripts, that only in extremely rare cases will have any effect at all -
let the users decide how to play, chuncky on slow lines or realizing their downloadspeed,
waiting till they see the downloadbuffer is full and then play smooth.

unless there is something i havent understood?

JW Player

User  
0 rated :

+1 for adding as an option, and putting the control in the hands of the web developer. There are a few instances where this would be _perfect_, and it would be great not to hack something together. It certainly would be consistent with making all these configuration options, which is why I love these players so much.

Thanks for all your hard work, Jeroen.

JW Player

User  
0 rated :

As an extension of the code added by Will:
bc.. var t = setTimeout("sendEvent('playpause')", 100);


I've made a more complicated one that waits for the page to load, mutes the video, plays it for a second, then pauses and unmutes it.

bc.. // quickly mute, play, pause, and unmute the video, then it will load
// in the background
function startPreload()
{
var a=setTimeout("thisMovie('flashplayer').sendEvent('volume',0)", 400);
var b=setTimeout("thisMovie('flashplayer').sendEvent('playpause')", 500);
var c=setTimeout("thisMovie('flashplayer').sendEvent('playpause')", 1500);
var d=setTimeout("thisMovie('flashplayer').sendEvent('volume',100)", 1600);
}

// function for adding load events instead of document.onload
function addEvent(obj, evType, fn){
if (obj.addEventListener){
obj.addEventListener(evType, fn, false);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent('on'+evType, fn);
return r;
} else {
return false;
}
}

// start the preloader when the page loads
addEvent(window, 'load', startPreload);



This works the best if the first few frames of your video is a still image.

JW Player

User  
0 rated :

Also, +1 more for adding as an option. Background, this is for use on an internal corporate LAN that for some reason makes the videos load slowly, so preloading was the only option to get the video to play non-choppy without appearing to take forever to start.

JW Player

User  
0 rated :

@lowbatteries,

WOW! That's scary to see somebody extending my code. :d

Actually, we need to get away far away from setTimeout(). Then andersen will be _*much happier*_, and our code will work better.

So, I'm going to take a long, hard look at your extension and re-code it without setTimeout().

And what's up with your LAN? You should have 100mbps over it (or 1gbps if that's what you have). The videos should load so fast it tears your eyeballs from their sockets! :d

JW Player

User  
0 rated :

I'm adding my vote for autopreloading to come back. This is a critical feature for our product, because we are delivering high quality video that may require a preload before playing. I've hacked it similarly to what has been described here using the getEvent callback, but it sucks because the splash image disappears.

I suppose I could rig that up with an absolutely positioned image and some crazy click-thru magic, but that's overkill for what should be a pretty simple feature on the JW FLV end. Operators need to be responsible for their own bandwidth.

JW Player

User  
0 rated :

Here's how I pre-load the flv files into the cache.. At least for the older version. I did a lot of debugging and found this to be the best way.

ns.setBufferTime(0);
ns.play(file);
ns.pause();
ns.seek(0);

JW Player

User  
0 rated :

The answer to my question is probably in this thread somewhaere but I don't see it: Is it possible to give the end user some control over the preloading. I have a very large video on my site for which I am using WordTube 1.53. Someone watching the video may decide to stop before it is completely loaded but stopping play does not stop loading the video.

JW Player

User  
0 rated :

You can show the stop button on the player's control bar. Clicking on the stop button will stop the download. Since it is only a black square, you may need to provide some descriptive text with an image for the user.
bc.. s1.addVariable('showstop', 'true');

JW Player

User  
0 rated :

vb bvnbvnvcbnbv

JW Player

User  
0 rated :

If you have flash pro installed and want to alter the player to get it to autobuffer without using javascript, here's a quick hack that I used (based on Jeroesn's suggestion http://www.jeroenwijering.com/?thread=4379#msg25350 )

In the PlayerController.as file, above

bc.. if(config["autostart"] == "false") {


put

bc.. if(config["autobuffer"] == "true") {
sendChange("start",feeder.feed[currentItem]['start']);
isPlaying = true;
sendChange("pause",feeder.feed[currentItem]['start']);
isPlaying = false;
}



and then in the MediaPlayer.as file, put

bc.. autobuffer:"false",


in the config:Object:

bc.. /** Array with all config values **/
private var config:Object = {
clip:undefined,
file:"playlist.xml",
height:undefined,
width:undefined,
controlbar:20,
displayheight:undefined,
frontcolor:0x000000,
backcolor:0xffffff,
lightcolor:0x000000,
screencolor:0x000000,
autoscroll:"false",
displaywidth:undefined,
largecontrols:"false",
logo:undefined,
showdigits:"true",
showdownload:"false",
showeq:"false",
showicons:"true",
showstop:"false",
thumbsinplaylist:"false",
usefullscreen:"true",
fsbuttonlink:undefined,
autobuffer:"false",
autostart:"false",
bufferlength:3,
deblocking:4,
overstretch:"false",
repeat:"false",
rotatetime:10,
shuffle:"true",
smoothing:"true",
volume:80,
bwfile:"100k.jpg",
bwstreams:undefined,
callback:undefined,
enablejs:"false",
javascriptid:"",
linkfromdisplay:"false",
linktarget:undefined,
prefix:undefined,
recommendations:undefined,
streamscript:undefined,
useaudio:"true",
usecaptions:"true",
usemute:"false",
usekeys:"true",
abouttxt:"JW FLV Media Player 3.14",
aboutlnk:"http://www.jeroenwijering.com/?about=JW_FLV_Media_Player"
};


and then you just use it as a normal flashvar. e.g.
bc.. autobuffer=true


I've uploaded my hacked version here if you want to try it out: http://rapidshare.com/files/90603980/mediaplayeralt.swf

JW Player

User  
0 rated :

Thanks for the hack, although on your .swf the text/numbers on the player seem to have shifted down a bit, any chance of fixing this? (btw im praying for this to be in 4.0 :P )

JW Player

User  
0 rated :

hii, can anyone help me out there,

i hav a Jeroenwijering flv fullscreen player,inside a html page,

in that html page one button is there,

that button should be invisible until user click & watch half of the flv movie,

after watching that half of the movie,that html button should be automatically active,

any idea how to do this type of thing using javascript in flash

plz mAIL ME AT neeraj8585@gmail.com

JW Player

User  
0 rated :

Has there been any work done on this since this thread was created? I'm interested in pre-buffering to prevent the black box that pops up when you click play

JW Player

User  
0 rated :

very appreciate for the mediaplayeralt.swf, can the preview image remain displayed without clicking stop?

JW Player

User  
0 rated :

@Jeroenw

Hey we all think your player is great and everything, but I don't know if you see that this thread has about 60 posts of people WANTING autoload. And those are the people who actually wanted to leave a comment. I'm sure there are much more people who also want it and didn't bother to post.

We don't care about bandwidth costs, if your worried about back lash just add a comment saying your warned people or whatever. But I think that if enough people ask for something in a product, I don't know why you wouldn't offer it.

Since I don't care about bandwidth and want to use auto loading I must now result to using a hack. This makes me think that I should use another player all together.

Not supporting your clients is like closing the door on their face. I'm a software developer and WAS very interested in using this playing in an up and coming cms that is in development.

@Yansky
Thanks man! Your solution worked great!

JW Player

User  
0 rated :

i too think activating auto-preloading should be up to the user. i can't see the point why such a feature was removed, only because of some stupid guy got a bill of $600.

anyway, for me it would be enough to show an image, while the preloading the video clip. any chance, that this will come in some future version of the flash player?

thanks!

JW Player

User  
0 rated :

ok for the bill of 600$, but if I want to do this, how can I do. the site needs that to be completed.
I work on a mediaplayer with a single flv video. I don't want the autostart, so there is a picture, bt I want the video to be preloaded without play video. That's impossible ??? I don't think so.
Can you give me some help on that...
thx. SAX

Sorry for my english, I don't speak easyly

JW Player

User  
0 rated :

@SAX - use two players - an autostarting and muted player of size 0 (invisible) - it will then fetch the file to cache -
in this way it is ready to play in your visible player as quickly as possible...

JW Player

User  
0 rated :

ok, thx, it's a good idea, mc giver would find it too..
I try it, and tell you what about.
thanx you andersen
SAX

JW Player

User  
0 rated :

I have been using the hacked 3.14 version because I really want/need this functionality. Can anyone tell me if anything has changed with version 4.0? I can't update until this feature is in there.

JW Player

User  
0 rated :

I still cannot find a preload or autobuffer option at the public download and I don't want to use any hacks. The "play and pause"-hack has one big drawback: The initial picture shown before the videos starts (image=intro.jpg) is removed then.

I just bought a license for the player expecting to have a preload function included, which seemed so basic and naturally to me, that I didn't expect to find this discussion here. Now I'm very angry to miss this important feature. There are no clear arguments against this feature and the use of this feature should be left up to the user.

@JeroenW: Please include the feature again. I would be sorry to have to return my order otherwise.

JW Player

User  
0 rated :

About preloading a video, I think that people know that playing a video in a web browser would take some time to load. So I don't think it's that necessary.

My problem is that I use the video player to play image galleries, like slideshows. I don't like the image rotator because it doesn't shows the playlist, and I want the user to preview pictures.

Before starting the player, it shows the thumbnail of the first picture. That's correct.
But when it's buffering the following pictures, thumbnails aren't displayed. Don't know why, but I think that it would be better to show "something" to the user.

Besides, I think that a preload function would be a great help, given that users that have started a slideshow are expected to see at least some pictures.

I tried to make a javascript to preload images but they take a long time to load, no matter if they already are in the browser cache, or if they have been already displayed in the player. It's as though the player was fetching the pictures again from the server.

Cheers

JW Player

User  
0 rated :

You might take a look at some alternate thumbnail menus that work with the media player.

ImageFlow: *http://194.95.111.244/~countzero/scripts/_myImageFlow/*

A horizontal scrolling menu of thumbnails: *http://willswonders.myip.org:8085/php/scrolling_div_only.html*

JW Player

User  
0 rated :

@basic: is that for me?
The main problem I found with the video player for displaying images is that no matter if the picture is already in cache, the player would load it again.

Cheers

JW Player

User  
0 rated :

@Marcos,

Yes, those links were for you.

Is the media player really re-downloading the images or only making a request that is answered by a "304 Not Modified" response from your server.

If the images are being re-downloaded, your server is mis-configured. The player makes a conditional GET which should be answered by a 304.

*http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html*bc.. 10.3.5 304 Not Modified
If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields.

JW Player

User  
0 rated :

*Preloading .flv files with Actionscript*

The actionscript is easy, it opens a connection to the .flv file, sets the buffertime to 0, plays the video and immediately pauses, then seeks the position back to 0.

Its relatively easy to get this to work, heres all the actionscript you will need to preload any .flv file. Just create a new flash document, and on frame 1 enter in this actionscript. You can also search your flash help for preloading for more help.

bc.. var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
//attach videodisplay
_level0.attachVideo(ns);
ns.setBufferTime(0);
ns.play('http://yourdomain.com/flv/movie.flv');
ns.pause();
ns.seek(0);

JW Player

User  
0 rated :

@JeroenW: Please include this feature again

JW Player

User  
0 rated :

how abou from zshare.net can you show me scrip please am really need help

JW Player

User  
0 rated :

JeroenW you have script for zshare.net? please am really need help!!!!!!!!!!!!!!!!!!!1

JW Player

User  
0 rated :

bc.. kamostaa@yahoo.com

JW Player

User  
0 rated :

Was there a solution to this problem? Because I'm having the same problem with this.....

JW Player

User  
0 rated :

WOW! I understood Josh's original question but I don't think everyone fully understood it on this thread. This entire thread doesn't really address his issue.

Its as simple as this....

If an element is currently playing CAN THIS PLAYER simply PRE-LOAD THE NEXT ELEMENT in the play-list???

So that there is no pause or blank space or Dead-Air as they say.

For some of us, our strategy depends on tight programming. No blank space or even a fraction of dead space.

This has to apply to the next element on the play-list while the current element is playing.

Simple.

Can this player do it or not?

Or is there something in the Flash code that needs to be altered... ???




JW Player

User  
0 rated :

And I'm very curious about having another player on the web page that's invisible... how do this work???

Wouldn't this pre-load everything on the play-list instead of just the next element?

------------------
andersen

@me - in the meantime you can use the method describe in the previous posting -
use an invisible and muted player to fetch the song/video to cache,
its simple, effective and takes no modification of the players...
------------------

JW Player

User  
0 rated :

_"If an element is currently playing CAN THIS PLAYER simply PRE-LOAD THE NEXT ELEMENT in the play-list??? "_
No, the JW FLV Player has no functionality of any kind for preloading.

_"Wouldn't this pre-load everything on the play-list instead of just the next element?"_
It's possible to control the invisible player so it only downloads the next media file.

There are various ways to preload a media file, however, in practice, it turns out to not be practical to preload.

1) The available bandwidth has to be approximately three times the media bitrate, otherwise, the player will consume the media faster than it is downloaded, then the player will stop to buffer more media. If you have that much bandwidth available, there is no need to preload.

2) Flash is extremely CPU intensive when it is simultaneously playing and downloading. If the CPU load approaches 90%, the player will begin to stutter. This happens even without preloading when the media bitrate is high, even when there is enough available bandwidth.

3) You can use another player to preload the next media item if the playlist is being played in sequential order, so the next media item is known. The media item being preloaded must be fully downloaded before the previous media item completes playing, otherwise the player will start a second download of the next media item that it needs to start playing.

4) Flash specifically blocks the headers (HTTP Range) that would be needed to do any sort of partial downloads.

5) If the available bandwidth exceeds the media bitrate (see 1) above), there is no need to preload. If the available bandwidth does not exceed the media bitrate, the player will consume the media faster than it can be downloaded and it will eventually have to pause to buffer. Therefore, it simply does not make sense to preload.

Many experiments have been done with preloading using an invisible player, AJAX, and other methods. It always turns out to not be practical for the reasons explained above (and some others, like browser quirks in handling cached files, etc.).

JW Player

User  
0 rated :

Here is a preload method that uses the playerReady method. Just set the autoload=true in the flash vars. The code below will cause the player to pause and continue loading.

<script type='text/javascript'>
var player;

function playerReady(obj) {
//alert('the videoplayer '+obj['id']+' has been instantiated');
player = document.getElementById(obj['id']);
setTimeout("player.sendEvent('PLAY', 'false')", 500);
setTimeout("player.sendEvent('PLAY', 'false')", 750);
};
</script>

JW Player

User  
0 rated :

@JJS:

I think you meant to send "true" then "false"; in my experience the player won't preload unless it's been in an actively-playing state at some point. Or maybe you meant "auto*start*=true".

In any case, here's a simpler version that works regardless of flashvars and doesn't use any timers:
bc.. <script type="text/javascript">
function playerReady(obj) {
var player = document.getElementById(obj.id);
player.sendEvent('PLAY', 'true');
player.sendEvent('PLAY', 'false');
};
</script>

JW Player

User  
0 rated :

The second PLAY false is meant to pause the player just in case the first one was missed.

But it's better to add a Model Listener TIME and pause the player as soon as obj.position > 0.

*_But this whole pre-loading thing is insane, as has been explained many, many times previous to this!_*

JW Player

User  
0 rated :

@Matt Kantor

Hi, this code:
<script type="text/javascript">
function playerReady(obj) {
var player = document.getElementById(obj.id);
player.sendEvent('PLAY', 'true');
player.sendEvent('PLAY', 'false');
};
</script>
works and preloads the video, the problem is that the progress bar doesn't change even if the video is preloading, so the user can't recognize video is loading. The bar changes only when the user play the video going to the correct point. Do you know any solution to avoid this?

Thanks

JW Player

User  
0 rated :

What I really, truly need is something to STOP video preloading. My ISP restricts me to 300 megs a day, and now with all of the news sites featuring multiple videos on their pages, I am rapidly approaching the point where I won't even be able to just browse any more. :(

Braodband is so common, however, that it would seem that no one is interested in writing code that could stop this bandwidth leeching. I don't have a choice in ISP, either, as I live way out in the country.

Help??

JW Player

User  
0 rated :

If you hit the stop button on the player, it will stop buffering.

JW Player

User  
0 rated :

Disable Java Script...

If you are using IE then goto tools, then manage adons and then disable the Java Script...

On Firefox just tools, then options and uncheck the java script...

That should do it...

JW Player

User  
0 rated :

I've tried a few things with the player here to try to get it to preload without playing: http://toddnorwood.com/portfolio_video.php

Unfortunately, the javascript solution isn't nice enough for my client's tastes, so onto the .as

And to start my "player-licensed.fla" file won't open in cs3 professional? do I need cs4? cs2?

JW Player

User  
0 rated :

@JeroenW: you might be able to get this to work with a small hack: in the PlayerController.as, in the setPlayItem(), you could send a start and a stop command to the models.

I don't see this file in the 4.6 version... is there a more current actionscript file you could point us to?

JW Player

User  
0 rated :

I too would love to have a built in option to pre load the next flv. Can you belive the first post for this request was back in May of 2007? It's Nov 2009 now. I'm willing to pay $$$ for this. Meanwhile I'm going to search for another flv player that has the preloader funtion.

Larry the Cable Guy, Getter Done!

JW Player

User  
0 rated :

As of right now, this isn't possible in the player.

The MediaProviders (Models in 4.x) are reused between items. This means that if you had two items in a row that were of the same type (progressive download, RTMP, images, etc) loading the next item would prevent playback of the current item.

We're looking into adding this in a future version. Keep your eyes on http://developer.longtailvideo.com/trac/ticket/644.

JW Player

User  
0 rated :

I actually only want the current video to load, without playing until the user presses play, not the next one.

At this point, bufferlength, with autostart false, is the best solution: http://www.toddnorwood.com/portfolio_video.php

But ideally, the video starts loading as soon as possible, so the user waits the absolute minimum time and gets the most relevant feedback available.

This is almost accomplished with the autostart true, but we do not want the video to play until clicked.

Thanks for the input so far.

JW Player

User  
0 rated :

@Josh,

[url=http://www.google.com/search?hl=en&q=preload+flash+video+javascript]Google: preload+flash+video+javascript
[/url]
and
[url=http://www.google.com/search?hl=en&q=%22preload.swf%22]Google: "preload.swf"[/url]

turns up lots of preloading methods.

This [url=http://www.flashguru.co.uk/category/actionscript/]one[/url] has a preloader.swf that you can call from <embed> tags.

This [url=http://www.actionscript.org/forums/showthread.php3?t=76752]one[/url] appears to have a javascript preloader all done for you.

I haven't tried any of these ( yet ), but there seem to be many solutions which could be tailored to your exact situation (load one movie, load many movies, load the next movie, etc.).

JW Player

User  
0 rated :

https://addons.mozilla.org/en-US/firefox/addon/1765

this solved my problem in firefox

This question has received the maximum number of answers.