[mirotalksfu] - fix, add stop screen share

هذا الالتزام موجود في:
Miroslav Pejic
2023-07-20 09:59:34 +02:00
الأصل 75a72edbdf
التزام 40f6278a9b
3 ملفات معدلة مع 64 إضافات و10 حذوفات

ثنائية
public/images/stop.png Normal file

ملف ثنائي غير معروض.

بعد

العرض:  |  الارتفاع:  |  الحجم: 2.7 KiB

عرض الملف

@@ -33,6 +33,8 @@ const _PEER = {
audioOff: '<i style="color: red;" class="fas fa-microphone-slash"></i>',
videoOn: '<i class="fas fa-video"></i>',
videoOff: '<i style="color: red;" class="fas fa-video-slash"></i>',
screenOn: '<i class="fas fa-desktop"></i>',
screenOff: '<i style="color: red;" class="fas fa-desktop"></i>',
raiseHand: '<i style="color: rgb(0, 255, 71);" class="fas fa-hand-paper pulsate"></i>',
lowerHand: '',
acceptPeer: '<i class="fas fa-check"></i>',
@@ -1484,6 +1486,7 @@ function handleRoomClientEvents() {
show(stopVideoButton);
setColor(startVideoButton, 'red');
setVideoButtonsDisabled(false);
if (isParticipantsListOpen) getRoomParticipants(true);
});
rc.on(RoomClient.EVENTS.pauseVideo, () => {
console.log('Room Client pause video');
@@ -1501,11 +1504,13 @@ function handleRoomClientEvents() {
show(startVideoButton);
setVideoButtonsDisabled(false);
isVideoPrivacyActive = false;
if (isParticipantsListOpen) getRoomParticipants(true);
});
rc.on(RoomClient.EVENTS.startScreen, () => {
console.log('Room Client start screen');
hide(startScreenButton);
show(stopScreenButton);
if (isParticipantsListOpen) getRoomParticipants(true);
});
rc.on(RoomClient.EVENTS.pauseScreen, () => {
console.log('Room Client pause screen');
@@ -1517,6 +1522,7 @@ function handleRoomClientEvents() {
console.log('Room Client stop screen');
hide(stopScreenButton);
show(startScreenButton);
if (isParticipantsListOpen) getRoomParticipants(true);
});
rc.on(RoomClient.EVENTS.roomLock, () => {
console.log('Room Client lock room');
@@ -2190,6 +2196,7 @@ async function getParticipantsTable(peers) {
<th></th>
<th></th>
<th></th>
<th></th>
</tr>`;
if (!isRulesActive || isPresenter) {
@@ -2199,6 +2206,7 @@ async function getParticipantsTable(peers) {
<td>all</td>
<td><button id="muteAllButton" onclick="rc.peerAction('me','${socket.id}','mute',true,true)">${_PEER.audioOff}</button></td>
<td><button id="hideAllButton" onclick="rc.peerAction('me','${socket.id}','hide',true,true)">${_PEER.videoOff}</button></td>
<td><button id="stopAllButton" onclick="rc.peerAction('me','${socket.id}','stop',true,true)">${_PEER.screenOff}</button></td>
<td></td>
<td><button id="sendAllButton" onclick="rc.selectFileToShare('${socket.id}', true)">${_PEER.sendFile}</button></td>
<td><button id="sendMessageToAll" onclick="rc.sendMessageTo('all','all')">${_PEER.sendMsg}</button></td>
@@ -2213,6 +2221,7 @@ async function getParticipantsTable(peers) {
let peer_name = peer_info.peer_name;
let peer_audio = peer_info.peer_audio ? _PEER.audioOn : _PEER.audioOff;
let peer_video = peer_info.peer_video ? _PEER.videoOn : _PEER.videoOff;
let peer_screen = peer_info.peer_screen ? _PEER.screenOn : _PEER.screenOff;
let peer_hand = peer_info.peer_hand ? _PEER.raiseHand : _PEER.lowerHand;
let peer_eject = _PEER.ejectPeer;
let peer_sendFile = _PEER.sendFile;
@@ -2226,6 +2235,7 @@ async function getParticipantsTable(peers) {
<td>${peer_name} (me)</td>
<td><button>${peer_audio}</button></td>
<td><button>${peer_video}</button></td>
<td><button>${peer_screen}</button></td>
<td><button>${peer_hand}</button></td>
<td></td>
<td></td>
@@ -2241,6 +2251,7 @@ async function getParticipantsTable(peers) {
<td>${peer_name}</td>
<td><button id='${peer_id}___pAudio' onclick="rc.peerAction('me',this.id,'mute')">${peer_audio}</button></td>
<td><button id='${peer_id}___pVideo' onclick="rc.peerAction('me',this.id,'hide')">${peer_video}</button></td>
<td><button id='${peer_id}___pScreen' onclick="rc.peerAction('me',this.id,'stop')">${peer_screen}</button></td>
<td><button>${peer_hand}</button></td>
<td><button id='${peer_id}___shareFile' onclick="rc.selectFileToShare('${peer_id}', false)">${peer_sendFile}</button></td>
<td><button id="${peer_id}___sendMessageTo" onclick="rc.sendMessageTo('${peer_id}','${peer_name}')">${peer_sendMsg}</button></td>
@@ -2255,6 +2266,7 @@ async function getParticipantsTable(peers) {
<td>${peer_name}</td>
<td><button id='${peer_id}___pAudio'>${peer_audio}</button></td>
<td><button id='${peer_id}___pVideo'>${peer_video}</button></td>
<td><button id='${peer_id}___pScreen'>${peer_screen}</button></td>
<td><button>${peer_hand}</button></td>
<td><button id='${peer_id}___shareFile' onclick="rc.selectFileToShare('${peer_id}', false)">${peer_sendFile}</button></td>
<td><button id="${peer_id}___sendMessageTo" onclick="rc.sendMessageTo('${peer_id}','${peer_name}')">${peer_sendMsg}</button></td>
@@ -2274,6 +2286,7 @@ function setParticipantsTippy(peers) {
if (!DetectRTC.isMobileDevice) {
setTippy('muteAllButton', 'Mute all participants', 'top');
setTippy('hideAllButton', 'Hide all participants', 'top');
setTippy('stopAllButton', 'Stop screen share to all participants', 'top');
setTippy('sendAllButton', 'Share file to all', 'top');
setTippy('sendMessageToAll', 'Send message to all', 'top');
setTippy('sendVideoToAll', 'Share video to all', 'top');
@@ -2284,6 +2297,7 @@ function setParticipantsTippy(peers) {
let peer_id = peer_info.peer_id;
setTippy(peer_id + '___pAudio', 'Mute', 'top');
setTippy(peer_id + '___pVideo', 'Hide', 'top');
setTippy(peer_id + '___pScreen', 'Stop', 'top');
setTippy(peer_id + '___shareFile', 'Share file', 'top');
setTippy(peer_id + '___sendMessageTo', 'Send private message', 'top');
setTippy(peer_id + '___sendVideoTo', 'Share video', 'top');

عرض الملف

@@ -60,6 +60,7 @@ const image = {
locked: '../images/locked.png',
mute: '../images/mute.png',
hide: '../images/hide.png',
stop: '../images/stop.png',
users: '../images/participants.png',
user: '../images/participant.png',
username: '../images/user.png',
@@ -4446,6 +4447,17 @@ class RoomClient {
);
}
break;
case 'stop':
if (peer_id === this.peer_id || broadcast) {
this.closeProducer(mediaType.screen);
this.userLog(
'warning',
from_peer_name + ' ' + _PEER.screenOff + ' has closed yours screen share',
'top-end',
10000,
);
}
break;
//...
}
}
@@ -4517,17 +4529,35 @@ class RoomClient {
break;
case 'mute':
case 'hide':
let muteHideConfirmed = false;
let whoMuteHide = data.broadcast ? 'everyone except yourself?' : 'current participant?';
case 'stop':
let muteHideStopConfirmed = false;
let whoMuteHideStop = data.broadcast ? 'everyone except yourself?' : 'current participant?';
let imageUrl, title, text;
switch (action) {
case 'mute':
imageUrl = image.mute;
title = 'Mute ' + whoMuteHideStop;
text =
"Once muted, you won't be able to unmute them, but they can unmute themselves at any time.";
break;
case 'hide':
title = 'Hide ' + whoMuteHideStop;
imageUrl = image.hide;
text =
"Once hided, you won't be able to unhide them, but they can unhide themselves at any time.";
break;
case 'stop':
imageUrl = image.stop;
title = 'Stop screen share to the ' + whoMuteHideStop;
text = "Once stop, you won't be able to start them, but they can start themselves at any time.";
break;
}
Swal.fire({
background: swalBackground,
position: 'center',
imageUrl: action == 'mute' ? image.mute : image.hide,
title: action == 'mute' ? 'Mute ' + whoMuteHide : 'Hide ' + whoMuteHide,
text:
action == 'mute'
? "Once muted, you won't be able to unmute them, but they can unmute themselves at any time."
: "Once hided, you won't be able to unhide them, but they can unhide themselves at any time.",
imageUrl: imageUrl,
title: title,
text: text,
showDenyButton: true,
confirmButtonText: `Yes`,
denyButtonText: `No`,
@@ -4536,7 +4566,7 @@ class RoomClient {
})
.then((result) => {
if (result.isConfirmed) {
muteHideConfirmed = true;
muteHideStopConfirmed = true;
if (!data.broadcast) {
this.socket.emit('peerAction', data);
switch (action) {
@@ -4547,6 +4577,9 @@ class RoomClient {
case 'hide':
let peerVideoButton = this.getId(data.peer_id + '___pVideo');
if (peerVideoButton) peerVideoButton.innerHTML = _PEER.videoOff;
case 'stop':
let peerScreenButton = this.getId(data.peer_id + '___pScreen');
if (peerScreenButton) peerScreenButton.innerHTML = _PEER.screenOff;
}
} else {
this.socket.emit('peerAction', data);
@@ -4556,7 +4589,8 @@ class RoomClient {
}
})
.then(() => {
if (muteHideConfirmed) this.peerActionProgress(action, 'In progress, wait...', 2000, 'refresh');
if (muteHideStopConfirmed)
this.peerActionProgress(action, 'In progress, wait...', 2000, 'refresh');
});
break;
//...
@@ -4599,6 +4633,9 @@ class RoomClient {
case 'video':
this.setIsVideo(status);
break;
case 'screen':
this.setIsScreen(status);
break;
case 'hand':
this.peer_info.peer_hand = status;
let peer_hand = this.getPeerHandBtn(peer_id);
@@ -4627,6 +4664,9 @@ class RoomClient {
case 'video':
this.setIsVideo(status);
break;
case 'screen':
this.setIsScreen(status);
break;
case 'hand':
let peer_hand = this.getPeerHandBtn(peer_id);
if (status) {