diff --git a/packages/fake/rtc/package.json b/packages/fake/rtc/package.json index 390d110..38ae931 100644 --- a/packages/fake/rtc/package.json +++ b/packages/fake/rtc/package.json @@ -1,6 +1,6 @@ { "name": "iris-web-rtc-fake", - "version": "0.8.2", + "version": "0.8.3", "description": "wait", "main": "./index.ts", "scripts": { diff --git a/packages/rtc/package.json b/packages/rtc/package.json index 2c29a31..7034a59 100644 --- a/packages/rtc/package.json +++ b/packages/rtc/package.json @@ -1,6 +1,6 @@ { "name": "iris-web-rtc", - "version": "0.8.2", + "version": "0.8.3", "description": "wait", "main": "./src/index.ts", "scripts": { diff --git a/packages/rtc/src/IrisRtcApi.ts b/packages/rtc/src/IrisRtcApi.ts index e96e48b..1367e2a 100644 --- a/packages/rtc/src/IrisRtcApi.ts +++ b/packages/rtc/src/IrisRtcApi.ts @@ -23,12 +23,14 @@ function initIrisRtc( ); // set the first irisApiEngine apiInterceptors to irisClientManager // this is a convenient way to get irisClientManager in most cases - if (window.__AGORA_IRIS_API_ENGINE_LIST__.length === 1) { - window.__AGORA_IRIS_CLIENT_MANAGER__ = - window.__AGORA_IRIS_API_ENGINE_LIST__[0][ - 'apiInterceptors' - ][0]?.irisClientManager; - } + setTimeout(() => { + if (window.__AGORA_IRIS_API_ENGINE_LIST__.length === 1) { + window.__AGORA_IRIS_CLIENT_MANAGER__ = + window.__AGORA_IRIS_API_ENGINE_LIST__[0][ + 'apiInterceptors' + ][0]?.irisClientManager; + } + }, 1000); } export let IrisWebRtc = { diff --git a/packages/rtc/src/engine/IrisClient.ts b/packages/rtc/src/engine/IrisClient.ts index 27847f6..4bb416c 100644 --- a/packages/rtc/src/engine/IrisClient.ts +++ b/packages/rtc/src/engine/IrisClient.ts @@ -218,6 +218,12 @@ export class IrisClient { } addLocalAudioTrack(trackPackage: AudioTrackPackage) { + let find = this.audioTrackPackages.find( + (track) => track.track === trackPackage.track + ); + if (find) { + return; + } this.audioTrackPackages.push(trackPackage); trackPackage.irisClient = this; } diff --git a/packages/rtc/src/engine/IrisClientObserver.ts b/packages/rtc/src/engine/IrisClientObserver.ts index 4abc087..8aebfd0 100644 --- a/packages/rtc/src/engine/IrisClientObserver.ts +++ b/packages/rtc/src/engine/IrisClientObserver.ts @@ -74,12 +74,11 @@ export class IrisClientObserver { const globalState = this._engine.globalState; if (!trackPackage.track) return; - let needPublish: boolean = false; let track = trackPackage.track as ILocalTrack; for (const irisClient of irisClientList) { + let needPublish: boolean = false; const options = irisClient.irisClientState; - if (globalState.enabledAudio && globalState.enabledLocalAudio) { switch (trackPackage.type) { case IrisAudioSourceType.kAudioSourceTypeMicrophonePrimary: diff --git a/packages/rtc/src/helper/ImplHelper.ts b/packages/rtc/src/helper/ImplHelper.ts index 187467b..8baf127 100644 --- a/packages/rtc/src/helper/ImplHelper.ts +++ b/packages/rtc/src/helper/ImplHelper.ts @@ -365,7 +365,6 @@ export class ImplHelper { connection ); } - //clientRole update if (isDefined(options.clientRoleType)) { if (