YouTip LogoYouTip

Prop Track Srclang

HTML DOM Track srclang Property

HTML DOM Track srclang Property

Track Object Reference Track Object

Example

Get the language code of the track text data:

var x = document.getElementById("myTrack").srclang;

x output will be:

en

Definition and Usage

The srclang property is used to set or return the value of the srclang attribute of a track.

The srclang property describes the language of the track text data.

If kind="subtitles", this attribute is required.

Tip: You can see more language code variables via the Language Codes Reference.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The srclang property is supported in Internet Explorer, Opera, and Chrome.

Note: Firefox, Safari, or Internet Explorer 9 and earlier versions do not support the srclang property.


Syntax

Return the srclang property:

trackObject.srclang

Set the srclang property:

trackObject.srclang=language_code

Property Values

Value Description
language_code Describes the language code (two letters) of the track text data.

Technical Details

Return Value: A string representing the language code of the track text data.

More Examples

Example

Change the language code of the track text data:

document.getElementById("myTrack").srclang="no";

Related Pages

HTML Reference: HTML <track> srclang Attribute


Track Object Reference Track Object

← Dom Obj VideoProp Video Audiotracks β†’