Skip to content

Commit e08818a

Browse files
authored
Fix captions related console error on ACS call (#2974)
* fix console error on acs call * Change files * Duplicate change files for beta release * pr comment
1 parent c638a09 commit e08818a

6 files changed

Lines changed: 24 additions & 2 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Fix bug where captions is subscribed to on ACS call",
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": "patch",
3+
"comment": "Fix bug where captions is subscribed to on ACS call",
4+
"packageName": "@azure/communication-react",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ export const _isTeamsCall: (call: CallCommon) => call is TeamsCall_2;
208208
// @internal (undocumented)
209209
export const _isTeamsCallAgent: (callAgent: CallAgentCommon) => callAgent is TeamsCallAgent_2;
210210

211+
// @internal
212+
export const _isTeamsMeetingCall: (call: CallCommon) => boolean;
213+
211214
// @public
212215
export interface LocalVideoStreamState {
213216
mediaStreamType: MediaStreamType;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const _isTeamsCallAgent = (callAgent: CallAgentCommon): callAgent is Team
4242

4343
/* @conditional-compile-remove(close-captions) */
4444
/**
45-
* @private
45+
* @internal
4646
* Determine whether a call is:
4747
* A TeamsCall
4848
* or a ACS Call joining the teams meeting

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ export * from './index-public';
55

66
export { _isACSCall, _isACSCallAgent, _isTeamsCall, _isTeamsCallAgent } from './TypeGuards';
77

8+
/* @conditional-compile-remove(close-captions) */
9+
export { _isTeamsMeetingCall } from './TypeGuards';
10+
811
export type { CallAgentCommon, CallCommon, TeamsCall, TeamsCallAgent, IncomingCallCommon } from './BetaToStableTypes';

packages/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ import { VideoBackgroundImage, SelectedVideoBackgroundEffect } from './CallAdapt
6767
/* @conditional-compile-remove(teams-identity-support) */
6868
import { TeamsCallAdapter } from './CallAdapter';
6969
import { getCallCompositePage, IsCallEndedPage, isCameraOn, isValidIdentifier } from '../utils';
70+
/* @conditional-compile-remove(close-captions) */
71+
import { _isTeamsMeetingCall } from '@internal/calling-stateful-client';
7072
/* @conditional-compile-remove(video-background-effects) */
7173
import { startSelectedVideoEffect } from '../utils';
7274
import { CreateVideoStreamViewResult, VideoStreamOptions } from '@internal/react-components';
@@ -752,7 +754,7 @@ export class AzureCommunicationCallAdapter<AgentType extends CallAgent | BetaTea
752754

753755
/* @conditional-compile-remove(close-captions) */
754756
private subscribeToCaptionEvents(): void {
755-
if (this.call?.state === 'Connected') {
757+
if (this.call && this.call.state === 'Connected' && _isTeamsMeetingCall(this.call)) {
756758
this.call?.feature(Features.TeamsCaptions).on('captionsReceived', this.captionsReceived.bind(this));
757759
this.call?.feature(Features.TeamsCaptions).on('isCaptionsActiveChanged', this.isCaptionsActiveChanged.bind(this));
758760
this.call?.off('stateChanged', this.subscribeToCaptionEvents.bind(this));

0 commit comments

Comments
 (0)