Skip to content

Commit

Permalink
fix(web): rtc is not initialized (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Oct 26, 2021
1 parent c555024 commit d1dc852
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web/flat-web/src/api-middleware/rtc/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export class RtcAvatar extends EventEmitter {
this.rtc.removeAvatar(this);
}

private get client(): IAgoraRTCClient {
return this.rtc.client!;
private get client(): IAgoraRTCClient | undefined {
return this.rtc.client;
}

public get element(): HTMLElement | undefined {
Expand All @@ -76,6 +76,9 @@ export class RtcAvatar extends EventEmitter {
}

public refreshRemoteTracks(): void {
if (!this.client) {
return;
}
this.remoteUser = this.client.remoteUsers.find(user => user.uid === this.avatarUser.rtcUID);
if (!this.remoteUser) {
this.audioTrack = undefined;
Expand Down

0 comments on commit d1dc852

Please sign in to comment.