Day 92 of 100DaysOfSpec, the source element
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.
4.7.8 The source element
“The source
element allows authors to specify multiple alternative media resources for media elements.” That is, audio
and video
elements.
- Can’t stuff any content inside this element.
- Attributes besides globals are
src
andtype
(of resource).src
is required. - No end tag or ARIA roles.
- Probably relevant to some folks: “Dynamically modifying a source element and its attribute when the element is already inserted in a video or audio element will have no effect.” You want to instead mess with the
src
attribute on thevideo
oraudio
element. - Hey, this area of the spec actually gives some example MIME types for the
type
attribute! *celebratory trumpet sound* - That type attribute can help the UA determine if the file is a useful media type worth fetching.