[mirotalk] - fix typo

This commit is contained in:
Miroslav Pejic
2024-05-03 16:07:33 +02:00
parent 6c2be0166d
commit a3288bc825
6 changed files with 76 additions and 63 deletions
+25
View File
@@ -337,6 +337,7 @@ const msgerCP = getId('msgerCP');
const msgerCPHeader = getId('msgerCPHeader');
const msgerCPCloseBtn = getId('msgerCPCloseBtn');
const msgerCPList = getId('msgerCPList');
const searchPeerBarName = getId('searchPeerBarName');
// Caption section
const captionDraggable = getId('captionDraggable');
@@ -1079,6 +1080,13 @@ function countPeerConnections() {
return Object.keys(peerConnections).length;
}
/**
* Get Started...
*/
document.addEventListener('DOMContentLoaded', function () {
initClientPeer();
});
/**
* On body load Get started
*/
@@ -1395,6 +1403,18 @@ async function whoAreYou() {
playSound('newMessage');
// init buttons click events
initVideoBtn.onclick = async (e) => {
await handleVideo(e, true);
};
initAudioBtn.onclick = (e) => {
handleAudio(e, true);
};
initVideoMirrorBtn.onclick = (e) => {
toggleInitVideoMirror();
};
await loadLocalStorage();
if (!useVideo || !buttons.main.showVideoBtn) {
@@ -4297,6 +4317,11 @@ function setChatRoomBtn() {
// adapt chat room size for mobile
setChatRoomAndCaptionForMobile();
// Search peer by name
searchPeerBarName.addEventListener('keyup', () => {
searchPeer();
});
// open hide chat room
chatRoomBtn.addEventListener('click', (e) => {
if (!isChatRoomVisible) {
+14 -15
View File
@@ -130,14 +130,6 @@ noun = noun.charAt(0).toUpperCase() + noun.substring(1);
adjective = adjective.charAt(0).toUpperCase() + adjective.substring(1);
document.getElementById('roomName').value = '';
// Typing Effect
let i = 0;
let txt = num + adjective + noun;
let speed = 100;
typeWriter();
/**
* Get random number
* @param {integer} length of string
@@ -153,6 +145,12 @@ function getRandomNumber(length) {
return result;
}
// Typing Effect
let i = 0;
let txt = num + adjective + noun;
let speed = 100;
/**
* Set room name with typewriter effect
*/
@@ -164,9 +162,10 @@ function typeWriter() {
}
}
typeWriter();
// ####################################################################
// LANDING | NEW CALL
// LANDING | NEW CALL
// ####################################################################
const lastRoomContainer = document.getElementById('lastRoomContainer');
@@ -183,15 +182,15 @@ const joinRoomButton = document.getElementById('joinRoomButton');
const adultCnt = document.getElementById('adultCnt');
genRoomButton.onclick = (e) => {
genRoom();
genRoom();
};
joinRoomButton.onclick = (e) => {
joinRoom();
joinRoom();
};
adultCnt.onclick = (e) => {
adultContent();
adultContent();
};
document.getElementById('roomName').onkeyup = (e) => {
@@ -240,7 +239,7 @@ const room_id = filterXSS(qs.get('room_id'));
const message = filterXSS(qs.get('message'));
const showMessage = document.getElementById('message');
console.log('Allow Camera or Audio', {
room_id: room_id,
message: message,
room_id: room_id,
message: message,
});
if (showMessage) showMessage.innerHTML = message;
if (showMessage) showMessage.innerHTML = message;
+31 -31
View File
@@ -11,22 +11,22 @@ const qs = new URLSearchParams(window.location.search);
let iceServers = filterXSS(qs.get('iceServers'));
if (iceServers) {
iceServers = JSON.parse(iceServers);
iceServers = JSON.parse(iceServers);
} else {
// http://localhost:3000/test
iceServers = [
// Test some STUN server
{
urls: 'stun:stun.l.google.com:19302',
},
// Test some TURN server
// https://www.metered.ca/tools/openrelay/
{
urls: 'turn:a.relay.metered.ca:443',
username: 'e8dd65b92c62d3e36cafb807',
credential: 'uWdWNmkhvyqTEswO',
},
];
// http://localhost:3000/test
iceServers = [
// Test some STUN server
{
urls: 'stun:stun.l.google.com:19302',
},
// Test some TURN server
// https://www.metered.ca/tools/openrelay/
{
urls: 'turn:a.relay.metered.ca:443',
username: 'e8dd65b92c62d3e36cafb807',
credential: 'uWdWNmkhvyqTEswO',
},
];
}
console.log('Check Ice Servers', iceServers);
@@ -36,32 +36,32 @@ Ice.innerText = JSON.stringify(iceServers, null, 4);
// Test the connections
const pc = new RTCPeerConnection({
iceServers,
iceServers,
});
pc.onicecandidate = (e) => {
if (!e.candidate) return;
if (!e.candidate) return;
console.log(e.candidate.candidate);
console.log(e.candidate.candidate);
// If a srflx candidate was found, notify that the STUN server works!
if (e.candidate.type == 'srflx' || e.candidate.candidate.includes('srflx')) {
let ip = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;
let address = e.candidate.address ? e.candidate.address : e.candidate.candidate.match(ip);
IP.innerText = '🟢 Your Public IP Address is ' + address;
Stun.innerText = '🟢 The STUN server is reachable!';
}
// If a srflx candidate was found, notify that the STUN server works!
if (e.candidate.type == 'srflx' || e.candidate.candidate.includes('srflx')) {
let ip = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;
let address = e.candidate.address ? e.candidate.address : e.candidate.candidate.match(ip);
IP.innerText = '🟢 Your Public IP Address is ' + address;
Stun.innerText = '🟢 The STUN server is reachable!';
}
// If a relay candidate was found, notify that the TURN server works!
if (e.candidate.type == 'relay' || e.candidate.candidate.includes('relay')) {
Turn.innerText = '🟢 The TURN server is reachable!';
}
// If a relay candidate was found, notify that the TURN server works!
if (e.candidate.type == 'relay' || e.candidate.candidate.includes('relay')) {
Turn.innerText = '🟢 The TURN server is reachable!';
}
};
// handle error
pc.onicecandidateerror = (e) => {
console.error(e);
Err.innerText = '⚠️ ' + e.errorText;
console.error(e);
Err.innerText = '⚠️ ' + e.errorText;
};
pc.createDataChannel('test');
+4 -9
View File
@@ -66,7 +66,7 @@
<script async src="../js/umami.js"></script>
</head>
<body onload="initClientPeer()">
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<!-- just 4SEO Optimization -->
@@ -101,14 +101,10 @@ access to use this app.
></video>
</div>
<div class="initComands">
<button id="initVideoBtn" class="fas fa-video" onclick="handleVideo(event, true)"></button>
<button id="initAudioBtn" class="fas fa-microphone" onclick="handleAudio(event, true)"></button>
<button id="initVideoBtn" class="fas fa-video"></button>
<button id="initAudioBtn" class="fas fa-microphone"></button>
<button id="initScreenShareBtn" class="fas fa-desktop"></button>
<button
id="initVideoMirrorBtn"
class="fas fa-arrow-right-arrow-left"
onclick="toggleInitVideoMirror()"
></button>
<button id="initVideoMirrorBtn" class="fas fa-arrow-right-arrow-left"></button>
<select id="initVideoSelect" class="form-select text-light bg-dark"></select>
<select id="initMicrophoneSelect" class="form-select text-light bg-dark"></select>
<select id="initSpeakerSelect" class="form-select text-light bg-dark"></select>
@@ -233,7 +229,6 @@ access to use this app.
placeholder=" 🔍 Search peer by name..."
maxlength="32"
name="search"
onkeyup="searchPeer()"
/>
</div>
<br />
+1 -4
View File
@@ -134,10 +134,7 @@
id="genRoomButton"
class="button button-primary br-6 mr-8 mb-8 fas fa-arrows-rotate"
></button>
<button
id="joinRoomButton"
class="button button-primary br-6 pulse"
>
<button id="joinRoomButton" class="button button-primary br-6 pulse">
Join Room
</button>
</div>
+1 -4
View File
@@ -128,10 +128,7 @@
id="genRoomButton"
class="button button-primary br-6 mr-8 mb-8 fas fa-arrows-rotate"
></button>
<button
id="joinRoomButton"
class="button button-primary br-6 pulse"
>
<button id="joinRoomButton" class="button button-primary br-6 pulse">
Join Room
</button>
</div>