Day 95 of 100DaysOfSpec, media elements, 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.

4.7.10 Media elements

4.7.10.3 MIME types

With some MIME types, you can describe the media resource with a codecs parameters (video/mp4; codecs=“stuffgoeshere”).

MIME types are not necessarily a silver bullet, a guarantee that the UA can definitely play a media element with that resource. They’re merely suggestions that a resource is playable, and they can help rule out the usability of some files (like if a resource’s MIME type is specified as “pineapple”, and I can’t play a pineapple file, that is helpful).

Accordingly, the canPlayType() method returns very non-committal messages: an empty string (can’t play), maybe, or probably.

“The MIME type application/octet-stream with no parameters is never a type that the user agent knows it cannot render.” It has to treat this type as if there’s not really any type information at all. The “no parameters” bit is important; if of a resource of this type has parameters, then it can be treated as a specific MIME type.

4.7.10.4 Network states

The networkState attribute stores the media element’s current network activity. Values:

  • NETWORK_EMPTY: nothing has happened yet
  • NETWORK_IDLE: resource has been selected by the algorithm, but nothing currently happening
  • NETWORK_LOADING: UA actively trying to download the resource’s data
  • NETWORK_NO_SOURCE: algorithm is active, but hasn’t found a resource to use yet

Comments