Keep our local video muted to prevent feedback

master
Daniel Berteaud 10 years ago
parent 75238a2631
commit 56d4d40b10
  1. 11
      public/js/vroom.js

@ -826,14 +826,14 @@ function initVroom(room) {
function handlePreviewClick(el, id){ function handlePreviewClick(el, id){
var wait = 1; var wait = 1;
// There's already a main video, let's hide it // There's already a main video, let's hide it
// and delay the new one so the fade out as time to complete // and delay the new one so the fade out has time to complete
if ($('#mainVideo video').length > 0){ if ($('#mainVideo video').length > 0){
$('#mainVideo').hide(200); $('#mainVideo').hide(200);
wait = 200; wait = 200;
// Play all preview // Play all previews
// the one in the mainVid was muted // the one in the mainVid was muted
$('#webRTCVideo video').each(function(){ $('#webRTCVideo video').each(function(){
if ($(this).get(0).volume == 0){ if ($(this).get(0).volume == 0 && $(this).attr('id') !== 'webRTCVideoLocal'){
$(this).get(0).volume= .7; $(this).get(0).volume= .7;
} }
}); });
@ -873,9 +873,14 @@ function initVroom(room) {
$(this).get(0).play(); $(this).get(0).play();
} }
}); });
if (el.attr('id') !== 'webRTCVideoLocal'){
el.get(0).volume = 0; el.get(0).volume = 0;
$('#mainVideo video').get(0).volume = 1; $('#mainVideo video').get(0).volume = 1;
} }
else {
$('#mainVideo video').get(0).volume = 0;
}
}
$('#mainVideo').show(200); $('#mainVideo').show(200);
} }
}, wait); }, wait);

Loading…
Cancel
Save