From 6cce083c728bfada360316f461c24980f833e09c Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Sat, 11 Jan 2025 16:12:03 +0100 Subject: [PATCH] [mirotalk] - fix video PIP on exit --- app/src/server.js | 2 +- package.json | 2 +- public/js/client.js | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/src/server.js b/app/src/server.js index 6c05d972..0005ab58 100755 --- a/app/src/server.js +++ b/app/src/server.js @@ -39,7 +39,7 @@ dependencies: { * @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.4.43 + * @version 1.4.44 * */ diff --git a/package.json b/package.json index ea19390d..678dff58 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalk", - "version": "1.4.43", + "version": "1.4.44", "description": "A free WebRTC browser-based video call", "main": "server.js", "scripts": { diff --git a/public/js/client.js b/public/js/client.js index a7640ba4..df743f7c 100644 --- a/public/js/client.js +++ b/public/js/client.js @@ -15,7 +15,7 @@ * @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.4.43 + * @version 1.4.44 * */ @@ -4268,6 +4268,18 @@ function handlePictureInPicture(btnId, videoId, peerId) { }); } }); + if (video) { + video.addEventListener('leavepictureinpicture', (event) => { + console.log('Exited PiP mode'); + // Check if the video is paused + if (video.paused) { + // Play the video again + video.play().catch((error) => { + console.error('Error playing video after exit PIP mode:', error); + }); + } + }); + } } /** @@ -10994,7 +11006,7 @@ function showAbout() { Swal.fire({ background: swBg, position: 'center', - title: 'WebRTC P2P v1.4.43', + title: 'WebRTC P2P v1.4.44', imageAlt: 'mirotalk-about', imageUrl: images.about, customClass: { image: 'img-about' },