Moved audio sink toggle to unit control panel

This commit is contained in:
Pax1601
2024-10-08 13:59:07 +02:00
parent 84a1375663
commit 804743c051
6 changed files with 71 additions and 31 deletions

View File

@@ -54,7 +54,10 @@ export class AudioManager {
/* Connect the audio websocket */
let res = this.#address.match(/(?:http|https):\/\/(.+):/);
let wsAddress = res ? res[1] : this.#address;
this.#socket = new WebSocket(`wss://refugees.dcsolympus.com/audio`);
if (this.#address.includes("https"))
this.#socket = new WebSocket(`wss://${wsAddress}/${getApp().getConfig()['WSAddress']}`);
else
this.#socket = new WebSocket(`ws://${wsAddress}:${getApp().getConfig()['WSPort']}`);
/* Log the opening of the connection */
this.#socket.addEventListener("open", (event) => {
@@ -63,7 +66,7 @@ export class AudioManager {
/* Log any websocket errors */
this.#socket.addEventListener("error", (event) => {
console.log(event);
console.log("An error occurred while connecting the WebSocket: " + event);
});
/* Handle the reception of a new message */

View File

@@ -37,7 +37,7 @@ export class UnitSink extends AudioSink {
});
Object.keys(this.#unitPipelines).forEach((unitID) => {
if (!(unitID in getApp().getAudioManager().getSRSClientsUnitIDs())) {
if (!(getApp().getAudioManager().getSRSClientsUnitIDs().includes(parseInt(unitID)))) {
delete this.#unitPipelines[unitID];
}
});