Skip to content

Commit ba67bc1

Browse files
[mirotalkc2c] - replace GIF loaders with CSS spinners for faster load
1 parent 562015e commit ba67bc1

9 files changed

Lines changed: 99 additions & 11 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 C2C v.1.2.84 - Environment Configuration
2+
# MiroTalk C2C v.1.2.85 - Environment Configuration
33
# ====================================================
44

55
# App environment

backend/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @license For private project or commercial purposes contact us at: license.mirotalk@gmail.com or purchase it directly via Code Canyon:
1010
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005
1111
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
12-
* @version 1.2.84
12+
* @version 1.2.85
1313
*/
1414

1515
require('dotenv').config();

frontend/css/client.css

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ body {
6666
min-width: 290px;
6767
padding: 30px;
6868
color: #ffffff;
69+
text-align: center;
6970
border: var(--border);
7071
border-radius: var(--border-radius);
7172
background: var(--secondary-color);
@@ -82,8 +83,59 @@ body {
8283
font-size: 16px;
8384
}
8485

85-
.loading-img {
86-
width: 290px;
86+
/* Custom CSS spinner */
87+
.loading-spinner {
88+
position: relative;
89+
width: 120px;
90+
height: 120px;
91+
margin: 0 auto 15px;
92+
}
93+
94+
.spinner-ring {
95+
position: absolute;
96+
inset: 0;
97+
border-radius: 50%;
98+
border: 4px solid rgba(255, 255, 255, 0.1);
99+
border-top-color: #fff;
100+
animation: spin 1s linear infinite;
101+
}
102+
103+
.spinner-ring::before {
104+
content: '';
105+
position: absolute;
106+
inset: 6px;
107+
border-radius: 50%;
108+
border: 4px solid rgba(255, 255, 255, 0.05);
109+
border-top-color: rgba(255, 255, 255, 0.6);
110+
animation: spin 1.5s linear reverse infinite;
111+
}
112+
113+
.spinner-logo {
114+
position: absolute;
115+
top: 50%;
116+
left: 50%;
117+
transform: translate(-50%, -50%);
118+
width: 48px;
119+
height: 48px;
120+
animation: pulse-logo 2s ease-in-out infinite;
121+
}
122+
123+
@keyframes spin {
124+
to {
125+
transform: rotate(360deg);
126+
}
127+
}
128+
129+
@keyframes pulse-logo {
130+
0%,
131+
100% {
132+
opacity: 0.7;
133+
transform: translate(-50%, -50%) scale(1);
134+
}
135+
50% {
136+
opacity: 1;
137+
transform: translate(-50%, -50%) scale(1.08);
138+
}
87139
}
88140

89141
.grid-buttons {
@@ -244,6 +296,27 @@ body {
244296
overflow: hidden;
245297
}
246298

299+
/* Video spinner overlay */
300+
.video-spinner {
301+
position: absolute;
302+
inset: 0;
303+
z-index: 3;
304+
display: flex;
305+
align-items: center;
306+
justify-content: center;
307+
background: rgba(0, 0, 0, 0.8);
308+
}
309+
310+
.video-spinner .loading-spinner {
311+
width: 80px;
312+
height: 80px;
313+
}
314+
315+
.video-spinner .spinner-logo {
316+
width: 32px;
317+
height: 32px;
318+
}
319+
247320
.remoteVideoWrap {
248321
z-index: 4;
249322
width: 100vw;

frontend/html/client.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@
6464
<div id="loadingDivContainer">
6565
<div id="loadingDiv" class="center">
6666
<h1 class="pulsate">Loading</h1>
67-
<img class="loading-img" src="../images/loading.gif" />
67+
<div class="loading-spinner">
68+
<div class="spinner-ring"></div>
69+
<img class="spinner-logo" src="../images/logo.svg" alt="logo" />
70+
</div>
6871
<pre>
6972
Please allow camera & microphone
7073
access to use this app.

frontend/images/loader.gif

-131 KB
Binary file not shown.

frontend/images/loading.gif

-198 KB
Binary file not shown.

frontend/js/client.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @license For private project or commercial purposes contact us at: license.mirotalk@gmail.com or purchase it directly via Code Canyon:
1010
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005
1111
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
12-
* @version 1.2.84
12+
* @version 1.2.85
1313
*/
1414

1515
const roomId = new URLSearchParams(window.location.search).get('room');
@@ -80,7 +80,6 @@ const image = {
8080
camOff: '../images/camOff.png',
8181
feedback: '../images/feedback.png',
8282
forbidden: '../images/forbidden.png',
83-
poster: '../images/loader.gif',
8483
};
8584

8685
const className = {
@@ -668,12 +667,19 @@ function createVideoElement(id, stream, muted = false) {
668667
video.controls = false;
669668
video.muted = muted;
670669
video.volume = muted ? 0 : 1;
671-
video.poster = image.poster;
672670
attachMediaStream(video, stream);
673671
video.play().catch(() => {});
674672
return video;
675673
}
676674

675+
function createVideoSpinner() {
676+
const spinner = document.createElement('div');
677+
spinner.className = 'video-spinner';
678+
spinner.innerHTML =
679+
'<div class="loading-spinner"><div class="spinner-ring"></div><img class="spinner-logo" src="../images/logo.svg" alt="logo" /></div>';
680+
return spinner;
681+
}
682+
677683
function createAudioElement(id, stream, muted = false) {
678684
const audio = document.createElement('audio');
679685
audio.id = id;
@@ -758,6 +764,9 @@ function setLocalMedia(stream) {
758764
myLocalMedia.style.objectFit = localStorageConfig.video.settings.aspect_ratio ? 'contain' : 'cover';
759765
myLocalMedia.style.display = 'block';
760766
myVideoAvatarImage.style.display = 'none';
767+
const myVideoSpinner = createVideoSpinner();
768+
myVideoWrap.appendChild(myVideoSpinner);
769+
myLocalMedia.addEventListener('playing', () => myVideoSpinner.remove(), { once: true });
761770
} else if (hasAudio) {
762771
myLocalMedia = createAudioElement('myAudio', stream, true);
763772
myLocalMedia.style.display = 'block';
@@ -888,6 +897,9 @@ function setRemoteMedia(stream, peers, peerId) {
888897
remoteVideoElem = createVideoElement(peerId + '_remoteVideo', stream, false);
889898
remoteVideoElem.style.display = 'block';
890899
remoteVideoAvatarImage.style.display = 'none';
900+
const remoteVideoSpinner = createVideoSpinner();
901+
remoteVideoWrap.appendChild(remoteVideoSpinner);
902+
remoteVideoElem.addEventListener('playing', () => remoteVideoSpinner.remove(), { once: true });
891903
}
892904

893905
// Audio element (if audio track)

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": "mirotalkc2c",
3-
"version": "1.2.84",
3+
"version": "1.2.85",
44
"description": "A free WebRTC Cam-2-Cam browser-based video calls",
55
"main": "server.js",
66
"scripts": {

0 commit comments

Comments
 (0)