default to last textTrack
This commit is contained in:
parent
8222b6205b
commit
081058c07e
@ -21,3 +21,12 @@ function getActiveTranscriptTrackIdx() {
|
|||||||
return cur_tt_idx;
|
return cur_tt_idx;
|
||||||
}
|
}
|
||||||
function getActiveTranscriptTrack() { return Q("video").textTracks[getActiveTranscriptTrackIdx()]; }
|
function getActiveTranscriptTrack() { return Q("video").textTracks[getActiveTranscriptTrackIdx()]; }
|
||||||
|
|
||||||
|
function getDefaultTranscriptTrackIdx() {
|
||||||
|
let tts = Q("video").textTracks;
|
||||||
|
return tts.length - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
|
cur_tt_idx = getDefaultTranscriptTrackIdx();
|
||||||
|
});
|
||||||
|
@ -87,6 +87,7 @@ window.addEventListener('DOMContentLoaded', function() {
|
|||||||
option.appendChild(text(tt.label));
|
option.appendChild(text(tt.label));
|
||||||
select_tt.appendChild(option);
|
select_tt.appendChild(option);
|
||||||
}
|
}
|
||||||
|
select_tt.selectedIndex = getDefaultTranscriptTrackIdx();
|
||||||
select_tt.addEventListener("change", loadCues);
|
select_tt.addEventListener("change", loadCues);
|
||||||
divR.appendChild(select_tt);
|
divR.appendChild(select_tt);
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ window.addEventListener('DOMContentLoaded', function() {
|
|||||||
divR.appendChild(table_tt);
|
divR.appendChild(table_tt);
|
||||||
|
|
||||||
tts.addEventListener("change", (e) => {
|
tts.addEventListener("change", (e) => {
|
||||||
console.log(e);
|
// console.log(e);
|
||||||
var idx = getActiveTranscriptTrackIdx(); // sadly not provided by 'e'
|
var idx = getActiveTranscriptTrackIdx(); // sadly not provided by 'e'
|
||||||
if (tts[idx].mode == "showing") {
|
if (tts[idx].mode == "showing") {
|
||||||
select_tt.selectedIndex = idx;
|
select_tt.selectedIndex = idx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user