There are several types of content which should be displayed overlayed on <video> elements, including subtitles/captions from various sources, scripted controls and more advanced scripted content such as karaoke or timed annotations. <overlay> suggested below tries to provide a simple markup to enable all such uses.

Use Case Description

Linking <video> with external captions/subtitles for native fetching/decoding/syncing by the UA.

Styling captions/subtitles with CSS, regardless of their source.

Allowing scripts to operate on captions/subtitles in a uniform manner, regardless of their source.

Possible sources of captions/subtitles include in-band (e.g. embedded in an MPEG-4 or Ogg stream), external (e.g. SRT or DXFP) or scripted (e.g. extracted from an on-page transcript) captions/subtitles.

Current Limitations

HTML5 currently lacks convenient markup and/or interfaces to handle at least these things:

Syncing and styling external subtitles/captions with <video>

Styling in-band subtitles/captions from media resources

Rendering scripted controls on top of <video> and positioning them to bottom.

Callbacks at specific times for scripted subtitles/captions (previously possible with "cue ranges")

Allowing any overlay (controls/captions/etc) to be retained in fullscreen mode.

Current Usage and Workarounds

Currently no browser supports rendering in-band subtitles and a workaround would involve extracting the captions on the server-side and sending them in another format. Fullscreen support is still immature, but there is no possible workaround for having scripted captions or controls appear in fullscreen display.

Scripted Captions

In Silvia's <itext> demo external SRT subtitles are fetched with XHR, parsed with JavaScript and finally synced in the timeupdate event. Using the timeupdate event is sub-optimal because it isn't guaranteed to fire any more often than every 250 ms, which isn't enough for fast-paced dialog.

Scripted Controls

In order to overlay scripted controls on top of <video>, a wrapping <div> and some CSS is needed:

This isn't terrible, but requires the size of the video to be known or be fixed to a certain size as above.

Benefits

<overlay> provides a single container for styling for all kinds of overlay content. The alternative would be to have one markup for in-band and external captions/subtitles (e.g. <itext>) and another solution for scripted captions/subtitles/controls/annotations, even though the problem solved is mostly exactly the same.

Processing Model

Resource Selection

If the <overlay> element is allowed to reference external resource using <source>, a resource selection algorithm must be defined. Other proposals have included variations on the theme of letting the UA to automatically select the language and type of timed text most suitable for the user (e.g. French subtitles for French-reading users and captions for hard-of-hearing users). Unlike resource selection for media elements, this would require the <source> candidates to be evaluated in another order than strict document order. There are certain complications to this, which may or may not be justified:

Requiring UAs to keep (or act as if they keep) a priority-sorted list of the candidates and keep that in sync with DOM modifications, so that they can fall back to the next best if a resource is unavailable or undecodable.

Relying on the Accept-Language setting which is often wrong or adding new language preferences to the UA which are likely to fail in the same ways Accept-Language has.

This proposal does not include a solution, implementor experience on this is probably the best way of finding out what makes sense and not.

Styling

It needs to be defined exactly what <overlay> is to <video>. The simplest may be acting as if <video> were the containing block for <overlay> elements, so that e.g. applying position:absolute;bottom:0;left:0;right:0 on <overlay> causes it to be position at the bottom of the parent <video>.

This was removed from the spec partly because it's script-only, i.e. it isn't used for notifications of the progress of external captions/subtitles/etc (see Remove addCueRange/removeCueRanges). A DOM interface similar to this is now needed, but with some modification. Note that pauseOnExit is not needed as playing a particular time range can be done using Media Fragments.

The events 'cuerangeenter' and 'cuerangeleave' would be fired as appropriate. The idea is that the same event would be fired for in-band, external and scripted captions/subtitles. The event target and/or className could be used to distinguish between them.

TODO: Better interface/method/event names and code examples

Limitations

In fullscreen mode, the size of the (virtual) containing box for <overlay> will change, which may require authors to write more complex CSS to handle gracefully.

Certain subtitle/caption formats provide their own styling which would interfere with CSS. For complex formats, ignoring CSS may be the only option.

Implementation

Browser vendors get the following benefits:

Since overlay content is explicitly marked up, it's easier to ensure that scripted overlays do not interfere with the native controls simply by placing native controls on top of the overlays.

Adoption

Authors get the following benefits:

With HD video becoming more and more common, most UAs will likely provide a fullscreen modes for <video>. This proposal gives authors a way to provide scripted enhancements even in fullscreen mode.

Simple, stylable subtitles/captions without using scripts.

Less work to position scripted controls on top of <video>

Baseline Formats

For <overlay src="captions"> or any other solution referencing external captions/subtitles to be interoperable, a baseline format is required.

SRT

SRT is probably the most widely supported and also one of the simplest subtitle formats. However, there is no spec for the format, rather different applications all parse it differently. In order to use it on the web we need an SRT parsing specification. That would entail gather lots and lots of SRT files from the wild and trying to define the algorithm such that it is compatible with as many as possible. Many SRT files has some limited HTML markup like <b> and <i>. A decision would have to be made whether or not to include that in the parsing algorithm.