Skip to content

Commit

Permalink
Fix acs room audio video enabled notifications (#5563)
Browse files Browse the repository at this point in the history
* Fix acs room capability issue.

* Change files

* test update

* update

* Update comment in change log JSON file

* Update comment for ACS room notifications fix

* test

* Revert previous change
  • Loading branch information
fuyan2024 authored Jan 16, 2025
1 parent e77a53b commit 7cdaf40
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Hard mute",
"comment": "Fix acs room audio video enabled notifications. when acs user just joined room, should not show the audio video enabled notifications",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Hard mute",
"comment": "Fix acs room audio video enabled notifications. when acs user just joined room, should not show the audio video enabled notifications",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
17 changes: 15 additions & 2 deletions packages/calling-stateful-client/src/CapabilitiesSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class CapabilitiesSubscriber {
private _callIdRef: CallIdRef;
private _context: CallContext;
private _capabilitiesFeature: CapabilitiesFeature;
/* @conditional-compile-remove(media-access) */
private _capabilitiesInitialized: boolean = false;

constructor(callIdRef: CallIdRef, context: CallContext, capabilities: CapabilitiesFeature) {
this._callIdRef = callIdRef;
Expand All @@ -38,12 +40,19 @@ export class CapabilitiesSubscriber {
}
/* @conditional-compile-remove(media-access) */
this.setUnmuteMicAndTurnVideoOnNotification(data);

/* @conditional-compile-remove(media-access) */
this._capabilitiesInitialized = true;
};

/* @conditional-compile-remove(media-access) */
private setUnmuteMicAndTurnVideoOnNotification = (data: CapabilitiesChangeInfo): void => {
if (data.oldValue.turnVideoOn?.isPresent !== data.newValue.turnVideoOn?.isPresent) {
if (data.oldValue.turnVideoOn?.isPresent === false && data.newValue.turnVideoOn?.isPresent) {
if (
data.oldValue.turnVideoOn?.isPresent === false &&
data.newValue.turnVideoOn?.isPresent &&
this._capabilitiesInitialized
) {
const capabilityTurnVideoOnAbsent = this._context.getState().latestNotifications.capabilityTurnVideoOnAbsent;
if (capabilityTurnVideoOnAbsent) {
this._context.deleteLatestNotification(this._callIdRef.callId, 'capabilityTurnVideoOnAbsent');
Expand Down Expand Up @@ -72,7 +81,11 @@ export class CapabilitiesSubscriber {
}
}
if (data.oldValue.unmuteMic?.isPresent !== data.newValue.unmuteMic?.isPresent) {
if (data.oldValue.unmuteMic?.isPresent === false && data.newValue.unmuteMic?.isPresent) {
if (
data.oldValue.unmuteMic?.isPresent === false &&
data.newValue.unmuteMic?.isPresent &&
this._capabilitiesInitialized
) {
const capabilityUnmuteMicAbsent = this._context.getState().latestNotifications.capabilityUnmuteMicAbsent;
if (capabilityUnmuteMicAbsent) {
this._context.deleteLatestNotification(this._callIdRef.callId, 'capabilityUnmuteMicAbsent');
Expand Down

0 comments on commit 7cdaf40

Please sign in to comment.