Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <track> srclang Attribute

The srclang attribute on a <track> tag specifies the language of the text track.

The language is specified as a two-letter HTML language code.

Example

#

A srclang attribute on a <track> tag.
The subtitle track is in Spanish.

<video controls="controls" width="320" height="176">
  <source src="/media/godfather.mp4" type="video/mp4" />
  <source src="/media/godfather.ogg" type="video/ogg" />
  <track src="/media/godfather.srt" kind="subtitles" srclang="es" label="Spanish" />
</video>

Using srclang

The srclang attribute specifies the language of the text track.

This attribute accepts a two-letter language code as its value.

If the text track is used for subtitles, the srclang attribute is required.

Tip:  This link has all HTML Language Codes.


Syntax

<track src="URL" srclang="language-code">

Values

#

Value Description
language-code Two letter Language Code, e.g. en, ko, nl, es, etc.

Browser support

Here is when srclang support started for each browser:

Chrome
23.0 Nov 2012
Firefox
31.0 Jul 2014
IE/Edge
10.0 Sep 2012
Opera
12.1 Nov 2012
Safari
6.0 Jul 2012

You may also like

 Back to <track>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides