update monitor muting for modern browsers

must interfact with web page before audio can automatically be unmuted
mitchross-coral-installer-update
Moe Alam 2020-12-01 07:25:25 -08:00
parent 48ce8125ab
commit 55cec40869
3 changed files with 25 additions and 7 deletions

View File

@ -97,8 +97,10 @@ $.ccio.form.details=function(e){
});
e.f.find('[name="details"]').val(JSON.stringify(e.ar));
};
$('body').one('click',function(){
window.hadFocus = true
})
$(document).ready(function(e){
//check switch UI
e.o=$.ccio.op().switches;
if(e.o){

View File

@ -303,15 +303,27 @@ $.ccio.tm=function(x,d,z,user){
el.muted = "muted"
})
}else{
$.each(monitorMutes,function(monitorId,choice){
if(choice === 1){
var hasFocus = $.ccio.windowFocus && hadFocus
$.each($.ccio.mon,function(frontId,monitor){
setTimeout(() => {
var monitorId = monitor.mid
var muted = monitorMutes[monitorId]
try{
var vidEl = $('.monitor_item[mid="' + monitorId + '"] video')[0]
if(vidEl.length === 0)return;
if(muted === 1){
vidEl.muted = true
}else{
if(hasFocus){
vidEl.muted = false
}else{
console.error('User must have window active to unmute.')
}
}
}catch(err){
}
// console.log(err)
}
},2000)
})
}
break;

View File

@ -258,7 +258,11 @@ $(document).ready(function(e){
vidEl.muted = true
}else{
if(masterMute !== 1){
if($.ccio.windowFocus && hadFocus){
vidEl.muted = false
}else{
console.error('User must have window active to unmute.')
}
}
}
var volumeIcon = monitorMutes[monitorId] !== 1 ? 'volume-up' : 'volume-off'