diff --git a/packages/rtc/src/event_handler/IrisClientEventHandler.ts b/packages/rtc/src/event_handler/IrisClientEventHandler.ts index 02fc0e9..2330caf 100644 --- a/packages/rtc/src/event_handler/IrisClientEventHandler.ts +++ b/packages/rtc/src/event_handler/IrisClientEventHandler.ts @@ -302,98 +302,170 @@ export class IrisClientEventHandler { | 'unmute-video' | 'disable-local-video' ): void { - let remoteUid = uid as number; - + let _uid = uid as number; switch (msg) { case 'mute-audio': this._engine.rtcEngineEventHandler.onUserMuteAudio_0aac2fe( this._irisClient.connection, - remoteUid, + _uid, true ); this._engine.rtcEngineEventHandler.onUserStateChanged_65f95a7( this._irisClient.connection, - remoteUid, + _uid, NATIVE_RTC.REMOTE_USER_STATE.USER_STATE_MUTE_AUDIO ); - this._engine.rtcEngineEventHandler.onRemoteAudioStateChanged_056772e( - this._irisClient.connection, - remoteUid, - null, - NATIVE_RTC.REMOTE_AUDIO_STATE_REASON.REMOTE_AUDIO_REASON_REMOTE_MUTED, - null - ); break; case 'mute-video': this._engine.rtcEngineEventHandler.onUserMuteVideo_0aac2fe( this._irisClient.connection, - remoteUid, + _uid, true ); this._engine.rtcEngineEventHandler.onUserStateChanged_65f95a7( this._irisClient.connection, - remoteUid, + _uid, NATIVE_RTC.REMOTE_USER_STATE.USER_STATE_MUTE_VIDEO ); - this._engine.rtcEngineEventHandler.onRemoteVideoStateChanged_a14e9d1( - this._irisClient.connection, - remoteUid, - null, - NATIVE_RTC.REMOTE_VIDEO_STATE_REASON - .REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED, - null - ); break; case 'unmute-audio': this._engine.rtcEngineEventHandler.onUserMuteAudio_0aac2fe( this._irisClient.connection, - remoteUid, + _uid, false ); - this._engine.rtcEngineEventHandler.onRemoteAudioStateChanged_056772e( - this._irisClient.connection, - remoteUid, - null, - NATIVE_RTC.REMOTE_AUDIO_STATE_REASON - .REMOTE_AUDIO_REASON_REMOTE_UNMUTED, - null - ); break; case 'unmute-video': this._engine.rtcEngineEventHandler.onUserMuteVideo_0aac2fe( this._irisClient.connection, - remoteUid, + _uid, false ); - this._engine.rtcEngineEventHandler.onRemoteVideoStateChanged_a14e9d1( - this._irisClient.connection, - remoteUid, - null, - NATIVE_RTC.REMOTE_VIDEO_STATE_REASON - .REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED, - null - ); break; case 'enable-local-video': this._engine.rtcEngineEventHandler.onUserEnableLocalVideo_0aac2fe( this._irisClient.connection, - remoteUid, + _uid, true ); this._engine.rtcEngineEventHandler.onUserStateChanged_65f95a7( this._irisClient.connection, - remoteUid, + _uid, NATIVE_RTC.REMOTE_USER_STATE.USER_STATE_ENABLE_LOCAL_VIDEO ); break; case 'disable-local-video': this._engine.rtcEngineEventHandler.onUserEnableLocalVideo_0aac2fe( this._irisClient.connection, - remoteUid, + _uid, false ); break; } + if (uid === this.agoraRTCClient.uid) { + switch (msg) { + case 'mute-audio': + this._engine.rtcEngineEventHandler.onUserMuteAudio_0aac2fe( + this._irisClient.connection, + _uid, + true + ); + this._engine.rtcEngineEventHandler.onUserStateChanged_65f95a7( + this._irisClient.connection, + _uid, + NATIVE_RTC.REMOTE_USER_STATE.USER_STATE_MUTE_AUDIO + ); + break; + case 'mute-video': + this._engine.rtcEngineEventHandler.onUserMuteVideo_0aac2fe( + this._irisClient.connection, + _uid, + true + ); + this._engine.rtcEngineEventHandler.onUserStateChanged_65f95a7( + this._irisClient.connection, + _uid, + NATIVE_RTC.REMOTE_USER_STATE.USER_STATE_MUTE_VIDEO + ); + break; + case 'unmute-audio': + this._engine.rtcEngineEventHandler.onUserMuteAudio_0aac2fe( + this._irisClient.connection, + _uid, + false + ); + break; + case 'unmute-video': + this._engine.rtcEngineEventHandler.onUserMuteVideo_0aac2fe( + this._irisClient.connection, + _uid, + false + ); + break; + case 'enable-local-video': + this._engine.rtcEngineEventHandler.onUserEnableLocalVideo_0aac2fe( + this._irisClient.connection, + _uid, + true + ); + this._engine.rtcEngineEventHandler.onUserStateChanged_65f95a7( + this._irisClient.connection, + _uid, + NATIVE_RTC.REMOTE_USER_STATE.USER_STATE_ENABLE_LOCAL_VIDEO + ); + break; + case 'disable-local-video': + this._engine.rtcEngineEventHandler.onUserEnableLocalVideo_0aac2fe( + this._irisClient.connection, + _uid, + false + ); + break; + } + } else { + switch (msg) { + case 'mute-audio': + this._engine.rtcEngineEventHandler.onRemoteAudioStateChanged_056772e( + this._irisClient.connection, + _uid, + NATIVE_RTC.REMOTE_AUDIO_STATE.REMOTE_AUDIO_STATE_STOPPED, + NATIVE_RTC.REMOTE_AUDIO_STATE_REASON + .REMOTE_AUDIO_REASON_REMOTE_MUTED, + 0 + ); + break; + case 'mute-video': + this._engine.rtcEngineEventHandler.onRemoteVideoStateChanged_a14e9d1( + this._irisClient.connection, + _uid, + NATIVE_RTC.REMOTE_VIDEO_STATE.REMOTE_VIDEO_STATE_STOPPED, + NATIVE_RTC.REMOTE_VIDEO_STATE_REASON + .REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED, + 0 + ); + break; + case 'unmute-audio': + this._engine.rtcEngineEventHandler.onRemoteAudioStateChanged_056772e( + this._irisClient.connection, + _uid, + NATIVE_RTC.REMOTE_AUDIO_STATE.REMOTE_AUDIO_STATE_STARTING, + NATIVE_RTC.REMOTE_AUDIO_STATE_REASON + .REMOTE_AUDIO_REASON_REMOTE_UNMUTED, + 0 + ); + break; + case 'unmute-video': + this._engine.rtcEngineEventHandler.onRemoteVideoStateChanged_a14e9d1( + this._irisClient.connection, + _uid, + NATIVE_RTC.REMOTE_VIDEO_STATE.REMOTE_VIDEO_STATE_STARTING, + NATIVE_RTC.REMOTE_VIDEO_STATE_REASON + .REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED, + 0 + ); + break; + } + } } onStreamMessage(uid: UID, payload: Uint8Array): void { diff --git a/packages/rtc/src/event_handler/IrisTrackEventHandler.ts b/packages/rtc/src/event_handler/IrisTrackEventHandler.ts index 1865f8e..a2d309a 100644 --- a/packages/rtc/src/event_handler/IrisTrackEventHandler.ts +++ b/packages/rtc/src/event_handler/IrisTrackEventHandler.ts @@ -142,9 +142,9 @@ export class IrisTrackEventHandler { onEventVideoElementVisibleStatus(data?: CheckVideoVisibleResult): void { this._engine.rtcEngineEventHandler.onFirstLocalVideoFrame_ebdfd19( this._videoSourceType as NATIVE_RTC.VIDEO_SOURCE_TYPE, - null, - null, - null + 0, + 0, + 0 ); }