modification to disable join button after click to avoid duplicate media
This commit is contained in:
parent
a3ee7df193
commit
4d28335a01
@ -8,6 +8,10 @@ var token; // Token retrieved from OpenVidu Server
|
||||
/* OPENVIDU METHODS */
|
||||
|
||||
function joinSession() {
|
||||
|
||||
document.getElementById("join-btn").disabled = true;
|
||||
document.getElementById("join-btn").innerHTML = "Joining...";
|
||||
|
||||
getToken((token) => {
|
||||
|
||||
// --- 1) Get an OpenVidu object ---
|
||||
@ -106,6 +110,7 @@ function joinSession() {
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn('There was an error connecting to the session:', error.code, error.message);
|
||||
enableBtn();
|
||||
});
|
||||
});
|
||||
|
||||
@ -124,11 +129,17 @@ function leaveSession() {
|
||||
|
||||
$('#join').show();
|
||||
$('#session').hide();
|
||||
|
||||
// eneble button
|
||||
enableBtn();
|
||||
}
|
||||
|
||||
/* OPENVIDU METHODS */
|
||||
|
||||
|
||||
function enableBtn (){
|
||||
document.getElementById("join-btn").disabled = false;
|
||||
document.getElementById("join-btn").innerHTML = "Join!";
|
||||
}
|
||||
|
||||
/* APPLICATION REST METHODS */
|
||||
|
||||
@ -161,6 +172,8 @@ function logOut() {
|
||||
$("#logged").hide();
|
||||
}
|
||||
);
|
||||
|
||||
enableBtn();
|
||||
}
|
||||
|
||||
function getToken(callback) {
|
||||
|
||||
@ -92,7 +92,7 @@
|
||||
<input class="form-control" type="text" id="sessionName" required>
|
||||
</p>
|
||||
<p class="text-center">
|
||||
<button class="btn btn-lg btn-success" onclick="joinSession()">Join!</button>
|
||||
<button class="btn btn-lg btn-success" id="join-btn" onclick="joinSession()">Join!</button>
|
||||
</p>
|
||||
</form>
|
||||
<hr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user