(feat): add basic call ui
(feat): add screensharing (incl. broken desktop picker) (qol): add todo
This commit is contained in:
parent
7b5cdca0ff
commit
fbd8ef4fa0
21 changed files with 1167 additions and 380 deletions
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
createContext,
|
||||
useContext,
|
||||
useMemo,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { createContext, useContext, useMemo, type ReactNode } from "react";
|
||||
import { invoke, isTauri } from "@tauri-apps/api/core";
|
||||
|
||||
export type DesktopScreenShareSource = {
|
||||
|
|
@ -21,13 +16,12 @@ export type DesktopScreenShareAudioOutput = {
|
|||
|
||||
export type DesktopScreenShareCapabilities = {
|
||||
platform: "linux" | "macos" | "windows" | "other";
|
||||
usesPipeWireAudioPicker: boolean;
|
||||
supportsSystemAudioSwitch: boolean;
|
||||
supportsReliableSystemAudio: boolean;
|
||||
showAudioOutputSelector: boolean;
|
||||
showAudioSwitch: boolean;
|
||||
hasReliableSystemAudio: boolean;
|
||||
};
|
||||
|
||||
type DesktopMediaContextValue = {
|
||||
isDesktopTauri: boolean;
|
||||
getScreenShareCapabilities: () => Promise<DesktopScreenShareCapabilities>;
|
||||
listScreenShareSources: () => Promise<DesktopScreenShareSource[]>;
|
||||
listScreenShareAudioOutputs: () => Promise<DesktopScreenShareAudioOutput[]>;
|
||||
|
|
@ -35,9 +29,9 @@ type DesktopMediaContextValue = {
|
|||
|
||||
const defaultCapabilities: DesktopScreenShareCapabilities = {
|
||||
platform: "other",
|
||||
usesPipeWireAudioPicker: false,
|
||||
supportsSystemAudioSwitch: false,
|
||||
supportsReliableSystemAudio: false,
|
||||
showAudioOutputSelector: false,
|
||||
showAudioSwitch: false,
|
||||
hasReliableSystemAudio: false,
|
||||
};
|
||||
|
||||
const desktopMediaContext = createContext<DesktopMediaContextValue | undefined>(
|
||||
|
|
@ -69,7 +63,9 @@ async function getScreenShareCapabilities(): Promise<DesktopScreenShareCapabilit
|
|||
return defaultCapabilities;
|
||||
}
|
||||
|
||||
return invoke<DesktopScreenShareCapabilities>("get_screen_share_capabilities");
|
||||
return invoke<DesktopScreenShareCapabilities>(
|
||||
"get_screen_share_capabilities",
|
||||
);
|
||||
}
|
||||
|
||||
export function useDesktopMedia() {
|
||||
|
|
@ -85,7 +81,6 @@ export function useDesktopMedia() {
|
|||
export default function Provider({ children }: { children: ReactNode }) {
|
||||
const value = useMemo<DesktopMediaContextValue>(
|
||||
() => ({
|
||||
isDesktopTauri: isTauri(),
|
||||
getScreenShareCapabilities,
|
||||
listScreenShareSources,
|
||||
listScreenShareAudioOutputs,
|
||||
|
|
|
|||
Loading…
Reference in a new issue