diff --git a/packages/desktop/src/providers/CommunicationsProvider.tsx b/packages/desktop/src/providers/CommunicationsProvider.tsx index d1ac213..b28533b 100644 --- a/packages/desktop/src/providers/CommunicationsProvider.tsx +++ b/packages/desktop/src/providers/CommunicationsProvider.tsx @@ -1,3 +1,32 @@ -interface CommunicationsProvider { +import React, { useContext, useEffect } from 'react'; + +import { useImmer } from 'use-immer'; + +// device ids for different types of content +type DeviceSelections = { audio?: string; video?: string }; + +interface ICommunicationsContext { userLocalStream?: MediaStream; + + userDeviceSelections?: DeviceSelections; +} + +const CommunicationsContext = React.createContext({}); + +export function CommunicationsProvider({ children }: { children: React.ReactNode }) { + const [userDeviceSelections, setUserDeviceSelections] = useImmer({}); + + // todo save the selected devices in localstorage + + useEffect(() => {}, []); + + return ( + + {children} + + ); +} + +export default function useCommunications() { + return useContext(CommunicationsContext); }