Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Added support for full screen when double clicking on Stream on Event page #4120

Merged
merged 4 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions web/skins/classic/js/skin.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var icons = {
};

var panZoomEnabled = true; //Add it to settings in the future
var expiredTap; //Time between touch screen clicks. Used to analyze double clicks

function checkSize() {
if ( 0 ) {
Expand Down Expand Up @@ -1201,4 +1202,52 @@ function loadFontFaceObserver() {
});
}

var doubleClickOnStream = function(event, touchEvent) {
let target = null;
if (event.target) {// Click NOT on touch screen, use THIS
//Process only double clicks directly on the image, excluding clicks,
//for example, on zoom buttons and other elements located in the image area.
if (event.target.id &&
(event.target.id.indexOf('evtStream') != -1 || event.target.id.indexOf('liveStream') != -1)) {
target = this;
}
} else {// Click on touch screen, use EVENT
if (touchEvent.target.id &&
(touchEvent.target.id.indexOf('evtStream') != -1 || touchEvent.target.id.indexOf('liveStream') != -1)) {
target = event;
}
}

if (target) {
if (document.fullscreenElement) {
closeFullscreen();
} else {
openFullscreen(target);
}
if (isMobile()) {
setTimeout(function() {
//For some mobile devices resizing does not work. You need to set a delay and re-call the 'resize' event
window.dispatchEvent(new Event('resize'));
}, 500);
}
}
};

var doubleTouch = function(e) {
if (e.touches.length === 1) {
if (!expiredTap) {
expiredTap = e.timeStamp + 300;
} else if (e.timeStamp <= expiredTap) {
// remove the default of this event ( Zoom )
e.preventDefault();
doubleClickOnStream(this, e);
// then reset the variable for other "double Touches" event
expiredTap = null;
} else {
// if the second touch was expired, make it as it's the first
expiredTap = e.timeStamp + 300;
}
}
};

loadFontFaceObserver();
8 changes: 8 additions & 0 deletions web/skins/classic/views/js/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,14 @@ function initPage() {
removeTag(tag);
});

// Event listener for double click
//var elStream = document.querySelectorAll('[id ^= "liveStream"], [id ^= "evtStream"]');
var elStream = document.querySelectorAll('[id = "wrapperEventVideo"]');
Array.prototype.forEach.call(elStream, (el) => {
el.addEventListener('touchstart', doubleTouch);
el.addEventListener('dblclick', doubleClickOnStream);
});

streamPlay();

if ( parseInt(ZM_OPT_USE_GEOLOCATION) && parseFloat(eventData.Latitude) && parseFloat(eventData.Longitude)) {
Expand Down