FIX: duration is no longer part of the json manifest

Now reading the duration directly from the controlling stream instead
of static metadata.
This commit is contained in:
Erik Thuning 2025-01-24 14:38:29 +01:00
parent e4b85a87a1
commit cc5a87e68a

@ -1305,8 +1305,6 @@ input[type="range"]::-ms-track {
this._presentation = presentation;
this._presTitle.textContent = presentation.title;
this._elapsed.textContent = this.formatTime(0);
this._duration.textContent = this.formatTime(
presentation.duration);
const streams = presentation.sources;
const sourcenames = Object.keys(streams);
// sorting the source names so they get a predictable ordering
@ -1385,6 +1383,11 @@ input[type="range"]::-ms-track {
this._mainSource = video;
// keep a reference to the source that plays audio
this._audioSource = video;
video.addEventListener('durationchange', (event) => {
this._duration.textContent = this.formatTime(
this._controlSource.duration);
});
} else {
playIcon.classList.add('hidden');
}
@ -1867,7 +1870,7 @@ input[type="range"]::-ms-track {
const minutes = (Math.floor((time % 3600) / 60)
+ '').padStart(2, '0');
const seconds = (Math.round(time % 60) + '').padStart(2, '0');
if(this._presentation.duration > 3600) {
if(this._controlSource && this._controlSource.duration > 3600) {
return hours +':'+ minutes +':'+ seconds;
} else {
return minutes +':'+ seconds;