|
$(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; |
|
} |
|
|
|
|
|
$.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"); |
|
|
|
$.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>` |
|
); |
|
} |
|
}); |