Implemented elapsed counter

This commit is contained in:
Erik Thuning 2022-10-27 14:30:26 +02:00
parent a84e1ff781
commit 3d8d2b44e8

@ -258,6 +258,9 @@
// list of stream overlay icons for play/pause
this._overlayPlayIcons = [];
// the periodic task that updates progress bar etc.
this._progressInterval = null;
// prepare shadow root
this.attachShadow({'mode': 'open'});
this.shadowRoot.appendChild(style.content.cloneNode(true));
@ -632,6 +635,7 @@
this.setActivePlaylistItem();
this.autoBlurControls();
this.updateProgress();
}
/*
@ -890,6 +894,18 @@
this._mainStream = newMain;
this.syncStreams();
}
updateProgress() {
if(this._progressInterval != null) {
window.clearInterval(this._progressInterval)
}
const trackedVideo = this._mainStream.querySelector('video');
this._progressInterval = window.setInterval(
() => {
this._elapsed.textContent = this.formatTime(
trackedVideo.currentTime);
}, 200);
}
}
customElements.define('multi-player', MultiPlayer);