Open Bug 1523224 Opened 7 years ago Updated 3 years ago

Setting the src attribute on a HTMLTrackElement trigger a text track change

Categories

(Core :: Audio/Video: Playback, defect, P3)

defect

Tracking

()

People

(Reporter: luo423, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Steps to reproduce:

1、 Get "track" Element.
2、 change it‘s src.

Actual results:

The WebVtt Subtitles will stop and it doesn't change into a new Subtitles,it just stop there,it happen in all version .But it works on chrome.

Expected results:

I want to change the Subtitles by changing <track/>'s src.

Please provide a testcase

Flags: needinfo?(luo423)

(In reply to Matthias Versen [:Matti] from comment #1)

Please provide a testcase

Purpose: I want to change the Subtitles by changing <track/>'s src.

It works on Chrome.

HTML:

<video src="./test.mp4" controls>
<track kind="subtitles" src="./1.vtt" srclang="zh" label="Chinese" default>
</video>

JS:

button1.onclick = function () {
document.getElementsByTagName('track')[0].src = './1.vtt';
}

button2.onclick = function () {
document.getElementsByTagName('track')[0].src = './2.vtt';
}

button3.onclick = function () {
//Close the subtitles;
document.getElementsByTagName('track')[0].src = '';
}

Flags: needinfo?(luo423)
Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

This test case is widely incomplete, please make sure to attach something that works next time. In particular, some buttons are missing from the HTML, and the text track is not present.

To do what you want to do, you need to have multiple <track> elements and have the one you want to show have mode="showing" as attribute, and the others mode="hidden". You can also have all of them "hidden" if you want to not display any subtitles.

The bug is valid though, we don't pass 0.

Status: UNCONFIRMED → NEW
Depends on: 1281418
Ever confirmed: true
Priority: -- → P3
Summary: Change <track/>'s src it doesn't work,but it works on chrome → Setting the src attribute on a HTMLTrackElement trigger a text track change
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.