From 0ec26e20c673e24871ece75b715d36980ced2555 Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Wed, 17 Jan 2024 15:44:34 +0100 Subject: [PATCH] [mirotalksfu] - fix init video mirror, update dep --- app/src/Server.js | 2 +- package.json | 6 +++--- public/js/Room.js | 18 +++++++++++++++++- public/js/RoomClient.js | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/src/Server.js b/app/src/Server.js index 6bc384df..f01a3d07 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -40,7 +40,7 @@ dependencies: { * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.3.53 + * @version 1.3.54 * */ diff --git a/package.json b/package.json index 0862550a..a751b453 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalksfu", - "version": "1.3.53", + "version": "1.3.54", "description": "WebRTC SFU browser-based video calls", "main": "Server.js", "scripts": { @@ -60,7 +60,7 @@ }, "devDependencies": { "node-fetch": "^3.3.2", - "nodemon": "^3.0.2", - "prettier": "3.2.1" + "nodemon": "^3.0.3", + "prettier": "3.2.4" } } diff --git a/public/js/Room.js b/public/js/Room.js index 55976bd9..2492e3a5 100644 --- a/public/js/Room.js +++ b/public/js/Room.js @@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.3.53 + * @version 1.3.54 * */ @@ -1662,6 +1662,7 @@ async function changeCamera(deviceId) { initStream.getVideoTracks()[0].getSettings(), ); checkInitConfig(); + handleCameraMirror(initVideo); }) .catch((err) => { console.error('[Error] changeCamera', err); @@ -1707,6 +1708,21 @@ async function toggleScreenSharing() { } } +function handleCameraMirror(video) { + const isDesktopDevice = !DetectRTC.isMobileDevice && !isTabletDevice && !isIPadDevice; + if (isDesktopDevice) { + // Desktop devices... + if (!video.classList.contains('mirror')) { + video.classList.toggle('mirror'); + } + } else { + // Mobile, Tablet, IPad devices... + if (video.classList.contains('mirror')) { + video.classList.remove('mirror'); + } + } +} + function handleSelects() { // devices options videoSelect.onchange = () => { diff --git a/public/js/RoomClient.js b/public/js/RoomClient.js index 44389355..fe333f69 100644 --- a/public/js/RoomClient.js +++ b/public/js/RoomClient.js @@ -9,7 +9,7 @@ * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.3.53 + * @version 1.3.54 * */