From abace4e42b9b40a8d8cf3a6beee7afea8ea886c4 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Tue, 2 Mar 2021 00:45:49 +0000 Subject: [PATCH] Allow option to remain connected on registration failure. --- src/broadcast/state.ts | 11 ++++++++++- src/optionsMenu/AdvancedTab.tsx | 19 +++++++++++++++++++ src/optionsMenu/settingsState.ts | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/broadcast/state.ts b/src/broadcast/state.ts index ed86b3c..d078ea2 100644 --- a/src/broadcast/state.ts +++ b/src/broadcast/state.ts @@ -144,7 +144,16 @@ export const registerForShow = (): AppThunk => async (dispatch, getState) => { }) ); if (streamer) { - await streamer.stop("ApiException " + e.message); + // We're connected, + var remain_connected = getState().settings.allowStreamingOnReject; + if (remain_connected) { + console.log( + "StateServer refused registration. Due to setting, staying connected.", + e + ); + } else { + await streamer.stop("ApiException " + e.message); + } } } else { // let raygun handle it diff --git a/src/optionsMenu/AdvancedTab.tsx b/src/optionsMenu/AdvancedTab.tsx index a29f38c..1b18d26 100644 --- a/src/optionsMenu/AdvancedTab.tsx +++ b/src/optionsMenu/AdvancedTab.tsx @@ -305,6 +305,25 @@ export function AdvancedTab() { /> +
+ + dispatch( + changeSetting({ + key: "allowStreamingOnReject", + val: e.target.checked, + }) + ) + } + /> + +
); } diff --git a/src/optionsMenu/settingsState.ts b/src/optionsMenu/settingsState.ts index 2d7aa19..da071df 100644 --- a/src/optionsMenu/settingsState.ts +++ b/src/optionsMenu/settingsState.ts @@ -3,6 +3,7 @@ import { INTERNAL_OUTPUT_ID, PLAYER_COUNT } from "../mixer/audio"; interface Settings { showDebugInfo: boolean; + allowStreamingOnReject: boolean; enableRecording: boolean; tracklist: "always" | "while_live" | "never"; doTheNews: "always" | "while_live" | "never"; @@ -18,6 +19,7 @@ const settingsState = createSlice({ name: "settings", initialState: { showDebugInfo: false, + allowStreamingOnReject: false, enableRecording: false, tracklist: "while_live", doTheNews: "while_live",