Skip to content

Commit

Permalink
fix(store): update preview network quality after local peer exists
Browse files Browse the repository at this point in the history
  • Loading branch information
triptu authored Mar 17, 2022
1 parent 4e2ffdc commit 7b83f17
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/hms-video-store/src/core/hmsSDKStore/HMSSDKActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,15 @@ export class HMSSDKActions implements IHMSActions {
}

private onNetworkQuality(quality: number) {
this.setState(store => {
const peerId = store.room.localPeer;
store.connectionQualities[peerId] = { peerID: peerId, downlinkScore: quality };
}, 'ConnectionQuality');
const unsub = this.store.subscribe(localPeer => {
if (localPeer?.id) {
this.setState(store => {
const peerId = localPeer.id;
store.connectionQualities[peerId] = { peerID: peerId, downlinkScore: quality };
}, 'ConnectionQuality');
unsub();
}
}, selectLocalPeer);
}

private async startScreenShare(config?: { audioOnly: boolean; videoOnly: boolean }) {
Expand Down

0 comments on commit 7b83f17

Please sign in to comment.