[mirotalksfu] - add moderator share media

هذا الالتزام موجود في:
Miroslav Pejic
2024-11-10 01:25:41 +01:00
الأصل 9c62253f30
التزام a3412ce730
8 ملفات معدلة مع 63 إضافات و26 حذوفات

عرض الملف

@@ -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;
}

عرض الملف

@@ -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:

عرض الملف

@@ -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": {

عرض الملف

@@ -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,

عرض الملف

@@ -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: `
<br />
<div id="about">

عرض الملف

@@ -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;
}

عرض الملف

@@ -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);

عرض الملف

@@ -822,6 +822,24 @@ access to use this app.
</div>
</td>
</tr>
<tr id="everyoneCantChatGPTBtn">
<td class="wa">
<div class="title">
<i class="fab fa-youtube red"></i>
<p>Disable Media Sharing</p>
</div>
</td>
<td>
<div class="form-check form-switch form-switch-md">
<input
id="switchEveryoneCantMediaSharing"
class="form-check-input"
type="checkbox"
checked
/>
</div>
</td>
</tr>
<tr id="disconnectAllOnLeave">
<td class="wa">
<div class="title">
@@ -985,7 +1003,7 @@ access to use this app.
<p>Share a Video or Audio</p>
</button>
<br />
<button id="videoCloseBtn" class="hidden">
<button id="videoCloseBtn" class="hidden btn-custom">
<i class="fas fa-times"></i>
<p>Close Video or Audio</p>
</button>