Skip to content
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

New settings API for autoconfig #4713

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
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
6 changes: 0 additions & 6 deletions app/components-react/pages/onboarding/Optimize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ export function Optimize() {
'streamingEncoder_test',
'recordingEncoder_test',
'checking_settings',
'setting_default_settings',
'saving_service',
'saving_settings',
];
const percentage =
optimizingState === 'running' && stepInfo ? (steps.indexOf(stepInfo.description) + 1) / steps.length : 0;
Expand All @@ -40,9 +37,6 @@ export function Optimize() {
streamingEncoder_test: $t('Testing streaming encoder...'),
recordingEncoder_test: $t('Testing recording encoder...'),
checking_settings: $t('Attempting stream...'),
setting_default_settings: $t('Reverting to defaults...'),
saving_service: $t('Applying stream settings...'),
saving_settings: $t('Applying general settings...'),
}[progress.description];
}

Expand Down
29 changes: 20 additions & 9 deletions app/services/auto-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Inject } from 'services';
import { StreamSettingsService } from 'services/settings/streaming';
import { getPlatformService } from 'services/platforms';
import { TwitchService } from 'services/platforms/twitch';
import { YoutubeService } from 'app-services';
import { SettingsService, YoutubeService } from 'app-services';
import { VideoSettingsService } from 'services/settings-v2/video';
import { UserService } from 'services/user';

Expand All @@ -28,6 +28,7 @@ export class AutoConfigService extends Service {
@Inject() streamSettingsService: StreamSettingsService;
@Inject() videoSettingsService: VideoSettingsService;
@Inject() userService: UserService;
@Inject() private settingsService: SettingsService;

configProgress = new Subject<IConfigProgress>();

Expand Down Expand Up @@ -65,12 +66,13 @@ export class AutoConfigService extends Service {
// return;
// }

// const settings = this.settingsService.views.values;
// obs.NodeObs.InitializeAutoConfig(
// (progress: IConfigProgress) => {
// this.handleProgress(progress);
// this.configProgress.next(progress);
// },
// { continent: '', service_name: '' },
// { continent: '', service_name: '', bind_ip: settings.Advanced.BindIP },
// );

// obs.NodeObs.StartBandwidthTest();
Expand All @@ -93,24 +95,33 @@ export class AutoConfigService extends Service {
obs.NodeObs.StartRecordingEncoderTest();
} else if (progress.description === 'recordingEncoder_test') {
obs.NodeObs.StartCheckSettings();
} else if (progress.description === 'checking_settings') {
obs.NodeObs.StartSaveStreamSettings();
} else if (progress.description === 'saving_service') {
obs.NodeObs.StartSaveSettings();
} else if (progress.description === 'setting_default_settings') {
obs.NodeObs.StartSaveStreamSettings();
}
}

let applySettings = false;
if (progress.event === 'error') {
obs.NodeObs.StartSetDefaultSettings();
obs.NodeObs.UseAutoConfigDefaultSettings();
obs.NodeObs.TerminateAutoConfig();
this.configProgress.next(progress);
applySettings = true;
}

if (progress.event === 'done') {
obs.NodeObs.TerminateAutoConfig();
this.videoSettingsService.loadLegacySettings();
applySettings = true;
}

if (applySettings) {
const settings = obs.NodeObs.GetNewSettings() as Array<[string, string, any]>;
for (const settingsTuple of settings) {
const [category, name, value] = settingsTuple;
if (category === 'Video') {
this.videoSettingsService.setVideoSetting(name, value);
} else {
this.settingsService.setSettingValue(category, name, value);
}
}
}
}

Expand Down
Loading