Add fullScreen function

master
Daniel Berteaud 11 years ago
parent 7d79b34e91
commit 28f5dab18f
  1. 22
      public/js/vroom.js

@ -93,6 +93,16 @@ function initVroom(room) {
audio.play(); audio.play();
} }
// Request full screen
function fullScreen(el){
if (el.requestFullScreen)
el.requestFullScreen();
else if (el.webkitRequestFullScreen)
el.webkitRequestFullScreen();
else if (el.mozRequestFullScreen)
el.mozRequestFullScreen();
}
// Logout // Logout
function hangupCall(){ function hangupCall(){
webrtc.connection.disconnect(); webrtc.connection.disconnect();
@ -154,8 +164,7 @@ function initVroom(room) {
// And go full screen on double click // And go full screen on double click
// TODO: also handle double tap // TODO: also handle double tap
$(video).dblclick(function() { $(video).dblclick(function() {
this.requestFullScreen = this.webkitRequestFullScreen || this.mozRequestFullScreen; fullScreen(this);
this.requestFullScreen();
}); });
// Simple click put this preview in the mainVideo div // Simple click put this preview in the mainVideo div
$(video).click(function() { $(video).click(function() {
@ -165,8 +174,7 @@ function initVroom(room) {
} }
else { else {
$('#mainVideo').html($(video).clone().dblclick(function() { $('#mainVideo').html($(video).clone().dblclick(function() {
this.requestFullScreen = this.webkitRequestFullScreen || this.mozRequestFullScreen; fullScreen(this);
this.requestFullScreen();
}).css('max-height', $(window).height()-$('#toolbar').height()-25)).bind("contextmenu", function(){ return false; }); }).css('max-height', $(window).height()-$('#toolbar').height()-25)).bind("contextmenu", function(){ return false; });
$('.selected').removeClass('selected'); $('.selected').removeClass('selected');
$(this).addClass('selected'); $(this).addClass('selected');
@ -509,8 +517,7 @@ function initVroom(room) {
// Go fullscreen on double click // Go fullscreen on double click
$("#webRTCVideoLocal").dblclick(function() { $("#webRTCVideoLocal").dblclick(function() {
this.requestFullScreen = this.webkitRequestFullScreen || this.mozRequestFullScreen; fullScreen(this);
this.requestFullScreen();
}); });
$("#webRTCVideoLocal").click(function() { $("#webRTCVideoLocal").click(function() {
// If this video is already the main one, remove the main // If this video is already the main one, remove the main
@ -522,8 +529,7 @@ function initVroom(room) {
// Else, update the main video to use this one // Else, update the main video to use this one
else{ else{
$('#mainVideo').html($(this).clone().dblclick(function() { $('#mainVideo').html($(this).clone().dblclick(function() {
this.requestFullScreen = this.webkitRequestFullScreen || this.mozRequestFullScreen; fullScreen(this);
this.requestFullScreen();
}).css('max-height', $(window).height()-$('#toolbar').height()-25)); }).css('max-height', $(window).height()-$('#toolbar').height()-25));
$('.selected').removeClass('selected'); $('.selected').removeClass('selected');
$(this).addClass('selected'); $(this).addClass('selected');

Loading…
Cancel
Save