Skip to content

Commit bb15256

Browse files
authored
VIDSOL-105: Background Replacement Support for Web VERA (#190)
1 parent e94c649 commit bb15256

File tree

80 files changed

+2497
-334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2497
-334
lines changed
324 KB
Loading
125 KB
Loading
118 KB
Loading
199 KB
Loading
229 KB
Loading
211 KB
Loading
170 KB
Loading
148 KB
Loading

frontend/src/App.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { PublisherProvider } from './Context/PublisherProvider';
1111
import RedirectToWaitingRoom from './components/RedirectToWaitingRoom';
1212
import UnsupportedBrowserPage from './pages/UnsupportedBrowserPage';
1313
import RoomContext from './Context/RoomContext';
14+
import { BackgroundPublisherProvider } from './Context/BackgroundPublisherProvider';
1415

1516
const App = () => {
1617
return (
@@ -20,9 +21,11 @@ const App = () => {
2021
<Route
2122
path="/waiting-room/:roomName"
2223
element={
23-
<PreviewPublisherProvider>
24-
<WaitingRoom />
25-
</PreviewPublisherProvider>
24+
<BackgroundPublisherProvider>
25+
<PreviewPublisherProvider>
26+
<WaitingRoom />
27+
</PreviewPublisherProvider>
28+
</BackgroundPublisherProvider>
2629
}
2730
/>
2831
<Route
@@ -31,7 +34,9 @@ const App = () => {
3134
<SessionProvider>
3235
<RedirectToWaitingRoom>
3336
<PublisherProvider>
34-
<Room />
37+
<BackgroundPublisherProvider>
38+
<Room />
39+
</BackgroundPublisherProvider>
3540
</PublisherProvider>
3641
</RedirectToWaitingRoom>
3742
</SessionProvider>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { ReactElement, ReactNode, createContext, useMemo } from 'react';
2+
import useBackgroundPublisher from './useBackgroundPublisher';
3+
4+
export type BackgroundPublisherContextType = ReturnType<typeof useBackgroundPublisher>;
5+
export const BackgroundPublisherContext = createContext({} as BackgroundPublisherContextType);
6+
7+
export type BackgroundPublisherProviderProps = {
8+
children: ReactNode;
9+
};
10+
11+
/**
12+
* BackgroundPublisherProvider - React Context Provider for BackgroundPublisherContext
13+
* BackgroundPublisherContextType contains all state and methods for local video publisher
14+
* See useBackgroundPublisher.tsx for methods and state
15+
* @param {BackgroundPublisherProviderProps} props - Background publisher provider properties
16+
* @property {ReactNode} children - The content to be rendered
17+
* @returns {BackgroundPublisherContext} a context provider for a publisher Background
18+
*/
19+
export const BackgroundPublisherProvider = ({
20+
children,
21+
}: {
22+
children: ReactNode;
23+
}): ReactElement => {
24+
const backgroundPublisherContext = useBackgroundPublisher();
25+
const value = useMemo(() => backgroundPublisherContext, [backgroundPublisherContext]);
26+
return (
27+
<BackgroundPublisherContext.Provider value={value}>
28+
{children}
29+
</BackgroundPublisherContext.Provider>
30+
);
31+
};

0 commit comments

Comments
 (0)