The preload attribute is one of the most important new features for video in HTML5. It’s a simple way to control how much video content is loaded when your page loads, which can help improve performance and reduce buffering.
In this article, we’ll cover preloading, how it works, and some things you should consider before adding the preload attribute to your site’s videos.
What Is the Preload Attribute in HTML5?
By default, videos in HTML are “lazy loaded”, meaning they won’t load until they’re actually needed. This is great for saving resources and reducing page loading speeds, but it’s not a solution that works for all websites.
Within HTML5, there is a new “preload” attribute for videos that can help solve this. It has three optional settings as well:
- Metadata will tell the browser only to fetch the video’s metadata upon page load.
- Auto will tell the browser to download the full video. This is the default option.
- None will tell the browser not to download the video, leaving you with a misshapen video player until the user presses play.
How Does Video Preload Work?
The most convenient way to explain video preload is by using an analogy:
Imagine you’re at a restaurant, and you’ve ordered your meal. While waiting for it, the waiter comes over and says: “I’m sorry; we don’t have enough ingredients right now to make this dish.” What do you do? Do you just leave? Do you wait patiently while they try their best (or not) to find more ingredients? Or do they offer some sort of compensation?
In terms of web development terms, this would be called “fallback content” – some sort of replacement element, such as an image or text message, should pop up and explain what happened. If not, the video should then load – eventually, at least.
With video preloading, you’re able to handle both scenarios. Your site can show fallback content if needed, or you can show them parts of the video until it’s ready to go.
What Are the Benefits of Video Preload?
There are a ton of reasons why video preloading is beneficial to a site, such as:
- Users can start watching a video before the entire thing has loaded, leading to a better viewing experience. And in some use cases, it can save the user resources if the video isn’t essential to the viewing experience.
- Improved page load time due to fewer requests and faster rendering times. This improves your SEO rankings and makes your website more user-friendly, leading to more conversions and sales.
- Advertisers get to improve their conversions by including ads with videos that are already playing when you land on a page or app with no wait time for buffering or loading (as opposed to waiting until after ads have loaded before playing).
Improve Your Video Preload with Cloudinary
While the default option within HTML5 is great for everyday uses, it’s fairly limited as a result. It can help improve your pages, but if you want to take it to the next level, you’ll want to use a tool to customize your videos to your business’s needs.
And with Cloudinary, you can do just that! Our Cloudinary Video Player is built atop HTML5 but with all of the amazing features that Cloudinary brings alongside it. You also have access to all of the custom features that come along with our video player, including default preloading options.
Get started with a free Cloudinary account today, and see how you can take your media to the next level.