I'm working on a Flash browser game that will download large amounts of external MP3s through the use of URLRequest
. I want to cache those MP3s on the user's computer so they don't get re-downloaded every time the user plays the game in order to save some server bandwidth.
I could use SharedObject
or FileReference
, but both require user interaction at some point. If the SharedObject exceeds a certain size, a popup appears asking the user for permission to increase the size. And with FileReference, the user has to confirm saving the file. Is there any way to do it without requiring any interaction from the user? It seems there is a way with AIR, but I don't want to go that route.
edit: I've done some testing, and the browser does not seem to cache things. I uploaded a webpage and test Flash, which loads an external 4 MB MP3 file and displays a progress bar. The first time I opened the page in my browser, I let it load normally. Then I navigated away from that page, used Net Limiter to limit my download speed to 5 KB/s, and went back to my test page. If the browser did in fact cache it, the MP3 should have immediately completed downloading, but instead it started at 0% and filled very slowly to 100%. I also tried the reload button, opening the test page in a new tab, and restarting the browser, but with the same results. I tried this with Chrome and IE11.
edit2: It seems file caching settings are set server side. My test server was a free webhost. It doesn't seem like I can alter those settings.