Skip to content

Commit 345ecef

Browse files
[mirotalk] - fix: cancel pending rAF in showDisconnectBanner to prevent stuck banner on fast reconnect
1 parent d88015d commit 345ecef

7 files changed

Lines changed: 21 additions & 12 deletions

File tree

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ====================================================
2-
# MiroTalk P2P v.1.8.32 - Environment Configuration
2+
# MiroTalk P2P v.1.8.33 - Environment Configuration
33
# ====================================================
44

55
# App environment

app/src/config.template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* ==============================================
5-
* MiroTalk P2P v.1.8.32 - Configuration File
5+
* MiroTalk P2P v.1.8.33 - Configuration File
66
* ==============================================
77
*
88
* This file is the central configuration source.

app/src/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies: {
4545
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
4646
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
4747
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
48-
* @version 1.8.32
48+
* @version 1.8.33
4949
*
5050
*/
5151

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mirotalk",
3-
"version": "1.8.32",
3+
"version": "1.8.33",
44
"description": "A free WebRTC browser-based video call",
55
"main": "server.js",
66
"scripts": {

public/js/brand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ let brand = {
109109
},
110110
about: {
111111
imageUrl: '../images/mirotalk-logo.gif',
112-
title: 'WebRTC P2P v1.8.32',
112+
title: 'WebRTC P2P v1.8.33',
113113
html: `
114114
<button
115115
id="support-button"

public/js/client.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
1616
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
1717
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
18-
* @version 1.8.32
18+
* @version 1.8.33
1919
*
2020
*/
2121

@@ -517,6 +517,7 @@ const icon = getId('disconnectBannerIcon');
517517
const title = getId('disconnectBannerTitle');
518518
const msg = getId('disconnectBannerMsg');
519519
const spinner = getId('disconnectBannerSpinner');
520+
let disconnectBannerRafId = null;
520521

521522
//....
522523

@@ -15812,7 +15813,7 @@ function showAbout() {
1581215813
Swal.fire({
1581315814
background: swBg,
1581415815
position: 'center',
15815-
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.32',
15816+
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.33',
1581615817
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
1581715818
customClass: { image: 'img-about' },
1581815819
html: renderRoomTemplate('tpl-about-modal', {
@@ -16075,15 +16076,23 @@ function showDisconnectBanner() {
1607516076
title.textContent = 'Connection lost';
1607616077
msg.innerHTML = 'Reconnecting to signaling server\u2026';
1607716078
spinner.style.opacity = '1';
16078-
// Trigger transition
16079-
requestAnimationFrame(() => banner.classList.add('visible'));
16079+
if (disconnectBannerRafId) cancelAnimationFrame(disconnectBannerRafId);
16080+
disconnectBannerRafId = requestAnimationFrame(() => {
16081+
disconnectBannerRafId = null;
16082+
banner.classList.add('visible');
16083+
});
1608016084
}
1608116085

1608216086
/**
1608316087
* Hide the disconnect banner (or briefly show a reconnected confirmation).
1608416088
*/
1608516089
function hideDisconnectBanner() {
16086-
if (!banner || !banner.classList.contains('visible')) return;
16090+
if (!banner) return;
16091+
if (disconnectBannerRafId) {
16092+
cancelAnimationFrame(disconnectBannerRafId);
16093+
disconnectBannerRafId = null;
16094+
}
16095+
if (!banner.classList.contains('visible')) return;
1608716096
banner.classList.add('reconnected');
1608816097
icon.className = 'fa-solid fa-circle-check';
1608916098
title.textContent = 'Back online';

0 commit comments

Comments
 (0)