Track src 属性
实例
例子 1
获取轨道文件的 URL:
var x = document.getElementById("myTrack").src;
x 的结果可能是:
https://www.codew3c.com/jsref/subtitles_en.vtt
例子 2
更改轨道文件的 URL:
document.getElementById("myTrack").src = "subtitles_no.vtt";
语法
返回 src 属性:
trackObject.src
Set src attribute:
trackObject.src = URL
Attribute value
Value | Description |
---|---|
URL | Specifies the URL of the track file. |
Technical details
Return value: | String value, representing the URL of the track file. Returns the entire URL, including the protocol (such as http://). |
---|
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | 10.0 | Not supported | Not supported | Supported |