diff --git a/app/src/Room.js b/app/src/Room.js index 402dda3f..bb7ed977 100644 --- a/app/src/Room.js +++ b/app/src/Room.js @@ -47,6 +47,7 @@ module.exports = class Room { screen_cant_share: false, chat_cant_privately: false, chat_cant_chatgpt: false, + media_cant_sharing: false, }; this.survey = config.survey; this.redirect = config.redirect; @@ -464,6 +465,9 @@ module.exports = class Room { case 'chat_cant_chatgpt': this._moderator.chat_cant_chatgpt = data.status; break; + case 'media_cant_sharing': + this._moderator.media_cant_sharing = data.status; + break; default: break; } diff --git a/app/src/Server.js b/app/src/Server.js index 6eed9895..7d98c357 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -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.6.29 + * @version 1.6.30 * */ @@ -2003,6 +2003,7 @@ function startServer() { case 'screen_cant_share': case 'chat_cant_privately': case 'chat_cant_chatgpt': + case 'media_cant_sharing': room.broadCast(socket.id, 'updateRoomModerator', moderator); break; default: diff --git a/package.json b/package.json index 7a7e07d6..f02ec29b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalksfu", - "version": "1.6.29", + "version": "1.6.30", "description": "WebRTC SFU browser-based video calls", "main": "Server.js", "scripts": { diff --git a/public/js/LocalStorage.js b/public/js/LocalStorage.js index 5227d36f..e3eab952 100644 --- a/public/js/LocalStorage.js +++ b/public/js/LocalStorage.js @@ -28,6 +28,7 @@ class LocalStorage { moderator_screen_cant_share: false, // Everyone can't share screen moderator_chat_cant_privately: false, // Everyone can't chat privately, only Public chat allowed moderator_chat_cant_chatgpt: false, // Everyone can't chat with ChatGPT + moderator_media_cant_sharing: false, // Everyone can't share media moderator_disconnect_all_on_leave: false, // Disconnect all participants on leave room mic_auto_gain_control: false, mic_echo_cancellations: true, diff --git a/public/js/Room.js b/public/js/Room.js index 422e54ad..6aecd7dc 100644 --- a/public/js/Room.js +++ b/public/js/Room.js @@ -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.6.29 + * @version 1.6.30 * */ @@ -1952,6 +1952,9 @@ function handleButtons() { rc.shareVideo('all'); }; videoCloseBtn.onclick = () => { + if (rc._moderator.media_cant_sharing) { + return userLog('warning', 'The moderator does not allow you close this media', 'top-end', 6000); + } rc.closeVideo(true); }; sendAbortBtn.onclick = () => { @@ -2658,6 +2661,14 @@ function handleSelects() { lS.setSettings(localStorageSettings); e.target.blur(); }; + switchEveryoneCantMediaSharing.onchange = (e) => { + const mediaCantSharing = e.currentTarget.checked; + rc.updateRoomModerator({ type: 'media_cant_sharing', status: mediaCantSharing }); + rc.roomMessage('media_cant_sharing', mediaCantSharing); + localStorageSettings.moderator_media_cant_sharing = mediaCantSharing; + lS.setSettings(localStorageSettings); + e.target.blur(); + }; switchDisconnectAllOnLeave.onchange = (e) => { const disconnectAll = e.currentTarget.checked; rc.roomMessage('disconnect_all_on_leave', disconnectAll); @@ -4603,7 +4614,7 @@ function showAbout() { imageUrl: image.about, customClass: { image: 'img-about' }, position: 'center', - title: 'WebRTC SFU v1.6.29', + title: 'WebRTC SFU v1.6.30', html: `
diff --git a/public/js/RoomClient.js b/public/js/RoomClient.js index 82bace2b..3c3ec44f 100644 --- a/public/js/RoomClient.js +++ b/public/js/RoomClient.js @@ -228,6 +228,7 @@ class RoomClient { screen_cant_share: false, chat_cant_privately: false, chat_cant_chatgpt: false, + media_cant_sharing: false, }; // Chat messages @@ -531,27 +532,10 @@ class RoomClient { // Handle Room moderator rules if (room.moderator && (!isRulesActive || !isPresenter)) { console.log('07.2 ----> ROOM MODERATOR', room.moderator); - const { - video_start_privacy, - audio_start_muted, - video_start_hidden, - audio_cant_unmute, - video_cant_unhide, - screen_cant_share, - chat_cant_privately, - chat_cant_chatgpt, - } = room.moderator; - this._moderator.video_start_privacy = video_start_privacy; - this._moderator.audio_start_muted = audio_start_muted; - this._moderator.video_start_hidden = video_start_hidden; - this._moderator.audio_cant_unmute = audio_cant_unmute; - this._moderator.video_cant_unhide = video_cant_unhide; - this._moderator.screen_cant_share = screen_cant_share; - this._moderator.chat_cant_privately = chat_cant_privately; - this._moderator.chat_cant_chatgpt = chat_cant_chatgpt; + // Update `this._moderator` with properties from `room.moderator`, keeping existing ones. + this._moderator = { ...this._moderator, ...room.moderator }; - // if (this._moderator.video_start_privacy || localStorageSettings.moderator_video_start_privacy) { this.peer_info.peer_video_privacy = true; this.emitCmd({ @@ -560,7 +544,7 @@ class RoomClient { active: true, broadcast: true, }); - this.userLog('warning', 'The Moderator starts video in privacy mode', 'top-end'); + this.userLog('warning', 'The Moderator starts your video in privacy mode', 'top-end'); } if (this._moderator.audio_start_muted && this._moderator.video_start_hidden) { this.userLog('warning', 'The Moderator disabled your audio and video', 'top-end'); @@ -6086,6 +6070,10 @@ class RoomClient { } shareVideo(peer_id = 'all') { + if (this._moderator.media_cant_sharing) { + return userLog('warning', 'The moderator does not allow you to share any media', 'top-end', 6000); + } + this.sound('open'); Swal.fire({ @@ -6266,11 +6254,16 @@ class RoomClient { d.appendChild(vb); this.videoMediaContainer.appendChild(d); handleAspectRatio(); - let exitVideoBtn = this.getId(e.id); + + const exitVideoBtn = this.getId(e.id); exitVideoBtn.addEventListener('click', (e) => { e.preventDefault(); + if (this._moderator.media_cant_sharing) { + return userLog('warning', 'The moderator does not allow you close this media', 'top-end', 6000); + } this.closeVideo(true); }); + this.handlePN(video.id, pn.id, d.id); if (!this.isMobileDevice) { this.setTippy(pn.id, 'Toggle Pin video player', 'bottom'); @@ -6530,6 +6523,9 @@ class RoomClient { 'top-end', ); break; + case 'media_cant_sharing': + this.userLog('info', `${icons.moderator} Moderator: everyone can't share media ${status}`, 'top-end'); + break; case 'disconnect_all_on_leave': this.userLog('info', `${icons.moderator} Moderator: disconnect all on leave room ${status}`, 'top-end'); break; @@ -7968,6 +7964,10 @@ class RoomClient { this._moderator.chat_cant_chatgpt = data.status; rc.roomMessage('chat_cant_chatgpt', data.status); break; + case 'media_cant_sharing': + this._moderator.media_cant_sharing = data.status; + rc.roomMessage('media_cant_sharing', data.status); + break; default: break; } diff --git a/public/js/Rules.js b/public/js/Rules.js index 43264f9a..af29d7bb 100644 --- a/public/js/Rules.js +++ b/public/js/Rules.js @@ -178,6 +178,7 @@ function handleRules(isPresenter) { switchEveryoneCantShareScreen.checked = localStorageSettings.moderator_screen_cant_share; switchEveryoneCantChatPrivately.checked = localStorageSettings.moderator_chat_cant_privately; switchEveryoneCantChatChatGPT.checked = localStorageSettings.moderator_chat_cant_chatgpt; + switchEveryoneCantMediaSharing.checked = localStorageSettings.moderator_media_cant_sharing; switchDisconnectAllOnLeave.checked = localStorageSettings.moderator_disconnect_all_on_leave; // Update moderator settings... @@ -190,6 +191,7 @@ function handleRules(isPresenter) { screen_cant_share: switchEveryoneCantShareScreen.checked, chat_cant_privately: switchEveryoneCantChatPrivately.checked, chat_cant_chatgpt: switchEveryoneCantChatChatGPT.checked, + media_cant_sharing: switchEveryoneCantMediaSharing.checked, }; console.log('Rules moderator data ---->', moderatorData); rc.updateRoomModeratorALL(moderatorData); diff --git a/public/views/Room.html b/public/views/Room.html index f6a98a40..afee8927 100644 --- a/public/views/Room.html +++ b/public/views/Room.html @@ -822,6 +822,24 @@ access to use this app.
+ + +
+ +

Disable Media Sharing

+
+ + +
+ +
+ +
@@ -985,7 +1003,7 @@ access to use this app.

Share a Video or Audio


-