<VideoID= "Mainvideo"src= "Video.mp4"type= "Video/mp4"controls AutoPlay Loop> < Tracksrc= "EN_TRACK.VTT"Srclang= "en"label= "中文版"Kind= "caption"default> < Tracksrc= "CN_TRACK.VTT"Srclang= "ZH-CN"label= "Simplified Chinese"Kind= "caption"> </Video>
Or
<video width= "640" height= "480" controls> <source src= "Video.mp4" type= "Video/mp4"/> <source Src= "VIDEO.WEBM" type= "VIDEO/WEBM"/> <track src= "SUBTITLES.VTT" kind= "subtitles" srclang= "en" label= " 中文版 "/> </video>
There are 4 main properties of the track label, such as the following table:
Properties |
Description |
Kind |
Define the caption content type, which can only be one of these five: subtitles, captions, descriptions, chapters, metadata . |
Src |
The URL address of the subtitle file |
Srclang |
The language type of the subtitle file, the role of the identity information, the player does not use this property. |
Label |
Subtitle labels, each subtitle element must have a unique, non-repeating label that displays the name when switching subtitles. |
Default |
Specifies whether it is the default caption. If none is specified, the caption will not be automatically displayed. |
Some notes about attributes:
• If no type is specified, the default is caption (Subtitles).
• If the type is a caption (subtitles), you need to specify Srclang.
• Cannot have two tracks of the same type (King) with the same label (label)
The MIME-type convention for WEBVTT subtitle files is "TEXT/VTT" and needs to be configured in a Web server such as IIS or Apache
The MIME type convention for ttml subtitle files is application/ttml+xml
Html5-video tags and subtitles