Skip to content

Commit

Permalink
Merge pull request #184 from TUMFARSynchrony/frontend-my-mute-partici…
Browse files Browse the repository at this point in the history
…pants

Prevent participants from hearing themselves
  • Loading branch information
NCEghtebas authored Oct 27, 2023
2 parents c8c7b6f + 911316f commit 620bfa2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/src/components/atoms/Video/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ type VideoProps = {
src: MediaProvider;
participantData: Participant;
title?: string; // Add a title prop
shouldMute?: boolean;
};

const Video = ({ src, participantData, title }: VideoProps) => {
const Video = ({ src, participantData, title, shouldMute }: VideoProps) => {
const useVideo = (stream: MediaStream | null) => {
const videoRef = useRef(document.createElement("video"));

Expand All @@ -19,6 +20,11 @@ const Video = ({ src, participantData, title }: VideoProps) => {
if (!stream) {
return;
}

if (shouldMute) {
video.muted = true;
}

video.srcObject = src;
video.onloadedmetadata = function () {
video.play();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function VideoCanvas({ connectedParticipants, sessionData, ownParticipantId, loc
src={localStream}
participantData={getParticipantById(ownParticipantId, sessionData)}
title="You"
shouldMute={true}
/>
) : null}
{/* Render videos for other connected participants */}
Expand Down

0 comments on commit 620bfa2

Please sign in to comment.