Skip to content

Commit

Permalink
[mirotalksfu] - fix UI
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Oct 21, 2024
1 parent f6b9ba4 commit 12fad56
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dev dependencies: {
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - [email protected]
* @version 1.5.95
* @version 1.5.96
*
*/

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.5.95",
"version": "1.5.96",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions public/js/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - [email protected]
* @version 1.5.95
* @version 1.5.96
*
*/

Expand Down Expand Up @@ -4500,7 +4500,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.5.95',
title: 'WebRTC SFU v1.5.96',
html: `
<br />
<div id="about">
Expand Down
2 changes: 1 addition & 1 deletion public/js/RoomClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - [email protected]
* @version 1.5.95
* @version 1.5.96
*
*/

Expand Down
17 changes: 15 additions & 2 deletions public/js/WhoAreYou.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

console.log(window.location);

const mediaQuery = window.matchMedia('(max-width: 640px)');

const settings = JSON.parse(localStorage.getItem('SFU_SETTINGS'));

console.log('Settings', settings);
Expand All @@ -16,6 +18,8 @@ guestJoinRoomBtn.classList.add('disabled');
const pathParts = window.location.pathname.split('/');
const roomId = filterXSS(pathParts[pathParts.length - 1]);

let roomActive = false;

presenterLoginBtn.onclick = () => {
window.location.href = '/login';
};
Expand All @@ -34,6 +38,11 @@ function sound(name) {
});
}

function handleScreenResize(e) {
if (roomActive) return;
presenterLoginBtn.style.display = e.matches ? 'flex' : 'inline-flex';
}

function checkRoomStatus(roomId) {
if (!roomId) {
console.warn('Room ID empty!');
Expand All @@ -43,22 +52,26 @@ function checkRoomStatus(roomId) {
.post('/isRoomActive', { roomId })
.then((response) => {
console.log('isRoomActive', response.data);
const roomActive = response.data.message;
roomActive = response.data.message;
if (roomActive) {
sound('roomActive');
guestJoinRoomBtn.classList.remove('disabled');
presenterLoginBtn.style.display = 'none';
if (autoJoinRoom) guestJoinRoomBtn.click();
} else {
guestJoinRoomBtn.classList.add('disabled');
presenterLoginBtn.style.display = 'inline-flex';
handleScreenResize(mediaQuery);
}
})
.catch((error) => {
console.error('Error checking room status', error);
});
}

handleScreenResize(mediaQuery);

checkRoomStatus(roomId);

mediaQuery.addEventListener('change', handleScreenResize);

setInterval(() => checkRoomStatus(roomId), 5000); // Start checking room status every 5 seconds

0 comments on commit 12fad56

Please sign in to comment.