From fc9dd70fd32402f5eed281b4007ffd3aacaf51e0 Mon Sep 17 00:00:00 2001 From: HUI <15215604969@163.com> Date: Wed, 27 Jan 2021 20:48:41 +0800 Subject: [PATCH] feat: support 3.3.0 for TS --- android/build.gradle | 2 +- .../AgoraExample.xcodeproj/project.pbxproj | 14 +- .../src/examples/advanced/MultiChannel.tsx | 5 +- .../src/examples/basic/JoinChannelAudio.tsx | 10 +- .../src/examples/basic/JoinChannelVideo.tsx | 5 +- example/src/examples/basic/StringUid.tsx | 10 +- react-native-agora.podspec | 2 +- src/common/Classes.ts | 123 ++++++++++++- src/common/Enums.ts | 139 ++++++++++++++- src/common/RtcChannel.native.ts | 28 +++ src/common/RtcEngine.native.ts | 162 ++++++++++++++++-- src/common/RtcEvents.ts | 27 +++ 12 files changed, 500 insertions(+), 27 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index c58fca2e9..69d6046f5 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -128,7 +128,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion') dependencies { // noinspection GradleDynamicVersion api 'com.facebook.react:react-native:+' - api "io.agora.rtc:full-sdk:3.2.1" + api "io.agora.rtc:full-sdk:3.3.0" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" } diff --git a/example/ios/AgoraExample.xcodeproj/project.pbxproj b/example/ios/AgoraExample.xcodeproj/project.pbxproj index 77cf996d3..17be20d11 100644 --- a/example/ios/AgoraExample.xcodeproj/project.pbxproj +++ b/example/ios/AgoraExample.xcodeproj/project.pbxproj @@ -202,17 +202,21 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-AgoraExample/Pods-AgoraExample-frameworks.sh", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraRtcKit.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/Agorafdkaac.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/Agoraffmpeg.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraSoundTouch.framework", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraAIDenoiseExtension/AgoraAIDenoiseExtension.framework/AgoraAIDenoiseExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcKit/AgoraRtcKit.framework/AgoraRtcKit", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/Agoraffmpeg/Agoraffmpeg.framework/Agoraffmpeg", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraCore/AgoraCore.framework/AgoraCore", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraSoundTouch/AgoraSoundTouch.framework/AgoraSoundTouch", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/Agorafdkaac/Agorafdkaac.framework/Agorafdkaac", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraAIDenoiseExtension.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraRtcKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agorafdkaac.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agoraffmpeg.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraCore.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraSoundTouch.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agorafdkaac.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/example/src/examples/advanced/MultiChannel.tsx b/example/src/examples/advanced/MultiChannel.tsx index fff9c9b75..ca426f2cb 100644 --- a/example/src/examples/advanced/MultiChannel.tsx +++ b/example/src/examples/advanced/MultiChannel.tsx @@ -13,6 +13,7 @@ import RtcEngine, { ChannelProfile, ClientRole, RtcChannel, + RtcEngineConfig, RtcLocalView, RtcRemoteView, VideoRemoteState, @@ -56,7 +57,9 @@ export default class MultiChannel extends Component<{}, State, any> { } _initEngine = async () => { - this._engine = await RtcEngine.create(config.appId); + this._engine = await RtcEngine.createWithConfig( + new RtcEngineConfig(config.appId) + ); await this._engine.enableVideo(); await this._engine.startPreview(); diff --git a/example/src/examples/basic/JoinChannelAudio.tsx b/example/src/examples/basic/JoinChannelAudio.tsx index f9ee6d185..720685071 100644 --- a/example/src/examples/basic/JoinChannelAudio.tsx +++ b/example/src/examples/basic/JoinChannelAudio.tsx @@ -8,7 +8,11 @@ import { Platform, } from 'react-native'; -import RtcEngine, { ChannelProfile, ClientRole } from 'react-native-agora'; +import RtcEngine, { + ChannelProfile, + ClientRole, + RtcEngineConfig, +} from 'react-native-agora'; const config = require('../../../agora.config.json'); @@ -41,7 +45,9 @@ export default class JoinChannelAudio extends Component<{}, State, any> { } _initEngine = async () => { - this._engine = await RtcEngine.create(config.appId); + this._engine = await RtcEngine.createWithConfig( + new RtcEngineConfig(config.appId) + ); this._addListeners(); await this._engine.enableAudio(); diff --git a/example/src/examples/basic/JoinChannelVideo.tsx b/example/src/examples/basic/JoinChannelVideo.tsx index 67e96fe19..bda544a72 100644 --- a/example/src/examples/basic/JoinChannelVideo.tsx +++ b/example/src/examples/basic/JoinChannelVideo.tsx @@ -13,6 +13,7 @@ import { import RtcEngine, { ChannelProfile, ClientRole, + RtcEngineConfig, RtcLocalView, RtcRemoteView, } from 'react-native-agora'; @@ -50,7 +51,9 @@ export default class JoinChannelAudio extends Component<{}, State, any> { } _initEngine = async () => { - this._engine = await RtcEngine.create(config.appId); + this._engine = await RtcEngine.createWithConfig( + new RtcEngineConfig(config.appId) + ); this._addListeners(); await this._engine.enableVideo(); diff --git a/example/src/examples/basic/StringUid.tsx b/example/src/examples/basic/StringUid.tsx index 85b5a953e..d6d676e4d 100644 --- a/example/src/examples/basic/StringUid.tsx +++ b/example/src/examples/basic/StringUid.tsx @@ -1,7 +1,11 @@ import React, { Component } from 'react'; import { Button, StyleSheet, TextInput, View } from 'react-native'; -import RtcEngine, { ChannelProfile, ClientRole } from 'react-native-agora'; +import RtcEngine, { + ChannelProfile, + ClientRole, + RtcEngineConfig, +} from 'react-native-agora'; const config = require('../../../agora.config.json'); @@ -32,7 +36,9 @@ export default class StringUid extends Component<{}, State, any> { } _initEngine = async () => { - this._engine = await RtcEngine.create(config.appId); + this._engine = await RtcEngine.createWithConfig( + new RtcEngineConfig(config.appId) + ); this._addListeners(); await this._engine.setChannelProfile(ChannelProfile.LiveBroadcasting); diff --git a/react-native-agora.podspec b/react-native-agora.podspec index 2fbbd0ea2..f2f9dab79 100644 --- a/react-native-agora.podspec +++ b/react-native-agora.podspec @@ -20,5 +20,5 @@ Pod::Spec.new do |s| s.swift_version = "4.0" s.dependency "React" - s.dependency "AgoraRtcEngine_iOS", "3.2.1" + s.dependency "AgoraRtcEngine_iOS", "3.3.0" end diff --git a/src/common/Classes.ts b/src/common/Classes.ts index babfb5f4b..f4fcdf62a 100644 --- a/src/common/Classes.ts +++ b/src/common/Classes.ts @@ -1,14 +1,17 @@ import type { + AreaCode, AudienceLatencyLevelType, AudioChannel, AudioCodecProfileType, AudioSampleRateType, CameraCaptureOutputPreference, CameraDirection, + CaptureBrightnessLevelType, DegradationPreference, EncryptionMode, LastmileProbeResultState, LighteningContrastLevel, + LogLevel, NetworkQuality, VideoCodecProfileType, VideoCodecType, @@ -846,6 +849,14 @@ export class CameraCapturerConfiguration { * The camera capturer configuration. */ preference: CameraCaptureOutputPreference; + /** + * Camera Capture Width + */ + captureWidth?: number; + /** + * Camera Capture Height + */ + captureHeight?: number; /** * The camera direction. */ @@ -853,10 +864,18 @@ export class CameraCapturerConfiguration { constructor( preference: CameraCaptureOutputPreference, - cameraDirection: CameraDirection + cameraDirection: CameraDirection, + params?: { + captureWidth?: number; + captureHeight?: number; + } ) { this.preference = preference; this.cameraDirection = cameraDirection; + if (params) { + this.captureWidth = params.captureWidth; + this.captureHeight = params.captureHeight; + } } } @@ -1207,6 +1226,10 @@ export interface LocalVideoStats { * @since v3.1.2. */ captureFrameRate: number; + /** + * The capture brightness level type. + */ + captureBrightnessLevel: CaptureBrightnessLevelType; } /** @@ -1268,6 +1291,14 @@ export interface RemoteAudioStats { * */ publishDuration: number; + /** + * Experience quality: #EXPERIENCE_QUALITY_TYPE + */ + qoeQuality: number; + /** + * The reason for poor experience quality: #EXPERIENCE_POOR_REASON + */ + qualityChangedReason: number; } /** @@ -1381,3 +1412,93 @@ export class ClientRoleOptions { this.audienceLatencyLevel = audienceLatencyLevel; } } + +/** + * TODO(DOC) + * Definition of LogConfiguration + */ +export class LogConfig { + /** + * The log file path, default is NULL for default log path + */ + filePath?: string; + /** + * The log file size, KB , set -1 to use default log size + */ + fileSize?: number; + /** + * The log level, set LOG_LEVEL_INFO to use default log level + */ + level?: LogLevel; + + constructor(params?: { + filePath?: string; + fileSize?: number; + level?: LogLevel; + }) { + if (params) { + this.filePath = params.filePath; + this.fileSize = params.fileSize; + this.level = params.level; + } + } +} + +/** + * TODO(DOC) + * Data stream config + */ +export class DataStreamConfig { + /** + * syncWithAudio Sets whether or not the recipients receive the data stream sync with current audio stream. + */ + syncWithAudio?: boolean; + /** + * ordered Sets whether or not the recipients receive the data stream in the sent order: + */ + ordered?: boolean; + + constructor(params?: { syncWithAudio?: boolean; ordered?: boolean }) { + if (params) { + this.syncWithAudio = params.syncWithAudio; + this.ordered = params.ordered; + } + } +} + +/** + * TODO(DOC) + * Definition of RtcEngineConfig. + */ +export class RtcEngineConfig { + /** + * The App ID issued to you by Agora. See [How to get the App ID](https://docs.agora.io/en/Agora%20Platform/token#get-an-app-id). + * Only users in apps with the same App ID can join the same channel and communicate with each other. Use an App ID to create only + * one `IRtcEngine` instance. To change your App ID, call `release` to destroy the current `IRtcEngine` instance and then call `createAgoraRtcEngine` + * and `initialize` to create an `IRtcEngine` instance with the new App ID. + */ + appId: string; + /** + * The region for connection. This advanced feature applies to scenarios that have regional restrictions. + * + * For the regions that Agora supports, see #AREA_CODE. After specifying the region, the SDK connects to the Agora servers within that region. + * + * @note The SDK supports specify only one region. + */ + areaCode?: AreaCode; + /** + * The config for custumer set log path, log size and log level + */ + logConfig?: LogConfig; + + constructor( + appId: string, + params?: { areaCode?: AreaCode; logConfig?: LogConfig } + ) { + this.appId = appId; + if (params) { + this.areaCode = params.areaCode; + this.logConfig = params.logConfig; + } + } +} diff --git a/src/common/Enums.ts b/src/common/Enums.ts index dc16f0ae9..968486738 100644 --- a/src/common/Enums.ts +++ b/src/common/Enums.ts @@ -606,9 +606,9 @@ export enum CameraCaptureOutputPreference { */ Preview = 2, /** - * 3: Internal use only + * 3: Capture Dimensions determined by user */ - Unkown = 3, + Manual = 3, } /** @@ -858,6 +858,10 @@ export enum ConnectionChangedReason { * [`Reconnecting`]{@link ConnectionStateType.Reconnecting} */ KeepAliveTimeout = 14, + /** + * 15: In cloud proxy mode, the proxy server connection interrupted. + */ + ProxyServerInterrupted = 15, } /** @@ -1165,6 +1169,10 @@ export enum ErrorCode { * 156: The format of the RTMP or RTMPS stream URL is not supported. Check whether the URL format is correct. */ PublishStreamFormatNotSuppported = 156, + /** + * 157: The App lack necessary library file. Check whether the dynamic library is loaded. + */ + ModuleNotFound = 157, /** * 1001: Fails to load the media engine. */ @@ -1402,6 +1410,14 @@ export enum LocalVideoStreamError { * 5: The local video encoding fails. */ EncodeFailure = 5, + /** + * 6: Capture InBackground. + */ + CaptureInBackground = 6, + /** + * 7: Capture MultipleForegroundApps. + */ + CaptureMultipleForegroundApps = 7, } /** @@ -2623,6 +2639,11 @@ export enum VoiceBeautifierPreset { */ ChatBeautifierVitality = 0x01010300, + /** + * TODO(DOC) + */ + SINGING_BEAUTIFIER = 0x01020100, + /** * A more vigorous voice. */ @@ -2682,3 +2703,117 @@ export enum AudienceLatencyLevelType { */ UltraLowLatency = 2, } + +/** + * TODO(DOC) + */ +export enum LogLevel { + /** + * 0: Do not output any log information. + */ + None = 0x0000, + /** + * 0x000f: Output CRITICAL, ERROR, WARNING, and INFO level log information. + * We recommend setting your log filter as this level. + */ + Info = 0x0001, + /** + * 0x000e: Outputs CRITICAL, ERROR, and WARNING level log information. + */ + Warn = 0x0002, + /** + * 0x000c: Outputs CRITICAL and ERROR level log information. + */ + Error = 0x0004, + /** + * 0x0008: Outputs CRITICAL level log information. + */ + Fatal = 0x0008, +} + +/** + * TODO(DOC) + */ +export enum CaptureBrightnessLevelType { + Invalid = -1, + Normal = 0, + Bright = 1, + Dark = 2, +} + +/** + * The reason why the super-resolution algorithm is not successfully enabled. + */ +export enum SuperResolutionStateReason { + /** + * 0: The super-resolution algorithm is successfully enabled. + */ + Success = 0, + /** + * 1: The origin resolution of the remote video is beyond the range where the super-resolution algorithm can be applied. + */ + StreamOverLimitation = 1, + /** + * 2: Another user is already using the super-resolution algorithm. + */ + UserCountOverLimitation = 2, + /** + * 3: The device does not support the super-resolution algorithm. + */ + DeviceNotSupported = 3, +} + +/** + * TODO(DOC) + */ +export enum UploadErrorReason { + Success = 0, + NetError = 1, + ServerError = 2, +} + +/** + * TODO(DOC) + * Cloud proxy transport type + */ +export enum CloudProxyType { + /** + * no proxy + */ + None = 0, + /** + * udp proxy + */ + UDP = 1, + /** + * tcp proxy + */ + TCP = 2, +} + +/** + * TODO(DOC) + * Experience quality types. + */ +export enum ExperienceQualityType { + /** + * 0: Good experience quality. + */ + Good = 0, + /** + * 1: Bad experience quality. + */ + Bad = 1, +} + +/** + * TODO(DOC) + * The reason for poor experience + */ +export enum ExperiencePoorReason { + None = 0, + RemoteNetworkQualityPoor = 1, + LocalNetworkQualityPoor = 2, + WirelessSignalPoor = 4, + WifiBluetoothCoexist = 8, +} diff --git a/src/common/RtcChannel.native.ts b/src/common/RtcChannel.native.ts index b31c562dd..175a75720 100644 --- a/src/common/RtcChannel.native.ts +++ b/src/common/RtcChannel.native.ts @@ -4,6 +4,7 @@ import type { ChannelMediaOptions, ChannelMediaRelayConfiguration, ClientRoleOptions, + DataStreamConfig, EncryptionConfig, LiveInjectStreamConfig, LiveTranscoding, @@ -431,6 +432,8 @@ export default class RtcChannel implements RtcChannelInterface { /** * Sets whether to receive all remote audio streams by default. * + * @deprecated TODO(DOC) + * * @param muted Determines whether to receive/stop receiving all remote audio streams by default: * - `true`: Stop receiving all remote audio streams by default. * - `false`: (Default) Receive all remote audio streams by default. @@ -465,6 +468,8 @@ export default class RtcChannel implements RtcChannelInterface { /** * Sets whether to receive all remote video streams by default. * + * @deprecated TODO(DOC) + * * @param muted Determines whether to receive/stop receiving all remote video streams by default: * - `true`: Stop receiving all remote video streams by default. * - `false`: (Default) Receive all remote video streams by default. @@ -473,6 +478,15 @@ export default class RtcChannel implements RtcChannelInterface { return this._callMethod('setDefaultMuteAllRemoteVideoStreams', { muted }); } + /** + * TODO(DOC) + * @param uid + * @param enable + */ + enableRemoteSuperResolution(uid: number, enable: boolean): Promise { + return this._callMethod('enableRemoteSuperResolution', { uid, enable }); + } + /** * Sets the sound position of a remote user. * @@ -847,6 +861,8 @@ export default class RtcChannel implements RtcChannelInterface { /** * Creates a data stream. * + * @deprecated TODO(DOC) + * * Each user can create up to five data streams during the life cycle of the [`RtcChannel`]{@link RtcChannel} instance. * * **Note** @@ -869,6 +885,14 @@ export default class RtcChannel implements RtcChannelInterface { return this._callMethod('createDataStream', { reliable, ordered }); } + /** + * TODO(DOC) + * @param config + */ + createDataStreamWithConfig(config: DataStreamConfig): Promise { + return this._callMethod('createDataStream', { config }); + } + /** * Sends the data stream message. * @@ -957,6 +981,8 @@ interface RtcVideoInterface { muteAllRemoteVideoStreams(muted: boolean): Promise; setDefaultMuteAllRemoteVideoStreams(muted: boolean): Promise; + + enableRemoteSuperResolution(uid: number, enable: boolean): Promise; } /** @@ -1053,5 +1079,7 @@ interface RtcInjectStreamInterface { interface RtcStreamMessageInterface { createDataStream(reliable: boolean, ordered: boolean): Promise; + createDataStreamWithConfig(config: DataStreamConfig): Promise; + sendStreamMessage(streamId: number, message: string): Promise; } diff --git a/src/common/RtcEngine.native.ts b/src/common/RtcEngine.native.ts index 1b57efb5d..228b33982 100644 --- a/src/common/RtcEngine.native.ts +++ b/src/common/RtcEngine.native.ts @@ -1,19 +1,22 @@ import { NativeEventEmitter, NativeModules } from 'react-native'; -import type { +import { BeautyOptions, CameraCapturerConfiguration, + ChannelMediaOptions, ChannelMediaRelayConfiguration, ClientRoleOptions, + DataStreamConfig, EncryptionConfig, LastmileProbeConfig, LiveInjectStreamConfig, LiveTranscoding, + RtcEngineConfig, UserInfo, VideoEncoderConfiguration, WatermarkOptions, } from './Classes'; -import { +import type { AreaCode, AudioEffectPreset, AudioEqualizationBandFrequency, @@ -27,6 +30,7 @@ import { AudioVoiceChanger, ChannelProfile, ClientRole, + CloudProxyType, ConnectionStateType, EncryptionMode, LogFilter, @@ -97,9 +101,25 @@ export default class RtcEngine implements RtcEngineInterface { } } + /** + * TODO(DOC) + */ + static async getSdkVersion(): Promise { + return RtcEngine._callMethod('getSdkVersion'); + } + + /** + * TODO(DOC) + */ + static async getErrorDescription(error: number): Promise { + return RtcEngine._callMethod('getErrorDescription', { error }); + } + /** * Creates an [`RtcEngine`]{@link RtcEngine} instance. * + * @deprecated + * * Unless otherwise specified, all the methods provided by the [`RtcEngine`]{@link RtcEngine} class are executed asynchronously. Agora recommends calling these methods in the same thread. * * **Note** @@ -116,12 +136,14 @@ export default class RtcEngine implements RtcEngineInterface { * - 101(InvalidAppId): The app ID is invalid. Check if it is in the correct format. */ static async create(appId: string): Promise { - return RtcEngine.createWithAreaCode(appId, AreaCode.GLOB); + return RtcEngine.createWithConfig(new RtcEngineConfig(appId)); } /** * Creates an [`RtcEngine`]{@link RtcEngine} instance. * + * @deprecated + * * Unless otherwise specified, all the methods provided by the [`RtcEngine`]{@link RtcEngine} class are executed asynchronously. Agora recommends calling these methods in the same thread. * * **Note** @@ -146,8 +168,16 @@ export default class RtcEngine implements RtcEngineInterface { appId: string, areaCode: AreaCode ): Promise { + return RtcEngine.createWithConfig(new RtcEngineConfig(appId, { areaCode })); + } + + /** + * TODO(DOC) + * @param config + */ + static async createWithConfig(config: RtcEngineConfig) { if (engine) return engine; - await RtcEngine._callMethod('create', { appId, areaCode, appType: 8 }); + await RtcEngine._callMethod('create', { config, appType: 8 }); engine = new RtcEngine(); return engine; } @@ -325,6 +355,7 @@ export default class RtcEngine implements RtcEngineInterface { * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". * @param optionalInfo Additional information about the channel. This parameter can be set as null or contain channel related information. Other users in the channel do not receive this message. * @param optionalUid (Optional) User ID. A 32-bit unsigned integer with a value ranging from 1 to (2^32-1). `optionalUid` must be unique. If `optionalUid` is not assigned (or set to `0`), the SDK assigns and returns `uid` in the [`JoinChannelSuccess`]{@link RtcEngineEvents.JoinChannelSuccess} callback. + * @param options TODO(DOC) * Your app must record and maintain the returned uid since the SDK does not do so. * * The uid is represented as a 32-bit unsigned integer in the SDK. Since unsigned integers are not supported by Java, the uid is handled as a 32-bit signed integer and larger numbers are interpreted as negative numbers in Java. @@ -344,13 +375,15 @@ export default class RtcEngine implements RtcEngineInterface { token: string | undefined | null, channelName: string, optionalInfo: string | undefined | null, - optionalUid: number + optionalUid: number, + options?: ChannelMediaOptions ): Promise { return RtcEngine._callMethod('joinChannel', { token, channelName, optionalInfo, optionalUid, + options, }); } @@ -377,6 +410,7 @@ export default class RtcEngine implements RtcEngineInterface { * - All numeric characters: 0 to 9. * - The space character. * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param options TODO(DOC) * * @returns * - 0(NoError): Success. @@ -390,9 +424,14 @@ export default class RtcEngine implements RtcEngineInterface { */ switchChannel( token: string | undefined | null, - channelName: string + channelName: string, + options?: ChannelMediaOptions ): Promise { - return RtcEngine._callMethod('switchChannel', { token, channelName }); + return RtcEngine._callMethod('switchChannel', { + token, + channelName, + options, + }); } /** @@ -522,6 +561,9 @@ export default class RtcEngine implements RtcEngineInterface { /** * Sets the log files that the SDK outputs. * + * TODO(DOC) + * @deprecated + * * By default, the SDK outputs five log files, `agorasdk.log`, `agorasdk_1.log`, `agorasdk_2.log`, `agorasdk_3.log`, `agorasdk_4.log`, each with a default size of 1024 KB. * These log files are encoded in UTF-8. The SDK writes the latest logs in `agorasdk.log`. When `agorasdk.log` is full, the SDK deletes the log file with the * earliest modification time among the other four, renames `agorasdk.log` to the name of the deleted log file, and creates a new `agorasdk.log` to record latest logs. @@ -540,6 +582,9 @@ export default class RtcEngine implements RtcEngineInterface { /** * Sets the output log level of the SDK. * + * TODO(DOC) + * @deprecated + * * You can use one or a combination of the filters. The log level follows the sequence of `Off`, `Critical`, `Error`, `Warning`, `Info`, and `Debug`. * Choose a level to see the logs preceding that level. For example, if you set the log level to `Warning`, you see the logs within levels `Critical`, `Error`, and `Warning`. * @@ -552,6 +597,9 @@ export default class RtcEngine implements RtcEngineInterface { /** * Sets the size (KB) of a log file that the SDK outputs. * + * TODO(DOC) + * @deprecated + * * By default, the SDK outputs five log files, `agorasdk.log`, `agorasdk_1.log`, `agorasdk_2.log`, `agorasdk_3.log`, `agorasdk_4.log`, each with a default size of 1024 KB. These log files are encoded in UTF-8. The SDK writes the latest logs in `agorasdk.log`. * When `agorasdk.log` is full, the SDK deletes the log file with the earliest modification time among the other four, renames `agorasdk.log` to the name of the deleted log file, and create a new `agorasdk.log` to record latest logs. * @param fileSizeInKBytes The size (KB) of a log file. The default value is 1024 KB. If you set `fileSizeInKByte` to 1024 KB, the SDK outputs @@ -627,6 +675,7 @@ export default class RtcEngine implements RtcEngineInterface { * - All numeric characters: 0 to 9. * - The space character. * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param options TODO(DOC) * * @returns * - 0(NoError): Success. @@ -639,12 +688,14 @@ export default class RtcEngine implements RtcEngineInterface { joinChannelWithUserAccount( token: string | undefined | null, channelName: string, - userAccount: string + userAccount: string, + options?: ChannelMediaOptions ): Promise { return RtcEngine._callMethod('joinChannelWithUserAccount', { token, channelName, userAccount, + options, }); } @@ -911,6 +962,9 @@ export default class RtcEngine implements RtcEngineInterface { /** * Sets whether to receive all remote audio streams by default. * + * TODO(DOC) + * @deprecated + * * You can call this method either before or after joining a channel. * If you call `setDefaultMuteAllRemoteAudioStreams(true)` after joining a channel, you will not receive the audio streams of any subsequent user. * @@ -1095,9 +1149,24 @@ export default class RtcEngine implements RtcEngineInterface { }); } + /** + * TODO(DOC) + * @param uid + * @param enable + */ + enableRemoteSuperResolution(uid: number, enable: boolean): Promise { + return RtcEngine._callMethod('enableRemoteSuperResolution', { + uid, + enable, + }); + } + /** * Sets whether to receive all remote video streams by default. * + * TODO(DOC) + * @deprecated + * * You can call this method either before or after joining a channel. * If you call `setDefaultMuteAllRemoteVideoStreams(true)` after joining a channel, you will not receive the video stream of any subsequent user. * @@ -2526,6 +2595,9 @@ export default class RtcEngine implements RtcEngineInterface { /** * Creates a data stream. * + * TODO(DOC) + * @deprecated + * * Each user can create up to five data streams during the lifecycle of the [`RtcEngine`]{@link RtcEngine}. * * **Note** @@ -2548,6 +2620,14 @@ export default class RtcEngine implements RtcEngineInterface { return RtcEngine._callMethod('createDataStream', { reliable, ordered }); } + /** + * TODO(DOC) + * @param config + */ + createDataStreamWithConfig(config: DataStreamConfig): Promise { + return RtcEngine._callMethod('createDataStream', { config }); + } + /** * Sends data stream messages. * @@ -2626,6 +2706,29 @@ export default class RtcEngine implements RtcEngineInterface { return RtcEngine._callMethod('getNativeHandle'); } + /** + * TODO(DOC) + * @param enabled + */ + enableDeepLearningDenoise(enabled: boolean): Promise { + return RtcEngine._callMethod('enableDeepLearningDenoise', { enabled }); + } + + /** + * TODO(DOC) + * @param proxyType + */ + setCloudProxy(proxyType: CloudProxyType): Promise { + return RtcEngine._callMethod('setCloudProxy', { proxyType }); + } + + /** + * TODO(DOC) + */ + uploadLogFile(): Promise { + return RtcEngine._callMethod('uploadLogFile'); + } + /** * Sets parameters for SDK preset audio effects. * @@ -2702,6 +2805,24 @@ export default class RtcEngine implements RtcEngineInterface { }); } + /** + * TODO(DOC) + * @param preset + * @param param1 + * @param param2 + */ + setVoiceBeautifierParameters( + preset: VoiceBeautifierPreset, + param1: number, + param2: number + ): Promise { + return RtcEngine._callMethod('setVoiceBeautifierParameters', { + preset, + param1, + param2, + }); + } + /** * Sets an SDK preset audio effect. * @@ -2807,12 +2928,14 @@ interface RtcEngineInterface token: string | undefined | null, channelName: string, optionalInfo: string | undefined | null, - optionalUid: number + optionalUid: number, + options?: ChannelMediaOptions ): Promise; switchChannel( token: string | undefined | null, - channelName: string + channelName: string, + options?: ChannelMediaOptions ): Promise; leaveChannel(): Promise; @@ -2846,6 +2969,12 @@ interface RtcEngineInterface setParameters(parameters: string): Promise; getNativeHandle(): Promise; + + enableDeepLearningDenoise(enabled: boolean): Promise; + + setCloudProxy(proxyType: CloudProxyType): Promise; + + uploadLogFile(): Promise; } /** @@ -2857,7 +2986,8 @@ interface RtcUserInfoInterface { joinChannelWithUserAccount( token: string, channelName: string, - userAccount: string + userAccount: string, + options?: ChannelMediaOptions ): Promise; getUserInfoByUserAccount(userAccount: string): Promise; @@ -2931,6 +3061,8 @@ interface RtcVideoInterface { enabled: boolean, options: BeautyOptions ): Promise; + + enableRemoteSuperResolution(uid: number, enable: boolean): Promise; } /** @@ -3036,6 +3168,12 @@ interface RtcVoiceChangerInterface { param1: number, param2: number ): Promise; + + setVoiceBeautifierParameters( + preset: VoiceBeautifierPreset, + param1: number, + param2: number + ): Promise; } /** @@ -3245,5 +3383,7 @@ interface RtcCameraInterface { interface RtcStreamMessageInterface { createDataStream(reliable: boolean, ordered: boolean): Promise; + createDataStreamWithConfig(config: DataStreamConfig): Promise; + sendStreamMessage(streamId: number, message: string): Promise; } diff --git a/src/common/RtcEvents.ts b/src/common/RtcEvents.ts index 28f6f82b0..834c4f8e6 100644 --- a/src/common/RtcEvents.ts +++ b/src/common/RtcEvents.ts @@ -35,6 +35,8 @@ import type { RtmpStreamingState, StreamPublishState, StreamSubscribeState, + SuperResolutionStateReason, + UploadErrorReason, UserOfflineReason, VideoRemoteState, VideoRemoteStateReason, @@ -485,6 +487,16 @@ export type RtmpStreamingEventCallback = * @param eventCode The event code. See [`RtmpStreamingEvent`]{@link RtmpStreamingEvent}. */ (url: string, eventCode: RtmpStreamingEvent) => void; +export type UserSuperResolutionEnabledCallback = + /** + * TODO(DOC) + */ + (uid: number, enabled: boolean, reason: SuperResolutionStateReason) => void; +export type UploadLogResultCallback = + /** + * TODO(DOC) + */ + (requestId: string, success: boolean, reason: UploadErrorReason) => void; /** * Callbacks. @@ -1385,6 +1397,16 @@ export interface RtcEngineEvents { * @event RtmpStreamingEvent */ RtmpStreamingEvent: RtmpStreamingEventCallback; + + /** + * TODO(DOC) + */ + UserSuperResolutionEnabled: UserSuperResolutionEnabledCallback; + + /** + * TODO(DOC) + */ + UploadLogResult: UploadLogResultCallback; } /** @@ -1737,4 +1759,9 @@ export interface RtcChannelEvents { * @event RtmpStreamingEvent */ RtmpStreamingEvent: RtmpStreamingEventCallback; + + /** + * TODO(DOC) + */ + UserSuperResolutionEnabled: UserSuperResolutionEnabledCallback; }