Mute Audio on Monitors individually (dashboard UI)

build-default-monitor-config-from-definitions
Moe 2020-04-04 16:59:18 -07:00
parent 391da78b95
commit b478bb92c0
2 changed files with 63 additions and 28 deletions

View File

@ -77,6 +77,7 @@ $.ccio.tm=function(x,d,z,user){
delete(d.src);
break;
case 2://monitor stream
var monitorMutes = $.ccio.op().monitorMutes || {}
try{k.d=JSON.parse(d.details);}catch(er){k.d=d.details;}
k.mode=$.ccio.init('humanReadMode',d.mode);
var dataTarget = '.monitor_item[mid=\''+d.mid+'\'][ke=\''+d.ke+'\'][auth=\''+user.auth_token+'\']';
@ -93,6 +94,12 @@ $.ccio.tm=function(x,d,z,user){
tmp+='</div>';
tmp+='<div class="btn-group btn-group-sm">'//start of btn list
var buttons = {
"Mute Audio": {
"label": lang['Mute Audio'],
"attr": "system=\"monitorMuteAudioSingle\" mid=\"" + d.mid + "\"",
"class": "primary",
"icon": monitorMutes[d.mid] !== 1 ? 'volume-up' : 'volume-off'
},
"Snapshot": {
"label": lang['Snapshot'],
"attr": "monitor=\"snapshot\"",
@ -266,10 +273,18 @@ $.ccio.tm=function(x,d,z,user){
}
}
k.e.append(tmp).find('.stream-element').resize();
var monitorMutes = $.ccio.op().monitorMutes || {}
if($.ccio.op().switches.monitorMuteAudio === 1){
k.e.find('video').each(function(n,el){
el.muted = "muted"
})
}else{
$.each(monitorMutes,function(monitorId,choice){
if(choice === 1){
var vidEl = $('.monitor_item[mid="' + monitorId + '"] video')[0]
vidEl.muted = true
}
})
}
break;
case'user-row':

View File

@ -221,50 +221,70 @@ $(document).ready(function(e){
e.value = e.e.val()
$.ccio.op(e.localStorage,e.value)
})
.on('click','[system]',function(e){
var e={};
e.e=$(this),
e.a=e.e.attr('system');//the function
switch(e.a){
case'switch':
e.switch=e.e.attr('switch');
e.o=$.ccio.op().switches
if(!e.o){
e.o={}
}
if(!e.o[e.switch]){
e.o[e.switch]=0
}
if(e.o[e.switch]===1){
e.o[e.switch]=0
.on('click','[system]',function(){
var e = {};
var el = $(this)
switch(el.attr('system')){
case'monitorMuteAudioSingle':
var monitorId = el.attr('mid')
var masterMute = $.ccio.op().switches.monitorMuteAudio
var monitorMutes = $.ccio.op().monitorMutes || {}
monitorMutes[monitorId] = monitorMutes[monitorId] === 1 ? 0 : 1
$.ccio.op('monitorMutes',monitorMutes)
var vidEl = $('.monitor_item[mid="' + monitorId + '"] video')[0]
if(monitorMutes[monitorId] === 1){
vidEl.muted = true
}else{
e.o[e.switch]=1
if(masterMute !== 1){
vidEl.muted = false
}
}
$.ccio.op('switches',e.o)
switch(e.switch){
var volumeIcon = monitorMutes[monitorId] !== 1 ? 'volume-up' : 'volume-off'
$(this).find('i').removeClass('fa-volume-up fa-volume-off').addClass('fa-' + volumeIcon)
break;
case'switch':
var systemSwitch = el.attr('switch');
var theSwitches = $.ccio.op().switches
if(!theSwitches){
theSwitches={}
}
if(!theSwitches[systemSwitch]){
theSwitches[systemSwitch]=0
}
if(theSwitches[systemSwitch]===1){
theSwitches[systemSwitch]=0
}else{
theSwitches[systemSwitch]=1
}
$.ccio.op('switches',theSwitches)
switch(systemSwitch){
case'monitorOrder':
if(e.o[e.switch] !== 1){
if(theSwitches[systemSwitch] !== 1){
$('.monitor_item').attr('data-gs-auto-position','yes')
}else{
$('.monitor_item').attr('data-gs-auto-position','no')
}
break;
case'monitorMuteAudio':
$('.monitor_item video').each(function(n,el){
if(e.o[e.switch] === 1){
el.muted = true
var monitorMutes = $.ccio.op().monitorMutes || {}
$('.monitor_item video').each(function(n,vidEl){
var monitorId = $(this).parents('[mid]').attr('mid')
if(theSwitches[systemSwitch] === 1){
vidEl.muted = true
}else{
el.muted = false
if(monitorMutes[monitorId] !== 1){
vidEl.muted = false
}
}
})
break;
}
switch(e.e.attr('type')){
switch(el.attr('type')){
case'text':
if(e.o[e.switch]===1){
e.e.addClass('text-success')
if(theSwitches[systemSwitch]===1){
el.addClass('text-success')
}else{
e.e.removeClass('text-success')
el.removeClass('text-success')
}
break;
}