Skip to content

Commit b89fbb8

Browse files
authored
fix(web): local track error introduced by #1203 (#1212)
Caused by calling `setEnabled()` after `unpublish()`. renderer-app uses another rtc sdk, does not need to fix.
1 parent 66eac44 commit b89fbb8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

cspell.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ module.exports = {
9292
"zindex", // antd
9393
"geogebra", // @netless/app-geogebra
9494
"commitlintrc", // @commitlint/cli
95+
"unpublish", // agora-rtc-sdk-ng
9596

9697
// misc
9798
"npmrc",

web/flat-web/src/api-middleware/rtc/avatar.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ export class RtcAvatar extends EventEmitter {
5757
this.observeVolumeId = window.setInterval(this.checkVolume, 500);
5858
}
5959

60-
public async destroy(): Promise<void> {
60+
public destroy(): void {
6161
clearInterval(this.observeVolumeId);
62-
await this.setMic(false);
63-
await this.setCamera(false);
6462
this.rtc.removeAvatar(this);
6563
}
6664

web/flat-web/src/api-middleware/rtc/room.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,13 @@ export class RtcRoom {
103103
setMicrophoneTrack();
104104
setCameraTrack();
105105
if (this.client.localTracks.length > 0) {
106-
for (const track of this.client.localTracks) {
106+
const tracks = this.client.localTracks;
107+
console.log("[rtc] unpublish local tracks");
108+
await this.client.unpublish(tracks);
109+
for (const track of tracks) {
107110
track.stop();
108111
track.close();
109112
}
110-
console.log("[rtc] unpublish local tracks");
111-
await this.client.unpublish(this.client.localTracks);
112113
}
113114
this.client.off("user-published", this.onUserPublished);
114115
this.client.off("user-unpublished", this.onUserUnpublished);

0 commit comments

Comments
 (0)