Skip to content

Commit ae96fb9

Browse files
carocao-msftgithub-actions[bot]dmceachernmsft
authored
Fixed start captions console error and add loading screen (#3021)
* start captions error fix * Change files * Duplicate change files for beta release * Update packages/react-composites CallWithChatComposite browser test snapshots * Update packages/react-composites CallComposite browser test snapshots * start captions error fix * tests * Update packages/react-composites CallWithChatComposite browser test snapshots * fixlint * fixlint * Update packages/react-composites CallComposite browser test snapshots * name change * test * Update packages/react-composites CallComposite browser test snapshots * captions * build fix * uprdate --------- Signed-off-by: carocao-msft <96077406+carocao-msft@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com>
1 parent db415f0 commit ae96fb9

41 files changed

Lines changed: 215 additions & 65 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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Fixed start captions console error and add loading screen ",
4+
"packageName": "@azure/communication-react",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Fixed start captions console error and add loading screen ",
4+
"packageName": "@azure/communication-react",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ export const getCaptionsStatus = (state: CallClientState, props: CallingBaseSele
154154
return state.calls[props.callId]?.captionsFeature.isCaptionsFeatureActive;
155155
};
156156

157+
/* @conditional-compile-remove(close-captions) */
158+
/** @private */
159+
export const getStartCaptionsInProgress = (
160+
state: CallClientState,
161+
props: CallingBaseSelectorProps
162+
): boolean | undefined => {
163+
return state.calls[props.callId]?.captionsFeature.startCaptionsInProgress;
164+
};
165+
157166
/* @conditional-compile-remove(close-captions) */
158167
/** @private */
159168
export const getCurrentCaptionLanguage = (

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/* @conditional-compile-remove(close-captions) */
44
import { CallClientState, CaptionsInfo } from '@internal/calling-stateful-client';
55
/* @conditional-compile-remove(close-captions) */
6-
import { CallingBaseSelectorProps } from './baseSelectors';
6+
import { CallingBaseSelectorProps, getStartCaptionsInProgress } from './baseSelectors';
77
/* @conditional-compile-remove(close-captions) */
88
import {
99
getCaptions,
@@ -99,8 +99,8 @@ export type _CaptionsBannerSelector = (
9999
* @internal
100100
*/
101101
export const _captionsBannerSelector: _CaptionsBannerSelector = reselect.createSelector(
102-
[getCaptions, getCaptionsStatus],
103-
(captions, isCaptionsFeatureActive) => {
102+
[getCaptions, getCaptionsStatus, getStartCaptionsInProgress],
103+
(captions, isCaptionsFeatureActive, startCaptionsInProgress) => {
104104
// Following Teams app logic, no matter how many 'Partial' captions come,
105105
// we only pick first one according to start time, and all the other partial captions will be filtered out
106106
// This will give customers a stable captions experience when others talking over the dominant speaker
@@ -122,7 +122,8 @@ export const _captionsBannerSelector: _CaptionsBannerSelector = reselect.createS
122122
});
123123
return {
124124
captions: captionsInfo ?? [],
125-
isCaptionsOn: isCaptionsFeatureActive ?? false
125+
isCaptionsOn: isCaptionsFeatureActive ?? false,
126+
startCaptionsInProgress: startCaptionsInProgress ?? false
126127
};
127128
}
128129
);

packages/calling-stateful-client/review/beta/calling-stateful-client.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export interface CaptionsCallFeatureState {
130130
currentCaptionLanguage: string;
131131
currentSpokenLanguage: string;
132132
isCaptionsFeatureActive: boolean;
133+
startCaptionsInProgress: boolean;
133134
supportedCaptionLanguages: string[];
134135
supportedSpokenLanguages: string[];
135136
}

packages/calling-stateful-client/src/CallClientState.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ export interface CaptionsCallFeatureState {
101101
* whether captions is on/off
102102
*/
103103
isCaptionsFeatureActive: boolean;
104+
/**
105+
* whether start captions button is clicked or now
106+
*/
107+
startCaptionsInProgress: boolean;
104108
/**
105109
* supported caption languages
106110
*/

packages/calling-stateful-client/src/CallContext.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,16 @@ export class CallContext {
739739
}
740740
});
741741
}
742+
743+
/* @conditional-compile-remove(close-captions) */
744+
setStartCaptionsInProgress(callId: string, startCaptionsInProgress: boolean): void {
745+
this.modifyState((draft: CallClientState) => {
746+
const call = draft.calls[this._callIdHistory.latestCallId(callId)];
747+
if (call) {
748+
call.captionsFeature.startCaptionsInProgress = startCaptionsInProgress;
749+
}
750+
});
751+
}
742752
/* @conditional-compile-remove(close-captions) */
743753
setSelectedSpokenLanguage(callId: string, spokenLanguage: string): void {
744754
this.modifyState((draft: CallClientState) => {

packages/calling-stateful-client/src/CallDeclarativeCommon.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ class ProxyTeamsCaptionsFeature implements ProxyHandler<TeamsCaptionsCallFeature
109109
case 'startCaptions':
110110
return this._context.withAsyncErrorTeedToState(
111111
async (...args: Parameters<TeamsCaptionsCallFeature['startCaptions']>) => {
112+
this._context.setStartCaptionsInProgress(this._call.id, true);
112113
const ret = await target.startCaptions(...args);
113-
this._context.setIsCaptionActive(this._call.id, true);
114114
this._context.setSelectedSpokenLanguage(this._call.id, args[0]?.spokenLanguage ?? 'en-us');
115+
115116
return ret;
116117
},
117118
'Call.feature'
@@ -122,6 +123,7 @@ class ProxyTeamsCaptionsFeature implements ProxyHandler<TeamsCaptionsCallFeature
122123
async (...args: Parameters<TeamsCaptionsCallFeature['stopCaptions']>) => {
123124
const ret = await target.stopCaptions(...args);
124125
this._context.setIsCaptionActive(this._call.id, false);
126+
this._context.setStartCaptionsInProgress(this._call.id, false);
125127
return ret;
126128
},
127129
'Call.feature'

packages/calling-stateful-client/src/Converter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ export function convertSdkCallToDeclarativeCall(call: CallCommon): CallState {
135135
supportedCaptionLanguages: [],
136136
currentCaptionLanguage: '',
137137
currentSpokenLanguage: '',
138-
isCaptionsFeatureActive: false
138+
isCaptionsFeatureActive: false,
139+
startCaptionsInProgress: false
139140
}
140141
};
141142
}

packages/calling-stateful-client/src/StreamUtils.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ function createMockCall(mockCallId: string): CallState {
9898
supportedCaptionLanguages: [],
9999
currentCaptionLanguage: '',
100100
currentSpokenLanguage: '',
101-
isCaptionsFeatureActive: false
101+
isCaptionsFeatureActive: false,
102+
startCaptionsInProgress: false
102103
}
103104
};
104105
return call;

0 commit comments

Comments
 (0)