@@ -12,7 +12,11 @@ import {
1212 RealtimeEvent ,
1313 TranscriptState ,
1414} from '../../common/types/events.types' ;
15- import { Participant , ParticipantType } from '../../common/types/participant.types' ;
15+ import {
16+ VideoParticipant ,
17+ ParticipantType ,
18+ Participant ,
19+ } from '../../common/types/participant.types' ;
1620import { StoreType } from '../../common/types/stores.types' ;
1721import { Logger } from '../../common/utils' ;
1822import { BrowserService } from '../../services/browser' ;
@@ -40,8 +44,8 @@ let KICK_PARTICIPANTS_TIMEOUT: ReturnType<typeof setTimeout> | null = null;
4044export class VideoConference extends BaseComponent {
4145 public name : ComponentNames ;
4246 protected logger : Logger ;
43- private participantsOnMeeting : Partial < Participant > [ ] = [ ] ;
44- private localParticipant : Participant ;
47+ private participantsOnMeeting : Partial < VideoParticipant > [ ] = [ ] ;
48+ private localParticipant : VideoParticipant ;
4549 private videoManager : VideoConferenceManager ;
4650 private connectionService : ConnectionService ;
4751 private browserService : BrowserService ;
@@ -178,15 +182,17 @@ export class VideoConference extends BaseComponent {
178182 * @returns {void }
179183 */
180184 private startVideo = ( ) : void => {
185+ const defaultAvatars =
186+ this . params ?. userType !== ParticipantType . AUDIENCE && this . params ?. defaultAvatars === true ;
187+
181188 this . videoConfig = {
182189 language : this . params ?. language ,
183190 canUseRecording : ! ! this . params ?. enableRecording ,
184191 canShowAudienceList : this . params ?. showAudienceList ?? true ,
185192 canUseChat : ! this . params ?. chatOff ,
186193 canUseCams : ! this . params ?. camsOff ,
187194 canUseScreenshare : ! this . params ?. screenshareOff ,
188- canUseDefaultAvatars :
189- ! ! this . params ?. defaultAvatars && ! this . localParticipant ?. avatar ?. model3DUrl ,
195+ canUseDefaultAvatars : defaultAvatars && ! this . localParticipant ?. avatar ?. model3DUrl ,
190196 canUseGather : ! ! this . params ?. enableGather ,
191197 canUseFollow : ! ! this . params ?. enableFollow ,
192198 canUseGoTo : ! ! this . params ?. enableGoTo ,
@@ -301,7 +307,10 @@ export class VideoConference extends BaseComponent {
301307 this . useStore ( StoreType . VIDEO ) ;
302308
303309 localParticipant . subscribe ( ( participant ) => {
304- this . localParticipant = participant ;
310+ this . localParticipant = {
311+ ...this . localParticipant ,
312+ ...participant ,
313+ } ;
305314 } ) ;
306315
307316 drawing . subscribe ( this . setDrawing ) ;
@@ -321,7 +330,7 @@ export class VideoConference extends BaseComponent {
321330 * */
322331 private createParticipantFromPresence = (
323332 participant : PresenceEvent < Participant > ,
324- ) : ParticipantToFrame => {
333+ ) : VideoParticipant => {
325334 return {
326335 participantId : participant . id ,
327336 id : participant . id ,
@@ -396,9 +405,6 @@ export class VideoConference extends BaseComponent {
396405 private onMeetingStateChange = ( state : MeetingState ) : void => {
397406 this . logger . log ( 'video conference @ on meeting state change' , state ) ;
398407 this . publish ( MeetingEvent . MEETING_STATE_UPDATE , state ) ;
399-
400- const { localParticipant } = this . useStore ( StoreType . GLOBAL ) ;
401- localParticipant . publish ( localParticipant . value ) ;
402408 } ;
403409
404410 /**
@@ -496,7 +502,7 @@ export class VideoConference extends BaseComponent {
496502 * @param {Participant } participant - participant
497503 * @returns {void }
498504 */
499- private onParticipantJoined = ( participant : Participant ) : void => {
505+ private onParticipantJoined = ( participant : VideoParticipant ) : void => {
500506 this . logger . log ( 'video conference @ on participant joined' , participant ) ;
501507
502508 this . publish ( MeetingEvent . MEETING_PARTICIPANT_JOINED , participant ) ;
@@ -508,6 +514,7 @@ export class VideoConference extends BaseComponent {
508514 avatar : participant . avatar ,
509515 name : participant . name ,
510516 type : participant . type ,
517+ joinedMeeting : true ,
511518 } ) ;
512519
513520 return ;
@@ -516,6 +523,7 @@ export class VideoConference extends BaseComponent {
516523 this . roomState . updateMyProperties ( {
517524 name : participant . name ,
518525 type : participant . type ,
526+ joinedMeeting : true ,
519527 } ) ;
520528 } ;
521529
@@ -525,7 +533,7 @@ export class VideoConference extends BaseComponent {
525533 * @param {Participant } _ - participant
526534 * @returns {void }
527535 */
528- private onParticipantLeft = ( _ : Participant ) : void => {
536+ private onParticipantLeft = ( _ : VideoParticipant ) : void => {
529537 this . logger . log ( 'video conference @ on participant left' , this . localParticipant ) ;
530538
531539 this . connectionService . removeListeners ( ) ;
@@ -546,10 +554,10 @@ export class VideoConference extends BaseComponent {
546554 * @param {Record<string, Participant> } participants - participants
547555 * @returns {void }
548556 */
549- private onParticipantListUpdate = ( participants : Record < string , Participant > ) : void => {
557+ private onParticipantListUpdate = ( participants : Record < string , VideoParticipant > ) : void => {
550558 this . logger . log ( 'video conference @ on participant list update' , participants ) ;
551559
552- const list : Participant [ ] = Object . values ( participants ) . map ( ( participant ) => {
560+ const list : VideoParticipant [ ] = Object . values ( participants ) . map ( ( participant ) => {
553561 return {
554562 id : participant . id ,
555563 slot : participant . slot ,
@@ -558,6 +566,7 @@ export class VideoConference extends BaseComponent {
558566 type : participant . type ,
559567 isHost : participant . isHost ?? false ,
560568 timestamp : participant . timestamp ,
569+ color : participant . slot ?. color || MEETING_COLORS . gray ,
561570 } ;
562571 } ) ;
563572
@@ -792,12 +801,6 @@ export class VideoConference extends BaseComponent {
792801 MeetingEvent . MY_PARTICIPANT_UPDATED ,
793802 this . createParticipantFromPresence ( participant ) ,
794803 ) ;
795-
796- localParticipant . publish ( {
797- ...localParticipant . value ,
798- ...participant . data ,
799- type : this . params . userType as ParticipantType ,
800- } ) ;
801804 }
802805
803806 participants . publish ( {
@@ -883,9 +886,9 @@ export class VideoConference extends BaseComponent {
883886 }
884887
885888 return current ;
886- } , null ) as Participant ;
889+ } , null ) as VideoParticipant ;
887890
888- this . room . presence . update < Participant > ( {
891+ this . room . presence . update < VideoParticipant > ( {
889892 ...this . localParticipant ,
890893 isHost : host . id === this . localParticipant . id ,
891894 } ) ;
0 commit comments