diff --git a/Frontend/library/src/Config/Config.ts b/Frontend/library/src/Config/Config.ts index b4892b6a..9d572e72 100644 --- a/Frontend/library/src/Config/Config.ts +++ b/Frontend/library/src/Config/Config.ts @@ -742,7 +742,13 @@ export class Config { `Cannot set text setting called ${id} - it does not exist in the Config.enumParameters map.` ); } else { - this.optionParameters.get(id).selected = settingValue; + const optionSetting = this.optionParameters.get(id); + const existingOptions = optionSetting.options; + if (!existingOptions.includes(settingValue)) { + existingOptions.push(settingValue); + optionSetting.options = existingOptions; + } + optionSetting.selected = settingValue; } } diff --git a/Frontend/library/src/Config/SettingOption.ts b/Frontend/library/src/Config/SettingOption.ts index cc5726e3..ba2aed77 100644 --- a/Frontend/library/src/Config/SettingOption.ts +++ b/Frontend/library/src/Config/SettingOption.ts @@ -24,7 +24,7 @@ export class SettingOption< // eslint-disable-next-line @typescript-eslint/no-empty-function defaultOnChangeListener: (changedValue: unknown, setting: SettingBase) => void = () => { /* Do nothing, to be overridden. */ } ) { - super(id, label, description, [defaultTextValue, defaultTextValue], defaultOnChangeListener); + super(id, label, description, [defaultTextValue], defaultOnChangeListener); this.options = options; const urlParams = new URLSearchParams(window.location.search); diff --git a/Frontend/library/src/PixelStreaming/PixelStreaming.ts b/Frontend/library/src/PixelStreaming/PixelStreaming.ts index ed0d6b2f..a8aca186 100644 --- a/Frontend/library/src/PixelStreaming/PixelStreaming.ts +++ b/Frontend/library/src/PixelStreaming/PixelStreaming.ts @@ -566,6 +566,10 @@ export class PixelStreaming { const useUrlParams = this.config.useUrlParams; const urlParams = new URLSearchParams(window.location.search); + Logger.Info( + Logger.GetStackTrace(), + `using URL parameters ${useUrlParams}` + ); if (settings.EncoderSettings) { this.config.setNumericSetting( NumericParameters.MinQP, diff --git a/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts b/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts index 3e15c2ac..3d9eb2d9 100644 --- a/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts +++ b/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts @@ -1322,6 +1322,16 @@ export class WebRtcPlayerController { 6 ); + let wantedStreamerId: string = null; + + // get the current selected streamer id option + var streamerIDOption = this.config.getSettingOption(OptionParameters.StreamerId); + const existingSelection = streamerIDOption.selected.toString().trim(); + if (!!existingSelection) { + // default to selected option if it exists + wantedStreamerId = streamerIDOption.selected; + } + // add the streamers to the UI const settingOptions = [...messageStreamerList.ids]; // copy the original messageStreamerList.ids settingOptions.unshift(''); // add an empty option at the top @@ -1330,15 +1340,15 @@ export class WebRtcPlayerController { settingOptions ); - let wantedStreamerId: string = null; let autoSelectedStreamerId: string = null; const waitForStreamer = this.config.isFlagEnabled(Flags.WaitForStreamer); const reconnectLimit = this.config.getNumericSettingValue(NumericParameters.MaxReconnectAttempts); const reconnectDelay = this.config.getNumericSettingValue(NumericParameters.StreamerAutoJoinInterval); // first we figure out a wanted streamer id through various means + const useUrlParams = this.config.useUrlParams; const urlParams = new URLSearchParams(window.location.search); - if (urlParams.has(OptionParameters.StreamerId)) { + if (useUrlParams && urlParams.has(OptionParameters.StreamerId)) { // if we've set the streamer id on the url we only want that streamer id wantedStreamerId = urlParams.get(OptionParameters.StreamerId); } else if (this.subscribedStream) {