[mirotalk] - add param notify to room join URL

This commit is contained in:
Miroslav Pejic
2022-01-21 22:36:04 +01:00
parent 5e3fcdb84b
commit 8735fbd9ac
3 changed files with 22 additions and 5 deletions
+3 -2
View File
@@ -55,8 +55,8 @@ Open the app with the following **supported browsers** and many more.
## Direct join
- You can also `join` directly to your `room` by going to:
- https://mirotalk.up.railway.app/join?room=test&name=mirotalk&audio=0&video=0
- https://mirotalk.herokuapp.com/join?room=test&name=mirotalk&audio=0&video=0
- https://mirotalk.up.railway.app/join?room=test&name=mirotalk&audio=0&video=0&notify=0
- https://mirotalk.herokuapp.com/join?room=test&name=mirotalk&audio=0&video=0$notify=0
| Params | Type | Description |
| ------ | ------- | ---------------- |
@@ -64,6 +64,7 @@ Open the app with the following **supported browsers** and many more.
| name | string | your name |
| audio | boolean | enable / disable |
| video | boolean | enable / disable |
| notify | boolean | enable / disable |
## Quick start
+3 -1
View File
@@ -157,7 +157,9 @@ app.get('/join/', (req, res) => {
let peerName = req.query.name;
let peerAudio = req.query.audio;
let peerVideo = req.query.video;
if (roomName && peerName && peerAudio && peerVideo) {
let notify = req.query.notify;
if (roomName && peerName && peerAudio && peerVideo && notify) {
res.sendFile(path.join(__dirname, '../../', 'public/view/client.html'));
return;
}
+16 -2
View File
@@ -90,6 +90,7 @@ let swalBackground = 'rgba(0, 0, 0, 0.7)'; // black - #16171b - transparent ...
let peerGeo;
let peerConnection;
let myPeerName = getPeerName();
let notify = getNotify();
let useAudio = true;
let useVideo = true;
let camera = 'user';
@@ -554,6 +555,19 @@ function makeId(length) {
return result;
}
/**
* Check if notify is set
*/
function getNotify() {
let qs = new URLSearchParams(window.location.search);
let notify = qs.get('notify');
if (notify) {
let queryNotify = notify === '1' || notify === 'true';
if (queryNotify != null) return queryNotify;
}
return true;
}
/**
* Check if peer name is set
* @return Peer Name
@@ -652,7 +666,7 @@ function whoAreYou() {
if (myPeerName) {
checkPeerAudioVideo();
whoAreYouJoin();
welcomeUser();
notify ? welcomeUser() : playSound('addPeer');
return;
}
@@ -685,7 +699,7 @@ function whoAreYou() {
whoAreYouJoin();
},
}).then(() => {
welcomeUser();
notify ? welcomeUser() : playSound('addPeer');
});
if (isMobileDevice) return;