Can switch to full screen

This commit is contained in:
Pierre HUBERT 2019-01-26 10:57:58 +01:00
parent 0b806d5bb2
commit 194b6c60de
3 changed files with 72 additions and 2 deletions

View File

@ -27,8 +27,9 @@
visibility: visible; visibility: visible;
} }
.call.window.body { .call-window .call-window-body{
flex: 1; flex: 1;
display: flex;
} }
@ -74,13 +75,16 @@
* Stream target * Stream target
*/ */
.call-window .streams-target { .call-window .streams-target {
flex: 1;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
flex-direction: row; flex-direction: row;
max-width: 100%;
} }
.call-window .streams-target video { .call-window .streams-target video {
width: 149px; flex: 1;
flex-shrink: 1;
} }

View File

@ -700,4 +700,57 @@ function SendEvent(name, details){
document.dispatchEvent(event); document.dispatchEvent(event);
}
/**
* Request full screen for an HTML element
*
* Note : this function must be called inside of an event of
* the user like a click, otherwise it will not work
*
* This function source code is based on this StackOverFlow Answer
* https://stackoverflow.com/a/32100295/3781411
*
* @param {HTMLElement} elem The element for which we want
* full screen
*/
function RequestFullScreen(element){
if (
document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement
) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
} else {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
}
/**
* Check out whether Comunic has grabbed full screen or not
*
* @return {Boolean} TRUE if the window is in full screen / FALSE else
*/
function IsFullScreen(){
return document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement;
} }

View File

@ -303,6 +303,19 @@ ComunicWeb.components.calls.callWindow = {
togglButtonSelectedStatus(btn, call.isLocalVideoEnabled()); togglButtonSelectedStatus(btn, call.isLocalVideoEnabled());
console.log(call); console.log(call);
} }
},
//Full screen button
{
icon: "fa-expand",
selected: false,
onclick: function(btn){
RequestFullScreen(callContainer);
setTimeout(function(){
togglButtonSelectedStatus(btn, IsFullScreen());
}, 1000);
}
} }
]; ];