Skip to content

Commit

Permalink
Allow option to remain connected on registration failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
mstratford committed Mar 2, 2021
1 parent 6412269 commit abace4e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/broadcast/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/optionsMenu/AdvancedTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,25 @@ export function AdvancedTab() {
/>
<label className="form-check-label">Enable recording</label>
</div>
<div className="form-check">
<input
className="form-check-input"
type="checkbox"
checked={settings.allowStreamingOnReject}
onChange={(e) =>
dispatch(
changeSetting({
key: "allowStreamingOnReject",
val: e.target.checked,
})
)
}
/>
<label>
Allow connection persistance for troubleshooting. (Don't enable unless
requested to.)
</label>
</div>
</>
);
}
2 changes: 2 additions & 0 deletions src/optionsMenu/settingsState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -18,6 +19,7 @@ const settingsState = createSlice({
name: "settings",
initialState: {
showDebugInfo: false,
allowStreamingOnReject: false,
enableRecording: false,
tracklist: "while_live",
doTheNews: "while_live",
Expand Down

0 comments on commit abace4e

Please sign in to comment.