Add screensharing support
This commit is contained in:
38
src/Room.jsx
38
src/Room.jsx
@@ -93,6 +93,10 @@ export function GroupCallView({ groupCall }) {
|
|||||||
leave,
|
leave,
|
||||||
toggleLocalVideoMuted,
|
toggleLocalVideoMuted,
|
||||||
toggleMicrophoneMuted,
|
toggleMicrophoneMuted,
|
||||||
|
toggleScreensharing,
|
||||||
|
isScreensharing,
|
||||||
|
localScreenshareFeed,
|
||||||
|
screenshareFeeds,
|
||||||
} = useGroupCall(groupCall);
|
} = useGroupCall(groupCall);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -108,6 +112,10 @@ export function GroupCallView({ groupCall }) {
|
|||||||
userMediaFeeds={userMediaFeeds}
|
userMediaFeeds={userMediaFeeds}
|
||||||
activeSpeaker={activeSpeaker}
|
activeSpeaker={activeSpeaker}
|
||||||
onLeave={leave}
|
onLeave={leave}
|
||||||
|
toggleScreensharing={toggleScreensharing}
|
||||||
|
isScreensharing={isScreensharing}
|
||||||
|
localScreenshareFeed={localScreenshareFeed}
|
||||||
|
screenshareFeeds={screenshareFeeds}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else if (state === GroupCallState.Entering) {
|
} else if (state === GroupCallState.Entering) {
|
||||||
@@ -235,18 +243,35 @@ function InRoomView({
|
|||||||
userMediaFeeds,
|
userMediaFeeds,
|
||||||
activeSpeaker,
|
activeSpeaker,
|
||||||
onLeave,
|
onLeave,
|
||||||
|
toggleScreensharing,
|
||||||
|
isScreensharing,
|
||||||
|
screenshareFeeds,
|
||||||
}) {
|
}) {
|
||||||
const [layout, toggleLayout] = useVideoGridLayout();
|
const [layout, toggleLayout] = useVideoGridLayout();
|
||||||
|
|
||||||
const items = useMemo(
|
const items = useMemo(() => {
|
||||||
() =>
|
const participants = [];
|
||||||
userMediaFeeds.map((callFeed) => ({
|
|
||||||
|
for (const callFeed of userMediaFeeds) {
|
||||||
|
participants.push({
|
||||||
id: callFeed.userId,
|
id: callFeed.userId,
|
||||||
callFeed,
|
callFeed,
|
||||||
isActiveSpeaker: callFeed.userId === activeSpeaker,
|
isActiveSpeaker: callFeed.userId === activeSpeaker,
|
||||||
})),
|
});
|
||||||
[userMediaFeeds, activeSpeaker]
|
}
|
||||||
);
|
|
||||||
|
for (const callFeed of screenshareFeeds) {
|
||||||
|
participants.push({
|
||||||
|
id: callFeed.userId + "-screenshare",
|
||||||
|
callFeed,
|
||||||
|
isActiveSpeaker: callFeed.userId === activeSpeaker,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("items changed", participants);
|
||||||
|
|
||||||
|
return participants;
|
||||||
|
}, [userMediaFeeds, activeSpeaker, screenshareFeeds]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -276,6 +301,7 @@ function InRoomView({
|
|||||||
enabled={localVideoMuted}
|
enabled={localVideoMuted}
|
||||||
onClick={toggleLocalVideoMuted}
|
onClick={toggleLocalVideoMuted}
|
||||||
/>
|
/>
|
||||||
|
<VideoButton enabled={isScreensharing} onClick={toggleScreensharing} />
|
||||||
<HangupButton onClick={onLeave} />
|
<HangupButton onClick={onLeave} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ export default defineConfig({
|
|||||||
alias: {
|
alias: {
|
||||||
"$(res)": path.resolve(__dirname, "node_modules/matrix-react-sdk/res"),
|
"$(res)": path.resolve(__dirname, "node_modules/matrix-react-sdk/res"),
|
||||||
},
|
},
|
||||||
dedupe: ["react", "react-dom"],
|
dedupe: ["react", "react-dom", "matrix-js-sdk"],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user