Skip to content

Commit

Permalink
fix(web): local track error introduced by #1203 (#1212)
Browse files Browse the repository at this point in the history
Caused by calling `setEnabled()` after `unpublish()`.

renderer-app uses another rtc sdk, does not need to fix.
  • Loading branch information
hyrious committed Dec 16, 2021
1 parent 66eac44 commit b89fbb8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions cspell.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ module.exports = {
"zindex", // antd
"geogebra", // @netless/app-geogebra
"commitlintrc", // @commitlint/cli
"unpublish", // agora-rtc-sdk-ng

// misc
"npmrc",
Expand Down
4 changes: 1 addition & 3 deletions web/flat-web/src/api-middleware/rtc/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ export class RtcAvatar extends EventEmitter {
this.observeVolumeId = window.setInterval(this.checkVolume, 500);
}

public async destroy(): Promise<void> {
public destroy(): void {
clearInterval(this.observeVolumeId);
await this.setMic(false);
await this.setCamera(false);
this.rtc.removeAvatar(this);
}

Expand Down
7 changes: 4 additions & 3 deletions web/flat-web/src/api-middleware/rtc/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ export class RtcRoom {
setMicrophoneTrack();
setCameraTrack();
if (this.client.localTracks.length > 0) {
for (const track of this.client.localTracks) {
const tracks = this.client.localTracks;
console.log("[rtc] unpublish local tracks");
await this.client.unpublish(tracks);
for (const track of tracks) {
track.stop();
track.close();
}
console.log("[rtc] unpublish local tracks");
await this.client.unpublish(this.client.localTracks);
}
this.client.off("user-published", this.onUserPublished);
this.client.off("user-unpublished", this.onUserUnpublished);
Expand Down

0 comments on commit b89fbb8

Please sign in to comment.