Allow unmute/resume webcam in owner's actions

master
Daniel Berteaud 11 years ago
parent 4f4bc8397c
commit 0d186fefd0
  1. 10
      lib/Vroom/I18N/en.pm
  2. 10
      lib/Vroom/I18N/fr.pm
  3. 60
      public/js/vroom.js

@ -93,20 +93,26 @@ our %Lexicon = (
"SET_YOUR_NAME_TO_CHAT" => "You need to set your name to be able to chat",
"SEND_MESSAGE" => "Send the message",
"SAVE_HISTORY" => "Save history to a file",
"MUTE_PEER" => "Mute this participant's microphone",
"SUSPEND_PEER" => "Suspend this participant's webcam",
"MUTE_PEER" => "Mute or unmute this participant's microphone",
"SUSPEND_PEER" => "Suspend or resume this participant's webcam",
"KICK_PEER" => "Kick this participant out of the room",
"s_IS_MUTING_YOU" => "%s has muted your microphone",
"s_IS_MUTING_s" => "%s has muted %s's microphone",
"s_IS_UNMUTING_YOU" => "%s has unmuted your microphone",
"s_IS_UNMUTING_s" => "%s has unmuted %s's microphone",
"s_IS_SUSPENDING_YOU" => "%s has suspended your webcam",
"s_IS_SUSPENDING_s" => "%s has suspended %s's webcam",
"s_IS_RESUMING_YOU" => "%s has resumed your webcam",
"s_IS_RESUMING_s" => "%s has resumed %s's webcam",
"s_IS_KICKING_s" => "%s has kicked %s out of the room",
"KICKED" => "Kicked",
"YOU_HAVE_BEEN_KICKED" => "You've been kicked out of the room",
"AN_ADMIN_HAS_KICKED_YOU" => "An administrator of the room has excluded you",
"YOU_HAVE_MUTED_s" => "You have muted %s's microphone",
"YOU_HAVE_UNMUTED_s" => "You have unmuted %s's microphone",
"CANT_MUTE_OWNER" => "You can't mute the microphone of this participant",
"YOU_HAVE_SUSPENDED_s" => "You have suspended %s's webcam",
"YOU_HAVE_RESUMED_s" => "You have resumed %s's webcam",
"CANT_SUSPEND_OWNER" => "You can't suspend this participant's webcam",
"YOU_HAVE_KICKED_s" => "You have kicked %s out of the room",
"CANT_KICK_OWNER" => "You can't kick this participant out of the room",

@ -99,20 +99,26 @@ our %Lexicon = (
"SET_YOUR_NAME_TO_CHAT" => "Vous devez saisir votre nom avant de pouvoir tchater",
"SEND_MESSAGE" => "Envoyer le message",
"SAVE_HISTORY" => "Sauvegarder l'historique dans un fichier",
"MUTE_PEER" => "Couper le micro de ce participant",
"SUSPEND_PEER" => "Mettre la webcam de ce participant en pause",
"MUTE_PEER" => "Couper ou réactiver le micro de ce participant",
"SUSPEND_PEER" => "Mettre en pause ou réactiver la webcam de ce participant",
"KICK_PEER" => "Éjecter ce participant du salon",
"s_IS_MUTING_YOU" => "%s a coupé votre micro",
"s_IS_MUTING_s" => "%s a coupé le micro de %s",
"s_IS_UNMUTING_YOU" => "%s a réactivé votre micro",
"s_IS_UNMUTING_s" => "%s a réactivé le micro de %s",
"s_IS_SUSPENDING_YOU" => "%s a mis votre webcam en pause",
"s_IS_SUSPENDING_s" => "%s a mis la webcam de %s en pause",
"s_IS_RESUMING_YOU" => "%s a réactivé votre webcam",
"s_IS_RESUMING_s" => "%s a réactivé la webcam de %s",
"s_IS_KICKING_s" => "%s a éjecté %s du salon",
"KICKED" => "Éjecté",
"YOU_HAVE_BEEN_KICKED" => "Vous avez été éjecté du salon",
"AN_ADMIN_HAS_KICKED_YOU" => "Un administrateur du salon vous a exclus",
"YOU_HAVE_MUTED_s" => "Vous avez coupé le micro de %s",
"YOU_HAVE_UNMUTED_s" => "Vous avez réactivé le micro de %s",
"CANT_MUTE_OWNER" => "Vous ne pouvez pas couper le micro de ce participant",
"YOU_HAVE_SUSPENDED_s" => "Vous avez mis la webcam de %s en pause",
"YOU_HAVE_RESUMED_s" => "Vous avez réactivé la webcam de %s",
"CANT_SUSPEND_OWNER" => "Vous ne pouvez pas mettre la webcam de ce participant en pause",
"YOU_HAVE_KICKED_s" => "Vous avez bani %s du salon",
"CANT_KICK_OWNER" => "Vous ne pouvez pas bannir ce participant",

@ -38,15 +38,21 @@ var locale = {
DISPLAY_NAME_TOO_LONG: '',
s_IS_MUTING_YOU: '',
s_IS_MUTING_s: '',
s_IS_UNMUTING_YOU: '',
s_IS_UNMUTING_s: '',
s_IS_SUSPENDING_YOU: '',
s_IS_SUSPENDING_s: '',
s_IS_RESUMING_YOU: '',
s_IS_RESUMING_s: '',
s_IS_KICKING_s: '',
MUTE_PEER: '',
SUSPEND_PEER: '',
KICK_PEER: '',
YOU_HAVE_MUTED_s: '',
YOU_HAVE_UNMUTED_s: '',
CANT_MUTE_OWNER: '',
YOU_HAVE_SUSPENDED_s: '',
YOU_HAVE_RESUMED_s: '',
CANT_SUSPEND_OWNER: '',
YOU_HAVE_KICKED_s: '',
CANT_KICK_OWNER: ''
@ -292,6 +298,8 @@ function initVroom(room) {
peers[peer.id] = {
displayName: peer.id,
color: color,
micMuted: false,
videoPaused: false,
dc: peer.getDataChannel('vroom'),
obj: peer
};
@ -437,8 +445,12 @@ function initVroom(room) {
// Mute a peer
function mutePeer(id){
if (peers[id] && peers[id].role != 'owner'){
webrtc.sendToAll('owner_mute', {peer: id});
$.notify(sprintf(locale.YOU_HAVE_MUTED_s, peers[id].displayName), 'info');
var msg = locale.YOU_HAVE_MUTED_s;
if (peers[id].micMuted){
msg = locale.YOU_HAVE_UNMUTED_s
}
webrtc.sendToAll('owner_toggle_mute', {peer: id});
$.notify(sprintf(msg, peers[id].displayName), 'info');
}
else{
$.notify(locale.CANT_MUTE_OWNER, 'error');
@ -447,8 +459,12 @@ function initVroom(room) {
// Puase a peer
function pausePeer(id){
if (peers[id] && peers[id].role != 'owner'){
webrtc.sendToAll('owner_pause', {peer: id});
$.notify(sprintf(locale.YOU_HAVE_SUSPENDED_s, peers[id].displayName), 'info');
var msg = locale.YOU_HAVE_SUSPENDED_s;
if (peers[id].videoPaused){
msg = locale.YOU_HAVE_RESUMED_s;
}
webrtc.sendToAll('owner_toggle_pause', {peer: id});
$.notify(sprintf(msg, peers[id].displayName), 'info');
}
else{
$.notify(locale.CANT_SUSPEND_OWNER, 'error');
@ -494,8 +510,8 @@ function initVroom(room) {
peers.local.videoPaused = false;
}
// An owner is muting ourself
webrtc.on('owner_mute', function(data){
// An owner is muting/unmuting ourself
webrtc.on('owner_toggle_mute', function(data){
if (peers[data.id].role != 'owner'){
return;
}
@ -507,26 +523,48 @@ function initVroom(room) {
$('#muteMicButton').prop('checked', true);
$.notify(sprintf(locale.s_IS_MUTING_YOU, peers[data.id].displayName), 'info');
}
else {
unmuteMic();
$("#muteMicLabel").removeClass('btn-danger active');
$('#muteMicButton').prop('checked', false);
$.notify(sprintf(locale.s_IS_UNMUTING_YOU, peers[data.id].displayName), 'info');
}
}
else if (data.payload.peer != peers.local.id){
$.notify(sprintf(locale.s_IS_MUTING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
if (peers[data.payload.peer].micMuted){
$.notify(sprintf(locale.s_IS_UNMUTING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
}
else{
$.notify(sprintf(locale.s_IS_MUTING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
}
}
});
// An owner is pausing our webcam
webrtc.on('owner_pause', function(data){
// An owner is pausing/resuming our webcam
webrtc.on('owner_toggle_pause', function(data){
if (peers[data.id].role != 'owner'){
return;
}
if (data.payload.peer && data.payload.peer == peers.local.id && peers.local.role != 'owner'){
if (!peers.local.paused){
if (!peers.local.videoPaused){
suspendCam();
$("#suspendCamLabel").addClass('btn-danger active');
$('#suspendCamButton').prop('checked', true);
$.notify(sprintf(locale.s_IS_SUSPENDING_YOU, peers[data.id].displayName), 'info');
}
else{
resumeCam();
$("#suspendCamLabel").removeClass('btn-danger active');
$('#suspendCamButton').prop('checked', false);
$.notify(sprintf(locale.s_IS_RESUMING_YOU, peers[data.id].displayName), 'info');
}
}
else if (data.payload.peer != peers.local.id){
$.notify(sprintf(locale.s_IS_SUSPENDING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
if (peers[data.payload.peer].videoPaused){
$.notify(sprintf(locale.s_IS_RESUMING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
}
else{
$.notify(sprintf(locale.s_IS_SUSPENDING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
}
}
});
// An owner is kicking us from the room

Loading…
Cancel
Save