diff --git a/public/css/vroom.css b/public/css/vroom.css index 32f9970..a4a4cbd 100644 --- a/public/css/vroom.css +++ b/public/css/vroom.css @@ -99,6 +99,9 @@ .unauthEl{ display: none; } +.threePeersEl{ + display: none; +} .ownerActions { position: absolute; left: 15px; diff --git a/public/js/vroom.js b/public/js/vroom.js index b4da0c0..8454b4e 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -269,6 +269,18 @@ function initVroom(room) { $('#noWebrtcSupport').modal('show'); } + // Return the number of peers in the room + function countPeers(){ + var count = Object.keys(peers).length; + // Do not count ourself + count--; + // and do not count our local screen + if (peers.local.screenShared){ + count--; + } + return count; + } + // Get our role and other room settings from the server function getRoomInfo(){ $.ajax({ @@ -291,7 +303,10 @@ function initVroom(room) { // Enable owner reserved menu if (data.role == 'owner'){ $('.unauthEl').hide(500); - $('.ownerEl').show(500); + $('.ownerEl').not('.threePeersEl').show(500); + if (countPeers() > 1){ + ('.threePeersEl').show(500); + } var notif = JSON.parse(data.notif); $.each(notif.email, function(index, val){ addNotifiedEmail(val); @@ -517,6 +532,14 @@ function initVroom(room) { // Stop moh, we're not alone anymore $('#mohPlayer')[0].pause(); $('.aloneEl').hide(300); + if (countPeers() > 1){ + if (peers.local.role == 'owner'){ + $('.threePeersEl').show(500); + } + else{ + $('.threePeersEl').not('.ownerEl').show(500); + } + } } $(div).attr('id', 'peer_' + id); // Disable context menu on the video @@ -686,7 +709,7 @@ function initVroom(room) { // Check if MoH is needed function checkMoh(){ setTimeout(function(){ - if (Object.keys(peers).length < 2){ + if (countPeers() < 1){ if ($('#pauseMohButton').is(':checked')){ $('#mohPlayer').get(0).volume = .25; $('#mohPlayer').get(0).play(); diff --git a/templates/default/join.html.ep b/templates/default/join.html.ep index d5e78ee..f69cb09 100644 --- a/templates/default/join.html.ep +++ b/templates/default/join.html.ep @@ -96,7 +96,7 @@ -