[call-me] - add popup msg, fix session time, update dep
This commit is contained in:
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "call-me",
|
"name": "call-me",
|
||||||
"version": "1.0.13",
|
"version": "1.0.14",
|
||||||
"description": "Your Go-To for Instant Video Calls",
|
"description": "Your Go-To for Instant Video Calls",
|
||||||
"author": "Miroslav Pejic - miroslav.pejic.85@gmail.com",
|
"author": "Miroslav Pejic - miroslav.pejic.85@gmail.com",
|
||||||
"license": "AGPLv3",
|
"license": "AGPLv3",
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"socket.io": "^4.7.5",
|
"socket.io": "^4.8.0",
|
||||||
"swagger-ui-express": "5.0.1"
|
"swagger-ui-express": "5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^3.1.6",
|
"nodemon": "^3.1.7",
|
||||||
"prettier": "3.3.3"
|
"prettier": "3.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-6
@@ -31,9 +31,6 @@ let connectedUser;
|
|||||||
let thisConnection;
|
let thisConnection;
|
||||||
let stream;
|
let stream;
|
||||||
|
|
||||||
// Hide room page initially
|
|
||||||
roomPage.style.display = 'none';
|
|
||||||
|
|
||||||
// On html page loaded...
|
// On html page loaded...
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
handleToolTip();
|
handleToolTip();
|
||||||
@@ -190,6 +187,7 @@ function handleCallClick() {
|
|||||||
to: callToUsername,
|
to: callToUsername,
|
||||||
});
|
});
|
||||||
localStorage.callMeUsernameToCall = callToUsername;
|
localStorage.callMeUsernameToCall = callToUsername;
|
||||||
|
popupMsg(`You are calling ${callToUsername}.<br/>Please wait for them to answer.`);
|
||||||
} else {
|
} else {
|
||||||
handleError('Please enter a username to call.');
|
handleError('Please enter a username to call.');
|
||||||
}
|
}
|
||||||
@@ -270,6 +268,9 @@ function initializeConnection() {
|
|||||||
remoteVideo.playsInline = true;
|
remoteVideo.playsInline = true;
|
||||||
remoteVideo.autoplay = true;
|
remoteVideo.autoplay = true;
|
||||||
remoteVideo.controls = false;
|
remoteVideo.controls = false;
|
||||||
|
|
||||||
|
startSessionTime();
|
||||||
|
|
||||||
console.log('Remote stream set to video element');
|
console.log('Remote stream set to video element');
|
||||||
} else {
|
} else {
|
||||||
handleError('No stream available in the ontrack event.');
|
handleError('No stream available in the ontrack event.');
|
||||||
@@ -334,8 +335,6 @@ function offerAccept(data) {
|
|||||||
callBtn.style.display = 'none';
|
callBtn.style.display = 'none';
|
||||||
data.type = 'offerCreate';
|
data.type = 'offerCreate';
|
||||||
socket.recipient = data.from;
|
socket.recipient = data.from;
|
||||||
// Start session time in h/m/s
|
|
||||||
startSessionTime();
|
|
||||||
} else {
|
} else {
|
||||||
data.type = 'offerDecline';
|
data.type = 'offerDecline';
|
||||||
}
|
}
|
||||||
@@ -416,10 +415,11 @@ function handleLeave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle and display errors
|
// Handle and display errors
|
||||||
function handleError(message, error = false) {
|
function handleError(message, error = false, position = 'top') {
|
||||||
if (error) console.error(error);
|
if (error) console.error(error);
|
||||||
sound('notify');
|
sound('notify');
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
position,
|
||||||
title: 'Warning',
|
title: 'Warning',
|
||||||
text: message,
|
text: message,
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
@@ -429,6 +429,21 @@ function handleError(message, error = false) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display Message to user
|
||||||
|
function popupMsg(message, position = 'top', timer = 4000) {
|
||||||
|
Swal.fire({
|
||||||
|
position,
|
||||||
|
title: 'Info',
|
||||||
|
html: message,
|
||||||
|
icon: 'info',
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
timerProgressBar: true,
|
||||||
|
timer,
|
||||||
|
showClass: { popup: 'animate__animated animate__fadeInDown' },
|
||||||
|
hideClass: { popup: 'animate__animated animate__fadeOutUp' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Send messages to the server
|
// Send messages to the server
|
||||||
function sendMsg(message) {
|
function sendMsg(message) {
|
||||||
if (connectedUser) {
|
if (connectedUser) {
|
||||||
|
|||||||
Reference in New Issue
Block a user