[mirotalksfu] - add screen query param
هذا الالتزام موجود في:
@@ -175,8 +175,8 @@ Set the inbound rules:
|
|||||||
$ curl -X POST "http://localhost:3010/api/v1/meeting" -H "authorization: mirotalksfu_default_secret" -H "Content-Type: application/json"
|
$ curl -X POST "http://localhost:3010/api/v1/meeting" -H "authorization: mirotalksfu_default_secret" -H "Content-Type: application/json"
|
||||||
$ curl -X POST "https://sfu.mirotalk.org/api/v1/meeting" -H "authorization: mirotalksfu_default_secret" -H "Content-Type: application/json"
|
$ curl -X POST "https://sfu.mirotalk.org/api/v1/meeting" -H "authorization: mirotalksfu_default_secret" -H "Content-Type: application/json"
|
||||||
# The response will give you a entrypoint / URL for the direct join to the meeting.
|
# The response will give you a entrypoint / URL for the direct join to the meeting.
|
||||||
$ curl -X POST "http://localhost:3010/api/v1/join" -H "authorization: mirotalksfu_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalksfu","audio":"0","video":"0","notify":"0"}'
|
$ curl -X POST "http://localhost:3010/api/v1/join" -H "authorization: mirotalksfu_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalksfu","audio":"0","video":"0","screen":"0","notify":"0"}'
|
||||||
$ curl -X POST "https://sfu.mirotalk.org/api/v1/join" -H "authorization: mirotalksfu_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalksfu","audio":"0","video":"0","notify":"0"}'
|
$ curl -X POST "https://sfu.mirotalk.org/api/v1/join" -H "authorization: mirotalksfu_default_secret" -H "Content-Type: application/json" --data '{"room":"test","name":"mirotalksfu","audio":"0","video":"0","screen":"0","notify":"0"}'
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
@@ -187,7 +187,7 @@ $ curl -X POST "https://sfu.mirotalk.org/api/v1/join" -H "authorization: mirotal
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
- You can `join` directly to `room` by going to
|
- You can `join` directly to `room` by going to
|
||||||
- https://sfu.mirotalk.org/join?room=test&name=mirotalksfu&audio=0&video=0¬ify=0
|
- https://sfu.mirotalk.org/join?room=test&name=mirotalksfu&audio=0&video=0&screen=0¬ify=0
|
||||||
|
|
||||||
| Params | Type | Description |
|
| Params | Type | Description |
|
||||||
| ------ | ------- | --------------- |
|
| ------ | ------- | --------------- |
|
||||||
@@ -195,6 +195,7 @@ $ curl -X POST "https://sfu.mirotalk.org/api/v1/join" -H "authorization: mirotal
|
|||||||
| name | string | user name |
|
| name | string | user name |
|
||||||
| audio | boolean | audio stream |
|
| audio | boolean | audio stream |
|
||||||
| video | boolean | video stream |
|
| video | boolean | video stream |
|
||||||
|
| screen | boolean | screen stream |
|
||||||
| notify | boolean | welcome message |
|
| notify | boolean | welcome message |
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ function getResponse() {
|
|||||||
name: 'mirotalksfu',
|
name: 'mirotalksfu',
|
||||||
audio: true,
|
audio: true,
|
||||||
video: true,
|
video: true,
|
||||||
|
screen: true,
|
||||||
notify: true,
|
notify: true,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ $data = array(
|
|||||||
"name" => "mirotalksfu",
|
"name" => "mirotalksfu",
|
||||||
"audio" => true,
|
"audio" => true,
|
||||||
"video" => true,
|
"video" => true,
|
||||||
|
"screen" => true,
|
||||||
"notify" => true,
|
"notify" => true,
|
||||||
);
|
);
|
||||||
$data_string = json_encode($data);
|
$data_string = json_encode($data);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ data = {
|
|||||||
"name": "mirotalksfu",
|
"name": "mirotalksfu",
|
||||||
"audio": "true",
|
"audio": "true",
|
||||||
"video": "true",
|
"video": "true",
|
||||||
|
"screen": "true",
|
||||||
"notify": "true",
|
"notify": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ MIROTALK_URL="https://sfu.mirotalk.org/api/v1/join"
|
|||||||
curl $MIROTALK_URL \
|
curl $MIROTALK_URL \
|
||||||
--header "authorization: $API_KEY" \
|
--header "authorization: $API_KEY" \
|
||||||
--header "Content-Type: application/json" \
|
--header "Content-Type: application/json" \
|
||||||
--data '{"room":"test","name":"mirotalksfu","audio":"1","video":"1","notify":"1"}' \
|
--data '{"room":"test","name":"mirotalksfu","audio":"1","video":"1","screen":"1""notify":"1"}' \
|
||||||
--request POST
|
--request POST
|
||||||
@@ -171,9 +171,9 @@ app.get(['/newroom'], (req, res) => {
|
|||||||
app.get('/join/', (req, res) => {
|
app.get('/join/', (req, res) => {
|
||||||
if (hostCfg.authenticated && Object.keys(req.query).length > 0) {
|
if (hostCfg.authenticated && Object.keys(req.query).length > 0) {
|
||||||
log.debug('Direct Join', req.query);
|
log.debug('Direct Join', req.query);
|
||||||
// http://localhost:3010/join?room=test&name=mirotalksfu&audio=1&video=1¬ify=1
|
// http://localhost:3010/join?room=test&name=mirotalksfu&audio=1&video=1&screen=1¬ify=1
|
||||||
const { room, name, audio, video, notify } = req.query;
|
const { room, name, audio, video, screen, notify } = req.query;
|
||||||
if (room && name && audio && video && notify) {
|
if (room && name && audio && video && screen && notify) {
|
||||||
return res.sendFile(view.room);
|
return res.sendFile(view.room);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ module.exports = class ServerApi {
|
|||||||
data.audio +
|
data.audio +
|
||||||
'&video=' +
|
'&video=' +
|
||||||
data.video +
|
data.video +
|
||||||
|
'&screen=' +
|
||||||
|
data.screen +
|
||||||
'¬ify=' +
|
'¬ify=' +
|
||||||
data.notify
|
data.notify
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ let isEnumerateAudioDevices = false;
|
|||||||
let isEnumerateVideoDevices = false;
|
let isEnumerateVideoDevices = false;
|
||||||
let isAudioAllowed = false;
|
let isAudioAllowed = false;
|
||||||
let isVideoAllowed = false;
|
let isVideoAllowed = false;
|
||||||
|
let isScreenAllowed = getScreen();
|
||||||
let isAudioVideoAllowed = false;
|
let isAudioVideoAllowed = false;
|
||||||
let joinRoomWithoutAudioVideo = true;
|
let joinRoomWithoutAudioVideo = true;
|
||||||
let isScreenAllowed = false;
|
|
||||||
let initAudioButton = null;
|
let initAudioButton = null;
|
||||||
let initVideoButton = null;
|
let initVideoButton = null;
|
||||||
let initAudioVideoButton = null;
|
let initAudioVideoButton = null;
|
||||||
@@ -252,10 +252,23 @@ function appenChild(device, el) {
|
|||||||
// API CHECK
|
// API CHECK
|
||||||
// ####################################################
|
// ####################################################
|
||||||
|
|
||||||
|
function getScreen() {
|
||||||
|
let qs = new URLSearchParams(window.location.search);
|
||||||
|
let screen = qs.get('screen');
|
||||||
|
if (screen) {
|
||||||
|
screen = screen.toLowerCase();
|
||||||
|
let queryScreen = screen === '1' || screen === 'true';
|
||||||
|
if (queryScreen != null && (navigator.getDisplayMedia || navigator.mediaDevices.getDisplayMedia))
|
||||||
|
return queryScreen;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function getNotify() {
|
function getNotify() {
|
||||||
let qs = new URLSearchParams(window.location.search);
|
let qs = new URLSearchParams(window.location.search);
|
||||||
let notify = qs.get('notify');
|
let notify = qs.get('notify');
|
||||||
if (notify) {
|
if (notify) {
|
||||||
|
notify = notify.toLowerCase();
|
||||||
let queryNotify = notify === '1' || notify === 'true';
|
let queryNotify = notify === '1' || notify === 'true';
|
||||||
if (queryNotify != null) return queryNotify;
|
if (queryNotify != null) return queryNotify;
|
||||||
}
|
}
|
||||||
@@ -460,6 +473,10 @@ async function shareRoom(useNavigator = false) {
|
|||||||
};
|
};
|
||||||
shareRoomByEmail(message);
|
shareRoomByEmail(message);
|
||||||
}
|
}
|
||||||
|
// share screen on join
|
||||||
|
if (isScreenAllowed) {
|
||||||
|
rc.shareScreen();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
makeRoomQR();
|
makeRoomQR();
|
||||||
}
|
}
|
||||||
@@ -518,6 +535,7 @@ function joinRoom(peer_name, room_id) {
|
|||||||
peer_info,
|
peer_info,
|
||||||
isAudioAllowed,
|
isAudioAllowed,
|
||||||
isVideoAllowed,
|
isVideoAllowed,
|
||||||
|
isScreenAllowed,
|
||||||
roomIsReady,
|
roomIsReady,
|
||||||
);
|
);
|
||||||
handleRoomClientEvents();
|
handleRoomClientEvents();
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ class RoomClient {
|
|||||||
peer_info,
|
peer_info,
|
||||||
isAudioAllowed,
|
isAudioAllowed,
|
||||||
isVideoAllowed,
|
isVideoAllowed,
|
||||||
|
isScreenAllowed,
|
||||||
successCallback,
|
successCallback,
|
||||||
) {
|
) {
|
||||||
this.remoteAudioEl = remoteAudioEl;
|
this.remoteAudioEl = remoteAudioEl;
|
||||||
@@ -96,6 +97,7 @@ class RoomClient {
|
|||||||
|
|
||||||
this.isAudioAllowed = isAudioAllowed;
|
this.isAudioAllowed = isAudioAllowed;
|
||||||
this.isVideoAllowed = isVideoAllowed;
|
this.isVideoAllowed = isVideoAllowed;
|
||||||
|
this.isScreenAllowed = isScreenAllowed;
|
||||||
this.producerTransport = null;
|
this.producerTransport = null;
|
||||||
this.consumerTransport = null;
|
this.consumerTransport = null;
|
||||||
this.device = null;
|
this.device = null;
|
||||||
@@ -242,7 +244,15 @@ class RoomClient {
|
|||||||
}
|
}
|
||||||
this.refreshParticipantsCount();
|
this.refreshParticipantsCount();
|
||||||
console.log('Participants Count:', participantsCount);
|
console.log('Participants Count:', participantsCount);
|
||||||
notify && participantsCount == 1 ? shareRoom() : sound('joined');
|
// notify && participantsCount == 1 ? shareRoom() : sound('joined');
|
||||||
|
if (notify && participantsCount == 1) {
|
||||||
|
shareRoom();
|
||||||
|
} else {
|
||||||
|
if (this.isScreenAllowed) {
|
||||||
|
this.shareScreen();
|
||||||
|
}
|
||||||
|
sound('joined');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadDevice(routerRtpCapabilities) {
|
async loadDevice(routerRtpCapabilities) {
|
||||||
@@ -563,6 +573,9 @@ class RoomClient {
|
|||||||
this.setVideoOff(this.peer_info, false);
|
this.setVideoOff(this.peer_info, false);
|
||||||
this.sendVideoOff();
|
this.sendVideoOff();
|
||||||
}
|
}
|
||||||
|
// if (this.isScreenAllowed) {
|
||||||
|
// this.shareScreen();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// ####################################################
|
// ####################################################
|
||||||
@@ -1231,6 +1244,42 @@ class RoomClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ####################################################
|
||||||
|
// SHARE SCREEN ON JOIN
|
||||||
|
// ####################################################
|
||||||
|
|
||||||
|
shareScreen() {
|
||||||
|
if (!this.isMobileDevice && (navigator.getDisplayMedia || navigator.mediaDevices.getDisplayMedia)) {
|
||||||
|
this.sound('open');
|
||||||
|
// startScreenButton.click(); // Chrome - Opera - Edge - Brave
|
||||||
|
// handle error: getDisplayMedia requires transient activation from a user gesture on Safari - FireFox
|
||||||
|
Swal.fire({
|
||||||
|
background: swalBackground,
|
||||||
|
position: 'center',
|
||||||
|
icon: 'question',
|
||||||
|
text: 'Do you want to share your screen?',
|
||||||
|
showDenyButton: true,
|
||||||
|
confirmButtonText: `Yes`,
|
||||||
|
denyButtonText: `No`,
|
||||||
|
showClass: {
|
||||||
|
popup: 'animate__animated animate__fadeInDown',
|
||||||
|
},
|
||||||
|
hideClass: {
|
||||||
|
popup: 'animate__animated animate__fadeOutUp',
|
||||||
|
},
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
startScreenButton.click();
|
||||||
|
console.log('10 ----> Screen is on');
|
||||||
|
} else {
|
||||||
|
console.log('10 ----> Screen is on');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('10 ----> Screen is off');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ####################################################
|
// ####################################################
|
||||||
// EXIT ROOM
|
// EXIT ROOM
|
||||||
// ####################################################
|
// ####################################################
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم