views:

43

answers:

1

I have a page that has a table with each row corresponding to an audio file. The last cell in each row embeds a simple flash audio player. The problem is that the flash file for the player is being downloaded for each row separately and as soon as rows go beyond 40-50 it crashes the browser.

I tried using different players (1pixelout, flash-mp3-player) and the problem is still there, so its not a player specific issue.

Is there any way to cache the player so that it is only downloaded once?

screenshot alt text

A: 

Swf file with same properties should be cached in first place, you probably pass parameters to it thus the download of all instances. I'm not sure you can use one player to play 50 files the same time. try to use the smallest player you can find and set it's autoplay option to 0 or false. So player will be downloaded but file won't be played until user clicks on it.

I have page with 100 images on it, each image is about 50KB and it works fine for all users with internet above 750Kbit. So reduce player size or even write your own which has only play and stop button on it (should be about 2-5KB for each instance) and make it load file on user click.

eugeneK
The player i'm using is just 2.5 kb and it does load the audio only on user click. But the player itself getting downloaded multiple times is the problem
Gunjan
@Gunjan, because you probably pass different parameters to it or your browser has caching disabled.
eugeneK
@Gunjan even if caching is disabled and player is loaded just once, 40 instances of Flash players would be created as they're different objects on stage. So network-wise you'd be safe but memory wise the browser will die after a while
Amarghosh
@Amarghosh, I don't think that would necessarily be a problem. Multiple instances of Flash content get driven out of the same process, so you don't use 40x the resources just for having 40 SWFs. I'd say test Eugene's suggestion by trying a version of the page that doesn't pass any parameters, so you can be reasonably sure the SWF is only getting loaded once. (Incidentally, whether the SWF gets loaded more than once is up to the browser, not Flash.)
fenomas
@fenomas All the SWFs should be running even though multiple songs won't be played at the same time - may be they're running out of same FP process but that process would end up taking more and more space as the number of SWFs increase. This is not the same as reusing URLLoader instances or moving particles once they go out of stage.
Amarghosh
@Amarghosh: The only difference between 40 separately embedded SWFs and the same 40 SWFs loaded into one movie is the overhead incurred by each instance of embedding. I'm suggesting that a test with identical embed tags ought to tell the questioner whether that overhead is what's killing his app or not. (Though I'd think it would vary widely by browser - at a guess, most of the overhead is probably at the plugin interface, rather than within Flash itself).
fenomas