tweak auto-closing of Substreams+

montage-api
Moe 2021-12-08 07:41:32 -08:00
parent 3f23502214
commit c945d53d9f
3 changed files with 9 additions and 14 deletions

View File

@ -1515,17 +1515,14 @@ module.exports = function(s,config,lang){
case'watch_off'://live streamers - leave
if(cn.monitorsCurrentlyWatching){delete(cn.monitorsCurrentlyWatching[e.id])}
setActiveViewer(e.ke,e.id,cn.id,false)
s.debugLog('closeing')
let currentCount = getActiveViewerCount(e.ke,e.id)
s.debugLog(currentCount,currentCount === 0,!!s.group[e.ke].activeMonitors[e.id].subStreamProcess)
clearTimeout(s.group[e.ke].activeMonitors[e.id].noViewerCountDisableSubstream)
if(currentCount === 0 && s.group[e.ke].activeMonitors[e.id].subStreamProcessActivated){
s.group[e.ke].activeMonitors[e.id].noViewerCountDisableSubstream = setTimeout(async () => {
let currentCount = getActiveViewerCount(e.ke,e.id)
if(currentCount === 0 && s.group[e.ke].activeMonitors[e.id].subStreamProcess){
s.group[e.ke].activeMonitors[e.id].allowDestroySubstream = true
await destroySubstreamProcess(s.group[e.ke].activeMonitors[e.id])
s.debugLog('closed')
},10000)
}
},10000)
break;
case'restart'://restart monitor
s.sendMonitorStatus({

View File

@ -232,7 +232,6 @@ module.exports = (s,config,lang) => {
substreamConfig.input.type = !substreamConfig.input.fulladdress ? monitorConfig.type : substreamConfig.input.type || monitorConfig.details.rtsp_transport
substreamConfig.input.fulladdress = substreamConfig.input.fulladdress || s.buildMonitorUrl(monitorConfig)
substreamConfig.input.rtsp_transport = substreamConfig.input.rtsp_transport || monitorConfig.details.rtsp_transport
activeMonitor.subStreamProcessActivated = true
const {
inputAndConnectionFields,
outputFields,

View File

@ -606,11 +606,7 @@ function closeAllLiveGridPlayers(rememberClose){
$.each(watchedOn,function(n,groupOfMons){
$.each(groupOfMons,function(monitorId,monitor){
if(monitor === 1){
if(rememberClose){
mainSocket.f({f:'monitor',ff:'watch_off',id: monitorId})
}else{
closeLiveGridPlayer(monitorId,true)
}
}
})
})
@ -926,6 +922,9 @@ $(document).ready(function(e){
ff: 'watch_off',
id: monitor.mid
})
setTimeout(function(){
saveLiveGridBlockOpenState(monitorId,$user.ke,0)
},1000)
})
})
liveGrid