Skip to content

Commit

Permalink
fix(flat-web): not close tracks when exiting room (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Jun 8, 2021
1 parent 0cac4f0 commit 3cf5072
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions web/flat-web/src/apiMiddleware/rtc/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ export class RtcAvatar {
}

public destroy(): void {
if (this.isLocal) {
const { audioTrack, videoTrack } = this;
if (audioTrack) {
this.audioTrack = undefined;
(audioTrack as IMicrophoneAudioTrack).close();
}
if (videoTrack) {
this.videoTrack = undefined;
(videoTrack as ICameraVideoTrack).close();
}
}
if (!this.isLocal && this.client) {
this.client.off("user-published", this.onUserPublished);
}
Expand Down

0 comments on commit 3cf5072

Please sign in to comment.