Skip to content

Commit 4eb0a3c

Browse files
authored
Use participant list name for captions so onFetchProfile works as expected (#4703)
* Use participant list name for captions * Change files
1 parent 19a00c2 commit 4eb0a3c

65 files changed

Lines changed: 39 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Captions",
5+
"comment": "Use display name from participant list for captions speaker display name to keep naming consisitent between different UI ",
6+
"packageName": "@azure/communication-react",
7+
"email": "96077406+carocao-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Captions",
5+
"comment": "Use display name from participant list for captions speaker display name to keep naming consisitent between different UI ",
6+
"packageName": "@azure/communication-react",
7+
"email": "96077406+carocao-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

packages/calling-component-bindings/src/captionsSelector.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
// Licensed under the MIT License.
33

44
import { CallClientState, CaptionsInfo } from '@internal/calling-stateful-client';
5-
import { CallingBaseSelectorProps, getStartCaptionsInProgress, getSupportedCaptionLanguages } from './baseSelectors';
5+
import {
6+
CallingBaseSelectorProps,
7+
getDisplayName,
8+
getIdentifier,
9+
getRemoteParticipants,
10+
getStartCaptionsInProgress,
11+
getSupportedCaptionLanguages
12+
} from './baseSelectors';
613
import {
714
getCaptions,
815
getCaptionsStatus,
@@ -105,13 +112,22 @@ export type _CaptionsBannerSelector = (
105112
* @internal
106113
*/
107114
export const _captionsBannerSelector: _CaptionsBannerSelector = reselect.createSelector(
108-
[getCaptions, getCaptionsStatus, getStartCaptionsInProgress],
109-
(captions, isCaptionsFeatureActive, startCaptionsInProgress) => {
115+
[getCaptions, getCaptionsStatus, getStartCaptionsInProgress, getRemoteParticipants, getDisplayName, getIdentifier],
116+
(captions, isCaptionsFeatureActive, startCaptionsInProgress, remoteParticipants, displayName, identifier) => {
110117
const captionsInfo = captions?.map((c, index) => {
111118
const userId = getCaptionsSpeakerIdentifier(c);
119+
let finalDisplayName;
120+
if (userId === identifier) {
121+
finalDisplayName = displayName;
122+
} else if (remoteParticipants) {
123+
const participant = remoteParticipants[userId];
124+
if (participant) {
125+
finalDisplayName = participant.displayName;
126+
}
127+
}
112128
return {
113-
id: (c.speaker.displayName ?? 'Unnamed Participant') + index,
114-
displayName: c.speaker.displayName ?? 'Unnamed Participant',
129+
id: (finalDisplayName ?? 'Unnamed Participant') + index,
130+
displayName: finalDisplayName ?? 'Unnamed Participant',
115131
captionText: c.captionText ?? '',
116132
userId
117133
};

0 commit comments

Comments
 (0)