Base: Add the current playback position to the video test page

This commit is contained in:
Timothy Flynn 2023-04-10 10:14:32 -04:00 committed by Linus Groh
parent 3d9106b1b5
commit 59848086ba

View file

@ -55,9 +55,13 @@
</tr>
</thead>
<tbody>
<tr>
<td>Current Time</td>
<td id=time>0.00 seconds</td>
</tr>
<tr>
<td>Duration</td>
<td id=duration>0 seconds</td>
<td id=duration>0.00 seconds</td>
</tr>
<tr>
<td>Play State</td>
@ -79,8 +83,12 @@
document.getElementById('selected').textContent = event.track.selected;
};
video.addEventListener('timeupdate', () => {
document.getElementById('time').textContent = `${video.currentTime.toFixed(2)} seconds`;
});
video.addEventListener('durationchange', () => {
document.getElementById('duration').textContent = `${video.duration} seconds`;
document.getElementById('duration').textContent = `${video.duration.toFixed(2)} seconds`;
});
video.addEventListener('loadedmetadata', () => {