Add grouped actions

To mute/unmute/suspend/resume everyone in one click
Fix #54
master
Daniel Berteaud 11 years ago
parent eb8d155d82
commit 20d1bf695f
  1. 5
      lib/Vroom/I18N/en.pm
  2. 5
      lib/Vroom/I18N/fr.pm
  3. 75
      public/js/vroom.js
  4. 32
      templates/default/join.html.ep

@ -163,6 +163,11 @@ our %Lexicon = (
"MIC_UNMUTED" => "Your microphone is now unmuted", "MIC_UNMUTED" => "Your microphone is now unmuted",
"CAM_SUSPENDED" => "Your webcam is now suspended", "CAM_SUSPENDED" => "Your webcam is now suspended",
"CAM_RESUMED" => "Your webcam is on again", "CAM_RESUMED" => "Your webcam is on again",
"GROUP_ACTIONS" => "Grouped actions",
"MUTE_EVERYONE" => "Mute everyone",
"UNMUTE_EVERYONE" => "Unmute everyone",
"SUSPEND_EVERYONE" => "Suspend everyone's webcam",
"RESUME_EVERYONE" => "Resume everyone's webcam",
"SHARE_YOUR_SCREEN" => "Share your screen with the other members of this room", "SHARE_YOUR_SCREEN" => "Share your screen with the other members of this room",
"CANT_SHARE_SCREEN" => "Sorry, your configuration does not allow screen sharing", "CANT_SHARE_SCREEN" => "Sorry, your configuration does not allow screen sharing",
"SCREEN_SHARING_ONLY_FOR_CHROME" => "Sorry, but you can't share your screen. Only Google Chrome supports this feature for now", "SCREEN_SHARING_ONLY_FOR_CHROME" => "Sorry, but you can't share your screen. Only Google Chrome supports this feature for now",

@ -173,6 +173,11 @@ our %Lexicon = (
"MIC_UNMUTED" => "Votre micro est à nouveau actif", "MIC_UNMUTED" => "Votre micro est à nouveau actif",
"CAM_SUSPENDED" => "Votre webcam est en pause", "CAM_SUSPENDED" => "Votre webcam est en pause",
"CAM_RESUMED" => "Votre webcam est à nouveau active", "CAM_RESUMED" => "Votre webcam est à nouveau active",
"GROUP_ACTIONS" => "Actions groupées",
"MUTE_EVERYONE" => "Couper le micro de tous les participants",
"UNMUTE_EVERYONE" => "Réactiver le micro de tous les participants",
"SUSPEND_EVERYONE" => "Mettre en pause les webcam de tous les participants",
"RESUME_EVERYONE" => "Réactiver les webcam de tous les participants",
"SHARE_YOUR_SCREEN" => "Partager votre écran", "SHARE_YOUR_SCREEN" => "Partager votre écran",
"CANT_SHARE_SCREEN" => "Désolé, mais votre configuration ne vous permet pas de partager votre écran", "CANT_SHARE_SCREEN" => "Désolé, mais votre configuration ne vous permet pas de partager votre écran",
"SCREEN_SHARING_ONLY_FOR_CHROME" => "Désolé, mais vous ne pouvez pas partager votre écran. Seul le navigateur Google Chrome " . "SCREEN_SHARING_ONLY_FOR_CHROME" => "Désolé, mais vous ne pouvez pas partager votre écran. Seul le navigateur Google Chrome " .

@ -603,34 +603,42 @@ function initVroom(room) {
} }
// Mute a peer // Mute a peer
function mutePeer(id){ function mutePeer(id,globalAction){
if (peers[id] && peers[id].role != 'owner'){ if (peers[id] && peers[id].role != 'owner'){
var msg = locale.YOU_HAVE_MUTED_s; if (!globalAction ||
var who = (peers[id].hasName) ? peers[id].displayName : locale.A_PARTICIPANT; (!peers[id].micMuted && globalAction == 'mute') ||
if (peers[id].micMuted){ (peers[id].micMuted && globalAction == 'unmute')){
msg = locale.YOU_HAVE_UNMUTED_s var msg = locale.YOU_HAVE_MUTED_s;
var who = (peers[id].hasName) ? peers[id].displayName : locale.A_PARTICIPANT;
if (peers[id].micMuted){
msg = locale.YOU_HAVE_UNMUTED_s
}
// notify everyone that we have muted this peer
webrtc.sendToAll('owner_toggle_mute', {peer: id});
$.notify(sprintf(msg, who), 'info');
} }
// notify everyone that we have muted this peer
webrtc.sendToAll('owner_toggle_mute', {peer: id});
$.notify(sprintf(msg, who), 'info');
} }
// We cannot mute another owner // We cannot mute another owner
else{ else if (!globalAction){
$.notify(locale.CANT_MUTE_OWNER, 'error'); $.notify(locale.CANT_MUTE_OWNER, 'error');
} }
} }
// Pause a peer // Pause a peer
function pausePeer(id){ function pausePeer(id,globalAction){
if (peers[id] && peers[id].role != 'owner'){ if (peers[id] && peers[id].role != 'owner'){
var msg = locale.YOU_HAVE_SUSPENDED_s; if (!globalAction ||
var who = (peers[id].hasName) ? peers[id].displayName : locale.A_PARTICIPANT; (!peers[id].videoPaused && globalAction == 'pause') ||
if (peers[id].videoPaused){ (peers[id].videoPaused && globalAction == 'resume')){
msg = locale.YOU_HAVE_RESUMED_s; var msg = locale.YOU_HAVE_SUSPENDED_s;
var who = (peers[id].hasName) ? peers[id].displayName : locale.A_PARTICIPANT;
if (peers[id].videoPaused){
msg = locale.YOU_HAVE_RESUMED_s;
}
webrtc.sendToAll('owner_toggle_pause', {peer: id});
$.notify(sprintf(msg, who), 'info');
} }
webrtc.sendToAll('owner_toggle_pause', {peer: id});
$.notify(sprintf(msg, who), 'info');
} }
else{ else if (!globalAction){
$.notify(locale.CANT_SUSPEND_OWNER, 'error'); $.notify(locale.CANT_SUSPEND_OWNER, 'error');
} }
} }
@ -1337,6 +1345,39 @@ function initVroom(room) {
} }
}); });
// Mute all the peers
$('#muteEveryoneButton').click(function(){
$.each(peers, function(id){
if (id != 'local'){
mutePeer(id, 'mute');
}
});
});
// Unmute all the peers
$('#unmuteEveryoneButton').click(function(){
$.each(peers, function(id){
if (id != 'local'){
mutePeer(id, 'unmute');
}
});
});
// Suspend all the peers
$('#suspendEveryoneButton').click(function(){
$.each(peers, function(id){
if (id != 'local'){
pausePeer(id, 'pause');
}
});
});
// Resum all the peers
$('#resumeEveryoneButton').click(function(){
$.each(peers, function(id){
if (id != 'local'){
pausePeer(id, 'resume');
}
});
});
// Handle auth to become room owner // Handle auth to become room owner
$('#authPass').on('input', function() { $('#authPass').on('input', function() {
if ($('#authPass').val() == ''){ if ($('#authPass').val() == ''){

@ -97,6 +97,38 @@
</ul> </ul>
</div> </div>
<div class="btn-group dropdown ownerEl"> <div class="btn-group dropdown ownerEl">
<button class="btn btn-default dropdown-toggle help" type="button" id="groupActionsButton" data-toggle="dropdown" data-toggle="tooltip" data-placement="bottom" title="<%=l 'GROUP_ACTIONS' %>">
<span class="glyphicon glyphicon-flag"></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="groupActionsButton" id="confMenu">
<li>
<center>
<div class="navbar-form">
<div class="btn-group" data-toggle="buttons">
<button type="button" class="btn btn-default help" id="muteEveryoneButton" data-toggle="tooltip" data-placement="bottom" title="<%=l 'MUTE_EVERYONE' %>">
<span class="glyphicon glyphicon-volume-off">
</span>
</button>
<button type="button" class="btn btn-default help" id="unmuteEveryoneButton" data-toggle="tooltip" data-placement="bottom" title="<%=l 'UNMUTE_EVERYONE' %>">
<span class="glyphicon glyphicon-volume-up">
</span>
</buton>
<button type="button" class="btn btn-default help" id="suspendEveryoneButton" data-toggle="tooltip" data-placement="bottom" title="<%=l 'SUSPEND_EVERYONE' %>">
<span class="glyphicon glyphicon-eye-close">
</span>
</button>
<button type="button" class="btn btn-default help" id="resumeEveryoneButton" data-toggle="tooltip" data-placement="bottom" title="<%=l 'RESUME_EVERYONE' %>">
<span class="glyphicon glyphicon-eye-open">
</span>
</button>
</div>
</div>
</center>
</li>
</ul>
</div>
<div class="btn-group dropdown ownerEl">
<button class="btn btn-default dropdown-toggle help" type="button" id="confMenuButton" data-toggle="dropdown" data-toggle="tooltip" data-placement="bottom" title="<%=l 'CONFIGURE' %>"> <button class="btn btn-default dropdown-toggle help" type="button" id="confMenuButton" data-toggle="dropdown" data-toggle="tooltip" data-placement="bottom" title="<%=l 'CONFIGURE' %>">
<span class="glyphicon glyphicon-wrench"></span> <span class="glyphicon glyphicon-wrench"></span>
<span class="caret"></span> <span class="caret"></span>

Loading…
Cancel
Save