diff --git a/app/components-react/windows/settings/VirtualWebcam.tsx b/app/components-react/windows/settings/VirtualWebcam.tsx index b4c175c77653..9997977c84d9 100644 --- a/app/components-react/windows/settings/VirtualWebcam.tsx +++ b/app/components-react/windows/settings/VirtualWebcam.tsx @@ -87,8 +87,19 @@ export function VirtualWebcamSettings() { ? $t('Output Scene') : $t('Output Source'); - function onSelectType(value: string, label: string) { - v.update((value as unknown) as VCamOutputType, label); + function onSelectType(value: string) { + const type = Number(value) as VCamOutputType; + let name = ''; + if (type === VCamOutputType.SceneOutput) { + const scenes = ScenesService.views.scenes; + name = scenes.length ? scenes[0].id : ''; + } else if (type === VCamOutputType.SourceOutput) { + const sources = SourcesService.views + .getSources() + .filter(source => source.type !== 'scene' && source.video); + name = sources.length ? sources[0].sourceId : ''; + } + v.update(type, name); } function onSelectSelection(value: string) { @@ -114,8 +125,8 @@ export function VirtualWebcamSettings() { options={OUTPUT_TYPE_OPTIONS} value={v.outputType} defaultValue={OUTPUT_TYPE_OPTIONS[0].value} - onSelect={(val: string, opts) => { - onSelectType(val, opts.labelrender); + onSelect={(val: string) => { + onSelectType(val); }} allowClear={false} style={{ width: '100%' }} diff --git a/app/services/app/app.ts b/app/services/app/app.ts index a5041a63ab2d..b9fb29a19d23 100644 --- a/app/services/app/app.ts +++ b/app/services/app/app.ts @@ -47,6 +47,7 @@ import { RealmService } from 'services/realm'; import { StreamAvatarService } from 'services/stream-avatar/stream-avatar-service'; import { NavigationService } from 'services/navigation'; import { StreamingService } from 'services/streaming'; +import { VirtualWebcamService } from 'services/virtual-webcam'; interface IAppState { loading: boolean; @@ -102,6 +103,7 @@ export class AppService extends StatefulService { @Inject() private streamAvatarService: StreamAvatarService; @Inject() private navigationService: NavigationService; @Inject() private streamingService: StreamingService; + @Inject() private virtualWebcamService: VirtualWebcamService; static initialState: IAppState = { loading: true, @@ -221,6 +223,7 @@ export class AppService extends StatefulService { await this.sceneCollectionsService.deinitialize(); this.performanceService.stop(); this.transitionsService.shutdown(); + this.virtualWebcamService.stop(); this.videoSettingsService.shutdown(); await this.gameOverlayService.destroy(); await this.fileManagerService.flushAll();