HTML <track> srclangProperty

HTML <track> tag

Example

A video element with two subtitle tracks:

<video width="320" height="240" controls>
  <source src="forrest_gump.mp4.html" type="video/mp4">
  <source src="forrest_gump.ogg.html" type="video/ogg">
  <track src="subtitles_en.vtt.html" kind="subtitles" srclang="en"
  label="English">
  <track src="subtitles_no.vtt.html" kind="subtitles" srclang="no"
  label="Norwegian">
</video>

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Opera, and Chrom support the srclang attribute.


Definition and Usage

The srclang attribute defines the language of the track.

If the value of the kind attribute is "subtitles", then the srclang attribute is required.

Tip:To view all available language codes, visit ourLanguage Code Reference Manual。


Differences between HTML 4.01 and HTML5

The <track> tag is a new tag in HTML5.


Syntax

<track src="subtitles_en.vtt.html" kind="subtitles" srclang="en">

Property value

Value Description
language_code A two-letter language code that specifies the language of the track.


HTML <track> tagother extensions