Day 94 of 100DaysOfSpec, media elements

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.10 Media elements

This section presents the media elements’ (audio and video) IDL interface and goes more into depth about commonalities across media elements. Those shared attributes include src, crossorigin, preload, autoplay, mediagroup, loop, muted, and controls.

4.7.10.1 Error codes

Media elements have an error status associated with them: a MediaError object stored in the error attribute. It would appear that this status only tracks one most recent error at a time. You can return such an error code by getting media.error.code.

Error codes:

  • MEDIA_ERR_ABORTED: fetching stopped at user’s request (stop loading a slow web page, I think might be an example)
  • MEDIA_ERR_NETWORK: a network error stopped the fetch. This error would be thrown only if the UA already determined that the media resource was a usable file; same with MEDIA_ERR_DECODE.
  • MEDIA_ERR_DECODE: now here’s the BS-y error! “An error of some description occurred”. Ok?
  • MEDIA_ERR_SRC_NOT_SUPPORTED: “The media resource indicated by the src attribute was not suitable.”

4.7.10.2 Location of the media resource

The only info I think might be new here since a previous section is that there’s a currentSrc IDL attribute on the media element that gives…the current source. It starts out as an empty string, and could be accessed in scripting languages via media.currentSrc.

Comments