From 1133c71d211e059c500b0cc8b4813c8c112edcf3 Mon Sep 17 00:00:00 2001 From: HUI Date: Tue, 8 Mar 2022 20:10:12 +0800 Subject: [PATCH] feat: support 3.6.2 --- android/build.gradle | 2 +- .../AgoraExample.xcodeproj/project.pbxproj | 40 +++--- react-native-agora.podspec | 2 +- src/common/Classes.ts | 129 ++++++++++++++++- src/common/Enums.ts | 123 ++++++++++++++++ src/common/RtcChannel.native.ts | 39 +++++ src/common/RtcEngine.native.ts | 133 +++++++++++++++++- src/common/RtcEvents.ts | 72 ++++++++++ 8 files changed, 515 insertions(+), 25 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index c862f1dfe..6d3181f2d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -127,7 +127,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion') dependencies { // noinspection GradleDynamicVersion api 'com.facebook.react:react-native:+' - api 'com.github.agorabuilder:native-full-sdk:3.5.2' + api 'com.github.agorabuilder:native-full-sdk:3.6.2' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } diff --git a/example/ios/AgoraExample.xcodeproj/project.pbxproj b/example/ios/AgoraExample.xcodeproj/project.pbxproj index 49d858ea4..986b3efac 100644 --- a/example/ios/AgoraExample.xcodeproj/project.pbxproj +++ b/example/ios/AgoraExample.xcodeproj/project.pbxproj @@ -231,32 +231,40 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-AgoraExample/Pods-AgoraExample-frameworks.sh", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraAIDenoiseExtension.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraCIExtension.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraCore.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraDav1dExtension.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraFDExtension.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraJNDExtension.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraRtcKit.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraSoundTouch.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/AgoraVideoSegmentationExtension.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/Agorafdkaac.framework", - "${PODS_ROOT}/AgoraRtcEngine_iOS/Agoraffmpeg.framework", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/AINS/AgoraAIDenoiseExtension.framework/AgoraAIDenoiseExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/AV1Dec/AgoraDav1dExtension.framework/AgoraDav1dExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/ContentInspect/AgoraCIExtension.framework/AgoraCIExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/FullAudioFormat/AgoraFullAudioFormatExtension.framework/AgoraFullAudioFormatExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/JND/AgoraJNDExtension.framework/AgoraJNDExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/ROIEnc/AgoraFDExtension.framework/AgoraFDExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/ReplayKit/AgoraReplayKitExtension.framework/AgoraReplayKitExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/RtcBasic/AgoraRtcKit.framework/AgoraRtcKit", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/RtcBasic/AgoraCore.framework/AgoraCore", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/RtcBasic/Agoraffmpeg.framework/Agoraffmpeg", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/RtcBasic/Agorafdkaac.framework/Agorafdkaac", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/RtcBasic/AgoraSoundTouch.framework/AgoraSoundTouch", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/SuperResolution/AgoraSuperResolutionExtension.framework/AgoraSuperResolutionExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/VideoPreprocess/AgoraVideoProcessExtension.framework/AgoraVideoProcessExtension", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/AgoraRtcEngine_iOS/VirtualBackground/AgoraVideoSegmentationExtension.framework/AgoraVideoSegmentationExtension", "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraAIDenoiseExtension.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraCIExtension.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraCore.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraDav1dExtension.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraFDExtension.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraCIExtension.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraFullAudioFormatExtension.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraJNDExtension.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraFDExtension.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraReplayKitExtension.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraRtcKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraCore.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agoraffmpeg.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agorafdkaac.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraSoundTouch.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraSuperResolutionExtension.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraVideoProcessExtension.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AgoraVideoSegmentationExtension.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agorafdkaac.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Agoraffmpeg.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework", ); runOnlyForDeploymentPostprocessing = 0; diff --git a/react-native-agora.podspec b/react-native-agora.podspec index dfe78a246..8c95a70e0 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.5.2" + s.dependency "AgoraRtcEngine_iOS", "3.6.2" end diff --git a/src/common/Classes.ts b/src/common/Classes.ts index f5fe3d22a..9860539ab 100644 --- a/src/common/Classes.ts +++ b/src/common/Classes.ts @@ -26,6 +26,7 @@ import type { VideoStreamType, VirtualBackgroundBlurDegree, VirtualBackgroundSourceType, + VideoCodecTypeForStream, } from './Enums'; /** @@ -347,18 +348,24 @@ export class BeautyOptions { * The default value is 0.1. This parameter adjusts the red saturation level. */ rednessLevel?: number; + /** + * TODO(doc) + */ + sharpnessLevel?: number; constructor(params?: { lighteningContrastLevel?: LighteningContrastLevel; lighteningLevel?: number; smoothnessLevel?: number; rednessLevel?: number; + sharpnessLevel?: number; }) { if (params) { this.lighteningContrastLevel = params.lighteningContrastLevel; this.lighteningLevel = params.lighteningLevel; this.smoothnessLevel = params.smoothnessLevel; this.rednessLevel = params.rednessLevel; + this.sharpnessLevel = params.sharpnessLevel; } } } @@ -387,6 +394,14 @@ export class AgoraImage { * Height of the image on the broadcasting video. */ height?: number; + /** + * TODO(doc) + */ + zOrder?: number; + /** + * TODO(doc) + */ + alpha?: number; constructor( url: string, @@ -395,6 +410,8 @@ export class AgoraImage { y?: number; width?: number; height?: number; + zOrder?: number; + alpha?: number; } ) { this.url = url; @@ -403,6 +420,8 @@ export class AgoraImage { this.y = params.y; this.width = params.width; this.height = params.height; + this.zOrder = params.zOrder; + this.alpha = params.alpha; } } } @@ -551,11 +570,19 @@ export class LiveTranscoding { * the audience of the CDN live publishing stream can see it. */ watermark?: AgoraImage; + /** + * TODO(doc) + */ + watermarkList?: AgoraImage[]; /** * The background image added to the CDN live publishing stream. Once a background image is added, * the audience of the CDN live publishing stream can see it. */ backgroundImage?: AgoraImage; + /** + * TODO(doc) + */ + backgroundImageList?: AgoraImage[]; /** * Self-defined audio-sample rate: AudioSampleRateType. */ @@ -583,6 +610,10 @@ export class LiveTranscoding { * Video codec profile type: VideoCodecProfileType. Set it as BASELINE, MAIN, or HIGH (default). If you set this parameter to other values, Agora adjusts it to the default value HIGH. */ videoCodecProfile?: VideoCodecProfileType; + /** + * TODO(doc) + */ + videoCodecType?: VideoCodecTypeForStream; /** * Sets the background color. */ @@ -591,10 +622,18 @@ export class LiveTranscoding { * Reserved property. Extra user-defined information to send the Supplemental Enhancement Information (SEI) for the H.264/H.265 video stream to the CDN live client. Maximum length: 4096 Bytes. */ userConfigExtraInfo?: string; + /** + * TODO(doc) + */ + metadata?: string; /** * An TranscodingUser object managing the user layout configuration in the CDN live stream. Agora supports a maximum of 17 transcoding users in a CDN live stream channel. */ transcodingUsers: TranscodingUser[]; + /** + * TODO(doc) + */ + advancedFeatures?: Map; constructor( transcodingUsers: TranscodingUser[], @@ -606,14 +645,19 @@ export class LiveTranscoding { lowLatency?: boolean; videoGop?: number; watermark?: AgoraImage; + watermarkList?: AgoraImage[]; backgroundImage?: AgoraImage; + backgroundImageList?: AgoraImage[]; audioSampleRate?: AudioSampleRateType; audioBitrate?: number; audioChannels?: AudioChannel; audioCodecProfile?: AudioCodecProfileType; videoCodecProfile?: VideoCodecProfileType; + videoCodecType?: VideoCodecTypeForStream; backgroundColor?: Color; userConfigExtraInfo?: string; + metadata?: string; + advancedFeatures?: Map; } ) { if (params) { @@ -624,14 +668,19 @@ export class LiveTranscoding { this.lowLatency = params.lowLatency; this.videoGop = params.videoGop; this.watermark = params.watermark; + this.watermarkList = params.watermarkList; this.backgroundImage = params.backgroundImage; + this.backgroundImageList = params.backgroundImageList; this.audioSampleRate = params.audioSampleRate; this.audioBitrate = params.audioBitrate; this.audioChannels = params.audioChannels; this.audioCodecProfile = params.audioCodecProfile; this.videoCodecProfile = params.videoCodecProfile; + this.videoCodecType = params.videoCodecType; this.backgroundColor = params.backgroundColor; this.userConfigExtraInfo = params.userConfigExtraInfo; + this.metadata = params.metadata; + this.advancedFeatures = params.advancedFeatures; } this.transcodingUsers = transcodingUsers; } @@ -1731,13 +1780,9 @@ export class AudioRecordingConfiguration { */ recordingSampleRate?: AudioSampleRateType; /** - * The degree of blurring applied to the custom background image. See [`VirtualBackgroundBlurDegree`]{@link VirtualBackgroundBlurDegree}. - * - * @note This parameter takes effect only when the type of the custom background image is `blur`. - * - * @since v3.5.2 + * TODO(doc) */ - blur_degree?: VirtualBackgroundBlurDegree; + recordingChannel?: number; constructor( filePath: string, @@ -1745,6 +1790,7 @@ export class AudioRecordingConfiguration { recordingQuality?: AudioRecordingQuality; recordingPosition?: AudioRecordingPosition; recordingSampleRate?: AudioSampleRateType; + recordingChannel?: number; } ) { this.filePath = filePath; @@ -1752,6 +1798,7 @@ export class AudioRecordingConfiguration { this.recordingQuality = params.recordingQuality; this.recordingPosition = params.recordingPosition; this.recordingSampleRate = params.recordingSampleRate; + this.recordingChannel = params.recordingChannel; } } } @@ -1864,3 +1911,73 @@ export class EchoTestConfiguration { } } } + +/** + * TODO(doc) + */ +export class MediaRecorderConfiguration { + storagePath: string; + containerFormat: number; + streamType: number; + maxDurationMs: number; + recorderInfoUpdateInterval: number; + + constructor( + storagePath: string, + containerFormat: number, + streamType: number, + maxDurationMs: number, + recorderInfoUpdateInterval: number + ) { + this.storagePath = storagePath; + this.containerFormat = containerFormat; + this.streamType = streamType; + this.maxDurationMs = maxDurationMs; + this.recorderInfoUpdateInterval = recorderInfoUpdateInterval; + } +} + +export class ContentInspectModule { + type?: number; + interval?: number; +} + +export class ContentInspectConfig { + extraInfo?: string; + modules?: ContentInspectModule[]; + moduleCount?: number; +} + +export class LocalAccessPointConfiguration { + ipList?: string[]; + domainList?: string[]; + verifyDomainName?: string; + mode?: number; +} + +export class VideoDenoiserOptions { + denoiserMode?: number; + denoiserLevel?: number; +} + +export class LowLightEnhanceOptions { + lowlightEnhanceMode?: number; + lowlightEnhanceLevel?: number; +} + +export class ColorEnhanceOptions { + strengthLevel?: number; + skinProtectLevel?: number; +} + +export interface RecorderInfo { + fileName: string; + durationMs: number; + fileSize: number; +} + +export interface WlAccStats { + e2eDelayPercent: number; + frozenRatioPercent: number; + lossRatePercent: number; +} diff --git a/src/common/Enums.ts b/src/common/Enums.ts index dfd702340..d6ca989cb 100644 --- a/src/common/Enums.ts +++ b/src/common/Enums.ts @@ -44,6 +44,10 @@ export enum AudioCodecProfileType { * 1: HE-AAC, which is the high-efficiency audio codec profile. */ HEAAC = 1, + /** + * TODO(doc) + */ + HE_AAC_V2 = 2, } /** @@ -322,6 +326,10 @@ export enum AudioRecordingQuality { * 2: High quality. For example, the size of an AAC file with a sample rate of 32,000 Hz and a 10-minute recording is approximately 3.75 MB. */ High = 2, + /** + * TODO(doc) + */ + UltraHigh = 3, } /** @@ -969,6 +977,14 @@ export enum ConnectionChangedReason { * 15: In cloud proxy mode, the proxy server connection is interrupted. */ ProxyServerInterrupted = 15, + /** + * TODO(doc) + */ + SameUidLogin = 19, + /** + * TODO(doc) + */ + TooManyBroadcasters = 20, } /** @@ -1454,6 +1470,10 @@ export enum ErrorCode { * This error code is deprecated. */ VcmEncoderSetError = 1603, + /** + * TODO(doc) + */ + AudioBtNoRoute = 1800, } /** @@ -1772,6 +1792,22 @@ export enum RtmpStreamingErrorCode { * 10: The format of the RTMP or RTMPS streaming URL is not supported. Check whether the URL format is correct. */ FormatNotSupported = 10, + /** + * TODO(doc) + */ + NotBroadcaster = 11, + /** + * TODO(doc) + */ + TranscodingNoMixStream = 13, + /** + * TODO(doc) + */ + NetDown = 14, + /** + * TODO(doc) + */ + InvalidAppid = 15, /** * The streaming has been stopped normally. After you call [`removePublishStreamUrl`]{@link RtcEngine.removePublishStreamUrl} to stop streaming, the SDK returns this value. * @@ -1814,6 +1850,10 @@ export enum RtmpStreamingState { * You can also call the [`addPublishStreamUrl`]{@link RtcEngine.addPublishStreamUrl} method to publish the RTMP or RTMPS streaming again. */ Failure = 4, + /** + * TODO(doc) + */ + Disconnecting = 5, } /** @@ -2564,6 +2604,14 @@ export enum RtmpStreamingEvent { * @since v3.4.5 */ UrlAlreadyInUse = 2, + /** + * TODO(doc) + */ + AdvancedFeatureNotSupport = 3, + /** + * TODO(doc) + */ + RequestTooOften = 4, } /** @@ -3186,3 +3234,78 @@ export enum VirtualBackgroundBlurDegree { */ High = 3, } + +/** The video codec type of the output video stream. + + @since v3.2.0 + */ +export enum VideoCodecTypeForStream { + /** 1: (Default) H.264 */ + H264 = 1, + /** 2: H.265 */ + H265 = 2, +} + +/** The proxy type. + + @since v3.6.2 + */ +export enum ProxyType { + /** 0: Reserved for future use. + */ + None = 0, + /** 1: The cloud proxy for the UDP protocol, that is, the Force UDP cloud proxy mode. + In this mode, the SDK always transmits data over UDP. + */ + Udp = 1, + /** 2: The cloud proxy for the TCP (encryption) protocol, that is, the Force TCP cloud proxy mode. + In this mode, the SDK always transmits data over TLS 443. + */ + Tcp = 2, + /** 3: Reserved for future use. + */ + Local = 3, + /** 4: The automatic mode. In this mode, the SDK attempts a direct connection to SD-RTN™ and automatically + switches to TLS 443 if the attempt fails. + */ + TcpAutoFallback = 4, +} + +/** API for future use. */ +export enum ContentInspectResult { + Neutral = 1, + Sexy = 2, + Porn = 3, +} + +/** API for future use. + */ +export enum WlAccReason { + WeakSignal = 0, + + ChannelCongestion = 1, +} + +/** API for future use. + */ +export enum WlAccAction { + CloseToWIFI = 0, + + ConnectSSID = 1, + + Check5G = 2, + + ModifySSID = 3, +} + +/** API for future use. + */ +export enum ClientRoleChangeFailedReason { + TooManyBroadcasters = 1, + + NotAuthorized = 2, + + RequestTimeOut = 3, + + ConnectionFailed = 4, +} diff --git a/src/common/RtcChannel.native.ts b/src/common/RtcChannel.native.ts index 37f310917..da3454b1a 100644 --- a/src/common/RtcChannel.native.ts +++ b/src/common/RtcChannel.native.ts @@ -1156,6 +1156,32 @@ export default class RtcChannel implements RtcChannelInterface { resumeAllChannelMediaRelay(): Promise { return this._callMethod('resumeAllChannelMediaRelay'); } + + setAVSyncSource(channelId: string, uid: number): Promise { + return this._callMethod('setAVSyncSource', { channelId, uid }); + } + + startRtmpStreamWithTranscoding( + url: string, + transcoding: LiveTranscoding + ): Promise { + return this._callMethod('startRtmpStreamWithTranscoding', { + url, + transcoding, + }); + } + + startRtmpStreamWithoutTranscoding(url: string): Promise { + return this._callMethod('startRtmpStreamWithoutTranscoding', { url }); + } + + stopRtmpStream(url: string): Promise { + return this._callMethod('stopRtmpStream', { url }); + } + + updateRtmpTranscoding(transcoding: LiveTranscoding): Promise { + return this._callMethod('updateRtmpTranscoding', { transcoding }); + } } /** @@ -1201,6 +1227,8 @@ interface RtcChannelInterface unpublish(): Promise; getCallId(): Promise; + + setAVSyncSource(channelId: string, uid: number): Promise; } /** @@ -1249,6 +1277,17 @@ interface RtcPublishStreamInterface { addPublishStreamUrl(url: string, transcodingEnabled: boolean): Promise; removePublishStreamUrl(url: string): Promise; + + startRtmpStreamWithoutTranscoding(url: string): Promise; + + startRtmpStreamWithTranscoding( + url: string, + transcoding: LiveTranscoding + ): Promise; + + updateRtmpTranscoding(transcoding: LiveTranscoding): Promise; + + stopRtmpStream(url: string): Promise; } /** diff --git a/src/common/RtcEngine.native.ts b/src/common/RtcEngine.native.ts index 177192493..aa2cc6416 100644 --- a/src/common/RtcEngine.native.ts +++ b/src/common/RtcEngine.native.ts @@ -11,16 +11,21 @@ import { ChannelMediaOptions, ChannelMediaRelayConfiguration, ClientRoleOptions, + ColorEnhanceOptions, + ContentInspectConfig, DataStreamConfig, EchoTestConfiguration, EncryptionConfig, LastmileProbeConfig, LiveInjectStreamConfig, LiveTranscoding, + LowLightEnhanceOptions, + MediaRecorderConfiguration, RhythmPlayerConfig, RtcEngineConfig, RtcEngineContext, UserInfo, + VideoDenoiserOptions, VideoEncoderConfiguration, VirtualBackgroundSource, WatermarkOptions, @@ -3666,6 +3671,85 @@ export default class RtcEngine implements RtcEngineInterface { filePath, }); } + + enableContentInspect( + enabled: boolean, + config: ContentInspectConfig + ): Promise { + return RtcEngine._callMethod('enableContentInspect', { enabled, config }); + } + + enableWirelessAccelerate(enabled: boolean): Promise { + return RtcEngine._callMethod('enableWirelessAccelerate', { enabled }); + } + + setAgoraLibPath(path: string): Promise { + return RtcEngine._callMethod('setAgoraLibPath', { path }); + } + + setColorEnhanceOptions( + enabled: boolean, + options: ColorEnhanceOptions + ): Promise { + return RtcEngine._callMethod('setColorEnhanceOptions', { + enabled, + options, + }); + } + + setLowLightEnhanceOptions( + enabled: boolean, + options: LowLightEnhanceOptions + ): Promise { + return RtcEngine._callMethod('setLowLightEnhanceOptions', { + enabled, + options, + }); + } + + setVideoDenoiserOptions( + enabled: boolean, + options: VideoDenoiserOptions + ): Promise { + return RtcEngine._callMethod('setVideoDenoiserOptions', { + enabled, + options, + }); + } + + startRecording(config: MediaRecorderConfiguration): Promise { + return RtcEngine._callMethod('startRecording', { config }); + } + + startRtmpStreamWithTranscoding( + url: string, + transcoding: LiveTranscoding + ): Promise { + return RtcEngine._callMethod('startRtmpStreamWithTranscoding', { + url, + transcoding, + }); + } + + startRtmpStreamWithoutTranscoding(url: string): Promise { + return RtcEngine._callMethod('startRtmpStreamWithoutTranscoding', { url }); + } + + stopRecording(): Promise { + return RtcEngine._callMethod('stopRecording'); + } + + stopRtmpStream(url: string): Promise { + return RtcEngine._callMethod('stopRtmpStream', { url }); + } + + updateRtmpTranscoding(transcoding: LiveTranscoding): Promise { + return RtcEngine._callMethod('updateRtmpTranscoding', { transcoding }); + } + + setAVSyncSource(channelId: string, uid: number): Promise { + return RtcEngine._callMethod('setAVSyncSource', { channelId, uid }); + } } /** @@ -3692,7 +3776,8 @@ interface RtcEngineInterface RtcAudioRecorderInterface, RtcInjectStreamInterface, RtcCameraInterface, - RtcStreamMessageInterface { + RtcStreamMessageInterface, + RtcMediaRecorderInterface { destroy(): Promise; setChannelProfile(profile: ChannelProfile): Promise; @@ -3759,6 +3844,17 @@ interface RtcEngineInterface ): Promise; takeSnapshot(channel: string, uid: number, filePath: string): Promise; + + enableWirelessAccelerate(enabled: boolean): Promise; + + enableContentInspect( + enabled: boolean, + config: ContentInspectConfig + ): Promise; + + setAgoraLibPath(path: string): Promise; + + setAVSyncSource(channelId: string, uid: number): Promise; } /** @@ -3847,6 +3943,21 @@ interface RtcVideoInterface { ): Promise; enableRemoteSuperResolution(uid: number, enable: boolean): Promise; + + setVideoDenoiserOptions( + enabled: boolean, + options: VideoDenoiserOptions + ): Promise; + + setLowLightEnhanceOptions( + enabled: boolean, + options: LowLightEnhanceOptions + ): Promise; + + setColorEnhanceOptions( + enabled: boolean, + options: ColorEnhanceOptions + ): Promise; } /** @@ -3998,6 +4109,17 @@ interface RtcPublishStreamInterface { addPublishStreamUrl(url: string, transcodingEnabled: boolean): Promise; removePublishStreamUrl(url: string): Promise; + + startRtmpStreamWithoutTranscoding(url: string): Promise; + + startRtmpStreamWithTranscoding( + url: string, + transcoding: LiveTranscoding + ): Promise; + + updateRtmpTranscoding(transcoding: LiveTranscoding): Promise; + + stopRtmpStream(url: string): Promise; } /** @@ -4212,3 +4334,12 @@ interface RtcStreamMessageInterface { sendStreamMessage(streamId: number, message: string): Promise; } + +/** + * @ignore + */ +interface RtcMediaRecorderInterface { + startRecording(config: MediaRecorderConfiguration): Promise; + + stopRecording(): Promise; +} diff --git a/src/common/RtcEvents.ts b/src/common/RtcEvents.ts index 1580b93f3..9a783e520 100644 --- a/src/common/RtcEvents.ts +++ b/src/common/RtcEvents.ts @@ -5,11 +5,13 @@ import type { LastmileProbeResult, LocalAudioStats, LocalVideoStats, + RecorderInfo, Rect, RemoteAudioStats, RemoteVideoStats, RtcStats, UserInfo, + WlAccStats, } from './Classes'; import type { AudioFileInfoError, @@ -44,6 +46,11 @@ import type { VideoRemoteStateReason, VirtualBackgroundSourceStateReason, WarningCode, + ContentInspectResult, + ProxyType, + WlAccAction, + WlAccReason, + ClientRoleChangeFailedReason, } from './Enums'; /** @@ -545,6 +552,47 @@ export type SnapshotTakenCallback = height: number, errCode: number ) => void; +export type ProxyConnectedCallback = + /** + * TODO(doc) + */ + ( + channel: string, + uid: number, + proxyType: ProxyType, + localProxyIp: string, + elapsed: number + ) => void; +export type ClientRoleChangeCallback = + /** + * TODO(doc) + */ + (reason: ClientRoleChangeFailedReason, currentRole: ClientRole) => void; +export type RecorderStateChangedCallback = + /** + * TODO(doc) + */ + (reason: number, state: number) => void; +export type RecorderInfoCallback = + /** + * TODO(doc) + */ + (info: RecorderInfo) => void; +export type ContentInspectResultCallback = + /** + * TODO(doc) + */ + (result: ContentInspectResult) => void; +export type WlAccMessageCallback = + /** + * TODO(doc) + */ + (reason: WlAccReason, action: WlAccAction, wlAccMsg: string) => void; +export type WlAccStatsCallback = + /** + * TODO(doc) + */ + (currentStats: WlAccStats, averageStats: WlAccStats) => void; /** * Callbacks. @@ -1503,6 +1551,20 @@ export interface RtcEngineEvents { * @event SnapshotTaken */ SnapshotTaken: SnapshotTakenCallback; + + RecorderStateChanged: RecorderStateChangedCallback; + + RecorderInfoUpdated: RecorderInfoCallback; + + ProxyConnected: ProxyConnectedCallback; + + ContentInspectResult: ContentInspectResultCallback; + + WlAccMessage: WlAccMessageCallback; + + WlAccStats: WlAccStatsCallback; + + ClientRoleChangeFailed: ClientRoleChangeCallback; } /** @@ -1877,4 +1939,14 @@ export interface RtcChannelEvents { * @event UserSuperResolutionEnabled */ UserSuperResolutionEnabled: UserSuperResolutionEnabledCallback; + + /** + * TODO(doc) + */ + ProxyConnected: ProxyConnectedCallback; + + /** + * TODO(doc) + */ + ClientRoleChangeFailed: ClientRoleChangeCallback; }