Skip to content

Commit da49980

Browse files
[mirotalksfu] - refactoring video menu bar
1 parent edec3ba commit da49980

File tree

6 files changed

+41
-30
lines changed

6 files changed

+41
-30
lines changed

app/src/Server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ dev dependencies: {
6464
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
6565
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
6666
* @author Miroslav Pejic - [email protected]
67-
* @version 1.9.73
67+
* @version 1.9.74
6868
*
6969
*/
7070

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": "mirotalksfu",
3-
"version": "1.9.73",
3+
"version": "1.9.74",
44
"description": "WebRTC SFU browser-based video calls",
55
"main": "Server.js",
66
"scripts": {

public/js/Brand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ let BRAND = {
7878
},
7979
about: {
8080
imageUrl: '../images/mirotalk-logo.gif',
81-
title: '<strong>WebRTC SFU v1.9.73</strong>',
81+
title: '<strong>WebRTC SFU v1.9.74</strong>',
8282
html: `
8383
<button
8484
id="support-button"

public/js/Room.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
1111
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
1212
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
1313
* @author Miroslav Pejic - [email protected]
14-
* @version 1.9.73
14+
* @version 1.9.74
1515
*
1616
*/
1717

@@ -5693,7 +5693,7 @@ function showAbout() {
56935693
position: 'center',
56945694
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about,
56955695
customClass: { image: 'img-about' },
5696-
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.73',
5696+
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.9.74',
56975697
html: `
56985698
<br />
56995699
<div id="about">

public/js/RoomClient.js

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
1010
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
1111
* @author Miroslav Pejic - [email protected]
12-
* @version 1.9.73
12+
* @version 1.9.74
1313
*
1414
*/
1515

@@ -3078,6 +3078,7 @@ class RoomClient {
30783078

30793079
eVc = document.createElement('div');
30803080
eVc.className = 'expand-video-content';
3081+
eVc.id = id + '_videoExpandContent';
30813082

30823083
pip = this.createButton(id + '__pictureInPicture', html.pip);
30833084
mv = this.createButton(id + '__videoMirror', html.mirror);
@@ -3182,8 +3183,7 @@ class RoomClient {
31823183

31833184
this.isVideoPictureInPictureSupported && this.handlePIP(elem.id, pip.id);
31843185
this.isVideoFullScreenSupported && this.handleFS(elem.id, fs.id);
3185-
this.handleVBEC(eBtn, eVc, vb, d);
3186-
this.handleVB(d.id, vb.id);
3186+
this.handleVB(d.id, vb.id, eBtn.id, eVc.id);
31873187
this.handleDD(elem.id, remotePeerId);
31883188
this.handleTS(elem.id, ts.id);
31893189
this.handleMV(elem.id, mv.id);
@@ -4606,28 +4606,33 @@ class RoomClient {
46064606
// HANDLE VIDEO AND MENU BAR
46074607
// ####################################################
46084608

4609-
handleVBEC(eBtn, eVc, vb, d) {
4610-
const showDropdown = () => eVc.classList.add('show');
4611-
const hideDropdown = () => eVc.classList.remove('show');
4612-
const hideVideoBar = () => hide(vb) && hideDropdown();
4613-
if (!this.isMobileDevice) {
4614-
eBtn.addEventListener('mouseenter', showDropdown);
4615-
eBtn.addEventListener('mouseleave', hideDropdown);
4616-
eVc.addEventListener('mouseenter', showDropdown);
4617-
eVc.addEventListener('mouseleave', hideDropdown);
4618-
d.addEventListener('mouseleave', hideDropdown);
4619-
} else {
4620-
eBtn.addEventListener('click', showDropdown);
4621-
eVc.addEventListener('click', showDropdown);
4622-
}
4623-
document.addEventListener('click', hideVideoBar);
4624-
}
4625-
4626-
handleVB(videoId, videoBarId) {
4609+
handleVB(videoId, videoBarId, eBtnId = null, eVcId = null) {
46274610
const videoPlayer = this.getId(videoId);
46284611
const videoBar = this.getId(videoBarId);
4612+
const eBtn = this.getId(eBtnId);
4613+
const eVc = this.getId(eVcId);
4614+
4615+
if (eBtn && eVc) {
4616+
const showDropdown = () => eVc.classList.add('show');
4617+
const hideDropdown = () => eVc.classList.remove('show');
4618+
4619+
const handleDocumentClick = (e) => {
4620+
if (!eBtn.contains(e.target) && !eVc.contains(e.target)) {
4621+
hideDropdown();
4622+
}
4623+
};
4624+
4625+
if (this.isDesktopDevice) {
4626+
eBtn.addEventListener('mouseenter', showDropdown);
4627+
eVc.addEventListener('mouseleave', hideDropdown);
4628+
} else {
4629+
eBtn.addEventListener('click', showDropdown);
4630+
document.addEventListener('click', handleDocumentClick);
4631+
}
4632+
}
4633+
46294634
if (videoPlayer && videoBar) {
4630-
const eventType = this.isMobileDevice ? 'click' : 'mouseenter';
4635+
const eventType = this.isDesktopDevice ? 'mouseenter' : 'click';
46314636
videoPlayer.addEventListener(eventType, async () => {
46324637
hideVideoMenuBar(videoBarId);
46334638
rc.resizeVideoMenuBar();
@@ -4641,12 +4646,18 @@ class RoomClient {
46414646
videoPlayer.style.setProperty('border', 'var(--videoBar-active)', 'important');
46424647
}
46434648
} else {
4644-
animateCSS(videoBar, 'fadeOutUp').then((msg) => {
4649+
animateCSS(videoBar, 'fadeOutUp').then(() => {
46454650
hide(videoBar);
46464651
});
46474652
videoPlayer.style.setProperty('border', 'none', 'important');
46484653
}
46494654
});
4655+
if (this.isDesktopDevice) {
4656+
videoPlayer.addEventListener('mouseleave', () => {
4657+
setCamerasBorderNone();
4658+
hideVideoMenuBar('ALL');
4659+
});
4660+
}
46504661
}
46514662
}
46524663

0 commit comments

Comments
 (0)