@@ -34,22 +34,28 @@ export function useParticipant(participant: Participant): ParticipantState {
3434 ) ;
3535
3636 const [ cameraPublication , setCameraPublication ] = useState (
37- participant . getTrack ( Track . Source . Camera )
37+ participant . getTrackPublication ( Track . Source . Camera )
3838 ) ;
3939 const [ microphonePublication , setMicrophonePublication ] = useState (
40- participant . getTrack ( Track . Source . Microphone )
40+ participant . getTrackPublication ( Track . Source . Microphone )
4141 ) ;
4242 const [ screenSharePublication , setScreenSharePublication ] = useState (
43- participant . getTrack ( Track . Source . ScreenShare )
43+ participant . getTrackPublication ( Track . Source . ScreenShare )
4444 ) ;
4545 useEffect ( ( ) => {
4646 const onPublicationsChanged = ( ) => {
47- setPublications ( Array . from ( participant . tracks . values ( ) ) ) ;
48- setCameraPublication ( participant . getTrack ( Track . Source . Camera ) ) ;
49- setMicrophonePublication ( participant . getTrack ( Track . Source . Microphone ) ) ;
50- setScreenSharePublication ( participant . getTrack ( Track . Source . ScreenShare ) ) ;
47+ setPublications ( Array . from ( participant . trackPublications . values ( ) ) ) ;
48+ setCameraPublication (
49+ participant . getTrackPublication ( Track . Source . Camera )
50+ ) ;
51+ setMicrophonePublication (
52+ participant . getTrackPublication ( Track . Source . Microphone )
53+ ) ;
54+ setScreenSharePublication (
55+ participant . getTrackPublication ( Track . Source . ScreenShare )
56+ ) ;
5157 setSubscribedTracks (
52- Array . from ( participant . tracks . values ( ) ) . filter ( ( pub ) => {
58+ Array . from ( participant . trackPublications . values ( ) ) . filter ( ( pub ) => {
5359 return pub . isSubscribed && pub . track !== undefined ;
5460 } )
5561 ) ;
@@ -120,7 +126,7 @@ export function useParticipant(participant: Participant): ParticipantState {
120126 } , [ participant ] ) ;
121127
122128 let muted : boolean | undefined ;
123- participant . audioTracks . forEach ( ( pub ) => {
129+ participant . audioTrackPublications . forEach ( ( pub ) => {
124130 muted = pub . isMuted ;
125131 } ) ;
126132 if ( muted === undefined ) {
0 commit comments