1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:47:35 +00:00

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