Exit full screen programatically when the remote side hangs up

pull/265/head
Kegan Dougal 2015-10-27 17:45:47 +00:00
parent ed52bc37b2
commit 731ad26be4
3 changed files with 22 additions and 3 deletions

View File

@ -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});
}
}
};

View File

@ -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() {

View File

@ -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;
}
},