diff --git a/src/renderer/components/ScreenSharePicker.tsx b/src/renderer/components/ScreenSharePicker.tsx index 4832558e..adbc5a3b 100644 --- a/src/renderer/components/ScreenSharePicker.tsx +++ b/src/renderer/components/ScreenSharePicker.tsx @@ -20,7 +20,7 @@ import { useState } from "@vencord/types/webpack/common"; import type { Dispatch, SetStateAction } from "react"; -import { patchAudioWithDevice } from "renderer/patches/screenShareAudio"; +import { patchDisplayMedia } from "renderer/patches/screenSharePatch"; import { addPatch } from "renderer/patches/shared"; import { isLinux, isWindows } from "renderer/utils"; @@ -42,6 +42,7 @@ interface StreamSettings { export interface StreamPick extends StreamSettings { id: string; + cameraId?: string; } interface Source { @@ -50,6 +51,11 @@ interface Source { url: string; } +interface Camera { + id: string; + name: string; +} + let currentSettings: StreamSettings | null = null; addPatch({ @@ -96,6 +102,7 @@ if (isLinux) { export function openScreenSharePicker(screens: Source[], skipPicker: boolean) { let didSubmit = false; + return new Promise((resolve, reject) => { const key = openModal( props => ( @@ -105,6 +112,12 @@ export function openScreenSharePicker(screens: Source[], skipPicker: boolean) { submit={async v => { didSubmit = true; + patchDisplayMedia({ + audioId: v.audioDevice, + venmic: !!v.audioSource && v.audioSource !== "None", + videoId: v.cameraId + }); + if (!v.audioDevice && v.audioSource && v.audioSource !== "None") { if (v.audioSource === "Entire System") { await VesktopNative.virtmic.startSystem(); @@ -113,8 +126,6 @@ export function openScreenSharePicker(screens: Source[], skipPicker: boolean) { } } - if (v.audioDevice) patchAudioWithDevice(v.audioDevice); - resolve(v); }} close={() => { @@ -134,12 +145,26 @@ export function openScreenSharePicker(screens: Source[], skipPicker: boolean) { }); } -function ScreenPicker({ screens, chooseScreen }: { screens: Source[]; chooseScreen: (id: string) => void }) { +function ScreenPicker({ + screens, + chooseScreen, + isDisabled = false +}: { + screens: Source[]; + chooseScreen: (id: string) => void; + isDisabled?: boolean; +}) { return (
{screens.map(({ id, name, url }) => (