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", "SET_YOUR_NAME_TO_CHAT" => "You need to set your name to be able to chat",
"SEND_MESSAGE" => "Send the message", "SEND_MESSAGE" => "Send the message",
"SAVE_HISTORY" => "Save history to a file", "SAVE_HISTORY" => "Save history to a file",
"MUTE_PEER" => "Mute this participant's microphone", "MUTE_PEER" => "Mute or unmute this participant's microphone",
"SUSPEND_PEER" => "Suspend this participant's webcam", "SUSPEND_PEER" => "Suspend or resume this participant's webcam",
"KICK_PEER" => "Kick this participant out of the room", "KICK_PEER" => "Kick this participant out of the room",
"s_IS_MUTING_YOU" => "%s has muted your microphone", "s_IS_MUTING_YOU" => "%s has muted your microphone",
"s_IS_MUTING_s" => "%s has muted %s's 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_YOU" => "%s has suspended your webcam",
"s_IS_SUSPENDING_s" => "%s has suspended %s's 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", "s_IS_KICKING_s" => "%s has kicked %s out of the room",
"KICKED" => "Kicked", "KICKED" => "Kicked",
"YOU_HAVE_BEEN_KICKED" => "You've been kicked out of the room", "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", "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_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", "CANT_MUTE_OWNER" => "You can't mute the microphone of this participant",
"YOU_HAVE_SUSPENDED_s" => "You have suspended %s's webcam", "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", "CANT_SUSPEND_OWNER" => "You can't suspend this participant's webcam",
"YOU_HAVE_KICKED_s" => "You have kicked %s out of the room", "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", "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", "SET_YOUR_NAME_TO_CHAT" => "Vous devez saisir votre nom avant de pouvoir tchater",
"SEND_MESSAGE" => "Envoyer le message", "SEND_MESSAGE" => "Envoyer le message",
"SAVE_HISTORY" => "Sauvegarder l'historique dans un fichier", "SAVE_HISTORY" => "Sauvegarder l'historique dans un fichier",
"MUTE_PEER" => "Couper le micro de ce participant", "MUTE_PEER" => "Couper ou réactiver le micro de ce participant",
"SUSPEND_PEER" => "Mettre la webcam de ce participant en pause", "SUSPEND_PEER" => "Mettre en pause ou réactiver la webcam de ce participant",
"KICK_PEER" => "Éjecter ce participant du salon", "KICK_PEER" => "Éjecter ce participant du salon",
"s_IS_MUTING_YOU" => "%s a coupé votre micro", "s_IS_MUTING_YOU" => "%s a coupé votre micro",
"s_IS_MUTING_s" => "%s a coupé le micro de %s", "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_YOU" => "%s a mis votre webcam en pause",
"s_IS_SUSPENDING_s" => "%s a mis la webcam de %s 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", "s_IS_KICKING_s" => "%s a éjecté %s du salon",
"KICKED" => "Éjecté", "KICKED" => "Éjecté",
"YOU_HAVE_BEEN_KICKED" => "Vous avez été éjecté du salon", "YOU_HAVE_BEEN_KICKED" => "Vous avez été éjecté du salon",
"AN_ADMIN_HAS_KICKED_YOU" => "Un administrateur du salon vous a exclus", "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_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", "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_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", "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", "YOU_HAVE_KICKED_s" => "Vous avez bani %s du salon",
"CANT_KICK_OWNER" => "Vous ne pouvez pas bannir ce participant", "CANT_KICK_OWNER" => "Vous ne pouvez pas bannir ce participant",

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

Loading…
Cancel
Save