@@ -119,8 +119,18 @@ const onConferenceLeft = () => {
119119 console . log ( 'conference left!' )
120120}
121121
122+ const onUserJoined = ( template , userId , participant ) => {
123+ console . log ( 'user joined!' , userId )
124+ const _remoteTracks = template . remoteTracks . get ( )
125+
126+ if ( ! _remoteTracks [ userId ] ) _remoteTracks [ userId ] = { }
127+ _remoteTracks [ userId ] . displayName = participant . getDisplayName ( )
128+ template . remoteTracks . set ( _remoteTracks )
129+ }
130+
122131const onConnectionSuccess = ( template ) => {
123132 console . log ( 'Successfully connected' )
133+ const user = Meteor . user ( { fields : { 'profile.name' : 1 } } )
124134
125135 if ( ! template . room ) {
126136 template . room = template . connection . get ( ) . initJitsiConference ( template . roomName , { } )
@@ -137,10 +147,13 @@ const onConnectionSuccess = (template) => {
137147 template . room . on ( meetJs . events . conference . TRACK_REMOVED , ( track ) => onTrackRemoved ( template , track ) )
138148 template . room . on ( meetJs . events . conference . CONFERENCE_JOINED , onConferenceJoined )
139149 template . room . on ( meetJs . events . conference . CONFERENCE_LEFT , onConferenceLeft )
140- template . room . on ( meetJs . events . conference . USER_JOINED , ( id ) => console . log ( 'user joined!' , id ) )
150+ template . room . on ( meetJs . events . conference . USER_JOINED , ( userId , participant ) =>
151+ onUserJoined ( template , userId , participant )
152+ )
141153 template . room . on ( meetJs . events . conference . USER_LEFT , ( id ) => console . log ( 'user left!' , id ) )
142154
143155 // Join
156+ template . room . setDisplayName ( user ?. profile ?. name )
144157 template . room . join ( )
145158 template . room . setSenderVideoConstraint ( 720 ) // Send at most 720p
146159 template . room . setReceiverVideoConstraint ( 360 ) // Receive at most 360p for each participant
0 commit comments