-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Together mode client state and subscriber implementation (#5152)
* Together mode client state and subscriber implementation --------- Co-authored-by: Donald McEachern <[email protected]>
- Loading branch information
1 parent
bb39ff5
commit 3175367
Showing
19 changed files
with
247 additions
and
4 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
change-beta/@azure-communication-react-367d1747-182e-425c-a897-cbcdfbc06ecd.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "prerelease", | ||
"area": "feature", | ||
"workstream": "Together Mode", | ||
"comment": "Together mode client state and subscriber implementation", | ||
"packageName": "@azure/communication-react", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
9 changes: 9 additions & 0 deletions
9
change-beta/@azure-communication-react-43b808a4-0c26-4119-a26b-7d31efbb2b93.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "prerelease", | ||
"area": "feature", | ||
"workstream": "Together Mode", | ||
"comment": "Together mode client state and subscriber implementation", | ||
"packageName": "@azure/communication-react", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
9 changes: 9 additions & 0 deletions
9
change-beta/@azure-communication-react-839f12bb-f1d6-43dc-9ba8-41fc6b17baaf.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "prerelease", | ||
"area": "feature", | ||
"workstream": "Together Mode", | ||
"comment": "Together mode client state and subscriber implementation", | ||
"packageName": "@azure/communication-react", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
9 changes: 9 additions & 0 deletions
9
change-beta/@azure-communication-react-a9fb84d9-5a0a-43a1-b407-decf5c80312c.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "prerelease", | ||
"area": "feature", | ||
"workstream": "Together Mode", | ||
"comment": "Together mode client state and subscriber implementation", | ||
"packageName": "@azure/communication-react", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
9 changes: 9 additions & 0 deletions
9
change-beta/@azure-communication-react-c5b508a6-370f-414d-9663-905d1ef3f69b.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "prerelease", | ||
"area": "feature", | ||
"workstream": "Together Mode", | ||
"comment": "This PR contains implementation of together mode client state changes and the event listener for together mode stream updates", | ||
"packageName": "@azure/communication-react", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
9 changes: 9 additions & 0 deletions
9
change-beta/@azure-communication-react-ebad70bc-6036-4b67-b5f9-438a20702e0e.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "prerelease", | ||
"area": "feature", | ||
"workstream": "TogetherMode", | ||
"comment": "Together mode client state and subscriber implementation", | ||
"packageName": "@azure/communication-react", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
packages/calling-stateful-client/src/TogetherModeSubscriber.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
/* @conditional-compile-remove(together-mode) */ | ||
import { TogetherModeCallFeature, TogetherModeVideoStream } from '@azure/communication-calling'; | ||
/* @conditional-compile-remove(together-mode) */ | ||
import { CallContext } from './CallContext'; | ||
/* @conditional-compile-remove(together-mode) */ | ||
import { CallIdRef } from './CallIdRef'; | ||
/** | ||
* @private | ||
*/ | ||
|
||
/* @conditional-compile-remove(together-mode) */ | ||
/** | ||
* TogetherModeSubscriber is responsible for subscribing to together mode events and updating the call context accordingly. | ||
*/ | ||
export class TogetherModeSubscriber { | ||
private _callIdRef: CallIdRef; | ||
private _context: CallContext; | ||
private _togetherMode: TogetherModeCallFeature; | ||
|
||
constructor(callIdRef: CallIdRef, context: CallContext, togetherMode: TogetherModeCallFeature) { | ||
this._callIdRef = callIdRef; | ||
this._context = context; | ||
this._togetherMode = togetherMode; | ||
|
||
this.subscribe(); | ||
} | ||
|
||
private subscribe = (): void => { | ||
this._togetherMode.on('togetherModeStreamsUpdated', this.onTogetherModeStreamUpdated); | ||
}; | ||
|
||
public unsubscribe = (): void => { | ||
this._togetherMode.off('togetherModeStreamsUpdated', this.onTogetherModeStreamUpdated); | ||
}; | ||
|
||
private onTogetherModeStreamUpdated = (args: { | ||
added: TogetherModeVideoStream[]; | ||
removed: TogetherModeVideoStream[]; | ||
}): void => { | ||
if (args.added) { | ||
this._context.setTogetherModeVideoStream(this._callIdRef.callId, args.added); | ||
} | ||
if (args.removed) { | ||
this._context.removeTogetherModeVideoStream(this._callIdRef.callId, args.removed); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.