Search code examples
htmlhtml5-videosubtitleclosed-captions

Can browsers natively play packaged subtitles (included in the video file)?


As you might know, most common video container files are like zip archives that contain several other files: the actual video, several audio files for different languages and several text files for subtitles and captions. If these tracks are included in the video file, that's called packaged afaik.

Now, while HTML offers the <track> element to reference additional files, are browsers capable of choosing among different packaged tracks and display different subtitles?

How is browser support?


Solution

  • No, currently they can't, even though the HTML standard encourages browser vendors to implement such controls.

    The standard allows several audio and video tracks per media resource, and exposes them via JavaScript:

    A media resource can have multiple embedded audio and video tracks. For example, in addition to the primary video and audio tracks, a media resource could have foreign-language dubbed dialogues, director's commentaries, audio descriptions, alternative angles, or sign-language overlays.

    4.8.12.10 Media resources with multiple media tracks

    Additionally, the standard encourages controls for different audio tracks and captions.

    If the [control] attribute is present, […] the user agent should expose a user interface to the user. This user interface should include features to […] change the display of closed captions or embedded sign-language tracks, select different audio tracks or turn on audio descriptions […]

    4.8.12.13 User interface

    According to can i use audioTracks, some vendors either already support this or are working on support.