From a7931257d5fdb5342b3a28764c106e1e2a0a24b8 Mon Sep 17 00:00:00 2001 From: Amateur Audio Dude <168192910+AmateurAudioDude@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:48:46 +1000 Subject: [PATCH] serialport reconnect rework - v1.3.0.1 --- web/js/3las/3las.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web/js/3las/3las.js b/web/js/3las/3las.js index 23490f5..b705064 100644 --- a/web/js/3las/3las.js +++ b/web/js/3las/3las.js @@ -1,3 +1,4 @@ +var audioStreamRestartInterval; var elapsedTimeConnectionWatchdog; var _3LAS_Settings = /** @class */ (function () { function _3LAS_Settings() { @@ -48,6 +49,20 @@ var _3LAS = /** @class */ (function () { this.ConnectivityFlag = false; this.Stop(); // Attempt to mitigate the 0.5x speed/multiple stream bug + // Restart audio stream if radio data connection was reestablished + // to prevent stuttering audio in some cases + if (audioStreamRestartInterval) { + clearInterval(audioStreamRestartInterval); + } + audioStreamRestartInterval = setInterval(() => { + if (requiresAudioStreamRestart) { + requiresAudioStreamRestart = false; + this.Stop(); + this.Start(); + console.log("Audio stream restarted after radio data loss."); + } + }, 3000); + // Stream connection watchdog monitors mp3 frames console.log("Stream connection watchdog active."); let intervalReconnectWatchdog = setInterval(() => {