Skip to content

fix(dual-output): persist display settings, YT vert fixes, details follow #5397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/components-react/shared/DisplaySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default function DisplaySelector(p: IDisplaySelectorProps) {
const {
customDestinations,
platforms,
updatePlatformDisplayAndSaveSettings,
updateCustomDestinationDisplay,
updatePlatform,
isPrime,
enabledPlatforms,
updateShouldUseExtraOutput,
Expand Down Expand Up @@ -64,7 +64,8 @@ export default function DisplaySelector(p: IDisplaySelectorProps) {
const display: TDisplayType =
// Use horizontal display, vertical stream will be created separately
supportsExtraOutputs && val === 'both' ? 'horizontal' : (val as TDisplayType);
updatePlatform(p.platform, { display });

updatePlatformDisplayAndSaveSettings(p.platform, display);

// Add or remove the platform from the Dual Output's extra output platforms list
updateShouldUseExtraOutput(p.platform, val);
Expand Down
10 changes: 10 additions & 0 deletions app/components-react/windows/go-live/useGoLiveSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,16 @@ export class GoLiveSettingsModule {
hasExtraOutput(platform: TPlatform) {
return Services.DualOutputService.views.hasExtraOutput(platform);
}

/* Go live window has no persistence until we go live or toggle a platform on/off
* As a result we don't get the latest state in any of its views.
* This makes changing display immediate and is only used in `DisplaySelector`
* to keep the rest of the code as before, but we might need to revisit that.
*/
updatePlatformDisplayAndSaveSettings(platform: TPlatform, display: TDisplayType) {
this.state.updatePlatform(platform, { display });
this.save(this.state.settings);
}
}

export function useGoLiveSettings() {
Expand Down
9 changes: 7 additions & 2 deletions app/services/settings/streaming/stream-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,13 @@ export class StreamSettingsService extends PersistentStatefulService<IStreamSett
if (
this.streamingService.views.enabledPlatforms.length > 1 &&
ytSettings?.enabled &&
this.dualOutputService.views.hasExtraOutput('youtube')
this.dualOutputService.views.hasExtraOutput('youtube') &&
!(
this.streamingService.views.activeDisplayPlatforms.vertical.length ||
this.streamingService.views.activeDisplayDestinations.vertical.length
)
) {
console.log('overrode youtube');
return 'StreamSecond';
}
}
Expand Down Expand Up @@ -225,7 +230,7 @@ export class StreamSettingsService extends PersistentStatefulService<IStreamSett
// transform IGoLiveSettings to ISavedGoLiveSettings
const patch: Partial<ISavedGoLiveSettings> = settingsPatch;
if (settingsPatch.platforms) {
const pickedFields: (keyof IPlatformFlags)[] = ['enabled', 'useCustomFields'];
const pickedFields: (keyof IPlatformFlags)[] = ['enabled', 'useCustomFields', 'display'];
const platforms: Dictionary<IPlatformFlags> = {};
Object.keys(settingsPatch.platforms).map(platform => {
const platformSettings = pick(settingsPatch.platforms![platform], pickedFields);
Expand Down
11 changes: 10 additions & 1 deletion app/services/streaming/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1002,11 +1002,20 @@ export class StreamingService

NodeObs.OBS_service_setVideoInfo(horizontalContext, 'horizontal');
const ytSettings = this.views.getPlatformSettings('youtube');
/*
* HACK: this needs to be addressed and is the result of the old
* streaming API *requiring* you to have both horizontal and vertical
* outputs to initialize streaming.
*/
// TODO: this can probably be more generic now
if (
this.views.enabledPlatforms.length > 1 &&
ytSettings?.enabled &&
this.dualOutputService.views.hasExtraOutput('youtube')
this.dualOutputService.views.hasExtraOutput('youtube') &&
!(
this.views.activeDisplayPlatforms.vertical.length ||
this.views.activeDisplayDestinations.vertical.length
)
) {
NodeObs.OBS_service_setVideoInfo(horizontalContext, 'vertical');
} else {
Expand Down
Loading