rebroadcast: fix inactivity grace period

This commit is contained in:
Koushik Dutta
2022-01-26 09:46:43 -08:00
parent 13b92a8800
commit 6f88ac052d
3 changed files with 6 additions and 4 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/prebuffer-mixin",
"version": "0.1.126",
"version": "0.1.128",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/prebuffer-mixin",
"version": "0.1.126",
"version": "0.1.128",
"license": "Apache-2.0",
"dependencies": {
"@scrypted/common": "file:../../common",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/prebuffer-mixin",
"version": "0.1.126",
"version": "0.1.128",
"description": "Rebroadcast and Prebuffer for VideoCameras.",
"author": "Scrypted",
"license": "Apache-2.0",

View File

@@ -61,6 +61,7 @@ class PrebufferSession {
storage: Storage;
activeClients = 0;
inactivityTimeout: NodeJS.Timeout;
AUDIO_CONFIGURATION = AUDIO_CONFIGURATION_TEMPLATE + '-' + this.streamId;
@@ -380,7 +381,8 @@ class PrebufferSession {
if (this.activeClients)
return;
setTimeout(() => {
clearTimeout(this.inactivityTimeout)
this.inactivityTimeout = setTimeout(() => {
if (this.activeClients)
return;
this.console.log(this.streamName, 'terminating rebroadcast due to inactivity');