Skip to content

Commit

Permalink
[mirotalk] - add username emoji, update dep
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Oct 1, 2024
1 parent a820943 commit 329985a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies: {
* @license For commercial use or closed source, contact us at [email protected] or purchase directly from CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
* @author Miroslav Pejic - [email protected]
* @version 1.3.77
* @version 1.3.78
*
*/

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalk",
"version": "1.3.77",
"version": "1.3.78",
"description": "A free WebRTC browser-based video call",
"main": "server.js",
"scripts": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"js-yaml": "^4.1.0",
"ngrok": "^5.0.0-beta.2",
"nodemailer": "^6.9.15",
"openai": "^4.63.0",
"openai": "^4.67.0",
"qs": "^6.13.0",
"socket.io": "^4.8.0",
"swagger-ui-express": "^5.0.1",
Expand Down
11 changes: 11 additions & 0 deletions public/css/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,17 @@ button:hover {
# Chat/room/user emoji picker
--------------------------------------------------------------*/

#usernameEmoji {
position: absolute;
z-index: 9999;
background: var(--body-bg);
border: var(--border);
border-radius: 5px;
--rgb-background: var(--body-bg) !important;
--color-border-over: var(--body-bg) !important;
--font-family: 'Montserrat';
}

.chatEmojiPicker {
z-index: 12;
position: absolute;
Expand Down
41 changes: 38 additions & 3 deletions public/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @license For commercial use or closed source, contact us at [email protected] or purchase directly from CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
* @author Miroslav Pejic - [email protected]
* @version 1.3.77
* @version 1.3.78
*
*/

Expand Down Expand Up @@ -231,9 +231,11 @@ const initVideoBtn = getId('initVideoBtn');
const initAudioBtn = getId('initAudioBtn');
const initScreenShareBtn = getId('initScreenShareBtn');
const initVideoMirrorBtn = getId('initVideoMirrorBtn');
const initUsernameEmojiButton = getId('initUsernameEmojiButton');
const initVideoSelect = getId('initVideoSelect');
const initMicrophoneSelect = getId('initMicrophoneSelect');
const initSpeakerSelect = getId('initSpeakerSelect');
const usernameEmoji = getId('usernameEmoji');

// Buttons bar
const buttonsBar = getId('buttonsBar');
Expand Down Expand Up @@ -766,6 +768,7 @@ function setButtonsToolTip() {
// Init buttons
setTippy(initScreenShareBtn, 'Toggle screen sharing', 'top');
setTippy(initVideoMirrorBtn, 'Toggle video mirror', 'top');
setTippy(initUsernameEmojiButton, 'Toggle username emoji', 'top');
// Main buttons
refreshMainButtonsToolTipPlacement();
// Chat room buttons
Expand Down Expand Up @@ -1258,6 +1261,7 @@ async function handleConnect() {
}
getHtmlElementsById();
setButtonsToolTip();
handleUsernameEmojiPicker();
manageLeftButtons();
handleButtonsRule();
setupMySettings();
Expand Down Expand Up @@ -1478,6 +1482,9 @@ async function whoAreYou() {
initVideoMirrorBtn.onclick = (e) => {
toggleInitVideoMirror();
};
initUsernameEmojiButton.onclick = (e) => {
toggleUsernameEmoji();
};

await loadLocalStorage();

Expand Down Expand Up @@ -1512,7 +1519,7 @@ async function whoAreYou() {
position: 'center',
input: 'text',
inputPlaceholder: 'Enter your email or name',
inputAttributes: { maxlength: 32 },
inputAttributes: { maxlength: 32, id: 'usernameInput' },
inputValue: window.localStorage.peer_name ? window.localStorage.peer_name : '',
html: initUser, // inject html
confirmButtonText: `Join meeting`,
Expand All @@ -1537,6 +1544,10 @@ async function whoAreYou() {
if (await checkUserName()) {
return 'Username is already in use!';
} else {
// Hide username emoji
if (!usernameEmoji.classList.contains('hidden')) {
usernameEmoji.classList.add('hidden');
}
window.localStorage.peer_name = myPeerName;
whoAreYouJoin();
}
Expand Down Expand Up @@ -5675,6 +5686,30 @@ async function handleLocalCameraMirror() {
}
}

/**
* Toggle username emoji
*/
function toggleUsernameEmoji() {
usernameEmoji.classList.toggle('hidden');
}

/**
* Handle username emoji picker
*/
function handleUsernameEmojiPicker() {
const pickerOptions = {
theme: 'dark',
onEmojiSelect: addEmojiToUsername,
};
const emojiUsernamePicker = new EmojiMart.Picker(pickerOptions);
usernameEmoji.appendChild(emojiUsernamePicker);

function addEmojiToUsername(data) {
getId('usernameInput').value += data.native;
toggleUsernameEmoji();
}
}

/**
* Toggle vide mirror
*/
Expand Down Expand Up @@ -10533,7 +10568,7 @@ function showAbout() {
Swal.fire({
background: swBg,
position: 'center',
title: '<strong>WebRTC P2P v1.3.77</strong>',
title: '<strong>WebRTC P2P v1.3.78</strong>',
imageAlt: 'mirotalk-about',
imageUrl: images.about,
customClass: { image: 'img-about' },
Expand Down
5 changes: 5 additions & 0 deletions public/views/client.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,17 @@ <h1>Loading</h1>
<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"></button>
<button id="initUsernameEmojiButton" class="fas fa-smile"></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>
</div>
</div>

<!-- Add emoji to username -->

<div id="usernameEmoji" class="usernameEmoji fadein center hidden"></div>

<!-- Start buttons bar https://fontawesome.com/icons?d=gallery -->

<div id="buttonsBar" class="fadein">
Expand Down

0 comments on commit 329985a

Please sign in to comment.