mardi 20 juin 2017

Preloading video content in EmberJS

I'm building an EmberJS app that is effectively a slideshow and the slides are either images or videos.

I've found that, as each slide is loaded, there is a short delay whilst the image or video was loaded from the server.

In order to stop this delay, I've added a function to my application controller that extracts a list of the image urls from my models and then calls images.forEach(i => { (new Image()).src = i }); on them. This has resulted in the slide rendering almost instantly, as the images are now loaded from the cache.

I was wondering whether there is something similar that I can do with the list of video URLs? The only info I've been able to find about preloading involves adding a preload attribute to the video tag but this won't work as the page HTML doesn't get rendered until the slide loads...




Aucun commentaire:

Enregistrer un commentaire