Skip to content

Commit

Permalink
[mirotalksfu] - add sound
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Oct 21, 2024
1 parent b24a64d commit f6b9ba4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 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 license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.94
* @version 1.5.95
*
*/

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.94",
"version": "1.5.95",
"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 license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.94
* @version 1.5.95
*
*/

Expand Down Expand Up @@ -4500,7 +4500,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.5.94',
title: 'WebRTC SFU v1.5.95',
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 license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.94
* @version 1.5.95
*
*/

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

console.log(window.location);

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

console.log('Settings', settings);

const autoJoinRoom = false; // automatically join the guest to the meeting

const presenterLoginBtn = document.getElementById('presenterLoginButton');
Expand All @@ -20,6 +24,16 @@ guestJoinRoomBtn.onclick = () => {
window.location.href = '/join/' + roomId;
};

function sound(name) {
if (!settings.sounds) return;
const sound = '../sounds/' + name + '.wav';
const audio = new Audio(sound);
audio.volume = 0.5;
audio.play().catch((err) => {
return false;
});
}

function checkRoomStatus(roomId) {
if (!roomId) {
console.warn('Room ID empty!');
Expand All @@ -31,6 +45,7 @@ function checkRoomStatus(roomId) {
console.log('isRoomActive', response.data);
const roomActive = response.data.message;
if (roomActive) {
sound('roomActive');
guestJoinRoomBtn.classList.remove('disabled');
presenterLoginBtn.style.display = 'none';
if (autoJoinRoom) guestJoinRoomBtn.click();
Expand All @@ -44,4 +59,6 @@ function checkRoomStatus(roomId) {
});
}

checkRoomStatus(roomId);

setInterval(() => checkRoomStatus(roomId), 5000); // Start checking room status every 5 seconds
Binary file added public/sounds/roomActive.wav
Binary file not shown.
Binary file added public/sounds/roomDisactive.wav
Binary file not shown.

0 comments on commit f6b9ba4

Please sign in to comment.