Skip to content

Commit

Permalink
Fix participant tile audio muted data prop (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO authored Apr 22, 2024
1 parent c2ad1ae commit 8aa9567
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/moody-suits-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/components-react": patch
---

Fix participant tile audio muted data prop
12 changes: 11 additions & 1 deletion packages/react/src/hooks/useParticipantTile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { mergeProps } from '../mergeProps';
import { useFacingMode } from './useFacingMode';
import { useIsMuted } from './useIsMuted';
import { useIsSpeaking } from './useIsSpeaking';
import { Track } from 'livekit-client';

/** @public */
export interface UseParticipantTileProps<T extends HTMLElement> extends React.HTMLAttributes<T> {
Expand Down Expand Up @@ -53,8 +54,17 @@ export function useParticipantTile<T extends HTMLElement>({
trackReference.source,
trackReference.participant,
]);

const micTrack = trackReference.participant.getTrackPublication(Track.Source.Microphone);
const micRef = React.useMemo(() => {
return {
participant: trackReference.participant,
source: Track.Source.Microphone,
publication: micTrack,
};
}, [micTrack, trackReference.participant]);
const isVideoMuted = useIsMuted(trackReference);
const isAudioMuted = useIsMuted(trackReference);
const isAudioMuted = useIsMuted(micRef);
const isSpeaking = useIsSpeaking(trackReference.participant);
const facingMode = useFacingMode(trackReference);
return {
Expand Down

0 comments on commit 8aa9567

Please sign in to comment.