From 731ad26be4dfdf840ca6c9ed9ad9f586a857ebd5 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 27 Oct 2015 17:45:47 +0000 Subject: [PATCH] Exit full screen programatically when the remote side hangs up --- src/controllers/molecules/voip/CallView.js | 1 + .../vector/views/molecules/RoomHeader.js | 2 +- .../vector/views/molecules/voip/VideoView.js | 22 +++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/controllers/molecules/voip/CallView.js b/src/controllers/molecules/voip/CallView.js index b16655679a..ab71214882 100644 --- a/src/controllers/molecules/voip/CallView.js +++ b/src/controllers/molecules/voip/CallView.js @@ -90,6 +90,7 @@ module.exports = { else { this.getVideoView().getLocalVideoElement().style.display = "none"; this.getVideoView().getRemoteVideoElement().style.display = "none"; + dis.dispatch({action: 'video_fullscreen', fullscreen: false}); } } }; diff --git a/src/skins/vector/views/molecules/RoomHeader.js b/src/skins/vector/views/molecules/RoomHeader.js index de6aea15e8..94adb2a9f4 100644 --- a/src/skins/vector/views/molecules/RoomHeader.js +++ b/src/skins/vector/views/molecules/RoomHeader.js @@ -39,7 +39,7 @@ module.exports = React.createClass({ }, onFullscreenClick: function() { - dis.dispatch({action: 'video_fullscreen'}, true); + dis.dispatch({action: 'video_fullscreen', fullscreen: true}, true); }, render: function() { diff --git a/src/skins/vector/views/molecules/voip/VideoView.js b/src/skins/vector/views/molecules/voip/VideoView.js index 9dff7cdf30..4e0fb913e6 100644 --- a/src/skins/vector/views/molecules/voip/VideoView.js +++ b/src/skins/vector/views/molecules/voip/VideoView.js @@ -51,8 +51,26 @@ module.exports = React.createClass({ return; } var element = this.container.getDOMNode(); - var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen; - requestMethod.call(element); + if (payload.fullscreen) { + var requestMethod = ( + element.requestFullScreen || + element.webkitRequestFullScreen || + element.mozRequestFullScreen || + element.msRequestFullscreen + ); + requestMethod.call(element); + } + else { + var exitMethod = ( + document.exitFullscreen || + document.mozCancelFullScreen || + document.webkitExitFullscreen || + document.msExitFullscreen + ); + if (exitMethod) { + exitMethod.call(document); + } + } break; } },