Reputation: 6320
If you put video
tags on a page, with not much other attributes other than src
(just a onclick
javascript handler), what is the usual behavior of browsers? Will they download the video(s) completely? Just some frames? Is this browser specific?
I have been asked to review a site, which showcases a lot of videos, so I am just curious.
Upvotes: 2
Views: 2529
Reputation: 25511
This behaviour is browser specific and as browsers get updated so often it may change over time. I believe the spec 'advises' the default to be 'metadata' (see below).
There is a 'preload' attribute which can have several values to instruct the browser to do what you want. It is a 'hint' attribute so browser do not have to follow it:
If the attribute is present with not value or an empty string then is taken as auto case above.
Its worth being aware that this page may be ignored in some cases - one common example was browsers on mobile devices which in the past generally ignored preload to protect a users data usage, although this is changing now.
More info here - worth checking as browsers change often: https://developer.mozilla.org/en/docs/Web/HTML/Element/video
Its probably worth mentioning also that if the video server is providing the video in a streamed format such as HLS or MPEG DASH, then the client will typically only download enough of the video to fills its buffer anyway. These protocols split the video into segments or chunks which the client downloads as required.
Upvotes: 5