utilities / static /script.js
Reggie's picture
Rename static/index.js to static/script.js
3334ac8
raw
history blame
1.28 kB
$(document).ready(function () {
let recording = false;
$("#startBtn").click(function () {
const youtubeUrl = $("#urlInput").val().trim();
if (youtubeUrl === "") {
showMessage("Please enter a valid YouTube Livestream URL.", "danger");
return;
}
// Call the start_process route in Flask
$.ajax({
type: "POST",
url: "/start_process",
data: { url: youtubeUrl },
success: function (data) {
showMessage(data.message, "success");
recording = true;
},
error: function (xhr, status, error) {
showMessage("Error: " + xhr.responseText, "danger");
},
});
});
$("#stopBtn").click(function () {
showMessage("Stopping transcription. This may take upto 30 sec.", "success");
// Call the stop_process route in Flask
$.ajax({
type: "POST",
url: "/stop_process",
success: function (data) {
showMessage(data.message, "success");
recording = false;
},
error: function (xhr, status, error) {
showMessage("Error: " + xhr.responseText, "danger");
},
});
});
function showMessage(message, type) {
$("#message").html(
`<div class="alert alert-${type}" role="alert">${message}</div>`
);
}
});