From 3f436100cdd252e215178c16687efcb01a36507c Mon Sep 17 00:00:00 2001 From: HUI Date: Wed, 30 Sep 2020 18:09:59 +0800 Subject: [PATCH] optimize --- src/src/RtcChannel.native.ts | 122 ++++++---------- src/src/RtcEngine.native.ts | 260 ++++++++++++++++++----------------- 2 files changed, 174 insertions(+), 208 deletions(-) diff --git a/src/src/RtcChannel.native.ts b/src/src/RtcChannel.native.ts index a6acdb5ac..5aabeb6ff 100644 --- a/src/src/RtcChannel.native.ts +++ b/src/src/RtcChannel.native.ts @@ -54,6 +54,10 @@ export default class RtcChannel implements RtcChannelInterface { this.channelId = channelId } + private _callMethod(method: string, args?: {}): Promise { + return AgoraRtcChannelModule.callMethod(method, args === undefined ? {channelId: this.channelId} : {channelId: this.channelId, ...args}); + } + /** * Creates and gets an [`RtcChannel`]{@link RtcChannel} instance. * @@ -102,7 +106,7 @@ export default class RtcChannel implements RtcChannelInterface { destroy(): Promise { this.removeAllListeners() channels.delete(this.channelId) - return AgoraRtcChannelModule.callMethod('destroy', {channelId: this.channelId}) + return this._callMethod('destroy') } /** @@ -177,7 +181,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param role The role of the user. */ setClientRole(role: ClientRole): Promise { - return AgoraRtcChannelModule.callMethod('setClientRole', {channelId: this.channelId, role}) + return this._callMethod('setClientRole', {role}) } /** @@ -197,13 +201,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param options The channel media options. */ joinChannel(token: string | null, optionalInfo: string | null, optionalUid: number, options: ChannelMediaOptions): Promise { - return AgoraRtcChannelModule.callMethod('joinChannel', { - channelId: this.channelId, - token, - optionalInfo, - optionalUid, - options - }) + return this._callMethod('joinChannel', {token, optionalInfo, optionalUid, options}) } /** @@ -227,12 +225,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param options The channel media options. */ joinChannelWithUserAccount(token: string | null, userAccount: string, options: ChannelMediaOptions): Promise { - return AgoraRtcChannelModule.callMethod('joinChannelWithUserAccount', { - channelId: this.channelId, - token, - userAccount, - options - }) + return this._callMethod('joinChannelWithUserAccount', {token, userAccount, options}) } /** @@ -243,7 +236,7 @@ export default class RtcChannel implements RtcChannelInterface { * - The remote client: [`UserOffline`]{@link RtcChannelEvents.UserOffline}, if the user leaving the channel is in a `Communication` channel, or is a host in a `LiveBroadcasting` channel. */ leaveChannel(): Promise { - return AgoraRtcChannelModule.callMethod('leaveChannel', {channelId: this.channelId}) + return this._callMethod('leaveChannel') } /** @@ -257,14 +250,14 @@ export default class RtcChannel implements RtcChannelInterface { * @param token The new token. */ renewToken(token: string): Promise { - return AgoraRtcChannelModule.callMethod('renewToken', {channelId: this.channelId, token}) + return this._callMethod('renewToken', {token}) } /** * Gets the network connection state of the SDK. */ getConnectionState(): Promise { - return AgoraRtcChannelModule.callMethod('getConnectionState', {channelId: this.channelId}) + return this._callMethod('getConnectionState') } /** @@ -276,7 +269,7 @@ export default class RtcChannel implements RtcChannelInterface { * - You can publish a stream to only one channel at a time. For details, see the advanced guide *Join Multiple Channels*. */ publish(): Promise { - return AgoraRtcChannelModule.callMethod('publish', {channelId: this.channelId}) + return this._callMethod('publish') } /** @@ -285,7 +278,7 @@ export default class RtcChannel implements RtcChannelInterface { * If you call this method in a channel where you are not publishing streams, the SDK returns [`Refused(-5)`]{@link ErrorCode.Refused}. */ unpublish(): Promise { - return AgoraRtcChannelModule.callMethod('unpublish', {channelId: this.channelId}) + return this._callMethod('unpublish') } /** @@ -296,7 +289,7 @@ export default class RtcChannel implements RtcChannelInterface { * - The empty string "", if the method call fails. */ getCallId(): Promise { - return AgoraRtcChannelModule.callMethod('getCallId', {channelId: this.channelId}) + return this._callMethod('getCallId') } /** @@ -317,11 +310,7 @@ export default class RtcChannel implements RtcChannelInterface { * - 100: The original volume. */ adjustUserPlaybackSignalVolume(uid: number, volume: number): Promise { - return AgoraRtcChannelModule.callMethod('adjustUserPlaybackSignalVolume', { - channelId: this.channelId, - uid, - volume - }) + return this._callMethod('adjustUserPlaybackSignalVolume', {uid, volume}) } /** @@ -333,7 +322,7 @@ export default class RtcChannel implements RtcChannelInterface { * - `false`: (Default) Receive the audio stream of the user. */ muteRemoteAudioStream(uid: number, muted: boolean): Promise { - return AgoraRtcChannelModule.callMethod('muteRemoteAudioStream', {channelId: this.channelId, uid, muted}) + return this._callMethod('muteRemoteAudioStream', {uid, muted}) } /** @@ -344,7 +333,7 @@ export default class RtcChannel implements RtcChannelInterface { * - `false`: (Default) Receive all remote audio streams. */ muteAllRemoteAudioStreams(muted: boolean): Promise { - return AgoraRtcChannelModule.callMethod('muteAllRemoteAudioStreams', {channelId: this.channelId, muted}) + return this._callMethod('muteAllRemoteAudioStreams', {muted}) } /** @@ -355,10 +344,7 @@ export default class RtcChannel implements RtcChannelInterface { * - `false`: (Default) Receive all remote audio streams by default. */ setDefaultMuteAllRemoteAudioStreams(muted: boolean): Promise { - return AgoraRtcChannelModule.callMethod('setDefaultMuteAllRemoteAudioStreams', { - channelId: this.channelId, - muted - }) + return this._callMethod('setDefaultMuteAllRemoteAudioStreams', {muted}) } /** @@ -369,7 +355,7 @@ export default class RtcChannel implements RtcChannelInterface { * - `false`: (Default) Receive all remote video streams. */ muteAllRemoteVideoStreams(muted: boolean): Promise { - return AgoraRtcChannelModule.callMethod('muteAllRemoteVideoStreams', {channelId: this.channelId, muted}) + return this._callMethod('muteAllRemoteVideoStreams', {muted}) } /** @@ -381,7 +367,7 @@ export default class RtcChannel implements RtcChannelInterface { * - `false`: (Default) Receive the video stream of the user. */ muteRemoteVideoStream(uid: number, muted: boolean): Promise { - return AgoraRtcChannelModule.callMethod('muteRemoteVideoStream', {channelId: this.channelId, uid, muted}) + return this._callMethod('muteRemoteVideoStream', {uid, muted}) } /** @@ -392,10 +378,7 @@ export default class RtcChannel implements RtcChannelInterface { * - `false`: (Default) Receive all remote video streams by default. */ setDefaultMuteAllRemoteVideoStreams(muted: boolean): Promise { - return AgoraRtcChannelModule.callMethod('setDefaultMuteAllRemoteVideoStreams', { - channelId: this.channelId, - muted - }) + return this._callMethod('setDefaultMuteAllRemoteVideoStreams', {muted}) } /** @@ -415,7 +398,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param gain Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain. */ setRemoteVoicePosition(uid: number, pan: number, gain: number): Promise { - return AgoraRtcChannelModule.callMethod('setRemoteVoicePosition', {channelId: this.channelId, uid, pan, gain}) + return this._callMethod('setRemoteVoicePosition', {uid, pan, gain}) } /** @@ -437,11 +420,7 @@ export default class RtcChannel implements RtcChannelInterface { * - `false`: Disable transcoding. */ addPublishStreamUrl(url: string, transcodingEnabled: boolean): Promise { - return AgoraRtcChannelModule.callMethod('addPublishStreamUrl', { - channelId: this.channelId, - url, - transcodingEnabled - }) + return this._callMethod('addPublishStreamUrl', {url, transcodingEnabled}) } /** @@ -459,7 +438,7 @@ export default class RtcChannel implements RtcChannelInterface { * such as Chinese language characters. */ removePublishStreamUrl(url: string): Promise { - return AgoraRtcChannelModule.callMethod('removePublishStreamUrl', {channelId: this.channelId, url}) + return this._callMethod('removePublishStreamUrl', {url}) } /** @@ -478,7 +457,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param transcoding Sets the CDN live audio/video transcoding settings. */ setLiveTranscoding(transcoding: LiveTranscoding): Promise { - return AgoraRtcChannelModule.callMethod('setLiveTranscoding', {channelId: this.channelId, transcoding}) + return this._callMethod('setLiveTranscoding', {transcoding}) } /** @@ -503,10 +482,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param channelMediaRelayConfiguration The configuration of the media stream relay. */ startChannelMediaRelay(channelMediaRelayConfiguration: ChannelMediaRelayConfiguration): Promise { - return AgoraRtcChannelModule.callMethod('startChannelMediaRelay', { - channelId: this.channelId, - channelMediaRelayConfiguration - }) + return this._callMethod('startChannelMediaRelay', {channelMediaRelayConfiguration}) } /** @@ -522,7 +498,7 @@ export default class RtcChannel implements RtcChannelInterface { * You can leave the channel using [`leaveChannel`]{@link RtcChannel.leaveChannel}, and the media stream relay automatically stops. */ stopChannelMediaRelay(): Promise { - return AgoraRtcChannelModule.callMethod('stopChannelMediaRelay', {channelId: this.channelId}) + return this._callMethod('stopChannelMediaRelay') } /** @@ -539,10 +515,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param channelMediaRelayConfiguration The media stream relay configuration. */ updateChannelMediaRelay(channelMediaRelayConfiguration: ChannelMediaRelayConfiguration): Promise { - return AgoraRtcChannelModule.callMethod('updateChannelMediaRelay', { - channelId: this.channelId, - channelMediaRelayConfiguration - }) + return this._callMethod('updateChannelMediaRelay', {channelMediaRelayConfiguration}) } /** @@ -551,10 +524,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param streamType Sets the default video-stream type. */ setRemoteDefaultVideoStreamType(streamType: VideoStreamType): Promise { - return AgoraRtcChannelModule.callMethod('setRemoteDefaultVideoStreamType', { - channelId: this.channelId, - streamType - }) + return this._callMethod('setRemoteDefaultVideoStreamType', {streamType}) } /** @@ -571,11 +541,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param streamType Sets the video-stream type. */ setRemoteVideoStreamType(uid: number, streamType: VideoStreamType): Promise { - return AgoraRtcChannelModule.callMethod('setRemoteVideoStreamType', { - channelId: this.channelId, - uid, - streamType - }) + return this._callMethod('setRemoteVideoStreamType', {uid, streamType}) } /** @@ -591,11 +557,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param userPriority The priority of the remote user. */ setRemoteUserPriority(uid: number, userPriority: UserPriority): Promise { - return AgoraRtcChannelModule.callMethod('setRemoteUserPriority', { - channelId: this.channelId, - uid, - userPriority - }) + return this._callMethod('setRemoteUserPriority', {uid, userPriority}) } /** @@ -611,7 +573,7 @@ export default class RtcChannel implements RtcChannelInterface { * - This method applies to the [`LiveBroadcasting`]{@link ChannelProfile.LiveBroadcasting} profile only. */ registerMediaMetadataObserver(): Promise { - return AgoraRtcChannelModule.callMethod('registerMediaMetadataObserver', {channelId: this.channelId}) + return this._callMethod('registerMediaMetadataObserver') } /** @@ -620,7 +582,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param metadata The metadata to be sent. */ sendMetadata(metadata: string): Promise { - return AgoraRtcChannelModule.callMethod('sendMetadata', {channelId: this.channelId, metadata}) + return this._callMethod('sendMetadata', {metadata}) } /** @@ -629,14 +591,14 @@ export default class RtcChannel implements RtcChannelInterface { * @param size Buffer size of the sent or received metadata. */ setMaxMetadataSize(size: number): Promise { - return AgoraRtcChannelModule.callMethod('setMaxMetadataSize', {channelId: this.channelId, size}) + return this._callMethod('setMaxMetadataSize', {size}) } /** * Unregisters the metadata observer. */ unregisterMediaMetadataObserver(): Promise { - return AgoraRtcChannelModule.callMethod('unregisterMediaMetadataObserver', {channelId: this.channelId}) + return this._callMethod('unregisterMediaMetadataObserver') } /** @@ -659,7 +621,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param config Configurations of built-in encryption schemas. See [`EncryptionConfig`]{@link EncryptionConfig}. */ enableEncryption(enabled: boolean, config: EncryptionConfig): Promise { - return AgoraRtcChannelModule.callMethod('enableEncryption', {channelId: this.channelId, enabled, config}); + return this._callMethod('enableEncryption', {enabled, config}); } /** @@ -680,7 +642,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param encryptionMode Sets the encryption mode. */ setEncryptionMode(encryptionMode: EncryptionMode): Promise { - return AgoraRtcChannelModule.callMethod('setEncryptionMode', {channelId: this.channelId, encryptionMode}) + return this._callMethod('setEncryptionMode', {encryptionMode}) } /** @@ -700,7 +662,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param secret The encryption password. */ setEncryptionSecret(secret: string): Promise { - return AgoraRtcChannelModule.callMethod('setEncryptionSecret', {channelId: this.channelId, secret}) + return this._callMethod('setEncryptionSecret', {secret}) } /** @@ -727,7 +689,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param config The [`LiveInjectStreamConfig`]{@link LiveInjectStreamConfig} object, which contains the configuration information for the added voice or video stream. */ addInjectStreamUrl(url: string, config: LiveInjectStreamConfig): Promise { - return AgoraRtcChannelModule.callMethod('addInjectStreamUrl', {channelId: this.channelId, url, config}) + return this._callMethod('addInjectStreamUrl', {url, config}) } /** @@ -741,7 +703,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param url The URL address to be removed. */ removeInjectStreamUrl(url: string): Promise { - return AgoraRtcChannelModule.callMethod('removeInjectStreamUrl', {channelId: this.channelId, url}) + return this._callMethod('removeInjectStreamUrl', {url}) } /** @@ -766,7 +728,7 @@ export default class RtcChannel implements RtcChannelInterface { * - < 0: Failure. The error code is related to the integer displayed in [Error Codes]{@link ErrorCode}. */ createDataStream(reliable: boolean, ordered: boolean): Promise { - return AgoraRtcChannelModule.callMethod('createDataStream', {channelId: this.channelId, reliable, ordered}) + return this._callMethod('createDataStream', {reliable, ordered}) } /** @@ -786,7 +748,7 @@ export default class RtcChannel implements RtcChannelInterface { * @param message The message data. */ sendStreamMessage(streamId: number, message: string): Promise { - return AgoraRtcChannelModule.callMethod('sendStreamMessage', {channelId: this.channelId, streamId, message}) + return this._callMethod('sendStreamMessage', {streamId, message}) } } diff --git a/src/src/RtcEngine.native.ts b/src/src/RtcEngine.native.ts index 0873a141c..6aa4f00b2 100644 --- a/src/src/RtcEngine.native.ts +++ b/src/src/RtcEngine.native.ts @@ -66,6 +66,10 @@ export default class RtcEngine implements RtcEngineInterface { */ private _listeners = new Map>() + private static _callMethod(method: string, args?: {}): Promise { + return AgoraRtcEngineModule.callMethod(method, args); + } + /** * Gets a created [`RtcEngine`]{@link RtcEngine} instance. * @@ -129,7 +133,7 @@ export default class RtcEngine implements RtcEngineInterface { */ static async createWithAreaCode(appId: string, areaCode: AreaCode): Promise { if (engine) return engine - await AgoraRtcEngineModule.callMethod('create', {appId, areaCode, appType: 8}) + await RtcEngine._callMethod('create', {appId, areaCode, appType: 8}) engine = new RtcEngine() return engine } @@ -153,7 +157,7 @@ export default class RtcEngine implements RtcEngineInterface { RtcChannel.destroyAll() this.removeAllListeners() engine = undefined - return AgoraRtcEngineModule.callMethod('destroy', null) + return RtcEngine._callMethod('destroy') } /** @@ -223,7 +227,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param profile The channel profile of the Agora [`RtcEngine`]{@link RtcEngine}. */ setChannelProfile(profile: ChannelProfile): Promise { - return AgoraRtcEngineModule.callMethod('setChannelProfile', {profile}) + return RtcEngine._callMethod('setChannelProfile', {profile}) } /** @@ -238,7 +242,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param role Sets the role of a user. */ setClientRole(role: ClientRole): Promise { - return AgoraRtcEngineModule.callMethod('setClientRole', {role}) + return RtcEngine._callMethod('setClientRole', {role}) } /** @@ -282,7 +286,7 @@ export default class RtcEngine implements RtcEngineInterface { * If necessary, the uid can be converted to a 64-bit integer through “uid&0xffffffffL”. */ joinChannel(token: string | null, channelName: string, optionalInfo: string | null, optionalUid: number): Promise { - return AgoraRtcEngineModule.callMethod('joinChannel', {token, channelName, optionalInfo, optionalUid}) + return RtcEngine._callMethod('joinChannel', {token, channelName, optionalInfo, optionalUid}) } /** @@ -308,7 +312,7 @@ export default class RtcEngine implements RtcEngineInterface { * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". */ switchChannel(token: string | null, channelName: string): Promise { - return AgoraRtcEngineModule.callMethod('switchChannel', {token, channelName}) + return RtcEngine._callMethod('switchChannel', {token, channelName}) } /** @@ -331,7 +335,7 @@ export default class RtcEngine implements RtcEngineInterface { * - If you call [`leaveChannel`]{@link leaveChannel} during CDN live streaming, the SDK triggers the [`removeInjectStreamUrl`]{@link removeInjectStreamUrl} method. */ leaveChannel(): Promise { - return AgoraRtcEngineModule.callMethod('leaveChannel', null) + return RtcEngine._callMethod('leaveChannel') } /** @@ -346,7 +350,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param token The new token. */ renewToken(token: string): Promise { - return AgoraRtcEngineModule.callMethod('renewToken', {token}) + return RtcEngine._callMethod('renewToken', {token}) } /** @@ -361,14 +365,14 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Disable. */ enableWebSdkInteroperability(enabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('enableWebSdkInteroperability', {enabled}) + return RtcEngine._callMethod('enableWebSdkInteroperability', {enabled}) } /** * Gets the connection state of the SDK. */ getConnectionState(): Promise { - return AgoraRtcEngineModule.callMethod('getConnectionState', null) + return RtcEngine._callMethod('getConnectionState') } /** @@ -384,7 +388,7 @@ export default class RtcEngine implements RtcEngineInterface { * Current call ID. */ getCallId(): Promise { - return AgoraRtcEngineModule.callMethod('getCallId', null) + return RtcEngine._callMethod('getCallId') } /** @@ -396,7 +400,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param description (Optional) The description of the rating. The string length must be less than 800 bytes. */ rate(callId: string, rating: Rate, description?: string): Promise { - return AgoraRtcEngineModule.callMethod('rate', {callId, rating, description}) + return RtcEngine._callMethod('rate', {callId, rating, description}) } /** @@ -406,7 +410,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param description (Optional) The description of the complaint. The string length must be less than 800 bytes. */ complain(callId: string, description: string): Promise { - return AgoraRtcEngineModule.callMethod('complain', {callId, description}) + return RtcEngine._callMethod('complain', {callId, description}) } /** @@ -424,7 +428,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param filePath File path of the log file. The string of the log file is in UTF-8. The default file path is `/storage/emulated/0/Android/data/="">/files/agorasdk.log`. */ setLogFile(filePath: string): Promise { - return AgoraRtcEngineModule.callMethod('setLogFile', {filePath}) + return RtcEngine._callMethod('setLogFile', {filePath}) } /** @@ -436,7 +440,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param filter Sets the log filter level. */ setLogFilter(filter: LogFilter): Promise { - return AgoraRtcEngineModule.callMethod('setLogFilter', {filter}) + return RtcEngine._callMethod('setLogFilter', {filter}) } /** @@ -448,7 +452,7 @@ export default class RtcEngine implements RtcEngineInterface { * at most 5 MB log files; if you set it to less than 1024 KB, the maximum size of a log file is still 1024 KB. */ setLogFileSize(fileSizeInKBytes: number): Promise { - return AgoraRtcEngineModule.callMethod('setLogFileSize', {fileSizeInKBytes}) + return RtcEngine._callMethod('setLogFileSize', {fileSizeInKBytes}) } /** @@ -459,7 +463,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param parameters Sets the parameter as a JSON string in the specified format. */ setParameters(parameters: string): Promise { - return AgoraRtcEngineModule.callMethod('setParameters', {parameters}) + return RtcEngine._callMethod('setParameters', {parameters}) } /** @@ -471,7 +475,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param uid The user ID of the user. Ensure that you set this parameter. */ getUserInfoByUid(uid: number): Promise { - return AgoraRtcEngineModule.callMethod('getUserInfoByUid', {uid}) + return RtcEngine._callMethod('getUserInfoByUid', {uid}) } /** @@ -483,7 +487,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param userAccount The user account of the user. Ensure that you set this parameter. */ getUserInfoByUserAccount(userAccount: string): Promise { - return AgoraRtcEngineModule.callMethod('getUserInfoByUserAccount', {userAccount}) + return RtcEngine._callMethod('getUserInfoByUserAccount', {userAccount}) } /** @@ -517,7 +521,7 @@ export default class RtcEngine implements RtcEngineInterface { * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". */ joinChannelWithUserAccount(token: string | null, channelName: string, userAccount: string): Promise { - return AgoraRtcEngineModule.callMethod('joinChannelWithUserAccount', {token, channelName, userAccount}) + return RtcEngine._callMethod('joinChannelWithUserAccount', {token, channelName, userAccount}) } /** @@ -550,7 +554,7 @@ export default class RtcEngine implements RtcEngineInterface { * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". */ registerLocalUserAccount(appId: string, userAccount: string): Promise { - return AgoraRtcEngineModule.callMethod('registerLocalUserAccount', {appId, userAccount}) + return RtcEngine._callMethod('registerLocalUserAccount', {appId, userAccount}) } /** @@ -568,7 +572,7 @@ export default class RtcEngine implements RtcEngineInterface { * Agora recommends setting the value of volume between 0 and 100. If you need to set the value higher than 100, contact support@agora.io first. */ adjustPlaybackSignalVolume(volume: number): Promise { - return AgoraRtcEngineModule.callMethod('adjustPlaybackSignalVolume', {volume}) + return RtcEngine._callMethod('adjustPlaybackSignalVolume', {volume}) } /** @@ -581,7 +585,7 @@ export default class RtcEngine implements RtcEngineInterface { * If you need to set the value higher than 100, contact support@agora.io first. */ adjustRecordingSignalVolume(volume: number): Promise { - return AgoraRtcEngineModule.callMethod('adjustRecordingSignalVolume', {volume}) + return RtcEngine._callMethod('adjustRecordingSignalVolume', {volume}) } /** @@ -599,7 +603,7 @@ export default class RtcEngine implements RtcEngineInterface { * - 100: The original volume. */ adjustUserPlaybackSignalVolume(uid: number, volume: number): Promise { - return AgoraRtcEngineModule.callMethod('adjustUserPlaybackSignalVolume', {uid, volume}) + return RtcEngine._callMethod('adjustUserPlaybackSignalVolume', {uid, volume}) } /** @@ -622,7 +626,7 @@ export default class RtcEngine implements RtcEngineInterface { * - [`muteAllRemoteAudioStreams`]{@link muteAllRemoteAudioStreams}: Whether to subscribe to and play all remote audio streams. */ disableAudio(): Promise { - return AgoraRtcEngineModule.callMethod('disableAudio', null) + return RtcEngine._callMethod('disableAudio') } /** @@ -647,7 +651,7 @@ export default class RtcEngine implements RtcEngineInterface { * - [`muteAllRemoteAudioStreams`]{@link muteAllRemoteAudioStreams}: Whether to subscribe to and play all remote audio streams. */ enableAudio(): Promise { - return AgoraRtcEngineModule.callMethod('enableAudio', null) + return RtcEngine._callMethod('enableAudio') } /** @@ -667,7 +671,7 @@ export default class RtcEngine implements RtcEngineInterface { * except for scenarios where the engine automatically detects the voice activity of the local user. */ enableAudioVolumeIndication(interval: number, smooth: number, report_vad: boolean): Promise { - return AgoraRtcEngineModule.callMethod('enableAudioVolumeIndication', {interval, smooth, report_vad}) + return RtcEngine._callMethod('enableAudioVolumeIndication', {interval, smooth, report_vad}) } /** @@ -696,7 +700,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: Disable the local audio function, that is, to stop local audio capture and processing. */ enableLocalAudio(enabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('enableLocalAudio', {enabled}) + return RtcEngine._callMethod('enableLocalAudio', {enabled}) } /** @@ -707,7 +711,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Receive all remote audio streams. */ muteAllRemoteAudioStreams(muted: boolean): Promise { - return AgoraRtcEngineModule.callMethod('muteAllRemoteAudioStreams', {muted}) + return RtcEngine._callMethod('muteAllRemoteAudioStreams', {muted}) } /** @@ -725,7 +729,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Send the local audio stream. */ muteLocalAudioStream(muted: boolean): Promise { - return AgoraRtcEngineModule.callMethod('muteLocalAudioStream', {muted}) + return RtcEngine._callMethod('muteLocalAudioStream', {muted}) } /** @@ -743,7 +747,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Receive the specified remote user’s audio stream. */ muteRemoteAudioStream(uid: number, muted: boolean): Promise { - return AgoraRtcEngineModule.callMethod('muteRemoteAudioStream', {uid, muted}) + return RtcEngine._callMethod('muteRemoteAudioStream', {uid, muted}) } /** @@ -760,7 +764,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param scenario Sets the audio application scenarios. Under different audio scenarios, the device uses different volume tracks, i.e. either the in-call volume or the media volume. */ setAudioProfile(profile: AudioProfile, scenario: AudioScenario): Promise { - return AgoraRtcEngineModule.callMethod('setAudioProfile', {profile, scenario}) + return RtcEngine._callMethod('setAudioProfile', {profile, scenario}) } /** @@ -780,7 +784,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Receive all remote audio streams by default. */ setDefaultMuteAllRemoteAudioStreams(muted: boolean): Promise { - return AgoraRtcEngineModule.callMethod('setDefaultMuteAllRemoteAudioStreams', {muted}) + return RtcEngine._callMethod('setDefaultMuteAllRemoteAudioStreams', {muted}) } /** @@ -812,7 +816,7 @@ export default class RtcEngine implements RtcEngineInterface { * - [`muteAllRemoteVideoStreams`]{@link muteAllRemoteVideoStreams}: Whether to subscribe to and play all remote video streams. */ disableVideo(): Promise { - return AgoraRtcEngineModule.callMethod('disableVideo', null) + return RtcEngine._callMethod('disableVideo') } /** @@ -835,7 +839,7 @@ export default class RtcEngine implements RtcEngineInterface { * When you set `enabled` as `false`, this method does not require a local camera. */ enableLocalVideo(enabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('enableLocalVideo', {enabled}) + return RtcEngine._callMethod('enableLocalVideo', {enabled}) } /** @@ -867,7 +871,7 @@ export default class RtcEngine implements RtcEngineInterface { * - [`muteAllRemoteVideoStreams`]{@link muteAllRemoteVideoStreams}: Whether to subscribe to and play all remote video streams. */ enableVideo(): Promise { - return AgoraRtcEngineModule.callMethod('enableVideo', null) + return RtcEngine._callMethod('enableVideo') } /** @@ -878,7 +882,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Receive all remote video streams. */ muteAllRemoteVideoStreams(muted: boolean): Promise { - return AgoraRtcEngineModule.callMethod('muteAllRemoteVideoStreams', {muted}) + return RtcEngine._callMethod('muteAllRemoteVideoStreams', {muted}) } /** @@ -899,7 +903,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Send the local video stream. */ muteLocalVideoStream(muted: boolean): Promise { - return AgoraRtcEngineModule.callMethod('muteLocalVideoStream', {muted}) + return RtcEngine._callMethod('muteLocalVideoStream', {muted}) } /** @@ -916,7 +920,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Receive a specified remote user’s video stream. */ muteRemoteVideoStream(uid: number, muted: boolean): Promise { - return AgoraRtcEngineModule.callMethod('muteRemoteVideoStream', {uid, muted}) + return RtcEngine._callMethod('muteRemoteVideoStream', {uid, muted}) } /** @@ -933,7 +937,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param options The image enhancement options. */ setBeautyEffectOptions(enabled: boolean, options: BeautyOptions): Promise { - return AgoraRtcEngineModule.callMethod('setBeautyEffectOptions', {enabled, options}) + return RtcEngine._callMethod('setBeautyEffectOptions', {enabled, options}) } /** @@ -952,7 +956,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Receive all remote video streams by default. */ setDefaultMuteAllRemoteVideoStreams(muted: boolean): Promise { - return AgoraRtcEngineModule.callMethod('setDefaultMuteAllRemoteVideoStreams', {muted}) + return RtcEngine._callMethod('setDefaultMuteAllRemoteVideoStreams', {muted}) } /** @@ -966,7 +970,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param config The local video encoder configuration. */ setVideoEncoderConfiguration(config: VideoEncoderConfiguration): Promise { - return AgoraRtcEngineModule.callMethod('setVideoEncoderConfiguration', {config}) + return RtcEngine._callMethod('setVideoEncoderConfiguration', {config}) } /** @@ -981,14 +985,14 @@ export default class RtcEngine implements RtcEngineInterface { * the local video preview remains until you call [`stopPreview`]{@link stopPreview} to disable it. */ startPreview(): Promise { - return AgoraRtcEngineModule.callMethod('startPreview', null) + return RtcEngine._callMethod('startPreview') } /** * Stops the local video preview and the video. */ stopPreview(): Promise { - return AgoraRtcEngineModule.callMethod('stopPreview', null) + return RtcEngine._callMethod('stopPreview') } /** @@ -1001,7 +1005,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param volume Audio mixing volume for local playback. The value ranges between 0 and 100 (default). */ adjustAudioMixingPlayoutVolume(volume: number): Promise { - return AgoraRtcEngineModule.callMethod('adjustAudioMixingPlayoutVolume', {volume}) + return RtcEngine._callMethod('adjustAudioMixingPlayoutVolume', {volume}) } /** @@ -1014,7 +1018,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param volume Audio mixing volume for publishing. The value ranges between 0 and 100 (default). */ adjustAudioMixingPublishVolume(volume: number): Promise { - return AgoraRtcEngineModule.callMethod('adjustAudioMixingPublishVolume', {volume}) + return RtcEngine._callMethod('adjustAudioMixingPublishVolume', {volume}) } /** @@ -1029,7 +1033,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param volume Audio mixing volume. The value ranges between 0 and 100 (default). */ adjustAudioMixingVolume(volume: number): Promise { - return AgoraRtcEngineModule.callMethod('adjustAudioMixingVolume', {volume}) + return RtcEngine._callMethod('adjustAudioMixingVolume', {volume}) } /** @@ -1044,7 +1048,7 @@ export default class RtcEngine implements RtcEngineInterface { * - < 0: Failure. */ getAudioMixingCurrentPosition(): Promise { - return AgoraRtcEngineModule.callMethod('getAudioMixingCurrentPosition', null) + return RtcEngine._callMethod('getAudioMixingCurrentPosition') } /** @@ -1059,7 +1063,7 @@ export default class RtcEngine implements RtcEngineInterface { * - < 0: Failure. */ getAudioMixingDuration(): Promise { - return AgoraRtcEngineModule.callMethod('getAudioMixingDuration', null) + return RtcEngine._callMethod('getAudioMixingDuration') } /** @@ -1072,7 +1076,7 @@ export default class RtcEngine implements RtcEngineInterface { * - < 0: Failure. */ getAudioMixingPlayoutVolume(): Promise { - return AgoraRtcEngineModule.callMethod('getAudioMixingPlayoutVolume', null) + return RtcEngine._callMethod('getAudioMixingPlayoutVolume') } /** @@ -1085,7 +1089,7 @@ export default class RtcEngine implements RtcEngineInterface { * - < 0: Failure. */ getAudioMixingPublishVolume(): Promise { - return AgoraRtcEngineModule.callMethod('getAudioMixingPublishVolume', null) + return RtcEngine._callMethod('getAudioMixingPublishVolume') } /** @@ -1094,7 +1098,7 @@ export default class RtcEngine implements RtcEngineInterface { * Call this method when you are in a channel. */ pauseAudioMixing(): Promise { - return AgoraRtcEngineModule.callMethod('pauseAudioMixing', null) + return RtcEngine._callMethod('pauseAudioMixing') } /** @@ -1103,7 +1107,7 @@ export default class RtcEngine implements RtcEngineInterface { * Call this method when you are in a channel. */ resumeAudioMixing(): Promise { - return AgoraRtcEngineModule.callMethod('resumeAudioMixing', null) + return RtcEngine._callMethod('resumeAudioMixing') } /** @@ -1122,7 +1126,7 @@ export default class RtcEngine implements RtcEngineInterface { * The greater the absolute value of this parameter, the higher or lower the pitch of the local music file. */ setAudioMixingPitch(pitch: number): Promise { - return AgoraRtcEngineModule.callMethod('setAudioMixingPitch', {pitch}) + return RtcEngine._callMethod('setAudioMixingPitch', {pitch}) } /** @@ -1130,7 +1134,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param pos The playback starting position (ms) of the audio mixing file. */ setAudioMixingPosition(pos: number): Promise { - return AgoraRtcEngineModule.callMethod('setAudioMixingPosition', {pos}) + return RtcEngine._callMethod('setAudioMixingPosition', {pos}) } /** @@ -1174,7 +1178,7 @@ export default class RtcEngine implements RtcEngineInterface { * - -1: Infinite playback loops. */ startAudioMixing(filePath: string, loopback: boolean, replace: boolean, cycle: number): Promise { - return AgoraRtcEngineModule.callMethod('startAudioMixing', {filePath, loopback, replace, cycle}) + return RtcEngine._callMethod('startAudioMixing', {filePath, loopback, replace, cycle}) } /** @@ -1183,7 +1187,7 @@ export default class RtcEngine implements RtcEngineInterface { * Call this method when you are in a channel. */ stopAudioMixing(): Promise { - return AgoraRtcEngineModule.callMethod('stopAudioMixing', null) + return RtcEngine._callMethod('stopAudioMixing') } /** @@ -1196,14 +1200,14 @@ export default class RtcEngine implements RtcEngineInterface { * - < 0: Failure. */ getEffectsVolume(): Promise { - return AgoraRtcEngineModule.callMethod('getEffectsVolume', null) + return RtcEngine._callMethod('getEffectsVolume') } /** * Pauses all audio effects. */ pauseAllEffects(): Promise { - return AgoraRtcEngineModule.callMethod('pauseAllEffects', null) + return RtcEngine._callMethod('pauseAllEffects') } /** @@ -1211,7 +1215,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param soundId ID of the audio effect. Each audio effect has a unique ID. */ pauseEffect(soundId: number): Promise { - return AgoraRtcEngineModule.callMethod('pauseEffect', {soundId}) + return RtcEngine._callMethod('pauseEffect', {soundId}) } /** @@ -1246,7 +1250,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: The locally played audio effect is not published to the Agora Cloud and the remote users cannot hear it. */ playEffect(soundId: number, filePath: string, loopCount: number, pitch: number, pan: number, gain: number, publish: Boolean): Promise { - return AgoraRtcEngineModule.callMethod('playEffect', {soundId, filePath, loopCount, pitch, pan, gain, publish}) + return RtcEngine._callMethod('playEffect', {soundId, filePath, loopCount, pitch, pan, gain, publish}) } /** @@ -1264,14 +1268,14 @@ export default class RtcEngine implements RtcEngineInterface { * @param filePath Absolute path of the audio effect file. */ preloadEffect(soundId: number, filePath: string): Promise { - return AgoraRtcEngineModule.callMethod('preloadEffect', {soundId, filePath}) + return RtcEngine._callMethod('preloadEffect', {soundId, filePath}) } /** * Resumes playing all audio effects. */ resumeAllEffects(): Promise { - return AgoraRtcEngineModule.callMethod('resumeAllEffects', null) + return RtcEngine._callMethod('resumeAllEffects') } /** @@ -1279,7 +1283,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param soundId ID of the audio effect. Each audio effect has a unique ID. */ resumeEffect(soundId: number): Promise { - return AgoraRtcEngineModule.callMethod('resumeEffect', {soundId}) + return RtcEngine._callMethod('resumeEffect', {soundId}) } /** @@ -1287,7 +1291,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param volume Volume of the audio effects. The value ranges between 0.0 and 100.0 (default). */ setEffectsVolume(volume: number): Promise { - return AgoraRtcEngineModule.callMethod('setEffectsVolume', {volume}) + return RtcEngine._callMethod('setEffectsVolume', {volume}) } /** @@ -1296,14 +1300,14 @@ export default class RtcEngine implements RtcEngineInterface { * @param volume Volume of the audio effect. The value ranges between 0.0 and 100.0 (default). */ setVolumeOfEffect(soundId: number, volume: number): Promise { - return AgoraRtcEngineModule.callMethod('setVolumeOfEffect', {soundId, volume}) + return RtcEngine._callMethod('setVolumeOfEffect', {soundId, volume}) } /** * Stops playing all audio effects. */ stopAllEffects(): Promise { - return AgoraRtcEngineModule.callMethod('stopAllEffects', null) + return RtcEngine._callMethod('stopAllEffects') } /** @@ -1317,7 +1321,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param soundId ID of the specified audio effect. Each audio effect has a unique ID. */ stopEffect(soundId: number): Promise { - return AgoraRtcEngineModule.callMethod('stopEffect', {soundId}) + return RtcEngine._callMethod('stopEffect', {soundId}) } /** @@ -1325,7 +1329,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param soundId ID of the audio effect. Each audio effect has a unique ID. */ unloadEffect(soundId: number): Promise { - return AgoraRtcEngineModule.callMethod('unloadEffect', {soundId}) + return RtcEngine._callMethod('unloadEffect', {soundId}) } /** @@ -1338,7 +1342,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param voiceChanger The local voice changer option. */ setLocalVoiceChanger(voiceChanger: AudioVoiceChanger): Promise { - return AgoraRtcEngineModule.callMethod('setLocalVoiceChanger', {voiceChanger}) + return RtcEngine._callMethod('setLocalVoiceChanger', {voiceChanger}) } /** @@ -1349,7 +1353,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param bandGain Sets the gain of each band (dB). The value ranges between -15 and 15. The default value is 0. */ setLocalVoiceEqualization(bandFrequency: AudioEqualizationBandFrequency, bandGain: number): Promise { - return AgoraRtcEngineModule.callMethod('setLocalVoiceEqualization', {bandFrequency, bandGain}) + return RtcEngine._callMethod('setLocalVoiceEqualization', {bandFrequency, bandGain}) } /** @@ -1358,7 +1362,7 @@ export default class RtcEngine implements RtcEngineInterface { * The lower the value, the lower the voice pitch. The default value is 1.0 (no change to the local voice pitch). */ setLocalVoicePitch(pitch: number): Promise { - return AgoraRtcEngineModule.callMethod('setLocalVoicePitch', {pitch}) + return RtcEngine._callMethod('setLocalVoicePitch', {pitch}) } /** @@ -1375,7 +1379,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param value The local voice reverberation value. */ setLocalVoiceReverb(reverbKey: AudioReverbType, value: number): Promise { - return AgoraRtcEngineModule.callMethod('setLocalVoiceReverb', {reverbKey, value}) + return RtcEngine._callMethod('setLocalVoiceReverb', {reverbKey, value}) } /** @@ -1390,7 +1394,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param preset The local voice reverberation preset. */ setLocalVoiceReverbPreset(preset: AudioReverbPreset): Promise { - return AgoraRtcEngineModule.callMethod('setLocalVoiceReverbPreset', {preset}) + return RtcEngine._callMethod('setLocalVoiceReverbPreset', {preset}) } /** @@ -1404,7 +1408,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: Disable stereo panning. */ enableSoundPositionIndication(enabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('enableSoundPositionIndication', {enabled}) + return RtcEngine._callMethod('enableSoundPositionIndication', {enabled}) } /** @@ -1431,7 +1435,7 @@ export default class RtcEngine implements RtcEngineInterface { * The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain. */ setRemoteVoicePosition(uid: number, pan: number, gain: number): Promise { - return AgoraRtcEngineModule.callMethod('setRemoteVoicePosition', {uid, pan, gain}) + return RtcEngine._callMethod('setRemoteVoicePosition', {uid, pan, gain}) } /** @@ -1453,7 +1457,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: Disable transcoding. */ addPublishStreamUrl(url: string, transcodingEnabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('addPublishStreamUrl', {url, transcodingEnabled}) + return RtcEngine._callMethod('addPublishStreamUrl', {url, transcodingEnabled}) } /** @@ -1471,7 +1475,7 @@ export default class RtcEngine implements RtcEngineInterface { * The URL address must not contain special characters, such as Chinese language characters. */ removePublishStreamUrl(url: string): Promise { - return AgoraRtcEngineModule.callMethod('removePublishStreamUrl', {url}) + return RtcEngine._callMethod('removePublishStreamUrl', {url}) } /** @@ -1491,7 +1495,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param transcoding Sets the CDN live audio/video transcoding settings. */ setLiveTranscoding(transcoding: LiveTranscoding): Promise { - return AgoraRtcEngineModule.callMethod('setLiveTranscoding', {transcoding}) + return RtcEngine._callMethod('setLiveTranscoding', {transcoding}) } /** @@ -1517,7 +1521,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param channelMediaRelayConfiguration The configuration of the media stream relay. */ startChannelMediaRelay(channelMediaRelayConfiguration: ChannelMediaRelayConfiguration): Promise { - return AgoraRtcEngineModule.callMethod('startChannelMediaRelay', {channelMediaRelayConfiguration}) + return RtcEngine._callMethod('startChannelMediaRelay', {channelMediaRelayConfiguration}) } /** @@ -1534,7 +1538,7 @@ export default class RtcEngine implements RtcEngineInterface { * You can leave the channel by calling [`leaveChannel`]{@link leaveChannel}, and the media stream relay automatically stops. */ stopChannelMediaRelay(): Promise { - return AgoraRtcEngineModule.callMethod('stopChannelMediaRelay', null) + return RtcEngine._callMethod('stopChannelMediaRelay') } /** @@ -1553,7 +1557,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param channelMediaRelayConfiguration The media stream relay configuration */ updateChannelMediaRelay(channelMediaRelayConfiguration: ChannelMediaRelayConfiguration): Promise { - return AgoraRtcEngineModule.callMethod('updateChannelMediaRelay', {channelMediaRelayConfiguration}) + return RtcEngine._callMethod('updateChannelMediaRelay', {channelMediaRelayConfiguration}) } /** @@ -1564,7 +1568,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: The speakerphone is not enabled, and the audio plays from devices other than the speakerphone. For example, the headset or earpiece. */ isSpeakerphoneEnabled(): Promise { - return AgoraRtcEngineModule.callMethod('isSpeakerphoneEnabled', null) + return RtcEngine._callMethod('isSpeakerphoneEnabled') } /** @@ -1593,7 +1597,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Route the audio to the earpiece. If a headset is plugged in, the audio is routed to the headset. */ setDefaultAudioRoutetoSpeakerphone(defaultToSpeaker: boolean): Promise { - return AgoraRtcEngineModule.callMethod('setDefaultAudioRoutetoSpeakerphone', {defaultToSpeaker}) + return RtcEngine._callMethod('setDefaultAudioRoutetoSpeakerphone', {defaultToSpeaker}) } /** @@ -1613,7 +1617,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: Route the audio to the earpiece. If the headset is plugged in, the audio is routed to the headset. */ setEnableSpeakerphone(enabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('setEnableSpeakerphone', {enabled}) + return RtcEngine._callMethod('setEnableSpeakerphone', {enabled}) } /** @@ -1623,7 +1627,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Disable. */ enableInEarMonitoring(enabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('enableInEarMonitoring', {enabled}) + return RtcEngine._callMethod('enableInEarMonitoring', {enabled}) } /** @@ -1631,7 +1635,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param volume Sets the volume of the in-ear monitor. The value ranges between 0 and 100 (default). */ setInEarMonitoringVolume(volume: number): Promise { - return AgoraRtcEngineModule.callMethod('setInEarMonitoringVolume', {volume}) + return RtcEngine._callMethod('setInEarMonitoringVolume', {volume}) } /** @@ -1645,7 +1649,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Single-stream mode. */ enableDualStreamMode(enabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('enableDualStreamMode', {enabled}) + return RtcEngine._callMethod('enableDualStreamMode', {enabled}) } /** @@ -1655,7 +1659,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param streamType Sets the default video-stream type. */ setRemoteDefaultVideoStreamType(streamType: VideoStreamType): Promise { - return AgoraRtcEngineModule.callMethod('setRemoteDefaultVideoStreamType', {streamType}) + return RtcEngine._callMethod('setRemoteDefaultVideoStreamType', {streamType}) } /** @@ -1677,7 +1681,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param streamType Sets the video-stream type. */ setRemoteVideoStreamType(uid: number, streamType: VideoStreamType): Promise { - return AgoraRtcEngineModule.callMethod('setRemoteVideoStreamType', {uid, streamType}) + return RtcEngine._callMethod('setRemoteVideoStreamType', {uid, streamType}) } /** @@ -1698,7 +1702,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param option Sets the fallback option for the locally published video stream. */ setLocalPublishFallbackOption(option: StreamFallbackOptions): Promise { - return AgoraRtcEngineModule.callMethod('setLocalPublishFallbackOption', {option}) + return RtcEngine._callMethod('setLocalPublishFallbackOption', {option}) } /** @@ -1714,7 +1718,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param option Sets the fallback option for the remotely subscribed video stream. */ setRemoteSubscribeFallbackOption(option: StreamFallbackOptions): Promise { - return AgoraRtcEngineModule.callMethod('setRemoteSubscribeFallbackOption', {option}) + return RtcEngine._callMethod('setRemoteSubscribeFallbackOption', {option}) } /** @@ -1731,14 +1735,14 @@ export default class RtcEngine implements RtcEngineInterface { * @param userPriority The priority of the remote user. */ setRemoteUserPriority(uid: number, userPriority: UserPriority): Promise { - return AgoraRtcEngineModule.callMethod('setRemoteUserPriority', {uid, userPriority}) + return RtcEngine._callMethod('setRemoteUserPriority', {uid, userPriority}) } /** * Disables the network connection quality test. */ disableLastmileTest(): Promise { - return AgoraRtcEngineModule.callMethod('disableLastmileTest', null) + return RtcEngine._callMethod('disableLastmileTest') } /** @@ -1762,7 +1766,7 @@ export default class RtcEngine implements RtcEngineInterface { * After you join the channel, whether you have called [`disableLastmileTest`]{@link disableLastmileTest} or not, the SDK automatically stops consuming the bandwidth. */ enableLastmileTest(): Promise { - return AgoraRtcEngineModule.callMethod('enableLastmileTest', null) + return RtcEngine._callMethod('enableLastmileTest') } /** @@ -1781,7 +1785,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param intervalInSeconds The time interval (s) between when you speak and when the recording plays back. */ startEchoTest(intervalInSeconds: number): Promise { - return AgoraRtcEngineModule.callMethod('startEchoTest', {intervalInSeconds}) + return RtcEngine._callMethod('startEchoTest', {intervalInSeconds}) } /** @@ -1806,21 +1810,21 @@ export default class RtcEngine implements RtcEngineInterface { * @param config The configurations of the last-mile network probe test. */ startLastmileProbeTest(config: LastmileProbeConfig): Promise { - return AgoraRtcEngineModule.callMethod('startLastmileProbeTest', {config}) + return RtcEngine._callMethod('startLastmileProbeTest', {config}) } /** * Stops the audio call test. */ stopEchoTest(): Promise { - return AgoraRtcEngineModule.callMethod('stopEchoTest', null) + return RtcEngine._callMethod('stopEchoTest') } /** * Stops the last-mile network probe test. */ stopLastmileProbeTest(): Promise { - return AgoraRtcEngineModule.callMethod('stopLastmileProbeTest', null) + return RtcEngine._callMethod('stopLastmileProbeTest') } /** @@ -1834,7 +1838,7 @@ export default class RtcEngine implements RtcEngineInterface { * Call this method before the [`joinChannel`]{@link joinChannel} method. */ registerMediaMetadataObserver(): Promise { - return AgoraRtcEngineModule.callMethod('registerMediaMetadataObserver', null) + return RtcEngine._callMethod('registerMediaMetadataObserver') } /** @@ -1843,7 +1847,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param metadata The metadata to be sent. */ sendMetadata(metadata: string): Promise { - return AgoraRtcEngineModule.callMethod('sendMetadata', {metadata}) + return RtcEngine._callMethod('sendMetadata', {metadata}) } /** @@ -1852,14 +1856,14 @@ export default class RtcEngine implements RtcEngineInterface { * @param size Buffer size of the sent or received metadata. */ setMaxMetadataSize(size: number): Promise { - return AgoraRtcEngineModule.callMethod('setMaxMetadataSize', {size}) + return RtcEngine._callMethod('setMaxMetadataSize', {size}) } /** * Unregisters the metadata observer. */ unregisterMediaMetadataObserver(): Promise { - return AgoraRtcEngineModule.callMethod('unregisterMediaMetadataObserver', null) + return RtcEngine._callMethod('unregisterMediaMetadataObserver') } /** @@ -1896,14 +1900,14 @@ export default class RtcEngine implements RtcEngineInterface { * @param options The options of the watermark image to be added. */ addVideoWatermark(watermarkUrl: string, options: WatermarkOptions): Promise { - return AgoraRtcEngineModule.callMethod('addVideoWatermark', {watermarkUrl, options}) + return RtcEngine._callMethod('addVideoWatermark', {watermarkUrl, options}) } /** * Removes the watermark image from the video stream added by [`addVideoWatermark`]{@link addVideoWatermark}. */ clearVideoWatermarks(): Promise { - return AgoraRtcEngineModule.callMethod('clearVideoWatermarks', null) + return RtcEngine._callMethod('clearVideoWatermarks') } /** @@ -1926,7 +1930,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param config Configurations of built-in encryption schemas. See [`EncryptionConfig`]{@link EncryptionConfig}. */ enableEncryption(enabled: boolean, config: EncryptionConfig): Promise { - return AgoraRtcEngineModule.callMethod('enableEncryption', {enabled, config}); + return RtcEngine._callMethod('enableEncryption', {enabled, config}); } /** @@ -1948,7 +1952,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param encryptionMode Sets the encryption mode. */ setEncryptionMode(encryptionMode: EncryptionMode): Promise { - return AgoraRtcEngineModule.callMethod('setEncryptionMode', {encryptionMode}) + return RtcEngine._callMethod('setEncryptionMode', {encryptionMode}) } /** @@ -1968,7 +1972,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param secret The encryption password. */ setEncryptionSecret(secret: string): Promise { - return AgoraRtcEngineModule.callMethod('setEncryptionSecret', {secret}) + return RtcEngine._callMethod('setEncryptionSecret', {secret}) } /** @@ -1992,7 +1996,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param quality The audio recording quality. */ startAudioRecording(filePath: string, sampleRate: AudioSampleRateType, quality: AudioRecordingQuality): Promise { - return AgoraRtcEngineModule.callMethod('startAudioRecording', {filePath, sampleRate, quality}) + return RtcEngine._callMethod('startAudioRecording', {filePath, sampleRate, quality}) } /** @@ -2004,7 +2008,7 @@ export default class RtcEngine implements RtcEngineInterface { * else, the recording automatically stops when you call [`leaveChannel`]{@link leaveChannel}. */ stopAudioRecording(): Promise { - return AgoraRtcEngineModule.callMethod('stopAudioRecording', null) + return RtcEngine._callMethod('stopAudioRecording') } /** @@ -2034,7 +2038,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param config The `LiveInjectStreamConfig` object which contains the configuration information for the added voice or video stream. */ addInjectStreamUrl(url: string, config: LiveInjectStreamConfig): Promise { - return AgoraRtcEngineModule.callMethod('addInjectStreamUrl', {url, config}) + return RtcEngine._callMethod('addInjectStreamUrl', {url, config}) } /** @@ -2047,7 +2051,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param url HTTP/HTTPS URL address of the added stream to be removed. */ removeInjectStreamUrl(url: string): Promise { - return AgoraRtcEngineModule.callMethod('removeInjectStreamUrl', {url}) + return RtcEngine._callMethod('removeInjectStreamUrl', {url}) } /** @@ -2064,7 +2068,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Disable face detection. */ enableFaceDetection(enable: boolean): Promise { - return AgoraRtcEngineModule.callMethod('enableFaceDetection', {enable}) + return RtcEngine._callMethod('enableFaceDetection', {enable}) } /** @@ -2073,7 +2077,7 @@ export default class RtcEngine implements RtcEngineInterface { * @returns The maximum camera zoom factor. */ getCameraMaxZoomFactor(): Promise { - return AgoraRtcEngineModule.callMethod('getCameraMaxZoomFactor', null) + return RtcEngine._callMethod('getCameraMaxZoomFactor') } /** @@ -2085,7 +2089,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: The device does not support the camera auto-face focus function. */ isCameraAutoFocusFaceModeSupported(): Promise { - return AgoraRtcEngineModule.callMethod('isCameraAutoFocusFaceModeSupported', null) + return RtcEngine._callMethod('isCameraAutoFocusFaceModeSupported') } /** @@ -2097,7 +2101,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: The device does not support the camera exposure function. */ isCameraExposurePositionSupported(): Promise { - return AgoraRtcEngineModule.callMethod('isCameraExposurePositionSupported', null) + return RtcEngine._callMethod('isCameraExposurePositionSupported') } /** @@ -2109,7 +2113,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: The device does not support the camera manual focus function. */ isCameraFocusSupported(): Promise { - return AgoraRtcEngineModule.callMethod('isCameraFocusSupported', null) + return RtcEngine._callMethod('isCameraFocusSupported') } /** @@ -2121,7 +2125,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: The device does not the support camera flash function. */ isCameraTorchSupported(): Promise { - return AgoraRtcEngineModule.callMethod('isCameraTorchSupported', null) + return RtcEngine._callMethod('isCameraTorchSupported') } /** @@ -2133,7 +2137,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: The device does not support the camera zoom function. */ isCameraZoomSupported(): Promise { - return AgoraRtcEngineModule.callMethod('isCameraZoomSupported', null) + return RtcEngine._callMethod('isCameraZoomSupported') } /** @@ -2144,7 +2148,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: (Default) Disable the camera auto-face focus function. */ setCameraAutoFocusFaceModeEnabled(enabled: boolean): Promise { - return AgoraRtcEngineModule.callMethod('setCameraAutoFocusFaceModeEnabled', {enabled}) + return RtcEngine._callMethod('setCameraAutoFocusFaceModeEnabled', {enabled}) } /** @@ -2168,7 +2172,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param config The camera capturer configuration. */ setCameraCapturerConfiguration(config: CameraCapturerConfiguration): Promise { - return AgoraRtcEngineModule.callMethod('setCameraCapturerConfiguration', {config}) + return RtcEngine._callMethod('setCameraCapturerConfiguration', {config}) } /** @@ -2180,7 +2184,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param positionYinView The vertical coordinate of the touch point in the view. */ setCameraExposurePosition(positionXinView: number, positionYinView: number): Promise { - return AgoraRtcEngineModule.callMethod('setCameraExposurePosition', {positionXinView, positionYinView}) + return RtcEngine._callMethod('setCameraExposurePosition', {positionXinView, positionYinView}) } /** @@ -2192,7 +2196,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param positionY The vertical coordinate of the touch point in the view. */ setCameraFocusPositionInPreview(positionX: number, positionY: number): Promise { - return AgoraRtcEngineModule.callMethod('setCameraFocusPositionInPreview', {positionX, positionY}) + return RtcEngine._callMethod('setCameraFocusPositionInPreview', {positionX, positionY}) } /** @@ -2202,7 +2206,7 @@ export default class RtcEngine implements RtcEngineInterface { * - `false`: Disable the camera flash function. */ setCameraTorchOn(isOn: boolean): Promise { - return AgoraRtcEngineModule.callMethod('setCameraTorchOn', {isOn}) + return RtcEngine._callMethod('setCameraTorchOn', {isOn}) } /** @@ -2210,14 +2214,14 @@ export default class RtcEngine implements RtcEngineInterface { * @param factor Sets the camera zoom factor. The value ranges between 1.0 and the maximum zoom supported by the device. */ setCameraZoomFactor(factor: number): Promise { - return AgoraRtcEngineModule.callMethod('setCameraZoomFactor', {factor}) + return RtcEngine._callMethod('setCameraZoomFactor', {factor}) } /** * Switches between front and rear cameras. */ switchCamera(): Promise { - return AgoraRtcEngineModule.callMethod('switchCamera', null) + return RtcEngine._callMethod('switchCamera') } /** @@ -2242,7 +2246,7 @@ export default class RtcEngine implements RtcEngineInterface { * - < 0: Failure. The error code is related to the integer displayed in [Error Codes]{@link ErrorCode}. */ createDataStream(reliable: boolean, ordered: boolean): Promise { - return AgoraRtcEngineModule.callMethod('createDataStream', {reliable, ordered}) + return RtcEngine._callMethod('createDataStream', {reliable, ordered}) } /** @@ -2267,7 +2271,7 @@ export default class RtcEngine implements RtcEngineInterface { * @param message Sent data. */ sendStreamMessage(streamId: number, message: string): Promise { - return AgoraRtcEngineModule.callMethod('sendStreamMessage', {streamId, message}) + return RtcEngine._callMethod('sendStreamMessage', {streamId, message}) } }