Skip to content

Commit 07b06fb

Browse files
authored
fix(dual-output): persist display settings, YT vert fixes, details follow (#5397)
* Persist changing displays immediately. Any interaction with displays does not get reflected by any of the streaming service or dual output service views, until some condition occurs (going live most likely). Inconsistency in that could result in bugs. I believe `display` is important enough to be reflected immediately. Validations in DO service that rely on `activeDisplayPlatforms` and `activeDisplayDestinations` might've been looking at stale data. It is also likely that there has been a regression into how the Go Live settings work. * Related to YT, do not attempt to hijack displays when a vertical platform exists, i.e streaming to Twitch vertical + Youtube Both.
1 parent d58a781 commit 07b06fb

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

app/components-react/shared/DisplaySelector.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export default function DisplaySelector(p: IDisplaySelectorProps) {
1919
const {
2020
customDestinations,
2121
platforms,
22+
updatePlatformDisplayAndSaveSettings,
2223
updateCustomDestinationDisplay,
23-
updatePlatform,
2424
isPrime,
2525
enabledPlatforms,
2626
updateShouldUseExtraOutput,
@@ -64,7 +64,8 @@ export default function DisplaySelector(p: IDisplaySelectorProps) {
6464
const display: TDisplayType =
6565
// Use horizontal display, vertical stream will be created separately
6666
supportsExtraOutputs && val === 'both' ? 'horizontal' : (val as TDisplayType);
67-
updatePlatform(p.platform, { display });
67+
68+
updatePlatformDisplayAndSaveSettings(p.platform, display);
6869

6970
// Add or remove the platform from the Dual Output's extra output platforms list
7071
updateShouldUseExtraOutput(p.platform, val);

app/components-react/windows/go-live/useGoLiveSettings.ts

+10
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,16 @@ export class GoLiveSettingsModule {
444444
hasExtraOutput(platform: TPlatform) {
445445
return Services.DualOutputService.views.hasExtraOutput(platform);
446446
}
447+
448+
/* Go live window has no persistence until we go live or toggle a platform on/off
449+
* As a result we don't get the latest state in any of its views.
450+
* This makes changing display immediate and is only used in `DisplaySelector`
451+
* to keep the rest of the code as before, but we might need to revisit that.
452+
*/
453+
updatePlatformDisplayAndSaveSettings(platform: TPlatform, display: TDisplayType) {
454+
this.state.updatePlatform(platform, { display });
455+
this.save(this.state.settings);
456+
}
447457
}
448458

449459
export function useGoLiveSettings() {

app/services/settings/streaming/stream-settings.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,13 @@ export class StreamSettingsService extends PersistentStatefulService<IStreamSett
146146
if (
147147
this.streamingService.views.enabledPlatforms.length > 1 &&
148148
ytSettings?.enabled &&
149-
this.dualOutputService.views.hasExtraOutput('youtube')
149+
this.dualOutputService.views.hasExtraOutput('youtube') &&
150+
!(
151+
this.streamingService.views.activeDisplayPlatforms.vertical.length ||
152+
this.streamingService.views.activeDisplayDestinations.vertical.length
153+
)
150154
) {
155+
console.log('overrode youtube');
151156
return 'StreamSecond';
152157
}
153158
}
@@ -225,7 +230,7 @@ export class StreamSettingsService extends PersistentStatefulService<IStreamSett
225230
// transform IGoLiveSettings to ISavedGoLiveSettings
226231
const patch: Partial<ISavedGoLiveSettings> = settingsPatch;
227232
if (settingsPatch.platforms) {
228-
const pickedFields: (keyof IPlatformFlags)[] = ['enabled', 'useCustomFields'];
233+
const pickedFields: (keyof IPlatformFlags)[] = ['enabled', 'useCustomFields', 'display'];
229234
const platforms: Dictionary<IPlatformFlags> = {};
230235
Object.keys(settingsPatch.platforms).map(platform => {
231236
const platformSettings = pick(settingsPatch.platforms![platform], pickedFields);

app/services/streaming/streaming.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1002,11 +1002,20 @@ export class StreamingService
10021002

10031003
NodeObs.OBS_service_setVideoInfo(horizontalContext, 'horizontal');
10041004
const ytSettings = this.views.getPlatformSettings('youtube');
1005+
/*
1006+
* HACK: this needs to be addressed and is the result of the old
1007+
* streaming API *requiring* you to have both horizontal and vertical
1008+
* outputs to initialize streaming.
1009+
*/
10051010
// TODO: this can probably be more generic now
10061011
if (
10071012
this.views.enabledPlatforms.length > 1 &&
10081013
ytSettings?.enabled &&
1009-
this.dualOutputService.views.hasExtraOutput('youtube')
1014+
this.dualOutputService.views.hasExtraOutput('youtube') &&
1015+
!(
1016+
this.views.activeDisplayPlatforms.vertical.length ||
1017+
this.views.activeDisplayDestinations.vertical.length
1018+
)
10101019
) {
10111020
NodeObs.OBS_service_setVideoInfo(horizontalContext, 'vertical');
10121021
} else {

0 commit comments

Comments
 (0)