Skip to content

Commit

Permalink
Download Video File button
Browse files Browse the repository at this point in the history
  • Loading branch information
parMaster committed May 17, 2024
1 parent 8afc4b2 commit c24c9d5
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions web/watch.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h5 id="meetingTopic"></h1>
</div>
</div>
<div class="row">
<div class="col-md-10">
<div class="col-md-7">
<table>
<tbody>
<tr>
Expand All @@ -48,6 +48,13 @@ <h5 id="meetingTopic"></h1>
</tbody>
</table>
</div>
<div class="col-md-3">
<div class="d-flex justify-content-end">
<a name="download_button" href="#" class="btn btn-sm btn-primary" download="#" target="_blank">⤓ Download Video File</a>
</div>
</div>
<div class="col-md-2">
</div>
</div>
</div>

Expand Down Expand Up @@ -83,18 +90,34 @@ <h5 id="meetingTopic"></h1>
$("#meetingId").text(data.meeting.id.toString().replace(/(\d{3})(\d{4})(\d{4})/, "$1 $2 $3"));
// Set the meeting date and time
$("#dateTime").text(data.meeting.date_time);
// loop through the data.records and find one with recording_type "shared_screen_with_gallery_view"
// and use data.records[i].file_path to set the source of the player
// loop through the data.records and find one with recording_type "shared_screen_with_gallery_view" or "shared_screen_with_speaker_view"
for (var i = 0; i < data.records.length; i++) {
if ((data.records[i].recording_type == "shared_screen_with_gallery_view") || (data.records[i].recording_type == "shared_screen_with_speaker_view")) {

// Use data.records[i].file_path to set the source of the player
$("#player").html('<video id="videoPlayer" style="width:100%" controls><source src="'+window.location.origin+'/' + data.records[i].file_path + '" type="video/mp4"></video>');

// Set the download button href and download attribute
$("a[name='download_button']").attr("href", window.location.origin + "/" + data.records[i].file_path);
$("a[name='download_button']").attr("download", data.meeting.topic + ".mp4");
break;
}
}
}
}
});

// disable download_button for 5 seconds on click to prevent multiple clicks
$("a[name='download_button']").click(function (event) {
if ($(this).hasClass("disabled")) {
event.preventDefault();
}
$(this).addClass("disabled");
setTimeout(function() {
$("a[name='download_button']").removeClass("disabled");
}, 5000);
});

// activate the chosen speed button
$("#speeds button").click(function() {
$("#speeds button").removeClass("active");
Expand Down

0 comments on commit c24c9d5

Please sign in to comment.