Skip to main content

Day 100 of 100DaysOfSpec, 4.7.10.6 Offsets into the media

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.

Omg! It’s here! I did it! All 100 (work)days. Planning to do a little recap post of the experience, so this one might feel a little anti-climatic as a last post.

Currently reading in 4.7.10.6 Offsets into the media resource

media.duration returns the length of the media resource in seconds, assuming a zero start time. Can also return “NaN” (missing duration metadata) or “Infinity” (our case again of the ever-streaming radio station, for example).

media.currentTime returns the playback position in seconds. You can also use this to jump the user to a particular point on the video or audio.

A media resource has a media timeline, spanning from its “earliest defined position” to the duration as final position point. A start point can include an explicit time and date—I suppose this is involved in scheduled live streaming video/audio—and that info can be accessed using the getStartDate() method. The start needs to be >= 0.

The media timeline is always linear, even if the data it spans is discontinuous, out of order, or overlaps original timestamps. The example they give is two clips that have been combined into one video; they lose their old timelines and instead get the new combined one.

The UA has been given the power to make a reasonable determination about timelines in the rare cases that a media resource has no explicit timelines or any timings at all (such as frame durations). Examples include animated GIFs and JPEG-push format.

Media elements have a:

  • current playback position
  • official playback position (which is approximately the current, but “is kept stable while scripts are running”)
  • default playback start position: originally set to zero sec, allows the element to be “seeked” before it’s done loading, which would come in handy, I think, if you want to jump the user to a particular point along the video/audio.
  • show poster flag: set to true when the media element is created
  • initial playback position: initially zero seconds, updated when a media resource is loaded

The currentTime attribute returns the default playback start position; if zero, it returns the official playback position instead.

There’s plenty more to this section and I thought I’d summon the strength to read the whole thing today, but nope nope nope nope. Way to finish strong! 🎉🎉🎉

Responses

My blog uses Webmentions. Responses from Mastodon and other sites that send Webmentions will show up here.

No Webmentions have been sent to this post yet.