Commit 7de5d323 authored by Brendan Long's avatar Brendan Long

Add "change" event listener (so we can switch the controls when they changed by other methods).

parent 70b93871
......@@ -84,14 +84,13 @@ function setTrackEnabled(track, enabled, button) {
track.selected = enabled;
} else if (track.mode !== undefined) {
track.mode = enabled ? "showing" : "disabled";
} else {
console.log("setTrackEnabled got invalid track type: ", type);
}
if (button) {
/* TextTrackList doesn't have a "change" event yet */
var label = button.firstChild;
label.nodeValue = label.nodeValue.replace(/(Dis|En)able/, enabled ? "Disable" : "Enable");
button.onclick = setTrackEnabled.bind(this, track, !enabled, button);
} else {
console.log("setTrackEnabled got invalid track type: ", type);
}
}
......@@ -176,6 +175,7 @@ function loadConfig(config) {
var typeControls = document.createElement("div");
var func = setupControls.bind(this, tracks, typeControls, type);
tracks.addEventListener("addtrack", func);
tracks.addEventListener("change", func);
tracks.addEventListener("removetrack", func);
func();
trackControls.appendChild(typeControls);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment