diff --git a/packages/calling-stateful-client/src/ParticipantSubscriber.ts b/packages/calling-stateful-client/src/ParticipantSubscriber.ts index 8c98964e62b..30c9a51e666 100644 --- a/packages/calling-stateful-client/src/ParticipantSubscriber.ts +++ b/packages/calling-stateful-client/src/ParticipantSubscriber.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RemoteParticipant, RemoteVideoStream } from '@azure/communication-calling'; +import { DisplayNameChangedReason, RemoteParticipant, RemoteVideoStream } from '@azure/communication-calling'; import { toFlatCommunicationIdentifier } from '@internal/acs-ui-common'; import { CallContext } from './CallContext'; import { CallIdRef } from './CallIdRef'; @@ -111,7 +111,12 @@ export class ParticipantSubscriber { this._context.setParticipantRole(this._callIdRef.callId, this._participantKey, this._participant.role); }; - private displayNameChanged = (): void => { + private displayNameChanged = (args: { + newValue?: string; + oldValue?: string; + reason?: DisplayNameChangedReason; + }): void => { + console.log(`hi there display name changed from ${args.oldValue} to ${args.newValue} due to ${args.reason}`); this._context.setParticipantDisplayName( this._callIdRef.callId, this._participantKey, diff --git a/samples/CallWithChat/src/app/views/CallScreen.tsx b/samples/CallWithChat/src/app/views/CallScreen.tsx index 16fc7f247aa..8cf5b9e6df4 100644 --- a/samples/CallWithChat/src/app/views/CallScreen.tsx +++ b/samples/CallWithChat/src/app/views/CallScreen.tsx @@ -12,6 +12,7 @@ import { CallWithChatCompositeOptions, onResolveDeepNoiseSuppressionDependencyLazy, onResolveVideoEffectDependencyLazy, + Profile, toFlatCommunicationIdentifier, useAzureCommunicationCallWithChatAdapter } from '@azure/communication-react'; @@ -99,6 +100,13 @@ export const CallScreen = (props: CallScreenProps): JSX.Element => { laughReaction: { url: 'assets/reactions/laughEmoji.png', frameCount: 102 }, applauseReaction: { url: 'assets/reactions/clapEmoji.png', frameCount: 102 }, surprisedReaction: { url: 'assets/reactions/surprisedEmoji.png', frameCount: 102 } + }, + onFetchProfile: async (userId: string, defaultProfile?: Profile): Promise => { + console.log('hi there onFetchProfile', userId, defaultProfile); + if (userId !== null) { + return { displayName: '[Renamed Remote Participant] bob' }; + } + return defaultProfile; } }; }, []);