1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-27 14:33:52 +01:00

Several fixes

* Fixed rare unprompted auto-restart stream bug (bkram) [/web/js/3las/main.js]
* Fixed multiple tooltip bug while RDS PS is tentatively loaded [/web/js/main.js]
* Changed copying of plugin files to symlinks (junction for Windows) [/server/plugins.js]
* Auto-reconnect audio stream on restored/changed internet connection [/web/js/3las/3las.js]
* Main WebSocket connection can be shared with plugins [/web/js/websocket.js] [/web/index.ejs]
This commit is contained in:
AmateurAudioDude
2024-07-14 19:52:12 +10:00
committed by GitHub
parent 8b2f489fbe
commit e510ce61e6
6 changed files with 178 additions and 37 deletions

View File

@@ -45,6 +45,7 @@ var _3LAS = /** @class */ (function () {
};
_3LAS.prototype.Start = function () {
this.ConnectivityFlag = false;
this.Stop(); // Attempt to mitigate the 0.5x speed/multiple stream bug
// This is stupid, but required for Android.... thanks Google :(
if (this.WakeLock)
@@ -128,11 +129,50 @@ var _3LAS = /** @class */ (function () {
this.ConnectivityFlag = false;
if (this.ConnectivityCallback)
this.ConnectivityCallback(false);
}
if (shouldReconnect) {
if (!this.ConnectivityFlag) {
console.log("Initial reconnect attempt...");
this.Stop(); // Attempt to mitigate the 0.5x speed/multiple stream bug
this.Start();
}
this.Start();
};
// Delay launch of subsequent reconnect attempts by 3 seconds
setTimeout(() => {
let streamReconnecting = false;
let intervalReconnect = setInterval(() => {
if (this.ConnectivityFlag || typeof Stream === 'undefined' || Stream === null) {
console.log("Reconnect attempts aborted.");
clearInterval(intervalReconnect);
} else if (!streamReconnecting) {
streamReconnecting = true;
console.log("Attempting to restart stream...");
this.Stop(); // Attempt to mitigate the 0.5x speed/multiple stream bug
this.Start();
// Wait for reconnect attempt
setTimeout(() => {
streamReconnecting = false;
}, 3000);
}
// Restore user set volume
if (Stream && typeof newVolumeGlobal !== 'undefined' && newVolumeGlobal !== null) {
Stream.Volume = newVolumeGlobal;
console.log(`User volume restored: ${Math.round(newVolumeGlobal * 100)}%`);
}
}, 3000);
}, 3000);
} else {
this.Logger.Log("Reconnection is disabled.");
}
};
_3LAS.prototype.OnSocketDataReady = function (data) {
this.Fallback.OnSocketDataReady(data);
};
return _3LAS;
}());
}());