openvidu-recording-improved: Show duration in recording info
This commit is contained in:
parent
8664ba3312
commit
44f0c4fb81
@ -287,7 +287,7 @@ function deleteRecordingContainer(recordingName) {
|
|||||||
recordingContainer.remove();
|
recordingContainer.remove();
|
||||||
|
|
||||||
const recordingsList = document.getElementById("recording-list");
|
const recordingsList = document.getElementById("recording-list");
|
||||||
|
|
||||||
if (recordingsList.children.length === 0) {
|
if (recordingsList.children.length === 0) {
|
||||||
recordingsList.innerHTML = "<span>There are no recordings available</span>";
|
recordingsList.innerHTML = "<span>There are no recordings available</span>";
|
||||||
}
|
}
|
||||||
@ -352,6 +352,7 @@ function showRecordingList(recordings) {
|
|||||||
|
|
||||||
recordings.forEach((recording) => {
|
recordings.forEach((recording) => {
|
||||||
const recordingName = recording.name;
|
const recordingName = recording.name;
|
||||||
|
const recordingDuration = secondsToHms(recording.duration ?? 0);
|
||||||
const recordingSize = formatBytes(recording.size ?? 0);
|
const recordingSize = formatBytes(recording.size ?? 0);
|
||||||
const recordingDate = new Date(recording.startedAt).toLocaleString();
|
const recordingDate = new Date(recording.startedAt).toLocaleString();
|
||||||
|
|
||||||
@ -363,7 +364,7 @@ function showRecordingList(recordings) {
|
|||||||
<i class="fa-solid fa-file-video"></i>
|
<i class="fa-solid fa-file-video"></i>
|
||||||
<div class="recording-info">
|
<div class="recording-info">
|
||||||
<p class="recording-name">${recordingName}</p>
|
<p class="recording-name">${recordingName}</p>
|
||||||
<p class="recording-size">${recordingSize}</p>
|
<p class="recording-size">${recordingDuration} | ${recordingSize}</p>
|
||||||
<p class="recording-date">${recordingDate}</p>
|
<p class="recording-date">${recordingDate}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="recording-actions">
|
<div class="recording-actions">
|
||||||
@ -399,6 +400,17 @@ function removeAllRecordings() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function secondsToHms(seconds) {
|
||||||
|
const h = Math.floor(seconds / 3600);
|
||||||
|
const m = Math.floor((seconds % 3600) / 60);
|
||||||
|
const s = Math.floor((seconds % 3600) % 60);
|
||||||
|
|
||||||
|
const hDisplay = h > 0 ? h + "h " : "";
|
||||||
|
const mDisplay = m > 0 ? m + "m " : "";
|
||||||
|
const sDisplay = s + "s";
|
||||||
|
return hDisplay + mDisplay + sDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
function formatBytes(bytes) {
|
function formatBytes(bytes) {
|
||||||
if (bytes === 0) {
|
if (bytes === 0) {
|
||||||
return "0Bytes";
|
return "0Bytes";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user