Pause a preview when going on the main div

This reduce the CPU pressure, as only one stream needs to be decoded
Also prevent the main vid to double its audio level (which was not a bad thing, but was just beacause this same track was decoded and played twice, it'd be better to play with the volume of only one track)
Doesn't work well on FF for now (because FF doesn't like switching main div, it often do not resume the video, or after several seconds, will need to investigate)
master
Daniel Berteaud 11 years ago
parent 5c5c17ebe2
commit 2d36ad921b
  1. 18
      public/js/vroom.js

@ -356,6 +356,15 @@ function initVroom(room) {
if ($('#mainVideo').html() != ''){
$('#mainVideo').hide(200);
wait = 200;
// Play all preview
// the one in the mainVid was paused, with a reduced opacity
// This isn't working on FF for the moment
if ($.browser.webkit){
$('#webRTCVideo video').each(function(){
$(this)[0].play();
$(this).css('opacity', '1');
});
}
}
setTimeout(function(){
$('#mainVideo').html('');
@ -376,6 +385,15 @@ function initVroom(room) {
$('.selected').removeClass('selected');
el.addClass('selected');
mainVid = el.attr('id');
// Pause the corresponding preview
// and reduce opacity
if ($.browser.webkit){
$('#webRTCVideo video').each(function(){
$(this)[0].play();
});
el[0].pause();
el.css('opacity', '.3');
}
$('#mainVideo').show(200);
}
}, wait);

Loading…
Cancel
Save