HTML5 track element question

前端 未结 6 1446
Happy的楠姐
Happy的楠姐 2020-12-11 23:13

Can someone explain what the track element in HTML is for in very simple terms?

相关标签:
6条回答
  • 2020-12-11 23:28

    In the same way that a DVD can have multiple audio or video tracks, the <track> element allows HTML5 video to do the same. This is primarily useful for things like adding subtitles.

    0 讨论(0)
  • 2020-12-11 23:31

    As it says in the spec, they're for:

    • subtitles
    • captions
    • descriptions
    • chapters
    • metadata

    Although this part of the spec has been in a lot of flux in recent months and it isn't finalised yet, this presentation will give you some idea of the intended usage.

    0 讨论(0)
  • 2020-12-11 23:33

    The track element lets you define subtitles, captions, descriptions, chapters, or metadata for either an audio or video element.

    Sources:

    • track element
    • text tracks
    • media elements
    0 讨论(0)
  • 2020-12-11 23:34

    The element allows authors to specify explicit external timed tracks for media elements. It does not represent anything on its own.

    see here

    0 讨论(0)
  • 2020-12-11 23:34

    Apologies for shameless self promotion, but I wrote an article about the track element for HTML5 Rocks: Getting Started With The Track Element.

    EDIT: removed examples from post: as Jörn pointed out (see below) Chrome was crashing if you scrolled a video with a track element offscreen. This seems to have been fixed now (in 19.0.1053.0 canary) but I'll leave the examples out for the moment.

    0 讨论(0)
  • 2020-12-11 23:49

    The src attribute gives the address of the text track data. The value must be a valid non-empty URL potentially surrounded by spaces. This attribute must be present.

    Source.

    0 讨论(0)
提交回复
热议问题