Day 99 of 100DaysOfSpec, loading the media resource, contd.
I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft's official opinion of the spec. Subsections not listed below were read without comment.
UAs = user agents = browsers, etc.
Continuing to read in 4.7.10.5 Loading the media resource
Some extra info after the algorithms from the previous days’ notes.
The preload
attribute takes one of the following keywords, which can be changed while the media resourced is being buffered or played:
none
: hint that the user might not need this resource, or that the server can save on traffic.metadata
: hint that the user might not need the resource, but it might be a good idea to fetch metadata and possibly the first few frames. Metadata includes dimensions, duration, etc, and fetching that will put thereadyState
attribute atHAVE_METADATA
. If some frames are fetched, that attribute will likely beHAVE_CURRENT_DATA
orHAVE_FUTURE_DATA
. I’m curious as to what the use case might be for setting thepreload
attribute tometadata
…maybe some perf black magic?auto
: Hint that the UA can load as much as it sees fit for the user.- The empty string value for
preload
, like theauto
keyword, has an Automatic state.
HTML authors can dynamically switch this preload
attribute value once playback begins (i.e. don’t download the video unless the user clicks play, in which case ZOMG DOWNLOAD NOW).
The UA can choose to ignore the settings in this attribute, as it is just a hint. This is supposed to be in service of UX though: taking user settings or being smart about connectivity health. The autoplay
attribute can also override preload
. It’s okay, validation-wise, if those two attributes don’t agree.
There’s a buffered
attribute that returns an object representing how much of the media resource the UA has buffered.