diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..155d772 --- /dev/null +++ b/Package.swift @@ -0,0 +1,58 @@ +// swift-tools-version: 5.10 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "AgoraSDK-4.1.1.33", + products: [ + // Products define the executables and libraries a package produces, making them visible to other packages. + .library( + name: "AgoraSDK-4.1.1.33", + targets: [ + "AgoraAiEchoCancellationExtension", + "AgoraAiNoiseSuppressionExtension", + "AgoraAudioBeautyExtension", + "AgoraClearVisionExtension", + "AgoraContentInspectExtension", + "AgoraDav1d", + "AgoraFaceDetectionExtension", + "Agorafdkaac", + "Agoraffmpeg", + "AgoraReplayKitExtension", + "AgoraRtcKit", + "AgoraSoundTouch", + "AgoraSpatialAudioExtension", + "AgoraVideoDecoderExtension", + "AgoraVideoEncoderExtension", + "AgoraVideoQualityAnalyzerExtension", + "AgoraVideoSegmentationExtension", + "video_dec", + "video_enc", + ] + ), + ], + targets: [ + // Targets are the basic building blocks of a package, defining a module or a test suite. + // Targets can depend on other targets in this package and products from dependencies. + .binaryTarget(name: "AgoraAiEchoCancellationExtension", path: "Sources/AgoraAiEchoCancellationExtension.xcframework"), + .binaryTarget(name: "AgoraAiNoiseSuppressionExtension", path: "Sources/AgoraAiNoiseSuppressionExtension.xcframework"), + .binaryTarget(name: "AgoraAudioBeautyExtension", path: "Sources/AgoraAudioBeautyExtension.xcframework"), + .binaryTarget(name: "AgoraClearVisionExtension", path: "Sources/AgoraClearVisionExtension.xcframework"), + .binaryTarget(name: "AgoraContentInspectExtension", path: "Sources/AgoraContentInspectExtension.xcframework"), + .binaryTarget(name: "AgoraDav1d", path: "Sources/AgoraDav1d.xcframework"), + .binaryTarget(name: "AgoraFaceDetectionExtension", path: "Sources/AgoraFaceDetectionExtension.xcframework"), + .binaryTarget(name: "Agorafdkaac", path: "Sources/Agorafdkaac.xcframework"), + .binaryTarget(name: "Agoraffmpeg", path: "Sources/Agoraffmpeg.xcframework"), + .binaryTarget(name: "AgoraReplayKitExtension", path: "Sources/AgoraReplayKitExtension.xcframework"), + .binaryTarget(name: "AgoraRtcKit", path: "Sources/AgoraRtcKit.xcframework"), + .binaryTarget(name: "AgoraSoundTouch", path: "Sources/AgoraSoundTouch.xcframework"), + .binaryTarget(name: "AgoraSpatialAudioExtension", path: "Sources/AgoraSpatialAudioExtension.xcframework"), + .binaryTarget(name: "AgoraVideoDecoderExtension", path: "Sources/AgoraVideoDecoderExtension.xcframework"), + .binaryTarget(name: "AgoraVideoEncoderExtension", path: "Sources/AgoraVideoEncoderExtension.xcframework"), + .binaryTarget(name: "AgoraVideoQualityAnalyzerExtension", path: "Sources/AgoraVideoQualityAnalyzerExtension.xcframework"), + .binaryTarget(name: "AgoraVideoSegmentationExtension", path: "Sources/AgoraVideoSegmentationExtension.xcframework"), + .binaryTarget(name: "video_dec", path: "Sources/video_dec.xcframework"), + .binaryTarget(name: "video_enc", path: "Sources/video_enc.xcframework"), + ] +) diff --git a/Sources/AgoraAiEchoCancellationExtension.xcframework/Info.plist b/Sources/AgoraAiEchoCancellationExtension.xcframework/Info.plist new file mode 100644 index 0000000..3b4f631 --- /dev/null +++ b/Sources/AgoraAiEchoCancellationExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraAiEchoCancellationExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraAiEchoCancellationExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_armv7/AgoraAiEchoCancellationExtension.framework/AgoraAiEchoCancellationExtension b/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_armv7/AgoraAiEchoCancellationExtension.framework/AgoraAiEchoCancellationExtension new file mode 100755 index 0000000..2f58b10 Binary files /dev/null and b/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_armv7/AgoraAiEchoCancellationExtension.framework/AgoraAiEchoCancellationExtension differ diff --git a/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_armv7/AgoraAiEchoCancellationExtension.framework/Info.plist b/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_armv7/AgoraAiEchoCancellationExtension.framework/Info.plist new file mode 100644 index 0000000..ca463a6 Binary files /dev/null and b/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_armv7/AgoraAiEchoCancellationExtension.framework/Info.plist differ diff --git a/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiEchoCancellationExtension.framework/AgoraAiEchoCancellationExtension b/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiEchoCancellationExtension.framework/AgoraAiEchoCancellationExtension new file mode 100755 index 0000000..e95a312 Binary files /dev/null and b/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiEchoCancellationExtension.framework/AgoraAiEchoCancellationExtension differ diff --git a/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiEchoCancellationExtension.framework/Info.plist b/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiEchoCancellationExtension.framework/Info.plist new file mode 100644 index 0000000..ca463a6 Binary files /dev/null and b/Sources/AgoraAiEchoCancellationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiEchoCancellationExtension.framework/Info.plist differ diff --git a/Sources/AgoraAiNoiseSuppressionExtension.xcframework/Info.plist b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/Info.plist new file mode 100644 index 0000000..714b3cb --- /dev/null +++ b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraAiNoiseSuppressionExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraAiNoiseSuppressionExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_armv7/AgoraAiNoiseSuppressionExtension.framework/AgoraAiNoiseSuppressionExtension b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_armv7/AgoraAiNoiseSuppressionExtension.framework/AgoraAiNoiseSuppressionExtension new file mode 100755 index 0000000..abdb646 Binary files /dev/null and b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_armv7/AgoraAiNoiseSuppressionExtension.framework/AgoraAiNoiseSuppressionExtension differ diff --git a/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_armv7/AgoraAiNoiseSuppressionExtension.framework/Info.plist b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_armv7/AgoraAiNoiseSuppressionExtension.framework/Info.plist new file mode 100644 index 0000000..94898f6 Binary files /dev/null and b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_armv7/AgoraAiNoiseSuppressionExtension.framework/Info.plist differ diff --git a/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiNoiseSuppressionExtension.framework/AgoraAiNoiseSuppressionExtension b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiNoiseSuppressionExtension.framework/AgoraAiNoiseSuppressionExtension new file mode 100755 index 0000000..960e53c Binary files /dev/null and b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiNoiseSuppressionExtension.framework/AgoraAiNoiseSuppressionExtension differ diff --git a/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiNoiseSuppressionExtension.framework/Info.plist b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiNoiseSuppressionExtension.framework/Info.plist new file mode 100644 index 0000000..94898f6 Binary files /dev/null and b/Sources/AgoraAiNoiseSuppressionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAiNoiseSuppressionExtension.framework/Info.plist differ diff --git a/Sources/AgoraAudioBeautyExtension.xcframework/Info.plist b/Sources/AgoraAudioBeautyExtension.xcframework/Info.plist new file mode 100644 index 0000000..526f5c8 --- /dev/null +++ b/Sources/AgoraAudioBeautyExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraAudioBeautyExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraAudioBeautyExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_armv7/AgoraAudioBeautyExtension.framework/AgoraAudioBeautyExtension b/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_armv7/AgoraAudioBeautyExtension.framework/AgoraAudioBeautyExtension new file mode 100755 index 0000000..792cf50 Binary files /dev/null and b/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_armv7/AgoraAudioBeautyExtension.framework/AgoraAudioBeautyExtension differ diff --git a/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_armv7/AgoraAudioBeautyExtension.framework/Info.plist b/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_armv7/AgoraAudioBeautyExtension.framework/Info.plist new file mode 100644 index 0000000..e2a22fb Binary files /dev/null and b/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_armv7/AgoraAudioBeautyExtension.framework/Info.plist differ diff --git a/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAudioBeautyExtension.framework/AgoraAudioBeautyExtension b/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAudioBeautyExtension.framework/AgoraAudioBeautyExtension new file mode 100755 index 0000000..6ede1c4 Binary files /dev/null and b/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAudioBeautyExtension.framework/AgoraAudioBeautyExtension differ diff --git a/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAudioBeautyExtension.framework/Info.plist b/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAudioBeautyExtension.framework/Info.plist new file mode 100644 index 0000000..e2a22fb Binary files /dev/null and b/Sources/AgoraAudioBeautyExtension.xcframework/ios-arm64_x86_64-simulator/AgoraAudioBeautyExtension.framework/Info.plist differ diff --git a/Sources/AgoraClearVisionExtension.xcframework/Info.plist b/Sources/AgoraClearVisionExtension.xcframework/Info.plist new file mode 100644 index 0000000..9c800ea --- /dev/null +++ b/Sources/AgoraClearVisionExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraClearVisionExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraClearVisionExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_armv7/AgoraClearVisionExtension.framework/AgoraClearVisionExtension b/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_armv7/AgoraClearVisionExtension.framework/AgoraClearVisionExtension new file mode 100755 index 0000000..b0e6154 Binary files /dev/null and b/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_armv7/AgoraClearVisionExtension.framework/AgoraClearVisionExtension differ diff --git a/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_armv7/AgoraClearVisionExtension.framework/Info.plist b/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_armv7/AgoraClearVisionExtension.framework/Info.plist new file mode 100644 index 0000000..10b80dd Binary files /dev/null and b/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_armv7/AgoraClearVisionExtension.framework/Info.plist differ diff --git a/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraClearVisionExtension.framework/AgoraClearVisionExtension b/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraClearVisionExtension.framework/AgoraClearVisionExtension new file mode 100755 index 0000000..0acbca3 Binary files /dev/null and b/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraClearVisionExtension.framework/AgoraClearVisionExtension differ diff --git a/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraClearVisionExtension.framework/Info.plist b/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraClearVisionExtension.framework/Info.plist new file mode 100644 index 0000000..10b80dd Binary files /dev/null and b/Sources/AgoraClearVisionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraClearVisionExtension.framework/Info.plist differ diff --git a/Sources/AgoraContentInspectExtension.xcframework/Info.plist b/Sources/AgoraContentInspectExtension.xcframework/Info.plist new file mode 100644 index 0000000..2b0f7d7 --- /dev/null +++ b/Sources/AgoraContentInspectExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraContentInspectExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraContentInspectExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_armv7/AgoraContentInspectExtension.framework/AgoraContentInspectExtension b/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_armv7/AgoraContentInspectExtension.framework/AgoraContentInspectExtension new file mode 100755 index 0000000..72db5ef Binary files /dev/null and b/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_armv7/AgoraContentInspectExtension.framework/AgoraContentInspectExtension differ diff --git a/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_armv7/AgoraContentInspectExtension.framework/Info.plist b/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_armv7/AgoraContentInspectExtension.framework/Info.plist new file mode 100644 index 0000000..38c0ee7 Binary files /dev/null and b/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_armv7/AgoraContentInspectExtension.framework/Info.plist differ diff --git a/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_x86_64-simulator/AgoraContentInspectExtension.framework/AgoraContentInspectExtension b/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_x86_64-simulator/AgoraContentInspectExtension.framework/AgoraContentInspectExtension new file mode 100755 index 0000000..28eae27 Binary files /dev/null and b/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_x86_64-simulator/AgoraContentInspectExtension.framework/AgoraContentInspectExtension differ diff --git a/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_x86_64-simulator/AgoraContentInspectExtension.framework/Info.plist b/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_x86_64-simulator/AgoraContentInspectExtension.framework/Info.plist new file mode 100644 index 0000000..38c0ee7 Binary files /dev/null and b/Sources/AgoraContentInspectExtension.xcframework/ios-arm64_x86_64-simulator/AgoraContentInspectExtension.framework/Info.plist differ diff --git a/Sources/AgoraDav1d.xcframework/Info.plist b/Sources/AgoraDav1d.xcframework/Info.plist new file mode 100644 index 0000000..434a95c --- /dev/null +++ b/Sources/AgoraDav1d.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraDav1d.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraDav1d.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraDav1d.xcframework/ios-arm64_armv7/AgoraDav1d.framework/AgoraDav1d b/Sources/AgoraDav1d.xcframework/ios-arm64_armv7/AgoraDav1d.framework/AgoraDav1d new file mode 100644 index 0000000..0b381a8 Binary files /dev/null and b/Sources/AgoraDav1d.xcframework/ios-arm64_armv7/AgoraDav1d.framework/AgoraDav1d differ diff --git a/Sources/AgoraDav1d.xcframework/ios-arm64_armv7/AgoraDav1d.framework/Info.plist b/Sources/AgoraDav1d.xcframework/ios-arm64_armv7/AgoraDav1d.framework/Info.plist new file mode 100644 index 0000000..05d54c7 Binary files /dev/null and b/Sources/AgoraDav1d.xcframework/ios-arm64_armv7/AgoraDav1d.framework/Info.plist differ diff --git a/Sources/AgoraDav1d.xcframework/ios-arm64_x86_64-simulator/AgoraDav1d.framework/AgoraDav1d b/Sources/AgoraDav1d.xcframework/ios-arm64_x86_64-simulator/AgoraDav1d.framework/AgoraDav1d new file mode 100644 index 0000000..8c0131c Binary files /dev/null and b/Sources/AgoraDav1d.xcframework/ios-arm64_x86_64-simulator/AgoraDav1d.framework/AgoraDav1d differ diff --git a/Sources/AgoraDav1d.xcframework/ios-arm64_x86_64-simulator/AgoraDav1d.framework/Info.plist b/Sources/AgoraDav1d.xcframework/ios-arm64_x86_64-simulator/AgoraDav1d.framework/Info.plist new file mode 100644 index 0000000..05d54c7 Binary files /dev/null and b/Sources/AgoraDav1d.xcframework/ios-arm64_x86_64-simulator/AgoraDav1d.framework/Info.plist differ diff --git a/Sources/AgoraFaceDetectionExtension.xcframework/Info.plist b/Sources/AgoraFaceDetectionExtension.xcframework/Info.plist new file mode 100644 index 0000000..95f928d --- /dev/null +++ b/Sources/AgoraFaceDetectionExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraFaceDetectionExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraFaceDetectionExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_armv7/AgoraFaceDetectionExtension.framework/AgoraFaceDetectionExtension b/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_armv7/AgoraFaceDetectionExtension.framework/AgoraFaceDetectionExtension new file mode 100755 index 0000000..74e3ec3 Binary files /dev/null and b/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_armv7/AgoraFaceDetectionExtension.framework/AgoraFaceDetectionExtension differ diff --git a/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_armv7/AgoraFaceDetectionExtension.framework/Info.plist b/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_armv7/AgoraFaceDetectionExtension.framework/Info.plist new file mode 100644 index 0000000..169bdcc Binary files /dev/null and b/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_armv7/AgoraFaceDetectionExtension.framework/Info.plist differ diff --git a/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraFaceDetectionExtension.framework/AgoraFaceDetectionExtension b/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraFaceDetectionExtension.framework/AgoraFaceDetectionExtension new file mode 100755 index 0000000..397b5b7 Binary files /dev/null and b/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraFaceDetectionExtension.framework/AgoraFaceDetectionExtension differ diff --git a/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraFaceDetectionExtension.framework/Info.plist b/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraFaceDetectionExtension.framework/Info.plist new file mode 100644 index 0000000..169bdcc Binary files /dev/null and b/Sources/AgoraFaceDetectionExtension.xcframework/ios-arm64_x86_64-simulator/AgoraFaceDetectionExtension.framework/Info.plist differ diff --git a/Sources/AgoraReplayKitExtension.xcframework/Info.plist b/Sources/AgoraReplayKitExtension.xcframework/Info.plist new file mode 100644 index 0000000..cc48f70 --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraReplayKitExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraReplayKitExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/AgoraReplayKitExtension b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/AgoraReplayKitExtension new file mode 100755 index 0000000..e893928 Binary files /dev/null and b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/AgoraReplayKitExtension differ diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExt.h b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExt.h new file mode 100644 index 0000000..428ea33 --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExt.h @@ -0,0 +1,44 @@ +// +// AgoraSampleHander.h +// BroadCastUI +// +// Created by Agora on 2022/1/25. +// Copyright (c) 2022 Agora IO. All rights reserved. + +#import +#import +typedef enum { + // Failed to connect to the app process, Please call startScreenCapture in the app process. + AgoraReplayKitExtReasonConnectFail = 1, + // Disconnected from the app process. Please Check the APP process exits or not. + AgoraReplayKitExtReasonDisconnect = 2, + // Stopped by the user or the app process. + AgoraReplayKitExtReasonInitiativeStop = 3, +} AgoraReplayKitExtReason; + +@class AgoraReplayKitExt; + +@protocol AgoraReplayKitExtDelegate + +- (void)broadcastFinished:(AgoraReplayKitExt* _Nonnull)broadcast + reason:(AgoraReplayKitExtReason)reason; + +@end + +NS_ASSUME_NONNULL_BEGIN +API_AVAILABLE(ios(11.0)) +NS_SWIFT_NAME(AgoraReplayKitExt) +__attribute__((visibility("default"))) +@interface AgoraReplayKitExt : NSObject + ++ (instancetype)shareInstance; + +- (void)start:(id)delegate; +- (void)stop; +- (void)resume; +- (void)pause; +- (void)pushSampleBuffer:(CMSampleBufferRef)sampleBuffer + withType:(RPSampleBufferType)sampleBufferType; +@end + +NS_ASSUME_NONNULL_END diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExtension.h b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExtension.h new file mode 100644 index 0000000..50801fd --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExtension.h @@ -0,0 +1,15 @@ +// +// AgoraReplayKitExtension.h +// AgoraScreenShare +// +// Created by Agora on 2022/1/25. +// Copyright (c) 2022 Agora IO. All rights reserved. + +#ifndef AgoraReplayKitExtension_h +#define AgoraReplayKitExtension_h + +#import +#import + + +#endif /* AgoraReplayKitExtension_h */ diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitHandler.h b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitHandler.h new file mode 100644 index 0000000..a53371b --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitHandler.h @@ -0,0 +1,14 @@ +// +// SampleHandler.h +// BroadCastUI +// +// Created by Agora on 2022/1/25. +// Copyright (c) 2022 Agora IO. All rights reserved. + +#import + +API_AVAILABLE(ios(11.0)) +__attribute__((visibility("default"))) +@interface AgoraReplayKitHandler : RPBroadcastSampleHandler + +@end diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Info.plist b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Info.plist new file mode 100644 index 0000000..777674b Binary files /dev/null and b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Info.plist differ diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Modules/module.modulemap b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Modules/module.modulemap new file mode 100644 index 0000000..be64143 --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_armv7/AgoraReplayKitExtension.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module AgoraReplayKitExtension { + header "AgoraReplayKitExtension.h" + header "AgoraReplayKitExt.h" + header "AgoraReplayKitHandler.h" + export * +} diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/AgoraReplayKitExtension b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/AgoraReplayKitExtension new file mode 100755 index 0000000..680f7d0 Binary files /dev/null and b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/AgoraReplayKitExtension differ diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExt.h b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExt.h new file mode 100644 index 0000000..428ea33 --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExt.h @@ -0,0 +1,44 @@ +// +// AgoraSampleHander.h +// BroadCastUI +// +// Created by Agora on 2022/1/25. +// Copyright (c) 2022 Agora IO. All rights reserved. + +#import +#import +typedef enum { + // Failed to connect to the app process, Please call startScreenCapture in the app process. + AgoraReplayKitExtReasonConnectFail = 1, + // Disconnected from the app process. Please Check the APP process exits or not. + AgoraReplayKitExtReasonDisconnect = 2, + // Stopped by the user or the app process. + AgoraReplayKitExtReasonInitiativeStop = 3, +} AgoraReplayKitExtReason; + +@class AgoraReplayKitExt; + +@protocol AgoraReplayKitExtDelegate + +- (void)broadcastFinished:(AgoraReplayKitExt* _Nonnull)broadcast + reason:(AgoraReplayKitExtReason)reason; + +@end + +NS_ASSUME_NONNULL_BEGIN +API_AVAILABLE(ios(11.0)) +NS_SWIFT_NAME(AgoraReplayKitExt) +__attribute__((visibility("default"))) +@interface AgoraReplayKitExt : NSObject + ++ (instancetype)shareInstance; + +- (void)start:(id)delegate; +- (void)stop; +- (void)resume; +- (void)pause; +- (void)pushSampleBuffer:(CMSampleBufferRef)sampleBuffer + withType:(RPSampleBufferType)sampleBufferType; +@end + +NS_ASSUME_NONNULL_END diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExtension.h b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExtension.h new file mode 100644 index 0000000..50801fd --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitExtension.h @@ -0,0 +1,15 @@ +// +// AgoraReplayKitExtension.h +// AgoraScreenShare +// +// Created by Agora on 2022/1/25. +// Copyright (c) 2022 Agora IO. All rights reserved. + +#ifndef AgoraReplayKitExtension_h +#define AgoraReplayKitExtension_h + +#import +#import + + +#endif /* AgoraReplayKitExtension_h */ diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitHandler.h b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitHandler.h new file mode 100644 index 0000000..a53371b --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Headers/AgoraReplayKitHandler.h @@ -0,0 +1,14 @@ +// +// SampleHandler.h +// BroadCastUI +// +// Created by Agora on 2022/1/25. +// Copyright (c) 2022 Agora IO. All rights reserved. + +#import + +API_AVAILABLE(ios(11.0)) +__attribute__((visibility("default"))) +@interface AgoraReplayKitHandler : RPBroadcastSampleHandler + +@end diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Info.plist b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Info.plist new file mode 100644 index 0000000..777674b Binary files /dev/null and b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Info.plist differ diff --git a/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Modules/module.modulemap b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Modules/module.modulemap new file mode 100644 index 0000000..be64143 --- /dev/null +++ b/Sources/AgoraReplayKitExtension.xcframework/ios-arm64_x86_64-simulator/AgoraReplayKitExtension.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module AgoraReplayKitExtension { + header "AgoraReplayKitExtension.h" + header "AgoraReplayKitExt.h" + header "AgoraReplayKitHandler.h" + export * +} diff --git a/Sources/AgoraRtcKit.xcframework/Info.plist b/Sources/AgoraRtcKit.xcframework/Info.plist new file mode 100644 index 0000000..48305a1 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraRtcKit.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraRtcKit.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/AgoraRtcKit b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/AgoraRtcKit new file mode 100755 index 0000000..46dfc6b Binary files /dev/null and b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/AgoraRtcKit differ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraAtomicOps.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraAtomicOps.h new file mode 100644 index 0000000..f0c4610 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraAtomicOps.h @@ -0,0 +1,73 @@ +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. +#pragma once + +#if defined(_WIN32) +// clang-format off +// clang formating would change include order. + +// Include WinSock2.h before including to maintain consistency with +// win32.h. To include win32.h directly, it must be broken out into its own +// build target. +#include +#include +// clang-format on +#endif // _WIN32 + +namespace agora { + +class AtomicOps { + public: +#if defined(_WIN32) + // Assumes sizeof(int) == sizeof(LONG), which it is on Win32 and Win64. + static int Increment(volatile int* i) { + return ::InterlockedIncrement(reinterpret_cast(i)); + } + static int Decrement(volatile int* i) { + return ::InterlockedDecrement(reinterpret_cast(i)); + } + static int AcquireLoad(volatile const int* i) { return *i; } + static void ReleaseStore(volatile int* i, int value) { *i = value; } + static int CompareAndSwap(volatile int* i, int old_value, int new_value) { + return ::InterlockedCompareExchange(reinterpret_cast(i), + new_value, old_value); + } + // Pointer variants. + template + static T* AcquireLoadPtr(T* volatile* ptr) { + return *ptr; + } + template + static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) { + return static_cast(::InterlockedCompareExchangePointer( + reinterpret_cast(ptr), new_value, old_value)); + } +#else + static int Increment(volatile int* i) { return __sync_add_and_fetch(i, 1); } + static int Decrement(volatile int* i) { return __sync_sub_and_fetch(i, 1); } + static int AcquireLoad(volatile const int* i) { + return __atomic_load_n(i, __ATOMIC_ACQUIRE); + } + static void ReleaseStore(volatile int* i, int value) { + __atomic_store_n(i, value, __ATOMIC_RELEASE); + } + static int CompareAndSwap(volatile int* i, int old_value, int new_value) { + return __sync_val_compare_and_swap(i, old_value, new_value); + } + // Pointer variants. + template + static T* AcquireLoadPtr(T* volatile* ptr) { + return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); + } + template + static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) { + return __sync_val_compare_and_swap(ptr, old_value, new_value); + } +#endif // _WIN32 +}; + +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraBase.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraBase.h new file mode 100644 index 0000000..b57ff7c --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraBase.h @@ -0,0 +1,6096 @@ +// +// Agora Engine SDK +// +// Created by Sting Feng in 2017-11. +// Copyright (c) 2017 Agora.io. All rights reserved. +// + +// This header file is included by both high level and low level APIs, +#pragma once // NOLINT(build/header_guard) + +#include +#include +#include +#include +#include + +#include "IAgoraParameter.h" +#include "AgoraMediaBase.h" +#include "AgoraRefPtr.h" +#include "AgoraOptional.h" + +#define MAX_PATH_260 (260) + +#if defined(_WIN32) + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif // !WIN32_LEAN_AND_MEAN +#if defined(__aarch64__) +#include +#endif +#include + +#if defined(AGORARTC_EXPORT) +#define AGORA_API extern "C" __declspec(dllexport) +#else +#define AGORA_API extern "C" __declspec(dllimport) +#endif // AGORARTC_EXPORT + +#define AGORA_CALL __cdecl + +#define __deprecated + +#elif defined(__APPLE__) + +#include + +#define AGORA_API extern "C" __attribute__((visibility("default"))) +#define AGORA_CALL + +#elif defined(__ANDROID__) || defined(__linux__) + +#define AGORA_API extern "C" __attribute__((visibility("default"))) +#define AGORA_CALL + +#define __deprecated + +#else // !_WIN32 && !__APPLE__ && !(__ANDROID__ || __linux__) + +#define AGORA_API extern "C" +#define AGORA_CALL + +#define __deprecated + +#endif // _WIN32 + +#ifndef OPTIONAL_ENUM_SIZE_T +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_SIZE_T enum : size_t +#else +#define OPTIONAL_ENUM_SIZE_T enum +#endif +#endif + +#ifndef OPTIONAL_NULLPTR +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_NULLPTR nullptr +#else +#define OPTIONAL_NULLPTR NULL +#endif +#endif + +#define INVALID_DISPLAY_ID 0xffff + +namespace agora { +namespace commons { +namespace cjson { +class JsonWrapper; +} // namespace cjson +} // namespace commons + +typedef commons::cjson::JsonWrapper any_document_t; + +namespace util { + +template +class AutoPtr { + protected: + typedef T value_type; + typedef T* pointer_type; + + public: + explicit AutoPtr(pointer_type p = NULL) : ptr_(p) {} + + ~AutoPtr() { + if (ptr_) { + ptr_->release(); + ptr_ = NULL; + } + } + + operator bool() const { return (ptr_ != NULL); } + + value_type& operator*() const { return *get(); } + + pointer_type operator->() const { return get(); } + + pointer_type get() const { return ptr_; } + + pointer_type release() { + pointer_type ret = ptr_; + ptr_ = 0; + return ret; + } + + void reset(pointer_type ptr = NULL) { + if (ptr != ptr_ && ptr_) { + ptr_->release(); + } + + ptr_ = ptr; + } + + template + bool queryInterface(C1* c, C2 iid) { + pointer_type p = NULL; + if (c && !c->queryInterface(iid, reinterpret_cast(&p))) { + reset(p); + } + + return (p != NULL); + } + + private: + AutoPtr(const AutoPtr&); + AutoPtr& operator=(const AutoPtr&); + + private: + pointer_type ptr_; +}; + +template +class CopyableAutoPtr : public AutoPtr { + typedef typename AutoPtr::pointer_type pointer_type; + + public: + explicit CopyableAutoPtr(pointer_type p = 0) : AutoPtr(p) {} + explicit CopyableAutoPtr(const CopyableAutoPtr& rhs) { this->reset(rhs.clone()); } + CopyableAutoPtr& operator=(const CopyableAutoPtr& rhs) { + if (this != &rhs) this->reset(rhs.clone()); + return *this; + } + pointer_type clone() const { + if (!this->get()) return NULL; + return this->get()->clone(); + } +}; + +class IString { + public: + virtual bool empty() const = 0; + virtual const char* c_str() = 0; + virtual const char* data() = 0; + virtual size_t length() = 0; + virtual IString* clone() = 0; + virtual void release() = 0; + virtual ~IString() {} +}; +typedef CopyableAutoPtr AString; + +class IIterator { + public: + virtual void* current() = 0; + virtual const void* const_current() const = 0; + virtual bool next() = 0; + virtual void release() = 0; + virtual ~IIterator() {} +}; + +class IContainer { + public: + virtual IIterator* begin() = 0; + virtual size_t size() const = 0; + virtual void release() = 0; + virtual ~IContainer() {} +}; + +template +class AOutputIterator { + IIterator* p; + + public: + typedef T value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + explicit AOutputIterator(IIterator* it = NULL) : p(it) {} + ~AOutputIterator() { + if (p) p->release(); + } + AOutputIterator(const AOutputIterator& rhs) : p(rhs.p) {} + AOutputIterator& operator++() { + p->next(); + return *this; + } + bool operator==(const AOutputIterator& rhs) const { + if (p && rhs.p) + return p->current() == rhs.p->current(); + else + return valid() == rhs.valid(); + } + bool operator!=(const AOutputIterator& rhs) const { return !this->operator==(rhs); } + reference operator*() { return *reinterpret_cast(p->current()); } + const_reference operator*() const { return *reinterpret_cast(p->const_current()); } + bool valid() const { return p && p->current() != NULL; } +}; + +template +class AList { + IContainer* container; + bool owner; + + public: + typedef T value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef size_t size_type; + typedef AOutputIterator iterator; + typedef const AOutputIterator const_iterator; + + public: + AList() : container(NULL), owner(false) {} + AList(IContainer* c, bool take_ownership) : container(c), owner(take_ownership) {} + ~AList() { reset(); } + void reset(IContainer* c = NULL, bool take_ownership = false) { + if (owner && container) container->release(); + container = c; + owner = take_ownership; + } + iterator begin() { return container ? iterator(container->begin()) : iterator(NULL); } + iterator end() { return iterator(NULL); } + size_type size() const { return container ? container->size() : 0; } + bool empty() const { return size() == 0; } +}; + +} // namespace util + +/** + * The channel profile. + */ +enum CHANNEL_PROFILE_TYPE { + /** + * 0: Communication. + * + * This profile prioritizes smoothness and applies to the one-to-one scenario. + */ + CHANNEL_PROFILE_COMMUNICATION = 0, + /** + * 1: (Default) Live Broadcast. + * + * This profile prioritizes supporting a large audience in a live broadcast channel. + */ + CHANNEL_PROFILE_LIVE_BROADCASTING = 1, + /** + * 2: Gaming. + * @deprecated This profile is deprecated. + */ + CHANNEL_PROFILE_GAME __deprecated = 2, + /** + * 3: Cloud Gaming. + * + * @deprecated This profile is deprecated. + */ + CHANNEL_PROFILE_CLOUD_GAMING __deprecated = 3, + + /** + * 4: Communication 1v1. + * @deprecated This profile is deprecated. + */ + CHANNEL_PROFILE_COMMUNICATION_1v1 __deprecated = 4, +}; + +/** + * The warning codes. + */ +enum WARN_CODE_TYPE { + /** + * 8: The specified view is invalid. To use the video function, you need to specify + * a valid view. + */ + WARN_INVALID_VIEW = 8, + /** + * 16: Fails to initialize the video function, probably due to a lack of + * resources. Users fail to see each other, but can still communicate with voice. + */ + WARN_INIT_VIDEO = 16, + /** + * 20: The request is pending, usually because some module is not ready, + * and the SDK postpones processing the request. + */ + WARN_PENDING = 20, + /** + * 103: No channel resources are available, probably because the server cannot + * allocate any channel resource. + */ + WARN_NO_AVAILABLE_CHANNEL = 103, + /** + * 104: A timeout occurs when looking for the channel. When joining a channel, + * the SDK looks up the specified channel. This warning usually occurs when the + * network condition is too poor to connect to the server. + */ + WARN_LOOKUP_CHANNEL_TIMEOUT = 104, + /** + * 105: The server rejects the request to look for the channel. The server + * cannot process this request or the request is illegal. + */ + WARN_LOOKUP_CHANNEL_REJECTED = 105, + /** + * 106: A timeout occurs when opening the channel. Once the specific channel + * is found, the SDK opens the channel. This warning usually occurs when the + * network condition is too poor to connect to the server. + */ + WARN_OPEN_CHANNEL_TIMEOUT = 106, + /** + * 107: The server rejects the request to open the channel. The server + * cannot process this request or the request is illegal. + */ + WARN_OPEN_CHANNEL_REJECTED = 107, + + // sdk: 100~1000 + /** + * 111: A timeout occurs when switching the live video. + */ + WARN_SWITCH_LIVE_VIDEO_TIMEOUT = 111, + /** + * 118: A timeout occurs when setting the user role. + */ + WARN_SET_CLIENT_ROLE_TIMEOUT = 118, + /** + * 121: The ticket to open the channel is invalid. + */ + WARN_OPEN_CHANNEL_INVALID_TICKET = 121, + /** + * 122: The SDK is trying connecting to another server. + */ + WARN_OPEN_CHANNEL_TRY_NEXT_VOS = 122, + /** + * 131: The channel connection cannot be recovered. + */ + WARN_CHANNEL_CONNECTION_UNRECOVERABLE = 131, + /** + * 132: The SDK connection IP has changed. + */ + WARN_CHANNEL_CONNECTION_IP_CHANGED = 132, + /** + * 133: The SDK connection port has changed. + */ + WARN_CHANNEL_CONNECTION_PORT_CHANGED = 133, + /** 134: The socket error occurs, try to rejoin channel. + */ + WARN_CHANNEL_SOCKET_ERROR = 134, + /** + * 701: An error occurs when opening the file for audio mixing. + */ + WARN_AUDIO_MIXING_OPEN_ERROR = 701, + /** + * 1014: Audio Device Module: An exception occurs in the playback device. + */ + WARN_ADM_RUNTIME_PLAYOUT_WARNING = 1014, + /** + * 1016: Audio Device Module: A warning occurs in the recording device. + */ + WARN_ADM_RUNTIME_RECORDING_WARNING = 1016, + /** + * 1019: Audio Device Module: No valid audio data is collected. + */ + WARN_ADM_RECORD_AUDIO_SILENCE = 1019, + /** + * 1020: Audio Device Module: The playback device fails to start. + */ + WARN_ADM_PLAYOUT_MALFUNCTION = 1020, + /** + * 1021: Audio Device Module: The recording device fails to start. + */ + WARN_ADM_RECORD_MALFUNCTION = 1021, + /** + * 1031: Audio Device Module: The recorded audio volume is too low. + */ + WARN_ADM_RECORD_AUDIO_LOWLEVEL = 1031, + /** + * 1032: Audio Device Module: The playback audio volume is too low. + */ + WARN_ADM_PLAYOUT_AUDIO_LOWLEVEL = 1032, + /** + * 1040: Audio device module: An exception occurs with the audio drive. + * Choose one of the following solutions: + * - Disable or re-enable the audio device. + * - Re-enable your device. + * - Update the sound card drive. + */ + WARN_ADM_WINDOWS_NO_DATA_READY_EVENT = 1040, + /** + * 1051: Audio Device Module: The SDK detects howling. + */ + WARN_APM_HOWLING = 1051, + /** + * 1052: Audio Device Module: The audio device is in a glitching state. + */ + WARN_ADM_GLITCH_STATE = 1052, + /** + * 1053: Audio Device Module: The settings are improper. + */ + WARN_ADM_IMPROPER_SETTINGS = 1053, + /** + * 1060: Audio Device Module: Could not register phone state listener. + */ + WARN_ADM_REG_PHONE_LISTENNER_FAILED = 1060, + /** + * 1322: No recording device. + */ + WARN_ADM_WIN_CORE_NO_RECORDING_DEVICE = 1322, + /** + * 1323: Audio device module: No available playback device. + * You can try plugging in the audio device. + */ + WARN_ADM_WIN_CORE_NO_PLAYOUT_DEVICE = 1323, + /** + * 1324: Audio device module: The capture device is released improperly. + * Choose one of the following solutions: + * - Disable or re-enable the audio device. + * - Re-enable your audio device. + * - Update the sound card drive. + */ + WARN_ADM_WIN_CORE_IMPROPER_CAPTURE_RELEASE = 1324, +}; + +/** + * The error codes. + */ +enum ERROR_CODE_TYPE { + /** + * 0: No error occurs. + */ + ERR_OK = 0, + // 1~1000 + /** + * 1: A general error occurs (no specified reason). + */ + ERR_FAILED = 1, + /** + * 2: The argument is invalid. For example, the specific channel name + * includes illegal characters. + */ + ERR_INVALID_ARGUMENT = 2, + /** + * 3: The SDK module is not ready. Choose one of the following solutions: + * - Check the audio device. + * - Check the completeness of the app. + * - Reinitialize the RTC engine. + */ + ERR_NOT_READY = 3, + /** + * 4: The SDK does not support this function. + */ + ERR_NOT_SUPPORTED = 4, + /** + * 5: The request is rejected. + */ + ERR_REFUSED = 5, + /** + * 6: The buffer size is not big enough to store the returned data. + */ + ERR_BUFFER_TOO_SMALL = 6, + /** + * 7: The SDK is not initialized before calling this method. + */ + ERR_NOT_INITIALIZED = 7, + /** + * 8: The state is invalid. + */ + ERR_INVALID_STATE = 8, + /** + * 9: No permission. This is for internal use only, and does + * not return to the app through any method or callback. + */ + ERR_NO_PERMISSION = 9, + /** + * 10: An API timeout occurs. Some API methods require the SDK to return the + * execution result, and this error occurs if the request takes too long + * (more than 10 seconds) for the SDK to process. + */ + ERR_TIMEDOUT = 10, + /** + * 11: The request is cancelled. This is for internal use only, + * and does not return to the app through any method or callback. + */ + ERR_CANCELED = 11, + /** + * 12: The method is called too often. This is for internal use + * only, and does not return to the app through any method or + * callback. + */ + ERR_TOO_OFTEN = 12, + /** + * 13: The SDK fails to bind to the network socket. This is for internal + * use only, and does not return to the app through any method or + * callback. + */ + ERR_BIND_SOCKET = 13, + /** + * 14: The network is unavailable. This is for internal use only, and + * does not return to the app through any method or callback. + */ + ERR_NET_DOWN = 14, + /** + * 17: The request to join the channel is rejected. This error usually occurs + * when the user is already in the channel, and still calls the method to join + * the channel, for example, \ref agora::rtc::IRtcEngine::joinChannel "joinChannel()". + */ + ERR_JOIN_CHANNEL_REJECTED = 17, + /** + * 18: The request to leave the channel is rejected. This error usually + * occurs when the user has already left the channel, and still calls the + * method to leave the channel, for example, \ref agora::rtc::IRtcEngine::leaveChannel + * "leaveChannel". + */ + ERR_LEAVE_CHANNEL_REJECTED = 18, + /** + * 19: The resources have been occupied and cannot be reused. + */ + ERR_ALREADY_IN_USE = 19, + /** + * 20: The SDK gives up the request due to too many requests. This is for + * internal use only, and does not return to the app through any method or callback. + */ + ERR_ABORTED = 20, + /** + * 21: On Windows, specific firewall settings can cause the SDK to fail to + * initialize and crash. + */ + ERR_INIT_NET_ENGINE = 21, + /** + * 22: The app uses too much of the system resource and the SDK + * fails to allocate any resource. + */ + ERR_RESOURCE_LIMITED = 22, + /** + * 101: The App ID is invalid, usually because the data format of the App ID is incorrect. + * + * Solution: Check the data format of your App ID. Ensure that you use the correct App ID to initialize the Agora service. + */ + ERR_INVALID_APP_ID = 101, + /** + * 102: The specified channel name is invalid. Please try to rejoin the + * channel with a valid channel name. + */ + ERR_INVALID_CHANNEL_NAME = 102, + /** + * 103: Fails to get server resources in the specified region. Please try to + * specify another region when calling \ref agora::rtc::IRtcEngine::initialize + * "initialize". + */ + ERR_NO_SERVER_RESOURCES = 103, + /** + * 109: The token has expired, usually for the following reasons: + * - Timeout for token authorization: Once a token is generated, you must use it to access the + * Agora service within 24 hours. Otherwise, the token times out and you can no longer use it. + * - The token privilege expires: To generate a token, you need to set a timestamp for the token + * privilege to expire. For example, If you set it as seven days, the token expires seven days after + * its usage. In that case, you can no longer access the Agora service. The users cannot make calls, + * or are kicked out of the channel. + * + * Solution: Regardless of whether token authorization times out or the token privilege expires, + * you need to generate a new token on your server, and try to join the channel. + */ + ERR_TOKEN_EXPIRED = 109, + /** + * 110: The token is invalid, usually for one of the following reasons: + * - Did not provide a token when joining a channel in a situation where the project has enabled the + * App Certificate. + * - Tried to join a channel with a token in a situation where the project has not enabled the App + * Certificate. + * - The App ID, user ID and channel name that you use to generate the token on the server do not match + * those that you use when joining a channel. + * + * Solution: + * - Before joining a channel, check whether your project has enabled the App certificate. If yes, you + * must provide a token when joining a channel; if no, join a channel without a token. + * - When using a token to join a channel, ensure that the App ID, user ID, and channel name that you + * use to generate the token is the same as the App ID that you use to initialize the Agora service, and + * the user ID and channel name that you use to join the channel. + */ + ERR_INVALID_TOKEN = 110, + /** + * 111: The internet connection is interrupted. This applies to the Agora Web + * SDK only. + */ + ERR_CONNECTION_INTERRUPTED = 111, // only used in web sdk + /** + * 112: The internet connection is lost. This applies to the Agora Web SDK + * only. + */ + ERR_CONNECTION_LOST = 112, // only used in web sdk + /** + * 113: The user is not in the channel when calling the + * \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage()" method. + */ + ERR_NOT_IN_CHANNEL = 113, + /** + * 114: The data size is over 1024 bytes when the user calls the + * \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage()" method. + */ + ERR_SIZE_TOO_LARGE = 114, + /** + * 115: The bitrate of the sent data exceeds the limit of 6 Kbps when the + * user calls the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage()". + */ + ERR_BITRATE_LIMIT = 115, + /** + * 116: Too many data streams (over 5) are created when the user + * calls the \ref agora::rtc::IRtcEngine::createDataStream "createDataStream()" method. + */ + ERR_TOO_MANY_DATA_STREAMS = 116, + /** + * 117: A timeout occurs for the data stream transmission. + */ + ERR_STREAM_MESSAGE_TIMEOUT = 117, + /** + * 119: Switching the user role fails. Please try to rejoin the channel. + */ + ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119, + /** + * 120: MediaStream decryption fails. The user may have tried to join the channel with a wrong + * password. Check your settings or try rejoining the channel. + */ + ERR_DECRYPTION_FAILED = 120, + /** + * 121: The user ID is invalid. + */ + ERR_INVALID_USER_ID = 121, + /** + * 122: DataStream decryption fails. The peer may have tried to join the channel with a wrong + * password, or did't enable datastream encryption + */ + ERR_DATASTREAM_DECRYPTION_FAILED = 122, + /** + * 123: The app is banned by the server. + */ + ERR_CLIENT_IS_BANNED_BY_SERVER = 123, + /** + * 130: Encryption is enabled when the user calls the + * \ref agora::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl()" method + * (CDN live streaming does not support encrypted streams). + */ + ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISH = 130, + + /** + * 131: License credential is invalid + */ + ERR_LICENSE_CREDENTIAL_INVALID = 131, + + /** + * 134: The user account is invalid, usually because the data format of the user account is incorrect. + */ + ERR_INVALID_USER_ACCOUNT = 134, + /** + * 135: When encryption enabled, a failure occurs when verifying the server's certification. + */ + ERR_CERT_VERIFY_FAILURE = 135, + + /** 157: The necessary dynamical library is not integrated. For example, if you call + * the \ref agora::rtc::IRtcEngine::enableDeepLearningDenoise "enableDeepLearningDenoise" but do not integrate the dynamical + * library for the deep-learning noise reduction into your project, the SDK reports this error code. + * + */ + ERR_MODULE_NOT_FOUND = 157, + + // Licensing, keep the license error code same as the main version + ERR_CERT_RAW = 157, + ERR_CERT_JSON_PART = 158, + ERR_CERT_JSON_INVAL = 159, + ERR_CERT_JSON_NOMEM = 160, + ERR_CERT_CUSTOM = 161, + ERR_CERT_CREDENTIAL = 162, + ERR_CERT_SIGN = 163, + ERR_CERT_FAIL = 164, + ERR_CERT_BUF = 165, + ERR_CERT_NULL = 166, + ERR_CERT_DUEDATE = 167, + ERR_CERT_REQUEST = 168, + + // PcmSend Error num + ERR_PCMSEND_FORMAT = 200, // unsupport pcm format + ERR_PCMSEND_BUFFEROVERFLOW = 201, // buffer overflow, the pcm send rate too quickly + + /// @cond + // signaling: 400~600 + ERR_LOGIN_ALREADY_LOGIN = 428, + + /// @endcond + // 1001~2000 + /** + * 1001: Fails to load the media engine. + */ + ERR_LOAD_MEDIA_ENGINE = 1001, + /** + * 1005: Audio device module: A general error occurs in the Audio Device Module (no specified + * reason). Check if the audio device is used by another app, or try + * rejoining the channel. + */ + ERR_ADM_GENERAL_ERROR = 1005, + /** + * 1008: Audio Device Module: An error occurs in initializing the playback + * device. + */ + ERR_ADM_INIT_PLAYOUT = 1008, + /** + * 1009: Audio Device Module: An error occurs in starting the playback device. + */ + ERR_ADM_START_PLAYOUT = 1009, + /** + * 1010: Audio Device Module: An error occurs in stopping the playback device. + */ + ERR_ADM_STOP_PLAYOUT = 1010, + /** + * 1011: Audio Device Module: An error occurs in initializing the recording + * device. + */ + ERR_ADM_INIT_RECORDING = 1011, + /** + * 1012: Audio Device Module: An error occurs in starting the recording device. + */ + ERR_ADM_START_RECORDING = 1012, + /** + * 1013: Audio Device Module: An error occurs in stopping the recording device. + */ + ERR_ADM_STOP_RECORDING = 1013, + /** + * 1501: Video Device Module: The camera is not authorized. + */ + ERR_VDM_CAMERA_NOT_AUTHORIZED = 1501, +}; + +enum LICENSE_ERROR_TYPE { + /** + * 1: Invalid license + */ + LICENSE_ERR_INVALID = 1, + /** + * 2: License expired + */ + LICENSE_ERR_EXPIRE = 2, + /** + * 3: Exceed license minutes limit + */ + LICENSE_ERR_MINUTES_EXCEED = 3, + /** + * 4: License use in limited period + */ + LICENSE_ERR_LIMITED_PERIOD = 4, + /** + * 5: Same license used in different devices at the same time + */ + LICENSE_ERR_DIFF_DEVICES = 5, + /** + * 99: SDK internal error + */ + LICENSE_ERR_INTERNAL = 99, +}; + +/** + * The operational permission of the SDK on the audio session. + */ +enum AUDIO_SESSION_OPERATION_RESTRICTION { + /** + * 0: No restriction; the SDK can change the audio session. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_NONE = 0, + /** + * 1: The SDK cannot change the audio session category. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_SET_CATEGORY = 1, + /** + * 2: The SDK cannot change the audio session category, mode, or categoryOptions. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_CONFIGURE_SESSION = 1 << 1, + /** + * 4: The SDK keeps the audio session active when the user leaves the + * channel, for example, to play an audio file in the background. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_DEACTIVATE_SESSION = 1 << 2, + /** + * 128: Completely restricts the operational permission of the SDK on the + * audio session; the SDK cannot change the audio session. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_ALL = 1 << 7, +}; + +typedef const char* user_id_t; +typedef void* view_t; + +/** + * The definition of the UserInfo struct. + */ +struct UserInfo { + /** + * ID of the user. + */ + util::AString userId; + /** + * Whether the user has enabled audio: + * - true: The user has enabled audio. + * - false: The user has disabled audio. + */ + bool hasAudio; + /** + * Whether the user has enabled video: + * - true: The user has enabled video. + * - false: The user has disabled video. + */ + bool hasVideo; + + UserInfo() : hasAudio(false), hasVideo(false) {} +}; + +typedef util::AList UserList; + +// Shared between Agora Service and Rtc Engine +namespace rtc { + +/** + * Reasons for a user being offline. + */ +enum USER_OFFLINE_REASON_TYPE { + /** + * 0: The user leaves the current channel. + */ + USER_OFFLINE_QUIT = 0, + /** + * 1: The SDK times out and the user drops offline because no data packet was received within a certain + * period of time. If a user quits the call and the message is not passed to the SDK (due to an + * unreliable channel), the SDK assumes that the user drops offline. + */ + USER_OFFLINE_DROPPED = 1, + /** + * 2: The user switches the client role from the host to the audience. + */ + USER_OFFLINE_BECOME_AUDIENCE = 2, +}; + +enum INTERFACE_ID_TYPE { + AGORA_IID_AUDIO_DEVICE_MANAGER = 1, + AGORA_IID_VIDEO_DEVICE_MANAGER = 2, + AGORA_IID_PARAMETER_ENGINE = 3, + AGORA_IID_MEDIA_ENGINE = 4, + AGORA_IID_AUDIO_ENGINE = 5, + AGORA_IID_VIDEO_ENGINE = 6, + AGORA_IID_RTC_CONNECTION = 7, + AGORA_IID_SIGNALING_ENGINE = 8, + AGORA_IID_MEDIA_ENGINE_REGULATOR = 9, + AGORA_IID_CLOUD_SPATIAL_AUDIO = 10, + AGORA_IID_LOCAL_SPATIAL_AUDIO = 11, + AGORA_IID_MEDIA_RECORDER = 12, + AGORA_IID_STATE_SYNC = 13, + AGORA_IID_METACHAT_SERVICE = 14, + AGORA_IID_MUSIC_CONTENT_CENTER = 15, +}; + +/** + * The network quality types. + */ +enum QUALITY_TYPE { + /** + * 0: The network quality is unknown. + * @deprecated This member is deprecated. + */ + QUALITY_UNKNOWN __deprecated = 0, + /** + * 1: The quality is excellent. + */ + QUALITY_EXCELLENT = 1, + /** + * 2: The quality is quite good, but the bitrate may be slightly + * lower than excellent. + */ + QUALITY_GOOD = 2, + /** + * 3: Users can feel the communication slightly impaired. + */ + QUALITY_POOR = 3, + /** + * 4: Users cannot communicate smoothly. + */ + QUALITY_BAD = 4, + /** + * 5: Users can barely communicate. + */ + QUALITY_VBAD = 5, + /** + * 6: Users cannot communicate at all. + */ + QUALITY_DOWN = 6, + /** + * 7: (For future use) The network quality cannot be detected. + */ + QUALITY_UNSUPPORTED = 7, + /** + * 8: Detecting the network quality. + */ + QUALITY_DETECTING = 8, +}; + +/** + * Content fit modes. + */ +enum FIT_MODE_TYPE { + /** + * 1: Uniformly scale the video until it fills the visible boundaries (cropped). + * One dimension of the video may have clipped contents. + */ + MODE_COVER = 1, + + /** + * 2: Uniformly scale the video until one of its dimension fits the boundary + * (zoomed to fit). Areas that are not filled due to disparity in the aspect + * ratio are filled with black. + */ + MODE_CONTAIN = 2, +}; + +/** + * The rotation information. + */ +enum VIDEO_ORIENTATION { + /** + * 0: Rotate the video by 0 degree clockwise. + */ + VIDEO_ORIENTATION_0 = 0, + /** + * 90: Rotate the video by 90 degrees clockwise. + */ + VIDEO_ORIENTATION_90 = 90, + /** + * 180: Rotate the video by 180 degrees clockwise. + */ + VIDEO_ORIENTATION_180 = 180, + /** + * 270: Rotate the video by 270 degrees clockwise. + */ + VIDEO_ORIENTATION_270 = 270 +}; + +/** + * The video frame rate. + */ +enum FRAME_RATE { + /** + * 1: 1 fps. + */ + FRAME_RATE_FPS_1 = 1, + /** + * 7: 7 fps. + */ + FRAME_RATE_FPS_7 = 7, + /** + * 10: 10 fps. + */ + FRAME_RATE_FPS_10 = 10, + /** + * 15: 15 fps. + */ + FRAME_RATE_FPS_15 = 15, + /** + * 24: 24 fps. + */ + FRAME_RATE_FPS_24 = 24, + /** + * 30: 30 fps. + */ + FRAME_RATE_FPS_30 = 30, + /** + * 60: 60 fps. Applies to Windows and macOS only. + */ + FRAME_RATE_FPS_60 = 60, +}; + +enum FRAME_WIDTH { + FRAME_WIDTH_960 = 960, +}; + +enum FRAME_HEIGHT { + FRAME_HEIGHT_540 = 540, +}; + + +/** + * Types of the video frame. + */ +enum VIDEO_FRAME_TYPE { + /** 0: A black frame. */ + VIDEO_FRAME_TYPE_BLANK_FRAME = 0, + /** 3: Key frame. */ + VIDEO_FRAME_TYPE_KEY_FRAME = 3, + /** 4: Delta frame. */ + VIDEO_FRAME_TYPE_DELTA_FRAME = 4, + /** 5: The B frame.*/ + VIDEO_FRAME_TYPE_B_FRAME = 5, + /** 6: A discarded frame. */ + VIDEO_FRAME_TYPE_DROPPABLE_FRAME = 6, + /** Unknown frame. */ + VIDEO_FRAME_TYPE_UNKNOW +}; + +/** + * Video output orientation modes. + */ +enum ORIENTATION_MODE { + /** + * 0: The output video always follows the orientation of the captured video. The receiver takes + * the rotational information passed on from the video encoder. This mode applies to scenarios + * where video orientation can be adjusted on the receiver: + * - If the captured video is in landscape mode, the output video is in landscape mode. + * - If the captured video is in portrait mode, the output video is in portrait mode. + */ + ORIENTATION_MODE_ADAPTIVE = 0, + /** + * 1: Landscape mode. In this mode, the SDK always outputs videos in landscape (horizontal) mode. + * If the captured video is in portrait mode, the video encoder crops it to fit the output. Applies + * to situations where the receiving end cannot process the rotational information. For example, + * CDN live streaming. + */ + ORIENTATION_MODE_FIXED_LANDSCAPE = 1, + /** + * 2: Portrait mode. In this mode, the SDK always outputs video in portrait (portrait) mode. If + * the captured video is in landscape mode, the video encoder crops it to fit the output. Applies + * to situations where the receiving end cannot process the rotational information. For example, + * CDN live streaming. + */ + ORIENTATION_MODE_FIXED_PORTRAIT = 2, +}; + +/** + * (For future use) Video degradation preferences under limited bandwidth. + */ +enum DEGRADATION_PREFERENCE { + /** + * 0: (Default) Prefers to reduce the video frame rate while maintaining video quality during video + * encoding under limited bandwidth. This degradation preference is suitable for scenarios where + * video quality is prioritized. + * @note In the COMMUNICATION channel profile, the resolution of the video sent may change, so + * remote users need to handle this issue. + */ + MAINTAIN_QUALITY = 0, + /** + * 1: Prefers to reduce the video quality while maintaining the video frame rate during video + * encoding under limited bandwidth. This degradation preference is suitable for scenarios where + * smoothness is prioritized and video quality is allowed to be reduced. + */ + MAINTAIN_FRAMERATE = 1, + /** + * 2: Reduces the video frame rate and video quality simultaneously during video encoding under + * limited bandwidth. MAINTAIN_BALANCED has a lower reduction than MAINTAIN_QUALITY and MAINTAIN_FRAMERATE, + * and this preference is suitable for scenarios where both smoothness and video quality are a + * priority. + */ + MAINTAIN_BALANCED = 2, + /** + * 3: Degrade framerate in order to maintain resolution. + */ + MAINTAIN_RESOLUTION = 3, + /** + * 4: Disable VQC adjustion. + */ + DISABLED = 100, +}; + +/** + * The definition of the VideoDimensions struct. + */ +struct VideoDimensions { + /** + * The width of the video, in pixels. + */ + int width; + /** + * The height of the video, in pixels. + */ + int height; + VideoDimensions() : width(640), height(480) {} + VideoDimensions(int w, int h) : width(w), height(h) {} + bool operator==(const VideoDimensions& rhs) const { + return width == rhs.width && height == rhs.height; + } +}; + +/** + * (Recommended) 0: Standard bitrate mode. + * + * In this mode, the video bitrate is twice the base bitrate. + */ +const int STANDARD_BITRATE = 0; + +/** + * -1: Compatible bitrate mode. + * + * In this mode, the video bitrate is the same as the base bitrate.. If you choose + * this mode in the live-broadcast profile, the video frame rate may be lower + * than the set value. + */ +const int COMPATIBLE_BITRATE = -1; + +/** + * -1: (For future use) The default minimum bitrate. + */ +const int DEFAULT_MIN_BITRATE = -1; + +/** + * -2: (For future use) Set minimum bitrate the same as target bitrate. + */ +const int DEFAULT_MIN_BITRATE_EQUAL_TO_TARGET_BITRATE = -2; + +/** + * screen sharing supported capability level. + */ +enum SCREEN_CAPTURE_CAPABILITY_LEVEL { + SCREEN_CAPTURE_CAPABILITY_LEVEL_15_FPS = 0, + SCREEN_CAPTURE_CAPABILITY_LEVEL_30_FPS = 1, + SCREEN_CAPTURE_CAPABILITY_LEVEL_60_FPS = 2, +}; + +/** + * Video codec capability levels. + */ +enum VIDEO_CODEC_CAPABILITY_LEVEL { + /** No specified level */ + CODEC_CAPABILITY_LEVEL_UNSPECIFIED = -1, + /** Only provide basic support for the codec type */ + CODEC_CAPABILITY_LEVEL_BASIC_SUPPORT = 5, + /** Can process 1080p video at a rate of approximately 30 fps. */ + CODEC_CAPABILITY_LEVEL_1080P30FPS = 10, + /** Can process 1080p video at a rate of approximately 60 fps. */ + CODEC_CAPABILITY_LEVEL_1080P60FPS = 20, + /** Can process 2k video at a rate of approximately 30 fps. */ + CODEC_CAPABILITY_LEVEL_2K30FPS = 23, + /** Can process 2k video at a rate of approximately 60 fps. */ + CODEC_CAPABILITY_LEVEL_2K60FPS = 26, + /** Can process 4k video at a rate of approximately 30 fps. */ + CODEC_CAPABILITY_LEVEL_4K60FPS = 30, +}; + +/** + * The video codec types. + */ +enum VIDEO_CODEC_TYPE { + VIDEO_CODEC_NONE = 0, + /** + * 1: Standard VP8. + */ + VIDEO_CODEC_VP8 = 1, + /** + * 2: Standard H.264. + */ + VIDEO_CODEC_H264 = 2, + /** + * 3: Standard H.265. + */ + VIDEO_CODEC_H265 = 3, + /** + * 6: Generic. This type is used for transmitting raw video data, such as encrypted video frames. + * The SDK returns this type of video frames in callbacks, and you need to decode and render the frames yourself. + */ + VIDEO_CODEC_GENERIC = 6, + /** + * 7: Generic H264. + */ + VIDEO_CODEC_GENERIC_H264 = 7, + /** + * 12: AV1. + */ + VIDEO_CODEC_AV1 = 12, + /** + * 5: VP9. + */ + VIDEO_CODEC_VP9 = 13, + /** + * 20: Generic JPEG. This type consumes minimum computing resources and applies to IoT devices. + */ + VIDEO_CODEC_GENERIC_JPEG = 20, +}; + +/** + * The CC (Congestion Control) mode options. + */ +enum TCcMode { + /** + * Enable CC mode. + */ + CC_ENABLED, + /** + * Disable CC mode. + */ + CC_DISABLED, +}; + +/** + * The configuration for creating a local video track with an encoded image sender. + */ +struct SenderOptions { + /** + * Whether to enable CC mode. See #TCcMode. + */ + TCcMode ccMode; + /** + * The codec type used for the encoded images: \ref agora::rtc::VIDEO_CODEC_TYPE "VIDEO_CODEC_TYPE". + */ + VIDEO_CODEC_TYPE codecType; + + /** + * Target bitrate (Kbps) for video encoding. + * + * Choose one of the following options: + * + * - \ref agora::rtc::STANDARD_BITRATE "STANDARD_BITRATE": (Recommended) Standard bitrate. + * - Communication profile: The encoding bitrate equals the base bitrate. + * - Live-broadcast profile: The encoding bitrate is twice the base bitrate. + * - \ref agora::rtc::COMPATIBLE_BITRATE "COMPATIBLE_BITRATE": Compatible bitrate. The bitrate stays the same + * regardless of the profile. + * + * The Communication profile prioritizes smoothness, while the Live Broadcast + * profile prioritizes video quality (requiring a higher bitrate). Agora + * recommends setting the bitrate mode as \ref agora::rtc::STANDARD_BITRATE "STANDARD_BITRATE" or simply to + * address this difference. + * + * The following table lists the recommended video encoder configurations, + * where the base bitrate applies to the communication profile. Set your + * bitrate based on this table. If the bitrate you set is beyond the proper + * range, the SDK automatically sets it to within the range. + + | Resolution | Frame Rate (fps) | Base Bitrate (Kbps, for Communication) | Live Bitrate (Kbps, for Live Broadcast)| + |------------------------|------------------|----------------------------------------|----------------------------------------| + | 160 × 120 | 15 | 65 | 130 | + | 120 × 120 | 15 | 50 | 100 | + | 320 × 180 | 15 | 140 | 280 | + | 180 × 180 | 15 | 100 | 200 | + | 240 × 180 | 15 | 120 | 240 | + | 320 × 240 | 15 | 200 | 400 | + | 240 × 240 | 15 | 140 | 280 | + | 424 × 240 | 15 | 220 | 440 | + | 640 × 360 | 15 | 400 | 800 | + | 360 × 360 | 15 | 260 | 520 | + | 640 × 360 | 30 | 600 | 1200 | + | 360 × 360 | 30 | 400 | 800 | + | 480 × 360 | 15 | 320 | 640 | + | 480 × 360 | 30 | 490 | 980 | + | 640 × 480 | 15 | 500 | 1000 | + | 480 × 480 | 15 | 400 | 800 | + | 640 × 480 | 30 | 750 | 1500 | + | 480 × 480 | 30 | 600 | 1200 | + | 848 × 480 | 15 | 610 | 1220 | + | 848 × 480 | 30 | 930 | 1860 | + | 640 × 480 | 10 | 400 | 800 | + | 1280 × 720 | 15 | 1130 | 2260 | + | 1280 × 720 | 30 | 1710 | 3420 | + | 960 × 720 | 15 | 910 | 1820 | + | 960 × 720 | 30 | 1380 | 2760 | + | 1920 × 1080 | 15 | 2080 | 4160 | + | 1920 × 1080 | 30 | 3150 | 6300 | + | 1920 × 1080 | 60 | 4780 | 6500 | + | 2560 × 1440 | 30 | 4850 | 6500 | + | 2560 × 1440 | 60 | 6500 | 6500 | + | 3840 × 2160 | 30 | 6500 | 6500 | + | 3840 × 2160 | 60 | 6500 | 6500 | + */ + int targetBitrate; + + SenderOptions() + : ccMode(CC_ENABLED), + codecType(VIDEO_CODEC_H264), + targetBitrate(6500) {} +}; + +/** + * Audio codec types. + */ +enum AUDIO_CODEC_TYPE { + /** + * 1: OPUS. + */ + AUDIO_CODEC_OPUS = 1, + // kIsac = 2, + /** + * 3: PCMA. + */ + AUDIO_CODEC_PCMA = 3, + /** + * 4: PCMU. + */ + AUDIO_CODEC_PCMU = 4, + /** + * 5: G722. + */ + AUDIO_CODEC_G722 = 5, + // kIlbc = 6, + /** 7: AAC. */ + // AUDIO_CODEC_AAC = 7, + /** + * 8: AAC LC. + */ + AUDIO_CODEC_AACLC = 8, + /** + * 9: HE AAC. + */ + AUDIO_CODEC_HEAAC = 9, + /** + * 10: JC1. + */ + AUDIO_CODEC_JC1 = 10, + /** + * 11: HE-AAC v2. + */ + AUDIO_CODEC_HEAAC2 = 11, + /** + * 12: LPCNET. + */ + AUDIO_CODEC_LPCNET = 12, +}; + +/** + * Audio encoding types of the audio encoded frame observer. + */ +enum AUDIO_ENCODING_TYPE { + /** + * AAC encoding format, 16000 Hz sampling rate, bass quality. A file with an audio duration of 10 + * minutes is approximately 1.2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_16000_LOW = 0x010101, + /** + * AAC encoding format, 16000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_16000_MEDIUM = 0x010102, + /** + * AAC encoding format, 32000 Hz sampling rate, bass quality. A file with an audio duration of 10 + * minutes is approximately 1.2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_32000_LOW = 0x010201, + /** + * AAC encoding format, 32000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_32000_MEDIUM = 0x010202, + /** + * AAC encoding format, 32000 Hz sampling rate, high sound quality. A file with an audio duration of + * 10 minutes is approximately 3.5 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_32000_HIGH = 0x010203, + /** + * AAC encoding format, 48000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_48000_MEDIUM = 0x010302, + /** + * AAC encoding format, 48000 Hz sampling rate, high sound quality. A file with an audio duration + * of 10 minutes is approximately 3.5 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_48000_HIGH = 0x010303, + /** + * OPUS encoding format, 16000 Hz sampling rate, bass quality. A file with an audio duration of 10 + * minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_OPUS_16000_LOW = 0x020101, + /** + * OPUS encoding format, 16000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_OPUS_16000_MEDIUM = 0x020102, + /** + * OPUS encoding format, 48000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM = 0x020302, + /** + * OPUS encoding format, 48000 Hz sampling rate, high sound quality. A file with an audio duration of + * 10 minutes is approximately 3.5 MB after encoding. + */ + AUDIO_ENCODING_TYPE_OPUS_48000_HIGH = 0x020303, +}; + +/** + * The adaptation mode of the watermark. + */ +enum WATERMARK_FIT_MODE { + /** + * Use the `positionInLandscapeMode` and `positionInPortraitMode` values you set in #WatermarkOptions. + * The settings in `WatermarkRatio` are invalid. + */ + FIT_MODE_COVER_POSITION, + /** + * Use the value you set in `WatermarkRatio`. The settings in `positionInLandscapeMode` and `positionInPortraitMode` + * in `WatermarkOptions` are invalid. + */ + FIT_MODE_USE_IMAGE_RATIO +}; + +/** + * The advanced settings of encoded audio frame. + */ +struct EncodedAudioFrameAdvancedSettings { + EncodedAudioFrameAdvancedSettings() + : speech(true), + sendEvenIfEmpty(true) {} + + /** + * Determines whether the audio source is speech. + * - true: (Default) The audio source is speech. + * - false: The audio source is not speech. + */ + bool speech; + /** + * Whether to send the audio frame even when it is empty. + * - true: (Default) Send the audio frame even when it is empty. + * - false: Do not send the audio frame when it is empty. + */ + bool sendEvenIfEmpty; +}; + +/** + * The definition of the EncodedAudioFrameInfo struct. + */ +struct EncodedAudioFrameInfo { + EncodedAudioFrameInfo() + : codec(AUDIO_CODEC_AACLC), + sampleRateHz(0), + samplesPerChannel(0), + numberOfChannels(0), + captureTimeMs(0) {} + + EncodedAudioFrameInfo(const EncodedAudioFrameInfo& rhs) + : codec(rhs.codec), + sampleRateHz(rhs.sampleRateHz), + samplesPerChannel(rhs.samplesPerChannel), + numberOfChannels(rhs.numberOfChannels), + advancedSettings(rhs.advancedSettings), + captureTimeMs(rhs.captureTimeMs) {} + /** + * The audio codec: #AUDIO_CODEC_TYPE. + */ + AUDIO_CODEC_TYPE codec; + /** + * The sample rate (Hz) of the audio frame. + */ + int sampleRateHz; + /** + * The number of samples per audio channel. + * + * If this value is not set, it is 1024 for AAC, or 960 for OPUS by default. + */ + int samplesPerChannel; + /** + * The number of audio channels of the audio frame. + */ + int numberOfChannels; + /** + * The advanced settings of the audio frame. + */ + EncodedAudioFrameAdvancedSettings advancedSettings; + + /** + * This is a input parameter which means the timestamp for capturing the audio frame. + */ + int64_t captureTimeMs; +}; +/** + * The definition of the AudioPcmDataInfo struct. + */ +struct AudioPcmDataInfo { + AudioPcmDataInfo() : samplesPerChannel(0), channelNum(0), samplesOut(0), elapsedTimeMs(0), ntpTimeMs(0) {} + + AudioPcmDataInfo(const AudioPcmDataInfo& rhs) + : samplesPerChannel(rhs.samplesPerChannel), + channelNum(rhs.channelNum), + samplesOut(rhs.samplesOut), + elapsedTimeMs(rhs.elapsedTimeMs), + ntpTimeMs(rhs.ntpTimeMs) {} + + /** + * The sample count of the PCM data that you expect. + */ + size_t samplesPerChannel; + + int16_t channelNum; + + // Output + /** + * The number of output samples. + */ + size_t samplesOut; + /** + * The rendering time (ms). + */ + int64_t elapsedTimeMs; + /** + * The NTP (Network Time Protocol) timestamp (ms). + */ + int64_t ntpTimeMs; +}; +/** + * Packetization modes. Applies to H.264 only. + */ +enum H264PacketizeMode { + /** + * Non-interleaved mode. See RFC 6184. + */ + NonInterleaved = 0, // Mode 1 - STAP-A, FU-A is allowed + /** + * Single NAL unit mode. See RFC 6184. + */ + SingleNalUnit, // Mode 0 - only single NALU allowed +}; + +/** + * Video stream types. + */ +enum VIDEO_STREAM_TYPE { + /** + * 0: The high-quality video stream, which has a higher resolution and bitrate. + */ + VIDEO_STREAM_HIGH = 0, + /** + * 1: The low-quality video stream, which has a lower resolution and bitrate. + */ + VIDEO_STREAM_LOW = 1, +}; + +struct VideoSubscriptionOptions { + /** + * The type of the video stream to subscribe to. + * + * The default value is `VIDEO_STREAM_HIGH`, which means the high-quality + * video stream. + */ + Optional type; + /** + * Whether to subscribe to encoded video data only: + * - `true`: Subscribe to encoded video data only. + * - `false`: (Default) Subscribe to decoded video data. + */ + Optional encodedFrameOnly; + + VideoSubscriptionOptions() {} +}; + +/** + * The definition of the EncodedVideoFrameInfo struct, which contains the information of the external encoded video frame. + */ +struct EncodedVideoFrameInfo { + EncodedVideoFrameInfo() + : codecType(VIDEO_CODEC_H264), + width(0), + height(0), + framesPerSecond(0), + frameType(VIDEO_FRAME_TYPE_BLANK_FRAME), + rotation(VIDEO_ORIENTATION_0), + trackId(0), + captureTimeMs(0), + decodeTimeMs(0), + uid(0), + streamType(VIDEO_STREAM_HIGH) {} + + EncodedVideoFrameInfo(const EncodedVideoFrameInfo& rhs) + : codecType(rhs.codecType), + width(rhs.width), + height(rhs.height), + framesPerSecond(rhs.framesPerSecond), + frameType(rhs.frameType), + rotation(rhs.rotation), + trackId(rhs.trackId), + captureTimeMs(rhs.captureTimeMs), + decodeTimeMs(rhs.decodeTimeMs), + uid(rhs.uid), + streamType(rhs.streamType) {} + + EncodedVideoFrameInfo& operator=(const EncodedVideoFrameInfo& rhs) { + if (this == &rhs) return *this; + codecType = rhs.codecType; + width = rhs.width; + height = rhs.height; + framesPerSecond = rhs.framesPerSecond; + frameType = rhs.frameType; + rotation = rhs.rotation; + trackId = rhs.trackId; + captureTimeMs = rhs.captureTimeMs; + decodeTimeMs = rhs.decodeTimeMs; + uid = rhs.uid; + streamType = rhs.streamType; + return *this; + } + /** + * The codec type of the local video stream. See #VIDEO_CODEC_TYPE. The default value is `VIDEO_CODEC_H264 (2)`. + */ + VIDEO_CODEC_TYPE codecType; + /** + * The width (px) of the video frame. + */ + int width; + /** + * The height (px) of the video frame. + */ + int height; + /** + * The number of video frames per second. + * When this parameter is not 0, you can use it to calculate the Unix timestamp of the external + * encoded video frames. + */ + int framesPerSecond; + /** + * The video frame type: #VIDEO_FRAME_TYPE. + */ + VIDEO_FRAME_TYPE frameType; + /** + * The rotation information of the video frame: #VIDEO_ORIENTATION. + */ + VIDEO_ORIENTATION rotation; + /** + * The track ID of the video frame. + */ + int trackId; // This can be reserved for multiple video tracks, we need to create different ssrc + // and additional payload for later implementation. + /** + * This is a input parameter which means the timestamp for capturing the video. + */ + int64_t captureTimeMs; + /** + * The timestamp for decoding the video. + */ + int64_t decodeTimeMs; + /** + * ID of the user that pushes the the external encoded video frame.. + */ + uid_t uid; + /** + * The stream type of video frame. + */ + VIDEO_STREAM_TYPE streamType; + +}; +/** +* Video compression preference. +*/ +enum COMPRESSION_PREFERENCE { + /** + * (Default) Low latency is preferred, usually used in real-time communication where low latency is the number one priority. + */ + PREFER_LOW_LATENCY, + /** + * Prefer quality in sacrifice of a degree of latency, usually around 30ms ~ 150ms, depends target fps + */ + PREFER_QUALITY, +}; + +/** +* The video encoder type preference. +*/ +enum ENCODING_PREFERENCE { + /** + *Default . + */ + PREFER_AUTO = -1, + /** + * Software encoding. + */ + PREFER_SOFTWARE = 0, + /** + * Hardware encoding + */ + PREFER_HARDWARE = 1, +}; + +/** + * The definition of the AdvanceOptions struct. + */ +struct AdvanceOptions { + + /** + * The video encoder type preference.. + */ + ENCODING_PREFERENCE encodingPreference; + + /** + * Video compression preference. + */ + COMPRESSION_PREFERENCE compressionPreference; + + AdvanceOptions() : encodingPreference(PREFER_AUTO), + compressionPreference(PREFER_LOW_LATENCY) {} + + AdvanceOptions(ENCODING_PREFERENCE encoding_preference, + COMPRESSION_PREFERENCE compression_preference) : + encodingPreference(encoding_preference), + compressionPreference(compression_preference) {} + + bool operator==(const AdvanceOptions& rhs) const { + return encodingPreference == rhs.encodingPreference && + compressionPreference == rhs.compressionPreference; + } + +}; + +/** + * Video mirror mode types. + */ +enum VIDEO_MIRROR_MODE_TYPE { + /** + * (Default) 0: The mirror mode determined by the SDK. + */ + VIDEO_MIRROR_MODE_AUTO = 0, + /** + * 1: Enable the mirror mode. + */ + VIDEO_MIRROR_MODE_ENABLED = 1, + /** + * 2: Disable the mirror mode. + */ + VIDEO_MIRROR_MODE_DISABLED = 2, +}; + +#if defined(__APPLE__) && TARGET_OS_IOS +/** + * Camera capturer configuration for format type. + */ +enum CAMERA_FORMAT_TYPE { + /** 0: (Default) NV12. */ + CAMERA_FORMAT_NV12, + /** 1: BGRA. */ + CAMERA_FORMAT_BGRA, +}; +#endif + +/** Supported codec type bit mask. */ +enum CODEC_CAP_MASK { + /** 0: No codec support. */ + CODEC_CAP_MASK_NONE = 0, + + /** bit 1: Hardware decoder support flag. */ + CODEC_CAP_MASK_HW_DEC = 1 << 0, + + /** bit 2: Hardware encoder support flag. */ + CODEC_CAP_MASK_HW_ENC = 1 << 1, + + /** bit 3: Software decoder support flag. */ + CODEC_CAP_MASK_SW_DEC = 1 << 2, + + /** bit 4: Software encoder support flag. */ + CODEC_CAP_MASK_SW_ENC = 1 << 3, +}; + +struct CodecCapLevels { + VIDEO_CODEC_CAPABILITY_LEVEL hwDecodingLevel; + VIDEO_CODEC_CAPABILITY_LEVEL swDecodingLevel; + + CodecCapLevels(): hwDecodingLevel(CODEC_CAPABILITY_LEVEL_UNSPECIFIED), swDecodingLevel(CODEC_CAPABILITY_LEVEL_UNSPECIFIED) {} +}; + +/** The codec support information. */ +struct CodecCapInfo { + /** The codec type: #VIDEO_CODEC_TYPE. */ + VIDEO_CODEC_TYPE codecType; + /** The codec support flag. */ + int codecCapMask; + /** The codec capability level, estimated based on the device hardware.*/ + CodecCapLevels codecLevels; +}; + +/** + * The definition of the VideoEncoderConfiguration struct. + */ +struct VideoEncoderConfiguration { + /** + * The video encoder code type: #VIDEO_CODEC_TYPE. + */ + VIDEO_CODEC_TYPE codecType; + /** + * The video dimension: VideoDimensions. + */ + VideoDimensions dimensions; + /** + * The frame rate of the video. You can set it manually, or choose one from #FRAME_RATE. + */ + int frameRate; + /** + * The bitrate (Kbps) of the video. + * + * Refer to the **Video Bitrate Table** below and set your bitrate. If you set a bitrate beyond the + * proper range, the SDK automatically adjusts it to a value within the range. You can also choose + * from the following options: + * + * - #STANDARD_BITRATE: (Recommended) Standard bitrate mode. In this mode, the bitrates differ between + * the Live Broadcast and Communication profiles: + * - In the Communication profile, the video bitrate is the same as the base bitrate. + * - In the Live Broadcast profile, the video bitrate is twice the base bitrate. + * - #COMPATIBLE_BITRATE: Compatible bitrate mode. The compatible bitrate mode. In this mode, the bitrate + * stays the same regardless of the profile. If you choose this mode for the Live Broadcast profile, + * the video frame rate may be lower than the set value. + * + * Agora uses different video codecs for different profiles to optimize the user experience. For example, + * the communication profile prioritizes the smoothness while the live-broadcast profile prioritizes the + * video quality (a higher bitrate). Therefore, We recommend setting this parameter as #STANDARD_BITRATE. + * + * | Resolution | Frame Rate (fps) | Base Bitrate (Kbps) | Live Bitrate (Kbps)| + * |------------------------|------------------|---------------------|--------------------| + * | 160 * 120 | 15 | 65 | 110 | + * | 120 * 120 | 15 | 50 | 90 | + * | 320 * 180 | 15 | 140 | 240 | + * | 180 * 180 | 15 | 100 | 160 | + * | 240 * 180 | 15 | 120 | 200 | + * | 320 * 240 | 15 | 200 | 300 | + * | 240 * 240 | 15 | 140 | 240 | + * | 424 * 240 | 15 | 220 | 370 | + * | 640 * 360 | 15 | 400 | 680 | + * | 360 * 360 | 15 | 260 | 440 | + * | 640 * 360 | 30 | 600 | 1030 | + * | 360 * 360 | 30 | 400 | 670 | + * | 480 * 360 | 15 | 320 | 550 | + * | 480 * 360 | 30 | 490 | 830 | + * | 640 * 480 | 15 | 500 | 750 | + * | 480 * 480 | 15 | 400 | 680 | + * | 640 * 480 | 30 | 750 | 1130 | + * | 480 * 480 | 30 | 600 | 1030 | + * | 848 * 480 | 15 | 610 | 920 | + * | 848 * 480 | 30 | 930 | 1400 | + * | 640 * 480 | 10 | 400 | 600 | + * | 960 * 540 | 15 | 750 | 1100 | + * | 960 * 540 | 30 | 1110 | 1670 | + * | 1280 * 720 | 15 | 1130 | 1600 | + * | 1280 * 720 | 30 | 1710 | 2400 | + * | 960 * 720 | 15 | 910 | 1280 | + * | 960 * 720 | 30 | 1380 | 2000 | + * | 1920 * 1080 | 15 | 2080 | 2500 | + * | 1920 * 1080 | 30 | 3150 | 3780 | + * | 1920 * 1080 | 60 | 4780 | 5730 | + * | 2560 * 1440 | 30 | 4850 | 4850 | + * | 2560 * 1440 | 60 | 7350 | 7350 | + * | 3840 * 2160 | 30 | 8910 | 8910 | + * | 3840 * 2160 | 60 | 13500 | 13500 | + */ + int bitrate; + + /** + * The minimum encoding bitrate (Kbps). + * + * The Agora SDK automatically adjusts the encoding bitrate to adapt to the + * network conditions. + * + * Using a value greater than the default value forces the video encoder to + * output high-quality images but may cause more packet loss and hence + * sacrifice the smoothness of the video transmission. That said, unless you + * have special requirements for image quality, Agora does not recommend + * changing this value. + * + * @note + * This parameter applies to the live-broadcast profile only. + */ + int minBitrate; + /** + * The video orientation mode: #ORIENTATION_MODE. + */ + ORIENTATION_MODE orientationMode; + /** + * The video degradation preference under limited bandwidth: #DEGRADATION_PREFERENCE. + */ + DEGRADATION_PREFERENCE degradationPreference; + + /** + * If mirror_type is set to VIDEO_MIRROR_MODE_ENABLED, then the video frame would be mirrored before encoding. + */ + VIDEO_MIRROR_MODE_TYPE mirrorMode; + + /** + * The advanced options for the video encoder configuration. See AdvanceOptions. + */ + AdvanceOptions advanceOptions; + + VideoEncoderConfiguration(const VideoDimensions& d, int f, int b, ORIENTATION_MODE m, VIDEO_MIRROR_MODE_TYPE mirror = VIDEO_MIRROR_MODE_DISABLED) + : codecType(VIDEO_CODEC_H264), + dimensions(d), + frameRate(f), + bitrate(b), + minBitrate(DEFAULT_MIN_BITRATE), + orientationMode(m), + degradationPreference(MAINTAIN_QUALITY), + mirrorMode(mirror), + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + VideoEncoderConfiguration(int width, int height, int f, int b, ORIENTATION_MODE m, VIDEO_MIRROR_MODE_TYPE mirror = VIDEO_MIRROR_MODE_DISABLED) + : codecType(VIDEO_CODEC_H264), + dimensions(width, height), + frameRate(f), + bitrate(b), + minBitrate(DEFAULT_MIN_BITRATE), + orientationMode(m), + degradationPreference(MAINTAIN_QUALITY), + mirrorMode(mirror), + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + VideoEncoderConfiguration(const VideoEncoderConfiguration& config) + : codecType(config.codecType), + dimensions(config.dimensions), + frameRate(config.frameRate), + bitrate(config.bitrate), + minBitrate(config.minBitrate), + orientationMode(config.orientationMode), + degradationPreference(config.degradationPreference), + mirrorMode(config.mirrorMode), + advanceOptions(config.advanceOptions) {} + VideoEncoderConfiguration() + : codecType(VIDEO_CODEC_H264), + dimensions(FRAME_WIDTH_960, FRAME_HEIGHT_540), + frameRate(FRAME_RATE_FPS_15), + bitrate(STANDARD_BITRATE), + minBitrate(DEFAULT_MIN_BITRATE), + orientationMode(ORIENTATION_MODE_ADAPTIVE), + degradationPreference(MAINTAIN_QUALITY), + mirrorMode(VIDEO_MIRROR_MODE_DISABLED), + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + + VideoEncoderConfiguration& operator=(const VideoEncoderConfiguration& rhs) { + if (this == &rhs) return *this; + codecType = rhs.codecType; + dimensions = rhs.dimensions; + frameRate = rhs.frameRate; + bitrate = rhs.bitrate; + minBitrate = rhs.minBitrate; + orientationMode = rhs.orientationMode; + degradationPreference = rhs.degradationPreference; + mirrorMode = rhs.mirrorMode; + advanceOptions = rhs.advanceOptions; + return *this; + } +}; + +/** + * The configurations for the data stream. + */ +struct DataStreamConfig { + /** + * Whether to synchronize the data packet with the published audio packet. + * - `true`: Synchronize the data packet with the audio packet. + * - `false`: Do not synchronize the data packet with the audio packet. + * + * When you set the data packet to synchronize with the audio, then if the data packet delay is + * within the audio delay, the SDK triggers the `onStreamMessage` callback when the synchronized + * audio packet is played out. Do not set this parameter as true if you need the receiver to receive + * the data packet immediately. Agora recommends that you set this parameter to `true` only when you + * need to implement specific functions, for example lyric synchronization. + */ + bool syncWithAudio; + /** + * Whether the SDK guarantees that the receiver receives the data in the sent order. + * - `true`: Guarantee that the receiver receives the data in the sent order. + * - `false`: Do not guarantee that the receiver receives the data in the sent order. + * + * Do not set this parameter as `true` if you need the receiver to receive the data packet immediately. + */ + bool ordered; +}; + +/** + * The definition of SIMULCAST_STREAM_MODE + */ +enum SIMULCAST_STREAM_MODE { + /* + * disable simulcast stream until receive request for enable simulcast stream by other broadcaster + */ + AUTO_SIMULCAST_STREAM = -1, + /* + * disable simulcast stream + */ + DISABLE_SIMULCAST_STREAM = 0, + /* + * always enable simulcast stream + */ + ENABLE_SIMULCAST_STREAM = 1, +}; + +/** + * The configuration of the low-quality video stream. + */ +struct SimulcastStreamConfig { + /** + * The video frame dimension: VideoDimensions. The default value is 160 × 120. + */ + VideoDimensions dimensions; + /** + * The video bitrate (Kbps), represented by an instantaneous value. The default value of the log level is 5. + */ + int kBitrate; + /** + * he capture frame rate (fps) of the local video. The default value is 5. + */ + int framerate; + SimulcastStreamConfig() : dimensions(160, 120), kBitrate(65), framerate(5) {} + bool operator==(const SimulcastStreamConfig& rhs) const { + return dimensions == rhs.dimensions && kBitrate == rhs.kBitrate && framerate == rhs.framerate; + } +}; + +/** + * The location of the target area relative to the screen or window. If you do not set this parameter, + * the SDK selects the whole screen or window. + */ +struct Rectangle { + /** + * The horizontal offset from the top-left corner. + */ + int x; + /** + * The vertical offset from the top-left corner. + */ + int y; + /** + * The width of the region. + */ + int width; + /** + * The height of the region. + */ + int height; + + Rectangle() : x(0), y(0), width(0), height(0) {} + Rectangle(int xx, int yy, int ww, int hh) : x(xx), y(yy), width(ww), height(hh) {} +}; + +/** + * The position and size of the watermark on the screen. + * + * The position and size of the watermark on the screen are determined by `xRatio`, `yRatio`, and `widthRatio`: + * - (`xRatio`, `yRatio`) refers to the coordinates of the upper left corner of the watermark, which determines + * the distance from the upper left corner of the watermark to the upper left corner of the screen. + * The `widthRatio` determines the width of the watermark. + */ +struct WatermarkRatio { + /** + * The x-coordinate of the upper left corner of the watermark. The horizontal position relative to + * the origin, where the upper left corner of the screen is the origin, and the x-coordinate is the + * upper left corner of the watermark. The value range is [0.0,1.0], and the default value is 0. + */ + float xRatio; + /** + * The y-coordinate of the upper left corner of the watermark. The vertical position relative to the + * origin, where the upper left corner of the screen is the origin, and the y-coordinate is the upper + * left corner of the screen. The value range is [0.0,1.0], and the default value is 0. + */ + float yRatio; + /** + * The width of the watermark. The SDK calculates the height of the watermark proportionally according + * to this parameter value to ensure that the enlarged or reduced watermark image is not distorted. + * The value range is [0,1], and the default value is 0, which means no watermark is displayed. + */ + float widthRatio; + + WatermarkRatio() : xRatio(0.0), yRatio(0.0), widthRatio(0.0) {} + WatermarkRatio(float x, float y, float width) : xRatio(x), yRatio(y), widthRatio(width) {} +}; + +/** + * Configurations of the watermark image. + */ +struct WatermarkOptions { + /** + * Whether or not the watermark image is visible in the local video preview: + * - true: (Default) The watermark image is visible in preview. + * - false: The watermark image is not visible in preview. + */ + bool visibleInPreview; + /** + * When the adaptation mode of the watermark is `FIT_MODE_COVER_POSITION`, it is used to set the + * area of the watermark image in landscape mode. See #FIT_MODE_COVER_POSITION for details. + */ + Rectangle positionInLandscapeMode; + /** + * When the adaptation mode of the watermark is `FIT_MODE_COVER_POSITION`, it is used to set the + * area of the watermark image in portrait mode. See #FIT_MODE_COVER_POSITION for details. + */ + Rectangle positionInPortraitMode; + /** + * When the watermark adaptation mode is `FIT_MODE_USE_IMAGE_RATIO`, this parameter is used to set + * the watermark coordinates. See WatermarkRatio for details. + */ + WatermarkRatio watermarkRatio; + /** + * The adaptation mode of the watermark. See #WATERMARK_FIT_MODE for details. + */ + WATERMARK_FIT_MODE mode; + + WatermarkOptions() + : visibleInPreview(true), + positionInLandscapeMode(0, 0, 0, 0), + positionInPortraitMode(0, 0, 0, 0), + mode(FIT_MODE_COVER_POSITION) {} +}; + +/** + * The definition of the RtcStats struct. + */ +struct RtcStats { + /** + * The call duration (s), represented by an aggregate value. + */ + unsigned int duration; + /** + * The total number of bytes transmitted, represented by an aggregate value. + */ + unsigned int txBytes; + /** + * The total number of bytes received, represented by an aggregate value. + */ + unsigned int rxBytes; + /** + * The total number of audio bytes sent (bytes), represented by an aggregate value. + */ + unsigned int txAudioBytes; + /** + * The total number of video bytes sent (bytes), represented by an aggregate value. + */ + unsigned int txVideoBytes; + /** + * The total number of audio bytes received (bytes), represented by an aggregate value. + */ + unsigned int rxAudioBytes; + /** + * The total number of video bytes received (bytes), represented by an aggregate value. + */ + unsigned int rxVideoBytes; + /** + * The transmission bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short txKBitRate; + /** + * The receiving bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short rxKBitRate; + /** + * Audio receiving bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short rxAudioKBitRate; + /** + * The audio transmission bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short txAudioKBitRate; + /** + * The video receive bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short rxVideoKBitRate; + /** + * The video transmission bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short txVideoKBitRate; + /** + * The VOS client-server latency (ms). + */ + unsigned short lastmileDelay; + /** + * The number of users in the channel. + */ + unsigned int userCount; + /** + * The app CPU usage (%). + * @note + * - The value of `cpuAppUsage` is always reported as 0 in the `onLeaveChannel` callback. + * - As of Android 8.1, you cannot get the CPU usage from this attribute due to system limitations. + */ + double cpuAppUsage; + /** + * The system CPU usage (%). + * + * For Windows, in the multi-kernel environment, this member represents the average CPU usage. The + * value = (100 - System Idle Progress in Task Manager)/100. + * @note + * - The value of `cpuTotalUsage` is always reported as 0 in the `onLeaveChannel` callback. + * - As of Android 8.1, you cannot get the CPU usage from this attribute due to system limitations. + */ + double cpuTotalUsage; + /** + * The round-trip time delay from the client to the local router. + * @note On Android, to get `gatewayRtt`, ensure that you add the `android.permission.ACCESS_WIFI_STATE` + * permission after `` in the `AndroidManifest.xml` file in your project. + */ + int gatewayRtt; + /** + * The memory usage ratio of the app (%). + * @note This value is for reference only. Due to system limitations, you may not get this value. + */ + double memoryAppUsageRatio; + /** + * The memory usage ratio of the system (%). + * @note This value is for reference only. Due to system limitations, you may not get this value. + */ + double memoryTotalUsageRatio; + /** + * The memory usage of the app (KB). + * @note This value is for reference only. Due to system limitations, you may not get this value. + */ + int memoryAppUsageInKbytes; + /** + * The time elapsed from the when the app starts connecting to an Agora channel + * to when the connection is established. 0 indicates that this member does not apply. + */ + int connectTimeMs; + /** + * The duration (ms) between the app starting connecting to an Agora channel + * and the first audio packet is received. 0 indicates that this member does not apply. + */ + int firstAudioPacketDuration; + /** + * The duration (ms) between the app starting connecting to an Agora channel + * and the first video packet is received. 0 indicates that this member does not apply. + */ + int firstVideoPacketDuration; + /** + * The duration (ms) between the app starting connecting to an Agora channel + * and the first video key frame is received. 0 indicates that this member does not apply. + */ + int firstVideoKeyFramePacketDuration; + /** + * The number of video packets before the first video key frame is received. + * 0 indicates that this member does not apply. + */ + int packetsBeforeFirstKeyFramePacket; + /** + * The duration (ms) between the last time unmute audio and the first audio packet is received. + * 0 indicates that this member does not apply. + */ + int firstAudioPacketDurationAfterUnmute; + /** + * The duration (ms) between the last time unmute video and the first video packet is received. + * 0 indicates that this member does not apply. + */ + int firstVideoPacketDurationAfterUnmute; + /** + * The duration (ms) between the last time unmute video and the first video key frame is received. + * 0 indicates that this member does not apply. + */ + int firstVideoKeyFramePacketDurationAfterUnmute; + /** + * The duration (ms) between the last time unmute video and the first video key frame is decoded. + * 0 indicates that this member does not apply. + */ + int firstVideoKeyFrameDecodedDurationAfterUnmute; + /** + * The duration (ms) between the last time unmute video and the first video key frame is rendered. + * 0 indicates that this member does not apply. + */ + int firstVideoKeyFrameRenderedDurationAfterUnmute; + /** + * The packet loss rate of sender(broadcaster). + */ + int txPacketLossRate; + /** + * The packet loss rate of receiver(audience). + */ + int rxPacketLossRate; + /** + * The audio playout device glitch count. + */ + int playoutDeviceGlitch; + RtcStats() + : duration(0), + txBytes(0), + rxBytes(0), + txAudioBytes(0), + txVideoBytes(0), + rxAudioBytes(0), + rxVideoBytes(0), + txKBitRate(0), + rxKBitRate(0), + rxAudioKBitRate(0), + txAudioKBitRate(0), + rxVideoKBitRate(0), + txVideoKBitRate(0), + lastmileDelay(0), + userCount(0), + cpuAppUsage(0.0), + cpuTotalUsage(0.0), + gatewayRtt(0), + memoryAppUsageRatio(0.0), + memoryTotalUsageRatio(0.0), + memoryAppUsageInKbytes(0), + connectTimeMs(0), + firstAudioPacketDuration(0), + firstVideoPacketDuration(0), + firstVideoKeyFramePacketDuration(0), + packetsBeforeFirstKeyFramePacket(0), + firstAudioPacketDurationAfterUnmute(0), + firstVideoPacketDurationAfterUnmute(0), + firstVideoKeyFramePacketDurationAfterUnmute(0), + firstVideoKeyFrameDecodedDurationAfterUnmute(0), + firstVideoKeyFrameRenderedDurationAfterUnmute(0), + txPacketLossRate(0), + rxPacketLossRate(0), + playoutDeviceGlitch(0) {} +}; + +/** + * User role types. + */ +enum CLIENT_ROLE_TYPE { + /** + * 1: Broadcaster. A broadcaster can both send and receive streams. + */ + CLIENT_ROLE_BROADCASTER = 1, + /** + * 2: Audience. An audience member can only receive streams. + */ + CLIENT_ROLE_AUDIENCE = 2, +}; + +/** + * Quality change of the local video in terms of target frame rate and target bit rate since last count. + */ +enum QUALITY_ADAPT_INDICATION { + /** + * 0: The quality of the local video stays the same. + */ + ADAPT_NONE = 0, + /** + * 1: The quality improves because the network bandwidth increases. + */ + ADAPT_UP_BANDWIDTH = 1, + /** + * 2: The quality worsens because the network bandwidth decreases. + */ + ADAPT_DOWN_BANDWIDTH = 2, +}; + +/** + * The latency level of an audience member in interactive live streaming. This enum takes effect only + * when the user role is set to `CLIENT_ROLE_AUDIENCE`. + */ +enum AUDIENCE_LATENCY_LEVEL_TYPE +{ + /** + * 1: Low latency. + */ + AUDIENCE_LATENCY_LEVEL_LOW_LATENCY = 1, + /** + * 2: Ultra low latency. + */ + AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY = 2, +}; + +/** + * The detailed options of a user. + */ +struct ClientRoleOptions +{ + /** + * The latency level of an audience member in interactive live streaming. See `AUDIENCE_LATENCY_LEVEL_TYPE`. + */ + AUDIENCE_LATENCY_LEVEL_TYPE audienceLatencyLevel; + + ClientRoleOptions() + : audienceLatencyLevel(AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY) {} +}; + +/** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. + */ +enum EXPERIENCE_QUALITY_TYPE { + /** 0: QoE of the local user is good. */ + EXPERIENCE_QUALITY_GOOD = 0, + /** 1: QoE of the local user is poor. */ + EXPERIENCE_QUALITY_BAD = 1, +}; + +/** + * Reasons why the QoE of the local user when receiving a remote audio stream is poor. + */ +enum EXPERIENCE_POOR_REASON { + /** + * 0: No reason, indicating good QoE of the local user. + */ + EXPERIENCE_REASON_NONE = 0, + /** + * 1: The remote user's network quality is poor. + */ + REMOTE_NETWORK_QUALITY_POOR = 1, + /** + * 2: The local user's network quality is poor. + */ + LOCAL_NETWORK_QUALITY_POOR = 2, + /** + * 4: The local user's Wi-Fi or mobile network signal is weak. + */ + WIRELESS_SIGNAL_POOR = 4, + /** + * 8: The local user enables both Wi-Fi and bluetooth, and their signals interfere with each other. + * As a result, audio transmission quality is undermined. + */ + WIFI_BLUETOOTH_COEXIST = 8, +}; + +/** + * Audio profile types. + */ +enum AUDIO_PROFILE_TYPE { + /** + * 0: The default audio profile. + * - For the Communication profile: + * - Windows: A sample rate of 16 kHz, audio encoding, mono, and a bitrate of up to 16 Kbps. + * - Android/macOS/iOS: A sample rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. + * of up to 16 Kbps. + * - For the Live-broadcast profile: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. + */ + AUDIO_PROFILE_DEFAULT = 0, + /** + * 1: A sample rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. + */ + AUDIO_PROFILE_SPEECH_STANDARD = 1, + /** + * 2: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. + */ + AUDIO_PROFILE_MUSIC_STANDARD = 2, + /** + * 3: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 80 Kbps. + * + * To implement stereo audio, you also need to call `setAdvancedAudioOptions` and set `audioProcessingChannels` + * to `AUDIO_PROCESSING_STEREO` in `AdvancedAudioOptions`. + */ + AUDIO_PROFILE_MUSIC_STANDARD_STEREO = 3, + /** + * 4: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 96 Kbps. + */ + AUDIO_PROFILE_MUSIC_HIGH_QUALITY = 4, + /** + * 5: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 128 Kbps. + * + * To implement stereo audio, you also need to call `setAdvancedAudioOptions` and set `audioProcessingChannels` + * to `AUDIO_PROCESSING_STEREO` in `AdvancedAudioOptions`. + */ + AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO = 5, + /** + * 6: A sample rate of 16 kHz, audio encoding, mono, and Acoustic Echo Cancellation (AES) enabled. + */ + AUDIO_PROFILE_IOT = 6, + AUDIO_PROFILE_NUM = 7 +}; + +/** + * The audio scenario. + */ +enum AUDIO_SCENARIO_TYPE { + /** + * 0: Automatic scenario, where the SDK chooses the appropriate audio quality according to the + * user role and audio route. + */ + AUDIO_SCENARIO_DEFAULT = 0, + /** + * 3: (Recommended) The live gaming scenario, which needs to enable gaming + * audio effects in the speaker. Choose this scenario to achieve high-fidelity + * music playback. + */ + AUDIO_SCENARIO_GAME_STREAMING = 3, + /** + * 5: The chatroom scenario, which needs to keep recording when setClientRole to audience. + * Normally, app developer can also use mute api to achieve the same result, + * and we implement this 'non-orthogonal' behavior only to make API backward compatible. + */ + AUDIO_SCENARIO_CHATROOM = 5, + /** + * 7: Real-time chorus scenario, where users have good network conditions and require ultra-low latency. + */ + AUDIO_SCENARIO_CHORUS = 7, + /** + * 8: Meeting + */ + AUDIO_SCENARIO_MEETING = 8, + /** + * 9: The number of enumerations. + */ + AUDIO_SCENARIO_NUM = 9, +}; + +/** + * The format of the video frame. + */ +struct VideoFormat { + OPTIONAL_ENUM_SIZE_T { + /** The maximum value (px) of the width. */ + kMaxWidthInPixels = 3840, + /** The maximum value (px) of the height. */ + kMaxHeightInPixels = 2160, + /** The maximum value (fps) of the frame rate. */ + kMaxFps = 60, + }; + + /** + * The width (px) of the video. + */ + int width; // Number of pixels. + /** + * The height (px) of the video. + */ + int height; // Number of pixels. + /** + * The video frame rate (fps). + */ + int fps; + VideoFormat() : width(FRAME_WIDTH_960), height(FRAME_HEIGHT_540), fps(FRAME_RATE_FPS_15) {} + VideoFormat(int w, int h, int f) : width(w), height(h), fps(f) {} + + bool operator<(const VideoFormat& fmt) const { + if (height != fmt.height) { + return height < fmt.height; + } else if (width != fmt.width) { + return width < fmt.width; + } else { + return fps < fmt.fps; + } + } + bool operator==(const VideoFormat& fmt) const { + return width == fmt.width && height == fmt.height && fps == fmt.fps; + } + bool operator!=(const VideoFormat& fmt) const { + return !operator==(fmt); + } +}; + +/** + * Video content hints. + */ +enum VIDEO_CONTENT_HINT { + /** + * (Default) No content hint. In this case, the SDK balances smoothness with sharpness. + */ + CONTENT_HINT_NONE, + /** + * Choose this option if you prefer smoothness or when + * you are sharing motion-intensive content such as a video clip, movie, or video game. + * + * + */ + CONTENT_HINT_MOTION, + /** + * Choose this option if you prefer sharpness or when you are + * sharing montionless content such as a picture, PowerPoint slide, ot text. + * + */ + CONTENT_HINT_DETAILS +}; +/** + * The screen sharing scenario. + */ +enum SCREEN_SCENARIO_TYPE { + /** + * 1: Document. This scenario prioritizes the video quality of screen sharing and reduces the + * latency of the shared video for the receiver. If you share documents, slides, and tables, + * you can set this scenario. + */ + SCREEN_SCENARIO_DOCUMENT = 1, + /** + * 2: Game. This scenario prioritizes the smoothness of screen sharing. If you share games, you + * can set this scenario. + */ + SCREEN_SCENARIO_GAMING = 2, + /** + * 3: Video. This scenario prioritizes the smoothness of screen sharing. If you share movies or + * live videos, you can set this scenario. + */ + SCREEN_SCENARIO_VIDEO = 3, + /** + * 4: Remote control. This scenario prioritizes the video quality of screen sharing and reduces + * the latency of the shared video for the receiver. If you share the device desktop being + * remotely controlled, you can set this scenario. + */ + SCREEN_SCENARIO_RDC = 4, +}; + +/** + * The brightness level of the video image captured by the local camera. + */ +enum CAPTURE_BRIGHTNESS_LEVEL_TYPE { + /** -1: The SDK does not detect the brightness level of the video image. + * Wait a few seconds to get the brightness level from `CAPTURE_BRIGHTNESS_LEVEL_TYPE` in the next callback. + */ + CAPTURE_BRIGHTNESS_LEVEL_INVALID = -1, + /** 0: The brightness level of the video image is normal. + */ + CAPTURE_BRIGHTNESS_LEVEL_NORMAL = 0, + /** 1: The brightness level of the video image is too bright. + */ + CAPTURE_BRIGHTNESS_LEVEL_BRIGHT = 1, + /** 2: The brightness level of the video image is too dark. + */ + CAPTURE_BRIGHTNESS_LEVEL_DARK = 2, +}; + +/** + * Local audio states. + */ +enum LOCAL_AUDIO_STREAM_STATE { + /** + * 0: The local audio is in the initial state. + */ + LOCAL_AUDIO_STREAM_STATE_STOPPED = 0, + /** + * 1: The capturing device starts successfully. + */ + LOCAL_AUDIO_STREAM_STATE_RECORDING = 1, + /** + * 2: The first audio frame encodes successfully. + */ + LOCAL_AUDIO_STREAM_STATE_ENCODING = 2, + /** + * 3: The local audio fails to start. + */ + LOCAL_AUDIO_STREAM_STATE_FAILED = 3 +}; + +/** + * Local audio state error codes. + */ +enum LOCAL_AUDIO_STREAM_ERROR { + /** + * 0: The local audio is normal. + */ + LOCAL_AUDIO_STREAM_ERROR_OK = 0, + /** + * 1: No specified reason for the local audio failure. Remind your users to try to rejoin the channel. + */ + LOCAL_AUDIO_STREAM_ERROR_FAILURE = 1, + /** + * 2: No permission to use the local audio device. Remind your users to grant permission. + */ + LOCAL_AUDIO_STREAM_ERROR_DEVICE_NO_PERMISSION = 2, + /** + * 3: (Android and iOS only) The local audio capture device is used. Remind your users to check + * whether another application occupies the microphone. Local audio capture automatically resume + * after the microphone is idle for about five seconds. You can also try to rejoin the channel + * after the microphone is idle. + */ + LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY = 3, + /** + * 4: The local audio capture failed. + */ + LOCAL_AUDIO_STREAM_ERROR_RECORD_FAILURE = 4, + /** + * 5: The local audio encoding failed. + */ + LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE = 5, + /** 6: The SDK cannot find the local audio recording device. + */ + LOCAL_AUDIO_STREAM_ERROR_NO_RECORDING_DEVICE = 6, + /** 7: The SDK cannot find the local audio playback device. + */ + LOCAL_AUDIO_STREAM_ERROR_NO_PLAYOUT_DEVICE = 7, + /** + * 8: The local audio capturing is interrupted by the system call. + */ + LOCAL_AUDIO_STREAM_ERROR_INTERRUPTED = 8, + /** 9: An invalid audio capture device ID. + */ + LOCAL_AUDIO_STREAM_ERROR_RECORD_INVALID_ID = 9, + /** 10: An invalid audio playback device ID. + */ + LOCAL_AUDIO_STREAM_ERROR_PLAYOUT_INVALID_ID = 10, +}; + +/** Local video state types. + */ +enum LOCAL_VIDEO_STREAM_STATE { + /** + * 0: The local video is in the initial state. + */ + LOCAL_VIDEO_STREAM_STATE_STOPPED = 0, + /** + * 1: The local video capturing device starts successfully. The SDK also reports this state when + * you call `startScreenCaptureByWindowId` to share a maximized window. + */ + LOCAL_VIDEO_STREAM_STATE_CAPTURING = 1, + /** + * 2: The first video frame is successfully encoded. + */ + LOCAL_VIDEO_STREAM_STATE_ENCODING = 2, + /** + * 3: Fails to start the local video. + */ + LOCAL_VIDEO_STREAM_STATE_FAILED = 3 +}; + +/** + * Local video state error codes. + */ +enum LOCAL_VIDEO_STREAM_ERROR { + /** + * 0: The local video is normal. + */ + LOCAL_VIDEO_STREAM_ERROR_OK = 0, + /** + * 1: No specified reason for the local video failure. + */ + LOCAL_VIDEO_STREAM_ERROR_FAILURE = 1, + /** + * 2: No permission to use the local video capturing device. Remind the user to grant permission + * and rejoin the channel. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_NO_PERMISSION = 2, + /** + * 3: The local video capturing device is in use. Remind the user to check whether another + * application occupies the camera. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY = 3, + /** + * 4: The local video capture fails. Remind the user to check whether the video capture device + * is working properly or the camera is occupied by another application, and then to rejoin the + * channel. + */ + LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE = 4, + /** + * 5: The local video encoder is not supported. + */ + LOCAL_VIDEO_STREAM_ERROR_CODEC_NOT_SUPPORT = 5, + /** + * 6: (iOS only) The app is in the background. Remind the user that video capture cannot be + * performed normally when the app is in the background. + */ + LOCAL_VIDEO_STREAM_ERROR_CAPTURE_INBACKGROUND = 6, + /** + * 7: (iOS only) The current application window is running in Slide Over, Split View, or Picture + * in Picture mode, and another app is occupying the camera. Remind the user that the application + * cannot capture video properly when the app is running in Slide Over, Split View, or Picture in + * Picture mode and another app is occupying the camera. + */ + LOCAL_VIDEO_STREAM_ERROR_CAPTURE_MULTIPLE_FOREGROUND_APPS = 7, + /** + * 8: Fails to find a local video capture device. Remind the user to check whether the camera is + * connected to the device properly or the camera is working properly, and then to rejoin the + * channel. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_NOT_FOUND = 8, + /** + * 9: (macOS only) The video capture device currently in use is disconnected (such as being + * unplugged). + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_DISCONNECTED = 9, + /** + * 10: (macOS and Windows only) The SDK cannot find the video device in the video device list. + * Check whether the ID of the video device is valid. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_INVALID_ID = 10, + /** + * 14: (Android only) Video capture was interrupted, possibly due to the camera being occupied + * or some policy reasons such as background termination. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_INTERRUPT = 14, + /** + * 15: (Android only) The device may need to be shut down and restarted to restore camera function, + * or there may be a persistent hardware problem. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_FATAL_ERROR = 15, + /** + * 101: The current video capture device is unavailable due to excessive system pressure. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_SYSTEM_PRESSURE = 101, + /** + * 11: (macOS only) The shared window is minimized when you call `startScreenCaptureByWindowId` + * to share a window. The SDK cannot share a minimized window. You can cancel the minimization + * of this window at the application layer, for example by maximizing this window. + */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_MINIMIZED = 11, + /** + * 12: (macOS and Windows only) The error code indicates that a window shared by the window ID + * has been closed or a full-screen window shared by the window ID has exited full-screen mode. + * After exiting full-screen mode, remote users cannot see the shared window. To prevent remote + * users from seeing a black screen, Agora recommends that you immediately stop screen sharing. + * + * Common scenarios for reporting this error code: + * - When the local user closes the shared window, the SDK reports this error code. + * - The local user shows some slides in full-screen mode first, and then shares the windows of + * the slides. After the user exits full-screen mode, the SDK reports this error code. + * - The local user watches a web video or reads a web document in full-screen mode first, and + * then shares the window of the web video or document. After the user exits full-screen mode, + * the SDK reports this error code. + */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_CLOSED = 12, + /** 13: The local screen capture window is occluded. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_OCCLUDED = 13, + /** 20: The local screen capture window is not supported. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_NOT_SUPPORTED = 20, + /** 21: The screen capture fails. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_FAILURE = 21, + /** 22: No permision to capture screen. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_NO_PERMISSION = 22, + /** 25: (Windows only) The local screen capture window is currently hidden and not visible on the desktop. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_HIDDEN = 25, + /** 26: (Windows only) The local screen capture window is recovered from its hidden state. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_RECOVER_FROM_HIDDEN = 26, + /** 27:(Windows only) The window is recovered from miniminzed */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_RECOVER_FROM_MINIMIZED = 27, +}; + +/** + * Remote audio states. + */ +enum REMOTE_AUDIO_STATE +{ + /** + * 0: The remote audio is in the default state. The SDK reports this state in the case of + * `REMOTE_AUDIO_REASON_LOCAL_MUTED(3)`, `REMOTE_AUDIO_REASON_REMOTE_MUTED(5)`, or + * `REMOTE_AUDIO_REASON_REMOTE_OFFLINE(7)`. + */ + REMOTE_AUDIO_STATE_STOPPED = 0, // Default state, audio is started or remote user disabled/muted audio stream + /** + * 1: The first remote audio packet is received. + */ + REMOTE_AUDIO_STATE_STARTING = 1, // The first audio frame packet has been received + /** + * 2: The remote audio stream is decoded and plays normally. The SDK reports this state in the case of + * `REMOTE_AUDIO_REASON_NETWORK_RECOVERY(2)`, `REMOTE_AUDIO_REASON_LOCAL_UNMUTED(4)`, or + * `REMOTE_AUDIO_REASON_REMOTE_UNMUTED(6)`. + */ + REMOTE_AUDIO_STATE_DECODING = 2, // The first remote audio frame has been decoded or fronzen state ends + /** + * 3: The remote audio is frozen. The SDK reports this state in the case of + * `REMOTE_AUDIO_REASON_NETWORK_CONGESTION(1)`. + */ + REMOTE_AUDIO_STATE_FROZEN = 3, // Remote audio is frozen, probably due to network issue + /** + * 4: The remote audio fails to start. The SDK reports this state in the case of + * `REMOTE_AUDIO_REASON_INTERNAL(0)`. + */ + REMOTE_AUDIO_STATE_FAILED = 4, // Remote audio play failed +}; + +/** + * Reasons for the remote audio state change. + */ +enum REMOTE_AUDIO_STATE_REASON +{ + /** + * 0: The SDK reports this reason when the video state changes. + */ + REMOTE_AUDIO_REASON_INTERNAL = 0, + /** + * 1: Network congestion. + */ + REMOTE_AUDIO_REASON_NETWORK_CONGESTION = 1, + /** + * 2: Network recovery. + */ + REMOTE_AUDIO_REASON_NETWORK_RECOVERY = 2, + /** + * 3: The local user stops receiving the remote audio stream or + * disables the audio module. + */ + REMOTE_AUDIO_REASON_LOCAL_MUTED = 3, + /** + * 4: The local user resumes receiving the remote audio stream or + * enables the audio module. + */ + REMOTE_AUDIO_REASON_LOCAL_UNMUTED = 4, + /** + * 5: The remote user stops sending the audio stream or disables the + * audio module. + */ + REMOTE_AUDIO_REASON_REMOTE_MUTED = 5, + /** + * 6: The remote user resumes sending the audio stream or enables the + * audio module. + */ + REMOTE_AUDIO_REASON_REMOTE_UNMUTED = 6, + /** + * 7: The remote user leaves the channel. + */ + REMOTE_AUDIO_REASON_REMOTE_OFFLINE = 7, +}; + +/** + * The state of the remote video. + */ +enum REMOTE_VIDEO_STATE { + /** + * 0: The remote video is in the default state. The SDK reports this state in the case of + * `REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED (3)`, `REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED (5)`, + * `REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE (7)`, or `REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK (8)`. + */ + REMOTE_VIDEO_STATE_STOPPED = 0, + /** + * 1: The first remote video packet is received. + */ + REMOTE_VIDEO_STATE_STARTING = 1, + /** + * 2: The remote video stream is decoded and plays normally. The SDK reports this state in the case of + * `REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY (2)`, `REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED (4)`, + * `REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED (6)`, or `REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY (9)`. + */ + REMOTE_VIDEO_STATE_DECODING = 2, + /** 3: The remote video is frozen, probably due to + * #REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION (1). + */ + REMOTE_VIDEO_STATE_FROZEN = 3, + /** 4: The remote video fails to start. The SDK reports this state in the case of + * `REMOTE_VIDEO_STATE_REASON_INTERNAL (0)`. + */ + REMOTE_VIDEO_STATE_FAILED = 4, +}; +/** + * The reason for the remote video state change. + */ +enum REMOTE_VIDEO_STATE_REASON { + /** + * 0: The SDK reports this reason when the video state changes. + */ + REMOTE_VIDEO_STATE_REASON_INTERNAL = 0, + /** + * 1: Network congestion. + */ + REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION = 1, + /** + * 2: Network recovery. + */ + REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY = 2, + /** + * 3: The local user stops receiving the remote video stream or disables the video module. + */ + REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED = 3, + /** + * 4: The local user resumes receiving the remote video stream or enables the video module. + */ + REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED = 4, + /** + * 5: The remote user stops sending the video stream or disables the video module. + */ + REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED = 5, + /** + * 6: The remote user resumes sending the video stream or enables the video module. + */ + REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED = 6, + /** + * 7: The remote user leaves the channel. + */ + REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE = 7, + /** 8: The remote audio-and-video stream falls back to the audio-only stream + * due to poor network conditions. + */ + REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK = 8, + /** 9: The remote audio-only stream switches back to the audio-and-video + * stream after the network conditions improve. + */ + REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY = 9, + /** (Internal use only) 10: The remote video stream type change to low stream type + */ + REMOTE_VIDEO_STATE_REASON_VIDEO_STREAM_TYPE_CHANGE_TO_LOW = 10, + /** (Internal use only) 11: The remote video stream type change to high stream type + */ + REMOTE_VIDEO_STATE_REASON_VIDEO_STREAM_TYPE_CHANGE_TO_HIGH = 11, + /** (iOS only) 12: The app of the remote user is in background. + */ + REMOTE_VIDEO_STATE_REASON_SDK_IN_BACKGROUND = 12, + + /** 13: The remote video stream is not supported by the decoder + */ + REMOTE_VIDEO_STATE_REASON_CODEC_NOT_SUPPORT = 13, + +}; + +/** + * The remote user state information. + */ +enum REMOTE_USER_STATE { + /** + * The remote user has muted the audio. + */ + USER_STATE_MUTE_AUDIO = (1 << 0), + /** + * The remote user has muted the video. + */ + USER_STATE_MUTE_VIDEO = (1 << 1), + /** + * The remote user has enabled the video, which includes video capturing and encoding. + */ + USER_STATE_ENABLE_VIDEO = (1 << 4), + /** + * The remote user has enabled the local video capturing. + */ + USER_STATE_ENABLE_LOCAL_VIDEO = (1 << 8), + +}; + +/** + * The definition of the VideoTrackInfo struct, which contains information of + * the video track. + */ +struct VideoTrackInfo { + VideoTrackInfo() + : isLocal(false), ownerUid(0), trackId(0), channelId(OPTIONAL_NULLPTR) + , streamType(VIDEO_STREAM_HIGH), codecType(VIDEO_CODEC_H264) + , encodedFrameOnly(false), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY) + , observationPosition(agora::media::base::POSITION_POST_CAPTURER) {} + /** + * Whether the video track is local or remote. + * - true: The video track is local. + * - false: The video track is remote. + */ + bool isLocal; + /** + * ID of the user who publishes the video track. + */ + uid_t ownerUid; + + /** + * ID of the video track. + */ + track_id_t trackId; + /** + * The channel ID of the video track. + */ + const char* channelId; + /** + * The video stream type: #VIDEO_STREAM_TYPE. + */ + VIDEO_STREAM_TYPE streamType; + /** + * The video codec type: #VIDEO_CODEC_TYPE. + */ + VIDEO_CODEC_TYPE codecType; + /** + * Whether the video track contains encoded video frame only. + * - true: The video track contains encoded video frame only. + * - false: The video track does not contain encoded video frame only. + */ + bool encodedFrameOnly; + /** + * The video source type: #VIDEO_SOURCE_TYPE + */ + VIDEO_SOURCE_TYPE sourceType; + /** + * the frame position for the video observer: #VIDEO_MODULE_POSITION + */ + uint32_t observationPosition; +}; + +/** + * The downscale level of the remote video stream . The higher the downscale level, the more the video downscales. + */ +enum REMOTE_VIDEO_DOWNSCALE_LEVEL { + /** + * No downscale. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE, + /** + * Downscale level 1. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_1, + /** + * Downscale level 2. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_2, + /** + * Downscale level 3. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_3, + /** + * Downscale level 4. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_4, +}; + +/** + * The volume information of users. + */ +struct AudioVolumeInfo { + /** + * User ID of the speaker. + * - In the local user's callback, `uid` = 0. + * - In the remote users' callback, `uid` is the user ID of a remote user whose instantaneous + * volume is one of the three highest. + */ + uid_t uid; + /** + * The volume of the user. The value ranges between 0 (the lowest volume) and 255 (the highest + * volume). If the user calls `startAudioMixing`, the value of volume is the volume after audio + * mixing. + */ + unsigned int volume; // [0,255] + /** + * Voice activity status of the local user. + * - 0: The local user is not speaking. + * - 1: The local user is speaking. + * @note + * - The `vad` parameter does not report the voice activity status of remote users. In a remote + * user's callback, the value of `vad` is always 1. + * - To use this parameter, you must set `reportVad` to true when calling `enableAudioVolumeIndication`. + */ + unsigned int vad; + /** + * The voice pitch (Hz) of the local user. The value ranges between 0.0 and 4000.0. + * @note The `voicePitch` parameter does not report the voice pitch of remote users. In the + * remote users' callback, the value of `voicePitch` is always 0.0. + */ + double voicePitch; + + AudioVolumeInfo() : uid(0), volume(0), vad(0), voicePitch(0.0) {} +}; + +/** + * The audio device information. + */ +struct DeviceInfo { + /* + * Whether the audio device supports ultra-low-latency capture and playback: + * - `true`: The device supports ultra-low-latency capture and playback. + * - `false`: The device does not support ultra-low-latency capture and playback. + */ + bool isLowLatencyAudioSupported; + + DeviceInfo() : isLowLatencyAudioSupported(false) {} +}; + +/** + * The definition of the IPacketObserver struct. + */ +class IPacketObserver { + public: + virtual ~IPacketObserver() {} + /** + * The definition of the Packet struct. + */ + struct Packet { + /** + * The buffer address of the sent or received data. + * @note Agora recommends setting `buffer` to a value larger than 2048 bytes. Otherwise, you + * may encounter undefined behaviors (such as crashes). + */ + const unsigned char* buffer; + /** + * The buffer size of the sent or received data. + */ + unsigned int size; + + Packet() : buffer(NULL), size(0) {} + }; + /** + * Occurs when the SDK is ready to send the audio packet. + * @param packet The audio packet to be sent: Packet. + * @return Whether to send the audio packet: + * - true: Send the packet. + * - false: Do not send the packet, in which case the audio packet will be discarded. + */ + virtual bool onSendAudioPacket(Packet& packet) = 0; + /** + * Occurs when the SDK is ready to send the video packet. + * @param packet The video packet to be sent: Packet. + * @return Whether to send the video packet: + * - true: Send the packet. + * - false: Do not send the packet, in which case the audio packet will be discarded. + */ + virtual bool onSendVideoPacket(Packet& packet) = 0; + /** + * Occurs when the audio packet is received. + * @param packet The received audio packet: Packet. + * @return Whether to process the audio packet: + * - true: Process the packet. + * - false: Do not process the packet, in which case the audio packet will be discarded. + */ + virtual bool onReceiveAudioPacket(Packet& packet) = 0; + /** + * Occurs when the video packet is received. + * @param packet The received video packet: Packet. + * @return Whether to process the audio packet: + * - true: Process the packet. + * - false: Do not process the packet, in which case the video packet will be discarded. + */ + virtual bool onReceiveVideoPacket(Packet& packet) = 0; +}; + +/** + * Audio sample rate types. + */ +enum AUDIO_SAMPLE_RATE_TYPE { + /** + * 32000: 32 KHz. + */ + AUDIO_SAMPLE_RATE_32000 = 32000, + /** + * 44100: 44.1 KHz. + */ + AUDIO_SAMPLE_RATE_44100 = 44100, + /** + * 48000: 48 KHz. + */ + AUDIO_SAMPLE_RATE_48000 = 48000, +}; +/** + * The codec type of the output video. + */ +enum VIDEO_CODEC_TYPE_FOR_STREAM { + /** + * 1: H.264. + */ + VIDEO_CODEC_H264_FOR_STREAM = 1, + /** + * 2: H.265. + */ + VIDEO_CODEC_H265_FOR_STREAM = 2, +}; + +/** + * Video codec profile types. + */ +enum VIDEO_CODEC_PROFILE_TYPE { + /** + * 66: Baseline video codec profile. Generally used in video calls on mobile phones. + */ + VIDEO_CODEC_PROFILE_BASELINE = 66, + /** + * 77: Main video codec profile. Generally used in mainstream electronics, such as MP4 players, portable video players, PSP, and iPads. + */ + VIDEO_CODEC_PROFILE_MAIN = 77, + /** + * 100: High video codec profile. Generally used in high-resolution broadcasts or television. + */ + VIDEO_CODEC_PROFILE_HIGH = 100, +}; + + +/** + * Self-defined audio codec profile. + */ +enum AUDIO_CODEC_PROFILE_TYPE { + /** + * 0: LC-AAC. + */ + AUDIO_CODEC_PROFILE_LC_AAC = 0, + /** + * 1: HE-AAC. + */ + AUDIO_CODEC_PROFILE_HE_AAC = 1, + /** + * 2: HE-AAC v2. + */ + AUDIO_CODEC_PROFILE_HE_AAC_V2 = 2, +}; + +/** + * Local audio statistics. + */ +struct LocalAudioStats +{ + /** + * The number of audio channels. + */ + int numChannels; + /** + * The sampling rate (Hz) of sending the local user's audio stream. + */ + int sentSampleRate; + /** + * The average bitrate (Kbps) of sending the local user's audio stream. + */ + int sentBitrate; + /** + * The internal payload codec. + */ + int internalCodec; + /** + * The packet loss rate (%) from the local client to the Agora server before applying the anti-packet loss strategies. + */ + unsigned short txPacketLossRate; + /** + * The audio delay of the device, contains record and playout delay + */ + int audioDeviceDelay; + /** + * The playout delay of the device + */ + int audioPlayoutDelay; + /** + * The estimated delay of audio in-ear monitoring + */ + int earMonitorDelay; + /** + * The estimated signal delay (ms) from AEC nearin and farin + */ + int aecEstimatedDelay; + /** + * The AI-Voice-Activity-Detection result + */ + int aedVoiceRes; + /** + * The AI-Music-Detection result + */ + int aedMusicRes; +}; + + +/** + * States of the Media Push. + */ +enum RTMP_STREAM_PUBLISH_STATE { + /** + * 0: The Media Push has not started or has ended. This state is also triggered after you remove a RTMP or RTMPS stream from the CDN by calling `removePublishStreamUrl`. + */ + RTMP_STREAM_PUBLISH_STATE_IDLE = 0, + /** + * 1: The SDK is connecting to Agora's streaming server and the CDN server. This state is triggered after you call the `addPublishStreamUrl` method. + */ + RTMP_STREAM_PUBLISH_STATE_CONNECTING = 1, + /** + * 2: The RTMP or RTMPS streaming publishes. The SDK successfully publishes the RTMP or RTMPS streaming and returns this state. + */ + RTMP_STREAM_PUBLISH_STATE_RUNNING = 2, + /** + * 3: The RTMP or RTMPS streaming is recovering. When exceptions occur to the CDN, or the streaming is interrupted, the SDK tries to resume RTMP or RTMPS streaming and returns this state. + * - If the SDK successfully resumes the streaming, #RTMP_STREAM_PUBLISH_STATE_RUNNING (2) returns. + * - If the streaming does not resume within 60 seconds or server errors occur, #RTMP_STREAM_PUBLISH_STATE_FAILURE (4) returns. You can also reconnect to the server by calling the `removePublishStreamUrl` and `addPublishStreamUrl` methods. + */ + RTMP_STREAM_PUBLISH_STATE_RECOVERING = 3, + /** + * 4: The RTMP or RTMPS streaming fails. See the `errCode` parameter for the detailed error information. You can also call the `addPublishStreamUrl` method to publish the RTMP or RTMPS streaming again. + */ + RTMP_STREAM_PUBLISH_STATE_FAILURE = 4, + /** + * 5: The SDK is disconnecting to Agora's streaming server and the CDN server. This state is triggered after you call the `removePublishStreamUrl` method. + */ + RTMP_STREAM_PUBLISH_STATE_DISCONNECTING = 5, +}; + +/** + * Error codes of the RTMP or RTMPS streaming. + */ +enum RTMP_STREAM_PUBLISH_ERROR_TYPE { + /** + * 0: The RTMP or RTMPS streaming publishes successfully. + */ + RTMP_STREAM_PUBLISH_ERROR_OK = 0, + /** + * 1: Invalid argument used. If, for example, you do not call the `setLiveTranscoding` method to configure the LiveTranscoding parameters before calling the addPublishStreamUrl method, + * the SDK returns this error. Check whether you set the parameters in the `setLiveTranscoding` method properly. + */ + RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMENT = 1, + /** + * 2: The RTMP or RTMPS streaming is encrypted and cannot be published. + */ + RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED = 2, + /** + * 3: Timeout for the RTMP or RTMPS streaming. Call the `addPublishStreamUrl` method to publish the streaming again. + */ + RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT = 3, + /** + * 4: An error occurs in Agora's streaming server. Call the `addPublishStreamUrl` method to publish the streaming again. + */ + RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR = 4, + /** + * 5: An error occurs in the CDN server. + */ + RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR = 5, + /** + * 6: The RTMP or RTMPS streaming publishes too frequently. + */ + RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN = 6, + /** + * 7: The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones. + */ + RTMP_STREAM_PUBLISH_ERROR_REACH_LIMIT = 7, + /** + * 8: The host manipulates other hosts' URLs. Check your app logic. + */ + RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED = 8, + /** + * 9: Agora's server fails to find the RTMP or RTMPS streaming. + */ + RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND = 9, + /** + * 10: The format of the RTMP or RTMPS streaming URL is not supported. Check whether the URL format is correct. + */ + RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED = 10, + /** + * 11: The user role is not host, so the user cannot use the CDN live streaming function. Check your application code logic. + */ + RTMP_STREAM_PUBLISH_ERROR_NOT_BROADCASTER = 11, // Note: match to ERR_PUBLISH_STREAM_NOT_BROADCASTER in AgoraBase.h + /** + * 13: The `updateRtmpTranscoding` or `setLiveTranscoding` method is called to update the transcoding configuration in a scenario where there is streaming without transcoding. Check your application code logic. + */ + RTMP_STREAM_PUBLISH_ERROR_TRANSCODING_NO_MIX_STREAM = 13, // Note: match to ERR_PUBLISH_STREAM_TRANSCODING_NO_MIX_STREAM in AgoraBase.h + /** + * 14: Errors occurred in the host's network. + */ + RTMP_STREAM_PUBLISH_ERROR_NET_DOWN = 14, // Note: match to ERR_NET_DOWN in AgoraBase.h + /** + * 15: Your App ID does not have permission to use the CDN live streaming function. + */ + RTMP_STREAM_PUBLISH_ERROR_INVALID_APPID = 15, // Note: match to ERR_PUBLISH_STREAM_APPID_INVALID in AgoraBase.h + /** invalid privilege. */ + RTMP_STREAM_PUBLISH_ERROR_INVALID_PRIVILEGE = 16, + /** + * 100: The streaming has been stopped normally. After you call `removePublishStreamUrl` to stop streaming, the SDK returns this value. + */ + RTMP_STREAM_UNPUBLISH_ERROR_OK = 100, +}; + +/** Events during the RTMP or RTMPS streaming. */ +enum RTMP_STREAMING_EVENT { + /** + * 1: An error occurs when you add a background image or a watermark image to the RTMP or RTMPS stream. + */ + RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE = 1, + /** + * 2: The streaming URL is already being used for CDN live streaming. If you want to start new streaming, use a new streaming URL. + */ + RTMP_STREAMING_EVENT_URL_ALREADY_IN_USE = 2, + /** + * 3: The feature is not supported. + */ + RTMP_STREAMING_EVENT_ADVANCED_FEATURE_NOT_SUPPORT = 3, + /** + * 4: Client request too frequently. + */ + RTMP_STREAMING_EVENT_REQUEST_TOO_OFTEN = 4, +}; + +/** + * Image properties. + */ +typedef struct RtcImage { + /** + *The HTTP/HTTPS URL address of the image in the live video. The maximum length of this parameter is 1024 bytes. + */ + const char* url; + /** + * The x coordinate (pixel) of the image on the video frame (taking the upper left corner of the video frame as the origin). + */ + int x; + /** + * The y coordinate (pixel) of the image on the video frame (taking the upper left corner of the video frame as the origin). + */ + int y; + /** + * The width (pixel) of the image on the video frame. + */ + int width; + /** + * The height (pixel) of the image on the video frame. + */ + int height; + /** + * The layer index of the watermark or background image. When you use the watermark array to add + * a watermark or multiple watermarks, you must pass a value to `zOrder` in the range [1,255]; + * otherwise, the SDK reports an error. In other cases, zOrder can optionally be passed in the + * range [0,255], with 0 being the default value. 0 means the bottom layer and 255 means the top + * layer. + */ + int zOrder; + /** The transparency level of the image. The value ranges between 0.0 and 1.0: + * + * - 0.0: Completely transparent. + * - 1.0: (Default) Opaque. + */ + double alpha; + + RtcImage() : url(NULL), x(0), y(0), width(0), height(0), zOrder(0), alpha(1.0) {} +} RtcImage; +/** + * The configuration for advanced features of the RTMP or RTMPS streaming with transcoding. + * + * If you want to enable the advanced features of streaming with transcoding, contact support@agora.io. + */ +struct LiveStreamAdvancedFeature { + LiveStreamAdvancedFeature() : featureName(NULL), opened(false) {} + LiveStreamAdvancedFeature(const char* feat_name, bool open) : featureName(feat_name), opened(open) {} + /** The advanced feature for high-quality video with a lower bitrate. */ + // static const char* LBHQ = "lbhq"; + /** The advanced feature for the optimized video encoder. */ + // static const char* VEO = "veo"; + + /** + * The feature names, including LBHQ (high-quality video with a lower bitrate) and VEO (optimized video encoder). + */ + const char* featureName; + + /** + * Whether to enable the advanced features of streaming with transcoding: + * - `true`: Enable the advanced feature. + * - `false`: (Default) Disable the advanced feature. + */ + bool opened; +} ; + +/** + * Connection state types. + */ +enum CONNECTION_STATE_TYPE +{ + /** + * 1: The SDK is disconnected from the Agora edge server. The state indicates the SDK is in one of the following phases: + * - The initial state before calling the `joinChannel` method. + * - The app calls the `leaveChannel` method. + */ + CONNECTION_STATE_DISCONNECTED = 1, + /** + * 2: The SDK is connecting to the Agora edge server. This state indicates that the SDK is + * establishing a connection with the specified channel after the app calls `joinChannel`. + * - If the SDK successfully joins the channel, it triggers the `onConnectionStateChanged` + * callback and the connection state switches to `CONNECTION_STATE_CONNECTED`. + * - After the connection is established, the SDK also initializes the media and triggers + * `onJoinChannelSuccess` when everything is ready. + */ + CONNECTION_STATE_CONNECTING = 2, + /** + * 3: The SDK is connected to the Agora edge server. This state also indicates that the user + * has joined a channel and can now publish or subscribe to a media stream in the channel. + * If the connection to the Agora edge server is lost because, for example, the network is down + * or switched, the SDK automatically tries to reconnect and triggers `onConnectionStateChanged` + * that indicates the connection state switches to `CONNECTION_STATE_RECONNECTING`. + */ + CONNECTION_STATE_CONNECTED = 3, + /** + * 4: The SDK keeps reconnecting to the Agora edge server. The SDK keeps rejoining the channel + * after being disconnected from a joined channel because of network issues. + * - If the SDK cannot rejoin the channel within 10 seconds, it triggers `onConnectionLost`, + * stays in the `CONNECTION_STATE_RECONNECTING` state, and keeps rejoining the channel. + * - If the SDK fails to rejoin the channel 20 minutes after being disconnected from the Agora + * edge server, the SDK triggers the `onConnectionStateChanged` callback, switches to the + * `CONNECTION_STATE_FAILED` state, and stops rejoining the channel. + */ + CONNECTION_STATE_RECONNECTING = 4, + /** + * 5: The SDK fails to connect to the Agora edge server or join the channel. This state indicates + * that the SDK stops trying to rejoin the channel. You must call `leaveChannel` to leave the + * channel. + * - You can call `joinChannel` to rejoin the channel. + * - If the SDK is banned from joining the channel by the Agora edge server through the RESTful + * API, the SDK triggers the `onConnectionStateChanged` callback. + */ + CONNECTION_STATE_FAILED = 5, +}; + +/** + * Transcoding configurations of each host. + */ +struct TranscodingUser { + /** + * The user ID of the host. + */ + uid_t uid; + /** + * The x coordinate (pixel) of the host's video on the output video frame (taking the upper left corner of the video frame as the origin). The value range is [0, width], where width is the `width` set in `LiveTranscoding`. + */ + int x; + /** + * The y coordinate (pixel) of the host's video on the output video frame (taking the upper left corner of the video frame as the origin). The value range is [0, height], where height is the `height` set in `LiveTranscoding`. + */ + int y; + /** + * The width (pixel) of the host's video. + */ + int width; + /** + * The height (pixel) of the host's video. + */ + int height; + /** + * The layer index number of the host's video. The value range is [0, 100]. + * - 0: (Default) The host's video is the bottom layer. + * - 100: The host's video is the top layer. + * + * If the value is beyond this range, the SDK reports the error code `ERR_INVALID_ARGUMENT`. + */ + int zOrder; + /** + * The transparency of the host's video. The value range is [0.0, 1.0]. + * - 0.0: Completely transparent. + * - 1.0: (Default) Opaque. + */ + double alpha; + /** + * The audio channel used by the host's audio in the output audio. The default value is 0, and the value range is [0, 5]. + * - `0`: (Recommended) The defaut setting, which supports dual channels at most and depends on the upstream of the host. + * - `1`: The host's audio uses the FL audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `2`: The host's audio uses the FC audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `3`: The host's audio uses the FR audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `4`: The host's audio uses the BL audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `5`: The host's audio uses the BR audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `0xFF` or a value greater than 5: The host's audio is muted, and the Agora server removes the host's audio. + * + * @note If the value is not `0`, a special player is required. + */ + int audioChannel; + TranscodingUser() + : uid(0), + x(0), + y(0), + width(0), + height(0), + zOrder(0), + alpha(1.0), + audioChannel(0) {} +}; + +/** + * Transcoding configurations for Media Push. + */ +struct LiveTranscoding { + /** The width of the video in pixels. The default value is 360. + * - When pushing video streams to the CDN, the value range of `width` is [64,1920]. + * If the value is less than 64, Agora server automatically adjusts it to 64; if the + * value is greater than 1920, Agora server automatically adjusts it to 1920. + * - When pushing audio streams to the CDN, set `width` and `height` as 0. + */ + int width; + /** The height of the video in pixels. The default value is 640. + * - When pushing video streams to the CDN, the value range of `height` is [64,1080]. + * If the value is less than 64, Agora server automatically adjusts it to 64; if the + * value is greater than 1080, Agora server automatically adjusts it to 1080. + * - When pushing audio streams to the CDN, set `width` and `height` as 0. + */ + int height; + /** Bitrate of the CDN live output video stream. The default value is 400 Kbps. + + Set this parameter according to the Video Bitrate Table. If you set a bitrate beyond the proper range, the SDK automatically adapts it to a value within the range. + */ + int videoBitrate; + /** Frame rate of the output video stream set for the CDN live streaming. The default value is 15 fps, and the value range is (0,30]. + + @note The Agora server adjusts any value over 30 to 30. + */ + int videoFramerate; + + /** **DEPRECATED** Latency mode: + + - true: Low latency with unassured quality. + - false: (Default) High latency with assured quality. + */ + bool lowLatency; + + /** Video GOP in frames. The default value is 30 fps. + */ + int videoGop; + /** Self-defined video codec profile: #VIDEO_CODEC_PROFILE_TYPE. + + @note If you set this parameter to other values, Agora adjusts it to the default value of 100. + */ + VIDEO_CODEC_PROFILE_TYPE videoCodecProfile; + /** The background color in RGB hex value. Value only. Do not include a preceeding #. For example, 0xFFB6C1 (light pink). The default value is 0x000000 (black). + */ + unsigned int backgroundColor; + /** Video codec profile types for Media Push. See VIDEO_CODEC_TYPE_FOR_STREAM. */ + VIDEO_CODEC_TYPE_FOR_STREAM videoCodecType; + /** The number of users in the live interactive streaming. + * The value range is [0, 17]. + */ + unsigned int userCount; + /** Manages the user layout configuration in the Media Push. Agora supports a maximum of 17 transcoding users in a Media Push channel. See `TranscodingUser`. + */ + TranscodingUser* transcodingUsers; + /** Reserved property. Extra user-defined information to send SEI for the H.264/H.265 video stream to the CDN live client. Maximum length: 4096 Bytes. + + For more information on SEI frame, see [SEI-related questions](https://docs.agora.io/en/faq/sei). + */ + const char* transcodingExtraInfo; + + /** **DEPRECATED** The metadata sent to the CDN live client. + */ + const char* metadata; + /** The watermark on the live video. The image format needs to be PNG. See `RtcImage`. + + You can add one watermark, or add multiple watermarks using an array. This parameter is used with `watermarkCount`. + */ + RtcImage* watermark; + /** + * The number of watermarks on the live video. The total number of watermarks and background images can range from 0 to 10. This parameter is used with `watermark`. + */ + unsigned int watermarkCount; + + /** The number of background images on the live video. The image format needs to be PNG. See `RtcImage`. + * + * You can add a background image or use an array to add multiple background images. This parameter is used with `backgroundImageCount`. + */ + RtcImage* backgroundImage; + /** + * The number of background images on the live video. The total number of watermarks and background images can range from 0 to 10. This parameter is used with `backgroundImage`. + */ + unsigned int backgroundImageCount; + + /** The audio sampling rate (Hz) of the output media stream. See #AUDIO_SAMPLE_RATE_TYPE. + */ + AUDIO_SAMPLE_RATE_TYPE audioSampleRate; + /** Bitrate (Kbps) of the audio output stream for Media Push. The default value is 48, and the highest value is 128. + */ + int audioBitrate; + /** The number of audio channels for Media Push. Agora recommends choosing 1 (mono), or 2 (stereo) audio channels. Special players are required if you choose 3, 4, or 5. + * - 1: (Default) Mono. + * - 2: Stereo. + * - 3: Three audio channels. + * - 4: Four audio channels. + * - 5: Five audio channels. + */ + int audioChannels; + /** Audio codec profile type for Media Push. See #AUDIO_CODEC_PROFILE_TYPE. + */ + AUDIO_CODEC_PROFILE_TYPE audioCodecProfile; + /** Advanced features of the RTMP or RTMPS streaming with transcoding. See LiveStreamAdvancedFeature. + */ + LiveStreamAdvancedFeature* advancedFeatures; + + /** The number of enabled advanced features. The default value is 0. */ + unsigned int advancedFeatureCount; + LiveTranscoding() : width(360), height(640), videoBitrate(400), videoFramerate(15), lowLatency(false), videoGop(30), videoCodecProfile(VIDEO_CODEC_PROFILE_HIGH), backgroundColor(0x000000), videoCodecType(VIDEO_CODEC_H264_FOR_STREAM), userCount(0), transcodingUsers(NULL), transcodingExtraInfo(NULL), metadata(NULL), watermark(NULL), watermarkCount(0), backgroundImage(NULL), backgroundImageCount(0), audioSampleRate(AUDIO_SAMPLE_RATE_48000), audioBitrate(48), audioChannels(1), audioCodecProfile(AUDIO_CODEC_PROFILE_LC_AAC), advancedFeatures(NULL), advancedFeatureCount(0) {} +}; + +/** + * The video streams for the video mixing on the local client. + */ +struct TranscodingVideoStream { + /** + * The source type of video for the video mixing on the local client. See #VIDEO_SOURCE_TYPE. + */ + VIDEO_SOURCE_TYPE sourceType; + /** + * The ID of the remote user. + * @note Use this parameter only when the source type of the video for the video mixing on the local client is `VIDEO_SOURCE_REMOTE`. + */ + uid_t remoteUserUid; + /** + * The URL of the image. + * @note Use this parameter only when the source type of the video for the video mixing on the local client is `RTC_IMAGE`. + */ + const char* imageUrl; + /** + * MediaPlayer id if sourceType is MEDIA_PLAYER_SOURCE. + */ + int mediaPlayerId; + /** + * The horizontal displacement of the top-left corner of the video for the video mixing on the client relative to the top-left corner (origin) of the canvas for this video mixing. + */ + int x; + /** + * The vertical displacement of the top-left corner of the video for the video mixing on the client relative to the top-left corner (origin) of the canvas for this video mixing. + */ + int y; + /** + * The width (px) of the video for the video mixing on the local client. + */ + int width; + /** + * The height (px) of the video for the video mixing on the local client. + */ + int height; + /** + * The number of the layer to which the video for the video mixing on the local client belongs. The value range is [0,100]. + * - 0: (Default) The layer is at the bottom. + * - 100: The layer is at the top. + */ + int zOrder; + /** + * The transparency of the video for the video mixing on the local client. The value range is [0.0,1.0]. 0.0 means the transparency is completely transparent. 1.0 means the transparency is opaque. + */ + double alpha; + /** + * Whether to mirror the video for the video mixing on the local client. + * - true: Mirroring. + * - false: (Default) Do not mirror. + * @note The paramter only works for videos with the source type `CAMERA`. + */ + bool mirror; + + TranscodingVideoStream() + : sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), + remoteUserUid(0), + imageUrl(NULL), + mediaPlayerId(0), + x(0), + y(0), + width(0), + height(0), + zOrder(0), + alpha(1.0), + mirror(false) {} +}; + + +/** + * The configuration of the video mixing on the local client. + */ +struct LocalTranscoderConfiguration { + /** + * The number of the video streams for the video mixing on the local client. + */ + unsigned int streamCount; + /** + * The video streams for the video mixing on the local client. See TranscodingVideoStream. + */ + TranscodingVideoStream* videoInputStreams; + /** + * The encoding configuration of the mixed video stream after the video mixing on the local client. See VideoEncoderConfiguration. + */ + VideoEncoderConfiguration videoOutputConfiguration; + /** + * Whether to use the timestamp when the primary camera captures the video frame as the timestamp of the mixed video frame. + * - true: (Default) Use the timestamp of the captured video frame as the timestamp of the mixed video frame. + * - false: Do not use the timestamp of the captured video frame as the timestamp of the mixed video frame. Instead, use the timestamp when the mixed video frame is constructed. + */ + bool syncWithPrimaryCamera; + + LocalTranscoderConfiguration() + : streamCount(0), + videoInputStreams(NULL), + videoOutputConfiguration(), + syncWithPrimaryCamera(true) {} +}; + +enum VIDEO_TRANSCODER_ERROR { + /** + * No error + */ + VT_ERR_OK = 0, + /** + * The video track of the video source is not started. + */ + VT_ERR_VIDEO_SOURCE_NOT_READY = 1, + /** + * The video source type is not supported. + */ + VT_ERR_INVALID_VIDEO_SOURCE_TYPE = 2, + /** + * The image url is not correctly of image source. + */ + VT_ERR_INVALID_IMAGE_PATH = 3, + /** + * The image format not the type png/jpeg/gif of image source. + */ + VT_ERR_UNSUPPORT_IMAGE_FORMAT = 4, + /** + * The layout is invalid such as width is zero. + */ + VT_ERR_INVALID_LAYOUT = 5, + /** + * Internal error. + */ + VT_ERR_INTERNAL = 20 +}; + +/** + * Configurations of the last-mile network test. + */ +struct LastmileProbeConfig { + /** + * Determines whether to test the uplink network. Some users, for example, + * the audience in a live broadcast channel, do not need such a test: + * - true: Test. + * - false: Do not test. + */ + bool probeUplink; + /** + * Determines whether to test the downlink network: + * - true: Test. + * - false: Do not test. + */ + bool probeDownlink; + /** + * The expected maximum sending bitrate (bps) of the local user. The value range is [100000, 5000000]. We recommend setting this parameter + * according to the bitrate value set by `setVideoEncoderConfiguration`. + */ + unsigned int expectedUplinkBitrate; + /** + * The expected maximum receiving bitrate (bps) of the local user. The value range is [100000,5000000]. + */ + unsigned int expectedDownlinkBitrate; +}; + +/** + * The status of the last-mile network tests. + */ +enum LASTMILE_PROBE_RESULT_STATE { + /** + * 1: The last-mile network probe test is complete. + */ + LASTMILE_PROBE_RESULT_COMPLETE = 1, + /** + * 2: The last-mile network probe test is incomplete because the bandwidth estimation is not available due to limited test resources. + */ + LASTMILE_PROBE_RESULT_INCOMPLETE_NO_BWE = 2, + /** + * 3: The last-mile network probe test is not carried out, probably due to poor network conditions. + */ + LASTMILE_PROBE_RESULT_UNAVAILABLE = 3 +}; + +/** + * Results of the uplink or downlink last-mile network test. + */ +struct LastmileProbeOneWayResult { + /** + * The packet loss rate (%). + */ + unsigned int packetLossRate; + /** + * The network jitter (ms). + */ + unsigned int jitter; + /** + * The estimated available bandwidth (bps). + */ + unsigned int availableBandwidth; + + LastmileProbeOneWayResult() : packetLossRate(0), + jitter(0), + availableBandwidth(0) {} +}; + +/** + * Results of the uplink and downlink last-mile network tests. + */ +struct LastmileProbeResult { + /** + * The status of the last-mile network tests. See #LASTMILE_PROBE_RESULT_STATE. + */ + LASTMILE_PROBE_RESULT_STATE state; + /** + * Results of the uplink last-mile network test. For details, see LastmileProbeOneWayResult. + */ + LastmileProbeOneWayResult uplinkReport; + /** + * Results of the downlink last-mile network test. For details, see LastmileProbeOneWayResult. + */ + LastmileProbeOneWayResult downlinkReport; + /** + * The round-trip time (ms). + */ + unsigned int rtt; + + LastmileProbeResult() + : state(LASTMILE_PROBE_RESULT_UNAVAILABLE), + rtt(0) {} +}; + +/** + * Reasons causing the change of the connection state. + */ +enum CONNECTION_CHANGED_REASON_TYPE +{ + /** + * 0: The SDK is connecting to the server. + */ + CONNECTION_CHANGED_CONNECTING = 0, + /** + * 1: The SDK has joined the channel successfully. + */ + CONNECTION_CHANGED_JOIN_SUCCESS = 1, + /** + * 2: The connection between the SDK and the server is interrupted. + */ + CONNECTION_CHANGED_INTERRUPTED = 2, + /** + * 3: The connection between the SDK and the server is banned by the server. This error occurs when the user is kicked out of the channel by the server. + */ + CONNECTION_CHANGED_BANNED_BY_SERVER = 3, + /** + * 4: The SDK fails to join the channel. When the SDK fails to join the channel for more than 20 minutes, this error occurs and the SDK stops reconnecting to the channel. + */ + CONNECTION_CHANGED_JOIN_FAILED = 4, + /** + * 5: The SDK has left the channel. + */ + CONNECTION_CHANGED_LEAVE_CHANNEL = 5, + /** + * 6: The connection fails because the App ID is not valid. + */ + CONNECTION_CHANGED_INVALID_APP_ID = 6, + /** + * 7: The connection fails because the channel name is not valid. Please rejoin the channel with a valid channel name. + */ + CONNECTION_CHANGED_INVALID_CHANNEL_NAME = 7, + /** + * 8: The connection fails because the token is not valid. Typical reasons include: + * - The App Certificate for the project is enabled in Agora Console, but you do not use a token when joining the channel. If you enable the App Certificate, you must use a token to join the channel. + * - The `uid` specified when calling `joinChannel` to join the channel is inconsistent with the `uid` passed in when generating the token. + */ + CONNECTION_CHANGED_INVALID_TOKEN = 8, + /** + * 9: The connection fails because the token has expired. + */ + CONNECTION_CHANGED_TOKEN_EXPIRED = 9, + /** + * 10: The connection is rejected by the server. Typical reasons include: + * - The user is already in the channel and still calls a method, for example, `joinChannel`, to join the channel. Stop calling this method to clear this error. + * - The user tries to join the channel when conducting a pre-call test. The user needs to call the channel after the call test ends. + */ + CONNECTION_CHANGED_REJECTED_BY_SERVER = 10, + /** + * 11: The connection changes to reconnecting because the SDK has set a proxy server. + */ + CONNECTION_CHANGED_SETTING_PROXY_SERVER = 11, + /** + * 12: The connection state changed because the token is renewed. + */ + CONNECTION_CHANGED_RENEW_TOKEN = 12, + /** + * 13: The IP address of the client has changed, possibly because the network type, IP address, or port has been changed. + */ + CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED = 13, + /** + * 14: Timeout for the keep-alive of the connection between the SDK and the Agora edge server. The connection state changes to CONNECTION_STATE_RECONNECTING. + */ + CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT = 14, + /** + * 15: The SDK has rejoined the channel successfully. + */ + CONNECTION_CHANGED_REJOIN_SUCCESS = 15, + /** + * 16: The connection between the SDK and the server is lost. + */ + CONNECTION_CHANGED_LOST = 16, + /** + * 17: The change of connection state is caused by echo test. + */ + CONNECTION_CHANGED_ECHO_TEST = 17, + /** + * 18: The local IP Address is changed by user. + */ + CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED_BY_USER = 18, + /** + * 19: The connection is failed due to join the same channel on another device with the same uid. + */ + CONNECTION_CHANGED_SAME_UID_LOGIN = 19, + /** + * 20: The connection is failed due to too many broadcasters in the channel. + */ + CONNECTION_CHANGED_TOO_MANY_BROADCASTERS = 20, + + /** + * 21: The connection is failed due to license validation failure. + */ + CONNECTION_CHANGED_LICENSE_VALIDATION_FAILURE = 21, + /** + * 22: The connection is failed due to certification verify failure. + */ + CONNECTION_CHANGED_CERTIFICATION_VERYFY_FAILURE = 22, +}; + +/** + * The reason of changing role's failure. + */ +enum CLIENT_ROLE_CHANGE_FAILED_REASON { + /** + * 1: Too many broadcasters in the channel. + */ + CLIENT_ROLE_CHANGE_FAILED_TOO_MANY_BROADCASTERS = 1, + /** + * 2: The operation of changing role is not authorized. + */ + CLIENT_ROLE_CHANGE_FAILED_NOT_AUTHORIZED = 2, + /** + * 3: The operation of changing role is timeout. + */ + CLIENT_ROLE_CHANGE_FAILED_REQUEST_TIME_OUT = 3, + /** + * 4: The operation of changing role is interrupted since we lost connection with agora service. + */ + CLIENT_ROLE_CHANGE_FAILED_CONNECTION_FAILED = 4, +}; + +/** + * The reason of notifying the user of a message. + */ +enum WLACC_MESSAGE_REASON { + /** + * WIFI signal is weak. + */ + WLACC_MESSAGE_REASON_WEAK_SIGNAL = 0, + /** + * Channel congestion. + */ + WLACC_MESSAGE_REASON_CHANNEL_CONGESTION = 1, +}; + +/** + * Suggest an action for the user. + */ +enum WLACC_SUGGEST_ACTION { + /** + * Please get close to AP. + */ + WLACC_SUGGEST_ACTION_CLOSE_TO_WIFI = 0, + /** + * The user is advised to connect to the prompted SSID. + */ + WLACC_SUGGEST_ACTION_CONNECT_SSID = 1, + /** + * The user is advised to check whether the AP supports 5G band and enable 5G band (the aciton link is attached), or purchases an AP that supports 5G. AP does not support 5G band. + */ + WLACC_SUGGEST_ACTION_CHECK_5G = 2, + /** + * The user is advised to change the SSID of the 2.4G or 5G band (the aciton link is attached). The SSID of the 2.4G band AP is the same as that of the 5G band. + */ + WLACC_SUGGEST_ACTION_MODIFY_SSID = 3, +}; + +/** + * Indicator optimization degree. + */ +struct WlAccStats { + /** + * End-to-end delay optimization percentage. + */ + unsigned short e2eDelayPercent; + /** + * Frozen Ratio optimization percentage. + */ + unsigned short frozenRatioPercent; + /** + * Loss Rate optimization percentage. + */ + unsigned short lossRatePercent; +}; + +/** + * The network type. + */ +enum NETWORK_TYPE { + /** + * -1: The network type is unknown. + */ + NETWORK_TYPE_UNKNOWN = -1, + /** + * 0: The SDK disconnects from the network. + */ + NETWORK_TYPE_DISCONNECTED = 0, + /** + * 1: The network type is LAN. + */ + NETWORK_TYPE_LAN = 1, + /** + * 2: The network type is Wi-Fi (including hotspots). + */ + NETWORK_TYPE_WIFI = 2, + /** + * 3: The network type is mobile 2G. + */ + NETWORK_TYPE_MOBILE_2G = 3, + /** + * 4: The network type is mobile 3G. + */ + NETWORK_TYPE_MOBILE_3G = 4, + /** + * 5: The network type is mobile 4G. + */ + NETWORK_TYPE_MOBILE_4G = 5, + /** + * 6: The network type is mobile 5G. + */ + NETWORK_TYPE_MOBILE_5G = 6, +}; + +/** + * The mode of setting up video views. + */ +enum VIDEO_VIEW_SETUP_MODE { + /** + * 0: replace one view + */ + VIDEO_VIEW_SETUP_REPLACE = 0, + /** + * 1: add one view + */ + VIDEO_VIEW_SETUP_ADD = 1, + /** + * 2: remove one view + */ + VIDEO_VIEW_SETUP_REMOVE = 2, +}; + +/** + * Attributes of video canvas object. + */ +struct VideoCanvas { + /** + * Video display window. + */ + view_t view; + /** + * The user id of local video. + */ + uid_t uid; + + uid_t subviewUid; + /** + * The video render mode. See \ref agora::media::base::RENDER_MODE_TYPE "RENDER_MODE_TYPE". + * The default value is RENDER_MODE_HIDDEN. + */ + media::base::RENDER_MODE_TYPE renderMode; + /** + * The video mirror mode. See \ref VIDEO_MIRROR_MODE_TYPE "VIDEO_MIRROR_MODE_TYPE". + * The default value is VIDEO_MIRROR_MODE_AUTO. + * @note + * - For the mirror mode of the local video view: + * If you use a front camera, the SDK enables the mirror mode by default; + * if you use a rear camera, the SDK disables the mirror mode by default. + * - For the remote user: The mirror mode is disabled by default. + */ + VIDEO_MIRROR_MODE_TYPE mirrorMode; + /** + * The mode of setting up video view. See \ref VIDEO_VIEW_SETUP_MODE "VIDEO_VIEW_SETUP_MODE" + * The default value is VIDEO_VIEW_SETUP_REPLACE. + */ + VIDEO_VIEW_SETUP_MODE setupMode; + /** + * The video source type. See \ref VIDEO_SOURCE_TYPE "VIDEO_SOURCE_TYPE". + * The default value is VIDEO_SOURCE_CAMERA_PRIMARY. + */ + VIDEO_SOURCE_TYPE sourceType; + /** + * The media player id of AgoraMediaPlayer. It should set this parameter when the + * sourceType is VIDEO_SOURCE_MEDIA_PLAYER to show the video that AgoraMediaPlayer is playing. + * You can get this value by calling the method \ref getMediaPlayerId(). + */ + int mediaPlayerId; + /** + * If you want to display a certain part of a video frame, you can set + * this value to crop the video frame to show. + * The default value is empty(that is, if it has zero width or height), which means no cropping. + */ + Rectangle cropArea; + + /** + * default false. if set to true, the video will apply alpha mask if exist.(Mac only) + */ + bool enableAlphaMask; + + VideoCanvas() + : view(NULL), uid(0),subviewUid(0),renderMode(media::base::RENDER_MODE_HIDDEN), mirrorMode(VIDEO_MIRROR_MODE_AUTO), + setupMode(VIDEO_VIEW_SETUP_REPLACE), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false) {} + + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, uid_t u) + : view(v), uid(u),subviewUid(0), renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), + sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false) {} + + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, uid_t u,uid_t subu) + : view(v), uid(u),subviewUid(subu), renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), + sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false) {} + + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, user_id_t) + : view(v), uid(0),subviewUid(0),renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), + sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false) {} +}; + +/** Image enhancement options. + */ +struct BeautyOptions { + /** The contrast level. + */ + enum LIGHTENING_CONTRAST_LEVEL { + /** Low contrast level. */ + LIGHTENING_CONTRAST_LOW = 0, + /** (Default) Normal contrast level. */ + LIGHTENING_CONTRAST_NORMAL = 1, + /** High contrast level. */ + LIGHTENING_CONTRAST_HIGH = 2, + }; + + /** The contrast level, used with the `lighteningLevel` parameter. The larger the value, the greater the contrast between light and dark. See #LIGHTENING_CONTRAST_LEVEL. + */ + LIGHTENING_CONTRAST_LEVEL lighteningContrastLevel; + + /** The brightness level. The value ranges from 0.0 (original) to 1.0. The default value is 0.0. The greater the value, the greater the degree of whitening. */ + float lighteningLevel; + + /** The value ranges from 0.0 (original) to 1.0. The default value is 0.0. The greater the value, the greater the degree of skin grinding. + */ + float smoothnessLevel; + + /** The redness level. The value ranges from 0.0 (original) to 1.0. The default value is 0.0. The larger the value, the greater the rosy degree. + */ + float rednessLevel; + + /** The sharpness level. The value ranges from 0.0 (original) to 1.0. The default value is 0.0. The larger the value, the greater the sharpening degree. + */ + float sharpnessLevel; + + BeautyOptions(LIGHTENING_CONTRAST_LEVEL contrastLevel, float lightening, float smoothness, float redness, float sharpness) : lighteningContrastLevel(contrastLevel), lighteningLevel(lightening), smoothnessLevel(smoothness), rednessLevel(redness), sharpnessLevel(sharpness) {} + + BeautyOptions() : lighteningContrastLevel(LIGHTENING_CONTRAST_NORMAL), lighteningLevel(0), smoothnessLevel(0), rednessLevel(0), sharpnessLevel(0) {} +}; + +struct LowlightEnhanceOptions { + /** + * The low-light enhancement mode. + */ + enum LOW_LIGHT_ENHANCE_MODE { + /** 0: (Default) Automatic mode. The SDK automatically enables or disables the low-light enhancement feature according to the ambient light to compensate for the lighting level or prevent overexposure, as necessary. */ + LOW_LIGHT_ENHANCE_AUTO = 0, + /** Manual mode. Users need to enable or disable the low-light enhancement feature manually. */ + LOW_LIGHT_ENHANCE_MANUAL = 1, + }; + /** + * The low-light enhancement level. + */ + enum LOW_LIGHT_ENHANCE_LEVEL { + /** + * 0: (Default) Promotes video quality during low-light enhancement. It processes the brightness, details, and noise of the video image. The performance consumption is moderate, the processing speed is moderate, and the overall video quality is optimal. + */ + LOW_LIGHT_ENHANCE_LEVEL_HIGH_QUALITY = 0, + /** + * Promotes performance during low-light enhancement. It processes the brightness and details of the video image. The processing speed is faster. + */ + LOW_LIGHT_ENHANCE_LEVEL_FAST = 1, + }; + + /** The low-light enhancement mode. See #LOW_LIGHT_ENHANCE_MODE. + */ + LOW_LIGHT_ENHANCE_MODE mode; + + /** The low-light enhancement level. See #LOW_LIGHT_ENHANCE_LEVEL. + */ + LOW_LIGHT_ENHANCE_LEVEL level; + + LowlightEnhanceOptions(LOW_LIGHT_ENHANCE_MODE lowlightMode, LOW_LIGHT_ENHANCE_LEVEL lowlightLevel) : mode(lowlightMode), level(lowlightLevel) {} + + LowlightEnhanceOptions() : mode(LOW_LIGHT_ENHANCE_AUTO), level(LOW_LIGHT_ENHANCE_LEVEL_HIGH_QUALITY) {} +}; +/** + * The video noise reduction options. + * + * @since v4.0.0 + */ +struct VideoDenoiserOptions { + /** The video noise reduction mode. + */ + enum VIDEO_DENOISER_MODE { + /** 0: (Default) Automatic mode. The SDK automatically enables or disables the video noise reduction feature according to the ambient light. */ + VIDEO_DENOISER_AUTO = 0, + /** Manual mode. Users need to enable or disable the video noise reduction feature manually. */ + VIDEO_DENOISER_MANUAL = 1, + }; + /** + * The video noise reduction level. + */ + enum VIDEO_DENOISER_LEVEL { + /** + * 0: (Default) Promotes video quality during video noise reduction. `HIGH_QUALITY` balances performance consumption and video noise reduction quality. + * The performance consumption is moderate, the video noise reduction speed is moderate, and the overall video quality is optimal. + */ + VIDEO_DENOISER_LEVEL_HIGH_QUALITY = 0, + /** + * Promotes reducing performance consumption during video noise reduction. `FAST` prioritizes reducing performance consumption over video noise reduction quality. + * The performance consumption is lower, and the video noise reduction speed is faster. To avoid a noticeable shadowing effect (shadows trailing behind moving objects) in the processed video, Agora recommends that you use `FAST` when the camera is fixed. + */ + VIDEO_DENOISER_LEVEL_FAST = 1, + /** + * Enhanced video noise reduction. `STRENGTH` prioritizes video noise reduction quality over reducing performance consumption. + * The performance consumption is higher, the video noise reduction speed is slower, and the video noise reduction quality is better. + * If `HIGH_QUALITY` is not enough for your video noise reduction needs, you can use `STRENGTH`. + */ + VIDEO_DENOISER_LEVEL_STRENGTH = 2, + }; + /** The video noise reduction mode. See #VIDEO_DENOISER_MODE. + */ + VIDEO_DENOISER_MODE mode; + + /** The video noise reduction level. See #VIDEO_DENOISER_LEVEL. + */ + VIDEO_DENOISER_LEVEL level; + + VideoDenoiserOptions(VIDEO_DENOISER_MODE denoiserMode, VIDEO_DENOISER_LEVEL denoiserLevel) : mode(denoiserMode), level(denoiserLevel) {} + + VideoDenoiserOptions() : mode(VIDEO_DENOISER_AUTO), level(VIDEO_DENOISER_LEVEL_HIGH_QUALITY) {} +}; + +/** The color enhancement options. + * + * @since v4.0.0 + */ +struct ColorEnhanceOptions { + /** The level of color enhancement. The value range is [0.0,1.0]. `0.0` is the default value, which means no color enhancement is applied to the video. The higher the value, the higher the level of color enhancement. + */ + float strengthLevel; + + /** The level of skin tone protection. The value range is [0.0,1.0]. `0.0` means no skin tone protection. The higher the value, the higher the level of skin tone protection. + * The default value is `1.0`. When the level of color enhancement is higher, the portrait skin tone can be significantly distorted, so you need to set the level of skin tone protection; when the level of skin tone protection is higher, the color enhancement effect can be slightly reduced. + * Therefore, to get the best color enhancement effect, Agora recommends that you adjust `strengthLevel` and `skinProtectLevel` to get the most appropriate values. + */ + float skinProtectLevel; + + ColorEnhanceOptions(float stength, float skinProtect) : strengthLevel(stength), skinProtectLevel(skinProtect) {} + + ColorEnhanceOptions() : strengthLevel(0), skinProtectLevel(1) {} +}; + +/** + * The custom background image. + */ +struct VirtualBackgroundSource { + /** The type of the custom background image. + */ + enum BACKGROUND_SOURCE_TYPE { + /** + * 1: (Default) The background image is a solid color. + */ + BACKGROUND_COLOR = 1, + /** + * The background image is a file in PNG or JPG format. + */ + BACKGROUND_IMG = 2, + /** The background image is the blurred background. */ + BACKGROUND_BLUR = 3, + }; + + /** The degree of blurring applied to the custom background image.. + */ + enum BACKGROUND_BLUR_DEGREE { + /** 1: The degree of blurring applied to the custom background image is low. The user can almost see the background clearly. */ + BLUR_DEGREE_LOW = 1, + /** 2: The degree of blurring applied to the custom background image is medium. It is difficult for the user to recognize details in the background. */ + BLUR_DEGREE_MEDIUM = 2, + /** 3: (Default) The degree of blurring applied to the custom background image is high. The user can barely see any distinguishing features in the background. */ + BLUR_DEGREE_HIGH = 3, + }; + + /** The type of the custom background image. See #BACKGROUND_SOURCE_TYPE. + */ + BACKGROUND_SOURCE_TYPE background_source_type; + + /** + * The color of the custom background image. The format is a hexadecimal integer defined by RGB, without the # sign, + * such as 0xFFB6C1 for light pink. The default value is 0xFFFFFF, which signifies white. The value range + * is [0x000000,0xFFFFFF]. If the value is invalid, the SDK replaces the original background image with a white + * background image. + * + * @note This parameter takes effect only when the type of the custom background image is `BACKGROUND_COLOR`. + */ + unsigned int color; + + /** + * The local absolute path of the custom background image. PNG and JPG formats are supported. If the path is invalid, + * the SDK replaces the original background image with a white background image. + * + * @note This parameter takes effect only when the type of the custom background image is `BACKGROUND_IMG`. + */ + const char* source; + + /** The degree of blurring applied to the custom background image. See BACKGROUND_BLUR_DEGREE. + * @note This parameter takes effect only when the type of the custom background image is `BACKGROUND_BLUR`. + */ + BACKGROUND_BLUR_DEGREE blur_degree; + + VirtualBackgroundSource() : background_source_type(BACKGROUND_COLOR), color(0xffffff), source(NULL), blur_degree(BLUR_DEGREE_HIGH) {} +}; + +struct SegmentationProperty { + + enum SEG_MODEL_TYPE { + + SEG_MODEL_AI = 1, + SEG_MODEL_GREEN = 2 + }; + + SEG_MODEL_TYPE modelType; + + float greenCapacity; + + + SegmentationProperty() : modelType(SEG_MODEL_AI), greenCapacity(0.5){} +}; + +/** The type of custom audio track +*/ +enum AUDIO_TRACK_TYPE { + /** + * -1: Invalid audio track + */ + AUDIO_TRACK_INVALID = -1, + /** + * 0: Mixable audio track + * You can push more than one mixable Audio tracks into one RTC connection(channel id + uid), + * and SDK will mix these tracks into one audio track automatically. + * However, compare to direct audio track, mixable track might cause extra 30ms+ delay. + */ + AUDIO_TRACK_MIXABLE = 0, + /** + * 1: Direct audio track + * You can only push one direct (non-mixable) audio track into one RTC connection(channel id + uid). + * Compare to mixable stream, you can have lower lantency using direct audio track. + */ + AUDIO_TRACK_DIRECT = 1, +}; + +/** The configuration of custom audio track +*/ +struct AudioTrackConfig { + /** + * Enable local playback, enabled by default + * true: (Default) Enable local playback + * false: Do not enable local playback + */ + bool enableLocalPlayback; + + AudioTrackConfig() + : enableLocalPlayback(true) {} +}; + +/** + * Preset local voice reverberation options. + * bitmap allocation: + * | bit31 | bit30 - bit24 | bit23 - bit16 | bit15 - bit8 | bit7 - bit0 | + * |---------|--------------------|-----------------------------|--------------|----------------| + * |reserved | 0x1: voice beauty | 0x1: chat beautification | effect types | effect settings| + * | | | 0x2: singing beautification | | | + * | | | 0x3: timbre transform | | | + * | | | 0x4: ultra high_quality | | | + * | |--------------------|-----------------------------| | | + * | | 0x2: audio effect | 0x1: space construction | | | + * | | | 0x2: voice changer effect | | | + * | | | 0x3: style transform | | | + * | | | 0x4: electronic sound | | | + * | | | 0x5: magic tone | | | + * | |--------------------|-----------------------------| | | + * | | 0x3: voice changer | 0x1: voice transform | | | + */ +/** The options for SDK preset voice beautifier effects. + */ +enum VOICE_BEAUTIFIER_PRESET { + /** Turn off voice beautifier effects and use the original voice. + */ + VOICE_BEAUTIFIER_OFF = 0x00000000, + /** A more magnetic voice. + * + * @note Agora recommends using this enumerator to process a male-sounding voice; otherwise, you + * may experience vocal distortion. + */ + CHAT_BEAUTIFIER_MAGNETIC = 0x01010100, + /** A fresher voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you + * may experience vocal distortion. + */ + CHAT_BEAUTIFIER_FRESH = 0x01010200, + /** A more vital voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you + * may experience vocal distortion. + */ + CHAT_BEAUTIFIER_VITALITY = 0x01010300, + /** + * Singing beautifier effect. + * - If you call `setVoiceBeautifierPreset`(SINGING_BEAUTIFIER), you can beautify a male-sounding voice and add a reverberation effect + * that sounds like singing in a small room. Agora recommends not using `setVoiceBeautifierPreset`(SINGING_BEAUTIFIER) to process + * a female-sounding voice; otherwise, you may experience vocal distortion. + * - If you call `setVoiceBeautifierParameters`(SINGING_BEAUTIFIER, param1, param2), you can beautify a male- or + * female-sounding voice and add a reverberation effect. + */ + SINGING_BEAUTIFIER = 0x01020100, + /** A more vigorous voice. + */ + TIMBRE_TRANSFORMATION_VIGOROUS = 0x01030100, + /** A deeper voice. + */ + TIMBRE_TRANSFORMATION_DEEP = 0x01030200, + /** A mellower voice. + */ + TIMBRE_TRANSFORMATION_MELLOW = 0x01030300, + /** A falsetto voice. + */ + TIMBRE_TRANSFORMATION_FALSETTO = 0x01030400, + /** A fuller voice. + */ + TIMBRE_TRANSFORMATION_FULL = 0x01030500, + /** A clearer voice. + */ + TIMBRE_TRANSFORMATION_CLEAR = 0x01030600, + /** A more resounding voice. + */ + TIMBRE_TRANSFORMATION_RESOUNDING = 0x01030700, + /** A more ringing voice. + */ + TIMBRE_TRANSFORMATION_RINGING = 0x01030800, + /** + * A ultra-high quality voice, which makes the audio clearer and restores more details. + * - To achieve better audio effect quality, Agora recommends that you call `setAudioProfile` + * and set the `profile` to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` + * and `scenario` to `AUDIO_SCENARIO_HIGH_DEFINITION(6)` before calling `setVoiceBeautifierPreset`. + * - If you have an audio capturing device that can already restore audio details to a high + * degree, Agora recommends that you do not enable ultra-high quality; otherwise, the SDK may + * over-restore audio details, and you may not hear the anticipated voice effect. + */ + ULTRA_HIGH_QUALITY_VOICE = 0x01040100 +}; + +/** Preset voice effects. + * + * For better voice effects, Agora recommends setting the `profile` parameter of `setAudioProfile` to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO` before using the following presets: + * + * - `ROOM_ACOUSTICS_KTV` + * - `AUDIO_EFFECT_OFF_HARMONY` + * - `ROOM_ACOUSTICS_KTV_HARMONY` + * - `ROOM_ACOUSTICS_VOCAL_CONCERT` + * - `ROOM_ACOUSTICS_VOCAL_CONCERT_HARMONY` + * - `ROOM_ACOUSTICS_STUDIO` + * - `ROOM_ACOUSTICS_STUDIO_HARMONY` + * - `ROOM_ACOUSTICS_PHONOGRAPH` + * - `ROOM_ACOUSTICS_PHONOGRAPH_HARMONY` + * - `ROOM_ACOUSTICS_SPACIAL` + * - `ROOM_ACOUSTICS_ETHEREAL` + * - `ROOM_ACOUSTICS_CHORUS` + * - `VOICE_CHANGER_EFFECT_UNCLE` + * - `VOICE_CHANGER_EFFECT_OLDMAN` + * - `VOICE_CHANGER_EFFECT_BOY` + * - `VOICE_CHANGER_EFFECT_SISTER` + * - `VOICE_CHANGER_EFFECT_GIRL` + * - `VOICE_CHANGER_EFFECT_PIGKING` + * - `VOICE_CHANGER_EFFECT_HULK` + * - `PITCH_CORRECTION` + */ +enum AUDIO_EFFECT_PRESET { + /** Turn off voice effects, that is, use the original voice. + */ + AUDIO_EFFECT_OFF = 0x00000000, + /** The voice effect for backing vocals when the lead vocal turns off audio effect. + * @note: When this effect is used, the voice of the backing vocals will be softer. + */ + AUDIO_EFFECT_OFF_HARMONY = 0x02010120, + /** The voice effect typical of a KTV venue. + */ + ROOM_ACOUSTICS_KTV = 0x02010100, + /** The voice effect typical of a KTV venue for backing vocals. + * @note: This effect is used for backing vocals when KTV venue is chosen for the lead vocal. + */ + ROOM_ACOUSTICS_KTV_HARMONY = 0x02010110, + /** The voice effect typical of a concert hall. + */ + ROOM_ACOUSTICS_VOCAL_CONCERT = 0x02010200, + /** The voice effect typical of a concert hall for backing vocals. + * @note: This effect is used for backing vocals when concert hall is chosen for the lead vocal. + */ + ROOM_ACOUSTICS_VOCAL_CONCERT_HARMONY = 0x02010210, + /** The voice effect typical of a recording studio. + */ + ROOM_ACOUSTICS_STUDIO = 0x02010300, + /** The voice effect typical of a studio venue for backing vocals. + * @note: This effect is used for backing vocals when studio venue is chosen for the lead vocal. + */ + ROOM_ACOUSTICS_STUDIO_HARMONY = 0x02010310, + /** The voice effect typical of a vintage phonograph. + */ + ROOM_ACOUSTICS_PHONOGRAPH = 0x02010400, + /** The voice effect typical of a phonograph venue for backing vocals. + * @note: This effect is used for backing vocals when phonograph venue is chosen for the lead vocal. + */ + ROOM_ACOUSTICS_PHONOGRAPH_HARMONY = 0x02010410, + /** The virtual stereo effect, which renders monophonic audio as stereo audio. + * + * @note Before using this preset, set the `profile` parameter of `setAudioProfile` + * to `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)`; + * otherwise, the preset setting is invalid. + */ + ROOM_ACOUSTICS_VIRTUAL_STEREO = 0x02010500, + /** A more spatial voice effect. + */ + ROOM_ACOUSTICS_SPACIAL = 0x02010600, + /** A more ethereal voice effect. + */ + ROOM_ACOUSTICS_ETHEREAL = 0x02010700, + /** A 3D voice effect that makes the voice appear to be moving around the user. The default cycle + * period of the 3D voice effect is 10 seconds. To change the cycle period, call `setAudioEffectParameters` + * after this method. + * + * @note + * - Before using this preset, set the `profile` parameter of `setAudioProfile` to + * `AUDIO_PROFILE_MUSIC_STANDARD_STEREO` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO`; otherwise, + * the preset setting is invalid. + * - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear + * the anticipated voice effect. + */ + ROOM_ACOUSTICS_3D_VOICE = 0x02010800, + /** virtual suround sound. + * + * @note + * - Agora recommends using this enumerator to process virtual suround sound; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND = 0x02010900, + /** The voice effect for chorus. + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + ROOM_ACOUSTICS_CHORUS = 0x02010D00, + /** A middle-aged man's voice. + * + * @note + * Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_UNCLE = 0x02020100, + /** A senior man's voice. + * + * @note Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_OLDMAN = 0x02020200, + /** A boy's voice. + * + * @note Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_BOY = 0x02020300, + /** A young woman's voice. + * + * @note + * - Agora recommends using this enumerator to process a female-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_SISTER = 0x02020400, + /** A girl's voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_GIRL = 0x02020500, + /** The voice of Pig King, a character in Journey to the West who has a voice like a growling + * bear. + */ + VOICE_CHANGER_EFFECT_PIGKING = 0x02020600, + /** The Hulk's voice. + */ + VOICE_CHANGER_EFFECT_HULK = 0x02020700, + /** An audio effect typical of R&B music. + * + * @note Before using this preset, set the `profile` parameter of `setAudioProfile` to + - `AUDIO_PROFILE_MUSIC_HIGH_QUALITY` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO`; otherwise, + * the preset setting is invalid. + */ + STYLE_TRANSFORMATION_RNB = 0x02030100, + /** The voice effect typical of popular music. + * + * @note Before using this preset, set the `profile` parameter of `setAudioProfile` to + - `AUDIO_PROFILE_MUSIC_HIGH_QUALITY` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO`; otherwise, + * the preset setting is invalid. + */ + STYLE_TRANSFORMATION_POPULAR = 0x02030200, + /** A pitch correction effect that corrects the user's pitch based on the pitch of the natural C + * major scale. After setting this voice effect, you can call `setAudioEffectParameters` to adjust + * the basic mode of tuning and the pitch of the main tone. + */ + PITCH_CORRECTION = 0x02040100, + + /** Todo: Electronic sound, Magic tone haven't been implemented. + * + */ +}; + +/** The options for SDK preset voice conversion. + */ +enum VOICE_CONVERSION_PRESET { + /** Turn off voice conversion and use the original voice. + */ + VOICE_CONVERSION_OFF = 0x00000000, + /** A gender-neutral voice. To avoid audio distortion, ensure that you use this enumerator to process a female-sounding voice. + */ + VOICE_CHANGER_NEUTRAL = 0x03010100, + /** A sweet voice. To avoid audio distortion, ensure that you use this enumerator to process a female-sounding voice. + */ + VOICE_CHANGER_SWEET = 0x03010200, + /** A steady voice. To avoid audio distortion, ensure that you use this enumerator to process a male-sounding voice. + */ + VOICE_CHANGER_SOLID = 0x03010300, + /** A deep voice. To avoid audio distortion, ensure that you use this enumerator to process a male-sounding voice. + */ + VOICE_CHANGER_BASS = 0x03010400 +}; + +/** The options for SDK preset headphone equalizer. + */ +enum HEADPHONE_EQUALIZER_PRESET { + /** Turn off headphone EQ and use the original voice. + */ + HEADPHONE_EQUALIZER_OFF = 0x00000000, + /** For over-ear headphones. + */ + HEADPHONE_EQUALIZER_OVEREAR = 0x04000001, + /** For in-ear headphones. + */ + HEADPHONE_EQUALIZER_INEAR = 0x04000002 +}; + +/** + * Screen sharing configurations. + */ +struct ScreenCaptureParameters { + /** + * On Windows and macOS, it represents the video encoding resolution of the shared screen stream. + * See `VideoDimensions`. The default value is 1920 x 1080, that is, 2,073,600 pixels. Agora uses + * the value of this parameter to calculate the charges. + * + * If the aspect ratio is different between the encoding dimensions and screen dimensions, Agora + * applies the following algorithms for encoding. Suppose dimensions are 1920 x 1080: + * - If the value of the screen dimensions is lower than that of dimensions, for example, + * 1000 x 1000 pixels, the SDK uses 1000 x 1000 pixels for encoding. + * - If the value of the screen dimensions is higher than that of dimensions, for example, + * 2000 x 1500, the SDK uses the maximum value under dimensions with the aspect ratio of + * the screen dimension (4:3) for encoding, that is, 1440 x 1080. + */ + VideoDimensions dimensions; + /** + * On Windows and macOS, it represents the video encoding frame rate (fps) of the shared screen stream. + * The frame rate (fps) of the shared region. The default value is 5. We do not recommend setting + * this to a value greater than 15. + */ + int frameRate; + /** + * On Windows and macOS, it represents the video encoding bitrate of the shared screen stream. + * The bitrate (Kbps) of the shared region. The default value is 0 (the SDK works out a bitrate + * according to the dimensions of the current screen). + */ + int bitrate; + /** Whether to capture the mouse in screen sharing: + * - `true`: (Default) Capture the mouse. + * - `false`: Do not capture the mouse. + */ + bool captureMouseCursor; + /** + * Whether to bring the window to the front when calling the `startScreenCaptureByWindowId` method to share it: + * - `true`: Bring the window to the front. + * - `false`: (Default) Do not bring the window to the front. + */ + bool windowFocus; + /** + * A list of IDs of windows to be blocked. When calling `startScreenCaptureByDisplayId` to start screen sharing, + * you can use this parameter to block a specified window. When calling `updateScreenCaptureParameters` to update + * screen sharing configurations, you can use this parameter to dynamically block the specified windows during + * screen sharing. + */ + view_t *excludeWindowList; + /** + * The number of windows to be blocked. + */ + int excludeWindowCount; + + /** The width (px) of the border. Defaults to 0, and the value range is [0,50]. + * + */ + int highLightWidth; + /** The color of the border in RGBA format. The default value is 0xFF8CBF26. + * + */ + unsigned int highLightColor; + /** Whether to place a border around the shared window or screen: + * - true: Place a border. + * - false: (Default) Do not place a border. + * + * @note When you share a part of a window or screen, the SDK places a border around the entire window or screen if you set `enableHighLight` as true. + * + */ + bool enableHighLight; + + ScreenCaptureParameters() + : dimensions(1920, 1080), frameRate(5), bitrate(STANDARD_BITRATE), captureMouseCursor(true), windowFocus(false), excludeWindowList(OPTIONAL_NULLPTR), excludeWindowCount(0), highLightWidth(0), highLightColor(0), enableHighLight(false) {} + ScreenCaptureParameters(const VideoDimensions& d, int f, int b) + : dimensions(d), frameRate(f), bitrate(b), captureMouseCursor(true), windowFocus(false), excludeWindowList(OPTIONAL_NULLPTR), excludeWindowCount(0), highLightWidth(0), highLightColor(0), enableHighLight(false) {} + ScreenCaptureParameters(int width, int height, int f, int b) + : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(true), windowFocus(false), excludeWindowList(OPTIONAL_NULLPTR), excludeWindowCount(0), highLightWidth(0), highLightColor(0), enableHighLight(false){} + ScreenCaptureParameters(int width, int height, int f, int b, bool cur, bool fcs) + : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(cur), windowFocus(fcs), excludeWindowList(OPTIONAL_NULLPTR), excludeWindowCount(0), highLightWidth(0), highLightColor(0), enableHighLight(false) {} + ScreenCaptureParameters(int width, int height, int f, int b, view_t *ex, int cnt) + : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(true), windowFocus(false), excludeWindowList(ex), excludeWindowCount(cnt), highLightWidth(0), highLightColor(0), enableHighLight(false) {} + ScreenCaptureParameters(int width, int height, int f, int b, bool cur, bool fcs, view_t *ex, int cnt) + : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(cur), windowFocus(fcs), excludeWindowList(ex), excludeWindowCount(cnt), highLightWidth(0), highLightColor(0), enableHighLight(false) {} +}; + +/** + * Audio recording quality. + */ +enum AUDIO_RECORDING_QUALITY_TYPE { + /** + * 0: Low quality. The sample rate is 32 kHz, and the file size is around 1.2 MB after 10 minutes of recording. + */ + AUDIO_RECORDING_QUALITY_LOW = 0, + /** + * 1: Medium quality. The sample rate is 32 kHz, and the file size is around 2 MB after 10 minutes of recording. + */ + AUDIO_RECORDING_QUALITY_MEDIUM = 1, + /** + * 2: High quality. The sample rate is 32 kHz, and the file size is around 3.75 MB after 10 minutes of recording. + */ + AUDIO_RECORDING_QUALITY_HIGH = 2, + /** + * 3: Ultra high audio recording quality. + */ + AUDIO_RECORDING_QUALITY_ULTRA_HIGH = 3, +}; + +/** + * Recording content. Set in `startAudioRecording`. + */ +enum AUDIO_FILE_RECORDING_TYPE { + /** + * 1: Only records the audio of the local user. + */ + AUDIO_FILE_RECORDING_MIC = 1, + /** + * 2: Only records the audio of all remote users. + */ + AUDIO_FILE_RECORDING_PLAYBACK = 2, + /** + * 3: Records the mixed audio of the local and all remote users. + */ + AUDIO_FILE_RECORDING_MIXED = 3, + /** + * 4: publish audio file recording. + */ + AUDIO_FILE_RECORDING_PUBLISH = 4, +}; + +/** + * Audio encoded frame observer position. + */ +enum AUDIO_ENCODED_FRAME_OBSERVER_POSITION { + /** + * 1: Only records the audio of the local user. + */ + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_RECORD = 1, + /** + * 2: Only records the audio of all remote users. + */ + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK = 2, + /** + * 3: Records the mixed audio of the local and all remote users. + */ + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_MIXED = 3, +}; + +/** + * Recording configuration. + */ +struct AudioRecordingConfiguration { + /** + * The absolute path (including the filename extensions) of the recording file. For example: `C:\music\audio.mp4`. + * @note Ensure that the directory for the log files exists and is writable. + */ + const char* filePath; + /** + * Whether to encode the audio data: + * - `true`: Encode audio data in AAC. + * - `false`: (Default) Do not encode audio data, but save the recorded audio data directly. + */ + bool encode; + /** + * Recording sample rate (Hz). + * - 16000 + * - (Default) 32000 + * - 44100 + * - 48000 + * @note If you set this parameter to 44100 or 48000, Agora recommends recording WAV files, or AAC files with quality + * to be `AUDIO_RECORDING_QUALITY_MEDIUM` or `AUDIO_RECORDING_QUALITY_HIGH` for better recording quality. + */ + int sampleRate; + /** + * The recording content. See `AUDIO_FILE_RECORDING_TYPE`. + */ + AUDIO_FILE_RECORDING_TYPE fileRecordingType; + /** + * Recording quality. See `AUDIO_RECORDING_QUALITY_TYPE`. + * @note This parameter applies to AAC files only. + */ + AUDIO_RECORDING_QUALITY_TYPE quality; + + /** + * Recording channel. The following values are supported: + * - (Default) 1 + * - 2 + */ + int recordingChannel; + + AudioRecordingConfiguration() + : filePath(NULL), + encode(false), + sampleRate(32000), + fileRecordingType(AUDIO_FILE_RECORDING_MIXED), + quality(AUDIO_RECORDING_QUALITY_LOW), + recordingChannel(1) {} + + AudioRecordingConfiguration(const char* file_path, int sample_rate, AUDIO_RECORDING_QUALITY_TYPE quality_type, int channel) + : filePath(file_path), + encode(false), + sampleRate(sample_rate), + fileRecordingType(AUDIO_FILE_RECORDING_MIXED), + quality(quality_type), + recordingChannel(channel) {} + + AudioRecordingConfiguration(const char* file_path, bool enc, int sample_rate, AUDIO_FILE_RECORDING_TYPE type, AUDIO_RECORDING_QUALITY_TYPE quality_type, int channel) + : filePath(file_path), + encode(enc), + sampleRate(sample_rate), + fileRecordingType(type), + quality(quality_type), + recordingChannel(channel) {} + + AudioRecordingConfiguration(const AudioRecordingConfiguration &rhs) + : filePath(rhs.filePath), + encode(rhs.encode), + sampleRate(rhs.sampleRate), + fileRecordingType(rhs.fileRecordingType), + quality(rhs.quality), + recordingChannel(rhs.recordingChannel) {} +}; + +/** + * Observer settings for the encoded audio. + */ +struct AudioEncodedFrameObserverConfig { + /** + * Audio profile. For details, see `AUDIO_ENCODED_FRAME_OBSERVER_POSITION`. + */ + AUDIO_ENCODED_FRAME_OBSERVER_POSITION postionType; + /** + * Audio encoding type. For details, see `AUDIO_ENCODING_TYPE`. + */ + AUDIO_ENCODING_TYPE encodingType; + + AudioEncodedFrameObserverConfig() + : postionType(AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK), + encodingType(AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM){} + +}; +/** + * The encoded audio observer. + */ +class IAudioEncodedFrameObserver { +public: +/** +* Gets the encoded audio data of the local user. +* +* After calling `registerAudioEncodedFrameObserver` and setting the encoded audio as `AUDIO_ENCODED_FRAME_OBSERVER_POSITION_RECORD`, +* you can get the encoded audio data of the local user from this callback. +* +* @param frameBuffer The pointer to the audio frame buffer. +* @param length The data length (byte) of the audio frame. +* @param audioEncodedFrameInfo Audio information after encoding. For details, see `EncodedAudioFrameInfo`. +*/ +virtual void OnRecordAudioEncodedFrame(const uint8_t* frameBuffer, int length, const EncodedAudioFrameInfo& audioEncodedFrameInfo) = 0; + +/** +* Gets the encoded audio data of all remote users. +* +* After calling `registerAudioEncodedFrameObserver` and setting the encoded audio as `AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK`, +* you can get encoded audio data of all remote users through this callback. +* +* @param frameBuffer The pointer to the audio frame buffer. +* @param length The data length (byte) of the audio frame. +* @param audioEncodedFrameInfo Audio information after encoding. For details, see `EncodedAudioFrameInfo`. +*/ +virtual void OnPlaybackAudioEncodedFrame(const uint8_t* frameBuffer, int length, const EncodedAudioFrameInfo& audioEncodedFrameInfo) = 0; + +/** +* Gets the mixed and encoded audio data of the local and all remote users. +* +* After calling `registerAudioEncodedFrameObserver` and setting the audio profile as `AUDIO_ENCODED_FRAME_OBSERVER_POSITION_MIXED`, +* you can get the mixed and encoded audio data of the local and all remote users through this callback. +* +* @param frameBuffer The pointer to the audio frame buffer. +* @param length The data length (byte) of the audio frame. +* @param audioEncodedFrameInfo Audio information after encoding. For details, see `EncodedAudioFrameInfo`. +*/ +virtual void OnMixedAudioEncodedFrame(const uint8_t* frameBuffer, int length, const EncodedAudioFrameInfo& audioEncodedFrameInfo) = 0; + +/** +* Occurs each time the SDK receives an encoded before-publish audio frame. +* @param frameBuffer The pointer to the audio frame buffer. +* @param length The data length of the audio frame. +* @param audioEncodedFrameInfo The information of the encoded audio frame: EncodedAudioFrameInfo. + +*/ +virtual void OnPublishAudioEncodedFrame(const uint8_t* frameBuffer, int length, const EncodedAudioFrameInfo& audioEncodedFrameInfo) = 0; + +virtual ~IAudioEncodedFrameObserver () {} +}; + +/** The region for connection, which is the region where the server the SDK connects to is located. + */ +enum AREA_CODE { + /** + * Mainland China. + */ + AREA_CODE_CN = 0x00000001, + /** + * North America. + */ + AREA_CODE_NA = 0x00000002, + /** + * Europe. + */ + AREA_CODE_EU = 0x00000004, + /** + * Asia, excluding Mainland China. + */ + AREA_CODE_AS = 0x00000008, + /** + * Japan. + */ + AREA_CODE_JP = 0x00000010, + /** + * India. + */ + AREA_CODE_IN = 0x00000020, + /** + * (Default) Global. + */ + AREA_CODE_GLOB = (0xFFFFFFFF) +}; + +enum AREA_CODE_EX { + /** + * Oceania + */ + AREA_CODE_OC = 0x00000040, + /** + * South-American + */ + AREA_CODE_SA = 0x00000080, + /** + * Africa + */ + AREA_CODE_AF = 0x00000100, + /** + * South Korea + */ + AREA_CODE_KR = 0x00000200, + /** + * Hong Kong and Macou + */ + AREA_CODE_HKMC = 0x00000400, + /** + * United States + */ + AREA_CODE_US = 0x00000800, + /** + * Russia + */ + AREA_CODE_RU = 0x00001000, + /** + * The global area (except China) + */ + AREA_CODE_OVS = 0xFFFFFFFE +}; + +/** + * The error code of the channel media replay. + */ +enum CHANNEL_MEDIA_RELAY_ERROR { + /** 0: No error. + */ + RELAY_OK = 0, + /** 1: An error occurs in the server response. + */ + RELAY_ERROR_SERVER_ERROR_RESPONSE = 1, + /** 2: No server response. You can call the `leaveChannel` method to leave the channel. + * + * This error can also occur if your project has not enabled co-host token authentication. You can contact technical + * support to enable the service for cohosting across channels before starting a channel media relay. + */ + RELAY_ERROR_SERVER_NO_RESPONSE = 2, + /** 3: The SDK fails to access the service, probably due to limited resources of the server. + */ + RELAY_ERROR_NO_RESOURCE_AVAILABLE = 3, + /** 4: Fails to send the relay request. + */ + RELAY_ERROR_FAILED_JOIN_SRC = 4, + /** 5: Fails to accept the relay request. + */ + RELAY_ERROR_FAILED_JOIN_DEST = 5, + /** 6: The server fails to receive the media stream. + */ + RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC = 6, + /** 7: The server fails to send the media stream. + */ + RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST = 7, + /** 8: The SDK disconnects from the server due to poor network connections. You can call the `leaveChannel` method to + * leave the channel. + */ + RELAY_ERROR_SERVER_CONNECTION_LOST = 8, + /** 9: An internal error occurs in the server. + */ + RELAY_ERROR_INTERNAL_ERROR = 9, + /** 10: The token of the source channel has expired. + */ + RELAY_ERROR_SRC_TOKEN_EXPIRED = 10, + /** 11: The token of the destination channel has expired. + */ + RELAY_ERROR_DEST_TOKEN_EXPIRED = 11, +}; + +/** + * The event code of channel media relay. + */ +enum CHANNEL_MEDIA_RELAY_EVENT { + /** 0: The user disconnects from the server due to poor network connections. + */ + RELAY_EVENT_NETWORK_DISCONNECTED = 0, + /** 1: The user is connected to the server. + */ + RELAY_EVENT_NETWORK_CONNECTED = 1, + /** 2: The user joins the source channel. + */ + RELAY_EVENT_PACKET_JOINED_SRC_CHANNEL = 2, + /** 3: The user joins the destination channel. + */ + RELAY_EVENT_PACKET_JOINED_DEST_CHANNEL = 3, + /** 4: The SDK starts relaying the media stream to the destination channel. + */ + RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL = 4, + /** 5: The server receives the video stream from the source channel. + */ + RELAY_EVENT_PACKET_RECEIVED_VIDEO_FROM_SRC = 5, + /** 6: The server receives the audio stream from the source channel. + */ + RELAY_EVENT_PACKET_RECEIVED_AUDIO_FROM_SRC = 6, + /** 7: The destination channel is updated. + */ + RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL = 7, + /** 8: The destination channel update fails due to internal reasons. + */ + RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_REFUSED = 8, + /** 9: The destination channel does not change, which means that the destination channel fails to be updated. + */ + RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE = 9, + /** 10: The destination channel name is NULL. + */ + RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL = 10, + /** 11: The video profile is sent to the server. + */ + RELAY_EVENT_VIDEO_PROFILE_UPDATE = 11, + /** 12: The SDK successfully pauses relaying the media stream to destination channels. + */ + RELAY_EVENT_PAUSE_SEND_PACKET_TO_DEST_CHANNEL_SUCCESS = 12, + /** 13: The SDK fails to pause relaying the media stream to destination channels. + */ + RELAY_EVENT_PAUSE_SEND_PACKET_TO_DEST_CHANNEL_FAILED = 13, + /** 14: The SDK successfully resumes relaying the media stream to destination channels. + */ + RELAY_EVENT_RESUME_SEND_PACKET_TO_DEST_CHANNEL_SUCCESS = 14, + /** 15: The SDK fails to resume relaying the media stream to destination channels. + */ + RELAY_EVENT_RESUME_SEND_PACKET_TO_DEST_CHANNEL_FAILED = 15, +}; +/** + * The state code of the channel media relay. + */ +enum CHANNEL_MEDIA_RELAY_STATE { + /** 0: The initial state. After you successfully stop the channel media relay by calling `stopChannelMediaRelay`, + * the `onChannelMediaRelayStateChanged` callback returns this state. + */ + RELAY_STATE_IDLE = 0, + /** 1: The SDK tries to relay the media stream to the destination channel. + */ + RELAY_STATE_CONNECTING = 1, + /** 2: The SDK successfully relays the media stream to the destination channel. + */ + RELAY_STATE_RUNNING = 2, + /** 3: An error occurs. See `code` in `onChannelMediaRelayStateChanged` for the error code. + */ + RELAY_STATE_FAILURE = 3, +}; + +/** The definition of ChannelMediaInfo. + */ +struct ChannelMediaInfo { + /** The channel name. The default value is NULL, which means that the SDK + * applies the current channel name. + */ + const char* channelName; + /** The token that enables the user to join the channel. The default value + * is NULL, which means that the SDK applies the current token. + */ + const char* token; + /** The user ID. + */ + uid_t uid; +}; + +/** The definition of ChannelMediaRelayConfiguration. + */ +struct ChannelMediaRelayConfiguration { + /** The information of the source channel `ChannelMediaInfo`. It contains the following members: + * - `channelName`: The name of the source channel. The default value is `NULL`, which means the SDK applies the name + * of the current channel. + * - `uid`: The unique ID to identify the relay stream in the source channel. The default value is 0, which means the + * SDK generates a random UID. You must set it as 0. + * - `token`: The token for joining the source channel. It is generated with the `channelName` and `uid` you set in + * `srcInfo`. + * - If you have not enabled the App Certificate, set this parameter as the default value `NULL`, which means the + * SDK applies the App ID. + * - If you have enabled the App Certificate, you must use the token generated with the `channelName` and `uid`, and + * the `uid` must be set as 0. + */ + ChannelMediaInfo *srcInfo; + /** The information of the destination channel `ChannelMediaInfo`. It contains the following members: + * - `channelName`: The name of the destination channel. + * - `uid`: The unique ID to identify the relay stream in the destination channel. The value + * ranges from 0 to (2^32-1). To avoid UID conflicts, this `UID` must be different from any + * other `UID` in the destination channel. The default value is 0, which means the SDK generates + * a random `UID`. Do not set this parameter as the `UID` of the host in the destination channel, + * and ensure that this `UID` is different from any other `UID` in the channel. + * - `token`: The token for joining the destination channel. It is generated with the `channelName` + * and `uid` you set in `destInfos`. + * - If you have not enabled the App Certificate, set this parameter as the default value NULL, + * which means the SDK applies the App ID. + * If you have enabled the App Certificate, you must use the token generated with the `channelName` + * and `uid`. + */ + ChannelMediaInfo *destInfos; + /** The number of destination channels. The default value is 0, and the value range is from 0 to + * 4. Ensure that the value of this parameter corresponds to the number of `ChannelMediaInfo` + * structs you define in `destInfo`. + */ + int destCount; + + ChannelMediaRelayConfiguration() + : srcInfo(NULL), + destInfos(NULL), + destCount(0) + {} +}; + +/** + * The uplink network information. + */ +struct UplinkNetworkInfo { + /** + * The target video encoder bitrate (bps). + */ + int video_encoder_target_bitrate_bps; + + UplinkNetworkInfo() : video_encoder_target_bitrate_bps(0) {} + + bool operator==(const UplinkNetworkInfo& rhs) const { + return (video_encoder_target_bitrate_bps == rhs.video_encoder_target_bitrate_bps); + } +}; + +/** + * The collections of downlink network info. + */ +struct DownlinkNetworkInfo { + struct PeerDownlinkInfo { + /** + * The ID of the user who owns the remote video stream. + */ + const char* uid; + /** + * The remote video stream type: #VIDEO_STREAM_TYPE. + */ + VIDEO_STREAM_TYPE stream_type; + /** + * The remote video downscale type: #REMOTE_VIDEO_DOWNSCALE_LEVEL. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL current_downscale_level; + /** + * The expected bitrate in bps. + */ + int expected_bitrate_bps; + + PeerDownlinkInfo() + : uid(OPTIONAL_NULLPTR), + stream_type(VIDEO_STREAM_HIGH), + current_downscale_level(REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE), + expected_bitrate_bps(-1) {} + + PeerDownlinkInfo& operator=(const PeerDownlinkInfo& rhs) { + if (this == &rhs) return *this; + uid = OPTIONAL_NULLPTR; + stream_type = rhs.stream_type; + current_downscale_level = rhs.current_downscale_level; + expected_bitrate_bps = rhs.expected_bitrate_bps; + if (rhs.uid != OPTIONAL_NULLPTR) { + char* temp = new char[strlen(rhs.uid) + 1]; + strcpy(temp, rhs.uid); + uid = temp; + } + return *this; + } + + ~PeerDownlinkInfo() { + if (uid) { delete [] uid; } + } + }; + + /** + * The lastmile buffer delay queue time in ms. + */ + int lastmile_buffer_delay_time_ms; + /** + * The current downlink bandwidth estimation(bps) after downscale. + */ + int bandwidth_estimation_bps; + /** + * The total video downscale level count. + */ + int total_downscale_level_count; + /** + * The peer video downlink info array. + */ + PeerDownlinkInfo* peer_downlink_info; + /** + * The total video received count. + */ + int total_received_video_count; + + DownlinkNetworkInfo() + : lastmile_buffer_delay_time_ms(-1), + bandwidth_estimation_bps(-1), + total_downscale_level_count(-1), + peer_downlink_info(OPTIONAL_NULLPTR), + total_received_video_count(-1) {} + + DownlinkNetworkInfo(const DownlinkNetworkInfo& info) + : lastmile_buffer_delay_time_ms(info.lastmile_buffer_delay_time_ms), + bandwidth_estimation_bps(info.bandwidth_estimation_bps), + total_downscale_level_count(info.total_downscale_level_count), + peer_downlink_info(OPTIONAL_NULLPTR), + total_received_video_count(info.total_received_video_count) { + if (total_received_video_count <= 0) return; + peer_downlink_info = new PeerDownlinkInfo[total_received_video_count]; + for (int i = 0; i < total_received_video_count; ++i) + peer_downlink_info[i] = info.peer_downlink_info[i]; + } + + DownlinkNetworkInfo& operator=(const DownlinkNetworkInfo& rhs) { + if (this == &rhs) return *this; + lastmile_buffer_delay_time_ms = rhs.lastmile_buffer_delay_time_ms; + bandwidth_estimation_bps = rhs.bandwidth_estimation_bps; + total_downscale_level_count = rhs.total_downscale_level_count; + peer_downlink_info = OPTIONAL_NULLPTR; + total_received_video_count = rhs.total_received_video_count; + if (total_received_video_count > 0) { + peer_downlink_info = new PeerDownlinkInfo[total_received_video_count]; + for (int i = 0; i < total_received_video_count; ++i) + peer_downlink_info[i] = rhs.peer_downlink_info[i]; + } + return *this; + } + + ~DownlinkNetworkInfo() { + if (peer_downlink_info) delete [] peer_downlink_info; + } +}; + +/** + * The built-in encryption mode. + * + * Agora recommends using AES_128_GCM2 or AES_256_GCM2 encrypted mode. These two modes support the + * use of salt for higher security. + */ +enum ENCRYPTION_MODE { + /** 1: 128-bit AES encryption, XTS mode. + */ + AES_128_XTS = 1, + /** 2: 128-bit AES encryption, ECB mode. + */ + AES_128_ECB = 2, + /** 3: 256-bit AES encryption, XTS mode. + */ + AES_256_XTS = 3, + /** 4: 128-bit SM4 encryption, ECB mode. + */ + SM4_128_ECB = 4, + /** 5: 128-bit AES encryption, GCM mode. + */ + AES_128_GCM = 5, + /** 6: 256-bit AES encryption, GCM mode. + */ + AES_256_GCM = 6, + /** 7: (Default) 128-bit AES encryption, GCM mode. This encryption mode requires the setting of + * salt (`encryptionKdfSalt`). + */ + AES_128_GCM2 = 7, + /** 8: 256-bit AES encryption, GCM mode. This encryption mode requires the setting of salt (`encryptionKdfSalt`). + */ + AES_256_GCM2 = 8, + /** Enumerator boundary. + */ + MODE_END, +}; + +/** Built-in encryption configurations. */ +struct EncryptionConfig { + /** + * The built-in encryption mode. See #ENCRYPTION_MODE. Agora recommends using `AES_128_GCM2` + * or `AES_256_GCM2` encrypted mode. These two modes support the use of salt for higher security. + */ + ENCRYPTION_MODE encryptionMode; + /** + * Encryption key in string type with unlimited length. Agora recommends using a 32-byte key. + * + * @note If you do not set an encryption key or set it as NULL, you cannot use the built-in encryption, and the SDK returns #ERR_INVALID_ARGUMENT (-2). + */ + const char* encryptionKey; + /** + * Salt, 32 bytes in length. Agora recommends that you use OpenSSL to generate salt on the server side. + * + * @note This parameter takes effect only in `AES_128_GCM2` or `AES_256_GCM2` encrypted mode. + * In this case, ensure that this parameter is not 0. + */ + uint8_t encryptionKdfSalt[32]; + + bool datastreamEncryptionEnabled; + + EncryptionConfig() + : encryptionMode(AES_128_GCM2), + encryptionKey(NULL), + datastreamEncryptionEnabled(false) + { + memset(encryptionKdfSalt, 0, sizeof(encryptionKdfSalt)); + } + + /// @cond + const char* getEncryptionString() const { + switch(encryptionMode) { + case AES_128_XTS: + return "aes-128-xts"; + case AES_128_ECB: + return "aes-128-ecb"; + case AES_256_XTS: + return "aes-256-xts"; + case SM4_128_ECB: + return "sm4-128-ecb"; + case AES_128_GCM: + return "aes-128-gcm"; + case AES_256_GCM: + return "aes-256-gcm"; + case AES_128_GCM2: + return "aes-128-gcm-2"; + case AES_256_GCM2: + return "aes-256-gcm-2"; + default: + return "aes-128-gcm-2"; + } + return "aes-128-gcm-2"; + } + /// @endcond +}; + +/** Encryption error type. + */ +enum ENCRYPTION_ERROR_TYPE { + /** + * 0: Internal reason. + */ + ENCRYPTION_ERROR_INTERNAL_FAILURE = 0, + /** + * 1: MediaStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + */ + ENCRYPTION_ERROR_DECRYPTION_FAILURE = 1, + /** + * 2: MediaStream encryption errors. + */ + ENCRYPTION_ERROR_ENCRYPTION_FAILURE = 2, + /** + * 3: DataStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + */ + ENCRYPTION_ERROR_DATASTREAM_DECRYPTION_FAILURE = 3, + /** + * 4: DataStream encryption errors. + */ + ENCRYPTION_ERROR_DATASTREAM_ENCRYPTION_FAILURE = 4, +}; + +enum UPLOAD_ERROR_REASON +{ + UPLOAD_SUCCESS = 0, + UPLOAD_NET_ERROR = 1, + UPLOAD_SERVER_ERROR = 2, +}; + +/** The type of the device permission. + */ +enum PERMISSION_TYPE { + /** + * 0: Permission for the audio capture device. + */ + RECORD_AUDIO = 0, + /** + * 1: Permission for the camera. + */ + CAMERA = 1, + + SCREEN_CAPTURE = 2, +}; + +/** The maximum length of the user account. + */ +enum MAX_USER_ACCOUNT_LENGTH_TYPE +{ + /** The maximum length of the user account is 256 bytes. + */ + MAX_USER_ACCOUNT_LENGTH = 256 +}; + +/** + * The subscribing state. + */ +enum STREAM_SUBSCRIBE_STATE { + /** + * 0: The initial subscribing state after joining the channel. + */ + SUB_STATE_IDLE = 0, + /** + * 1: Fails to subscribe to the remote stream. Possible reasons: + * - The remote user: + * - Calls `muteLocalAudioStream(true)` or `muteLocalVideoStream(true)` to stop sending local + * media stream. + * - Calls `disableAudio` or `disableVideo `to disable the local audio or video module. + * - Calls `enableLocalAudio(false)` or `enableLocalVideo(false)` to disable the local audio or video capture. + * - The role of the remote user is audience. + * - The local user calls the following methods to stop receiving remote streams: + * - Calls `muteRemoteAudioStream(true)`, `muteAllRemoteAudioStreams(true)` or `setDefaultMuteAllRemoteAudioStreams(true)` to stop receiving the remote audio streams. + * - Calls `muteRemoteVideoStream(true)`, `muteAllRemoteVideoStreams(true)` or `setDefaultMuteAllRemoteVideoStreams(true)` to stop receiving the remote video streams. + */ + SUB_STATE_NO_SUBSCRIBED = 1, + /** + * 2: Subscribing. + */ + SUB_STATE_SUBSCRIBING = 2, + /** + * 3: Subscribes to and receives the remote stream successfully. + */ + SUB_STATE_SUBSCRIBED = 3 +}; + +/** + * The publishing state. + */ +enum STREAM_PUBLISH_STATE { + /** + * 0: The initial publishing state after joining the channel. + */ + PUB_STATE_IDLE = 0, + /** + * 1: Fails to publish the local stream. Possible reasons: + * - The local user calls `muteLocalAudioStream(true)` or `muteLocalVideoStream(true)` to stop sending the local media stream. + * - The local user calls `disableAudio` or `disableVideo` to disable the local audio or video module. + * - The local user calls `enableLocalAudio(false)` or `enableLocalVideo(false)` to disable the local audio or video capture. + * - The role of the local user is audience. + */ + PUB_STATE_NO_PUBLISHED = 1, + /** + * 2: Publishing. + */ + PUB_STATE_PUBLISHING = 2, + /** + * 3: Publishes successfully. + */ + PUB_STATE_PUBLISHED = 3 +}; + +/** + * The EchoTestConfiguration struct. + */ +struct EchoTestConfiguration { + view_t view; + bool enableAudio; + bool enableVideo; + const char* token; + const char* channelId; + + EchoTestConfiguration(view_t v, bool ea, bool ev, const char* t, const char* c) + : view(v), enableAudio(ea), enableVideo(ev), token(t), channelId(c) {} + + EchoTestConfiguration() + : view(OPTIONAL_NULLPTR), enableAudio(true), enableVideo(true), token(OPTIONAL_NULLPTR), channelId(OPTIONAL_NULLPTR) {} +}; + +/** + * The information of the user. + */ +struct UserInfo { + /** + * The user ID. + */ + uid_t uid; + /** + * The user account. The maximum data length is `MAX_USER_ACCOUNT_LENGTH_TYPE`. + */ + char userAccount[MAX_USER_ACCOUNT_LENGTH]; + UserInfo() + : uid(0) { + userAccount[0] = '\0'; + } +}; + +/** + * The audio filter of in-ear monitoring. + */ +enum EAR_MONITORING_FILTER_TYPE { + /** + * 1: Do not add an audio filter to the in-ear monitor. + */ + EAR_MONITORING_FILTER_NONE = (1<<0), + /** + * 2: Enable audio filters to the in-ear monitor. If you implement functions such as voice + * beautifier and audio effect, users can hear the voice after adding these effects. + */ + EAR_MONITORING_FILTER_BUILT_IN_AUDIO_FILTERS = (1<<1), + /** + * 4: Enable noise suppression to the in-ear monitor. + */ + EAR_MONITORING_FILTER_NOISE_SUPPRESSION = (1<<2) +}; + +/** + * Thread priority type. + */ +enum THREAD_PRIORITY_TYPE { + /** + * 0: Lowest priority. + */ + LOWEST = 0, + /** + * 1: Low priority. + */ + LOW = 1, + /** + * 2: Normal priority. + */ + NORMAL = 2, + /** + * 3: High priority. + */ + HIGH = 3, + /** + * 4. Highest priority. + */ + HIGHEST = 4, + /** + * 5. Critical priority. + */ + CRITICAL = 5, +}; + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + +/** + * The video configuration for the shared screen stream. + */ +struct ScreenVideoParameters { + /** + * The dimensions of the video encoding resolution. The default value is `1280` x `720`. + * For recommended values, see [Recommended video + * profiles](https://docs.agora.io/en/Interactive%20Broadcast/game_streaming_video_profile?platform=Android#recommended-video-profiles). + * If the aspect ratio is different between width and height and the screen, the SDK adjusts the + * video encoding resolution according to the following rules (using an example where `width` × + * `height` is 1280 × 720): + * - When the width and height of the screen are both lower than `width` and `height`, the SDK + * uses the resolution of the screen for video encoding. For example, if the screen is 640 × + * 360, The SDK uses 640 × 360 for video encoding. + * - When either the width or height of the screen is higher than `width` or `height`, the SDK + * uses the maximum values that do not exceed those of `width` and `height` while maintaining + * the aspect ratio of the screen for video encoding. For example, if the screen is 2000 × 1500, + * the SDK uses 960 × 720 for video encoding. + * + * @note + * - The billing of the screen sharing stream is based on the values of width and height. + * When you do not pass in these values, Agora bills you at 1280 × 720; + * when you pass in these values, Agora bills you at those values. + * For details, see [Pricing for Real-time + * Communication](https://docs.agora.io/en/Interactive%20Broadcast/billing_rtc). + * - This value does not indicate the orientation mode of the output ratio. + * For how to set the video orientation, see `ORIENTATION_MODE`. + * - Whether the SDK can support a resolution at 720P depends on the performance of the device. + * If you set 720P but the device cannot support it, the video frame rate can be lower. + */ + VideoDimensions dimensions; + /** + * The video encoding frame rate (fps). The default value is `15`. + * For recommended values, see [Recommended video + * profiles](https://docs.agora.io/en/Interactive%20Broadcast/game_streaming_video_profile?platform=Android#recommended-video-profiles). + */ + int frameRate = 15; + /** + * The video encoding bitrate (Kbps). For recommended values, see [Recommended video + * profiles](https://docs.agora.io/en/Interactive%20Broadcast/game_streaming_video_profile?platform=Android#recommended-video-profiles). + */ + int bitrate; + /* + * The content hint of the screen sharing: + */ + VIDEO_CONTENT_HINT contentHint = VIDEO_CONTENT_HINT::CONTENT_HINT_MOTION; + + ScreenVideoParameters() : dimensions(1280, 720) {} +}; + +/** + * The audio configuration for the shared screen stream. + */ +struct ScreenAudioParameters { + /** + * The audio sample rate (Hz). The default value is `48000`. + */ + int sampleRate = 48000; + /** + * The number of audio channels. The default value is `2`, indicating dual channels. + */ + int channels = 2; + /** + * The volume of the captured system audio. The value range is [0,100]. The default value is + * `100`. + */ + int captureSignalVolume = 100; +}; + +/** + * The configuration of the screen sharing + */ +struct ScreenCaptureParameters2 { + /** + * Determines whether to capture system audio during screen sharing: + * - `true`: Capture. + * - `false`: (Default) Do not capture. + * + * **Note** + * Due to system limitations, capturing system audio is only available for Android API level 29 + * and later (that is, Android 10 and later). + */ + bool captureAudio = false; + /** + * The audio configuration for the shared screen stream. + */ + ScreenAudioParameters audioParams; + /** + * Determines whether to capture the screen during screen sharing: + * - `true`: (Default) Capture. + * - `false`: Do not capture. + * + * **Note** + * Due to system limitations, screen capture is only available for Android API level 21 and later + * (that is, Android 5 and later). + */ + bool captureVideo = true; + /** + * The video configuration for the shared screen stream. + */ + ScreenVideoParameters videoParams; +}; +#endif + +/** + * The tracing event of media rendering. + */ +enum MEDIA_TRACE_EVENT { + /** + * 0: The media frame has been rendered. + */ + MEDIA_TRACE_EVENT_VIDEO_RENDERED = 0, + /** + * 1: The media frame has been decoded. + */ + MEDIA_TRACE_EVENT_VIDEO_DECODED, +}; + +/** + * The video rendering tracing result + */ +struct VideoRenderingTracingInfo { + /** + * Elapsed time from the start tracing time to the time when the tracing event occurred. + */ + int elapsedTime; + /** + * Elapsed time from the start tracing time to the time when join channel. + * + * **Note** + * If the start tracing time is behind the time when join channel, this value will be negative. + */ + int start2JoinChannel; + /** + * Elapsed time from joining channel to finishing joining channel. + */ + int join2JoinSuccess; + /** + * Elapsed time from finishing joining channel to remote user joined. + * + * **Note** + * If the start tracing time is after the time finishing join channel, this value will be + * the elapsed time from the start tracing time to remote user joined. The minimum value is 0. + */ + int joinSuccess2RemoteJoined; + /** + * Elapsed time from remote user joined to set the view. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to set the view. The minimum value is 0. + */ + int remoteJoined2SetView; + /** + * Elapsed time from remote user joined to the time subscribing remote video stream. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to the time subscribing remote video stream. + * The minimum value is 0. + */ + int remoteJoined2UnmuteVideo; + /** + * Elapsed time from remote user joined to the remote video packet received. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to the time subscribing remote video stream. + * The minimum value is 0. + */ + int remoteJoined2PacketReceived; +}; + +} // namespace rtc + +namespace base { + +class IEngineBase { + public: + virtual int queryInterface(rtc::INTERFACE_ID_TYPE iid, void** inter) = 0; + virtual ~IEngineBase() {} +}; + +class AParameter : public agora::util::AutoPtr { + public: + AParameter(IEngineBase& engine) { initialize(&engine); } + AParameter(IEngineBase* engine) { initialize(engine); } + AParameter(IAgoraParameter* p) : agora::util::AutoPtr(p) {} + + private: + bool initialize(IEngineBase* engine) { + IAgoraParameter* p = NULL; + if (engine && !engine->queryInterface(rtc::AGORA_IID_PARAMETER_ENGINE, (void**)&p)) reset(p); + return p != NULL; + } +}; + +class LicenseCallback { + public: + virtual ~LicenseCallback() {} + virtual void onCertificateRequired() = 0; + virtual void onLicenseRequest() = 0; + virtual void onLicenseValidated() = 0; + virtual void onLicenseError(int result) = 0; +}; + +} // namespace base + +/** + * Spatial audio parameters + */ +struct SpatialAudioParams { + /** + * Speaker azimuth in a spherical coordinate system centered on the listener. + */ + Optional speaker_azimuth; + /** + * Speaker elevation in a spherical coordinate system centered on the listener. + */ + Optional speaker_elevation; + /** + * Distance between speaker and listener. + */ + Optional speaker_distance; + /** + * Speaker orientation [0-180], 0 degree is the same with listener orientation. + */ + Optional speaker_orientation; + /** + * Enable blur or not for the speaker. + */ + Optional enable_blur; + /** + * Enable air absorb or not for the speaker. + */ + Optional enable_air_absorb; + /** + * Speaker attenuation factor. + */ + Optional speaker_attenuation; + /** + * Enable doppler factor. + */ + Optional enable_doppler; +}; + +struct VideoLayout +{ + const char* channelId; + uint32_t uid; + const char* strUid; + uint32_t x; + uint32_t y; + uint32_t width; + uint32_t height; + uint32_t videoState; +}; +} // namespace agora + +/** + * Gets the version of the SDK. + * @param [out] build The build number of Agora SDK. + * @return The string of the version of the SDK. + */ +AGORA_API const char* AGORA_CALL getAgoraSdkVersion(int* build); + +/** + * Gets error description of an error code. + * @param [in] err The error code. + * @return The description of the error code. + */ +AGORA_API const char* AGORA_CALL getAgoraSdkErrorDescription(int err); + +AGORA_API int AGORA_CALL setAgoraSdkExternalSymbolLoader(void* (*func)(const char* symname)); + +/** + * Generate credential + * @param [in, out] credential The content of the credential. + * @return The description of the error code. + * @note For license only, everytime will generate a different credential. + * So, just need to call once for a device, and then save the credential + */ +AGORA_API int AGORA_CALL createAgoraCredential(agora::util::AString &credential); + +/** + * Verify given certificate and return the result + * When you receive onCertificateRequired event, you must validate the certificate by calling + * this function. This is sync call, and if validation is success, it will return ERR_OK. And + * if failed to pass validation, you won't be able to joinChannel and ERR_CERT_FAIL will be + * returned. + * @param [in] credential_buf pointer to the credential's content. + * @param [in] credential_len the length of the credential's content. + * @param [in] certificate_buf pointer to the certificate's content. + * @param [in] certificate_len the length of the certificate's content. + * @return The description of the error code. + * @note For license only. + */ +AGORA_API int AGORA_CALL getAgoraCertificateVerifyResult(const char *credential_buf, int credential_len, + const char *certificate_buf, int certificate_len); + +/** + * @brief Implement the agora::base::LicenseCallback, + * create a LicenseCallback object to receive callbacks of license. + * + * @param [in] callback The object of agora::LiceseCallback, + * set the callback to null before delete it. + */ +AGORA_API void setAgoraLicenseCallback(agora::base::LicenseCallback *callback); + +/** + * @brief Get the LicenseCallback pointer if already setup, + * otherwise, return null. + * + * @return a pointer of agora::base::LicenseCallback + */ + +AGORA_API agora::base::LicenseCallback* getAgoraLicenseCallback(); + +/* + * Get monotonic time in ms which can be used by capture time, + * typical scenario is as follows: + * + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * | // custom audio/video base capture time, e.g. the first audio/video capture time. | + * | int64_t custom_capture_time_base; | + * | | + * | int64_t agora_monotonic_time = getAgoraCurrentMonotonicTimeInMs(); | + * | | + * | // offset is fixed once calculated in the begining. | + * | const int64_t offset = agora_monotonic_time - custom_capture_time_base; | + * | | + * | // realtime_custom_audio/video_capture_time is the origin capture time that customer provided.| + * | // actual_audio/video_capture_time is the actual capture time transfered to sdk. | + * | int64_t actual_audio_capture_time = realtime_custom_audio_capture_time + offset; | + * | int64_t actual_video_capture_time = realtime_custom_video_capture_time + offset; | + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * + * @return + * - >= 0: Success. + * - < 0: Failure. + */ +AGORA_API int64_t AGORA_CALL getAgoraCurrentMonotonicTimeInMs(); diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraBaseDelegate.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraBaseDelegate.h new file mode 100644 index 0000000..c9d3289 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraBaseDelegate.h @@ -0,0 +1,420 @@ +// +// AgoraRtcEngineKit.h +// AgoraRtcEngineKit +// +// Created by Sting Feng on 2015-8-11. +// Copyright (c) 2015 Agora. All rights reserved. +// + +@class AgoraRtcEngineKit; +#import "AgoraObjects.h" + +@protocol AgoraBaseDelegate +@optional +#pragma mark SDK common delegates + +#pragma mark String UID + +/** Occurs when the local user successfully registers a user account by calling the + * This callback reports the user ID and user account of the local user. + * @param uid The ID of the local user. + * @param userAccount The user account of the local user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalUserRegisteredWithUserId:(NSUInteger)uid userAccount:(NSString * _Nonnull)userAccount NS_SWIFT_NAME(rtcEngine(_:didLocalUserRegisteredWithUserId:userAccount:)); + +/** Occurs when the SDK gets the user ID and user account of the remote user. + + * After a remote user joins the channel, the SDK gets the UID and user account of the remote user, + * caches them in a mapping table object (`userInfo`), and triggers this callback on the local client. + + * @param uid The ID of the remote user. + * @param userInfo The `AgoraUserInfo` object that contains the user ID and user account of the remote user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didUserInfoUpdatedWithUserId:(NSUInteger)uid userInfo:(AgoraUserInfo* _Nonnull)userInfo NS_SWIFT_NAME(rtcEngine(_:didUserInfoUpdatedWithUserId:userInfo:)); + +/** + * The warning occurred in SDK. The APP could igonre the warning, and the SDK could try to resume automically. + * + * @param engine The engine kit + * @param warningCode The warning code + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurWarning:(AgoraWarningCode)warningCode NS_SWIFT_NAME(rtcEngine(_:didOccurWarning:)); + +/** + * The error occurred in SDK. The SDK couldn't resume to normal state, and the app need to handle it. + * + * @param engine The engine kit + * @param errorCode The error code + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurError:(AgoraErrorCode)errorCode NS_SWIFT_NAME(rtcEngine(_:didOccurError:)); + +/** + * Event of load media engine success + * + * @param engine The engine kit + */ +- (void)rtcEngineMediaEngineDidLoaded:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineMediaEngineDidLoaded(_:)); + +/** + * Event of media engine start call success + * + * @param engine The engine kit + */ +- (void)rtcEngineMediaEngineDidStartCall:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineMediaEngineDidStartCall(_:)); + +/** + * when token is enabled, and specified token is invalid or expired, this function will be called. + * APP should generate a new token and call renewToken() to refresh the token. + * NOTE: to be compatible with previous version, ERR_TOKEN_EXPIRED and ERR_INVALID_TOKEN are also reported via onError() callback. + * You should move renew of token logic into this callback. + * @param engine The engine kit + */ +- (void)rtcEngineRequestToken:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRequestToken(_:)); + +/** + * Event of disconnected with server. This event is reported at the moment SDK loses connection with server. + * In the mean time SDK automatically tries to reconnect with the server until APP calls leaveChannel. + * + * @param engine The engine kit + */ +- (void)rtcEngineConnectionDidInterrupted:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidInterrupted(_:)); + +/** + * Event of loss connection with server. This event is reported after the connection is interrupted and exceed the retry period (10 seconds by default). + * In the mean time SDK automatically tries to reconnect with the server until APP calls leaveChannel. + * + * @param engine The engine kit + */ +- (void)rtcEngineConnectionDidLost:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidLost(_:)); + +/** + * Event of connection banned by server. This event is reported after the connection is banned by server. + * In the mean time SDK will not try to reconnect the server. + */ +- (void)rtcEngineConnectionDidBanned:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidBanned(_:)); + +/** + * Statistics of rtc engine status. Updated every two seconds. + * + * @param engine The engine kit + * @param stats The statistics of rtc status, including duration, sent bytes and received bytes + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine reportRtcStats:(AgoraChannelStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:reportRtcStats:)); + +/** + * The network quality of lastmile test. + * + * @param engine The engine kit + * @param quality The network quality + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileQuality:(AgoraNetworkQuality)quality NS_SWIFT_NAME(rtcEngine(_:lastmileQuality:)); + +/** + * Reports the last-mile network probe result. + * + * The SDK triggers this callback within 30 seconds after the app calls the [startLastmileProbeTest]([AgoraRtcEngineKit startLastmileProbeTest:]) method. + * + * @param engine AgoraRtcEngineKit object. + * @param result The uplink and downlink last-mile network probe test result, see [AgoraLastmileProbeResult](AgoraLastmileProbeResult). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileProbeTestResult:(AgoraLastmileProbeResult * _Nonnull)result NS_SWIFT_NAME(rtcEngine(_:lastmileProbeTest:)); + +/** + * Event of API call executed + * @deprecated This callback is deprecated. Use other specific event callbacks instead. + * + * @param engine The engine kit + * @param api The API description + * @param error The error code + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didApiCallExecute:(NSInteger)error api:(NSString * _Nonnull)api result:(NSString * _Nonnull)result NS_SWIFT_NAME(rtcEngine(_:didApiCallExecute:api:result:)) __deprecated; + + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +/** + * the notificaitoin of device added removed + * + * @param engine The engine kit + * @param deviceId the identification of device + * @param deviceType type of device: -1: audio unknown; 0: audio recording ; 1: audio playout ; 2: render; 4: capture + * @param state state of device: 0: added; 1: removed + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine device:(NSString * _Nonnull)deviceId type:(AgoraMediaDeviceType)deviceType stateChanged:(NSInteger)state NS_SWIFT_NAME(rtcEngine(_:device:type:stateChanged:)); + +#endif + +/** + * An error of encryption occurred during SDK runtime. + * + * @param errorType AgoraEncryptionErrorType + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurEncryptionError:(AgoraEncryptionErrorType)errorType NS_SWIFT_NAME(rtcEngine(_:didOccur:)); +/** + * Reports the user log upload result + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine uploadLogResultRequestId:(NSString * _Nonnull)requestId success:(BOOL)success reason:(AgoraUploadErrorReason)reason NS_SWIFT_NAME(rtcEngine(_:uploadLogResultRequestId:success:reason:)); + +#pragma mark Local user common delegates + +/** + * Event of cient role change. only take effect under broadcasting mode + * + * @param engine The engine kit + * @param oldRole The previous role of the local user + * @param newRole The new role of the local user + * @param newRoleOptions The client role options of the current role of the local user + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didClientRoleChanged:(AgoraClientRole)oldRole newRole:(AgoraClientRole)newRole newRoleOptions:(AgoraClientRoleOptions * _Nullable)newRoleOptions NS_SWIFT_NAME(rtcEngine(_:didClientRoleChanged:newRole:newRoleOptions:)); + +/** + * Event of cient role change. only take effect under broadcasting mode + * + * @param engine The engine kit + * @param reason The reason of the failure of the local user role switches + * @param currentRole The current role of the user + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didClientRoleChangeFailed:(AgoraClientRoleChangeFailedReason)reason currentRole:(AgoraClientRole)currentRole NS_SWIFT_NAME(rtcEngine(_:didClientRoleChangeFailed:currentRole:)); + +/** + * The statistics of the call when leave channel + * + * @param engine The engine kit + * @param stats The statistics of the call, including duration, sent bytes and received bytes + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLeaveChannelWithStats:(AgoraChannelStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:didLeaveChannelWith:)); + +#pragma mark Local user audio delegates +/** + * Event of the first audio frame is sent. + * + * @param engine The engine kit + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalAudioFramePublished:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstLocalAudioFramePublished:)); + +/** The statistics of the local audio stream. + + Same as [localAudioStatBlock]([AgoraRtcEngineKit localAudioStatBlock:]). The SDK updates the application on the statistics of the local audio stream once every two seconds. + + * @param engine The AgoraRtcEngineKit object. + * @param stats AgoraRtcLocalAudioStats + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localAudioStats:(AgoraRtcLocalAudioStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:localAudioStats:)); + +/** + * Event of local audio route changed + * + * @param engine The engine kit + * @param routing the current audio output routing + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didAudioRouteChanged:(AgoraAudioOutputRouting)routing NS_SWIFT_NAME(rtcEngine(_:didAudioRouteChanged:)); + +/** + * Event of finish audio mixing. + * + * @param engine The engine kit + */ +- (void)rtcEngineLocalAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineLocalAudioMixingDidFinish(_:)); + +/** Audio mixing state changed. + + * @param engine The AgoraRtcEngineKit object. + * @param state AgoraAudioMixingStateType + * @param reasonCode AgoraAudioMixingReasonType + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingStateChanged:(AgoraAudioMixingStateType)state + reasonCode:(AgoraAudioMixingReasonCode)reasonCode NS_SWIFT_NAME(rtcEngine(_:audioMixingStateChanged:reasonCode:)); + +/** + * @brief Reports current AudioMixing progress. + * + * The callback occurs once every one second during the playback and reports the current playback progress. + * @param position Current AudioMixing progress (millisecond). + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingPositionChanged:(NSInteger)position NS_SWIFT_NAME(rtcEngine(_:audioMixingPositionChanged:)); + +/** + * Event of finish audio effect. + * + * @param engine The engine kit + */ +- (void)rtcEngineDidAudioEffectFinish:(AgoraRtcEngineKit * _Nonnull)engine soundId:(int)soundId NS_SWIFT_NAME(rtcEngineDidAudioEffectFinish(_:soundId:)); + + +#pragma mark Local user video delegates +/** + * Event of camera opened + * + * @param engine The engine kit + */ +- (void)rtcEngineCameraDidReady:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineCameraDidReady(_:)); + +#if TARGET_OS_IPHONE +/** + * Event of camera focus position changed + * + * @param engine The engine kit + * @param rect The focus rect in local preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine cameraFocusDidChangedToRect:(CGRect)rect NS_SWIFT_NAME(rtcEngine(_:cameraFocusDidChangedTo:)); + +/** A camera exposure position changed. + + @param engine AgoraRtcEngineKit object + @param rect Exposure rectangle in the local preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine cameraExposureDidChangedToRect:(CGRect)rect NS_SWIFT_NAME(rtcEngine(_:cameraExposureDidChangedTo:)); + +#endif + +/** + * Event of camera stopped + * + * @param engine The engine kit + */ +- (void)rtcEngineVideoDidStop:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineVideoDidStop(_:)); + +/** Event of the first local video frame is published. + * @param engine The engine kit + * @param elapsed The elapsed time(ms) from the beginning of the session. + * + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed + sourceType:(AgoraVideoSourceType)source NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFramePublishedWithElapsed:sourceType:)); + +/** + * Event of the first local frame starts rendering on the screen. + * + * @param engine The engine kit + * @param size The size of local video stream + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFrameWithSize:(CGSize)size elapsed:(NSInteger)elapsed sourceType:(AgoraVideoSourceType)source NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFrameWith:elapsed:sourceType:)); + +/** + * The statistics of local video stream. Update every two seconds. + * + * @param engine The engine kit + * @param stats The statistics of local video, including sent bitrate, sent framerate + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats + sourceType:(AgoraVideoSourceType)source NS_SWIFT_NAME(rtcEngine(_:localVideoStats:sourceType:)); + +#pragma mark Remote user audio delegates + +/** + * The sdk reports the volume of a speaker. The interface is disable by default, and it could be enable by API "enableAudioVolumeIndication" + * + * @param engine The engine kit + * @param speakers AgoraRtcAudioVolumeInfo array + * @param totalVolume The total volume of speakers + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine reportAudioVolumeIndicationOfSpeakers:(NSArray * _Nonnull)speakers totalVolume:(NSInteger)totalVolume NS_SWIFT_NAME(rtcEngine(_:reportAudioVolumeIndicationOfSpeakers:totalVolume:)); + +/** + * Event of remote start audio mixing. + * + * @param engine The engine kit + */ +- (void)rtcEngineRemoteAudioMixingDidStart:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRemoteAudioMixingDidStart(_:)); + +/** + * Event of remote finish audio mixing. + * + * @param engine The engine kit + */ +- (void)rtcEngineRemoteAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRemoteAudioMixingDidFinish(_:)); + +/** + * The statistics of remote audio stream. Update every two seconds. + * + * @param engine The engine kit + * @param stats The statistics of audio video, including user id, delay, resolution, received bitrate, received framerate, audio stream type + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteAudioStats:(AgoraRtcRemoteAudioStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:remoteAudioStats:)); + +#pragma mark Remote user video delegates + +/** + * The statistics of remote video stream. Update every two seconds. + * + * @param engine The engine kit + * @param stats The statistics of remote video, including user id, delay, resolution, received bitrate, received framerate, video stream type + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStats:(AgoraRtcRemoteVideoStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:remoteVideoStats:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine rtmpStreamingChangedToState:(NSString * _Nonnull)url + state:(AgoraRtmpStreamingState)state + errCode:(AgoraRtmpStreamingErrorCode)errCode NS_SWIFT_NAME(rtcEngine(_:rtmpStreamingChangedToState:state:errCode:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine rtmpStreamingEventWithUrl:(NSString* _Nonnull)url eventCode:(AgoraRtmpStreamingEvent)eventCode NS_SWIFT_NAME(rtcEngine(_:rtmpStreamingEventWithUrl:eventCode:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamPublishedWithUrl:(NSString * _Nonnull)url errorCode:(AgoraErrorCode)errorCode NS_SWIFT_NAME(rtcEngine(_:streamPublishedWithUrl:errorCode:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamUnpublishedWithUrl:(NSString * _Nonnull)url NS_SWIFT_NAME(rtcEngine(_:streamUnpublishedWithUrl:)); + +- (void)rtcEngineTranscodingUpdated:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineTranscodingUpdated(_:)); + +#pragma mark Face Detection Delegate Methods +/**----------------------------------------------------------------------------- + * @name Face Detection Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** Reports the face detection result of the local user. (iOS only) + + **Since:** v3.0.1. + + Once you enable face detection by calling [enableFaceDetection]([AgoraRtcEngineKit enableFaceDetection:]), you can get the following information on the local user in real-time: + + - The width and height of the local video. + - The position of the human face in the local video. + - The distance between the human face and the device screen. This value is based on the fitting calculation of the local video size and the position of the human face. + + **Note** + + - If the SDK does not detect a face, it reduces the frequency of this callback to reduce power consumption on the local device. + - The SDK stops triggering this callback when a human face is in close proximity to the screen. + + @param engine AgoraRtcEngineKit object. + @param width The width (px) of the local video. + @param height The height (px) of the local video. + @param faces An AgoraFacePositionInfo array, which contains the information of the detected human face. + + The number of the AgoraFacePositionInfo array depends on the number of human faces detected. If the array length is 0, it means that no human face is detected. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine facePositionDidChangeWidth:(int)width previewHeight:(int)height faces:(NSArray* _Nullable)faces NS_SWIFT_NAME(rtcEngine(_:facePositionDidChangeWidth:previewHeight:faces:)); + +@end + +/* + +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + info:(NSString * _Nullable)info + userId:(NSString * _Nullable)userId NS_SWIFT_NAME(joinChannel(byToken:channelId:info:userId:)); + +- (int)setRemoteRenderModeWithUid:(NSString * _Nonnull)userId + mode:(AgoraVideoRenderMode)mode NS_SWIFT_NAME(setRemoteRenderModeWithUid(_:mode:)); + +- (int)switchView:(NSString * _Nonnull)userId1 + andAnother:(NSString * _Nonnull)userId2 NS_SWIFT_NAME(switchView(_:andAnother:)) __deprecated; + +- (int)muteRemoteAudioStream:(NSString * _Nonnull)userId mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteAudioStream(_:mute:)); + +- (int)setRemoteVideoStream:(NSString * _Nonnull)userId + type:(AgoraVideoStreamType)streamType NS_SWIFT_NAME(setRemoteVideoStream(_:type:)); +- (int)muteRemoteVideoStream:(NSString * _Nonnull)userId + mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteVideoStream(_:mute:)); + +- (void)setRemoteVideoRenderer:(id _Nullable)videoRenderer withUserId:(NSString * _Nonnull)userId NS_SWIFT_NAME(setRemoteVideoRenderer(_:withUserId:)); + +- (int)sendPublishingRequestToOwner:(NSString * _Nonnull)userId NS_SWIFT_NAME(sendPublishingRequestToOwner(_:)); +- (int)answerPublishingRequestOfUid:(NSString * _Nonnull)userId accepted:(bool)accepted NS_SWIFT_NAME(answerPublishingRequestOfUid(_:accepted:)); +- (int)sendUnpublishingRequestToUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(sendUnpublishingRequestToUid(_:)); + +- (id _Nullable)remoteVideoRendererOfUserId:(NSString * _Nonnull)userId NS_SWIFT_NAME(remoteVideoRendererOfUserId(_:)); +*/ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraConstants.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraConstants.h new file mode 100644 index 0000000..8ce5f7f --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraConstants.h @@ -0,0 +1,122 @@ +// +// AgoraConstants.h +// AgoraRtcEngineKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// +#import +#if TARGET_OS_IPHONE +#import +#elif TARGET_OS_MAC +#import +#endif + +/** The standard bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]). + + (Recommended) In a live broadcast, Agora recommends setting a larger bitrate to improve the video quality. When you choose AgoraVideoBitrateStandard, the bitrate value doubles in a live broadcast mode, and remains the same as in AgoraVideoProfile in a communication mode. + */ +extern NSInteger const AgoraVideoBitrateStandard; + +/** The compatible bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]). + + The bitrate in both the live broadcast and communication modes remain the same as in AgoraVideoProfile. + */ +extern NSInteger const AgoraVideoBitrateCompatible; + + +/** The min bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]). + + The min bitrate set to default value + */ +extern NSInteger const AgoraVideoDefaultMinBitrate; + +/** The min bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]). + + The min bitrate will be equal to bitrate + */ +extern NSInteger const AgoraVideoMinBitrateEqualToBitrate; + +/** + * set analyze duration for real time stream + * @example "setPlayerOption(AgoraRtcMediaPlayerRealTimeStreamAnalyzeDuration,1000000)" + */ +extern NSString* const AgoraRtcMediaPlayerRealTimeStreamAnalyzeDuration; + +/** + * make the player to enable audio or not + * @example "setPlayerOption(AgoraRtcMediaPlayerEnableAudio,0)" + */ +extern NSString* const AgoraRtcMediaPlayerEnableAudio; + +/** + * make the player to enable video or not + * @example "setPlayerOption(AgoraRtcMediaPlayerEnableVideo,0)" + */ +extern NSString* const AgoraRtcMediaPlayerEnableVideo; + +/** + * set the player enable to search metadata + * @example "setPlayerOption(AgoraRtcMediaPlayerEnableSearchMetadata,0)" + */ +extern NSString* const AgoraRtcMediaPlayerEnableSearchMetadata; + +/** 120 x 120 + */ +extern CGSize const AgoraVideoDimension120x120; +/** 160 x 120 + */ +extern CGSize const AgoraVideoDimension160x120; +/** 180 x 180 + */ +extern CGSize const AgoraVideoDimension180x180; +/** 240 x 180 + */ +extern CGSize const AgoraVideoDimension240x180; +/** 320 x 180 + */ +extern CGSize const AgoraVideoDimension320x180; +/** 240 x 240 + */ +extern CGSize const AgoraVideoDimension240x240; +/** 320 x 240 + */ +extern CGSize const AgoraVideoDimension320x240; +/** 424 x 240 + */ +extern CGSize const AgoraVideoDimension424x240; +/** 360 x 360 + */ +extern CGSize const AgoraVideoDimension360x360; +/** 480 x 360 + */ +extern CGSize const AgoraVideoDimension480x360; +/** 640 x 360 + */ +extern CGSize const AgoraVideoDimension640x360; +/** 480 x 480 + */ +extern CGSize const AgoraVideoDimension480x480; +/** 640 x 480 + */ +extern CGSize const AgoraVideoDimension640x480; +/** 840 x 480 + */ +extern CGSize const AgoraVideoDimension840x480; +/** 960 x 540 + */ +extern CGSize const AgoraVideoDimension960x540; +/** 960 x 720 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension960x720; +/** 1280 x 720 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension1280x720; +/** 1920 x 1080 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension1920x1080; +/** 25400 x 1440 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension2540x1440; +/** 3840 x 2160 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension3840x2160; diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraEnumerates.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraEnumerates.h new file mode 100644 index 0000000..dca4410 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraEnumerates.h @@ -0,0 +1,3273 @@ +// +// AgoraEnumerates.h +// AgoraRtcEngineKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#import + +/** + * Warning code. + * + * Warning codes occur when the SDK encounters an error that may be recovered automatically. + * These are only notifications, and can generally be ignored. For example, when the SDK loses connection to the server, the SDK reports the AgoraWarningCodeOpenChannelTimeout(106) warning and tries to reconnect automatically. + */ +typedef NS_ENUM(NSInteger, AgoraWarningCode) { + /** 8: The specified view is invalid. Specify a view when using the video call function. */ + AgoraWarningCodeInvalidView = 8, + /** 16: Failed to initialize the video function, possibly caused by a lack of resources. The users cannot see the video while the voice communication is not affected. */ + AgoraWarningCodeInitVideo = 16, + /** 20: The request is pending, usually due to some module not being ready, and the SDK postpones processing the request. */ + AgoraWarningCodePending = 20, + /** 103: No channel resources are available. Maybe because the server cannot allocate any channel resource. */ + AgoraWarningCodeNoAvailableChannel = 103, + /** 104: A timeout occurs when looking up the channel. When joining a channel, the SDK looks up the specified channel. The warning usually occurs when the network condition is too poor for the SDK to connect to the server. */ + AgoraWarningCodeLookupChannelTimeout = 104, + /** 105: The server rejects the request to look up the channel. The server cannot process this request or the request is illegal. */ + AgoraWarningCodeLookupChannelRejected = 105, + /** 106: The server rejects the request to look up the channel. The server cannot process this request or the request is illegal. */ + AgoraWarningCodeOpenChannelTimeout = 106, + /** 107: The server rejects the request to open the channel. The server cannot process this request or the request is illegal. */ + AgoraWarningCodeOpenChannelRejected = 107, + /** 111: A timeout occurs when switching to the live video. */ + AgoraWarningCodeSwitchLiveVideoTimeout = 111, + /** 118: A timeout occurs when setting the client role in the live broadcast profile. */ + AgoraWarningCodeSetClientRoleTimeout = 118, + /** 119: The client role is unauthorized. */ + AgoraWarningCodeSetClientRoleNotAuthorized = 119, + /** 121: The ticket to open the channel is invalid. */ + AgoraWarningCodeOpenChannelInvalidTicket = 121, + /** 122: Try connecting to another server. */ + AgoraWarningCodeOpenChannelTryNextVos = 122, + /** 701: An error occurs in opening the audio mixing file. */ + AgoraWarningCodeAudioMixingOpenError = 701, + /** 1014: Audio Device Module: a warning occurs in the playback device. */ + AgoraWarningCodeAdmRuntimePlayoutWarning = 1014, + /** 1016: Audio Device Module: a warning occurs in the recording device. */ + AgoraWarningCodeAdmRuntimeRecordingWarning = 1016, + /** 1019: Audio Device Module: no valid audio data is collected. */ + AgoraWarningCodeAdmRecordAudioSilence = 1019, + /** 1020: Audio Device Module: a playback device fails. */ + AgoraWarningCodeAdmPlaybackMalfunction = 1020, + /** 1021: Audio Device Module: a recording device fails. */ + AgoraWarningCodeAdmRecordMalfunction = 1021, + /** 1025: Call is interrupted by system events such as phone call or Siri. */ + AgoraWarningCodeAdmInterruption = 1025, + /** 1031: Audio Device Module: the recorded audio is too low. */ + AgoraWarningCodeAdmRecordAudioLowlevel = 1031, + /** 1032: Audio Device Module: the playback audio is too low. */ + AgoraWarningCodeAdmPlayoutAudioLowlevel = 1032, + /** 1051: Audio Device Module: howling is detected. */ + AgoraWarningCodeApmHowling = 1051, + /** 1052: Audio Device Module: the device is in the glitch state. */ + AgoraWarningCodeAdmGlitchState = 1052, + /** 1053: Audio Device Module: the underlying audio settings have changed. */ + AgoraWarningCodeAdmImproperSettings = 1053, +}; + +/** + * Error code. + * + * Error codes occur when the SDK encounters an error that cannot be recovered automatically without any app intervention. + * For example, the SDK reports the \ref AgoraErrorCodeStartCall(1002) error if it fails to start a call. + */ +typedef NS_ENUM(NSInteger, AgoraErrorCode) { + /** 0: No error occurs. */ + AgoraErrorCodeNoError = 0, + /** 1: A general error occurs (no specified reason). */ + AgoraErrorCodeFailed = 1, + /** 2: An invalid parameter is used. For example, the specific channel name includes illegal characters. */ + AgoraErrorCodeInvalidArgument = 2, + /** + * 3: The SDK module is not ready. + * + * Possible solutions: + * - Check the audio device. + * - Check the completeness of the app. + * - Re-initialize the SDK. + */ + AgoraErrorCodeNotReady = 3, + /** 4: The current state of the SDK does not support this function. */ + AgoraErrorCodeNotSupported = 4, + /** 5: The request is rejected. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeRefused = 5, + /** 6: The buffer size is not big enough to store the returned data. */ + AgoraErrorCodeBufferTooSmall = 6, + /** 7: The SDK is not initialized before calling this method. */ + AgoraErrorCodeNotInitialized = 7, + /** 7: The state is invalid. */ + AgoraErrorCodeInvalidState = 8, + /** 9: No permission exists. Check if the user has granted access to the audio or video device. */ + AgoraErrorCodeNoPermission = 9, + /** 10: An API method timeout occurs. Some API methods require the SDK to return the execution result, and this error occurs if the request takes too long (over 10 seconds) for the SDK to process. */ + AgoraErrorCodeTimedOut = 10, + /** 11: The request is canceled. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeCanceled = 11, + /** 12: The method is called too often. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeTooOften = 12, + /** 13: The SDK fails to bind to the network socket. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeBindSocket = 13, + /** 14: The network is unavailable. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeNetDown = 14, + /** 15: No network buffers are available. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeNoBufs = 15, + /** + * 17: The request to join the channel is rejected. + * + * Possible reasons: + * - The user is already in the channel, and still calls the API method to join the channel, for example `joinChannelByToken`. + * - The user tries joining the channel during the echo test. Please join the channel after the echo test ends. + */ + AgoraErrorCodeJoinChannelRejected = 17, + /** + * 18: The request to leave the channel is rejected. + * + * Possible reasons are: + * - The user left the channel and still calls the API method to leave the channel, for example, \ref AgoraRtcEngineKit.leaveChannel: leaveChannel. + * - The user has not joined the channel and calls the API method to leave the channel. + */ + AgoraErrorCodeLeaveChannelRejected = 18, + /** 19: The resources are occupied and cannot be used. */ + AgoraErrorCodeAlreadyInUse = 19, + /** 20: The SDK gave up the request due to too many requests. */ + AgoraErrorCodeAbort = 20, + /** 21: In Windows, specific firewall settings cause the SDK to fail to initialize and crash. */ + AgoraErrorCodeInitNetEngine = 21, + /** 22: The app uses too much of the system resources and the SDK fails to allocate the resources. */ + AgoraErrorCodeResourceLimited = 22, + /** 101: The specified App ID is invalid. Please try to rejoin the channel with a valid App ID.*/ + AgoraErrorCodeInvalidAppId = 101, + /** 102: The specified channel name is invalid. Please try to rejoin the channel with a valid channel name. */ + AgoraErrorCodeInvalidChannelId = 102, + /** 103: Fails to get server resources in the specified region. Please try to specify another region when calling sharedEngine.*/ + AgoraErrorCodeNoServerResources = 103, + /** + * 109: The token expired. + * + * Possible reasons are: + * - Authorized Timestamp expired: The timestamp is represented by the number of seconds elapsed since 1/1/1970. The user can use the token to access the Agora service within 24 hours after the token is generated. If the user does not access the Agora service after 24 hours, this token is no longer valid. + * - Call Expiration Timestamp expired: The timestamp is the exact time when a user can no longer use the Agora service (for example, when a user is forced to leave an ongoing call). When a value is set for the Call Expiration Timestamp, it does not mean that the token will expire, but that the user will be banned from the channel. + */ + AgoraErrorCodeTokenExpired = 109, + /** + * 110: The token is invalid. + * + * Possible reasons are: + * - The App Certificate for the project is enabled in Console, but the user is using the App ID. Once the App Certificate is enabled, the user must use a token. + * - The uid is mandatory, and users must set the same uid as the one set in the `joinChannelByToken` method. + */ + AgoraErrorCodeInvalidToken = 110, + /** 111: The Internet connection is interrupted. This applies to the Agora Web SDK only. */ + AgoraErrorCodeConnectionInterrupted = 111, + /** 112: The Internet connection is lost. This applies to the Agora Web SDK only. */ + AgoraErrorCodeConnectionLost = 112, + /** 113: The user is not in the channel when calling the `sendStreamMessage` or `getUserInfoByUserAccount` method. */ + AgoraErrorCodeNotInChannel = 113, + /** 114: The size of the sent data is over 1024 bytes when the user calls the `sendStreamMessage` method. */ + AgoraErrorCodeSizeTooLarge = 114, + /** 115: The bitrate of the sent data exceeds the limit of 6 Kbps when the user calls the `sendStreamMessage` method. */ + AgoraErrorCodeBitrateLimit = 115, + /** 116: Too many data streams (over five streams) are created when the user calls the `createDataStream` method. */ + AgoraErrorCodeTooManyDataStreams = 116, + /** 117: A timeout occurs for the data stream transmission.*/ + AgoraErrorCodeStreamMessageTimeout = 117, + /** 119: Switching the user role fails. Please try to rejoin the channel.*/ + AgoraErrorCodeSetClientRoleNotAuthorzed = 119, + /** 120: Decryption fails. The user may have used a different encryption password to join the channel. Check your settings or try rejoining the channel. */ + AgoraErrorCodeDecryptionFailed = 120, + /** 121: The user ID is invalid.*/ + AgoraErrorCodeInvalidUserId = 121, + /** 123: The app is banned by the server.*/ + AgoraErrorCodeClientIsBannedByServer = 123, + /** 130: The encrypted stream is not allowed to publish. */ + AgoraErrorCodeEncryptedStreamNotAllowedPublish = 130, + /** 134: The user account is invalid. */ + AgoraErrorCodeInvalidUserAccount = 134, + /** 135: When encryption enabled, a failure occurs when verifying the server's certification. */ + AgoraErrorCodeCertVerifyFailure = 135, + /** Stream publishing failed. */ + AgoraErrorCodePublishFailed = 150, + /** 151: CDN related errors. Remove the original URL address and add a new one by calling the [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:]) and [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) methods. */ + AgoraErrorCodePublishStreamCDNError = 151, + /** 157: The extension library is not integrated, such as the library for enabling deep-learning noise reduction. */ + AgoraErrorCodeModuleNotFound = 157, + /** 1001: Fails to load the media engine. */ + AgoraErrorCodeLoadMediaEngine = 1001, + /** 1002: Fails to start the call after enabling the media engine. */ + AgoraErrorCodeStartCall = 1002, + /** 1003: Fails to start the camera. */ + AgoraErrorCodeStartCamera = 1003, + /** 1004: Fails to start the video rendering module. */ + AgoraErrorCodeStartVideoRender = 1004, + /** 1005: A general error occurs in the Audio Device Module (the reason is not classified specifically). Check if the audio device is used by another app, or try rejoining the channel. */ + AgoraErrorCodeAdmGeneralError = 1005, + /** 1006: Audio Device Module: An error occurs in using the Java resources. */ + AgoraErrorCodeAdmJavaResource = 1006, + /** 1007: Audio Device Module: An error occurs in setting the sampling frequency. */ + AgoraErrorCodeAdmSampleRate = 1007, + /** 1008: Audio Device Module: An error occurs in initializing the playback device. */ + AgoraErrorCodeAdmInitPlayout = 1008, + /** 1009: Audio Device Module: An error occurs in starting the playback device. */ + AgoraErrorCodeAdmStartPlayout = 1009, + /** 1010: Audio Device Module: An error occurs in stopping the playback device. */ + AgoraErrorCodeAdmStopPlayout = 1010, + /** 1011: Audio Device Module: An error occurs in initializing the recording device. */ + AgoraErrorCodeAdmInitRecording = 1011, + /** 1012: Audio Device Module: An error occurs in starting the recording device. */ + AgoraErrorCodeAdmStartRecording = 1012, + /** 1013: Audio Device Module: An error occurs in stopping the recording device. */ + AgoraErrorCodeAdmStopRecording = 1013, + /** 1015: Audio Device Module: A playback error occurs. Check your playback device, or try rejoining the channel. */ + AgoraErrorCodeAdmRuntimePlayoutError = 1015, + /** 1017: Audio Device Module: A recording error occurs. */ + AgoraErrorCodeAdmRuntimeRecordingError = 1017, + /** 1018: Audio Device Module: Fails to record. */ + AgoraErrorCodeAdmRecordAudioFailed = 1018, + /** 1020: Audio Device Module: Abnormal audio playback frequency. */ + AgoraErrorCodeAdmPlayAbnormalFrequency = 1020, + /** 1021: Audio Device Module: Abnormal audio recording frequency. */ + AgoraErrorCodeAdmRecordAbnormalFrequency = 1021, + /** 1022: Audio Device Module: An error occurs in initializing the loopback device. */ + AgoraErrorCodeAdmInitLoopback = 1022, + /** 1023: Audio Device Module: An error occurs in starting the loopback device. */ + AgoraErrorCodeAdmStartLoopback = 1023, + /** 1359: No recording device exists. */ + AgoraErrorCodeAdmNoRecordingDevice = 1359, + /** 1360: No playback device exists. */ + AgoraErrorCodeAdmNoPlayoutDevice = 1360, + /** 1501: Video Device Module: The camera is unauthorized. */ + AgoraErrorCodeVdmCameraNotAuthorized = 1501, + /** 1600: Video Device Module: An unknown error occurs. */ + AgoraErrorCodeVcmUnknownError = 1600, + /** 1601: Video Device Module: An error occurs in initializing the video encoder. */ + AgoraErrorCodeVcmEncoderInitError = 1601, + /** 1602: Video Device Module: An error occurs in video encoding. */ + AgoraErrorCodeVcmEncoderEncodeError = 1602, + /** @deprecated + * 1603: Video Device Module: An error occurs in setting the video encoder. + */ + AgoraErrorCodeVcmEncoderSetError __deprecated = 1603, +}; + +/** @deprecated + Video Profile */ +typedef NS_ENUM(NSInteger, AgoraVideoProfile) { + /** Invalid profile */ + AgoraVideoProfileInvalid = -1, + /** 160 x 120 @ 15 fps */ + AgoraVideoProfileLandscape120P = 0, + /** 120 x 120 @ 15 fps */ + AgoraVideoProfileLandscape120P_3 = 2, // iOS + /** 320 x 180 @ 15 fps */ + AgoraVideoProfileLandscape180P = 10, // iOS + /** 180 x 180 @ 15 fps */ + AgoraVideoProfileLandscape180P_3 = 12, // iOS + /** 240 x 180 @ 15 fps */ + AgoraVideoProfileLandscape180P_4 = 13, // iOS + /** 320 x 240 @ 15 fps */ + AgoraVideoProfileLandscape240P = 20, + /** 240 x 240 @ 15 fps */ + AgoraVideoProfileLandscape240P_3 = 22, //iOS + /** 424 x 240 @ 15 fps */ + AgoraVideoProfileLandscape240P_4 = 23, // iOS + /** 640 x 360 @ 15 fps */ + AgoraVideoProfileLandscape360P = 30, + /** 360 x 360 @ 15 fps */ + AgoraVideoProfileLandscape360P_3 = 32, // iOS + /** 640 x 360 @ 30 fps */ + AgoraVideoProfileLandscape360P_4 = 33, + /** 360 x 360 @ 30 fps */ + AgoraVideoProfileLandscape360P_6 = 35, + /** 480 x 360 @ 15 fps */ + AgoraVideoProfileLandscape360P_7 = 36, + /** 480 x 360 @ 30 fps */ + AgoraVideoProfileLandscape360P_8 = 37, + /** 640 x 360 @ 15 fps */ + AgoraVideoProfileLandscape360P_9 = 38, + /** 640 x 360 @ 24 fps */ + AgoraVideoProfileLandscape360P_10 = 39, + /** 640 x 360 @ 24 fps */ + AgoraVideoProfileLandscape360P_11 = 100, + /** 640 x 480 @ 15 fps */ + AgoraVideoProfileLandscape480P = 40, + /** 480 x 480 @ 15 fps */ + AgoraVideoProfileLandscape480P_3 = 42, // iOS + /** 640 x 480 @ 30 fps */ + AgoraVideoProfileLandscape480P_4 = 43, + /** 480 x 480 @ 30 fps */ + AgoraVideoProfileLandscape480P_6 = 45, + /** 848 x 480 @ 15 fps */ + AgoraVideoProfileLandscape480P_8 = 47, + /** 848 x 480 @ 30 fps */ + AgoraVideoProfileLandscape480P_9 = 48, + /** 640 x 480 @ 10 fps */ + AgoraVideoProfileLandscape480P_10 = 49, + /** 1280 x 720 @ 15 fps */ + AgoraVideoProfileLandscape720P = 50, + /** 1280 x 720 @ 30 fps */ + AgoraVideoProfileLandscape720P_3 = 52, + /** 960 x 720 @ 15 fps */ + AgoraVideoProfileLandscape720P_5 = 54, + /** 960 x 720 @ 30 fps */ + AgoraVideoProfileLandscape720P_6 = 55, + /** 1920 x 1080 @ 15 fps */ + AgoraVideoProfileLandscape1080P = 60, + /** 1920 x 1080 @ 30 fps */ + AgoraVideoProfileLandscape1080P_3 = 62, + /** 1920 x 1080 @ 60 fps */ + AgoraVideoProfileLandscape1080P_5 = 64, + /** 2560 x 1440 @ 30 fps */ + AgoraVideoProfileLandscape1440P = 66, + /** 2560 x 1440 @ 60 fps */ + AgoraVideoProfileLandscape1440P_2 = 67, + /** 3840 x 2160 @ 30 fps */ + AgoraVideoProfileLandscape4K = 70, + /** 3840 x 2160 @ 60 fps */ + AgoraVideoProfileLandscape4K_3 = 72, + /** 120 x 160 @ 15 fps */ + AgoraVideoProfilePortrait120P = 1000, + /** 120 x 120 @ 15 fps */ + AgoraVideoProfilePortrait120P_3 = 1002, //iOS + /** 180 x 320 @ 15 fps */ + AgoraVideoProfilePortrait180P = 1010, // iOS + /** 180 x 180 @ 15 fps */ + AgoraVideoProfilePortrait180P_3 = 1012, // iOS + /** 180 x 240 @ 15 fps */ + AgoraVideoProfilePortrait180P_4 = 1013, // iOS + /** 240 x 320 @ 15 fps */ + AgoraVideoProfilePortrait240P = 1020, + /** 240 x 240 @ 15 fps */ + AgoraVideoProfilePortrait240P_3 = 1022, // iOS + /** 240 x 424 @ 15 fps */ + AgoraVideoProfilePortrait240P_4 = 1023, + /** 360 x 640 @ 15 fps */ + AgoraVideoProfilePortrait360P = 1030, // iOS + /** 360 x 360 @ 15 fps */ + AgoraVideoProfilePortrait360P_3 = 1032, // iOS + /** 360 x 640 @ 30 fps */ + AgoraVideoProfilePortrait360P_4 = 1033, + /** 360 x 360 @ 30 fps */ + AgoraVideoProfilePortrait360P_6 = 1035, + /** 360 x 480 @ 15 fps */ + AgoraVideoProfilePortrait360P_7 = 1036, + /** 360 x 480 @ 30 fps */ + AgoraVideoProfilePortrait360P_8 = 1037, + /** 360 x 640 @ 15 fps */ + AgoraVideoProfilePortrait360P_9 = 1038, + /** 360 x 640 @ 24 fps */ + AgoraVideoProfilePortrait360P_10 = 1039, + /** 360 x 640 @ 24 fps */ + AgoraVideoProfilePortrait360P_11 = 1100, + /** 480 x 640 @ 15 fps */ + AgoraVideoProfilePortrait480P = 1040, + /** 480 x 480 @ 15 fps */ + AgoraVideoProfilePortrait480P_3 = 1042, // iOS + /** 480 x 640 @ 30 fps */ + AgoraVideoProfilePortrait480P_4 = 1043, + /** 480 x 480 @ 30 fps */ + AgoraVideoProfilePortrait480P_6 = 1045, + /** 480 x 848 @ 15 fps */ + AgoraVideoProfilePortrait480P_8 = 1047, + /** 480 x 848 @ 30 fps */ + AgoraVideoProfilePortrait480P_9 = 1048, + /** 480 x 640 @ 10 fps */ + AgoraVideoProfilePortrait480P_10 = 1049, + /** 720 x 1280 @ 15 fps */ + AgoraVideoProfilePortrait720P = 1050, + /** 720 x 1280 @ 30 fps */ + AgoraVideoProfilePortrait720P_3 = 1052, + /** 720 x 960 @ 15 fps */ + AgoraVideoProfilePortrait720P_5 = 1054, + /** 720 x 960 @ 30 fps */ + AgoraVideoProfilePortrait720P_6 = 1055, + /** 1080 x 1920 @ 15 fps */ + AgoraVideoProfilePortrait1080P = 1060, // macOS + /** 1080 x 1920 @ 30 fps */ + AgoraVideoProfilePortrait1080P_3 = 1062, // macOS + /** 1080 x 1920 @ 60 fps */ + AgoraVideoProfilePortrait1080P_5 = 1064, // macOS + /** 1440 x 2560 @ 30 fps */ + AgoraVideoProfilePortrait1440P = 1066, // macOS + /** 1440 x 2560 @ 60 fps */ + AgoraVideoProfilePortrait1440P_2 = 1067, // macOS + /** 2160 x 3840 @ 30 fps */ + AgoraVideoProfilePortrait4K = 1070, // macOS + /** 2160 x 3840 @ 60 fps */ + AgoraVideoProfilePortrait4K_3 = 1072, // macOS + /** Default 640 x 360 @ 15 fps */ + AgoraVideoProfileDEFAULT = AgoraVideoProfileLandscape360P, +}; + +typedef NS_ENUM(NSInteger, AgoraVideoCodecCapabilityLevel) { + AgoraVideoCodecCapabilityLevelUnspecified = -1, + AgoraVideoCodecCapabilityLevelBasicSupport = 5, + AgoraVideoCodecCapabilityLevel1080p30fps = 10, + AgoraVideoCodecCapabilityLevel1080p60fps = 20, + AgoraVideoCodecCapabilityLevel2k30fps = 23, + AgoraVideoCodecCapabilityLevel2k60fps = 26, + AgoraVideoCodecCapabilityLevel4k60fps = 30, +}; + +typedef NS_ENUM(NSInteger, AgoraVideoCodecType) { + AgoraVideoCodecTypeVP8 = 1, + AgoraVideoCodecTypeH264 = 2, + AgoraVideoCodecTypeH265 = 3, + AgoraVideoCodecTypeVP9 = 5, + AgoraVideoCodecTypeGeneric = 6, + AgoraVideoCodecTypeGenericH264 = 7, + AgoraVideoCodecTypeGenericJpeg = 20, +}; + +typedef NS_ENUM(NSInteger, AgoraVideoHwEncoderAccelerating) { + AgoraVideoHwEncoderSoftware = 0, + AgoraVideoHwEncoderHardware = 1, +}; + +typedef NS_ENUM(NSInteger, AgoraVideoFrameOrientation) { + AgoraVideoFrameOrientation0 = 0, + AgoraVideoFrameOrientation90 = 90, + AgoraVideoFrameOrientation180 = 180, + AgoraVideoFrameOrientation270 = 270, +}; + +/** The video codec type of the output video stream. + + @since v3.2.0 + */ +typedef NS_ENUM(NSInteger, AgoraVideoCodecTypeForStream) { + /** 1: (Default) H.264 */ + AgoraVideoCodecTypeH264ForStream = 1, + /** 2: H.265 */ + AgoraVideoCodecTypeH265ForStream = 2, +}; + +/** Video frame rate */ +typedef NS_ENUM(NSInteger, AgoraVideoFrameRate) { + /** 1 fps */ + AgoraVideoFrameRateFps1 = 1, + /** 7 fps */ + AgoraVideoFrameRateFps7 = 7, + /** 10 fps */ + AgoraVideoFrameRateFps10 = 10, + /** 15 fps */ + AgoraVideoFrameRateFps15 = 15, + /** 24 fps */ + AgoraVideoFrameRateFps24 = 24, + /** 30 fps */ + AgoraVideoFrameRateFps30 = 30, + /** 60 fps */ + AgoraVideoFrameRateFps60 = 60, +}; + +/** Video output orientation mode + + Note: When a custom video source is used, if you set AgoraVideoOutputOrientationMode as AgoraVideoOutputOrientationModeFixedLandscape(1) or AgoraVideoOutputOrientationModeFixedPortrait(2), when the rotated video image has a different orientation than the specified output orientation, the video encoder will first crop it and then encode it. + */ +typedef NS_ENUM(NSInteger, AgoraVideoOutputOrientationMode) { + /** Adaptive mode (Default). + + The video encoder adapts to the orientation mode of the video input device. + + - If the width of the captured video from the SDK is larger than the height, the video sent out by the encoder is in landscape mode. The encoder also sends out the rotational information of the video, and the receiving end will rotate the received video based on the rotational information. + - When a custom video source is used, the output video from the encoder inherits the orientation of the original video. If the original video is in portrait mode, the output video from the encoder is also in portrait mode. The encoder also sends out the rotational information of the video to the receiver. + */ + AgoraVideoOutputOrientationModeAdaptative = 0, + /** Landscape mode. + + The video encoder always sends out the video in landscape mode. The original video is rotated before being sent out and the rotational information is therefore 0. This mode applies to scenarios involving CDN streaming. + */ + AgoraVideoOutputOrientationModeFixedLandscape = 1, + /** Portrait mode. + + The video encoder always sends out the video in portrait mode. The original video is rotated before being sent out and the rotational information is therefore 0. This mode applies to scenarios involving CDN streaming. + */ + AgoraVideoOutputOrientationModeFixedPortrait = 2, +}; + +/** + * The channel profile. + */ +typedef NS_ENUM(NSInteger, AgoraChannelProfile) { + /** + * 0: Communication. + * + * This profile prioritizes smoothness and applies to the one-to-one scenario. + */ + AgoraChannelProfileCommunication = 0, + /** + * 1: (Default) Live Broadcast. + * + * This profile prioritizes supporting a large audience in a live broadcast channel. + */ + AgoraChannelProfileLiveBroadcasting = 1, + /** + * @deprecated + * 2: Gaming. + * + */ + AgoraChannelProfileGame __deprecated = 2, + /** + * @deprecated + * 3: Cloud Gaming. + * + */ + AgoraChannelProfileCloudGaming __deprecated = 3, + + /** + * @deprecated + * 4:1-to-1 communication. + */ + AgoraChannelProfileCommunication_1v1 __deprecated = 4, +}; + +/** Client role. */ +typedef NS_ENUM(NSInteger, AgoraClientRole) { + /** Broadcaster */ + AgoraClientRoleBroadcaster = 1, + /** Audience */ + AgoraClientRoleAudience = 2, +}; + +/** Audience latency levels in broadcaster mode. */ +typedef NS_ENUM(NSInteger, AgoraAudienceLatencyLevelType) { + /** 1: Low latency. A low latency audience's jitter buffer is 1.2 second. */ + AgoraAudienceLatencyLevelLowLatency = 1, + /** 2: Default Ultra low latency. An ultra low latency audience's jitter buffer is 0.5 second. */ + AgoraAudienceLatencyLevelUltraLowLatency = 2, +}; + +/** The brightness level of the video image captured by the local camera. */ +typedef NS_ENUM(NSInteger, AgoraCaptureBrightnessLevelType) { + /** -1: The SDK does not detect the brightness level of the video image. + Wait a few seconds to get the brightness level in the next callback. + */ + AgoraCaptureBrightnessLevelInvalid = -1, + /** 0: The brightness level of the video image is normal. + */ + AgoraCaptureBrightnessLevelNormal = 0, + /** 1: The brightness level of the video image is too bright. + */ + AgoraCaptureBrightnessLevelBright = 1, + /** 2: The brightness level of the video image is too dark. + */ + AgoraCaptureBrightnessLevelDark = 2, +} NS_SWIFT_NAME(AgoraCaptureBrightnessLevelType); + +/** Media type */ +typedef NS_ENUM(NSInteger, AgoraMediaType) { + /** No audio and video */ + AgoraMediaTypeNone = 0, + /** Audio only */ + AgoraMediaTypeAudioOnly = 1, + /** Video only */ + AgoraMediaTypeVideoOnly = 2, + /** Audio and video */ + AgoraMediaTypeAudioAndVideo = 3, +}; + + +/** Encryption mode */ +typedef NS_ENUM(NSInteger, AgoraEncryptionMode) { + /** 128-bit AES encryption, XTS mode. */ + AgoraEncryptionModeAES128XTS = 1, + /** 128-bit AES encryption, ECB mode. */ + AgoraEncryptionModeAES128ECB = 2, + /** 256-bit AES encryption, XTS mode. */ + AgoraEncryptionModeAES256XTS = 3, + /** 128-bit SM4 encryption, ECB mode. */ + AgoraEncryptionModeSM4128ECB = 4, + /** 128-bit AES encryption, GCM mode. */ + AgoraEncryptionModeAES128GCM = 5, + /** 256-bit AES encryption, GCM mode. */ + AgoraEncryptionModeAES256GCM = 6, + /** 128-bit AES encryption, GCM mode, with KDF salt */ + AgoraEncryptionModeAES128GCM2 = 7, + /** 256-bit AES encryption, GCM mode, with KDF salt */ + AgoraEncryptionModeAES256GCM2 = 8, + /** Enumerator boundary */ + AgoraEncryptionModeEnd, +}; + +/** The cloud proxy type. + */ +typedef NS_ENUM(NSUInteger, AgoraCloudProxyType) { + /** Do not use the cloud proxy. + */ + AgoraNoneProxy = 0, + /** The cloud proxy for the UDP protocol. + */ + AgoraUdpProxy = 1, + /** The cloud proxy for the TCP (encrypted) protocol. + */ + AgoraTcpProxy = 2, +} NS_SWIFT_NAME(AgoraCloudProxyType); + +/** Reason for the user being offline */ +typedef NS_ENUM(NSUInteger, AgoraUserOfflineReason) { + /** A user has quit the call. */ + AgoraUserOfflineReasonQuit = 0, + /** The SDK timed out and the user dropped offline because it has not received any data package within a certain period of time. If a user quits the call and the message is not passed to the SDK (due to an unreliable channel), the SDK assumes the event has timed out. */ + AgoraUserOfflineReasonDropped = 1, + /** User switched to an audience */ + AgoraUserOfflineReasonBecomeAudience = 2, +}; + +/** Status of importing an external video stream in a live broadcast */ +typedef NS_ENUM(NSUInteger, AgoraInjectStreamStatus) { + /** The external video stream imported successfully. */ + AgoraInjectStreamStatusStartSuccess = 0, + /** The external video stream already exists. */ + AgoraInjectStreamStatusStartAlreadyExists = 1, + /** The external video stream import is unauthorized */ + AgoraInjectStreamStatusStartUnauthorized = 2, + /** Import external video stream timeout. */ + AgoraInjectStreamStatusStartTimedout = 3, + /** The external video stream failed to import. */ + AgoraInjectStreamStatusStartFailed = 4, + /** The xternal video stream imports successfully. */ + AgoraInjectStreamStatusStopSuccess = 5, + /** No external video stream is found. */ + AgoraInjectStreamStatusStopNotFound = 6, + /** The external video stream is stopped from being unauthorized. */ + AgoraInjectStreamStatusStopUnauthorized = 7, + /** Importing the external video stream timeout. */ + AgoraInjectStreamStatusStopTimedout = 8, + /** Importing the external video stream failed. */ + AgoraInjectStreamStatusStopFailed = 9, + /** The external video stream is broken. */ + AgoraInjectStreamStatusBroken = 10, +}; + +/** Output log filter level */ +typedef NS_ENUM(NSUInteger, AgoraLogFilter) { + /** Do not output any log information. */ + AgoraLogFilterOff = 0, + /** Output all API log information */ + AgoraLogFilterDebug = 0x080f, + /** Output CRITICAL, ERROR, WARNING, and INFO level log information. */ + AgoraLogFilterInfo = 0x000f, + /** Outputs CRITICAL, ERROR, and WARNING level log information. */ + AgoraLogFilterWarning = 0x000e, + /** Outputs CRITICAL and ERROR level log information */ + AgoraLogFilterError = 0x000c, + /** Outputs CRITICAL level log information. */ + AgoraLogFilterCritical = 0x0008, +}; + +/** Audio recording quality */ +typedef NS_ENUM(NSInteger, AgoraAudioRecordingQuality) { + /** Low quality, file size around 1.2 MB after 10 minutes of recording. */ + AgoraAudioRecordingQualityLow = 0, + /** Medium quality, file size around 2 MB after 10 minutes of recording. */ + AgoraAudioRecordingQualityMedium = 1, + /** High quality, file size around 3.75 MB after 10 minutes of recording. */ + AgoraAudioRecordingQualityHigh = 2, + /** Ultra high quality, file size around 7.5 after 10 minutes of recording. */ + AgoraAudioRecordingQualityUltraHigh = 3, +}; + +/** The audio file record type. */ +typedef NS_ENUM(NSInteger, AgoraAudioFileRecordingType) { + /** mic audio file recording. */ + AgoraAudioFileRecordingTypeMic = 1, + /** playback audio file recording. */ + AgoraAudioFileRecordingTypePlayback = 2, + /** mixed audio file recording. */ + AgoraAudioFileRecordingTypeMixed = 3, + AgoraAudioFileRecordingTypePublish = 4, +}; + +/** The encoded audio frame observer position. */ +typedef NS_ENUM(NSInteger, AgoraAudioEncodedFrameDelegatePosition) { + /** mic audio file recording. */ + AgoraAudioEncodedFrameObserverPositionRecord = 1, + /** playback audio file recording. */ + AgoraAudioEncodedFrameObserverPositionPlayback = 2, + /** mixed audio file recording. */ + AgoraAudioEncodedFrameObserverPositionMixed = 3, + /** publish audio file recording. */ + AgoraAudioEncodedFrameObserverPositionPublish = 4, +}; + +/** The codec type of audio */ +typedef NS_ENUM(NSInteger, AgoraAudioCodecType) { + AgoraAudioCodecTypeOPUS = 1, + AgoraAudioCodecTypeAACLC = 8, + AgoraAudioCodecTypeHEAAC = 9, + AgoraAudioCodecTypeHEAAC2 = 11, +}; +/** the audio encoding type of audio encoded frame delegate */ +typedef NS_ENUM(NSInteger, AgoraAudioEncodingType) { + /** codecType AAC; sampleRate 16000; quality low which around 1.2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC16000Low = 0x010101, + /** codecType AAC; sampleRate 16000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC16000Medium = 0x010102, + /** codecType AAC; sampleRate 32000; quality low which around 1.2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC32000Low = 0x010201, + /** codecType AAC; sampleRate 32000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC32000Medium = 0x010202, + /** codecType AAC; sampleRate 32000; quality high which around 3.5 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC32000High = 0x010203, + /** codecType AAC; sampleRate 48000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC48000Medium = 0x010302, + /** codecType AAC; sampleRate 48000; quality high which around 3.5 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC48000High = 0x010303, + /** codecType OPUS; sampleRate 16000; quality low which around 1.2 MB after 10 minutes */ + AgoraAudioEncodingTypeOPUS16000Low = 0x020101, + /** codecType OPUS; sampleRate 16000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeOPUS6000Medium = 0x020102, + /** codecType OPUS; sampleRate 48000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeOPUS48000Medium = 0x020302, + /** codecType OPUS; sampleRate 48000; quality high which around 3.5 MB after 10 minutes */ + AgoraAudioEncodingTypeOPUS48000High = 0x020303, +}; + +/** Video stream lifecyle of CDN Live. */ +typedef NS_ENUM(NSInteger, AgoraRtmpStreamLifeCycle) { + /** Bound to the channel lifecycle. */ + AgoraRtmpStreamLifeCycleBindToChannel = 1, + /** Bound to the owner of the RTMP stream. */ + AgoraRtmpStreamLifeCycleBindToOwner = 2, +}; + +/** Network quality */ +typedef NS_ENUM(NSUInteger, AgoraNetworkQuality) { + /** The network quality is unknown. */ + AgoraNetworkQualityUnknown = 0, + /** The network quality is excellent. */ + AgoraNetworkQualityExcellent = 1, + /** The network quality is quite good, but the bitrate may be slightly lower than excellent. */ + AgoraNetworkQualityGood = 2, + /** Users can feel the communication slightly impaired. */ + AgoraNetworkQualityPoor = 3, + /** Users can communicate only not very smoothly. */ + AgoraNetworkQualityBad = 4, + /** The network is so bad that users can hardly communicate. */ + AgoraNetworkQualityVBad = 5, + /** The network is down and users cannot communicate at all. */ + AgoraNetworkQualityDown = 6, + /** Users cannot detect the network quality. (Not in use.) */ + AgoraNetworkQualityUnsupported = 7, + /** Detecting the network quality. */ + AgoraNetworkQualityDetecting = 8, +}; + +/** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. + */ +typedef NS_ENUM(NSUInteger, AgoraExperienceQuality) { + /** QoE of the local user is good. */ + AgoraExperienceQualityGood = 0, + /** QoE of the local user is poor. */ + AgoraExperienceQualityBad = 1, +}; + +/** + * The reason for poor QoE of the local user when receiving a remote audio stream. + * + */ +typedef NS_ENUM(NSUInteger, AgoraExperiencePoorReason) { + /** 0: No reason, indicating good QoE of the local user. + */ + AgoraExperiencePoorReasonNone = 0, + /** 1: The remote user's network quality is poor. + */ + AgoraExperiencePoorReasonRemoteNetworkQualityPoor = 1, + /** 2: The local user's network quality is poor. + */ + AgoraExperiencePoorReasonLocalNetworkQualityPoor = 2, + /** 4: The local user's Wi-Fi or mobile network signal is weak. + */ + AgoraExperiencePoorReasonWirelessSignalPoor = 4, + /** 8: The local user enables both Wi-Fi and bluetooth, and their signals interfere with each other. + * As a result, audio transmission quality is undermined. + */ + AgoraExperiencePoorReasonWifiBluetoothCoexist = 8, +}; + +/** + * The state of the probe test. + */ +typedef NS_ENUM(NSUInteger, AgoraLastmileProbeResultState) { + /** + * 1: The last-mile network probe test is complete. + */ + AgoraLastmileProbeResultComplete = 1, + /** + * 2: The last-mile network probe test is incomplete and the bandwidth estimation is not available, probably due to limited test resources. + */ + AgoraLastmileProbeResultIncompleteNoBwe = 2, + /** + * 3: The last-mile network probe test is not carried out, probably due to poor network conditions. + */ + AgoraLastmileProbeResultUnavailable = 3, +}; + +typedef NS_ENUM(NSInteger, AgoraUploadErrorReason) { + AgoraUploadErrorReasonSuccess = 0, + AgoraUploadErrorReasonNetError = 1, + AgoraUploadErrorReasonServerError = 2, +}; + +/** Video stream type */ +typedef NS_ENUM(NSInteger, AgoraVideoStreamType) { + /** High-video stream */ + AgoraVideoStreamTypeHigh = 0, + /** Low-video stream */ + AgoraVideoStreamTypeLow = 1, +}; + +/** Quality change of the local video in terms of target frame rate and target bit rate since last count. */ +typedef NS_ENUM(NSInteger, AgoraVideoQualityAdaptIndication) { + /** The quality of the local video stays the same. */ + AgoraVideoQualityAdaptNone = 0, + /** The quality improves because the network bandwidth increases. */ + AgoraVideoQualityAdaptUpBandwidth = 1, + /** The quality worsens because the network bandwidth decreases. */ + AgoraVideoQualityAdaptDownBandwidth = 2, +} NS_SWIFT_NAME(AgoraVideoQualityAdaptIndication); + +/** Video display mode */ +typedef NS_ENUM(NSUInteger, AgoraVideoRenderMode) { + /** Hidden(1): Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. */ + AgoraVideoRenderModeHidden = 1, + + /** Fit(2): Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black. */ + AgoraVideoRenderModeFit = 2, + + /** @deprecated + Adaptive(3):This mode is obsolete. + */ + AgoraVideoRenderModeAdaptive __deprecated_enum_msg("AgoraVideoRenderModeAdaptive is deprecated.") = 3, +}; + +/** Video codec profile type */ +typedef NS_ENUM(NSInteger, AgoraVideoCodecProfileType) { + /** Baseline video codec profile */ + AgoraVideoCodecProfileTypeBaseLine = 66, + /** Main video codec profile */ + AgoraVideoCodecProfileTypeMain = 77, + /** High Video codec profile (default) */ + AgoraVideoCodecProfileTypeHigh = 100 +}; + +/** Video mirror mode */ +typedef NS_ENUM(NSUInteger, AgoraVideoMirrorMode) { + /** + * 0: The default mirror mode (the SDK determines the mirror mode). + */ + AgoraVideoMirrorModeAuto = 0, + /** + * 1: Enable the mirror mode. + */ + AgoraVideoMirrorModeEnabled = 1, + /** + * 2: Disable the mirror mode. + */ + AgoraVideoMirrorModeDisabled = 2, +}; + +/** States of the local video. */ +typedef NS_ENUM(NSUInteger, AgoraVideoLocalState) { + /** + * 0: The local video is in the initial state. + */ + AgoraVideoLocalStateStopped = 0, + /** + * 1: The capturer starts successfully. + */ + AgoraVideoLocalStateCapturing = 1, + /** + * 2: The first video frame is encoded successfully. + */ + AgoraVideoLocalStateEncoding = 2, + /** + * 3: The local video fails to start. + */ + AgoraVideoLocalStateFailed = 3 +}; + +/** States of the local video. */ +typedef NS_ENUM(NSUInteger, AgoraLocalVideoStreamError) { + /** 0: The local video is normal. + */ + AgoraLocalVideoStreamErrorOK = 0, + /** 1: No specified reason for the local video failure. + */ + AgoraLocalVideoStreamErrorFailure = 1, + /** 2: The application does not have permission to start the local video capture device. Remind your user to grant permission and rejoin the channel. + */ + AgoraLocalVideoStreamErrorDeviceNoPermission = 2, + /** 3: The local video capture device is in use. Check whether the camera is occupied by another application or try to rejoin the channel. + */ + AgoraLocalVideoStreamErrorDeviceBusy = 3, + /** 4: The local video capture failed. Check whether the video capture device is working properly, check whether the camera is occupied by another application, or try to rejoin the channel. + */ + AgoraLocalVideoStreamErrorCaptureFailure = 4, + /** 5: The local video encoding fails. + */ + AgoraLocalVideoStreamErrorEncodeFailure = 5, + /** 6: (iOS only) The application is in the background. Remind your user that the application cannot capture video properly when the application is in the background. + */ + AgoraLocalVideoStreamErrorCaptureInBackGround = 6, + /** 7: (iOS only) The application is running in Slide Over, Split View, or Picture in Picture mode. Remind your user that the application cannot capture video properly when the application is running in Slide Over, Split View, or Picture in Picture mode. + */ + AgoraLocalVideoStreamErrorCaptureMultipleForegroundApps = 7, + /** 8: The SDK cannot find the local video capture device. Check whether the camera is connected to the device properly, check whether the camera is working properly, or try to rejoin the channel. + */ + AgoraLocalVideoStreamErrorCaptureNoDeviceFound = 8, + /** 9: (macOS only) The external camera currently in use is disconnected + (such as being unplugged). + */ + AgoraLocalVideoStreamErrorCaptureDeviceDisconnected = 9, + /** 10: The SDK cannot find the local video device id in device list, device id is invalid. + */ + AgoraLocalVideoStreamErrorCaptureDeviceInvalidId = 10, + /** 11: (macOS only) The shared window is minimized when you call + [startScreenCaptureByWindowId]([AgoraRtcEngineKit startScreenCaptureByWindowId:rectangle:parameters:]) to share a window. + Remind your user that the window cannot be shared properly when the shared window is minimized. + */ + AgoraLocalVideoStreamErrorScreenCaptureWindowMinimized = 11, + /** 12: (macOS only) The error code indicates that a window shared by the window ID has been closed, or a full-screen + window shared by the window ID has exited full-screen mode. After exiting + full-screen mode, remote users cannot see the shared window. To prevent remote users from seeing a black screen, Agora recommends + that you immediately stop screen sharing. +

Common scenarios for reporting this error code:

+
  • When the local user closes the shared window, the SDK reports this error code.
  • t +
  • The local user shows some slides in full-screen mode first, and then shares the windows of the slides. After the user exits full-screen + mode, the SDK reports this error code.
  • +
  • The local user watches web video or reads web document in full-screen mode first, and then shares the window of the web video or + document. After the user exits full-screen mode, the SDK reports this error code.
  • + */ + AgoraLocalVideoStreamErrorScreenCaptureWindowClosed = 12, + + /** 22: No permision to capture screen. */ + AgoraLocalVideoStreamErrorScreenCaptureNoPermission = 22, +}; + +/** The state of the remote video. */ +typedef NS_ENUM(NSUInteger, AgoraVideoRemoteState) { + /** 0: The remote video is in the default state, probably due to `AgoraVideoRemoteStateReasonLocalMuted(3)`, `AgoraVideoRemoteStateReasonRemoteMuted(5)`, or `AgoraVideoRemoteStateReasonRemoteOffline(7)`. */ + AgoraVideoRemoteStateStopped = 0, + /** 1: The first remote video packet is received. */ + AgoraVideoRemoteStateStarting = 1, + /** 2: The remote video stream is decoded and plays normally, probably due to `AgoraVideoRemoteStateReasonNetworkRecovery(2)`, `AgoraVideoRemoteStateReasonLocalUnmuted(4)`, `AgoraVideoRemoteStateReasonRemoteUnmuted(6)`, or `AgoraVideoRemoteStateReasonAudioFallbackRecovery(9)`. */ + AgoraVideoRemoteStateDecoding = 2, + /** 3: The remote video is frozen, probably due to `AgoraVideoRemoteStateReasonNetworkCongestion(1)` or `AgoraVideoRemoteStateReasonAudioFallback(8)`. */ + AgoraVideoRemoteStateFrozen = 3, + /** 4: The remote video fails to start, probably due to `AgoraVideoRemoteStateReasonInternal(0)`. */ + AgoraVideoRemoteStateFailed = 4, +}; + +/** + * The reason of the remote video state change. + */ +typedef NS_ENUM(NSUInteger, AgoraVideoRemoteReason) { + /** + * 0: Internal reasons. + */ + AgoraVideoRemoteReasonInternal = 0, + + /** + * 1: Network congestion. + */ + AgoraVideoRemoteReasonCongestion = 1, + + /** + * 2: Network recovery. + */ + AgoraVideoRemoteReasonRecovery = 2, + + /** + * 3: The local user stops receiving the remote video stream or disables the video module. + */ + AgoraVideoRemoteReasonLocalMuted = 3, + + /** + * 4: The local user resumes receiving the remote video stream or enables the video module. + */ + AgoraVideoRemoteReasonLocalUnmuted = 4, + + /** + * 5: The remote user stops sending the video stream or disables the video module. + */ + AgoraVideoRemoteReasonRemoteMuted = 5, + + /** + * 6: The remote user resumes sending the video stream or enables the video module. + */ + AgoraVideoRemoteReasonRemoteUnmuted = 6, + + /** + * 7: The remote user leaves the channel. + */ + AgoraVideoRemoteReasonRemoteOffline = 7, + + /** + * 8: The remote media stream falls back to the audio-only stream due to poor network conditions. + */ + AgoraVideoRemoteReasonAudioFallback = 8, + + /** + * 9: The remote media stream switches back to the video stream after the network conditions improve. + */ + AgoraVideoRemoteReasonAudioFallbackRecovery = 9 +}; + +/** + * The state of the local audio. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioLocalState) { + /** + * 0: The local audio is in the initial state. + */ + AgoraAudioLocalStateStopped = 0, + /** + * 1: The recording device starts successfully. + */ + AgoraAudioLocalStateRecording = 1, + /** + * 2: The first audio frame encodes successfully. + */ + AgoraAudioLocalStateEncoding = 2, + /** + * 3: The local audio fails to start. + */ + AgoraAudioLocalStateFailed = 3, +}; + +/** + * The error information of the local audio. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioLocalError) { + /** + * 0: No error. + */ + AgoraAudioLocalErrorOK = 0, + /** + * 1: No specified reason for the local audio failure. + */ + AgoraAudioLocalErrorFailure = 1, + /** + * 2: No permission to use the local audio device. + */ + AgoraAudioLocalErrorDeviceNoPermission = 2, + /** + * 3: The microphone is in use. + */ + AgoraAudioLocalErrorDeviceBusy = 3, + /** + * 4: The local audio recording fails. Check whether the recording device is working properly. + */ + AgoraAudioLocalErrorRecordFailure = 4, + /** + * 5: The local audio encoding fails. + */ + AgoraAudioLocalErrorEncodeFailure = 5, +}; + +/** Audio codec profile. */ +typedef NS_ENUM(NSInteger, AgoraAudioCodecProfileType) { + /** (Default) LC-AAC, the low-complexity audio codec profile. */ + AgoraAudioCodecProfileLCAAC = 0, + /** HE-AAC, the high-efficiency audio codec profile. */ + AgoraAudioCodecProfileHEAAC = 1, + /** HE-AACv2, which is the high-efficiency audio codec type.*/ + AgoraAudioCodecProfileHEAACv2 = 2 +}; + +typedef NS_ENUM(NSInteger, AgoraLicenseVerifyCode) { + /** + * 1: Invalid license + */ + AgoraLicenseVerifyInvalid = 1, + /** + * 2: License expired + */ + AgoraLicenseVerifyExpire = 2, + /** + * 3: Exceed license minutes limit + */ + AgoraLicenseVerifyMinutesExceed = 3, + /** + * 4: License use in limited period + */ + AgoraLicenseVerifyLimitedPeriod = 4, + /** + * 5: Same license used in different devices at the same time + */ + AgoraLicenseVerifyDiffDevices = 5, + /** + * 99: SDK internal error + */ + AgoraLicenseVerifyInternal = 99, +}; + +/** + * The state of the remote audio. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioRemoteState) { + /** + * 0: The remote audio stops (the default state). The following are possible reasons: + * - \ref AgoraAudioRemoteReasonLocalMuted(3) + * - \ref AgoraAudioRemoteReasonRemoteMuted(5) + * - \ref AgoraAudioRemoteReasonRemoteOffline(7) + */ + AgoraAudioRemoteStateStopped = 0, + /** + * 1: The first remote audio packet is received. + */ + AgoraAudioRemoteStateStarting = 1, + /** + * 2: The remote audio stream is decoded and plays normally. The following are possible reasons: + * - \ref AgoraAudioRemoteReasonNetworkRecovery(2) + * - \ref AgoraAudioRemoteReasonLocalUnmuted(4) + * - \ref AgoraAudioRemoteReasonRemoteUnmuted(6) + */ + AgoraAudioRemoteStateDecoding = 2, + /** + * 3: The remote audio is frozen. The possible reason is \ref AgoraAudioRemoteReasonNetworkCongestion(1). + */ + AgoraAudioRemoteStateFrozen = 3, + /** + * 4: The remote audio fails to start. The possible reason is \ref AgoraAudioRemoteReasonInternal(0). + */ + AgoraAudioRemoteStateFailed = 4, +}; + +/** + * The reason of the remote audio state change. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioRemoteReason) { + /** + * 0: Internal reasons. + */ + AgoraAudioRemoteReasonInternal = 0, + /** + * 1: Network congestion. + */ + AgoraAudioRemoteReasonNetworkCongestion = 1, + /** + * 2: Network recovery. + */ + AgoraAudioRemoteReasonNetworkRecovery = 2, + /** + * 3: The local user stops receiving the remote audio stream or disables the audio module. + */ + AgoraAudioRemoteReasonLocalMuted = 3, + /** + * 4: The local user resumes receiving the remote audio stream or enables the audio module. + */ + AgoraAudioRemoteReasonLocalUnmuted = 4, + /** + * 5: The remote user stops sending the audio stream or disables the audio module. + */ + AgoraAudioRemoteReasonRemoteMuted = 5, + /** + * 6: The remote user resumes sending the audio stream or enables the audio module. + */ + AgoraAudioRemoteReasonRemoteUnmuted = 6, + /** + * 7: The remote user leaves the channel. + */ + AgoraAudioRemoteReasonRemoteOffline = 7, +}; + +/** Stream fallback option */ +typedef NS_ENUM(NSInteger, AgoraStreamFallbackOptions) { + /** + * No fallback operation for the stream when the network condition is poor. The stream quality cannot be guaranteed. + */ + AgoraStreamFallbackOptionDisabled = 0, + /** + * Default option. + * Under poor network conditions, the SDK will send or receive AgoraVideoStreamTypeLow. + * You can only set this option in [setRemoteSubscribeFallbackOption]([AgoraRtcEngineKit setRemoteSubscribeFallbackOption:]). + * Nothing happens when you set this in [setLocalPublishFallbackOption]([AgoraRtcEngineKit setLocalPublishFallbackOption:]). + */ + AgoraStreamFallbackOptionVideoStreamLow = 1, + /** + * Under poor network conditions, the SDK may receive AgoraVideoStreamTypeLow first. + * But if the network still does not allow displaying the video, the SDK will send or receive audio only. + */ + AgoraStreamFallbackOptionAudioOnly = 2, +}; + +/** Audio sampling rate */ +typedef NS_ENUM(NSInteger, AgoraAudioSampleRateType) { + /** 32 kHz */ + AgoraAudioSampleRateType32000 = 32000, + /** 44.1 kHz */ + AgoraAudioSampleRateType44100 = 44100, + /** 48 kHz */ + AgoraAudioSampleRateType48000 = 48000, +}; + +/** + * Audio profile types. + */ +typedef NS_ENUM(NSInteger, AgoraAudioProfile) { + /** + * 0: The default audio profile. + * - In the Communication profile, it represents a sample rate of 16 kHz, music encoding, mono, and a bitrate + * of up to 16 Kbps. + * - In the Live-broadcast profile, it represents a sample rate of 48 kHz, music encoding, mono, and a bitrate + * of up to 64 Kbps. + */ + AgoraAudioProfileDefault = 0, + /** + * 1: A sample rate of 32 kHz, audio encoding, mono, and a bitrate up to 18 Kbps. + */ + AgoraAudioProfileSpeechStandard = 1, + /** + * 2: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. + */ + AgoraAudioProfileMusicStandard = 2, + /** + * 3: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 80 + * Kbps. + */ + AgoraAudioProfileMusicStandardStereo = 3, + /** + * 4: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 96 Kbps. + */ + AgoraAudioProfileMusicHighQuality = 4, + /** + * 5: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 128 Kbps. + */ + AgoraAudioProfileMusicHighQualityStereo = 5, + /** + * 6: A sample rate of 16 kHz, audio encoding, mono, and a bitrate of up to 64 Kbps. + */ + AgoraAudioProfileIot = 6, +}; + +/** + * Audio application scenarios. + */ +typedef NS_ENUM(NSInteger, AgoraAudioScenario) { + /** + * 0: (Recommended) The default audio scenario. + */ + AgoraAudioScenarioDefault = 0, + /** + * 3: (Recommended) The live gaming scenario, which needs to enable gaming + * audio effects in the speaker. Choose this scenario to achieve high-fidelity + * music playback. + */ + AgoraAudioScenarioGameStreaming = 3, + /** + * 5: The chatroom scenario. + */ + AgoraAudioScenarioChatRoom = 5, + /** Chorus */ + AgoraAudioScenarioChorus = 7, + /** Meeting */ + AgoraAudioScenarioMeeting = 8 +}; + +/** + * The audio output routing. + */ +typedef NS_ENUM(NSInteger, AgoraAudioOutputRouting) { + /** + * -1: The default audio route. + */ + AgoraAudioOutputRoutingDefault = -1, + /** + * 0: Headset. + */ + AgoraAudioOutputRoutingHeadset = 0, + /** + * 1: Earpiece. + */ + AgoraAudioOutputRoutingEarpiece = 1, + /** + * 2: Headset with no microphone. + */ + AgoraAudioOutputRoutingHeadsetNoMic = 2, + /** + * 3: Speakerphone. + */ + AgoraAudioOutputRoutingSpeakerphone = 3, + /** + * 4: Loudspeaker. + */ + AgoraAudioOutputRoutingLoudspeaker = 4, + /** + * 5: Bluetooth headset. + */ + AgoraAudioOutputRoutingHeadsetBluetooth = 5, + /** + * 6: (macOS only) HDMI peripheral. + */ + AgoraAudioOutputRoutingHdmi = 6, + /** + * 7: (macOS only) USB peripheral. + */ + AgoraAudioOutputRoutingUsb = 7, + /** + * 8: (macOS only) DisplayPort peripheral. + */ + AgoraAudioOutputRoutingDisplayPort = 8, + /** + * 9: Apple AirPlay. + */ + AgoraAudioOutputRoutingAirPlay = 9, + /** + * 10: Bluetooth Speaker via a2dp. + */ + AgoraAudioOutputRoutingBluetoothSpeaker = 10 +}; + +/** Use mode of the onRecordAudioFrame callback */ +typedef NS_ENUM(NSInteger, AgoraAudioRawFrameOperationMode) { + /** Read-only mode: Users only read the AudioFrame data without modifying anything. For example, when users acquire data with the Agora SDK then push the RTMP streams. */ + AgoraAudioRawFrameOperationModeReadOnly = 0, + /** Read and write mode: Users read the data from AudioFrame, modify it, and then play it. For example, when users have their own sound-effect processing module and do some voice pre-processing such as a voice change. */ + AgoraAudioRawFrameOperationModeReadWrite = 2, +}; + +/** Audio equalization band frequency */ +typedef NS_ENUM(NSInteger, AgoraAudioEqualizationBandFrequency) { + /** 31 Hz */ + AgoraAudioEqualizationBand31 = 0, + /** 62 Hz */ + AgoraAudioEqualizationBand62 = 1, + /** 125 Hz */ + AgoraAudioEqualizationBand125 = 2, + /** 250 Hz */ + AgoraAudioEqualizationBand250 = 3, + /** 500 Hz */ + AgoraAudioEqualizationBand500 = 4, + /** 1 kHz */ + AgoraAudioEqualizationBand1K = 5, + /** 2 kHz */ + AgoraAudioEqualizationBand2K = 6, + /** 4 kHz */ + AgoraAudioEqualizationBand4K = 7, + /** 8 kHz */ + AgoraAudioEqualizationBand8K = 8, + /** 16 kHz */ + AgoraAudioEqualizationBand16K = 9, +}; + +/** Audio reverberation type */ +typedef NS_ENUM(NSInteger, AgoraAudioReverbType) { + /** (dB, -20 to 10), the level of the dry signal */ + AgoraAudioReverbDryLevel = 0, + /** (dB, -20 to 10), the level of the early reflection signal (wet signal) */ + AgoraAudioReverbWetLevel = 1, + /** (0 to 100), the room size of the reflection */ + AgoraAudioReverbRoomSize = 2, + /** (ms, 0 to 200), the length of the initial delay of the wet signal in ms */ + AgoraAudioReverbWetDelay = 3, + /** (0 to 100), the strength of the late reverberation */ + AgoraAudioReverbStrength = 4, +}; + +/** The options for SDK preset voice beautifier effects.*/ +typedef NS_ENUM(NSInteger, AgoraVoiceBeautifierPreset) { + /** Turn off voice beautifier effects and use the original voice. + */ + AgoraVoiceBeautifierPresetOff = 0x00000000, + /** A more magnetic voice. + * + * @note Agora recommends using this enumerator to process a male-sounding voice; otherwise, you + * may experience vocal distortion. + */ + AgoraVoiceBeautifierPresetChatBeautifierMagnetic = 0x01010100, + /** A fresher voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you + * may experience vocal distortion. + */ + AgoraVoiceBeautifierPresetChatBeautifierFresh = 0x01010200, + /** A more vital voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you + * may experience vocal distortion. + */ + AgoraVoiceBeautifierPresetChatBeautifierVitality = 0x01010300, + /** + * @since v3.3.0 + * + * Singing beautifier effect. + * - If you call \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * (SINGING_BEAUTIFIER), you can beautify a male-sounding voice and add a reverberation effect + * that sounds like singing in a small room. Agora recommends not using \ref + * IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" (SINGING_BEAUTIFIER) to process + * a female-sounding voice; otherwise, you may experience vocal distortion. + * - If you call \ref IRtcEngine::setVoiceBeautifierParameters + * "setVoiceBeautifierParameters"(SINGING_BEAUTIFIER, param1, param2), you can beautify a male- or + * female-sounding voice and add a reverberation effect. + */ + AgoraVoiceBeautifierPresetSingingBeautifier= 0x01020100, + /** A more vigorous voice. + */ + AgoraVoiceBeautifierTimbreTransformationVigorous = 0x01030100, + /** A deeper voice. + */ + AgoraVoiceBeautifierTimbreTransformationDeep = 0x01030200, + /** A mellower voice. + */ + AgoraVoiceBeautifierTimbreTransformationMellow= 0x01030300, + /** A falsetto voice. + */ + AgoraVoiceBeautifierTimbreTransformationFalsetto= 0x01030400, + /** A fuller voice. + */ + AgoraVoiceBeautifierTimbreTransformationFull = 0x01030500, + /** A clearer voice. + */ + AgoraVoiceBeautifierTimbreTransformationClear = 0x01030600, + /** A more resounding voice. + */ + AgoraVoiceBeautifierTimbreTransformationResounding = 0x01030700, + /** A more ringing voice. + */ + AgoraVoiceBeautifierTimbreTransformatRinging= 0x01030800, + + AgoraVoiceBeautifierUltraHighQuality = 0x01040100 +}; + +/** The options for SDK preset audio effects.*/ +typedef NS_ENUM(NSInteger, AgoraAudioEffectPreset) { + /** Turn off audio effects and use the original voice. + */ + AgoraAudioEffectPresetOff = 0x00000000, + /** The voice effect for backing vocals when the lead vocal turns off audio effect. + * @note: When this effect is used, the voice of the backing vocals will be softer. + */ + AgoraAudioEffectPresetOffHarmony = 0x02010120, + /** An audio effect typical of a KTV venue. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousticsKTV = 0x02010100, + /** An audio effect typical of a KTV venue for backing vocals. + * + * @note: This effect is used for backing vocals when KTV venue is chosen for the lead vocal. + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousticsKTVHarmony = 0x02010110, + /** An audio effect typical of a concert hall. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousVocalConcer = 0x02010200, + /** An audio effect typical of a concert hall for backing vocals. + * + * @note: This effect is used for backing vocals when concert hall is chosen for the lead vocal. + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousVocalConcerHarmony = 0x02010210, + /** An audio effect typical of a recording studio. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousStudio = 0x02010300, + /** The voice effect typical of a studio venue for backing vocals. + * + * @note: This effect is used for backing vocals when studio venue is chosen for the lead vocal. + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousStudioHarmony = 0x02010310, + /** An audio effect typical of a vintage phonograph. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousPhonograph = 0x02010400, + /** The voice effect typical of a phonograph venue for backing vocals. + * + * @note: This effect is used for backing vocals when phonograph venue is chosen for the lead vocal. + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousPhonographHarmony = 0x02010410, + /** A virtual stereo effect that renders monophonic audio as stereo audio. + * + * @note Call \ref IRtcEngine::setAudioProfile "setAudioProfile" and set the `profile` parameter + * to `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` + * before setting this enumerator; otherwise, the enumerator setting does not take effect. + */ + AgoraAudioEffectPresetRoomAcousVirtualStereo = 0x02010500, + /** A more spatial audio effect. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousSpatial = 0x02010600, + /** A more ethereal audio effect. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousEthereal = 0x02010700, + /** A 3D voice effect that makes the voice appear to be moving around the user. The default cycle + * period of the 3D voice effect is 10 seconds. To change the cycle period, call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" after this method. + * + * @note + * - Call \ref IRtcEngine::setAudioProfile "setAudioProfile" and set the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator; otherwise, the enumerator setting does not take effect. + * - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear + * the anticipated voice effect. + */ + AgoraAudioEffectPresetRoomAcous3DVoice = 0x02010800, + /** virtual suround sound. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousVirtualSurroundSound = 0x02010900, + /** An audio effect for chorus. + * + * @note: To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousticsChorus = 0x02010D00, + /** The voice of an uncle. + * + * @note + * - Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectUncle = 0x02020100, + /** The voice of an old man. + * + * @note + * - Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectOldMan = 0x02020200, + /** The voice of a boy. + * + * @note + * - Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectBoy= 0x02020300, + /** The voice of a young woman. + * + * @note + * - Agora recommends using this enumerator to process a female-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectSister= 0x02020400, + /** The voice of a girl. + * + * @note + * - Agora recommends using this enumerator to process a female-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectGirl = 0x02020500, + /** The voice of Pig King, a character in Journey to the West who has a voice like a growling + * bear. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectPigKin = 0x02020600, + /** The voice of Hulk. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectHulk = 0x02020700, + /** An audio effect typical of R&B music. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetStyleTransformationRnb = 0x02030100, + /** An audio effect typical of popular music. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetStyleTransformationPopular= 0x02030200, + /** A pitch correction effect that corrects the user's pitch based on the pitch of the natural C + * major scale. To change the basic mode and tonic pitch, call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" after this method. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetPitchCorrection = 0x02040100 +}; + +/** The options for SDK preset voice conversion. */ +typedef NS_ENUM(NSInteger, AgoraVoiceConversionPreset) { + /** Turn off voice conversion and use the original voice. */ + AgoraVoiceConversionPresetOff = 0x00000000, + /** A neutral voice. */ + AgoraVoiceConversionPresetNeutral = 0x03010100, + /** A sweet voice. */ + AgoraVoiceConversionPresetSweet = 0x03010200, + /** A solid voice. */ + AgoraVoiceConversionPresetChangerSolid = 0x03010300, + /** A bass voice. */ + AgoraVoiceConversionPresetChangerBass = 0x03010400 +}; + +/** The preset local voice reverberation option. */ +typedef NS_ENUM(NSInteger, AgoraAudioReverbPreset) { + /** The original voice (no local voice reverberation). */ + AgoraAudioReverbPresetOff = 0x00000000, + /** The reverberation style typical of a KTV venue (enhanced). */ + AgoraAudioReverbPresetFxKTV = 0x02010100, + /** The reverberation style typical of a concert hall (enhanced). */ + AgoraAudioReverbPresetFxVocalConcert = 0x02010200, + /** The reverberation style typical of an uncle's voice. */ + AgoraAudioReverbPresetFxUncle = 0x02020100, + /** The reverberation style typical of a little sister's voice. */ + AgoraAudioReverbPresetFxSister = 0x02020400, + /** The reverberation style typical of a recording studio (enhanced). */ + AgoraAudioReverbPresetFxStudio = 0x02010300, + /** The reverberation style typical of popular music (enhanced). */ + AgoraAudioReverbPresetFxPopular = 0x02030200, + /** The reverberation style typical of R&B music (enhanced). */ + AgoraAudioReverbPresetFxRNB = 0x02030100, + /** The reverberation style typical of the vintage phonograph. */ + AgoraAudioReverbPresetFxPhonograph = 0x02010400, + /** The reverberation style typical of chorus. */ + AgoraAudioReverbPresetFxChorus = 0x02010D00 +}; + +typedef NS_ENUM(NSInteger, AgoraHeadphoneEQPreset){ + /** Turn off headphone EQ and use the original voice. */ + AgoraAudioHeadphoneEQPresetOff = 0x00000000, + /** For over-ear headphones. */ + AgoraAudioHeadphoneEQPresetOverear = 0x04000001, + /** For in-ear headphones. */ + AgoraAudioHeadphoneEQPresetInear = 0x04000002 +}; + +/** Audio session restriction */ +typedef NS_OPTIONS(NSUInteger, AgoraAudioSessionOperationRestriction) { + /** No restriction, the SDK has full control on the audio session operations. */ + AgoraAudioSessionOperationRestrictionNone = 0, + /** The SDK will not change the audio session category */ + AgoraAudioSessionOperationRestrictionSetCategory = 1, + /** The SDK will not change any setting of the audio session (category, mode, categoryOptions) */ + AgoraAudioSessionOperationRestrictionConfigureSession = 1 << 1, + /** The SDK will keep the audio session active when leaving a channel */ + AgoraAudioSessionOperationRestrictionDeactivateSession = 1 << 2, + /** The SDK will not configure the audio session anymore */ + AgoraAudioSessionOperationRestrictionAll = 1 << 7 +}; + +/** Media device type */ +typedef NS_ENUM(NSInteger, AgoraMediaDeviceType) { + /** Unknown device*/ + AgoraMediaDeviceTypeAudioUnknown = -1, + /** Audio playback device */ + AgoraMediaDeviceTypeAudioPlayout = 0, + /** Microphone device */ + AgoraMediaDeviceTypeAudioRecording = 1, + /** Video render device*/ + AgoraMediaDeviceTypeVideoRender = 2, + /** Video capture device*/ + AgoraMediaDeviceTypeVideoCapture = 3, +}; + +/** Video frame format */ +typedef NS_ENUM(NSInteger, AgoraVideoFormat) { + /** i420 video frame fromat*/ + AgoraVideoFormatI420 = 1, + /** BGRA video frame fromat*/ + AgoraVideoFormatBGRA = 2, + /** NV21 video frame fromat*/ + AgoraVideoFormatNV21 = 3, + /** RGBA video frame fromat*/ + AgoraVideoFormatRGBA = 4, + /** NV12 video frame fromat*/ + AgoraVideoFormatNV12 = 8, + /** iOS texture NV12 (CVPixelBufferRef)*/ + AgoraVideoFormatCVPixelNV12 = 12, + /** iOS texture I420 (CVPixelBufferRef)*/ + AgoraVideoFormatCVPixelI420 = 13, + /** iOS texture BGRA (CVPixelBufferRef)*/ + AgoraVideoFormatCVPixelBGRA = 14, + /** I422 video frame fromat*/ + AgoraVideoFormatI422 = 16, + /** Internal default fromat*/ + AgoraVideoFormatDefault = 0, +}; + +/** + * Types of the video frame. + */ +typedef NS_ENUM(NSInteger, AgoraVideoFrameType) { + /** (Default) Blank frame */ + AgoraVideoFrameTypeBlankFrame = 0, + /** (Default) Key frame */ + AgoraVideoFrameTypeKeyFrame = 3, + /** (Default) Delta frame */ + AgoraVideoFrameTypeDeltaFrame = 4, + /** (Default) B frame */ + AgoraVideoFrameTypeBFrame = 5, + /** (Default) Droppable frame */ + AgoraVideoFrameTypeDroppableFrame = 6, + /** (Default) Unknown frame type */ + AgoraVideoFrameTypeUnknow +}; + +typedef NS_ENUM(NSInteger, AgoraVideoFrameProcessMode) { + AgoraVideoFrameProcessModeReadOnly, // Observer works as a pure renderer and will not modify the original frame. + AgoraVideoFrameProcessModeReadWrite, // Observer works as a filter that will process the video frame and affect the following frame processing in SDK. +}; + +/** The connection state of the SDK. */ +typedef NS_ENUM(NSInteger, AgoraConnectionState) { + /** + * 1: The SDK is disconnected from the edge server. + */ + AgoraConnectionStateDisconnected = 1, + /** + * 2: The SDK is connecting to the edge server. + */ + AgoraConnectionStateConnecting = 2, + /** + * 3: The SDK is connected to the edge server and has joined a channel. You can now publish or subscribe to a media stream in the channel. + */ + AgoraConnectionStateConnected = 3, + /** + * 4: The SDK keeps rejoining the channel after being disconnected from a joined channel because of network issues. + */ + AgoraConnectionStateReconnecting = 4, + /** + * 5: The SDK fails to connect to the edge server or join the channel. + */ + AgoraConnectionStateFailed = 5, +}; + +/** The network type. */ +typedef NS_ENUM(NSInteger, AgoraNetworkType) { + /** + * -1: The network type is unknown. + */ + AgoraNetworkTypeUnknown = -1, + /** + * 0: The network type is disconnected. + */ + AgoraNetworkTypeDisconnected = 0, + /** + * 1: The network type is LAN. + */ + AgoraNetworkTypeLAN = 1, + /** + * 2: The network type is Wi-Fi. + */ + AgoraNetworkTypeWIFI = 2, + /** + * 3: The network type is mobile 2G. + */ + AgoraNetworkType2G = 3, + /** + * 4: The network type is mobile 3G. + */ + AgoraNetworkType3G = 4, + /** + * 5: The network type is mobile 4G. + */ + AgoraNetworkType4G = 5, + /** + * 6: The network type is mobile 5G. + */ + AgoraNetworkType5G = 6, +}; + +/** The video encoding degradation preference under limited bandwidth. */ +typedef NS_ENUM(NSInteger, AgoraDegradationPreference) { + /** (Default) Degrade the frame rate and keep resolution to guarantee the video quality. */ + AgoraDegradationMaintainQuality = 0, + /** Degrade resolution in order to maintain framerate. */ + AgoraDegradationMaintainFramerate = 1, + /** Maintain resolution in video quality control process. Under limited bandwidth, degrade video quality first and then degrade frame rate. */ + AgoraDegradationBalanced = 2, + /** Degrade framerate in order to maintain resolution. */ + AgoraDegradationMaintainResolution = 3, +}; + +/** The video AgoraHardwareEncoding. */ +typedef NS_ENUM(NSInteger, AgoraEncodingPreference) { + /** + * Default encoding. + */ + AgoraEncodingPreferAuto = -1, + /** + * Software encoding. + */ + AgoraEncodingPrefersoftware = 0, + /** + * Hardware encoding + */ + AgoraEncodingPreferhardware = 1, +}; + +/** The video compression preference. */ +typedef NS_ENUM(NSInteger, AgoraCompressionPreference) { + /** (Default) Prefer low latency, it is default behavior, normally in real-time communication, latency is the first priority. + */ + AgoraCompressionLowLatency = 0, + /** Prefer quality in sacrifice of a degree of latency, usually around 30ms ~ 150ms, depends target fps + */ + AgoraCompressionQuality = 1, +}; + +/** Supported codec bit mask types. */ +typedef NS_ENUM(NSInteger, AgoraCodecCapMask) { + /** No codec support. + */ + AgoraCodecMaskNone = 0, + /** bit 1: Hardware decoder support flag + */ + AgoraCodecMaskHwDec = 1, + /** bit 2: Hardware encoder support flag + */ + AgoraCodecMaskHwEnc = 2, + /** bit 3: Software decoder support flag + */ + AgoraCodecMaskSwDec = 4, + /** bit 4: Software encoder support flag + */ + AgoraCodecMaskSwEnc = 8, +}; + +/** The lightening contrast level. */ +typedef NS_ENUM(NSUInteger, AgoraLighteningContrastLevel) { + /** Low contrast level. */ + AgoraLighteningContrastLow = 0, + /** (Default) Normal contrast level. */ + AgoraLighteningContrastNormal = 1, + /** High contrast level. */ + AgoraLighteningContrastHigh = 2, +}; + +/** The video noise reduction mode. + + @since v4.0.0 + */ +typedef NS_ENUM(NSUInteger, AgoraVideoDenoiserMode) { + /** 0: (Default) Automatic mode. The SDK automatically enables or disables the video noise reduction feature according to the ambient light. */ + AgoraVideoDenoiserModeAuto = 0, + /** 1: Manual mode. Users need to enable or disable the video noise reduction feature manually. */ + AgoraVideoDenoiserModeManual = 1, +}; + +/** The video noise reduction level. + + @since v4.0.0 + */ +typedef NS_ENUM(NSUInteger, AgoraVideoDenoiserLevel) { + /** 0: (Default) Promotes video quality during video noise reduction. `HighQuality` balances performance consumption and video noise reduction quality. The performance consumption is moderate, the video noise reduction speed is moderate, and the overall video quality is optimal. */ + AgoraVideoDenoiserLevelHighQuality = 0, + /** 1: Promotes reducing performance consumption during video noise reduction. `Fast` prioritizes reducing performance consumption over video noise reduction quality. The performance consumption is lower, and the video noise reduction speed is faster. To avoid a noticeable shadowing effect (shadows trailing behind moving objects) in the processed video, Agora recommends that you use `Fast` when the camera is fixed. */ + AgoraVideoDenoiserLevelFast = 1, + /** 2: Enhanced video noise reduction. `Strength` prioritizes video noise reduction quality over reducing performance consumption. The performance consumption is higher, the video noise reduction speed is slower, and the video noise reduction quality is better. If `HighQuality` is not enough for your video noise reduction needs, you can use `Strength`. */ + AgoraVideoDenoiserLevelStrength = 2, + +}; + +/** The low-light enhancement mode. + + @since v4.0.0 + */ +typedef NS_ENUM(NSUInteger, AgoraLowlightEnhanceMode) { + /** 0: (Default) Automatic mode. The SDK automatically enables or disables the low-light enhancement feature according to the ambient light to compensate for the lighting level or prevent overexposure, as necessary. */ + AgoraLowlightEnhanceModeAuto = 0, + /** 1: Manual mode. Users need to enable or disable the low-light enhancement feature manually. */ + AgoraLowlightEnhanceModeManual = 1, +}; + +/** The low-light enhancement level. + + @since v4.0.0 + */ +typedef NS_ENUM(NSUInteger, AgoraLowlightEnhanceLevel) { + /** 0: (Default) Promotes video quality during low-light enhancement. It processes the brightness, details, and noise of the video image. The performance consumption is moderate, the processing speed is moderate, and the overall video quality is optimal. */ + AgoraLowlightEnhanceLevelQuality = 0, + /** 1: Promotes performance during low-light enhancement. It processes the brightness and details of the video image. The processing speed is faster. */ + AgoraLowlightEnhanceLevelFast = 1, +}; + +/** The type of the custom background image. + @since v3.7.200 + */ +typedef NS_ENUM(NSUInteger, AgoraVirtualBackgroundSourceType) { + /** 1: (Default) The background image is a solid color.*/ + AgoraVirtualBackgroundColor = 1, + /** 2: The background image is a file in PNG or JPG format.*/ + AgoraVirtualBackgroundImg = 2, + /** Background source is blur your background */ + AgoraVirtualBackgroundBlur = 3, +} NS_SWIFT_NAME(AgoraVirtualBackgroundSourceType); + +/** The lightening contrast level. */ +typedef NS_ENUM(NSUInteger, AgoraBlurDegree) { + /** Background few things*/ + AgoraBlurLow = 1, + /** Background blur more things*/ + AgoraBlurMedium = 2, + /** Background blur most */ + AgoraBlurHigh = 3, +} NS_SWIFT_NAME(AgoraBlurDegree); + +typedef NS_ENUM(NSUInteger, SegModelType) { + SegModelAgoraAi = 1, + SegModelAgoraGreen = 2, +} NS_SWIFT_NAME(SegModelType); + +typedef NS_ENUM(NSInteger, AgoraConnectionChangedReason) { + /** + * 0: The SDK is connecting to Agora's edge server. + */ + AgoraConnectionChangedReasonConnecting = 0, + /** + * 1: The SDK has joined the channel successfully. + */ + AgoraConnectionChangedReasonJoinSuccess = 1, + /** + * 2: The connection between the SDK and Agora's edge server is interrupted. + */ + AgoraConnectionChangedReasonInterrupted = 2, + /** + * 3: The connection between the SDK and Agora's edge server is banned by Agora's edge server. + */ + AgoraConnectionChangedReasonBannedByServer = 3, + /** + * 4: The SDK fails to join the channel for more than 20 minutes and stops reconnecting to the channel. + */ + AgoraConnectionChangedReasonJoinFailed = 4, + /** + * 5: The SDK has left the channel. + */ + AgoraConnectionChangedReasonLeaveChannel = 5, + /** + * 6: The connection failed since Appid is not valid. + */ + AgoraConnectionChangedReasonInvalidAppId = 6, + /** + * 7: The connection failed since channel name is not valid. + */ + AgoraConnectionChangedReasonInvalidChannelName = 7, + /** + * 8: The connection failed since token is not valid, possibly because: + - The App Certificate for the project is enabled in Console, but you do not use Token when + joining the channel. If you enable the App Certificate, you must use a token to join the channel. + - The uid that you specify in the `joinChannel` method + is different from the uid that you pass for generating the token. + */ + AgoraConnectionChangedReasonInvalidToken = 8, + /** + * 9: The connection failed since token is expired. + */ + AgoraConnectionChangedReasonTokenExpired = 9, + /** + * 10: The connection is rejected by server. + */ + AgoraConnectionChangedReasonRejectedByServer = 10, + /** + * 11: The connection changed to reconnecting since SDK has set a proxy server. + */ + AgoraConnectionChangedReasonSettingProxyServer = 11, + /** + * 12: When SDK is in connection failed, the renew token operation will make it connecting. + */ + AgoraConnectionChangedReasonRenewToken = 12, + /** + * 13: The IP Address of SDK client has changed. i.e., Network type or IP/Port changed by network + operator might change client IP address. + */ + AgoraConnectionChangedReasonClientIpAddressChanged = 13, + /** + * 14: Timeout for the keep-alive of the connection between the SDK and Agora's edge server. The + connection state changes to CONNECTION_STATE_RECONNECTING(4). + */ + AgoraConnectionChangedReasonKeepAliveTimeout = 14, + /** + * 15: The SDK has rejoined the channel successfully. + */ + AgoraConnectionChangedReasonRejoinSuccess = 15, + /** + * 16: The connection between the SDK and Agora's edge server is lost. + */ + AgoraConnectionChangedReasonLost = 16, + /** + * 17: The change of connection state is caused by echo test. + */ + AgoraConnectionChangedReasonEchoTest = 17, + /** + * 18: The local IP Address is changed by user. + */ + AgoraConnectionChangedClientIpAddressChangedByUser = 18, + /** + * 19: There is a disconnection due to joining channel on another device with the same uid. + */ + AgoraConnectionChangedSameUidLogin = 19, + /** + * 20: The connection is failed due to too many broadcasters in the channel. + */ + AgoraConnectionChangedTooManyBroadcasters = 20, + /** + * 21: The connection is failed due to license validation failure. + */ + AgoraConnectionChangedLicenseValidationFailure = 21, + /** + * 22: The connection is failed due to certification verify failure. + */ + AgoraConnectionChangedCertificationVerifyFailure = 22, +}; + +typedef NS_ENUM(NSInteger, AgoraClientRoleChangeFailedReason) { + /** + * 1: Too many broadcasters in the channel. + */ + AgoraClientRoleChangeFailedTooManyBroadcasters = 1, + /** + * 2: The operation of changing role is not authorized. + */ + AgoraClientRoleChangeFailedNotAuthorized = 2, + /** + * 3: The operation of changing role is timeout. + */ + AgoraClientRoleChangeFailedRequestTimeout = 3, + /** + * 4: The operation of changing role is interrupted since we lost connection with agora service. + */ + AgoraClientRoleChangeFailedConnectionFailed = 4, +}; + +/** + * The playback state of the audio mixing file. + */ +typedef NS_ENUM(NSInteger, AgoraAudioMixingStateType) { + /** + * 710: The audio mixing file is playing. + */ + AgoraAudioMixingStateTypePlaying = 710, + /** + * 711: The audio mixing file pauses playing. + */ + AgoraAudioMixingStateTypePaused = 711, + /** + * 713: The audio mixing file stops playing. + */ + AgoraAudioMixingStateTypeStopped = 713, + /** + * 714: The audio mixing file playback fails. See `AgoraAudioMixingReasonCode` for details. + */ + AgoraAudioMixingStateTypeFailed = 714, +}; + +/** + * The audio mixing error code. + */ +typedef NS_ENUM(NSInteger, AgoraAudioMixingReasonCode) { + /** + * 701: The SDK cannot open the audio file. + */ + AgoraAudioMixingReasonCanNotOpen = 701, + /** + * 702: The SDK opens the audio mixing file too frequently. Ensure that the time interval between calling \ref AgoraRtcEngineKit.startAudioMixing:loopback:replace:cycle: startAudioMixing is more than 100 ms. + */ + AgoraAudioMixingReasonTooFrequentlyCall = 702, + /** + * 703: The audio mixing file playback is interrupted. + */ + + AgoraAudioMixingReasonInterruptedEOF = 703, + /** 715: The audio mixing file is played once. */ + + AgoraAudioMixingReasonOneLoopCompleted = 721, + + /** 716: The audio mixing file is all played out. */ + AgoraAudioMixingReasonAllLoopsCompleted = 723, + + /** 716: The audio mixing file stopped by user */ + AgoraAudioMixingReasonStoppedByUser = 724, + /** + * 0: No error. + */ + AgoraAudioMixingReasonTypeOk = 0, +}; + +typedef NS_ENUM (NSInteger, AgoraMetadataType) { + /** -1: The metadata type is unknown. + */ + AgoraMetadataTypeUnknown = -1, + /** 0: The metadata type is video. + */ + AgoraMetadataTypeVideo = 0 +}; + +/** + * The maximum metadata size. + */ +typedef NS_ENUM (NSInteger, AgoraMaxMetadataSizeType) { + AgoraMaxMetadataSizeTypeInvalid = -1, + AgoraMaxMetadataSizeTypeDefault = 512, + AgoraMaxMetadataSizeTypeMax = 1024 +}; + +/** + * Supported logging severities of SDK. + */ +typedef NS_ENUM (NSInteger, AgoraLogLevel) { + /** + * Do not output any log file. + */ + AgoraLogLevelNone = 0x0000, + /** + * (Recommended) Output log files of the Info level. + */ + AgoraLogLevelInfo = 0x0001, + /** + * Output log files of the Warning level. + */ + AgoraLogLevelWarn = 0x0002, + /** + * Output log files of the Error level. + */ + AgoraLogLevelError = 0x0004, + /** + * Output log files of the Critical level. + */ + AgoraLogLevelFatal = 0x0008 +}; + +/** Areas for geofencing. + */ +typedef NS_ENUM(NSUInteger, AgoraAreaCodeType) { + /** + * Mainland China. + */ + AgoraAreaCodeTypeCN = 0x1, + /** + * North America. + */ + AgoraAreaCodeTypeNA = 0x2, + /** + * Europe. + */ + AgoraAreaCodeTypeEUR = 0x4, + /** + * Asia, excluding Mainland China. + */ + AgoraAreaCodeTypeAS = 0x8, + /** + * Japan. + */ + AgoraAreaCodeTypeJP = 0x10, + /** + * India + */ + AgoraAreaCodeTypeIN = 0x20, + /** + * Russia + */ + AgoraAreaCodeTypeRU = 0x1000, + /** + * (Default) Global. + */ + AgoraAreaCodeTypeGlobal = 0xFFFFFFFF +}; + +/** The RTMP or RTMPS streaming state. */ +typedef NS_ENUM(NSUInteger, AgoraRtmpStreamingState) { + /** The RTMP or RTMPS streaming has not started or has ended. This state is also triggered after you remove an RTMP or RTMPS stream from the CDN by calling [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:]).*/ + AgoraRtmpStreamingStateIdle = 0, + /** The SDK is connecting to Agora's streaming server and the CDN server. This state is triggered after you call the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method. */ + AgoraRtmpStreamingStateConnecting = 1, + /** The RTMP or RTMPS streaming is being published. The SDK successfully publishes the RTMP or RTMPS streaming and returns this state. */ + AgoraRtmpStreamingStateRunning = 2, + /** The RTMP or RTMPS streaming is recovering. When exceptions occur to the CDN, or the streaming is interrupted, the SDK attempts to resume RTMP or RTMPS streaming and returns this state. +
  • If the SDK successfully resumes the streaming, `AgoraRtmpStreamingStateRunning(2)` returns. +
  • If the streaming does not resume within 60 seconds or server errors occur, AgoraRtmpStreamingStateFailure(4) returns. You can also reconnect to the server by calling the [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:]) and [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) methods. */ + AgoraRtmpStreamingStateRecovering = 3, + /** The RTMP or RTMPS streaming fails. See the errorCode parameter for the detailed error information. You can also call the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method to publish the RTMP or RTMPS streaming again. */ + AgoraRtmpStreamingStateFailure = 4, + /** The SDK is disconnecting to Agora's streaming server and the CDN server. This state is triggered after you call the [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:transcodingEnabled:]) method. */ + AgoraRtmpStreamingStateDisconnecting = 5, +}; + +/** The detailed error information for streaming. */ +typedef NS_ENUM(NSUInteger, AgoraRtmpStreamingErrorCode) { + /** The RTMP or RTMPS streaming publishes successfully. */ + AgoraRtmpStreamingErrorCodeOK = 0, + /** Invalid argument used. If, for example, you do not call the [setLiveTranscoding]([AgoraRtcEngineKit setLiveTranscoding:]) method to configure the LiveTranscoding parameters before calling the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method, the SDK returns this error. Check whether you set the parameters in the setLiveTranscoding method properly. */ + AgoraRtmpStreamingErrorCodeInvalidParameters = 1, + /** The RTMP or RTMPS streaming is encrypted and cannot be published. */ + AgoraRtmpStreamingErrorCodeEncryptedStreamNotAllowed = 2, + /** Timeout for the RTMP or RTMPS streaming. Call the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method to publish the streaming again. */ + AgoraRtmpStreamingErrorCodeConnectionTimeout = 3, + /** An error occurs in Agora's streaming server. Call the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method to publish the streaming again. */ + AgoraRtmpStreamingErrorCodeInternalServerError = 4, + /** An error occurs in the CDN server. */ + AgoraRtmpStreamingErrorCodeRtmpServerError = 5, + /** The RTMP or RTMPS streaming publishes too frequently. */ + AgoraRtmpStreamingErrorCodeTooOften = 6, + /** The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones. */ + AgoraRtmpStreamingErrorCodeReachLimit = 7, + /** The host manipulates other hosts' URLs. Check your app logic. */ + AgoraRtmpStreamingErrorCodeNotAuthorized = 8, + /** Agora's server fails to find the RTMP or RTMPS streaming. */ + AgoraRtmpStreamingErrorCodeStreamNotFound = 9, + /** The format of the RTMP or RTMPS streaming URL is not supported. Check whether the URL format is correct. */ + AgoraRtmpStreamingErrorCodeFormatNotSupported = 10, + /** Current role is not broadcaster. Check whether the role of the current channel. */ + AgoraRtmpStreamingErrorNotBroadcaster = 11, + /** Call updateTranscoding, but no mix stream. */ + AgoraRtmpStreamingErrorTranscodingNoMixStream = 13, + /** Network error. */ + AgoraRtmpStreamingErrorNetDown = 14, + /** User AppId have not authorized to push stream. */ + AgoraRtmpStreamingErrorInvalidAppId = 15, + /** invalid privilege. */ + AgoraRtmpStreamingErrorInvalidPrivilege = 16, + /** The streaming has been stopped normally. After you call + [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:]) to + stop streaming, the SDK returns this value. + + @since v3.4.5 + */ + AgoraRtmpStreamingErrorCodeUnpublishOK = 100, +}; + +/** Events during the RTMP or RTMPS streaming. */ +typedef NS_ENUM(NSUInteger, AgoraRtmpStreamingEvent) { + /** 1: An error occurs when you add a background image or a watermark image + to the RTMP stream. + */ + AgoraRtmpStreamingEventFailedLoadImage = 1, + /** 2: The streaming URL is already being used for CDN live streaming. If you + want to start new streaming, use a new streaming URL. + + @since v3.4.5 + */ + AgoraRtmpStreamingEventUrlAlreadyInUse = 2, + /** advanced feature not support. */ + AgoraRtmpStreamingEventAdvancedFeatureNotSupport = 3, + /** Client request too frequently. */ + AgoraRtmpStreamingEventRequestTooOften = 4, +}; + +/** + * Encryption error type. + */ +typedef NS_ENUM(NSInteger, AgoraEncryptionErrorType) { +/** + * 0: Internal reason. + */ + ENCRYPTION_ERROR_INTERNAL_FAILURE = 0, +/** + * 1: MediaStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + */ + ENCRYPTION_ERROR_DECRYPTION_FAILURE = 1, +/** + * 2: MediaStream encryption errors. + */ + ENCRYPTION_ERROR_ENCRYPTION_FAILURE = 2, +/** + * 3: DataStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + */ + ENCRYPTION_ERROR_DATASTREAM_DECRYPTION_FAILURE = 3, +/** + * 4: DataStream encryption errors. + */ + ENCRYPTION_ERROR_DATASTREAM_ENCRYPTION_FAILURE = 4, + +}; + +/** + * The camera direction + */ +typedef NS_ENUM(NSUInteger, AgoraCameraDirection) { + /** + * 0: Uses the rear camera. + */ + AgoraCameraDirectionRear = 0, + /** + * 1: Uses the front camera. + */ + AgoraCameraDirectionFront = 1, +}; + +/** The state code in AgoraChannelMediaRelayState. + */ +typedef NS_ENUM(NSInteger, AgoraChannelMediaRelayState) { + /** 0: The SDK is initializing. + */ + AgoraChannelMediaRelayStateIdle = 0, + /** 1: The SDK tries to relay the media stream to the destination channel. + */ + AgoraChannelMediaRelayStateConnecting = 1, + /** 2: The SDK successfully relays the media stream to the destination channel. + */ + AgoraChannelMediaRelayStateRunning = 2, + /** 3: A failure occurs. See the details in `error`. + */ + AgoraChannelMediaRelayStateFailure = 3, +}; + +/** The event code in AgoraChannelMediaRelayEvent. + */ +typedef NS_ENUM(NSInteger, AgoraChannelMediaRelayEvent) { + /** 0: The user disconnects from the server due to poor network connections. + */ + AgoraChannelMediaRelayEventDisconnect = 0, + /** 1: The network reconnects. + */ + AgoraChannelMediaRelayEventConnected = 1, + /** 2: The user joins the source channel. + */ + AgoraChannelMediaRelayEventJoinedSourceChannel = 2, + /** 3: The user joins the destination channel. + */ + AgoraChannelMediaRelayEventJoinedDestinationChannel = 3, + /** 4: The SDK starts relaying the media stream to the destination channel. + */ + AgoraChannelMediaRelayEventSentToDestinationChannel = 4, + /** 5: The server receives the video stream from the source channel. + */ + AgoraChannelMediaRelayEventReceivedVideoPacketFromSource = 5, + /** 6: The server receives the audio stream from the source channel. + */ + AgoraChannelMediaRelayEventReceivedAudioPacketFromSource = 6, + /** 7: The destination channel is updated. + */ + AgoraChannelMediaRelayEventUpdateDestinationChannel = 7, + /** 8: The destination channel update fails due to internal reasons. + */ + AgoraChannelMediaRelayEventUpdateDestinationChannelRefused = 8, + /** 9: The destination channel does not change, which means that the destination channel fails to be updated. + */ + AgoraChannelMediaRelayEventUpdateDestinationChannelNotChange = 9, + /** 10: The destination channel name is NULL. + */ + AgoraChannelMediaRelayEventUpdateDestinationChannelIsNil = 10, + /** 11: The video profile is sent to the server. + */ + AgoraChannelMediaRelayEventVideoProfileUpdate = 11, +}; + +/** The error code in AgoraChannelMediaRelayError. + */ +typedef NS_ENUM(NSInteger, AgoraChannelMediaRelayError) { + /** 0: The state is normal. + */ + AgoraChannelMediaRelayErrorNone = 0, + /** 1: An error occurs in the server response. + */ + AgoraChannelMediaRelayErrorServerErrorResponse = 1, + /** 2: No server response. You can call the [leaveChannel]([AgoraRtcEngineKit leaveChannel:]) method to leave the channel. + */ + AgoraChannelMediaRelayErrorServerNoResponse = 2, + /** 3: The SDK fails to access the service, probably due to limited resources of the server. + */ + AgoraChannelMediaRelayErrorNoResourceAvailable = 3, + /** 4: Fails to send the relay request. + */ + AgoraChannelMediaRelayErrorFailedJoinSourceChannel = 4, + /** 5: Fails to accept the relay request. + */ + AgoraChannelMediaRelayErrorFailedJoinDestinationChannel = 5, + /** 6: The server fails to receive the media stream. + */ + AgoraChannelMediaRelayErrorFailedPacketReceivedFromSource = 6, + /** 7: The server fails to send the media stream. + */ + AgoraChannelMediaRelayErrorFailedPacketSentToDestination = 7, + /** 8: The SDK disconnects from the server due to poor network connections. You can call the [leaveChannel]([AgoraRtcEngineKit leaveChannel:]) method to leave the channel. + */ + AgoraChannelMediaRelayErrorServerConnectionLost = 8, + /** 9: An internal error occurs in the server. + */ + AgoraChannelMediaRelayErrorInternalError = 9, + /** 10: The token of the source channel has expired. + */ + AgoraChannelMediaRelayErrorSourceTokenExpired = 10, + /** 11: The token of the destination channel has expired. + */ + AgoraChannelMediaRelayErrorDestinationTokenExpired = 11, +}; + +/* + * The stream subscribe state. + */ +typedef NS_ENUM (NSInteger, AgoraStreamSubscribeState) { + AgoraStreamSubscribeStateIdle = 0, + AgoraStreamSubscribeStateNoSubscribed = 1, + AgoraStreamSubscribeStateSubscribing = 2, + AgoraStreamSubscribeStateSubscribed = 3 +}; + +/** + * The stream publish state. + */ +typedef NS_ENUM (NSInteger, AgoraStreamPublishState) { + AgoraStreamPublishStateIdle = 0, + AgoraStreamPublishStateNoPublished = 1, + AgoraStreamPublishStatePublishing = 2, + AgoraStreamPublishStatePublished = 3 +}; +/** + * The screen sharing scenario. + * + * @since v4.0.0 + */ +typedef NS_ENUM(NSInteger, AgoraScreenScenarioType) { + /** 1: (Default) Document. This scenario prioritizes the video quality of screen sharing and reduces the latency of the shared video for the receiver. If you share documents, slides, and tables, you can set this scenario. + */ + AgoraScreenScenarioDocument = 1, + /** 2: Game. This scenario prioritizes the smoothness of screen sharing. If you share games, you can set this scenario. + */ + AgoraScreenScenarioGaming = 2, + /** 3: Video. This scenario prioritizes the smoothness of screen sharing. If you share movies or live videos, you can set this scenario. + */ + AgoraScreenScenarioVideo = 3, + /** 4: Remote control. This scenario prioritizes the video quality of screen sharing and reduces the latency of the shared video for the receiver. If you share the device desktop being remotely controlled, you can set this scenario. + */ + AgoraScreenScenarioRDC = 4, +}; +/** + * Media source types definition. + */ +typedef NS_ENUM(NSInteger, AgoraMediaSourceType) { + /** + * 0: The audio playback device. + */ + AgoraMediaSourceTypeAudioPlayout = 0, + /** + * 1: Microphone. + */ + AgoraMediaSourceTypeRecording = 1, + /** + * 2: Video captured by primary camera. + */ + AgoraMediaSourceTypePrimaryCamera = 2, + /** + * 3: Video captured by secondary camera. + */ + AgoraMediaSourceTypeSecondaryCamera = 3, + /** + * 4: Video captured by primary screen capturer. + */ + AgoraMediaSourceTypePrimaryScreen = 4, + /** + * 5: Video captured by secondary screen capturer. + */ + AgoraMediaSourceTypeSecondaryScreen = 5, + /** + * 6: Video captured by custom video source. + */ + AgoraMediaSourceTypeCustomVideo = 6, + /** + * 7: Video for media player sharing. + */ + AgoraMediaSourceTypeMediaPlayer = 7, + /** + * 8: Video for png image. + */ + AgoraMediaSourceTypeRtcImagePng = 8, + /** + * 9: Video for jpeg image. + */ + AgoraMediaSourceTypeRtcImageJpeg = 9, + /** + * 10: Video for gif image. + */ + AgoraMediaSourceTypeRtcImageGif = 10, + /** + * 11: Remote video received from network. + */ + AgoraMediaSourceTypeRemoteVideo = 11, + /** + * 12: Video for transcoded. + */ + AgoraMediaSourceTypeTranscodedVideo = 12, + /** + * 100: unknown media source. + */ + AgoraMediaSourceTypeUnknown = 100 +}; + +/** + * Video source types definition. + */ +typedef NS_ENUM(NSInteger, AgoraVideoSourceType) { + /** Video captured by the camera. + */ + AgoraVideoSourceTypeCamera = 0, + /** Video captured by the secondary camera. + */ + AgoraVideoSourceTypeCameraSecondary = 1, + /** Video for screen sharing. + */ + AgoraVideoSourceTypeScreen = 2, + /** Video for secondary screen sharing. + */ + AgoraVideoSourceTypeScreenSecondary = 3, + /** Video for custom video. + */ + AgoraVideoSourceTypeCustom = 4, + /** Video for media player sharing. + */ + AgoraVideoSourceTypeMediaPlayer = 5, + /** Video for png image. + */ + AgoraVideoSourceTypeImagePNG = 6, + /** Video for JPEG image. + */ + AgoraVideoSourceTypeImageJPEG = 7, + /** Video for GIF image. + */ + AgoraVideoSourceTypeImageGIF = 8, + /** Remote video received from network. + */ + AgoraVideoSourceTypeRemote = 9, + /** Video for transcoded. + */ + AgoraVideoSourceTypeTransCoded = 10, + /** Video captured by the third camera. + */ + AgoraVideoSourceTypeCameraThird = 11, + /** Video captured by the fourth camera. + */ + AgoraVideoSourceTypeCameraFourth = 12, + /** Video for third screen sharing. + */ + AgoraVideoSourceTypeScreenThird = 13, + /** Video for fourth screen sharing. + */ + AgoraVideoSourceTypeScreenFourth = 14, + /** Not define. + */ + AgoraVideoSourceTypeUnknown = 100 +}; + +/** + * The external video source type. + */ +typedef NS_ENUM(NSInteger, AgoraExternalVideoSourceType) { + /** + * 0: non-encoded video frame. + */ + AgoraExternalVideoSourceTypeVideoFrame = 0, + /** + * 1: encoded video frame. + */ + AgoraExternalVideoSourceTypeEncodedVideoFrame, +}; + +/** + * The dual stream mode + */ +typedef NS_ENUM(NSInteger, AgoraSimulcastStreamMode) { + /** -1 : disable simulcast stream until receive request for enable simulcast stream by other broadcaster + */ + AgoraAutoSimulcastStream = -1, + /** 0 : disable simulcast stream + */ + AgoraDisableSimulcastStream = 0, + /** 1 : always enable simulcast stream + */ + AgoraEnableSimulcastStream = 1, +}; + +/** + * AgoraMediaStreamType, reporting the type of the media stream. + */ +typedef NS_ENUM(NSInteger, AgoraMediaStreamType) { + /** `0`: The type is unknown. */ + AgoraMediaStreamTypeUnknown = 0, + /** `1`: The video stream. */ + AgoraMediaStreamTypeVideo = 1, + /** `2`: The audio stream. */ + AgoraMediaStreamTypeAudio = 2, + /** `3`: The subtitle stream. */ + AgoraMediaStreamTypeSubtitle = 3, +}; + +/** + * @brief Player state + * + */ +typedef NS_ENUM(NSInteger, AgoraMediaPlayerState) { + /** Player idle + */ + AgoraMediaPlayerStateIdle = 0, + /** Opening media file + */ + AgoraMediaPlayerStateOpening, + /** Media file opened successfully + */ + AgoraMediaPlayerStateOpenCompleted, + /** Player playing + */ + AgoraMediaPlayerStatePlaying, + /** Player paused + */ + AgoraMediaPlayerStatePaused, + /** Player playback one loop completed + */ + AgoraMediaPlayerStatePlayBackCompleted, + /** Player playback all loops completed + */ + AgoraMediaPlayerStatePlayBackAllLoopsCompleted, + /** Player stopped + */ + AgoraMediaPlayerStateStopped, + /** Player pausing (internal) + */ + AgoraMediaPlayerStatePausingInternal = 50, + /** Player stopping (internal) + */ + AgoraMediaPlayerStateStoppingInternal, + /** Player seeking state (internal) + */ + AgoraMediaPlayerStateSeekingInternal, + /** Player getting state (internal) + */ + AgoraMediaPlayerStateGettingInternal, + /** None state for state machine (internal) + */ + AgoraMediaPlayerStateNoneInternal, + /** Do nothing state for state machine (internal) + */ + AgoraMediaPlayerStateDoNothingInternal, + /** Player set track state (internal) + */ + AgoraMediaPlayerStateSetTrackInternal, + /** Player failed + */ + AgoraMediaPlayerStateFailed = 100, +}; + +/** + * The video display mode. + */ +typedef NS_ENUM(NSUInteger, AgoraMediaPlayerRenderMode) { + /** + * 1: Uniformly scale the video until it fills the visible boundaries + * (cropped). One dimension of the video may have clipped contents. + */ + AgoraMediaPlayerRenderModeHidden = 1, + /** + * 2: Uniformly scale the video until one of its dimension fits the boundary + * (zoomed to fit). Areas that are not filled due to the disparity in the + * aspect ratio will be filled with black. + */ + AgoraMediaPlayerRenderModeFit = 2, +}; + +/** AgoraMediaPlayerError, reporting the player's error code. */ +typedef NS_ENUM(NSInteger, AgoraMediaPlayerError) { + /** `0`: No error. */ + AgoraMediaPlayerErrorNone = 0, + /** `-1`: Invalid arguments. */ + AgoraMediaPlayerErrorInvalidArguments = -1, + /** `-2`: Internal error. */ + AgoraMediaPlayerErrorInternal = -2, + /** `-3`: No resource. */ + AgoraMediaPlayerErrorNoSource = -3, + /** `-4`: Invalid media resource. */ + AgoraMediaPlayerErrorInvalidMediaSource = -4, + /** `-5`: The type of the media stream is unknown. */ + AgoraMediaPlayerErrorUnknowStreamType = -5, + /** `-6`: The object is not initialized. */ + AgoraMediaPlayerErrorObjNotInitialized = -6, + /** `-7`: The codec is not supported. */ + AgoraMediaPlayerErrorCodecNotSupported = -7, + /** `-8`: Invalid renderer. */ + AgoraMediaPlayerErrorVideoRenderFailed = -8, + /** `-9`: Error occurs in the internal state of the player. */ + AgoraMediaPlayerErrorInvalidState = -9, + /** `-10`: The URL of the media resource can not be found. */ + AgoraMediaPlayerErrorUrlNotFound = -10, + /** `-11`: Invalid connection between the player and Agora's Server. */ + AgoraMediaPlayerErrorInvalidConnectState = -11, + /** `-12`: The playback buffer is insufficient. */ + AgoraMediaPlayerErrorSrcBufferUnderflow = -12, + /** `-13`: The audio mixing file playback is interrupted. */ + AgoraMediaPlayerErrorInterrupted = -13, + /** `-14`: The SDK does not support this function.*/ + AgoraMediaPlayerErrorNotSupported = -14, + /** `-15`: The token has expired.*/ + AgoraMediaPlayerErrorTokenExpired = -15, + /** `-16`: The ip has expired.*/ + AgoraMediaPlayerErrorIpExpired = -16, + /** `-17`: An unknown error occurs.*/ + AgoraMediaPlayerErrorUnknown = -17, +}; + +/** AgoraMediaPlayerEvent, reporting the result of the seek operation to the new + playback position. +*/ +typedef NS_ENUM(NSInteger, AgoraMediaPlayerEvent) { + /** `0`: Begins to seek to the new playback position. */ + AgoraMediaPlayerEventSeekBegin = 0, + /** `1`: Finish seeking to the new playback position. */ + AgoraMediaPlayerEventSeekComplete = 1, + /** `2`: Error occurs when seeking to the new playback position. */ + AgoraMediaPlayerEventSeekError = 2, + /** The player changes the audio track for playback. */ + AgoraMediaPlayerEventAudioTrackChanged= 5, + /** player buffer low. */ + AgoraMediaPlayerEventBufferLow = 6, + /** player buffer recover. */ + AgoraMediaPlayerEventBufferRecover = 7, + /** `8`: The video or audio is interrupted. */ + AgoraMediaPlayerEventFreezeStart = 8, + /** `9`: Interrupt at the end of the video or audio. */ + AgoraMediaPlayerEventFreezeStop = 9, + /** switch source begin. */ + AgoraMediaPlayerEventSwitchBegin = 10, + /** switch source complete. */ + AgoraMediaPlayerEventSwitchComplete = 11, + /** switch source error. */ + AgoraMediaPlayerEventSwitchError = 12, + /** An application can render the video to less than a second. */ + AgoraMediaPlayerEventFirstDisplayed = 13, + /** cache resources exceed the maximum number */ + AgoraMediaPlayerEventReachCacheFileMaxCount = 14, + /** cache resources exceed the maximum file size */ + AgoraMediaPlayerEventReachCacheFileMaxSize = 15, + /** Triggered when a retry is required to open the media*/ + AgoraMediaPlayerEventTryOpenStart = 16, + /** Triggered when the retry to open the media is successful*/ + AgoraMediaPlayerEventTryOpenSucceed = 17, + /** Triggered when retrying to open media fails*/ + AgoraMediaPlayerEventTryOpenFailed = 18, +}; + +/** + * @brief The play preload another source event. + */ +typedef NS_ENUM(NSUInteger, AgoraMediaPlayerPreloadEvent) { + /** preload source begin. */ + AgoraMediaPlayerPreloadEventBegin = 0, + /** preload source complete. */ + AgoraMediaPlayerPreloadEventComplete = 1, + /** preload source error. */ + AgoraMediaPlayerPreloadEventError = 2, +}; + +/** + * AgoraMediaPlayerMetaDataType, reporting the type of the media metadata. + */ +typedef NS_ENUM(NSUInteger, AgoraMediaPlayerMetaDataType) { + /** `0`: The type is unknown. */ + AgoraMediaPlayerMetaDataTypeUnknown = 0, + /** `1`: The type is SEI. */ + AgoraMediaPlayerMetaDataTypeSEI = 1, +}; + +/** Type of permission. + */ +typedef NS_ENUM(NSInteger, AgoraPermissionType) { + /** 0: Permission, Record Audio + */ + AgoraPermissionTypeRecordAudio = 0, + /** 1:Permission, Camera + */ + AgoraPermissionTypeCamera = 1, +}; + +/** + * @brief Streaming state + * + */ +typedef NS_ENUM(NSInteger, AgoraDirectCdnStreamingState) { + /** State idle. */ + AgoraDirectCdnStreamingStateIdle = 0, + /** Start pushing the stream. */ + AgoraDirectCdnStreamingStateRunning = 1, + /** Stop push stream. */ + AgoraDirectCdnStreamingStateStopped = 2, + /** Failed to push the stream.*/ + AgoraDirectCdnStreamingStateFailed = 3, + /** Retrying to push stream */ + AgoraDirectCdnStreamingStateRecovering = 4, +}; + +/** + */ +typedef NS_ENUM(NSInteger, AgoraDirectCdnStreamingError) { +// No error occurs. + AgoraDirectCdnStreamingErrorOK = 0, +// A general error occurs (no specified reason). + AgoraDirectCdnStreamingErrorFailed = 1, +// Audio publication error. + AgoraDirectCdnStreamingErrorAudioPublication = 2, +// Video publication error. + AgoraDirectCdnStreamingErrorVideoPublication = 3, +// Network connect error. + AgoraDirectCdnStreamingErrorNetConnect = 4, +// Already exist stream name. + AgoraDirectCdnStreamingErrorBadName = 5, +}; + +/** Type of ear monitoring. + */ +typedef NS_OPTIONS(NSInteger, AgoraEarMonitoringFilterType) { + /** + * 1: Do not add an audio filter to the in-ear monitor. + */ + AgoraEarMonitoringFilterNone = (1<<0), + /** + * 2: Add an audio filter to the in-ear monitor. + */ + AgoraEarMonitoringFilterBuiltInAudioFilters = (1<<1), + /** + * 4: Enable noise suppression to the in-ear monitor. + */ + AgoraEarMonitoringFilterNoiseSuppression = (1<<2), + /** + * 6: Enable both audio fileter and noise suppression to the in-ear monitor. + */ + AgoraEarMonitoringFilterBuiltInAudioFiltersWithNoiseSuppression = (1<<1) | (1<<2) +}; + +/** The bit mask that controls the audio observation positions. + */ +typedef NS_OPTIONS(NSUInteger, AgoraAudioFramePosition) { + /** The position for observing the playback audio of all remote users after + mixing, which enables the SDK to trigger the + [onPlaybackAudioFrame]([AgoraAudioFrameDelegate onPlaybackAudioFrame:]) + callback. + */ + AgoraAudioFramePositionPlayback = 1 << 0, + /** The position for observing the recorded audio of the local user, which + enables the SDK to trigger the + [onRecordAudioFrame]([AgoraAudioFrameDelegate onRecordAudioFrame:]) + callback. + */ + AgoraAudioFramePositionRecord = 1 << 1, + /** The position for observing the mixed audio of the local user and all + remote users, which enables the SDK to trigger the + [onMixedAudioFrame]([AgoraAudioFrameDelegate onMixedAudioFrame:]) + callback. + */ + AgoraAudioFramePositionMixed = 1 << 2, + /** The position for observing the audio of a single remote user before + mixing, which enables the SDK to trigger the + [onPlaybackAudioFrameBeforeMixing]([AgoraAudioFrameDelegate onPlaybackAudioFrameBeforeMixing:uid:]) + callback. + */ + AgoraAudioFramePositionBeforeMixing = 1 << 3, + /** The position for observing the ear monitoring audio of the local user + [onEarMonitoringAudioFrame]([AgoraAudioFrameDelegate onEarMonitoringAudioFrame:]) callback. + */ + AgoraAudioFramePositionEarMonitoring = 1 << 4, + /** The position for observing the before-publishing audio of the local user + [onPublishAudioFrame]([AgoraAudioFrameDelegate onPublishAudioFrame:]) callback. + */ + AgoraAudioFramePositionPublish = 1 << 5, +}; + +/** The content hint for screen sharing. */ +typedef NS_ENUM(NSUInteger, AgoraVideoContentHint) { + /** 0: (Default) No content hint. */ + AgoraVideoContentHintNone = 0, + /** 1: Motion-intensive content. Choose this option if you prefer smoothness or when you are sharing a video clip, movie, or video game. */ + AgoraVideoContentHintMotion = 1, + /** 2: Motionless content. Choose this option if you prefer sharpness or when you are sharing a picture, PowerPoint slide, or text. */ + AgoraVideoContentHintDetails = 2, +}; + +/** Thread priority type. + */ +typedef NS_ENUM(NSInteger, AgoraThreadPriorityType) { + /** + * 0: Lowest priority. + */ + AgoraThreadPriorityTypeLowest = 0, + /** + * 1: Low priority. + */ + AgoraThreadPriorityTypeLow = 1, + /** + * 2: Normal priority. + */ + AgoraThreadPriorityTypeNormal = 2, + /** + * 3: High priority. + */ + AgoraThreadPriorityTypeHigh = 3, + /** + * 4. Highest priority. + */ + AgoraThreadPriorityTypeHighest = 4, + /** + * 5. Critical priority. + */ + AgoraThreadPriorityTypeCritical = 5, +}; + +typedef NS_ENUM(NSUInteger, AgoraContentInspectType) { + /** default type is invalid */ + AgoraContentInspectTypeInvalid = 0, + /** + * @deprecated + * content inspect type moderation + */ + AgoraContentInspectTypeModeration __deprecated = 1, + /** content inspect type supervise */ + AgoraContentInspectTypeSupervise = 2, + /** content inspect type image moderation */ + AgoraContentInspectTypeImageModeration = 3, +}; + +typedef NS_ENUM(NSUInteger, AgoraContentInspectResult) { + AgoraContentInspectNeutral = 1, + // background image does not exist + AgoraContentInspectSexy = 2, + // color format is not supported + AgoraContentInspectPorn = 3, +}; + +/** The audio dual-mono output mode. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioDualMonoMode) { + /**< ChanLOut=ChanLin, ChanRout=ChanRin */ + AgoraAudioDualMonoStereo, + /**< ChanLOut=ChanRout=ChanLin */ + AgoraAudioDualMonoL, + /**< ChanLOut=ChanRout=ChanRin */ + AgoraAudioDualMonoR, + /**< ChanLout=ChanRout=(ChanLin+ChanRin)/2 */ + AgoraAudioDualMonoMix +}; + +/** The audio mixing dual-mono output mode. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioMixingDualMonoMode) { + /* 0: Original mode */ + AgoraAudioMixingDualMonoAuto = 0, + /* 1: Left channel mode */ + AgoraAudioMixingDualMonoL = 1, + /* 2: Right channel mode */ + AgoraAudioMixingDualMonoR = 2, + /* 3: Mixed channel mode */ + AgoraAudioMixingDualMonoMix = 3, +}; + +/** + The states of the rhythm player. + */ +typedef NS_ENUM(NSInteger, AgoraRhythmPlayerState) { + /** 810: The rhythm player is idle. */ + AgoraRhythmPlayerStateIdle = 810, + /** 811: The rhythm player is opening files. */ + AgoraRhythmPlayerStateOpening, + /** 812: 812: Files opened successfully, the rhythm player starts decoding files. */ + AgoraRhythmPlayerStateDecoding, + /** 813: Files decoded successfully, the rhythm player starts mixing the two files and playing back them locally. */ + AgoraRhythmPlayerStatePlaying, + /** 814: The rhythm player is starting to fail, and you need to check the error code for detailed failure reasons. */ + AgoraRhythmPlayerStateFailed, +}; + +/** + The error codes of the rhythm player. + */ +typedef NS_ENUM(NSInteger, AgoraRhythmPlayerError) { + /** 0: The rhythm player works well. */ + AgoraRhythmPlayerErrorOK = 0, + /** 1: The rhythm player occurs a internal error. */ + AgoraRhythmPlayerErrorFailed = 1, + /** 801: The rhythm player can not open the file. */ + AgoraRhythmPlayerErrorCanNotOpen = 801, + /** 802: The rhythm player can not play the file. */ + AgoraRhythmPlayerErrorCanNotPlay, + /** 803: The file duration over the limit. The file duration limit is 1.2 seconds. */ + AgoraRhythmPlayerErrorFileOverDurationLimit, +}; + +/** + The error codes of the local video transcoder. + */ +typedef NS_ENUM(NSInteger, AgoraVideoTranscoderError) { + /** + * No error + */ + AgoraVideoTranscoderErrorOK = 0, + /** + * Occurs when video track not started of video source. + */ + AgoraVideoTranscoderErrorVideoSourceNotReady = 1, + /** + * Occurs when source type not on support list. + */ + AgoraVideoTranscoderErrorInvalidVideoSourceType = 2, + /** + * Occurs when image url is not correctly of image source. + */ + AgoraVideoTranscoderErrorInvalidImagePath = 3, + /** + * Occurs when image format not the type png/jpeg/gif of image source. + */ + AgoraVideoTranscoderErrorUnsupportImageFormat = 4, + /** + * Occurs when layout is invalid such as width is zero. + */ + AgoraVideoTranscoderErrorInvalidLayout = 5, + /** + * Internal error. + */ + AgoraVideoTranscoderErrorInternal = 20 +}; + +typedef NS_ENUM(NSUInteger, AgoraLocalProxyMode) { + /** Connect local proxy with high priority, if not connected to local proxy, fallback to sdrtn. + */ + AgoraConnectivityFirst = 0, + /** Only connect local proxy. + */ + AgoraLocalOnly = 1, +} NS_SWIFT_NAME(AgoraLocalProxyMode); + +/** The proxy type. + */ +typedef NS_ENUM(NSUInteger, AgoraProxyType) { + /** Not connected cloud proxy or local proxy. + */ + AgoraNoneProxyType = 0, + /** The cloud proxy for the UDP protocol. + */ + AgoraUdpProxyType = 1, + /** The cloud proxy for the TCP (encrypted) protocol. + */ + AgoraTcpProxyType = 2, + /** The local proxy + */ + AgoraLocalProxyType = 3, + /** The cloud proxy, auto fallback. + */ + AgoraTcpProxyAutoFallbackType = 4, +} NS_SWIFT_NAME(AgoraProxyType); + + +/** mode of setting view. + */ +typedef NS_ENUM(NSInteger, AgoraVideoViewSetupMode) { + AgoraVideoViewSetupReplace = 0, + AgoraVideoViewSetupAdd = 1, + AgoraVideoViewSetupRemove = 2, +}; + +typedef NS_ENUM(NSInteger, AgoraAudioProcessChannels) { + AgoraAudioProcessChannelsMono = 1, + AgoraAudioProcessChannelstereo = 2, +}; + +/** + * The frame position of the video observer. + */ +typedef NS_OPTIONS(NSUInteger, AgoraVideoFramePosition) { + /** 1: The post-capturer position, which corresponds to the video data in the onCaptureVideoFrame callback. + */ + AgoraVideoFramePositionPostCapture = 1 << 0, + /** 2: The pre-renderer position, which corresponds to the video data in the onRenderVideoFrame callback. + */ + AgoraVideoFramePositionPreRenderer = 1 << 1, + /** 4: The pre-encoder position, which corresponds to the video data in the onPreEncodeVideoFrame callback. + */ + AgoraVideoFramePositionPreEncoder = 1 << 2, +}; + +/** + * The reason of notifying the user of a message. + */ +typedef NS_ENUM(NSUInteger, AgoraWlAccReason) { + /** + * WIFI signal is weak. + */ + AgoraWlAccMessageReasonWeakSignal = 0, + /** + * Channel congestion. + */ + AgoraWlAccMessageReasonChannelCongestion = 1, +}; + +/** + * Suggest an action for the user. + */ +typedef NS_ENUM(NSUInteger, AgoraWlAccAction) { + /** + * Please get close to AP. + */ + AgoraWlAccSuggestActionCloseToWIFI = 0, + /** + * The user is advised to connect to the prompted SSID. + */ + AgoraWlAccSuggestActionConnectSSID = 1, + /** + * The user is advised to check whether the AP supports 5G band and enable 5G band (the aciton link is attached), or purchases an AP that supports 5G. AP does not support 5G band. + */ + AgoraWlAccSuggestActionCheck5G = 2, + /** + * The user is advised to change the SSID of the 2.4G or 5G band (the aciton link is attached). The SSID of the 2.4G band AP is the same as that of the 5G band. + */ + AgoraWlAccSuggestActionModifySSID = 3, +}; + +/** The state of agora media recorder. */ +typedef NS_ENUM(NSInteger, AgoraMediaRecorderState) { + /** -1: Media recorder is in wrong state. */ + AgoraMediaRecorderStateError = -1, + /** 2: Media recorder is started. */ + AgoraMediaRecorderStateStarted = 2, + /** 3: Media recorder is stopped. */ + AgoraMediaRecorderStateStopped = 3, +}; +/** Recorder error code. */ +typedef NS_ENUM(NSInteger, AgoraMediaRecorderErrorCode) { + /** 0: No error occurs. */ + AgoraMediaRecorderErrorCodeNoError = 0, + /** 1: Store media data into local file failed. */ + AgoraMediaRecorderErrorCodeWriteFailed = 1, + /** 2: Occurs when there is no media stream. */ + AgoraMediaRecorderErrorCodeNoStream = 2, + /** 3: Occurs when duration of media stream is already over maxmium stream duration. */ + AgoraMediaRecorderErrorCodeOverMaxDuration = 3, + /** 4: Occurs when recording configuration changes. */ + AgoraMediaRecorderErrorCodeConfigChange = 4, +}; +/** Recorder stream type. */ +typedef NS_ENUM(NSInteger, AgoraMediaRecorderStreamType) { + /** 1: Record audio only. */ + AgoraMediaRecorderStreamTypeAudio = 1, + /** 2: Record video only. */ + AgoraMediaRecorderStreamTypeVideo = 2, + /** 3: Record both audio and video. */ + AgoraMediaRecorderStreamTypeBoth = 3, +}; +/** Recorder container format. */ +typedef NS_ENUM(NSInteger, AgoraMediaRecorderContainerFormat) { + /** 1: Format of mp4. */ + AgoraMediaRecorderContainerFormatMP4 = 1, +}; + +/** +The type of the shared target. +*/ + +typedef NS_ENUM(NSInteger, AgoraScreenCaptureSourceType) { + /** -1: Unknown type. */ + AgoraScreenCaptureSourceTypeUnknown = -1, + /** 0: The shared target is a window. */ + AgoraScreenCaptureSourceTypeWindow = 0, + /** 1: The shared target is a screen of a particular monitor. */ + AgoraScreenCaptureSourceTypeScreen = 1, + /** 2: Reserved parameter. */ + AgoraScreenCaptureSourceTypeCustom = 2, +}; + +typedef NS_ENUM(NSInteger, AgoraScreenCaptureFrameRateCapability) { + AgoraScreenCaptureFrameRateUnKonw = -1, + AgoraScreenCaptureFrameRate15FPS = 0, + AgoraScreenCaptureFrameRate30FPS = 1, + AgoraScreenCaptureFrameRate60FPS = 2, +}; + +/** + * The tracing event of media rendering. + */ +typedef NS_ENUM(NSInteger, AgoraMediaTraceEvent) { + /** + * 0: The media frame has been rendered. + */ + AgoraMediaTraceEventVideoRendered = 0, + /** + * 1: The media frame has been decoded. + */ + AgoraMediaTraceEventVideoDecoded = 1, +}; + +typedef NS_ENUM(NSUInteger, AgoraFeatureType) { + AgoraVideoPreprocessVirtualBackground = 1, + AgoraVideoPreprocessBeauty = 2, +}; + +typedef NS_ENUM(NSInteger, AgoraAudioTrackType) { + /** + * 0: Mixable audio track + * You can push more than one mixable Audio tracks into one RTC connection(channel id + uid), + * and SDK will mix these tracks into one audio track automatically. + * However, compare to direct audio track, mixable track might cause extra 30ms+ delay. + */ + AgoraAudioTrackTypeMixable = 0, + /** + * 1: Direct audio track + * You can only push one direct (non-mixable) audio track into one RTC connection(channel id + uid). + * Compare to mixable stream, you can have lower lantency using direct audio track. + */ + AgoraAudioTrackTypeDirect = 1, +}; diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraExtensionProviderEntry.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraExtensionProviderEntry.h new file mode 100644 index 0000000..66c43e7 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraExtensionProviderEntry.h @@ -0,0 +1,49 @@ +// +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "NGIAgoraExtensionControl.h" +AGORA_API agora::rtc::IExtensionControl* AGORA_CALL getAgoraExtensionControl(); +AGORA_API void AGORA_CALL declareProviderVersion( + const char*, const agora::rtc::ExtensionVersion&); +typedef void(*agora_ext_entry_func_t)(void); +AGORA_API void AGORA_CALL registerProviderEntry(const char*, agora_ext_entry_func_t); + +#define DECLARE_CREATE_AND_REGISTER_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, ...) \ +static void register_##PROVIDER_NAME##_to_agora() { \ + auto control = getAgoraExtensionControl(); \ + agora::rtc::ExtensionVersion version = \ + agora::rtc::ExtensionInterfaceVersion::Version(); \ + declareProviderVersion(#PROVIDER_NAME, version); \ + if (#PROVIDER_NAME && control) { \ + control->registerProvider(#PROVIDER_NAME, \ + new agora::RefCountedObject(__VA_ARGS__)); \ + } \ +} \ + +#if defined (__GNUC__) +#define REGISTER_AGORA_EXTENSION_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, ...) \ +DECLARE_CREATE_AND_REGISTER_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, __VA_ARGS__); \ +__attribute__((constructor, used)) \ +static void _##PROVIDER_NAME##_provider_entry() { \ + registerProviderEntry(#PROVIDER_NAME, register_##PROVIDER_NAME##_to_agora); \ +} \ + +#elif defined (_MSC_VER) +#define REGISTER_AGORA_EXTENSION_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, ...) \ +DECLARE_CREATE_AND_REGISTER_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, __VA_ARGS__); \ +static int _##PROVIDER_NAME##_provider_entry() { \ + registerProviderEntry(#PROVIDER_NAME, register_##PROVIDER_NAME##_to_agora); \ + return 0; \ +} \ +const int DUMMY_AGORA_REGEXT_##PROVIDE_NAME##_VAR = _##PROVIDER_NAME##_provider_entry(); \ + +#else +#error Unsupported Compilation Toolchain! +#endif diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraExtensionVersion.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraExtensionVersion.h new file mode 100644 index 0000000..da4d563 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraExtensionVersion.h @@ -0,0 +1,111 @@ +// +// Copyright (c) 2021 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once + +namespace agora { +namespace rtc { + +struct ExtensionVersion { + // Extension Framework Version : major.minor.micro + int major_v; + int minor_v; + int micro_v; + + ExtensionVersion() + : major_v(0), minor_v(0), micro_v(0) {} + ExtensionVersion(int majorV, int minorV = 0, int microV = 0) + : major_v(majorV), minor_v(minorV), micro_v(microV) {} + + bool operator==(const ExtensionVersion& other) const { + return major_v == other.major_v && minor_v == other.minor_v && micro_v == other.micro_v; + } + + bool operator>(const ExtensionVersion& other) const { + return major_v > other.major_v || (major_v == other.major_v && minor_v > other.minor_v) + || (major_v == other.major_v && minor_v == other.minor_v && micro_v > other.micro_v); + } + + bool operator<(const ExtensionVersion& other) const { + return major_v < other.major_v || (major_v == other.major_v && minor_v < other.minor_v) + || (major_v == other.major_v && minor_v == other.minor_v && micro_v < other.micro_v); + } + + bool operator<=(const ExtensionVersion& other) const { + return !operator>(other); + } + + bool operator>=(const ExtensionVersion& other) const { + return !operator<(other); + } +}; + +#define BUMP_MAJOR_VERSION(VERSION) \ + ExtensionVersion(VERSION.major_v + 1, 0, 0); \ + +#define BUMP_MINOR_VERSION(VERSION) \ + ExtensionVersion(VERSION.major_v, VERSION.minor_v + 1, 0); \ + +#define BUMP_MICRO_VERSION(VERSION) \ + ExtensionVersion(VERSION.major_v, VERSION.minor_v, VERSION.micro_v + 1); \ + +class IExtensionProvider; +class IExtensionProviderV2; +class IExtensionProviderV3; +class IAudioFilter; +class IAudioFilterV2; +class IExtensionVideoFilter; +class IScreenCaptureSource; + +template +struct ExtensionInterfaceVersion; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return ExtensionVersion(1, 0, 0); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion::Version()); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return ExtensionVersion(1, 0, 0); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion::Version()); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return ExtensionVersion(1, 0, 0); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return ExtensionVersion(1, 0, 0); + } +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaBase.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaBase.h new file mode 100644 index 0000000..a1e24bd --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaBase.h @@ -0,0 +1,1662 @@ +// +// Agora Engine SDK +// +// Created by Sting Feng in 2017-11. +// Copyright (c) 2017 Agora.io. All rights reserved. + +#pragma once // NOLINT(build/header_guard) + +#include +#include +#include +#include + +#ifndef OPTIONAL_ENUM_SIZE_T +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_SIZE_T enum : size_t +#else +#define OPTIONAL_ENUM_SIZE_T enum +#endif +#endif + +#if !defined(__APPLE__) +#define __deprecated +#endif + +namespace agora { +namespace rtc { + +typedef unsigned int uid_t; +typedef unsigned int track_id_t; +typedef unsigned int conn_id_t; +typedef unsigned int video_track_id_t; + +static const unsigned int INVALID_TRACK_ID = 0xffffffff; +static const unsigned int DEFAULT_CONNECTION_ID = 0; +static const unsigned int DUMMY_CONNECTION_ID = (std::numeric_limits::max)(); + + +struct EncodedVideoFrameInfo; + +struct ExtensionContext { + /** Whether uid is valid. + */ + bool isValid; + /** Default 0 when "isValid" is false + * Local user is 0 and remote user great than 0 when "isValid" is true + */ + uid_t uid; + /** current extension's provider name + */ + const char *providerName; + /** current extension's name + */ + const char *extensionName; + ExtensionContext():isValid(false), uid(0), providerName(NULL), extensionName(NULL) {} +}; + + +/** +* Video source types definition. +**/ +enum VIDEO_SOURCE_TYPE { + /** Video captured by the camera. + */ + VIDEO_SOURCE_CAMERA_PRIMARY = 0, + VIDEO_SOURCE_CAMERA = VIDEO_SOURCE_CAMERA_PRIMARY, + /** Video captured by the secondary camera. + */ + VIDEO_SOURCE_CAMERA_SECONDARY = 1, + /** Video for screen sharing. + */ + VIDEO_SOURCE_SCREEN_PRIMARY = 2, + VIDEO_SOURCE_SCREEN = VIDEO_SOURCE_SCREEN_PRIMARY, + /** Video for secondary screen sharing. + */ + VIDEO_SOURCE_SCREEN_SECONDARY = 3, + /** Not define. + */ + VIDEO_SOURCE_CUSTOM = 4, + /** Video for media player sharing. + */ + VIDEO_SOURCE_MEDIA_PLAYER = 5, + /** Video for png image. + */ + VIDEO_SOURCE_RTC_IMAGE_PNG = 6, + /** Video for png image. + */ + VIDEO_SOURCE_RTC_IMAGE_JPEG = 7, + /** Video for png image. + */ + VIDEO_SOURCE_RTC_IMAGE_GIF = 8, + /** Remote video received from network. + */ + VIDEO_SOURCE_REMOTE = 9, + /** Video for transcoded. + */ + VIDEO_SOURCE_TRANSCODED = 10, + + /** Video captured by the third camera. + */ + VIDEO_SOURCE_CAMERA_THIRD = 11, + /** Video captured by the fourth camera. + */ + VIDEO_SOURCE_CAMERA_FOURTH = 12, + /** Video for third screen sharing. + */ + VIDEO_SOURCE_SCREEN_THIRD = 13, + /** Video for fourth screen sharing. + */ + VIDEO_SOURCE_SCREEN_FOURTH = 14, + + VIDEO_SOURCE_UNKNOWN = 100 +}; + +/** + * Audio routes. + */ +enum AudioRoute +{ + /** + * -1: The default audio route. + */ + ROUTE_DEFAULT = -1, + /** + * The headset. + */ + ROUTE_HEADSET = 0, + /** + * The earpiece. + */ + ROUTE_EARPIECE = 1, + /** + * The headset with no microphone. + */ + ROUTE_HEADSETNOMIC = 2, + /** + * The speakerphone. + */ + ROUTE_SPEAKERPHONE = 3, + /** + * The loudspeaker. + */ + ROUTE_LOUDSPEAKER = 4, + /** + * The Bluetooth headset. + */ + ROUTE_HEADSETBLUETOOTH = 5, + /** + * The USB + */ + ROUTE_USB = 6, + /** + * The HDMI + */ + ROUTE_HDMI = 7, + /** + * The DISPLAYPORT + */ + ROUTE_DISPLAYPORT = 8, + /** + * The AIRPLAY + */ + ROUTE_AIRPLAY = 9, + /** + * The BLUETOOTH Speaker via a2dp + */ + ROUTE_BLUETOOTH_SPEAKER = 10, +}; + +/** + * Bytes per sample + */ +enum BYTES_PER_SAMPLE { + /** + * two bytes per sample + */ + TWO_BYTES_PER_SAMPLE = 2, +}; + +struct AudioParameters { + int sample_rate; + size_t channels; + size_t frames_per_buffer; + + AudioParameters() + : sample_rate(0), + channels(0), + frames_per_buffer(0) {} +}; + +/** + * The use mode of the audio data. + */ +enum RAW_AUDIO_FRAME_OP_MODE_TYPE { + /** 0: Read-only mode: Users only read the data from `AudioFrame` without modifying anything. + * For example, when users acquire the data with the Agora SDK, then start the media push. + */ + RAW_AUDIO_FRAME_OP_MODE_READ_ONLY = 0, + + /** 2: Read and write mode: Users read the data from `AudioFrame`, modify it, and then play it. + * For example, when users have their own audio-effect processing module and perform some voice pre-processing, such as a voice change. + */ + RAW_AUDIO_FRAME_OP_MODE_READ_WRITE = 2, +}; + +} // namespace rtc + +namespace media { + /** + * The type of media device. + */ +enum MEDIA_SOURCE_TYPE { + /** + * 0: The audio playback device. + */ + AUDIO_PLAYOUT_SOURCE = 0, + /** + * 1: Microphone. + */ + AUDIO_RECORDING_SOURCE = 1, + /** + * 2: Video captured by primary camera. + */ + PRIMARY_CAMERA_SOURCE = 2, + /** + * 3: Video captured by secondary camera. + */ + SECONDARY_CAMERA_SOURCE = 3, + /** + * 4: Video captured by primary screen capturer. + */ + PRIMARY_SCREEN_SOURCE = 4, + /** + * 5: Video captured by secondary screen capturer. + */ + SECONDARY_SCREEN_SOURCE = 5, + /** + * 6: Video captured by custom video source. + */ + CUSTOM_VIDEO_SOURCE = 6, + /** + * 7: Video for media player sharing. + */ + MEDIA_PLAYER_SOURCE = 7, + /** + * 8: Video for png image. + */ + RTC_IMAGE_PNG_SOURCE = 8, + /** + * 9: Video for jpeg image. + */ + RTC_IMAGE_JPEG_SOURCE = 9, + /** + * 10: Video for gif image. + */ + RTC_IMAGE_GIF_SOURCE = 10, + /** + * 11: Remote video received from network. + */ + REMOTE_VIDEO_SOURCE = 11, + /** + * 12: Video for transcoded. + */ + TRANSCODED_VIDEO_SOURCE = 12, + /** + * 100: Internal Usage only. + */ + UNKNOWN_MEDIA_SOURCE = 100 +}; +/** Definition of contentinspect + */ +#define MAX_CONTENT_INSPECT_MODULE_COUNT 32 +enum CONTENT_INSPECT_RESULT { + CONTENT_INSPECT_NEUTRAL = 1, + CONTENT_INSPECT_SEXY = 2, + CONTENT_INSPECT_PORN = 3, +}; + +enum CONTENT_INSPECT_TYPE { +/** + * (Default) content inspect type invalid + */ +CONTENT_INSPECT_INVALID = 0, +/** + * @deprecated + * Content inspect type moderation + */ +CONTENT_INSPECT_MODERATION __deprecated = 1, +/** + * Content inspect type supervise + */ +CONTENT_INSPECT_SUPERVISION = 2, +/** + * Content inspect type image moderation + */ +CONTENT_INSPECT_IMAGE_MODERATION = 3 +}; + +struct ContentInspectModule { + /** + * The content inspect module type. + */ + CONTENT_INSPECT_TYPE type; + /**The content inspect frequency, default is 0 second. + * the frequency <= 0 is invalid. + */ + unsigned int interval; + ContentInspectModule() { + type = CONTENT_INSPECT_INVALID; + interval = 0; + } +}; +/** Definition of ContentInspectConfig. + */ +struct ContentInspectConfig { + const char* extraInfo; + + /**The content inspect modules, max length of modules is 32. + * the content(snapshot of send video stream, image) can be used to max of 32 types functions. + */ + ContentInspectModule modules[MAX_CONTENT_INSPECT_MODULE_COUNT]; + /**The content inspect module count. + */ + int moduleCount; + ContentInspectConfig& operator=(const ContentInspectConfig& rth) + { + extraInfo = rth.extraInfo; + moduleCount = rth.moduleCount; + memcpy(&modules, &rth.modules, MAX_CONTENT_INSPECT_MODULE_COUNT * sizeof(ContentInspectModule)); + return *this; + } + ContentInspectConfig() :extraInfo(NULL), moduleCount(0){} +}; + +namespace base { + +typedef void* view_t; + +typedef const char* user_id_t; + +static const uint8_t kMaxCodecNameLength = 50; + +/** + * The definition of the PacketOptions struct, which contains infomation of the packet + * in the RTP (Real-time Transport Protocal) header. + */ +struct PacketOptions { + /** + * The timestamp of the packet. + */ + uint32_t timestamp; + // Audio level indication. + uint8_t audioLevelIndication; + PacketOptions() + : timestamp(0), + audioLevelIndication(127) {} +}; + +/** + * The detailed information of the incoming audio encoded frame. + */ + +struct AudioEncodedFrameInfo { + /** + * The send time of the packet. + */ + uint64_t sendTs; + /** + * The codec of the packet. + */ + uint8_t codec; + AudioEncodedFrameInfo() + : sendTs(0), + codec(0) {} +}; + +/** + * The detailed information of the incoming audio frame in the PCM format. + */ +struct AudioPcmFrame { + /** + * The buffer size of the PCM audio frame. + */ + OPTIONAL_ENUM_SIZE_T { + // Stereo, 32 kHz, 60 ms (2 * 32 * 60) + /** + * The max number of the samples of the data. + * + * When the number of audio channel is two, the sample rate is 32 kHZ, + * the buffer length of the data is 60 ms, the number of the samples of the data is 3840 (2 x 32 x 60). + */ + kMaxDataSizeSamples = 3840, + /** The max number of the bytes of the data. */ + kMaxDataSizeBytes = kMaxDataSizeSamples * sizeof(int16_t), + }; + + /** The timestamp (ms) of the audio frame. + */ + int64_t capture_timestamp; + /** The number of samples per channel. + */ + size_t samples_per_channel_; + /** The sample rate (Hz) of the audio data. + */ + int sample_rate_hz_; + /** The channel number. + */ + size_t num_channels_; + /** The number of bytes per sample. + */ + rtc::BYTES_PER_SAMPLE bytes_per_sample; + /** The audio frame data. */ + int16_t data_[kMaxDataSizeSamples]; + + AudioPcmFrame& operator=(const AudioPcmFrame& src) { + if(this == &src) { + return *this; + } + + this->capture_timestamp = src.capture_timestamp; + this->samples_per_channel_ = src.samples_per_channel_; + this->sample_rate_hz_ = src.sample_rate_hz_; + this->bytes_per_sample = src.bytes_per_sample; + this->num_channels_ = src.num_channels_; + + size_t length = src.samples_per_channel_ * src.num_channels_; + if (length > kMaxDataSizeSamples) { + length = kMaxDataSizeSamples; + } + + memcpy(this->data_, src.data_, length * sizeof(int16_t)); + + return *this; + } + + AudioPcmFrame() + : capture_timestamp(0), + samples_per_channel_(0), + sample_rate_hz_(0), + num_channels_(0), + bytes_per_sample(rtc::TWO_BYTES_PER_SAMPLE) { + memset(data_, 0, sizeof(data_)); + } + + AudioPcmFrame(const AudioPcmFrame& src) + : capture_timestamp(src.capture_timestamp), + samples_per_channel_(src.samples_per_channel_), + sample_rate_hz_(src.sample_rate_hz_), + num_channels_(src.num_channels_), + bytes_per_sample(src.bytes_per_sample) { + size_t length = src.samples_per_channel_ * src.num_channels_; + if (length > kMaxDataSizeSamples) { + length = kMaxDataSizeSamples; + } + + memcpy(this->data_, src.data_, length * sizeof(int16_t)); + } +}; + +/** Audio dual-mono output mode + */ +enum AUDIO_DUAL_MONO_MODE { + /**< ChanLOut=ChanLin, ChanRout=ChanRin */ + AUDIO_DUAL_MONO_STEREO = 0, + /**< ChanLOut=ChanRout=ChanLin */ + AUDIO_DUAL_MONO_L = 1, + /**< ChanLOut=ChanRout=ChanRin */ + AUDIO_DUAL_MONO_R = 2, + /**< ChanLout=ChanRout=(ChanLin+ChanRin)/2 */ + AUDIO_DUAL_MONO_MIX = 3 +}; +/** + * The audio frame observer. + */ +class IAudioFrameObserver { + public: + /** + * Occurs when each time the player receives an audio frame. + * + * After registering the audio frame observer, + * the callback occurs when each time the player receives an audio frame, + * reporting the detailed information of the audio frame. + * @param frame The detailed information of the audio frame. See {@link AudioPcmFrame}. + */ + virtual void onFrame(AudioPcmFrame* frame) = 0; + virtual ~IAudioFrameObserver() {} +}; + +/** + * Video pixel formats. + */ +enum VIDEO_PIXEL_FORMAT { + /** + * 0: Default format. + */ + VIDEO_PIXEL_DEFAULT = 0, + /** + * 1: I420. + */ + VIDEO_PIXEL_I420 = 1, + /** + * 2: BGRA. + */ + VIDEO_PIXEL_BGRA = 2, + /** + * 3: NV21. + */ + VIDEO_PIXEL_NV21 = 3, + /** + * 4: RGBA. + */ + VIDEO_PIXEL_RGBA = 4, + /** + * 8: NV12. + */ + VIDEO_PIXEL_NV12 = 8, + /** + * 10: GL_TEXTURE_2D + */ + VIDEO_TEXTURE_2D = 10, + /** + * 11: GL_TEXTURE_OES + */ + VIDEO_TEXTURE_OES = 11, + /* + 12: pixel format for iOS CVPixelBuffer NV12 + */ + VIDEO_CVPIXEL_NV12 = 12, + /* + 13: pixel format for iOS CVPixelBuffer I420 + */ + VIDEO_CVPIXEL_I420 = 13, + /* + 14: pixel format for iOS CVPixelBuffer BGRA + */ + VIDEO_CVPIXEL_BGRA = 14, + /** + * 16: I422. + */ + VIDEO_PIXEL_I422 = 16, +}; + +/** + * The video display mode. + */ +enum RENDER_MODE_TYPE { + /** + * 1: Uniformly scale the video until it fills the visible boundaries + * (cropped). One dimension of the video may have clipped contents. + */ + RENDER_MODE_HIDDEN = 1, + /** + * 2: Uniformly scale the video until one of its dimension fits the boundary + * (zoomed to fit). Areas that are not filled due to the disparity in the + * aspect ratio will be filled with black. + */ + RENDER_MODE_FIT = 2, + /** + * @deprecated + * 3: This mode is deprecated. + */ + RENDER_MODE_ADAPTIVE __deprecated = 3, +}; + +/** + * The camera video source type + */ +enum CAMERA_VIDEO_SOURCE_TYPE { + /** + * 0: the video frame comes from the front camera + */ + CAMERA_SOURCE_FRONT = 0, + /** + * 1: the video frame comes from the back camera + */ + CAMERA_SOURCE_BACK = 1, + /** + * 1: the video frame source is unsepcified + */ + VIDEO_SOURCE_UNSPECIFIED = 2, +}; + +/** + * The definition of the ExternalVideoFrame struct. + */ +struct ExternalVideoFrame { + ExternalVideoFrame() + : type(VIDEO_BUFFER_RAW_DATA), + format(VIDEO_PIXEL_DEFAULT), + buffer(NULL), + stride(0), + height(0), + cropLeft(0), + cropTop(0), + cropRight(0), + cropBottom(0), + rotation(0), + timestamp(0), + eglContext(NULL), + eglType(EGL_CONTEXT10), + textureId(0), + fence_object(0), + metadata_buffer(NULL), + metadata_size(0), + alphaBuffer(NULL), + fillAlphaBuffer(false){} + + /** + * The EGL context type. + */ + enum EGL_CONTEXT_TYPE { + /** + * 0: When using the OpenGL interface (javax.microedition.khronos.egl.*) defined by Khronos + */ + EGL_CONTEXT10 = 0, + /** + * 0: When using the OpenGL interface (android.opengl.*) defined by Android + */ + EGL_CONTEXT14 = 1, + }; + + /** + * Video buffer types. + */ + enum VIDEO_BUFFER_TYPE { + /** + * 1: Raw data. + */ + VIDEO_BUFFER_RAW_DATA = 1, + /** + * 2: The same as VIDEO_BUFFER_RAW_DATA. + */ + VIDEO_BUFFER_ARRAY = 2, + /** + * 3: The video buffer in the format of texture. + */ + VIDEO_BUFFER_TEXTURE = 3, + }; + + /** + * The buffer type: #VIDEO_BUFFER_TYPE. + */ + VIDEO_BUFFER_TYPE type; + /** + * The pixel format: #VIDEO_PIXEL_FORMAT + */ + VIDEO_PIXEL_FORMAT format; + /** + * The video buffer. + */ + void* buffer; + /** + * The line spacing of the incoming video frame (px). For + * texture, it is the width of the texture. + */ + int stride; + /** + * The height of the incoming video frame. + */ + int height; + /** + * [Raw data related parameter] The number of pixels trimmed from the left. The default value is + * 0. + */ + int cropLeft; + /** + * [Raw data related parameter] The number of pixels trimmed from the top. The default value is + * 0. + */ + int cropTop; + /** + * [Raw data related parameter] The number of pixels trimmed from the right. The default value is + * 0. + */ + int cropRight; + /** + * [Raw data related parameter] The number of pixels trimmed from the bottom. The default value + * is 0. + */ + int cropBottom; + /** + * [Raw data related parameter] The clockwise rotation information of the video frame. You can set the + * rotation angle as 0, 90, 180, or 270. The default value is 0. + */ + int rotation; + /** + * The timestamp (ms) of the incoming video frame. An incorrect timestamp results in a frame loss or + * unsynchronized audio and video. + * + * Please refer to getAgoraCurrentMonotonicTimeInMs or getCurrentMonotonicTimeInMs + * to determine how to fill this filed. + */ + long long timestamp; + /** + * [Texture-related parameter] + * When using the OpenGL interface (javax.microedition.khronos.egl.*) defined by Khronos, set EGLContext to this field. + * When using the OpenGL interface (android.opengl.*) defined by Android, set EGLContext to this field. + */ + void *eglContext; + /** + * [Texture related parameter] Texture ID used by the video frame. + */ + EGL_CONTEXT_TYPE eglType; + /** + * [Texture related parameter] Incoming 4 × 4 transformational matrix. The typical value is a unit matrix. + */ + int textureId; + /** + * [Texture related parameter] + */ + long long fence_object; + /** + * [Texture related parameter] Incoming 4 × 4 transformational matrix. The typical value is a unit matrix. + */ + float matrix[16]; + /** + * [Texture related parameter] The MetaData buffer. + * The default value is NULL + */ + uint8_t* metadata_buffer; + /** + * [Texture related parameter] The MetaData size. + * The default value is 0 + */ + int metadata_size; + /** + * Indicates the alpha channel of current frame, which is consistent with the dimension of the video frame. + * The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground. + * The default value is NULL. + */ + uint8_t* alphaBuffer; + /** + * Extract alphaBuffer from bgra or rgba data. Set it true if you do not explicitly specify the alphabuffer. + * The default value is false + */ + bool fillAlphaBuffer; +}; + +/** + * The definition of the VideoFrame struct. + */ +struct VideoFrame { + VideoFrame(): + type(VIDEO_PIXEL_DEFAULT), + width(0), + height(0), + yStride(0), + uStride(0), + vStride(0), + yBuffer(NULL), + uBuffer(NULL), + vBuffer(NULL), + rotation(0), + renderTimeMs(0), + avsync_type(0), + metadata_buffer(NULL), + metadata_size(0), + sharedContext(0), + textureId(0), + fence_object(0), + alphaBuffer(NULL), + pixelBuffer(NULL){} + /** + * The video pixel format: #VIDEO_PIXEL_FORMAT. + */ + VIDEO_PIXEL_FORMAT type; + /** + * The width of the video frame. + */ + int width; + /** + * The height of the video frame. + */ + int height; + /** + * The line span of Y buffer in the YUV data. + */ + int yStride; + /** + * The line span of U buffer in the YUV data. + */ + int uStride; + /** + * The line span of V buffer in the YUV data. + */ + int vStride; + /** + * The pointer to the Y buffer in the YUV data. + */ + uint8_t* yBuffer; + /** + * The pointer to the U buffer in the YUV data. + */ + uint8_t* uBuffer; + /** + * The pointer to the V buffer in the YUV data. + */ + uint8_t* vBuffer; + /** + * The clockwise rotation information of this frame. You can set it as 0, 90, 180 or 270. + */ + int rotation; + /** + * The timestamp to render the video stream. Use this parameter for audio-video synchronization when + * rendering the video. + * + * @note This parameter is for rendering the video, not capturing the video. + */ + int64_t renderTimeMs; + /** + * The type of audio-video synchronization. + */ + int avsync_type; + /** + * [Texture related parameter] The MetaData buffer. + * The default value is NULL + */ + uint8_t* metadata_buffer; + /** + * [Texture related parameter] The MetaData size. + * The default value is 0 + */ + int metadata_size; + /** + * [Texture related parameter], egl context. + */ + void* sharedContext; + /** + * [Texture related parameter], Texture ID used by the video frame. + */ + int textureId; + /** + * [Texture related parameter] + */ + long long fence_object; + /** + * [Texture related parameter], Incoming 4 × 4 transformational matrix. + */ + float matrix[16]; + /** + * Indicates the alpha channel of current frame, which is consistent with the dimension of the video frame. + * The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground. + * The default value is NULL. + */ + uint8_t* alphaBuffer; + /** + *The type of CVPixelBufferRef, for iOS and macOS only. + */ + void* pixelBuffer; +}; + +/** + * The IVideoFrameObserver class. + */ +class IVideoFrameObserver { + public: + /** + * Occurs each time the player receives a video frame. + * + * After registering the video frame observer, + * the callback occurs each time the player receives a video frame to report the detailed information of the video frame. + * @param frame The detailed information of the video frame. See {@link VideoFrame}. + */ + virtual void onFrame(const VideoFrame* frame) = 0; + virtual ~IVideoFrameObserver() {} + virtual bool isExternal() { return true; } + virtual VIDEO_PIXEL_FORMAT getVideoFormatPreference() { return VIDEO_PIXEL_DEFAULT; } +}; + +enum MEDIA_PLAYER_SOURCE_TYPE { + /** + * The real type of media player when use MEDIA_PLAYER_SOURCE_DEFAULT is decided by the + * type of SDK package. It is full feature media player in full-featured SDK, or simple + * media player in others. + */ + MEDIA_PLAYER_SOURCE_DEFAULT, + /** + * Full featured media player is designed to support more codecs and media format, which + * requires more package size than simple player. If you need this player enabled, you + * might need to download a full-featured SDK. + */ + MEDIA_PLAYER_SOURCE_FULL_FEATURED, + /** + * Simple media player with limit codec supported, which requires minimal package size + * requirement and is enabled by default + */ + MEDIA_PLAYER_SOURCE_SIMPLE, +}; + +enum VIDEO_MODULE_POSITION { + POSITION_POST_CAPTURER = 1 << 0, + POSITION_PRE_RENDERER = 1 << 1, + POSITION_PRE_ENCODER = 1 << 2, +}; + +} // namespace base + +/** + * The IAudioFrameObserverBase class. + */ +class IAudioFrameObserverBase { + public: + /** + * Audio frame types. + */ + enum AUDIO_FRAME_TYPE { + /** + * 0: 16-bit PCM. + */ + FRAME_TYPE_PCM16 = 0, + }; + enum { MAX_HANDLE_TIME_CNT = 10 }; + /** + * The definition of the AudioFrame struct. + */ + struct AudioFrame { + /** + * The audio frame type: #AUDIO_FRAME_TYPE. + */ + AUDIO_FRAME_TYPE type; + /** + * The number of samples per channel in this frame. + */ + int samplesPerChannel; + /** + * The number of bytes per sample: #BYTES_PER_SAMPLE + */ + agora::rtc::BYTES_PER_SAMPLE bytesPerSample; + /** + * The number of audio channels (data is interleaved, if stereo). + * - 1: Mono. + * - 2: Stereo. + */ + int channels; + /** + *The number of samples per channel in the audio frame. + */ + int samplesPerSec; + /** + * The data buffer of the audio frame. When the audio frame uses a stereo channel, the data + * buffer is interleaved. + * + * Buffer data size: buffer = samples × channels × bytesPerSample. + */ + void* buffer; + /** + * The timestamp to render the audio data. + * + * You can use this timestamp to restore the order of the captured audio frame, and synchronize + * audio and video frames in video scenarios, including scenarios where external video sources + * are used. + */ + int64_t renderTimeMs; + /** + * The number of the audio track. + */ + int audioTrackNumber; + /** + * A reserved parameter. + */ + int avsync_type; + + AudioFrame() : type(FRAME_TYPE_PCM16), + samplesPerChannel(0), + bytesPerSample(rtc::TWO_BYTES_PER_SAMPLE), + channels(0), + samplesPerSec(0), + buffer(NULL), + renderTimeMs(0), + audioTrackNumber(0), + avsync_type(0) {} + }; + + enum AUDIO_FRAME_POSITION { + AUDIO_FRAME_POSITION_NONE = 0x0000, + /** The position for observing the playback audio of all remote users after mixing + */ + AUDIO_FRAME_POSITION_PLAYBACK = 0x0001, + /** The position for observing the recorded audio of the local user + */ + AUDIO_FRAME_POSITION_RECORD = 0x0002, + /** The position for observing the mixed audio of the local user and all remote users + */ + AUDIO_FRAME_POSITION_MIXED = 0x0004, + /** The position for observing the audio of a single remote user before mixing + */ + AUDIO_FRAME_POSITION_BEFORE_MIXING = 0x0008, + /** The position for observing the ear monitoring audio of the local user + */ + AUDIO_FRAME_POSITION_EAR_MONITORING = 0x0010, + /** The position for observing the before-publish audio of the local user + */ + AUDIO_FRAME_POSITION_BEFORE_PUBLISH = 0x0020, + }; + + struct AudioParams { + /** The audio sample rate (Hz), which can be set as one of the following values: + + - `8000` + - `16000` (Default) + - `32000` + - `44100 ` + - `48000` + */ + int sample_rate; + + /* The number of audio channels, which can be set as either of the following values: + + - `1`: Mono (Default) + - `2`: Stereo + */ + int channels; + + /* The use mode of the audio data. See AgoraAudioRawFrameOperationMode. + */ + rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE mode; + + /** The number of samples. For example, set it as 1024 for RTMP or RTMPS + streaming. + */ + int samples_per_call; + + AudioParams() : sample_rate(0), channels(0), mode(rtc::RAW_AUDIO_FRAME_OP_MODE_READ_ONLY), samples_per_call(0) {} + AudioParams(int samplerate, int channel, rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE type, int samplesPerCall) : sample_rate(samplerate), channels(channel), mode(type), samples_per_call(samplesPerCall) {} + }; + + public: + virtual ~IAudioFrameObserverBase() {} + + /** + * Occurs when the recorded audio frame is received. + * @param channelId The channel name + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The recorded audio frame is valid and is encoded and sent. + * - false: The recorded audio frame is invalid and is not encoded or sent. + */ + virtual bool onRecordAudioFrame(const char* channelId, AudioFrame& audioFrame) = 0; + /** + * Occurs when the before-publishing audio frame is received. + * @param channelId The channel name + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The recorded audio frame is valid and is encoded and sent. + * - false: The recorded audio frame is invalid and is not encoded or sent. + */ + virtual bool onPublishAudioFrame(const char* channelId, AudioFrame& audioFrame) { + (void) channelId; + (void) audioFrame; + return true; + } + /** + * Occurs when the playback audio frame is received. + * @param channelId The channel name + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The playback audio frame is valid and is encoded and sent. + * - false: The playback audio frame is invalid and is not encoded or sent. + */ + virtual bool onPlaybackAudioFrame(const char* channelId, AudioFrame& audioFrame) = 0; + /** + * Occurs when the mixed audio data is received. + * @param channelId The channel name + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The mixed audio data is valid and is encoded and sent. + * - false: The mixed audio data is invalid and is not encoded or sent. + */ + virtual bool onMixedAudioFrame(const char* channelId, AudioFrame& audioFrame) = 0; + /** + * Occurs when the ear monitoring audio frame is received. + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The ear monitoring audio data is valid and is encoded and sent. + * - false: The ear monitoring audio data is invalid and is not encoded or sent. + */ + virtual bool onEarMonitoringAudioFrame(AudioFrame& audioFrame) = 0; + /** + * Occurs when the before-mixing playback audio frame is received. + * @param channelId The channel name + * @param userId ID of the remote user. + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The before-mixing playback audio frame is valid and is encoded and sent. + * - false: The before-mixing playback audio frame is invalid and is not encoded or sent. + */ + virtual bool onPlaybackAudioFrameBeforeMixing(const char* channelId, base::user_id_t userId, AudioFrame& audioFrame) { + (void) channelId; + (void) userId; + (void) audioFrame; + return true; + } + + /** + * Sets the frame position for the audio observer. + * @return A bit mask that controls the frame position of the audio observer. + * @note - Use '|' (the OR operator) to observe multiple frame positions. + *

    + * After you successfully register the audio observer, the SDK triggers this callback each time it receives a audio frame. You can determine which position to observe by setting the return value. + * The SDK provides 4 positions for observer. Each position corresponds to a callback function: + * - `AUDIO_FRAME_POSITION_PLAYBACK (1 << 0)`: The position for playback audio frame is received, which corresponds to the \ref onPlaybackFrame "onPlaybackFrame" callback. + * - `AUDIO_FRAME_POSITION_RECORD (1 << 1)`: The position for record audio frame is received, which corresponds to the \ref onRecordFrame "onRecordFrame" callback. + * - `AUDIO_FRAME_POSITION_MIXED (1 << 2)`: The position for mixed audio frame is received, which corresponds to the \ref onMixedFrame "onMixedFrame" callback. + * - `AUDIO_FRAME_POSITION_BEFORE_MIXING (1 << 3)`: The position for playback audio frame before mixing is received, which corresponds to the \ref onPlaybackFrameBeforeMixing "onPlaybackFrameBeforeMixing" callback. + * @return The bit mask that controls the audio observation positions. + * See AUDIO_FRAME_POSITION. + */ + + virtual int getObservedAudioFramePosition() = 0; + + /** Sets the audio playback format + **Note**: + + - The SDK calculates the sample interval according to the `AudioParams` + you set in the return value of this callback and triggers the + `onPlaybackAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ + virtual AudioParams getPlaybackAudioParams() = 0; + + virtual AudioParams getPublishAudioParams() {return AudioParams();} + + /** Sets the audio recording format + **Note**: + - The SDK calculates the sample interval according to the `AudioParams` + you set in the return value of this callback and triggers the + `onRecordAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ + virtual AudioParams getRecordAudioParams() = 0; + + /** Sets the audio mixing format + **Note**: + - The SDK calculates the sample interval according to the `AudioParams` + you set in the return value of this callback and triggers the + `onMixedAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ + virtual AudioParams getMixedAudioParams() = 0; + + /** Sets the ear monitoring audio format + **Note**: + - The SDK calculates the sample interval according to the `AudioParams` + you set in the return value of this callback and triggers the + `onEarMonitoringAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ + virtual AudioParams getEarMonitoringAudioParams() = 0; +}; + +/** + * The IAudioFrameObserver class. + */ +class IAudioFrameObserver : public IAudioFrameObserverBase { + public: + using IAudioFrameObserverBase::onPlaybackAudioFrameBeforeMixing; + /** + * Occurs when the before-mixing playback audio frame is received. + * @param channelId The channel name + * @param uid ID of the remote user. + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The before-mixing playback audio frame is valid and is encoded and sent. + * - false: The before-mixing playback audio frame is invalid and is not encoded or sent. + */ + virtual bool onPlaybackAudioFrameBeforeMixing(const char* channelId, rtc::uid_t uid, AudioFrame& audioFrame) = 0; +}; + +struct AudioSpectrumData { + /** + * The audio spectrum data of audio. + */ + const float *audioSpectrumData; + /** + * The data length of audio spectrum data. + */ + int dataLength; + + AudioSpectrumData() : audioSpectrumData(NULL), dataLength(0) {} + AudioSpectrumData(const float *data, int length) : + audioSpectrumData(data), dataLength(length) {} +}; + +struct UserAudioSpectrumInfo { + /** + * User ID of the speaker. + */ + agora::rtc::uid_t uid; + /** + * The audio spectrum data of audio. + */ + struct AudioSpectrumData spectrumData; + + UserAudioSpectrumInfo () : uid(0), spectrumData() {} + UserAudioSpectrumInfo(agora::rtc::uid_t _uid, const float *data, int length) : + uid(_uid) { spectrumData.audioSpectrumData = data; spectrumData.dataLength = length; } +}; + +/** + * The IAudioSpectrumObserver class. + */ +class IAudioSpectrumObserver { +public: + virtual ~IAudioSpectrumObserver() {} + + /** + * Reports the audio spectrum of local audio. + * + * This callback reports the audio spectrum data of the local audio at the moment + * in the channel. + * + * You can set the time interval of this callback using \ref ILocalUser::enableAudioSpectrumMonitor "enableAudioSpectrumMonitor". + * + * @param data The audio spectrum data of local audio. + * - true: Processed. + * - false: Not processed. + */ + virtual bool onLocalAudioSpectrum(const AudioSpectrumData& data) = 0; + + /** + * Reports the audio spectrum of remote user. + * + * This callback reports the IDs and audio spectrum data of the loudest speakers at the moment + * in the channel. + * + * You can set the time interval of this callback using \ref ILocalUser::enableAudioSpectrumMonitor "enableAudioSpectrumMonitor". + * + * @param spectrums The pointer to \ref agora::media::UserAudioSpectrumInfo "UserAudioSpectrumInfo", which is an array containing + * the user ID and audio spectrum data for each speaker. + * - This array contains the following members: + * - `uid`, which is the UID of each remote speaker + * - `spectrumData`, which reports the audio spectrum of each remote speaker. + * @param spectrumNumber The array length of the spectrums. + * - true: Processed. + * - false: Not processed. + */ + virtual bool onRemoteAudioSpectrum(const UserAudioSpectrumInfo * spectrums, unsigned int spectrumNumber) = 0; +}; + +/** + * The IVideoEncodedFrameObserver class. + */ +class IVideoEncodedFrameObserver { + public: + /** + * Occurs each time the SDK receives an encoded video image. + * @param uid The user id of remote user. + * @param imageBuffer The pointer to the video image buffer. + * @param length The data length of the video image. + * @param videoEncodedFrameInfo The information of the encoded video frame: EncodedVideoFrameInfo. + * @return Determines whether to accept encoded video image. + * - true: Accept. + * - false: Do not accept. + */ + virtual bool onEncodedVideoFrameReceived(rtc::uid_t uid, const uint8_t* imageBuffer, size_t length, + const rtc::EncodedVideoFrameInfo& videoEncodedFrameInfo) = 0; + + virtual ~IVideoEncodedFrameObserver() {} +}; + +/** + * The IVideoFrameObserver class. + */ +class IVideoFrameObserver { + public: + typedef media::base::VideoFrame VideoFrame; + /** + * The process mode of the video frame: + */ + enum VIDEO_FRAME_PROCESS_MODE { + /** + * Read-only mode. + * + * In this mode, you do not modify the video frame. The video frame observer is a renderer. + */ + PROCESS_MODE_READ_ONLY, // Observer works as a pure renderer and will not modify the original frame. + /** + * Read and write mode. + * + * In this mode, you modify the video frame. The video frame observer is a video filter. + */ + PROCESS_MODE_READ_WRITE, // Observer works as a filter that will process the video frame and affect the following frame processing in SDK. + }; + + public: + virtual ~IVideoFrameObserver() {} + + /** + * Occurs each time the SDK receives a video frame captured by the local camera. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time + * a video frame is received. In this callback, you can get the video data captured by the local + * camera. You can then pre-process the data according to your scenarios. + * + * After pre-processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @note + * - If you get the video data in RGBA color encoding format, Agora does not support using this callback to send the processed data in RGBA color encoding format back to the SDK. + * - The video data that this callback gets has not been pre-processed, such as watermarking, cropping content, rotating, or image enhancement. + * + * @param videoFrame A pointer to the video frame: VideoFrame + * @param type source type of video frame. See #VIDEO_SOURCE_TYPE. + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ + virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) = 0; + + /** + * Occurs each time the SDK receives a video frame before encoding. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time + * when it receives a video frame. In this callback, you can get the video data before encoding. You can then + * process the data according to your particular scenarios. + * + * After processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @note + * - To get the video data captured from the second screen before encoding, you need to set (1 << 2) as a frame position through `getObservedFramePosition`. + * - The video data that this callback gets has been pre-processed, such as watermarking, cropping content, rotating, or image enhancement. + * - This callback does not support sending processed RGBA video data back to the SDK. + * + * @param videoFrame A pointer to the video frame: VideoFrame + * @param type source type of video frame. See #VIDEO_SOURCE_TYPE. + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ + virtual bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) = 0; + + /** + * Occurs each time the SDK receives a video frame decoded by the MediaPlayer. + * + * After you successfully register the video frame observer, the SDK triggers this callback each + * time a video frame is decoded. In this callback, you can get the video data decoded by the + * MediaPlayer. You can then pre-process the data according to your scenarios. + * + * After pre-processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @note + * If the returned agora::media::base::VIDEO_PIXEL_DEFAULT format is specified by getVideoFormatPreference, + * the video frame you get through onMediaPlayerVideoFrame is in agora::media::base::VIDEO_PIXEL_I420 format. + * + * @param videoFrame A pointer to the video frame: VideoFrame + * @param mediaPlayerId ID of the mediaPlayer. + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ + virtual bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) = 0; + + /** + * Occurs each time the SDK receives a video frame sent by the remote user. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time a + * video frame is received. In this callback, you can get the video data sent by the remote user. You + * can then post-process the data according to your scenarios. + * + * After post-processing, you can send the processed data back to the SDK by setting the `videoFrame` + * parameter in this callback. + * + * @note This callback does not support sending processed RGBA video data back to the SDK. + * + * @param channelId The channel name + * @param remoteUid ID of the remote user who sends the current video frame. + * @param videoFrame A pointer to the video frame: VideoFrame + * @return Determines whether to ignore the current video frame if the post-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ + virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame) = 0; + + virtual bool onTranscodedVideoFrame(VideoFrame& videoFrame) = 0; + + /** + * Occurs each time the SDK receives a video frame and prompts you to set the process mode of the video frame. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time it receives + * a video frame. You need to set your preferred process mode in the return value of this callback. + * @return VIDEO_FRAME_PROCESS_MODE. + */ + virtual VIDEO_FRAME_PROCESS_MODE getVideoFrameProcessMode() { + return PROCESS_MODE_READ_ONLY; + } + + /** + * Sets the format of the raw video data output by the SDK. + * + * If you want to get raw video data in a color encoding format other than YUV 420, register this callback when + * calling `registerVideoFrameObserver`. After you successfully register the video frame observer, the SDK triggers + * this callback each time it receives a video frame. You need to set your preferred video data in the return value + * of this callback. + * + * @note If you want the video captured by the sender to be the original format, set the original video data format + * to VIDEO_PIXEL_DEFAULT in the return value. On different platforms, the original video pixel format is also + * different, for the actual video pixel format, see `VideoFrame`. + * + * @return Sets the video format. See VIDEO_PIXEL_FORMAT. + */ + virtual base::VIDEO_PIXEL_FORMAT getVideoFormatPreference() { return base::VIDEO_PIXEL_DEFAULT; } + + /** + * Occurs each time the SDK receives a video frame, and prompts you whether to rotate the captured video. + * + * If you want to rotate the captured video according to the rotation member in the `VideoFrame` class, register this + * callback by calling `registerVideoFrameObserver`. After you successfully register the video frame observer, the + * SDK triggers this callback each time it receives a video frame. You need to set whether to rotate the video frame + * in the return value of this callback. + * + * @note This function only supports video data in RGBA or YUV420. + * + * @return Determines whether to rotate. + * - `true`: Rotate the captured video. + * - `false`: (Default) Do not rotate the captured video. + */ + virtual bool getRotationApplied() { return false; } + + /** + * Occurs each time the SDK receives a video frame and prompts you whether or not to mirror the captured video. + * + * If the video data you want to obtain is a mirror image of the original video, you need to register this callback + * when calling `registerVideoFrameObserver`. After you successfully register the video frame observer, the SDK + * triggers this callback each time it receives a video frame. You need to set whether or not to mirror the video + * frame in the return value of this callback. + * + * @note This function only supports video data in RGBA and YUV420 formats. + * + * @return Determines whether to mirror. + * - `true`: Mirror the captured video. + * - `false`: (Default) Do not mirror the captured video. + */ + virtual bool getMirrorApplied() { return false; } + + /** + * Sets the frame position for the video observer. + * + * After you successfully register the video observer, the SDK triggers this callback each time it receives + * a video frame. You can determine which position to observe by setting the return value. The SDK provides + * 3 positions for observer. Each position corresponds to a callback function: + * + * POSITION_POST_CAPTURER(1 << 0): The position after capturing the video data, which corresponds to the onCaptureVideoFrame callback. + * POSITION_PRE_RENDERER(1 << 1): The position before receiving the remote video data, which corresponds to the onRenderVideoFrame callback. + * POSITION_PRE_ENCODER(1 << 2): The position before encoding the video data, which corresponds to the onPreEncodeVideoFrame callback. + * + * To observe multiple frame positions, use '|' (the OR operator). + * This callback observes POSITION_POST_CAPTURER(1 << 0) and POSITION_PRE_RENDERER(1 << 1) by default. + * To conserve the system consumption, you can reduce the number of frame positions that you want to observe. + * + * @return A bit mask that controls the frame position of the video observer: VIDEO_OBSERVER_POSITION. + */ + virtual uint32_t getObservedFramePosition() { + return base::POSITION_POST_CAPTURER | base::POSITION_PRE_RENDERER; + } + + /** + * Indicate if the observer is for internal use. + * Note: Never override this function + * @return + * - true: the observer is for external use + * - false: the observer is for internal use + */ + virtual bool isExternal() { return true; } +}; + +/** + * The external video source type. + */ +enum EXTERNAL_VIDEO_SOURCE_TYPE { + /** + * 0: non-encoded video frame. + */ + VIDEO_FRAME = 0, + /** + * 1: encoded video frame. + */ + ENCODED_VIDEO_FRAME, +}; + +/** + * The format of the recording file. + * + * @since v3.5.2 + */ +enum MediaRecorderContainerFormat { + /** + * 1: (Default) MP4. + */ + FORMAT_MP4 = 1, +}; +/** + * The recording content. + * + * @since v3.5.2 + */ +enum MediaRecorderStreamType { + /** + * Only audio. + */ + STREAM_TYPE_AUDIO = 0x01, + /** + * Only video. + */ + STREAM_TYPE_VIDEO = 0x02, + /** + * (Default) Audio and video. + */ + STREAM_TYPE_BOTH = STREAM_TYPE_AUDIO | STREAM_TYPE_VIDEO, +}; +/** + * The current recording state. + * + * @since v3.5.2 + */ +enum RecorderState { + /** + * -1: An error occurs during the recording. See RecorderErrorCode for the reason. + */ + RECORDER_STATE_ERROR = -1, + /** + * 2: The audio and video recording is started. + */ + RECORDER_STATE_START = 2, + /** + * 3: The audio and video recording is stopped. + */ + RECORDER_STATE_STOP = 3, +}; +/** + * The reason for the state change + * + * @since v3.5.2 + */ +enum RecorderErrorCode { + /** + * 0: No error occurs. + */ + RECORDER_ERROR_NONE = 0, + /** + * 1: The SDK fails to write the recorded data to a file. + */ + RECORDER_ERROR_WRITE_FAILED = 1, + /** + * 2: The SDK does not detect audio and video streams to be recorded, or audio and video streams are interrupted for more than five seconds during recording. + */ + RECORDER_ERROR_NO_STREAM = 2, + /** + * 3: The recording duration exceeds the upper limit. + */ + RECORDER_ERROR_OVER_MAX_DURATION = 3, + /** + * 4: The recording configuration changes. + */ + RECORDER_ERROR_CONFIG_CHANGED = 4, +}; +/** + * Configurations for the local audio and video recording. + * + * @since v3.5.2 + */ +struct MediaRecorderConfiguration { + /** + * The absolute path (including the filename extensions) of the recording file. + * For example, `C:\Users\\AppData\Local\Agora\\example.mp4` on Windows, + * `/App Sandbox/Library/Caches/example.mp4` on iOS, `/Library/Logs/example.mp4` on macOS, and + * `/storage/emulated/0/Android/data//files/example.mp4` on Android. + * + * @note Ensure that the specified path exists and is writable. + */ + const char* storagePath; + /** + * The format of the recording file. See \ref agora::rtc::MediaRecorderContainerFormat "MediaRecorderContainerFormat". + */ + MediaRecorderContainerFormat containerFormat; + /** + * The recording content. See \ref agora::rtc::MediaRecorderStreamType "MediaRecorderStreamType". + */ + MediaRecorderStreamType streamType; + /** + * The maximum recording duration, in milliseconds. The default value is 120000. + */ + int maxDurationMs; + /** + * The interval (ms) of updating the recording information. The value range is + * [1000,10000]. Based on the set value of `recorderInfoUpdateInterval`, the + * SDK triggers the \ref IMediaRecorderObserver::onRecorderInfoUpdated "onRecorderInfoUpdated" + * callback to report the updated recording information. + */ + int recorderInfoUpdateInterval; + + MediaRecorderConfiguration() : storagePath(NULL), containerFormat(FORMAT_MP4), streamType(STREAM_TYPE_BOTH), maxDurationMs(120000), recorderInfoUpdateInterval(0) {} + MediaRecorderConfiguration(const char* path, MediaRecorderContainerFormat format, MediaRecorderStreamType type, int duration, int interval) : storagePath(path), containerFormat(format), streamType(type), maxDurationMs(duration), recorderInfoUpdateInterval(interval) {} +}; +/** + * Information for the recording file. + * + * @since v3.5.2 + */ +struct RecorderInfo { + /** + * The absolute path of the recording file. + */ + const char* fileName; + /** + * The recording duration, in milliseconds. + */ + unsigned int durationMs; + /** + * The size in bytes of the recording file. + */ + unsigned int fileSize; + + RecorderInfo() : fileName(NULL), durationMs(0), fileSize(0) {} + RecorderInfo(const char* name, unsigned int dur, unsigned int size) : fileName(name), durationMs(dur), fileSize(size) {} +}; + + +class IMediaRecorderObserver { + public: + /** + * Occurs when the recording state changes. + * + * @since v3.5.2 + * + * When the local audio and video recording state changes, the SDK triggers this callback to report the current + * recording state and the reason for the change. + * + * @param state The current recording state. See \ref agora::rtc::RecorderState "RecorderState". + * @param error The reason for the state change. See \ref agora::rtc::RecorderErrorCode "RecorderErrorCode". + */ + virtual void onRecorderStateChanged(RecorderState state, RecorderErrorCode error) = 0; + /** + * Occurs when the recording information is updated. + * + * @since v3.5.2 + * + * After you successfully register this callback and enable the local audio and video recording, the SDK periodically triggers + * the `onRecorderInfoUpdated` callback based on the set value of `recorderInfoUpdateInterval`. This callback reports the + * filename, duration, and size of the current recording file. + * + * @param info Information for the recording file. See RecorderInfo. + * + */ + virtual void onRecorderInfoUpdated(const RecorderInfo& info) = 0; + virtual ~IMediaRecorderObserver() {} +}; +} // namespace media +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaFilterEventDelegate.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaFilterEventDelegate.h new file mode 100644 index 0000000..5e2a6d6 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaFilterEventDelegate.h @@ -0,0 +1,67 @@ +// +// AgoraMediaFilterEventDelegate.h +// Agora SDK +// +// Created by LLF on 2020-9-21. +// Copyright (c) 2020 Agora. All rights reserved. +// + +#import + +@interface AgoraExtensionContext : NSObject +/** Whether uid is valid. + */ +@property (assign, nonatomic) BOOL isValid; +/** Default 0 when "isValid is NO + * Local user is 0 and remote user great than 0 when "isValid" is YES + */ +@property (assign, nonatomic) NSUInteger uid; +@property (copy, nonatomic) NSString * _Nullable providerName; +@property (copy, nonatomic) NSString * _Nullable extensionName; + +@end + +@protocol AgoraMediaFilterEventDelegate +@optional +/* Meida filter(audio filter or video filter) event callback + */ +- (void)onEvent:(NSString * __nullable)provider + extension:(NSString * __nullable)extension + key:(NSString * __nullable)key + value:(NSString * __nullable)value NS_SWIFT_NAME(onEvent(_:extension:key:value:)) __deprecated_msg("override needExtensionContext, use onEventWithContext instead"); + +- (void)onExtensionStopped:(NSString * __nullable)provider + extension:(NSString * __nullable)extension NS_SWIFT_NAME(onExtensionStopped(_:extension:)) + __deprecated_msg("override needExtensionContext, use onExtensionStoppedWithContext instead"); + +- (void)onExtensionStarted:(NSString * __nullable)provider + extension:(NSString * __nullable)extension NS_SWIFT_NAME(onExtensionStarted(_:extension:)) + __deprecated_msg("override needExtensionContext, use onExtensionStartedWithContext instead"); + +- (void)onExtensionError:(NSString * __nullable)provider + extension:(NSString * __nullable)extension + error:(int)error + message:(NSString * __nullable)message NS_SWIFT_NAME(onExtensionError(_:extension:error:message:)) + __deprecated_msg("override needExtensionContext, use onExtensionErrorWithContext instead"); + +/** Whether need ExtensionContext, default NO if doesn't impl + * + * recommend override for YES + * return NO, then callback interface with onEvent、onExtensionStarted、onExtensionStopped、onExtensionError + * return YES, then callback interface conterpart with *WithContext interface + */ +- (BOOL)needExtensionContext NS_SWIFT_NAME(needExtensionContext());// + +- (void)onEventWithContext:(AgoraExtensionContext * __nonnull)context + key:(NSString * __nullable)key + value:(NSString * __nullable)value NS_SWIFT_NAME(onEventWithContext(_:key:value:)); + +- (void)onExtensionStartedWithContext:(AgoraExtensionContext * __nonnull)context NS_SWIFT_NAME(onExtensionStartedWithContext(_:)); + +- (void)onExtensionStoppedWithContext:(AgoraExtensionContext * __nonnull)context NS_SWIFT_NAME(onExtensionStoppedWithContext(_:)); + +- (void)onExtensionErrorWithContext:(AgoraExtensionContext * __nonnull)context + error:(int)error + message:(NSString * __nullable)message NS_SWIFT_NAME(onExtensionErrorWithContext(_:error:message:)); + +@end diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaPlayerTypes.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaPlayerTypes.h new file mode 100644 index 0000000..b446bf0 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMediaPlayerTypes.h @@ -0,0 +1,474 @@ +// +// Agora Engine SDK +// +// Created by Sting Feng in 2020-05. +// Copyright (c) 2017 Agora.io. All rights reserved. + +#pragma once // NOLINT(build/header_guard) + +#include +#include + +#include "AgoraOptional.h" + +/** + * set analyze duration for real time stream + * @example "setPlayerOption(KEY_PLAYER_REAL_TIME_STREAM_ANALYZE_DURATION,1000000)" + */ +#define KEY_PLAYER_REAL_TIME_STREAM_ANALYZE_DURATION "analyze_duration" + +/** + * make the player to enable audio or not + * @example "setPlayerOption(KEY_PLAYER_ENABLE_AUDIO,0)" + */ +#define KEY_PLAYER_ENABLE_AUDIO "enable_audio" + +/** + * make the player to enable video or not + * @example "setPlayerOption(KEY_PLAYER_ENABLE_VIDEO,0)" + */ +#define KEY_PLAYER_ENABLE_VIDEO "enable_video" + +/** + * set the player enable to search metadata + * @example "setPlayerOption(KEY_PLAYER_DISABLE_SEARCH_METADATA,0)" + */ +#define KEY_PLAYER_ENABLE_SEARCH_METADATA "enable_search_metadata" + +/** + * set the player sei filter type + * @example "setPlayerOption(KEY_PLAYER_SEI_FILTER_TYPE,"5")" + */ +#define KEY_PLAYER_SEI_FILTER_TYPE "set_sei_filter_type" + +namespace agora { + +namespace media { + +namespace base { +static const uint8_t kMaxCharBufferLength = 50; +/** + * @brief The playback state. + * + */ +enum MEDIA_PLAYER_STATE { + /** Default state. + */ + PLAYER_STATE_IDLE = 0, + /** Opening the media file. + */ + PLAYER_STATE_OPENING, + /** The media file is opened successfully. + */ + PLAYER_STATE_OPEN_COMPLETED, + /** Playing the media file. + */ + PLAYER_STATE_PLAYING, + /** The playback is paused. + */ + PLAYER_STATE_PAUSED, + /** The playback is completed. + */ + PLAYER_STATE_PLAYBACK_COMPLETED, + /** All loops are completed. + */ + PLAYER_STATE_PLAYBACK_ALL_LOOPS_COMPLETED, + /** The playback is stopped. + */ + PLAYER_STATE_STOPPED, + /** Player pausing (internal) + */ + PLAYER_STATE_PAUSING_INTERNAL = 50, + /** Player stopping (internal) + */ + PLAYER_STATE_STOPPING_INTERNAL, + /** Player seeking state (internal) + */ + PLAYER_STATE_SEEKING_INTERNAL, + /** Player getting state (internal) + */ + PLAYER_STATE_GETTING_INTERNAL, + /** None state for state machine (internal) + */ + PLAYER_STATE_NONE_INTERNAL, + /** Do nothing state for state machine (internal) + */ + PLAYER_STATE_DO_NOTHING_INTERNAL, + /** Player set track state (internal) + */ + PLAYER_STATE_SET_TRACK_INTERNAL, + /** The playback fails. + */ + PLAYER_STATE_FAILED = 100, +}; +/** + * @brief Player error code + * + */ +enum MEDIA_PLAYER_ERROR { + /** No error. + */ + PLAYER_ERROR_NONE = 0, + /** The parameter is invalid. + */ + PLAYER_ERROR_INVALID_ARGUMENTS = -1, + /** Internel error. + */ + PLAYER_ERROR_INTERNAL = -2, + /** No resource. + */ + PLAYER_ERROR_NO_RESOURCE = -3, + /** Invalid media source. + */ + PLAYER_ERROR_INVALID_MEDIA_SOURCE = -4, + /** The type of the media stream is unknown. + */ + PLAYER_ERROR_UNKNOWN_STREAM_TYPE = -5, + /** The object is not initialized. + */ + PLAYER_ERROR_OBJ_NOT_INITIALIZED = -6, + /** The codec is not supported. + */ + PLAYER_ERROR_CODEC_NOT_SUPPORTED = -7, + /** Invalid renderer. + */ + PLAYER_ERROR_VIDEO_RENDER_FAILED = -8, + /** An error occurs in the internal state of the player. + */ + PLAYER_ERROR_INVALID_STATE = -9, + /** The URL of the media file cannot be found. + */ + PLAYER_ERROR_URL_NOT_FOUND = -10, + /** Invalid connection between the player and the Agora server. + */ + PLAYER_ERROR_INVALID_CONNECTION_STATE = -11, + /** The playback buffer is insufficient. + */ + PLAYER_ERROR_SRC_BUFFER_UNDERFLOW = -12, + /** The audio mixing file playback is interrupted. + */ + PLAYER_ERROR_INTERRUPTED = -13, + /** The SDK does not support this function. + */ + PLAYER_ERROR_NOT_SUPPORTED = -14, + /** The token has expired. + */ + PLAYER_ERROR_TOKEN_EXPIRED = -15, + /** The ip has expired. + */ + PLAYER_ERROR_IP_EXPIRED = -16, + /** An unknown error occurs. + */ + PLAYER_ERROR_UNKNOWN = -17, +}; + +/** + * @brief The type of the media stream. + * + */ +enum MEDIA_STREAM_TYPE { + /** The type is unknown. + */ + STREAM_TYPE_UNKNOWN = 0, + /** The video stream. + */ + STREAM_TYPE_VIDEO = 1, + /** The audio stream. + */ + STREAM_TYPE_AUDIO = 2, + /** The subtitle stream. + */ + STREAM_TYPE_SUBTITLE = 3, +}; + +/** + * @brief The playback event. + * + */ +enum MEDIA_PLAYER_EVENT { + /** The player begins to seek to the new playback position. + */ + PLAYER_EVENT_SEEK_BEGIN = 0, + /** The seek operation completes. + */ + PLAYER_EVENT_SEEK_COMPLETE = 1, + /** An error occurs during the seek operation. + */ + PLAYER_EVENT_SEEK_ERROR = 2, + /** The player changes the audio track for playback. + */ + PLAYER_EVENT_AUDIO_TRACK_CHANGED = 5, + /** player buffer low + */ + PLAYER_EVENT_BUFFER_LOW = 6, + /** player buffer recover + */ + PLAYER_EVENT_BUFFER_RECOVER = 7, + /** The video or audio is interrupted + */ + PLAYER_EVENT_FREEZE_START = 8, + /** Interrupt at the end of the video or audio + */ + PLAYER_EVENT_FREEZE_STOP = 9, + /** switch source begin + */ + PLAYER_EVENT_SWITCH_BEGIN = 10, + /** switch source complete + */ + PLAYER_EVENT_SWITCH_COMPLETE = 11, + /** switch source error + */ + PLAYER_EVENT_SWITCH_ERROR = 12, + /** An application can render the video to less than a second + */ + PLAYER_EVENT_FIRST_DISPLAYED = 13, + /** cache resources exceed the maximum file count + */ + PLAYER_EVENT_REACH_CACHE_FILE_MAX_COUNT = 14, + /** cache resources exceed the maximum file size + */ + PLAYER_EVENT_REACH_CACHE_FILE_MAX_SIZE = 15, + /** Triggered when a retry is required to open the media + */ + PLAYER_EVENT_TRY_OPEN_START = 16, + /** Triggered when the retry to open the media is successful + */ + PLAYER_EVENT_TRY_OPEN_SUCCEED = 17, + /** Triggered when retrying to open media fails + */ + PLAYER_EVENT_TRY_OPEN_FAILED = 18, +}; + +/** + * @brief The play preload another source event. + * + */ +enum PLAYER_PRELOAD_EVENT { + /** preload source begin + */ + PLAYER_PRELOAD_EVENT_BEGIN = 0, + /** preload source complete + */ + PLAYER_PRELOAD_EVENT_COMPLETE = 1, + /** preload source error + */ + PLAYER_PRELOAD_EVENT_ERROR = 2, +}; + +/** + * @brief The information of the media stream object. + * + */ +struct PlayerStreamInfo { + /** The index of the media stream. */ + int streamIndex; + + /** The type of the media stream. See {@link MEDIA_STREAM_TYPE}. */ + MEDIA_STREAM_TYPE streamType; + + /** The codec of the media stream. */ + char codecName[kMaxCharBufferLength]; + + /** The language of the media stream. */ + char language[kMaxCharBufferLength]; + + /** The frame rate (fps) if the stream is video. */ + int videoFrameRate; + + /** The video bitrate (bps) if the stream is video. */ + int videoBitRate; + + /** The video width (pixel) if the stream is video. */ + int videoWidth; + + /** The video height (pixel) if the stream is video. */ + int videoHeight; + + /** The rotation angle if the steam is video. */ + int videoRotation; + + /** The sample rate if the stream is audio. */ + int audioSampleRate; + + /** The number of audio channels if the stream is audio. */ + int audioChannels; + + /** The number of bits per sample if the stream is audio. */ + int audioBitsPerSample; + + /** The total duration (millisecond) of the media stream. */ + int64_t duration; + + PlayerStreamInfo() : streamIndex(0), + streamType(STREAM_TYPE_UNKNOWN), + videoFrameRate(0), + videoBitRate(0), + videoWidth(0), + videoHeight(0), + videoRotation(0), + audioSampleRate(0), + audioChannels(0), + audioBitsPerSample(0), + duration(0) { + memset(codecName, 0, sizeof(codecName)); + memset(language, 0, sizeof(language)); + } +}; + +/** + * @brief The information of the media stream object. + * + */ +struct SrcInfo { + /** The bitrate of the media stream. The unit of the number is kbps. + * + */ + int bitrateInKbps; + + /** The name of the media stream. + * + */ + const char* name; + +}; + +/** + * @brief The type of the media metadata. + * + */ +enum MEDIA_PLAYER_METADATA_TYPE { + /** The type is unknown. + */ + PLAYER_METADATA_TYPE_UNKNOWN = 0, + /** The type is SEI. + */ + PLAYER_METADATA_TYPE_SEI = 1, +}; + +struct CacheStatistics { + /** total data size of uri + */ + int64_t fileSize; + /** data of uri has cached + */ + int64_t cacheSize; + /** data of uri has downloaded + */ + int64_t downloadSize; +}; + +struct PlayerUpdatedInfo { + /** playerId has value when user trigger interface of opening + */ + Optional playerId; + + /** deviceId has value when user trigger interface of opening + */ + Optional deviceId; + + /** cacheStatistics exist if you enable cache, triggered 1s at a time after openning url + */ + Optional cacheStatistics; +}; + +/** + * The custom data source provides a data stream input callback, and the player will continue to call back this interface, requesting the user to fill in the data that needs to be played. + */ +class IMediaPlayerCustomDataProvider { +public: + + /** + * @brief The player requests to read the data callback, you need to fill the specified length of data into the buffer + * @param buffer the buffer pointer that you need to fill data. + * @param bufferSize the bufferSize need to fill of the buffer pointer. + * @return you need return offset value if succeed. return 0 if failed. + */ + virtual int onReadData(unsigned char *buffer, int bufferSize) = 0; + + /** + * @brief The Player seek event callback, you need to operate the corresponding stream seek operation, You can refer to the definition of lseek() at https://man7.org/linux/man-pages/man2/lseek.2.html + * @param offset the value of seek offset. + * @param whence the postion of start seeking, the directive whence as follows: + * 0 - SEEK_SET : The file offset is set to offset bytes. + * 1 - SEEK_CUR : The file offset is set to its current location plus offset bytes. + * 2 - SEEK_END : The file offset is set to the size of the file plus offset bytes. + * 65536 - AVSEEK_SIZE : Optional. Passing this as the "whence" parameter to a seek function causes it to return the filesize without seeking anywhere. + * @return + * whence == 65536, return filesize if you need. + * whence >= 0 && whence < 3 , return offset value if succeed. return -1 if failed. + */ + virtual int64_t onSeek(int64_t offset, int whence) = 0; + + virtual ~IMediaPlayerCustomDataProvider() {} +}; + +struct MediaSource { + /** + * The URL of the media file that you want to play. + */ + const char* url; + /** + * The URI of the media file + * + * When caching is enabled, if the url cannot distinguish the cache file name, + * the uri must be able to ensure that the cache file name corresponding to the url is unique. + */ + const char* uri; + /** + * Set the starting position for playback, in ms. + */ + int64_t startPos; + /** + * Determines whether to autoplay after opening a media resource. + * - true: (Default) Autoplay after opening a media resource. + * - false: Do not autoplay after opening a media resource. + */ + bool autoPlay; + /** + * Determines whether to enable cache streaming to local files. If enable cached, the media player will + * use the url or uri as the cache index. + * + * @note + * The local cache function only supports on-demand video/audio streams and does not support live streams. + * Caching video and audio files based on the HLS protocol (m3u8) to your local device is not supported. + * + * - true: Enable cache. + * - false: (Default) Disable cache. + */ + bool enableCache; + /** + * Determines whether to enable multi-track audio stream decoding. + * Then you can select multi audio track of the media file for playback or publish to channel + * + * @note + * If you use the selectMultiAudioTrack API, you must set enableMultiAudioTrack to true. + * + * - true: Enable MultiAudioTrack;. + * - false: (Default) Disable MultiAudioTrack;. + */ + bool enableMultiAudioTrack; + /** + * Determines whether the opened media resource is a stream through the Agora Broadcast Streaming Network(CDN). + * - true: It is a stream through the Agora Broadcast Streaming Network. + * - false: (Default) It is not a stream through the Agora Broadcast Streaming Network. + */ + Optional isAgoraSource; + /** + * Determines whether the opened media resource is a live stream. If is a live stream, it can speed up the opening of media resources. + * - true: It is a live stream. + * - false: (Default) It is not is a live stream. + */ + Optional isLiveSource; + /** + * External custom data source object + */ + IMediaPlayerCustomDataProvider* provider; + + MediaSource() : url(NULL), uri(NULL), startPos(0), autoPlay(true), enableCache(false), + enableMultiAudioTrack(false), provider(NULL){ + } +}; + +} // namespace base +} // namespace media +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMusicContentCenter.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMusicContentCenter.h new file mode 100644 index 0000000..98c0156 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraMusicContentCenter.h @@ -0,0 +1,485 @@ +// +// AgoraMusicContentCenter.h +// AgoraMusicContentCenter +// +// Created by dingyusong on 2022/6/1. +// Copyright © 2022 Agora. All rights reserved. +// + +#import +#import "AgoraRtcEngineKit.h" +/** + * The status of preload request + */ +typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterPreloadStatus) { + /** + * 0: No error occurs and preload succeeds. + */ + AgoraMusicContentCenterPreloadStatusOK = 0, + + /** + * 1: A general error occurs. + */ + AgoraMusicContentCenterPreloadStatusError = 1, + + /** + * 2: The media file is preloading. + */ + AgoraMusicContentCenterPreloadStatusPreloading = 2, + + /** + * 3: The media file is removed. + */ + AgoraMusicContentCenterPreloadStatusRemoveCache = 3, +}; + +/** + * the status of search or get top list request + */ +typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterStatusCode) { + /** + * 0: No error occurs and request succeeds. + */ + AgoraMusicContentCenterStatusCodeOK = 0, + /** + * 1: A general error occurs. + */ + AgoraMusicContentCenterStatusCodeError = 1, + /** + * 2: The gateway error. There are several possible reasons: + * - Token is expired. Check if your token is expired. + * - Token is invalid. Check the type of token you passed in. + * - Network error. Check your network. + */ + AgoraMusicContentCenterStatusCodeErrorGateway = 2, + /** + * 3: Permission and resource error. There are several possible reasons: + * - Your appid may not have the mcc permission. Please contact technical support + * - The resource may not exist. Please contact technical support + */ + AgoraMusicContentCenterStatusCodeErrorPermissionAndResource = 3, + /** + * 4: Internal data parse error. Please contact technical support + */ + AgoraMusicContentCenterStatusCodeErrorInternalDataParse = 4, + /** + * 5: Music loading error. Please contact technical support + */ + AgoraMusicContentCenterStatusCodeErrorMusicLoading = 5, + /** + * 6: Music decryption error. Please contact technical support + */ + AgoraMusicContentCenterStatusCodeErrorMusicDecryption = 6, + /** + * 7: Http internal error. suggest retry later. + */ + AgoraMusicContentCenterStatusCodeErrorHttpInternalError = 7, +}; + +typedef NS_ENUM(NSUInteger, AgoraMusicCacheStatusType) { + /** + * 0: The media file is already cached. + */ + AgoraMusicCacheStatusTypeCached = 0, + + /** + * 1: The media file is being cached. + */ + AgoraMusicCacheStatusTypeCaching = 1, +}; + +NS_ASSUME_NONNULL_BEGIN + +__attribute__((visibility("default"))) @interface AgoraMusicCacheInfo : NSObject +/** + * The songCode of the music + */ +@property(nonatomic, assign) NSInteger songCode; + +/** + * The cache status of the music + */ +@property(nonatomic, assign) AgoraMusicCacheStatusType statusType; +@end + +__attribute__((visibility("default"))) @interface AgoraMusicChartInfo : NSObject +/** + * Name of the music chart + */ +@property (nonatomic, copy) NSString *chartName; +/** + * Id of the music chart, which is used to get music list + */ +@property (nonatomic, assign) NSInteger identify; +@end + +__attribute__((visibility("default"))) @interface AgoraMvProperty : NSObject +/** + * The resolution of the mv + */ +@property (nonatomic, copy) NSString *resolution; +/** + * The bandwidth of the mv + */ +@property (nonatomic, copy) NSString *bandwidth; +@end + +__attribute__((visibility("default"))) @interface AgoraClimaxSegment : NSObject +/** + * The start time of climax segment + */ +@property(nonatomic, assign) NSInteger startTimeMs; +/** + * The end time of climax segment + */ +@property(nonatomic, assign) NSInteger endTimeMs; +@end + +/** + * The music info + */ +__attribute__((visibility("default"))) @interface AgoraMusic : NSObject +/** + * The songCode of music + */ +@property(nonatomic, assign) NSInteger songCode; +/** + * The type of music + * 1, mp3 with instrumental accompaniment and original + * 2, mp3 only with instrumental accompaniment + * 3, mp3 only with original + * 4, mp4 with instrumental accompaniment and original + * 5, mv only + * 6, new type mp4 with instrumental accompaniment and original + * detail at document of music media center + */ +@property(nonatomic, assign) NSInteger type; +/** + * The pitch type of music. + * 1, xml lyric has pitch + * 2, lyric has no pitch + */ +@property(nonatomic, assign) NSInteger pitchType; +/** + * The name of music + */ +@property(nonatomic, copy) NSString* name; +/** + * The singer of music + */ +@property(nonatomic, copy) NSString* singer; +/** + * The poster url of music + */ +@property(nonatomic, copy) NSString* poster; + +/** + * The release time of music + */ +@property(nonatomic, copy) NSString* releaseTime; +/** + * The duration (in seconds) of music + */ +@property(nonatomic, assign) NSInteger durationS; +/** + * The lyric list of music + * 0, xml + * 1, lrc + */ +@property(nonatomic, strong) NSArray* lyricList; +/** + * The mv property list of music + */ +@property(nonatomic, strong) NSArray* mvPropertyList; +/** + * The climax segment list of music + */ +@property(nonatomic, strong) NSArray* climaxSegmentList; +@end + +/** + * The music collection info + */ +__attribute__((visibility("default"))) @interface AgoraMusicCollection : NSObject +/** + * This page contains how many AgoraMusic object + */ +@property(nonatomic, assign) NSInteger count; +/** + * Total number of this search result or total number of the type music sources + */ +@property(nonatomic, assign) NSInteger total; +/** + * This current page number + */ +@property(nonatomic, assign) NSInteger page; +/** + * This request page size + */ +@property(nonatomic, assign) NSInteger pageSize; +/** + * This music list of the request result + */ +@property(nonatomic, strong) NSArray* musicList; +@end + +/** + * The request event delegate callback + */ +@protocol AgoraMusicContentCenterEventDelegate +/** + * The music chart result callback; occurs when getMusicCharts method is called. + * + * @param requestId The request id is same as that returned by getMusicCharts. + * @param result The result of music chart collection + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onMusicChartsResult:(NSString *)requestId result:(NSArray *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode; + +/** + * Music collection, occurs when getMusicCollectionByMusicChartId or searchMusic method is called. + * + * @param requestId The request id is the same with that returned by getMusicCollectionByMusicChartId or searchMusic + * @param result The result of music collection + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onMusicCollectionResult:(NSString *)requestId result:(AgoraMusicCollection *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode; + +/** + * Lyric url callback of getLyric, occurs when getLyric is called + * + * @param requestId The request id is same as that returned by getLyric + * @param songCode Song code + * @param lyricUrl The lyric url of this music + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onLyricResult:(NSString*)requestId songCode:(NSInteger)songCode lyricUrl:(NSString* _Nullable)lyricUrl errorCode:(AgoraMusicContentCenterStatusCode)errorCode; + +/** + * Simple info callback of getSongSimpleInfo, occurs when getSongSimpleInfo is called + * + * @param requestId The request id is same as that returned by getSongSimpleInfo. + * @param songCode Song code + * @param simpleinfo The metadata of the music. + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onSongSimpleInfoResult:(NSString*)requestId songCode:(NSInteger)songCode simpleInfo:(NSString* _Nullable)simpleInfo errorCode:(AgoraMusicContentCenterStatusCode)errorCode; + +/** + * Preload process callback, occurs when preload is called + * + * @param requestId The request id is same as that returned by preload. + * @param songCode Song code + * @param percent Preload progress (0 ~ 100) + * @param lyricUrl The lyric url of this music + * @param status Preload status; see PreloadStatusCode. + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onPreLoadEvent:(NSString*)requestId songCode:(NSInteger)songCode percent:(NSInteger)percent lyricUrl:(NSString * _Nullable)lyricUrl status:(AgoraMusicContentCenterPreloadStatus)status errorCode:(AgoraMusicContentCenterStatusCode)errorCode; +@end + + +@class AgoraRtcEngineKit; +__attribute__((visibility("default"))) @interface AgoraMusicContentCenterConfig : NSObject +@property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine; +/** + * The app ID of the project that has enabled the music content center + */ +@property (nonatomic, copy) NSString *appId; +/** + * music content center need token to connect with server + */ +@property (nonatomic, copy) NSString *token; +/** + * The user ID when using music content center. It can be different from that of the rtc product. + */ +@property (nonatomic, assign) NSInteger mccUid; +/** + * The max number which the music content center caches cannot exceed 50. + */ +@property (nonatomic, assign) NSUInteger maxCacheSize; +/** + * The mccdomain, used to control the domain name of music contenter center,usually developer do not need to set it.Only under Tech supporter's help, can set the value + */ +@property(nonatomic, copy) NSString* mccDomain; +/** + * Event handler to get callback result. + */ +@property(nonatomic, weak) id eventDelegate; +@end + +@protocol AgoraMusicPlayerProtocol +/** + * Open a media file with specified parameters. + * + * @param songCode The identifier of the media file that you want to play. + * @param startPos The playback position (ms) of the music file. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (NSInteger)openMediaWithSongCode:(NSInteger)songCode startPos:(NSInteger)startPos NS_SWIFT_NAME(openMedia(songCode:startPos:)); +@end + + +__attribute__((visibility("default"))) @interface AgoraMusicContentCenter : NSObject + +/** + * Create an AgoraMusicContentCenter instance. + * + * @param config Configurations for the AgoraMusicContentCenter instance. For details, see AgoraMusicContentCenterConfig. + * @return An shared instance of AgoraMusicContentCenter +*/ ++ (instancetype _Nullable)sharedContentCenterWithConfig:(AgoraMusicContentCenterConfig *)config NS_SWIFT_NAME(sharedContentCenter(config:)); + +/** +* Renew token of music content center +* @param token The new token. +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (NSInteger)renewToken:(NSString * _Nonnull)token; + +/** + * Register an event delegate, only the last delegate is working. + * + * @param eventDelegate the object who need AgoraRtcMediaPlayerDelegate method to get the player information , + * if you want remove the delegate, just pass nil + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (NSInteger)registerEventDelegate:(id _Nullable)eventDelegate; + +/** + * Creates a music player source object and return its pointer. + * + * @param delegate The object who need AgoraRtcMediaPlayerDelegate method to get the player information + * @return + * - The pointer to an object who realize the AgoraMusicPlayerProtocol, if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ +- (id _Nullable)createMusicPlayerWithDelegate:(id _Nullable)delegate NS_SWIFT_NAME(createMusicPlayer(delegate:)); + +/** + * Get music chart collection of music.If the method call success, get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicChartsResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(NSArray *)result; match the callback "requestId" parameter to get the request result. + * + * @return The request identification + */ +- (NSString *)getMusicCharts; + +/** + * Get hot music list by hotType and page info.If the method call success, get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicCollectionResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(AgoraMusicCollection *)result; match the callback "requestId" parameter to get the request result. + * + * @param musicChartId The music chart id obtained from getMusicCharts. + * @param page The page of the music chart, starting from 1 + * @param pageSize The page size, max is 50. + * @param jsonOption The ext param, default is null. + * @return The request identification + */ +- (NSString *)getMusicCollectionWithMusicChartId:(NSInteger)musicChartId page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getMusicCollection(musicChartId:page:pageSize:jsonOption:)); + +/** + * Search music by keyword and page info. get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicCollectionResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(AgoraMusicCollection *)result; match the callback "requestId" parameter to get the request result. + * + * @param keyWord The key word to search. + * @param page The page of the music search result, starting from 1 + * @param pageSize The page size, max is 50. + * @param jsonOption The ext param, default is null. + * @return The request identification + */ +- (NSString *)searchMusicWithKeyWord:(NSString *)keyWord page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(searchMusic(keyWord:page:pageSize:jsonOption:)); + +/** + * Preload a media file with specified parameters. + * + * @deprecated This method is deprecated. Use preload(songCode:) instead. + * @param songCode The identify of the media file that you want to play. + * @param jsonOption The ext param, default is null. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (NSInteger)preloadWithSongCode:(NSInteger)songCode jsonOption:(NSString* _Nullable)jsonOption NS_SWIFT_NAME(preload(songCode:jsonOption:)) __attribute__((deprecated("Use preload(songCode:) instead."))); + +/** + * Preload a media file with specified parameters. + * + * @param songCode The identify of the media file that you want to play. + * @return The request identification + */ +- (NSString *)preloadWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(preload(songCode:)); + +/** + * Preload a media file with specified parameters. + * + * @param songCode The identify of the media file that you want to play. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (NSInteger)isPreloadedWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(isPreloaded(songCode:)); + +/** + * Remove a media file cache + * + * @param songCode The identifier of the media file that you want to play. + * @return + * - 0: Success; the cached media file is removed. + * - < 0: Failure. + */ +- (NSInteger)removeCacheWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(removeCache(songCode:)); + +/** + * Get media cache files. + * + * @return The caches Array contains songCode and status of the music. + */ +- (NSArray *)getCaches NS_SWIFT_NAME(getCaches()); + +/** + * Get internal songCodeKey from songCode and jsonOption + * + * @param songCode The identifier of the media file. + * @param jsonOption An extention parameter. The default value is null. it’s a json-format string and the `key` and `value` can be customized according to your scenarios. + * @return + * - Internal songCode key, if the method call succeeds. + * - The number less than zero, if the method call fails. + */ +- (NSInteger)getInternalSongCode:(NSInteger)songCode jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getInternalSongCode(songCode:jsonOption:)); + +/** + * Get lyric of the song. get result from the AgoraMusicContentCenterEventDelegate - (void)onLyricResult:(NSString*)requestId lyricUrl:(NSString*)lyricUrl; match the callback "requestId" parameter to get the request result. + * + * @param songCode The identify of the media file that you want to play. + * @param lyricType The type of the lyric file. may be 0:xml or 1:lrc. + * @return The request identification + */ +- (NSString *)getLyricWithSongCode:(NSInteger)songCode lyricType:(NSInteger)lyricType NS_SWIFT_NAME(getLyric(songCode:lyricType:)); + +/** + * Gets the metadata of a specific music. Once this method is called, the SDK triggers the onSongSimpleInfoResult callback to report the metadata of the music. + * + * @param songCode The identify of the media file that you want to play. + * @return The request identification + */ +- (NSString *)getSongSimpleInfoWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(getSongSimpleInfo(songCode:)); + +/** + * If you want AgoraMusicContentCenterEventDelegate methods callback in the mainThread ,you should set enable YES. Default the delegate callback in subthread. + * - `NO`: (Default)Send the delegate callback in subthread. + * - `YES`: Send the delegate callback in mainthread. + */ +- (void)enableMainQueueDispatch:(BOOL)enabled; + +/** + * Destroy the shared instance of AgoraMusicContentCenter + * + * @note If you call the method, you should call it brefore AgoraRtcEngineKit destroy + */ ++ (void)destroy; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraObjects.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraObjects.h new file mode 100644 index 0000000..18b3073 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraObjects.h @@ -0,0 +1,3284 @@ +// +// AgoraObjects.h +// AgoraRtcEngineKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#import +#import +#import "AgoraEnumerates.h" +#import "AgoraMediaFilterEventDelegate.h" + +#if TARGET_OS_IPHONE +#import +typedef UIView VIEW_CLASS; +typedef UIColor COLOR_CLASS; +typedef UIImage IMAGE_CLASS; +#elif TARGET_OS_MAC +#import +typedef NSView VIEW_CLASS; +typedef NSColor COLOR_CLASS; +typedef NSImage IMAGE_CLASS; +#endif + +@protocol AgoraRtcMediaPlayerProtocol; +/** + * @brief The player requests to read the data callback, you need to fill the specified length of data into the buffer + * @param playerKit the player instance. \ref AgoraRtcMediaPlayerProtocol. + * @param buffer the buffer pointer that you need to fill data. + * @param bufferSize the bufferSize need to fill of the buffer pointer. + * @return you need return offset value if succeed. return 0 if failed. + */ +typedef int(^AgoraRtcMediaPlayerCustomSourceOnReadCallback)(id _Nonnull playerKit, unsigned char * _Nullable buffer, int bufferSize); + +/** + * @brief The Player seek event callback, you need to operate the corresponding stream seek operation, You can refer to the definition of lseek() at https://man7.org/linux/man-pages/man2/lseek.2.html + * @param playerKit the player instance. \ref AgoraRtcMediaPlayerProtocol. + * @param offset the value of seek offset, + * @param whence the postion of start seeking, the directive whence as follows: + * SEEK_SET : The file offset is set to offset bytes. + * SEEK_CUR : The file offset is set to its current location plus offset bytes. + * SEEK_END : The file offset is set to the size of the file plus offset bytes. + * 65536 - AVSEEK_SIZE : Optional. Passing this as the "whence" parameter to a seek function causes it to return the filesize without seeking anywhere. + * @return + * whence == 65536, return filesize if you need. + * whence >= 0 && whence < 3 , return offset value if succeed. return -1 if failed. + */ +typedef long long(^AgoraRtcMediaPlayerCustomSourceOnSeekCallback)(id _Nonnull playerKit, long long offset, int whence); + +__attribute__((visibility("default"))) @interface AgoraMediaSource : NSObject +/** + * The URL of the media file that you want to play. + */ +@property(copy, nonatomic) NSString *_Nullable url; +/** + * The URI of the media file. + */ +@property(copy, nonatomic) NSString *_Nullable uri; +/** + * Set the starting position for playback, in seconds (ms) + */ +@property(assign, nonatomic) NSUInteger startPos; +/** + * Determines whether to autoplay after opening a media resource. + * - `YES`: (Default) Autoplay after opening a media resource. + * - `NO`: Do not autoplay after opening a media resource. + */ +@property(assign, nonatomic) BOOL autoPlay; +/** + * Determines whether to enable cache streaming to local files. If enable cached, the media player will + * use the url or uri as the cache index. + * + * @note + * The local cache function only supports on-demand video/audio streams and does not support live streams. + * Caching video and audio files based on the HLS protocol (m3u8) to your local device is not supported. + * + * - `YES`: Enable cache. + * - `NO`: (Default) Disable cache. + */ +@property(assign, nonatomic) BOOL enableCache; +/** + * Determines whether to enable multi-track audio stream decoding. + * Then you can select multi audio track of the media file for playback or publish to channel + * + * @note + * If you use the selectMultiAudioTrack API, you must set enableMultiAudioTrack to true. + * + * - `YES`: Enable MultiAudioTrack;. + * - `NO`: (Default) Disable MultiAudioTrack;. + */ +@property(assign, nonatomic) BOOL enableMultiAudioTrack; +/** + * Determines whether the opened media resource is a stream through the Agora Broadcast Streaming Network(CDN). + * - `YES`: It is a stream through the Agora Broadcast Streaming Network. + * - `NO`: (Default) It is not a stream through the Agora Broadcast Streaming Network. + */ +@property(assign, nonatomic) BOOL isAgoraSource; +/** + * Determines whether the opened media resource is a live stream. If is a live stream, it can speed up the opening of media resources. + * - `YES`: It is a live stream. + * - `NO`: (Default) It is not is a live stream. + */ +@property(assign, nonatomic) BOOL isLiveSource; +/** + * External custom data source callback + */ +@property(copy, nonatomic) AgoraRtcMediaPlayerCustomSourceOnReadCallback _Nonnull playerOnReadCallback; +@property(copy, nonatomic) AgoraRtcMediaPlayerCustomSourceOnSeekCallback _Nonnull playerOnSeekCallback; + +@end + +__attribute__((visibility("default"))) @interface AgoraMediaPlayerCacheStatistics : NSObject + +@property(assign, nonatomic) NSInteger fileSize; +@property(assign, nonatomic) NSInteger cacheSize; +@property(assign, nonatomic) NSInteger downloadSize; + +@end + +/** + * @brief player_id and device_id has value when user trigger interface of opening. + * + */ +__attribute__((visibility("default"))) @interface AgoraMediaPlayerUpdatedInfo : NSObject +@property(copy, nonatomic) NSString *_Nullable playerId; +@property(copy, nonatomic) NSString *_Nullable deviceId; +@property(strong, nonatomic) AgoraMediaPlayerCacheStatistics *_Nullable cacheStatistics; +@end + +/** + * @brief The information of the media stream object. + * + */ +__attribute__((visibility("default"))) @interface AgoraMediaPlayerSrcInfo : NSObject +/** + * The bitrate of the media stream. The unit of the number is kbps. + */ +@property(assign, nonatomic) int bitrateInKbps; +/** + * The name of the media stream. +*/ +@property(copy, nonatomic) NSString *_Nullable name; + +@end + + +/** + * The statistics of the Direct Cdn Streams. + */ +__attribute__((visibility("default"))) @interface AgoraDirectCdnStreamingStats : NSObject +/** + * Width of the video pushed by rtmp. + */ +@property(assign, nonatomic) NSUInteger videoWidth; +/** + * Height of the video pushed by rtmp. + */ +@property(assign, nonatomic) NSUInteger videoHeight; +/** + * The frame rate of the video pushed by rtmp. + */ +@property(assign, nonatomic) NSUInteger fps; +/** + * Real-time bit rate of the video streamed by rtmp. + */ +@property(assign, nonatomic) NSUInteger videoBitrate; +/** + * Real-time bit rate of the audio pushed by rtmp. + */ +@property(assign, nonatomic) NSUInteger audioBitrate; + +@end + +/** + * The cdn streaming media options. + */ +__attribute__((visibility("default"))) @interface AgoraDirectCdnStreamingMediaOptions : NSObject +/** + * Determines whether to publish the video of the camera track. + * - `YES`: Publish the video track of the camera capturer. + * - `NO`: (Default) Do not publish the video track of the camera capturer. + */ +@property(assign, nonatomic) BOOL publishCameraTrack; +/** + * Determines whether to publish the recorded audio. + * - `YES`: Publish the recorded audio. + * - `NO`: (Default) Do not publish the recorded audio. + */ +@property(assign, nonatomic) BOOL publishMicrophoneTrack; +/** + * Determines whether to publish the audio of the custom audio track. + * - `YES`: Publish the audio of the custom audio track. + * - `NO`: (Default) Do not publish the audio of the custom audio track. + */ +@property(assign, nonatomic) BOOL publishCustomAudioTrack; +/** + * Determines whether to publish the video of the custom video track. + * - `YES`: Publish the video of the custom video track. + * - `NO`: (Default) Do not publish the video of the custom video track. + */ +@property(assign, nonatomic) BOOL publishCustomVideoTrack; +/** + * Determines whether to publish the audio track of media player source. + * - `YES`: Publish the audio track of media player source. + * - `NO`: (Default) Do not publish the audio track of media player source. +*/ +@property(assign, nonatomic) BOOL publishMediaPlayerAudioTrack; +/** + * Determines which media player source should be published. + * This parameter get from function getMediaPlayerId() of AgoraMediaPlayer. +*/ +@property(assign, nonatomic) NSInteger publishMediaPlayerId; + +/** + * The custom video track id which will used to publish. + */ +@property(assign, nonatomic) NSInteger customVideoTrackId; + +@end + +/** + * The video encoded track options. + */ +__attribute__((visibility("default"))) @interface AgoraEncodedVideoTrackOptions : NSObject +/** + * Whether to enable CC mode. + * - TCC_ENABLED = 0: (Default) enable cc. + * - TCC_DISABLED = 1: disable cc. + */ +@property(assign, nonatomic) int ccMode; +/** + * The codec type used for the encoded images. + * - VIDEO_CODEC_VP8 = 1: VP8. + * - VIDEO_CODEC_H264 = 2: (Default) H.264. + * - VIDEO_CODEC_H265 = 3: H.265. + * - VIDEO_CODEC_VP9 = 5: VP9. + * - VIDEO_CODEC_GENERIC = 6: GENERIC. + * - VIDEO_CODEC_GENERIC_H264 = 7: GENERIC_H264. + * - VIDEO_CODEC_GENERIC_JPEG = 20: GENERIC_JPEG. + */ +@property(assign, nonatomic) int codecType; +/** + * Target bitrate (Kbps) for sending encoded video frame. + */ +@property(assign, nonatomic) int targetBitrate; +@end + +/** + * The channel media options. + */ +__attribute__((visibility("default"))) @interface AgoraRtcChannelMediaOptions : NSObject +/** + * Determines whether to publish the video of the camera track. + * - `YES`: (Default) Publish the video track of the camera capturer. + * - `NO`: Do not publish the video track of the camera capturer. + */ +@property(assign, nonatomic) BOOL publishCameraTrack; +/** + * Determines whether to publish the video of the secondary camera track. + * - `YES`: Publish the video track of the secondary camera capturer. + * - `NO`: (Default) Do not publish the video track of the secondary camera capturer. + */ +@property(assign, nonatomic) BOOL publishSecondaryCameraTrack; +/** + * Determines whether to publish the recorded audio of microphone. + * - `YES`: (Default) Publish the recorded audio of microphone. + * - `NO`: Do not publish the recorded audio of microphone. + */ +@property(assign, nonatomic) BOOL publishMicrophoneTrack; +#if TARGET_OS_IPHONE +/** + * Determines whether to publish the video of the screen capturer. + * - `YES`: Publish the video track of the screen capturer. + * - `NO`: (Default) Do not publish the video track of the screen capturer. + */ +@property(assign, nonatomic) BOOL publishScreenCaptureVideo; +/** + * Determines whether to publish the audio of the screen capturer. + * - `YES`: Publish the audio track of the screen capturer. + * - `NO`: (Default) Do not publish the audio track of the screen capturer. + */ +@property(assign, nonatomic) BOOL publishScreenCaptureAudio; +#elif TARGET_OS_MAC +/** + * Determines whether to publish the video of the third camera track. + * - `YES`: Publish the video track of the third camera capturer. + * - `NO`: (Default) Do not publish the video track of the third camera capturer. + */ +@property(assign, nonatomic) BOOL publishThirdCameraTrack; +/** + * Determines whether to publish the video of the fourth camera track. + * - `YES`: Publish the video track of the fourth camera capturer. + * - `NO`: (Default) Do not publish the video track of the fourth camera capturer. + */ +@property(assign, nonatomic) BOOL publishFourthCameraTrack; +/** + * Determines whether to publish the video of the screen capturer. + * - `YES`: Publish the video track of the screen capturer. + * - `NO`: (Default) Do not publish the video track of the screen capturer. + */ +@property(assign, nonatomic) BOOL publishScreenTrack; +/** + * Determines whether to publish the video of the secondary screen track. + * - `YES`: Publish the video track of the secondary screen capturer. + * - `NO`: (Default) Do not publish the video track of the secondary screen capturer. + */ +@property(assign, nonatomic) BOOL publishSecondaryScreenTrack; +/** + * Determines whether to publish the video of the third screen track. + * - `YES`: Publish the video track of the secondary third capturer. + * - `NO`: (Default) Do not publish the video track of the third screen capturer. + */ +@property(assign, nonatomic) BOOL publishThirdScreenTrack; +/** + * Determines whether to publish the video of the fourth screen track. + * - `YES`: Publish the video track of the secondary fourth capturer. + * - `NO`: (Default) Do not publish the video track of the fourth screen capturer. + */ +@property(assign, nonatomic) BOOL publishFourthScreenTrack; +#endif +/** + * Determines whether to publish the audio of the custom audio track. + * - `YES`: Publish the audio of the custom audio track. + * - `NO`: (Default) Do not publish the audio of the custom audio track. + */ +@property(assign, nonatomic) BOOL publishCustomAudioTrack; +/** + * The custom audio track id. The default value is 0. + */ +@property(assign, nonatomic) NSInteger publishCustomAudioTrackId; +/** + * Determines whether to publish AEC custom audio track. + * - `YES`: Publish AEC track. + * - `NO`: (Default) Do not publish AEC track. + */ +@property(assign, nonatomic) BOOL publishCustomAudioTrackAec; +/** + * Determines whether to publish the video of the custom video track. + * - `YES`: Publish the video of the custom video track. + * - `NO`: (Default) Do not publish the video of the custom video track. + */ +@property(assign, nonatomic) BOOL publishCustomVideoTrack; +/** + * Determines whether to publish the video of the encoded video track. + * - `YES`: Publish the video of the encoded video track. + * - `NO`: (Default) Do not publish the video of the encoded video track. + */ +@property(assign, nonatomic) BOOL publishEncodedVideoTrack; +/** + * Determines whether to publish the audio track of media player. + * - `YES`: Publish the audio track of media player. + * - `NO`: (Default) Do not publish the audio track of media player. + */ +@property(assign, nonatomic) BOOL publishMediaPlayerAudioTrack; +/** +* Determines whether to publish the video track of media player source. +* - `YES`: Publish the video track of media player source. +* - `NO`: (Default) Do not publish the video track of media player source. +*/ +@property(assign, nonatomic) BOOL publishMediaPlayerVideoTrack; +/** +* Determines whether to publish the local transcoded video track. +* - `YES`: Publish the video track of local transcoded video track. +* - `NO`: (Default) Do not publish the local transcoded video track. +*/ +@property(assign, nonatomic) BOOL publishTrancodedVideoTrack; +/** +* Determines whether to publish the local mixed audio track. +* - `YES`: Publish the audio track of local mixed audio track. +* - `NO`: (Default) Do not publish the local mixed audio track. +*/ +@property(assign, nonatomic) BOOL publishMixedAudioTrack; +/** + * Determines whether to subscribe all remote audio streams automatically. + * This property replaces calling \ref AgoraRtcEngineKit.setDefaultMuteAllRemoteAudioStreams: setDefaultMuteAllRemoteAudioStreams + * before joining a channel. + * - `YES`: (Default) Subscribe all remote audio streams automatically. + * - `NO`: Do not subscribe any remote audio stream automatically. + */ +@property(assign, nonatomic) BOOL autoSubscribeAudio; +/** + * Determines whether to subscribe all remote video streams automatically. + * This property replaces calling \ref AgoraRtcEngineKit.setDefaultMuteAllRemoteVideoStreams: setDefaultMuteAllRemoteVideoStreams + * before joining a channel. + * - `YES`: (Default) Subscribe all remote video streams automatically. + * - `NO`: Do not subscribe any remote video stream automatically. + */ +@property(assign, nonatomic) BOOL autoSubscribeVideo; +/** + * Determines whether to enable audio recording or playout. + * - `YES`: (Default) It's used to publish audio and mix microphone, or subscribe audio and playout. + * - `NO`: It's used to publish extenal audio frame only without mixing microphone, or no need audio device to playout audio either. + */ +@property(assign, nonatomic) BOOL enableAudioRecordingOrPlayout; +/** +* Determines which media player source should be published. +* This parameter get from function getMediaPlayerId() of AgoraMediaPlayer. +*/ +@property(assign, nonatomic) NSInteger publishMediaPlayerId; +/** + * The client role type: \ref AgoraClientRole. + * Default is AgoraClientRoleAudience. + */ +@property(assign, nonatomic) AgoraClientRole clientRoleType; +/** + * The audience latency level type: \ref AgoraAudienceLatencyLevelType. + * Default is AgoraAudienceLatencyLevelUltraLowLatency. + */ +@property(assign, nonatomic) AgoraAudienceLatencyLevelType audienceLatencyLevel; +/** + * The default video stream type: \ref AgoraVideoStreamType. + * Default is AgoraVideoStreamTypeHigh. + */ +@property(assign, nonatomic) AgoraVideoStreamType defaultVideoStreamType; +/** + * The channel profile: \ref AgoraChannelProfile. + * Default is AgoraChannelProfileLiveBroadcasting. + */ +@property(assign, nonatomic) AgoraChannelProfile channelProfile; +/** + * The delay in ms for sending audio frames. This is used for explicit control of A/V sync. + * To switch off the delay, set the value to zero. + */ +@property(assign, nonatomic) NSInteger audioDelayMs; +/** + * The delay in ms for sending media player audio frames. This is used for explicit control of A/V sync. + * To switch off the delay, set the value to zero. + */ +@property(assign, nonatomic) NSInteger mediaPlayerAudioDelayMs; +/** + * The token to be renewed. + */ +@property(copy, nonatomic) NSString * _Nullable token; +/** + * Enable media packet encryption. + * It will be ignored when calling function updateChannelMediaOptions(). + * - `YES`: Enable media packet encryption. + * - `NO`: (Default) Do not Enable media packet encryption. + */ +@property(assign, nonatomic) BOOL enableBuiltInMediaEncryption; + +/** + * Determines whether to publish the sound of the rhythm player to remote users. + * - true: (Default) Publish the sound of the rhythm player. + * - false: Do not publish the sound of the rhythm player. + */ +@property(assign, nonatomic) BOOL publishRhythmPlayerTrack; +/** + * This mode is only used for audience. In PK mode, client might join one + * channel as broadcaster, and join another channel as interactive audience to + * achieve low lentancy and smooth video from remote user. + * - `YES`: Enable low lentancy and smooth video when joining as an audience. + * - `NO`: (default) Use default settings for audience role. + */ +@property(assign, nonatomic) BOOL isInteractiveAudience; + +/** + * The custom video track id which will used to publish or preview. + */ +@property(assign, nonatomic) NSInteger customVideoTrackId; + +/** + * Determines whether local audio stream can be filtered. + * - `YES`: (Default) Can be filtered when audio level is low. + * - `NO`: Do not filter this audio stream. + */ +@property(assign, nonatomic) BOOL isAudioFilterable; + +/** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + */ +@property(copy, nonatomic) NSString * _Nullable parameters; + +@end + +/** Properties of the video canvas object. + */ +__attribute__((visibility("default"))) @interface AgoraRtcVideoCanvas : NSObject +/** + *The video display view. The SDK does not maintain the lifecycle of the view. + * + *The view can be safely released after calling [leaveChannel]([AgoraRtcEngineKit + *leaveChannel:]) with a returned value. The SDK keeps a cache of the view value, so calling + *[setupLocalVideo]([AgoraRtcEngineKit setupLocalVideo:]) to set the view value to nil can + *clear the cache before switching or releasing the view. + */ +@property(strong, nonatomic) VIEW_CLASS *_Nullable view; +/** + * The user id of local video. + */ +@property(assign, nonatomic) NSUInteger uid; + +@property(assign, nonatomic) NSUInteger subviewUid; + +/** + * The video render mode. See \ref AgoraVideoRenderMode. + * The default value is AgoraVideoRenderModeHidden. + */ +@property(assign, nonatomic) AgoraVideoRenderMode renderMode; +/** + * The video mirror mode. See \ref AgoraVideoMirrorMode. + * The default value is AgoraVideoMirrorModeAuto. + * @note + * - For the mirror mode of the local video view: + * If you use a front camera, the SDK enables the mirror mode by default; + * if you use a rear camera, the SDK disables the mirror mode by default. + * - For the remote user: The mirror mode is disabled by default. + */ +@property(assign, nonatomic) AgoraVideoMirrorMode mirrorMode; +/** + * The mode of setting up video view. See \ref AgoraVideoViewSetupMode. + * The default value is AgoraVideoViewSetupReplace. + */ +@property(assign, nonatomic) AgoraVideoViewSetupMode setupMode; +/** + * The video source type. See \ref AgoraVideoSourceType + * The default value is AgoraVideoSourceTypeCamera. + */ +@property(nonatomic, assign) AgoraVideoSourceType sourceType; +/** + * The media player id of AgoraMediaPlayer. It should set this parameter when the + * sourceType is AgoraVideoSourceTypeMediaPlayer to show the video that AgoraMediaPlayer is playing. + * You can get this value by calling the method \ref getMediaPlayerId(). + */ +@property(nonatomic, assign) int mediaPlayerId; +/** + * If you want to display a certain part of a video frame, you can set + * this value to crop the video frame to show. + * The default value is empty(that is, if it has zero width or height), which means no cropping. + */ +@property(assign, nonatomic) CGRect cropArea; +/** + * default NO. if set to YES, the video will apply alpha mask if exist.(Mac only) + */ +@property(assign, nonatomic) BOOL enableAlphaMask; + +@end + +/** + * The configurations for the last-mile network probe test. + */ +__attribute__((visibility("default"))) @interface AgoraLastmileProbeConfig : NSObject +/** + * Sets whether or not to test the uplink network. + * + * Some users, for example, the audience in a live-broadcast channel, do not need such a test. + * - `YES`: Enables the test. + * - `NO`: Disables the test. + */ +@property (assign, nonatomic) BOOL probeUplink; +/** + * Sets whether or not to test the downlink network. + * - `YES`: Enables the test. + * - `NO`: Disables the test. + */ +@property (assign, nonatomic) BOOL probeDownlink; +/** + * Sets the expected maximum sending bitrate (bps) of the local user. + * + * The value ranges between 100000 and 5000000. Agora recommends + * setting this value according to the required bitrate of selected video profile. + */ +@property (assign, nonatomic) NSUInteger expectedUplinkBitrate; +/** + * Sets the expected maximum receiving bitrate (bps) of the local user. + * The value ranges between 100000 and 5000000. + */ +@property (assign, nonatomic) NSUInteger expectedDownlinkBitrate; +@end + +/** + * The one-way last-mile probe result. + */ +__attribute__((visibility("default"))) @interface AgoraLastmileProbeOneWayResult : NSObject +/** + * The packet loss rate (%). + */ +@property (assign, nonatomic) NSUInteger packetLossRate; +/** + * The network jitter (ms). + */ +@property (assign, nonatomic) NSUInteger jitter; +/** + * The estimated available bandwidth (bps). + */ +@property (assign, nonatomic) NSUInteger availableBandwidth; +@end + +/** + * Statistics of the last-mile probe. + */ +__attribute__((visibility("default"))) @interface AgoraLastmileProbeResult : NSObject +/** + * The state of the probe test. + * See \ref AgoraLastmileProbeResultState. + */ +@property (assign, nonatomic) AgoraLastmileProbeResultState state; +/** + * The round-trip delay time (ms). + */ +@property (assign, nonatomic) NSUInteger rtt; +/** + * The uplink last-mile network report. + * + * See \ref AgoraLastmileProbeOneWayResult. + */ +@property (strong, nonatomic) AgoraLastmileProbeOneWayResult *_Nonnull uplinkReport; +/** + * The downlink last-mile network report. + * + * See \ref AgoraLastmileProbeOneWayResult. + */ +@property (strong, nonatomic) AgoraLastmileProbeOneWayResult *_Nonnull downlinkReport; +@end + + +/** + * The statistics of the local video stream. + */ +__attribute__((visibility("default"))) @interface AgoraRtcLocalVideoStats : NSObject +/** + * Bitrate (Kbps) sent in the reported interval, which does not include + * the bitrate of the retransmission video after packet loss. + */ +@property(assign, nonatomic) NSUInteger sentBitrate; +/** + * Frame rate (fps) sent in the reported interval, which does not include + * the frame rate of the retransmission video after packet loss. + */ +@property(assign, nonatomic) NSUInteger sentFrameRate; +/** + * ID of the local user. + */ +@property(assign, nonatomic) NSUInteger uid; + +/** The capture frame rate (fps) of the local video. + */ +@property(assign, nonatomic) NSInteger captureFrameRate; +/** The width of the capture frame (px). + */ +@property(assign, nonatomic) NSInteger captureFrameWidth; +/** The height of the capture frame (px). + */ +@property(assign, nonatomic) NSInteger captureFrameHeight; +/** + * The regulated frame rate of capture frame rate according to video encoder configuration. + */ +@property(assign, nonatomic) NSInteger regulatedCaptureFrameRate; +/** + * The regulated frame width (pixel) of capture frame width according to video encoder configuration. + */ +@property(assign, nonatomic) NSInteger regulatedCaptureFrameWidth; +/** + * The regulated frame height (pixel) of capture frame height according to video encoder configuration. + */ +@property(assign, nonatomic) NSInteger regulatedCaptureFrameHeight; + +/** The encoder output frame rate (fps) of the local video. + */ +@property(assign, nonatomic) NSInteger encoderOutputFrameRate; +/** The render output frame rate (fps) of the local video. + */ +@property(assign, nonatomic) NSInteger rendererOutputFrameRate; +/** The target frame rate (fps) of the current encoder. + */ +@property(assign, nonatomic) NSInteger targetFrameRate; +/** Quality change of the local video in terms of target frame rate and target bit rate in this reported interval, see [AgoraVideoQualityAdaptIndication](AgoraVideoQualityAdaptIndication). */ +@property(assign, nonatomic) AgoraVideoQualityAdaptIndication qualityAdaptIndication; +/** + * The target bitrate (Kbps) of the current encoder. This value is + * estimated by the SDK based on the current network conditions. + */ +@property(assign, nonatomic) NSInteger targetBitrate; +/** + * The encoding bitrate (Kbps), which does not include the bitrate of the + * re-transmission video after packet loss. + */ +@property(assign, nonatomic) NSInteger encodedBitrate; +/** + * The width of the encoding frame (px). + */ +@property(assign, nonatomic) NSInteger encodedFrameWidth; +/** + * The height of the encoding frame (px). + */ +@property(assign, nonatomic) NSInteger encodedFrameHeight; +/** + * The number of the sent frames, represented by an aggregate value. + */ +@property(assign, nonatomic) NSInteger encodedFrameCount; +/** + * The codec type of the local video: + * - VIDEO_CODEC_VP8 = 1: VP8. + * - VIDEO_CODEC_H264 = 2: (Default) H.264. + */ +@property(assign, nonatomic) AgoraVideoCodecType codecType; +/** + * The hw_encoder_accelerating of the local video: + * - hwEncoderAccelerating = 0: the encoder is software + * - hwEncoderAccelerating = 1: the encoder is hardware + */ +@property(assign, nonatomic) AgoraVideoHwEncoderAccelerating hwEncoderAccelerating; +/** + * The video packet loss rate (%) from the local client to the Agora edge server before applying the anti-packet loss strategies. + */ +@property(assign, nonatomic) NSInteger txPacketLossRate; +/** + * The brightness level of the video image captured by the local camera. See AgoraCaptureBrightnessLevelType. + */ +@property(assign, nonatomic) AgoraCaptureBrightnessLevelType captureBrightnessLevel NS_SWIFT_NAME(captureBrightnessLevel); +/** + * Whether we send dual stream now. + */ +@property(assign, nonatomic) BOOL dualStreamEnabled; +@end + +/** Statistics of the remote video stream. */ +__attribute__((visibility("default"))) @interface AgoraRtcRemoteVideoStats : NSObject +/** + * ID of the remote user sending the video stream. + */ +@property(assign, nonatomic) NSUInteger uid; +/** Time delay (ms). + */ +@property(assign, nonatomic) NSUInteger delay __deprecated; +/** Width (pixels) of the video stream. + */ +@property(assign, nonatomic) NSUInteger width; +/** Height (pixels) of the video stream. + */ +@property(assign, nonatomic) NSUInteger height; +/** Data receive bitrate (Kbps) since last count. + */ +@property(assign, nonatomic) NSUInteger receivedBitrate; +/** Data receive frame rate (fps) since last count. + */ +@property(assign, nonatomic) NSUInteger receivedFrameRate; +/** Video stream type; high- or low-video stream. + */ +@property(assign, nonatomic) AgoraVideoStreamType rxStreamType; + +/** The decoder output frame rate (fps) of the remote video. + */ +@property(assign, nonatomic) NSInteger decoderOutputFrameRate; +/** The render output frame rate (fps) of the remote video. + */ +@property(assign, nonatomic) NSInteger rendererOutputFrameRate; +/** The video frame loss rate (%) of the remote video stream in the reported interval. + */ +@property(assign, nonatomic) NSInteger frameLossRate; +/** Packet loss rate (%) of the remote video stream after using the anti-packet-loss method. + */ +@property(assign, nonatomic) NSInteger packetLossRate; +/** + The total freeze time (ms) of the remote video stream after the remote user joins the channel. + In a video session where the frame rate is set to no less than 5 fps, video freeze occurs when + the time interval between two adjacent renderable video frames is more than 500 ms. + */ +@property(assign, nonatomic) NSInteger totalFrozenTime; +/** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ +@property(assign, nonatomic) NSUInteger totalActiveTime; +/** + * The total publish duration (ms) of the remote audio stream. + */ +@property(assign, nonatomic) NSInteger publishDuration; +/** + The total video freeze time as a percentage (%) of the total time when the video is available. + */ +@property(assign, nonatomic) NSInteger frozenRate; +/** + The offset (ms) between audio and video stream. A positive value indicates the audio leads the + video, and a negative value indicates the audio lags the video. + */ +@property(assign, nonatomic) NSInteger avSyncTimeMs; +/** + * The quality of the remote video stream in the reported interval. + * The quality is determined by the Agora real-time video MOS (Mean Opinion Score) measurement method. + * The return value range is [0, 500]. + * Dividing the return value by 100 gets the MOS score, which ranges from 0 to 5. The higher the score, the better the video quality. + * @note For textured video data, this parameter always returns 0. + */ +@property(assign, nonatomic) NSInteger mosValue; +/** + * Total number of video bytes received (bytes), represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxVideoBytes; + +@end + +/** + * The statistics of the local audio. + */ +__attribute__((visibility("default"))) @interface AgoraRtcLocalAudioStats : NSObject +/** + * The number of audio channels. + */ +@property(assign, nonatomic) NSUInteger numChannels; +/** + * The sample rate (Hz). + */ +@property(assign, nonatomic) NSUInteger sentSampleRate; +/** + * The average sending bitrate (Kbps). + */ +@property(assign, nonatomic) NSUInteger sentBitrate; +/** The internal payload type. + */ +@property(assign, nonatomic) NSUInteger internalCodec; +/** The audio packet loss rate (%) from the local client to the Agora edge server before applying the anti-packet loss strategies. + */ +@property(assign, nonatomic) NSUInteger txPacketLossRate; +/** + * The audio delay of the device, contains record and playout delay + */ +@property(assign, nonatomic) NSUInteger audioDeviceDelay; +/** + * The audio playout delay of the device + */ +@property(assign, nonatomic) NSUInteger audioPlayoutDelay; +/** + * The estimated delay of audio in-ear monitoring + */ +@property(assign, nonatomic) NSUInteger earMonitorDelay; +/** + * The estimated signal delay (ms) from AEC nearin and farin + */ +@property(assign, nonatomic) NSUInteger aecEstimatedDelay; +/** + * The AIMD result + */ +@property(assign, nonatomic) NSInteger aedMusicRes; +/** + * The AIVAD result + */ +@property(assign, nonatomic) NSInteger aedVoiceRes; + +@end + +/** + * The statistics of the remote audio. + */ +__attribute__((visibility("default"))) @interface AgoraRtcRemoteAudioStats : NSObject +/** + * ID of the user sending the audio stream. + */ +@property(assign, nonatomic) NSUInteger uid; +/** + * The receiving audio quality. + * + * - 0: The quality is unknown. + * - 1: The quality is excellent. + * - 2: The quality is quite good, but the bitrate may be slightly + * lower than excellent. + * - 3: Users can feel the communication slightly impaired. + * - 4: Users can communicate not very smoothly. + * - 5: The quality is so bad that users can barely communicate. + * - 6: The network is disconnected and users cannot communicate at all. + */ +@property(assign, nonatomic) NSUInteger quality; +/** + * The network delay (ms) from the sender to the receiver. + */ +@property(assign, nonatomic) NSUInteger networkTransportDelay; +/** + * The jitter buffer delay (ms) at the receiver. + */ +@property(assign, nonatomic) NSUInteger jitterBufferDelay; +/** + * The packet loss rate in the reported interval. + */ +@property(assign, nonatomic) NSUInteger audioLossRate; +/** + * The number of audio channels. + */ +@property(assign, nonatomic) NSUInteger numChannels; +/** + * The sample rate (Hz) of the received audio stream, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger receivedSampleRate; +/** + * The bitrate (Kbps) of the received audio stream, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger receivedBitrate; +/** + * The total freeze time (ms) of the remote audio stream after the remote user joins the channel. + * In a session, audio freeze occurs when the audio frame loss rate reaches 4% within two seconds. + * Agora uses 2 seconds as an audio piece unit to calculate the audio freeze time. + * The total audio freeze time = The audio freeze number × 2 seconds + */ +@property(assign, nonatomic) NSUInteger totalFrozenTime; +/** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ +@property(assign, nonatomic) NSUInteger totalActiveTime; +/** + * The total publish duration (ms) of the remote audio stream. + */ +@property(assign, nonatomic) NSInteger publishDuration; +/** + * The total audio freeze time as a percentage (%) of the total time when the audio is available. + */ +@property(assign, nonatomic) NSUInteger frozenRate; +/** + * The quality of the remote audio stream as determined by the Agora real-time + * audio MOS (Mean Opinion Score) measurement method in the reported interval. + * The return value ranges from 0 to 500. Dividing the return value by 100 gets + * the MOS score, which ranges from 0 to 5. The higher the score, the better the audio quality. + * + * The subjective perception of audio quality corresponding to the Agora real-time audio MOS scores is as follows: + * + * | MOS score | Perception of audio quality | + * | :------------- | :----------------------------------------------------------- | + * | Greater than 4 | Excellent. The audio sounds clear and smooth. | + * | From 3.5 to 4 | Good. The audio has some perceptible impairment, but still sounds clear. | + * | From 3 to 3.5 | Fair. The audio freezes occasionally and requires attentive listening. | + * | From 2.5 to 3 | Poor. The audio sounds choppy and requires considerable effort to understand. | + * | From 2 to 2.5 | Bad. The audio has occasional noise. Consecutive audio dropouts occur, resulting in some information loss. The users can communicate only with difficulty. | + * | Less than 2 | Very bad. The audio has persistent noise. Consecutive audio dropouts are frequent, resulting in severe information loss. Communication is nearly impossible. | + */ +@property(assign, nonatomic) NSUInteger mosValue; +/** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. + */ +@property(assign, nonatomic) AgoraExperienceQuality qoeQuality; +/** + * The reason for poor QoE of the local user when receiving a remote audio stream. See #EXPERIENCE_POOR_REASON. + */ +@property(assign, nonatomic) AgoraExperiencePoorReason qualityChangedReason; +/** + * Total number of audio bytes received (bytes) before network countermeasures, represented by + * an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxAudioBytes; +/** + * The end-to-end delay (ms) from the sender to the receiver. + */ +@property(assign, nonatomic) NSInteger e2eDelay; +@end + +/** Properties of the audio volume information. + */ +__attribute__((visibility("default"))) @interface AgoraRtcAudioVolumeInfo : NSObject +/** User ID of the speaker. + */ +@property(assign, nonatomic) NSUInteger uid; +/** The volume of the speaker that ranges from 0 (lowest volume) to 255 (highest volume). + */ +@property(assign, nonatomic) NSUInteger volume; + +@property(assign, nonatomic) NSUInteger vad; + +/** Voice pitch frequency in Hz. + */ +@property (assign, nonatomic) double voicePitch; + +@end + +/** + * The Statistics of the channel. + */ +__attribute__((visibility("default"))) @interface AgoraChannelStats : NSObject +/** + * The call duration in seconds, represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger duration; +/** + * The total number of bytes transmitted, represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger txBytes; +/** + * The total number of bytes received, represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxBytes; +/** + * The audio transmission bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger txAudioKBitrate; +/** + * The audio receiving bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger rxAudioKBitrate; +/** + * The video transmission bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger txVideoKBitrate; +/** + * The video receiving bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger rxVideoKBitrate; +/** + * Total number of audio bytes sent (bytes), represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger txAudioBytes; +/** + * Total number of video bytes sent (bytes), represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger txVideoBytes; +/** + * Total number of audio bytes received (bytes) before network countermeasures, represented by + * an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxAudioBytes; +/** + * Total number of video bytes received (bytes), represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxVideoBytes; +/** + * The client-server latency (ms). + */ +@property(assign, nonatomic) NSUInteger lastmileDelay; +/** + * The number of users in the channel. + */ +@property(assign, nonatomic) NSUInteger userCount; +/** Application CPU usage (%). + */ +@property(assign, nonatomic) double cpuAppUsage; +/** System CPU usage (%). + */ +@property(assign, nonatomic) double cpuTotalUsage; +/** Gateway Rtt. + */ +@property(assign, nonatomic) NSInteger gatewayRtt; +/** + * The memory usage ratio of the app (%). + */ +@property(assign, nonatomic) double memoryAppUsageRatio; +/** + * The memory usage ratio of the system (%). + */ +@property(assign, nonatomic) double memoryTotalUsageRatio; +/** + * The memory usage of the app (KB). + */ +@property(assign, nonatomic) NSInteger memoryAppUsageInKbytes; +/** + * The time interval (ms) between establishing the connection and the connection succeeds, 0 if not valid. + */ +@property(assign, nonatomic) NSInteger connectTimeMs; + +/** + * The transmission bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger txKBitrate; +/** + * The receiving bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger rxKBitrate; + +/**The duration(ms) between first audio packet received and connection start, 0 if not valid + */ +@property(assign, nonatomic) NSInteger firstAudioPacketDuration; +/** The duration(ms) between first video packet received and connection start, 0 if not valid + */ +@property(assign, nonatomic) NSInteger firstVideoPacketDuration; +/** The duration(ms) between first video key frame received and connection start, 0 if not valid + */ +@property(assign, nonatomic) NSInteger firstVideoKeyFramePacketDuration; +/** Video packet number before first video key frame received, 0 if not valid + */ +@property(assign, nonatomic) NSInteger packetsBeforeFirstKeyFramePacket; +/** + * The packet loss rate of sender(broadcaster). + */ +@property(assign, nonatomic) NSInteger txPacketLossRate; +/** + * The packet loss rate of receiver(audience). + */ +@property(assign, nonatomic) NSInteger rxPacketLossRate; + +@end +/** Properties of the video encoder configuration. +*/ +__attribute__((visibility("default"))) @interface AgoraAdvancedVideoOptions : NSObject +/** +* The video encoder encodingPreference hard or soft +*/ +@property(assign, nonatomic) AgoraEncodingPreference encodingPreference; + +/** The video compression preference. */ +@property(assign, nonatomic) AgoraCompressionPreference compressionPreference; + +@end + +__attribute__((visibility("default"))) @interface AgoraVideoCodecCapLevels : NSObject + +@property(assign, nonatomic) AgoraVideoCodecCapabilityLevel hwDecodingLevel; +@property(assign, nonatomic) AgoraVideoCodecCapabilityLevel swDecodingLevel; + +@end + +/** + * The codec support information. +*/ +__attribute__((visibility("default"))) @interface AgoraVideoCodecCapInfo : NSObject + +/** The codec type. */ +@property(assign, nonatomic) AgoraVideoCodecType codecType; +/** The codec type mask. bit 1 Hardware decoder support flag, bit 2: Hardware encoder support flag, + * bit 3: Software decoder support flag, bit 4: Software encoder support flag */ +@property(assign, nonatomic) NSUInteger codecCapMask; + +/** The codec capability level, estimated based on the device hardware.*/ +@property(strong, nonatomic) AgoraVideoCodecCapLevels *_Nonnull codecCapLevels; + +@end +/** Properties of the video encoder configuration. + */ +__attribute__((visibility("default"))) @interface AgoraVideoEncoderConfiguration : NSObject +/** Video resolution that can be set manually or by choosing from one of the following + enumerations, the default value is 960x540: + + - AgoraVideoDimension120x120 + - AgoraVideoDimension160x120 + - AgoraVideoDimension180x180 + - AgoraVideoDimension240x180 + - AgoraVideoDimension320x180 + - AgoraVideoDimension240x240 + - AgoraVideoDimension320x240 + - AgoraVideoDimension424x240 + - AgoraVideoDimension360x360 + - AgoraVideoDimension480x360 + - AgoraVideoDimension640x360 + - AgoraVideoDimension480x480 + - AgoraVideoDimension640x480 + - AgoraVideoDimension840x480 + - AgoraVideoDimension960x540 + - AgoraVideoDimension960x720 + - AgoraVideoDimension1280x720 + - AgoraVideoDimension1920x1080 + - AgoraVideoDimension2540x1440 + - AgoraVideoDimension3840x2160 + + @note Whether 720p can be supported depends on the device. If the device cannot support 720p, + the frame rate will be lower than the one listed in the table. Agora optimizes the video in + lower-end devices. Contact mailto:support@agora.io for special requirements. + */ +@property(assign, nonatomic) CGSize dimensions; + +/** Codec type. See \ref AgoraVideoCodecType. + */ +@property(assign, nonatomic) AgoraVideoCodecType codecType; + +/** Frame rate of the video: AgoraVideoFrameRate + */ +@property(assign, nonatomic) AgoraVideoFrameRate frameRate; + +/** Bitrate of the video: + + Refer to AgoraVideoProfile and set your desired bitrate. If the bitrate you set is beyond the + proper range, the SDK will automatically adjust it to a value within the range. You can also choose + from the following options: + + - AgoraVideoBitrateStandard: + + - The standard bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit + setVideoEncoderConfiguration:]). - (Recommended) In a live broadcast, Agora recommends setting a + larger bitrate to improve the video quality. When you choose AgoraVideoBitrateStandard, the bitrate + value doubles in a live broadcast mode, and remains the same as in AgoraVideoProfile in a + communication mode. + + - AgoraVideoBitrateCompatible: + + - The compatible bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit + setVideoEncoderConfiguration:]). - The bitrate in both the live broadcast and communication modes + remain the same as in AgoraVideoProfile. + */ +@property(assign, nonatomic) NSInteger bitrate; + +@property(assign, nonatomic) NSInteger minBitrate; + +/** Video orientation mode of the video: AgoraVideoOutputOrientationMode. + */ +@property(assign, nonatomic) AgoraVideoOutputOrientationMode orientationMode; + +/** Video mirror mode of the video: AgoraVideoMirrorMode. + */ +@property(assign, nonatomic) AgoraVideoMirrorMode mirrorMode; + +/** The video encoding degradation preference under limited bandwidth. + +AgoraDegradationPreference: + +* AgoraDegradationMaintainQuality(0): (Default) Degrades the frame rate to guarantee the video quality. +* AgoraDegradationMaintainFramerate(1): Degrades the video quality to guarantee the frame rate. +*/ +@property (assign, nonatomic) AgoraDegradationPreference degradationPreference; + +/** The video hardwareEncoding. */ +@property (strong, nonatomic) AgoraAdvancedVideoOptions *_Nullable advancedVideoOptions; + +/** Initializes and returns a newly allocated AgoraVideoEncoderConfiguration object with the + specified video resolution. + + @param size Video resolution + @param frameRate Video frame rate + @param bitrate Video bitrate + @param orientationMode AgoraVideoOutputOrientationMode + @param mirrorMode AgoraVideoMirrorMode + @return An initialized AgoraVideoEncoderConfiguration object + */ +- (instancetype _Nonnull)initWithSize:(CGSize)size + frameRate:(AgoraVideoFrameRate)frameRate + bitrate:(NSInteger)bitrate + orientationMode:(AgoraVideoOutputOrientationMode)orientationMode + mirrorMode:(AgoraVideoMirrorMode)mirrorMode NS_SWIFT_NAME(init(size:frameRate:bitrate:orientationMode:mirrorMode:)); + +/** Initializes and returns a newly allocated AgoraVideoEncoderConfiguration object with the + specified video width and height. + + @param width Width of the video + @param height Height of the video + @param frameRate Video frame rate + @param bitrate Video bitrate + @param orientationMode AgoraVideoOutputOrientationMode + @param mirrorMode AgoraVideoMirrorMode + @return An initialized AgoraVideoEncoderConfiguration object + */ +- (instancetype _Nonnull)initWithWidth:(NSInteger)width + height:(NSInteger)height + frameRate:(AgoraVideoFrameRate)frameRate + bitrate:(NSInteger)bitrate + orientationMode:(AgoraVideoOutputOrientationMode)orientationMode + mirrorMode:(AgoraVideoMirrorMode)mirrorMode NS_SWIFT_NAME(init(width:height:frameRate:bitrate:orientationMode:mirrorMode:)); +@end + +/** A class for providing user-specific audio/video transcoding settings. + */ +__attribute__((visibility("default"))) @interface AgoraLiveTranscodingUser : NSObject +/** User ID. + */ +@property(assign, nonatomic) NSUInteger uid; +/** Position and size of the video frame. + */ +@property(assign, nonatomic) CGRect rect; +/** Video frame layer number, in the range of 1 to 100. + + * 1: The video frame image is in the lowest layer (default) + * 100: The video frame image is in the highest layer + */ +@property(assign, nonatomic) NSInteger zOrder; +/** Transparency of the video frame, between 0 and 1.0: + + * 0: Completely transparent + * 1.0: Opaque (default) + */ +@property(assign, nonatomic) double alpha; +/** The audio channel of the sound. The default value is 0: + + * 0: (default) Supports dual channels at most, depending on the upstream of the broadcaster. + * 1: The audio stream of the broadcaster is in the FL audio channel. If the upstream of the + broadcaster uses dual-sound channel, only the left-sound channel will be used for streaming. * 2: + The audio stream of the broadcaster is in the FC audio channel. If the upstream of the broadcaster + uses dual-sound channel, only the left-sound channel will be used for streaming. * 3: The audio + stream of the broadcaster is in the FR audio channel. If the upstream of the broadcaster uses + dual-sound channel, only the left-sound channel will be used for streaming. * 4: The audio stream + of the broadcaster is in the BL audio channel. If the upstream of the broadcaster uses dual-sound + channel, only the left-sound channel will be used for streaming. * 5: The audio stream of the + broadcaster is in the BR audio channel. If the upstream of the broadcaster uses dual-sound channel, + only the left-sound channel will be used for streaming. + */ +@property(assign, nonatomic) NSInteger audioChannel; +@end + +/** The configuration for advanced features of the RTMP or RTMPS streaming with transcoding. + */ +__attribute__((visibility("default"))) @interface AgoraLiveStreamAdvancedFeature : NSObject + +/** The name of the advanced feature, including the following: + + - LBHQ: The advanced feature for high-quality video with a lower bitrate. + - VEO: The advanced feature for the optimized video encoder. +*/ +@property(copy, nonatomic) NSString* _Nullable featureName; + +/** Whether to enable the advanced feature: + + - YES: Enable the advanced feature. + - NO: (Default) Disable the advanced feature. + */ +@property(assign, nonatomic) BOOL opened; +@end + +/** Watermark image properties. + */ +__attribute__((visibility("default"))) @interface AgoraImage : NSObject +/** URL address of the watermark on the broadcasting video + */ +@property(strong, nonatomic) NSURL *_Nonnull url; +/** Position and size of the watermark on the broadcasting video in CGRect + */ +@property(assign, nonatomic) CGRect rect; +/** + * Order attribute for an ordering of overlapping two-dimensional objects. +*/ +@property (assign, nonatomic) NSInteger zOrder; +/** The transparency level of the image. + + The value ranges between 0.0 and 1.0: + + * 0.0: Completely transparent. + * 1.0: (Default) Opaque. + */ +@property(assign, nonatomic) double alpha; +@end + +/** The options of the watermark image to be added. + */ +__attribute__((visibility("default"))) @interface WatermarkOptions : NSObject +/** Sets whether or not the watermark image is visible in the local video preview: + + - YES: (Default) The watermark image is visible in preview. + - NO: The watermark image is not visible in preview. + */ +@property(assign, nonatomic) BOOL visibleInPreview; +/** The watermark position in landscape mode of *Rotate the Video*. This parameter contains the following members: + + - `x`: The horizontal offset of the watermark from the top-left corner. + - `y`: The vertical offset of the watermark from the top-left corner. + - `width`: The width (pixel) of the watermark region. + - `height`: The height (pixel) of the watermark region. + */ +@property(assign, nonatomic) CGRect positionInLandscapeMode; +/** The watermark position in portrait mode of *Rotate the Video*. This parameter contains the following members: + + - `x`: The horizontal offset of the watermark from the top-left corner. + - `y`: The vertical offset of the watermark from the top-left corner. + - `width`: The width (pixel) of the watermark region. + - `height`: The height (pixel) of the watermark region. + */ +@property(assign, nonatomic) CGRect positionInPortraitMode; +@end + +/** A class for managing CDN transcoding. + */ +__attribute__((visibility("default"))) @interface AgoraLiveTranscoding : NSObject +/** The size of the video (width and height in pixels). + +- When pushing video streams to the CDN, note the following: + + - The value range of the width is [64,1920]. If the value is less than 64, + Agora server automatically adjusts it to 64; if the value is greater than + 1920, Agora server automatically adjusts it to 1920. + - The value range of the height is [64,1080]. If the value is less than 64, + Agora server automatically adjusts it to 64; if the value is greater than + 1080, Agora server automatically adjusts it to 1080. + +- When pushing audio streams to the CDN, set the width and height as 0. + */ +@property(assign, nonatomic) CGSize size; +/** Bitrate of the CDN live output video stream. + +The default value is 400 Kbps. + +Set this parameter according to the Video Bitrate Table. If you set a bitrate beyond the proper range, the SDK automatically adapts it to a value within the range. + */ +@property(assign, nonatomic) NSInteger videoBitrate; +/** Frame rate of the CDN live output video stream. + +The default value is 15 fps, and the value range is (0,30]. + + @note The Agora server adjusts any value over 30 to 30. + */ +@property(assign, nonatomic) NSInteger videoFramerate; +/** Latency mode. **DEPRECATED** from v2.8.0 + + * YES: Low latency with unassured quality. + * NO:(Default)High latency with assured quality. + */ +@property(assign, nonatomic) BOOL lowLatency; +/** Video GOP in frames. The default value is 30 fps. */ +@property(assign, nonatomic) NSInteger videoGop; +/** Video codec profile type + +Set it as 66, 77, or 100 (default), see [AgoraVideoCodecProfileType](AgoraVideoCodecProfileType). + +If you set this parameter to other values, Agora adjusts it to the default value of 100. + */ +@property(assign, nonatomic) AgoraVideoCodecProfileType videoCodecProfile; + +/** The video codec type of the output video stream. See AgoraVideoCodecTypeForStream. + + @since v3.2.0 + */ +@property(assign, nonatomic) AgoraVideoCodecTypeForStream videoCodecType; + +/** An AgoraLiveTranscodingUser 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. See AgoraLiveTranscodingUser. + */ +@property(copy, nonatomic) NSArray* _Nullable transcodingUsers; + +/** Reserved property. Extra user-defined information to send SEI for the H.264/H.265 video stream to the CDN live client. Maximum length: 4096 bytes. For more information on SEI, see [SEI-related questions](https://docs.agora.io/en/faq/sei). + */ +@property(copy, nonatomic) NSString* _Nullable transcodingExtraInfo; + +/** + * add few watermarks + */ +@property(copy, nonatomic) NSArray* _Nullable watermarkArray; + +/** + * add few backgroundImage + */ +@property(copy, nonatomic) NSArray* _Nullable backgroundImageArray; + +/** The background color in RGB hex. + +Value only. Do not include a preceding #. For example, 0xFFB6C1 (light pink). The default value is 0x000000 (black). + +COLOR_CLASS is a general name for the type: + +* iOS: UIColor +* macOS: NSColor + */ +@property(strong, nonatomic) COLOR_CLASS* _Nullable backgroundColor; + +/** Self-defined audio sample rate: AgoraAudioSampleRateType. + */ +@property(assign, nonatomic) AgoraAudioSampleRateType audioSampleRate; +/** Bitrate (Kbps) of the CDN live audio output stream. The default value is 48, and the highest value is 128. + */ +@property(assign, nonatomic) NSInteger audioBitrate; +/** The number of audio channels for the CDN live stream. + + Agora recommends choosing 1 (mono), or 2 (stereo) audio channels. Special players are required if you choose 3, 4, or 5. + + * 1: (Default) Mono + * 2: Stereo + * 3: Three audio channels + * 4: Four audio channels + * 5: Five audio channels + */ +@property(assign, nonatomic) NSInteger audioChannels; +/** + Audio codec profile. See AgoraAudioCodecProfileType. + + The default value is AgoraAudioCodecProfileLCAAC(0). + */ +@property(assign, nonatomic) AgoraAudioCodecProfileType audioCodecProfile; + +/** Creates a default transcoding object. + + @return Default AgoraLiveTranscoding object. + */ ++ (AgoraLiveTranscoding* _Nonnull)defaultTranscoding NS_SWIFT_NAME(default()); + +/** Adds a user displaying the video in CDN live. + + @param user The transcoding user. See AgoraLiveTranscodingUser. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)addUser:(AgoraLiveTranscodingUser* _Nonnull)user NS_SWIFT_NAME(add(_:)); + +/** Removes a user from CDN live. + + @param uid The user ID of the user to remove from CDN live. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)removeUser:(NSUInteger)uid NS_SWIFT_NAME(removeUser(_:)); + +/** Enables/Disables advanced features of the RTMP or RTMPS streaming with transcoding. + + @param featureName The name of the advanced feature, including the following: +

  • LBHQ: The advanced feature for high-quality video with a lower bitrate.
  • +
  • VEO: The advanced feature for the optimized video encoder.
  • + @param opened Whether to enable the advanced feature: +
  • YES: Enable the advanced feature.
  • +
  • NO: (Default) Disable the advanced feature.
  • + */ +- (void)setAdvancedFeatures:(NSString* _Nonnull)featureName opened:(BOOL)opened NS_SWIFT_NAME(setAdvancedFeatures(_:opened:)); + +/** Checks whether advanced features of the RTMP or RTMPS streaming with transcoding are enabled. + @return The name of each advanced feature and whether the advanced feature is enabled. + */ +- (NSArray* _Nullable)getAdvancedFeatures NS_SWIFT_NAME(getAdvancedFeatures()); + +@end + +/** Live broadcast import stream configuration. + */ +__attribute__((visibility("default"))) @interface AgoraLiveInjectStreamConfig : NSObject +/** Size of the stream to be imported into the live broadcast. The default value is 0; same + * size as the original stream. + */ +@property(assign, nonatomic) CGSize size; +/** Video GOP of the stream to be added into the broadcast. The default value is 30. + */ +@property(assign, nonatomic) NSInteger videoGop; +/** Video frame rate of the stream to be added into the broadcast. The default value is 15 fps. + */ +@property(assign, nonatomic) NSInteger videoFramerate; +/** Video bitrate of the stream to be added into the broadcast. The default value is 400 Kbps. + */ +@property(assign, nonatomic) NSInteger videoBitrate; + +/** Audio sampling rate of the stream to be added into the broadcast. The default value is 48000. + */ +@property(assign, nonatomic) AgoraAudioSampleRateType audioSampleRate; +/** Audio bitrate of the stream to be added into the broadcast. The default value is 48 Kbps. + */ +@property(assign, nonatomic) NSInteger audioBitrate; +/** Audio channels to be added into the broadcast. The default value is 1. + */ +@property(assign, nonatomic) NSInteger audioChannels; + +/** Create a default stream config + + @return default stream config + */ ++ (AgoraLiveInjectStreamConfig *_Nonnull)defaultConfig NS_SWIFT_NAME(defaultConfig()); +@end + + __deprecated + + /** AgoraRtcVideoCompositingRegion array. + */ + __attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingRegion + : NSObject + /** User ID of the user with the video to be displayed in the region. + */ + @property(assign, nonatomic) NSUInteger uid; +/** Horizontal position of the region on the screen (0.0 to 1.0). + */ +@property(assign, nonatomic) CGFloat x; +/** Vertical position of the region on the screen (0.0 to 1.0). + */ +@property(assign, nonatomic) CGFloat y; +/** Actual width of the region (0.0 to 1.0). + */ +@property(assign, nonatomic) CGFloat width; +/** Actual height of the region (0.0 to 1.0). + */ +@property(assign, nonatomic) CGFloat height; +/** 0 means the region is at the bottom, and 100 means the region is at the top. + */ +@property(assign, nonatomic) NSInteger zOrder; +/** 0 means the region is transparent, and 1 means the region is opaque. The default value is 1.0. + */ +@property(assign, nonatomic) CGFloat alpha; +/** Render mode: AgoraVideoRenderMode + */ +@property(assign, nonatomic) AgoraVideoRenderMode renderMode; +@end + + __deprecated + /** Rtc video compositing layout. + */ + __attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingLayout + : NSObject + /** Width of the entire canvas (display window or screen). + */ + @property(assign, nonatomic) NSInteger canvasWidth; +/** Height of the entire canvas (display window or screen). + */ +@property(assign, nonatomic) NSInteger canvasHeight; +/** Enter any of the 6-digit symbols defined in RGB. For example, "#c0c0c0" + */ +@property(copy, nonatomic) NSString *_Nullable backgroundColor; +/** AgoraRtcVideoCompositingRegion array. + */ +@property(copy, nonatomic) NSArray *_Nullable regions; +/** Application defined data. + */ +@property(copy, nonatomic) NSString *_Nullable appData; +@end + + /** + @deprecated + + Sets whether the current host is the RTMP stream owner. + */ + __deprecated __attribute__((visibility("default"))) @interface AgoraPublisherConfiguration + : NSObject + /** + - YES: The current host is the RTMP stream owner and the push-stream configuration is enabled + (default). - NO: The current host is not the RTMP stream owner and the push-stream + configuration is disabled. + */ + @property(assign, nonatomic) BOOL owner; + +/** Width of the output data stream set for CDN Live. 360 is the default value + */ +@property(assign, nonatomic) NSInteger width; +/** Height of the output data stream set for CDN Live. 640 is the default value + */ +@property(assign, nonatomic) NSInteger height; +/** Frame rate of the output data stream set for CDN Live. 15 fps is the default value + */ +@property(assign, nonatomic) NSInteger framerate; +/** Bitrate of the output data stream set for CDN Live. 500 kbit/s is the default value + */ +@property(assign, nonatomic) NSInteger bitrate; +/** Audio sample rate of the output data stream set for CDN Live. The default value is 48000. + */ +@property(assign, nonatomic) NSInteger audiosamplerate; +/** Audio bitrate of the output data stream set for CDN Live. The default value is 48. + */ +@property(assign, nonatomic) NSInteger audiobitrate; +/** Audio channels of the output data stream set for CDN Live. The default value is 1. + */ +@property(assign, nonatomic) NSInteger audiochannels; + +/** + +* 0: Tile Horizontally +* 1: Layered Windows +* 2: Tile Vertically + */ +@property(assign, nonatomic) NSInteger defaultLayout; +/** Video stream lifecycle of CDN Live: AgoraRtmpStreamLifeCycle + */ +@property(assign, nonatomic) AgoraRtmpStreamLifeCycle lifeCycle; + +/** Width of the stream to be injected. Set it as 0. + */ +@property(assign, nonatomic) NSInteger injectStreamWidth; + +/** Height of the stream to be injected. Set it as 0. + */ +@property(assign, nonatomic) NSInteger injectStreamHeight; + +/** Address of the stream to be injected to the channel. + */ +@property(copy, nonatomic) NSString *_Nullable injectStreamUrl; + +/** The push-stream address for the picture-in-picture layouts. The default value is *NULL*. + */ +@property(copy, nonatomic) NSString *_Nullable publishUrl; + +/** The push-stream address of the original stream which does not require picture-blending. The + * default value is NULL. + */ +@property(copy, nonatomic) NSString *_Nullable rawStreamUrl; + +/** Reserved field. The default value is NULL. + */ +@property(copy, nonatomic) NSString *_Nullable extraInfo; + +/** Check if configuration is validate + */ +- (BOOL)validate NS_SWIFT_NAME(validate()); + +- (NSString * _Nullable)toJsonString NS_SWIFT_NAME(toJsonString()); +@end + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) + +/** AgoraRtcDeviceInfo array. + */ +__attribute__((visibility("default"))) @interface AgoraRtcDeviceInfo : NSObject +@property (assign, nonatomic) int __deprecated index; + +/** AgoraMediaDeviceType + */ +@property(assign, nonatomic) AgoraMediaDeviceType type; + +/** Device ID. + */ +@property(copy, nonatomic) NSString *_Nullable deviceId; + +/** Device name. + */ +@property(copy, nonatomic) NSString *_Nullable deviceName; +@end +#endif + +/** Properties of the AgoraVideoFrame object. + */ +__attribute__((visibility("default"))) @interface AgoraVideoFrame : NSObject +/** Video format: + + * - 1: I420 + * - 2: BGRA + * - 3: NV21 + * - 4: RGBA + * - 5: IMC2 + * - 7: ARGB + * - 8: NV12 + * - 12: iOS texture (CVPixelBufferRef) + * - 13: Still Image (UIImage for iPhone, NSImage for Mac) + */ +@property(assign, nonatomic) NSInteger format; + +/** Timestamp of the incoming video frame (ms). An incorrect timestamp will result in frame loss or + * unsynchronized audio and video. + */ +@property(assign, nonatomic) CMTime time; // Time for this frame. + +/** + @deprecated Use strideInPixels instead. + */ +@property(assign, nonatomic) int stride DEPRECATED_MSG_ATTRIBUTE("use strideInPixels instead"); + +/** Line spacing of the incoming video frame, which must be in pixels instead of bytes. For + * textures, it is the width of the texture. + */ +@property(assign, nonatomic) int strideInPixels; // Number of pixels between two consecutive rows. + // Note: in pixel, not byte. Not used for iOS + // textures. + +/** Height of the incoming video frame. + */ +@property(assign, nonatomic) int height; // Number of rows of pixels. Not used for iOS textures. + +/** CVPixelBuffer + */ +@property(assign, nonatomic) CVPixelBufferRef _Nullable textureBuf; + +/** Still Image (UIImage for iPhone, NSImage for Mac) + */ +@property(strong, nonatomic) IMAGE_CLASS * _Nullable image; + +/** Raw data buffer. + */ +@property(strong, nonatomic) NSData *_Nullable dataBuf; // Raw data buffer. Not used for iOS textures. + +/** + * Indicates the alpha channel of current frame, which is consistent with the dimension of the video frame. + * The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground. + * The default value is nill. + */ +@property(strong, nonatomic) NSData *_Nullable alphaBuf; + +/** (Optional) Specifies the number of pixels trimmed from the left, which is set as 0 by default. + */ +@property(assign, nonatomic) int cropLeft; // Number of pixels to crop on the left boundary. +/** (Optional) Specifies the number of pixels trimmed from the top, which is set as 0 by default. + */ +@property(assign, nonatomic) int cropTop; // Number of pixels to crop on the top boundary. +/** (Optional) Specifies the number of pixels trimmed from the right, which is set as 0 by default. + */ +@property(assign, nonatomic) int cropRight; // Number of pixels to crop on the right boundary. +/** (Optional) Specifies the number of pixels trimmed from the bottom, which is set as 0 by default. + */ +@property(assign, nonatomic) int cropBottom; // Number of pixels to crop on the bottom boundary. +/** (Optional) Specifies whether to rotate the incoming video group. Optional values: 0, 90, 180, or + * 270 clockwise. Set as 0 by default. + */ +@property(assign, nonatomic) int rotation; // 0, 90, 180, 270. See document for rotation calculation. +/* Note + * 1. strideInPixels + * Stride is in pixels, not bytes + * 2. About the frame width and height + * No field is defined for the width. However, it can be deduced by: + * croppedWidth = (strideInPixels - cropLeft - cropRight) + * And + * croppedHeight = (height - cropTop - cropBottom) + * 3. About crop + * _________________________________________________________________..... + * | ^ | ^ + * | | | | + * | cropTop | | + * | | | | + * | v | | + * | ________________________________ | | + * | | | | | + * | | | | | + * |<-- cropLeft -->| valid region |<- cropRight ->| + * | | | | height + * | | | | + * | |_____________________________ | | | + * | ^ | | + * | | | | + * | cropBottom | | + * | | | | + * | v | v + * _________________________________________________________________...... + * | | + * |<---------------- strideInPixels ----------------------------->| + * + * If your buffer contains garbage data, you can crop them. For example, the frame size is + * 360 x 640, often the buffer stride is 368, that is, there extra 8 pixels on the + * right are for padding, and should be removed. In this case, you can set: + * strideInPixels = 368; + * height = 640; + * cropRight = 8; + * // cropLeft, cropTop, cropBottom are set to a default of 0 + */ + +/** If data format is BGRA or RGBA and alphaBuf is nill, it is required to call fillAlphaData to fill alphaBuf. + */ +- (void)fillAlphaData; +@end + +__attribute__((visibility("default"))) @interface AgoraLogConfig: NSObject +/** The absolute path of log files. + + Ensure that the directory for the log + files exists and is writable. The default file path is as follows: + + - iOS: `App Sandbox/Library/caches/agorasdk.log` + - macOS: + - Sandbox enabled: `App Sandbox/Library/Logs/agorasdk.log`, such as + `/Users//Library/Containers//Data/Library/Logs/agorasdk.log` + - Sandbox disabled: `�Library/Logs/agorasdk.log` + */ +@property (copy, nonatomic) NSString * _Nullable filePath; +/** The size (KB) of a log file. + + The default value is 1024 KB. If you set + this parameter to 1024 KB, the SDK outputs at most 5 MB log files; if + you set it to less than 1024 KB, the setting is invalid, and the maximum + size of a log file is still 1024 KB. + */ +@property (assign, nonatomic) NSInteger fileSizeInKB; +/** The output log level of the SDK. See details in AgoraLogLevel. + + For example, if you set the log level to `AgoraLogLevelWarn`, the SDK outputs the logs + within levels `AgoraLogLevelFatal`, `AgoraLogLevelError`, and `AgoraLogLevelWarn`. + */ +@property (assign, nonatomic) AgoraLogLevel level; +@end + +/** + * The config of AgoraRtcEngine. + */ +__attribute__((visibility("default"))) @interface AgoraRtcEngineConfig: NSObject + + /** + * The App ID issued to the developers by Agora. Apply for a new one from Agora if it is missing from + * your kit. + */ + @property (copy, nonatomic) NSString * _Nullable appId; + +/** + * The channel profile. See #AgoraChannelProfile. + */ + @property (assign, nonatomic) AgoraChannelProfile channelProfile; + + /** + * The license used for verification when connectting channel. Charge according to the license + */ + @property (copy, nonatomic) NSString * _Nullable license; + + /** + * The audio application scenario. See #AgoraAudioScenario. + * + * @note Agora recommends the following scenarios: + * - `AgoraAudioScenarioDefault = 0` + * - `AgoraAudioScenarioGameStreaming = 3` + */ + @property (assign, nonatomic) AgoraAudioScenario audioScenario; + /** + * The region for connection. This advanced feature applies to scenarios that + * have regional restrictions. + * + * For the regions that Agora supports, see \ref AgoraAreaCodeType. + * + * After specifying the region, the SDK connects to the Agora servers within + * that region. + */ + @property (assign, nonatomic) AgoraAreaCodeType areaCode; + @property (strong, nonatomic) AgoraLogConfig * _Nullable logConfig; + /** + * Thread priority for SDK common threads + * + * See \ref AgoraThreadPriorityType. + */ + @property (assign, nonatomic) AgoraThreadPriorityType threadPriority; + @property (weak, nonatomic) id _Nullable eventDelegate; + /** + * Determines whether to enable domain limit. + * - `true`: only connect to servers that already parsed by DNS + * - `false`: (Default) connect to servers with no limit + */ + @property (assign, nonatomic) BOOL domainLimit; +@end + +/** + * The class of AgoraAudioFrame. + */ +__attribute__((visibility("default"))) @interface AgoraAudioFrame : NSObject +/** The number of samples per channel. + */ +@property(assign, nonatomic) NSInteger samplesPerChannel; +/** The number of bytes per audio sample. For example, each PCM audio sample + usually takes up 16 bits (2 bytes). + */ +@property(assign, nonatomic) NSInteger bytesPerSample; +/** The number of audio channels. If the channel uses stereo, the data is + interleaved. + +- 1: Mono. +- 2: Stereo. + */ +@property(assign, nonatomic) NSInteger channels; +/** The sample rate. + */ +@property(assign, nonatomic) NSInteger samplesPerSec; +/** The buffer of the sample audio data. When the audio frame uses a stereo + channel, the data buffer is interleaved. The size of the data buffer is as + follows: `buffer` = `samplesPerChannel` × `channels` × `bytesPerSample`. + */ +@property(assign, nonatomic) void* _Nullable buffer; +/** The timestamp of the external audio frame. You can use this parameter for + the following purposes: + +- Restore the order of the captured audio frame. +- Synchronize audio and video frames in video-related scenarios, including +where external video sources are used. + */ +@property(assign, nonatomic) int64_t renderTimeMs; +/** Reserved for future use. + */ +@property(assign, nonatomic) NSInteger avSyncType; +@end + +/** The AgoraAudioParams interface + You can pass the `AgoraAudioParams` object in the return value of the following + callbacks to set the audio data format for the corresponding callbacks: + + - [getRecordAudioParams]([AgoraAudioFrameDelegate getRecordAudioParams]): + Sets the audio recording format for the + [onRecordAudioFrame]([AgoraAudioFrameDelegate onRecordAudioFrame:]) + callback. + - [getPlaybackAudioParams]([AgoraAudioFrameDelegate getPlaybackAudioParams]): + Sets the audio playback format for the + [onPlaybackAudioFrame]([AgoraAudioFrameDelegate onPlaybackAudioFrame:]) + callback. + - [getMixedAudioParams]([AgoraAudioFrameDelegate getMixedAudioParams]): + Sets the audio mixing format for the + [onMixedAudioFrame]([AgoraAudioFrameDelegate onMixedAudioFrame:]) callback. + + @note The SDK calculates the sample interval according to the + `samplesPerCall`, `sampleRate`, and `channel` values in the + `AgoraAudioParams` interface and triggers the following callbacks at the + calculated sample interval: + + - [onRecordAudioFrame]([AgoraAudioFrameDelegate onRecordAudioFrame:]) + - [onPlaybackAudioFrame]([AgoraAudioFrameDelegate onPlaybackAudioFrame:]) + - [onMixedAudioFrame]([AgoraAudioFrameDelegate onMixedAudioFrame:]) + + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + */ +__attribute__((visibility("default"))) @interface AgoraAudioParams : NSObject + +/** The audio sample rate (Hz), which can be set as one of the following values: + + - `8000` + - `16000` (Default) + - `32000` + - `44100 ` + - `48000` + */ +@property (assign, nonatomic) NSInteger sampleRate; + +/* The number of audio channels, which can be set as either of the following values: + + - `1`: Mono (Default) + - `2`: Stereo + */ +@property (assign, nonatomic) NSInteger channel; + +/* The use mode of the audio data. See AgoraAudioRawFrameOperationMode. + */ +@property (assign, nonatomic) AgoraAudioRawFrameOperationMode mode; + +/** The number of samples. For example, set it as 1024 for RTMP or RTMPS + streaming. + */ +@property (assign, nonatomic) NSInteger samplesPerCall; + +@end + +/** + * The class of AgoraEncodedAudioFrameInfo. + */ +__attribute__((visibility("default"))) @interface AgoraEncodedAudioFrameInfo: NSObject + @property (assign, nonatomic) NSInteger samplesPerChannel; + @property (assign, nonatomic) NSInteger channels; + @property (assign, nonatomic) NSInteger samplesPerSec; + @property (assign, nonatomic) AgoraAudioCodecType codecType; +@end + +/** + * The collections of uplink network info. + */ +__attribute__((visibility("default"))) @interface AgoraUplinkNetworkInfo : NSObject +/** +* The target video encoder bitrate bps. +*/ +@property(nonatomic, assign) int videoEncoderTargetBitrateBps; +@end + +/** + * The collections of downlink network info. + */ +__attribute__((visibility("default"))) @interface AgoraDownlinkNetworkInfo : NSObject +/** +* The lastmile buffer delay time in ms. +*/ +@property(nonatomic, assign) int lastmileBufferDelayTimeMs; +/** +* The downlink bandwidth estimation bitrate bps. +*/ +@property(nonatomic, assign) int bandwidthEstimationBps; +@end + +/** + * The leave channel options. + */ +__attribute__((visibility("default"))) @interface AgoraLeaveChannelOptions : NSObject +/** + * Determines whether to stop playing and mixing the music file when leave channel. + * - true: (Default) Stop playing and mixing the music file. + * - false: Do not stop playing and mixing the music file. + */ +@property(nonatomic, assign) BOOL stopAudioMixing; + +/** + * Determines whether to stop all music effects when leave channel. + * - true: (Default) Stop all music effects. + * - false: Do not stop the music effect. + */ +@property(nonatomic, assign) BOOL stopAllEffect; + +/** + * Determines whether to stop microphone recording when leave channel. + * - true: (Default) Stop microphone recording. + * - false: Do not stop microphone recording. + */ +@property(nonatomic, assign) BOOL stopMicrophoneRecording; + +@end + +__attribute__((visibility("default"))) @interface AgoraOutputVideoFrame : NSObject + +/** Video format: + * - 1: I420 + * - 2: BGRA + * - 3: NV21 + * - 4: RGBA + * - 5: IMC2 + * - 7: ARGB + * - 8: NV12 + * - 12: iOS texture NV12 (CVPixelBufferRef) + * - 13: iOS texture I420 (CVPixelBufferRef) + * - 14: iOS texture BGRA (CVPixelBufferRef) + */ +@property (nonatomic, assign) NSInteger type; +/** + * The width of the Video frame. + */ +@property (nonatomic, assign) int width; +/** + * The height of the video frame. + */ +@property (nonatomic, assign) int height; +/** + * The line span of Y buffer in the YUV data. + */ +@property (nonatomic, assign) int yStride; +/** + * The line span of U buffer in the YUV data. + */ +@property (nonatomic, assign) int uStride; +/** + * The line span of V buffer in the YUV data. + */ +@property (nonatomic, assign) int vStride; +/** + * The pointer to the Y buffer in the YUV data. + */ +@property (nonatomic, assign) uint8_t* _Nullable yBuffer; +/** + * The pointer to the U buffer in the YUV data. + */ +@property (nonatomic, assign) uint8_t* _Nullable uBuffer; +/** + * The pointer to the V buffer in the YUV data. + */ +@property (nonatomic, assign) uint8_t* _Nullable vBuffer; +/** + * The clockwise rotation information of this frame. You can set it as 0, 90, 180 or 270. + */ +@property (nonatomic, assign) int rotation; +/** + * The timestamp to render the video stream. Use this parameter for audio-video synchronization when + * rendering the video. + * + * @note This parameter is for rendering the video, not capturing the video. + */ +@property (nonatomic, assign) int64_t renderTimeMs; +/** + * The type of audio-video synchronization. + */ +@property (nonatomic, assign) int avSyncType; + +/** CVPixelBuffer + */ +@property(assign, nonatomic) CVPixelBufferRef _Nullable pixelBuffer; +/** + * Portrait Segmentation meta buffer, dimension of which is the same as AgoraOutputVideoFrame. + * Pixl value is between 0-255, 0 represents totally background, 255 represents totally foreground. + */ +@property (nonatomic, assign) uint8_t* _Nullable alphaBuffer; + +@end + +/** Configurations of built-in encryption schemas. + */ +__attribute__((visibility("default"))) @interface AgoraEncryptionConfig: NSObject + + /** Encryption mode. The default encryption mode is `AgoraEncryptionModeAES128GCM2`. See AgoraEncryptionMode. + */ + @property (assign, nonatomic) AgoraEncryptionMode encryptionMode; + + /** Encryption key in string type. + + **Note** + + If you do not set an encryption key or set it as `nil`, you cannot use the built-in encryption, and the SDK returns `-2` (`AgoraErrorCodeInvalidArgument`). + */ + @property (copy, nonatomic) NSString * _Nullable encryptionKey; + @property (strong, nonatomic) NSData * _Nullable encryptionKdfSalt; + @property (assign, nonatomic) BOOL datastreamEncryptionEnabled; + @end + +/** AgoraUserInfo. + */ +__attribute__((visibility("default"))) @interface AgoraUserInfo: NSObject + + /** The user ID + */ +@property(assign, nonatomic) NSUInteger uid; + + /** The user account + */ + @property (copy, nonatomic) NSString * _Nullable userAccount; + @end + +/** Client role options for the AgoraRtcEngineKit instance. + */ +__attribute__((visibility("default"))) @interface AgoraClientRoleOptions: NSObject + +/** Audicnce latency level. The default level is `AgoraAudienceLatencyLevelUltraLowLatency`. See AgoraAudienceLatencyLevelType. + */ +@property (assign, nonatomic) AgoraAudienceLatencyLevelType audienceLatencyLevel; + +@end + +/** The configuration of camera capturer. + */ +__attribute__((visibility("default"))) @interface AgoraCameraCapturerConfiguration: NSObject +/** The camera direction. See AgoraCameraDirection: + + - AgoraCameraDirectionRear: The rear camera. + - AgoraCameraDirectionFront: The front camera. + */ +#if TARGET_OS_IOS +@property (assign, nonatomic) AgoraCameraDirection cameraDirection; +#elif TARGET_OS_MAC +/** + *The device ID of the playback device. + */ +@property (copy, nonatomic) NSString * _Nullable deviceId; +#endif + +/** + * The dimensions of camera capture. + */ +@property(assign, nonatomic) CGSize dimensions; + +/** Frame rate of the camera capture. + */ +@property(assign, nonatomic) int frameRate; + +/** Follow the dimension ratio of setVideoEncoderConfiguration + * - YES: (Default) follow the dimension ratio. + * - NO: Do not follow the dimension ratio. + */ +@property(assign, nonatomic) BOOL followEncodeDimensionRatio; + +@end + +/** the configuration of datastream. + */ +__attribute__((visibility("default"))) @interface AgoraDataStreamConfig: NSObject + +@property (assign, nonatomic) BOOL ordered; + +@property (assign, nonatomic) BOOL syncWithAudio; +@end + + +/** The definition of AgoraChannelMediaRelayInfo. + */ +__attribute__((visibility("default"))) @interface AgoraChannelMediaRelayInfo: NSObject +/** The token that enables the user to join the channel. + */ +@property (copy, nonatomic) NSString * _Nullable token; +/** The channel name. + */ +@property (copy, nonatomic) NSString * _Nullable channelName; +/** The user ID. + */ +@property (assign, nonatomic) NSUInteger uid; +/** Initializes the AgoraChannelMediaRelayInfo object + + @param token The token that enables the user to join the channel. + */ +- (instancetype _Nonnull)initWithToken:(NSString *_Nullable)token NS_SWIFT_NAME(init(token:)); +@end + +/** The definition of AgoraChannelMediaRelayConfiguration. + */ +__attribute__((visibility("default"))) @interface AgoraChannelMediaRelayConfiguration: NSObject +/** The information of the destination channel: AgoraChannelMediaRelayInfo. It contains the following members: + + - `channelName`: The name of the destination channel. + - `uid`: ID of the broadcaster in the destination channel. The value ranges from 0 to (232-1). To avoid UID conflicts, this `uid` must be different from any other UIDs in the destination channel. The default value is 0, which means the SDK generates a random UID. + - `token`: The token for joining the destination channel. It is generated with the `channelName` and `uid` you set in `destinationInfos`. + + - If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID. + - If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`. + */ +@property (strong, nonatomic, readonly) NSDictionary *_Nullable destinationInfos; +/** The information of the source channel: AgoraChannelMediaRelayInfo. It contains the following members: + + - `channelName`: The name of the source channel. The default value is `nil`, which means the SDK applies the name of the current channel. + - `uid`: ID of the broadcaster whose media stream you want to relay. The default value is 0, which means the SDK generates a random UID. You must set it as 0. + - `token`: The token for joining the source channel. It is generated with the `channelName` and `uid` you set in `sourceInfo`. + + - If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID. + - If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`, and the `uid` must be set as 0. + */ +@property (strong, nonatomic) AgoraChannelMediaRelayInfo *_Nonnull sourceInfo; +/** Sets the information of the destination channel. + + If you want to relay the media stream to multiple channels, call this method as many times (at most four). + + @param destinationInfo The information of the destination channel: AgoraChannelMediaRelayInfo. It contains the following members: + + - `channelName`: The name of the destination channel. + - `uid`: ID of the broadcaster in the destination channel. The value ranges from 0 to (232-1). To avoid UID conflicts, this `uid` must be different from any other UIDs in the destination channel. The default value is 0, which means the SDK generates a random UID. + - `token`: The token for joining the destination channel. It is generated with the `channelName` and `uid` you set in `destinationInfo`. + + - If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID. + - If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`. + + @param channelName The name of the destination channel. Ensure that the value of this parameter is the same as that of the `channelName` member in `destinationInfo`. + + @return - YES: Success. + - NO: Failure. + */ +- (BOOL)setDestinationInfo:(AgoraChannelMediaRelayInfo *_Nonnull)destinationInfo forChannelName:(NSString *_Nonnull)channelName NS_SWIFT_NAME(setDestinationInfo(_:forChannelName:)); +/** Removes the destination channel. + + @param channelName The name of the destination channel. + + @return - YES: Success. + - NO: Failure. + */ +- (BOOL)removeDestinationInfoForChannelName:(NSString *_Nonnull)channelName NS_SWIFT_NAME(removeDestinationInfo(forChannelName:)); +@end + + +/** The image enhancement options in [setBeautyEffectOptions]([AgoraRtcEngineKit setBeautyEffectOptions:options:]). */ +__attribute__((visibility("default"))) @interface AgoraBeautyOptions : NSObject + +/** The lightening contrast level + +[AgoraLighteningContrastLevel](AgoraLighteningContrastLevel), used with the lighteningLevel property: + +- 0: Low contrast level. +- 1: (Default) Normal contrast level. +- 2: High contrast level. +*/ +@property(nonatomic, assign) AgoraLighteningContrastLevel lighteningContrastLevel; + +/** The brightness level. + +The default value is 0.7. The value ranges from 0.0 (original) to 1.0. + */ +@property(nonatomic, assign) float lighteningLevel; + +/** The smoothness level. + +The default value is 0.5. The value ranges from 0.0 (original) to 1.0. This parameter is usually used to remove blemishes. + */ +@property(nonatomic, assign) float smoothnessLevel; + +/** The redness level. + +The default value is 0.1. The value ranges from 0.0 (original) to 1.0. This parameter adjusts the red saturation level. +*/ +@property(nonatomic, assign) float rednessLevel; + +/** The sharpness level. + +The default value is 0.1. The value ranges from 0.0 (original) to 1.0. +*/ +@property(nonatomic, assign) float sharpnessLevel; + +@end + +/** + The video noise reduction options. + + **Since** v3.6.2 + */ +__attribute__((visibility("default"))) @interface AgoraVideoDenoiserOptions : NSObject + +/** The video noise reduction mode. See AgoraVideoDenoiserMode. + */ +@property(nonatomic, assign) AgoraVideoDenoiserMode mode; + +/** The video noise reduction level. See AgoraVideoDenoiserLevel. + */ +@property(nonatomic, assign) AgoraVideoDenoiserLevel level; + +@end + +/** + The video noise reduction options. + + **Since** v3.6.2 + */ +__attribute__((visibility("default"))) @interface AgoraLowlightEnhanceOptions : NSObject + +/** The low-light enhancement mode. See AgoraLowlightEnhanceMode. */ +@property(nonatomic, assign) AgoraLowlightEnhanceMode mode; + +/** The low-light enhancement level. See AgoraLowlightEnhanceLevel. */ +@property(nonatomic, assign) AgoraLowlightEnhanceLevel level; + +@end + +/** + The color enhancement options. + + **Since** v3.6.2 + */ +__attribute__((visibility("default"))) @interface AgoraColorEnhanceOptions : NSObject + +/** The level of color enhancement. The value range is [0.0,1.0]. `0.0` is the default value, which means no color enhancement is applied to the video. The higher the value, the higher the level of color enhancement. */ +@property(nonatomic, assign) float strengthLevel; + +/** The level of skin tone protection. The value range is [0.0,1.0]. `0.0` means no skin tone protection. The higher the value, the higher the level of skin tone protection. The default value is `1.0.` When the level of color enhancement is higher, the portrait skin tone can be significantly distorted, so you need to set the level of skin tone protection; when the level of skin tone protection is higher, the color enhancement effect can be slightly reduced. Therefore, to get the best color enhancement effect, Agora recommends that you adjust strengthLevel and skinProtectLevel to get the most appropriate values. */ +@property(nonatomic, assign) float skinProtectLevel; + +@end + + +/** The custom background image. + */ +__attribute__((visibility("default"))) @interface AgoraVirtualBackgroundSource : NSObject + +/** The type of the custom background image. See AgoraVirtualBackgroundSourceType. + */ +@property(nonatomic, assign) AgoraVirtualBackgroundSourceType backgroundSourceType NS_SWIFT_NAME(backgroundSourceType); + +/** The color of the custom background image. The format is a hexadecimal + integer defined by RGB, without the # sign, such as `0xFFB6C1` for light pink. + The default value is `0xFFFFFF`, which signifies white. The value range is + [0x000000,0xFFFFFF]. If the value is invalid, the SDK replaces the original + background image with a white background image. +

    Note: This parameter takes effect only when the type of the custom + background image is AgoraVirtualBackgroundColor.

    + */ +@property(nonatomic, assign) NSUInteger color NS_SWIFT_NAME(color); + +/** The local absolute path of the custom background image. PNG and JPG formats + are supported. If the path is invalid, the SDK replaces the original + background image with a white background image. +

    Note: This parameter takes effect only when the type of the custom + background image is AgoraVirtualBackgroundImg.

    + */ +@property(nonatomic, copy) NSString* _Nullable source NS_SWIFT_NAME(source); + +/** Background blur degree, for example: 1 2 3 */ +@property(nonatomic, assign) AgoraBlurDegree blurDegree; + +@end + +/** The custom green capacity. + */ +__attribute__((visibility("default"))) @interface AgoraSegmentationProperty: NSObject + +@property(nonatomic, assign) SegModelType modelType; + +@property(nonatomic, assign) float greenCapacity; + +@end + + +/** The definition of AgoraTranscodingVideoStream. + */ +__attribute__((visibility("default"))) @interface AgoraTranscodingVideoStream: NSObject +/** + * Source type of video stream. + */ +@property (assign, nonatomic) AgoraVideoSourceType sourceType; +/** + * Remote user uid if sourceType is AgoraMediaSourceTypeRemote. + */ +@property (assign, nonatomic) NSUInteger remoteUserUid; +/** + * RTC image if sourceType is AgoraMediaSourceTypeRtcImage. + */ +@property (copy, nonatomic) NSString * _Nullable imageUrl; +/** + * MediaPlayer id if sourceType is AgoraMediaSourceTypeMediaPlayer. + */ +@property(assign, nonatomic) NSUInteger mediaPlayerId; +/** + * Position and size of the video frame. + */ +@property (assign, nonatomic) CGRect rect; +/** + * The layer of the video frame that ranges from 1 to 100: + - 1: (Default) The lowest layer. + - 100: The highest layer. + */ +@property (assign, nonatomic) NSInteger zOrder; +/** + * The transparency of the video frame. + */ +@property(assign, nonatomic) double alpha; +/** + * Mirror of the source video frame (only valid for camera streams) + */ +@property(assign, nonatomic) BOOL mirror; + +@end +__attribute__((visibility("default"))) @interface AgoraVideoLayout: NSObject +@property(copy, nonatomic) NSString* _Nonnull channelId NS_SWIFT_NAME(channelId); +@property (assign, nonatomic) NSUInteger uid NS_SWIFT_NAME(uid); +@property(copy, nonatomic) NSString* _Nullable strUid NS_SWIFT_NAME(strUid); +@property (assign, nonatomic) NSUInteger videoState NS_SWIFT_NAME(videoState); +@property (assign, nonatomic) NSUInteger x NS_SWIFT_NAME(x); +@property (assign, nonatomic) NSUInteger y NS_SWIFT_NAME(y); +@property (assign, nonatomic) NSUInteger width NS_SWIFT_NAME(width); +@property (assign, nonatomic) NSUInteger height NS_SWIFT_NAME(height); +@end +/** The definition of AgoraVideoLayoutInfo. + */ +__attribute__((visibility("default"))) @interface AgoraVideoLayoutInfo: NSObject +@property (assign, nonatomic) NSUInteger width NS_SWIFT_NAME(width); +@property (assign, nonatomic) NSUInteger height NS_SWIFT_NAME(height); +@property (assign, nonatomic) NSUInteger layoutCount NS_SWIFT_NAME(layoutCount); +@property(copy, nonatomic) NSArray *_Nullable layoutList NS_SWIFT_NAME(layoutList); +@end + +/** The definition of AgoraLocalTranscoderConfiguration. + */ +__attribute__((visibility("default"))) @interface AgoraLocalTranscoderConfiguration: NSObject +/** + * The video stream layout configuration in the transcoder. + */ +@property(copy, nonatomic) NSArray *_Nullable videoInputStreams; +/** + * The video encoder configuration of transcoded video. + */ +@property (strong, nonatomic) AgoraVideoEncoderConfiguration *_Nonnull videoOutputConfiguration; + +/** + * Whether to use the timestamp when the primary camera captures the video frame as the timestamp of the mixed video frame. + * - true: (Default) Use the timestamp of the captured video frame as the timestamp of the mixed video frame. + * - false: Do not use the timestamp of the captured video frame as the timestamp of the mixed video frame. use the timestamp when the mixed video frame is constructed Instead. + */ +@property(assign, nonatomic) BOOL syncWithPrimaryCamera; + +@end + +/** The definition of the screen sharing encoding parameters. + */ +__attribute__((visibility("default"))) @interface AgoraScreenCaptureParameters: NSObject +/** + * The dimensions of the shared region in terms of width × height. The default value is 0, which means + * the original dimensions of the shared screen. + */ +@property (assign, nonatomic) CGSize dimensions; +/** + * The frame rate (fps) of the shared region. The default value is 5. We do not recommend setting + * this to a value greater than 15. + */ +@property (assign, nonatomic) NSInteger frameRate; +/** + * The bitrate (Kbps) of the shared region. The default value is 0, which means the SDK works out a bitrate + * according to the dimensions of the current screen. + */ +@property (assign, nonatomic) NSInteger bitrate; + +/** Sets whether to capture the mouse for screen sharing. + +- YES: (Default) Capture the mouse. +- NO: Do not capture the mouse. + */ +@property(assign, nonatomic) BOOL captureMouseCursor; + +/** Whether to bring the window to the front when calling [startScreenCaptureByWindowId]([AgoraRtcEngineKit startScreenCaptureByWindowId:rectangle:parameters:]) to share the window: + + - YES: Bring the window to the front. + - NO: (Default) Do not bring the window to the front. + + @note Due to system limitations, `windowFocus` only supports bringing the main window of an application to the front. + + */ +@property(assign, nonatomic) BOOL windowFocus; + +/** A list of IDs of windows to be blocked. + + When calling [startScreenCaptureByDisplayId]([AgoraRtcEngineKit startScreenCaptureByDisplayId:rectangle:parameters:]) + and pass `0` in the `displayId` parameter to start sharing a main screen, you can use this parameter to block the specified windows. When calling + [updateScreenCaptureParameters]([AgoraRtcEngineKit updateScreenCaptureParameters:]) to update the configuration for the main screen sharing, you can use this + parameter to dynamically block the specified windows during the main screen sharing. + + */ +@property(copy, nonatomic) NSArray* _Nullable excludeWindowList; + +/** (macOS only) Determines whether to place a border around the shared window or screen: + + - YES: Place a border. + - NO: (Default) Do not place a border. + + @note When you share a part of a window or screen, the SDK places a border around the entire window or screen if you set `highLighted` as YES. + + */ +@property(assign, nonatomic) BOOL highLighted; +/** (macOS only) The color of the border in RGBA format. The default value is 0xFF8CBF26. + + on macOS, `COLOR_CLASS` refers to `NSColor`. + + */ +@property(strong, nonatomic) COLOR_CLASS* _Nullable highLightColor; +/** (macOS only) The width (px) of the border. Defaults to 0, and the value range is [0,50]. + + */ +@property(assign, nonatomic) NSUInteger highLightWidth; + +@end + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +/** The configuration of camera capturer. + */ +__attribute__((visibility("default"))) @interface AgoraScreenCaptureConfiguration: NSObject +/** + * Whether to capture the window on the screen: + * - `true`: Capture the window. + * - `false`: (Default) Capture the screen, not the window. + */ +@property(assign, nonatomic) BOOL isCaptureWindow; +/** + * (macOS only) The display ID of the screen. + */ +@property(assign, nonatomic) NSInteger displayId; +/** + * (For Windows and macOS only) The window ID. + * @note This parameter takes effect only when you want to capture the window. + */ + +@property(assign, nonatomic) NSInteger windowId; + +/** + * (For Windows and macOS only) The screen capture configuration. For details, see ScreenCaptureParameters. + */ +@property(strong, nonatomic) AgoraScreenCaptureParameters* _Nonnull params; +/** + * (For Windows and macOS only) The relative position of the shared region to the whole screen. For details, see Rectangle. + * + * If you do not set this parameter, the SDK shares the whole screen. If the region you set exceeds the boundary of the + * screen, only the region within in the screen is shared. If you set width or height in Rectangle as 0, the whole + * screen is shared. + */ +@property(assign, nonatomic) CGRect regionRect; + +@end +#endif + +__attribute__((visibility("default"))) @interface AgoraScreenVideoParameters : NSObject + +/** CGSizezero Since the applicable below 720p + + You can customize the dimension, or select from the following list: + + - AgoraVideoDimension120x120 + - AgoraVideoDimension160x120 + - AgoraVideoDimension180x180 + - AgoraVideoDimension240x180 + - AgoraVideoDimension320x180 + - AgoraVideoDimension240x240 + - AgoraVideoDimension320x240 + - AgoraVideoDimension424x240 + - AgoraVideoDimension360x360 + - AgoraVideoDimension480x360 + - AgoraVideoDimension640x360 + - AgoraVideoDimension480x480 + - AgoraVideoDimension640x480 + - AgoraVideoDimension840x480 + - AgoraVideoDimension960x540 + - AgoraVideoDimension960x720 + - AgoraVideoDimension1280x720 + - AgoraVideoDimension1920x1080 (macOS only) + + Note: + + - The dimension does not specify the orientation mode of the output ratio. For how to set the video orientation, see [AgoraVideoOutputOrientationMode](AgoraVideoOutputOrientationMode). + - Whether 720p can be supported depends on the device. If the device cannot support 720p, the frame rate will be lower than the one listed in the table. Agora optimizes the video in lower-end devices. + - iPhones do not support video frame dimensions above 720p. + + */ +@property(assign, nonatomic) CGSize dimensions; +/** The frame rate of the video (fps). + + You can either set the frame rate manually or choose from the following options. The default value is 15. We do not recommend setting this to a value greater than 30. + + * AgoraVideoFrameRateFps1(1): 1 fps + * AgoraVideoFrameRateFps7(7): 7 fps + * AgoraVideoFrameRateFps10(10): 10 fps + * AgoraVideoFrameRateFps15(15): 15 fps + * AgoraVideoFrameRateFps24(24): 24 fps + * AgoraVideoFrameRateFps30(30): 30 fps + * AgoraVideoFrameRateFps60(30): 60 fps (macOS only) + */ +@property(assign, nonatomic) AgoraVideoFrameRate frameRate; +/** The bitrate of the video. + + Sets the video bitrate (Kbps). Refer to the table below and set your bitrate. If you set a bitrate beyond the proper range, the SDK automatically adjusts it to a value within the range. You can also choose from the following options: + + - AgoraVideoBitrateStandard: (recommended) the standard bitrate mode. In this mode, the bitrates differ between the interactive live streaming and Communication profiles: + + - Communication profile: the video bitrate is the same as the base bitrate. + - Interactive live streaming profile: the video bitrate is twice the base bitrate. + + - AgoraVideoBitrateCompatible: the compatible bitrate mode. In this mode, the bitrate stays the same regardless of the profile. In the interactive live streaming profile, if you choose this mode, the video frame rate may be lower than the set value. + +Agora uses different video codecs for different profiles to optimize the user experience. For example, the Communication profile prioritizes the smoothness while the interactive live streaming profile prioritizes the video quality (a higher bitrate). Therefore, Agora recommends setting this parameter as AgoraVideoBitrateStandard. + +**Video Bitrate Table** + +| Resolution | Frame Rate (fps) | Base Bitrate (Kbps, for Communication) | Live Bitrate (Kbps, for Live Broadcast) | +|-------------------|------------------|----------------------------------------|-----------------------------------------| +| 160 * 120 | 15 | 65 | 130 | +| 120 * 120 | 15 | 50 | 100 | +| 320 * 180 | 15 | 140 | 280 | +| 180 * 180 | 15 | 100 | 200 | +| 240 * 180 | 15 | 120 | 240 | +| 320 * 240 | 15 | 200 | 400 | +| 240 * 240 | 15 | 140 | 280 | +| 424 * 240 | 15 | 220 | 440 | +| 640 * 360 | 15 | 400 | 800 | +| 360 * 360 | 15 | 260 | 520 | +| 640 * 360 | 30 | 600 | 1200 | +| 360 * 360 | 30 | 400 | 800 | +| 480 * 360 | 15 | 320 | 640 | +| 480 * 360 | 30 | 490 | 980 | +| 640 * 480 | 15 | 500 | 1000 | +| 480 * 480 | 15 | 400 | 800 | +| 640 * 480 | 30 | 750 | 1500 | +| 480 * 480 | 30 | 600 | 1200 | +| 848 * 480 | 15 | 610 | 1220 | +| 848 * 480 | 30 | 930 | 1860 | +| 640 * 480 | 10 | 400 | 800 | +| 1280 * 720 | 15 | 1130 | 2260 | +| 1280 * 720 | 30 | 1710 | 3420 | +| 960 * 720 | 15 | 910 | 1820 | +| 960 * 720 | 30 | 1380 | 2760 | +| 1920 * 1080 | 15 | 2080 | 4160 | +| 1920 * 1080 | 30 | 3150 | 6300 | +| 1920 * 1080 | 60 | 4780 | 6500 | + + +**Note:** + +The base bitrate in this table applies to the Communication profile. The interactive live streaming profile generally requires a higher bitrate for better video quality. Agora recommends setting the bitrate mode as AgoraVideoBitrateStandard. You can also set the bitrate as twice the base bitrate. + + +*/ +@property(assign, nonatomic) NSInteger bitrate; + +/** contentHint The content hint for screen sharing, see [AgoraVideoContentHint](AgoraVideoContentHint). + */ +@property(assign, nonatomic) AgoraVideoContentHint contentHint; + +@end + +__attribute__((visibility("default"))) @interface AgoraScreenAudioParameters : NSObject + +@property(assign, nonatomic) NSInteger captureSignalVolume; + +@end + +__attribute__((visibility("default"))) @interface AgoraScreenCaptureParameters2 : NSObject +/** + * when captureAudio is YES, ReplayKit will push sample buffer with RPSampleBufferTypeAudioApp, default NO. + */ +@property(assign, nonatomic) BOOL captureAudio; +/** + * screen share with audio parameters + */ +@property(strong, nonatomic) AgoraScreenAudioParameters* _Nonnull audioParams; +/** + * when captureVideo is YES, ReplayKit will push sample buffer with RPSampleBufferTypeVideo, default YES. + */ +@property(assign, nonatomic) BOOL captureVideo; +/** + * screen share with video parameters + */ +@property(strong, nonatomic) AgoraScreenVideoParameters* _Nonnull videoParams; +@end + +/** Configurations of SimulcastStreamConfig. + */ + +__attribute__((visibility("default"))) @interface AgoraAudioRecordingConfiguration: NSObject +/** + * The absolute path (including the filename extensions) of the recording file. For example: `/var/mobile/Containers/Data/audio.aac`. + * @note Ensure that the path you specify exists and is writable. + */ +@property (copy, nonatomic) NSString * _Nullable filePath; +/** + * Recording sample rate (Hz). The following values are supported: + * - 16000 + * - (Default) 32000 + * - 44100 + * - 48000 + * @note If this parameter is set to `44100` or `48000`, for better recording effects, Agora recommends recording WAV + * files or AAC files whose `quality` is `AgoraAudioRecordingQualityMedium` or `AgoraAudioRecordingQualityHigh`. + */ +@property (assign, nonatomic) NSUInteger sampleRate; +/** + * Recording content. See AgoraAudioFileRecordingType. + */ +@property (assign, nonatomic) AgoraAudioFileRecordingType fileRecordOption; +/** + * Audio recording quality. See AgoraAudioRecordingQuality. + * @note This parameter applies for AAC files only. + */ +@property (assign, nonatomic) AgoraAudioRecordingQuality quality; + +/** + * Recording channel.The following values are supported: + * - (Default) 1 + * - 2 + */ +@property (assign, nonatomic) NSInteger recordingChannel; + +@end + +/** Configurations of SimulcastStreamConfig. + */ +__attribute__((visibility("default"))) @interface AgoraSimulcastStreamConfig: NSObject + +/** + * The video bitrate (Kbps). + */ + @property (assign, nonatomic) int kBitrate; +/** + * The video framerate. + */ + @property (assign, nonatomic) int framerate; + /** + * The video frame dimension. + */ + @property (assign, nonatomic) CGSize dimensions; + @end + +/** The AgoraMediaStreamInfo class, reporting the whole detailed information of + the media stream. + */ +__attribute__((visibility("default"))) @interface AgoraRtcMediaStreamInfo : NSObject +/** The index of the media stream. */ +@property(nonatomic, assign) NSInteger streamIndex; +/** The type of the media stream. See AgoraMediaStreamType for details. */ +@property(nonatomic, assign) AgoraMediaStreamType streamType; +/** The codec of the media stream. */ +@property(nonatomic, copy) NSString *_Nonnull codecName; +/** The language of the media stream. */ +@property(nonatomic, copy) NSString *_Nullable language; +/** For video stream, gets the frame rate (fps). */ +@property(nonatomic, assign) NSInteger videoFrameRate; +/** For video stream, gets the bitrate (bps). */ +@property(nonatomic, assign) NSInteger videoBitRate; +/** For video stream, gets the width (pixel) of the video. */ +@property(nonatomic, assign) NSInteger videoWidth; +/** For video stream, gets the height (pixel) of the video. */ +@property(nonatomic, assign) NSInteger videoHeight; +/** For the audio stream, gets the sample rate (Hz). */ +@property(nonatomic, assign) NSInteger audioSampleRate; +/** For the audio stream, gets the channel number. */ +@property(nonatomic, assign) NSInteger audioChannels; +/** The total duration (s) of the media stream. */ +@property(nonatomic, assign) NSInteger duration; +/** The rotation of the video stream. */ +@property(nonatomic, assign) NSInteger rotation; + +@end + +__attribute__((visibility("default"))) @interface AgoraAudioSpectrumInfo : NSObject + +/** User ID of the speaker. */ +@property(nonatomic, assign) NSInteger uid; +@property(nonatomic, strong) NSArray * _Nullable audioSpectrumData; + +@end + +/** + * The configurations for the audio encoded freame. + */ +__attribute__((visibility("default"))) @interface AgoraAudioEncodedFrameDelegateConfig: NSObject +/** + * The position where SDK record the audio, and callback to encoded audio frame observer. + */ +@property (assign, nonatomic) AgoraAudioEncodedFrameDelegatePosition postionType; +/** + * audio encoding type. + */ +@property (assign, nonatomic) AgoraAudioEncodingType encodingType; +@end + +__attribute__((visibility("default"))) @interface AgoraContentInspectModule: NSObject +@property (assign, nonatomic) AgoraContentInspectType type; + +@property (assign, nonatomic) NSInteger interval; +@end + +__attribute__((visibility("default"))) @interface AgoraContentInspectConfig: NSObject +@property (nonatomic, copy) NSString* _Nullable extraInfo; +@property(copy, nonatomic) NSArray* _Nullable modules; +@end +/** + * The AgoraRtcConnection for the AgoraRtcEngineKitEx. + */ +__attribute__((visibility("default"))) @interface AgoraRtcConnection: NSObject + +/** + * Init AgoraRtcConnection with channelId and localUid + * + * @param channelId Unique channel name for the AgoraRTC session in the string. + * @param localUid Local User ID. A 32-bit unsigned integer. + * @return AgoraRtcConnection. + */ +- (instancetype _Nonnull)initWithChannelId:(NSString *_Nonnull)channelId localUid:(NSInteger)localUid; + +/* channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + */ +@property (nonatomic, copy) NSString *_Nonnull channelId; +/* uid Local User ID. A 32-bit unsigned integer with a value ranging from 1 to + * (232-1). The `uid` must be unique and not set to 0 . Your app + * must record and maintain the returned `uid` since the SDK does not do so. + */ +@property (nonatomic, assign) NSUInteger localUid; + +@end +/** + * remote video subscription options + */ +__attribute__((visibility("default"))) @interface AgoraVideoSubscriptionOptions: NSObject + +/* +* The type of the video stream to subscribe to. +* +* The default value is `VIDEO_STREAM_HIGH`, which means the high-quality +* video stream. +*/ +@property (nonatomic, assign) AgoraVideoStreamType type; +/* +* Whether to subscribe to encoded video data only: +* - `true`: Subscribe to encoded video data only. +* - `false`: (Default) Subscribe to decoded video data. +*/ +@property (nonatomic, assign) bool encodedFrameOnly; + +@end +/** + * The configurations for the audio encoded freame. + */ +__attribute__((visibility("default"))) @interface AgoraEncodedVideoFrameInfo: NSObject + +/** + * The video codec: #VIDEO_CODEC_TYPE. + */ +@property (assign, nonatomic) AgoraVideoCodecType codecType; +/** + * The width (px) of the video. + */ +@property (assign, nonatomic) NSInteger width; +/** + * The height (px) of the video. + */ +@property (assign, nonatomic) NSInteger height; +/** + * The number of video frames per second. + * This value will be used for calculating timestamps of the encoded image. + * If framesPerSecond equals zero, then real timestamp will be used. + * Otherwise, timestamp will be adjusted to the value of framesPerSecond set. + */ +@property (assign, nonatomic) NSInteger framesPerSecond; +/** + * The frame type of the encoded video frame: #VIDEO_FRAME_TYPE. + */ +@property (assign, nonatomic) AgoraVideoFrameType frameType; +/** + * The rotation information of the encoded video frame: #VIDEO_ORIENTATION. + */ +@property (assign, nonatomic) NSInteger rotation; +/** + * The track ID of the video frame. + */ +@property (assign, nonatomic) NSInteger trackId; // This can be reserved for multiple video tracks, we need to create different ssrc + // and additional payload for later implementation. +/** + * This is a input parameter which means the timestamp for capturing the video. + */ +@property (assign, nonatomic) NSInteger captureTimeMs; +/** + * This is a output parameter which means the timestamp for decoding the video. + */ +@property (assign, nonatomic) NSInteger decodeTimeMs; +/** + * ID of the user. + */ +@property (assign, nonatomic) NSInteger uid; +/** + * The stream type of video frame. + */ +@property (assign, nonatomic) AgoraVideoStreamType streamType; +@end + +NS_SWIFT_NAME(LogUploadServerInfo) __attribute__((visibility("default"))) @interface LogUploadServerInfo : NSObject +/** Log upload server domain + */ +@property(copy, nonatomic) NSString* _Nullable serverDomain; +/** Log upload server path + */ +@property(copy, nonatomic) NSString* _Nullable serverPath; +/** Log upload server port + */ +@property(assign, nonatomic) NSInteger serverPort; +/** Whether to use HTTPS request: + - true: Use HTTPS request + - fasle: Use HTTP request + */ +@property(assign, nonatomic) BOOL serverHttps; +@end + +NS_SWIFT_NAME(AdvancedConfigInfo) __attribute__((visibility("default"))) @interface AdvancedConfigInfo : NSObject +/** Log upload server + */ +@property(strong, nonatomic) LogUploadServerInfo* _Nullable logUploadServer; +@end + +NS_SWIFT_NAME(AgoraLocalAccessPointConfiguration) __attribute__((visibility("default"))) @interface AgoraLocalAccessPointConfiguration : NSObject +/** Local access point IP address list. + */ +@property(copy, nonatomic) NSArray* _Nullable ipList NS_SWIFT_NAME(ipList); +/** Local access point domain list. + */ +@property(copy, nonatomic) NSArray* _Nullable domainList NS_SWIFT_NAME(domainList); +/** Certificate domain name installed on specific local access point. pass "" means using sni domain on specific local access point + * SNI(Server Name Indication) is an extension to the TLS protocol. + */ +@property(copy, nonatomic) NSString* _Nullable verifyDomainName NS_SWIFT_NAME(verifyDomainName); +/** Local proxy connection mode, connectivity first or local only. + */ +@property(assign, nonatomic) AgoraLocalProxyMode mode NS_SWIFT_NAME(mode); +/** Local proxy connection, advanced config info. + */ +@property(strong, nonatomic) AdvancedConfigInfo* _Nullable advancedConfig NS_SWIFT_NAME(advancedConfig); +@end + +/** + * The configuration of rhythm player, + * which is set in startRhythmPlayer or configRhythmPlayer. + */ +__attribute__((visibility("default"))) @interface AgoraRhythmPlayerConfig: NSObject +/** + * The number of beats per measure. The range is 1 to 9. + * The default value is 4, + * which means that each measure contains one downbeat and three upbeats. + */ +@property (assign, nonatomic) int beatsPerMeasure; +/* + * The range is 60 to 360. + * The default value is 60, + * which means that the rhythm player plays 60 beats in one minute. + */ +@property (assign, nonatomic) int beatsPerMinute; + +@end + +/** AgoraFacePositionInfo. + */ +NS_SWIFT_NAME(AgoraFacePositionInfo) __attribute__((visibility("default"))) @interface AgoraFacePositionInfo : NSObject + +/** The x coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, the x coordinate represents the relative lateral displacement of the top left corner of the human face to the origin. + */ +@property(assign, nonatomic) NSInteger x NS_SWIFT_NAME(x); + +/** The y coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, the y coordinate represents the relative longitudinal displacement of the top left corner of the human face to the origin. + */ +@property(assign, nonatomic) NSInteger y NS_SWIFT_NAME(y); + +/** The width (px) of the human face in the captured video. + */ +@property(assign, nonatomic) NSInteger width NS_SWIFT_NAME(width); + +/** The height (px) of the human face in the captured video. + */ +@property(assign, nonatomic) NSInteger height NS_SWIFT_NAME(height); + +/** The distance (cm) between the human face and the screen. + */ +@property(assign, nonatomic) NSInteger distance NS_SWIFT_NAME(distance); +@end + +/** AgoraAdvancedAudioOptions. + */ +__attribute__((visibility("default"))) @interface AgoraAdvancedAudioOptions: NSObject + +@property(assign, nonatomic) AgoraAudioProcessChannels audioProcessingChannels; + +@end + +__attribute__((visibility("default"))) @interface AgoraImageTrackOptions : NSObject +@property(copy, nonatomic) NSString *_Nullable imageUrl; +@property(assign, nonatomic) int fps; +@property(assign, nonatomic) AgoraVideoMirrorMode mirrorMode; +@end + +/** + * spatial audio parameters + * . + */ +__attribute__((visibility("default"))) @interface AgoraSpatialAudioParams : NSObject +/** + * Speaker azimuth in a spherical coordinate system centered on the listener. + */ +@property(assign, nonatomic) double speaker_azimuth; +/** + * Speaker elevation in a spherical coordinate system centered on the listener. + */ +@property(assign, nonatomic) double speaker_elevation; +/** + * Distance between speaker and listener. + */ +@property(assign, nonatomic) double speaker_distance; +/** + * Speaker orientation [0-180], 0 degree is the same with listener orientation. + */ +@property(assign, nonatomic) NSInteger speaker_orientation; +/** + * Enable blur or not for the speaker. + */ +@property(assign, nonatomic) BOOL enable_blur; +/** + * Enable air absorb or not for the speaker. + */ +@property(assign, nonatomic) BOOL enable_air_absorb; +/** + * Speaker attenuation factor. + */ +@property(assign, nonatomic) double speaker_attenuation; +/** + * Enable doppler factor. + */ +@property(assign, nonatomic) BOOL enable_doppler; +@end + +NS_SWIFT_NAME(AgoraEchoTestConfiguration) +__attribute__((visibility("default"))) @interface AgoraEchoTestConfiguration : NSObject +/** The video display view. + + VIEW_CLASS is a general name for this property. See the following definitions for iOS and macOS: + + - iOS: UIView + - MacOS: NSView + */ +@property(strong, nonatomic) VIEW_CLASS* _Nullable view NS_SWIFT_NAME(view); +/** Whether to enable audio. + */ +@property(assign, nonatomic) BOOL enableAudio NS_SWIFT_NAME(enableAudio); +/** Whether to enable video. + */ +@property(assign, nonatomic) BOOL enableVideo NS_SWIFT_NAME(enableVideo); +/** The token for join channel. + */ +@property(copy, nonatomic) NSString* _Nullable token NS_SWIFT_NAME(token); +/** The channelId. + */ +@property(copy, nonatomic) NSString* _Nonnull channelId NS_SWIFT_NAME(channelId); +@end + +/** + * Indicator optimization degree. + */ +NS_SWIFT_NAME(AgoraWlAccStats) __attribute__((visibility("default"))) @interface AgoraWlAccStats : NSObject +/** + * End-to-end delay optimization percentage. + */ +@property(assign, nonatomic) NSInteger e2eDelayPercent NS_SWIFT_NAME(e2eDelayPercent); +/** + * Frozen Ratio optimization percentage. + */ +@property(assign, nonatomic) NSInteger frozenRatioPercent NS_SWIFT_NAME(frozenRatioPercent); +/** + * Loss Rate optimization percentage. + */ +@property(assign, nonatomic) NSInteger lossRatePercent NS_SWIFT_NAME(lossRatePercent); +@end + +__attribute__((visibility("default"))) @interface AgoraMediaRecorderInfo : NSObject + +/** Recorder file name. It contains file's absolute path. + */ +@property(copy, nonatomic) NSString* _Nonnull recorderFileName; +/** Record duration (ms). + */ +@property(assign, nonatomic) NSUInteger durationMs; +/** Record file size (Byte). + */ +@property(assign, nonatomic) NSUInteger fileSize; + +@end + +__attribute__((visibility("default"))) @interface AgoraMediaRecorderConfiguration : NSObject + +/** Recorder file storage path. It contains file name (absolute path), such as -xxx.flv, -xxx.mp4, etc. + */ +@property(copy, nonatomic) NSString* _Nonnull storagePath; +/** Container format. See AgoraMediaRecorderContainerFormat. + */ +@property(assign, nonatomic) AgoraMediaRecorderContainerFormat containerFormat; +/** Stream Type. See AgoraMediaRecorderStreamType. + */ +@property(assign, nonatomic) AgoraMediaRecorderStreamType streamType; +/** Max duration (ms). Default 120000ms. + */ +@property(assign, nonatomic) NSUInteger maxDurationMs; +/** Recorder information update interval (ms, [1000~10000]). If it is set to other values, there won't be any callback. + */ +@property(assign, nonatomic) NSUInteger recorderInfoUpdateInterval; + +@end + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) + +/** + The AgoraScreenCaptureSourceInfo interface. (macOS only) + */ +__attribute__((visibility("default"))) @interface AgoraScreenCaptureSourceInfo : NSObject +/** The type of the shared target. See ScreenCaptureSourceType. */ +@property(assign, nonatomic) AgoraScreenCaptureSourceType type; +/** The window ID for a window or the display ID for a screen. */ +@property(assign, nonatomic) CGWindowID sourceId; +/** The name of the window or screen. UTF-8 encoding. */ +@property(copy, nonatomic) NSString* _Nonnull sourceName; +/** The image content of the thumbnail.. */ +@property(strong, nonatomic) NSImage* _Nonnull thumbImage; +/** The image content of the icon. . */ +@property(strong, nonatomic) NSImage* _Nullable iconImage; +/** The process to which the window belongs. UTF-8 encoding. */ +@property(copy, nonatomic) NSString* _Nonnull processPath; +/** The name of the processName. UTF-8 encoding. */ +@property(copy, nonatomic) NSString* _Nonnull sourceTitle; +/** The relative position of the shared region to the screen space (A virtual space include all the screens). */ +@property(assign, nonatomic) CGRect position; +/** Determines whether the screen is the primary display: + + - YES: The screen is the primary display. + - NO: The screen is not the primary display. + */ +@property(assign, nonatomic) BOOL primaryMonitor; + +@end + +#endif + +NS_SWIFT_NAME(AgoraExtensionInfo) __attribute__((visibility("default"))) @interface AgoraExtensionInfo : NSObject + +/** + * The type of media device. + */ +@property (assign, nonatomic) AgoraMediaSourceType sourceType NS_SWIFT_NAME(sourceType); + +/** + * The id of the remote user on which the extension works. + * + * @note remoteUid = 0 means that the extension works on all remote streams. + */ +@property (assign, nonatomic) NSUInteger remoteUid NS_SWIFT_NAME(remoteUid); + +/** + * The unique channel name for the AgoraRTC session in the string format. The string + * length must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", + * "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + */ +@property (copy, nonatomic) NSString *_Nonnull channelId NS_SWIFT_NAME(channelId); + +/** + * User ID: A 32-bit unsigned integer ranging from 1 to (2^32-1). It must be unique. + */ +@property (assign, nonatomic) NSUInteger localUid NS_SWIFT_NAME(localUid); + +@end + +/** + * The video rendering tracing result + */ +NS_SWIFT_NAME(AgoraVideoRenderingTracingInfo) __attribute__((visibility("default"))) @interface AgoraVideoRenderingTracingInfo : NSObject +/** + * Elapsed time from the start tracing time to the time when the tracing event occurred. + */ +@property (assign, nonatomic) NSInteger elapsedTime NS_SWIFT_NAME(elapsedTime); +/** + * Elapsed time from the start tracing time to the time when join channel. + * + * **Note** + * If the start tracing time is behind the time when join channel, this value will be negative. + */ +@property (assign, nonatomic) NSInteger start2JoinChannel NS_SWIFT_NAME(start2JoinChannel); +/** + * Elapsed time from joining channel to finishing joining channel. + */ +@property (assign, nonatomic) NSInteger join2JoinSuccess NS_SWIFT_NAME(join2JoinSuccess); +/** + * Elapsed time from finishing joining channel to remote user joined. + * + * **Note** + * If the start tracing time is after the time finishing join channel, this value will be + * the elapsed time from the start tracing time to remote user joined. The minimum value is 0. + */ +@property (assign, nonatomic) NSInteger joinSuccess2RemoteJoined NS_SWIFT_NAME(joinSuccess2RemoteJoined); +/** + * Elapsed time from remote user joined to set the view. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to set the view. The minimum value is 0. + */ +@property (assign, nonatomic) NSInteger remoteJoined2SetView NS_SWIFT_NAME(remoteJoined2SetView); +/** + * Elapsed time from remote user joined to the time subscribing remote video stream. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to the time subscribing remote video stream. + * The minimum value is 0. + */ +@property (assign, nonatomic) NSInteger remoteJoined2UnmuteVideo NS_SWIFT_NAME(remoteJoined2UnmuteVideo); +/** + * Elapsed time from remote user joined to the remote video packet received. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to the time subscribing remote video stream. + * The minimum value is 0. + */ +@property (assign, nonatomic) NSInteger remoteJoined2PacketReceived NS_SWIFT_NAME(remoteJoined2PacketReceived); + +@end + +/** The configuration of custom audio track +*/ +NS_SWIFT_NAME(AgoraAudioTrackConfig) __attribute__((visibility("default"))) @interface AgoraAudioTrackConfig : NSObject +/** + * Enable local playback, enabled by default + * true: (Default) Enable local playback + * false: Do not enable local playback + */ +@property (assign, nonatomic) BOOL enableLocalPlayback NS_SWIFT_NAME(enableLocalPlayback); + +@end diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraOptional.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraOptional.h new file mode 100644 index 0000000..97595be --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraOptional.h @@ -0,0 +1,891 @@ +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. +#pragma once + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#include +#endif +#include + +#ifndef CONSTEXPR +#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) +#define CONSTEXPR constexpr +#else +#define CONSTEXPR +#endif +#endif // !CONSTEXPR + +#ifndef NOEXCEPT +#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) +#define NOEXCEPT(Expr) noexcept(Expr) +#else +#define NOEXCEPT(Expr) +#endif +#endif // !NOEXCEPT + +namespace agora { + +// Specification: +// http://en.cppreference.com/w/cpp/utility/optional/in_place_t +struct in_place_t {}; + +// Specification: +// http://en.cppreference.com/w/cpp/utility/optional/nullopt_t +struct nullopt_t { + CONSTEXPR explicit nullopt_t(int) {} +}; + +// Specification: +// http://en.cppreference.com/w/cpp/utility/optional/in_place +/*CONSTEXPR*/ const in_place_t in_place = {}; + +// Specification: +// http://en.cppreference.com/w/cpp/utility/optional/nullopt +/*CONSTEXPR*/ const nullopt_t nullopt(0); + +// Forward declaration, which is refered by following helpers. +template +class Optional; + +namespace internal { + +template +struct OptionalStorageBase { + // Initializing |empty_| here instead of using default member initializing + // to avoid errors in g++ 4.8. + CONSTEXPR OptionalStorageBase() : is_populated_(false), empty_('\0') {} + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + CONSTEXPR explicit OptionalStorageBase(in_place_t, Args&&... args) + : is_populated_(true), value_(std::forward(args)...) {} +#else + CONSTEXPR explicit OptionalStorageBase(in_place_t, const T& _value) + : is_populated_(true), value_(_value) {} +#endif + // When T is not trivially destructible we must call its + // destructor before deallocating its memory. + // Note that this hides the (implicitly declared) move constructor, which + // would be used for constexpr move constructor in OptionalStorage. + // It is needed iff T is trivially move constructible. However, the current + // is_trivially_{copy,move}_constructible implementation requires + // is_trivially_destructible (which looks a bug, cf: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51452 and + // http://cplusplus.github.io/LWG/lwg-active.html#2116), so it is not + // necessary for this case at the moment. Please see also the destructor + // comment in "is_trivially_destructible = true" specialization below. + ~OptionalStorageBase() { + if (is_populated_) + value_.~T(); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + void Init(Args&&... args) { + ::new (&value_) T(std::forward(args)...); + is_populated_ = true; + } +#else + void Init(const T& _value) { + ::new (&value_) T(_value); + is_populated_ = true; + } +#endif + + bool is_populated_; + + union { + // |empty_| exists so that the union will always be initialized, even when + // it doesn't contain a value. Union members must be initialized for the + // constructor to be 'constexpr'. + char empty_; + T value_; + }; +}; + +// Implement conditional constexpr copy and move constructors. These are +// constexpr if is_trivially_{copy,move}_constructible::value is true +// respectively. If each is true, the corresponding constructor is defined as +// "= default;", which generates a constexpr constructor (In this case, +// the condition of constexpr-ness is satisfied because the base class also has +// compiler generated constexpr {copy,move} constructors). Note that +// placement-new is prohibited in constexpr. +template +struct OptionalStorage : OptionalStorageBase { + // This is no trivially {copy,move} constructible case. Other cases are + // defined below as specializations. + + // Accessing the members of template base class requires explicit + // declaration. + using OptionalStorageBase::is_populated_; + using OptionalStorageBase::value_; + using OptionalStorageBase::Init; + + // Inherit constructors (specifically, the in_place constructor). + //using OptionalStorageBase::OptionalStorageBase; + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + CONSTEXPR explicit OptionalStorage(in_place_t in_place, Args&&... args) + : OptionalStorageBase(in_place, std::forward(args)...) {} +#else + CONSTEXPR explicit OptionalStorage(in_place_t in_place, const T& _value) + : OptionalStorageBase(in_place, _value) {} +#endif + + // User defined constructor deletes the default constructor. + // Define it explicitly. + OptionalStorage() {} + + OptionalStorage(const OptionalStorage& other) { + if (other.is_populated_) + Init(other.value_); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + OptionalStorage(OptionalStorage&& other) NOEXCEPT(std::is_nothrow_move_constructible::value) { + if (other.is_populated_) + Init(std::move(other.value_)); + } +#endif +}; + +// Base class to support conditionally usable copy-/move- constructors +// and assign operators. +template +class OptionalBase { + // This class provides implementation rather than public API, so everything + // should be hidden. Often we use composition, but we cannot in this case + // because of C++ language restriction. + protected: + CONSTEXPR OptionalBase() {} + CONSTEXPR OptionalBase(const OptionalBase& other) : storage_(other.storage_) {} +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR OptionalBase(OptionalBase&& other) : storage_(std::move(other.storage_)) {} + + template + CONSTEXPR explicit OptionalBase(in_place_t, Args&&... args) + : storage_(in_place, std::forward(args)...) {} +#else + CONSTEXPR explicit OptionalBase(in_place_t, const T& _value) + : storage_(in_place, _value) {} +#endif + + // Implementation of converting constructors. + template + explicit OptionalBase(const OptionalBase& other) { + if (other.storage_.is_populated_) + storage_.Init(other.storage_.value_); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + explicit OptionalBase(OptionalBase&& other) { + if (other.storage_.is_populated_) + storage_.Init(std::move(other.storage_.value_)); + } +#endif + + ~OptionalBase() {} + + OptionalBase& operator=(const OptionalBase& other) { + CopyAssign(other); + return *this; + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + OptionalBase& operator=(OptionalBase&& other) NOEXCEPT( + std::is_nothrow_move_assignable::value && + std::is_nothrow_move_constructible::value) { + MoveAssign(std::move(other)); + return *this; + } +#endif + + template + void CopyAssign(const OptionalBase& other) { + if (other.storage_.is_populated_) + InitOrAssign(other.storage_.value_); + else + FreeIfNeeded(); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + void MoveAssign(OptionalBase&& other) { + if (other.storage_.is_populated_) + InitOrAssign(std::move(other.storage_.value_)); + else + FreeIfNeeded(); + } +#endif + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + void InitOrAssign(U&& value) { + if (storage_.is_populated_) + storage_.value_ = std::forward(value); + else + storage_.Init(std::forward(value)); + } +#else + void InitOrAssign(const U& value) { + if (storage_.is_populated_) + storage_.value_ = value; + else + storage_.Init(value); + } +#endif + + + void FreeIfNeeded() { + if (!storage_.is_populated_) + return; + storage_.value_.~T(); + storage_.is_populated_ = false; + } + + // For implementing conversion, allow access to other typed OptionalBase + // class. + template + friend class OptionalBase; + + OptionalStorage storage_; +}; + +// The following {Copy,Move}{Constructible,Assignable} structs are helpers to +// implement constructor/assign-operator overloading. Specifically, if T is +// is not movable but copyable, Optional's move constructor should not +// participate in overload resolution. This inheritance trick implements that. +template +struct CopyConstructible {}; + +template <> +struct CopyConstructible { + CONSTEXPR CopyConstructible() {} + CopyConstructible& operator=(const CopyConstructible&) { return *this; } +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR CopyConstructible(CopyConstructible&&) {} + CopyConstructible& operator=(CopyConstructible&&) { return *this; } +#endif + private: + CONSTEXPR CopyConstructible(const CopyConstructible&); +}; + +template +struct MoveConstructible {}; + +template <> +struct MoveConstructible { + CONSTEXPR MoveConstructible() {} + CONSTEXPR MoveConstructible(const MoveConstructible&) {} + MoveConstructible& operator=(const MoveConstructible&) { return *this; } +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + MoveConstructible& operator=(MoveConstructible&&) { return *this; } + private: + CONSTEXPR MoveConstructible(MoveConstructible&&); +#endif +}; + +template +struct CopyAssignable {}; + +template <> +struct CopyAssignable { + CONSTEXPR CopyAssignable() {} + CONSTEXPR CopyAssignable(const CopyAssignable&) {} +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR CopyAssignable(CopyAssignable&&) {} + CopyAssignable& operator=(CopyAssignable&&) { return *this; } +#endif + private: + CopyAssignable& operator=(const CopyAssignable&); +}; + +template +struct MoveAssignable {}; + +template <> +struct MoveAssignable { + CONSTEXPR MoveAssignable() {} + CONSTEXPR MoveAssignable(const MoveAssignable&) {} + MoveAssignable& operator=(const MoveAssignable&) { return *this; } +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR MoveAssignable(MoveAssignable&&) {} + + private: + MoveAssignable& operator=(MoveAssignable&&); +#endif +}; + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +// Helper to conditionally enable converting constructors and assign operators. +template +struct IsConvertibleFromOptional + : std::integral_constant< + bool, + std::is_constructible&>::value || + std::is_constructible&>::value || + std::is_constructible&&>::value || + std::is_constructible&&>::value || + std::is_convertible&, T>::value || + std::is_convertible&, T>::value || + std::is_convertible&&, T>::value || + std::is_convertible&&, T>::value> {}; + +template +struct IsAssignableFromOptional + : std::integral_constant< + bool, + IsConvertibleFromOptional::value || + std::is_assignable&>::value || + std::is_assignable&>::value || + std::is_assignable&&>::value || + std::is_assignable&&>::value> {}; + +// Forward compatibility for C++17. +// Introduce one more deeper nested namespace to avoid leaking using std::swap. +namespace swappable_impl { +using std::swap; + +struct IsSwappableImpl { + // Tests if swap can be called. Check(0) returns true_type iff swap + // is available for T. Otherwise, Check's overload resolution falls back + // to Check(...) declared below thanks to SFINAE, so returns false_type. + template + static auto Check(int) + -> decltype(swap(std::declval(), std::declval()), std::true_type()); + + template + static std::false_type Check(...); +}; +} // namespace swappable_impl +template +struct IsSwappable : decltype(swappable_impl::IsSwappableImpl::Check(0)) {}; +#endif +} // namespace internal + +// On Windows, by default, empty-base class optimization does not work, +// which means even if the base class is empty struct, it still consumes one +// byte for its body. __declspec(empty_bases) enables the optimization. +// cf) +// https://blogs.msdn.microsoft.com/vcblog/2016/03/30/optimizing-the-layout-of-empty-base-classes-in-vs2015-update-2-3/ +#if defined(_WIN32) +#define OPTIONAL_DECLSPEC_EMPTY_BASES __declspec(empty_bases) +#else +#define OPTIONAL_DECLSPEC_EMPTY_BASES +#endif + +// Optional is a Chromium version of the C++17 optional class: +// std::optional documentation: +// http://en.cppreference.com/w/cpp/utility/optional +// Chromium documentation: +// https://chromium.googlesource.com/chromium/src/+/master/docs/optional.md +// +// These are the differences between the specification and the implementation: +// - Constructors do not use 'constexpr' as it is a C++14 extension. +// - 'constexpr' might be missing in some places for reasons specified locally. +// - No exceptions are thrown, because they are banned from Chromium. +// Marked noexcept for only move constructor and move assign operators. +// - All the non-members are in the 'base' namespace instead of 'std'. +// +// Note that T cannot have a constructor T(Optional) etc. Optional checks +// T's constructor (specifically via IsConvertibleFromOptional), and in the +// check whether T can be constructible from Optional, which is recursive +// so it does not work. As of Feb 2018, std::optional C++17 implementation in +// both clang and gcc has same limitation. MSVC SFINAE looks to have different +// behavior, but anyway it reports an error, too. +template +class OPTIONAL_DECLSPEC_EMPTY_BASES Optional + : public internal::OptionalBase +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + , public internal::CopyConstructible::value>, + public internal::MoveConstructible::value>, + public internal::CopyAssignable::value && + std::is_copy_assignable::value>, + public internal::MoveAssignable::value && + std::is_move_assignable::value> +#endif +{ + public: +#undef OPTIONAL_DECLSPEC_EMPTY_BASES + + typedef T value_type; + + // Defer default/copy/move constructor implementation to OptionalBase. + CONSTEXPR Optional() {} + CONSTEXPR Optional(const Optional& other) : internal::OptionalBase(other) {} + + CONSTEXPR Optional(nullopt_t) {} // NOLINT(runtime/explicit) + + // Converting copy constructor. "explicit" only if + // std::is_convertible::value is false. It is implemented by + // declaring two almost same constructors, but that condition in enable_if_t + // is different, so that either one is chosen, thanks to SFINAE. + template + Optional(const Optional& other) : internal::OptionalBase(other) {} + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + // Converting move constructor. Similar to converting copy constructor, + // declaring two (explicit and non-explicit) constructors. + template + Optional(Optional&& other) : internal::OptionalBase(std::move(other)) {} + + template + CONSTEXPR explicit Optional(in_place_t, Args&&... args) + : internal::OptionalBase(in_place, std::forward(args)...) {} + + template + CONSTEXPR explicit Optional(in_place_t, + std::initializer_list il, + Args&&... args) + : internal::OptionalBase(in_place, il, std::forward(args)...) {} +#else + CONSTEXPR explicit Optional(in_place_t, const T& _value) + : internal::OptionalBase(in_place, _value) {} + template + CONSTEXPR explicit Optional(in_place_t, + const U il[], + const T& _value) + : internal::OptionalBase(in_place, il, _value) {} +#endif + + // Forward value constructor. Similar to converting constructors, + // conditionally explicit. +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + CONSTEXPR Optional(U&& value) + : internal::OptionalBase(in_place, std::forward(value)) {} +#else + template + CONSTEXPR Optional(const U& value) + : internal::OptionalBase(in_place, value) {} +#endif + + ~Optional() {} + + // Defer copy-/move- assign operator implementation to OptionalBase. + Optional& operator=(const Optional& other) { + if (&other == this) { + return *this; + } + + internal::OptionalBase::operator=(other); + return *this; + } + + Optional& operator=(nullopt_t) { + FreeIfNeeded(); + return *this; + } + + // Perfect-forwarded assignment. + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + Optional& operator=(U&& value) { + InitOrAssign(std::forward(value)); + return *this; + } +#else + Optional& operator=(const U& value) { + InitOrAssign(value); + return *this; + } +#endif + + // Copy assign the state of other. + template + Optional& operator=(const Optional& other) { + CopyAssign(other); + return *this; + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + // Move assign the state of other. + template + Optional& operator=(Optional&& other) { + MoveAssign(std::move(other)); + return *this; + } +#endif + + const T* operator->() const { + return &storage_.value_; + } + + T* operator->() { + return &storage_.value_; + } + + const T& operator*() const { + return storage_.value_; + } + + T& operator*() { + return storage_.value_; + } + + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR explicit operator bool() const { return storage_.is_populated_; } +#else + CONSTEXPR operator bool() const { return storage_.is_populated_; } +#endif + + CONSTEXPR bool has_value() const { return storage_.is_populated_; } + +#if 1 + const T& value() const { + return storage_.value_; + } + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR T value_or(U&& default_value) const { + // TODO(mlamouri): add the following assert when possible: + // static_assert(std::is_copy_constructible::value, + // "T must be copy constructible"); + static_assert(std::is_convertible::value, + "U must be convertible to T"); + return storage_.is_populated_ + ? value() + : static_cast(std::forward(default_value)); + } +#else + CONSTEXPR T value_or(const U& default_value) const { + return storage_.is_populated_ + ? value() + : static_cast(default_value); + } +#endif +#else + const T& value() const & { + return storage_.value_; + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + const T&& value() const && { + return std::move(storage_.value_); + } +#endif + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR T value_or(U&& default_value) const & { + // TODO(mlamouri): add the following assert when possible: + // static_assert(std::is_copy_constructible::value, + // "T must be copy constructible"); + static_assert(std::is_convertible::value, + "U must be convertible to T"); + return storage_.is_populated_ + ? value() + : static_cast(std::forward(default_value)); + } +#else + CONSTEXPR T value_or(const U& default_value) const & { + // TODO(mlamouri): add the following assert when possible: + // static_assert(std::is_copy_constructible::value, + // "T must be copy constructible"); + static_assert(std::is_convertible::value, + "U must be convertible to T"); + return storage_.is_populated_ + ? value() + : static_cast(default_value); + } +#endif + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR T value_or(U&& default_value) const && { + // TODO(mlamouri): add the following assert when possible: + // static_assert(std::is_move_constructible::value, + // "T must be move constructible"); + static_assert(std::is_convertible::value, + "U must be convertible to T"); + return storage_.is_populated_ + ? std::move(value()) + : static_cast(std::forward(default_value)); + } +#endif +#endif // 1 + + void swap(Optional& other) { + if (!storage_.is_populated_ && !other.storage_.is_populated_) + return; + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + if (storage_.is_populated_ != other.storage_.is_populated_) { + if (storage_.is_populated_) { + other.storage_.Init(std::move(storage_.value_)); + FreeIfNeeded(); + } else { + storage_.Init(std::move(other.storage_.value_)); + other.FreeIfNeeded(); + } + return; + } +#endif + using std::swap; + swap(**this, *other); + } + + void reset() { FreeIfNeeded(); } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + T& emplace(Args&&... args) { + FreeIfNeeded(); + storage_.Init(std::forward(args)...); + return storage_.value_; + } + + template + T& emplace(std::initializer_list il, Args&&... args) { + FreeIfNeeded(); + storage_.Init(il, std::forward(args)...); + return storage_.value_; + } +#else + T& emplace(const T& _value) { + FreeIfNeeded(); + storage_.Init(_value); + return storage_.value_; + } + template + T& emplace(const U il[], const T& _value) { + FreeIfNeeded(); + storage_.Init(il, _value); + return storage_.value_; + } +#endif + + private: + // Accessing template base class's protected member needs explicit + // declaration to do so. + using internal::OptionalBase::CopyAssign; + using internal::OptionalBase::FreeIfNeeded; + using internal::OptionalBase::InitOrAssign; +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + using internal::OptionalBase::MoveAssign; +#endif + using internal::OptionalBase::storage_; +}; + +// Here after defines comparation operators. The definition follows +// http://en.cppreference.com/w/cpp/utility/optional/operator_cmp +// while bool() casting is replaced by has_value() to meet the chromium +// style guide. +template +bool operator==(const Optional& lhs, const Optional& rhs) { + if (lhs.has_value() != rhs.has_value()) + return false; + if (!lhs.has_value()) + return true; + return *lhs == *rhs; +} + +template +bool operator!=(const Optional& lhs, const Optional& rhs) { + if (lhs.has_value() != rhs.has_value()) + return true; + if (!lhs.has_value()) + return false; + return *lhs != *rhs; +} + +template +bool operator<(const Optional& lhs, const Optional& rhs) { + if (!rhs.has_value()) + return false; + if (!lhs.has_value()) + return true; + return *lhs < *rhs; +} + +template +bool operator<=(const Optional& lhs, const Optional& rhs) { + if (!lhs.has_value()) + return true; + if (!rhs.has_value()) + return false; + return *lhs <= *rhs; +} + +template +bool operator>(const Optional& lhs, const Optional& rhs) { + if (!lhs.has_value()) + return false; + if (!rhs.has_value()) + return true; + return *lhs > *rhs; +} + +template +bool operator>=(const Optional& lhs, const Optional& rhs) { + if (!rhs.has_value()) + return true; + if (!lhs.has_value()) + return false; + return *lhs >= *rhs; +} + +template +CONSTEXPR bool operator==(const Optional& opt, nullopt_t) { + return !opt; +} + +template +CONSTEXPR bool operator==(nullopt_t, const Optional& opt) { + return !opt; +} + +template +CONSTEXPR bool operator!=(const Optional& opt, nullopt_t) { + return opt.has_value(); +} + +template +CONSTEXPR bool operator!=(nullopt_t, const Optional& opt) { + return opt.has_value(); +} + +template +CONSTEXPR bool operator<(const Optional& , nullopt_t) { + return false; +} + +template +CONSTEXPR bool operator<(nullopt_t, const Optional& opt) { + return opt.has_value(); +} + +template +CONSTEXPR bool operator<=(const Optional& opt, nullopt_t) { + return !opt; +} + +template +CONSTEXPR bool operator<=(nullopt_t, const Optional& ) { + return true; +} + +template +CONSTEXPR bool operator>(const Optional& opt, nullopt_t) { + return opt.has_value(); +} + +template +CONSTEXPR bool operator>(nullopt_t, const Optional& ) { + return false; +} + +template +CONSTEXPR bool operator>=(const Optional& , nullopt_t) { + return true; +} + +template +CONSTEXPR bool operator>=(nullopt_t, const Optional& opt) { + return !opt; +} + +template +CONSTEXPR bool operator==(const Optional& opt, const U& value) { + return opt.has_value() ? *opt == value : false; +} + +template +CONSTEXPR bool operator==(const U& value, const Optional& opt) { + return opt.has_value() ? value == *opt : false; +} + +template +CONSTEXPR bool operator!=(const Optional& opt, const U& value) { + return opt.has_value() ? *opt != value : true; +} + +template +CONSTEXPR bool operator!=(const U& value, const Optional& opt) { + return opt.has_value() ? value != *opt : true; +} + +template +CONSTEXPR bool operator<(const Optional& opt, const U& value) { + return opt.has_value() ? *opt < value : true; +} + +template +CONSTEXPR bool operator<(const U& value, const Optional& opt) { + return opt.has_value() ? value < *opt : false; +} + +template +CONSTEXPR bool operator<=(const Optional& opt, const U& value) { + return opt.has_value() ? *opt <= value : true; +} + +template +CONSTEXPR bool operator<=(const U& value, const Optional& opt) { + return opt.has_value() ? value <= *opt : false; +} + +template +CONSTEXPR bool operator>(const Optional& opt, const U& value) { + return opt.has_value() ? *opt > value : false; +} + +template +CONSTEXPR bool operator>(const U& value, const Optional& opt) { + return opt.has_value() ? value > *opt : true; +} + +template +CONSTEXPR bool operator>=(const Optional& opt, const U& value) { + return opt.has_value() ? *opt >= value : false; +} + +template +CONSTEXPR bool operator>=(const U& value, const Optional& opt) { + return opt.has_value() ? value >= *opt : true; +} + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +template +CONSTEXPR Optional make_optional(Args&&... args) { + return Optional(in_place, std::forward(args)...); +} + +template +CONSTEXPR Optional make_optional(std::initializer_list il, + Args&&... args) { + return Optional(in_place, il, std::forward(args)...); +} +#endif + +// Partial specialization for a function template is not allowed. Also, it is +// not allowed to add overload function to std namespace, while it is allowed +// to specialize the template in std. Thus, swap() (kind of) overloading is +// defined in base namespace, instead. +template +void swap(Optional& lhs, Optional& rhs) { + lhs.swap(rhs); +} + +} // namespace agora + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +namespace std { +template +struct hash > { + size_t operator()(const agora::Optional& opt) const { + return opt == agora::nullopt ? 0 : std::hash()(*opt); + } +}; +} // namespace std +#endif +#undef CONSTEXPR +#undef NOEXCEPT diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRefCountedObject.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRefCountedObject.h new file mode 100644 index 0000000..a457ef7 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRefCountedObject.h @@ -0,0 +1,129 @@ + +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. +#pragma once + +#include "AgoraRefPtr.h" +#include "AgoraAtomicOps.h" + +#ifndef OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER agora::RefCountReleaseStatus:: +#else +#define OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER +#endif +#endif +namespace agora { + +class RefCounter { + public: + explicit RefCounter(int ref_count) : ref_count_(ref_count) {} + + void IncRef() { AtomicOps::Increment(&ref_count_); } + + /** + * Returns true if this was the last reference, and the resource protected by + * the reference counter can be deleted. + */ + agora::RefCountReleaseStatus DecRef() { + return (AtomicOps::Decrement(&ref_count_) == 0 + ? OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER kDroppedLastRef + : OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER kOtherRefsRemained); + } + + /** + * Return whether the reference count is one. If the reference count is used + * in the conventional way, a reference count of 1 implies that the current + * thread owns the reference and no other thread shares it. This call performs + * the test for a reference count of one, and performs the memory barrier + * needed for the owning thread to act on the resource protected by the + * reference counter, knowing that it has exclusive access. + */ + bool HasOneRef() const { return (AtomicOps::AcquireLoad(&ref_count_) == 1); } + + private: + RefCounter(); + + private: + volatile int ref_count_; +}; + +/** + * Agora sample code for wrapping a class that needs to inherit from RefCountInterface in order + * to be held by agora::agora_refptr + * Usage: + * agora::agora_refptr ptr = new RefCountedObject(Arg1, Arg2, ...); + */ + +template +class RefCountedObject : public T { + public: + RefCountedObject(): ref_count_(0) {} + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + explicit RefCountedObject(P0&& p0) : T(std::forward(p0)), ref_count_(0) {} +#else + explicit RefCountedObject(const P0& p0) : T(p0), ref_count_(0) {} +#endif + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + RefCountedObject(P0&& p0, P1&& p1, Args&&... args) + : T(std::forward(p0), + std::forward(p1), + std::forward(args)...), + ref_count_(0) {} +#endif + + virtual void AddRef() const { ref_count_.IncRef(); } + + virtual agora::RefCountReleaseStatus Release() const { + const agora::RefCountReleaseStatus status = ref_count_.DecRef(); + if (status == OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER kDroppedLastRef) { + delete this; + } + return status; + } + + /** + * Return whether the reference count is one. If the reference count is used + * in the conventional way, a reference count of 1 implies that the current + * thread owns the reference and no other thread shares it. This call + * performs the test for a reference count of one, and performs the memory + * barrier needed for the owning thread to act on the object, knowing that it + * has exclusive access to the object. + */ + virtual bool HasOneRef() const { return ref_count_.HasOneRef(); } + + protected: + virtual ~RefCountedObject() {} + + private: + RefCountedObject(const RefCountedObject&); + RefCountedObject& operator=(const RefCountedObject&); + + protected: + mutable agora::RefCounter ref_count_; +}; + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +template +inline agora_refptr make_refptr(types&&... args) { + return agora_refptr(new RefCountedObject(std::forward(args)...)); +} +#else +template +inline agora_refptr make_refptr() { + return agora_refptr(new RefCountedObject()); +} +template +inline agora_refptr make_refptr(const P0& p0) { + return agora_refptr(new RefCountedObject(p0)); +} +#endif +} // namespace agora \ No newline at end of file diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRefPtr.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRefPtr.h new file mode 100644 index 0000000..97594cb --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRefPtr.h @@ -0,0 +1,156 @@ + +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once + +#include +#if !(__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)) +#include +#endif +#ifndef OPTIONAL_ENUM_CLASS +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_CLASS enum class +#else +#define OPTIONAL_ENUM_CLASS enum +#endif +#endif + +namespace agora { + +OPTIONAL_ENUM_CLASS RefCountReleaseStatus { kDroppedLastRef, kOtherRefsRemained }; + +// Interfaces where refcounting is part of the public api should +// inherit this abstract interface. The implementation of these +// methods is usually provided by the RefCountedObject template class, +// applied as a leaf in the inheritance tree. +class RefCountInterface { + public: + virtual void AddRef() const = 0; + virtual RefCountReleaseStatus Release() const = 0; + virtual bool HasOneRef() const = 0; + + // Non-public destructor, because Release() has exclusive responsibility for + // destroying the object. + protected: + virtual ~RefCountInterface() {} +}; + +template +class agora_refptr { + public: + agora_refptr() : ptr_(NULL) {} + + agora_refptr(T* p) : ptr_(p) { + if (ptr_) ptr_->AddRef(); + } + + template + agora_refptr(U* p) : ptr_(p) { + if (ptr_) ptr_->AddRef(); + } + + agora_refptr(const agora_refptr& r) : ptr_(r.get()) { + if (ptr_) ptr_->AddRef(); + } + + template + agora_refptr(const agora_refptr& r) : ptr_(r.get()) { + if (ptr_) ptr_->AddRef(); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + agora_refptr(agora_refptr&& r) : ptr_(r.move()) {} + + template + agora_refptr(agora_refptr&& r) : ptr_(r.move()) {} +#endif + + ~agora_refptr() { + reset(); + } + + T* get() const { return ptr_; } + operator bool() const { return (ptr_ != NULL); } + + T* operator->() const { return ptr_; } + T& operator*() const { return *ptr_; } + + // Returns the (possibly null) raw pointer, and makes the agora_refptr hold a + // null pointer, all without touching the reference count of the underlying + // pointed-to object. The object is still reference counted, and the caller of + // move() is now the proud owner of one reference, so it is responsible for + // calling Release() once on the object when no longer using it. + T* move() { + T* retVal = ptr_; + ptr_ = NULL; + return retVal; + } + + agora_refptr& operator=(T* p) { + if (ptr_ == p) return *this; + + if (p) p->AddRef(); + if (ptr_) ptr_->Release(); + ptr_ = p; + return *this; + } + + agora_refptr& operator=(const agora_refptr& r) { + return *this = r.get(); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + agora_refptr& operator=(agora_refptr&& r) { + agora_refptr(std::move(r)).swap(*this); + return *this; + } + + template + agora_refptr& operator=(agora_refptr&& r) { + agora_refptr(std::move(r)).swap(*this); + return *this; + } +#endif + + // For working with std::find() + bool operator==(const agora_refptr& r) const { return ptr_ == r.ptr_; } + + // For working with std::set + bool operator<(const agora_refptr& r) const { return ptr_ < r.ptr_; } + + void swap(T** pp) { + T* p = ptr_; + ptr_ = *pp; + *pp = p; + } + + void swap(agora_refptr& r) { swap(&r.ptr_); } + + void reset() { + if (ptr_) { + ptr_->Release(); + ptr_ = NULL; + } + } + + protected: + T* ptr_; +}; + +} // namespace agora + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +namespace std { +template +struct hash> { + std::size_t operator()(const agora::agora_refptr& k) const { + return reinterpret_cast(k.get()); + } +}; +} // namespace std +#endif \ No newline at end of file diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcAudioSpectrumDelegate.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcAudioSpectrumDelegate.h new file mode 100644 index 0000000..865e208 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcAudioSpectrumDelegate.h @@ -0,0 +1,48 @@ +// +// AgoraRtcMediaPlayerProtocol.h +// AgoraRtcMediaPlayerProtocol +// +// Copyright (c) 2020 Agora. All rights reserved. +// + +#import +#import "AgoraObjects.h" + + +@protocol AgoraAudioSpectrumDelegate + +@optional +/** + * Reports the audio spectrum of audio recording. + * + * This callback reports the audio spectrum data of the audio recording at the moment + * in the channel. + * + * You can set the time interval of this callback using "enableAudioSpectrumMonitor". + * + * @param audioSpectrumData The audio spectrum data of audio recording. + * - true: Processed. + * - false: Not processed. + */ +- (BOOL)onLocalAudioSpectrum:(NSArray * _Nullable)audioSpectrumData NS_SWIFT_NAME(onLocalAudioSpectrum(_:)); +/** + * Reports the audio spectrum of remote user. + * + * This callback reports the IDs and audio spectrum data of the loudest speakers at the moment + * in the channel. + * + * You can set the time interval of this callback using "enableAudioSpectrumMonitor". + * + * @param AudioSpectrumInfo The pointer to AudioSpectrumInfo, which is an array containing + * the user ID and audio spectrum data for each speaker. + * - This array contains the following members: + * - `uid`, which is the UID of each remote speaker + * - `audioSpectrumData`, which reports the audio spectrum of each remote speaker. + * - `spectrumDataLength`, the length of audio spectrum data. + * - true: Processed. + * - false: Not processed. + */ +- (BOOL)onRemoteAudioSpectrum:(NSArray * _Nullable)AudioSpectrumInfo NS_SWIFT_NAME(onRemoteAudioSpectrum(_:)); + + +@end diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineDelegate2.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineDelegate2.h new file mode 100644 index 0000000..f9d0de4 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineDelegate2.h @@ -0,0 +1,467 @@ +// +// AgoraRtcEngineKit2.h +// AgoraRtcEngineKit +// +// Created by Sting Feng on 2015-8-11. +// Copyright (c) 2015 Agora. All rights reserved. +// + +#import "AgoraBaseDelegate.h" +#import "AgoraEnumerates.h" + +@class AgoraRtcEngineKit; + +@protocol AgoraRtcEngineDelegate2 +@optional + +#pragma mark Local user common delegates +/** + * Event of the user joined the channel. + * + * @param engine The engine kit + * @param channelId The channel name + * @param userId The remote user id + * @param elapsed The elapsed time (ms) from session beginning + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinChannel:(NSString * _Nonnull)channelId withUid:(NSString * _Nonnull)userId elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didJoinChannel:withUid:elapsed:)); + +/** + * Event of the user rejoined the channel + * + * @param engine The engine kit + * @param channelId The channel name + * @param userId The user id + * @param elapsed The elapsed time (ms) from session beginning + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRejoinChannel:(NSString * _Nonnull)channelId withUid:(NSString * _Nonnull)userId elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didRejoinChannel:withUid:elapsed:)); + +/** + * The network quality of local user. + * + * @param engine The engine kit + * @param userId The id of user + * @param txQuality The sending network quality + * @param rxQuality The receiving network quality + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine networkQuality:(NSString * _Nonnull)userId txQuality:(AgoraNetworkQuality)txQuality rxQuality:(AgoraNetworkQuality)rxQuality NS_SWIFT_NAME(rtcEngine(_:networkQuality:txQuality:rxQuality:)); + +#pragma mark Remote user common delegates +/** + * Event of remote user joined + * + * @param engine The engine kit + * @param userId The remote user id + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinedOfUid:(NSString * _Nonnull)userId elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didJoinedOfUid:elapsed:)); + +/** + * Event of remote user offlined + * + * @param engine The engine kit + * @param userId The remote user id + * @param reason Reason of user offline, quit, drop or became audience + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOfflineOfUid:(NSString * _Nonnull)userId reason:(AgoraUserOfflineReason)reason NS_SWIFT_NAME(rtcEngine(_:didOfflineOfUid:reason:)); + +/** + * receive custom data from remote user + * + * @param engine The engine kit + * @param userId The remote user id + * @param streamId The stream id + * @param data The user defined data + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine receiveStreamMessageFromUid:(NSString * _Nonnull)userId streamId:(NSInteger)streamId data:(NSData * _Nonnull)data NS_SWIFT_NAME(rtcEngine(_:receiveStreamMessageFromUid:streamId:data:)); + +/** + * the local user has not received the data stream from the other user within 5 seconds. + * + * @param engine The engine kit + * @param userId The remote user id + * @param streamId The stream id + * @param error The error code + * @param missed The number of lost messages + * @param cached The number of incoming cached messages when the data stream is interrupted + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurStreamMessageErrorFromUid:(NSString * _Nonnull)userId streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached NS_SWIFT_NAME(rtcEngine(_:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached:)); + +#pragma mark Local user audio delegates + +/** + * This callback indicates local audio stream state has changed. + * + * @param engine The engine kit + * @param state Stopped: The initial state + * Recording: The capturer starts successfully + * Encoding: The first video frame is successfully encoded + * Failed: The local video fails to start + * @param error OK: The local audio is normal + * Failure: No specified reason for the local audio failure. + * DeviceNoPermission: No permission to use the local audio device + * DeviceBusy: The microphone is in use + * RecordFailure: The local audio recording fails. Check whether the recording device is working properly + * EncodeFailure: The local audio encoding fails + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localAudioStateChanged:(AgoraAudioLocalState)state error:(AgoraAudioLocalError)error NS_SWIFT_NAME(rtcEngine(_:localAudioStateChanged:error:)); + +#pragma mark Remote user audio delegates + +/** The first audio frame received and decoded from the remote user. + + @param engine The AgoraRtcEngineKit object. + @param userId Remote user ID. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteAudioFrameOfUid:(NSString * _Nonnull)userId elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameOfUid:elapsed:)); + +/** Occurs when the SDK decodes the first remote audio frame for playback. + + **Deprecated** . Use `AgoraAudioRemoteStateDecoding(2)` in the [remoteAudioStateChangedOfUid]([AgoraRtcEngineDelegate rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:]) callback instead. + + This callback is triggered in either of the following scenarios: + + - The remote user joins the channel and sends the audio stream. + - The remote user stops sending the audio stream and re-sends it after 15 seconds. Reasons for such an interruption include: + + - The remote user leaves channel. + - The remote user drops offline. + - The remote user calls the [muteLocalAudioStream]([AgoraRtcEngineKit muteLocalAudioStream:]) method to stop sending the local audio stream. + - The remote user calls the [disableAudio]([AgoraRtcEngineKit disableAudio]) method to disable audio. + + @param engine AgoraRtcEngineKit object. + @param uid User ID of the remote user sending the audio stream. + @param elapsed The time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine firstRemoteAudioFrameDecodedOfUid:(NSString * _Nonnull)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameDecodedOfUid:elapsed:)); + + +/** + * This callback indicates remote audio stream state has changed. + * + * @param engine The engine kit + * @param userId The user id + * @param state Stopped // The remote audio stopped, default state, audio is started or remote user disabled/muted audio stream. + * Starting // The first remote audio packet is received. + * Decoding // The remote audio stream is decoded and plays normally. + * Frozen // The remote audio is frozen. + * Failed // The remote audio fails to start. + * @param reason Interal // Internal reasons. + * NetworkCongestion // Network congestion. + * NetworkRecovery // Network recovery. + * LocalMuted // The local user stops receiving the remote audio stream or disables the audio module. + * LocalUnmuted // The local user resumes receiving the remote audio stream or enables the audio module. + * RemoteMuted // The remote user stops sending the audio stream or disables the audio module. + * RemoteUnmuted // The remote user resumes sending the audio stream or enables the audio module. + * Offline // The remote user leaves the channel. + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteAudioStateChangedOfUid:(NSString * _Nonnull)userId state:(AgoraAudioRemoteState)state reason:(AgoraAudioRemoteReason)reason elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:remoteAudioStateChangedOfUid:state:reason:elapsed:)); + +/** + * The sdk reports who is active speaker in the channel + * + * @param engine The engine kit + * @param speakerUid The speaker who is talking + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine activeSpeaker:(NSString * _Nonnull)speakerUid NS_SWIFT_NAME(rtcEngine(_:activeSpeaker:)); + +/** + * The audio quality of the user. updated every two seconds. + * + * @param engine The engine kit + * @param userId The id of user + * @param quality The audio quality + * @param delay The delay from the remote user + * @param lost The percentage of lost packets + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine audioQualityOfUid:(NSString * _Nonnull)userId quality:(AgoraNetworkQuality)quality delay:(NSUInteger)delay lost:(NSUInteger)lost NS_SWIFT_NAME(rtcEngine(_:audioQualityOfUid:quality:delay:lost:)); + +/** + * Occurs when the audio subscribe state changed. + * + * @param channelId The channel name of user joined. + * @param uid The remote user ID that is subscribed to. + * @param oldState The old state of the audio stream subscribe : #AgoraStreamSubscribeState. + * @param newState The new state of the audio stream subscribe : #AgoraStreamSubscribeState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioSubscribeStateChange:(NSString * _Nonnull)channelId + uid:(unsigned int)uid + oldState:(AgoraStreamSubscribeState)oldState + newState:(AgoraStreamSubscribeState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didAudioSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:)); + +/** + * Occurs when the audio publish state changed. + * + * @param channelId The channel name of user joined. + * @param oldState The old state of the audio stream publish : #AgoraStreamPublishState. + * @param newState The new state of the audio stream publish : #AgoraStreamPublishState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioPublishStateChange:(NSString * _Nonnull)channelId + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didAudioPublishStateChange:oldState:newState:elapseSinceLastState:)); + +#pragma mark Remote user video delegates +/** + * Event of the first frame of remote user is decoded successfully. + * + * @param engine The engine kit + * @param userId The remote user id + * @param size The size of video stream + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoDecodedOfUid:(NSString * _Nonnull)userId size:(CGSize)size elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteVideoDecodedOfUid:size:elapsed:)); + +/** + * Event of the first frame of remote user is rendering on the screen. + * + * @param engine The engine kit + * @param userId The remote user id + * @param size The size of video stream + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoFrameOfUid:(NSString * _Nonnull)userId size:(CGSize)size elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteVideoFrameOfUid:size:elapsed:)); + +/** Occurs when the local or remote video size or rotation has changed. + * + * @param engine AgoraRtcEngineKit object. + * @param sourceType The video source type. + * @param uid The user ID. 0 indicates the local user. + * @param size Size of the video (width and height) in pixels. + * @param rotation The rotation information of the video. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfSourceType:(AgoraVideoSourceType)sourceType uid:(NSString * _Nonnull)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOf:uid:size:rotation:)); +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine contentInspectResult:(AgoraContentInspectResult)result NS_SWIFT_NAME(rtcEngine(_:contentInspectResult:)); +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine snapshotTaken:(NSUInteger)uid filePath:(NSString* _Nonnull)filePath width:(NSInteger)width height:(NSInteger)height errCode:(NSInteger)errCode NS_SWIFT_NAME(rtcEngine(_:snapshotTaken:filePath:width:height:errCode:)); + +/** + * @technical preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine audioMetadataReceived:(NSString * _Nonnull)userId metadata:(NSData * _Nonnull)metadata NS_SWIFT_NAME(rtcEngine(_:audioMetadataReceived:metadata:)); +/** Occurs when the local video stream state changes + * + * This callback indicates the state of the local video stream, including camera capturing and video encoding, + * and allows you to troubleshoot issues when exceptions occur. + * + * @note For some device models, the SDK will not trigger this callback when the state of the local video changes + * while the local video capturing device is in use, so you have to make your own timeout judgment. + * @param engine AgoraRtcEngineKit object + * @param state State type #AgoraVideoLocalState. When the state is AgoraVideoLocalStateFailed (3), see the `error` parameter for details. + * @param error The detailed error information: #AgoraLocalVideoStreamError. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStateChangedOfState:(AgoraVideoLocalState)state + error:(AgoraLocalVideoStreamError)error + sourceType:(AgoraVideoSourceType)source NS_SWIFT_NAME(rtcEngine(_:localVideoStateChangedOf:error:sourceType:)); + +/** + * This callback indicates remote video stream state has changed. + * + * @param engine The engine kit + * @param userId The user id + * @param state Stopped // Default state, video is started or remote user disabled/muted video stream + Running // Running state, remote video can be displayed normally + Frozen // Remote video is frozen, probably due to network issue. + * @param reason Interal // Internal reasons. + * NetworkCongestion // Network congestion. + * NetworkRecovery // Network recovery. + * LocalMuted // The local user stops receiving the remote audio stream or disables the audio module. + * LocalUnmuted // The local user resumes receiving the remote audio stream or enables the audio module. + * RemoteMuted // The remote user stops sending the audio stream or disables the audio module. + * RemoteUnmuted // The remote user resumes sending the audio stream or enables the audio module. + * Offline // The remote user leaves the channel. + * AudioFallback //The remote media stream falls back to the audio-only stream due to poor network conditions. + * AudioFallbackRecovery // The remote media stream switches back to the video stream after the network conditions improve. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStateChangedOfUid:(NSString * _Nonnull)userId state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteReason)reason elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:remoteVideoStateChangedOfUid:state:reason:elapsed:)); + +/** + * Event of remote user audio muted or unmuted + * + * @param engine The engine kit + * @param muted Muted or unmuted + * @param userId The remote user id + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didAudioMuted:(BOOL)muted byUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:didAudioMuted:byUid:)); + +/** + * Event of remote user video muted or unmuted + * + * @param engine The engine kit + * @param muted Muted or unmuted + * @param userId The remote user id + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didVideoMuted:(BOOL)muted byUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:didVideoMuted:byUid:)); + +/** + * Event of remote user video enabled or disabled + * + * @param engine The engine kit + * @param enabled Enabled or disabled + * @param userId The remote user id + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didVideoEnabled:(BOOL)enabled byUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:didVideoEnabled:byUid:)); + +/** + * Event of remote user local video enabled or disabled + * + * @param engine The engine kit + * @param enabled Enabled or disabled + * @param userId The remote user id + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:didLocalVideoEnabled:byUid:)); + +/** + * Occurs when the remote user state is updated. + * + * @param engine The engine kit + * @param userId The remote user id + * @param state The remote user state + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteUserStateChangedOfUid:(NSString * _Nonnull)userId state:(NSUInteger)state NS_SWIFT_NAME(rtcEngine(_:remoteUserStateChangedOfUid:state:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine publishingRequestReceivedFromUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:publishingRequestReceivedFromUid:)); +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine publishingRequestAnsweredByOwner:(NSString * _Nonnull)userId accepted:(BOOL)accepted error:(AgoraErrorCode)error NS_SWIFT_NAME(rtcEngine(_:publishingRequestAnsweredByOwner:accepted:error:)); +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine unpublishingRequestReceivedFromOwner:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:unpublishingRequestReceivedFromOwner:)); +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamInjectedStatusOfUrl:(NSString * _Nonnull)url uid:(NSString * _Nonnull)userId status:(AgoraInjectStreamStatus)status NS_SWIFT_NAME(rtcEngine(_:streamInjectedStatusOfUrl:uid:status:)); + +/** Intra request received. + * @param engine The AgoraRtcEngineKit object. +*/ +- (void)rtcEngineIntraRequestReceived:(AgoraRtcEngineKit *_Nonnull)engine NS_SWIFT_NAME(rtcEngineIntraRequestReceived(_:)); + +/** Target bitrate updated. + * @param engine The AgoraRtcEngineKit object. + * @param bweInfo The uplink network info, including target bitrate bps. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine uplinkNetworkInfoUpdate:(AgoraUplinkNetworkInfo *_Nonnull)bweInfo NS_SWIFT_NAME(rtcEngine(_:uplinkNetworkInfoUpdate:)); + +/** Downlink network info updated. + * @param engine The AgoraRtcEngineKit object. + * @param networkInfo The downlink network info. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine downlinkNetworkInfoUpdate:(AgoraDownlinkNetworkInfo *_Nonnull)networkInfo NS_SWIFT_NAME(rtcEngine(_:downlinkNetworkInfoUpdate:)); + +#pragma mark Connection state delegates + +/** Occurs when the connection state of the SDK to the server is changed. + * + * @param state See #AgoraConnectionState. + * @param reason See #AgoraConnectionChangedReason. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine connectionChangedToState:(AgoraConnectionState)state reason:(AgoraConnectionChangedReason)reason NS_SWIFT_NAME(rtcEngine(_:connectionChangedTo:reason:)); + +/** + * Reports WIFI user message. + * When the user needs to be prompted to approach the AP or switch the frequency band connected to the AP, the SDK will trigger this callback to notify the APP. + * @param engine AgoraRtcEngineKit object. + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine wlAccMessage:(AgoraWlAccReason)reason action:(AgoraWlAccAction)action wlAccMsg:(NSString * _Nonnull)wlAccMsg NS_SWIFT_NAME(rtcEngine(_:wlAccMessage:action:wlAccMsg:)); + +/** + * Reports WIFI accelerate status. + * When the optimized end-to-end delay, frozen ratio and packet loss rate need to be displayed to the user, the SDK will trigger this callback to notify the APP. + * @param engine AgoraRtcEngineKit object. + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine wlAccStats:(AgoraWlAccStats * _Nonnull)currentStats averageStats:(AgoraWlAccStats * _Nonnull)averageStats NS_SWIFT_NAME(rtcEngine(_:wlAccStats:averageStats:)); + +/** + * Occurs when the connection state of the SDK to the server is changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param type See \ref AgoraNetworkType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine networkTypeChanged:(AgoraNetworkType)type NS_SWIFT_NAME(rtcEngine(_:networkTypeChanged:)); + +/** + * Occurs when permission error + * + * @param engine The AgoraRtcEngineKit object. + * @param type See \ref AgoraPermissionType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine permissionError:(AgoraPermissionType)type NS_SWIFT_NAME(rtcEngine(_:permissionError:)); + +/** Occurs when the state of the media stream relay changes. + + The SDK reports the state of the current media relay and possible error messages in this callback. + + @param engine AgoraRtcEngineKit object. + @param state The state code in [AgoraChannelMediaRelayState](AgoraChannelMediaRelayState). + @param error The error code in [AgoraChannelMediaRelayError](AgoraChannelMediaRelayError). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine +channelMediaRelayStateDidChange:(AgoraChannelMediaRelayState)state + error:(AgoraChannelMediaRelayError)error NS_SWIFT_NAME(rtcEngine(_:channelMediaRelayStateDidChange:error:)); + +/** Reports events during the media stream relay. + + @param engine AgoraRtcEngineKit object. + @param event The event code in [AgoraChannelMediaRelayEvent](AgoraChannelMediaRelayEvent). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine +didReceiveChannelMediaRelayEvent:(AgoraChannelMediaRelayEvent)event NS_SWIFT_NAME(rtcEngine(_:didReceive:)); + +/** Occurs when the video subscribe state changed. + * + * @param engine AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param uid The remote user ID that is subscribed to. + * @param oldState The old state of the video stream subscribe : #AgoraStreamSubscribeState. + * @param newState The new state of the video stream subscribe : #AgoraStreamSubscribeState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoSubscribeStateChange:(NSString * _Nonnull)channelId + uid:(unsigned int)uid + oldState:(AgoraStreamSubscribeState)oldState + newState:(AgoraStreamSubscribeState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:)); + +/** + * Occurs when the video publish state changed. + * + * @param engine AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param oldState The old state of the video stream publish : #AgoraStreamPublishState. + * @param newState The new state of the video stream publish : #AgoraStreamPublishState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoPublishStateChange:(NSString * _Nonnull)channelId +sourceType:(AgoraVideoSourceType)source + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState:)); + +#pragma mark Rhythm Player Delegates Methods + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRhythmPlayerStateChanged:(AgoraRhythmPlayerState)state + errorCode:(AgoraRhythmPlayerError)errorCode NS_SWIFT_NAME(rtcEngine(_:didRhythmPlayerStateChanged:errorCode:)); + +#pragma mark Local Video Transcoder Delegates Methods +/** + * Occurs when local video transcoder stream has error. + * + * @param stream Stream type of AgoraTranscodingVideoStream. + * @param error Error code of AgoraVideoTranscoderError. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoTranscoderErrorWithStream:(AgoraTranscodingVideoStream * _Nonnull )stream + errorCode:(AgoraVideoTranscoderError)errorCode NS_SWIFT_NAME(rtcEngine(_:didLocalVideoTranscoderErrorWithStream:errorCode:)); + +#pragma mark Remote Video Layout Info Delegates Methods +/** + * Occurs when local video transcoder stream has error. + * + * @param uid The ID of the remote user. + * @param videoLayoutInfo The `AgoraVideoLayoutInfo` object that contains video layout info of the remote user.. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didTranscodedStreamLayoutInfoUpdatedWithUserId:(NSUInteger)uid videoLayoutInfo:(AgoraVideoLayoutInfo* _Nonnull)videoLayoutInfo NS_SWIFT_NAME(rtcEngine(_:didTranscodedStreamLayoutInfoUpdatedWithUserId:videoLayoutInfo:)); + +@end diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineKit.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineKit.h new file mode 100644 index 0000000..43b21d8 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineKit.h @@ -0,0 +1,7464 @@ +// +// AgoraRtcEngineKit.h +// AgoraRtcEngineKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#import +#import "AgoraConstants.h" +#import "AgoraObjects.h" +#import "AgoraRtcEngineDelegate2.h" +#import "AgoraBaseDelegate.h" +#import "AgoraRtcMediaPlayerProtocol.h" + +/** Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through a virtual global network that is especially optimized for real-time web and mobile-to-mobile applications. + + The AgoraRtcEngineKit class is the entry point of the Agora SDK that provides simple APIs for applications to easily start voice and video communication. + */ +@class AgoraRtcEngineKit; + +/** + * The AgoraAudioFrameDelegate protocol enables audio frame callback event notifications to your application. + */ +@protocol AgoraAudioFrameDelegate +@optional + +/** + * Occurs when the recorded audio frame is received. + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @return + * - true: The recorded audio frame is valid and is encoded and sent. + * - false: The recorded audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onRecordAudioFrame:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onRecordAudioFrame(_:channelId:)); + +/** + * Occurs when the recorded audio frame is received. + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @return + * - true: The recorded audio frame is valid and is encoded and sent. + * - false: The recorded audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onPublishAudioFrame:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onPublishAudioFrame(_:channelId:)); + +/** + * Occurs when the playback audio frame is received. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @return + * - true: The playback audio frame is valid and is encoded and sent. + * - false: The playback audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onPlaybackAudioFrame:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onPlaybackAudioFrame(_:channelId:)); + +/** + * Occurs when the mixed audio data is received. + * @param frame The A pointer to the audio frame: AgoraAudioFrame. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @return + * - true: The mixed audio data is valid and is encoded and sent. + * - false: The mixed audio data is invalid and is not encoded or sent. + */ +- (BOOL)onMixedAudioFrame:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onMixedAudioFrame(_:channelId:)); + +/** + * Occurs when the ear monitoring audio frame is received. + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @return + * - true: The ear monitoring audio frame is valid and is encoded and sent. + * - false: The ear monitoring audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onEarMonitoringAudioFrame:(AgoraAudioFrame* _Nonnull)frame NS_SWIFT_NAME(onEarMonitoringAudioFrame(_:)); + +/** + * Occurs when the before-mixing playback audio frame is received. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid ID of the remote user. + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @return + * - true: The before-mixing playback audio frame is valid and is encoded and sent. + * - false: The before-mixing playback audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onPlaybackAudioFrameBeforeMixing:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId uid:(NSUInteger)uid NS_SWIFT_NAME(onPlaybackAudioFrame(beforeMixing:channelId:uid:)); + +/** + Sets the frame position for the audio observer. + * @return A bit mask that controls the frame position of the audio observer. + * @note - Use '|' (the OR operator) to observe multiple frame positions. + *

    + * After you successfully register the audio observer, the SDK triggers this callback each time it receives a audio frame. You can determine which position to observe by setting the return value. + * The SDK provides 4 positions for observer. Each position corresponds to a callback function: + * - `AgoraAudioFramePositionPlayback (1 << 0)`: The position for playback audio frame is received, which corresponds to the \ref onPlaybackFrame "onPlaybackFrame" callback. + * - `AgoraAudioFramePositionRecord (1 << 1)`: The position for record audio frame is received, which corresponds to the \ref onRecordFrame "onRecordFrame" callback. + * - `AgoraAudioFramePositionMixed (1 << 2)`: The position for mixed audio frame is received, which corresponds to the \ref onMixedFrame "onMixedFrame" callback. + * - `AgoraAudioFramePositionBeforeMixing (1 << 3)`: The position for playback audio frame before mixing is received, which corresponds to the \ref onPlaybackFrameBeforeMixing "onPlaybackFrameBeforeMixing" callback. + * @return The bit mask that controls the audio observation positions. + See AgoraAudioFramePosition. + */ + +- (AgoraAudioFramePosition)getObservedAudioFramePosition NS_SWIFT_NAME(getObservedAudioFramePosition()); + +/** Sets the audio mixing format for the + [onMixedAudioFrame]([AgoraAudioFrameDelegate onMixedAudioFrame:]) callback. + + Register the `getMixedAudioParams` callback when calling the + [setAudioFrameDelegate]([AgoraRtcEngineKit setAudioFrameDelegate:]) method. After you + successfully register the audio delegate, the SDK triggers this callback each + time it receives an audio frame. You can set the audio mixing format in + the return value of this callback. + + **Note**: + + - The SDK calculates the sample interval according to the `AgoraAudioParams` + you set in the return value of this callback and triggers the + `onMixedAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ +- (AgoraAudioParams* _Nonnull)getMixedAudioParams NS_SWIFT_NAME(getMixedAudioParams()); + +/** Sets the audio recording format for the + [onRecordAudioFrame]([AgoraAudioFrameDelegate onRecordAudioFrame:]) + callback. + + Register the `getRecordAudioParams` callback when calling the + [setAudioFrameDelegate]([AgoraRtcEngineKit setAudioFrameDelegate:]) method. After you + successfully register the audio delegate, the SDK triggers this callback each + time it receives an audio frame. You can set the audio recording format in + the return value of this callback. + + **Note**: + + - This callback applies to iOS only. + - The SDK calculates the sample interval according to the `AgoraAudioParams` + you set in the return value of this callback and triggers the + `onRecordAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ +- (AgoraAudioParams* _Nonnull)getRecordAudioParams NS_SWIFT_NAME(getRecordAudioParams()); + + +- (AgoraAudioParams* _Nonnull)getPublishAudioParams NS_SWIFT_NAME(getPublishAudioParams()); +/** Sets the audio playback format for the + [onPlaybackAudioFrame]([AgoraAudioFrameDelegate onPlaybackAudioFrame:]) + callback. + + Register the `getPlaybackAudioParams` callback when calling the + [setAudioFrameDelegate]([AgoraRtcEngineKit setAudioFrameDelegate:]) method. After you + successfully register the audio delegate, the SDK triggers this callback each + time it receives an audio frame. You can set the audio playback format in + the return value of this callback. + + **Note**: + + - The SDK calculates the sample interval according to the `AgoraAudioParams` + you set in the return value of this callback and triggers the + `onPlaybackAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ +- (AgoraAudioParams* _Nonnull)getPlaybackAudioParams NS_SWIFT_NAME(getPlaybackAudioParams()); + +/** Sets the audio recording format for the + [onEarMonitoringAudioFrame]([AgoraAudioFrameDelegate onEarMonitoringAudioFrame:]) + callback. + + Register the `getEarMonitoringAudioParams` callback when calling the + [setAudioFrameDelegate]([AgoraRtcEngineKit setAudioFrameDelegate:]) method. After you + successfully register the audio delegate, the SDK triggers this callback each + time it receives an audio frame. You can set the audio recording format in + the return value of this callback. + + **Note**: + + - This callback applies to iOS only. + - The SDK calculates the sample interval according to the `AgoraAudioParams` + you set in the return value of this callback and triggers the + `onEarMonitoringAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ +- (AgoraAudioParams* _Nonnull)getEarMonitoringAudioParams NS_SWIFT_NAME(getEarMonitoringAudioParams()); + +@end + +@protocol AgoraAudioEncodedFrameDelegate +@required + +/** + * Occurs when the record audio data is received. + */ +- (void)onRecordEncodedAudioFrame:(NSData* _Nonnull)frameData info:(AgoraEncodedAudioFrameInfo* _Nonnull)info NS_SWIFT_NAME(onRecordEncodedAudioFrame(_:info:)); + +/** + * Occurs when the playback audio data is received. + */ +- (void)onPlaybackEncodedAudioFrame:(NSData* _Nonnull)frameData info:(AgoraEncodedAudioFrameInfo* _Nonnull)info NS_SWIFT_NAME(onPlaybackEncodedAudioFrame(_:info:)); + +/** + * Occurs when the mixed audio data is received. + */ +- (void)onMixedEncodedAudioFrame:(NSData* _Nonnull)frameData info:(AgoraEncodedAudioFrameInfo* _Nonnull)info NS_SWIFT_NAME(onMixedEncodedAudioFrame(_:info:)); +/** + * Occurs when the publish audio data is received. + */ +- (void)onPublishEncodedAudioFrame:(NSData* _Nonnull)frameData info:(AgoraEncodedAudioFrameInfo* _Nonnull) info; +@end + +@protocol AgoraEncodedVideoFrameDelegate +@optional + +/** + * Occurs when get H264 video data interface before decoding + */ + +- (BOOL)onEncodedVideoFrameReceived:(NSData * _Nonnull )videoData length:(size_t)length info:(AgoraEncodedVideoFrameInfo * _Nonnull)videoFrameInfo NS_SWIFT_NAME(onEncodedVideoFrameReceived(_:length:info:)); +@end + +@protocol AgoraVideoFrameDelegate +@optional + +/** + * Occurs each time the SDK receives a video frame captured by the local camera. + * Notes: If getVideoFrameProcessMode is read-only, use MUST implement this method + * + * After you successfully register the video frame observer, the SDK triggers this callback each time + * a video frame is received. In this callback, you can get the video data captured by the local + * camera. You can then pre-process the data according to your scenarios. + * + * After pre-processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @param videoFrame A pointer to the video frame: AgoraOutputVideoFrame + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ +- (BOOL)onCaptureVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame sourceType:(AgoraVideoSourceType)sourceType; + +/** + * Occurs each time the SDK receives a video frame before encoding. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time + * when it receives a video frame. In this callback, you can get the video data before encoding. You can then + * process the data according to your particular scenarios. + * + * After processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * The video data that this callback gets has been pre-processed, with its content cropped, rotated, and the image enhanced. + * + * @param videoFrame A pointer to the video frame: VideoFrame + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ +- (BOOL)onPreEncodeVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame sourceType:(AgoraVideoSourceType)sourceType; + + +- (BOOL)onTranscodedVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame NS_SWIFT_NAME(onTranscodedVideoFrame(_:)); + +/** + * Occurs each time the SDK receives a video frame sent by the remote user. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time a + * video frame is received. In this callback, you can get the video data sent by the remote user. You + * can then post-process the data according to your scenarios. + * + * After post-processing, you can send the processed data back to the SDK by setting the `videoFrame` + * parameter in this callback. + * + * @param uid ID of the remote user who sends the current video frame. + * @param channelId Channel name. + * @param videoFrame A pointer to the video frame: AgoraOutputVideoFrame + * @return Determines whether to ignore the current video frame if the post-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ +- (BOOL)onRenderVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame uid:(NSUInteger)uid channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onRenderVideoFrame(_:uid:channelId:)); + +/** + * Occurs each time the SDK receives a video frame decoded by the MediaPlayer. + * + * After you successfully register the video frame observer, the SDK triggers this callback each + * time a video frame is decoded. In this callback, you can get the video data decoded by the + * MediaPlayer. You can then pre-process the data according to your scenarios. + * + * After pre-processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @note + * If the returned agora::media::base::VIDEO_PIXEL_DEFAULT format is specified by getVideoFormatPreference, + * the video frame you get through onMediaPlayerVideoFrame is in agora::media::base::VIDEO_PIXEL_I420 format. + * + * @param videoFrame A pointer to the video frame: AgoraOutputVideoFrame + * @param mediaPlayerId of the mediaPlayer. + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ +- (BOOL)onMediaPlayerVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame mediaPlayerId:(NSInteger)mediaPlayerId NS_SWIFT_NAME(onMediaPlayerVideoFrame(_:mediaPlayerId:)); + +/** + * Occurs each time needs to get rotation angle. + * @return rotation angle. + */ +- (BOOL)getRotationApplied NS_SWIFT_NAME(getRotationApplied()); + +/** + * Occurs each time needs to get whether mirror is applied or not. + * @return Determines whether to mirror. + * - true: need to mirror. + * - false: no mirror. + */ +- (BOOL)getMirrorApplied NS_SWIFT_NAME(getMirrorApplied()); + +/** + * Indicate the video frame mode of the observer. + * @return AgoraVideoFrameProcessMode + */ +- (AgoraVideoFrameProcessMode)getVideoFrameProcessMode NS_SWIFT_NAME(getVideoFrameProcessMode()); + +/** + * Occurs each time needs to get preference video frame type. + * @return AgoraVideoFormat. + */ +- (AgoraVideoFormat)getVideoFormatPreference NS_SWIFT_NAME(getVideoFormatPreference()); + +/** + * Sets the frame position for the video observer. + * + * After you successfully register the video observer, the SDK triggers this callback each time it receives + * a video frame. You can determine which position to observe by setting the return value. The SDK provides + * 3 positions for observer. Each position corresponds to a callback function: + * + * AgoraVideoFramePositionPostCapture(1 << 0): The position after capturing the video data, which corresponds to the onCaptureVideoFrame callback. + * AgoraVideoFramePositionPreRenderer(1 << 1): The position before receiving the remote video data, which corresponds to the onRenderVideoFrame callback. + * AgoraVideoFramePositionPreEncoder(1 << 2): The position before encoding the video data, which corresponds to the onPreEncodeVideoFrame callback. + * + * To observe multiple frame positions, use '|' (the OR operator). + * This callback observes AgoraVideoFramePositionPostCapture(1 << 0) and AgoraVideoFramePositionPreRenderer(1 << 1) by default. + * To conserve the system consumption, you can reduce the number of frame positions that you want to observe. + * + * @return A bit mask that controls the frame position of the video observer: AgoraVideoFramePosition. + */ +- (AgoraVideoFramePosition)getObservedFramePosition NS_SWIFT_NAME(getObservedFramePosition()); + +@end + +@protocol AgoraRtcMediaPlayerDelegate + +@optional + + +/** Reports the playback state change. + + @param playerKit AgoraRtcMediaPlayer + + @param state The new playback state after change. See AgoraMediaPlayerState. + + @param error The player's error code. See AgoraMediaPlayerError. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didChangedToState:(AgoraMediaPlayerState)state + error:(AgoraMediaPlayerError)error NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didChangedTo:error:)); + +/** Reports current playback progress. + + The callback occurs once every one second during the playback and reports + current playback progress. + + @param playerKit AgoraMediaPlayer + + @param positionMs Current playback progress (ms). + @param timestampMs The NTP timestamp (ms) when the position is sent. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didChangedToPosition:(NSInteger)positionMs + atTimestamp:(NSTimeInterval)timestampMs NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didChangedTo:atTimestamp:)); + +/** Reports the result of the seek operation. + + @param playerKit AgoraRtcMediaPlayer + @param eventCode AgoraMediaPlayerEvent + @param elapsedTime The playback elapsed time. + @param message NSString + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didOccurEvent:(AgoraMediaPlayerEvent)eventCode + elapsedTime:(NSInteger)elapsedTime + message:(NSString *_Nullable)message NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didOccur:elapsedTime:message:)); + +/** Reports the reception of the media metadata. + + The callback occurs when the player receivers the media metadata and reports + the detailed information of the media metadata. + + @param playerKit AgoraRtcMediaPlayer + + @param data The detailed data of the media metadata. + + @param length The length (byte) of the data. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didReceiveData:(NSString *_Nullable)data + length:(NSInteger)length NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didReceiveData:length:)); + +/** + * @brief Triggered when play buffer updated, once every 1 second + * + * @param playerKit AgoraRtcMediaPlayer + * @param playCachedBuffer NSInteger + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didPlayBufferUpdated:(NSInteger)playCachedBuffer NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didPlayBufferUpdated:)); + +/** + * @brief Triggered when the player preloadSrc + * + * @param playerKit AgoraRtcMediaPlayer + * @param event AgoraMediaPlayerPreloadEvent + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didPreloadEvent:(AgoraMediaPlayerPreloadEvent)event NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didPreloadEvent:)); + +/** + * @brief Reports current playback source bitrate changed. + * + * @param to Streaming media information after the change. + * @param from Streaming media information before the change. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit playerSrcInfoDidChange:(AgoraMediaPlayerSrcInfo *_Nonnull)to from:(AgoraMediaPlayerSrcInfo *_Nonnull)from NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:playerSrcInfoDidChange:from:)); + +/** + * @brief Triggered when media player information updated. + * + * @param info Include information of media player. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit infoUpdated:(AgoraMediaPlayerUpdatedInfo *_Nonnull)info NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:infoUpdated:)); + +/** + * @brief AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken(const char* + * src). + */ +- (void)onAgoraCDNTokenWillExpire NS_SWIFT_NAME(onAgoraCDNTokenWillExpire()); + +/** + * @brief Triggered when play volume updated, once every 200 millisecond + * + * @param volume volume of current player. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + volumeIndicationDidReceive:(NSInteger)volume NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:volumeIndicationDidReceive:)); +@end + + +@protocol AgoraRtcMediaPlayerVideoFrameDelegate +@optional +/** Occurs when each time the player receives a video frame. + + After registering the video frame observer, the callback occurs when each + time the player receives a video frame, reporting the detailed + information of the video frame. + + @param playerKit AgoraRtcMediaPlayer + + @param videoFrame The detailed information of the video frame. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didReceiveVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didReceiveVideoFrame:)); + +/** Occurs when each time the player receives a video frame. + + After registering the video frame observer, the callback occurs when each + time the player receives a video frame, reporting the detailed + information of the CVPixelBufferRef. + + @param playerKit AgoraRtcMediaPlayer + + @param pixelBuffer The detailed information of the CVPixelBufferRef. Format define by AgoraRtcMediaPlayerGetVideoPixelFormat. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didReceivePixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didReceivePixelBuffer:)); + +/** + * Occurs each time needs to get preference video frame type. + * @return AgoraVideoFormat. + */ +- (AgoraVideoFormat)AgoraRtcMediaPlayerGetVideoPixelFormat NS_SWIFT_NAME(AgoraRtcMediaPlayerGetVideoPixelFormat()); + +@end + + +@protocol AgoraRtcMediaPlayerAudioFrameDelegate + +/** Occurs when each time the player receives an audio frame. + + After registering the audio frame observer, the callback occurs when each + time the player receives an audio frame, reporting the detailed + information of the audio frame. + + @param playerKit AgoraRtcMediaPlayer + + @param audioFrame The detailed information of the audio frame. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didReceiveAudioFrame:(AgoraAudioFrame* _Nonnull)audioFrame NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didReceiveAudioFrame:)); + +@end + + +/** + * The event handler for direct cdn streaming + * + */ +@protocol AgoraDirectCdnStreamingEventDelegate + + @optional + +/** + * Event callback of direct cdn streaming + * @param state Current status + * @param error Error Code + * @param message Message + */ +- (void)onDirectCdnStreamingStateChanged:(AgoraDirectCdnStreamingState)state + error:(AgoraDirectCdnStreamingError)error + message:(NSString *_Nullable)message NS_SWIFT_NAME(onDirectCdnStreamingStateChanged(_:error:message:)); + +- (void)onDirectCdnStreamingStats:(AgoraDirectCdnStreamingStats *_Nonnull)stats NS_SWIFT_NAME(onDirectCdnStreamingStats(_:)); + +@end + +/** The definition of the AgoraMediaMetadataDataSource protocol. + * @note Implement all the callbacks in this protocol in the critical thread. We recommend avoiding any time-consuming + * operation in the critical thread. +*/ +@protocol AgoraMediaMetadataDataSource +@required + +/** Occurs when the SDK requests the maximum size of the metadata. +* +* After calling the \ref AgoraRtcEngineKit.setMediaMetadataDataSource:withType: setMediaMetadataDataSource method, +* the SDK triggers this callback to query the maximum size of your metadata. +* You must specify the maximum size in the return value and then pass it to the SDK. +* +* @return The maximum size (bytes) of the buffer of the metadata. See \ref AgoraMediaMetadataDataSource.readyToSendMetadataAtTimestamp: readyToSendMetadataAtTimestamp. The value must not exceed 1024 bytes. +* You must specify the maximum size in this return value. + */ +- (NSInteger)metadataMaxSize NS_SWIFT_NAME(metadataMaxSize()); + +/** Occurs when the SDK is ready to send metadata. + +You need to specify the metadata in the return value of this method. + + @note Ensure that the size of the metadata that you specify in this callback does not exceed the value set in the \ref AgoraMediaMetadataDataSource.metadataMaxSize metadataMaxSize callback. + @param timestamp The timestamp (ms) of the current metadata. + @return The metadata that you want to send in the format of NSData, including the following parameters: + - `uid`: ID of the user who sends the metadata. + - `size`: The size of the sent metadata. + - `buffer`: The sent metadata. + - `timeStampMs`: The NTP timestamp (ms) when the metadata is sent. + */ +- (NSData * _Nullable)readyToSendMetadataAtTimestamp:(NSTimeInterval)timestamp sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(readyToSendMetadata(atTimestamp:sourceType:)); + +@end + +/** The definition of AgoraMediaMetadataDelegate. +@note Implement the callback in this protocol in the critical thread. We recommend avoiding any time-consuming operation in the critical thread. +*/ +@protocol AgoraMediaMetadataDelegate +@required + +/** Occurs when the local user receives the metadata. + @param data The received metadata. + @param uid The ID of the user who sends the metadata. + @param timestamp The NTP timestamp (ms) when the metadata is sent. + @note If the receiver is audience, the receiver cannot get the NTP timestamp (ms) from `timestamp`. + */ +- (void)receiveMetadata:(NSData * _Nonnull)data fromUser:(NSInteger)uid atTimestamp:(NSTimeInterval)timestamp NS_SWIFT_NAME(receiveMetadata(_:fromUser:atTimestamp:)); + +@end + +/** + * The AgoraRtcEngineDelegate protocol enables callback event notifications to your application. + + The SDK uses delegate callbacks in the AgoraRtcEngineDelegate protocol to report runtime events to the application. + From v1.1, some block callbacks in the SDK are replaced with delegate callbacks. The old block callbacks are therefore deprecated, but can still be used in the current version. However, Agora recommends replacing block callbacks with delegate callbacks. The SDK calls the block callback if a callback is defined in both the block and delegate callbacks. + */ +@protocol AgoraRtcEngineDelegate +@optional + +#pragma mark Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Delegate Methods + + The SDK uses delegate callbacks in the AgoraRtcEngineDelegate protocol to report runtime events to the application. + From v1.1, some block callbacks in the SDK are replaced with delegate callbacks. The old block callbacks are therefore deprecated, but can still be used in the current version. However, Agora recommends replacing block callbacks with delegate callbacks. The SDK calls the block callback if a callback is defined in both the block and delegate callbacks. + * ----------------------------------------------------------------------------- + */ + +#pragma mark Core Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Core Delegate Methods + * ----------------------------------------------------------------------------- + */ +/** A warning occurred during SDK runtime. + + In most cases, the application can ignore the warnings reported by the SDK because the SDK can usually fix the issue and resume running. + For instance, the SDK may report an AgoraRtc_Error_OpenChannelTimeout(106) warning upon disconnection from the server and attempts to reconnect. + + @param engine AgoraRtcEngineKit object + @param warningCode AgoraWarningCode + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurWarning:(AgoraWarningCode)warningCode NS_SWIFT_NAME(rtcEngine(_:didOccurWarning:)); + +/** An error occurred during SDK runtime. + + In most cases, reporting an error means that the SDK cannot fix the issue and resume running, and therefore requires actions from the application or simply informs the user on the issue. + For instance, the SDK reports an AgoraErrorCodeStartCall = 1002 error when failing to initialize a call. In this case, the application informs the user that the call initialization failed and calls the \ref AgoraRtcEngineKit.leaveChannel: leaveChannel method to exit the channel. + + @param engine AgoraRtcEngineKit object + @param errorCode AgoraErrorCode + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurError:(AgoraErrorCode)errorCode NS_SWIFT_NAME(rtcEngine(_:didOccurError:)); + +/** The media engine loaded successfully. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineMediaEngineDidLoaded:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineMediaEngineDidLoaded(_:)); + +/** The media engine started successfully. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineMediaEngineDidStartCall:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineMediaEngineDidStartCall(_:)); + + +/** + * Occurs when the token has expired. + * + * If a token is specified when calling `joinChannelByToken`, + * the token expires after a certain period of time and you need a new token to + * reconnect to the server. + * + * Upon receiving this callback, generate a new token at your app server and + * call \ref AgoraRtcEngineKit.renewToken: renewToken to pass the new token + * to the SDK. + * @param engine The AgoraRtcEngineKit object. + * @sa [How to generate a token](https://docs.agora.io/en/Interactive%20Broadcast/token_server_cpp?platform=CPP). + */ +- (void)rtcEngineRequestToken:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRequestToken(_:)); + +/** + * Occurs when the token will expire in 30 seconds. + * + * If the token you specified when calling + * `joinChannelByToken` + * expires, the user drops offline. This callback is triggered 30 seconds + * before the token expires, to remind you to renew the token. + * Upon receiving this callback, generate a new token at your app server and + * call \ref AgoraRtcEngineKit.renewToken: renewToken to pass the new token + * to the SDK. + * @param engine The AgoraRtcEngineKit object. + * @param token The token that will expire in 30 seconds. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine tokenPrivilegeWillExpire:(NSString *_Nonnull)token NS_SWIFT_NAME(rtcEngine(_:tokenPrivilegeWillExpire:)); + +/** + * Occurs when connection license verification fails + * + * You can know the reason accordding to error code + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine licenseValidationFailure:(AgoraLicenseVerifyCode) error; + +/** The SDK disconnected from the server. + + Once the connection is lost, the SDK tries to reconnect it repeatedly until the application calls [leave](@ref AgoraRtcEngineKit.leaveChannel:) . + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineConnectionDidInterrupted:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidInterrupted(_:)); + + +/** + * Occurs when the SDK cannot reconnect to Agora's edge server 10 seconds after + * its connection to the server is interrupted. + * + * The SDK triggers this callback when it cannot connect to the server 10 seconds after calling + * `joinChannelByToken`, regardless of whether it is in the channel or not. + * @param engine The AgoraRtcEngineKit object. + */ +- (void)rtcEngineConnectionDidLost:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidLost(_:)); + + +/** A connection is banned by the server. + + The SDK will not try to reconnect the server. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineConnectionDidBanned:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidBanned(_:)); + +/** + * Occurs when the connection state of the SDK to the server is changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param type See \ref AgoraNetworkType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine networkTypeChanged:(AgoraNetworkType)type NS_SWIFT_NAME(rtcEngine(_:networkTypeChanged:)); + +/** + * Occurs when permission error + * + * @param engine The AgoraRtcEngineKit object. + * @param type See \ref AgoraPermissionType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine permissionError:(AgoraPermissionType)type NS_SWIFT_NAME(rtcEngine(_:permissionError:)); + +/** + * Occurs when the connection state of the SDK to the server is changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param state See \ref AgoraConnectionState. + * @param reason See \ref AgoraConnectionChangedReason. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine connectionChangedToState:(AgoraConnectionState)state reason:(AgoraConnectionChangedReason)reason NS_SWIFT_NAME(rtcEngine(_:connectionChangedTo:reason:)); + + +/** + * Reports WIFI user message. + * When the user needs to be prompted to approach the AP or switch the frequency band connected to the AP, the SDK will trigger this callback to notify the APP. + * @param engine AgoraRtcEngineKit object. + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine wlAccMessage:(AgoraWlAccReason)reason action:(AgoraWlAccAction)action wlAccMsg:(NSString * _Nonnull)wlAccMsg NS_SWIFT_NAME(rtcEngine(_:wlAccMessage:action:wlAccMsg:)); + +/** + * Reports WIFI accelerate status. + * When the optimized end-to-end delay, frozen ratio and packet loss rate need to be displayed to the user, the SDK will trigger this callback to notify the APP. + * @param engine AgoraRtcEngineKit object. + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine wlAccStats:(AgoraWlAccStats * _Nonnull)currentStats averageStats:(AgoraWlAccStats * _Nonnull)averageStats NS_SWIFT_NAME(rtcEngine(_:wlAccStats:averageStats:)); + +/** + * Reports the statistics of the current call. + * + * This callback is triggered once every two seconds after the user joins the channel. + * + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics on the current call: #AgoraChannelStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine reportRtcStats:(AgoraChannelStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:reportRtcStats:)); + + +/** The last mile network quality of the local user. + + This callback is triggered once after you have called [startLastmileProbeTest]([AgoraRtcEngineKit startLastmileProbeTest]) to report the network quality of the local user. + + @param engine AgoraRtcEngineKit object + @param quality AgoraNetworkQuality + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileQuality:(AgoraNetworkQuality)quality NS_SWIFT_NAME(rtcEngine(_:lastmileQuality:)); + + +/** + * Reports the last-mile network probe result. + * + * The SDK triggers this callback within 30 seconds after the app calls the \ref AgoraRtcEngineKit.startLastmileProbeTest: startLastmileProbeTest method. + * @param engine The AgoraRtcEngineKit object. + * @param result The uplink and downlink last-mile network probe test result, see \ref AgoraLastmileProbeResult. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileProbeTestResult:(AgoraLastmileProbeResult * _Nonnull)result NS_SWIFT_NAME(rtcEngine(_:lastmileProbeTest:)); + +/** + * The API call was executed successfully. + * @deprecated This callback is deprecated. Use other specific event callbacks instead. + * + * @param engine The AgoraRtcEngineKit object. + * @param error \ref AgoraErrorCode + * @param api The method executed by the SDK. + * @param result The result of the method call. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didApiCallExecute:(NSInteger)error api:(NSString * _Nonnull)api result:(NSString * _Nonnull)result NS_SWIFT_NAME(rtcEngine(_:didApiCallExecute:api:result:)) __deprecated; + + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) + +/** The specified device state. + + @note This method applies to macOS only. + + @param engine AgoraRtcEngineKit object + @param deviceId Device ID + @param deviceType AgoraMediaDeviceType + @param state State of the device: + + * 0: Added. + * 1: Removed. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine device:(NSString * _Nonnull)deviceId type:(AgoraMediaDeviceType)deviceType stateChanged:(NSInteger)state NS_SWIFT_NAME(rtcEngine(_:device:type:stateChanged:)); + +#endif + +/** An error of encryption occurred during SDK runtime. + + @param errorType AgoraEncryptionErrorType + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurEncryptionError:(AgoraEncryptionErrorType)errorType NS_SWIFT_NAME(rtcEngine(_:didOccur:)); +/** + * Reports the user log upload result + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine uploadLogResultRequestId:(NSString * _Nonnull)requestId success:(BOOL)success reason:(AgoraUploadErrorReason)reason NS_SWIFT_NAME(rtcEngine(_:uploadLogResultRequestId:success:reason:)); + +#pragma mark Local User Core Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Local User Core Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** + * Occurs when the local user successfully joins a specified channel. + * + * @param engine AgoraRtcEngineKit object + * @param channel The channel name. + * @param uid The user ID. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannelByToken` until this event occurs. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinChannel:(NSString * _Nonnull)channel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didJoinChannel:withUid:elapsed:)); + +/** + * Occurs when the local user rejoins a channel. + * + * If the client loses connection with the server because of network problems, + * the SDK automatically attempts to reconnect and then triggers this callback + * upon reconnection, indicating that the user rejoins the channel with the + * assigned channel ID and user ID. + * + * @param engine The AgoraRtcEngineKit object. + * @param channel The channel name. + * @param uid The user ID. + * @param elapsed Time elapsed (ms) from the local user calling `joinChannelByToken` until this event occurs. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRejoinChannel:(NSString * _Nonnull)channel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didRejoinChannel:withUid:elapsed:)); + +/** + * Occurs when the local user role switches in a live broadcast. + * + * @param engine The AgoraRtcEngineKit object. + * @param oldRole The role that the user switches from: #AgoraClientRole. + * @param newRole The role that the user switches to: #AgoraClientRole. + * @param newRoleOptions The client role option of the new role: #AgoraClientRoleOptions. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didClientRoleChanged:(AgoraClientRole)oldRole newRole:(AgoraClientRole)newRole newRoleOptions:(AgoraClientRoleOptions * _Nullable)newRoleOptions NS_SWIFT_NAME(rtcEngine(_:didClientRoleChanged:newRole:newRoleOptions:)); + +/** + * Occurs when the local user role switches in a live broadcast. + * + * @param engine The AgoraRtcEngineKit object. + * @param reason The reason of the failure of the local user role switches: #AgoraClientRoleChangeFailedReason. + * @param currentRole The current role of the user: #AgoraClientRole. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didClientRoleChangeFailed:(AgoraClientRoleChangeFailedReason)reason currentRole:(AgoraClientRole)currentRole NS_SWIFT_NAME(rtcEngine(_:didClientRoleChangeFailed:currentRole:)); + +/** + * Occurs when the local user leaves a channel. + * + * When the user successfully leaves the channel after calling + * \ref AgoraRtcEngineKit.leaveChannel: leaveChannel method, this callback + * notifies the app that a user leaves a channel. + * + * This callback also reports information such as the call duration and the + * statistics of data received or transmitted by the SDK. + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics of the call. See #AgoraChannelStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLeaveChannelWithStats:(AgoraChannelStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:didLeaveChannelWith:)); + + +/** The network quality of a specified user in a channel. + + This callback is triggered every two seconds to update the application on the network quality of the specified user in a communication or live broadcast channel. + + @param engine AgoraRtcEngineKit object + @param uid User ID + @param txQuality Network transmission quality defined in AgoraNetworkQuality. + @param rxQuality Network receiving quality defined in AgoraNetworkQuality. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine networkQuality:(NSUInteger)uid txQuality:(AgoraNetworkQuality)txQuality rxQuality:(AgoraNetworkQuality)rxQuality NS_SWIFT_NAME(rtcEngine(_:networkQuality:txQuality:rxQuality:)); + + +#pragma mark Local User Audio Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Local User Audio Delegate Methods + * ----------------------------------------------------------------------------- + */ +/** + * Occurs when the first local audio frame is published. + * + * @param engine The AgoraRtcEngineKit object. + * @param elapsed The time elapsed (ms) from calling `joinChannelByToken` until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalAudioFramePublished:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstLocalAudioFramePublished:)); + +/** + * Reports the statistics of the local audio stream. + * + * The SDK triggers this callback once every two seconds. + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics of the local audio stream. See \ref AgoraRtcLocalAudioStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localAudioStats:(AgoraRtcLocalAudioStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:localAudioStats:)); + +/** + * Occurs when the local audio stream state changes. + * + * This callback indicates the state change of the local audio stream, including + * the state of the audio recording and encoding, and allows you to troubleshoot + * issues when exceptions occur. + * + * @note + * When the state is `AgoraAudioLocalStateFailed`(3), see the `error` parameter for details. + * @param engine AgoraRtcEngineKit object + * @param state The state of the local audio. See \ref AgoraAudioLocalState. + * @param error The error information of the local audio. See \ref AgoraAudioLocalError. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localAudioStateChanged:(AgoraAudioLocalState)state error:(AgoraAudioLocalError)error NS_SWIFT_NAME(rtcEngine(_:localAudioStateChanged:error:)); + +/** + * Occurs when the local audio route changes. + * + * The SDK triggers this callback when the local audio route changes. + * @param engine The AgoraRtcEngineKit object. + * @param routing The audio route. See \ref AgoraAudioOutputRouting. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didAudioRouteChanged:(AgoraAudioOutputRouting)routing NS_SWIFT_NAME(rtcEngine(_:didAudioRouteChanged:)); + +/** The audio mixing file playback stopped after calling [startAudioMixing]([AgoraRtcEngineKit startAudioMixing:loopback:replace:cycle:]). + + If you failed to call [startAudioMixing]([AgoraRtcEngineKit startAudioMixing:loopback:replace:cycle:]), it returns the error code in the [didOccurError]([AgoraRtcEngineDelegate rtcEngine:didOccurError:]) callback. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineLocalAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineLocalAudioMixingDidFinish(_:)); + +/** Occurs when the local audio effect playback finishes. + + You can start a local audio effect playback by calling the \ref AgoraRtcEngineKit.playEffect:filePath:loopCount:pitch:pan:gain:publish: playEffect method. The SDK triggers this callback when the local audio effect file playback finishes. + + @param engine AgoraRtcEngineKit object. + @param soundId ID of the local audio effect. Each local audio effect has a unique ID. + */ +- (void)rtcEngineDidAudioEffectFinish:(AgoraRtcEngineKit * _Nonnull)engine soundId:(int)soundId NS_SWIFT_NAME(rtcEngineDidAudioEffectFinish(_:soundId:)); + + +#pragma mark Local User Video Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Local User Video Delegate Methods + * ----------------------------------------------------------------------------- + */ + + +/** A camera turned on and is ready to capture video. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineCameraDidReady:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineCameraDidReady(_:)); + +#if TARGET_OS_IPHONE + +/** A camera focus position changed. + + @param engine AgoraRtcEngineKit object + @param rect Focus rectangle in the local preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine cameraFocusDidChangedToRect:(CGRect)rect NS_SWIFT_NAME(rtcEngine(_:cameraFocusDidChangedTo:)); + +/** A camera exposure position changed. + + @param engine AgoraRtcEngineKit object + @param rect Exposure rectangle in the local preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine cameraExposureDidChangedToRect:(CGRect)rect NS_SWIFT_NAME(rtcEngine(_:cameraExposureDidChangedTo:)); + +#endif + +/** The video playback stopped. + + The application can use this callback to change the configuration of the view (for example, displaying other pictures in the view) after the video stops. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineVideoDidStop:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineVideoDidStop(_:)); + +/** Event of the first local video frame is published. + * @param engine The engine kit + * @param elapsed The elapsed time(ms) from the beginning of the session. + * @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFramePublishedWithElapsed:sourceType:)); + +/** The first local frame displayed on the video window. + + Same as [firstLocalVideoFrameBlock]([AgoraRtcEngineKit firstLocalVideoFrameBlock:]). + + @param engine The AgoraRtcEngineKit object. + @param size Size of the video (width and height). + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFrameWithSize:(CGSize)size elapsed:(NSInteger)elapsed sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFrameWith:elapsed:sourceType:)); + +/** Reports the statistics of the local video stream. + + * The SDK triggers this callback once every two seconds for each + * user/host. If there are multiple users/hosts in the channel, the SDK + * triggers this callback as many times. + * + * @note If you have called the + * \ref AgoraRtcEngineKit.enableDualStreamMode: enableDualStreamMode + * method, this callback reports the statistics of the high-video + * stream (high bitrate, and high-resolution video stream). + * @param engine The \ref AgoraRtcEngineKitobject. + * @param stats Statistics of the local video stream. See \ref AgoraRtcLocalVideoStats. + * @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(rtcEngine(_:localVideoStats:sourceType:)); + +/** The local published media stream fell back to an audio-only stream in poor network conditions or switched back to the video when the network conditions improved. + + If you call [setLocalPublishFallbackOption]([AgoraRtcEngineKit setLocalPublishFallbackOption:]) and set *option* as AgoraStreamFallbackOptionAudioOnly, this callback will be triggered when the local publish stream falls back to audio-only mode due to poor uplink conditions, or when the audio stream switches back to the video when the uplink network condition improves. + + @note Once the local publish stream falls back to audio only, the remote app will receive the [userMuteVideoBlock]([AgoraRtcEngineKit userMuteVideoBlock:])callback. + + @param engine The AgoraRtcEngineKit object. + @param isFallbackOrRecover * YES: The local publish stream fell back to audio-only due to poor network conditions. + * NO: The local publish stream switched back to the video when the network conditions improved. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalPublishFallbackToAudioOnly:(BOOL)isFallbackOrRecover NS_SWIFT_NAME(rtcEngine(_:didLocalPublishFallbackToAudioOnly:)); + +/** + * Reports the tracing result of video rendering event of the user. + * + * @param uid The user ID. + * @param currentEvent The current event of the tracing result: #AgoraMediaTraceEvent. + * @param tracingInfo The tracing result: #AgoraVideoRenderingTracingInfo. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoRenderingTracingResultOfUid:(NSUInteger)uid currentEvent:(AgoraMediaTraceEvent)currentEvent tracingInfo:(AgoraVideoRenderingTracingInfo * _Nonnull)tracingInfo NS_SWIFT_NAME(rtcEngine(_:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:)); + + + +#pragma mark Remote User Core Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Remote User Core Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** + * Occurs when a remote user or user joins the channel. + * + * If other users or hosts are already in the channel, the SDK also reports to + * the app on the existing users/hosts. + * + * The SDK triggers this callback under one of the following circumstances: + * - A remote user/host joins the channel by calling `joinChannelByToken`. + * - A remote user switches the user role to the host by calling + * \ref AgoraRtcEngineKit.setClientRole: setClientRole method after joining + * the channel. + * - A remote user/host rejoins the channel after a network interruption. + * @note + * When a web user joins the channel, this callback is triggered as long as the + * user publishes a stream. + @param engine The AgoraRtcEngineKit object. + @param uid The user ID. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didJoinedOfUid:elapsed:)); + +/** + * Occurs when a remote user or host goes offline. + * + * There are two reasons for a user to go offline: + * - Leave the channel: When the user leaves the channel, the user sends a + * goodbye message. When this message is received, the SDK determines that the + * user leaves the channel. + * - Drop offline: When no data packet of the user is received for a certain + * period of time, the SDK assumes that the user drops offline. A poor network + * connection may lead to false detection, so we recommend using + * the RTM SDK for reliable offline detection. + * + * @param engine The AgoraRtcEngineKit object. + * @param uid The ID of the user who goes offline. + * @param reason The reason why the user goes offline: #AgoraUserOfflineReason. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOfflineOfUid:(NSUInteger)uid reason:(AgoraUserOfflineReason)reason NS_SWIFT_NAME(rtcEngine(_:didOfflineOfUid:reason:)); + + +/** Occurs when the user receives the data stream. + +The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the \ref AgoraRtcEngineKit.sendStreamMessage:data: sendStreamMessage method within five seconds. + + @param engine AgoraRtcEngineKit object. + @param uid User ID of the remote user sending the message. + @param streamId Stream ID. + @param data Data received by the local user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine receiveStreamMessageFromUid:(NSUInteger)uid streamId:(NSInteger)streamId data:(NSData * _Nonnull)data NS_SWIFT_NAME(rtcEngine(_:receiveStreamMessageFromUid:streamId:data:)); + +/** Occurs when the user does not receive the data stream. + + The SDK triggers this callback when the local user fails to receive the stream message that the remote user sends by calling the \ref AgoraRtcEngineKit.sendStreamMessage:data: sendStreamMessage + method within five seconds. + + @param engine AgoraRtcEngineKit object. + @param uid User ID of the remote user sending the message. + @param streamId Stream ID. + @param error Error code. See \ref AgoraErrorCode. + @param missed Number of lost messages. + @param cached Number of incoming cached messages when the data stream is interrupted. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurStreamMessageErrorFromUid:(NSUInteger)uid streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached NS_SWIFT_NAME(rtcEngine(_:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached:)); + + +#pragma mark Remote User Audio Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Remote User Audio Delegate Methods + * ----------------------------------------------------------------------------- + */ + + +/** The first audio frame received and decoded from the remote user. + + @param engine The AgoraRtcEngineKit object. + @param uid Remote user ID. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteAudioFrameOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameOfUid:elapsed:)); + + +/** Occurs when the SDK decodes the first remote audio frame for playback. + + **Deprecated** from v3.0.0. Use `AgoraAudioRemoteStateDecoding(2)` in the [remoteAudioStateChangedOfUid]([AgoraRtcEngineDelegate rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:]) callback instead. + + This callback is triggered in either of the following scenarios: + + - The remote user joins the channel and sends the audio stream. + - The remote user stops sending the audio stream and re-sends it after 15 seconds. Reasons for such an interruption include: + + - The remote user leaves channel. + - The remote user drops offline. + - The remote user calls the [muteLocalAudioStream]([AgoraRtcEngineKit muteLocalAudioStream:]) method to stop sending the local audio stream. + - The remote user calls the [disableAudio]([AgoraRtcEngineKit disableAudio]) method to disable audio. + + @param engine AgoraRtcEngineKit object. + @param uid User ID of the remote user sending the audio stream. + @param elapsed The time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine firstRemoteAudioFrameDecodedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameDecodedOfUid:elapsed:)) __deprecated_msg("use rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed: instead."); + +/** + * Reports the statistics of the remote audio stream. + * + * The SDK triggers this callback once every two seconds for each remote user or broadcaster. If a + * channel has multiple remote users, the SDK triggers this callback as many times. + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics of the received audio. See \ref AgoraRtcRemoteAudioStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteAudioStats:(AgoraRtcRemoteAudioStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:remoteAudioStats:)); + +/** A remote user's audio was muted or unmuted. + + @param engine AgoraRtcEngineKit object + @param muted Mute or unmute + @param uid Remote user ID + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didAudioMuted:(BOOL)muted byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didAudioMuted:byUid:)); + + +/** + * This callback reports the IDs and volumes of the loudest speakers at the + * moment in the channel, and whether the local user is speaking. + * + * Once enabled, this callback is triggered at the set interval, regardless of + * whether a user speaks or not. + * + * The SDK triggers two independent `reportAudioVolumeIndicationOfSpeakers` + * callbacks at one time, which separately report the volume information of the + * local user and all the remote speakers. + * + * @param engine The AgoraRtcEngineKit object. + * @param speakers An array containing the user ID and volume information + * for each speaker: #AgoraRtcAudioVolumeInfo. + * - In the local user's callback, this array contains the following members: + * - `uid` = 0, + * - `volume` = `totalVolume`, which reports the sum of the voice volume + * and audio-mixing volume of the local user. + * - In the remote users' callback, this array contains the following members: + * - `uid` of each remote speaker. + * - `volume`, which reports the sum of the voice volume and audio-mixing + * volume of each remote speaker. + * An empty `speakers` array in the callback indicates that no remote user is + * speaking at the moment. + * @param totalVolume The total volume after audio mixing. The value ranges + * between 0 (the lowest volume) and 255 (the highest volume). + * - In the local user's callback, `totalVolume` is the sum of the voice volume + * and audio-mixing volume of the local user. + * - In the remote users' callback, `totalVolume` is the sum of the voice + * volume and audio-mixing volume of all the remote speakers. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine reportAudioVolumeIndicationOfSpeakers:(NSArray * _Nonnull)speakers totalVolume:(NSInteger)totalVolume NS_SWIFT_NAME(rtcEngine(_:reportAudioVolumeIndicationOfSpeakers:totalVolume:)); + + +/** + * Occurs when an active speaker is detected. + * + * If you have called \ref AgoraRtcEngineKit.enableAudioVolumeIndication:smooth: enableAudioVolumeIndication, + * this callback is triggered when the volume detecting unit has detected an + * active speaker in the channel. This callback also returns the `uid` of the + * active speaker. + * + * @note + * - You need to call `enableAudioVolumeIndication` to receive this callback. + * - The active speaker means the user ID of the speaker who speaks at the + * highest volume during a certain period of time. + * @param engine The AgoraRtcEngineKit object. + * @param speakerUid The ID of the active speaker. A `speakerUid` of 0 means + * the local user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine activeSpeaker:(NSUInteger)speakerUid NS_SWIFT_NAME(rtcEngine(_:activeSpeaker:)); + +/** Occurs when a remote user starts audio mixing. + + The SDK triggers this callback when a remote user calls the [startAudioMixing]([AgoraRtcEngineKit startAudioMixing:loopback:replace:cycle:]) method. + + @param engine AgoraRtcEngineKit object. + */ +- (void)rtcEngineRemoteAudioMixingDidStart:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRemoteAudioMixingDidStart(_:)); + +/** The remote user ended audio mixing. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineRemoteAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRemoteAudioMixingDidFinish(_:)); + +/** The audio quality of the specified user every two seconds. Same as [audioQualityBlock]([AgoraRtcEngineKit audioQualityBlock:]). + + @param engine The AgoraRtcEngineKit object. + @param uid User ID of the speaker. + @param quality AgoraNetworkQuality + @param delay Time delay (ms). + @param lost Packet loss rate (%). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine audioQualityOfUid:(NSUInteger)uid quality:(AgoraNetworkQuality)quality delay:(NSUInteger)delay lost:(NSUInteger)lost NS_SWIFT_NAME(rtcEngine(_:audioQualityOfUid:quality:delay:lost:)); + +/** The remote audio transport statistics. + + This callback is triggered every two seconds after the user receives the audio data packet sent from a remote user. + + @param engine The AgoraRtcEngineKit object. + @param uid User ID of the remote user whose audio data packet has been received. + @param delay Time delay (ms) from the remote user to the local client. + @param lost Packet loss rate (%). + @param rxKBitRate Received audio bitrate (kbit/s) of the packet from the remote user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine audioTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate NS_SWIFT_NAME(rtcEngine(_:audioTransportStatsOfUid:delay:lost:rxKBitRate:)); + + +/** Intra request received. + * @param engine The AgoraRtcEngineKit object. +*/ +- (void)rtcEngineIntraRequestReceived:(AgoraRtcEngineKit *_Nonnull)engine NS_SWIFT_NAME(rtcEngineIntraRequestReceived(_:)); + +/** Target bitrate updated. + * @param engine The AgoraRtcEngineKit object. + * @param networkInfo The uplink network info, including target bitrate bps. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine uplinkNetworkInfoUpdate:(AgoraUplinkNetworkInfo *_Nonnull)networkInfo NS_SWIFT_NAME(rtcEngine(_:uplinkNetworkInfoUpdate:)); + +/** Downlink network info updated. + * @param engine The AgoraRtcEngineKit object. + * @param networkInfo The network info. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine downlinkNetworkInfoUpdate:(AgoraDownlinkNetworkInfo *_Nonnull)networkInfo NS_SWIFT_NAME(rtcEngine(_:downlinkNetworkInfoUpdate:)); + +/** + * Occurs when the audio subscribe state changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param uid The remote user ID that is subscribed to. + * @param oldState The old state of the audio stream subscribe : #AgoraStreamSubscribeState. + * @param newState The new state of the audio stream subscribe : #AgoraStreamSubscribeState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioSubscribeStateChange:(NSString * _Nonnull)channelId + uid:(unsigned int)uid + oldState:(AgoraStreamSubscribeState)oldState + newState:(AgoraStreamSubscribeState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didAudioSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:)); + +/** + * Occurs when the audio publish state changed. + * + * @param channelId The channel name of user joined. + * @param oldState The old state of the audio stream publish : #AgoraStreamPublishState. + * @param newState The new state of the audio stream publish : #AgoraStreamPublishState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioPublishStateChange:(NSString * _Nonnull)channelId + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didAudioPublishStateChange:oldState:newState:elapseSinceLastState:)); + +#pragma mark String UID + +/** Occurs when the local user successfully registers a user account by calling the + * This callback reports the user ID and user account of the local user. + * @param engine The AgoraRtcEngineKit object. + * @param uid The ID of the local user. + * @param userAccount The user account of the local user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalUserRegisteredWithUserId:(NSUInteger)uid userAccount:(NSString * _Nonnull)userAccount NS_SWIFT_NAME(rtcEngine(_:didLocalUserRegisteredWithUserId:userAccount:)); + +/** Occurs when the SDK gets the user ID and user account of the remote user. + + * After a remote user joins the channel, the SDK gets the UID and user account of the remote user, + * caches them in a mapping table object (`userInfo`), and triggers this callback on the local client. + + * @param engine The AgoraRtcEngineKit object. + * @param uid The ID of the remote user. + * @param userInfo The `AgoraUserInfo` object that contains the user ID and user account of the remote user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didUserInfoUpdatedWithUserId:(NSUInteger)uid userInfo:(AgoraUserInfo* _Nonnull)userInfo NS_SWIFT_NAME(rtcEngine(_:didUserInfoUpdatedWithUserId:userInfo:)); + +#pragma mark Rhythm Player Delegates Methods + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRhythmPlayerStateChanged:(AgoraRhythmPlayerState)state + errorCode:(AgoraRhythmPlayerError)errorCode NS_SWIFT_NAME(rtcEngine(_:didRhythmPlayerStateChanged:errorCode:)); + +#pragma mark Local Video Transcoder Delegates Methods +/** + * Occurs when local video transcoder stream has error. + * + * @param stream Stream type of AgoraTranscodingVideoStream. + * @param error Error code of AgoraVideoTranscoderError. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoTranscoderErrorWithStream:(AgoraTranscodingVideoStream * _Nonnull )stream + errorCode:(AgoraVideoTranscoderError)errorCode NS_SWIFT_NAME(rtcEngine(_:didLocalVideoTranscoderErrorWithStream:errorCode:)); + +#pragma mark Remote Video Layout Info Delegates Methods +/** + * Occurs when local video transcoder stream has error. + * + * @param uid The ID of the remote user. + * @param videoLayoutInfo The `AgoraVideoLayoutInfo` object that contains video layout info of the remote user.. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didTranscodedStreamLayoutInfoUpdatedWithUserId:(NSUInteger)uid videoLayoutInfo:(AgoraVideoLayoutInfo* _Nonnull)videoLayoutInfo NS_SWIFT_NAME(rtcEngine(_:didTranscodedStreamLayoutInfoUpdatedWithUserId:videoLayoutInfo:)); + +#pragma mark Remote User Video Delegates Methods + +/**----------------------------------------------------------------------------- + * @name Remote User Video Delegates Methods + * ----------------------------------------------------------------------------- + */ + + +/** Occurs when the first frame of the remote user was decoded successfully. + + @deprecated This callback is deprecated. Use [remoteVideoStateChangedOfUid](remoteVideoStateChangedOfUid:state:reason:elapsed:) + instead. + + This callback is triggered upon the SDK receiving and successfully decoding + the first video frame from a remote video. The app can configure the + user view settings in this delegate. + + @param engine The AgoraRtcEngineKit object. + @param uid ID of the user whose video streams are received. + @param size Size of the video (width and height) in pixels. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteVideoDecodedOfUid:size:elapsed:)) __deprecated; + +/** The first frame of the remote user was displayed successfully. Same as [firstRemoteVideoFrameBlock]([AgoraRtcEngineKit firstRemoteVideoFrameBlock:]). + + @param engine The AgoraRtcEngineKit object. + @param uid Remote user ID. + @param size Size of the video (width and height) in pixels. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoFrameOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteVideoFrameOfUid:size:elapsed:)); + + /** Occurs when the local or remote video size or rotation has changed. + * + * @param engine AgoraRtcEngineKit object. + * @param sourceType The video source type. + * @param uid The user ID. 0 indicates the local user. + * @param size Size of the video (width and height) in pixels. + * @param rotation The rotation information of the video. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfSourceType:(AgoraVideoSourceType)sourceType uid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOf:uid:size:rotation:)); +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine contentInspectResult:(AgoraContentInspectResult)result NS_SWIFT_NAME(rtcEngine(_:contentInspectResult:)); +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine snapshotTaken:(NSUInteger)uid filePath:(NSString* _Nonnull)filePath width:(NSInteger)width height:(NSInteger)height errCode:(NSInteger)errCode NS_SWIFT_NAME(rtcEngine(_:snapshotTaken:filePath:width:height:errCode:)); + +/** + * @technical preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine audioMetadataReceived:(NSUInteger)uid metadata:(NSData * _Nonnull)metadata NS_SWIFT_NAME(rtcEngine(_:audioMetadataReceived:metadata:)); +/** Occurs when the local video stream state changes. + * + * This callback indicates the state of the local video stream, including camera capturing and video encoding, + * and allows you to troubleshoot issues when exceptions occur. + * + * @note For some device models, the SDK will not trigger this callback when the state of the local video changes + * while the local video capturing device is in use, so you have to make your own timeout judgment. + * @param engine AgoraRtcEngineKit object + * @param state State type #AgoraVideoLocalState. When the state is AgoraVideoLocalStateFailed (3), see the `error` parameter for details. + * @param error The detailed error information: #AgoraLocalVideoStreamError. + * @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStateChangedOfState:(AgoraVideoLocalState)state error:(AgoraLocalVideoStreamError)error sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(rtcEngine(_:localVideoStateChangedOf:error:sourceType:)); + +/** Occurs when the remote video state has changed. + * + * @note This callback does not work properly when the number of users (in the `AgoraChannelProfileCommunication` profile) or hosts + * (in the `AgoraChannelProfileLiveBroadcasting` profile) in the channel exceeds 17. + * + * @param engine AgoraRtcEngineKit object. + * @param uid ID of the user whose video state has changed. + * @param state The remote video state: #AgoraVideoRemoteState. + * @param reason The reason of the remote video state change: #AgoraVideoRemoteReason. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteReason)reason elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:remoteVideoStateChangedOfUid:state:reason:elapsed:)); + +/** + * Occurs when the state of a remote audio stream changes. + * + * @param engine The AgoraRtcEngineKit object. + * @param uid The ID of the user whose audio state has changed. + * @param state The state of the remote audio. See \ref AgoraAudioRemoteState. + * @param reason The reason of the remote audio state change. See \ref AgoraAudioRemoteReason. + * @param elapsed The time elapsed (ms) from calling `joinChannelByToken` until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteAudioStateChangedOfUid:(NSUInteger)uid state:(AgoraAudioRemoteState)state reason:(AgoraAudioRemoteReason)reason elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:remoteAudioStateChangedOfUid:state:reason:elapsed:)); + +/** Occurs when the state of the media stream relay changes. + + The SDK reports the state of the current media relay and possible error messages in this callback. + + @param engine AgoraRtcEngineKit object. + @param state The state code in [AgoraChannelMediaRelayState](AgoraChannelMediaRelayState). + @param error The error code in [AgoraChannelMediaRelayError](AgoraChannelMediaRelayError). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine +channelMediaRelayStateDidChange:(AgoraChannelMediaRelayState)state + error:(AgoraChannelMediaRelayError)error NS_SWIFT_NAME(rtcEngine(_:channelMediaRelayStateDidChange:error:)); + +/** Reports events during the media stream relay. + + @param engine AgoraRtcEngineKit object. + @param event The event code in [AgoraChannelMediaRelayEvent](AgoraChannelMediaRelayEvent). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine +didReceiveChannelMediaRelayEvent:(AgoraChannelMediaRelayEvent)event NS_SWIFT_NAME(rtcEngine(_:didReceive:)); + +/** A remote user's video paused or resumed. Same as [userMuteVideoBlock]([AgoraRtcEngineKit userMuteVideoBlock:]). + @deprecated + @note Invalid when the number of users in a channel exceeds 20. + + @param engine The AgoraRtcEngineKit object. + @param muted Paused or resumed: + + * Yes: Remote user's video paused. + * No: Remote user's video resumed. + + @param uid Remote user ID. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didVideoMuted:(BOOL)muted byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didVideoMuted:byUid:)) __deprecated_msg("use rtcEngine:remoteVideoStateChangedOfUid:state:reason: instead."); + +/** A remote user's video was enabled or disabled. + @deprecated + Once the video function is disabled, users can only perform an audio call and cannot see any video. + + @note Invalid when the number of users in a channel exceeds 20. + + @param engine The AgoraRtcEngineKit object. + @param enabled Enabled or disabled: + + * Yes: User has enabled the video function. + * No: User has disabled the video function. + + @param uid Remote user ID. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didVideoEnabled:byUid:)) __deprecated_msg("use rtcEngine:remoteVideoStateChangedOfUid:state:reason: instead."); + +/** A remote user's local video was enabled or disabled. + @deprecated + @param engine The AgoraRtcEngineKit object. + @param enabled Enabled or disabled: + + * Yes: User has enabled the local video function. + * No: User has disabled the local video function. + + @param uid Remote user ID. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didLocalVideoEnabled:byUid:)) __deprecated_msg("use rtcEngine:remoteVideoStateChangedOfUid:state:reason: instead."); + +/** Occurs when join success after calling [setLocalAccessPoint]([AgoraRtcEngineKit setLocalAccessPoint:channelId:info:uid:joinSuccess:]) or [setCloudProxy]([AgoraRtcEngineKit setCloudProxy:proxyType]) + @param engine AgoraRtcEngineKit object. + @param channel Channel name. + @param uid User ID. If the `uid` is specified in the [joinChannelByToken]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) method, the specified user ID is returned. If the user ID is not specified when the joinChannel method is called, the server automatically assigns a `uid`. + @param proxyType type of proxy agora sdk connected, proxyType will be AgoraNoneProxyType if not connected to proxy(fallback). + @param localProxyIp local proxy ip list, if not join local proxy, it will be "" + @param elapsed Time elapsed (ms) from the user calling the [joinChannelByToken]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) method until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine didProxyConnected:(NSString* _Nonnull)channel withUid:(NSUInteger)uid proxyType:(AgoraProxyType)proxyType localProxyIp:(NSString* _Nonnull)localProxyIp elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didProxyConnected:withUid:proxyType:localProxyIp:elapsed:)); + +/** + * Occurs when the remote user state is updated. + * + * @param engine The AgoraRtcEngineKit object. + * @param uid Remote user ID. + * @param state The remote user state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteUserStateChangedOfUid:(NSUInteger)uid state:(NSUInteger)state NS_SWIFT_NAME(rtcEngine(_:remoteUserStateChangedOfUid:state:)); + +/** + * Reports the statistics of the video stream from each remote user/host. + * + * The SDK triggers this callback once every two seconds for each remote user + * or host. If a channel includes multiple remote users, the SDK triggers this + * callback as many times. + * + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics of the received remote video streams. See + * #AgoraRtcRemoteVideoStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStats:(AgoraRtcRemoteVideoStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:remoteVideoStats:)); + + + /** The remote published media stream fell back to an audio-only stream in poor network conditions or switched back to the video when the network conditions improved. + + Once you enabled [setRemoteSubscribeFallbackOption]([AgoraRtcEngineKit setRemoteSubscribeFallbackOption:]), + this event will be triggered to receive audio only due to poor network conditions or resubscribes the video when the network condition improves. + + @note Once the remote subscribe stream is switched to the low stream due to poor network conditions, you can monitor the stream switch between a high and low stream in the [remoteVideoStats]([AgoraRtcEngineDelegate rtcEngine:remoteVideoStats:]) callback. + + @param engine The AgoraRtcEngineKit object. + @param isFallbackOrRecover * YES: The remote subscribe stream fell back to audio-only due to poor network conditions. + * NO: The remote subscribe stream switched back to the video stream when the network conditions improved. + @param uid Remote user ID + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRemoteSubscribeFallbackToAudioOnly:(BOOL)isFallbackOrRecover byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didRemoteSubscribeFallbackToAudioOnly:byUid:)); + +/** The remote video transport statistics. + + This callback is triggered every two seconds after the user receives the video data packet sent from a remote user. + + @param engine The AgoraRtcEngineKit object. + @param uid User ID of the remote user whose video packet has been received. + @param delay Time delay (ms) from the remote user to the local client. + @param lost Packet loss rate (%). + @param rxKBitRate Received video bitrate (kbit/s) of the packet from the remote user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate NS_SWIFT_NAME(rtcEngine(_:videoTransportStatsOfUid:delay:lost:rxKBitRate:)); + +/** + * Occurs when the video subscribe state changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param uid The remote user ID that is subscribed to. + * @param oldState The old state of the video stream subscribe : #AgoraStreamSubscribeState. + * @param newState The new state of the video stream subscribe : #AgoraStreamSubscribeState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoSubscribeStateChange:(NSString * _Nonnull)channelId + uid:(unsigned int)uid + oldState:(AgoraStreamSubscribeState)oldState + newState:(AgoraStreamSubscribeState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:)); + +/** + * Occurs when the video publish state changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + * @param oldState The old state of the video stream publish : #AgoraStreamPublishState. + * @param newState The new state of the video stream publish : #AgoraStreamPublishState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoPublishStateChange:(NSString * _Nonnull)channelId + sourceType:(AgoraVideoSourceType)sourceType + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState:)); + +#pragma mark Stream Publish Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Stream Publish Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/**----------------------------------------------------------------------------- + * @name CDN Live Streaming Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** Occurs when the state of the RTMP or RTMPS streaming changes. + +The SDK triggers this callback to report the result of the local user calling the [addPublishStreamUrl](addPublishStreamUrl:transcodingEnabled:) or [removePublishStreamUrl](removePublishStreamUrl:) method. + +This callback returns the URL and its current streaming state. + +This callback indicates the state of the RTMP or RTMPS streaming. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the `errorCode` parameter. + +@param engine AgoraRtcEngineKit object. +@param url The CDN streaming URL. +@param state The RTMP or RTMPS streaming state: AgoraRtmpStreamingState. +@param errCode The detailed error information for streaming: AgoraRtmpStreamingErrorCode. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine rtmpStreamingChangedToState:(NSString* _Nonnull)url state:(AgoraRtmpStreamingState)state errCode:(AgoraRtmpStreamingErrorCode)errCode NS_SWIFT_NAME(rtcEngine(_:rtmpStreamingChangedToState:state:errCode:)); + +/** Reports events during the RTMP or RTMPS streaming. + + @since v3.1.0 + + @param engine AgoraRtcEngineKit object. + @param url The RTMP or RTMPS streaming URL. + @param eventCode The event code. See AgoraRtmpStreamingEvent. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine rtmpStreamingEventWithUrl:(NSString* _Nonnull)url eventCode:(AgoraRtmpStreamingEvent)eventCode NS_SWIFT_NAME(rtcEngine(_:rtmpStreamingEventWithUrl:eventCode:)); + + +/** A stream was published. + + @param engine The AgoraRtcEngineKit object. + @param url Address to which the publisher publishes the stream. + @param errorCode [AgoraErrorCode]([AgoraErrorCode]) + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamPublishedWithUrl:(NSString * _Nonnull)url errorCode:(AgoraErrorCode)errorCode NS_SWIFT_NAME(rtcEngine(_:streamPublishedWithUrl:errorCode:)); + +/** A stream was unpublished. + + @param engine The AgoraRtcEngineKit object. + @param url Address to which the publisher unpublishes the stream. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamUnpublishedWithUrl:(NSString * _Nonnull)url NS_SWIFT_NAME(rtcEngine(_:streamUnpublishedWithUrl:)); + +/** The publisher transcoding was updated. + + @param engine The AgoraRtcEngineKit object. + */ +- (void)rtcEngineTranscodingUpdated:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineTranscodingUpdated(_:)); + +/** The status of the injected stream. + +@param engine The AgoraRtcEngineKit object. +@param url URL address added to the broadcast. +@param uid User ID +@param status AgoraInjectStreamStatus + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamInjectedStatusOfUrl:(NSString * _Nonnull)url uid:(NSUInteger)uid status:(AgoraInjectStreamStatus)status NS_SWIFT_NAME(rtcEngine(_:streamInjectedStatusOfUrl:uid:status:)); + +/** Audio mixing state changed. + * @param engine The AgoraRtcEngineKit object. + * @param state AgoraAudioMixingStateType + * @param reasonCode AgoraAudioMixingReasonCode +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingStateChanged:(AgoraAudioMixingStateType)state + reasonCode:(AgoraAudioMixingReasonCode)reasonCode NS_SWIFT_NAME(rtcEngine(_:audioMixingStateChanged:reasonCode:)); + +/** + * @brief Reports current AudioMixing progress. + * + * The callback occurs once every one second during the playback and reports the current playback progress. + * @param position Current AudioMixing progress (millisecond). + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingPositionChanged:(NSInteger)position NS_SWIFT_NAME(rtcEngine(_:audioMixingPositionChanged:)); + +#if TARGET_OS_IPHONE +#pragma mark Face Detection Delegate Methods +/**----------------------------------------------------------------------------- + * @name Face Detection Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** Reports the face detection result of the local user. (iOS only) + + **Since:** v3.0.1. + + Once you enable face detection by calling [enableFaceDetection]([AgoraRtcEngineKit enableFaceDetection:]), you can get the following information on the local user in real-time: + + - The width and height of the local video. + - The position of the human face in the local video. + - The distance between the human face and the device screen. This value is based on the fitting calculation of the local video size and the position of the human face. + + **Note** + + - If the SDK does not detect a face, it reduces the frequency of this callback to reduce power consumption on the local device. + - The SDK stops triggering this callback when a human face is in close proximity to the screen. + + @param engine AgoraRtcEngineKit object. + @param width The width (px) of the local video. + @param height The height (px) of the local video. + @param faces An AgoraFacePositionInfo array, which contains the information of the detected human face. + + The number of the AgoraFacePositionInfo array depends on the number of human faces detected. If the array length is 0, it means that no human face is detected. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine facePositionDidChangeWidth:(int)width previewHeight:(int)height faces:(NSArray* _Nullable)faces NS_SWIFT_NAME(rtcEngine(_:facePositionDidChangeWidth:previewHeight:faces:)); +#endif + +#pragma mark - Unavailable Delegate Methods +#if TARGET_OS_IPHONE +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStateChangedOfState:(AgoraVideoLocalState)state error:(AgoraLocalVideoStreamError)error NS_SWIFT_NAME(rtcEngine(_:localVideoStateChangedOf:error:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:localVideoStateChangedOfState:error:sourceType instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:localVideoStats:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:localVideoStats:sourceType instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoPublishStateChange:(NSString * _Nonnull)channelId + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoPublishStateChange:oldState:newState:elapseSinceLastState:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState: instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFramePublishedWithElapsed:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType: instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOfUid:size:rotation:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:videoSizeChangedOfSourceType:uid:size:rotation instead."))); +#endif + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStateChangedOfState:(AgoraVideoLocalState)state error:(AgoraLocalVideoStreamError)error NS_SWIFT_NAME(rtcEngine(_:localVideoStateChangedOf:error:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:localVideoStateChangedOfState:error:sourceType instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:localVideoStats:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:localVideoStats:sourceType instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoPublishStateChange:(NSString * _Nonnull)channelId + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoPublishStateChange:oldState:newState:elapseSinceLastState:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState: instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFramePublishedWithElapsed:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType: instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOfUid:size:rotation:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:videoSizeChangedOfSourceType:uid:size:rotation instead."))); +#endif +@end + +#pragma mark - AgoraRtcEngineKit + +/** + * Provides all methods that can be invoked by your application. + * + * Agora provides ensured quality of experience (QoE) for worldwide + * Internet-based voice and video communications through a virtual global + * network that is especially optimized for real-time web and mobile-to-mobile + * applications. + * + * `AgoraRtcEngineKit` is the basic interface class of Agora Native SDK. Creating an AgoraRtcEngineKit object and then calling the methods of this object enables the use of Agora Native SDK’s communication functionality. +*/ +__attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject + +#pragma mark Core Methods + +/**----------------------------------------------------------------------------- + * @name Core Methods + * ----------------------------------------------------------------------------- + */ + +/** + * Sets and retrieves the SDK delegate. + * + * The SDK uses the delegate to inform the app on engine runtime events. All methods defined in the + * delegate are optional implementation methods. + */ +@property(nonatomic, weak) id _Nullable delegate; + +/** + * Preload a channel. + * + * This method enables users to preload a channel. + * + * A successful call of this method will reduce the time of joining the same channel. + * + * Note: + * 1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available. + * 2. Renew the token of the preloaded channel by calling this method with the same 'channelId' and 'uid'. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid The user ID. This parameter is used to identify the user in the channel for real-time + * audio and video interaction. You need to set and manage user IDs yourself, and ensure that each + * user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value + * range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user + * ID and returns it in the onJoinChannelSuccess callback. Your application must record and maintain + * the returned user ID, because the SDK does not do so. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * preload the channel again. + */ +- (int)preloadChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + uid:(NSUInteger)uid NS_SWIFT_NAME(preloadChannel(byToken:channelId:uid:)); + +/** + * Preload a channel. + * + * This method enables users to preload a channel. + * + * A successful call of this method will reduce the time of joining the same channel. + * + * Note: + * 1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available. + * 2. Renew the token of the preloaded channel by calling this method with the same 'channelId' and 'userAccount'. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the userAccount parameter is empty. + * You need to pass in a valid parameter and preload the channel again. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * preload the channel again. + */ +- (int)preloadChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + userAccount:(NSString * _Nonnull)userAccount NS_SWIFT_NAME(preloadChannel(byToken:channelId:userAccount:)); + +/** + * Update token of the preloaded channels. + * + * An easy way to update all preloaded channels' tokens, if all preloaded channels use the same token. + * + * If preloaded channels use different tokens, we need to call the 'preloadChannel' method with the same 'channelId' + * and 'uid' or 'userAccount' to update the corresponding token. + * + * @param token The token generated on your server for authentication. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The token is invalid. You need to pass in a valid token and update the token again. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + */ +- (int)updatePreloadChannelToken:(NSString * _Nonnull)token NS_SWIFT_NAME(updatePreloadChannelToken(_:)); + +/** + * Joins a channel. + * + * Users in the same channel can talk to each other, and multiple users in the + * same channel can start a group chat. Users with different App IDs cannot + * call each other even if they join the same channel. + * + * You must call the \ref leaveChannel: leaveChannel method to exit the + * current call before entering another channel. This method call is + * asynchronous; therefore, you can call this method in the main user interface + * thread. + * + * A successful method call triggers the following callbacks: + * + * - The local client: \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. + * - The remote client: \ref AgoraRtcEngineDelegate.rtcEngine:didJoinedOfUid:elapsed: didJoinedOfUid, + * if the user joining the channel is in the Communication profile, or is a + * BROADCASTER in the Live Broadcast profile. + * + * When the connection between the client and Agora's server is interrupted due + * to poor network conditions, the SDK tries reconnecting to the server. When + * the local client successfully rejoins the channel, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didRejoinChannel:withUid:elapsed: didRejoinChannel callback on the local client. + * + * @note + * - When joining a channel, the SDK calls + * `setCategory(AVAudioSessionCategoryPlayAndRecord)` to set `AVAudioSession` + * to `PlayAndRecord` mode. When `AVAudioSession` is set to `PlayAndRecord` + * mode, the sound played (for example a ringtone) is interrupted. The app + * should not set `AVAudioSession` to any other mode. + * - The SDK uses the iOS's AVAudioSession shared object for audio recording + * and playback. Using this object may affect the SDK’s audio functions. + * @param token The token for authentication. + * - In situations not requiring high security: You can use the temporary token + * generated at Console. For details, see [Get a temporary token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-temporary-token). + * - In situations requiring high security: Set it as the token generated at + * you server. For details, see [Generate a token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-token). + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param info (Optional) Additional information about the channel. This + * parameter can be set to `nil` or contain channel related information. Other + * users in the channel do not receive this message. + * @param uid User ID. A 32-bit unsigned integer with a value ranging from 1 to + * (232-1). The `uid` must be unique. If a `uid` is not assigned (or + * set to 0), the SDK assigns and returns a `uid` in the callback. Your app + * must record and maintain the returned `uid` since the SDK does not do so. + * @param joinSuccessBlock Same as \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. We recommend you set this parameter as `nil` to use `didJoinChannel`. + * - If `joinSuccessBlock` is nil, the SDK triggers the `didJoinChannel` callback. + * - If you implement both `joinSuccessBlock` and `didJoinChannel`, `joinSuccessBlock` takes higher priority than `didJoinChannel`. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: #AgoraErrorCodeInvalidArgument + * - -3: #AgoraErrorCodeNotReady + * - -5: #AgoraErrorCodeRefused + */ +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + info:(NSString * _Nullable)info + uid:(NSUInteger)uid + joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannel(byToken:channelId:info:uid:joinSuccess:)); + +/** + * Joins a channel. + * + * Users in the same channel can talk to each other, and multiple users in the + * same channel can start a group chat. Users with different App IDs cannot + * call each other even if they join the same channel. + * + * You must call the \ref leaveChannel: leaveChannel method to exit the + * current call before entering another channel. This method call is + * asynchronous; therefore, you can call this method in the main user interface + * thread. + * + * A successful method call triggers the following callbacks: + * + * - The local client: \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. + * - The remote client: \ref AgoraRtcEngineDelegate.rtcEngine:didJoinedOfUid:elapsed: didJoinedOfUid, + * if the user joining the channel is in the Communication profile, or is a + * BROADCASTER in the Live Broadcast profile. + * + * When the connection between the client and Agora's server is interrupted due + * to poor network conditions, the SDK tries reconnecting to the server. When + * the local client successfully rejoins the channel, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didRejoinChannel:withUid:elapsed: didRejoinChannel callback on the local client. + * + * @note + * - When joining a channel, the SDK calls + * `setCategory(AVAudioSessionCategoryPlayAndRecord)` to set `AVAudioSession` + * to `PlayAndRecord` mode. When `AVAudioSession` is set to `PlayAndRecord` + * mode, the sound played (for example a ringtone) is interrupted. The app + * should not set `AVAudioSession` to any other mode. + * - The SDK uses the iOS's AVAudioSession shared object for audio recording + * and playback. Using this object may affect the SDK’s audio functions. + * @param token The token for authentication. + * - In situations not requiring high security: You can use the temporary token + * generated at Console. For details, see [Get a temporary token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-temporary-token). + * - In situations requiring high security: Set it as the token generated at + * you server. For details, see [Generate a token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-token). + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid User ID. A 32-bit unsigned integer with a value ranging from 1 to + * (232-1). The `uid` must be unique. If a `uid` is not assigned (or + * set to 0), the SDK assigns and returns a `uid` in the callback. Your app + * must record and maintain the returned `uid` since the SDK does not do so. + * @param mediaOptions AgoraRtcChannelMediaOptions Object. + * @param joinSuccessBlock Same as \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. We recommend you set this parameter as `nil` to use `didJoinChannel`. + * - If `joinSuccessBlock` is nil, the SDK triggers the `didJoinChannel` callback. + * - If you implement both `joinSuccessBlock` and `didJoinChannel`, `joinSuccessBlock` takes higher priority than `didJoinChannel`. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: #AgoraErrorCodeInvalidArgument + * - -3: #AgoraErrorCodeNotReady + * - -5: #AgoraErrorCodeRefused + */ +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + uid:(NSUInteger)uid + mediaOptions:(AgoraRtcChannelMediaOptions * _Nonnull)mediaOptions + joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannel(byToken:channelId:uid:mediaOptions:joinSuccess:)); + +- (int)startMultipleVideoStreams:(VIEW_CLASS * _Nonnull)view screen:(VIEW_CLASS * _Nonnull)screenView remotes:(NSArray * _Nullable)remoteViews NS_SWIFT_NAME(startMultipleVideoStreams(_:screen:remotes:)); + + +/** + * Leaves the channel. + * + * This method allows a user to leave the channel, for example, by hanging up or + * exiting a call. + * + * This method also releases all resources related to the call. + * + * This method is an asynchronous call, which means that the result of this + * method returns before the user has not actually left the channel. Once + * the user successfully leaves the channel, the SDK triggers the + * \ref AgoraRtcEngineDelegate.rtcEngine:didLeaveChannelWithStats: didLeaveChannelWithStats callback. + * + * @note + * - If you call \ref destroy immediately after this method, the leaveChannel + * process is interrupted, and the SDK does not trigger the + * `didLeaveChannelWithStats` callback. + * - When you call this method, the SDK deactivates the audio session on iOS by + * default, and may affect other apps. + * + * @param leaveChannelBlock This callback indicates that a user leaves a channel, and provides the statistics of the call in #AgoraChannelStats. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)leaveChannel:(void(^ _Nullable)(AgoraChannelStats * _Nonnull stat))leaveChannelBlock NS_SWIFT_NAME(leaveChannel(_:)); + +/** + * Leaves the channel. + * + * This method allows a user to leave the channel, for example, by hanging up or + * exiting a call. + * + * This method also releases all resources related to the call. + * + * This method is an asynchronous call, which means that the result of this + * method returns before the user has not actually left the channel. Once + * the user successfully leaves the channel, the SDK triggers the + * \ref AgoraRtcEngineDelegate.rtcEngine:didLeaveChannelWithStats: didLeaveChannelWithStats callback. + * + * @note + * - If you call \ref destroy immediately after this method, the leaveChannel + * process is interrupted, and the SDK does not trigger the + * `didLeaveChannelWithStats` callback. + * - When you call this method, the SDK deactivates the audio session on iOS by + * default, and may affect other apps. + * + * @param options The leave channel options. + * @param leaveChannelBlock This callback indicates that a user leaves a channel, and provides the statistics of the call in #AgoraChannelStats. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)leaveChannel:(AgoraLeaveChannelOptions * _Nonnull)options + leaveChannelBlock:(void (^ _Nullable)(AgoraChannelStats * _Nonnull))leaveChannelBlock NS_SWIFT_NAME(leaveChannel(_:leaveChannelBlock:)); + +/** + * Sets the channel profile. + * + * The SDK differentiates channel profiles and applies different optimization + * algorithms accordingly. + * + * @note + * - To ensure the quality of real-time communication, we recommend that all + * users in a channel use the same channel profile. + * - Call this method before calling `joinChannelByToken`. You + * cannot set the channel profile once you have joined the channel. + * + * @param profile The channel profile: #AgoraChannelProfile. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setChannelProfile:(AgoraChannelProfile)profile NS_SWIFT_NAME(setChannelProfile(_:)); + +/** + * Updates the channel media options after joining the channel. + * + * @param mediaOptions The channel media options: ChannelMediaOptions. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateChannelWithMediaOptions:(AgoraRtcChannelMediaOptions* _Nonnull)mediaOptions NS_SWIFT_NAME(updateChannel(with:)); + +/** + * Sets the role of a user. + * + * This method sets the role of a user as either a broadcaster or an audience. + * - The broadcaster sends and receives streams. + * - The audience receives streams only. + * @note + * By default, all users are audience regardless of the channel profile. Call + * this method to change the user role to BROADCASTER so that the user can send + * a stream. + * @param role Role of the client: #AgoraClientRole. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setClientRole:(AgoraClientRole)role NS_SWIFT_NAME(setClientRole(_:)); + +/** Sets the role of a user. + +This method is applicable only to the live interactive streaming profile. + +Sets the role of a user, such as a host or an audience (default), before joining a channel. + +This method can be used to switch the user role after a user joins a channel. + +When a user switches user roles after joining a channel, a successful method call triggers the following callback: + +- The local client: [didClientRoleChanged]([AgoraRtcEngineDelegate rtcEngine:didClientRoleChanged:newRole:]) +- Remote clients: [didJoinedOfUid]([AgoraRtcEngineDelegate rtcEngine:didJoinedOfUid:elapsed:]) or [didOfflineOfUid(AgoraUserOfflineReasonBecomeAudience)]([AgoraRtcEngineDelegate rtcEngine:didOfflineOfUid:reason:]) + + @param role The role of the user: + + - `AgoraClientRoleBroadcaster(1)`: Host. A host can both send and receive streams. + - `AgoraClientRoleAudience(2)`: Audience, the default role. An audience can only receive streams. + + @param options The client role of the user, see AgoraClientRoleOptions. + + @return - `0`(`AgoraRtmpStreamingErrorCodeOK`): Success. +- < `0`: Failure. + + - `-1`(`AgoraErrorCodeFailed`): A general error occurs (no specified reason). + - `-2`(`AgoraErrorCodeInvalidArgument`): The parameter is invalid. + - `-7`(`AgoraErrorCodeNotInitialized`): The SDK is not initialized. + */ +- (int)setClientRole:(AgoraClientRole)role options:(AgoraClientRoleOptions * _Nullable)options NS_SWIFT_NAME(setClientRole(_:options:)); + +/** + * Renews the token. + * + * Once a token is enabled and used, it expires after a certain period of time. + * + * Under the following circumstances, generate a new token on your server, and + * then call this method to renew it. Failure to do so results in the SDK + * disconnecting from the server. + * - The \ref AgoraRtcEngineDelegate.rtcEngine:tokenPrivilegeWillExpire: tokenPrivilegeWillExpire callback is triggered. + * - The \ref AgoraRtcEngineDelegate.rtcEngineRequestToken: rtcEngineRequestToken callback is triggered. + * - The `AgoraErrorCodeTokenExpired`(-109) error is reported. + * @param token The new token. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)renewToken:(NSString * _Nonnull)token NS_SWIFT_NAME(renewToken(_:)); + +/** + * Gets the connection state of the SDK. + * + * @return The connection state. See \ref AgoraConnectionState. + */ +- (AgoraConnectionState)getConnectionState NS_SWIFT_NAME(getConnectionState()); + +/** Starts to relay media streams across channels. + + After a successful method call, the SDK triggers the [channelMediaRelayStateDidChange]([AgoraRtcEngineDelegate rtcEngine:channelMediaRelayStateDidChange:error:]) and [didReceiveChannelMediaRelayEvent]([AgoraRtcEngineDelegate rtcEngine:didReceiveChannelMediaRelayEvent:]) callbacks, and these callbacks return the state and events of the media stream relay. + + - If the `channelMediaRelayStateDidChange` callback returns AgoraChannelMediaRelayStateRunning(2) and AgoraChannelMediaRelayStateIdle(0), and the `didReceiveChannelMediaRelayEvent` callback returns AgoraChannelMediaRelayEventSentToDestinationChannel(4), the SDK starts relaying media streams between the original and the destination channel. + - If the `channelMediaRelayStateDidChange` callback returns AgoraChannelMediaRelayStateFailure(3), an exception occurs during the media stream relay. + + **Note** + + - Call this method after the [joinChannel]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) method. + - This method takes effect only when you are a broadcaster in a Live-broadcast channel. + - After a successful method call, if you want to call this method again, ensure that you call the [stopChannelMediaRelay]([AgoraRtcEngineKit stopChannelMediaRelay]) method to quit the current relay. + - Contact sales-us@agora.io before implementing this function. + - We do not support string user accounts in this API. + + @param config The configuration of the media stream relay: [AgoraChannelMediaRelayConfiguration](AgoraChannelMediaRelayConfiguration). + + @return - 0: Success. + - < 0: Failure. + */ +- (int)startChannelMediaRelay:(AgoraChannelMediaRelayConfiguration * _Nonnull)config NS_SWIFT_NAME(startChannelMediaRelay(_:)); + +/** Updates the channels for media stream relay. + + After the channel media relay starts, if you want to relay the media stream to more channels, or leave the current relay channel, you can call the `updateChannelMediaRelay` method. + + After a successful method call, the SDK triggers the [didReceiveChannelMediaRelayEvent]([AgoraRtcEngineDelegate rtcEngine:didReceiveChannelMediaRelayEvent:]) callback with the AgoraChannelMediaRelayEventUpdateDestinationChannel(7) state code. + + **Note** + + - Call this method after the [startChannelMediaRelay]([AgoraRtcEngineKit startChannelMediaRelay:]) method to update the destination channel. + - This method supports adding at most four destination channels in the relay. If there are already four destination channels in the relay, remove the unnecessary ones with the `removeDestinationInfoForChannelName` method in channelMediaRelayConfiguration before calling this method. + + @param config The media stream relay configuration: [AgoraChannelMediaRelayConfiguration](AgoraChannelMediaRelayConfiguration). + + @return - 0: Success. + - < 0: Failure. + */ +- (int)updateChannelMediaRelay:(AgoraChannelMediaRelayConfiguration * _Nonnull)config NS_SWIFT_NAME(updateChannelMediaRelay(_:)); + +/** Stops the media stream relay. + + Once the relay stops, the broadcaster quits all the destination channels. + + After a successful method call, the SDK triggers the [channelMediaRelayStateDidChange]([AgoraRtcEngineDelegate rtcEngine:channelMediaRelayStateDidChange:error:]) callback. If the callback returns AgoraChannelMediaRelayStateIdle(0) and AgoraChannelMediaRelayErrorNone(0), the broadcaster successfully stops the relay. + + @note If the method call fails, the SDK triggers the [channelMediaRelayStateDidChange]([AgoraRtcEngineDelegate rtcEngine:channelMediaRelayStateDidChange:error:]) callback with the AgoraChannelMediaRelayErrorServerNoResponse(2) or AgoraChannelMediaRelayEventUpdateDestinationChannelRefused(8) state code. You can leave the channel by calling the [leaveChannel]([AgoraRtcEngineKit leaveChannel:]) method, and the media stream relay automatically stops. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)stopChannelMediaRelay NS_SWIFT_NAME(stopChannelMediaRelay()); + +/** pause the channels for media stream relay. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)pauseAllChannelMediaRelay NS_SWIFT_NAME(pauseAllChannelMediaRelay()); + +/** resume the channels for media stream relay. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)resumeAllChannelMediaRelay NS_SWIFT_NAME(resumeAllChannelMediaRelay()); + +/** Turn WIFI acceleration on or off. + * + * @note + * - This method is called before and after joining a channel. + * - Users check the WIFI router app for information about acceleration. Therefore, if this interface is invoked, the caller accepts that the caller's name will be displayed to the user in the WIFI router application on behalf of the caller. + * + * @param enabled + * - true:Turn WIFI acceleration on. + * - false:Turn WIFI acceleration off. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableWirelessAccelerate:(BOOL)enabled NS_SWIFT_NAME(enableWirelessAccelerate(_:)); + +- (int)startLocalVideoTranscoder:(AgoraLocalTranscoderConfiguration* _Nonnull)config NS_SWIFT_NAME(startLocalVideoTranscoder(_:)); + +- (int)updateLocalTranscoderConfiguration:(AgoraLocalTranscoderConfiguration* _Nonnull)config NS_SWIFT_NAME(updateLocalTranscoderConfiguration(_:)); + +- (int)stopLocalVideoTranscoder NS_SWIFT_NAME(stopLocalVideoTranscoder()); + + +/** + @brief Start tracing media rendering events. + @since v4.1.1 + @discussion + - SDK will trace media rendering events when this API is called. + - The tracing result can be obtained through callback `[AgoraRtcEngineDelegate rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:]` + @note + - By default, SDK will trace media rendering events when join channel. + - The start point of event tracing will be reset after leaving channel. + @return + - 0: Success. + - < 0: Failure. + - `-7(AgoraErrorCodeNotInitialized)`: The SDK is not initialized. + */ +- (int)startMediaRenderingTracing NS_SWIFT_NAME(startMediaRenderingTracing()); + +/** + @brief Enable instant media rendering. + @since v4.1.1 + @discussion + - This method enable SDK to render video or playout audio faster. + @note + - Once enable this mode, we should destroy rtc engine to disable it. + - Enable this mode, will sacrifice some part of experience. + @return + - 0: Success. + - < 0: Failure. + - `-7(AgoraErrorCodeNotInitialized)`: The SDK is not initialized. + */ +- (int)enableInstantMediaRendering NS_SWIFT_NAME(enableInstantMediaRendering()); + +/** + * @deprecated Web SDK interoperability is by default enabled. + * + * @param enabled Whether interoperability with the Agora Web SDK is enabled: + * - YES: Enabled. + * - NO: Disabled. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)enableWebSdkInteroperability:(BOOL)enabled NS_SWIFT_NAME(enableWebSdkInteroperability(_:)) __deprecated; + +/** + * Initializes the Agora SDK service. + * + * After the initialization, the service is set to enable audio by default. + * @note Ensure that you call this method before calling any other API. + * @warning Only users with the same App ID can call each other. + * @warning One AgoraRtcEngineKit can use only one App ID. If you need to + * change the App ID, call \ref destroy to release the current instance + * first, and then call this method to create a new instance. + @param appId [App ID](https://docs.agora.io/en/Agora%20Platform/terms?platform=All%20Platforms#a-nameappidaapp-id) of + your Agora project. + @param delegate AgoraRtcEngineDelegate. + @return An AgoraRtcEngineKit object. + */ ++ (instancetype _Nonnull)sharedEngineWithAppId:(NSString * _Nonnull)appId + delegate:(id _Nullable)delegate NS_SWIFT_NAME(sharedEngine(withAppId:delegate:)); + +/** Creates an AgoraRtcEngineKit instance. + + Unless otherwise specified, all the methods provided by the AgoraRtcEngineKit instance are executed asynchronously. Agora recommends calling these methods in the same thread. + + @note + - You must create the AgoraRtcEngineKit instance before calling any other method. + - You can create an AgoraRtcEngineKit instance either by calling this method or by calling \ref AgoraRtcEngineKit.sharedEngineWithAppId:delegate: sharedEngineWithAppId. The difference between `sharedEngineWithAppId` and this method is that this method enables you to specify the connection area. + - The SDK supports creating only one AgoraRtcEngineKit instance for an app for now. + + @param config Configurations for the AgoraRtcEngineKit instance. For details, see AgoraRtcEngineConfig. + @param delegate AgoraRtcEngineDelegate. + + @return - The AgoraRtcEngineKit instance, if this method call succeeds. + - The error code, if this method call fails. + + - `-1`(`AgoraErrorCodeFailed`): A general error occurs (no specified reason). + - `-2`(`AgoraErrorCodeInvalidArgument`): No `AgoraRtcEngineDelegate` object is specified. + - `-7`(`AgoraErrorCodeNotInitialized`): The SDK is not initialized. + - `-101`(`AgoraErrorCodeInvalidAppId`): The App ID is invalid. + */ ++ (instancetype _Nonnull)sharedEngineWithConfig:(AgoraRtcEngineConfig * _Nonnull)config + delegate:(id _Nullable)delegate NS_SWIFT_NAME(sharedEngine(with:delegate:)); + +/** + * This method releases all the resources used by the Agora SDK. This is useful + * for applications that occasionally make voice or video calls, to free up + * resources for other operations when not making calls. + * Once the application has called this method to destroy the created + * AgoraRtcEngineKit instance, no other methods in the SDK can be used and no + * callbacks occur. To start communications again, call + * \ref sharedEngineWithAppId:delegate: sharedEngineWithAppId to establish a + * new AgoraRtcEngineKit instance. + * @note + * - Call this method in the subthread. + * - This method is a synchronous call, which means that the result of + * this method call returns after the AgoraRtcEngineKit object resources are + * released. Do not call this method in any callback generated by the SDK, or + * it may result in a deadlock. + */ ++ (void)destroy NS_SWIFT_NAME(destroy()); + +#pragma mark Core Audio + +/**----------------------------------------------------------------------------- + * @name Core Audio + * ----------------------------------------------------------------------------- + */ + +/** + * Enables the audio. + * + * The audio is enabled by default. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAudio NS_SWIFT_NAME(enableAudio()); + +/** + * Disables the audio. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)disableAudio NS_SWIFT_NAME(disableAudio()); + +/** + * Enables or disables the local audio capture. + * + * The audio function is enabled by default. This method disables or re-enables the + * local audio function, that is, to stop or restart local audio capture and + * processing. + * + * This method does not affect receiving or playing the remote audio streams, + * and `enableLocalAudio` (NO) is applicable to scenarios where the user wants + * to receive remote audio streams without sending any audio stream to other users + * in the channel. + * + * @param enabled Determines whether to disable or re-enable the local audio function: + * - `YES`: (Default) Re-enable the local audio function, that is, to start local + * audio capture and processing. + * - `NO`: Disable the local audio function, that is, to stop local audio + * capture and processing. + * + * @return + * - 0: Success. + * - < 0: Failure. +*/ +- (int)enableLocalAudio:(BOOL)enabled NS_SWIFT_NAME(enableLocalAudio(_:)); + +/** + * Sets the audio profile. + * @note + * - Call this method before calling `joinChannelByToken`. + * - In scenarios requiring high-quality audio, Agora recommends setting `profile` + * as `AgoraAudioProfileMusicHighQuality`(4). + * - To set the audio scenario, call the \ref sharedEngineWithConfig:delegate: sharedEngineWithConfig + * method. + * @param profile The audio profile, such as the sample rate, bitrate, encoding mode, and the number of + * channels, see #AgoraAudioProfile. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setAudioProfile:(AgoraAudioProfile)profile NS_SWIFT_NAME(setAudioProfile(_:)); + +- (int)setAudioScenario:(AgoraAudioScenario)scenario NS_SWIFT_NAME(setAudioScenario(_:)); + +/** + * Enables the `reportAudioVolumeIndicationOfSpeakers` callback to report on + * which users are speaking and the speakers' volume. + * + * Once the \ref AgoraRtcEngineDelegate.rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: reportAudioVolumeIndicationOfSpeakers + * callback is enabled, the SDK returns the volume indication in the at the + * time interval set in `enableAudioVolumeIndication`, regardless of whether + * any user is speaking in the channel. + * + * @param interval Sets the time interval between two consecutive volume indications: + * - <= 0: Disables the volume indication. + * - > 0: Time interval (ms) between two consecutive volume indications, + * and should be integral multiple of 200 (less than 200 will be set to 200). + * @param smooth The smoothing factor that sets the sensitivity of the audio + * volume indicator. The value range is [0, 10]. The greater the value, the + * more sensitive the indicator. The recommended value is 3. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAudioVolumeIndication:(NSInteger)interval + smooth:(NSInteger)smooth + reportVad:(BOOL)reportVad NS_SWIFT_NAME(enableAudioVolumeIndication(_:smooth:reportVad:)); + + +#if TARGET_OS_IPHONE +/** + * Enables/Disables the speakerphone temporarily. (iOS only) + * + * When the audio route changes, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didAudioRouteChanged: didAudioRouteChanged callback. + * + * You can call this method before, during, or after a call. However, Agora recommends calling this method only when you are in a channel to change the audio route temporarily. + * @note + * - The SDK calls `setCategory(AVAudioSessionCategoryPlayAndRecord)` with options to configure the headset or speakerphone, so this method call applies to all audio playback in the system. + * - This method sets the audio route temporarily. Plugging in or unplugging a headphone, or the SDK re-enabling the audio device module (ADM) + * to adjust the media volume in some scenarios relating to audio, leads to a change in the audio route. See *Principles for Changing the Audio Route*. + * @param enableSpeaker Whether to set the speakerphone as the temporary audio route: + * - `YES`: Set the speakerphone as the audio route temporarily. This setting does not take effect if a headphone or a Bluetooth audio device is connected. + * - `NO`: Do not set the speakerphone as the audio route. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setEnableSpeakerphone:(BOOL)enableSpeaker NS_SWIFT_NAME(setEnableSpeakerphone(_:)); + +/** + * Checks whether the speakerphone is enabled. (iOS only) + * + * @return + * - `YES`: The speakerphone is enabled, and the audio plays from the + * speakerphone. + * - `NO`: The speakerphone is not enabled, and the audio plays from devices + * other than the speakerphone. For example, the headset or earpiece. + */ +- (BOOL)isSpeakerphoneEnabled NS_SWIFT_NAME(isSpeakerphoneEnabled()); + +/** + * Sets the default audio route. (iOS only) + * + * Most mobile phones have two audio routes: An earpiece at the top, and a speakerphone at the bottom. + * The earpiece plays at a lower volume, and the speakerphone plays at a higher volume. + * + * By setting the default audio route, you determine whether the audio playback comes through the earpiece or speakerphone + * when no external audio device is connected. + * + * Depending on the scenario, Agora uses different default audio routes: + * - Voice call: Earpiece + * - Audio broadcast: Speakerphone + * - Video call: Speakerphone + * - Video broadcast: Speakerphone + * + * Call this method to change the default audio route before, during, or after a call. + * When the audio route changes, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didAudioRouteChanged: didAudioRouteChanged callback. + * @note + * The system audio route changes when an external audio device, such as a headphone or a Bluetooth audio device, is connected. See *Principles for Changing the Audio Route*. + * @param defaultToSpeaker Whether to set the speakerphone as the default audio route: + * - `YES`: Set the speakerphone as the default audio route. + * - `NO`: Do not set the speakerphone as the default audio route. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDefaultAudioRouteToSpeakerphone:(BOOL)defaultToSpeaker NS_SWIFT_NAME(setDefaultAudioRouteToSpeakerphone(_:)); +#endif + +/** Adjusts the recording volume. + + @param volume Recording volume; ranges from 0 to 400: + + * 0: Mute + * 100: Original volume + * 400: (Maximum) Four times the original volume with signal clipping protection + + @return * 0: Success. +* <0: Failure. + */ +- (int)adjustRecordingSignalVolume:(NSInteger)volume NS_SWIFT_NAME(adjustRecordingSignalVolume(_:)); + +/** Adjusts the playback volume. + + @param volume Playback volume; ranges from 0 to 400: + + * 0: Mute + * 100: Original volume + * 400: (Maximum) Four times the original volume with signal clipping protection + + @return * 0: Success. +* <0: Failure. + */ +- (int)adjustPlaybackSignalVolume:(NSInteger)volume NS_SWIFT_NAME(adjustPlaybackSignalVolume(_:)); + +/** Adjust the playback signal volume of a specified remote user. + + You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user. + + **Note** + + - Call this method after joining a channel. + - The playback volume here refers to the mixed volume of a specified remote user. + - This method can only adjust the playback volume of one specified remote user at a time. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. + + @param uid The ID of the remote user. + @param volume The playback volume of the specified remote user. The value ranges from 0 to 100: + + - 0: Mute. + - 100: Original volume. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)adjustUserPlaybackSignalVolume:(NSUInteger)uid volume:(int)volume NS_SWIFT_NAME(adjustUserPlaybackSignalVolume(_:volume:)); + +/** Mutes the recording signal. + + @param muted * YES: Mute the recording signal + * NO: Unmute the recording signal + + @return * 0: Success. +* <0: Failure. + */ +- (int)muteRecordingSignal:(BOOL)muted NS_SWIFT_NAME(muteRecordingSignal(_:)); + +/** + * Stops or resumes sending the local audio stream. + * + * @param mute Whether to send or stop sending the local audio stream: + * - `YES`: Stops sending the local audio stream. + * - `NO`: (Default) Sends the local audio stream. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteLocalAudioStream:(BOOL)mute NS_SWIFT_NAME(muteLocalAudioStream(_:)); + +/** + * Stops/Resumes receiving the audio stream of a specified user. + * + * You can call this method before or after joining a channel. + * If a user leaves a channel, the settings in this method become invalid. + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the audio stream of the specified user: + * - `YES`: Stop receiving the audio stream of the specified user. + * - `NO`: (Default) Resume receiving the audio stream of the specified user. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteRemoteAudioStream:(NSUInteger)uid mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteAudioStream(_:mute:)); + +/** + * Stops/Resumes receiving all remote audio streams. + * + * This method works for all remote users that join or will join a channel. You can call this method before, during, or after a call. + * - If you call `muteAllRemoteAudioStreams`(YES) before joining a channel, the local user does not receive any audio stream after joining the channel. + * - If you call `muteAllRemoteAudioStreams`(YES) after joining a channel, the local use stops receiving any audio stream from any user in the channel, including any user who joins the channel after you call this method. + * - If you call `muteAllRemoteAudioStreams`(YES) after leaving a channel, the local user does not receive any audio stream the next time the user joins a channel. + * + * After you successfully call `muteAllRemoteAudioStreams`(YES), you can take the following actions: + * - To resume receiving all remote audio streams, call `muteAllRemoteAudioStreams`(NO). + * - To resume receiving the audio stream of a specified user, call \ref muteRemoteAudioStream:mute: muteRemoteAudioStream(uid, NO), where `uid` is the ID of the user whose audio stream you want to resume receiving. + * + * @note + * - The result of calling this method is affected by calling \ref enableAudio and \ref disableAudio. Settings in `muteAllRemoteAudioStreams` stop taking effect if either of the following occurs: + * - Calling `enableAudio` after `muteAllRemoteAudioStreams`(YES). + * - Calling `disableAudio` after `muteAllRemoteAudioStreams`(NO). + * - In scenarios involving multiple channels, use \ref AgoraRtcChannelMediaOptions.autoSubscribeAudio autoSubscribeAudio to set whether to receive remote audio streams for a specific channel. + * @param mute Whether to stop receiving remote audio streams: + * - `YES`: Stop receiving any remote audio stream. + * - `NO`: (Default) Resume receiving all remote audio streams. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)muteAllRemoteAudioStreams:(BOOL)mute NS_SWIFT_NAME(muteAllRemoteAudioStreams(_:)); + +/** + * @deprecated + * To set whether to receive remote audio streams by default, call \ref muteAllRemoteAudioStreams: muteAllRemoteAudioStreams before calling `joinChannelByToken`. + * + * Determines whether to receive all remote audio streams by default. + * + * @param mute Whether to receive remote audio streams by default: + * - `YES`: Do not receive any remote audio stream by default. + * - `NO`: (Default) Receive remote audio streams by default. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setDefaultMuteAllRemoteAudioStreams:(BOOL)mute NS_SWIFT_NAME(setDefaultMuteAllRemoteAudioStreams(_:)) __deprecated; + +/** + * Registers an extension. Normally, you should call this function immediately after initializing the engine. + * Once an extension is registered, SDK will create and add extension to pipeline automatically. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param sourceType The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)registerExtensionWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + sourceType:(AgoraMediaSourceType)sourceType NS_SWIFT_NAME(registerExtension(withVendor:extension:sourceType:)); + +/** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtensionWithVendor, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtensionWithVendor explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param enabled Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableExtensionWithVendor:(NSString * __nonnull)provider extension:(NSString * __nonnull)extension enabled:(BOOL)enabled NS_SWIFT_NAME(enableExtension(withVendor:extension:enabled:)); + +/** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtensionWithVendor, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtensionWithVendor explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param enabled Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * @param sourceType The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableExtensionWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + enabled:(BOOL)enabled + sourceType:(AgoraMediaSourceType)sourceType NS_SWIFT_NAME(enableExtension(withVendor:extension:enabled:sourceType:)); + +/** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtensionWithVendor, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtensionWithVendor explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension definition see AgoraExtensionInfo + * @param enabled Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableExtensionWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + extensionInfo:(AgoraExtensionInfo * __nonnull)extensionInfo + enabled:(BOOL)enabled NS_SWIFT_NAME(enableExtension(withVendor:extension:extensionInfo:enabled:)); + +/** + * Sets the provider property of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExtensionProviderPropertyWithVendor:(NSString * __nonnull)provider + key:(NSString * __nonnull)key + value:(NSString * __nonnull)value NS_SWIFT_NAME(setExtensionProviderPropertyWithVendor(_:key:value:)); + +/** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return true, if get property success, otherwise false + */ +- (int)setExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + key:(NSString * __nonnull)key + value:(NSString * __nonnull)value NS_SWIFT_NAME(setExtensionPropertyWithVendor(_:extension:key:value:)); + +/** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * @param sourceType The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + key:(NSString * __nonnull)key + value:(NSString * __nonnull)value + sourceType:(AgoraMediaSourceType)sourceType NS_SWIFT_NAME(setExtensionPropertyWithVendor(_:extension:key:value:sourceType:)); +/** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. See AgoraExtensionInfo. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + extensionInfo:(AgoraExtensionInfo * __nonnull)extensionInfo + key:(NSString * __nonnull)key + value:(NSString * __nonnull)value NS_SWIFT_NAME(setExtensionPropertyWithVendor(_:extension:extensionInfo:key:value:)); + +/** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * + * @return + * - json formatted string of property's value; return null if failed + */ +- (NSString * _Nullable)getExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + key:(NSString * __nonnull)key NS_SWIFT_NAME(getExtensionProperty(withVendor:extension:key:)); + +/** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param sourceType The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType. + * + * @return + * - json formatted string of property's value; return null if failed + */ +- (NSString * _Nullable)getExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + key:(NSString * __nonnull)key + sourceType:(AgoraMediaSourceType)sourceType NS_SWIFT_NAME(getExtensionProperty(withVendor:extension:key:sourceType:)); + +/** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. See AgoraExtensionInfo. + * @param key The key of the extension. + * + * @return + * - json formatted string of property's value; return null if failed + */ +- (NSString * _Nullable)getExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + extensionInfo:(AgoraExtensionInfo * __nonnull)extensionInfo + key:(NSString * __nonnull)key NS_SWIFT_NAME(getExtensionProperty(withVendor:extension:extensionInfo:key:)); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) + +/** Enables loopback sampling. (macOS only) + * If you enable loopback sampling, the output of the sound card is mixed into the audio stream sent to the other end. + + * You can call this method either before or after joining a channel. + + * *Note:** + * macOS does not support loopback sampling of the default sound card. If you need to use this method, + * please use a virtual sound card and pass its name to the `deviceName` parameter. Agora has tested and recommends using soundflower. + + * @param enabled Sets whether to enable/disable loopback sampling. + * YES: Enable loopback sampling. + * NO: (Default) Disable loopback sampling. + + * @param deviceName Pointer to the device name of the sound card. The default value is nil (default sound card). + * If you use a virtual sound card like "Soundflower", set this parameter as the name of the sound card, "Soundflower", + * and the SDK will find the corresponding sound card and start capturing. + * @return + * 0: Success. + * < 0: Failure. + */ +- (int)enableLoopbackRecording:(BOOL)enabled deviceName:(NSString* _Nullable)deviceName NS_SWIFT_NAME(enableLoopbackRecording(_:deviceName:)); + +/** Adjusts the loopback recording volume. + * + * @param volume The loopback volume, which ranges from 0 to 100: + + * - 0: Mute the recoridng volume. + * - 100: The Original volume. + * protection. + + * @return + * - 0: Success. + *- < 0: Failure. +*/ +- (int)adjustLoopbackSignalVolume:(NSInteger)volume NS_SWIFT_NAME(adjustLoopbackSignalVolume(_:)); + +/** Retrieves the audio volume for recording loopback. + * @note Call this method when you are in a channel. + * @return + * - >= 0: The audio volume for loopback, if this method call succeeds. The value range is [0, 100]. + * - < 0: Failure. +*/ +- (int)getLoopbackRecordingVolume NS_SWIFT_NAME(getLoopbackRecordingVolume()); + +#endif + +#pragma mark Core Video + +/**----------------------------------------------------------------------------- + * @name Core Video + * ----------------------------------------------------------------------------- + */ + +/** + * Enables the video. + * + * You can call this method either before joining a channel or during a call. + * If you call this method before entering a channel, the service starts the + * video; if you call it during a call, the audio call switches to a video call. + * + * @note + * This method controls the underlying states of the engine. It is still + * valid after one leaves the channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableVideo NS_SWIFT_NAME(enableVideo()); + +/** + * Disables the video. + * + * This method stops capturing the local video and receiving all remote video. + * To enable the local preview function, call \ref enableLocalVideo: enableLocalVideo(YES). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)disableVideo NS_SWIFT_NAME(disableVideo()); + +/** + * Disables or re-enables the local video capture. + * + * Once you enable the video using \ref enableVideo, the local video is + * enabled by default. This method disables or re-enables the local video + * capture. + * + * `enableLocalVideo(NO)` applies to scenarios when the user wants to watch the + * remote video without sending any video stream to the other user. + * + * @note + * Call this method after `enableVideo`. Otherwise, this method may not work properly. + * + * @param enabled Determines whether to disable or re-enable the local video, + * including the capturer, renderer, and sender: + * - `YES`: (Default) Re-enable the local video. + * - `NO`: Disable the local video. Once the local video is disabled, the remote + * users can no longer receive the video stream of this user, while this user + * can still receive the video streams of other remote users. When you set + * `enabled` as `NO`, this method does not require a local camera. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableLocalVideo:(BOOL)enabled NS_SWIFT_NAME(enableLocalVideo(_:)); + +/** + * QueryCodecCapability. + * query current device codec capacity. and will return codec actual capability. + * + * @param a array for save result + * + */ +- (NSArray *__nullable)queryCodecCapability ; + +/** + * Queries the score of the current device. + * + * @return + * > 0: If the value is greater than 0, it means that the device score has been retrieved and represents the score value. + * Most devices score between 60-100, with higher scores indicating better performance. + * + * < 0: Failure. + */ +- (int)queryDeviceScore NS_SWIFT_NAME(queryDeviceScore()); + +/** + * Sets the video encoder configuration. + * + * Each configuration profile corresponds to a set of video parameters, + * including the resolution, frame rate, and bitrate. + * + * The parameters specified in this method are the maximum values under ideal network conditions. + * If the video engine cannot render the video using the specified parameters + * due to poor network conditions, the parameters further down the list are + * considered until a successful configuration is found. + * + * @param config The local video encoder configuration, see #AgoraVideoEncoderConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVideoEncoderConfiguration:(AgoraVideoEncoderConfiguration * _Nonnull)config NS_SWIFT_NAME(setVideoEncoderConfiguration(_:)); + + +/** + * This method initializes the video view of the local stream on the local + * device. + * + * It affects only the video view that the local user sees, not the published + * local video stream. + * + * Call this method to bind the local video stream to a video view and to set + * the rendering and mirror modes of the video view. To unbind the `view`, set + * the `view` in #AgoraRtcVideoCanvas to `nil`. + * + * @note + * Call this method before joining a channel. + * @param local The local video view and settings. See #AgoraRtcVideoCanvas. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setupLocalVideo:(AgoraRtcVideoCanvas * _Nullable)local NS_SWIFT_NAME(setupLocalVideo(_:)); + +/** + * @deprecated + */ +- (int)setLocalVideoMirrorMode:(AgoraVideoMirrorMode)mode NS_SWIFT_NAME(setLocalVideoMirrorMode(_:)) __deprecated; + +/** + * @deprecated + */ +- (int)setLocalRenderMode:(NSUInteger)uid + mode:(AgoraVideoRenderMode)mode NS_SWIFT_NAME(setLocalRenderMode(_:mode:)) __deprecated; + +/** + * Updates the display mode of the local video view. + * + * After initialzing the local video view, you can call this method to update + * its rendering mode. It affects only the video view that the local user sees, not the published local video stream. + * + * @note + * - Ensure that you have called \ref setupLocalVideo: setupLocalVideo to + * initialize the local video view before this method. + * - During a call, you can call this method as many times as necessary to update the local video view. + * + * @param mode Sets the local display mode. See #AgoraVideoRenderMode. + * @param mirror Sets the mirror mode. See #AgoraVideoMirrorMode + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLocalRenderMode:(AgoraVideoRenderMode)mode + mirror:(AgoraVideoMirrorMode)mirror NS_SWIFT_NAME(setLocalRenderMode(_:mirror:)); + +/** + * Starts the local video preview before joining a channel. + * + * Once you call this method to start the local video preview, if you leave + * the channel by calling \ref leaveChannel: leaveChannel, the local video + * preview remains until you call \ref stopPreview to disable it. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + +- (int)startPreview NS_SWIFT_NAME(startPreview()); + +/** + * Starts the local video preview before joining a channel. + * + * Once you call this method to start the local video preview, if you leave + * the channel by calling \ref leaveChannel: leaveChannel, the local video + * preview remains until you call \ref stopPreview to disable it. + * @param sourceType source type of video. See #AgoraVideoSourceType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + +- (int)startPreview: (AgoraVideoSourceType)sourceType NS_SWIFT_NAME(startPreview(_:)); + +/** + * Stops the local video preview and the video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopPreview NS_SWIFT_NAME(stopPreview()); + +/** + * Stops the local video preview and the video. + * @param sourceType source type of video. See #AgoraVideoSourceType. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopPreview: (AgoraVideoSourceType)sourceType NS_SWIFT_NAME(stopPreview(_:)); + +/** Binds the remote user to the video display window, that is, sets the view for the user of the specified uid. + + Usually, the application should specify the uid of the remote video in the method call before the user enters a channel. If the remote uid is unknown to the application, set it later when the application receives the [userJoinedBlock]([AgoraRtcEngineKit userJoinedBlock:]) event. + If the Video Recording function is enabled, the Video Recording Service joins the channel as a dumb client, which means other clients will also receive the [didJoinedOfUid]([AgoraRtcEngineDelegate rtcEngine:didJoinedOfUid:elapsed:]) event. Your application should not bind it with the view, because it does not send any video stream. If your application cannot recognize the dumb client, bind it with the view when the [firstRemoteVideoDecodedOfUid]([AgoraRtcEngineDelegate rtcEngine:firstRemoteVideoDecodedOfUid:size:elapsed:]) event is triggered. To unbind the user with the view, set the view to null. After the user has left the channel, the SDK unbinds the remote user. + + @param remote AgoraRtcVideoCanvas + + @return * 0: Success. +* <0: Failure. + */ +- (int)setupRemoteVideo:(AgoraRtcVideoCanvas * _Nonnull)remote NS_SWIFT_NAME(setupRemoteVideo(_:)); + +/** Configures the remote video display mode. The application can call this method multiple times to change the display mode. + + @param uid User id of the user whose video streams are received. + @param mode AgoraVideoRenderMode + @param mirror AgoraVideoMirrorMode + + @return * 0: Success. +* <0: Failure. + */ +- (int)setRemoteRenderMode:(NSUInteger)uid + mode:(AgoraVideoRenderMode)mode + mirror:(AgoraVideoMirrorMode)mirror NS_SWIFT_NAME(setRemoteRenderMode(_:mode:mirror:)); + + +/** + * Stops or resumes sending the local video stream. + * + * @param mute Determines whether to send or stop sending the local video + * stream: + * - `YES`: Stop sending the local video stream. + * - `NO`: (Default) Send the local video stream. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteLocalVideoStream:(BOOL)mute NS_SWIFT_NAME(muteLocalVideoStream(_:)); + +/** + * Stops/Resumes receiving all remote video streams. + * + * This method works for all remote users that join or will join a channel. You can call this method before, during, or after a call. + * - If you call `muteAllRemoteVideoStreams`(YES) before joining a channel, the local user does not receive any video stream after joining the channel. + * - If you call `muteAllRemoteVideoStreams`(YES) after joining a channel, the local use stops receiving any video stream from any user in the channel, including any user who joins the channel after you call this method. + * - If you call `muteAllRemoteVideoStreams`(YES) after leaving a channel, the local user does not receive any video stream the next time the user joins a channel. + * + * After you successfully call `muteAllRemoteVideoStreams`(YES), you can take the following actions: + * - To resume receiving all remote video streams, call `muteAllRemoteVideoStreams`(NO). + * - To resume receiving the video stream of a specified user, call \ref muteRemoteVideoStream:mute: muteRemoteVideoStream(uid, NO), where `uid` is the ID of the user whose video stream you want to resume receiving. + * + * @note + * - The result of calling this method is affected by calling \ref enableVideo and \ref disableVideo. Settings in `muteAllRemoteVideoStreams` stop taking effect if either of the following occurs: + * - Calling `enableVideo` after `muteAllRemoteVideoStreams`(YES). + * - Calling `disableVideo` after `muteAllRemoteVideoStreams`(NO). + * - In scenarios involving multiple channels, use \ref AgoraRtcChannelMediaOptions.autoSubscribeVideo autoSubscribeVideo to set whether to receive remote video streams for a specific channel. + * @param mute Whether to stop receiving remote video streams: + * - `YES`: Stop receiving any remote video stream. + * - `NO`: (Default) Resume receiving all remote video streams. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)muteAllRemoteVideoStreams:(BOOL)mute NS_SWIFT_NAME(muteAllRemoteVideoStreams(_:)); + +/** + * @deprecated + * To set whether to receive remote video streams by default, call \ref muteAllRemoteVideoStreams: muteAllRemoteVideoStreams before calling `joinChannelByToken`. + * + * Determines whether to receive all remote video streams by default. + * + * @param mute Whether to receive remote video streams by default: + * - `YES`: Do not receive any remote video stream by default. + * - `NO`: (Default) Receive remote video streams by default. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDefaultMuteAllRemoteVideoStreams:(BOOL)mute NS_SWIFT_NAME(setDefaultMuteAllRemoteVideoStreams(_:)) __deprecated; + +/** + * Stops or resumes receiving the video stream of a specified user. + * + * You can call this method before or after joining a channel. + * If a user leaves a channel, the settings in this method become invalid. + * + * @param uid ID of the specified remote user. + * @param mute Whether to stop receiving the video stream of the specified user: + * - `YES`: Stop receiving the video stream of the specified user. + * - `NO`: (Default) Resume receiving the video stream of the specified user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteRemoteVideoStream:(NSUInteger)uid + mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteVideoStream(_:mute:)); + +/** Enables/Disables image enhancement and sets the options. + +@note Call this method after calling the [enableVideo]([AgoraRtcEngineKit enableVideo]) method. + +@param enable Sets whether or not to enable image enhancement: + +- `YES`: Enable image enhancement. +- `NO`: Disable image enhancement. +@param options The image enhancement options, see AgoraBeautyOptions. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)setBeautyEffectOptions:(BOOL)enable options:(AgoraBeautyOptions* _Nullable)options NS_SWIFT_NAME(setBeautyEffectOptions(_:options:)); +/** Sets video noise reduction. + +@since v4.0.0 + +Underlit environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding. + +You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect. + +**Note:** + +- Before calling this method, ensure that you have integrated the `AgoraClearVisionExtension.xcframework` dynamic library. +- Call this method after [enableVideo]([AgoraRtcEngineKit enableVideo]). +- The video noise reduction feature has certain performance requirements on devices. If your device overheats after you enable video noise reduction, Agora recommends modifying the video noise reduction options to a less performance-consuming level or disabling video noise reduction entirely. + +@param enable Sets whether to enable video noise reduction: + +- YES: Enable. +- NO: (Default) Disable. + +@param options The video noise reduction options. See AgoraVideoDenoiserOptions. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)setVideoDenoiserOptions:(BOOL)enable options:(AgoraVideoDenoiserOptions* _Nullable)options NS_SWIFT_NAME(setVideoDenoiserOptions(_:options:)); +/** Sets low-light enhancement. + +@since v4.0.0 + +The low-light enhancement feature can adaptively adjust the brightness value of the video captured in situations with low or uneven lighting, such as backlit, cloudy, or dark scenes. It restores or highlights the image details and improves the overall visual effect of the video. + +You can call this method to enable the low-light enhancement feature and set the options of the low-light enhancement effect. + +**Note:** + +- Before calling this method, ensure that you have integrated the `AgoraClearVisionExtension.xcframework` dynamic library. +- Call this method after [enableVideo]([AgoraRtcEngineKit enableVideo]). +- The low-light enhancement feature has certain performance requirements on devices. If your device overheats after you enable low-light enhancement, Agora recommends modifying the low-light enhancement options to a less performance-consuming level or disabling low-light enhancement entirely. + +@param enable Sets whether to enable low-light enhancement: + +- YES: Enable. +- NO: (Default) Disable. + +@param options The low-light enhancement options. See AgoraLowlightEnhanceOptions. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)setLowlightEnhanceOptions:(BOOL)enable options:(AgoraLowlightEnhanceOptions* _Nullable)options NS_SWIFT_NAME(setLowlightEnhanceOptions(_:options:)); +/** Sets color enhancement. + +@since v4.0.0 + +The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid. + +You can call this method to enable the color enhancement feature and set the options of the color enhancement effect. + +**Note:** + +- Before calling this method, ensure that you have integrated the `AgoraClearVisionExtension.xcframework` dynamic library. +- Call this method after [enableVideo]([AgoraRtcEngineKit enableVideo]). +- The color enhancement feature has certain performance requirements on devices. If your device overheats after you enable color enhancement, Agora recommends modifying the color enhancement options to a less performance-consuming level or disabling color enhancement entirely. + +@param enable Sets whether to enable color enhancement: + +- YES: Enable. +- NO: (Default) Disable. + +@param options The color enhancement options. See AgoraColorEnhanceOptions. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)setColorEnhanceOptions:(BOOL)enable options:(AgoraColorEnhanceOptions* _Nullable)options NS_SWIFT_NAME(setColorEnhanceOptions(_:options:)); + +/** Enables/Disables the virtual background. (beta function) + + @since v3.7.200 + + After enabling the virtual background function, you can replace the original + background image of the local user with a custom background image. After the + replacement, all users in the channel can see the custom background image. You + can find out from the [virtualBackgroundSourceEnabled]([AgoraRtcEngineDelegate rtcEngine:virtualBackgroundSourceEnabled:reason:]) + callback whether the virtual background is successfully enabled or the cause + of any errors. + + **Note**: + + - This method applies to macOS and iOS. + - Before calling this method, ensure that you have integrated the + `AgoraVideoSegmentationExtension.framework` dynamic library into the project + folder. + - Call this method after [enableVideo]([AgoraRtcEngineKit enableVideo]). + - This function requires a high-performance device. Agora recommends that you + use this function on devices with an i5 CPU and better. + - Agora recommends that you use this function in scenarios that meet the + following conditions: + + - A high-definition camera device is used, and the environment is uniformly + lit. + - The captured video image is uncluttered, the user's portrait is + half-length and largely unobstructed, and the background is a single color + that differs from the color of the user's clothing. + + @param enable Sets whether to enable the virtual background: + + - `YES`: Enable. + - `NO`: Disable. + @param backData The custom background image. See AgoraVirtualBackgroundSource. +

    Note: To adapt the resolution of the custom background image to the + resolution of the SDK capturing video, the SDK scales and crops the custom + background image while ensuring that the content of the custom background + image is not distorted.

    + @param segData + @return + * 0: Success. + * < 0: Failure. + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_SUCCESS = 0, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_IMAGE_NOT_EXIST = -1, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_COLOR_FORMAT_NOT_SUPPORTED = -2, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_DEVICE_NOT_SUPPORTED = -3, + */ +- (int)enableVirtualBackground:(BOOL)enable backData:(AgoraVirtualBackgroundSource* _Nullable)backData segData:(AgoraSegmentationProperty* _Nullable)segData NS_SWIFT_NAME(enableVirtualBackground(_:backData:segData:)); + +/** Whether the device support target feautre. + + @param type The feature type. See AgoraFeatureType. + + @return + - true: support. + - false: not support. + */ +- (bool)isFeatureAvailableOnDevice:(AgoraFeatureType)type; + +#pragma mark Audio Effect + +/**----------------------------------------------------------------------------- + * @name Audio Effect + * ----------------------------------------------------------------------------- + */ + +/** Sets the voice pitch of the local speaker. + + @note This method applies to macOS only. + + @param pitch Voice frequency, in the range of 0.5 to 2.0. The default value is 1.0. + + @return * 0: Success. +* <0: Failure. + */ +- (int)setLocalVoicePitch:(double)pitch NS_SWIFT_NAME(setLocalVoicePitch(_:)); + +/** Sets the local voice equalization. + + @note This method applies to macOS only. + + @param bandFrequency The band frequency ranging from 0 to 9; representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. + @param gain Gain of each band in dB; ranging from -15 to 15. + */ +- (int)setLocalVoiceEqualizationOfBandFrequency:(AgoraAudioEqualizationBandFrequency)bandFrequency withGain:(NSInteger)gain NS_SWIFT_NAME(setLocalVoiceEqualizationOf(_:withGain:)); + +/** Sets the local voice reverberation. + + @note This method applies to macOS only. + + @param reverbType Reverberation type. + @param value AgoraAudioReverbType + */ +- (int)setLocalVoiceReverbOfType:(AgoraAudioReverbType)reverbType withValue:(NSInteger)value NS_SWIFT_NAME(setLocalVoiceReverbOf(_:withValue:)); + +#pragma mark Audio Effect Playback + +/**----------------------------------------------------------------------------- + * @name Audio Effect Playback + * ----------------------------------------------------------------------------- + */ + +/** Preloads a specified audio effect. + * + * This method preloads only one specified audio effect into the memory each time + * it is called. To preload multiple audio effects, call this method multiple times. + * + * After preloading, you can call \ref playEffect:filePath:loopCount:pitch:pan:gain:publish: playEffect + * to play the preloaded audio effect or call + * \ref playAllEffectsWithLoopCount:pitch:pan:gain:publish: playAllEffects to play all the preloaded + * audio effects. + * + * @note + * - To ensure smooth communication, limit the size of the audio effect file. + * - Agora recommends calling this method before joining the channel. + * + * @param soundId The ID of the audio effect. + * @param filePath The absolute path of the local audio effect file or the URL + * of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, + * 3gp, mkv and wav. + + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)preloadEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath NS_SWIFT_NAME(preloadEffect(_:filePath:)); + +/** Preloads a specified audio effect. + * + * This method preloads only one specified audio effect into the memory each time + * it is called. To preload multiple audio effects, call this method multiple times. + * + * After preloading, you can call \ref playEffect:filePath:loopCount:pitch:pan:gain:publish: playEffect + * to play the preloaded audio effect or call + * \ref playAllEffectsWithLoopCount:pitch:pan:gain:publish: playAllEffects to play all the preloaded + * audio effects. + * + * @note + * - To ensure smooth communication, limit the size of the audio effect file. + * - Agora recommends calling this method before joining the channel. + * + * @param soundId The ID of the audio effect. + * @param filePath The absolute path of the local audio effect file or the URL + * of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, + * 3gp, mkv and wav. + * @param startPos The playback position (ms) of the audio effect file. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + +- (int)preloadEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + startPos:(int)startPos NS_SWIFT_NAME(preloadEffect(_:filePath:startPos:)); + +/** Plays a specified audio effect. +* +* @see [playEffect](playEffect:filePath:loopCount:pitch:pan:gain:publish:) +* @param soundId ID of the audio effect. Each audio effect has a unique ID. +* +* @note If you preloaded the audio effect into the memory through the [preloadEffect]([AgoraRtcEngineKit preloadEffect:filePath:]) method, ensure that the `soundID` value is set to the same value as in preloadEffect. +* @param filePath Absolute path of the audio effect file. +* @param loopCount Sets the number of times looping the audio effect: +* - 0: Plays the audio effect once. +* - 1: Plays the audio effect twice. +* - -1: Plays the audio effect in an indefinite loop until you call the [stopEffect]([AgoraRtcEngineKit stopEffect:]) or [stopAllEffects]([AgoraRtcEngineKit stopAllEffects]) method +* +* @param pitch Sets whether to change the pitch of the audio effect. The value ranges between 0.5 and 2. +* The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. +* @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0. +* - 0.0: The audio effect displays ahead. +* - 1.0: The audio effect displays to the right. +* - -1.0: The audio effect displays to the left. +* +* @param gain Sets the volume of the sound effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the sound effect. +* @return * 0: Success. +* < 0: Failure. + */ +- (int)playEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + loopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain NS_SWIFT_NAME(playEffect(_:filePath:loopCount:pitch:pan:gain:)); + +/** Plays a specified audio effect. +* +* @see [playEffect](playEffect:filePath:loopCount:pitch:pan:gain:publish:) +* @param soundId ID of the audio effect. Each audio effect has a unique ID. +* +* @note If you preloaded the audio effect into the memory through the [preloadEffect]([AgoraRtcEngineKit preloadEffect:filePath:]) method, ensure that the `soundID` value is set to the same value as in preloadEffect. +* @param filePath Absolute path of the audio effect file. +* @param loopCount Sets the number of times looping the audio effect: +* - 0: Plays the audio effect once. +* - 1: Plays the audio effect twice. +* - -1: Plays the audio effect in an indefinite loop until you call the [stopEffect]([AgoraRtcEngineKit stopEffect:]) or [stopAllEffects]([AgoraRtcEngineKit stopAllEffects]) method +* +* @param pitch Sets whether to change the pitch of the audio effect. The value ranges between 0.5 and 2. +* The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. +* @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0. +* - 0.0: The audio effect displays ahead. +* - 1.0: The audio effect displays to the right. +* - -1.0: The audio effect displays to the left. +* +* @param gain Sets the volume of the sound effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the sound effect. +* @param startPos The playback position (ms) of the audio effect file. +* @return * 0: Success. +* < 0: Failure. + */ +- (int)playEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + loopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain + startPos:(int)startPos NS_SWIFT_NAME(playEffect(_:filePath:loopCount:pitch:pan:gain:startPos:)); + +/** Plays a specified audio effect. + +* With this method, you can set the loop count, pitch, pan, and gain of the audio effect file and whether the remote user can hear the audio effect. +* +* To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time. +* +* When the audio effect file playback is finished, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngineDidAudioEffectFinish:soundId: rtcEngineDidAudioEffectFinish callback. +* +* @param soundId ID of the specified audio effect. Each audio effect has a unique ID. +* If the audio effect is preloaded into the memory through the \ref preloadEffect:filePath: preloadEffect method, ensure that the `soundId` value is set to the same value as in \ref preloadEffect:filePath: preloadEffect. +* @param filePath Specifies the absolute path (including the suffixes of the filename) to the local audio effect file or the URL of the online audio effect file, for example, `/var/mobile/Containers/Data/audio.mp4`. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. +* @param loopCount Sets the number of times the audio effect loops: +* - 0: Plays the audio effect once. +* - 1: Plays the audio effect twice. +* - -1: Plays the audio effect in an indefinite loop until you call the \ref stopEffect: stopEffect or \ref stopAllEffects stopAllEffects method. +* +* @param pitch Sets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. +* @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0. +* - 0.0: The audio effect displays ahead. +* - 1.0: The audio effect displays to the right. +* - -1.0: The audio effect displays to the left. +* +* @param gain Sets the volume of the audio effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the audio effect. +* @param publish Sets whether or not to publish the specified audio effect to the remote stream: +* - YES: The played audio effect is published to the Agora Cloud and the remote users can hear it. +* - NO: The played audio effect is not published to the Agora Cloud and the remote users cannot hear it. +* +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (int)playEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + loopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain + publish:(BOOL)publish NS_SWIFT_NAME(playEffect(_:filePath:loopCount:pitch:pan:gain:publish:)); + +/** Plays a specified audio effect. + +* With this method, you can set the loop count, pitch, pan, and gain of the audio effect file and whether the remote user can hear the audio effect. +* +* To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time. +* +* When the audio effect file playback is finished, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngineDidAudioEffectFinish:soundId: rtcEngineDidAudioEffectFinish callback. +* +* @param soundId ID of the specified audio effect. Each audio effect has a unique ID. +* If the audio effect is preloaded into the memory through the \ref preloadEffect:filePath: preloadEffect method, ensure that the `soundId` value is set to the same value as in \ref preloadEffect:filePath: preloadEffect. +* @param filePath Specifies the absolute path (including the suffixes of the filename) to the local audio effect file or the URL of the online audio effect file, for example, `/var/mobile/Containers/Data/audio.mp4`. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. +* @param loopCount Sets the number of times the audio effect loops: +* - 0: Plays the audio effect once. +* - 1: Plays the audio effect twice. +* - -1: Plays the audio effect in an indefinite loop until you call the \ref stopEffect: stopEffect or \ref stopAllEffects stopAllEffects method. +* +* @param pitch Sets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. +* @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0. +* - 0.0: The audio effect displays ahead. +* - 1.0: The audio effect displays to the right. +* - -1.0: The audio effect displays to the left. +* +* @param gain Sets the volume of the audio effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the audio effect. +* @param publish Sets whether or not to publish the specified audio effect to the remote stream: +* - YES: The played audio effect is published to the Agora Cloud and the remote users can hear it. +* - NO: The played audio effect is not published to the Agora Cloud and the remote users cannot hear it. +* @param startPos The playback position (ms) of the audio effect file. +* +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (int)playEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + loopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain + publish:(BOOL)publish + startPos:(int)startPos NS_SWIFT_NAME(playEffect(_:filePath:loopCount:pitch:pan:gain:publish:startPos:)); + +/** Plays all audio effects. + * + * After calling \ref preloadEffect:filePath: preloadEffect multiple times + * to preload multiple audio effects into the memory, you can call this + * method to play all the specified audio effects for all users in + * the channel. + * + * @param loopCount The number of times the audio effect loops: + * - `-1`: Play the audio effect in an indefinite loop until + * \ref AgoraRtcEngineKit.stopEffect: stopEffect or + * \ref AgoraRtcEngineKit.stopAllEffects stopAllEffects + * - `0`: Play the audio effect once. + * - `1`: Play the audio effect twice. + * @param pitch The pitch of the audio effect. The value ranges between 0.5 and 2.0. + * The default value is `1.0` (original pitch). The lower the value, the lower the pitch. + * @param pan The spatial position of the audio effect. The value ranges between -1.0 and 1.0: + * - `-1.0`: The audio effect displays to the left. + * - `0.0`: The audio effect displays ahead. + * - `1.0`: The audio effect displays to the right. + * @param gain The volume of the audio effect. The value ranges between 0 and 100. + * The default value is `100` (original volume). The lower the value, the lower + * the volume of the audio effect. + * @param publish Sets whether to publish the audio effect to the remote: + * - true: Publish the audio effect to the remote. + * - false: Do not publish the audio effect to the remote. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)playAllEffectsWithLoopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain + publish:(BOOL)publish NS_SWIFT_NAME(playAllEffects(withLoopCount:pitch:pan:gain:publish:)); + + /** + * Gets the volume of audio effects. + * + * @return + * - ≥ 0: The volume of audio effects. The value ranges between 0 and 100 (original volume). + * - < 0: Failure. + */ +- (int)getEffectsVolume NS_SWIFT_NAME(getEffectsVolume()); + + /** Sets the volume of audio effects. + * + * @param volume The volume of audio effects. The value ranges between 0 + * and 100 (original volume). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setEffectsVolume:(NSInteger)volume NS_SWIFT_NAME(setEffectsVolume(_:)); + + /** Sets the volume of the specified audio effect. + * + * @param soundId The ID of the audio effect. + * @param volume The volume of the specified audio effect. The value ranges + * between 0 and 100 (original volume). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVolumeOfEffect:(int)soundId + withVolume:(int)volume NS_SWIFT_NAME(setVolumeOfEffect(_:withVolume:)); + + /** Gets the volume of the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - ≥ 0: The volume of the specified audio effect. The value ranges + * between 0 and 100 (original volume). + * - < 0: Failure. + */ +- (int)getVolumeOfEffect:(int)soundId NS_SWIFT_NAME(getVolumeOfEffect(_:)); + +/** Pauses playing a specific audio effect. + + * @param soundId ID of the audio effect. Each audio effect has a unique ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)pauseEffect:(int)soundId NS_SWIFT_NAME(pauseEffect(_:)); + +/** Pauses playing all audio effects. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)pauseAllEffects NS_SWIFT_NAME(pauseAllEffects()); + +/** Resumes playing the specified audio effect. + + * @param soundId The ID of the audio effect. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)resumeEffect:(int)soundId NS_SWIFT_NAME(resumeEffect(_:)); + +/** Resumes playing all audio effects. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)resumeAllEffects NS_SWIFT_NAME(resumeAllEffects()); + +/** Stops playing a specific audio effect. + + * @param soundId The ID of the audio effect. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopEffect:(int)soundId NS_SWIFT_NAME(stopEffect(_:)); + +/** Stops playing all audio effects. + + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopAllEffects NS_SWIFT_NAME(stopAllEffects()); + +/** Gets the duration of the audio effect file. + + + **Note** + + - Call this method after joining a channel. + - For the audio file formats supported by this method, see + [What formats of audio files does the Agora RTC SDK support](https://docs.agora.io/en/faq/audio_format). + + @param filePath The absolute path (including the filename extensions) of the local audio effect file. For example: + `/var/mobile/Containers/Data/audio.mp4`. + @return - ≥ 0: A successful method call. Returns the total duration (ms) of the specified audio effect file. +- < 0: Failure. + + - `-22(AgoraErrorCodeResourceLimited)`: Cannot find the audio effect file. Please set a correct `filePath`. + */ +- (int)getEffectDuration:(NSString* _Nonnull)filePath NS_SWIFT_NAME(getEffectDuration(_:)); +/** Sets the playback position of an audio effect file. + + After a successful setting, the local audio effect file starts playing at the specified position. + + @note Call this method after [playEffect]([AgoraRtcEngineKit playEffect:filePath:loopCount:pitch:pan:gain:publish:startPos:]). + + @param soundId Audio effect ID. Ensure that this parameter is set to the same value as in `playEffect`. + @param pos The playback position (ms) of the audio effect file. + + @return - 0: Success. +- < 0: Failure. + + - `-22(AgoraErrorCodeResourceLimited)`: Cannot find the audio effect file. Please set a correct `soundId`. + */ +- (int)setEffectPosition:(int)soundId pos:(NSInteger)pos NS_SWIFT_NAME(setEffectPosition(_:pos:)); +/** Gets the playback position of the audio effect file. + + @note Call this method after [playEffect]([AgoraRtcEngineKit playEffect:filePath:loopCount:pitch:pan:gain:publish:startPos:]). + + @param soundId Audio effect ID. Ensure that this parameter is set to the same value as in `playEffect`. + @return - ≥ 0: A successful method call. Returns the playback position (ms) of the specified audio effect file. +- < 0: Failure. + + - `-22(AgoraErrorCodeResourceLimited)`: Cannot find the audio effect file. Please set a correct `soundId`. + */ +- (int)getEffectCurrentPosition:(int)soundId NS_SWIFT_NAME(getEffectCurrentPosition(_:)); + + + + +/** Releases a specific preloaded audio effect from the memory. + + * @param soundId The ID of the audio effect. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)unloadEffect:(int)soundId NS_SWIFT_NAME(unloadEffect(_:)); + +/** Release all preloaded audio effects from the memory. + + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)unloadAllEffects NS_SWIFT_NAME(unloadAllEffects()); + +#pragma mark beautifier effect +/** Sets an SDK preset voice beautifier effect. + * + * Call this method to set an SDK preset voice beautifier effect for the local user who sends an + * audio stream. After setting a voice beautifier effect, all users in the channel can hear the + * effect. + * + * You can set different voice beautifier effects for different scenarios. See *Set the Voice + * Beautifier and Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" to + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call + * fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters": + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset voice beautifier effects: #VOICE_BEAUTIFIER_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVoiceBeautifierPreset:(AgoraVoiceBeautifierPreset)preset NS_SWIFT_NAME(setVoiceBeautifierPreset(_:)); + +/** Sets an SDK preset audio effect. + * + * Call this method to set an SDK preset audio effect for the local user who sends an audio + * stream. This audio effect does not change the gender characteristics of the original voice. + * After setting an audio effect, all users in the channel can hear the effect. + * + * You can set different audio effects for different scenarios. See *Set the Voice Beautifier and + * Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the profile `parameter` of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)` + * or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - If you call this method and set the `preset` parameter to enumerators except + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION`, do not call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters"; otherwise, + * `setAudioEffectParameters` overrides this method. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectPreset`: + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset audio effects. See #AUDIO_EFFECT_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setAudioEffectPreset:(AgoraAudioEffectPreset)preset NS_SWIFT_NAME(setAudioEffectPreset(_:)); + +/** Sets an SDK preset voice conversion. + * + * Call this method to set an SDK preset audio effect for the local user who sends an audio + * stream. This audio effect does not change the gender characteristics of the original voice. + * After setting an audio effect, all users in the channel can hear the effect. + * + * You can set different audio effects for different scenarios. See *Set the Voice Beautifier and + * Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the profile `parameter` of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)` + * or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - If you call this method and set the `preset` parameter to enumerators except + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION`, do not call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters"; otherwise, + * `setAudioEffectParameters` overrides this method. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectPreset`: + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVoiceConversionPreset:(AgoraVoiceConversionPreset)preset NS_SWIFT_NAME(setVoiceConversionPreset(_:)); + +/** Sets parameters for SDK preset audio effects. + * + * Call this method to set the following parameters for the local user who send an audio stream: + * - 3D voice effect: Sets the cycle period of the 3D voice effect. + * - Pitch correction effect: Sets the basic mode and tonic pitch of the pitch correction effect. + * Different songs have different modes and tonic pitches. Agora recommends bounding this method + * with interface elements to enable users to adjust the pitch correction interactively. + * + * After setting parameters, all users in the channel can hear the relevant effect. + * + * You can call this method directly or after \ref IRtcEngine::setAudioEffectPreset + * "setAudioEffectPreset". If you call this method after \ref IRtcEngine::setAudioEffectPreset + * "setAudioEffectPreset", ensure that you set the preset parameter of `setAudioEffectPreset` to + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION` and then call this method to set the same + * enumerator; otherwise, this method overrides `setAudioEffectPreset`. + * + * @note + * - You can call this method either before or after joining a channel. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" to + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call + * fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectParameters`: + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * @param preset The options for SDK preset audio effects: + * - 3D voice effect: `ROOM_ACOUSTICS_3D_VOICE`. + * - Call \ref IRtcEngine::setAudioProfile "setAudioProfile" and set the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator; otherwise, the enumerator setting does not take effect. + * - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear + * the anticipated voice effect. + * - Pitch correction effect: `PITCH_CORRECTION`. To achieve better audio effect quality, Agora + * recommends calling \ref IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` + * parameter to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before setting this enumerator. + * @param param1 + * - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, the `param1` sets the cycle period of the + * 3D voice effect. The value range is [1,60] and the unit is a second. The default value is 10 + * seconds, indicating that the voice moves around you every 10 seconds. + * - If you set `preset` to `PITCH_CORRECTION`, `param1` sets the basic mode of the pitch + * correction effect: + * - `1`: (Default) Natural major scale. + * - `2`: Natural minor scale. + * - `3`: Japanese pentatonic scale. + * @param param2 + * - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, you need to set `param2` to `0`. + * - If you set `preset` to `PITCH_CORRECTION`, `param2` sets the tonic pitch of the pitch + * correction effect: + * - `1`: A + * - `2`: A# + * - `3`: B + * - `4`: (Default) C + * - `5`: C# + * - `6`: D + * - `7`: D# + * - `8`: E + * - `9`: F + * - `10`: F# + * - `11`: G + * - `12`: G# + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setAudioEffectParameters:(AgoraAudioEffectPreset)preset param1:(int)param1 param2:(int)param2 NS_SWIFT_NAME(setAudioEffectParameters(_:param1:param2:)); + +/** Sets parameters for SDK preset voice beautifier effects. + * + * Call this method to set a gender characteristic and a reverberation effect for the singing + * beautifier effect. This method sets parameters for the local user who sends an audio stream. + * + * After you call this method successfully, all users in the channel can hear the relevant effect. + * + * To achieve better audio effect quality, before you call this method, Agora recommends calling + * \ref IRtcEngine::setAudioProfile "setAudioProfile", and setting the `scenario` parameter as + * `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter as + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)`. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" as + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call does + * not take effect. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After you call this method, Agora recommends not calling the following methods, because they + * can override `setVoiceBeautifierParameters`: + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * + * @param preset The options for SDK preset voice beautifier effects: + * - `SINGING_BEAUTIFIER`: Singing beautifier effect. + * @param param1 The gender characteristics options for the singing voice: + * - `1`: A male-sounding voice. + * - `2`: A female-sounding voice. + * @param param2 The reverberation effects options: + * - `1`: The reverberation effect sounds like singing in a small room. + * - `2`: The reverberation effect sounds like singing in a large room. + * - `3`: The reverberation effect sounds like singing in a hall. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVoiceBeautifierParameters:(AgoraVoiceBeautifierPreset)preset param1:(int)param1 param2:(int)param2 NS_SWIFT_NAME(setVoiceBeautifierParameters(_:param1:param2:)); + +/** Set parameters for SDK preset voice conversion. + * + * @note + * - reserved interface + * + * @param preset The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET. + * @param param1 reserved. + * @param param2 reserved. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVoiceConversionParameters:(AgoraVoiceConversionPreset)preset param1:(int)param1 param2:(int)param2 NS_SWIFT_NAME(setVoiceConversionParameters(_:param1:param2:)); +/** Sets preset audio playback effect for remote headphones after remote audio is mixed. + * + * @param preset The preset key: #HEADPHONE_EQUALIZER_PRESET. + * - HEADPHONE_EQUALIZER_OFF = 0x00000000 : Turn off the eualizer effect for headphones. + * - HEADPHONE_EQUALIZER_OVEREAR = 0x04000001 : For over-ear headphones only. + * - HEADPHONE_EQUALIZER_INEAR = 0x04000002 : For in-ear headphones only. + * @return + * - 0: Success. + * - < 0: Failure. + * - -1(ERR_FAILED): A general error occurs (no specified reason). + */ +- (int)setHeadphoneEQPreset:(AgoraHeadphoneEQPreset)preset NS_SWIFT_NAME(setHeadphoneEQPreset(_:)); +/** Sets the parameters of audio playback effect for remote headphones after remote audio is mixed. + * + * @param lowGain The higher the parameter value, the deeper the sound. The value range is [-10,10]. + * @param highGain The higher the parameter value, the sharper the sound. The value range is [-10,10]. + * @return + * - 0: Success. + * - < 0: Failure. + * - -1(ERR_FAILED): A general error occurs (no specified reason). + */ +- (int)setHeadphoneEQParameters:(int)lowGain highGain:(int)highGain NS_SWIFT_NAME(setHeadphoneEQParameters(_:highGain:)); + +#pragma mark Sound Position Indication + +/**----------------------------------------------------------------------------- + * @name Sound Position Indication + * ----------------------------------------------------------------------------- + */ +/** Enables/Disables stereo panning for remote users. + +If you need to use the [setRemoteVoicePosition]([AgoraRtcEngineKit setRemoteVoicePosition:pan:gain:]) method, ensure that you call this method before joining a channel to enable stereo panning for remote users. + + @param enabled Sets whether or not to enable stereo panning for remote users: + + - `YES`: enables stereo panning. + - `NO`: disables stereo panning. + + @return * 0: Success. + * < 0: Failure. + - `-157`(`AgoraErrorCodeModuleNotFound`): The library for enabling deep-learning + noise reduction is not integrated. + */ +- (int)enableSoundPositionIndication:(BOOL)enabled NS_SWIFT_NAME(enableSoundPositionIndication(_:)); + +/** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + +**Note:** + +- Ensure that you call this method after joining a channel. For this method to work, enable stereo panning for remote users by calling [enableSoundPositionIndication]([AgoraRtcEngineKit enableSoundPositionIndication:]) before joining a channel. +This method requires hardware support. +- For the best effect, we recommend using the following audio output devices: + - (iOS) A stereo headset. + - (macOS) A stereo loudspeaker. + @param uid The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + + * 0.0: (default) the remote sound comes from the front. + * -1.0: the remote sound comes from the left. + * 1.0: the remote sound comes from the right. + + @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. + + @return * 0: Success. +* < 0: Failure. + */ +- (int)setRemoteVoicePosition:(NSUInteger)uid pan:(double)pan gain:(double)gain NS_SWIFT_NAME(setRemoteVoicePosition(_:pan:gain:)); + +/** Enables/Disables spatial audio for remote users. + + @param enabled Sets whether or not to enable spatial audio for remote users: + + - `YES`: enables spatial audio. + - `NO`: disables spatial audio. + + @return * 0: Success. + * < 0: Failure + */ +- (int)enableSpatialAudio:(BOOL)enabled NS_SWIFT_NAME(enableSpatialAudio(_:)); + +/** Sets spatial audio parameters of a remote user. + + When the local user calls this method to set the spatial audio parameters of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of spatial. + +**Note:** + +- For the best effect, we recommend using the following audio output devices: + - (iOS) A stereo headset. + - (macOS) A stereo loudspeaker. + @param uid The ID of the remote user. + @param params The spatial audio parameters of the remote user. + + @return * 0: Success. +* < 0: Failure. + */ +- (int)setRemoteUserSpatialAudioParams:(NSUInteger)uid + params:(AgoraSpatialAudioParams* _Nonnull)params NS_SWIFT_NAME(setRemoteUserSpatialAudioParams(_:params:)); + +#pragma mark Audio Mixing + +/**----------------------------------------------------------------------------- + * @name Audio Mixing + * ----------------------------------------------------------------------------- + */ + +/** + * Starts audio mixing. + * + * This method mixes the specified local audio file with the audio stream from the microphone, or replaces the microphone’s audio stream with the specified local audio file. + * + * You can choose whether the other users can hear the local audio playback and specify the number of playback loops. + * + * This method also supports online music playback. + * + * A successful method call triggers the \ref AgoraRtcEngineDelegate.rtcEngine:audioMixingStateChanged:errorType: audioMixingStateChanged callback on the local client to report the `AgoraAudioMixingStateTypePlaying` state. + * + * When the audio mixing file playback finishes, the SDK triggers the `audioMixingStateChanged` callback on the local client to report the `AgoraAudioMixingStateTypeStopped` state. + * @note + * - To use this method, ensure that the iOS device version is 8.0 and later. + * - Call this method when the user is in a channel. + * - To play an online music file, ensure that the time interval between calling this method is more than 100 ms, or the `audioMixingStateChanged` callback reports the `AgoraAudioMixingReasonTooFrequentlyCall`(702) error. + * @param filePath Specifies the absolute path (including the suffixes of the filename) of the local or online audio file to be mixed. + * For example, `/var/mobile/Containers/Data/audio.mp4`. Supported audio formats: MP3, MP4, M4A, AAC, 3GP, MKV, and WAV. + * @param loopback Sets which user can hear the audio mixing: + * - `YES`: Only the local user can hear the audio mixing. + * - `NO`: All users can hear the audio mixing. + * @param cycle Sets the number of playback loops: + * - Positive integer: Number of playback loops. + * - -1: Infinite playback loops. + * + * @return + * - 0: Success. + * - <0: Failure. + * - -701: The local audio mixing file does not exist, the SDK does not support the file format, or the online audio packet is not received within five seconds + * after it is opened. + */ +- (int)startAudioMixing:(NSString * _Nonnull)filePath + loopback:(BOOL)loopback + cycle:(NSInteger)cycle NS_SWIFT_NAME(startAudioMixing(_:loopback:cycle:)); + +/** + * Starts audio mixing. + * + * This method mixes the specified local audio file with the audio stream from the microphone, or replaces the microphone’s audio stream with the specified local audio file. + * + * You can choose whether the other users can hear the local audio playback and specify the number of playback loops. + * + * This method also supports online music playback. + * + * A successful method call triggers the \ref AgoraRtcEngineDelegate.rtcEngine:audioMixingStateChanged:errorType: audioMixingStateChanged callback on the local client to report the `AgoraAudioMixingStateTypePlaying` state. + * + * When the audio mixing file playback finishes, the SDK triggers the `audioMixingStateChanged` callback on the local client to report the `AgoraAudioMixingStateTypeStopped` state. + * @note + * - To use this method, ensure that the iOS device version is 8.0 and later. + * - Call this method when the user is in a channel. + * - To play an online music file, ensure that the time interval between calling this method is more than 100 ms, or the `audioMixingStateChanged` callback reports the `AgoraAudioMixingReasonTypeTooFrequentlyCall`(702) error. + * @param filePath Specifies the absolute path (including the suffixes of the filename) of the local or online audio file to be mixed. + * For example, `/var/mobile/Containers/Data/audio.mp4`. Supported audio formats: MP3, MP4, M4A, AAC, 3GP, MKV, and WAV. + * @param loopback Sets which user can hear the audio mixing: + * - `YES`: Only the local user can hear the audio mixing. + * - `NO`: All users can hear the audio mixing. + * @param cycle Sets the number of playback loops: + * - Positive integer: Number of playback loops. + * - -1: Infinite playback loops. + * @param startPos The playback position (ms) of the music file. + * + * @return + * - 0: Success. + * - <0: Failure. + * - -701: The local audio mixing file does not exist, the SDK does not support the file format, or the online audio packet is not received within five seconds + * after it is opened. + */ +- (int)startAudioMixing:(NSString * _Nonnull)filePath + loopback:(BOOL)loopback + cycle:(NSInteger)cycle + startPos:(NSInteger)startPos NS_SWIFT_NAME(startAudioMixing(_:loopback:cycle:startPos:)); + +/** + * Stops audio mixing. + * + * Call this method when the user is in a channel. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)stopAudioMixing NS_SWIFT_NAME(stopAudioMixing()); + +/** + * Pauses audio mixing. + * + * Call this method when the user is in a channel. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)pauseAudioMixing NS_SWIFT_NAME(pauseAudioMixing()); + +/** + * Resumes audio mixing. + * + * Call this API when the user is in a channel. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)resumeAudioMixing NS_SWIFT_NAME(resumeAudioMixing()); + +/** Select audio track for the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ +- (int)selectAudioTrack:(NSInteger)index NS_SWIFT_NAME(selectAudioTrack(_:)); +/** Get audio track count of the music file. + + Call this method when you are in a channel. + + @return + - ≥ 0: Audio track count of the music file, if the method call is successful. + - < 0: Failure. + */ +- (int)getAudioTrackCount NS_SWIFT_NAME(getAudioTrackCount()); + +/** + * Adjusts the volume of audio mixing. + * + * Call this API when the user is in a channel. + * + * @param volume Audio mixing volume. The value ranges between 0 and 100 (default). 100 is the original volume. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)adjustAudioMixingVolume:(NSInteger)volume NS_SWIFT_NAME(adjustAudioMixingVolume(_:)); + + +/** + * Adjusts the audio mixing volume for publishing (for remote users). + * @note Call this method when you are in a channel. + * @param volume Audio mixing volume for publishing. The value ranges between 0 and 100 (default). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)adjustAudioMixingPublishVolume:(NSInteger)volume NS_SWIFT_NAME(adjustAudioMixingPublishVolume(_:)); + +/** + * Retrieves the audio mixing volume for publishing. + * This method helps troubleshoot audio volume related issues. + * @note Call this method when you are in a channel. + * @return + * - ≥ 0: The audio mixing volume for publishing, if this method call succeeds. The value range is [0,100]. + * - < 0: Failure. + */ +- (int)getAudioMixingPublishVolume NS_SWIFT_NAME(getAudioMixingPublishVolume()); + +/** + * Adjusts the audio mixing volume for local playback. + * @note Call this method when you are in a channel. + * @param volume Audio mixing volume for local playback. The value ranges between 0 and 100 (default). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)adjustAudioMixingPlayoutVolume:(NSInteger)volume NS_SWIFT_NAME(adjustAudioMixingPlayoutVolume(_:)); + +/** + * Retrieves the audio mixing volume for local playback. + * This method helps troubleshoot audio volume related issues. + * @note Call this method when you are in a channel. + * @return + * - ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100]. + * - < 0: Failure. + */ +- (int)getAudioMixingPlayoutVolume NS_SWIFT_NAME(getAudioMixingPlayoutVolume()); + + +/** + * Gets the duration of audio mixing. + * + * Call this API when the user is in a channel. + * + * @return + * - >= 0: The audio mixing duration (ms), if this method call is successful. + * - < 0: Failure. + */ +- (int)getAudioMixingDuration NS_SWIFT_NAME(getAudioMixingDuration()); + +/** + * Gets the playback position of the audio. + * + * Call this API when the user is in a channel. + * @return + * - >= 0: The current playback position (ms), if this method call is successful. + * - < 0: Failure. + */ +- (int)getAudioMixingCurrentPosition NS_SWIFT_NAME(getAudioMixingCurrentPosition()); + +/** + * Sets the playback position of the audio mixing file. + * + * Sets the playback starting position of the audio mixing file instead of playing it from the beginning. + * + * @param pos Integer. The playback starting position of the audio mixing file (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setAudioMixingPosition:(NSInteger)pos NS_SWIFT_NAME(setAudioMixingPosition(_:)); + +/** In dual-channel music files, different audio data can be stored on the left and right channels. + * According to actual needs, you can set the channel mode as the original mode, + * the left channel mode, the right channel mode or the mixed mode + + @param mode The mode of channel mode + + @return + - 0: Success. + - < 0: Failure. + */ +- (int)setAudioMixingDualMonoMode:(AgoraAudioMixingDualMonoMode)mode NS_SWIFT_NAME(setAudioMixingDualMonoMode(_:)); + +/** Sets the pitch of the local music file. + When a local music file is mixed with a local human voice, call this method to set the pitch of the local music file only. + @note Call this method after calling [startAudioMixing]([AgoraRtcEngineKit startAudioMixing:loopback:cycle:]). + + @param pitch Sets the pitch of the local music file by chromatic scale. The default value is 0, which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between consecutive values is a chromatic value. The greater the absolute value of this parameter, the higher or lower the pitch of the local music file. + + @return * 0: Success. + * < 0: Failure. + */ +- (int)setAudioMixingPitch:(NSInteger)pitch NS_SWIFT_NAME(setAudioMixingPitch(_:)); + +#pragma mark Audio Recording + +/**----------------------------------------------------------------------------- + * @name Audio Recording + * ----------------------------------------------------------------------------- + */ + +/** Starts an audio recording. + + The SDK allows recording during a call, which supports either one of the following two formats: + + * .wav: Large file size with high sound fidelity + * .aac: Small file size with low sound fidelity + + Ensure that the saving directory in the application exists and is writable. This method is usually called after the `joinChannelByToken` method. The recording automatically stops when the [leaveChannel](leaveChannel:) method is called. + + @param filePath Full file path of the recording file. The string of the file name is in UTF-8 code. + @param quality Sets the audio recording quality: #AUDIO_RECORDING_QUALITY_TYPE. + @return + - 0: Success. + - < 0: Failure. +*/ +- (int)startAudioRecording:(NSString * _Nonnull)filePath + quality:(AgoraAudioRecordingQuality)quality NS_SWIFT_NAME(startAudioRecording(_:quality:)); + +/** Starts an audio recording on the client. + + The SDK allows recording audio during a call. After successfully calling this method, you can record the audio of + users in the channel and get an audio recording file. Supported file formats are as follows: + + - WAV: High-fidelity files with typically larger file sizes. For example, if the sample rate is 32,000 Hz, the file + size for a 10-minute recording is approximately 73 MB. + - AAC: Low-fidelity files with typically smaller file sizes. For example, if the sample rate is 32,000 Hz and the + recording quality is `AgoraAudioRecordingQualityMedium`, the file size for a 10-minute recording is approximately 2 MB. + + Once the user leaves the channel, the recording automatically stops. + + @note Call this method after joining a channel. + + @param config Recording configuration. See AgoraAudioRecordingConfiguration. + + @return - 0: Success. + - < 0: Failure. + + -160(`AgoraErrorCodeAlreadyInRecording`): The client is already recording audio. To start a new recording, call + [stopAudioRecording]([AgoraRtcEngineKit stopAudioRecording]) to stop the current recording first, and then call + `startAudioRecordingWithConfig`. + */ +- (int)startAudioRecordingWithConfig:(AgoraAudioRecordingConfiguration * _Nonnull)config NS_SWIFT_NAME(startAudioRecording(withConfig:)); + +- (int)setAudioEncodedFrameDelegate:(id _Nullable)delegate config:(AgoraAudioEncodedFrameDelegateConfig * _Nonnull)config NS_SWIFT_NAME(setAudioEncodedFrameDelegate(_:config:)); +/** Stops the audio recording. + + @note Call this method before calling [leaveChannel](leaveChannel:), otherwise the recording automatically stops when the [leaveChannel](leaveChannel:) method is called. + + @return * 0: Success. +* <0: Failure. + */ +- (int)stopAudioRecording NS_SWIFT_NAME(stopAudioRecording()); + +#pragma mark Echo Test + +/**----------------------------------------------------------------------------- + * @name Echo Test + * ----------------------------------------------------------------------------- + */ + +/** Launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly. + + In the test, the user first speaks, and the recording is played back in 10 seconds. If the user can hear the recording in 10 seconds, it indicates that the audio devices and network connection work properly. + + @note After calling this method, always call stopEchoTest to end the test, otherwise the application will not be able to run the next echo test, nor can it call the `joinChannelByToken` method to start a new call. + + @param successBlock Callback on successfully starting the echo test. See JoinSuccessBlock in `joinChannelByToken` for a description of the callback parameters. + + @return * 0: Success. +* <0: Failure. + For example, AgoraErrorCodeRefused(-5):Failed to launch the echo test. + */ +- (int)startEchoTest:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))successBlock NS_SWIFT_NAME(startEchoTest(_:)); + +/** Starts an audio call test. + + This method starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly. + In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly. + + @note + - Call this method before joining a channel. + - After calling this method, call the stopEchoTest method to end the test. Otherwise, the app cannot run the next echo test, or join a channel. + - In the live interactive streaming profile, only a host can call this method. + + @param interval The time interval (s) between when you speak and when the recording plays back. + @param successBlock The SDK triggers the `successBlock` callback if this method call is successful. + + @return * 0: Success. + * < 0: Failure. +*/ +- (int)startEchoTestWithInterval:(NSInteger)interval + successBlock:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))successBlock NS_SWIFT_NAME(startEchoTest(withInterval:successBlock:)); + +/** Starts an audio/video call loop test. + + @param config The configuration for audio/video echo test. + + @return * 0: Success. + * < 0: Failure. + */ +- (int)startEchoTestWithConfig:(AgoraEchoTestConfiguration* _Nonnull)config NS_SWIFT_NAME(startEchoTest(withConfig:)); + +/** Stops the audio call test. + + @note This method applies to macOS only. + + @return * 0: Success. +* <0: Failure. For example, AgoraErrorCodeRefused(-5):Failed to stop the echo test. It could be that the echo test is not running. + */ +- (int)stopEchoTest NS_SWIFT_NAME(stopEchoTest()); + + +#pragma mark Miscellaneous Audio Control + +/**----------------------------------------------------------------------------- + * @name Miscellaneous Audio Control + * ----------------------------------------------------------------------------- + */ + +/** + * Enables in-ear monitoring. + * + * @param enabled Determines whether to enable in-ear monitoring. + * - `YES`: Enable in-ear monitoring. + * - `NO`: Disable in-ear monitoring. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableInEarMonitoring:(BOOL)enabled NS_SWIFT_NAME(enable(inEarMonitoring:)); + +/** + * Enables in-ear monitoring. + * + * @param enabled Determines whether to enable in-ear monitoring. + * - `YES`: Enable in-ear monitoring. + * - `NO`: Disable in-ear monitoring. + * @param includeAudioFilters The type of the ear monitoring: #AgoraEarMonitoringFilterType. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableInEarMonitoring:(BOOL)enabled includeAudioFilters:(AgoraEarMonitoringFilterType)includeAudioFilters NS_SWIFT_NAME(enable(inEarMonitoring:includeAudioFilters:)); + +/** + * Sets the volume of the in-ear monitoring. + * + * @param volume The volume of the in-ear monitor, ranging from 0 to 100, + * can be amplified to 400, but not suggested. + * The default value is 100. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setInEarMonitoringVolume:(NSInteger)volume NS_SWIFT_NAME(setInEarMonitoringVolume(_:)); + +#if TARGET_OS_IPHONE + +/** Sets the audio session operation restriction. + + @note This method applies to iOS only. + + The SDK and the application can both configure the audio session by default. The application may occassionally use other applications or third-party components to manipulate the audio session and restrict the SDK from doing so. This API allows the application to restrict the SDK's manipulation of the audio session. + + @note This method restricts the SDK's manipulation of the audio session. Any operation to the audio session relies solely on the application, other applications, or third-party components. + */ +- (void)setAudioSessionOperationRestriction:(AgoraAudioSessionOperationRestriction)restriction NS_SWIFT_NAME(setAudioSessionOperationRestriction(_:)); + +#endif + +#pragma mark Dual Video Mode + +/**----------------------------------------------------------------------------- + * @name Dual Video Mode + * ----------------------------------------------------------------------------- + */ + +/** + * Enables or disables the dual video stream mode. + * + * @param enabled + * - `YES`: Enable the dual-stream mode. + * - `NO`: (default) Disable the dual-stream mode. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)enableDualStreamMode:(BOOL)enabled NS_SWIFT_NAME(enableDualStreamMode(_:)); + +/** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @param streamConfig + * - The minor stream config + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableDualStreamMode:(BOOL)enabled + streamConfig:(AgoraSimulcastStreamConfig* _Nonnull)streamConfig NS_SWIFT_NAME(enableDualStreamMode(_:streamConfig:)); + +/** + * Enables, disables or auto enable the dual video stream mode. + * + * @param mode + * - The dual-stream mode. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setDualStreamMode:(AgoraSimulcastStreamMode)mode NS_SWIFT_NAME(setDualStreamMode(_:)); + +/** + * Enables, disables or auto enable the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * If dual-stream mode is auto, if user subscriber low-stream, then we will send low-stream + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param mode + * - The dual-stream mode. + * @param streamConfig + * - The minor stream config + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDualStreamMode:(AgoraSimulcastStreamMode)mode + streamConfig:(AgoraSimulcastStreamConfig* _Nonnull)streamConfig NS_SWIFT_NAME(setDualStreamMode(_:streamConfig:)); +/** + * Sets the remote video stream type. + * + * If the remote user has enabled the dual-stream mode, by default the SDK + * receives the high-stream video. Call this method to switch to the low-stream + * video. + * + * @note + * This method applies to scenarios where the remote user has enabled the + * dual-stream mode by \ref enableDualStreamMode: enableDualStreamMode + * before joining the channel. + * + * @param uid ID of the remote user sending the video stream. + * @param streamType The video stream type: #AgoraVideoStreamType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteVideoStream:(NSUInteger)uid + type:(AgoraVideoStreamType)streamType NS_SWIFT_NAME(setRemoteVideoStream(_:type:)); + +/** + * Sets the remote video subscription options + * + * + * @param uid ID of the remote user sending the video stream. + * @param options Sets the video subscription options. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteVideoSubscriptionOptions:(NSUInteger)uid + options:(AgoraVideoSubscriptionOptions* _Nonnull)options NS_SWIFT_NAME(setRemoteVideoSubscriptionOptions(_:options:)); +/** + * Sets the default stream type of the remote video if the remote user has + * enabled the dual-stream mode. + * + * @param streamType The default video stream type: #AgoraVideoStreamType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteDefaultVideoStreamType:(AgoraVideoStreamType)streamType NS_SWIFT_NAME(setRemoteDefaultVideoStreamType(_:)); + +#pragma mark Subscribe Blocklist / Allowlist + +/** + * Sets the blocklist of subscribe remote stream audio. + * + * @param blocklist The uid list of users who do not subscribe to audio. + * + * @note + * If uid is in blacklist, the remote user's audio will not be subscribed, + * even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeAudioBlocklist:(NSArray *_Nonnull)blocklist NS_SWIFT_NAME(setSubscribeAudioBlocklist(_:)); + +/** + * Sets the allowlist of subscribe remote stream audio. + * + * @param allowlist The uid list of users who do subscribe to audio. + * + * @note + * If uid is in allowlist, the remote user's audio will be subscribed, + * even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to audio. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeAudioAllowlist:(NSArray *_Nonnull)allowlist NS_SWIFT_NAME(setSubscribeAudioAllowlist(_:)); + +/** + * Sets the blocklist of subscribe remote stream video. + * + * @param blocklist The uid list of users who do not subscribe to video. + * + * @note + * If uid is in blocklist, the remote user's video will not be subscribed, + * even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeVideoBlocklist:(NSArray *_Nonnull)blocklist NS_SWIFT_NAME(setSubscribeVideoBlocklist(_:)); + +/** + * Sets the allowlist of subscribe remote stream video. + * + * @param allowlist The uid list of users who do subscribe to video. + * + * @note + * If uid is in allowlist, the remote user's video will be subscribed, + * even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeVideoAllowlist:(NSArray *_Nonnull)allowlist NS_SWIFT_NAME(setSubscribeVideoAllowlist(_:)); + +#pragma mark Stream Fallback + +/**----------------------------------------------------------------------------- + * @name Stream Fallback + * ----------------------------------------------------------------------------- + */ + +/** Sets the local publish stream fallback option. + + This method disables/enables the local publish stream fallback option according to the network conditions. + + If you set the option as AgoraStreamFallbackOptionAudioOnly = 2, the SDK will: + + * Disable the upstream video when the network cannot support both video and audio. + * Reenable the video when the network condition improves. + + When the local publish stream falls back to audio-only or when the audio stream switches back to the video, the [didLocalPublishFallbackToAudioOnly]([AgoraRtcEngineDelegate rtcEngine:didLocalPublishFallbackToAudioOnly:]) callback will be triggered. + + @note Agora does not recommend using this method for CDN streaming, because the remote CDN user will notice a lag when the local publish stream falls back to audio-only. + + @param option AgoraStreamFallbackOptions + @return * 0: Success. +* <0: Failure. + */ +- (int)setLocalPublishFallbackOption:(AgoraStreamFallbackOptions)option NS_SWIFT_NAME(setLocalPublishFallbackOption(_:)); + +/** Sets the remote subscribe stream fallback option. + + This method disables/enables the remote subscribe stream fallback option according to the network conditions. + + If you use the option as AgoraStreamFallbackOptionAudioOnly = 2, the SDK will automatically switch the video from a high-stream to a low-stream, or disable the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and re-enables the video stream when the network conditions improve. + Once the local publish stream falls back to audio only, or the audio stream switches back to the video stream, the [didRemoteSubscribeFallbackToAudioOnly]([AgoraRtcEngineDelegate rtcEngine:didRemoteSubscribeFallbackToAudioOnly:byUid:]) callback will be triggered. + + @param option AgoraStreamFallbackOptions + @return * 0: Success. +* <0: Failure. + */ +- (int)setRemoteSubscribeFallbackOption:(AgoraStreamFallbackOptions)option NS_SWIFT_NAME(setRemoteSubscribeFallbackOption(_:)); + +#pragma mark Video Quality Control + +/**----------------------------------------------------------------------------- + * @name Video Quality Control + * ----------------------------------------------------------------------------- + */ + +/** Sets the video quality preferences. + + @param preferFrameRateOverImageQuality The video preference to be set: + + * YES: Frame rate over image quality + * NO: Image quality over frame rate (default) + + @return * 0: Success. +* <0: Failure. + */ +- (int)setVideoQualityParameters:(BOOL)preferFrameRateOverImageQuality NS_SWIFT_NAME(setVideoQualityParameters(_:)); + +#pragma mark External Media Source + +/**----------------------------------------------------------------------------- + * @name External Media Source + * ----------------------------------------------------------------------------- + */ + +/** + * Sets the external video source. + * + * Call this API before `enableVideo` or `startPreview`. + * + * @param enable Determines whether to enable the external video source. + * - `YES`: Use external video source. + * - `NO`: Do not use external video source. + * + * The Agora SDK does not support switching video sources dynamically in the + * channel. If an external video source is enabled and you are in a channel, if + * you want to switch to an internal video source, you must exit the channel. + * Then call this method to set enable as NO, and join the channel again. + * @param useTexture Determines whether to use textured video data. + * - `YES`: Use the texture as an input. + * - `NO`: Do not use the texture as an input. + * @param sourceType Determines the type of the external video source. + * - see AgoraExternalVideoSourceType in AgoraEnumerates.h + */ +- (void)setExternalVideoSource:(BOOL)enable useTexture:(BOOL)useTexture sourceType:(AgoraExternalVideoSourceType)sourceType NS_SWIFT_NAME(setExternalVideoSource(_:useTexture:sourceType:)); + +/** + * Sets the external video source. + * + * Call this API before `enableVideo` or `startPreview`. + * + * @param enable Determines whether to enable the external video source. + * - `YES`: Use external video source. + * - `NO`: Do not use external video source. + * + * The Agora SDK does not support switching video sources dynamically in the + * channel. If an external video source is enabled and you are in a channel, if + * you want to switch to an internal video source, you must exit the channel. + * Then call this method to set enable as NO, and join the channel again. + * @param useTexture Determines whether to use textured video data. + * - `YES`: Use the texture as an input. + * - `NO`: Do not use the texture as an input. + * @param sourceType Determines the type of the external video source. + * @param encodedVideoTrackOption Determines encoded video track options. + */ +- (void)setExternalVideoSource:(BOOL)enable useTexture:(BOOL)useTexture + sourceType:(AgoraExternalVideoSourceType)sourceType + encodedVideoTrackOption:(AgoraEncodedVideoTrackOptions* _Nonnull)encodedVideoTrackOption NS_SWIFT_NAME(setExternalVideoSource(_:useTexture:sourceType:encodedVideoTrackOption:)); + +/** + * Pushes the encoded external video frame to Agora SDK. + * + * @note + * Ensure that you have configured encoded video source before calling this method. + * + * @param data The encoded external video data, which must be the direct buffer. + * @param frameInfo The encoded external video frame info: AgoraEncodedVideoFrameInfo. + * + * @return + * - 0: Success, which means that the encoded external video frame is pushed successfully. + * - < 0: Failure, which means that the encoded external video frame fails to be pushed. + */ +- (int)pushExternalEncodedVideoFrame:(NSData* _Nonnull)frame + info:(AgoraEncodedVideoFrameInfo * _Nonnull)info NS_SWIFT_NAME(pushExternalEncodedVideoFrame(_:info:)); + +/** + * Pushes the external video frame. + * + * This method pushes the video frame using the AgoraVideoFrame class and + * passes it to the Agora SDK with the `format` parameter in AgoraVideoFormat. + * + * Call \ref setExternalVideoSource:useTexture:pushMode: setExternalVideoSource + * and set the `pushMode` parameter as `YES` before calling this method. + * @note + * In the Communication profile, this method does not support pushing textured + * video frames. + * @param frame Video frame containing the SDK's encoded video data to be + * pushed: #AgoraVideoFrame. + * @return + * - `YES`: Success. + * - `NO`: Failure. + */ +- (BOOL)pushExternalVideoFrame:(AgoraVideoFrame * _Nonnull)frame NS_SWIFT_NAME(pushExternalVideoFrame(_:)); + + +/** + * Get an custom video track id created by internal,which could used to publish or preview + * + * @return + * - > 0: the useable video track id. + * - < 0: Failure. + */ +- (unsigned int)createCustomVideoTrack NS_SWIFT_NAME(createCustomVideoTrack()); + +/** + * Get an custom encoded video track id created by internal,which could used to publish or preview + * + * @return + * - > 0: the useable video track id. + * - < 0: Failure. + */ +- (unsigned int)createCustomEncodedVideoTrack:(AgoraEncodedVideoTrackOptions* _Nonnull)encodedVideoTrackOption NS_SWIFT_NAME(createCustomEncodedVideoTrack(_:)); + +/** + * destroy a created custom video track id + * + * @param videoTrackId The video track id which was created by createCustomVideoTrack + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)destroyCustomVideoTrack:(NSUInteger)videoTrackId NS_SWIFT_NAME(destroyCustomVideoTrack(_:)); + +/** + * destroy a created custom encoded video track id + * + * @param videoTrackId The video track id which was created by createCustomEncodedVideoTrack + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)destroyCustomEncodedVideoTrack:(NSUInteger)videoTrackId NS_SWIFT_NAME(destroyCustomEncodedVideoTrack(_:)); + +#pragma mark External Audio Data +/** Enables the external audio sink. + + This method applies to scenarios where you want to use external audio data for playback. After enabling the external audio sink, you can call the [pullPlaybackAudioFrameRawData]([AgoraRtcEngineKit pullPlaybackAudioFrameRawData:lengthInByte:]) / [pullPlaybackAudioFrameSampleBufferByLengthInByte]([AgoraRtcEngineKit pullPlaybackAudioFrameSampleBufferByLengthInByte:]) method to pull the remote audio data, process it, and play it with the audio effects that you want. + @param enabled Determines whether to enable the external audio sick: + - true: Enable the external audio sick. + - false: Disable the external audio sick. + @param sampleRate Sets the sample rate (Hz) of the external audio sink. You can set this parameter as 16000, 32000, 44100 or 48000. + @param channels Sets the number of audio channels of the external audio sink: + + - 1: Mono + - 2: Stereo + + */ +- (void)enableExternalAudioSink:(BOOL)enabled + sampleRate:(NSUInteger)sampleRate + channels:(NSUInteger)channels NS_SWIFT_NAME(enableExternalAudioSink(_:sampleRate:channels:)); + +/** Pulls the remote audio data in the RawData format. + + Before calling this method, call the [enableExternalAudioSink]([AgoraRtcEngineKit enableExternalAudioSink:channels:]) method to enable and set the external audio sink. + + After a successful method call, the app pulls the decoded and mixed audio data for playback. + + **Note** + + @param data The audio data that you want to pull. The data format is in byte[]. + @param lengthInByte The data length (byte) of the external audio data. + + The value of this parameter is related to the value of the `sampleRate` parameter that you set in the [enableExternalAudioSink]([AgoraRtcEngineKit enableExternalAudioSink:channels:]) method: lengthInByte = sampleRate / 100 * 2 * number of channels * time (ms). + + @return - YES: Success. + - NO: Failure. + */ +- (BOOL)pullPlaybackAudioFrameRawData:(void * _Nonnull)data + lengthInByte:(NSUInteger)lengthInByte NS_SWIFT_NAME(pullPlaybackAudioFrameRawData(_:lengthInByte:)); + +/** Pulls the remote audio data in the SampleBuffer format. + + Before calling this method, call the [enableExternalAudioSink]([AgoraRtcEngineKit enableExternalAudioSink:channels:]) method to enable and set the external audio sink. + + After a successful method call, the app pulls the decoded and mixed audio data for playback. + + **Note** + + @param lengthInByte The data length (byte) of the external audio data. + + The value of this parameter is related to the value of the sampleRate parameter that you set in the [enableExternalAudioSink]([AgoraRtcEngineKit enableExternalAudioSink:channels:]) method: + + - `lengthInByte` = `sampleRate` / 100 * 2 * number of channels * time (ms). + - This parameter should be divisible by the value of sampleRate. + + @return - NOT NULL: Success. + - NULL: Failure. + */ +- (CMSampleBufferRef _Nullable)pullPlaybackAudioFrameSampleBufferByLengthInByte:(NSUInteger)lengthInByte NS_SWIFT_NAME(pullPlaybackAudioFrameSampleBufferBy(lengthInByte:)); + + +/** + * Create a custom audio track and get the audio track id. + * + * @note Ensure that you call this method before calling `joinChannel`. + + * @param trackType The type of custom audio track + * See AgoraAudioTrackType. + * + * @param config The config of custom audio track + * See AgoraAudioTrackConfig. + * + * @return + * - If the call is successful, SDK returns audio track id. + * - If the call fails, SDK returns 0xffffffff. + */ +- (int)createCustomAudioTrack:(AgoraAudioTrackType)trackType + config:(AgoraAudioTrackConfig* _Nonnull)config; + +/** + * Destroy custom audio track by trackId + * + * @param trackId The custom audio track id + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)destroyCustomAudioTrack:(NSInteger)trackId; + +/** + * Sets the external audio source. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @param trackId custom audio track id. + * @param enabled Enable/Disables the local playback of external audio track: + * - true: Enable local playback + * - false: Do not enable local playback + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableCustomAudioLocalPlayback:(NSInteger)trackId enabled:(BOOL)enabled NS_SWIFT_NAME(enableCustomAudioLocalPlayback(_:enabled:)); + +/** Pushes the external audio frame to the Agora SDK for encoding. + * + * @param data External audio data. + * @param samples Number of samples for the push. + * @param trackId The audio track ID. + * @param timestamp Time stamp of the external audio frame to be synchronized with the external video source. + * @return * 0: Success. + * <0: Failure. + */ +- (int)pushExternalAudioFrameRawData:(void * _Nonnull)data + samples:(NSInteger)samples + trackId:(NSInteger)trackId + timestamp:(NSTimeInterval)timestamp NS_SWIFT_NAME(pushExternalAudioFrameRawData(_:samples:trackId:timestamp:)); + +- (int)pushCaptureAudioFrame:(AgoraAudioFrame* _Nonnull)audioFrame NS_SWIFT_NAME(pushCaptureAudioFrame(_:)); + +- (int)pushReverseAudioFrame:(AgoraAudioFrame* _Nonnull)audioFrame NS_SWIFT_NAME(pushReverseAudioFrame(_:)); + +/** Pushes the external audio frame to the Agora SDK for encoding. + * + * @param data External audio data. + * @param samples Number of samples for the push, which can be set as "samples = data.length / sizeof(int16_t)" + * @param sampleRate The Sample rate (Hz) , which can set be as 8000, 16000, 32000, 44100, or 48000. + * @param channels The number of channels, which can be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param trackId The audio track ID. + * @param timestamp Time stamp of the external audio frame to be synchronized with the external video source. + * @return * 0: Success. + * <0: Failure. + */ +- (int)pushExternalAudioFrameRawData:(void* _Nonnull)data + samples:(NSInteger)samples + sampleRate:(NSInteger)sampleRate + channels:(NSInteger)channels + trackId:(NSInteger)trackId + timestamp:(NSTimeInterval)timestamp NS_SWIFT_NAME(pushExternalAudioFrameRawData(_:samples:sampleRate:channels:trackId:timestamp:)); +/** + * Pushes the external audio frame to the sample buffer for encoding. + * + * @param sampleBuffer Sample buffer + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)pushExternalAudioFrameSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer NS_SWIFT_NAME(pushExternalAudioFrameSampleBuffer(_:)); + +/** + * Enable or disable the external audio source local playback. + * + * * @param enable Determines whether to enable the external audio source local playback: + * - true: Enable the external audio source local playback. + * - false: (default) Disable the external audio source local playback. + * @return int + * - 0: Success. + * - <0: Failure. + */ +- (int)enableExternalAudioSourceLocalPlayback:(BOOL)enable NS_SWIFT_NAME(enableExternalAudioSourceLocalPlayback(_:)); + +/** + * Sets the audio recording format for the `onRecordAudioFrame` callback. + * + * The SDK calculates the sample interval according to the value of the + * `sampleRate`, `channel`, and `samplesPerCall` parameters you set in this + * method. Sample interval (sec) = `samplePerCall`/(`sampleRate` × + * `channel`). Ensure that the value of sample interval is no less than 0.01. + * The SDK triggers the `onRecordAudioFrame` callback according to the sample interval. + * + * @param sampleRate The audio sample rate (`samplesPerSec`) returned in + * the `onRecordAudioFrame` callback, which can be set as 8000, 16000, 32000, + * 44100, or 48000 Hz. + * @param channel The number of audio channels (`channels`) returned in + * the `onRecordAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the `onRecordAudioFrame` callback.See #AgoraAudioRawFrameOperationMode. + * @param samplesPerCall The number of samples the `onRecordAudioFrame` + * callback returns. Set it as 1024 for RTMP streaming. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRecordingAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + mode:(AgoraAudioRawFrameOperationMode)mode + samplesPerCall:(NSInteger)samplesPerCall NS_SWIFT_NAME(setRecordingAudioFrameParametersWithSampleRate(_:channel:mode:samplesPerCall:)); + +- (int)setPublishAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + samplesPerCall:(NSInteger)samplesPerCall; +/** + * Sets the audio playback format for the `onPlaybackAudioFrame` callback. + * + * The SDK calculates the sample interval according to the value of the + * `sampleRate`, `channel`, and `samplesPerCall` parameters you set in this + * method. Sample interval (sec) = `samplePerCall`/(`sampleRate` × + * `channel`). Ensure that the value of sample interval is no less than 0.01. + * The SDK triggers the `onPlaybackAudioFrame` callback according to the sample + * interval. + * @param sampleRate The sample rate (`samplesPerSec`) returned in the + * `onPlaybackAudioFrame` callback, which can be set as 8000, 16000, 32000, + * 44100, or 48000 Hz. + * @param channel The number of audio channels (`channels`) returned in + * the `onPlaybackAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the `onPlaybackAudioFrame` callback. + * See #AgoraAudioRawFrameOperationMode. + * @param samplesPerCall The number of samples the `onPlaybackAudioFrame` + * callback returns. Set it as 1024 for RTMP streaming. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setPlaybackAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + mode:(AgoraAudioRawFrameOperationMode)mode + samplesPerCall:(NSInteger)samplesPerCall NS_SWIFT_NAME(setPlaybackAudioFrameParametersWithSampleRate(_:channel:mode:samplesPerCall:)); + +/** + * Sets the mixed audio format for the `onMixedAudioFrame` callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in the + * `onMixedAudioFrame` callback, which can set be as 8000, 16000, 32000, 44100, + * or 48000. + * @param channel The number of channels of the audio data in + * `onMixedAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param samplesPerCall Not supported. Sampling points in the called data + * returned in `onMixedAudioFrame`. For example, it is usually set as 1024 for + * stream pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setMixedAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + samplesPerCall:(NSInteger)samplesPerCall NS_SWIFT_NAME(setMixedAudioFrameParametersWithSampleRate(_:channel:samplesPerCall:)); + +/** + * Sets the audio ear monitoring format for the `onEarMonitoringAudioFrame` callback. + * + * The SDK calculates the sample interval according to the value of the + * `sampleRate`, `channel`, and `samplesPerCall` parameters you set in this + * method. Sample interval (sec) = `samplePerCall`/(`sampleRate` × + * `channel`). Ensure that the value of sample interval is no less than 0.01. + * The SDK triggers the `onEarMonitoringAudioFrame` callback according to the sample + * interval. + * @param sampleRate The sample rate (`samplesPerSec`) returned in the + * `onEarMonitoringAudioFrame` callback, which can be set as 8000, 16000, 32000, + * 44100, or 48000 Hz. + * @param channel The number of audio channels (`channels`) returned in + * the `onEarMonitoringAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the `onEarMonitoringAudioFrame` callback. + * See #AgoraAudioRawFrameOperationMode. + * @param samplesPerCall The number of samples the `onEarMonitoringAudioFrame` + * callback returns. Set it as 1024 for RTMP streaming. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setEarMonitoringAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + mode:(AgoraAudioRawFrameOperationMode)mode + samplesPerCall:(NSInteger)samplesPerCall NS_SWIFT_NAME(setEarMonitoringAudioFrameParametersWithSampleRate(_:channel:mode:samplesPerCall:)); + + +/** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing + * "onPlaybackAudioFrameBeforeMixing" callback. + * + * @param sampleRate The sample rate(Hz) contained in the `onPlaybackAudioFrameBeforeMixing` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of channels contained in the `onPlaybackAudioFrameBeforeMixing` callback. + * - 1: Mono. + * - 2: Stereo. + * @return int + * - 0: Success. + * - < 0: Failure. + */ +- (int)setPlaybackAudioFrameBeforeMixingParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel NS_SWIFT_NAME(setPlaybackAudioFrameBeforeMixingParametersWithSampleRate(_:channel:)); +/* + * Adjust the custom audio publish volume by track id. + * @param trackId custom audio track id. + * @param volume The volume, range is [0,100]: + * 0: mute, 100: The original volume + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)adjustCustomAudioPublishVolume:(NSInteger)trackId volume:(NSInteger)volume NS_SWIFT_NAME(adjustCustomAudioPublishVolume(_:volume:)); + +/* + * Adjust the custom audio playout volume by track id. + * @param trackId custom audio track id. + * @param volume The volume, range is [0,100]: + * 0: mute, 100: The original volume + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)adjustCustomAudioPlayoutVolume:(NSInteger)trackId volume:(NSInteger)volume NS_SWIFT_NAME(adjustCustomAudioPlayoutVolume(_:volume:)); + +/* + * Get monotonic time in ms which can be used by capture time, + * typical scenario is as follows: + * + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * | // custom audio/video base capture time, e.g. the first audio/video capture time. | + * | int64_t custom_capture_time_base; | + * | | + * | int64_t agora_monotonic_time = getAgoraCurrentMonotonicTimeInMs(); | + * | | + * | // offset is fixed once calculated in the begining. | + * | const int64_t offset = agora_monotonic_time - custom_capture_time_base; | + * | | + * | // realtime_custom_audio/video_capture_time is the origin capture time that customer provided.| + * | // actual_audio/video_capture_time is the actual capture time transfered to sdk. | + * | int64_t actual_audio_capture_time = realtime_custom_audio_capture_time + offset; | + * | int64_t actual_video_capture_time = realtime_custom_video_capture_time + offset; | + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * + * @return + * - >= 0: Success. + * - < 0: Failure. + */ +- (int64_t)getCurrentMonotonicTimeInMs NS_SWIFT_NAME(getCurrentMonotonicTimeInMs()); + +#pragma mark Audio spectrum monitor + +/** + * Enable the audio spectrum monitor. + * + * @param intervalInMS Sets the time interval(ms) between two consecutive audio spectrum callback. + * The default value is 100. This param should be larger than 10. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAudioSpectrumMonitor:(int)intervalInMS NS_SWIFT_NAME(enableAudioSpectrumMonitor(_:)); + +/** + * Disalbe the audio spectrum monitor. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)disableAudioSpectrumMonitor NS_SWIFT_NAME(disableAudioSpectrumMonitor()); + +/** + * Registers an audio spectrum delegate. + * + * You need to register the following callbacks + * according to your scenario: + * - "onAudioSpectrumComputed": Occurs when the SDK receives the audio data and at set intervals. + * + * @param delegate AgoraAudioSpectrumDelegate + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)registerAudioSpectrumDelegate:(id _Nullable )delegate NS_SWIFT_NAME(registerAudioSpectrumDelegate(_:)); + + /** + * Releases the audio spectrum delegate. + * + * @param delegate AgoraAudioSpectrumDelegate + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)unregisterAudioSpectrumDelegate:(id _Nullable)delegate NS_SWIFT_NAME(unregisterAudioSpectrumDelegate(_:)); + +#pragma mark Built-in Encryption + +/**----------------------------------------------------------------------------- + * @name Built-in Encryption + * ----------------------------------------------------------------------------- + */ + +/** Enables/Disables the built-in encryption. + + In scenarios requiring high security, Agora recommends calling enableEncryption to enable the built-in encryption before joining a channel. + + All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + + **Note** + + - If you enable the built-in encryption, you cannot use the RTMP streaming function. + + @param enabled Whether to enable the built-in encryption: + + - YES: Enable the built-in encryption. + - NO: Disable the built-in encryption. + + @param config Configurations of built-in encryption schemas. See AgoraEncryptionConfig. + + @return - 0: Success. + - < 0: Failure. + + - -2 (`AgoraErrorCodeInvalidArgument`): An invalid parameter is used. Set the parameter with a valid value. + - -7 (`AgoraErrorCodeNotInitialized`): The SDK is not initialized. Initialize the `AgoraRtcEngineKit` instance before calling this method. + - -4 (`AgoraErrorCodeNotSupported`): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. + */ +- (int)enableEncryption:(bool)enabled encryptionConfig:(AgoraEncryptionConfig * _Nonnull)config NS_SWIFT_NAME(enableEncryption(_:encryptionConfig:)); + + +#pragma mark Data Stream + +/**----------------------------------------------------------------------------- + * @name Data Steam + * ----------------------------------------------------------------------------- + */ +/** Creates a data stream. +* +* Each user can create up to five data streams during the lifecycle of the `AgoraRtcEngineKit`. +* +* @note Set both the `reliable` and `ordered` parameters to `YES` or `NO`. Do not set one as `YES` and the other as `NO`. +* +* @param streamId ID of the created data stream. +* @param reliable Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds: +* - YES: The recipients receive the data stream from the sender within five seconds. If the recipient does not receive the data stream within five seconds, an error is reported to the app. +* - NO: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream. +* +* @param ordered Sets whether or not the recipients receive the data stream in the sent order: +* - YES: The recipients receive the data stream in the sent order. +* - NO: The recipients do not receive the data stream in the sent order. +* +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (int)createDataStream:(NSInteger * _Nonnull)streamId + reliable:(BOOL)reliable + ordered:(BOOL)ordered NS_SWIFT_NAME(createDataStream(_:reliable:ordered:)); +/** Creates a data stream. + + Each user can create up to five data streams during the lifecycle of the [AgoraRtcChannel](AgoraRtcChannel). + + @param streamId ID of the created data stream. + @param config the config of data stream. + @return * 0: Success. +* < 0: Failure. + */ +- (int)createDataStream:(NSInteger * _Nonnull)streamId + config:(AgoraDataStreamConfig * _Nonnull)config NS_SWIFT_NAME(createDataStream(_:config:)); +/** Sends data stream messages to all users in a channel. + +The SDK has the following restrictions on this method: + +- Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB. +- Each client can send up to 30 KB of data per second. +- Each user can have up to five data streams simultaneously. + +If the remote user receives the data stream within five seconds, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:receiveStreamMessageFromUid:streamId:data: receiveStreamMessageFromUid callback on the remote client, from which the remote user gets the stream message. + +If the remote user does not receive the data stream within five seconds, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached: didOccurStreamMessageErrorFromUid callback on the remote client. + + @note + - This method applies only to the Communication profile or to the hosts in the live interactive streaming profile. If an audience in the live interactive streaming profile calls this method, the audience role may be changed to a host. + - Ensure that you have created the data stream using \ref createDataStream:reliable:ordered: createDataStream before calling this method. + + @param streamId ID of the sent data stream returned in the `createDataStream` method. + @param data Sent data. + + @return + - 0: Success. + - < 0: Failure. +*/ +- (int)sendStreamMessage:(NSInteger)streamId + data:(NSData * _Nonnull)data NS_SWIFT_NAME(sendStreamMessage(_:data:)); + +#pragma mark Stream Publish + +/**----------------------------------------------------------------------------- + * @name Stream Publish + * ----------------------------------------------------------------------------- + */ + + +/** + * New publish stream interface, just publish raw stream + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. The RTMP URL address must not contain special characters, such as Chinese language characters. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ +- (int)startRtmpStreamWithoutTranscoding:(NSString* _Nonnull)url NS_SWIFT_NAME(startRtmpStreamWithoutTranscoding(_:)); + +/** + * New publish stream interface, just publish mix stream + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. The RTMP URL address must not contain special characters, such as Chinese language characters. + * @param transcoding Sets the CDN live audio/video transcoding settings. See AgoraLiveTranscoding. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ +- (int)startRtmpStreamWithTranscoding:(NSString* _Nonnull)url transcoding:(AgoraLiveTranscoding* _Nullable)transcoding NS_SWIFT_NAME(startRtmpStream(withTranscoding:transcoding:)); + +/** Sets the video layout and audio settings for CDN live. (CDN live only.) + + The SDK triggers the [rtcEngineTranscodingUpdated]([AgoraRtcEngineDelegate rtcEngineTranscodingUpdated:]) callback when you call the `setLiveTranscoding` method to update the transcoding setting. + + **Note** + + - This method applies to live-broadcast profile only. + - Ensure that you enable the RTMP Converter service before using this function. See [Prerequisites](https://docs.agora.io/en/Interactive%20Broadcast/cdn_streaming_apple?platform=iOS#prerequisites). + - If you call the `setLiveTranscoding` method to update the transcoding setting for the first time, the SDK does not trigger the `rtcEngineTranscodingUpdated` callback. + + + @param transcoding Sets the CDN live audio/video transcoding settings. See AgoraLiveTranscoding. + + @return = 0: Success. + * < 0: Failure. + */ +- (int)updateRtmpTranscoding:(AgoraLiveTranscoding* _Nullable)transcoding NS_SWIFT_NAME(updateRtmpTranscoding(_:)); + +/** Removes an RTMP stream from the CDN. + +This method removes the RTMP URL address added by the [addPublishStreamUrl](addPublishStreamUrl:transcodingEnabled:) method from a CDN live stream. + +This method call triggers the [rtmpStreamingChangedToState]([AgoraRtcEngineDelegate rtcEngine:rtmpStreamingChangedToState:state:errorCode:]) callback on the local client to report the state of removing an RTMP stream from the CDN. + + **Note:** + + * This method applies to live-broadcast profile only. + * This method removes only one URL each time it is called. + * The URL must not contain special characters, such as Chinese language characters. + + @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + + @return = 0: Success. + * < 0: Failure. + */ +- (int)stopRtmpStream:(NSString* _Nonnull)url NS_SWIFT_NAME(stopRtmpStream(_:)); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +#pragma mark Screen Capture + +/**----------------------------------------------------------------------------- + * @name Screen Capture + * ----------------------------------------------------------------------------- + */ + +/** Starts screen sharing. + * + * @param sourceType source type of screen. See #AgoraVideoSourceType. + * @param parameters The configuration of the screen sharing. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startScreenCapture:(AgoraVideoSourceType)sourceType config:(AgoraScreenCaptureConfiguration * _Nullable)config NS_SWIFT_NAME(startScreenCapture(_:config:)); + +/** Stops a screen capture. + + @note This method applies to macOS only. + + @param The capture type of the custom video source. See #AgoraVideoSourceType. + @return * 0: Success. +* <0: Failure. + - `ERR_INVALID_ARGUMENT`: the argument is invalid. + */ +- (int)stopScreenCapture:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(stopScreenCapture(_:)); + +/** Shares the whole or part of a screen by specifying the display ID. (macOS only.) + +@param displayId The ID ( type of CGDirectDisplayId) of the display screen to be shared. This parameter specifies which display screen you want to share. For information on how to get the displayId, see [Share the Screen](../../../screensharing_mac). +@param regionRect (Optional) The relative location of the region to the display screen. nil means sharing the whole screen. This parameter contains the following properties: + +- x: the horizontal offset from the top-left corner. +- y: the vertical offset from the top-left corner. +- width: the width of the region. +- height: the height of the region. + +If the specified region overruns the screen, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen. +@param captureParams The screen sharing encoding parameters, see [AgoraScreenCaptureParameters](AgoraScreenCaptureParameters). + +@return * 0: Success. +* < 0: Failure. + + - `ERR_INVALID_STATE`: the screen sharing state is invalid, probably because another screen or window is being shared. Call [stopScreenCapture]([AgoraRtcEngineKit stopScreenCapture]) to stop sharing the current window. + - `ERR_INVALID_ARGUMENT`: the argument is invalid. + */ +- (int)startScreenCaptureByDisplayId:(UInt32)displayId + regionRect:(CGRect)regionRect + captureParams:(AgoraScreenCaptureParameters *_Nonnull)captureParams NS_SWIFT_NAME(startScreenCapture(byDisplayId:regionRect:captureParams:)); + +/** Shares the whole or part of a window by specifying the window ID. (macOS only.) + +@param windowId The ID of the window ( type of CGWindowId) to be shared. This parameter specifies which window you want to share. For information on how to get the windowId, see [Share the Screen](../../../screensharing_mac). +@param regionRect (Optional) The relative location of the region to the window. nil means sharing the whole window. This parameter contains the following properties: + +- x: the horizontal offset from the top-left corner. +- y: the vertical offset from the top-left corner. +- width: the width of the region. +- height: the height of the region. + +If the specified region overruns the window, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole window. +@param captureParams The window sharing encoding parameters, see [AgoraScreenCaptureParameters](AgoraScreenCaptureParameters). + +@return * 0: Success. +* < 0: Failure. + + - `ERR_INVALID_STATE`: the window sharing state is invalid, probably because another screen or window is being shared. Call [stopScreenCapture]([AgoraRtcEngineKit stopScreenCapture]) to stop sharing the current window. + - `ERR_INVALID_ARGUMENT`: the argument is invalid. + */ +- (int)startScreenCaptureByWindowId:(UInt32)windowId + regionRect:(CGRect)regionRect + captureParams:(AgoraScreenCaptureParameters *_Nonnull)captureParams NS_SWIFT_NAME(startScreenCapture(byWindowId:regionRect:captureParams:)); + +/** Updates the screen capture region. + + @note This method applies to macOS only. + + @param rect The screen capture region. + + @return * 0: Success. +* <0: Failure. + */ +- (int)updateScreenCaptureRegion:(CGRect)rect NS_SWIFT_NAME(updateScreenCaptureRegion(_:)); + +/** Updates the screen sharing parameters. (macOS only.) + +@param captureParams The screen sharing encoding parameters, see [AgoraScreenCaptureParameters](AgoraScreenCaptureParameters). + +@return * 0: Success. +* < 0: Failure. + + - `ERR_NOT_READY`: no screen or windows is being shared. + */ +- (int)updateScreenCaptureParameters:(AgoraScreenCaptureParameters * _Nonnull)captureParams NS_SWIFT_NAME(updateScreenCaptureParameters(_:)); + +/** + Gets a list of shareable screens and windows. + + You can call this method before sharing a screen or window to get a list of + shareable screens and windows, which enables a user to use thumbnails in the + list to easily choose a particular screen or window to share. This list also + contains important information such as window ID and screen ID, with which you + can call [startScreenCaptureByWindowId]([AgoraRtcEngineKit startScreenCaptureByWindowId:rectangle:parameters:]) + or [startScreenCaptureByDisplayId]([AgoraRtcEngineKit startScreenCaptureByDisplayId:rectangle:parameters:]) + to start the sharing. + + @note This method applies to macOS only. + + @param thumbSize The target size of the screen or window thumbnail. The width and height are in pixels. The SDK scales + the original image to make the length of the longest side of the image the same as that of the target size without + distorting the original image. For example, if the original image is 400 × 300 and `thumbSize` is 100 × 100, the + actual size of the thumbnail is 100 × 75. If the target size is larger than the original size, the thumbnail is the + original image and the SDK does not scale it. + @param iconSize The target size of the icon corresponding to the application program. The width and height are in pixels. + The SDK scales the original image to make the length of the longest side of the image the same as that of the target + size without distorting the original image. For example, if the original image is 400 × 300 and `iconSize` is 100 × 100, + the actual size of the icon is 100 × 75. If the target size is larger than the original size, the icon is the original + image and the SDK does not scale it. + @param includeScreen Whether the SDK returns screen information in addition to window information: + + - YES: The SDK returns screen and window information. + - NO: The SDK returns window information only. + + @return AgoraScreenCaptureSourceInfo + */ +- (NSArray* _Nullable)getScreenCaptureSourcesWithThumbSize:(NSSize)thumbSize iconSize:(NSSize)iconSize includeScreen:(BOOL)includeScreen NS_SWIFT_NAME(getScreenCaptureSources(withThumbSize:iconSize:includeScreen:)); + +#endif + +/** Setting the screen sharing capture scenario. + +@param scenarioType The screen sharing scenario parameters, see [AgoraScreenScenarioType](AgoraScreenScenarioType). + +@return * 0: Success. +* < 0: Failure. + + - `ERR_NOT_READY`: no screen or windows is being shared. + */ +- (int)setScreenCaptureScenario:(AgoraScreenScenarioType)scenarioType NS_SWIFT_NAME(setScreenCaptureScenario(_:)); + +/** Stops a screen capture. + + @note This method applies to macOS / iOS. + + @return * 0: Success. +* <0: Failure. + */ +- (int)stopScreenCapture NS_SWIFT_NAME(stopScreenCapture()); + +#if TARGET_OS_IPHONE +/** Starts screen sharing. + + * Before calling this method, ensure that you have integrated AgoraRelayKitExtension.framework. + * When you call this method, AgoraRtcEngine will establish a socket connection to the ReplayKit extension. + * In the ReplayKit extension, inherit the AgoraReplayKitHandler, and then AgoraRtcEngine will get the screen share data. + + * A successful call of this method triggers the [AgoraRtcEngineDelegate]([AgoraRtcEngineDelegate rtcEngine:localVideoStateChangedOfState:state:error:sourceType]) callback: + - When sourceType == AgoraVideoSourceTypeScreen and state == AgoraVideoLocalStateCapturing, you can call [AgoraRtcEngine updateChannelWithMediaOptions:] + to change the publishScreenCaptureVideo/publishScreenCaptureAudio = YES and then publish the screen share video stream. + + - When sourceType == AgoraVideoSourceTypeScreen and state == AgoraVideoLocalStateStopped, you can call [AgoraRtcEngine updateChannelWithMediaOptions:] + to change the publishScreenCaptureVideo/publishScreenCaptureAudio = NO and then stop publishing the screen share video stream. + + * @note This method applies to iOS 11+ only. + * @param parameters The configuration of the screen sharing. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startScreenCapture:(AgoraScreenCaptureParameters2* _Nullable)parameters NS_SWIFT_NAME(startScreenCapture(_:)); + +/** + * Updates the screen sharing configuration. + * + * @param parameters The configuration of the screen sharing. + * @note This method applies to iOS 11+ only. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateScreenCapture:(AgoraScreenCaptureParameters2* _Nullable)parameters NS_SWIFT_NAME(updateScreenCapture(_:)); + +- (AgoraScreenCaptureFrameRateCapability)queryScreenCaptureCapability NS_SWIFT_NAME(queryScreenCaptureCapability()); + +#pragma mark Camera Control + +/**----------------------------------------------------------------------------- + * @name Camera Control + * ----------------------------------------------------------------------------- + */ + +/** Checks whether camera zoom is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the camera zoom function + * NO: The device does not support the camera zoom function + */ +- (BOOL)isCameraZoomSupported NS_SWIFT_NAME(isCameraZoomSupported()); + +/** get the max camera zoom ratio. + + @note This method applies to iOS only, not to macOS. + + @return the max camera zoom ratio. +*/ +- (CGFloat)cameraMaxZoomFactor NS_SWIFT_NAME(cameraMaxZoomFactor()); + +/** Sets the camera zoom ratio. + + @note This method applies to iOS only, not to macOS. + + @param zoomFactor The camera zoom factor ranging from 1.0 to maximum zoom. + */ +- (CGFloat)setCameraZoomFactor:(CGFloat)zoomFactor NS_SWIFT_NAME(setCameraZoomFactor(_:)); + +/** Checks whether the manual focus is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the manual focus function + * NO: The device does not support the manual focus function + */ +- (BOOL)isCameraFocusPositionInPreviewSupported NS_SWIFT_NAME(isCameraFocusPositionInPreviewSupported()); + +/** Sets the manual focus position. + + @note This method applies to iOS only, not to macOS. + + @param position * positionX: Horizontal coordinate of the touch point in the view + * positionY: Vertical coordinate of the touch point in the view + */ +- (BOOL)setCameraFocusPositionInPreview:(CGPoint)position NS_SWIFT_NAME(setCameraFocusPositionInPreview(_:)); + +/** Checks whether the manual exposure is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the manual exposure function + * NO: The device does not support the manual exposure function + */ +- (BOOL)isCameraExposurePositionSupported NS_SWIFT_NAME(isCameraExposurePositionSupported()); + +/** Sets the manual exposure position. + + @note This method applies to iOS only, not to macOS. + + @param positionInView * positionX: Horizontal coordinate of the touch point in the view + * positionY: Vertical coordinate of the touch point in the view + */ +- (BOOL)setCameraExposurePosition:(CGPoint)positionInView NS_SWIFT_NAME(setCameraExposurePosition(_:)); + +/** Checks whether camera supports to set exposure value. + +@note This method applies to iOS only, not to macOS. + +@return * YES: The device supports the camera exposure function +* NO: The device does not support the camera exposure function +*/ +- (BOOL)isCameraExposureSupported NS_SWIFT_NAME(isCameraExposureSupported()); + +/** Sets the camera exposure value bias. + +@note This method applies to iOS only, not to macOS. + +@param exposureFactor the recommended camera exposure factor ranging from -8.0 to 8.0. Absolute EV bias will set to camera. +*/ +- (CGFloat)setCameraExposureFactor:(CGFloat)exposureFactor NS_SWIFT_NAME(setCameraExposureFactor(_:)); + +/** Checks whether the device supports enabling the flash. (iOS only.) + + The SDK uses the front camera by default, so if you call + `isCameraTorchSupported` directly, you can find out from the return value + whether the device supports enabling the flash when using the front camera. + If you want to check whether the device supports enabling the flash when + using the rear camera, call [switchCamera]([AgoraRtcEngineKit switchCamera]) + to switch the camera used by the SDK to the rear camera, and then call + `isCameraTorchSupported`. + + **Note** + + - Call this method after the camera is started. + - On iPads with system version 15, even if `isCameraTorchSupported` + returns `YES`, you might fail to successfully enable the flash by calling + [setCameraTorchOn]([AgoraRtcEngineKit setCameraTorchOn:]) due to system issues. + + @return * YES: The device supports enabling the flash. + * NO: The device does not support enabling the flash. + */ +- (BOOL)isCameraTorchSupported NS_SWIFT_NAME(isCameraTorchSupported()); + +/** Sets whether to enable the flash. (iOS only.) + + **Note** + + - Call this method after the camera is started. + - On iPads with system version 15, even if [isCameraTorchSupported]([AgoraRtcEngineKit isCameraTorchSupported]) + returns `YES`, you might fail to successfully enable the flash by calling `setCameraTorchOn` due to system issues. + + @param isOn Determines whether to enable the flash: + + * YES: Enable the flash. + * NO: Do not enable the flash. + + @return * YES: Success. +* NO: Failure. + */ +- (BOOL)setCameraTorchOn:(BOOL)isOn NS_SWIFT_NAME(setCameraTorchOn(_:)); + +/** Checks whether the autofocus is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the autofocus function + * NO: The device does not support the autofocus function + */ +- (BOOL)isCameraAutoFocusFaceModeSupported NS_SWIFT_NAME(isCameraAutoFocusFaceModeSupported()); + +/** Enables the camera autoFocus. + + @note This method applies to iOS only, not to macOS. + + @param enable * YES: Enable the camera autofocus + * NO: Disable the camera autofocus + + @return + * YES: Success. + * NO: Failure. + */ +- (BOOL)setCameraAutoFocusFaceModeEnabled:(BOOL)enable NS_SWIFT_NAME(setCameraAutoFocusFaceModeEnabled(_:)); + +/** Checks whether the autoexposure is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the autoexposure function + * NO: The device does not support the autoexposure function + */ +- (BOOL)isCameraAutoExposureFaceModeSupported NS_SWIFT_NAME(isCameraAutoExposureFaceModeSupported()); + +/** Enables the camera autoExposure. + + @note This method applies to iOS only, not to macOS. + + @param enable * YES: Enable the camera autoexposure + * NO: Disable the camera autoexposure + + @return + * YES: Success. + * NO: Failure. + */ +- (BOOL)setCameraAutoExposureFaceModeEnabled:(BOOL)enable NS_SWIFT_NAME(setCameraAutoExposureFaceModeEnabled(_:)); + +/** + * Switches between the front and rear cameras. + * @note This method applies to iOS only, not to macOS. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)switchCamera NS_SWIFT_NAME(switchCamera()); + +/** Enables the SDK use AVCaptureMultiCamSession or AVCaptureSession. Applies to iOS 13.0+ only. + * @param enabled Whether to enable multi-camera when capturing video: + * - true: Enable multi-camera, and the SDK uses AVCaptureMultiCamSession. + * - false: Disable multi-camera, and the SDK uses AVCaptureSession. + * @param config The config for secondary camera capture session. See \ref AgoraCameraCapturerConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableMultiCamera:(BOOL)enabled config:(AgoraCameraCapturerConfiguration* _Nullable)config NS_SWIFT_NAME(enableMultiCamera(_:config:)); +#endif + + +/** Sets the camera capture configuration. + * @note Call this method before enabling the local camera. + * That said, you can call this method before calling \ref IRtcEngine::joinChannel "joinChannel", + * \ref IRtcEngine::enableVideo "enableVideo", or \ref IRtcEngine::enableLocalVideo "enableLocalVideo", + * depending on which method you use to turn on your local camera. + * + * @param config Sets the camera capturer configuration. See AgoraCameraCapturerConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setCameraCapturerConfiguration:(AgoraCameraCapturerConfiguration * _Nullable)config NS_SWIFT_NAME(setCameraCapturerConfiguration(_:)); + + +/** + * Start the camera capture + * + * @param sourceType source type of camera. See #AgoraVideoSourceType. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startCameraCapture:(AgoraVideoSourceType)sourceType config:(AgoraCameraCapturerConfiguration * _Nullable)config NS_SWIFT_NAME(startCameraCapture(_:config:)); + +/** + * Stop the camera capture + * + * @param sourceType source type of camera. See #AgoraVideoSourceType. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopCameraCapture:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(stopCameraCapture(_:)); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +#pragma mark macOS Device +/**----------------------------------------------------------------------------- + * @name macOS Device + * ----------------------------------------------------------------------------- + */ + +/** Monitors the change of a device state. + + @note This method applies to macOS only, not to iOS. + + @param enabled - YES: Enable the monitoring of a device state change + - Fales: Disable the monitoring a device state change + */ +- (void)monitorDeviceChange:(BOOL)enabled NS_SWIFT_NAME(monitorDeviceChange(_:)); + +/** Gets all the devices in the system. + + @note This method applies to macOS only, not to iOS. + + This method returns an NSArray object, including all the devices in the system. + Your application can use the AgoraRtcDeviceInfo array object to enumerate the devices. + + @note Do not call this method in the main thread. + + @param type AgoraMediaDeviceType + @return When called successfully, it returns an AgoraRtcDeviceInfo NSArray object including all the devices. + */ +- (NSArray * _Nullable)enumerateDevices:(AgoraMediaDeviceType)type NS_SWIFT_NAME(enumerateDevices(_:)); + +/** Gets the device info; such as a recording, playback, or video capture device. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @return When called successfully, it returns the device info of the device. Otherwise, it returns nil. + */ +- (AgoraRtcDeviceInfo * _Nullable)getDeviceInfo:(AgoraMediaDeviceType)type NS_SWIFT_NAME(getDeviceInfo(_:)); + +/** Specifies the player, recording, or audio-sampling device. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @param deviceId Device ID of the device, which can be fetched by calling [enumerateDevices](enumerateDevices:). The deviceId does not change when plugged or unplugged. + @return * 0: Success. +* <0: Failure. + */ + +- (int)setDevice:(AgoraMediaDeviceType)type deviceId:(NSString * _Nonnull)deviceId NS_SWIFT_NAME(setDevice(_:deviceId:)); + +/** Gets the default audio device of the system (macOS only). + + @param type Device type: AgoraMediaDeviceType. + @return * The device information (AgoraRtcDeviceInfo), if this method call is successful. + * nil: Failure. +*/ +- (AgoraRtcDeviceInfo* _Nullable)getDefaultAudioDevice:(AgoraMediaDeviceType)type NS_SWIFT_NAME(getDefaultAudioDevice(_:)); + +/** Gets the specified device's volume. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @return * 0: Success. +* <0: Failure. + */ +- (int)getDeviceVolume:(AgoraMediaDeviceType)type NS_SWIFT_NAME(getDeviceVolume(_:)); + +/** Sets the specified device's volume. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @param volume The volume to set, ranging from 0 to 255. + @return * 0: Success. +* <0: Failure. + */ +- (int)setDeviceVolume:(AgoraMediaDeviceType)type volume:(int)volume NS_SWIFT_NAME(setDeviceVolume(_:volume:)); + +/** Starts the microphone test. + + @note This method applies to macOS only, not to iOS. + + This method tests whether the microphone works properly. Once the test starts, the SDK reports the volume information by using the [reportAudioVolumeIndicationOfSpeakers]([AgoraRtcEngineDelegate rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:]) callback method. + + @param indicationInterval Interval (ms) at which to report the microphone volume. + @return * 0: Success. +* <0: Failure. + */ +- (int)startRecordingDeviceTest:(int)indicationInterval NS_SWIFT_NAME(startRecordingDeviceTest(_:)); + +/** Stops the microphone test. + + @note This method applies to macOS only, not to iOS. + + This method stops testing the microphone. You must call this method to stop the test after calling the [startRecordingDeviceTest](startRecordingDeviceTest:) method. + + @return * 0: Success. +* <0: Failure. + */ +- (int)stopRecordingDeviceTest NS_SWIFT_NAME(stopRecordingDeviceTest()); + + /** Starts a playback device test. + + @note This method applies to macOS only, not to iOS. + + This method tests whether the playback device works properly with the specified playback audio file. + + @param audioFileName File path of the audio file for the test, which is in utf8 absolute path: + + - Supported File Format: wav, mp3, m4a, and aac + - Supported File Sampling Rate: 8000, 16000, 32000, 44100, and 48000 + + @return * 0: Success. +* <0: Failure. + */ +- (int)startPlaybackDeviceTest:(NSString * _Nonnull)audioFileName NS_SWIFT_NAME(startPlaybackDeviceTest(_:)); + +/** Stops the playback device test. + + @note This method applies to macOS only, not to iOS. + + This method stops testing the playback device. You must call this method to stop the test after calling [startPlaybackDeviceTest](startPlaybackDeviceTest:). + + @return * 0: Success. +* <0: Failure. + */ +- (int)stopPlaybackDeviceTest NS_SWIFT_NAME(stopPlaybackDeviceTest()); + +/** Starts the audio device loopback test. (macOS only.) + +This method tests whether the local audio devices are working properly. After calling this method, the microphone captures the local audio and plays it through the speaker. The [reportAudioVolumeIndicationOfSpeakers]([AgoraRtcEngineDelegate rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:]) callback returns the local audio volume information at the set interval. + +**Note:** + +This method tests the local audio devices and does not report the network conditions. + +@param indicationInterval The time interval (ms) at which the [reportAudioVolumeIndicationOfSpeakers]([AgoraRtcEngineDelegate rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:]) callback returns. We recommend setting it as greater than 200 ms. The minimum value is 10 ms. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)startAudioDeviceLoopbackTest:(int)indicationInterval NS_SWIFT_NAME(startAudioDeviceLoopbackTest(_:)); + +/** Stops the audio device loopback test. (macOS only.) + +Ensure that you call this method to stop the loopback test after calling the [startAudioDeviceLoopbackTest]([AgoraRtcEngineKit startAudioDeviceLoopbackTest:]) method. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)stopAudioDeviceLoopbackTest NS_SWIFT_NAME(stopAudioDeviceLoopbackTest()); + +/** The status of following system default playback device. + + @note The status of following system default playback device. + + @param enable Variable to whether the current device follow system default playback device or not. + - true: The current device will change when the system default playback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. +*/ +- (int)followSystemPlaybackDevice:(BOOL)enable NS_SWIFT_NAME(followSystemPlaybackDevice(_:)); + +/** The status of following system default recording device. + + @note The status of following system default recording device. + + @param enable Variable to whether the current device follow system default recording device or not. + - true: The current device will change when the system default recording device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ +- (int)followSystemRecordingDevice:(BOOL)enable NS_SWIFT_NAME(followSystemRecordingDevice(_:)); + +/** Starts the capture device test. + + @note This method applies to macOS only, not to iOS. + + This method tests whether the current video capture device works properly. Ensure that you have called enableVideo before calling this method and that the parameter view window is valid. + + @param view Input parameter, for displaying the video window. + */ +- (int)startCaptureDeviceTest:(NSView * _Nonnull)view NS_SWIFT_NAME(startCaptureDeviceTest(_:)); + +/** Stops the capture device test. + + @note This method applies to macOS only, not to iOS. + + This method stops testing the capture device. You must call this method to stop the test after calling [startCaptureDeviceTest](startCaptureDeviceTest:). + */ +- (int)stopCaptureDeviceTest NS_SWIFT_NAME(stopCaptureDeviceTest()); +#endif + +#pragma mark Face Detection + +#if TARGET_OS_IPHONE + +/**----------------------------------------------------------------------------- + * @name Face Detection + * ----------------------------------------------------------------------------- + */ + +/** Enables/Disables face detection for the local user. (iOS only) + + Once face detection is enabled, the SDK triggers the [facePositionDidChangeWidth]([AgoraRtcEngineDelegate rtcEngine:facePositionDidChangeWidth:previewHeight:faces:]) callback to report the face information of the local user, which includes the following aspects: + + - The width and height of the local video. + - The position of the human face in the local video. + - The distance between the human face and the device screen. + + You can call this method either before or after joining a channel. + + @param enable Determines whether to enable the face detection function for the local user: + + - YES: Enable face detection. + - NO: Disable face detection. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)enableFaceDetection:(bool)enable NS_SWIFT_NAME(enableFaceDetection(_:)); +#endif + +#pragma mark Watermark + +/**----------------------------------------------------------------------------- + * @name Watermark + * ----------------------------------------------------------------------------- + */ + +/** Adds a watermark in the PNG file format onto the local video stream so that the recording device and the audience in the channel and CDN can see or capture it. + + To add the PNG file onto a CDN publishing stream only, see the method described in [setLiveTranscoding](setLiveTranscoding:). + + @param watermark AgoraImage + */ +- (int)addVideoWatermark:(AgoraImage * _Nonnull)watermark NS_SWIFT_NAME(addVideoWatermark(_:)) __deprecated_msg("use addVideoWatermark:url options instead."); + +/** Adds a watermark image to the local video. + + This method adds a PNG watermark image to the local video in the interactive live streaming. Once the watermark image is added, all the audience in the channel (CDN audience included), and the capturing device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one. + + The watermark position depends on the settings in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method: + + - If the orientation mode of the encoding video is AgoraVideoOutputOrientationModeFixedLandscape, or the landscape mode in AgoraVideoOutputOrientationModeAdaptative, the watermark uses the landscape orientation. + - If the orientation mode of the encoding video is AgoraVideoOutputOrientationModeFixedPortrait, or the portrait mode in AgoraVideoOutputOrientationModeAdaptative, the watermark uses the portrait orientation. + - When setting the watermark position, the region must be less than the dimensions set in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method. Otherwise, the watermark image will be cropped. + + **Note** + + - Ensure that you have called the [enableVideo]([AgoraRtcEngineKit enableVideo]) method to enable the video module before calling this method. + - If you only want to add a watermark image to the local video for the audience in the CDN live streaming channel to see and capture, you can call this method or the [setLiveTranscoding]([AgoraRtcEngineKit setLiveTranscoding:]) method. + - This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray. + - If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings. + - If you have enabled the local video preview by calling the [startPreview]([AgoraRtcEngineKit startPreview]) method, you can use the `visibleInPreview` member in the WatermarkOptions class to set whether or not the watermark is visible in preview. + - If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. + + @param url The local file path of the watermark image to be added. This method supports adding a watermark image from the local file path. If the watermark image to be added is in the project file, you need to change the image's Type from PNG image to Data in the Xcode property, otherwise, the Agora Native SDK cannot recognize the image. + @param options The options of the watermark image to be added. See WatermarkOptions. + + @return * 0: Success. + * < 0: Failure. + */ +- (int)addVideoWatermark:(NSURL* _Nonnull)url options:(WatermarkOptions* _Nonnull)options NS_SWIFT_NAME(addVideoWatermark(_:options:)); + +/** Clears the watermark image on the video stream. +@return * 0: Success. + * < 0: Failure. + */ +- (int)clearVideoWatermarks NS_SWIFT_NAME(clearVideoWatermarks()); + +#pragma mark String UID + +/** Registers a user account. + * + * Once registered, the user account can be used to identify the local user when the user joins the channel. + * After the user successfully registers a user account, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" callback on the local client, + * reporting the user ID and user account of the local user. + * + * To join a channel with a user account, you can choose either of the following: + * + * Call the [registerLocalUserAccount]([AgoraRtcEngineKit registerLocalUserAccount:appId:]) method to create a user account, and then the [joinChannelByUserAccount]([AgoraRtcEngineKit joinChannelByUserAccount:token:channelId:joinSuccess:]) method to join the channel. + * Call the [joinChannelByUserAccount]([AgoraRtcEngineKit joinChannelByUserAccount:token:channelId:joinSuccess:]) method to join the channel. + + * + * The difference between the two is that for the former, the time elapsed between calling the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method + * and joining the channel is shorter than the latter. + * + * @note + * - Ensure that you set the `userAccount` parameter. Otherwise, this method does not take effect. + * - Ensure that the value of the `userAccount` parameter is unique in the channel. + * - To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param appID The App ID of your project. + + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)registerLocalUserAccount:(NSString* _Nonnull)userAccount appId:(NSString* _Nonnull)appId NS_SWIFT_NAME(registerLocalUserAccount(_:appId:)); + +/** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param joinSuccessBlock callback block + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (-2) + * - #ERR_NOT_READY (-3) + * - #ERR_REFUSED (-5) + */ +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + userAccount:(NSString * _Nonnull)userAccount + joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannel(byToken:channelId:userAccount:joinSuccess:)); + +/** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param mediaOptions The channel media options: \ref agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions" + * @param joinSuccessBlock callback block + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (-2) + * - #ERR_NOT_READY (-3) + * - #ERR_REFUSED (-5) + */ +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + userAccount:(NSString * _Nonnull)userAccount + mediaOptions:(AgoraRtcChannelMediaOptions * _Nonnull)mediaOptions + joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannel(byToken:channelId:userAccount:mediaOptions:joinSuccess:)); + +/** Gets the user information by passing in the user account. + + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (`AgoraUserInfo`), and triggers the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback on the local client. + + * After receiving the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback, you can call this method to get the user ID of the remote user from the `userInfo` object by passing in the user account. + + * @param userAccount The user account of the user. Ensure that you set this parameter. + * @param error The pointer to [AgoraErrorCode](AgoraErrorCode). It can be set as nil. + * @return An [AgoraUserInfo](AgoraUserInfo) object that contains the user account and user ID of the user. + */ +- (AgoraUserInfo* _Nullable)getUserInfoByUserAccount:(NSString* _Nonnull)userAccount withError:(AgoraErrorCode* _Nullable)error NS_SWIFT_NAME(getUserInfo(byUserAccount:withError:)); + +/** Gets the user information by passing in the user ID. + + * After a user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (`AgoraUserInfo`), and triggers the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback on the local client. + + * After receiving the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback, you can call this method to get the user account of the user from the `userInfo` object by passing in the user ID. + + * @param uid The user ID of the user. Ensure that you set this parameter. + * @param error The pointer to [AgoraErrorCode](AgoraErrorCode). It can be set as nil. + * @return An [AgoraUserInfo](AgoraUserInfo) object that contains the user account and user ID of the user. + */ +- (AgoraUserInfo* _Nullable)getUserInfoByUid:(NSUInteger)uid withError:(AgoraErrorCode* _Nullable)error NS_SWIFT_NAME(getUserInfo(byUid:withError:)); + +#pragma mark Custom Audio PCM Frame + +/** + * @brief register & unregister the player audio observer + * + * @param delegate observer object, pass nil to unregister + * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR + */ +- (BOOL)setAudioFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setAudioFrameDelegate(_:)); + +#pragma mark Custom Video Frame + +/** + * Registers & unregister video frame observer object. + * + * @note + * - Ensure that you call this method before joining the channel. + * + * @param delegate An object to the video frame observer: id. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (BOOL)setVideoFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setVideoFrameDelegate(_:)); + +#pragma mark Encoded Video Frame + +/** + * Obtain H264 video data before decoding. + * + * @note + * - Ensure that you call this method before joining the channel. + * + * @param delegate An object to the video frame observer: id. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (BOOL)setEncodedVideoFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setEncodedVideoFrameDelegate(_:)); + +#pragma mark Custom Media Metadata + +/**----------------------------------------------------------------------------- + * @name Media Metadata + * ----------------------------------------------------------------------------- + */ + +/** Sets the data source of the metadata. + + You need to implement the \ref AgoraMediaMetadataDataSource protocol and specify the type of metadata in this method. + + Use this method with the \ref AgoraRtcEngineKit.setMediaMetadataDelegate:withType: setMediaMetadataDelegate method to add synchronized metadata in the video stream. You can create more diversified live interactive streaming interactions, such as sending shopping links, digital coupons, and online quizzes. + + **Note** + + - Call this method before the `joinChannelByToken` method. + - This method applies to the live interactive streaming channel profile only. + + @param metadataDataSource The AgoraMediaMetadataDataSource protocol. + @param type The metadata type. See \ref AgoraMetadataType. Currently, the SDK supports video metadata only. + @return + - YES: Success. + - NO: Failure. + */ +- (BOOL)setMediaMetadataDataSource:(id _Nullable)metadataDataSource withType:(AgoraMetadataType)type NS_SWIFT_NAME(setMediaMetadataDataSource(_:with:)); + +/** Sets the delegate of the metadata. + + You need to implement the AgoraMediaMetadataDelegate protocol and specify the type of metadata in this method. + + **Note** + + - Call this method before the `joinChannelByToken` method. + - This method applies to the live interactive streaming channel profile only. + + @param metadataDelegate The AgoraMediaMetadataDelegate protocol. + @param type The metadata type. See \ref AgoraMetadataType. Currently, the SDK supports video metadata only. + @return + - YES: Success. + - NO: Failure. + */ +- (BOOL)setMediaMetadataDelegate:(id _Nullable)metadataDelegate withType:(AgoraMetadataType)type NS_SWIFT_NAME(setMediaMetadataDelegate(_:with:)); + +#pragma mark Miscellaneous Methods + +/**----------------------------------------------------------------------------- + * @name Miscellaneous Methods + * ----------------------------------------------------------------------------- + */ + +/** + * Gets the Agora SDK version. + * + * @return The version of the current SDK in the string format. + */ ++ (NSString * _Nonnull)getSdkVersion NS_SWIFT_NAME(getSdkVersion()); + +/** + * Gets the warning or error description. + * @param error The warning or error code. + * @return The detailed warning or error description. + */ ++ (NSString* _Nonnull)getErrorDescription:(NSInteger)error NS_SWIFT_NAME(getErrorDescription(_:)); + + +/** Returns the native handler of the SDK Engine. + + This interface is used to get native the C++ handler of the SDK engine that can be used in special scenarios, such as register the audio and video frame observer. + */ +- (void * _Nullable)getNativeHandle NS_SWIFT_NAME(getNativeHandle()); + + +/** + * Specifies an SDK output log file. + * + * The log file records all log data for the SDK’s operation. Ensure that the + * directory for the log file exists and is writable. + * + * @note + * - The default log file location is as follows: + * - iOS: `App Sandbox/Library/caches/agorasdk.log` + * - macOS + * - Sandbox enabled: `App Sandbox/Library/Logs/agorasdk.log`, for + * example `/Users//Library/Containers//Data/Library/Logs/agorasdk.log`. + * - Sandbox disabled: `~/Library/Logs/agorasdk.log`. + * - Ensure that you call this method immediately after calling the + * \ref sharedEngineWithAppId:delegate: sharedEngineWithAppId method, + * otherwise the output log might not be complete. + * @param filePath Absolute path of the log file. The string of the log file is + * in UTF-8 code. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setLogFile:(NSString * _Nonnull)filePath NS_SWIFT_NAME(setLogFile(_:)); + +/** Sets the output log filter level of the SDK. + +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 filter level to `Warning`, you see the logs within levels `Critical`, `Error`, and `Warning`. + + @see \ref AgoraRtcEngineKit.setLogFile: setLogFile + + @param filter Log filter level: \ref AgoraLogFilter. + + @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLogFilter:(NSUInteger)filter NS_SWIFT_NAME(setLogFilter(_:)); + +/** + * Sets the log file size (KB). + * + * The SDK has two log files, each with a default size of 512 KB. If you set + * `fileSizeInBytes` as 1024 KB, the SDK outputs log files with a total + * maximum size of 2 MB. + * If the total size of the log files exceed the set value, + * the new output log files overwrite the old output log files. + * + * @param fileSizeInKBytes The SDK log file size (KB). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLogFileSize:(NSUInteger)fileSizeInKBytes NS_SWIFT_NAME(setLogFileSize(_:)); + +/** Upload current log file immediately to server. + * only use this when an error occurs + * block before log file upload success or timeout. + * + * @return + * requestID the id of this upload. + */ +- (NSString * _Nullable)uploadLogFile NS_SWIFT_NAME(uploadLogFile()); + +/** * Write the log to SDK . @technical preview + + You can Write the log to SDK log files of the specified level + + @param level Log level: \ref AgoraLogLevel. + + @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)writeLog:(AgoraLogLevel)level content:(NSString * _Nonnull)content NS_SWIFT_NAME(writeLog(_:content:)); + +/** + * Gets the current call ID. + * + * When a user joins a channel, a call ID is generated to identify the call. + * + * After a call ends, you can call `rate` or `complain` to gather feedback from + * your customer. + * + * @return The call ID if the method call is successful. + */ +- (NSString * _Nullable)getCallId NS_SWIFT_NAME(getCallId()); + +/** + * Allows a user to rate the call. + * + * It is usually called after the call ends. + * + * @param callId The call ID retrieved from the \ref getCallId method. + * @param rating The rating of the call between 1 (the lowest score) to 5 (the + * highest score). If you set a value out of this range, the + * #AgoraErrorCodeInvalidArgument(-2) error occurs. + * @param description (Optional) The description of the rating. The string + * length must be less than 800 bytes. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: #AgoraErrorCodeInvalidArgument. The passed argument is invalid. For + * example, `callId` is invalid. + * - -3: #AgoraErrorCodeNotReady. The SDK status is incorrect. For example, + * initialization fails. + */ +- (int)rate:(NSString * _Nonnull)callId + rating:(NSInteger)rating +description:(NSString * _Nullable)description NS_SWIFT_NAME(rate(_:rating:description:)); + +/** + * Allows a user to complain about the call quality. + * + * This method is usually called after the call ends. + * + * @param callId The call ID retrieved from the \ref getCallId method. + * @param description (Optional) The description of the complaint. The string + * length must be less than 800 bytes. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: #AgoraErrorCodeInvalidArgument. The passed argument is invalid. For + * example, `callId` is invalid. + * - -3: #AgoraErrorCodeNotReady. The SDK status is incorrect. For example, + * initialization fails. + */ +- (int)complain:(NSString * _Nonnull)callId + description:(NSString * _Nullable)description NS_SWIFT_NAME(complain(_:description:)); + + +/** Enables/Disables dispatching the delegate to the main queue. + + If disabled, the application should dispatch the UI operating to the main queue. + + @param enabled * YES: Dispatch the delegate method to the main queue. + * NO: Do not dispatch the delegate methods to the main queue + + @return * 0: Success. +* <0: Failure. + */ +- (int)enableMainQueueDispatch:(BOOL)enabled NS_SWIFT_NAME(enableMainQueueDispatch(_:)); + + +/** + * Starts the last-mile network probe test. + * + * Starts the last-mile network probe test before joining a channel to get the uplink and downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT). + * + * Call this method to check the uplink network quality before users join a channel or before an audience switches to a host. + * + * Once this method is enabled, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:lastmileProbeTestResult: lastmileProbeTestResult callback + * within 30 seconds depending on the network conditions. This callback reports the real-time statistics of the network conditions. + * + * @note + * - Do not call other methods before receiving the `lastmileProbeTestResult` callback. Otherwise, the callback may be interrupted. + * - This method consumes extra network traffic and may affect communication quality. + * + * @param config The configurations for the last-mile network probe test. See \ref AgoraLastmileProbeConfig. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startLastmileProbeTest:(AgoraLastmileProbeConfig *_Nullable)config NS_SWIFT_NAME(startLastmileProbeTest(_:)); + +/** + * Stops the last-mile network probe test. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopLastmileProbeTest NS_SWIFT_NAME(stopLastmileProbeTest()); + +/** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + + @note The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way. Contact support@agora.io for more information. + + @param options SDK options in JSON format. + */ +- (int)setParameters:(NSString * _Nonnull)options NS_SWIFT_NAME(setParameters(_:)); + +/** Gets the Agora SDK's parameters for customization purposes. + + @note This method is not public. Contact support@agora.io for more information. + + */ +- (NSString * _Nullable)getParameter:(NSString * _Nonnull)parameter + args:(NSString * _Nullable)args NS_SWIFT_NAME(getParameter(_:args:)); + + +/** + * Return current NTP(unix timestamp) time in milliseconds. + */ +- (uint64_t)getNtpWallTimeInMs; + +#pragma mark MediaPlayer +/**----------------------------------------------------------------------------- + * @name MediaPlayer publish + * ----------------------------------------------------------------------------- + */ +/** + * create MediaPlayer + * @param delegate An object to the mediaPlayer observer: id. + * @return id + */ +- (id_Nullable)createMediaPlayerWithDelegate:(id_Nullable)delegate NS_SWIFT_NAME(createMediaPlayer(with:)); +/** + * create MediaPlayer cache manager + * @return id + */ +- (id _Nullable)createMediaPlayerCacheManager NS_SWIFT_NAME(createMediaPlayerCacheManager()); + +/** + * Destroy a media player source instance. + * If a media player source instance is destroyed, the video and audio of it cannot + * be published. + * + * @param mediaPlayer id + * + * @return + * - >0: The id of media player source instance. + * - < 0: Failure. + */ +- (int)destroyMediaPlayer:(id_Nullable)mediaPlayer NS_SWIFT_NAME(destroyMediaPlayer(_:)); + +/** + * getMediaPlayer + * @param mediaPlayerId of the mediaPlayer. + * @return id + */ +- (id _Nullable)getMediaPlayer:(int)mediaPlayerId NS_SWIFT_NAME(getMediaPlayer(_:)); + +#pragma mark rhythm player + +/** Enables the rhythm player. + * + * @param sound1 The absolute path or URL address (including the filename extensions) of the file for the downbeat. + * @param sound2 The absolute path or URL address (including the filename extensions) of the file for the upbeats. + * @param config The configuration of rhythm player. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startRhythmPlayer:(NSString * _Nonnull)sound1 sound2:(NSString * _Nonnull)sound2 config:(AgoraRhythmPlayerConfig * _Nullable)config NS_SWIFT_NAME(startRhythmPlayer(_:sound2:config:)); + +/** Disables the rhythm player. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopRhythmPlayer NS_SWIFT_NAME(stopRhythmPlayer()); + +/** Configures the rhythm player. + * + * @param config The configuration of rhythm player. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)configRhythmPlayer:(AgoraRhythmPlayerConfig * _Nullable)config NS_SWIFT_NAME(configRhythmPlayer(_:)); + +#pragma mark Streaming Kit + +/** Set audio parameters for direct streaming to CDN + * + * @note + * Must call this api before "startDirectCdnStreaming" + * + * @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels: + * #AUDIO_PROFILE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDirectCdnStreamingAudioConfiguration:(AgoraAudioProfile)profile NS_SWIFT_NAME(setDirectCdnStreamingAudioConfiguration(_:)); + +/** Set video parameters for direct streaming to CDN + * + * Each configuration profile corresponds to a set of video parameters, including + * the resolution, frame rate, and bitrate. + * + * @note + * Must call this api before "startDirectCdnStreaming" + * + * @param config The local video encoder configuration: VideoEncoderConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDirectCdnStreamingVideoConfiguration:(AgoraVideoEncoderConfiguration * _Nonnull)config NS_SWIFT_NAME(setDirectCdnStreamingVideoConfiguration(_:)); + +/** Start direct cdn streaming + * + * @param delegate A pointer to the direct cdn streaming event handler: \ref agora::rtc::IDirectCdnStreamingEventHandler + * "IDirectCdnStreamingEventHandler". + * @param publishUrl The url of the cdn used to publish the stream. + * @param options The direct cdn streaming media options: AgoraDirectCdnStreamingMediaOptions. + * This API must pass an audio-related option, and temporarily cannot pass more than one. + * Video-related options may not be passed, or one, but not multiple. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startDirectCdnStreaming:(id _Nonnull)delegate + publishUrl:(NSString * _Nonnull)publishUrl + mediaOptions:(AgoraDirectCdnStreamingMediaOptions * _Nonnull)options NS_SWIFT_NAME(startDirectCdnStreaming(_:publishUrl:mediaOptions:)); + +/** Stop direct cdn streaming + * + * @note + * This method is temporarily not supported. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopDirectCdnStreaming NS_SWIFT_NAME(stopDirectCdnStreaming()); + +/** Change the media source during the pushing + * + * @note + * This method is synchronous. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateDirectCdnStreamingMediaOptions:(AgoraDirectCdnStreamingMediaOptions * _Nonnull)options NS_SWIFT_NAME(updateDirectCdnStreamingMediaOptions(_:)); + + + +#pragma mark Deprecated Methods + +/**----------------------------------------------------------------------------- + * @name Deprecated Methods + * ----------------------------------------------------------------------------- + */ + +/** The user who is talking and the speaker’s volume. + @deprecated From v1.1 + + By default it is disabled. If needed, use the [enableAudioVolumeIndication]([AgoraRtcEngineKit enableAudioVolumeIndication:smooth:]) method to configure it. + + @param audioVolumeIndicationBlock callback block, which contains the following + speakers The speakers (array). Each speaker (): + - uid: User ID of the speaker. + - volume:Volume of the speaker, between 0 (lowest volume) to 255 (highest volume). + totalVolume Total volume after audio mixing between 0 (lowest volume) to 255 (highest volume). + */ +- (void)audioVolumeIndicationBlock:(void(^ _Nullable)(NSArray * _Nonnull speakers, NSInteger totalVolume))audioVolumeIndicationBlock NS_SWIFT_NAME(audioVolumeIndicationBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The first local video frame is displayed on the screen. + @deprecated From v1.1 + + @param firstLocalVideoFrameBlock callback block, which contains the following + width Width (pixels) of the video stream. + height Height (pixels) of the video stream. + elapsed Time elapsed (ms) from a user joining the channel until this callback is triggered. + */ +- (void)firstLocalVideoFrameBlock:(void(^ _Nullable)(NSInteger width, NSInteger height, NSInteger elapsed))firstLocalVideoFrameBlock NS_SWIFT_NAME(firstLocalVideoFrameBlock(_:)) __deprecated_msg("use delegate instead."); + +/** Occurs when the first remote video frame is received and decoded. + + @deprecated This callback is deprecated. + + @param firstRemoteVideoDecodedBlock callback block, which contains the following + uid User ID of the user whose video streams are received. + width Width (pixels) of the video stream. + height Height (pixels) of the video stream. + elapsed Time elapsed (ms) from the user joining the channel until this callback is triggered. + */ +- (void)firstRemoteVideoDecodedBlock:(void(^ _Nullable)(NSUInteger uid, NSInteger width, NSInteger height, NSInteger elapsed))firstRemoteVideoDecodedBlock NS_SWIFT_NAME(firstRemoteVideoDecodedBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The first remote video frame is received and decoded. + @deprecated From v1.1 + + @param firstRemoteVideoFrameBlock callback block, which contains the following + uid User ID of the user whose video streams are received. + width Width (pixels) of the video stream. + height Height (pixels) of the video stream. + elapsed Time elapsed (ms) from the user joining the channel until this callback is triggered. + */ +- (void)firstRemoteVideoFrameBlock:(void(^ _Nullable)(NSUInteger uid, NSInteger width, NSInteger height, NSInteger elapsed))firstRemoteVideoFrameBlock NS_SWIFT_NAME(firstRemoteVideoFrameBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user has successfully joined the channel. + @deprecated From v1.1 + + If there are other users in the channel when this user joins, the SDK also reports to the application on the existing users who are already in the channel. + + @param userJoinedBlock callback block, which contains the following: + uid User ID. If the uid is specified in the `joinChannelByToken` method, it returns the specified ID; if not, it returns an ID that is automatically assigned by the Agora server. + elapsed Time elapsed (ms) from calling joinChannelByToken until this callback is triggered. + */ +- (void)userJoinedBlock:(void(^ _Nullable)(NSUInteger uid, NSInteger elapsed))userJoinedBlock NS_SWIFT_NAME(userJoinedBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user has left the call or gone offline. + @deprecated From v1.1 + + The SDK reads the timeout data to determine if a user has left the channel (or has gone offline). If no data package is received from the user in 15 seconds, the SDK assumes the user is offline. Sometimes a weak network connection may lead to false detections; therefore, Agora recommends using signaling for reliable offline detection. + + @param userOfflineBlock callback block, which contains the following: + uid User ID. + */ +- (void)userOfflineBlock:(void(^ _Nullable)(NSUInteger uid))userOfflineBlock NS_SWIFT_NAME(userOfflineBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user's audio stream has muted/unmuted. + @deprecated From v1.1 + + @param userMuteAudioBlock callback block, which contains the following: + uid User ID. + muted + - YES: Muted. + - NO: Unmuted. +*/ +- (void)userMuteAudioBlock:(void(^ _Nullable)(NSUInteger uid, BOOL muted))userMuteAudioBlock NS_SWIFT_NAME(userMuteAudioBlock(_:)) __deprecated_msg("use delegate instead."); + +/** Occurs when a remote user pauses or resumes sending the video stream. + + @deprecated This callback is deprecated. Use [remoteVideoStateChangedOfUid](remoteVideoStateChangedOfUid:state:reason:elapsed:) + instead. + + @note This callback is invalid when the number of users or broadacasters in a + channel exceeds 20. + + @param userMuteVideoBlock callback block, which contains the following: + userId ID of the remote user. + muted + - YES: The remote user has paused sending the video stream. + - NO: The remote user has resumed sending the video stream. + */ +- (void)userMuteVideoBlock:(void(^ _Nullable)(NSUInteger uid, BOOL muted))userMuteVideoBlock NS_SWIFT_NAME(userMuteVideoBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The SDK updates the application about the statistics of the uploading local video streams once every two seconds. + @deprecated From v1.1 + + @param localVideoStatBlock callback block, which contains the following: + sentBytes Total bytes sent since last count. + sentFrames Total frames sent since last count. + */ +- (void)localVideoStatBlock:(void(^ _Nullable)(NSInteger sentBitrate, NSInteger sentFrameRate))localVideoStatBlock NS_SWIFT_NAME(localVideoStatBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The SDK updates the application about the statistics of receiving remote video streams once every two seconds. + @deprecated From v1.1 + + @param remoteVideoStatBlock callback block, which contains the following: + uid User ID that specifies whose video streams are received. + rameCount Total frames received since last count. + delay Time delay (ms) + receivedBytes Total bytes received since last count. + */ +- (void)remoteVideoStatBlock:(void(^ _Nullable)(NSUInteger uid, NSInteger delay, NSInteger receivedBitrate, NSInteger receivedFrameRate))remoteVideoStatBlock NS_SWIFT_NAME(remoteVideoStatBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The camera is turned on and ready to capture the video. + @deprecated From v1.1 + */ +- (void)cameraReadyBlock:(void(^ _Nullable)(void))cameraReadyBlock NS_SWIFT_NAME(cameraReadyBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The SDK has lost network connection with the server. + @deprecated From v1.1 + */ +- (void)connectionLostBlock:(void(^ _Nullable)(void))connectionLostBlock NS_SWIFT_NAME(connectionLostBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user has rejoined the channel with the reported channel ID and user ID. + @deprecated From v1.1 + + When the local machine loses connection with the server because of network problems, the SDK automatically attempts to reconnect, and then triggers this callback method upon reconnection. + + @param rejoinChannelSuccessBlock callback block, which contains the following: + channel Channel name. + uid User ID. + elapsed Time delay (ns) in rejoining the channel. + */ +- (void)rejoinChannelSuccessBlock:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))rejoinChannelSuccessBlock NS_SWIFT_NAME(rejoinChannelSuccessBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The RtcEngine runtime statistics reported once every two seconds. + @deprecated From v1.1 + + @param rtcStatsBlock callback block, which contains the following: + stat AgoraChannelStats + */ +- (void)rtcStatsBlock:(void(^ _Nullable)(AgoraChannelStats * _Nonnull stat))rtcStatsBlock NS_SWIFT_NAME(rtcStatsBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user has left the channel. + @deprecated From v1.1 + + This callback also provides call session statistics, including the duration of the call and the transmitting and receiving bytes. + + @param leaveChannelBlock callback block, which contains the following: + stat AgoraChannelStats + */ +- (void)leaveChannelBlock:(void(^ _Nullable)(AgoraChannelStats * _Nonnull stat))leaveChannelBlock NS_SWIFT_NAME(leaveChannelBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The audio quality of the current call reported once every two seconds. + @deprecated From v1.1 + + @param audioQualityBlock callback block, which contains the following: + uid User ID of the speaker + quality AgoraNetworkQuality + delay Time delay (ms) + lost The packet loss rate (%) + */ +- (void)audioQualityBlock:(void(^ _Nullable)(NSUInteger uid, AgoraNetworkQuality quality, NSUInteger delay, NSUInteger lost))audioQualityBlock NS_SWIFT_NAME(audioQualityBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The network quality of the specified user in a communication or live broadcast channel reported once every two seconds. + @deprecated From v1.1 + + @param networkQualityBlock callback block, which contains the following: + uid User ID. The network quality of the user with this UID will be reported. If uid is 0, the local network quality is reported. + txQuality The transmission quality of the user: AgoraNetworkQuality + rxQuality The receiving quality of the user: AgoraNetworkQuality + */ +- (void)networkQualityBlock:(void(^ _Nullable)(NSUInteger uid, AgoraNetworkQuality txQuality, AgoraNetworkQuality rxQuality))networkQualityBlock NS_SWIFT_NAME(networkQualityBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The network quality of the local user reported once after you have called [startLastmileProbeTest]([AgoraRtcEngineKit startLastmileProbeTest]). + @deprecated From v1.1 + + @param lastmileQualityBlock callback block, which contains the following: + quality Quality of the last mile network: AgoraNetworkQuality + */ +- (void)lastmileQualityBlock:(void(^ _Nullable)(AgoraNetworkQuality quality))lastmileQualityBlock NS_SWIFT_NAME(lastmileQualityBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The media engine event. + @deprecated From v1.1. + */ +- (void)mediaEngineEventBlock:(void(^ _Nullable)(NSInteger code))mediaEngineEventBlock NS_SWIFT_NAME(mediaEngineEventBlock(_:)) __deprecated_msg("use delegate instead."); + +/** Disables the audio function in the channel. + + Replaced with the disableAudio method from v2.3. + + @deprecated Replaced with the disableAudio method from v2.3. + + @return * 0: Success. +* <0: Failure. + */ +- (int)pauseAudio __deprecated_msg("use disableAudio instead."); + +/** Enables the audio function in the channel. + + Replaced with the enableAudio method from v2.3. + + @deprecated Replaced with the enableAudio method from v2.3. + + @return * 0: Success. +* <0: Failure. + */ +- (int)resumeAudio __deprecated_msg("use enableAudio instead."); + +/** Initializes the The AgoraRtcEngineKit object. + + Replaced with [sharedEngineWithAppId]([AgoraRtcEngineKit sharedEngineWithAppId:delegate:]). + + @deprecated Replaced with sharedEngineWithAppId. + */ ++ (instancetype _Nonnull)sharedEngineWithAppId:(NSString * _Nonnull)AppId + error:(void(^ _Nullable)(AgoraErrorCode errorCode))errorBlock NS_SWIFT_NAME(sharedEngine(withAppId:error:)) __deprecated_msg("use sharedEngineWithAppId:delegate: instead."); + +/** Sets the high-quality audio parameters. + @deprecated + + Replaced with [setAudioProfile](setAudioProfile:scenario:). + */ +- (int)setHighQualityAudioParametersWithFullband:(BOOL)fullband + stereo:(BOOL)stereo + fullBitrate:(BOOL)fullBitrate NS_SWIFT_NAME(setHighQualityAudioParametersWithFullband(_:stereo:fullBitrate:)) __deprecated_msg("use setAudioProfile:scenario: instead."); + +/** Sets the video encoding profile. + @deprecated From v2.3 + + Each profile includes a set of parameters, such as the resolution, frame rate, and bitrate. When the camera does not support the specified resolution, the SDK chooses a suitable camera resolution, while the encoder resolution is the one specified by [setVideoProfile](setVideoProfile:swapWidthAndHeight:). + + @note * Always set the video profile after calling the enableVideo method. + * Always set the video profile before calling the `joinChannelByToken` or startPreview method. + + @param profile Enumeration definition about the video resolution, fps, and maximum kbit/s. See AgoraVideoProfile. + @param swapWidthAndHeight The width and height of the output video is consistent with that of the video profile you set. This parameter sets whether to swap the width and height of the stream: + + * YES: Swap the width and height. After that the video will be in the portrait mode, that is, width < height. + * NO: (Default) Do not swap the width and height, and the video remains in the landscape mode, that is, width > height. + + @return * 0: Success. +* <0: Failure. + */ +- (int)setVideoProfile:(AgoraVideoProfile)profile + swapWidthAndHeight:(BOOL)swapWidthAndHeight NS_SWIFT_NAME(setVideoProfile(_:swapWidthAndHeight:)) __deprecated_msg("use setVideoEncoderConfiguration: instead."); + +/** Sets the video encoding profile manually. + @deprecated From v2.3 + + @param size Size of the video that you want to set. The highest value is 1280 x 720. + @param frameRate Frame rate of the video that you want to set. The highest value is 30. You can set it to 5, 10, 15, 24, 30, and so on. + @param bitrate Bitrate of the video that you want to set. You need to manually work out the frame rate according to the width, height, and frame rate. With the same width and height, the bitrate varies with the change of the frame rate: + + * If the frame rate is 5 fps, divide the recommended bitrate by 2. + * If the frame rate is 15 fps, use the recommended bitrate. + * If the frame rate is 30 fps, multiply the recommended bitrate by 1.5. + * Calculate your bitrate with the ratio if you choose other frame rates. + + For example, the resolution is 320 x 240 and the frame rate is 15 fps, hence, the bitrate is 200: + + * If the frame rate is 5 fps, the bitrate is 100. + * If the frame rate is 30 fps, the bitrate is 300. + * If the bitrate you set is beyond the proper range, the SDK will automatically adjust it to a value within the range. + */ +- (int)setVideoResolution:(CGSize)size andFrameRate:(NSInteger)frameRate bitrate:(NSInteger)bitrate NS_SWIFT_NAME(setVideoResolution(_:andFrameRate:bitrate:)) __deprecated_msg("use setVideoEncoderConfiguration: instead."); + +/** + * Sets the audio parameters and application scenarios. + * @deprecated This method is deprecated. You can use the + * \ref AgoraRtcEngineKit.setAudioProfile: setAudioProfile + * method instead. + * + * @note + * - Call this method before calling `joinChannelByToken`. + * - In scenarios requiring high-quality audio, we recommend setting `profile` + * as `AgoraAudioProfileMusicHighQuality`(4) and `scenario` as + * `AgoraAudioScenarioGameStreaming`(3). + * @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels. See #AgoraAudioProfile. + * @param scenario Sets the audio application scenarios. See #AgoraAudioScenario. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setAudioProfile:(AgoraAudioProfile)profile scenario:(AgoraAudioScenario)scenario NS_SWIFT_NAME(setAudioProfile(_:scenario:)) __deprecated; + +/** Gets the device type; such as a recording, playback, or video capture device. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @return When called successfully, it returns the device ID of the device. Otherwise, it returns nil. + */ +- (NSString * _Nullable)getDeviceId:(AgoraMediaDeviceType)type NS_SWIFT_NAME(getDeviceId(_:)) __deprecated_msg("use getDeviceInfo: instead."); + +/** + * Sets the external audio source. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @deprecated This method is deprecated. Use createCustomAudioTrack:(AgoraAudioTrackType)trackType config:(AgoraAudioTrackConfig* _Nonnull)config instead. + * + * @param enabled Determines whether to enable the external audio source: + * - true: Enable the external audio source. + * - false: (default) Disable the external audio source. + * @param sampleRate The Sample rate (Hz) of the external audio source, which can set be as + * 8000, 16000, 32000, 44100, or 48000. + * @param channels The number of channels of the external audio source, which can be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExternalAudioSource:(BOOL)enabled + sampleRate:(NSInteger)sampleRate + channels:(NSInteger)channels NS_SWIFT_NAME(setExternalAudioSource(_:sampleRate:channels:)) __deprecated_msg("use createCustomAudioTrack:config: instead."); + +- (int)enableEchoCancellationExternal:(BOOL)enabled + audioSourceDelay:(NSInteger)audioSourceDelay NS_SWIFT_NAME(enableEchoCancellationExternal(_:audioSourceDelay:)); + +/** + * Sets the external audio source. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @deprecated This method is deprecated. Use createCustomAudioTrack:(AgoraAudioTrackType)trackType config:(AgoraAudioTrackConfig* _Nonnull)config instead. + * + * @param enabled Determines whether to enable the external audio source: + * - true: Enable the external audio source. + * - false: (default) Disable the external audio source. + * @param sampleRate The Sample rate (Hz) of the external audio source, which can set be as + * 8000, 16000, 32000, 44100, or 48000. + * @param channels The number of channels of the external audio source, which can be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param localPlayback Enable/Disables the local playback of external audio track: + * - true: Enable local playback + * - false: (Default) Do not enable local playback + * @param publish Determines whether to publish the external audio track: + * - true: (Default) Publish the external audio track. + * - false: Don`t publish the external audio track. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExternalAudioSource:(BOOL)enabled + sampleRate:(NSInteger)sampleRate + channels:(NSInteger)channels + localPlayback:(BOOL)localPlayback + publish:(BOOL)publish NS_SWIFT_NAME(setExternalAudioSource(_:sampleRate:channels:localPlayback:publish:)) __deprecated_msg("use createCustomAudioTrack:config: instead."); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +/** Sets the speakerphone volume. + + @note This method applies to macOS only, not to iOS. + + @param volume 0 (lowest volume) to 255 (highest volume). + + @return * 0: Success. +* <0: Failure. + */ +- (int)setSpeakerphoneVolume:(NSUInteger)volume NS_SWIFT_NAME(setSpeakerphoneVolume(_:)) __deprecated_msg("use setDeviceVolume:volume: instead."); + +- (int)startScreenCapture:(NSUInteger)windowId + withCaptureFreq:(NSInteger)captureFreq + bitRate:(NSInteger)bitRate + andRect:(CGRect)rect NS_SWIFT_NAME(startScreenCapture(_:withCaptureFreq:bitRate:andRect:)) __deprecated_msg("use startScreenCaptureByWindowId:regionRect:captureParams: instead."); +#endif + +/** Returns the Media Engine version. + @deprecated From v2.3 + + @return string, Media engine version + */ ++ (NSString * _Nonnull)getMediaEngineVersion __deprecated NS_SWIFT_NAME(getMediaEngineVersion()); + +/** set advanced audio options. use this method before join channel / enableAudio / enableLocalAudio. + @param options The AgoraAdvancedAudioOptions class, See the definition of AgoraAdvancedAudioOptions for details. + + @return + - 0: Success + - < 0: Failure + */ +- (int)setAdvancedAudioOptions:(AgoraAdvancedAudioOptions * _Nonnull)options NS_SWIFT_NAME(setAdvancedAudioOptions(_:)); + +- (BOOL)isSecure NS_SWIFT_NAME(isSecure()); + + +/** Agora supports reporting and analyzing customized messages. + * + * This function is in the beta stage with a free trial. The ability provided + * in its beta test version is reporting a maximum of 10 message pieces within + * 6 seconds, with each message piece not exceeding 256 bytes. + * + * To try out this function, contact [support@agora.io](mailto:support@agora.io) + * and discuss the format of customized messages with us. + */ +- (int)sendCustomReportMessage:(NSString * _Nullable)messageId + category:(NSString * _Nullable)category + event:(NSString * _Nullable)event + label:(NSString * _Nullable)label + value:(NSInteger)value NS_SWIFT_NAME(sendCustomReportMessage(_:category:event:label:value:)); +/** + * Sets the output log level of the SDK. + * + * You can set the SDK to ouput the log files of the specified level. + * + * @param level The log level: + - `AgoraLogFilterOff (0)`: Do not output any log file. + - `AgoraLogFilterInfo (0x000f)`: (Recommended) Output log files of the Info level. + - `AgoraLogFilterWarning (0x000e)`: Output log files of the Warning level. + - `AgoraLogFilterError (0x000c)`: Output log files of the Error level. + - `AgoraLogFilterCritical (0x0008)`: Output log files of the Critical level. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLogLevel:(AgoraLogLevel)level NS_SWIFT_NAME(setLogLevel(_:)); + +/** Sets the built-in encryption mode. + @deprecated + + The Agora Native SDK supports built-in encryption. Call this API to set the encryption mode. + All users in the same channel must use the same encryption mode and password. Refer to information related to the encryption algorithm on the differences between encryption modes. + Call [setEncryptionSecret](setEncryptionSecret:) to enable the built-in encryption function before calling this API. + + @note Do not use this function together with CDN. + + @param encryptionMode Sets the encryption mode. + - "sm4-128-ecb": 128-bit SM4 encryption, ECB mode. + + @return * 0: Success. +* <0: Failure. + */ +- (int)setEncryptionMode:(NSString * _Nullable)encryptionMode NS_SWIFT_NAME(setEncryptionMode(_:)) __deprecated_msg("use enableEncryption: instead."); + +/** Enables built-in encryption. + @deprecated + + Use this method to specify an encryption password to enable built-in encryption before joining a channel. + All users in a channel must set the same encryption password. + The encryption password is automatically cleared once a user has left the channel. + If the encryption password is not specified or set to empty, the encryption function will be disabled. + + @note Do not use this function together with CDN. + + @param secret Encryption password + @return * 0: Success. +* <0: Failure. + */ +- (int)setEncryptionSecret:(NSString * _Nullable)secret NS_SWIFT_NAME(setEncryptionSecret(_:)) __deprecated_msg("use enableEncryption: instead."); + +/** Set local access point configuration for local proxy service. + Use this method before join channel. + @param config The configuration for local access point. + @return * 0: Success. + * < 0: Failure. + */ + +- (int)setLocalAccessPoint:(AgoraLocalAccessPointConfiguration* _Nonnull)config NS_SWIFT_NAME(setLocalAccessPoint(withConfig:)); + +/** Sets the Agora cloud proxy service. + + @since v3.3.0 + + When the user's firewall restricts the IP address and port, refer to + *Use Cloud Proxy* to add the specific IP addresses and ports to the firewall + allowlist; then, call this method to enable the cloud proxy and set the cloud + proxy type with the `proxyType` parameter as `AgoraUdpProxy(1)`, which is the + cloud proxy for the UDP protocol. + + After a successfully cloud proxy connection, the SDK triggers the + [connectionChangedToState(AgoraConnectionStateConnecting, AgoraConnectionChangedSettingProxyServer)]([AgoraRtcEngineDelegate rtcEngine:connectionChangedToState:reason:]) + callback. + + To disable the cloud proxy that has been set, call `setCloudProxy(AgoraNoneProxy)`. + To change the cloud proxy type that has been set, call `setCloudProxy(AgoraNoneProxy)` + first, and then call `setCloudProxy`, and pass the value that you expect in + `proxyType`. + + **Note** + + - Agora recommends that you call this method before joining the channel or + after leaving the channel. + - For the SDK v3.3.x, the services for pushing streams to CDN and co-hosting + across channels are not available when you use the cloud proxy for the UDP + protocol. For the SDK v3.4.0 and later, the services for pushing streams to + CDN and co-hosting across channels are not available when the user is in a + network environment with a firewall and uses the cloud proxy for the UDP protocol. + + @param proxyType The cloud proxy type, see AgoraCloudProxyType. This + parameter is required, and the SDK reports an error if you do not pass in a value. + + @return - 0: Success. +- < 0: Failure. + + - `-2(AgoraErrorCodeInvalidArgument)`: The parameter is invalid. + - `-7(AgoraErrorCodeNotInitialized)`: The SDK is not initialized. + */ +- (int)setCloudProxy:(AgoraCloudProxyType)proxyType NS_SWIFT_NAME(setCloudProxy(_:)); + +- (NSInteger)takeSnapshot:(NSInteger)uid filePath:(NSString* _Nonnull)filePath NS_SWIFT_NAME(takeSnapshot(_:filePath:)); + +- (int)enableContentInspect:(BOOL)enabled config:(AgoraContentInspectConfig* _Nonnull)config NS_SWIFT_NAME(enableContentInspect(_:config:)); + +/** Bind local user and a remote user as an audio&video sync group. The remote user is defined by cid and uid. + There’s a usage limit that local user must be a video stream sender. On the receiver side, media streams from same sync group will be time-synced + + @param channelId The channel id + @param uid The user ID of the remote user to be bound with (local user) + + @return + - 0: Success. + - < 0: Failure. + */ +- (int)setAVSyncSource:(NSString* _Nonnull)channelId uid:(NSUInteger)uid NS_SWIFT_NAME(setAVSyncSource(_:uid:)); + +/** + @technical preview + */ +- (int)sendAudioMetadata:(NSData * _Nonnull)metadata NS_SWIFT_NAME(sendAudioMetadata(_:)); + +/** + Enable or disable video image source to replace the current video source published or resume it + + @param enable true for enable, false for disable + @param options options for image track + */ +- (int)enableVideoImageSource:(BOOL)enable + options:(AgoraImageTrackOptions *_Nullable)options NS_SWIFT_NAME(enableVideoImageSource(_:options:)); +/** get network Type + +@return +- 0: DISCONNECTED. +- 1: LAN. +- 2: WIFI. +- 3: MOBILE_2G +- 4: MOBILE_3G +- 5: MOBILE_4G +- 6: MOBILE_5G +- -1: UNKNOWN +*/ +- (int)getNetworkType NS_SWIFT_NAME(getNetworkType()); + +/** + * Adds multiple SDK delegate. + * + * @param delegate The AgoraRtcEngineDelegate object. + */ +- (void)addDelegate:(id _Nonnull)delegate NS_SWIFT_NAME(addDelegate(_:)); + +/** + * Removes multiple SDK delegate. + * + * @param delegate The AgoraRtcEngineDelegate object. + */ +- (void)removeDelegate:(id _Nonnull)delegate NS_SWIFT_NAME(removeDelegate(_:)); + +@end + +@class AgoraMediaRecorder; +@protocol AgoraMediaRecorderDelegate +#pragma mark Media Recorder Delegate Methods +/**----------------------------------------------------------------------------- + * @name Media Recorder Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** + Occurs when media recorder state is changed. + + @param recorder AgoraMediaRecorder object. + @param state Recorder state. See AgoraMediaRecorderState. + @param error Error code. See AgoraMediaRecorderError. + */ +- (void)mediaRecorder:(AgoraMediaRecorder* _Nonnull)recorder stateDidChanged:(AgoraMediaRecorderState)state error:(AgoraMediaRecorderErrorCode)error NS_SWIFT_NAME(mediaRecorder(_:stateDidChanged:error:)); + +/** + Occurs when media recorder information is updated. + + @param recorder AgoraMediaRecorder object. + @param info Recorder information. See AgoraMediaRecorderInfo. + */ +- (void)mediaRecorder:(AgoraMediaRecorder* _Nonnull)recorder informationDidUpdated:(AgoraMediaRecorderInfo* _Nonnull)info NS_SWIFT_NAME(mediaRecorder(_:informationDidUpdated:)); + +@end + +__attribute__((visibility("default"))) @interface AgoraMediaRecorder : NSObject + +/** + Initializes the AgoraMediaRecorder object. + + @param engine AgoraRtcEngineKit object. + @param delegate AgoraMediaRecorderDelegate. + @return An object of AgoraMediaRecorder class. + */ ++ (instancetype _Nonnull)sharedMediaRecorderWithRtcEngine:(AgoraRtcEngineKit* _Nonnull)engine NS_SWIFT_NAME(sharedMediaRecorder(withRtcEngine:)); + +- (int)setMediaRecorderDelegate:(AgoraRtcConnection * _Nonnull)connection + delegate:(id _Nullable)delegate NS_SWIFT_NAME(setMediaRecorderDelegate(_:delegate:)); +/** + Destroys the RtcEngine instance and releases all resources used by the SDK. + */ ++ (void)destroy NS_SWIFT_NAME(destroy()); + +/** Enables/Disables dispatching delegate methods to the main queue. + + If disabled, the app should dispatch UI operations to the main queue. + @param enabled Sets whether or not to dispatch delegate methods to the main queue: + * YES: Dispatch delegate methods to the main queue. + * NO: Do not dispatch delegate methods to the main queue + @return * 0: Success. + * < 0: Failure. + */ +- (int)enableMainQueueDispatch:(BOOL)enabled NS_SWIFT_NAME(enableMainQueueDispatch(_:)); + +/** + Start recording. + @param config AgoraMediaRecorderConfiguration object. + @return 0: Success. + * < 0: Failure. + */ +- (int)startRecording:(AgoraRtcConnection * _Nonnull)connection + config:(AgoraMediaRecorderConfiguration* _Nonnull)config NS_SWIFT_NAME(startRecording(_:config:)); + + +/** + Stop recording. + @return 0: Success. + * < 0: Failure. + */ +- (int)stopRecording:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(stopRecording(_:)); + +@end + + diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineKitEx.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineKitEx.h new file mode 100644 index 0000000..1162d88 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcEngineKitEx.h @@ -0,0 +1,940 @@ +// +// AgoraRtcEngineKitEx.h +// AgoraRtcEngineKit +// +// Copyright (c) 2020 Agora. All rights reserved. +// Created by LLF on 2020/3/9. +// + +#import "AgoraRtcEngineKit.h" +#import "AgoraObjects.h" + +#if TARGET_OS_IPHONE +#import +#elif TARGET_OS_MAC +#import +#endif + +NS_ASSUME_NONNULL_BEGIN +@interface AgoraRtcEngineKit(Ex) + +/** + * Joins a channel. + * + * You can call this method multiple times to join multiple channels. + * + * @param token The token for authentication. + * - In situations not requiring high security: You can use the temporary token + * generated at Console. For details, see [Get a temporary token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-temporary-token). + * - In situations requiring high security: Set it as the token generated at + * you server. For details, see [Generate a token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-token). + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @param delegate AgoraRtcEngineDelegate protocol.(Need a new object when called) + * @param mediaOptions AgoraRtcChannelMediaOptions Object. + * @param joinSuccessBlock Same as \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. We recommend you set this parameter as `nil` to use `didJoinChannel`. + * - If `joinSuccessBlock` is nil, the SDK triggers the `didJoinChannel` callback. + * - If you implement both `joinSuccessBlock` and `didJoinChannel`, `joinSuccessBlock` takes higher priority than `didJoinChannel`. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)joinChannelExByToken:(NSString* _Nullable)token + connection:(AgoraRtcConnection * _Nonnull)connection + delegate:(id _Nullable)delegate + mediaOptions:(AgoraRtcChannelMediaOptions* _Nonnull)mediaOptions + joinSuccess:(void(^ _Nullable)(NSString* _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannelEx(byToken:connection:delegate:mediaOptions:joinSuccess:)); + +/** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param delegate AgoraRtcEngineDelegate protocol. + * @param mediaOptions The channel media options: \ref agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions" + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (-2) + * - #ERR_NOT_READY (-3) + * - #ERR_REFUSED (-5) + */ +- (int)joinChannelExByToken:(NSString* _Nullable)token + channelId:(NSString* _Nonnull)channelId + userAccount:(NSString* _Nonnull)userAccount + delegate:(id _Nullable)delegate + mediaOptions:(AgoraRtcChannelMediaOptions* _Nonnull)mediaOptions + joinSuccess:(void(^ _Nullable)(NSString* _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannelEx(byToken:channelId:userAccount:delegate:mediaOptions:joinSuccess:)); + +/** + * Updates the channel media options after joining the channel. + * + * @param mediaOptions The channel media options: ChannelMediaOptions. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateChannelExWithMediaOptions:(AgoraRtcChannelMediaOptions* _Nonnull)mediaOptions + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateChannelEx(with:connection:)); + +/** + * Leaves the channel by connection. + * + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @param leaveChannelBlock This callback indicates that a user leaves a channel, and provides the statistics of the call in #AgoraChannelStats. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)leaveChannelEx:(AgoraRtcConnection * _Nonnull)connection + leaveChannelBlock:(void(^ _Nullable)(AgoraChannelStats* _Nonnull stat))leaveChannelBlock NS_SWIFT_NAME(leaveChannelEx(_:leaveChannelBlock:)); + +/** + * Resets the SDK delegate. + * + * The SDK uses the delegate to inform the app on engine runtime events. All methods defined in the + * delegate are optional implementation methods. + * + * @param delegate The AgoraRtcEngineDelegate protocol. + * @param connection The AgoraRtcConnection object. + */ +- (int)setDelegateEx:(id _Nullable)delegate connection:(AgoraRtcConnection * _Nonnull)connection; + +/** + *Stops or resumes sending the local audio stream with connection. + * + *@param mute Determines whether to send or stop sending the local audio stream: + *- `YES`: Stop sending the local audio stream. + *- `NO`: Send the local audio stream. + * + *@param connection \ref AgoraRtcConnection by channelId and uid combine + * + *@return + *- 0: Success. + *- < 0: Failure. + */ +- (int)muteLocalAudioStreamEx:(BOOL)mute connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteLocalAudioStreamEx(_:connection:)); +/** + *Stops or resumes sending the local video stream with connection. + * + *@param mute Determines whether to send or stop sending the local video stream: + *- `YES`: Stop sending the local video stream. + *- `NO`: Send the local video stream. + * + *@param connection \ref AgoraRtcConnection by channelId and uid combine + * + *@return + *- 0: Success. + *- < 0: Failure. + */ +- (int)muteLocalVideoStreamEx:(BOOL)mute connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteLocalVideoStreamEx(_:connection:)); + +/** + * Leaves the channel by connection. + * + * @param connection {@link AgoraRtcConnection} by channelId and uid combine + * @param options The options for leaving the channel. See {@link LeaveChannelOptions}. + * @param leaveChannelBlock This callback indicates that a user leaves a channel, and provides the statistics of the call in #AgoraChannelStats. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)leaveChannelEx:(AgoraRtcConnection * _Nonnull)connection + options:(AgoraLeaveChannelOptions * _Nonnull)options + leaveChannelBlock:(void(^ _Nullable)(AgoraChannelStats* _Nonnull stat))leaveChannelBlock; + +/** Mutes a specified remote user's audio stream. + + @note When setting to YES, this method stops playing audio streams without affecting the audio stream receiving process. + + @param uid User ID whose audio streams the user intends to mute. + @param mute * YES: Stops playing a specified user’s audio streams. + * NO: Resumes playing a specified user’s audio streams. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. +* <0: Failure. + */ +- (int)muteRemoteAudioStreamEx:(NSUInteger)uid + mute:(BOOL)mute + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteRemoteAudioStreamEx(_:mute:connection:)); + +/** + *Stops or resumes receiving all remote audio stream with connection. + * + *@param mute Whether to stop receiving remote audio streams: + *- `YES`: Stop receiving any remote audio stream. + *- `NO`: Resume receiving all remote audio streams. + * + *@param connection \ref AgoraRtcConnection by channelId and uid combine + * + *@return + *- 0: Success. + *- < 0: Failure. + */ +- (int)muteAllRemoteAudioStreamsEx:(BOOL)mute + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteAllRemoteAudioStreamsEx(_:connection:)); + +/** + * Sets the video encoder configuration. + * + * Each configuration profile corresponds to a set of video parameters, + * including the resolution, frame rate, and bitrate. + * + * The parameters specified in this method are the maximum values under ideal network conditions. + * If the video engine cannot render the video using the specified parameters + * due to poor network conditions, the parameters further down the list are + * considered until a successful configuration is found. + * + * @param config The local video encoder configuration, see #AgoraVideoEncoderConfiguration. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVideoEncoderConfigurationEx:(AgoraVideoEncoderConfiguration* _Nonnull)config + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setVideoEncoderConfigurationEx(_:connection:)); + +/** Binds the remote user to the video display window, that is, sets the view for the user of the specified uid. +* +* Usually, the application should specify the uid of the remote video in the method call before the user enters a channel. If the remote uid is unknown to the application, you can set the uid after receiving the \ref AgoraRtcEngineDelegate.rtcEngine:didJoinedOfUid:elapsed: didJoinedOfUid event. +* +* @param remote \ref AgoraRtcVideoCanvas +* @param connection \ref AgoraRtcConnection by channelId and uid combine +* @return +* - 0: Success. +* - <0: Failure. + */ +- (int)setupRemoteVideoEx:(AgoraRtcVideoCanvas* _Nonnull)remote + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setupRemoteVideoEx(_:connection:)); + +/** Configures the remote video display mode. The application can call this method multiple times to change the display mode. +* +* @param uid User id of the user whose video streams are received. +* @param mode AgoraVideoRenderMode +* @param mirror AgoraVideoMirrorMode +* @param connection \ref AgoraRtcConnection by channelId and uid combine +* +* @return +* - 0: Success. +* - <0: Failure. +*/ +- (int)setRemoteRenderModeEx:(NSUInteger)uid + mode:(AgoraVideoRenderMode)mode + mirror:(AgoraVideoMirrorMode)mirror + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setRemoteRenderModeEx(_:mode:mirror:connection:)); + +/** + * Stops or resumes receiving the video stream of a specified user. + * + * @note + * Once you leave the channel, the settings in this method becomes invalid. + * + * @param uid ID of the specified remote user. + * @param mute Determines whether to receive or stop receiving a specified video stream: + * - `YES`: Stop receiving the specified video stream. + * - `NO`: (Default) Receive the specified video stream. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteRemoteVideoStreamEx:(NSUInteger)uid + mute:(BOOL)mute + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteRemoteVideoStreamEx(_:mute:connection:)); + +/** + *Stops or resumes receiving all remote video stream with connection. + * + *@param mute Whether to stop receiving remote video streams: + *- `YES`: Stop receiving any remote video stream. + *- `NO`: Resume receiving all remote video streams. + * + *@param connection \ref AgoraRtcConnection by channelId and uid combine + * + *@return + *- 0: Success. + *- < 0: Failure. + */ +- (int)muteAllRemoteVideoStreamsEx:(BOOL)mute + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteAllRemoteVideoStreamsEx(_:connection:)); + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video + * stream) video using \ref setRemoteVideoStreamType setRemoteVideoStreamType. + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @param streamConfig The minor stream config + * @param connection An output parameter which is used to control different connection instances. + */ +- (int)enableDualStreamModeEx:(BOOL)enabled + streamConfig:(AgoraSimulcastStreamConfig*)streamConfig + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(enableDualStreamModeEx(_:streamConfig:connection:)); + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video + * stream) video using \ref setRemoteVideoStreamType setRemoteVideoStreamType. + * + * @param mode The dual-stream mode. + * @param streamConfig The minor stream config + * @param connection An output parameter which is used to control different connection instances. + */ +- (int)setDualStreamModeEx:(AgoraSimulcastStreamMode)mode + streamConfig:(AgoraSimulcastStreamConfig*)streamConfig + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(setDualStreamModeEx(_:streamConfig:connection:)); + + +/** + * Sets the remote video stream type. + * + * If the remote user has enabled the dual-stream mode, by default the SDK + * receives the high-stream video. Call this method to switch to the low-stream + * video. + * + * @note + * This method applies to scenarios where the remote user has enabled the + * dual-stream mode by \ref enableDualStreamMode: enableDualStreamMode + * before joining the channel. + * + * @param uid ID of the remote user sending the video stream. + * @param streamType The video stream type: #AgoraVideoStreamType. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteVideoStreamEx:(NSUInteger)uid + type:(AgoraVideoStreamType)streamType + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setRemoteVideoStreamEx(_:type:connection:)); +/** + * Sets the remote video subscription options + * + * + * @param uid ID of the remote user sending the video stream. + * @param options Sets the video subscription options. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteVideoSubscriptionOptionsEx:(NSUInteger)uid + options:(AgoraVideoSubscriptionOptions* _Nonnull)options + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(setRemoteVideoSubscriptionOptionsEx(_:options:connection:)); + +/** + * Pushes the encoded external video frame to specified connection in Agora SDK. + * + * @note + * Ensure that you have configured encoded video source before calling this method. + * + * @param data The encoded external video data, which must be the direct buffer. + * @param frameInfo The encoded external video frame info: AgoraEncodedVideoFrameInfo. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0: Success, which means that the encoded external video frame is pushed successfully. + * - < 0: Failure, which means that the encoded external video frame fails to be pushed. + */ +- (int)pushExternalEncodedVideoFrameEx:(NSData* _Nonnull)frame + info:(AgoraEncodedVideoFrameInfo * _Nonnull)info + videoTrackId:(NSUInteger)videoTrackId NS_SWIFT_NAME(pushExternalEncodedVideoFrameEx(_:info:videoTrackId:)); + +/** + * Pushes the external video frame. + * + * This method pushes the video frame using the AgoraVideoFrame class and + * passes it to the Agora SDK with the `format` parameter in AgoraVideoFormat. + * + * Call \ref setExternalVideoSource:useTexture:pushMode: setExternalVideoSource + * and set the `pushMode` parameter as `YES` before calling this method. + * @note + * In the Communication profile, this method does not support pushing textured + * video frames. + * @param frame Video frame containing the SDK's encoded video data to be + * pushed: #AgoraVideoFrame. + * @param videoTrackId The id of the video track. + * @return + * - `YES`: Success. + * - `NO`: Failure. + */ +- (BOOL)pushExternalVideoFrame:(AgoraVideoFrame * _Nonnull)frame videoTrackId:(NSUInteger)videoTrackId NS_SWIFT_NAME(pushExternalVideoFrame(_:videoTrackId:)); + +/** Gets the user information by passing in the user account. + + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (`AgoraUserInfo`), and triggers the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback on the local client. + + * After receiving the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback, you can call this method to get the user ID of the remote user from the `userInfo` object by passing in the user account. + + * @param userAccount The user account of the user. Ensure that you set this parameter. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return An [AgoraUserInfo](AgoraUserInfo) object that contains the user account and user ID of the user. + */ +- (AgoraUserInfo* _Nullable)getUserInfoByUserAccountEx:(NSString* _Nonnull)userAccount + connection:(AgoraRtcConnection * _Nonnull)connection + withError:(AgoraErrorCode* _Nullable)error NS_SWIFT_NAME(getUserInfo(byUserAccountEx:connection:withError:)); + +/** Gets the user information by passing in the user ID. + * + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, + * caches them in a mapping table object (`userInfo`), and triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback on the local client. + * + * After receiving the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback, you can call this method to get the user account of the remote user + * from the `userInfo` object by passing in the user ID. + * + * @param uid The user ID of the remote user. Ensure that you set this parameter. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return An [AgoraUserInfo](AgoraUserInfo) object that contains the user account and user ID of the user. + */ +- (AgoraUserInfo* _Nullable)getUserInfoByUidEx:(NSUInteger)uid + connection:(AgoraRtcConnection * _Nonnull)connection + withError:(AgoraErrorCode* _Nullable)error NS_SWIFT_NAME(getUserInfo(byUidEx:connection:withError:)); + +/** + * Gets the connection state of the SDK. + * + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return The connection state. See \ref AgoraConnectionState. + */ +- (AgoraConnectionState)getConnectionStateEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(getConnectionStateEx(_:)); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +/** Enables loopback sampling. (macOS only) + * If you enable loopback sampling, the output of the sound card is mixed into the audio stream sent to the other end. + * You can call this method either before or after joining a channel. + + * *Note:** + * macOS does not support loopback sampling of the default sound card. If you need to use this method, + * please use a virtual sound card and pass its name to the `deviceName` parameter. Agora has tested and recommends using soundflower. + + * @param enabled Sets whether to enable/disable loopback sampling. + * YES: Enable loopback sampling. + * NO: (Default) Disable loopback sampling. + + * @param deviceName Pointer to the device name of the sound card. The default value is nil (default sound card). + * If you use a virtual sound card like "Soundflower", set this parameter as the name of the sound card, "Soundflower", + * and the SDK will find the corresponding sound card and start capturing. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return + * 0: Success. + * < 0: Failure. + */ +- (int)enableLoopbackRecordingEx:(BOOL)enabled + deviceName:(NSString* _Nullable)deviceName + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(enableLoopbackRecordingEx(_:deviceName:connection:)); +#endif + +/** + * Adjusts the recording volume. + * + * @param volume The recording volume, which ranges from 0 to 400: + * - 0 : Mute the recording volume. + * - 100: The original volume. + * - 400: (Maximum) Four times the original volume with signal clipping protection. + * + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0 : Success. + * - < 0: Failure. + */ +- (int)adjustRecordingSignalVolumeEx:(NSInteger)volume + connection:(AgoraRtcConnection* _Nonnull)connection; + +/** + * Mute or resume recording signal volume. + * + * @param mute Determines whether to mute or resume the recording signal volume. + * - YES: Mute the recording signal volume. + * - NO: (Default) Resume the recording signal volume. + * + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0 : Success. + * - < 0: Failure. + */ +- (int)muteRecordingSignalEx:(BOOL)mute + connection:(AgoraRtcConnection* _Nonnull)connection; + +/** Adjust the playback signal volume of a specified remote user. + + You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user. + + **Note** + + - The playback volume here refers to the mixed volume of a specified remote user. + - This method can only adjust the playback volume of one specified remote user at a time. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. + + @param uid The ID of the remote user. + @param volume The playback volume of the specified remote user. The value + ranges between 0 and 400, including the following: + + - 0: Mute. + - 100: (Default) Original volume. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return + - 0: Success. + - < 0: Failure. + */ + +- (int)adjustUserPlaybackSignalVolumeEx:(NSUInteger)uid + volume:(NSInteger)volume + connection:(AgoraRtcConnection* _Nonnull)connection; + +- (int)sendCustomReportMessageEx:(NSString * _Nullable)messageId + category:(NSString * _Nullable)category + event:(NSString * _Nullable)event + label:(NSString * _Nullable)label + value:(NSInteger)value + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(sendCustomReportMessageEx(_:category:event:label:value:connection:)); + +- (int)enableAudioVolumeIndicationEx:(NSInteger)interval + smooth:(NSInteger)smooth + reportVad:(BOOL)reportVad + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(enableAudioVolumeIndicationEx(_:smooth:reportVad:connection:)); + +/** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + +**Note:** + +- Ensure that you call this method after joining a channel. For this method to work, enable stereo panning for remote users by calling [enableSoundPositionIndication]([AgoraRtcEngineKit enableSoundPositionIndication:]) before joining a channel. +This method requires hardware support. +- For the best effect, we recommend using the following audio output devices: + - (iOS) A stereo headset. + - (macOS) A stereo loudspeaker. + @param uid The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + + * 0.0: (default) the remote sound comes from the front. + * -1.0: the remote sound comes from the left. + * 1.0: the remote sound comes from the right. + + @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. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. +* < 0: Failure. + */ +- (int)setRemoteVoicePositionEx:(NSUInteger)uid + pan:(double)pan + gain:(double)gain + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setRemoteVoicePositionEx(_:pan:gain:connection:)); + +/** Sets spatial audio parameters of a remote user. + + When the local user calls this method to set the spatial audio parameters of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of spatial. + +**Note:** + +- For the best effect, we recommend using the following audio output devices: + - (iOS) A stereo headset. + - (macOS) A stereo loudspeaker. + @param uid The ID of the remote user. + @param params The spatial audio parameters of the remote user. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. +* < 0: Failure. + */ +- (int)setRemoteUserSpatialAudioParamsEx:(NSUInteger)uid + params:(AgoraSpatialAudioParams* _Nonnull)params + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(setRemoteUserSpatialAudioParamsEx(_:params:connection:)); + +/** Adds a watermark image to the local video. + + This method adds a PNG watermark image to the local video in the interactive live streaming. Once the watermark image is added, all the audience in the channel (CDN audience included), and the capturing device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one. + + The watermark position depends on the settings in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method: + + - If the orientation mode of the encoding video is AgoraVideoOutputOrientationModeFixedLandscape, or the landscape mode in AgoraVideoOutputOrientationModeAdaptative, the watermark uses the landscape orientation. + - If the orientation mode of the encoding video is AgoraVideoOutputOrientationModeFixedPortrait, or the portrait mode in AgoraVideoOutputOrientationModeAdaptative, the watermark uses the portrait orientation. + - When setting the watermark position, the region must be less than the dimensions set in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method. Otherwise, the watermark image will be cropped. + + **Note** + + - Ensure that you have called the [enableVideo]([AgoraRtcEngineKit enableVideo]) method to enable the video module before calling this method. + - If you only want to add a watermark image to the local video for the audience in the CDN live streaming channel to see and capture, you can call this method or the [setLiveTranscoding]([AgoraRtcEngineKit setLiveTranscoding:]) method. + - This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray. + - If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings. + - If you have enabled the local video preview by calling the [startPreview]([AgoraRtcEngineKit startPreview]) method, you can use the `visibleInPreview` member in the WatermarkOptions class to set whether or not the watermark is visible in preview. + - If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. + + @param url The local file path of the watermark image to be added. This method supports adding a watermark image from the local file path. If the watermark image to be added is in the project file, you need to change the image's Type from PNG image to Data in the Xcode property, otherwise, the Agora Native SDK cannot recognize the image. + @param options The options of the watermark image to be added. See WatermarkOptions. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. + * < 0: Failure. + */ +- (int)addVideoWatermarkEx:(NSURL* _Nonnull)url options:(WatermarkOptions* _Nonnull)options connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(addVideoWatermarkEx(_:options:connection:)); + +/** Clears the watermark image on the video stream. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. + * < 0: Failure. + */ +- (int)clearVideoWatermarkEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(clearVideoWatermarkEx(_:)); + +/**----------------------------------------------------------------------------- + * @name Data Steam + * ----------------------------------------------------------------------------- + */ +/** Creates a data stream. +* +* Each user can create up to five data streams during the lifecycle of the `AgoraRtcEngineKit`. +* +* @note Set both the `reliable` and `ordered` parameters to `YES` or `NO`. Do not set one as `YES` and the other as `NO`. +* +* @param streamId ID of the created data stream. +* @param reliable Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds: +* - YES: The recipients receive the data stream from the sender within five seconds. If the recipient does not receive the data stream within five seconds, an error is reported to the app. +* - NO: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream. +* +* @param ordered Sets whether or not the recipients receive the data stream in the sent order: +* - YES: The recipients receive the data stream in the sent order. +* - NO: The recipients do not receive the data stream in the sent order. +* @param connection \ref AgoraRtcConnection by channelId and uid combine. +* +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (int)createDataStreamEx:(NSInteger * _Nonnull)streamId + reliable:(BOOL)reliable + ordered:(BOOL)ordered + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(createDataStreamEx(_:reliable:ordered:connection:)); +/** Creates a data stream. + + Each user can create up to five data streams during the lifecycle of the [AgoraRtcChannel](AgoraRtcChannel). + + @param streamId ID of the created data stream. + @param config the config of data stream. + @param connection \ref AgoraRtcConnection by channelId and uid combine. + @return * 0: Success. +* < 0: Failure. + */ +- (int)createDataStreamEx:(NSInteger * _Nonnull)streamId + config:(AgoraDataStreamConfig * _Nonnull)config + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(createDataStreamEx(_:config:connection:)); + +/** Sends data stream messages to all users in a channel. + +The SDK has the following restrictions on this method: + +- Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB. +- Each client can send up to 30 KB of data per second. +- Each user can have up to five data streams simultaneously. + +If the remote user receives the data stream within five seconds, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:receiveStreamMessageFromUid:streamId:data: receiveStreamMessageFromUid callback on the remote client, from which the remote user gets the stream message. + +If the remote user does not receive the data stream within five seconds, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached: didOccurStreamMessageErrorFromUid callback on the remote client. + + @note + - This method applies only to the Communication profile or to the hosts in the live interactive streaming profile. If an audience in the live interactive streaming profile calls this method, the audience role may be changed to a host. + - Ensure that you have created the data stream using \ref createDataStream:reliable:ordered: createDataStream before calling this method. + + @param streamId ID of the sent data stream returned in the `createDataStream` method. + @param data Sent data. + @param connection \ref AgoraRtcConnection by channelId and uid combine. + + @return + - 0: Success. + - < 0: Failure. +*/ +- (int)sendStreamMessageEx:(NSInteger)streamId + data:(NSData * _Nonnull)data + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(sendStreamMessageEx(_:data:connection:)); + +/**----------------------------------------------------------------------------- + * @name Stream Publish + * ----------------------------------------------------------------------------- + */ + + /** + * Sets the blocklist of subscribe remote stream audio. + * + * @param blocklist The uid list of users who do not subscribe to audio. + * @param connection \ref AgoraRtcConnection by channelId and uid combine. + * @note + * If uid is in blocklist, the remote user's audio will not be subscribed, + * even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeAudioBlocklistEx:(NSArray *_Nonnull)blocklist connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setSubscribeAudioBlocklistEx(_:connection:)); + +/** + * Sets the allowlist of subscribe remote stream audio. + * + * @param allowlist The uid list of users who do subscribe to audio. + * @param connection \ref AgoraRtcConnection by channelId and uid combine. + * @note + * If uid is in allowlist, the remote user's audio will be subscribed, + * even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to audio. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeAudioAllowlistEx:(NSArray *_Nonnull)allowlist connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setSubscribeAudioAllowlistEx(_:connection:)); + +/** + * Sets the blocklist of subscribe remote stream video. + * + * @param blocklist The uid list of users who do not subscribe to video. + * @param connection \ref AgoraRtcConnection by channelId and uid combine. + * @note + * If uid is in blocklist, the remote user's video will not be subscribed, + * even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeVideoBlocklistEx:(NSArray *_Nonnull)blocklist connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setSubscribeVideoBlocklistEx(_:connection:)); + +/** + * Sets the allowlist of subscribe remote stream video. + * + * @param allowlist The uid list of users who do subscribe to video. + * @param connection \ref AgoraRtcConnection by channelId and uid combine. + * @note + * If uid is in whitelist, the remote user's video will be subscribed, + * even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeVideoAllowlistEx:(NSArray *_Nonnull)allowlist connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setSubscribeVideoAllowlistEx(_:connection:)); + +- (NSInteger)takeSnapshotEx:(AgoraRtcConnection * _Nonnull)connection uid:(NSInteger)uid filePath:(NSString* _Nonnull)filePath NS_SWIFT_NAME(takeSnapshotEx(_:uid:filePath:)); + +/** + * @technical preview + */ +- (int)sendAudioMetadataEx:(AgoraRtcConnection * _Nonnull)connection metadata:(NSData * _Nonnull)metadata NS_SWIFT_NAME(sendAudioMetadataEx(_:metadata:)); + +- (int)enableContentInspectEx:(BOOL)enabled config:(AgoraContentInspectConfig* _Nonnull)config connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(enableContentInspectEx(_:config:connection:)); + +/** Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.) + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startRtmpStreamWithoutTranscodingEx:(NSString* _Nonnull)url + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(startRtmpStreamWithoutTranscodingEx(_:connection:)); + +/** Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.) + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + * @param connection AgoraRtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startRtmpStreamWithTranscodingEx:(NSString* _Nonnull)url + transcoding:(AgoraLiveTranscoding* _Nullable)transcoding + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(startRtmpStreamWithTranscodingEx(_:transcoding:connection:)); + +/** Update the video layout and audio settings for CDN live. (CDN live only.) + * @note This method applies to Live Broadcast only. + * + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + * @param connection AgoraRtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateRtmpTranscodingEx:(AgoraLiveTranscoding* _Nullable)transcoding + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateRtmpTranscodingEx(_:connection:)); + +/** Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.) + * @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopRtmpStreamEx:(NSString* _Nonnull)url + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(stopRtmpStreamEx(_:connection:)); + +/** Starts to relay media streams across channels. + * + * @param configuration The configuration of the media stream relay:AgoraChannelMediaRelayConfiguration. + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startChannelMediaRelayEx:(AgoraChannelMediaRelayConfiguration * _Nonnull)config connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(startChannelMediaRelayEx(_:connection:)); + +/** Updates the channels for media stream relay + * @param configuration The media stream relay configuration: AgoraChannelMediaRelayConfiguration. + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateChannelMediaRelayEx:(AgoraChannelMediaRelayConfiguration * _Nonnull)config connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateChannelMediaRelayEx(_:connection:)); + +/** Stops the media stream relay. + * + * Once the relay stops, the host quits all the destination + * channels. + * + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopChannelMediaRelayEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(stopChannelMediaRelayEx(_:)); + +/** pause the channels for media stream relay. + * + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)pauseAllChannelMediaRelayEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(pauseAllChannelMediaRelayEx(_:)); + +/** resume the channels for media stream relay. + * + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)resumeAllChannelMediaRelayEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(resumeAllChannelMediaRelayEx(_:)); + +/** + @brief Start tracing media rendering events. + @since v4.1.1 + @discussion + - SDK will trace media rendering events when this API is called. + - The tracing result can be obtained through callback `[AgoraRtcEngineDelegate rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:]` + @param connection AgoraRtcConnection. + @note + - By default, SDK will trace media rendering events when join channel. + - The start point of event tracing will be reset after leaving channel. + @return + - 0: Success. + - < 0: Failure. + - `-2(AgoraErrorCodeInvalidArgument)`: The parameter is invalid. Check the channel ID and local uid set by parameter `connection`. + - `-7(AgoraErrorCodeNotInitialized)`: The SDK is not initialized. + */ +- (int)startMediaRenderingTracingEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(startMediaRenderingTracingEx(_:)); + +/** + * Adds multiple SDK delegate. + * + * @param delegate The AgoraRtcEngineDelegate object. + * @param connection The AgoraRtcConnection object. + */ +- (void)addDelegateEx:(id _Nonnull)delegate connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(addDelegateEx(_:connection:)); + +/**----------------------------------------------------------------------------- + * @name Built-in Encryption + * ----------------------------------------------------------------------------- + */ + +/** Enables/Disables the built-in encryption. + + In scenarios requiring high security, Agora recommends calling enableEncryption to enable the built-in encryption before joining a channel. + + All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + + **Note** + + - If you enable the built-in encryption, you cannot use the RTMP streaming function. + + @param enabled Whether to enable the built-in encryption: + + - YES: Enable the built-in encryption. + - NO: Disable the built-in encryption. + + @param config Configurations of built-in encryption schemas. See AgoraEncryptionConfig. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return - 0: Success. + - < 0: Failure. + + - -2 (`AgoraErrorCodeInvalidArgument`): An invalid parameter is used. Set the parameter with a valid value. + - -7 (`AgoraErrorCodeNotInitialized`): The SDK is not initialized. Initialize the `AgoraRtcEngineKit` instance before calling this method. + - -4 (`AgoraErrorCodeNotSupported`): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. + */ +- (int)enableEncryptionEx:(bool)enabled encryptionConfig:(AgoraEncryptionConfig *_Nonnull)config connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(enableEncryptionEx(_:encryptionConfig:connection:)); + +/** + * Removes multiple SDK delegate. + * + * @param delegate The AgoraRtcEngineDelegate object. + * @param connection The AgoraRtcConnection object. + */ +- (void)removeDelegateEx:(id _Nonnull)delegate connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(removeDelegateEx(_:connection:)); + +/** + * Gets the current call ID. + * + * When a user joins a channel, a call ID is generated to identify the call. + * + * After a call ends, you can call `rate` or `complain` to gather feedback from + * your customer. + * + * @param connection The AgoraRtcConnection object. + * @return The call ID if the method call is successful. + */ +- (NSString * _Nullable)getCallIdEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(getCallIdEx(_:)); + +@end +NS_ASSUME_NONNULL_END diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcKit.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcKit.h new file mode 100644 index 0000000..d3a39ac --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcKit.h @@ -0,0 +1,19 @@ +// +// AgoraRtcKit.h +// AgoraRtcKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcMediaPlayerProtocol.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcMediaPlayerProtocol.h new file mode 100644 index 0000000..ddbd598 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraRtcMediaPlayerProtocol.h @@ -0,0 +1,551 @@ +// +// AgoraRtcMediaPlayerProtocol.h +// AgoraRtcMediaPlayerProtocol +// +// Copyright (c) 2020 Agora. All rights reserved. +// + +#import +#import "AgoraObjects.h" +#import "AgoraRtcAudioSpectrumDelegate.h" +#if TARGET_OS_IPHONE +#import +typedef UIView View; +#elif TARGET_OS_MAC +#import +typedef NSView View; +#endif + +@protocol AgoraRtcMediaPlayerAudioFrameDelegate; +@protocol AgoraRtcMediaPlayerVideoFrameDelegate; + +NS_ASSUME_NONNULL_BEGIN +@protocol AgoraRtcMediaPlayerProtocol + +/** + * Get unique media player id of the media player entity. + * @return + * - >= 0: The mediaPlayerId of this media player entity. + * - < 0: Failure. + */ +- (int)getMediaPlayerId NS_SWIFT_NAME(getMediaPlayerId()); +/** + * Opens a media file with a specified URL. + * @param url The URL of the media file that you want to play. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)open:(NSString *)url startPos:(NSInteger)startPos NS_SWIFT_NAME(open(_:startPos:)); + + +/** + * Opens a media file with MediaSource + * @param source see `AgoraMediaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)openWithMediaSource:(AgoraMediaSource *)source NS_SWIFT_NAME(open(with:)); + +/** + * Open the Agora CDN media source. + * @param src The src of the media file that you want to play. + * @param startPos The playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)openWithAgoraCDNSrc:(NSString *)src startPos:(NSInteger)startPos NS_SWIFT_NAME(open(withAgoraCDNSrc:startPos:)); + +/** + * Gets the number of Agora CDN lines. + * @return + * - > 0: number of CDN. + * - <= 0: Failure. + */ +- (int)getAgoraCDNLineCount NS_SWIFT_NAME(getAgoraCDNLineCount()); + +/** + * Switch Agora CDN lines. + * @param index Specific line. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)switchAgoraCDNLineByIndex:(int)index NS_SWIFT_NAME(switchAgoraCDNLine(by:)); + +/** + * Gets the line of the current CDN. + * @return + * - >= 0: Specific line. + * - < 0: Failure. + */ +- (int)getCurrentAgoraCDNIndex NS_SWIFT_NAME(getCurrentAgoraCDNIndex()); + +/** + * Enable automatic CDN line switching. + * @param enable Whether enable. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAutoSwitchAgoraCDN:(BOOL)enable NS_SWIFT_NAME(enableAutoSwitchAgoraCDN(_:)); + +/** + * Update the CDN source token and timestamp. + * @param token token. + * @param ts ts. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)renewAgoraCDNSrcToken:(NSString *)token ts:(NSInteger)ts NS_SWIFT_NAME(renewAgoraCDNSrcToken(_:ts:)); + +/** + * Switch the CDN source. + * @param src Specific line. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)switchAgoraCDNSrc:(NSString *)src syncPts:(BOOL)syncPts NS_SWIFT_NAME(switchAgoraCDNSrc(_:syncPts:)); + +/** + * Plays the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)play NS_SWIFT_NAME(play()); + +/** + * Pauses playing the media file. + */ +- (int)pause NS_SWIFT_NAME(pause()); + +/** + * Stops playing the current media file. + */ +- (int)stop NS_SWIFT_NAME(stop()); + +/** + * Resumes playing the media file. + */ +- (int)resume NS_SWIFT_NAME(resume()); + +/** + * Sets the current playback position of the media file. + * @param position The new playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)seekToPosition:(NSInteger)position NS_SWIFT_NAME(seek(toPosition:)); + +/** + * Sets the pitch of the current media file. + * @param pitch Sets the pitch of the local music file by chromatic scale. The default value is 0, + * which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value + * between consecutive values is a chromatic value. The greater the absolute value of this + * parameter, the higher or lower the pitch of the local music file. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setAudioPitch:(NSInteger)pitch NS_SWIFT_NAME(setAudioPitch(_:)); + +/** + * Gets the duration of the media file. + */ +- (NSInteger)getDuration NS_SWIFT_NAME(getDuration()); +/** + * Gets the current playback position of the media file.(ms). + */ +- (NSInteger)getPosition NS_SWIFT_NAME(getPosition()); +/** + * Gets the number of the media streams in the media resource. + */ +- (NSInteger)getStreamCount NS_SWIFT_NAME(getStreamCount()); + +/** Gets the detailed information of the media stream. + + @param index The index of the media stream. + + @return * If the call succeeds, returns the detailed information of the media + stream. See AgoraMediaStreamInfo. + * If the call fails and returns nil. + */ +- (AgoraRtcMediaStreamInfo *_Nullable)getStreamByIndex:(int)index NS_SWIFT_NAME(getStreamBy(_:)); + +/** + * Sets whether to loop the media file for playback. + * @param loopCount the number of times looping the media file. + * - 0: Play the audio effect once. + * - 1: Play the audio effect twice. + * - -1: Play the audio effect in a loop indefinitely, until stopEffect() or stop() is called. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLoopCount:(int)loopCount NS_SWIFT_NAME(setLoopCount(_:)); + +/** + * Change playback speed + * @param speed the enum of playback speed + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setPlaybackSpeed:(int)speed NS_SWIFT_NAME(setPlaybackSpeed(_:)); + +/** + * Select playback audio track of the media file + * @param index the index of the audio track in media file + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)selectAudioTrack:(int)index NS_SWIFT_NAME(selectAudioTrack(_:)); + +/** + * Selects multi audio track of the media file for playback or publish to channel. + * @param playoutTrackIndex The index of the audio track in media file for local playback. + * @param publishTrackIndex The index of the audio track in the media file published to the remote. + * + * @note + * You can obtain the streamIndex of the audio track by calling getStreamInfo.. + * If you want to use selectMultiAudioTrack, you need to open the media file with openWithMediaSource and set enableMultiAudioTrack to true. + * + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - -2: Invalid argument. Argument must be greater than or equal to zero. + * - -8: Invalid State.You must open the media file with openWithMediaSource and set enableMultiAudioTrack to true + */ +- (int)selectMultiAudioTrack:(NSInteger)playoutTrackIndex publishTrackIndex:(NSInteger)publishTrackIndex NS_SWIFT_NAME(selectMultiAudioTrack(_:publishTrackIndex:)); + +/** + * take screenshot while playing video + * @param filename the filename of screenshot file + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)takeScreenshot:(NSString *)filename NS_SWIFT_NAME(takeScreenshot(_:)); + +/** + * select internal subtitles in video + * @param index the index of the internal subtitles + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)selectInternalSubtitle:(int)index NS_SWIFT_NAME(selectInternalSubtitle(_:)); + +/** + * set an external subtitle for video + * @param url The URL of the subtitle file that you want to load. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExternalSubtitle:(NSString *)url NS_SWIFT_NAME(setExternalSubtitle(_:)); + +/** Gets current playback state. + + @return * The call succeeds and returns current playback state. See + AgoraMediaPlayerState. + * The call fails and returns nil. + */ +- (AgoraMediaPlayerState)getPlayerState NS_SWIFT_NAME(getPlayerState()); + +/** + * @brief Turn mute on or off + * + * @param isMute Whether the media source is mute. + * YES: Yes. + * NO: No. + * @return mute Whether to mute on + */ +- (int)mute:(bool)isMute NS_SWIFT_NAME(mute(_:)); + +/** + * @brief Get mute state + * + * @return mute Whether is mute on + */ +- (BOOL)getMute NS_SWIFT_NAME(getMute()); + +/** + * @brief Adjust playback volume + * + * @param volume The volume value to be adjusted + * The volume can be adjusted from 0 to 400: + * 0: mute; + * 100: original volume; + * 400: Up to 4 times the original volume (with built-in overflow protection). + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ +- (int)adjustPlayoutVolume:(int)volume NS_SWIFT_NAME(adjustPlayoutVolume(_:)); + +/** + * @brief Get the current playback volume + * + * @return volume + */ +- (int)getPlayoutVolume NS_SWIFT_NAME(getPlayoutVolume()); + +/** + * @brief adjust publish signal volume + */ +- (int)adjustPublishSignalVolume:(int)volume NS_SWIFT_NAME(adjustPublishSignalVolume(_:)); + +/** + * @brief get publish signal volume + */ +- (int)getPublishSignalVolume NS_SWIFT_NAME(getPublishSignalVolume()); + +/** + * @brief Modify player option before opening file or url, + * @param [in] key + * the option key name + * @param [in] value + * the option value + * @return + * - 0: Success. + * - < 0: Failure. See AgoraMediaPlayerError. + */ +- (int)setPlayerOption:(NSString *)key value:(NSInteger)value NS_SWIFT_NAME(setPlayerOption(_:value:)); + +/** + * @brief Modify player option before opening file or url, + * @param [in] key + * the option key name + * @param [in] value + * the option value + * @return + * - 0: Success. + * - < 0: Failure. See AgoraMediaPlayerError. + */ +- (int)setPlayerOptionString:(NSString *)key value:(NSString *)value NS_SWIFT_NAME(setPlayerOptionString(_:value:)); + +/** + * @brief Set video rendering view + */ +- (int)setView:(View *_Nullable)view NS_SWIFT_NAME(setView(_:)); + +/** + * @brief Set video display mode + * + * @param mode Video display mode + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ +- (int)setRenderMode:(AgoraMediaPlayerRenderMode)mode NS_SWIFT_NAME(setRenderMode(_:)); + +/** + * Get the current play src. + * @return + * - current play src of raw bytes. + */ +- (NSString *)getPlaySrc NS_SWIFT_NAME(getPlaySrc()); + +/** + * Switch the media source when open a media through "open" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)switchSrc:(NSString *)src syncPts:(BOOL)syncPts NS_SWIFT_NAME(switchSrc(_:syncPts:)); + +/** + * Preload a media source + * @param src Specific src. + * @param startPos The starting position (ms) for playback. Default value is 0. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)preloadSrc:(NSString *)src startPos:(int)startPos NS_SWIFT_NAME(preloadSrc(_:startPos:)); + +/** + * unload a media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)unloadSrc:(NSString *)src NS_SWIFT_NAME(unloadSrc(_:)); + +/** + * Play a pre-loaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)playPreloadedSrc:(NSString *)src NS_SWIFT_NAME(playPreloadedSrc(_:)); + +/** Set dual-mono output mode of the music file. + @param mode The audio dual mono mode. See AgoraAudioDualMonoMode. + + @return + - 0: Success. + - < 0: Failure. + */ +- (int)setAudioDualMonoMode:(AgoraAudioDualMonoMode)mode NS_SWIFT_NAME(setAudioDualMonoMode(_:)); + +/** + * @deprecated + * Open media file or stream with custom soucrce. + * The custom data source provides a data stream input callback, and the player will continue to call back this interface, requesting the user to fill in the data that needs to be played. + * + * @param startPos Set the starting position for playback, in seconds. + * @param onReadDataCallback The player requests to read the data callback , see `AgoraRtcMediaPlayerOnReadCallback` + * @param onSeekCallback The Player seek event callback, see `AgoraRtcMediaPlayerOnSeekCallback` + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)openWithCustomSourceAtStartPos:(NSInteger)startPos + withPlayerOnReadData:(AgoraRtcMediaPlayerCustomSourceOnReadCallback)onReadDataCallback + andPlayerOnSeek:(AgoraRtcMediaPlayerCustomSourceOnSeekCallback)onSeekCallback NS_SWIFT_NAME(openWithCustomSourceAtStartPos(_:withPlayerOnReadData:andPlayerOnSeek:)); + +/** + * Set spatial audio params for the music file. It can be called after the media player + * was created. + * + * @params params See `AgoraSpatialAudioParams`. If it's + * not set, then the spatial audio will be disabled; or it will be enabled. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSpatialAudioParams:(AgoraSpatialAudioParams* _Nonnull)params NS_SWIFT_NAME(setSpatialAudioParams(_:)); + +#pragma mark Callback Audio PCM Frame + +/** + * Registers & unregister the player audio observer + * + * @param delegate observer object, pass nil to unregister + * @return + * - YES: Success. + * - NO: Failure. + */ +- (BOOL)setAudioFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setAudioFrameDelegate(_:)); + +#pragma mark Callback Video Frame + +/** + * Registers & unregister the player video observer + * + * @param delegate observer object, pass nil to unregister. + * @return + * - YES: Success. + * - NO: Failure. + */ +- (BOOL)setVideoFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setVideoFrameDelegate(_:)); + +- (int)registerMediaPlayerAudioSpectrumDelegate:(id _Nullable)delegate + intervalInMS:(NSUInteger)intervalInMS NS_SWIFT_NAME(registerMediaPlayerAudioSpectrumDelegate(_:intervalInMS:)); + +- (int)unregisterMediaPlayerAudioSpectrumDelegate:(id _Nullable)delegate NS_SWIFT_NAME(unregisterMediaPlayerAudioSpectrumDelegate(_:)); +@end + + +@protocol AgoraRtcMediaPlayerCacheManagerProtocol + +/** + * Get shared cacheManager instance. + * @return cacheManager instance. + */ ++ (instancetype)sharedInstance NS_SWIFT_NAME(sharedInstance()); +/** + * Remove all media resource cache files. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)removeAllCaches NS_SWIFT_NAME(removeAllCaches()); +/** + * Remove the latest media resource cache file. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)removeOldCache NS_SWIFT_NAME(removeOldCache()); +/** + * Remove the cache file by uri, setting by MediaSource. + * @param uri URI,identify the uniqueness of the property, Set from `MeidaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)removeCacheByUri:(NSString *)uri NS_SWIFT_NAME(removeCache(byUri:)); +/** + * Set cache file path that files will be saved to. + * @param cacheDir cacheDir path. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setCacheDir:(NSString *)cacheDir NS_SWIFT_NAME(setCacheDir(_:)); +/** + * Set the maximum number of cached files. + * @param count maximum number of cached files. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setMaxCacheFileCount:(NSInteger)count NS_SWIFT_NAME(setMaxCacheFileCount(_:)); +/** + * Set the total size of the largest cache file. + * @param cacheSize total size of the largest cache file. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setMaxCacheFileSize:(NSInteger)cacheSize NS_SWIFT_NAME(setMaxCacheFileSize(_:)); +/** + * Set whether the player will clean up the cache in the order of resource usage. + * @param enable enable the player to automatically clear the cache. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAutoRemoveCache:(BOOL)enable NS_SWIFT_NAME(enableAutoRemoveCache(_:)); +/** + * Get the cache directory you have set. + * @return cacheDir + */ +- (NSString *)cacheDir NS_SWIFT_NAME(cacheDir()); +/** + * Get the maximum number of cached files. + * @return + * > 0: file count. + * - < 0: Failure. + */ +- (NSInteger)maxCacheFileCount NS_SWIFT_NAME(maxCacheFileCount()); +/** + * Get the total size of the largest cache file + * @return + * > 0: file size. + * - < 0: Failure. + */ +- (NSInteger)maxCacheFileSize NS_SWIFT_NAME(maxCacheFileSize()); +/** + * Get the number of all cache files. + * @return + * > 0: file count. + * - < 0: Failure. + */ +- (NSInteger)cacheFileCount NS_SWIFT_NAME(cacheFileCount()); + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraSpatialAudioKit.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraSpatialAudioKit.h new file mode 100644 index 0000000..40f5499 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/AgoraSpatialAudioKit.h @@ -0,0 +1,108 @@ +// +// AgoraSpatialAudioKit.h +// AgoraRtcKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#ifndef AgoraSpatialAudioKit_h +#define AgoraSpatialAudioKit_h + +#import +#import "AgoraEnumerates.h" +#import "AgoraObjects.h" + +__attribute__((visibility("default"))) @interface AgoraRemoteVoicePositionInfo : NSObject +@property(strong, nonatomic) NSArray * _Nonnull position; +@property(strong, nonatomic) NSArray * _Nullable forward; +@end + +__attribute__((visibility("default"))) @interface AgoraSpatialAudioZone : NSObject +//the zone id +@property(assign, nonatomic) NSInteger zoneSetId; +//zone center point +@property(strong, nonatomic) NSArray * _Nonnull position; +//forward direction +@property(strong, nonatomic) NSArray * _Nonnull forward; +//right direction +@property(strong, nonatomic) NSArray * _Nonnull right; +//up direction +@property(strong, nonatomic) NSArray * _Nonnull up; +//the forward side length of the zone +@property(assign, nonatomic) float forwardLength; +//tehe right side length of the zone +@property(assign, nonatomic) float rightLength; +//the up side length of the zone +@property(assign, nonatomic) float upLength; +//the audio attenuation of zone +@property(assign, nonatomic) float audioAttenuation; +@end + +@class AgoraRtcEngineKit, AgoraBaseSpatialAudioKit, AgoraLocalSpatialAudioKit; + +__attribute__((visibility("default"))) @interface AgoraCloudSpatialAudioConfig : NSObject +@property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine; +/** 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 AgoraRtcEngineKit instance. To change your App ID, call [destroy]([AgoraRtcEngineKit destroy]) to `destroy` the current AgoraRtcEngineKit instance, and after `destroy` returns 0, call [sharedEngineWithConfig]([AgoraRtcEngineKit sharedEngineWithConfig:delegate:]) to create an AgoraRtcEngineKit instance with the new App ID. + */ +@property(copy, nonatomic) NSString* _Nullable appId; +/** The region for connection. This advanced feature applies to scenarios that have regional restrictions.

    For the regions that Agora supports, see AgoraAreaCode. The area codes support bitwise operation. After specifying the region, the SDK connects to the Agora servers within that region.

    + */ +@property(assign, nonatomic) NSUInteger deployRegion; +@end + +__attribute__((visibility("default"))) @interface AgoraLocalSpatialAudioConfig : NSObject +@property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine; +@end + +__attribute__((visibility("default"))) @interface AgoraBaseSpatialAudioKit : NSObject + +- (int)setMaxAudioRecvCount:(NSUInteger)maxCount NS_SWIFT_NAME(setMaxAudioRecvCount(_:)); + +- (int)setAudioRecvRange:(float)range NS_SWIFT_NAME(setAudioRecvRange(_:)); + +- (int)setDistanceUnit:(float)unit NS_SWIFT_NAME(setDistanceUnit(_:)); + +- (int)updatePlayerPositionInfo:(NSInteger)playerId positionInfo:(AgoraRemoteVoicePositionInfo* _Nonnull)positionInfo NS_SWIFT_NAME(updatePlayerPositionInfo(_:positionInfo:)); + +- (int)updateSelfPosition:(NSArray* _Nonnull)position axisForward:(NSArray* _Nonnull)axisForward axisRight:(NSArray* _Nonnull)axisRight axisUp:(NSArray* _Nonnull)axisUp NS_SWIFT_NAME(updateSelfPosition(_:axisForward:axisRight:axisUp:)); + +- (int)updateSelfPositionEx:(NSArray* _Nonnull)position + axisForward:(NSArray* _Nonnull)axisForward + axisRight:(NSArray* _Nonnull)axisRight + axisUp:(NSArray* _Nonnull)axisUp + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateSelfPositionEx(_:axisForward:axisRight:axisUp:connection:)); + +- (int)muteLocalAudioStream:(BOOL)mute NS_SWIFT_NAME(muteLocalAudioStream(_:)); + +- (int)muteAllRemoteAudioStreams:(BOOL)mute NS_SWIFT_NAME(muteAllRemoteAudioStreams(_:)); + +- (int)setZones:(NSArray * _Nullable)zones NS_SWIFT_NAME(setZones(_:)); + +- (int)setPlayerAttenuation:(double)attenuation playerId:(NSUInteger)playerId forceSet:(BOOL)forceSet NS_SWIFT_NAME(setPlayerAttenuation(_:playerId:forceSet:)); + +- (int)muteRemoteAudioStream:(NSUInteger)uid mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteAudioStream(_:mute:)); + +@end +__attribute__((visibility("default"))) @interface AgoraLocalSpatialAudioKit : AgoraBaseSpatialAudioKit + ++ (instancetype _Nonnull)sharedLocalSpatialAudioWithConfig:(AgoraLocalSpatialAudioConfig* _Nonnull)config NS_SWIFT_NAME(sharedLocalSpatialAudio(with:)); + ++ (void)destroy NS_SWIFT_NAME(destroy()); + +- (int)updateRemotePosition:(NSUInteger)uid positionInfo:(AgoraRemoteVoicePositionInfo* _Nonnull)posInfo NS_SWIFT_NAME(updateRemotePosition(_:positionInfo:)); + +- (int)updateRemotePositionEx:(NSUInteger)uid positionInfo:(AgoraRemoteVoicePositionInfo* _Nonnull)posInfo connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateRemotePositionEx(_:positionInfo:connection:)); + +- (int)removeRemotePosition:(NSUInteger)uid NS_SWIFT_NAME(removeRemotePosition(_:)); + +- (int)removeRemotePositionEx:(NSUInteger)uid connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(removeRemotePositionEx(_:connection:)); + +- (int)clearRemotePositions NS_SWIFT_NAME(clearRemotePositions()); + +- (int)clearRemotePositionsEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(clearRemotePositionsEx(_:)); + +- (int)setRemoteAudioAttenuation:(double)attenuation userId:(NSUInteger)uid forceSet:(BOOL)forceSet NS_SWIFT_NAME(setRemoteAudioAttenuation(_:userId:forceSet:)); + +@end + +#endif /* AgoraSpatialAudioKit_h */ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraFileUploader.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraFileUploader.h new file mode 100644 index 0000000..1ccd367 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraFileUploader.h @@ -0,0 +1,44 @@ + +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +struct ImagePayloadData { + ImagePayloadData(int seq, uint8_t* pixel, int fileSize, int w, int h, int64_t ts) + : seqid(seq), + size(fileSize), + width(w), + height(h), + timestamp(ts){ + } + + int seqid; + int size; + int width; + int height; + int64_t timestamp; + uint8_t* buffer; + void* privdata; + int privsize; +}; +/** + * The IFileUploadService class, which enables upload file service. + */ +class IFileUploaderService : public RefCountInterface { + public: + virtual ~IFileUploaderService() {} + virtual int startImageUpload(const ImagePayloadData* imgData) = 0; + virtual int stopImageUpload() = 0; +}; +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraLog.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraLog.h new file mode 100644 index 0000000..f395216 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraLog.h @@ -0,0 +1,98 @@ +// +// Agora Media SDK +// +// Copyright (c) 2015 Agora IO. All rights reserved. +// +#pragma once + +#include +#include + +#ifndef OPTIONAL_ENUM_CLASS +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_CLASS enum class +#else +#define OPTIONAL_ENUM_CLASS enum +#endif +#endif + +#ifndef OPTIONAL_LOG_LEVEL_SPECIFIER +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_LOG_LEVEL_SPECIFIER LOG_LEVEL:: +#else +#define OPTIONAL_LOG_LEVEL_SPECIFIER +#endif +#endif + +namespace agora { +namespace commons { + +/** + * Supported logging severities of SDK + */ +OPTIONAL_ENUM_CLASS LOG_LEVEL { + LOG_LEVEL_NONE = 0x0000, + LOG_LEVEL_INFO = 0x0001, + LOG_LEVEL_WARN = 0x0002, + LOG_LEVEL_ERROR = 0x0004, + LOG_LEVEL_FATAL = 0x0008, + LOG_LEVEL_API_CALL = 0x0010, +}; + +/* +The SDK uses ILogWriter class Write interface to write logs as application +The application inherits the methods Write() to implentation their own log writ + +Write has default implementation, it writes logs to files. +Application can use setLogFile() to change file location, see description of set +*/ +class ILogWriter { + public: + /** user defined log Write function + @param level log level + @param message log message content + @param length log message length + @return + - 0: success + - <0: failure + */ + virtual int32_t writeLog(LOG_LEVEL level, const char* message, uint16_t length) = 0; + + virtual ~ILogWriter() {} +}; + +enum LOG_FILTER_TYPE { + LOG_FILTER_OFF = 0, + LOG_FILTER_DEBUG = 0x080f, + LOG_FILTER_INFO = 0x000f, + LOG_FILTER_WARN = 0x000e, + LOG_FILTER_ERROR = 0x000c, + LOG_FILTER_CRITICAL = 0x0008, + LOG_FILTER_MASK = 0x80f, +}; + +const uint32_t MAX_LOG_SIZE = 20 * 1024 * 1024; // 20MB +const uint32_t MIN_LOG_SIZE = 128 * 1024; // 128KB +/** The default log size in kb + */ +const uint32_t DEFAULT_LOG_SIZE_IN_KB = 1024; + +/** Definition of LogConfiguration + */ +struct LogConfig { + /**The log file path, default is NULL for default log path + */ + const char* filePath; + /** The log file size, KB , set 1024KB to use default log size + */ + uint32_t fileSizeInKB; + /** The log level, set LOG_LEVEL_INFO to use default log level + */ + LOG_LEVEL level; + + LogConfig() : filePath(NULL), fileSizeInKB(DEFAULT_LOG_SIZE_IN_KB), level(OPTIONAL_LOG_LEVEL_SPECIFIER LOG_LEVEL_INFO) {} +}; +} // namespace commons +} // namespace agora + +#undef OPTIONAL_LOG_LEVEL_SPECIFIER diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaComponentFactory.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaComponentFactory.h new file mode 100644 index 0000000..28de53f --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaComponentFactory.h @@ -0,0 +1,41 @@ +// +// Agora SDK +// +// Copyright (c) 2021 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +class IMediaPlayer; + +class IMediaComponentFactory { +public: + /** This method creates media player. + */ + virtual agora_refptr createMediaPlayer( + agora::media::base::MEDIA_PLAYER_SOURCE_TYPE type = agora::media::base::MEDIA_PLAYER_SOURCE_DEFAULT) = 0; + +protected: + virtual ~IMediaComponentFactory() {} +}; + +} //namespace rtc +} // namespace agora + +/** \addtogroup createMediaComponentFactory + @{ + */ +/** + * Creates an \ref agora::rtc::IMediaComponentFactory "IMediaComponentFactory" object and returns the pointer. + * + * @return + * - The pointer to \ref agora::rtc::IMediaComponentFactory "IMediaComponentFactory": Success. + * - A null pointer: Failure. + */ +AGORA_API agora::rtc::IMediaComponentFactory* AGORA_CALL createAgoraMediaComponentFactory(); +/** @} */ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaEngine.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaEngine.h new file mode 100644 index 0000000..057b4cc --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaEngine.h @@ -0,0 +1,267 @@ +// +// Agora Media SDK +// +// Copyright (c) 2015 Agora IO. All rights reserved. +// +#pragma once + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace media { + +/** dual-mono music output mode + */ +enum AUDIO_MIXING_DUAL_MONO_MODE { + /* 0: Original mode */ + AUDIO_MIXING_DUAL_MONO_AUTO = 0, + /* 1: Left channel mode */ + AUDIO_MIXING_DUAL_MONO_L = 1, + /* 2: Right channel mode */ + AUDIO_MIXING_DUAL_MONO_R = 2, + /* 3: Mixed channel mode */ + AUDIO_MIXING_DUAL_MONO_MIX = 3 +}; + + +/** + * The IMediaEngine class. + */ +class IMediaEngine { + public: + /** + * Registers an audio frame observer object. + * + * @note + * Ensure that you call this method before \ref IRtcEngine::joinChannel "joinChannel". + * + * @param observer A pointer to the audio frame observer object: IAudioFrameObserver, + * nullptr means unregistering observer instead. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(IAudioFrameObserver* observer) = 0; + /** + * Registers a video frame observer object. + * + * @note + * - Ensure that you call this method before joining the channel. + * - If you register an observer for video raw video data, you cannot register an IVideoEncodedFrameObserver + * object. + * + * @param observer A pointer to the video frame observer: IVideoFrameObserver. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoFrameObserver(IVideoFrameObserver* observer) = 0; + + /** + * Registers a receiver object for the encoded video image. + * + * @note + * - Ensure that you call this method before joining the channel. + * + * @param observer A pointer to the observer of the encoded video image: \ref IVideoEncodedFrameObserver + * "IVideoEncodedFrameObserver". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoEncodedFrameObserver(IVideoEncodedFrameObserver* observer) = 0; + + /** + * Pushes the external audio data to the app. + * + * @param frame The audio buffer data. + * @param trackId The audio track ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pushAudioFrame(IAudioFrameObserver::AudioFrame* frame, rtc::track_id_t trackId = 0) = 0; + + virtual int pushCaptureAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0; + + virtual int pushReverseAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0; + + /** + * Pulls the remote audio data. + * + * After a successful method call, the app pulls the decoded and mixed audio data for playback. + * + * The difference between this method and the \ref onPlaybackAudioFrame "onPlaybackAudioFrame" is as follows: + * - `onPlaybackAudioFrame`: The SDK sends the audio data to the app once every 10 ms. Any delay in processing + * the audio frames may result in audio jitter. + * - `pullAudioFrame`: The app pulls the remote audio data. After setting the audio data parameters, the + * SDK adjusts the frame buffer and avoids problems caused by jitter in the external audio playback. + * + * @param frame The pointer to the audio frame: AudioFrame. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pullAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0; + + /** + * Sets the external video source. + * + * Once the external video source is enabled, the SDK prepares to accept the external video frame. + * + * @param enabled Determines whether to enable the external video source. + * - true: Enable the external video source. Once set, the SDK creates the external source and prepares + * video data from `pushVideoFrame` or `pushEncodedVideoImage`. + * - false: Disable the external video source. + * @param useTexture Determines whether to use textured video data. + * - true: Use texture, which is not supported now. + * - False: Do not use texture. + * @param sourceType Determines the type of external video source frame. + * - ENCODED_VIDEO_FRAME: The external video source is encoded. + * - VIDEO_FRAME: The external video source is not encoded. + * @param encodedVideoOption Video encoded track option, which is only used for ENCODED_VIDEO_FRAME. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExternalVideoSource( + bool enabled, bool useTexture, EXTERNAL_VIDEO_SOURCE_TYPE sourceType = VIDEO_FRAME, + rtc::SenderOptions encodedVideoOption = rtc::SenderOptions()) = 0; + + /** + * Sets the external audio source. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @deprecated This method is deprecated. Use createCustomAudioTrack(rtc::AUDIO_TRACK_TYPE trackType, const rtc::AudioTrackConfig& config) instead. + * + * @param enabled Determines whether to enable the external audio source: + * - true: Enable the external audio source. + * - false: (default) Disable the external audio source. + * @param sampleRate The Sample rate (Hz) of the external audio source, which can set be as + * 8000, 16000, 32000, 44100, or 48000. + * @param channels The number of channels of the external audio source, which can be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param localPlayback Enable/Disables the local playback of external audio track: + * - true: Enable local playback + * - false: (Default) Do not enable local playback + * @param publish Determines whether to publish the external audio track: + * - true: (Default) Publish the external audio track. + * - false: Don`t publish the external audio track. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExternalAudioSource(bool enabled, int sampleRate, int channels, bool localPlayback = false, bool publish = true) = 0; + + /** + * Create a custom audio track and get the audio track id. + * + * @note Ensure that you call this method before calling `joinChannel`. + * + * @param trackType The type of custom audio track + * See AUDIO_TRACK_TYPE. + * + * @param config The config of custom audio track + * See AudioTrackConfig. + * + * @return + * - If the call is successful, SDK returns audio track id. + * - If the call fails, SDK returns 0xffffffff. + */ + virtual rtc::track_id_t createCustomAudioTrack(rtc::AUDIO_TRACK_TYPE trackType, const rtc::AudioTrackConfig& config) = 0; + + /** + * Destroy custom audio track by trackId + * + * @param trackId The custom audio track id. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int destroyCustomAudioTrack(rtc::track_id_t trackId) = 0; + + /** + * Sets the external audio sink. + * + * This method applies to scenarios where you want to use external audio + * data for playback. After calling the \ref IRtcEngine::initialize "initialize" + * method and pass value of false in the `enableAudioDevice` member in the RtcEngineContext struct, you can call + * the \ref agora::media::IMediaEngine::pullAudioFrame "pullAudioFrame" method to pull the remote audio data, process + * it, and play it with the audio effects that you want. + * + * @note + * Once you call the \ref IRtcEngine::initialize "initialize" method and pass value of false in the `enableAudioDevice` + * member in the RtcEngineContext struct, the app will not retrieve any audio data from the + * \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback. + * + * @param enabled Sets whether or not to the external audio sink + * - true: Enables the external audio sink. + * - false: Disables the external audio sink. + * @param sampleRate Sets the sample rate (Hz) of the external audio sink, which can be set as 16000, 32000, 44100 or 48000. + * @param channels Sets the number of audio channels of the external + * audio sink: + * - 1: Mono. + * - 2: Stereo. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExternalAudioSink(bool enabled, int sampleRate, int channels) = 0; + + /** + * Sets the external audio track. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @param trackId The custom audio track id. + * @param enabled Enable/Disables the local playback of external audio track: + * - true: Enable local playback + * - false: Do not enable local playback + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableCustomAudioLocalPlayback(rtc::track_id_t trackId, bool enabled) = 0; + + /** + * Pushes the external video frame to the app. + * + * @param frame The external video frame: ExternalVideoFrame. + * @param videoTrackId The id of the video track. + * - 0: Success. + * - < 0: Failure. + */ + virtual int pushVideoFrame(base::ExternalVideoFrame* frame, unsigned int videoTrackId = 0) = 0; + + /** + * Pushes the encoded video image to the app. + * @param imageBuffer A pointer to the video image. + * @param length The data length. + * @param videoEncodedFrameInfo The reference to the information of the encoded video frame: + * \ref agora::rtc::EncodedVideoFrameInfo "EncodedVideoFrameInfo". + * @param videoTrackId The id of the video track. + * - 0: Success. + * - < 0: Failure. + */ + virtual int pushEncodedVideoImage(const uint8_t* imageBuffer, size_t length, + const agora::rtc::EncodedVideoFrameInfo& videoEncodedFrameInfo, + unsigned int videoTrackId = 0) = 0; + + virtual void release() = 0; + + protected: + virtual ~IMediaEngine() {} +}; + +} // namespace media + +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaPlayer.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaPlayer.h new file mode 100644 index 0000000..4ec36ca --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaPlayer.h @@ -0,0 +1,654 @@ +// +// Agora SDK +// +// Copyright (c) 2020 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraMediaPlayerTypes.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace base { +class IAgoraService; +} +namespace rtc { + +class ILocalAudioTrack; +class ILocalVideoTrack; +class IMediaPlayerSourceObserver; +class IMediaPlayerCustomDataProvider; + +/** + * The IMediaPlayerEntity class provides access to a media player entity. If yout want to playout + * multiple media sources simultaneously, create multiple media player source objects. + */ +class IMediaPlayer : public RefCountInterface { +protected: + virtual ~IMediaPlayer() {} + +public: + virtual int initialize(base::IAgoraService* agora_service) = 0; + + /** + * Get unique media player id of the media player entity. + * @return + * - >= 0: The source id of this media player entity. + * - < 0: Failure. + */ + virtual int getMediaPlayerId() const = 0; + + /** + * Opens a media file with a specified URL. + * @param url The URL of the media file that you want to play. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int open(const char* url, int64_t startPos) = 0; + + /** + * @deprecated + * @brief Open media file or stream with custom soucrce. + * @param startPos Set the starting position for playback, in seconds + * @param observer dataProvider object + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithCustomSource(int64_t startPos, media::base::IMediaPlayerCustomDataProvider* provider) = 0; + + /** + * @brief Open a media file with a media file source. + * @param source Media file source that you want to play, see `MediaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithMediaSource(const media::base::MediaSource &source) = 0; + + /** + * Plays the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int play() = 0; + + /** + * Pauses playing the media file. + */ + virtual int pause() = 0; + + /** + * Stops playing the current media file. + */ + virtual int stop() = 0; + + /** + * Resumes playing the media file. + */ + virtual int resume() = 0; + + /** + * Sets the current playback position of the media file. + * @param newPos The new playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int seek(int64_t newPos) = 0; + + /** Sets the pitch of the current media file. + * @param pitch Sets the pitch of the local music file by chromatic scale. The default value is 0, + * which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between + * consecutive values is a chromatic value. The greater the absolute value of this parameter, the + * higher or lower the pitch of the local music file. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioPitch(int pitch) = 0; + + /** + * Gets the duration of the media file. + * @param duration A reference to the duration of the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDuration(int64_t& duration) = 0; + + /** + * Gets the current playback position of the media file. + * @param currentPosition A reference to the current playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlayPosition(int64_t& pos) = 0; + + virtual int getStreamCount(int64_t& count) = 0; + + virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* info) = 0; + + /** + * Sets whether to loop the media file for playback. + * @param loopCount the number of times looping the media file. + * - 0: Play the audio effect once. + * - 1: Play the audio effect twice. + * - -1: Play the audio effect in a loop indefinitely, until stopEffect() or stop() is called. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLoopCount(int loopCount) = 0; + + /** + * Change playback speed + * @param speed the value of playback speed ref [50-400] + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackSpeed(int speed) = 0; + + /** + * Slect playback audio track of the media file + * @param index the index of the audio track in media file + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int selectAudioTrack(int index) = 0; + + /** + * Selects multi audio track of the media file for playback or publish to channel. + * @param playoutTrackIndex The index of the audio track in media file for local playback. + * @param publishTrackIndex The index of the audio track in the media file published to the remote. + * + * @note + * You can obtain the streamIndex of the audio track by calling getStreamInfo.. + * If you want to use selectMultiAudioTrack, you need to open the media file with openWithMediaSource and set enableMultiAudioTrack to true. + * + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - -2: Invalid argument. Argument must be greater than or equal to zero. + * - -8: Invalid State.You must open the media file with openWithMediaSource and set enableMultiAudioTrack to true + */ + virtual int selectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex) = 0; + + /** + * change player option before play a file + * @param key the key of the option param + * @param value the value of option param + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlayerOption(const char* key, int value) = 0; + + /** + * change player option before play a file + * @param key the key of the option param + * @param value the value of option param + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlayerOption(const char* key, const char* value) = 0; + /** + * take screenshot while playing video + * @param filename the filename of screenshot file + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int takeScreenshot(const char* filename) = 0; + + /** + * select internal subtitles in video + * @param index the index of the internal subtitles + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int selectInternalSubtitle(int index) = 0; + + /** + * set an external subtitle for video + * @param url The URL of the subtitle file that you want to load. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExternalSubtitle(const char* url) = 0; + + virtual media::base::MEDIA_PLAYER_STATE getState() = 0; + + /** + * @brief Turn mute on or off + * + * @param muted Whether to mute on + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int mute(bool muted) = 0; + + /** + * @brief Get mute state + * + * @param[out] muted Whether is mute on + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int getMute(bool& muted) = 0; + + /** + * @brief Adjust playback volume + * + * @param volume The volume value to be adjusted + * The volume can be adjusted from 0 to 400: + * 0: mute; + * 100: original volume; + * 400: Up to 4 times the original volume (with built-in overflow protection). + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int adjustPlayoutVolume(int volume) = 0; + + /** + * @brief Get the current playback volume + * + * @param[out] volume + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int getPlayoutVolume(int& volume) = 0; + + /** + * @brief adjust publish signal volume + * + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int adjustPublishSignalVolume(int volume) = 0; + + /** + * @brief get publish signal volume + * + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int getPublishSignalVolume(int& volume) = 0; + + /** + * @brief Set video rendering view + * + * @param view view object, windows platform is HWND + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int setView(media::base::view_t view) = 0; + + /** + * @brief Set video display mode + * + * @param renderMode Video display mode + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int setRenderMode(media::base::RENDER_MODE_TYPE renderMode) = 0; + + /** + * Registers a media player source observer. + * + * Once the media player source observer is registered, you can use the observer to monitor the state change of the media player. + * @param observer The pointer to the IMediaPlayerSourceObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; + + /** + * Releases the media player source observer. + * @param observer The pointer to the IMediaPlayerSourceObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; + + /** + * Register the audio frame observer. + * + * @param observer The pointer to the IAudioFrameObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Registers an audio observer. + * + * @param observer The audio observer, reporting the reception of each audio + * frame. See + * \ref media::base::IAudioFrameObserver "IAudioFrameObserver" for + * details. + * @param mode Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode) = 0; + + /** + * Releases the audio frame observer. + * @param observer The pointer to the IAudioFrameObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * @brief Register the player video observer + * + * @param observer observer object + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int registerVideoFrameObserver(media::base::IVideoFrameObserver* observer) = 0; + + /** + * @brief UnRegister the player video observer + * + * @param observer observer object + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int unregisterVideoFrameObserver(agora::media::base::IVideoFrameObserver* observer) = 0; + + /** + * Registers the audio frame spectrum observer. + * + * @param observer The pointer to the {@link media::base::IAudioSpectrumObserver IAudioSpectrumObserver} object. + * @param intervalInMS Sets the time interval(ms) between two consecutive audio spectrum callback. + * The default value is 100. This param should be larger than 10. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerMediaPlayerAudioSpectrumObserver(media::IAudioSpectrumObserver* observer, int intervalInMS) = 0; + + /** + * Releases the audio frame spectrum observer. + * @param observer The pointer to the {@link media::base::IAudioSpectrumObserver IAudioSpectrumObserver} object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterMediaPlayerAudioSpectrumObserver(media::IAudioSpectrumObserver* observer) = 0; + + /** + * @brief Set dual-mono output mode of the music file. + * + * @param mode dual mono mode. See #agora::media::AUDIO_DUAL_MONO_MODE + */ + virtual int setAudioDualMonoMode(agora::media::base::AUDIO_DUAL_MONO_MODE mode) = 0; + + /** + * get sdk version and build number of player SDK. + * @return String of the SDK version. + */ + virtual const char* getPlayerSdkVersion() = 0; + + /** + * Get the current play src. + * @return + * - current play src of raw bytes. + */ + virtual const char* getPlaySrc() = 0; + + + /** + * Open the Agora CDN media source. + * @param src The src of the media file that you want to play. + * @param startPos The playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithAgoraCDNSrc(const char* src, int64_t startPos) = 0; + + /** + * Gets the number of Agora CDN lines. + * @return + * - > 0: number of CDN. + * - <= 0: Failure. + */ + virtual int getAgoraCDNLineCount() = 0; + + /** + * Switch Agora CDN lines. + * @param index Specific CDN line index. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchAgoraCDNLineByIndex(int index) = 0; + + /** + * Gets the line of the current CDN. + * @return + * - >= 0: Specific line. + * - < 0: Failure. + */ + virtual int getCurrentAgoraCDNIndex() = 0; + + /** + * Enable automatic CDN line switching. + * @param enable Whether enable. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAutoSwitchAgoraCDN(bool enable) = 0; + + /** + * Update the CDN source token and timestamp. + * @param token token. + * @param ts ts. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int renewAgoraCDNSrcToken(const char* token, int64_t ts) = 0; + + /** + * Switch the CDN source when open a media through "openWithAgoraCDNSrc" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchAgoraCDNSrc(const char* src, bool syncPts = false) = 0; + + /** + * Switch the media source when open a media through "open" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchSrc(const char* src, bool syncPts = true) = 0; + + /** + * Preload a media source + * @param src Specific src. + * @param startPos The starting position (ms) for playback. Default value is 0. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preloadSrc(const char* src, int64_t startPos) = 0; + + /** + * Play a pre-loaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int playPreloadedSrc(const char* src) = 0; + + /** + * Unload a preloaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unloadSrc(const char* src) = 0; + + /** + * Set spatial audio params for the music file. It can be called after the media player + * was created. + * + * @param params See #agora::SpatialAudioParams. If it's + * not set, then the spatial audio will be disabled; or it will be enabled. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSpatialAudioParams(const SpatialAudioParams& params) = 0; + + /** + * Set sound position params for the music file. It can be called after the media player + * was created. + * + *@param pan The sound position of the music file. The value ranges from -1.0 to 1.0: + *- 0.0: the music sound comes from the front. + *- -1.0: the music sound comes from the left. + *- 1.0: the music sound comes from the right. + *@param gain Gain of the music. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the music). The smaller the value, the less the gain. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSoundPositionParams(float pan, float gain) = 0; + + /** + * Set delay of playback to local device. + * + *@param delay_ms The delay_ms for playback to local device: + * - for default, the pipeline default is 160ms, 16 buffer before pipeline start consuming + * - for playeffect, it need to play as soon as possible for short file, sugguest to used 50ms + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioPlaybackDelay(int delay_ms) = 0; + +}; + +/** + * This class is used to set and manage the player cache, implemented in the + * form of a singleton, independent of the player. + */ +class IMediaPlayerCacheManager { +public: + /** + * Delete the longest used cache file in order to release some of the cache file disk usage. + * (usually used when the cache quota notification is received) + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeAllCaches() = 0; + /** + * Remove the latest media resource cache file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeOldCache() = 0; + /** + * Remove the cache file by uri, setting by MediaSource. + * @param uri URI,identify the uniqueness of the property, Set from `MeidaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeCacheByUri(const char *uri) = 0; + /** + * Set cache file path that files will be saved to. + * @param path file path. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCacheDir(const char *path) = 0; + /** + * Set the maximum number of cached files. + * @param count maximum number of cached files. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMaxCacheFileCount(int count) = 0; + /** + * Set the maximum size of cache file disk usage. + * @param cacheSize total size of the largest cache file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMaxCacheFileSize(int64_t cacheSize) = 0; + /** + * Whether to automatically delete old cache files when the cache file usage reaches the limit. + * @param enable enable the player to automatically clear the cache. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAutoRemoveCache(bool enable) = 0; + /** + * Get the cache directory. + * @param path cache path, recieve a pointer to be copied to. + * @param length the length to be copied. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getCacheDir(char* path, int length) = 0; + /** + * Get the maximum number of cached files. + * @return + * > 0: file count. + * - < 0: Failure. + */ + virtual int getMaxCacheFileCount() = 0; + /** + * Get the total size of the largest cache file + * @return + * > 0: file size. + * - < 0: Failure. + */ + virtual int64_t getMaxCacheFileSize() = 0; + /** + * Get the number of all cache files. + * @return + * > 0: file count. + * - < 0: Failure. + */ + virtual int getCacheFileCount() = 0; + + virtual ~IMediaPlayerCacheManager(){}; +}; + +} //namespace rtc +} // namespace agora + +AGORA_API agora::rtc::IMediaPlayerCacheManager* AGORA_CALL getMediaPlayerCacheManager(); \ No newline at end of file diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaPlayerSource.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaPlayerSource.h new file mode 100644 index 0000000..8e27e12 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaPlayerSource.h @@ -0,0 +1,486 @@ +// +// Agora SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraMediaPlayerTypes.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +class IMediaPlayerSourceObserver; + +/** + * The IMediaPlayerSource class provides access to a media player source. To playout multiple media sources simultaneously, + * create multiple media player source objects. + */ +class IMediaPlayerSource : public RefCountInterface { +protected: + virtual ~IMediaPlayerSource() {} + +public: + + /** + * Gets the unique source ID of the media player source. + * @return + * - >=0: The source ID of this media player source. + * - < 0: Failure. + */ + virtual int getSourceId() const = 0; + + /** + * Opens a media file with a specified URL. + * @param url The path of the media file. Both the local path and online path are supported. + * @param startPos The starting position (ms) for playback. Default value is 0. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int open(const char* url, int64_t startPos) = 0; + + /** + * @deprecated + * @brief Open media file or stream with custom soucrce. + * @param startPos Set the starting position for playback, in seconds + * @param observer dataProvider object + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithCustomSource(int64_t startPos, media::base::IMediaPlayerCustomDataProvider* provider) = 0; + + /** + * Opens a media file with a media file source. + * @param source Media file source that you want to play, see `MediaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithMediaSource(const media::base::MediaSource &source) = 0; + + /** + * Plays the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int play() = 0; + + /** + * Pauses the playback. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pause() = 0; + + /** + * Stops the playback. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stop() = 0; + + /** + * Resumes the playback. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resume() = 0; + + /** + * Sets the playback position of the media file. + * @param newPos The new playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int seek(int64_t newPos) = 0; + + /** + * Gets the duration of the media file. + * @param [out] duration A reference to the duration of the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDuration(int64_t& duration) = 0; + + /** + * Gets the current playback position of the media file. + * @param [out] pos A reference to the current playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int getPlayPosition(int64_t& pos) = 0; + + /** + * Gets the number of the media streams in the media source. + * @param [out] count The number of the media streams in the media source. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int getStreamCount(int64_t& count) = 0; + + /** + * Gets the detailed information of a media stream. + * @param index The index of the media stream. + * @param [out] info The detailed information of the media stream. See \ref media::base::PlayerStreamInfo "PlayerStreamInfo" for details. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* info) = 0; + + /** + * Sets whether to loop the media file for playback. + * @param loopCount The number of times of looping the media file. + * - 0: Play the media file once. + * - 1: Play the media file twice. + * - -1: Play the media file in a loop indefinitely, until {@link stop} is called. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setLoopCount(int64_t loopCount) = 0; + + /** + * Changes the playback speed. + * @param speed The playback speed ref [50-400]. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setPlaybackSpeed(int speed) = 0; + + /** + * Selects an audio track of the media file for playback. + * @param index The index of the audio track in media file. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int selectAudioTrack(int64_t index) = 0; + + /** + * Selects multi audio track of the media file for playback or publish to channel. + * @param playoutTrackIndex The index of the audio track in media file for local playback. + * @param publishTrackIndex The index of the audio track in the media file published to the remote. + * + * @note + * You can obtain the streamIndex of the audio track by calling getStreamInfo.. + * If you want to use selectMultiAudioTrack, you need to open the media file with openWithMediaSource and set enableMultiAudioTrack to true. + * + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - -2: Invalid argument. Argument must be greater than or equal to zero. + * - -8: Invalid State.You must open the media file with openWithMediaSource and set enableMultiAudioTrack to true + */ + virtual int selectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex) = 0; + + /** + * Changes the player option before playing a file. + * @param key The key of the option paramemter. + * @param value The value of option parameter. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setPlayerOption(const char* key, int64_t value) = 0; + + /** + * Changes the player option before playing a file. + * @param key The key of the option paramemter. + * @param value The value of option parameter. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setPlayerOption(const char* key, const char* value) = 0; + + /** + * Takes a screenshot when playing a video file. + * @param filename The filename of the screenshot file. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int takeScreenshot(const char* filename) = 0; + + /** + * Selects internal subtitles for a video file. + * @param index The index of the internal subtitles. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int selectInternalSubtitle(int64_t index) = 0; + + /** + * Sets an external subtitle file for a video file. + * @param url The URL of the subtitle file. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setExternalSubtitle(const char* url) = 0; + + /** + * Gets the playback state. + * @return The current playback state. See {@link media::base::MEDIA_PLAYER_STATE MEDIA_PLAYER_STATE} for details. + */ + virtual media::base::MEDIA_PLAYER_STATE getState() = 0; + + /** + * Registers a media player source observer. + * + * Once the media player source observer is registered, you can use the observer to monitor the state change of the media player. + * @param observer The pointer to the IMediaPlayerSourceObserver object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; + + /** + * Releases the media player source observer. + * @param observer The pointer to the IMediaPlayerSourceObserver object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; + + /** + * Registers the audio frame observer. + * + * @param observer The pointer to the {@link media::base::IAudioFrameObserver IAudioFrameObserver} object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Releases the audio frame observer. + * @param observer The pointer to the {@link media::base::IAudioFrameObserver IAudioFrameObserver} object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int unregisterAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Open the Agora CDN media source. + * @param src The src of the media file that you want to play. + * @param startPos The playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithAgoraCDNSrc(const char* src, int64_t startPos) = 0; + + /** + * Gets the number of Agora CDN lines. + * @return + * - > 0: number of CDN. + * - <= 0: Failure. + */ + virtual int getAgoraCDNLineCount() = 0; + + + /** + * Switch Agora CDN lines. + * @param index Specific CDN line index. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchAgoraCDNLineByIndex(int index) = 0; + + /** + * Gets the line of the current CDN. + * @return + * - >= 0: Specific line. + * - < 0: Failure. + */ + virtual int getCurrentAgoraCDNIndex() = 0; + + /** + * Enable automatic CDN line switching. + * @param enable Whether enable. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAutoSwitchAgoraCDN(bool enable) = 0; + + /** + * Update the CDN source token and timestamp. + * @param token token. + * @param ts ts. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int renewAgoraCDNSrcToken(const char* token, int64_t ts) = 0; + + /** + * Switch the CDN source when open a media through "openWithAgoraCDNSrc" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchAgoraCDNSrc(const char* src, bool syncPts = false) = 0; + + /** + * Switch the media source when open a media through "open" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchSrc(const char* src, bool syncPts) = 0; + + /** + * Preload a media source + * @param src Specific src. + * @param startPos The starting position (ms) for playback. Default value is 0. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preloadSrc(const char* src, int64_t startPos) = 0; + + /** + * Unload a preloaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unloadSrc(const char* src) = 0; + + /** + * Play a pre-loaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int playPreloadedSrc(const char* src) = 0; + +}; + +/** + * This class class reports runtime events to the applications. + */ +class IMediaPlayerSourceObserver { + public: + virtual ~IMediaPlayerSourceObserver() {} + + /** + * @brief Reports the playback state change. + * + * When the state of the playback changes, the SDK triggers this callback to report the new playback state and the reason or error for the change. + * @param state The new playback state after change. See {@link media::base::MEDIA_PLAYER_STATE MEDIA_PLAYER_STATE}. + * @param ec The player's error code. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, + media::base::MEDIA_PLAYER_ERROR ec) = 0; + + /** + * @brief Reports current playback progress. + * + * The callback occurs once every one second during the playback and reports the current playback progress. + * @param positionMs Current playback progress (milisecond). + * @param timestampMs Current NTP(Network Time Protocol) time (milisecond). + */ + virtual void onPositionChanged(int64_t positionMs, int64_t timestampMs) = 0; + + /** + * @brief Reports the playback event. + * + * - After calling the `seek` method, the SDK triggers the callback to report the results of the seek operation. + * - After calling the `selectAudioTrack` method, the SDK triggers the callback to report that the audio track changes. + * + * @param eventCode The playback event. See {@link media::base::MEDIA_PLAYER_EVENT MEDIA_PLAYER_EVENT}. + * @param elapsedTime The playback elapsed time. + * @param message The playback message. + */ + virtual void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) = 0; + + /** + * @brief Occurs when the metadata is received. + * + * The callback occurs when the player receives the media metadata and reports the detailed information of the media metadata. + * @param data The detailed data of the media metadata. + * @param length The data length (bytes). + */ + virtual void onMetaData(const void* data, int length) = 0; + + + /** + * @brief Triggered when play buffer updated, once every 1 second + * + * @param int cached buffer during playing, in milliseconds + */ + virtual void onPlayBufferUpdated(int64_t playCachedBuffer) = 0; + + + /** + * @brief Triggered when the player preloadSrc + * + * @param event + */ + virtual void onPreloadEvent(const char* src, media::base::PLAYER_PRELOAD_EVENT event) = 0; + + /** + * @brief Occurs when one playback of the media file is completed. + */ + virtual void onCompleted() = 0; + + /** + * @brief AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken(const char* src). + */ + virtual void onAgoraCDNTokenWillExpire() = 0; + + /** + * @brief Reports current playback source bitrate changed. + * @brief Reports current playback source info changed. + * + * @param from Streaming media information before the change. + * @param to Streaming media information after the change. + */ + virtual void onPlayerSrcInfoChanged(const media::base::SrcInfo& from, const media::base::SrcInfo& to) = 0; + + /** + * @brief Triggered when media player information updated. + * + * @param info Include information of media player. + */ + virtual void onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo& info) = 0; + + /** + * @brief Triggered every 200 millisecond ,update player current volume range [0,255] + * + * @param volume volume of current player. + */ + virtual void onAudioVolumeIndication(int volume) = 0; +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaRecorder.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaRecorder.h new file mode 100644 index 0000000..e805f28 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaRecorder.h @@ -0,0 +1,26 @@ +// +// Agora SDK +// +// Copyright (c) 2022 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "IAgoraRtcEngineEx.h" + +namespace agora { +namespace rtc { + +class IMediaRecorder { + protected: + virtual ~IMediaRecorder() {} + public: + virtual int setMediaRecorderObserver(const RtcConnection& connection, media::IMediaRecorderObserver* callback) = 0; + virtual int startRecording(const RtcConnection& connection, const media::MediaRecorderConfiguration& config) = 0; + virtual int stopRecording(const RtcConnection& connection) = 0; + virtual void release() = 0; +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaStreamingSource.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaStreamingSource.h new file mode 100644 index 0000000..e1267b6 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMediaStreamingSource.h @@ -0,0 +1,332 @@ +// +// Agora SDK +// Copyright (c) 2019 Agora.io. All rights reserved. +// +// Created by xiaohua.lu in 2020-03. +// CodeStyle: Google C++ +// + +#pragma once // NOLINT(build/header_guard) + + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraMediaPlayerTypes.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + + +class IMediaStreamingSourceObserver; + + +/** + * @brief The error code of streaming source + * + */ +enum STREAMING_SRC_ERR { + STREAMING_SRC_ERR_NONE = 0, ///< no error + STREAMING_SRC_ERR_UNKNOWN = 1, ///< unknown error + STREAMING_SRC_ERR_INVALID_PARAM = 2, ///< invalid parameter + STREAMING_SRC_ERR_BAD_STATE = 3, ///< bad status + STREAMING_SRC_ERR_NO_MEM = 4, ///< not enough memory + STREAMING_SRC_ERR_BUFFER_OVERFLOW = 5, ///< buffer overflow + STREAMING_SRC_ERR_BUFFER_UNDERFLOW = 6, ///< buffer underflow + STREAMING_SRC_ERR_NOT_FOUND = 7, ///< buffer underflow + STREAMING_SRC_ERR_TIMEOUT = 8, ///< buffer underflow + STREAMING_SRC_ERR_EXPIRED = 9, ///< expired + STREAMING_SRC_ERR_UNSUPPORTED = 10, ///< unsupported + STREAMING_SRC_ERR_NOT_EXIST = 11, ///< component not exist + STREAMING_SRC_ERR_EXIST = 12, ///< component already exist + STREAMING_SRC_ERR_OPEN = 13, ///< fail to IO open + STREAMING_SRC_ERR_CLOSE = 14, ///< fail to IO close + STREAMING_SRC_ERR_READ = 15, ///< fail to IO read + STREAMING_SRC_ERR_WRITE = 16, ///< fail to IO write + STREAMING_SRC_ERR_SEEK = 17, ///< fail to IO seek + STREAMING_SRC_ERR_EOF = 18, ///< reach to IO EOF, can do nothing + STREAMING_SRC_ERR_CODECOPEN = 19, ///< fail to codec open + STREAMING_SRC_ERR_CODECCLOSE = 20, ///< fail to codec close + STREAMING_SRC_ERR_CODECPROC = 21, ///< fail to codec process +}; + + + +/** + * @brief The state machine of Streaming Source + * + */ +enum STREAMING_SRC_STATE { + STREAMING_SRC_STATE_CLOSED = 0, ///< streaming source still closed, can do nothing + STREAMING_SRC_STATE_OPENING = 1, ///< after call open() method and start parsing streaming source + STREAMING_SRC_STATE_IDLE = 2, ///< streaming source is ready waiting for play + STREAMING_SRC_STATE_PLAYING = 3, ///< after call play() method, playing & pushing the AV data + STREAMING_SRC_STATE_SEEKING = 4, ///< after call seek() method, start seeking poisition + STREAMING_SRC_STATE_EOF = 5, ///< The position is located at end, can NOT playing + STREAMING_SRC_STATE_ERROR = 6, ///< The error status and can do nothing except close +}; + + +/** + * @brief The input SEI data + * + */ +struct InputSeiData { + int32_t type; ///< SEI type + int64_t timestamp; ///< the frame timestamp which be attached + int64_t frame_index; ///< the frame index which be attached + uint8_t* private_data; ///< SEI really data + int32_t data_size; ///< size of really data +}; + + + +/** + * @brief The IMediaStreamingSource class provides access to a media streaming source demuxer. + * To playout multiple stream sources simultaneously, + * create multiple media stream source objects. + */ +class IMediaStreamingSource : public RefCountInterface { +public: + virtual ~IMediaStreamingSource() {}; + + + /** + * @brief Opens a media streaming source with a specified URL. + * @param url The path of the media file. Both the local path and online path are supported. + * @param startPos The starting position (ms) for pushing. Default value is 0. + * @param auto_play whether start playing after opened + * @return + * - 0: Success. + * - < 0: Failure + */ + virtual int open(const char* url, int64_t start_pos, bool auto_play = true) = 0; + + /** + * @brief Close current media streaming source + * @return + * - 0: Success. + * - < 0: Failure + */ + virtual int close() = 0; + + /** + * @brief Gets the unique source ID of the streaming source. + * @return + * - ≧ 0: The source ID of this media player source. + * - < 0: Failure. + */ + virtual int getSourceId() const = 0; + + /** + * @brief Retrieve whether video stream is valid + * @return: valid or invalid + */ + virtual bool isVideoValid() = 0; + + /** + * @brief Retrieve whether audio stream is valid + * @return: valid or invalid + */ + virtual bool isAudioValid() = 0; + + /** + * @brief Gets the duration of the streaming source. + * @param [out] duration A reference to the duration of the media file. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int getDuration(int64_t& duration) = 0; + + /** + * @brief Gets the number of the streming source + * @param [out] count The number of the media streams in the media source. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int getStreamCount(int64_t& count) = 0; + + /** + * @brief Gets the detailed information of a media stream. + * @param index The index of the media stream. + * @param [out] out_info The detailed information of the media stream. See \ref media::base::PlayerStreamInfo "PlayerStreamInfo" for details. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* out_info) = 0; + + /** + * @brief Sets whether to loop the streaming source for playback. + * @param loop_count The number of times of looping the media file. + * - 1: Play the media file once. + * - 2: Play the media file twice. + * - <= 0: Play the media file in a loop indefinitely, until {@link stop} is called. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int setLoopCount(int64_t loop_count) = 0; + + /** + * @brief Play & push the streaming source. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int play() = 0; + + /** + * @brief Pauses the playing & pushing of the streaming source, Keep current position. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int pause() = 0; + + /** + * @brief Stop the playing & pushing of the streaming source, set the position to 0. + * @return + * - 0: Success. + * - < 0: Failure.See {@link STREAMINGSRC_ERR}. + */ + virtual int stop() = 0; + + /** + * @brief Sets the playback position of the streaming source. + * After seek done, it will return to previous status + * @param newPos The new playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int seek(int64_t new_pos) = 0; + + /** + * @brief Gets the current playback position of the media file. + * @param [out] pos A reference to the current playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int getCurrPosition(int64_t& pos) = 0; + + /** + * @breif Gets the status of current streaming source. + * @return The current state machine + */ + virtual STREAMING_SRC_STATE getCurrState() = 0; + + /** + * @brief append the SEI data which can be sent attached to video packet + * @param type SEI type + * @param timestamp the video frame timestamp which attached to + * @param frame_index the video frame timestamp which attached to + * + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int appendSeiData(const InputSeiData& inSeiData) = 0; + + /** + * Registers a media player source observer. + * + * Once the media player source observer is registered, you can use the observer to monitor the state change of the media player. + * @param observer The pointer to the IMediaStreamingSource object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int registerObserver(IMediaStreamingSourceObserver* observer) = 0; + + /** + * Releases the media player source observer. + * @param observer The pointer to the IMediaStreamingSource object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int unregisterObserver(IMediaStreamingSourceObserver* observer) = 0; + + /** + * @brief Parse a media information with a specified URL. + * @param url : The path of the media file. Both the local path and online path are supported. + * @param video_info : The output video information, It means no video track while video_info.streamIndex less than 0 + * @param audio_info : The output audio information, It means no audio track while audio_info.streamIndex less than 0 + * @return + * - 0: Success. + * - < 0: Failure + */ + virtual int parseMediaInfo(const char* url, + media::base::PlayerStreamInfo& video_info, + media::base::PlayerStreamInfo& audio_info) = 0; + +}; + + + +/** + * @brief This observer interface of media streaming source + */ +class IMediaStreamingSourceObserver { + public: + virtual ~IMediaStreamingSourceObserver() {}; + + + /** + * @brief Reports the playback state change. + * When the state of the playback changes, + * the SDK triggers this callback to report the new playback state + * and the reason or error for the change. + * @param state The new playback state after change. See {@link STREAMING_SRC_STATE}. + * @param ec The player's error code. See {@link STREAMINGSRC_ERR}. + */ + virtual void onStateChanged(STREAMING_SRC_STATE state, STREAMING_SRC_ERR err_code) = 0; + + /** + * @brief Triggered when file is opened + * @param err_code The error code + * @return None + */ + virtual void onOpenDone(STREAMING_SRC_ERR err_code) = 0; + + /** + * @brief Triggered when seeking is done + * @param err_code The error code + * @return None + */ + virtual void onSeekDone(STREAMING_SRC_ERR err_code) = 0; + + /** + * @brief Triggered when playing is EOF + * @param progress_ms the progress position + * @param repeat_count means repeated count of playing + */ + virtual void onEofOnce(int64_t progress_ms, int64_t repeat_count) = 0; + + /** + * @brief Reports current playback progress. + * The callback triggered once every one second during the playing status + * @param position_ms Current playback progress (millisecond). + */ + virtual void onProgress(int64_t position_ms) = 0; + + /** + * @brief Occurs when the metadata is received. + * The callback occurs when the player receives the media metadata + * and reports the detailed information of the media metadata. + * @param data The detailed data of the media metadata. + * @param length The data length (bytes). + */ + virtual void onMetaData(const void* data, int length) = 0; + +}; + + + +} //namespace rtc +} // namespace agora + diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMusicContentCenter.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMusicContentCenter.h new file mode 100644 index 0000000..2de2a76 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraMusicContentCenter.h @@ -0,0 +1,539 @@ +// +// Agora Media SDK +// +// Created by FanYuanYuan in 2022-05. +// Copyright (c) 2022 Agora IO. All rights reserved. +// + +#pragma once + +#include "AgoraRefPtr.h" +#include "IAgoraMediaPlayer.h" + +namespace agora { +namespace rtc { + +typedef enum +{ + /** + * 0: No error occurs and preload succeeds. + */ + kPreloadStatusCompleted = 0, + + /** + * 1: A general error occurs. + */ + kPreloadStatusFailed = 1, + + /** + * 2: The media file is preloading. + */ + kPreloadStatusPreloading = 2, + /** + * 3: The media file is removed. + */ + kPreloadStatusRemoved = 3, +} PreloadStatusCode; + +typedef enum +{ + /** + * 0: No error occurs and request succeeds. + */ + kMusicContentCenterStatusOk = 0, + /** + * 1: A general error occurs. + */ + kMusicContentCenterStatusErr = 1, + /** + * 2: The gateway error. There are several possible reasons: + * - Token is expired. Check if your token is expired. + * - Token is invalid. Check the type of token you passed in. + * - Network error. Check your network. + */ + kMusicContentCenterStatusErrGateway = 2, + /** + * 3: Permission and resource error. There are several possible reasons: + * - Your appid may not have the mcc permission. Please contact technical support + * - The resource may not exist. Please contact technical support + */ + kMusicContentCenterStatusErrPermissionAndResource = 3, + /** + * 4: Internal data parse error. Please contact technical support + */ + kMusicContentCenterStatusErrInternalDataParse = 4, + /** + * 5: Music loading error. Please contact technical support + */ + kMusicContentCenterStatusErrMusicLoading = 5, + /** + * 6: Music decryption error. Please contact technical support + */ + kMusicContentCenterStatusErrMusicDecryption = 6, + /** + * 7: Http internal error. suggest retry later. + */ + kMusicContentCenterStatusErHttpInternalError = 7, +} MusicContentCenterStatusCode; + +typedef struct +{ + /** + * Name of the music chart + */ + const char* chartName; + /** + * Id of the music chart, which is used to get music list + */ + int32_t id; +} MusicChartInfo; + +enum MUSIC_CACHE_STATUS_TYPE { + /** + * 0: Music is already cached. + */ + MUSIC_CACHE_STATUS_TYPE_CACHED = 0, + /** + * 1: Music is being cached. + */ + MUSIC_CACHE_STATUS_TYPE_CACHING = 1 +}; + +struct MusicCacheInfo { + /** + * The songCode of music. + */ + int64_t songCode; + /** + * The cache status of the music. + */ + MUSIC_CACHE_STATUS_TYPE status; + MusicCacheInfo():songCode(0), status(MUSIC_CACHE_STATUS_TYPE_CACHED) {} +}; + +class MusicChartCollection : public RefCountInterface { +public: + virtual int getCount() = 0; + virtual MusicChartInfo* get(int index) = 0; +protected: + virtual ~MusicChartCollection() = default; +}; + +struct MvProperty +{ + /** + * The resolution of the mv + */ + const char* resolution; + /** + * The bandwidth of the mv + */ + const char* bandwidth; +}; + +struct ClimaxSegment +{ + /** + * The start time of climax segment + */ + int32_t startTimeMs; + /** + * The end time of climax segment + */ + int32_t endTimeMs; +}; + +struct Music +{ + /** + * The songCode of music + */ + int64_t songCode; + /** + * The name of music + */ + const char* name; + /** + * The singer of music + */ + const char* singer; + /** + * The poster url of music + */ + const char* poster; + /** + * The release time of music + */ + const char* releaseTime; + /** + * The duration (in seconds) of music + */ + int32_t durationS; + /** + * The type of music + * 1, mp3 with instrumental accompaniment and original + * 2, mp3 only with instrumental accompaniment + * 3, mp3 only with original + * 4, mp4 with instrumental accompaniment and original + * 5, mv only + * 6, new type mp4 with instrumental accompaniment and original + * detail at document of music media center + */ + int32_t type; + /** + * The pitch type of music. + * 1, xml lyric has pitch + * 2, lyric has no pitch + */ + int32_t pitchType; + /** + * The number of lyrics available for the music + */ + int32_t lyricCount; + /** + * The lyric list of music + * 0, xml + * 1, lrc + */ + int32_t* lyricList; + /** + * The number of climax segments of the music + */ + int32_t climaxSegmentCount; + /** + * The climax segment list of music + */ + ClimaxSegment* climaxSegmentList; + /** + * The number of mv of the music + * If this value is greater than zero, it means the current music has MV resource + */ + int32_t mvPropertyCount; + /** + * The mv property list of music + */ + MvProperty* mvPropertyList; +}; + +class MusicCollection : public RefCountInterface { +public: + virtual int getCount() = 0; + virtual int getTotal() = 0; + virtual int getPage() = 0; + virtual int getPageSize() = 0; + virtual Music* getMusic(int32_t index) = 0; +protected: + virtual ~MusicCollection() = default; +}; + + +class IMusicContentCenterEventHandler { +public: + /** + * The music chart result callback; occurs when getMusicCharts method is called. + * + * @param requestId The request id is same as that returned by getMusicCharts. + * @param result The result of music chart collection + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onMusicChartsResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode errorCode) = 0; + + /** + * Music collection, occurs when getMusicCollectionByMusicChartId or searchMusic method is called. + * + * @param requestId The request id is same as that returned by getMusicCollectionByMusicChartId or searchMusic + * @param result The result of music collection + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onMusicCollectionResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode errorCode) = 0; + + /** + * Lyric url callback of getLyric, occurs when getLyric is called + * + * @param requestId The request id is same as that returned by getLyric + * @param songCode Song code + * @param lyricUrl The lyric url of this music + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onLyricResult(const char* requestId, int64_t songCode, const char* lyricUrl, MusicContentCenterStatusCode errorCode) = 0; + + /** + * Simple info callback of getSongSimpleInfo, occurs when getSongSimpleInfo is called + * + * @param requestId The request id is same as that returned by getSongSimpleInfo. + * @param songCode Song code + * @param simpleinfo The metadata of the music. + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onSongSimpleInfoResult(const char* requestId, int64_t songCode, const char* simpleInfo, MusicContentCenterStatusCode errorCode) = 0; + + /** + * Preload process callback, occurs when preload is called + * + * @param requestId The request id is same as that returned by preload. + * @param songCode Song code + * @param percent Preload progress (0 ~ 100) + * @param lyricUrl The lyric url of this music + * @param status Preload status; see PreloadStatusCode. + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onPreLoadEvent(const char* requestId, int64_t songCode, int percent, const char* lyricUrl, PreloadStatusCode status, MusicContentCenterStatusCode errorCode) = 0; + + virtual ~IMusicContentCenterEventHandler() {}; +}; + +struct MusicContentCenterConfiguration { + /** + * The app ID of the project that has enabled the music content center + */ + const char *appId; + /** + * Music content center need token to connect with server + */ + const char *token; + /** + * The user ID when using music content center. It can be different from that of the rtc product. + */ + int64_t mccUid; + /** + * The max number which the music content center caches cannot exceed 50. + */ + int32_t maxCacheSize; + /** + * The mccdomain, used to control the domain name of music content center, usually developer do not need to set it. Only under Tech supporter's help, can set the value. + * @technical preview + */ + const char* mccDomain; + /** + * Event handler to get callback result. + */ + IMusicContentCenterEventHandler* eventHandler; + MusicContentCenterConfiguration():appId(nullptr),token(nullptr),eventHandler(nullptr),mccUid(0),maxCacheSize(10), mccDomain(nullptr){} + MusicContentCenterConfiguration(const char*appid,const char* token,int64_t id,IMusicContentCenterEventHandler* handler,int32_t maxSize = 10, const char* apiurl = nullptr): + appId(appid),token(token),mccUid(id),eventHandler(handler),maxCacheSize(maxSize), mccDomain(apiurl){} +}; + +class IMusicPlayer : public IMediaPlayer { +protected: + virtual ~IMusicPlayer() {}; + +public: + IMusicPlayer() {}; + using IMediaPlayer::open; + /** + * Open a media file with specified parameters. + * + * @param songCode The identifier of the media file that you want to play. + * @param startPos The playback position (ms) of the music file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int open(int64_t songCode, int64_t startPos = 0) = 0; +}; + +class IMusicContentCenter +{ +protected: + virtual ~IMusicContentCenter(){}; +public: + IMusicContentCenter() {}; + + /** + * Initializes the IMusicContentCenter + * Set token of music content center and other params + * + * @param configuration + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initialize(const MusicContentCenterConfiguration & configuration) = 0; + + /** + * Renew token of music content center + * + * @param token The new token. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int renewToken(const char* token) = 0; + + /** + * release music content center resource. + * + */ + virtual void release() = 0; + + /** + * register event handler. + */ + virtual int registerEventHandler(IMusicContentCenterEventHandler* eventHandler) = 0; + + /** + * unregister event handler. + */ + virtual int unregisterEventHandler() = 0; + + /** + * Creates a music player source object and return its pointer. + * @return + * - The pointer to \ref rtc::IMusicPlayer "IMusicPlayer", + * if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ + virtual agora_refptr createMusicPlayer() = 0; + + /** + * Get music chart collection of music. + * If the method call succeeds, get result from the + * \ref agora::rtc::IMusicContentCenterEventHandler::onMusicChartsResult + * "onMusicChartsResult" callback + * @param requestId The request id you will get of this query, format is uuid. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMusicCharts(agora::util::AString& requestId) = 0; + + /** + * Get music collection of the music chart by musicChartId and page info. + * If the method call success, get result from the + * \ref agora::rtc::IMusicContentCenterEventHandler::onMusicCollectionResult + * "onMusicCollectionResult" callback + * @param requestId The request id you will get of this query, format is uuid. + * @param musicChartId The music chart id obtained from getMusicCharts. + * @param page The page of the music chart, starting from 1 + * @param pageSize The page size, max is 50. + * @param jsonOption The ext param, default is null. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMusicCollectionByMusicChartId(agora::util::AString& requestId, int32_t musicChartId, int32_t page, int32_t pageSize, const char* jsonOption = nullptr) = 0; + + /** + * Search music by keyword and page info. + * If the method call success, get result from the + * \ref agora::rtc::IMusicContentCenterEventHandler::onMusicCollectionResult + * "onMusicCollectionResult" callback + * @param requestId The request id you will get of this query, format is uuid. + * @param keyWord The key word to search. + * @param page The page of music search result , start from 1. + * @param pageSize The page size, max is 50. + * @param jsonOption The ext param, default is null. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int searchMusic(agora::util::AString& requestId, const char* keyWord, int32_t page, int32_t pageSize, const char* jsonOption = nullptr) = 0; + + /** + * Preload a media file with specified parameters. + * + * @deprecated This method is deprecated. Use preload(int64_t songCode) instead. + * + * @param songCode The identifier of the media file that you want to play. + * @param jsonOption The ext param, default is null. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preload(int64_t songCode, const char* jsonOption) __deprecated = 0; + + /** + * Preload a media file with specified parameters. + * + * @param requestId The request id you will get of this query, format is uuid. + * @param songCode The identifier of the media file that you want to play. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preload(agora::util::AString& requestId, int64_t songCode) = 0; + + /** + * Remove a media file cache + * + * @param songCode The identifier of the media file that you want to play. + * @return + * - 0: Success; the cached media file is removed. + * - < 0: Failure. + */ + virtual int removeCache(int64_t songCode) = 0; + + /** + * Get cached media files. + * Before calling this API, you should allocate a memory buffer that stores the cached media file information, and pass the pointer of the buffer as the input parameter cacheInfo, and set the size of the memory buffer to cacheInfoSize. + * The sample code below illustrates how to request the cached media file information: + * + * cacheInfoSize = 10 // Allocate a memory buffer of 10 MusicCacheInfo size + * agora::rtc::MusicCacheInfo *infos = new agora::rtc::MusicCacheInfo[cacheInfoSize]; + * int ret = self.imcc->getCaches(infos, cacheInfoSize); + * if (ret < 0) { // error occurred! + * return; + * } + * std::cout << "the cache size:" << cacheInfoSize << std::endl; // The cache size: 5 + * + * + * @param cacheInfo An output parameter; A pointer to the memory buffer that stores the cached media file information. The memory buffer pointed to by cacheInfo should be allocated by yourself before calling this API. + * @param cacheInfoSize + * - Input: The number of MusicCacheInfo's size that you get from the memory. + * - Output: The actual number of MusicCacheInfo struct that is returned. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getCaches(MusicCacheInfo *cacheInfo, int32_t* cacheInfoSize) = 0; + + /** + * Check if the media file is preloaded + * + * @param songCode The identifier of the media file that you want to play. + * @return + * - 0: Success, file is preloaded. + * - < 0: Failure. + */ + virtual int isPreloaded(int64_t songCode) = 0; + + /** + * Get lyric of the music. + * + * @param requestId The request id you will get of this query, format is uuid. + * @param songCode The identifier of the media file that you want to play. + * @param LyricType The type of the lyric file. 0:xml or 1:lrc. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getLyric(agora::util::AString& requestId, int64_t songCode, int32_t LyricType = 0) = 0; + + /** + * Gets the metadata of a specific music. Once this method is called, the SDK triggers the onSongSimpleInfoResult callback to report the metadata of the music. + * + * @param requestId The request id you will get of this query, format is uuid. + * @param songCode The identifier of the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getSongSimpleInfo(agora::util::AString& requestId, int64_t songCode) = 0; + + /** + * Get internal songCodeKey from songCode and jsonOption + * + * @param songCode The identifier of the media file. + * @param jsonOption An extention parameter. The default value is null. it’s a json-format string and the `key` and `value` can be customized according to your scenarios. + * @param internalSongCode The identifier of internal + * @return + * - 0: Success. + * - < 0: Failure. + */ + + virtual int getInternalSongCode(int64_t songCode, const char* jsonOption, int64_t& internalSongCode) = 0; + +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraParameter.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraParameter.h new file mode 100644 index 0000000..70ea593 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraParameter.h @@ -0,0 +1,307 @@ +// +// Agora Engine SDK +// +// Created by minbo in 2019-10. +// Copyright (c) 2019 Agora.io. All rights reserved. + +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#pragma once // NOLINT(build/header_guard) + +// external key +/** + * set the range of ports available for connection + * @example "{\"rtc.udp_port_range\":[4500, 5000]}" + */ +#define KEY_RTC_UDP_PORT_RANGE "rtc.udp_port_range" +/** + * set the list of ports available for connection + * @example "{\"rtc.udp_port_list\":[4501, 4502, 4503, 4504, 4505, 4506]}" + */ +#define KEY_RTC_UDP_PORT_LIST "rtc.udp_port_list" + +/** + * get the fd of sending socket available for connection + * note: set method is not supported. + */ +#define KEY_RTC_UDP_SEND_FD "rtc.udp_send_fd" + + /** + * set the video encoder mode (hardware or software) + */ +#define KEY_RTC_VIDEO_ENABLED_HW_ENCODER "engine.video.enable_hw_encoder" +#define KEY_RTC_VIDEO_HARDWARE_ENCODEING "che.hardware_encoding" +#define KEY_RTC_VIDEO_H264_HWENC "che.video.h264.hwenc" + /** + * set the hardware video encoder provider (nv for nvidia or qsv for intel) + */ +#define KEY_RTC_VIDEO_HW_ENCODER_PROVIDER "engine.video.hw_encoder_provider" + + /** + * set the video decoder mode (hardware or software) + */ +#define KEY_RTC_VIDEO_ENABLED_HW_DECODER "engine.video.enable_hw_decoder" +#define KEY_RTC_VIDEO_HARDWARE_DECODING "che.hardware_decoding" + + /** + * set the hardware video decoder provider (h264_cuvid(default) or h264_qsv) + */ +#define KEY_RTC_VIDEO_HW_DECODER_PROVIDER "engine.video.hw_decoder_provider" + + /** + * override the lua policy + */ +#define KEY_RTC_VIDEO_OVERRIDE_SMALLVIDEO_NOT_USE_HWENC_POLICY "engine.video.override_smallvideo_not_use_hwenc_policy" + +/** + * enable/disable video packet retransmission, enabled by default + */ +#define KEY_RTC_VIDEO_RESEND "rtc.video_resend" + +/** + * enable/disable audio packet retransmission, enabled by default +*/ +#define KEY_RTC_AUDIO_RESEND "rtc.audio_resend" + +/** + * set the bitrate ratio for video +*/ +#define KEY_RTC_VIDEO_BITRATE_ADJUST_RATIO "rtc.video.bitrate_adjust_ratio" + +/** + * set the minbitrate / bitrate ratio for video +*/ +#define KEY_RTC_VIDEO_MINBITRATE_RATIO "rtc.video.minbitrate_ratio" + +/** + * set the degradation preference +*/ +#define KEY_RTC_VIDEO_DEGRADATION_PREFERENCE "rtc.video.degradation_preference" + +/** + * set the degradation fps down step +*/ + +#define KEY_RTC_VIDEO_DEGRADATION_FPS_DOWN_STEP "rtc.video.degradation_fps_down_step" +/** + * set the degradation fps up step +*/ +#define KEY_RTC_VIDEO_DEGRADATION_FPS_UP_STEP "rtc.video.degradation_fps_up_step" + +/** + * set the duration ms for connection lost callback +*/ +#define KEY_RTC_CONNECTION_LOST_PERIOD "rtc.connection_lost_period" + +/** + * set the local ip +*/ +#define KEY_RTC_LOCAL_IP "rtc.local.ip" + +/** + * set the network interface +*/ +#define KEY_RTC_NETWORK_INTERFACE "rtc.network.interface" + +/** + * set the video codec type, such as "H264", "JPEG" + */ +#define KEY_RTC_VIDEO_CODEC_TYPE "engine.video.codec_type" +#define KEY_RTC_VIDEO_CODEC_INDEX "che.video.videoCodecIndex" +/** + * only use average QP for quality scaling +*/ +#define KEY_RTC_VIDEO_QUALITY_SCALE_ONLY_ON_AVERAGE_QP "engine.video.quality_scale_only_on_average_qp" + +/** + * low bound for quality scaling +*/ +#define KEY_RTC_VIDEO_H264_QP_THRESHOLD_LOW "engine.video.h264_qp_thresholds_low" + +/** + * high bound for quality scaling +*/ +#define KEY_RTC_VIDEO_H264_QP_THRESHOLD_HIGH "engine.video.h264_qp_thresholds_high" + + +namespace agora { + +namespace util { +template +class CopyableAutoPtr; + +class IString; +typedef CopyableAutoPtr AString; +} // namespace util + +namespace base { + +class IAgoraParameter { + public: + /** + * release the resource + */ + virtual void release() = 0; + + /** + * set bool value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setBool(const char* key, bool value) = 0; + + /** + * set int value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setInt(const char* key, int value) = 0; + + /** + * set unsigned int value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setUInt(const char* key, unsigned int value) = 0; + + /** + * set double value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setNumber(const char* key, double value) = 0; + + /** + * set string value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setString(const char* key, const char* value) = 0; + + /** + * set object value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setObject(const char* key, const char* value) = 0; + + /** + * set array value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setArray(const char* key, const char* value) = 0; + /** + * get bool value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getBool(const char* key, bool& value) = 0; + + /** + * get int value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getInt(const char* key, int& value) = 0; + + /** + * get unsigned int value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getUInt(const char* key, unsigned int& value) = 0; + + /** + * get double value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getNumber(const char* key, double& value) = 0; + + /** + * get string value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getString(const char* key, agora::util::AString& value) = 0; + + /** + * get a child object value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getObject(const char* key, agora::util::AString& value) = 0; + + /** + * get array value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getArray(const char* key, const char* args, agora::util::AString& value) = 0; + + /** + * set parameters of the sdk or engine + * @param [in] parameters + * the parameters + * @return return 0 if success or an error code + */ + virtual int setParameters(const char* parameters) = 0; + + virtual int convertPath(const char* filePath, agora::util::AString& value) = 0; + + virtual ~IAgoraParameter() {} +}; + +} // namespace base +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRhythmPlayer.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRhythmPlayer.h new file mode 100644 index 0000000..b39322a --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRhythmPlayer.h @@ -0,0 +1,92 @@ +// +// Agora SDK +// +// Copyright (c) 2021 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace base { +class IAgoraService; +} + +namespace rtc { +class ILocalAudioTrack; +class IRtcEngineEventHandler; + +/** + The states of the rhythm player. + */ +enum RHYTHM_PLAYER_STATE_TYPE { + /** 810: The rhythm player is idle. */ + RHYTHM_PLAYER_STATE_IDLE = 810, + /** 811: The rhythm player is opening files. */ + RHYTHM_PLAYER_STATE_OPENING, + /** 812: Files opened successfully, the rhythm player starts decoding files. */ + RHYTHM_PLAYER_STATE_DECODING, + /** 813: Files decoded successfully, the rhythm player starts mixing the two files and playing back them locally. */ + RHYTHM_PLAYER_STATE_PLAYING, + /** 814: The rhythm player is starting to fail, and you need to check the error code for detailed failure reasons. */ + RHYTHM_PLAYER_STATE_FAILED, +}; + +/** + The error codes of the rhythm player. + */ +enum RHYTHM_PLAYER_ERROR_TYPE { + /** 0: The rhythm player works well. */ + RHYTHM_PLAYER_ERROR_OK = 0, + /** 1: The rhythm player occurs a internal error. */ + RHYTHM_PLAYER_ERROR_FAILED = 1, + /** 801: The rhythm player can not open the file. */ + RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN = 801, + /** 802: The rhythm player can not play the file. */ + RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY, + /** 803: The file duration over the limit. The file duration limit is 1.2 seconds */ + RHYTHM_PLAYER_ERROR_FILE_OVER_DURATION_LIMIT, +}; + +/** + * The configuration of rhythm player, + * which is set in startRhythmPlayer or configRhythmPlayer. + */ +struct AgoraRhythmPlayerConfig { + /** + * The number of beats per measure. The range is 1 to 9. + * The default value is 4, + * which means that each measure contains one downbeat and three upbeats. + */ + int beatsPerMeasure; + /* + * The range is 60 to 360. + * The default value is 60, + * which means that the rhythm player plays 60 beats in one minute. + */ + int beatsPerMinute; + + AgoraRhythmPlayerConfig() : beatsPerMeasure(4), beatsPerMinute(60) {} +}; + +/** + * The IRhythmPlayer class provides access to a rhythm player entity. + * A rhythm player synthesizes beats, plays them locally, and pushes them remotely. + */ +class IRhythmPlayer : public RefCountInterface { +protected: + virtual ~IRhythmPlayer() {} + +public: + static agora_refptr Create(); + virtual int initialize(base::IAgoraService* agora_service, IRtcEngineEventHandler* event_handler, bool is_pass_thru_mode) = 0; + virtual int playRhythm(const char* sound1, const char* sound2, const AgoraRhythmPlayerConfig& config) = 0; + virtual int stopRhythm() = 0; + virtual int configRhythmPlayer(const AgoraRhythmPlayerConfig& config) = 0; + virtual agora_refptr getRhythmPlayerTrack() = 0; +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtcEngine.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtcEngine.h new file mode 100644 index 0000000..b5a0903 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtcEngine.h @@ -0,0 +1,8581 @@ +// +// Agora Rtc Engine SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// +#pragma once + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "IAgoraLog.h" +#include "AgoraOptional.h" +#include "IAudioDeviceManager.h" +#include "IAgoraRhythmPlayer.h" +#include "IAgoraMediaEngine.h" + +namespace agora { +namespace rtc { + +template +static void SetFrom(Optional* s, const Optional& o) { + if (o) { + *s = o; + } +} + +template +static void ReplaceBy(Optional* s, const Optional& o) { + *s = o; +} + +//class IAudioDeviceManager; + +/** + * The media device types. + */ +enum MEDIA_DEVICE_TYPE { + /** + * -1: Unknown device type. + */ + UNKNOWN_AUDIO_DEVICE = -1, + /** + * 0: The audio playback device. + */ + AUDIO_PLAYOUT_DEVICE = 0, + /** + * 1: The audio recording device. + */ + AUDIO_RECORDING_DEVICE = 1, + /** + * 2: The video renderer. + */ + VIDEO_RENDER_DEVICE = 2, + /** + * 3: The video capturer. + */ + VIDEO_CAPTURE_DEVICE = 3, + /** + * 4: The audio playback device of the app. + */ + AUDIO_APPLICATION_PLAYOUT_DEVICE = 4, +}; + +/** + The playback state of the music file. + */ +enum AUDIO_MIXING_STATE_TYPE { + /** 710: The music file is playing. */ + AUDIO_MIXING_STATE_PLAYING = 710, + /** 711: The music file pauses playing. */ + AUDIO_MIXING_STATE_PAUSED = 711, + /** 713: The music file stops playing. */ + AUDIO_MIXING_STATE_STOPPED = 713, + /** 714: An error occurs during the playback of the audio mixing file. + */ + AUDIO_MIXING_STATE_FAILED = 714, +}; + +/** + The reson codes of the local user's audio mixing file. + */ +enum AUDIO_MIXING_REASON_TYPE { + /** 701: The SDK cannot open the audio mixing file. */ + AUDIO_MIXING_REASON_CAN_NOT_OPEN = 701, + /** 702: The SDK opens the audio mixing file too frequently. */ + AUDIO_MIXING_REASON_TOO_FREQUENT_CALL = 702, + /** 703: The audio mixing file playback is interrupted. */ + AUDIO_MIXING_REASON_INTERRUPTED_EOF = 703, + /** 715: The audio mixing file is played once. */ + AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED = 721, + /** 716: The audio mixing file is all played out. */ + AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED = 723, + /** 716: The audio mixing file stopped by user */ + AUDIO_MIXING_REASON_STOPPED_BY_USER = 724, + /** 0: The SDK can open the audio mixing file. */ + AUDIO_MIXING_REASON_OK = 0, +}; + +/** + * The status of importing an external video stream in a live broadcast. + */ +enum INJECT_STREAM_STATUS { + /** + * 0: The media stream is injected successfully. + */ + INJECT_STREAM_STATUS_START_SUCCESS = 0, + /** + * 1: The media stream already exists. + */ + INJECT_STREAM_STATUS_START_ALREADY_EXISTS = 1, + /** + * 2: The media stream injection is unauthorized. + */ + INJECT_STREAM_STATUS_START_UNAUTHORIZED = 2, + /** + * 3: Timeout occurs when injecting a media stream. + */ + INJECT_STREAM_STATUS_START_TIMEDOUT = 3, + /** + * 4: The media stream injection fails. + */ + INJECT_STREAM_STATUS_START_FAILED = 4, + /** + * 5: The media stream stops being injected successfully. + */ + INJECT_STREAM_STATUS_STOP_SUCCESS = 5, + /** + * 6: The media stream injection that you want to stop is found. + */ + INJECT_STREAM_STATUS_STOP_NOT_FOUND = 6, + /** + * 7: You are not authorized to stop the media stream injection. + */ + INJECT_STREAM_STATUS_STOP_UNAUTHORIZED = 7, + /** + * 8: Timeout occurs when you stop injecting the media stream. + */ + INJECT_STREAM_STATUS_STOP_TIMEDOUT = 8, + /** + * 9: Stopping injecting the media stream fails. + */ + INJECT_STREAM_STATUS_STOP_FAILED = 9, + /** + * 10: The media stream is broken. + */ + INJECT_STREAM_STATUS_BROKEN = 10, +}; + +/** + * The audio equalization band frequency. + */ +enum AUDIO_EQUALIZATION_BAND_FREQUENCY { + /** + * 0: 31 Hz. + */ + AUDIO_EQUALIZATION_BAND_31 = 0, + /** + * 1: 62 Hz. + */ + AUDIO_EQUALIZATION_BAND_62 = 1, + /** + * 2: 125 Hz. + */ + AUDIO_EQUALIZATION_BAND_125 = 2, + /** + * 3: 250 Hz. + */ + AUDIO_EQUALIZATION_BAND_250 = 3, + /** + * 4: 500 Hz. + */ + AUDIO_EQUALIZATION_BAND_500 = 4, + /** + * 5: 1 KHz. + */ + AUDIO_EQUALIZATION_BAND_1K = 5, + /** + * 6: 2 KHz. + */ + AUDIO_EQUALIZATION_BAND_2K = 6, + /** + * 7: 4 KHz. + */ + AUDIO_EQUALIZATION_BAND_4K = 7, + /** + * 8: 8 KHz. + */ + AUDIO_EQUALIZATION_BAND_8K = 8, + /** + * 9: 16 KHz. + */ + AUDIO_EQUALIZATION_BAND_16K = 9, +}; + +/** + * The audio reverberation type. + */ +enum AUDIO_REVERB_TYPE { + /** + * 0: (-20 to 10 dB), the level of the dry signal. + */ + AUDIO_REVERB_DRY_LEVEL = 0, + /** + * 1: (-20 to 10 dB), the level of the early reflection signal (wet signal). + */ + AUDIO_REVERB_WET_LEVEL = 1, + /** + * 2: (0 to 100 dB), the room size of the reflection. + */ + AUDIO_REVERB_ROOM_SIZE = 2, + /** + * 3: (0 to 200 ms), the length of the initial delay of the wet signal in ms. + */ + AUDIO_REVERB_WET_DELAY = 3, + /** + * 4: (0 to 100), the strength of the late reverberation. + */ + AUDIO_REVERB_STRENGTH = 4, +}; + +enum STREAM_FALLBACK_OPTIONS { + /** 0: No fallback operation for the stream when the network + condition is poor. The stream quality cannot be guaranteed. */ + + STREAM_FALLBACK_OPTION_DISABLED = 0, + /** 1: (Default) Under poor network conditions, the SDK will send or receive + agora::rtc::VIDEO_STREAM_LOW. You can only set this option in + RtcEngineParameters::setRemoteSubscribeFallbackOption. Nothing happens when + you set this in RtcEngineParameters::setLocalPublishFallbackOption. */ + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW = 1, + /** 2: Under poor network conditions, the SDK may receive + agora::rtc::VIDEO_STREAM_LOW first, but if the network still does + not allow displaying the video, the SDK will send or receive audio only. */ + STREAM_FALLBACK_OPTION_AUDIO_ONLY = 2, +}; + +enum PRIORITY_TYPE { + /** 50: High priority. + */ + PRIORITY_HIGH = 50, + /** 100: (Default) normal priority. + */ + PRIORITY_NORMAL = 100, +}; + +/** Statistics of the local video stream. + */ +struct LocalVideoStats +{ + /** + * ID of the local user. + */ + uid_t uid; + /** The actual bitrate (Kbps) while sending the local video stream. + * @note This value does not include the bitrate for resending the video after packet loss. + */ + int sentBitrate; + /** The actual frame rate (fps) while sending the local video stream. + * @note This value does not include the frame rate for resending the video after packet loss. + */ + int sentFrameRate; + /** The capture frame rate (fps) of the local video. + */ + int captureFrameRate; + /** The width of the capture frame (px). + */ + int captureFrameWidth; + /** The height of the capture frame (px). + */ + int captureFrameHeight; + /** + * The regulated frame rate of capture frame rate according to video encoder configuration. + */ + int regulatedCaptureFrameRate; + /** + * The regulated frame width (pixel) of capture frame width according to video encoder configuration. + */ + int regulatedCaptureFrameWidth; + /** + * The regulated frame height (pixel) of capture frame height according to video encoder configuration. + */ + int regulatedCaptureFrameHeight; + /** The output frame rate (fps) of the local video encoder. + */ + int encoderOutputFrameRate; + /** The width of the encoding frame (px). + */ + int encodedFrameWidth; + /** The height of the encoding frame (px). + */ + int encodedFrameHeight; + /** The output frame rate (fps) of the local video renderer. + */ + int rendererOutputFrameRate; + /** The target bitrate (Kbps) of the current encoder. This is an estimate made by the SDK based on the current network conditions. + */ + int targetBitrate; + /** The target frame rate (fps) of the current encoder. + */ + int targetFrameRate; + /** Quality adaption of the local video stream in the reported interval (based on the target frame + * rate and target bitrate). See #QUALITY_ADAPT_INDICATION. + */ + QUALITY_ADAPT_INDICATION qualityAdaptIndication; + /** The bitrate (Kbps) while encoding the local video stream. + * @note This value does not include the bitrate for resending the video after packet loss. + */ + int encodedBitrate; + /** The number of the sent video frames, represented by an aggregate value. + */ + int encodedFrameCount; + /** The codec type of the local video. See #VIDEO_CODEC_TYPE. + */ + VIDEO_CODEC_TYPE codecType; + /** + * The video packet loss rate (%) from the local client to the Agora server before applying the anti-packet loss strategies. + */ + unsigned short txPacketLossRate; + /** The brightness level of the video image captured by the local camera. See #CAPTURE_BRIGHTNESS_LEVEL_TYPE. + */ + CAPTURE_BRIGHTNESS_LEVEL_TYPE captureBrightnessLevel; + /** + * Whether we send dual stream now. + */ + bool dualStreamEnabled; + /** The hwEncoderAccelerating of the local video: + * - software = 0. + * - hardware = 1. + */ + int hwEncoderAccelerating; +}; + + +/** + * Audio statistics of the remote user. + */ +struct RemoteAudioStats +{ + /** + * User ID of the remote user sending the audio stream. + */ + uid_t uid; + /** + * The quality of the remote audio: #QUALITY_TYPE. + */ + int quality; + /** + * The network delay (ms) from the sender to the receiver. + */ + int networkTransportDelay; + /** + * The network delay (ms) from the receiver to the jitter buffer. + * @note When the receiving end is an audience member and `audienceLatencyLevel` of `ClientRoleOptions` + * is 1, this parameter does not take effect. + */ + int jitterBufferDelay; + /** + * The audio frame loss rate in the reported interval. + */ + int audioLossRate; + /** + * The number of channels. + */ + int numChannels; + /** + * The sample rate (Hz) of the remote audio stream in the reported interval. + */ + int receivedSampleRate; + /** + * The average bitrate (Kbps) of the remote audio stream in the reported + * interval. + */ + int receivedBitrate; + /** + * The total freeze time (ms) of the remote audio stream after the remote + * user joins the channel. + * + * In a session, audio freeze occurs when the audio frame loss rate reaches 4%. + */ + int totalFrozenTime; + /** + * The total audio freeze time as a percentage (%) of the total time when the + * audio is available. + */ + int frozenRate; + /** + * The quality of the remote audio stream as determined by the Agora + * real-time audio MOS (Mean Opinion Score) measurement method in the + * reported interval. The return value ranges from 0 to 500. Dividing the + * return value by 100 gets the MOS score, which ranges from 0 to 5. The + * higher the score, the better the audio quality. + * + * | MOS score | Perception of audio quality | + * |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | Greater than 4 | Excellent. The audio sounds clear and smooth. | + * | From 3.5 to 4 | Good. The audio has some perceptible impairment, but still sounds clear. | + * | From 3 to 3.5 | Fair. The audio freezes occasionally and requires attentive listening. | + * | From 2.5 to 3 | Poor. The audio sounds choppy and requires considerable effort to understand. | + * | From 2 to 2.5 | Bad. The audio has occasional noise. Consecutive audio dropouts occur, resulting in some information loss. The users can communicate only with difficulty. | + * | Less than 2 | Very bad. The audio has persistent noise. Consecutive audio dropouts are frequent, resulting in severe information loss. Communication is nearly impossible. | + */ + int mosValue; + /** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ + int totalActiveTime; + /** + * The total publish duration (ms) of the remote audio stream. + */ + int publishDuration; + /** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. See #EXPERIENCE_QUALITY_TYPE. + */ + int qoeQuality; + /** + * The reason for poor QoE of the local user when receiving a remote audio stream. See #EXPERIENCE_POOR_REASON. + */ + int qualityChangedReason; + /** + * The total number of audio bytes received (bytes), inluding the FEC bytes, represented by an aggregate value. + */ + unsigned int rxAudioBytes; + /** + * The end-to-end delay (ms) from the sender to the receiver. + */ + int e2eDelay; + + RemoteAudioStats() : + uid(0), + quality(0), + networkTransportDelay(0), + jitterBufferDelay(0), + audioLossRate(0), + numChannels(0), + receivedSampleRate(0), + receivedBitrate(0), + totalFrozenTime(0), + frozenRate(0), + mosValue(0), + totalActiveTime(0), + publishDuration(0), + qoeQuality(0), + qualityChangedReason(0), + rxAudioBytes(0), + e2eDelay(0) {} +}; + +/** + * The statistics of the remote video stream. + */ +struct RemoteVideoStats { + /** + * ID of the remote user sending the video stream. + */ + uid_t uid; + /** + * @deprecated Time delay (ms). + * + * In scenarios where audio and video is synchronized, you can use the + * value of `networkTransportDelay` and `jitterBufferDelay` in `RemoteAudioStats` + * to know the delay statistics of the remote video. + */ + int delay __deprecated; + /** + * The width (pixels) of the video stream. + */ + int width; + /** + * The height (pixels) of the video stream. + */ + int height; + /** + * Bitrate (Kbps) received since the last count. + */ + int receivedBitrate; + /** The decoder output frame rate (fps) of the remote video. + */ + int decoderOutputFrameRate; + /** The render output frame rate (fps) of the remote video. + */ + int rendererOutputFrameRate; + /** The video frame loss rate (%) of the remote video stream in the reported interval. + */ + int frameLossRate; + /** Packet loss rate (%) of the remote video stream after using the anti-packet-loss method. + */ + int packetLossRate; + /** + * The type of the remote video stream: #VIDEO_STREAM_TYPE. + */ + VIDEO_STREAM_TYPE rxStreamType; + /** + The total freeze time (ms) of the remote video stream after the remote user joins the channel. + In a video session where the frame rate is set to no less than 5 fps, video freeze occurs when + the time interval between two adjacent renderable video frames is more than 500 ms. + */ + int totalFrozenTime; + /** + The total video freeze time as a percentage (%) of the total time when the video is available. + */ + int frozenRate; + /** + The offset (ms) between audio and video stream. A positive value indicates the audio leads the + video, and a negative value indicates the audio lags the video. + */ + int avSyncTimeMs; + /** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ + int totalActiveTime; + /** + * The total publish duration (ms) of the remote audio stream. + */ + int publishDuration; + /** + * The quality of the remote video stream in the reported interval. + * The quality is determined by the Agora real-time video MOS (Mean Opinion Score) measurement method. + * The return value range is [0, 500]. + * Dividing the return value by 100 gets the MOS score, which ranges from 0 to 5. The higher the score, the better the video quality. + * @note For textured video data, this parameter always returns 0. + */ + int mosValue; + /** + * The total number of video bytes received (bytes), inluding the FEC bytes, represented by an aggregate value. + */ + unsigned int rxVideoBytes; +}; + +struct VideoCompositingLayout { + struct Region { + /** User ID of the user whose video is to be displayed in the region. + */ + uid_t uid; + /** Horizontal position of the region on the screen. + */ + double x; // [0,1] + /** Vertical position of the region on the screen. + */ + double y; // [0,1] + /** + Actual width of the region. + */ + double width; // [0,1] + /** Actual height of the region. */ + double height; // [0,1] + /** 0 means the region is at the bottom, and 100 means the region is at the + * top. + */ + int zOrder; // optional, [0, 100] //0 (default): bottom most, 100: top most + + /** 0 means the region is transparent, and 1 means the region is opaque. The + * default value is 1.0. + */ + double alpha; + + media::base::RENDER_MODE_TYPE + renderMode; // RENDER_MODE_HIDDEN: Crop, RENDER_MODE_FIT: Zoom to fit + + Region() + : uid(0), + x(0), + y(0), + width(0), + height(0), + zOrder(0), + alpha(1.0), + renderMode(media::base::RENDER_MODE_HIDDEN) {} + }; + + /** Ignore this parameter. The width of the canvas is set by + agora::rtc::IRtcEngine::configPublisher, and not by + agora::rtc::VideoCompositingLayout::canvasWidth. + */ + int canvasWidth; + /** Ignore this parameter. The height of the canvas is set by + agora::rtc::IRtcEngine::configPublisher, and not by + agora::rtc::VideoCompositingLayout::canvasHeight. + */ + int canvasHeight; + /** Enter any of the 6-digit symbols defined in RGB. + */ + const char* backgroundColor; // e.g. "#C0C0C0" in RGB + /** Region array. Each host in the channel can have a region to display the + * video on the screen. + */ + const Region* regions; + /** Number of users in the channel. + */ + int regionCount; + /** User-defined data. + */ + const char* appData; + /** Length of the user-defined data. + */ + int appDataLength; + + VideoCompositingLayout() + : canvasWidth(0), + canvasHeight(0), + backgroundColor(NULL), + regions(NULL), + regionCount(0), + appData(NULL), + appDataLength(0) {} +}; + +/** The definition of InjectStreamConfig. + */ +struct InjectStreamConfig { + /** Width of the stream to be added into the broadcast. The default value is + 0; same width as the original stream. + */ + int width; + /** Height of the stream to be added into the broadcast. The default value is + 0; same height as the original stream. + */ + int height; + /** Video GOP of the stream to be added into the broadcast. The default value + is 30. + */ + int videoGop; + /** Video frame rate of the stream to be added into the broadcast. The + default value is 15 fps. + */ + int videoFramerate; + /** Video bitrate of the stream to be added into the broadcast. The default + value is 400 Kbps. + */ + int videoBitrate; + /** Audio-sampling rate of the stream to be added into the broadcast: + #AUDIO_SAMPLE_RATE_TYPE. The default value is 48000. + */ + AUDIO_SAMPLE_RATE_TYPE audioSampleRate; + /** Audio bitrate of the stream to be added into the broadcast. The default + value is 48. + */ + int audioBitrate; + /** Audio channels to be added into the broadcast. The default value is 1. + */ + int audioChannels; + + // width / height default set to 0 means pull the stream with its original + // resolution + InjectStreamConfig() + : width(0), + height(0), + videoGop(30), + videoFramerate(15), + videoBitrate(400), + audioSampleRate(AUDIO_SAMPLE_RATE_48000), + audioBitrate(48), + audioChannels(1) {} +}; + +/** The video stream lifecycle of CDN Live. + */ +enum RTMP_STREAM_LIFE_CYCLE_TYPE { + /** Bound to the channel lifecycle. + */ + RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL = 1, + /** Bound to the owner identity of the RTMP stream. + */ + RTMP_STREAM_LIFE_CYCLE_BIND2OWNER = 2, +}; + +/** The definition of PublisherConfiguration. +*/ +struct PublisherConfiguration { + /** Width of the output data stream set for CDN Live. The default value is + 360. + */ + int width; + /** Height of the output data stream set for CDN Live. The default value is + 640. + */ + int height; + /** Frame rate of the output data stream set for CDN Live. The default value + is 15 fps. + */ + int framerate; + /** Bitrate of the output data stream set for CDN Live. The default value is + 500 Kbps. + */ + int bitrate; + /** The default layout: + - 0: Tile horizontally + - 1: Layered windows + - 2: Tile vertically + */ + int defaultLayout; + /** The video stream lifecycle of CDN Live: RTMP_STREAM_LIFE_CYCLE_TYPE + */ + int lifecycle; + /** Whether the current user is the owner of the RTMP stream: + - True: Yes (default). The push-stream configuration takes effect. + - False: No. The push-stream configuration will not work. + */ + bool owner; + /** Width of the stream to be injected. Set it as 0. + */ + int injectStreamWidth; + /** Height of the stream to be injected. Set it as 0. + */ + int injectStreamHeight; + /** URL address of the stream to be injected to the channel. + */ + const char* injectStreamUrl; + /** Push-stream URL address for the picture-in-picture layouts. The default + value is NULL. + */ + const char* publishUrl; + /** Push-stream URL address of the original stream which does not require + picture-blending. The default value is NULL. + */ + const char* rawStreamUrl; + /** Reserved field. The default value is NULL. + */ + const char* extraInfo; + + PublisherConfiguration() + : width(640), + height(360), + framerate(15), + bitrate(500), + defaultLayout(1), + lifecycle(RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL), + owner(true), + injectStreamWidth(0), + injectStreamHeight(0), + injectStreamUrl(NULL), + publishUrl(NULL), + rawStreamUrl(NULL), + extraInfo(NULL) {} +}; + +/** + * The camera direction. + */ +enum CAMERA_DIRECTION { + /** The rear camera. */ + CAMERA_REAR = 0, + /** The front camera. */ + CAMERA_FRONT = 1, +}; + +/** The cloud proxy type. + * + * @since v3.3.0 + */ +enum CLOUD_PROXY_TYPE { + /** 0: Do not use the cloud proxy. + */ + NONE_PROXY = 0, + /** 1: The cloud proxy for the UDP protocol. + */ + UDP_PROXY = 1, + /// @cond + /** 2: The cloud proxy for the TCP (encrypted) protocol. + */ + TCP_PROXY = 2, + /// @endcond +}; + +/** Camera capturer configuration.*/ +struct CameraCapturerConfiguration { + /** Camera direction settings (for Android/iOS only). See: #CAMERA_DIRECTION. */ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + /** + * The camera direction. + */ + CAMERA_DIRECTION cameraDirection; +#else + /** For windows. The device ID of the playback device. The maximum length is #MAX_DEVICE_ID_LENGTH. */ + char deviceId[MAX_DEVICE_ID_LENGTH]; +#endif + /** The video format. See VideoFormat. */ + VideoFormat format; + bool followEncodeDimensionRatio; + CameraCapturerConfiguration() : followEncodeDimensionRatio(true) { +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + cameraDirection = CAMERA_REAR; +#else + memset(deviceId, 0, sizeof(deviceId)); +#endif + } +}; +/** + * The configuration of the captured screen. + */ +struct ScreenCaptureConfiguration { + /** + * Whether to capture the window on the screen: + * - `true`: Capture the window. + * - `false`: (Default) Capture the screen, not the window. + */ + bool isCaptureWindow; // true - capture window, false - capture display + /** + * (macOS only) The display ID of the screen. + */ + uint32_t displayId; + /** + * (Windows only) The relative position of the shared screen to the virtual screen. + * @note This parameter takes effect only when you want to capture the screen on Windows. + */ + Rectangle screenRect; //Windows only + /** + * (For Windows and macOS only) The window ID. + * @note This parameter takes effect only when you want to capture the window. + */ + view_t windowId; + /** + * (For Windows and macOS only) The screen capture configuration. For details, see ScreenCaptureParameters. + */ + ScreenCaptureParameters params; + /** + * (For Windows and macOS only) The relative position of the shared region to the whole screen. For details, see Rectangle. + * + * If you do not set this parameter, the SDK shares the whole screen. If the region you set exceeds the boundary of the + * screen, only the region within in the screen is shared. If you set width or height in Rectangle as 0, the whole + * screen is shared. + */ + Rectangle regionRect; + + ScreenCaptureConfiguration() : isCaptureWindow(false), displayId(0), windowId(0) {} +}; + +#if (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) +/** The size of the screen shot to the screen or window. + */ +struct SIZE { + /** The width of the screen shot. + */ + int width; + /** The width of the screen shot. + */ + int height; + + SIZE() : width(0), height(0) {} + SIZE(int ww, int hh) : width(ww), height(hh) {} +}; +#endif + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) +/** + * The image content of the thumbnail or icon. + * @note The default image is in the RGBA format. If you need to use another format, you need to convert the image on + * your own. + */ +struct ThumbImageBuffer { + /** + * The buffer of the thumbnail ot icon. + */ + const char* buffer; + /** + * The buffer length of the thumbnail or icon, in bytes. + */ + unsigned int length; + /** + * The actual width (px) of the thumbnail or icon. + */ + unsigned int width; + /** + * The actual height (px) of the thumbnail or icon. + */ + unsigned int height; + ThumbImageBuffer() : buffer(nullptr), length(0), width(0), height(0) {} +}; +/** + * The type of the shared target. Set in ScreenCaptureSourceInfo. + */ +enum ScreenCaptureSourceType { + /** -1: Unknown type. */ + ScreenCaptureSourceType_Unknown = -1, + /** 0: The shared target is a window.*/ + ScreenCaptureSourceType_Window = 0, + /** 1: The shared target is a screen of a particular monitor.*/ + ScreenCaptureSourceType_Screen = 1, + /** 2: Reserved parameter.*/ + ScreenCaptureSourceType_Custom = 2, +}; +/** The information about the specified shareable window or screen. It is returned in IScreenCaptureSourceList. */ +struct ScreenCaptureSourceInfo { + /** + * The type of the shared target. See \ref agora::rtc::ScreenCaptureSourceType "ScreenCaptureSourceType". + */ + ScreenCaptureSourceType type; + /** + * The window ID for a window or the display ID for a screen. + */ + view_t sourceId; + /** + * The name of the window or screen. UTF-8 encoding. + */ + const char* sourceName; + /** + * The image content of the thumbnail. See ThumbImageBuffer. + */ + ThumbImageBuffer thumbImage; + /** + * The image content of the icon. See ThumbImageBuffer. + */ + ThumbImageBuffer iconImage; + /** + * The process to which the window belongs. UTF-8 encoding. + */ + const char* processPath; + /** + * The title of the window. UTF-8 encoding. + */ + const char* sourceTitle; + /** + * Determines whether the screen is the primary display: + * - true: The screen is the primary display. + * - false: The screen is not the primary display. + */ + bool primaryMonitor; + bool isOccluded; + /** + * The relative position of the shared region to the screen space (A virtual space include all the screens). See Rectangle. + */ + Rectangle position; +#if defined(_WIN32) + /** + * Determines whether the window is minimized. + */ + bool minimizeWindow; + /** + * The display ID to the window of interest. + * If the window intersects one or more display monitor rectangles, the return value is an valid + * ID to the display monitor that has the largest area of intersection with the window, Otherwise + * the return value is -2. + */ + view_t sourceDisplayId; + ScreenCaptureSourceInfo() : type(ScreenCaptureSourceType_Unknown), sourceId(nullptr), sourceName(nullptr), + processPath(nullptr), sourceTitle(nullptr), primaryMonitor(false), isOccluded(false), minimizeWindow(false), sourceDisplayId((view_t)-2) {} +#else + ScreenCaptureSourceInfo() : type(ScreenCaptureSourceType_Unknown), sourceId(nullptr), sourceName(nullptr), processPath(nullptr), sourceTitle(nullptr), primaryMonitor(false), isOccluded(false) {} +#endif +}; +/** + * The IScreenCaptureSourceList class. This class is returned in the getScreenCaptureSources method. + */ +class IScreenCaptureSourceList { + protected: + virtual ~IScreenCaptureSourceList(){}; + + public: + /** + * Gets the number of shareable cpp and screens. + * + * @return The number of shareable cpp and screens. + */ + virtual unsigned int getCount() = 0; + /** + * Gets information about the specified shareable window or screen. + * + * After you get IScreenCaptureSourceList, you can pass in the index value of the specified shareable window or + * screen to get information about that window or screen from ScreenCaptureSourceInfo. + * + * @param index The index of the specified shareable window or screen. The value range is [0, getCount()). + * @return ScreenCaptureSourceInfo The information of the specified window or screen. + */ + virtual ScreenCaptureSourceInfo getSourceInfo(unsigned int index) = 0; + /** + * Releases IScreenCaptureSourceList. + * + * After you get the list of shareable cpp and screens, to avoid memory leaks, call this method to release + * IScreenCaptureSourceList instead of deleting IScreenCaptureSourceList directly. + */ + virtual void release() = 0; +}; +#endif // _WIN32 || (__APPLE__ && !TARGET_OS_IPHONE && TARGET_OS_MAC) +/** + * The advanced options for audio. + */ +struct AdvancedAudioOptions { + /** + * Audio processing channels, only support 1 or 2. + */ + Optional audioProcessingChannels; + + AdvancedAudioOptions() {} + ~AdvancedAudioOptions() {} +}; + +struct ImageTrackOptions { + const char* imageUrl; + int fps; + VIDEO_MIRROR_MODE_TYPE mirrorMode; + ImageTrackOptions() : imageUrl(NULL), fps(1), mirrorMode(VIDEO_MIRROR_MODE_DISABLED) {} +}; + +/** + * The channel media options. + * + * Agora supports publishing multiple audio streams and one video stream at the same time and in the same RtcConnection. + * For example, `publishAudioTrack`, `publishCustomAudioTrack` and `publishMediaPlayerAudioTrack` can be true at the same time; + * but only one of `publishCameraTrack`, `publishScreenTrack`, `publishCustomVideoTrack`, and `publishEncodedVideoTrack` can be + * true at the same time. + */ +struct ChannelMediaOptions { + /** + * Whether to publish the video of the camera track. + * - `true`: (Default) Publish the video track of the camera capturer. + * - `false`: Do not publish the video track of the camera capturer. + */ + Optional publishCameraTrack; + /** + * Whether to publish the video of the secondary camera track. + * - `true`: Publish the video track of the secondary camera capturer. + * - `false`: (Default) Do not publish the video track of the secondary camera capturer. + */ + Optional publishSecondaryCameraTrack; + /** + * Whether to publish the video of the third camera track. + * - `true`: Publish the video track of the third camera capturer. + * - `false`: (Default) Do not publish the video track of the third camera capturer. + */ + Optional publishThirdCameraTrack; + /** + * Whether to publish the video of the fourth camera track. + * - `true`: Publish the video track of the fourth camera capturer. + * - `false`: (Default) Do not publish the video track of the fourth camera capturer. + */ + Optional publishFourthCameraTrack; + /** + * Whether to publish the recorded audio. + * - `true`: (Default) Publish the recorded audio. + * - `false`: Do not publish the recorded audio. + */ + Optional publishMicrophoneTrack; + + #if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + /** + * Whether to publish the video track of the screen capturer: + * - `true`: Publish the video track of the screen capture. + * - `false`: (Default) Do not publish the video track of the screen capture. + */ + Optional publishScreenCaptureVideo; + /** + * Whether to publish the audio track of the screen capturer: + * - `true`: Publish the video audio of the screen capturer. + * - `false`: (Default) Do not publish the audio track of the screen capturer. + */ + Optional publishScreenCaptureAudio; + #else + /** + * Whether to publish the captured video from the screen: + * - `true`: PPublish the captured video from the screen. + * - `false`: (Default) Do not publish the captured video from the screen. + */ + Optional publishScreenTrack; + /** + * Whether to publish the captured video from the secondary screen: + * - true: Publish the captured video from the secondary screen. + * - false: (Default) Do not publish the captured video from the secondary screen. + */ + Optional publishSecondaryScreenTrack; + /** + * Whether to publish the captured video from the third screen: + * - true: Publish the captured video from the third screen. + * - false: (Default) Do not publish the captured video from the third screen. + */ + Optional publishThirdScreenTrack; + /** + * Whether to publish the captured video from the fourth screen: + * - true: Publish the captured video from the fourth screen. + * - false: (Default) Do not publish the captured video from the fourth screen. + */ + Optional publishFourthScreenTrack; + #endif + + /** + * Whether to publish the captured audio from a custom source: + * - true: Publish the captured audio from a custom source. + * - false: (Default) Do not publish the captured audio from the custom source. + */ + Optional publishCustomAudioTrack; + /** + * The custom audio track id. The default value is 0. + */ + Optional publishCustomAudioTrackId; + /** + * Whether to publish AEC custom audio track. + * - `true`: Publish AEC track. + * - `false`: (Default) Do not publish AEC track. + */ + Optional publishCustomAudioTrackAec; + /** + * Whether to publish the captured video from a custom source: + * - `true`: Publish the captured video from a custom source. + * - `false`: (Default) Do not publish the captured video from the custom source. + */ + Optional publishCustomVideoTrack; + /** + * Whether to publish the encoded video: + * - `true`: Publish the encoded video. + * - `false`: (Default) Do not publish the encoded video. + */ + Optional publishEncodedVideoTrack; + /** + * Whether to publish the audio from the media player: + * - `true`: Publish the audio from the media player. + * - `false`: (Default) Do not publish the audio from the media player. + */ + Optional publishMediaPlayerAudioTrack; + /** + * Whether to publish the video from the media player: + * - `true`: Publish the video from the media player. + * - `false`: (Default) Do not publish the video from the media player. + */ + Optional publishMediaPlayerVideoTrack; + /** + * Whether to publish the local transcoded video track. + * - `true`: Publish the video track of local transcoded video track. + * - `false`: (Default) Do not publish the local transcoded video track. + */ + Optional publishTrancodedVideoTrack; + /** + * Whether to publish the local mixed track. + * - `true`: Publish the audio track of local mixed track. + * - `false`: (Default) Do not publish the local mixed track. + */ + Optional publishMixedAudioTrack; + /** + * Whether to automatically subscribe to all remote audio streams when the user joins a channel: + * - `true`: (Default) Subscribe to all remote audio streams. + * - `false`: Do not subscribe to any remote audio stream. + */ + Optional autoSubscribeAudio; + /** + * Whether to subscribe to all remote video streams when the user joins the channel: + * - `true`: (Default) Subscribe to all remote video streams. + * - `false`: Do not subscribe to any remote video stream. + */ + Optional autoSubscribeVideo; + /** + * Whether to enable audio capturing or playback. + * - `true`: (Default) Enable audio capturing and playback. + * - `false`: Do not enable audio capturing or playback. + */ + Optional enableAudioRecordingOrPlayout; + /** + * The ID of the media player to be published. The default value is 0. + */ + Optional publishMediaPlayerId; + /** + * The client role type. See \ref CLIENT_ROLE_TYPE. + * Default is CLIENT_ROLE_AUDIENCE. + */ + Optional clientRoleType; + /** + * The audience latency level type. See #AUDIENCE_LATENCY_LEVEL_TYPE. + */ + Optional audienceLatencyLevel; + /** + * The default video stream type. See \ref VIDEO_STREAM_TYPE. + * Default is VIDEO_STREAM_HIGH. + */ + Optional defaultVideoStreamType; + /** + * The channel profile. See \ref CHANNEL_PROFILE_TYPE. + * Default is CHANNEL_PROFILE_LIVE_BROADCASTING. + */ + Optional channelProfile; + /** + * The delay in ms for sending audio frames. This is used for explicit control of A/V sync. + * To switch off the delay, set the value to zero. + */ + Optional audioDelayMs; + /** + * The delay in ms for sending media player audio frames. This is used for explicit control of A/V sync. + * To switch off the delay, set the value to zero. + */ + Optional mediaPlayerAudioDelayMs; + /** + * (Optional) The token generated on your server for authentication. + * @note + * - This parameter takes effect only when calling `updateChannelMediaOptions` or `updateChannelMediaOptionsEx`. + * - Ensure that the App ID, channel name, and user name used for creating the token are the same ones as those + * used by the initialize method for initializing the RTC engine, and those used by the `joinChannel [2/2]` + * and `joinChannelEx` methods for joining the channel. + */ + Optional token; + /** + * Whether to enable media packet encryption: + * - `true`: Yes. + * - `false`: (Default) No. + * + * @note This parameter is ignored when calling `updateChannelMediaOptions`. + */ + Optional enableBuiltInMediaEncryption; + /** + * Whether to publish the sound of the rhythm player to remote users: + * - `true`: (Default) Publish the sound of the rhythm player. + * - `false`: Do not publish the sound of the rhythm player. + */ + Optional publishRhythmPlayerTrack; + /** + * Whether the user is an interactive audience member in the channel. + * - `true`: Enable low lentancy and smooth video when joining as an audience. + * - `false`: (Default) Use default settings for audience role. + * @note This mode is only used for audience. In PK mode, client might join one channel as broadcaster, and join + * another channel as interactive audience to achieve low lentancy and smooth video from remote user. + */ + Optional isInteractiveAudience; + /** + * The custom video track id which will used to publish or preview. + * You can get the VideoTrackId after calling createCustomVideoTrack() of IRtcEngine. + */ + Optional customVideoTrackId; + /** + * Whether local audio stream can be filtered. + * - `true`: (Default) Can be filtered when audio level is low. + * - `false`: Do not Filter this audio stream. + */ + Optional isAudioFilterable; + + /** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + Pointer to the set parameters in a JSON string. + */ + Optional parameters; + + ChannelMediaOptions() {} + ~ChannelMediaOptions() {} + + void SetAll(const ChannelMediaOptions& change) { +#define SET_FROM(X) SetFrom(&X, change.X) + + SET_FROM(publishCameraTrack); + SET_FROM(publishSecondaryCameraTrack); + SET_FROM(publishThirdCameraTrack); + SET_FROM(publishFourthCameraTrack); + SET_FROM(publishMicrophoneTrack); +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + SET_FROM(publishScreenCaptureVideo); + SET_FROM(publishScreenCaptureAudio); +#else + SET_FROM(publishScreenTrack); + SET_FROM(publishSecondaryScreenTrack); + SET_FROM(publishThirdScreenTrack); + SET_FROM(publishFourthScreenTrack); +#endif + SET_FROM(publishTrancodedVideoTrack); + SET_FROM(publishMixedAudioTrack); + SET_FROM(publishCustomAudioTrack); + SET_FROM(publishCustomAudioTrackId); + SET_FROM(publishCustomAudioTrackAec); + SET_FROM(publishCustomVideoTrack); + SET_FROM(publishEncodedVideoTrack); + SET_FROM(publishMediaPlayerAudioTrack); + SET_FROM(publishMediaPlayerVideoTrack); + SET_FROM(autoSubscribeAudio); + SET_FROM(autoSubscribeVideo); + SET_FROM(publishMediaPlayerId); + SET_FROM(enableAudioRecordingOrPlayout); + SET_FROM(clientRoleType); + SET_FROM(audienceLatencyLevel); + SET_FROM(defaultVideoStreamType); + SET_FROM(channelProfile); + SET_FROM(audioDelayMs); + SET_FROM(mediaPlayerAudioDelayMs); + SET_FROM(token); + SET_FROM(enableBuiltInMediaEncryption); + SET_FROM(publishRhythmPlayerTrack); + SET_FROM(customVideoTrackId); + SET_FROM(isAudioFilterable); + SET_FROM(isInteractiveAudience); + SET_FROM(parameters); +#undef SET_FROM + } + + bool operator==(const ChannelMediaOptions& o) const { +#define BEGIN_COMPARE() bool b = true +#define ADD_COMPARE(X) b = (b && (X == o.X)) +#define END_COMPARE() + + BEGIN_COMPARE(); + ADD_COMPARE(publishCameraTrack); + ADD_COMPARE(publishSecondaryCameraTrack); + ADD_COMPARE(publishThirdCameraTrack); + ADD_COMPARE(publishFourthCameraTrack); + ADD_COMPARE(publishMicrophoneTrack); +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + ADD_COMPARE(publishScreenCaptureVideo); + ADD_COMPARE(publishScreenCaptureAudio); +#else + ADD_COMPARE(publishScreenTrack); + ADD_COMPARE(publishSecondaryScreenTrack); + ADD_COMPARE(publishThirdScreenTrack); + ADD_COMPARE(publishFourthScreenTrack); +#endif + ADD_COMPARE(publishTrancodedVideoTrack); + ADD_COMPARE(publishMixedAudioTrack); + ADD_COMPARE(publishCustomAudioTrack); + ADD_COMPARE(publishCustomAudioTrackId); + ADD_COMPARE(publishCustomAudioTrackAec); + ADD_COMPARE(publishCustomVideoTrack); + ADD_COMPARE(publishEncodedVideoTrack); + ADD_COMPARE(publishMediaPlayerAudioTrack); + ADD_COMPARE(publishMediaPlayerVideoTrack); + ADD_COMPARE(autoSubscribeAudio); + ADD_COMPARE(autoSubscribeVideo); + ADD_COMPARE(publishMediaPlayerId); + ADD_COMPARE(enableAudioRecordingOrPlayout); + ADD_COMPARE(clientRoleType); + ADD_COMPARE(audienceLatencyLevel); + ADD_COMPARE(defaultVideoStreamType); + ADD_COMPARE(channelProfile); + ADD_COMPARE(audioDelayMs); + ADD_COMPARE(mediaPlayerAudioDelayMs); + ADD_COMPARE(token); + ADD_COMPARE(enableBuiltInMediaEncryption); + ADD_COMPARE(publishRhythmPlayerTrack); + ADD_COMPARE(customVideoTrackId); + ADD_COMPARE(isAudioFilterable); + ADD_COMPARE(isInteractiveAudience); + ADD_COMPARE(parameters); + END_COMPARE(); + +#undef BEGIN_COMPARE +#undef ADD_COMPARE +#undef END_COMPARE + return b; + } + + ChannelMediaOptions& operator=(const ChannelMediaOptions& replace) { + if (this != &replace) { +#define REPLACE_BY(X) ReplaceBy(&X, replace.X) + + REPLACE_BY(publishCameraTrack); + REPLACE_BY(publishSecondaryCameraTrack); + REPLACE_BY(publishThirdCameraTrack); + REPLACE_BY(publishFourthCameraTrack); + REPLACE_BY(publishMicrophoneTrack); +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + REPLACE_BY(publishScreenCaptureVideo); + REPLACE_BY(publishScreenCaptureAudio); +#else + REPLACE_BY(publishScreenTrack); + REPLACE_BY(publishSecondaryScreenTrack); + REPLACE_BY(publishThirdScreenTrack); + REPLACE_BY(publishFourthScreenTrack); +#endif + REPLACE_BY(publishTrancodedVideoTrack); + REPLACE_BY(publishMixedAudioTrack); + REPLACE_BY(publishCustomAudioTrack); + REPLACE_BY(publishCustomAudioTrackId); + REPLACE_BY(publishCustomAudioTrackAec); + REPLACE_BY(publishCustomVideoTrack); + REPLACE_BY(publishEncodedVideoTrack); + REPLACE_BY(publishMediaPlayerAudioTrack); + REPLACE_BY(publishMediaPlayerVideoTrack); + REPLACE_BY(autoSubscribeAudio); + REPLACE_BY(autoSubscribeVideo); + REPLACE_BY(publishMediaPlayerId); + REPLACE_BY(enableAudioRecordingOrPlayout); + REPLACE_BY(clientRoleType); + REPLACE_BY(audienceLatencyLevel); + REPLACE_BY(defaultVideoStreamType); + REPLACE_BY(channelProfile); + REPLACE_BY(audioDelayMs); + REPLACE_BY(mediaPlayerAudioDelayMs); + REPLACE_BY(token); + REPLACE_BY(enableBuiltInMediaEncryption); + REPLACE_BY(publishRhythmPlayerTrack); + REPLACE_BY(customVideoTrackId); + REPLACE_BY(isAudioFilterable); + REPLACE_BY(isInteractiveAudience); + REPLACE_BY(parameters); +#undef REPLACE_BY + } + return *this; + } +}; + +/** The local proxy mode type. */ +enum LOCAL_PROXY_MODE { + /** 0: Connect local proxy with high priority, if not connected to local proxy, fallback to sdrtn. + */ + ConnectivityFirst = 0, + /** 1: Only connect local proxy + */ + LocalOnly = 1, +}; + +enum PROXY_TYPE { + /** 0: Do not use the cloud proxy. + */ + NONE_PROXY_TYPE = 0, + /** 1: The cloud proxy for the UDP protocol. + */ + UDP_PROXY_TYPE = 1, + /** 2: The cloud proxy for the TCP (encrypted) protocol. + */ + TCP_PROXY_TYPE = 2, + /** 3: The local proxy. + */ + LOCAL_PROXY_TYPE = 3, + /** 4: auto fallback to tcp cloud proxy + */ + TCP_PROXY_AUTO_FALLBACK_TYPE = 4, +}; + +enum FeatureType { + VIDEO_VIRTUAL_BACKGROUND = 1, + VIDEO_BEAUTY_EFFECT = 2, +}; + +struct LogUploadServerInfo { + /** Log upload server domain + */ + const char* serverDomain; + /** Log upload server path + */ + const char* serverPath; + /** Log upload server port + */ + int serverPort; + /** Whether to use HTTPS request: + - true: Use HTTPS request + - fasle: Use HTTP request + */ + bool serverHttps; + + LogUploadServerInfo() : serverDomain(NULL), serverPath(NULL), serverPort(0), serverHttps(true) {} + + LogUploadServerInfo(const char* domain, const char* path, int port, bool https) : serverDomain(domain), serverPath(path), serverPort(port), serverHttps(https) {} +}; + +struct AdvancedConfigInfo { + /** Log upload server + */ + LogUploadServerInfo logUploadServer; +}; + +struct LocalAccessPointConfiguration { + /** Local access point IP address list. + */ + const char** ipList; + /** The number of local access point IP address. + */ + int ipListSize; + /** Local access point domain list. + */ + const char** domainList; + /** The number of local access point domain. + */ + int domainListSize; + /** Certificate domain name installed on specific local access point. pass "" means using sni domain on specific local access point + * SNI(Server Name Indication) is an extension to the TLS protocol. + */ + const char* verifyDomainName; + /** Local proxy connection mode, connectivity first or local only. + */ + LOCAL_PROXY_MODE mode; + /** Local proxy connection, advanced Config info. + */ + AdvancedConfigInfo advancedConfig; + LocalAccessPointConfiguration() : ipList(NULL), ipListSize(0), domainList(NULL), domainListSize(0), verifyDomainName(NULL), mode(ConnectivityFirst) {} +}; + +/** + * The options for leaving a channel. + */ +struct LeaveChannelOptions { + /** + * Whether to stop playing and mixing the music file when a user leaves the channel. + * - `true`: (Default) Stop playing and mixing the music file. + * - `false`: Do not stop playing and mixing the music file. + */ + bool stopAudioMixing; + /** + * Whether to stop playing all audio effects when a user leaves the channel. + * - `true`: (Default) Stop playing all audio effects. + * - `false`: Do not stop playing any audio effect. + */ + bool stopAllEffect; + /** + * Whether to stop microphone recording when a user leaves the channel. + * - `true`: (Default) Stop microphone recording. + * - `false`: Do not stop microphone recording. + */ + bool stopMicrophoneRecording; + + LeaveChannelOptions() : stopAudioMixing(true), stopAllEffect(true), stopMicrophoneRecording(true) {} +}; + +/** + * The IRtcEngineEventHandler class. + * + * The SDK uses this class to send callback event notifications to the app, and the app inherits + * the methods in this class to retrieve these event notifications. + * + * All methods in this class have their default (empty) implementations, and the app can inherit + * only some of the required events instead of all. In the callback methods, the app should avoid + * time-consuming tasks or calling blocking APIs, otherwise the SDK may not work properly. + */ +class IRtcEngineEventHandler { + public: + virtual ~IRtcEngineEventHandler() {} + + virtual const char* eventHandlerType() const { return "event_handler"; } + + /** + * Occurs when a user joins a channel. + * + * This callback notifies the application that a user joins a specified channel. + * + * @param channel The channel name. + * @param uid The ID of the user who joins the channel. + * @param elapsed The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback. + */ + virtual void onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed) { + (void)channel; + (void)uid; + (void)elapsed; + } + + /** + * Occurs when a user rejoins the channel. + * + * When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect + * and triggers this callback upon reconnection. + * + * @param channel The channel name. + * @param uid The ID of the user who rejoins the channel. + * @param elapsed Time elapsed (ms) from the local user calling the joinChannel method until this callback is triggered. + */ + virtual void onRejoinChannelSuccess(const char* channel, uid_t uid, int elapsed) { + (void)channel; + (void)uid; + (void)elapsed; + } + + /** Occurs when join success after calling \ref IRtcEngine::setLocalAccessPoint "setLocalAccessPoint" or \ref IRtcEngine::setCloudProxy "setCloudProxy" + @param channel Channel name. + @param uid User ID of the user joining the channel. + @param proxyType type of proxy agora sdk connected, proxyType will be NONE_PROXY_TYPE if not connected to proxy(fallback). + @param localProxyIp local proxy ip. if not join local proxy, it will be "". + @param elapsed Time elapsed (ms) from the user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback. + */ + virtual void onProxyConnected(const char* channel, uid_t uid, PROXY_TYPE proxyType, const char* localProxyIp, int elapsed) { + (void)channel; + (void)uid; + (void)proxyType; + (void)localProxyIp; + (void)elapsed; + } + + /** An error occurs during the SDK runtime. + + @param err The error code: #ERROR_CODE_TYPE. + @param msg The detailed error message. + */ + virtual void onError(int err, const char* msg) { + (void)err; + (void)msg; + } + + /** Reports the statistics of the audio stream from each remote + user/broadcaster. + + @deprecated This callback is deprecated. Use onRemoteAudioStats instead. + + The SDK triggers this callback once every two seconds to report the audio + quality of each remote user/host sending an audio stream. If a channel has + multiple remote users/hosts sending audio streams, the SDK triggers this + callback as many times. + + @param uid The user ID of the remote user sending the audio stream. + @param quality The audio quality of the user: #QUALITY_TYPE + @param delay The network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering. + @param lost The audio packet loss rate (%) from the sender to the receiver. + */ + virtual void onAudioQuality(uid_t uid, int quality, unsigned short delay, + unsigned short lost) { + (void)uid; + (void)quality; + (void)delay; + (void)lost; + } + + /** Reports the result of the last-mile network probe result. + * + * The SDK triggers this callback within 30 seconds after the app calls the `startLastmileProbeTest` method. + * @param result The uplink and downlink last-mile network probe test result: LastmileProbeResult. + */ + virtual void onLastmileProbeResult(const LastmileProbeResult& result) { + (void)result; + } + + /** + * Reports the volume information of users. + * + * By default, this callback is disabled. You can enable it by calling `enableAudioVolumeIndication`. Once this + * callback is enabled and users send streams in the channel, the SDK triggers the `onAudioVolumeIndication` + * callback at the time interval set in `enableAudioVolumeIndication`. The SDK triggers two independent + * `onAudioVolumeIndication` callbacks simultaneously, which separately report the volume information of the + * local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest. + * + * @note After you enable this callback, calling muteLocalAudioStream affects the SDK's behavior as follows: + * - If the local user stops publishing the audio stream, the SDK stops triggering the local user's callback. + * - 20 seconds after a remote user whose volume is one of the three highest stops publishing the audio stream, + * the callback excludes this user's information; 20 seconds after all remote users stop publishing audio streams, + * the SDK stops triggering the callback for remote users. + * + * @param speakers The volume information of the users, see AudioVolumeInfo. An empty `speakers` array in the + * callback indicates that no remote user is in the channel or sending a stream at the moment. + * @param speakerNumber The total number of speakers. + * - In the local user's callback, when the local user sends a stream, `speakerNumber` is 1. + * - In the callback for remote users, the value range of speakerNumber is [0,3]. If the number of remote users who + * send streams is greater than or equal to three, the value of `speakerNumber` is 3. + * @param totalVolume The volume of the speaker. The value ranges between 0 (lowest volume) and 255 (highest volume). + * - In the local user's callback, `totalVolume` is the volume of the local user who sends a stream. + * - In the remote users' callback, `totalVolume` is the sum of all remote users (up to three) whose instantaneous + * volume is the highest. If the user calls `startAudioMixing`, `totalVolume` is the volume after audio mixing. + */ + virtual void onAudioVolumeIndication(const AudioVolumeInfo* speakers, unsigned int speakerNumber, + int totalVolume) { + (void)speakers; + (void)speakerNumber; + (void)totalVolume; + } + + /** + * Occurs when a user leaves a channel. + * + * This callback notifies the app that the user leaves the channel by calling `leaveChannel`. From this callback, + * the app can get information such as the call duration and quality statistics. + * + * @param stats The statistics on the call: RtcStats. + */ + virtual void onLeaveChannel(const RtcStats& stats) { (void)stats; } + + /** + * Reports the statistics of the current call. + * + * The SDK triggers this callback once every two seconds after the user joins the channel. + * + * @param stats The statistics of the current call: RtcStats. + */ + virtual void onRtcStats(const RtcStats& stats) { (void)stats; } + + /** Occurs when the audio device state changes. + + This callback notifies the application that the system's audio device state + is changed. For example, a headset is unplugged from the device. + + @param deviceId The device ID. + @param deviceType The device type: #MEDIA_DEVICE_TYPE. + @param deviceState The device state: + - On macOS: + - 0: The device is ready for use. + - 8: The device is not connected. + - On Windows: #MEDIA_DEVICE_STATE_TYPE. + */ + virtual void onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) { + (void)deviceId; + (void)deviceType; + (void)deviceState; + } + + /** + * @brief Reports current AudioMixing progress. + * + * The callback occurs once every one second during the playback and reports the current playback progress. + * @param position Current AudioMixing progress (millisecond). + */ + virtual void onAudioMixingPositionChanged(int64_t position) {} + + /** Occurs when the audio mixing file playback finishes. + @deprecated This method is deprecated, use onAudioMixingStateChanged instead. + + After you call startAudioMixing to play a local music file, this callback occurs when the playback finishes. + If the startAudioMixing method call fails, the SDK returns the error code 701. + */ + virtual void onAudioMixingFinished() __deprecated {} + /** + * Occurs when the playback of the local audio effect file finishes. + * + * This callback occurs when the local audio effect file finishes playing. + * + * @param soundId The audio effect ID. The ID of each audio effect file is unique. + */ + virtual void onAudioEffectFinished(int soundId) {} + + /** Occurs when the video device state changes. + + This callback notifies the application that the system's video device state + is changed. + + @param deviceId Pointer to the device ID. + @param deviceType Device type: #MEDIA_DEVICE_TYPE. + @param deviceState Device state: #MEDIA_DEVICE_STATE_TYPE. + */ + virtual void onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) { + (void)deviceId; + (void)deviceType; + (void)deviceState; + } + + /** + * Reports the last mile network quality of each user in the channel. + * + * This callback reports the last mile network conditions of each user in the channel. Last mile refers to the + * connection between the local device and Agora's edge server. + * + * The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers + * this callback as many times. + * + * @note `txQuality` is UNKNOWN when the user is not sending a stream; `rxQuality` is UNKNOWN when the user is not + * receiving a stream. + * + * @param uid The user ID. The network quality of the user with this user ID is reported. + * @param txQuality Uplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, + * average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you + * understand how well the current uplink network conditions can support the selected video encoder configuration. + * For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame + * rate of 15 fps in the LIVE_BROADCASTING profile, but may be inadequate for resolutions higher than 1280 × 720. + * See #QUALITY_TYPE. + * @param rxQuality Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter + * of the downlink network. See #QUALITY_TYPE. + */ + virtual void onNetworkQuality(uid_t uid, int txQuality, int rxQuality) { + (void)uid; + (void)txQuality; + (void)rxQuality; + } + + /** + * Occurs when intra request from remote user is received. + * + * This callback is triggered once remote user needs one Key frame. + * + */ + virtual void onIntraRequestReceived() {} + + /** + * Occurs when uplink network info is updated. + * + * The SDK triggers this callback when the uplink network information changes. + * + * @note This callback only applies to scenarios where you push externally encoded + * video data in H.264 format to the SDK. + * + * @param info The uplink network information. See UplinkNetworkInfo. + */ + virtual void onUplinkNetworkInfoUpdated(const UplinkNetworkInfo& info) { + (void)info; + } + + /** + * Occurs when downlink network info is updated. + * + * This callback is used for notifying user to switch major/minor stream if needed. + * + * @param info The downlink network info collections. + */ + virtual void onDownlinkNetworkInfoUpdated(const DownlinkNetworkInfo& info) { + (void)info; + } + + /** + * Reports the last-mile network quality of the local user. + * + * This callback reports the last-mile network conditions of the local user before the user joins + * the channel. Last mile refers to the connection between the local device and Agora's edge server. + * + * When the user is not in a channel and the last-mile network test is enabled + * (by calling `startLastmileProbeTest`), this callback function is triggered + * to update the app on the network connection quality of the local user. + * + * @param quality The last mile network quality. See #QUALITY_TYPE. + */ + virtual void onLastmileQuality(int quality) { (void)quality; } + + /** Occurs when the first local video frame is rendered on the local video view. + * + * @param source The video source: #VIDEO_SOURCE_TYPE. + * @param width The width (px) of the first local video frame. + * @param height The height (px) of the first local video frame. + * @param elapsed Time elapsed (ms) from the local user calling the `joinChannel` + * method until the SDK triggers this callback. If you call the `startPreview` method before calling + * the `joinChannel` method, then `elapsed` is the time elapsed from calling the + * `startPreview` method until the SDK triggers this callback. + */ + virtual void onFirstLocalVideoFrame(VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) { + (void)source; + (void)width; + (void)height; + (void)elapsed; + } + + /** Occurs when the first local video frame is published. + * The SDK triggers this callback under one of the following circumstances: + * - The local client enables the video module and calls `joinChannel` successfully. + * - The local client calls `muteLocalVideoStream(true)` and muteLocalVideoStream(false) in sequence. + * - The local client calls `disableVideo` and `enableVideo` in sequence. + * - The local client calls `pushVideoFrame` to successfully push the video frame to the SDK. + * @param source The video source type. + * @param elapsed The time elapsed (ms) from the local user calling joinChannel` to the SDK triggers + * this callback. + */ + virtual void onFirstLocalVideoFramePublished(VIDEO_SOURCE_TYPE source, int elapsed) { + (void)source; + (void)elapsed; + } + + /** Occurs when the first remote video frame is received and decoded. + + The SDK triggers this callback under one of the following circumstances: + - The remote user joins the channel and sends the video stream. + - The remote user stops sending the video stream and re-sends it after 15 seconds. Reasons for such an interruption include: + - The remote user leaves the channel. + - The remote user drops offline. + - The remote user calls `muteLocalVideoStream` to stop sending the video stream. + - The remote user calls `disableVideo` to disable video. + + @param uid The user ID of the remote user sending the video stream. + @param width The width (pixels) of the video stream. + @param height The height (pixels) of the video stream. + @param elapsed The time elapsed (ms) from the local user calling `joinChannel` + until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoDecoded(uid_t uid, int width, int height, int elapsed) __deprecated { + (void)uid; + (void)width; + (void)height; + (void)elapsed; + } + + /** + * Occurs when the local or remote video size or rotation has changed. + * @param sourceType The video source type: #VIDEO_SOURCE_TYPE. + * @param uid The user ID. 0 indicates the local user. + * @param width The new width (pixels) of the video. + * @param height The new height (pixels) of the video. + * @param rotation The rotation information of the video. + */ + virtual void onVideoSizeChanged(VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) { + (void)uid; + (void)width; + (void)height; + (void)rotation; + } + + /** Occurs when the local video stream state changes. + * + * When the state of the local video stream changes (including the state of the video capture and + * encoding), the SDK triggers this callback to report the current state. This callback indicates + * the state of the local video stream, including camera capturing and video encoding, and allows + * you to troubleshoot issues when exceptions occur. + * + * The SDK triggers the onLocalVideoStateChanged callback with the state code of `LOCAL_VIDEO_STREAM_STATE_FAILED` + * and error code of `LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE` in the following situations: + * - The app switches to the background, and the system gets the camera resource. + * - The camera starts normally, but does not output video for four consecutive seconds. + * + * When the camera outputs the captured video frames, if the video frames are the same for 15 + * consecutive frames, the SDK triggers the `onLocalVideoStateChanged` callback with the state code + * of `LOCAL_VIDEO_STREAM_STATE_CAPTURING` and error code of `LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE`. + * Note that the video frame duplication detection is only available for video frames with a resolution + * greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps. + * + * @note For some device models, the SDK does not trigger this callback when the state of the local + * video changes while the local video capturing device is in use, so you have to make your own + * timeout judgment. + * + * @param source The video source type: #VIDEO_SOURCE_TYPE. + * @param state The state of the local video. See #LOCAL_VIDEO_STREAM_STATE. + * @param error The detailed error information. See #LOCAL_VIDEO_STREAM_ERROR. + */ + virtual void onLocalVideoStateChanged(VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_ERROR error) { + (void)source; + (void)state; + (void)error; + } + + /** + * Occurs when the remote video state changes. + * + * @note This callback does not work properly when the number of users (in the voice/video call + * channel) or hosts (in the live streaming channel) in the channel exceeds 17. + * + * @param uid The ID of the user whose video state has changed. + * @param state The remote video state: #REMOTE_VIDEO_STATE. + * @param reason The reason of the remote video state change: #REMOTE_VIDEO_STATE_REASON. + * @param elapsed The time elapsed (ms) from the local client calling `joinChannel` until this callback is triggered. + */ + virtual void onRemoteVideoStateChanged(uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) { + (void)uid; + (void)state; + (void)reason; + (void)elapsed; + } + + /** Occurs when the renderer receives the first frame of the remote video. + * + * @param userId The user ID of the remote user sending the video stream. + * @param width The width (px) of the video frame. + * @param height The height (px) of the video stream. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoFrame(uid_t userId, int width, int height, int elapsed) { + (void)userId; + (void)width; + (void)height; + (void)elapsed; + } + + /** + * Occurs when a remote user or broadcaster joins the channel. + * + * - In the COMMUNICATION channel profile, this callback indicates that a remote user joins the channel. + * The SDK also triggers this callback to report the existing users in the channel when a user joins the + * channel. + * In the LIVE_BROADCASTING channel profile, this callback indicates that a host joins the channel. The + * SDK also triggers this callback to report the existing hosts in the channel when a host joins the + * channel. Agora recommends limiting the number of hosts to 17. + * + * The SDK triggers this callback under one of the following circumstances: + * - A remote user/host joins the channel by calling the `joinChannel` method. + * - A remote user switches the user role to the host after joining the channel. + * - A remote user/host rejoins the channel after a network interruption. + * + * @param uid The ID of the remote user or broadcaster joining the channel. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` or `setClientRole` + * until this callback is triggered. + */ + virtual void onUserJoined(uid_t uid, int elapsed) { + (void)uid; + (void)elapsed; + } + + /** + * Occurs when a remote user or broadcaster goes offline. + * + * There are two reasons for a user to go offline: + * - Leave the channel: When the user leaves the channel, the user sends a goodbye message. When this + * message is received, the SDK determines that the user leaves the channel. + * - Drop offline: When no data packet of the user is received for a certain period of time, the SDK assumes + * that the user drops offline. A poor network connection may lead to false detection, so we recommend using + * the RTM SDK for reliable offline detection. + * - The user switches the user role from a broadcaster to an audience. + * + * @param uid The ID of the remote user or broadcaster who leaves the channel or drops offline. + * @param reason The reason why the remote user goes offline: #USER_OFFLINE_REASON_TYPE. + */ + virtual void onUserOffline(uid_t uid, USER_OFFLINE_REASON_TYPE reason) { + (void)uid; + (void)reason; + } + + /** Occurs when a remote user's audio stream playback pauses/resumes. + + The SDK triggers this callback when the remote user stops or resumes sending the audio stream by + calling the `muteLocalAudioStream` method. + + @note This callback can be inaccurate when the number of users (in the `COMMUNICATION` profile) or hosts (in the `LIVE_BROADCASTING` profile) in the channel exceeds 17. + + @param uid The user ID. + @param muted Whether the remote user's audio stream is muted/unmuted: + - true: Muted. + - false: Unmuted. + */ + virtual void onUserMuteAudio(uid_t uid, bool muted) { + (void)uid; + (void)muted; + } + + /** Occurs when a remote user pauses or resumes sending the video stream. + * + * When a remote user calls `muteLocalVideoStream` to stop or resume publishing the video stream, the + * SDK triggers this callback to report the state of the remote user's publishing stream to the local + * user. + + @note This callback is invalid when the number of users or broadacasters in a + channel exceeds 20. + + @param userId ID of the remote user. + @param muted Whether the remote user stops publishing the video stream: + - true: The remote user has paused sending the video stream. + - false: The remote user has resumed sending the video stream. + */ + virtual void onUserMuteVideo(uid_t userId, bool muted) { + (void)userId; + (void)muted; + } + + /** Occurs when a remote user enables or disables the video module. + + Once the video function is disabled, the users cannot see any video. + + The SDK triggers this callback when a remote user enables or disables the video module by calling the + `enableVideo` or `disableVideo` method. + + @param uid The ID of the remote user. + @param enabled Whether the video of the remote user is enabled: + - true: The remote user has enabled video. + - false: The remote user has disabled video. + */ + virtual void onUserEnableVideo(uid_t uid, bool enabled) __deprecated { + (void)uid; + (void)enabled; + } + + /** + * Occurs when the remote user state is updated. + * @param uid The uid of the remote user. + * @param state The remote user state: #REMOTE_USER_STATE. + */ + virtual void onUserStateChanged(uid_t uid, uint32_t state) { + (void)uid; + (void)state; + } + + /** Occurs when a remote user enables or disables local video capturing. + + The SDK triggers this callback when the remote user resumes or stops capturing the video stream by + calling the `enableLocalVideo` method. + + @param uid The ID of the remote user. + @param enabled Whether the specified remote user enables/disables local video: + - `true`: The remote user has enabled local video capturing. + - `false`: The remote user has disabled local video capturing. + */ + virtual void onUserEnableLocalVideo(uid_t uid, bool enabled) __deprecated { + (void)uid; + (void)enabled; + } + + /** + * Occurs when a method is executed by the SDK. + * @deprecated This callback is deprecated. Use other specific event callbacks instead. + * + * @param api The method executed by the SDK. + * @param err The error code returned by the SDK when the method call fails. If the SDK returns 0, + * then the method call is successful. + * @param result The result of the method call. + */ + virtual void onApiCallExecuted(int err, const char* api, const char* result) __deprecated { + (void)err; + (void)api; + (void)result; + } + + /** Reports the statistics of the local audio stream. + * + * The SDK triggers this callback once every two seconds. + * + * @param stats The statistics of the local audio stream. + * See LocalAudioStats. + */ + virtual void onLocalAudioStats(const LocalAudioStats& stats) { + (void)stats; + } + + /** Reports the statistics of the audio stream from each remote user/host. + + The SDK triggers this callback once every two seconds for each remote user who is sending audio + streams. If a channel includes multiple remote users, the SDK triggers this callback as many times. + + @param stats Statistics of the received remote audio streams. See RemoteAudioStats. + */ + virtual void onRemoteAudioStats(const RemoteAudioStats& stats) { + (void)stats; + } + + /** Reports the statistics of the local video stream. + * + * The SDK triggers this callback once every two seconds for each + * user/host. If there are multiple users/hosts in the channel, the SDK + * triggers this callback as many times. + * + * @note If you have called the `enableDualStreamMode` + * method, this callback reports the statistics of the high-video + * stream (high bitrate, and high-resolution video stream). + * + * @param source The video source type. See #VIDEO_SOURCE_TYPE. + * @param stats Statistics of the local video stream. See LocalVideoStats. + */ + virtual void onLocalVideoStats(VIDEO_SOURCE_TYPE source, const LocalVideoStats& stats) { + (void)source; + (void)stats; + } + + /** Reports the statistics of the video stream from each remote user/host. + * + * The SDK triggers this callback once every two seconds for each remote user. If a channel has + * multiple users/hosts sending video streams, the SDK triggers this callback as many times. + * + * @param stats Statistics of the remote video stream. See + * RemoteVideoStats. + */ + virtual void onRemoteVideoStats(const RemoteVideoStats& stats) { + (void)stats; + } + /** + * Occurs when the camera turns on and is ready to capture the video. + * @deprecated Use `LOCAL_VIDEO_STREAM_STATE_CAPTURING(1)` in onLocalVideoStateChanged instead. + * This callback indicates that the camera has been successfully turned on and you can start to capture video. + */ + virtual void onCameraReady() {} + /** + * Occurs when the camera focus area changes. + * + * @note This method is for Andriod and iOS only. + * + * @param x The x coordinate of the changed camera focus area. + * @param y The y coordinate of the changed camera focus area. + * @param width The width of the changed camera focus area. + * @param height The height of the changed camera focus area. + */ + virtual void onCameraFocusAreaChanged(int x, int y, int width, int height) { + (void)x; + (void)y; + (void)width; + (void)height; + } + /** + * Occurs when the camera exposure area changes. + * + * @param x The x coordinate of the changed camera exposure area. + * @param y The y coordinate of the changed camera exposure area. + * @param width The width of the changed camera exposure area. + * @param height The height of the changed exposure area. + */ + virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) { + (void)x; + (void)y; + (void)width; + (void)height; + } +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + /** + * Reports the face detection result of the local user. + * + * Once you enable face detection by calling enableFaceDetection(true), you can get the following + * information on the local user in real-time: + * - The width and height of the local video. + * - The position of the human face in the local view. + * - The distance between the human face and the screen. + * + * This value is based on the fitting calculation of the local video size and the position of the human face. + * + * @note + * - This callback is for Android and iOS only. + * - When it is detected that the face in front of the camera disappears, the callback will be + * triggered immediately. In the state of no face, the trigger frequency of the callback will be + * reduced to save power consumption on the local device. + * - The SDK stops triggering this callback when a human face is in close proximity to the screen. + * On Android, the value of `distance` reported in this callback may be slightly different from the + * actual distance. Therefore, Agora does not recommend using it for accurate calculation. + * + * @param imageWidth The width (px) of the video image captured by the local camera. + * @param imageHeight The height (px) of the video image captured by the local camera. + * @param vecRectangle The information of the detected human face: + * - x: The x-coordinate (px) of the human face in the local view. Taking the top left corner of the view as the origin, the x-coordinate represents the horizontal position of the human face relative to the origin. + * - y: The y-coordinate (px) of the human face in the local view. Taking the top left corner of the view as the origin, the y-coordinate represents the vertical position of the human face relative to the origin. + * - width: The width (px) of the human face in the captured view. + * - height: The height (px) of the human face in the captured view. + * @param vecDistance The distance between the human face and the device screen (cm). + * @param numFaces The number of faces detected. If the value is 0, it means that no human face is detected. + */ + virtual void onFacePositionChanged(int imageWidth, int imageHeight, + const Rectangle* vecRectangle, const int* vecDistance, + int numFaces) { + (void) imageWidth; + (void) imageHeight; + (void) vecRectangle; + (void) vecDistance; + (void) numFaces; + } +#endif + /** + * Occurs when the video stops playing. + * @deprecated Use `LOCAL_VIDEO_STREAM_STATE_STOPPED(0)` in the onLocalVideoStateChanged callback instead. + * + * The app can use this callback to change the configuration of the view (for example, displaying + * other pictures in the view) after the video stops playing. + */ + virtual void onVideoStopped() {} + + /** Occurs when the playback state of the music file changes. + * + * This callback occurs when the playback state of the music file changes, and reports the current state and error code. + + @param state The playback state of the music file. See #AUDIO_MIXING_STATE_TYPE. + @param reason The reason for the change of the music file playback state. See #AUDIO_MIXING_REASON_TYPE. + */ + virtual void onAudioMixingStateChanged(AUDIO_MIXING_STATE_TYPE state, AUDIO_MIXING_REASON_TYPE reason) { + (void)state; + (void)reason; + } + + /** Occurs when the state of the rhythm player changes. + When you call the \ref IRtcEngine::startRhythmPlayer "startRhythmPlayer" + method and the state of rhythm player changes, the SDK triggers this + callback. + + @param state The state code. See #RHYTHM_PLAYER_STATE_TYPE. + @param errorCode The error code. See #RHYTHM_PLAYER_ERROR_TYPE. + */ + virtual void onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_ERROR_TYPE errorCode) { + (void)state; + (void)errorCode; + } + + /** + * Occurs when the SDK cannot reconnect to the server 10 seconds after its connection to the server is + * interrupted. + * + * The SDK triggers this callback when it cannot connect to the server 10 seconds after calling + * `joinChannel`, regardless of whether it is in the channel or not. If the SDK fails to rejoin + * the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel. + */ + virtual void onConnectionLost() {} + + /** Occurs when the connection between the SDK and the server is interrupted. + * @deprecated Use `onConnectionStateChanged` instead. + + The SDK triggers this callback when it loses connection with the serer for more + than 4 seconds after the connection is established. After triggering this + callback, the SDK tries to reconnect to the server. If the reconnection fails + within a certain period (10 seconds by default), the onConnectionLost() + callback is triggered. If the SDK fails to rejoin the channel 20 minutes after + being disconnected from Agora's edge server, the SDK stops rejoining the channel. + + */ + virtual void onConnectionInterrupted() {} + + /** Occurs when your connection is banned by the Agora Server. + * @deprecated Use `onConnectionStateChanged` instead. + */ + virtual void onConnectionBanned() {} + + /** Occurs when the local user receives the data stream from the remote user. + * + * The SDK triggers this callback when the user receives the data stream that another user sends + * by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method. + * + * @param userId ID of the user who sends the data stream. + * @param streamId The ID of the stream data. + * @param data The data stream. + * @param length The length (byte) of the data stream. + * @param sentTs The time when the data stream sent. + */ + virtual void onStreamMessage(uid_t userId, int streamId, const char* data, size_t length, uint64_t sentTs) { + (void)userId; + (void)streamId; + (void)data; + (void)length; + (void)sentTs; + } + + /** Occurs when the local user does not receive the data stream from the remote user. + * + * The SDK triggers this callback when the user fails to receive the data stream that another user sends + * by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method. + * + * @param userId ID of the user who sends the data stream. + * @param streamId The ID of the stream data. + * @param code The error code. + * @param missed The number of lost messages. + * @param cached The number of incoming cached messages when the data stream is + * interrupted. + */ + virtual void onStreamMessageError(uid_t userId, int streamId, int code, int missed, int cached) { + (void)userId; + (void)streamId; + (void)code; + (void)missed; + (void)cached; + } + + /** + * Occurs when the token expires. + * + * When the token expires during a call, the SDK triggers this callback to remind the app to renew the token. + * + * Upon receiving this callback, generate a new token at your app server and call + * `joinChannel` to pass the new token to the SDK. + * + */ + virtual void onRequestToken() {} + + /** + * Occurs when the token will expire in 30 seconds. + * + * When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token. + + * Upon receiving this callback, generate a new token at your app server and call + * \ref IRtcEngine::renewToken "renewToken" to pass the new Token to the SDK. + * + * + * @param token The token that will expire in 30 seconds. + */ + virtual void onTokenPrivilegeWillExpire(const char* token) { + (void)token; + } + + /** + * Occurs when connection license verification fails. + * + * You can know the reason accordding to error code + */ + virtual void onLicenseValidationFailure(LICENSE_ERROR_TYPE error) { + (void)error; + } + + /** Occurs when the first local audio frame is published. + * + * The SDK triggers this callback under one of the following circumstances: + * - The local client enables the audio module and calls `joinChannel` successfully. + * - The local client calls `muteLocalAudioStream(true)` and `muteLocalAudioStream(false)` in sequence. + * - The local client calls `disableAudio` and `enableAudio` in sequence. + * - The local client calls `pushAudioFrame` to successfully push the audio frame to the SDK. + * + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` to the SDK triggers this callback. + */ + virtual void onFirstLocalAudioFramePublished(int elapsed) { + (void)elapsed; + } + + /** Occurs when the SDK receives the first audio frame from a specific remote user. + * @deprecated Use `onRemoteAudioStateChanged` instead. + * + * @param uid ID of the remote user. + * @param elapsed The time elapsed (ms) from the loca user calling `joinChannel` + * until this callback is triggered. + */ + virtual void onFirstRemoteAudioFrame(uid_t uid, int elapsed) { + (void)uid; + (void)elapsed; + } + + /** + * Occurs when the SDK decodes the first remote audio frame for playback. + * + * @deprecated Use `onRemoteAudioStateChanged` instead. + * The SDK triggers this callback under one of the following circumstances: + * - The remote user joins the channel and sends the audio stream for the first time. + * - The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot + * receive audio in 15 seconds. Reasons for such an interruption include: + * - The remote user leaves channel. + * - The remote user drops offline. + * - The remote user calls muteLocalAudioStream to stop sending the audio stream. + * - The remote user calls disableAudio to disable audio. + * @param uid User ID of the remote user sending the audio stream. + * @param elapsed The time elapsed (ms) from the loca user calling `joinChannel` + * until this callback is triggered. + */ + virtual void onFirstRemoteAudioDecoded(uid_t uid, int elapsed) { + (void)uid; + (void)elapsed; + } + + /** Occurs when the local audio state changes. + * + * When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK + * triggers this callback to report the current state. This callback indicates the state of the local audio stream, + * and allows you to troubleshoot issues when audio exceptions occur. + * + * @note + * When the state is `LOCAL_AUDIO_STREAM_STATE_FAILED(3)`, see the `error` + * parameter for details. + * + * @param state State of the local audio. See #LOCAL_AUDIO_STREAM_STATE. + * @param error The error information of the local audio. + * See #LOCAL_AUDIO_STREAM_ERROR. + */ + virtual void onLocalAudioStateChanged(LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error) { + (void)state; + (void)error; + } + + /** Occurs when the remote audio state changes. + * + * When the audio state of a remote user (in the voice/video call channel) or host (in the live streaming channel) + * changes, the SDK triggers this callback to report the current state of the remote audio stream. + * + * @note This callback does not work properly when the number of users (in the voice/video call channel) or hosts + * (in the live streaming channel) in the channel exceeds 17. + * + * @param uid ID of the remote user whose audio state changes. + * @param state State of the remote audio. See #REMOTE_AUDIO_STATE. + * @param reason The reason of the remote audio state change. + * See #REMOTE_AUDIO_STATE_REASON. + * @param elapsed Time elapsed (ms) from the local user calling the + * `joinChannel` method until the SDK + * triggers this callback. + */ + virtual void onRemoteAudioStateChanged(uid_t uid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) { + (void)uid; + (void)state; + (void)reason; + (void)elapsed; + } + + /** + * Occurs when an active speaker is detected. + * + * After a successful call of `enableAudioVolumeIndication`, the SDK continuously detects which remote user has the + * loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, + * is the most active user. + * + * When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker. + * - If the most active remote speaker is always the same user, the SDK triggers the `onActiveSpeaker` callback only once. + * - If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker. + * + * @param userId The ID of the active speaker. A `uid` of 0 means the local user. + */ + virtual void onActiveSpeaker(uid_t userId) { (void)userId; } + /** Reports result of content inspection. + * + * @param result The result of content inspection: #CONTENT_INSPECT_RESULT. + */ + virtual void onContentInspectResult(media::CONTENT_INSPECT_RESULT result) { (void)result; } + /** Reports the result of taking a video snapshot. + * + * After a successful `takeSnapshot` method call, the SDK triggers this callback to report whether the snapshot is + * successfully taken, as well as the details for that snapshot. + * + * @param uid The user ID. A `uid` of 0 indicates the local user. + * @param filePath The local path of the snapshot. + * @param width The width (px) of the snapshot. + * @param height The height (px) of the snapshot. + * @param errCode The message that confirms success or gives the reason why the snapshot is not successfully taken: + * - 0: Success. + * - < 0: Failure. + * - -1: The SDK fails to write data to a file or encode a JPEG image. + * - -2: The SDK does not find the video stream of the specified user within one second after the `takeSnapshot` method call succeeds. + * - -3: Calling the `takeSnapshot` method too frequently. Call the `takeSnapshot` method after receiving the `onSnapshotTaken` + * callback from the previous call. + */ + virtual void onSnapshotTaken(uid_t uid, const char* filePath, int width, int height, int errCode) { + (void)uid; + (void)filePath; + (void)width; + (void)height; + (void)errCode; + } + /** + * Occurs when the user role switches in the interactive live streaming. + * + * @param oldRole The old role of the user: #CLIENT_ROLE_TYPE. + * @param newRole The new role of the user: #CLIENT_ROLE_TYPE. + * @param newRoleOptions The client role options of the new role: #ClientRoleOptions. + */ + virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) { + (void)oldRole; + (void)newRole; + (void)newRoleOptions; + } + /** + * Occurs when the user role in a Live-Broadcast channel fails to switch, for example, from a broadcaster + * to an audience or vice versa. + * + * @param reason The reason for failing to change the client role: #CLIENT_ROLE_CHANGE_FAILED_REASON. + * @param currentRole The current role of the user: #CLIENT_ROLE_TYPE. + */ + virtual void onClientRoleChangeFailed(CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) { + (void)reason; + (void)currentRole; + } + /** Occurs when the audio device volume changes. + @param deviceType The device type, see #MEDIA_DEVICE_TYPE + @param volume The volume of the audio device. + @param muted Whether the audio device is muted: + - true: The audio device is muted. + - false: The audio device is not muted. + */ + virtual void onAudioDeviceVolumeChanged(MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) { + (void)deviceType; + (void)volume; + (void)muted; + } + + /** + * Occurs when the state of the RTMP streaming changes. + * + * When the media push state changes, the SDK triggers this callback and reports the URL address and the current state + * of the media push. This callback indicates the state of the media push. When exceptions occur, you can troubleshoot + * issues by referring to the detailed error descriptions in the error code. + * + * @param url The URL address where the state of the media push changes. + * @param state The current state of the media push: #RTMP_STREAM_PUBLISH_STATE. + * @param errCode The detailed error information for the media push: #RTMP_STREAM_PUBLISH_ERROR_TYPE. + */ + virtual void onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, + RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) { + (void)url; + (void)state; + (void)errCode; + } + + /** Reports events during the media push. + * + * @param url The URL for media push. + * @param eventCode The event code of media push. See RTMP_STREAMING_EVENT for details. + */ + virtual void onRtmpStreamingEvent(const char* url, RTMP_STREAMING_EVENT eventCode) { + (void)url; + (void)eventCode; + } + + /** + * Occurs when the publisher's transcoding settings are updated. + * + * When the `LiveTranscoding` class in \ref IRtcEngine::setLiveTranscoding "setLiveTranscoding" + * updates, the SDK triggers this callback to report the update information. + * + * @note + * If you call the `setLiveTranscoding` method to set the `LiveTranscoding` class for the first time, the SDK + * does not trigger this callback. + */ + virtual void onTranscodingUpdated() {} + + /** Occurs when the local audio route changes (for Android, iOS, and macOS only). + + The SDK triggers this callback when the local audio route switches to an + earpiece, speakerphone, headset, or Bluetooth device. + @param routing The current audio output routing: + - -1: Default. + - 0: Headset. + - 1: Earpiece. + - 2: Headset with no microphone. + - 3: Speakerphone. + - 4: Loudspeaker. + - 5: Bluetooth headset. + */ + virtual void onAudioRoutingChanged(int routing) { (void)routing; } + + + /** + * Occurs when the state of the media stream relay changes. + * + * The SDK reports the state of the current media relay and possible error messages in this + * callback. + * + * @param state The state code: + * - `RELAY_STATE_IDLE(0)`: The SDK is initializing. + * - `RELAY_STATE_CONNECTING(1)`: The SDK tries to relay the media stream to the destination + * channel. + * - `RELAY_STATE_RUNNING(2)`: The SDK successfully relays the media stream to the destination + * channel. + * - `RELAY_STATE_FAILURE(3)`: A failure occurs. See the details in `code`. + * @param code The error code: + * - `RELAY_OK(0)`: The state is normal. + * - `RELAY_ERROR_SERVER_ERROR_RESPONSE(1)`: An error occurs in the server response. + * - `RELAY_ERROR_SERVER_NO_RESPONSE(2)`: No server response. You can call the leaveChannel method + * to leave the channel. + * - `RELAY_ERROR_NO_RESOURCE_AVAILABLE(3)`: The SDK fails to access the service, probably due to + * limited resources of the server. + * - `RELAY_ERROR_FAILED_JOIN_SRC(4)`: Fails to send the relay request. + * - `RELAY_ERROR_FAILED_JOIN_DEST(5)`: Fails to accept the relay request. + * - `RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC(6)`: The server fails to receive the media + * stream. + * - `RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST(7)`: The server fails to send the media stream. + * - `RELAY_ERROR_SERVER_CONNECTION_LOST(8)`: The SDK disconnects from the server due to poor + * network connections. You can call the leaveChannel method to leave the channel. + * - `RELAY_ERROR_INTERNAL_ERROR(9)`: An internal error occurs in the server. + * - `RELAY_ERROR_SRC_TOKEN_EXPIRED(10)`: The token of the source channel has expired. + * - `RELAY_ERROR_DEST_TOKEN_EXPIRED(11)`: The token of the destination channel has expired. + */ + virtual void onChannelMediaRelayStateChanged(int state, int code) { + (void)state; + (void)code; + } + + /** + * Reports events during the media stream relay. + * + * @param code The event code for media stream relay: + * - `RELAY_EVENT_NETWORK_DISCONNECTED(0)`: The user disconnects from the server due to poor + * network connections. + * - `RELAY_EVENT_NETWORK_CONNECTED(1)`: The network reconnects. + * - `RELAY_EVENT_PACKET_JOINED_SRC_CHANNEL(2)`: The user joins the source channel. + * - `RELAY_EVENT_PACKET_JOINED_DEST_CHANNEL(3)`: The user joins the destination channel. + * - `RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL(4)`: The SDK starts relaying the media stream to the + * destination channel. + * - `RELAY_EVENT_PACKET_RECEIVED_VIDEO_FROM_SRC(5)`: The server receives the video stream from + * the source channel. + * - `RELAY_EVENT_PACKET_RECEIVED_AUDIO_FROM_SRC(6)`: The server receives the audio stream from + * the source channel. + * - `RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL(7)`: The destination channel is updated. + * - `RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_REFUSED(8)`: The destination channel update fails due + * to internal reasons. Deprecated from 4.1.0 + * - `RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE(9)`: The destination channel does not + * change, which means that the destination channel fails to be updated. + * - `RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL(10)`: The destination channel name is NULL. + * - `RELAY_EVENT_VIDEO_PROFILE_UPDATE(11)`: The video profile is sent to the server. + */ + virtual void onChannelMediaRelayEvent(int code) { + (void)code; + } + /** + * Occurs when the published media stream falls back to an audio-only stream due to poor network conditions or + * switches back to video stream after the network conditions improve. + * + * If you call `setLocalPublishFallbackOption` and set `option` as `STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)`, this + * callback is triggered when the locally published stream falls back to audio-only mode due to poor uplink + * conditions, or when the audio stream switches back to the video after the uplink network condition improves. + * Once the published stream falls back to audio only, the remote app receives the `onRemoteVideoStateChanged` callback. + * + * @param isFallbackOrRecover Whether the published stream fell back to audio-only or switched back to the video: + * - `true`: The published stream fell back to audio-only due to poor network conditions. + * - `false`: The published stream switched back to the video after the network conditions improved. + */ + virtual void onLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover) { + (void)isFallbackOrRecover; + } + /** + * Occurs when the remote media stream falls back to audio-only stream due to poor network conditions or + * switches back to video stream after the network conditions improve. + * + * If you call `setRemoteSubscribeFallbackOption` and set `option` as `STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)`, this + * callback is triggered when the remotely subscribed media stream falls back to audio-only mode due to poor downlink + * conditions, or when the remotely subscribed media stream switches back to the video after the downlink network + * condition improves. + * + * @note Once the remote media stream is switched to the low stream due to poor network conditions, you can monitor + * the stream switch between a high and low stream in the `onRemoteVideoStats` callback. + * + * @param uid ID of the remote user sending the stream. + * @param isFallbackOrRecover Whether the remote media stream fell back to audio-only or switched back to the video: + * - `true`: The remote media stream fell back to audio-only due to poor network conditions. + * - `false`: The remote media stream switched back to the video stream after the network conditions improved. + */ + virtual void onRemoteSubscribeFallbackToAudioOnly(uid_t uid, bool isFallbackOrRecover) { + (void)uid; + (void)isFallbackOrRecover; + } + + /** Reports the transport-layer statistics of each remote audio stream. + * @deprecated Use `onRemoteAudioStats` instead. + + This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every + two seconds after the local user receives an audio packet from a remote user. During a call, when the user receives + the audio packet sent by the remote user/host, the callback is triggered every 2 seconds. + + @param uid ID of the remote user whose audio data packet is received. + @param delay The network time delay (ms) from the sender to the receiver. + @param lost The Packet loss rate (%) of the audio packet sent from the remote + user. + @param rxKBitRate Received bitrate (Kbps) of the audio packet sent from the + remote user. + */ + virtual void onRemoteAudioTransportStats(uid_t uid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) { + (void)uid; + (void)delay; + (void)lost; + (void)rxKBitRate; + } + + /** Reports the transport-layer statistics of each remote video stream. + * @deprecated Use `onRemoteVideoStats` instead. + + This callback reports the transport-layer statistics, such as the packet loss rate and network time + delay, once every two seconds after the local user receives a video packet from a remote user. + + During a call, when the user receives the video packet sent by the remote user/host, the callback is + triggered every 2 seconds. + + @param uid ID of the remote user whose video packet is received. + @param delay The network time delay (ms) from the remote user sending the + video packet to the local user. + @param lost The packet loss rate (%) of the video packet sent from the remote + user. + @param rxKBitRate The bitrate (Kbps) of the video packet sent from + the remote user. + */ + virtual void onRemoteVideoTransportStats(uid_t uid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) { + (void)uid; + (void)delay; + (void)lost; + (void)rxKBitRate; + } + + /** Occurs when the network connection state changes. + * + * When the network connection state changes, the SDK triggers this callback and reports the current + * connection state and the reason for the change. + + @param state The current connection state. See #CONNECTION_STATE_TYPE. + @param reason The reason for a connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnectionStateChanged( + CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason) { + (void)state; + (void)reason; + } + + /** Occurs when the WIFI message need be sent to the user. + * + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ + virtual void onWlAccMessage(WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) { + (void)reason; + (void)action; + (void)wlAccMsg; + } + + /** Occurs when SDK statistics wifi acceleration optimization effect. + * + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ + virtual void onWlAccStats(WlAccStats currentStats, WlAccStats averageStats) { + (void)currentStats; + (void)averageStats; + } + + /** Occurs when the local network type changes. + * + * This callback occurs when the connection state of the local user changes. You can get the + * connection state and reason for the state change in this callback. When the network connection + * is interrupted, this callback indicates whether the interruption is caused by a network type + * change or poor network conditions. + + @param type The type of the local network connection. See #NETWORK_TYPE. + */ + virtual void onNetworkTypeChanged(NETWORK_TYPE type) { + (void)type; + } + + /** Reports the built-in encryption errors. + * + * When encryption is enabled by calling `enableEncryption`, the SDK triggers this callback if an + * error occurs in encryption or decryption on the sender or the receiver side. + + @param errorType The error type. See #ENCRYPTION_ERROR_TYPE. + */ + virtual void onEncryptionError(ENCRYPTION_ERROR_TYPE errorType) { + (void)errorType; + } + + /** Occurs when the SDK cannot get the device permission. + * + * When the SDK fails to get the device permission, the SDK triggers this callback to report which + * device permission cannot be got. + * + * @note This method is for Android and iOS only. + + @param permissionType The type of the device permission. See #PERMISSION_TYPE. + */ + virtual void onPermissionError(PERMISSION_TYPE permissionType) { + (void)permissionType; + } + + /** Occurs when the local user registers a user account. + * + * After the local user successfully calls `registerLocalUserAccount` to register the user account + * or calls `joinChannelWithUserAccount` to join a channel, the SDK triggers the callback and + * informs the local user's UID and User Account. + + @param uid The ID of the local user. + @param userAccount The user account of the local user. + */ + virtual void onLocalUserRegistered(uid_t uid, const char* userAccount) { + (void)uid; + (void)userAccount; + } + + /** Occurs when the SDK gets the user ID and user account of the remote user. + + After a remote user joins the channel, the SDK gets the UID and user account of the remote user, + caches them in a mapping table object (`userInfo`), and triggers this callback on the local client. + + @param uid The ID of the remote user. + @param info The `UserInfo` object that contains the user ID and user account of the remote user. + */ + virtual void onUserInfoUpdated(uid_t uid, const UserInfo& info) { + (void)uid; + (void)info; + } + /** + * Reports the user log upload result + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ + virtual void onUploadLogResult(const char* requestId, bool success, UPLOAD_ERROR_REASON reason) { + (void)requestId; + (void)success; + (void)reason; + } + + /** + * Occurs when the audio subscribing state changes. + * + * @param channel The name of the channel. + * @param uid The ID of the remote user. + * @param oldState The previous subscribing status: #STREAM_SUBSCRIBE_STATE. + * @param newState The current subscribing status: #STREAM_SUBSCRIBE_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the previous state to the current state. + */ + virtual void onAudioSubscribeStateChanged(const char* channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) { + (void)channel; + (void)uid; + (void)oldState; + (void)newState; + (void)elapseSinceLastState; + } + + /** + * Occurs when the video subscribing state changes. + * + * @param channel The name of the channel. + * @param uid The ID of the remote user. + * @param oldState The previous subscribing status: #STREAM_SUBSCRIBE_STATE. + * @param newState The current subscribing status: #STREAM_SUBSCRIBE_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the previous state to the current state. + */ + virtual void onVideoSubscribeStateChanged(const char* channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) { + (void)channel; + (void)uid; + (void)oldState; + (void)newState; + (void)elapseSinceLastState; + } + + /** + * Occurs when the audio publishing state changes. + * + * @param channel The name of the channel. + * @param oldState The previous publishing state: #STREAM_PUBLISH_STATE. + * @param newState The current publishing state: #STREAM_PUBLISH_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the previous state to the current state. + */ + virtual void onAudioPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) { + (void)channel; + (void)oldState; + (void)newState; + (void)elapseSinceLastState; + } + + /** + * Occurs when the video publishing state changes. + * + * @param source The video source type. + * @param channel The name of the channel. + * @param oldState The previous publishing state: #STREAM_PUBLISH_STATE. + * @param newState The current publishing state: #STREAM_PUBLISH_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the previous state to the current state. + */ + virtual void onVideoPublishStateChanged(VIDEO_SOURCE_TYPE source, const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) { + (void)source; + (void)channel; + (void)oldState; + (void)newState; + (void)elapseSinceLastState; + } + /** + * The event callback of the extension. + * + * To listen for events while the extension is running, you need to register this callback. + * + * @deprecated This method is deprecated. override needExtensionContext method + * and use onEventWithContext instead + * + * @param provider The name of the extension provider. + * @param extension The name of the extension. + * @param key The key of the extension. + * @param value The value of the extension key. + */ + virtual void onExtensionEvent(const char* provider, const char* extension, const char* key, const char* value) __deprecated { + (void)provider; + (void)extension; + (void)key; + (void)value; + } + /** + * Occurs when the extension is enabled. + * + * After a successful create of filter, the extension triggers this callback. + * + * @deprecated This method is deprecated. override needExtensionContext method + * and use onExtensionStartedWithContext instead + * + * @param provider The name of the extension provider. + * @param extension The name of the extension. + */ + virtual void onExtensionStarted(const char* provider, const char* extension) __deprecated { + (void)provider; + (void)extension; + } + /** + * Occurs when the extension is disabled. + * + * After a successful create of filter, the extension triggers this callback. + * + * @deprecated This method is deprecated. override needExtensionContext method + * and use onExtensionStoppedWithContext instead + * + * @param provider The name of the extension provider. + * @param extension The name of the extension. + */ + virtual void onExtensionStopped(const char* provider, const char* extension) __deprecated { + (void)provider; + (void)extension; + } + /** + * Occurs when the extension runs incorrectly. + * + * When the extension runs in error, the extension triggers + * this callback and reports the error code and reason. + * + * @deprecated This method is deprecated. override needExtensionContext method + * and use onExtensionErrorWithContext instead + * + * @param provider The name of the extension provider. + * @param extension The name of the extension. + * @param error The error code. For details, see the extension documentation provided by the extension provider. + * @param message The error message. For details, see the extension documentation provided by the extension provider. + */ + virtual void onExtensionError(const char* provider, const char* extension, int error, const char* message) __deprecated { + (void)provider; + (void)extension; + (void)error; + (void)message; + } + /** + * Occurs when the user account is updated. + * + * @param uid The user ID. + * @param userAccount The user account. + */ + virtual void onUserAccountUpdated(uid_t uid, const char* userAccount){ + (void)uid; + (void)userAccount; + } + + /** Whether need ExtensionContext \ref agoro::rtc::ExtensionContext + * + * recommend override for true + * return false, then callback interface with onExtensionEvent、onExtensionStarted、onExtensionStopped、onExtensionError + * return true, then callback interface conterpart with *WithContext interface + */ + virtual bool needExtensionContext() {return false;} + + /** + * The event callback of the extension. + * + * To listen for events while the extension is running, you need to register this callback. + * + * @param context The context of the extension. + * @param key The key of the extension. + * @param value The value of the extension key. + */ + virtual void onExtensionEventWithContext(const ExtensionContext &context, const char* key, const char* value) { + (void)context; + (void)key; + (void)value; + } + + /** + * Occurs when the extension is enabled. + * + * After a successful create of filter , the extension triggers this callback. + * + * @param context The context of the extension. + */ + virtual void onExtensionStartedWithContext(const ExtensionContext &context) { + (void)context; + } + + /** + * Occurs when the extension is disabled. + * + * After a successful create of filter, the extension triggers this callback. + * + * @param context The context of the extension. + */ + virtual void onExtensionStoppedWithContext(const ExtensionContext &context) { + (void)context; + } + + /** + * Occurs when the extension runs incorrectly. + * + * When the extension runs in error, the extension triggers + * this callback and reports the error code and reason. + * + * @param context The context of the extension. + * @param error The error code. For details, see the extension documentation provided by the extension provider. + * @param message The error message. For details, see the extension documentation provided by the extension provider. + */ + virtual void onExtensionErrorWithContext(const ExtensionContext &context, int error, const char* message) { + (void)context; + (void)error; + (void)message; + } + + /** + * Reports the tracing result of video rendering event of the user. + * + * @param uid The user ID. + * @param currentEvent The current event of the tracing result: #MEDIA_TRACE_EVENT. + * @param tracingInfo The tracing result: #VideoRenderingTracingInfo. + */ + virtual void onVideoRenderingTracingResult(uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) { + (void)uid; + (void)currentEvent; + (void)tracingInfo; + } + + /** + * Occurs when local video transcoder stream has an error. + * + * @param stream Stream type of TranscodingVideoStream. + * @param error Error code of VIDEO_TRANSCODER_ERROR. + */ + virtual void onLocalVideoTranscoderError(const TranscodingVideoStream& stream, VIDEO_TRANSCODER_ERROR error){ + (void)stream; + (void)error; + } + + virtual void onTranscodedStreamLayoutInfo(uid_t uid, int width, int height, int layoutCount,const VideoLayout* layoutlist) { + (void)uid; + (void)width; + (void)height; + (void)layoutCount; + (void)layoutlist; + } + + /** + * @technical preview + */ + virtual void onAudioMetadataReceived(uid_t uid, const char* metadata, size_t length) { + (void)uid; + (void)metadata; + (void)length; + } +}; + +/** + * The IVideoDeviceCollection class. You can get information related to video devices through this interface. + */ +class IVideoDeviceCollection { + public: + virtual ~IVideoDeviceCollection() {} + + /** + * Gets the total number of the indexed video capture devices in the system. + * + * @return The total number of the indexed video capture devices. + */ + virtual int getCount() = 0; + + /** + * Specifies a device with the device ID. + * + * @param deviceIdUTF8 The device ID. The maximum length is #MAX_DEVICE_ID_LENGTH_TYPE. Plugging or + * unplugging the audio device does not change the value of deviceId. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDevice(const char deviceIdUTF8[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets a specified piece of information about an indexed video device. + * + * @param index The index value of the video device. The value of this parameter must be less than the value returned in `getCount`. + * @param deviceNameUTF8 The name of the device. The maximum length is #MAX_DEVICE_ID_LENGTH. + * @param deviceIdUTF8 The device ID of the video device. The maximum length is #MAX_DEVICE_ID_LENGTH. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDevice(int index, char deviceNameUTF8[MAX_DEVICE_ID_LENGTH], + char deviceIdUTF8[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Releases all the resources occupied by the IVideoDeviceCollection object. + */ + virtual void release() = 0; +}; + +/** + * The IVideoDeviceManager class. + */ +class IVideoDeviceManager { + public: + virtual ~IVideoDeviceManager() {} + /** + * Enumerates the video devices. + * + * This method returns an `IVideoDeviceCollection` object including all video devices in the system. + * With the `IVideoDeviceCollection` object, the application can enumerate video devices. The + * application must call the release method to release the returned object after using it. + * + * @return + * - Success: An `IVideoDeviceCollection` object including all video devices in the system. + * - Failure: NULL. + */ + virtual IVideoDeviceCollection* enumerateVideoDevices() = 0; + + /** + * Specifies the video capture device with the device ID. + * + * @param deviceIdUTF8 he device ID. You can get the device ID by calling `enumerateVideoDevices`. + * The maximum length is #MAX_DEVICE_ID_LENGTH. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDevice(const char deviceIdUTF8[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Retrieves the current video capture device. + * @param deviceIdUTF8 Output parameter. The device ID. The maximum length is #MAX_DEVICE_ID_LENGTH_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDevice(char deviceIdUTF8[MAX_DEVICE_ID_LENGTH]) = 0; + +#if defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \ + (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + /** + * Gets the number of video formats supported by the specified video capture device. + * + * Video capture devices may support multiple video formats, and each format supports different + * combinations of video frame width, video frame height, and frame rate. + * + * You can call this method to get how many video formats the specified video capture device can + * support, and then call `getCapability` to get the specific video frame information in the + * specified video format. + * + * @param deviceIdUTF8 The ID of the video capture device. + * + * @return + * - 0: Success. Returns the number of video formats supported by this device. For example: If the + * specified camera supports 10 different video formats, the return value is 10. + * - < 0: Failure. + */ + virtual int numberOfCapabilities(const char* deviceIdUTF8) = 0; + + /** + * Gets the detailed video frame information of the video capture device in the specified video format. + * + * After calling `numberOfCapabilities` to get the number of video formats supported by the video capture + * device, you can call this method to get the specific video frame information supported by the + * specified index number. + * + * @param deviceIdUTF8 ID of the video capture device. + * @param deviceCapabilityNumber The index number of the video format. If the return value of `numberOfCapabilities` + * is i, the value range of this parameter is [0,i). + * @param capability Output parameter. Indicates the specific information of the specified video format, + * including width (px), height (px), and frame rate (fps). See VideoFormat. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getCapability(const char* deviceIdUTF8, const uint32_t deviceCapabilityNumber, VideoFormat& capability) = 0; +#endif + /** + * Starts the video capture device test. + * + * This method tests whether the video capture device works properly. + * Before calling this method, ensure that you have already called + * \ref IRtcEngine::enableVideo "enableVideo", and the HWND window handle of + * the incoming parameter is valid. + * + * @param hwnd An Output parameter that specifies the window handle to display the video. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startDeviceTest(view_t hwnd) = 0; + + /** + * Stops the video capture device test. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopDeviceTest() = 0; + + /** + * Releases all the resources occupied by the `IVideoDeviceManager` object. + */ + virtual void release() = 0; +}; + + +class IRtcEngineEventHandlerEx; +/** + * The context of IRtcEngine. + */ +struct RtcEngineContext { + /** + * The event handler for IRtcEngine. + */ + IRtcEngineEventHandler* eventHandler; + /** + * The App ID issued by Agora for your project. Only users in apps with the same App ID can join the + * same channel and communicate with each other. An App ID can only be used to create one `IRtcEngine` + * instance. To change your App ID, call release to destroy the current IRtcEngine instance, and then + * create a new one. + */ + const char* appId; + /** + * - For Android, it is the context of Activity or Application. + * - For Windows, it is the window handle of app. Once set, this parameter enables you to plug + * or unplug the video devices while they are powered. + */ + void* context; + /** + * The channel profile. See #CHANNEL_PROFILE_TYPE. + */ + CHANNEL_PROFILE_TYPE channelProfile; + + /** + * The license used for verification when connectting channel. Charge according to the license + */ + const char* license; + + /** + * The audio application scenario. See #AUDIO_SCENARIO_TYPE. + * + * @note Agora recommends the following scenarios: + * - `AUDIO_SCENARIO_DEFAULT(0)` + * - `AUDIO_SCENARIO_GAME_STREAMING(3)` + */ + AUDIO_SCENARIO_TYPE audioScenario; + /** + * The region for connection. This is an advanced feature and applies to scenarios that have regional restrictions. + * + * For the regions that Agora supports, see #AREA_CODE. The area codes support bitwise operation. + * + * After specifying the region, the app integrated with the Agora SDK connects to the Agora servers + * within that region. + */ + unsigned int areaCode; + + /** + * The log files that the SDK outputs. See LogConfig. + * + * By default, the SDK generates five SDK log files and five API call log files with the following rules: + * - The SDK log files are: `agorasdk.log`, `agorasdk.1.log`, `agorasdk.2.log`, `agorasdk.3.log`, and `agorasdk.4.log`. + * - The API call log files are: `agoraapi.log`, `agoraapi.1.log`, `agoraapi.2.log`, `agoraapi.3.log`, and `agoraapi.4.log`. + * - The default size for each SDK log file is 1,024 KB; the default size for each API call log file is 2,048 KB. These log files are encoded in UTF-8. + * - The SDK writes the latest logs in `agorasdk.log` or `agoraapi.log`. + * - When `agorasdk.log` is full, the SDK processes the log files in the following order: + * - Delete the `agorasdk.4.log` file (if any). + * - Rename `agorasdk.3.log` to `agorasdk.4.log`. + * - Rename `agorasdk.2.log` to `agorasdk.3.log`. + * - Rename `agorasdk.1.log` to `agorasdk.2.log`. + * - Create a new `agorasdk.log` file. + */ + commons::LogConfig logConfig; + + /** + * Thread priority for SDK common threads + */ + Optional threadPriority; + + /** + * Whether to use egl context in the current thread as sdk‘s root egl context, + * which is shared by all egl related modules. eg. camera capture, video renderer. + * + * @note + * This property applies to Android only. + */ + bool useExternalEglContext; + + /** + * Determines whether to enable domain limit + * -true: only connect to servers which already parsed by DNS + * -false: (Default) connect to servers with no limit + */ + bool domainLimit; + + /** + * Whether to automatically register Agora extensions when initializing RtcEngine. + * -true: (Default) Automatically register Agora extensions. + * -false: Do not automatically register Agora extensions. The user calls EnableExtension to manually register an Agora extension. + */ + bool autoRegisterAgoraExtensions; + + RtcEngineContext() + : eventHandler(NULL), appId(NULL), context(NULL), + channelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING), + license(NULL), + audioScenario(AUDIO_SCENARIO_DEFAULT), + areaCode(AREA_CODE_GLOB), + logConfig(), useExternalEglContext(false), domainLimit(false), autoRegisterAgoraExtensions(true) {} +}; + +/** Definition of IMetadataObserver +*/ +class IMetadataObserver { +public: + /** The metadata type. + * + * @note We only support video metadata for now. + */ + enum METADATA_TYPE + { + /** -1: (Not supported) Unknown. + */ + UNKNOWN_METADATA = -1, + /** 0: (Supported) Video metadata. + */ + VIDEO_METADATA = 0, + }; + /** + * The maximum metadata size. + */ + enum MAX_METADATA_SIZE_TYPE + { + INVALID_METADATA_SIZE_IN_BYTE = -1, + DEFAULT_METADATA_SIZE_IN_BYTE = 512, + MAX_METADATA_SIZE_IN_BYTE = 1024 + }; + + /** Metadata. + */ + struct Metadata + { + /** The User ID that sent the metadata. + * - For the receiver: The user ID of the user who sent the `metadata`. + * - For the sender: Ignore this value. + */ + unsigned int uid; + /** The buffer size of the sent or received `metadata`. + */ + unsigned int size; + /** The buffer address of the sent or received `metadata`. + */ + unsigned char *buffer; + /** The timestamp (ms) of the `metadata`. + * + */ + long long timeStampMs; + }; + + virtual ~IMetadataObserver() {} + + /** Occurs when the SDK requests the maximum size of the metadata. + * + * + * After successfully complete the registration by calling `registerMediaMetadataObserver`, the SDK + * triggers this callback once every video frame is sent. You need to specify the maximum size of + * the metadata in the return value of this callback. + * + * @return The maximum size of the buffer of the metadata that you want to use. The highest value is + * 1024 bytes. Ensure that you set the return value. + */ + virtual int getMaxMetadataSize() { return DEFAULT_METADATA_SIZE_IN_BYTE; } + + /** Occurs when the local user receives the metadata. + + @note Ensure that the size of the metadata does not exceed the value set in the `getMaxMetadataSize` callback. + + @param metadataThe metadata that the user wants to send. For details, see Metadata. + @param source_type The video data type: #VIDEO_SOURCE_TYPE. + @return + - true: Send. + - false: Do not send. + */ + virtual bool onReadyToSendMetadata(Metadata &metadata, VIDEO_SOURCE_TYPE source_type) = 0; + + /** Occurs when the local user receives the metadata. + * + * @param metadata The metadata received. See Metadata. + * + * @note If the receiver is audience, the receiver cannot get the NTP timestamp (ms) + * that the metadata sends. + */ + virtual void onMetadataReceived(const Metadata &metadata) = 0; +}; + +// The error codes for media streaming +// GENERATED_JAVA_ENUM_PACKAGE: io.agora.streaming +enum DIRECT_CDN_STREAMING_ERROR { + // No error occurs. + DIRECT_CDN_STREAMING_ERROR_OK = 0, + // A general error occurs (no specified reason). + DIRECT_CDN_STREAMING_ERROR_FAILED = 1, + // Audio publication error. + DIRECT_CDN_STREAMING_ERROR_AUDIO_PUBLICATION = 2, + // Video publication error. + DIRECT_CDN_STREAMING_ERROR_VIDEO_PUBLICATION = 3, + + DIRECT_CDN_STREAMING_ERROR_NET_CONNECT = 4, + // Already exist stream name. + DIRECT_CDN_STREAMING_ERROR_BAD_NAME = 5, +}; + +// The connection state of media streaming +// GENERATED_JAVA_ENUM_PACKAGE: io.agora.streaming +enum DIRECT_CDN_STREAMING_STATE { + + DIRECT_CDN_STREAMING_STATE_IDLE = 0, + + DIRECT_CDN_STREAMING_STATE_RUNNING = 1, + + DIRECT_CDN_STREAMING_STATE_STOPPED = 2, + + DIRECT_CDN_STREAMING_STATE_FAILED = 3, + + DIRECT_CDN_STREAMING_STATE_RECOVERING = 4, +}; + +/** + * The statistics of the Direct Cdn Streams. + */ +struct DirectCdnStreamingStats { + /** + * Width of the video pushed by rtmp. + */ + int videoWidth; + + /** + * Height of the video pushed by rtmp. + */ + int videoHeight; + + /** + * The frame rate of the video pushed by rtmp. + */ + int fps; + + /** + * Real-time bit rate of the video streamed by rtmp. + */ + int videoBitrate; + + /** + * Real-time bit rate of the audio pushed by rtmp. + */ + int audioBitrate; +}; + +/** + * The event handler for direct cdn streaming + * + */ +class IDirectCdnStreamingEventHandler { + public: + virtual ~IDirectCdnStreamingEventHandler() {} + + /** + * Event callback of direct cdn streaming + * @param state Current status + * @param error Error Code + * @param message Message + */ + virtual void onDirectCdnStreamingStateChanged(DIRECT_CDN_STREAMING_STATE state, DIRECT_CDN_STREAMING_ERROR error, const char* message) { + (void)state; + (void)error; + (void)message; + }; + + virtual void onDirectCdnStreamingStats(const DirectCdnStreamingStats& stats) { + (void)stats; + }; +}; + +/** + * The channel media options. + */ +struct DirectCdnStreamingMediaOptions { + /** + * Determines whether to publish the video of the camera track. + * - true: Publish the video track of the camera capturer. + * - false: (Default) Do not publish the video track of the camera capturer. + */ + Optional publishCameraTrack; + /** + * Determines whether to publish the recorded audio. + * - true: Publish the recorded audio. + * - false: (Default) Do not publish the recorded audio. + */ + Optional publishMicrophoneTrack; + /** + * Determines whether to publish the audio of the custom audio track. + * - true: Publish the audio of the custom audio track. + * - false: (Default) Do not publish the audio of the custom audio track. + */ + Optional publishCustomAudioTrack; + /** + * Determines whether to publish the video of the custom video track. + * - true: Publish the video of the custom video track. + * - false: (Default) Do not publish the video of the custom video track. + */ + Optional publishCustomVideoTrack; + /** + * Determines whether to publish the audio track of media player source. + * - true: Publish the audio track of media player source. + * - false: (Default) Do not publish the audio track of media player source. + */ + Optional publishMediaPlayerAudioTrack; + /** + * Determines which media player source should be published. + * You can get the MediaPlayerId after calling getMediaPlayerId() of AgoraMediaPlayer. + */ + Optional publishMediaPlayerId; + /** + * The custom video track id which will used to publish. + * You can get the VideoTrackId after calling createCustomVideoTrack() of IRtcEngine. + */ + Optional customVideoTrackId; + + DirectCdnStreamingMediaOptions() {} + ~DirectCdnStreamingMediaOptions() {} + + void SetAll(const DirectCdnStreamingMediaOptions& change) { +#define SET_FROM(X) SetFrom(&X, change.X) + SET_FROM(publishCameraTrack); + SET_FROM(publishMicrophoneTrack); + SET_FROM(publishCustomAudioTrack); + SET_FROM(publishCustomVideoTrack); + SET_FROM(publishMediaPlayerAudioTrack); + SET_FROM(publishMediaPlayerId); + SET_FROM(customVideoTrackId); +#undef SET_FROM + } + + bool operator==(const DirectCdnStreamingMediaOptions& o) const { +#define BEGIN_COMPARE() bool b = true +#define ADD_COMPARE(X) b = (b && (X == o.X)) +#define END_COMPARE() + + BEGIN_COMPARE(); + ADD_COMPARE(publishCameraTrack); + ADD_COMPARE(publishMicrophoneTrack); + ADD_COMPARE(publishCustomAudioTrack); + ADD_COMPARE(publishCustomVideoTrack); + ADD_COMPARE(publishMediaPlayerAudioTrack); + ADD_COMPARE(customVideoTrackId); + ADD_COMPARE(publishMediaPlayerId); + END_COMPARE(); + +#undef BEGIN_COMPARE +#undef ADD_COMPARE +#undef END_COMPARE + return b; + } + + DirectCdnStreamingMediaOptions& operator=(const DirectCdnStreamingMediaOptions& replace) { + if (this != &replace) { +#define REPLACE_BY(X) ReplaceBy(&X, replace.X) + + REPLACE_BY(publishCameraTrack); + REPLACE_BY(publishMicrophoneTrack); + REPLACE_BY(publishCustomAudioTrack); + REPLACE_BY(publishCustomVideoTrack); + REPLACE_BY(publishMediaPlayerAudioTrack); + REPLACE_BY(customVideoTrackId); + REPLACE_BY(publishMediaPlayerId); +#undef REPLACE_BY + } + return *this; + } +}; + +/** + * The information for extension. + */ +struct ExtensionInfo { + /** + * The type of media device. + */ + agora::media::MEDIA_SOURCE_TYPE mediaSourceType; + + /** + * The id of the remote user on which the extension works. + * + * @note remoteUid = 0 means that the extension works on all remote streams. + */ + uid_t remoteUid; + + /** + * The unique channel name for the AgoraRTC session in the string format. The string + * length must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", + * "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + */ + const char* channelId; + + /** + * User ID: A 32-bit unsigned integer ranging from 1 to (2^32-1). It must be unique. + */ + uid_t localUid; + + ExtensionInfo() + : mediaSourceType(agora::media::UNKNOWN_MEDIA_SOURCE), + remoteUid(0), + channelId(NULL), + localUid(0) {} +}; + +class IMediaPlayer; + +/** + * The IRtcEngine class, which is the basic interface of the Agora SDK that implements the core functions of real-time communication. + * + * `IRtcEngine` provides the main methods that your app can call. + * + * Before calling other APIs, you must call createAgoraRtcEngine to create an `IRtcEngine` object. + */ +class IRtcEngine : public agora::base::IEngineBase { + public: + /** + * Releases the IRtcEngine object. + * + * This method releases all resources used by the Agora SDK. Use this method for apps in which users + * occasionally make voice or video calls. When users do not make calls, you can free up resources for + * other operations. + * + * After a successful method call, you can no longer use any method or callback in the SDK anymore. + * If you want to use the real-time communication functions again, you must call `createAgoraRtcEngine` + * and `initialize` to create a new `IRtcEngine` instance. + * + * @note If you want to create a new `IRtcEngine` instance after destroying the current one, ensure + * that you wait till the `release` method execution to complete. + * + * @param sync Determines whether this method is a synchronous call. + * - `true`: This method is a synchronous call, which means that the result of this method call + * returns after the IRtcEngine object resources are released. Do not call this method + * in any callback generated by the SDK, or it may result in a deadlock. The SDK automatically + * detects the deadlock and turns this method into an asynchronous call, but the test itself takes + * extra time. + * - `false`: This method is an asynchronous call. The result returns immediately even when the + * IRtcEngine object resources are not released. + * + */ + virtual void release(bool sync = false) = 0; + + /** + * Initializes `IRtcEngine`. + * + * All called methods provided by the `IRtcEngine` class are executed asynchronously. Agora + * recommends calling these methods in the same thread. + * + * @note + * - Before calling other APIs, you must call `createAgoraRtcEngine` and `initialize `to create and + * initialize the `IRtcEngine` object. + * - The SDK supports creating only one `IRtcEngine` instance for an app. + * + * @param context The RtcEngineContext object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initialize(const RtcEngineContext& context) = 0; + + /** + * Gets the pointer to the specified interface. + * + * @param iid The ID of the interface. See #INTERFACE_ID_TYPE for details. + * @param inter Output parameter. The pointer to the specified interface. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int queryInterface(INTERFACE_ID_TYPE iid, void** inter) = 0; + + + /** + * Gets the SDK version. + * @param build The build number. + * @return The version of the current SDK in the string format. + */ + virtual const char* getVersion(int* build) = 0; + + /** + * Gets the warning or error description. + * @param code The error code or warning code reported by the SDK. + * @return The specific error or warning description. + */ + virtual const char* getErrorDescription(int code) = 0; + + /** + * Queries the capacity of the current device codec. + * + * @param codec_info An array of the codec cap information: CodecCapInfo. + * @param size The array size. + * @return + * 0: Success. + * < 0: Failure. + */ + virtual int queryCodecCapability(CodecCapInfo* codec_info, int& size) = 0; + + /** + * Queries the score of the current device. + * + * @return + * > 0: If the value is greater than 0, it means that the device score has been retrieved and represents the score value. + * Most devices score between 60-100, with higher scores indicating better performance. + * + * < 0: Failure. + */ + virtual int queryDeviceScore() = 0; + + /** + * Preload a channel. + * + * This method enables users to preload a channel. + * + * A successful call of this method will reduce the time of joining the same channel. + * + * Note: + * 1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available. + * 2. Renew the token of the preloaded channel by calling this method with the same 'channelId' and 'uid'. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid The user ID. This parameter is used to identify the user in the channel for real-time + * audio and video interaction. You need to set and manage user IDs yourself, and ensure that each + * user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value + * range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user + * ID and returns it in the onJoinChannelSuccess callback. Your application must record and maintain + * the returned user ID, because the SDK does not do so. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * preload the channel again. + */ + virtual int preloadChannel(const char* token, const char* channelId, uid_t uid) = 0; + + /** + * Preload a channel. + * + * This method enables users to preload a channel. + * + * A successful call of this method will reduce the time of joining the same channel. + * + * Note: + * 1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available. + * 2. Renew the token of the preloaded channel by calling this method with the same 'channelId' and 'userAccount'. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the userAccount parameter is empty. + * You need to pass in a valid parameter and preload the channel again. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * preload the channel again. + */ + virtual int preloadChannel(const char* token, const char* channelId, const char* userAccount) = 0; + + /** + * Update token of the preloaded channels. + * + * An easy way to update all preloaded channels' tokens, if all preloaded channels use the same token. + * + * If preloaded channels use different tokens, we need to call the 'preloadChannel' method with the same 'channelId' + * and 'uid' or 'userAccount' to update the corresponding token. + * + * @param token The token generated on your server for authentication. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The token is invalid. You need to pass in a valid token and update the token again. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + */ + virtual int updatePreloadChannelToken(const char* token) = 0; + + /** + * Joins a channel. + * + * This method enables users to join a channel. Users in the same channel can talk to each other, + * and multiple users in the same channel can start a group chat. Users with different App IDs + * cannot call each other. + * + * A successful call of this method triggers the following callbacks: + * - The local client: The `onJoinChannelSuccess` and `onConnectionStateChanged` callbacks. + * - The remote client: `onUserJoined`, if the user joining the channel is in the Communication + * profile or is a host in the Live-broadcasting profile. + * + * When the connection between the client and Agora's server is interrupted due to poor network + * conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins + * the channel, the SDK triggers the `onRejoinChannelSuccess` callback on the local client. + * + * @note Once a user joins the channel, the user subscribes to the audio and video streams of all + * the other users in the channel by default, giving rise to usage and billing calculation. To + * stop subscribing to a specified stream or all remote streams, call the corresponding `mute` methods. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param info (Optional) Reserved for future use. + * @param uid The user ID. This parameter is used to identify the user in the channel for real-time + * audio and video interaction. You need to set and manage user IDs yourself, and ensure that each + * user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value + * range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user + * ID and returns it in the onJoinChannelSuccess callback. Your application must record and maintain + * the returned user ID, because the SDK does not do so. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set + * to an integer, or the value of a member in the `ChannelMediaOptions` structure is invalid. You need + * to pass in a valid parameter and join the channel again. + * - -3: Failes to initialize the `IRtcEngine` object. You need to reinitialize the IRtcEngine object. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -8: The internal state of the IRtcEngine object is wrong. The typical cause is that you call + * this method to join the channel without calling `stopEchoTest` to stop the test after calling + * `startEchoTest` to start a call loop test. You need to call `stopEchoTest` before calling this method. + * - -17: The request to join the channel is rejected. The typical cause is that the user is in the + * channel. Agora recommends using the `onConnectionStateChanged` callback to get whether the user is + * in the channel. Do not call this method to join the channel unless you receive the + * `CONNECTION_STATE_DISCONNECTED(1)` state. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * rejoin the channel. + * - -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel. + */ + virtual int joinChannel(const char* token, const char* channelId, const char* info, + uid_t uid) = 0; + + /** + * Joins a channel with media options. + * + * This method enables users to join a channel. Users in the same channel can talk to each other, + * and multiple users in the same channel can start a group chat. Users with different App IDs + * cannot call each other. + * + * A successful call of this method triggers the following callbacks: + * - The local client: The `onJoinChannelSuccess` and `onConnectionStateChanged` callbacks. + * - The remote client: `onUserJoined`, if the user joining the channel is in the Communication + * profile or is a host in the Live-broadcasting profile. + * + * When the connection between the client and Agora's server is interrupted due to poor network + * conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins + * the channel, the SDK triggers the `onRejoinChannelSuccess` callback on the local client. + * + * Compared to `joinChannel`, this method adds the options parameter to configure whether to + * automatically subscribe to all remote audio and video streams in the channel when the user + * joins the channel. By default, the user subscribes to the audio and video streams of all + * the other users in the channel, giving rise to usage and billings. To unsubscribe, set the + * `options` parameter or call the `mute` methods accordingly. + * + * @note + * - This method allows users to join only one channel at a time. + * - Ensure that the app ID you use to generate the token is the same app ID that you pass in the + * `initialize` method; otherwise, you may fail to join the channel by token. + * + * @param token The token generated on your server for authentication. + * + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid The user ID. This parameter is used to identify the user in the channel for real-time + * audio and video interaction. You need to set and manage user IDs yourself, and ensure that each + * user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value + * range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user + * ID and returns it in the `onJoinChannelSuccess` callback. Your application must record and maintain + * the returned user ID, because the SDK does not do so. + * @param options The channel media options: ChannelMediaOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set + * to an integer, or the value of a member in the `ChannelMediaOptions` structure is invalid. You need + * to pass in a valid parameter and join the channel again. + * - -3: Failes to initialize the `IRtcEngine` object. You need to reinitialize the IRtcEngine object. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -8: The internal state of the IRtcEngine object is wrong. The typical cause is that you call + * this method to join the channel without calling `stopEchoTest` to stop the test after calling + * `startEchoTest` to start a call loop test. You need to call `stopEchoTest` before calling this method. + * - -17: The request to join the channel is rejected. The typical cause is that the user is in the + * channel. Agora recommends using the `onConnectionStateChanged` callback to get whether the user is + * in the channel. Do not call this method to join the channel unless you receive the + * `CONNECTION_STATE_DISCONNECTED(1)` state. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * rejoin the channel. + * - -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel. + */ + virtual int joinChannel(const char* token, const char* channelId, uid_t uid, + const ChannelMediaOptions& options) = 0; + + /** + * Updates the channel media options after joining the channel. + * + * @param options The channel media options: ChannelMediaOptions. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateChannelMediaOptions(const ChannelMediaOptions& options) = 0; + + /** + * Leaves the channel. + * + * This method allows a user to leave the channel, for example, by hanging up or exiting a call. + * + * This method is an asynchronous call, which means that the result of this method returns even before + * the user has not actually left the channel. Once the user successfully leaves the channel, the + * SDK triggers the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel" callback. + * + * @note + * If you call \ref release "release" immediately after this method, the leaveChannel process will be + * interrupted, and the SDK will not trigger the `onLeaveChannel` callback. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int leaveChannel() = 0; + + /** + * Leaves the channel. + * + * @param options The leave channel options. + * + * This method allows a user to leave the channel, for example, by hanging up or exiting a call. + * + * This method is an asynchronous call, which means that the result of this method returns even before + * the user has not actually left the channel. Once the user successfully leaves the channel, the + * SDK triggers the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel" callback. + * + * @note + * If you call \ref release "release" immediately after this method, the leaveChannel process will be + * interrupted, and the SDK will not trigger the `onLeaveChannel` callback. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int leaveChannel(const LeaveChannelOptions& options) = 0; + + /** + * Renews the token. + * + * Once a token is enabled and used, it expires after a certain period of time. + * + * Under the following circumstances, generate a new token on your server, and then call this method to + * renew it. Failure to do so results in the SDK disconnecting from the server. + * - The \ref IRtcEngineEventHandler onTokenPrivilegeWillExpire "onTokenPrivilegeWillExpire" callback is triggered; + * - The \ref IRtcEngineEventHandler::onRequestToken "onRequestToken" callback is triggered; + * - The `ERR_TOKEN_EXPIRED(-109)` error is reported. + * + * @param token The new token. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int renewToken(const char* token) = 0; + + /** + * Sets the channel profile. + * + * The IRtcEngine differentiates channel profiles and applies different optimization algorithms accordingly. + * For example, it prioritizes smoothness and low latency for a video call, and prioritizes video quality + * for a video broadcast. + * + * @note + * - To ensure the quality of real-time communication, we recommend that all users in a channel use the + * same channel profile. + * - Call this method before calling `joinChannel`. You cannot set the channel profile + * once you have joined the channel. + * + * @param profile The channel profile: #CHANNEL_PROFILE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setChannelProfile(CHANNEL_PROFILE_TYPE profile) = 0; + + /** + * Sets the role of a user. + * + * This method sets the user role as either BROADCASTER or AUDIENCE (default). + * - The broadcaster sends and receives streams. + * - The audience receives streams only. + * + * By default, all users are audience regardless of the channel profile. + * Call this method to change the user role to BROADCASTER so that the user can + * send a stream. + * + * @note + * After calling the setClientRole() method to CLIENT_ROLE_AUDIENCE, the SDK stops audio recording. + * However, CLIENT_ROLE_AUDIENCE will keep audio recording with AUDIO_SCENARIO_CHATROOM(5). + * Normally, app developer can also use mute api to achieve the same result, and we implement + * this 'non-orthogonal' behavior only to make API backward compatible. + * + * @param role The role of the client: #CLIENT_ROLE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setClientRole(CLIENT_ROLE_TYPE role) = 0; + + /** Sets the role of the user, such as a host or an audience (default), before joining a channel in the live interactive streaming. + * + * This method can be used to switch the user role in the live interactive streaming after the user joins a channel. + * + * In the `LIVE_BROADCASTING` profile, when a user switches user roles after joining a channel, a successful \ref agora::rtc::IRtcEngine::setClientRole "setClientRole" method call triggers the following callbacks: + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onClientRoleChanged "onClientRoleChanged" + * - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" or \ref agora::rtc::IRtcEngineEventHandler::onUserOffline "onUserOffline" (BECOME_AUDIENCE) + * + * @note + * This method applies only to the `LIVE_BROADCASTING` profile. + * + * @param role Sets the role of the user. See #CLIENT_ROLE_TYPE. + * @param options Sets the audience latency level of the user. See #ClientRoleOptions. + * + * @return + * - 0(ERR_OK): Success. + * - < 0: Failure. + * - -1(ERR_FAILED): A general error occurs (no specified reason). + * - -2(ERR_INALID_ARGUMENT): The parameter is invalid. + * - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. + */ + virtual int setClientRole(CLIENT_ROLE_TYPE role, const ClientRoleOptions& options) = 0; + + /** Starts an audio call test. + + This method launches an audio call test to determine whether the audio devices + (for example, headset and speaker) and the network connection are working + properly. + + In the test, the user first speaks, and the recording is played back + in 10 seconds. If the user can hear the recording in 10 seconds, it indicates + that the audio devices and network connection work properly. + + @note + After calling the startEchoTest() method, always call stopEchoTest() to end + the test. Otherwise, the app cannot run the next echo test, nor can + it call the joinChannel() method. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startEchoTest() = 0; + + /** Starts an audio call test. + + This method starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly. + + In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly. + + @note + - Call this method before joining a channel. + - After calling this method, call the \ref IRtcEngine::stopEchoTest "stopEchoTest" method to end the test. Otherwise, the app cannot run the next echo test, or call the \ref IRtcEngine::joinChannel "joinChannel" method. + - In the `LIVE_BROADCASTING` profile, only a host can call this method. + @param intervalInSeconds The time interval (s) between when you speak and when the recording plays back. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startEchoTest(int intervalInSeconds) = 0; + + /** Starts a video call test. + * + * @param config: configuration for video call test. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startEchoTest(const EchoTestConfiguration& config) = 0; + + /** Stops the audio call test. + @return int + + - 0: Success. + - < 0: Failure. + */ + virtual int stopEchoTest() = 0; + +#if defined(__APPLE__) && TARGET_OS_IOS + /** Enables the SDK use AVCaptureMultiCamSession or AVCaptureSession. Applies to iOS 13.0+ only. + * @param enabled Whether to enable multi-camera when capturing video: + * - true: Enable multi-camera, and the SDK uses AVCaptureMultiCamSession. + * - false: Disable multi-camera, and the SDK uses AVCaptureSession. + * @param config The config for secondary camera capture session. See #CameraCapturerConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableMultiCamera(bool enabled, const CameraCapturerConfiguration& config) = 0; +#endif + /** + * Enables the video. + * + * You can call this method either before joining a channel or during a call. + * If you call this method before entering a channel, the service starts the video; if you call it + * during a call, the audio call switches to a video call. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves the channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableVideo() = 0; + + /** + * Disables the video. + * + * This method stops capturing the local video and receiving any remote video. + * To enable the local preview function, call \ref enableLocalVideo "enableLocalVideo" (true). + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableVideo() = 0; + + /** + * Starts the local video preview before joining a channel. + * + * Once you call this method to start the local video preview, if you leave + * the channel by calling \ref leaveChannel "leaveChannel", the local video preview remains until + * you call \ref stopPreview "stopPreview" to disable it. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startPreview() = 0; + + /** + * Starts the local video preview for specific source type. + * @param sourceType - The video source type. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startPreview(VIDEO_SOURCE_TYPE sourceType) = 0; + + /** + * Stops the local video preview and the video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopPreview() = 0; + + /** + * Stops the local video preview for specific source type. + * @param sourceType - The video source type. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopPreview(VIDEO_SOURCE_TYPE sourceType) = 0; + + /** Starts the last-mile network probe test. + + This method starts the last-mile network probe test before joining a channel + to get the uplink and downlink last-mile network statistics, including the + bandwidth, packet loss, jitter, and round-trip time (RTT). + + Call this method to check the uplink network quality before users join a + channel or before an audience switches to a host. Once this method is + enabled, the SDK returns the following callbacks: + - \ref IRtcEngineEventHandler::onLastmileQuality "onLastmileQuality": the + SDK triggers this callback depending on the network + conditions. This callback rates the network conditions and is more closely + linked to the user experience. + - \ref IRtcEngineEventHandler::onLastmileProbeResult "onLastmileProbeResult": + the SDK triggers this callback within 30 seconds depending on the network + conditions. This callback returns the real-time statistics of the network + conditions and is more objective. + + @note + - Do not call other methods before receiving the + \ref IRtcEngineEventHandler::onLastmileQuality "onLastmileQuality" and + \ref IRtcEngineEventHandler::onLastmileProbeResult "onLastmileProbeResult" + callbacks. Otherwise, the callbacks may be interrupted. + - In the Live-broadcast profile, a host should not call this method after + joining a channel. + + @param config Sets the configurations of the last-mile network probe test. See + LastmileProbeConfig. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startLastmileProbeTest(const LastmileProbeConfig& config) = 0; + + /** Stops the last-mile network probe test. */ + virtual int stopLastmileProbeTest() = 0; + + /** + * Sets the video encoder configuration. + * + * Each configuration profile corresponds to a set of video parameters, including + * the resolution, frame rate, and bitrate. + * + * The parameters specified in this method are the maximum values under ideal network conditions. + * If the video engine cannot render the video using the specified parameters due + * to poor network conditions, the parameters further down the list are considered + * until a successful configuration is found. + * + * @param config The local video encoder configuration: VideoEncoderConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVideoEncoderConfiguration(const VideoEncoderConfiguration& config) = 0; + + /** Enables/Disables image enhancement and sets the options. + * + * @note Call this method after calling the \ref IRtcEngine::enableVideo "enableVideo" method. + * + * @param enabled Sets whether or not to enable image enhancement: + * - true: enables image enhancement. + * - false: disables image enhancement. + * @param options Sets the image enhancement option. See BeautyOptions. + */ + virtual int setBeautyEffectOptions(bool enabled, const BeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + /** + * Sets low-light enhancement. + * + * @since v4.0.0 + * + * The low-light enhancement feature can adaptively adjust the brightness value of the video captured in situations with low or uneven lighting, such as backlit, cloudy, or dark scenes. It restores or highlights the image details and improves the overall visual effect of the video. + * + * You can call this method to enable the low-light enhancement feature and set the options of the low-light enhancement effect. + * + * @note + * - Before calling this method, ensure that you have integrated the following dynamic library into your project: + * - Android: `libagora_segmentation_extension.so` + * - iOS/macOS: `AgoraVideoSegmentationExtension.xcframework` + * - Windows: `libagora_segmentation_extension.dll` + * - Call this method after \ref IRtcEngine::enableVideo "enableVideo". + * - The low-light enhancement feature has certain performance requirements on devices. If your device overheats after you enable low-light enhancement, Agora recommends modifying the low-light enhancement options to a less performance-consuming level or disabling low-light enhancement entirely. + * + * @param enabled Sets whether to enable low-light enhancement: + * - `true`: Enable. + * - `false`: (Default) Disable. + * @param options The low-light enhancement options. See LowlightEnhanceOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLowlightEnhanceOptions(bool enabled, const LowlightEnhanceOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + /** + * Sets video noise reduction. + * + * @since v4.0.0 + * + * Underlit environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding. + * + * You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect. + * + * @note + * - Before calling this method, ensure that you have integrated the following dynamic library into your project: + * - Android: `libagora_segmentation_extension.so` + * - iOS/macOS: `AgoraVideoSegmentationExtension.xcframework` + * - Windows: `libagora_segmentation_extension.dll` + * - Call this method after \ref IRtcEngine::enableVideo "enableVideo". + * - The video noise reduction feature has certain performance requirements on devices. If your device overheats after you enable video noise reduction, Agora recommends modifying the video noise reduction options to a less performance-consuming level or disabling video noise reduction entirely. + * + * @param enabled Sets whether to enable video noise reduction: + * - `true`: Enable. + * - `false`: (Default) Disable. + * @param options The video noise reduction options. See VideoDenoiserOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVideoDenoiserOptions(bool enabled, const VideoDenoiserOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + /** + * Sets color enhancement. + * + * @since v4.0.0 + * + * The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid. + * + * You can call this method to enable the color enhancement feature and set the options of the color enhancement effect. + * + * @note + * - Before calling this method, ensure that you have integrated the following dynamic library into your project: + * - Android: `libagora_segmentation_extension.so` + * - iOS/macOS: `AgoraVideoSegmentationExtension.xcframework` + * - Windows: `libagora_segmentation_extension.dll` + * - Call this method after \ref IRtcEngine::enableVideo "enableVideo". + * - The color enhancement feature has certain performance requirements on devices. If your device overheats after you enable color enhancement, Agora recommends modifying the color enhancement options to a less performance-consuming level or disabling color enhancement entirely. + * + * @param enabled Sets whether to enable color enhancement: + * - `true`: Enable. + * - `false`: (Default) Disable. + * @param options The color enhancement options. See ColorEnhanceOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setColorEnhanceOptions(bool enabled, const ColorEnhanceOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + + /** + * Enables/Disables the virtual background. (beta function) + * + * @since v3.7.200 + * + * After enabling the virtual background function, you can replace the original background image of the local user + * with a custom background image. After the replacement, all users in the channel can see the custom background + * image. + * + * @note + * - Before calling this method, ensure that you have integrated the + * `libagora_segmentation_extension.dll` (Windows)/`AgoraVideoSegmentationExtension.framework` (macOS) dynamic + * library into the project folder. + * - Call this method after \ref IRtcEngine::enableVideo "enableVideo". + * - This function requires a high-performance device. Agora recommends that you use this function on devices with + * an i5 CPU and better. + * - Agora recommends that you use this function in scenarios that meet the following conditions: + * - A high-definition camera device is used, and the environment is uniformly lit. + * - The captured video image is uncluttered, the user's portrait is half-length and largely unobstructed, and the + * background is a single color that differs from the color of the user's clothing. + * + * @param enabled Sets whether to enable the virtual background: + * - true: Enable. + * - false: Disable. + * @param backgroundSource The custom background image. See VirtualBackgroundSource. **Note**: To adapt the + * resolution of the custom background image to the resolution of the SDK capturing video, the SDK scales and crops + * the custom background image while ensuring that the content of the custom background image is not distorted. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableVirtualBackground(bool enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + + /** + * Initializes the video view of a remote user. + * + * This method initializes the video view of a remote stream on the local device. It affects only the + * video view that the local user sees. + * + * Usually the app should specify the `uid` of the remote video in the method call before the + * remote user joins the channel. If the remote `uid` is unknown to the app, set it later when the + * app receives the \ref IRtcEngineEventHandler::onUserJoined "onUserJoined" callback. + * + * To unbind the remote user from the view, set `view` in VideoCanvas as `null`. + * + * @note + * Ensure that you call this method in the UI thread. + * + * @param canvas The remote video view settings: VideoCanvas. + * @return int + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_SUCCESS = 0, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_IMAGE_NOT_EXIST = -1, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_COLOR_FORMAT_NOT_SUPPORTED = -2, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_DEVICE_NOT_SUPPORTED = -3, + */ + virtual int setupRemoteVideo(const VideoCanvas& canvas) = 0; + + /** + * Initializes the local video view. + * + * This method initializes the video view of the local stream on the local device. It affects only + * the video view that the local user sees, not the published local video stream. + * + * To unbind the local video from the view, set `view` in VideoCanvas as `null`. + * + * @note + * Call this method before joining a channel. + * + * @param canvas The local video view setting: VideoCanvas. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setupLocalVideo(const VideoCanvas& canvas) = 0; + + /** + * Enables the audio. + * + * The audio is enabled by default. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudio() = 0; + + /** + * Disables the audio. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableAudio() = 0; + + /** + * Sets the audio parameters and application scenarios. + * + * @deprecated This method is deprecated. You can use the + * \ref IRtcEngine::setAudioProfile(AUDIO_PROFILE_TYPE) "setAudioProfile" + * method instead. To set the audio scenario, call the \ref IRtcEngine::initialize "initialize" + * method and pass value in the `audioScenario` member in the RtcEngineContext struct. + * + * @note + * - Call this method before calling the `joinChannel` method. + * - In scenarios requiring high-quality audio, we recommend setting `profile` as `MUSIC_HIGH_QUALITY`(4) + * and `scenario` as `AUDIO_SCENARIO_GAME_STREAMING`(3). + * + * @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels: + * #AUDIO_PROFILE_TYPE. + * @param scenario Sets the audio application scenarios: #AUDIO_SCENARIO_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) __deprecated = 0; + + /** + * Sets the audio profile. + * + * @note + * - Call this method before calling the `joinChannel` method. + * - In scenarios requiring high-quality audio, Agora recommends setting `profile` as `MUSIC_HIGH_QUALITY`(4). + * - To set the audio scenario, call the \ref IRtcEngine::initialize "initialize" + * method and pass value in the `audioScenario` member in the RtcEngineContext struct. + * + * @param profile The audio profile, such as the sample rate, bitrate and codec type: #AUDIO_PROFILE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile) = 0; + /** + * Set the audio scenario. + * + * @param scenario The audio scenario: #AUDIO_SCENARIO_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioScenario(AUDIO_SCENARIO_TYPE scenario) = 0; + /** + * Enables or disables the local audio capture. + * + * The audio function is enabled by default. This method disables or re-enables the + * local audio function, that is, to stop or restart local audio capture and + * processing. + * + * This method does not affect receiving or playing the remote audio streams, + * and `enableLocalAudio` (false) is applicable to scenarios where the user wants + * to receive remote audio streams without sending any audio stream to other users + * in the channel. + * + * @param enabled Determines whether to disable or re-enable the local audio function: + * - true: (Default) Re-enable the local audio function, that is, to start local + * audio capture and processing. + * - false: Disable the local audio function, that is, to stop local audio + * capture and processing. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLocalAudio(bool enabled) = 0; + + /** + Stops or resumes sending the local audio stream. + + After calling this method successfully, the SDK triggers the + \ref IRtcEngineEventHandler::onRemoteAudioStateChanged "onRemoteAudioStateChanged" + callback with the following parameters: + - REMOTE_AUDIO_STATE_STOPPED(0) and REMOTE_AUDIO_REASON_REMOTE_MUTED(5). + - REMOTE_AUDIO_STATE_DECODING(2) and REMOTE_AUDIO_REASON_REMOTE_UNMUTED(6). + + @note + - When `mute` is set as `true`, this method does not disable the + microphone, which does not affect any ongoing recording. + - If you call \ref IRtcEngine::setChannelProfile "setChannelProfile" after + this method, the SDK resets whether or not to mute the local audio + according to the channel profile and user role. Therefore, we recommend + calling this method after the `setChannelProfile` method. + + @param mute Determines whether to send or stop sending the local audio stream: + - true: Stop sending the local audio stream. + - false: (Default) Send the local audio stream. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int muteLocalAudioStream(bool mute) = 0; + + /** + Stops or resumes receiving all remote audio stream. + + This method works for all remote users that join or will join a channel + using the `joinChannel` method. It is + equivalent to the `autoSubscribeAudio` member in the ChannelMediaOptions + class. + - Ensure that you call this method after joining a channel. + - If you call muteAllRemoteAudioStreams(true) after joining a channel, the + local use stops receiving any audio stream from any user in the channel, + including any user who joins the channel after you call this method. + - If you call muteAllRemoteAudioStreams(true) after leaving a channel, the + local user does not receive any audio stream the next time the user joins a + channel. + + After you successfully call muteAllRemoteAudioStreams(true), you can take + the following actions: + - To resume receiving all remote audio streams, call + muteAllRemoteAudioStreams(false). + - To resume receiving the audio stream of a specified user, call + muteRemoteAudioStream(uid, false), where uid is the ID of the user whose + audio stream you want to resume receiving. + + @note + - The result of calling this method is affected by calling + \ref IRtcEngine::enableAudio "enableAudio" and + \ref IRtcEngine::disableAudio "disableAudio". Settings in + muteAllRemoteAudioStreams stop taking effect if either of the following occurs: + - Calling `enableAudio` after muteAllRemoteAudioStreams(true). + - Calling `disableAudio` after muteAllRemoteAudioStreams(false). + - This method only works for the channel created by calling + `joinChannel`. To set whether to receive remote + audio streams for a specific channel, Agora recommends using + `autoSubscribeAudio` in the ChannelMediaOptions class. + @param mute Whether to stop receiving remote audio streams: + - true: Stop receiving any remote audio stream. + - false: (Default) Resume receiving all remote audio streams. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int muteAllRemoteAudioStreams(bool mute) = 0; + + /** + * Determines whether to receive all remote audio streams by default. + * + * @deprecated This method is deprecated. To set whether to receive remote + * audio streams by default, call + * \ref IRtcEngine::muteAllRemoteAudioStreams "muteAllRemoteAudioStreams" + * before calling `joinChannel` + * + * Use this method to set whether to receive audio streams of subsequent peer + * users. Agora recommends calling it before joining a channel. + * + * A successful call of setDefaultMuteAllRemoteAudioStreams(true) results in + * that the local user not receiving any audio stream after joining a channel. + * @param mute Whether to receive remote audio streams by default: + * - true: Do not receive any remote audio stream by default. + * - false: (Default) Receive remote audio streams by default. + * + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDefaultMuteAllRemoteAudioStreams(bool mute) __deprecated = 0; + + /** + * Stops or resumes receiving the audio stream of a specified user. + * + * @note + * You can call this method before or after joining a channel. If a user + * leaves a channel, the settings in this method become invalid. + * + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the audio stream of the specified user: + * - true: Stop receiving the audio stream of the specified user. + * - false: (Default) Resume receiving the audio stream of the specified user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRemoteAudioStream(uid_t uid, bool mute) = 0; + + /** + * Stops or resumes sending the local video stream. + * + * @param mute Determines whether to send or stop sending the local video stream: + * - true: Stop sending the local video stream. + * - false: (Default) Send the local video stream. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteLocalVideoStream(bool mute) = 0; + + /** + * Disables or re-enables the local video capture. + * + * Once you enable the video using \ref enableVideo "enableVideo", the local video is enabled + * by default. This method disables or re-enables the local video capture. + * + * `enableLocalVideo(false)` applies to scenarios when the user wants to watch the remote video + * without sending any video stream to the other user. + * + * @note + * Call this method after `enableVideo`. Otherwise, this method may not work properly. + * + * @param enabled Determines whether to disable or re-enable the local video, including + * the capturer, renderer, and sender: + * - true: (Default) Re-enable the local video. + * - false: Disable the local video. Once the local video is disabled, the remote + * users can no longer receive the video stream of this user, while this user + * can still receive the video streams of other remote users. When you set + * `enabled` as `false`, this method does not require a local camera. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLocalVideo(bool enabled) = 0; + + /** Stops or resumes receiving all remote video streams. + + This method works for all remote users that join or will join a channel + using the `joinChannel` method. It is + equivalent to the `autoSubscribeVideo` member in the ChannelMediaOptions + class. + - Ensure that you call this method after joining a channel. + - If you call muteAllRemoteVideoStreams(true) after joining a channel, the + local use stops receiving any video stream from any user in the channel, + including any user who joins the channel after you call this method. + - If you call muteAllRemoteVideoStreams(true) after leaving a channel, + the local user does not receive any video stream the next time the user + joins a channel. + + After you successfully call muteAllRemoteVideoStreams(true), you can take + the following actions: + - To resume receiving all remote video streams, call + muteAllRemoteVideoStreams(false). + - To resume receiving the video stream of a specified user, call + muteRemoteVideoStream(uid, false), where uid is the ID of the user whose + video stream you want to resume receiving. + + @note + - The result of calling this method is affected by calling + \ref IRtcEngine::enableVideo "enableVideo" and + \ref IRtcEngine::disableVideo "disableVideo". Settings in + muteAllRemoteVideoStreams stop taking effect if either of the following occurs: + - Calling `enableVideo` after muteAllRemoteVideoStreams(true). + - Calling `disableVideo` after muteAllRemoteVideoStreams(false). + - This method only works for the channel created by calling `joinChannel`. + To set whether to receive remote audio streams for a specific channel, Agora + recommends using `autoSubscribeVideo` in the ChannelMediaOptions class. + @param mute Whether to stop receiving remote video streams: + - true: Stop receiving any remote video stream. + - false: (Default) Resume receiving all remote video streams. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int muteAllRemoteVideoStreams(bool mute) = 0; + + /** + Determines whether to receive all remote video streams by default. + + @deprecated This method is deprecated. To set whether to receive remote + video streams by default, call + \ref IRtcEngine::muteAllRemoteVideoStreams "muteAllRemoteVideoStreams" + before calling `joinChannel`. + + Use this method to set whether to receive video streams of subsequent peer + users. Agora recommends calling it before joining a channel. + + A successful call of setDefaultMuteAllRemoteVideoStreams(true) results in + that the local user not receiving any video stream after joining a channel. + + @param mute Whether to receive remote video streams by default: + - true: Do not receive any remote video stream by default. + - false: (Default) Receive remote video streams by default. + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int setDefaultMuteAllRemoteVideoStreams(bool mute) __deprecated = 0; + + /** + * Stops or resumes receiving the video stream of a specified user. + * + * @note + * You can call this method before or after joining a channel. If a user + * leaves a channel, the settings in this method become invalid. + * + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the video stream of the specified user: + * - true: Stop receiving the video stream of the specified user. + * - false: (Default) Resume receiving the video stream of the specified user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRemoteVideoStream(uid_t uid, bool mute) = 0; + + /** + * Sets the remote video stream type. + * + * If the remote user has enabled the dual-stream mode, by default the SDK receives the high-stream video by + * Call this method to switch to the low-stream video. + * + * @note + * This method applies to scenarios where the remote user has enabled the dual-stream mode using + * \ref enableDualStreamMode "enableDualStreamMode"(true) before joining the channel. + * + * @param uid ID of the remote user sending the video stream. + * @param streamType Sets the video stream type: #VIDEO_STREAM_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteVideoStreamType(uid_t uid, VIDEO_STREAM_TYPE streamType) = 0; + + /** + * Sets the remote video subscription options + * + * + * @param uid ID of the remote user sending the video stream. + * @param options Sets the video subscription options. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteVideoSubscriptionOptions(uid_t uid, const VideoSubscriptionOptions &options) = 0; + + /** + * Sets the default stream type of the remote video if the remote user has enabled dual-stream. + * + * @param streamType Sets the default video stream type: #VIDEO_STREAM_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteDefaultVideoStreamType(VIDEO_STREAM_TYPE streamType) = 0; + + /** + * Sets the blocklist of subscribe remote stream audio. + * + * @param uidList The id list of users whose audio you do not want to subscribe to. + * @param uidNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's audio will not be subscribed, + * even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioBlocklist(uid_t* uidList, int uidNumber) = 0; + + /** + * Sets the allowlist of subscribe remote stream audio. + * + * @param uidList The id list of users whose audio you want to subscribe to. + * @param uidNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's audio will be subscribed, + * even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, only the blocklist takes effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioAllowlist(uid_t* uidList, int uidNumber) = 0; + + /** + * Sets the blocklist of subscribe remote stream video. + * + * @param uidList The id list of users whose video you do not want to subscribe to. + * @param uidNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's video will not be subscribed, + * even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoBlocklist(uid_t* uidList, int uidNumber) = 0; + + /** + * Sets the allowlist of subscribe remote stream video. + * + * @param uidList The id list of users whose video you want to subscribe to. + * @param uidNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's video will be subscribed, + * even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, only the blocklist takes effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoAllowlist(uid_t* uidList, int uidNumber) = 0; + + /** + * Enables the `onAudioVolumeIndication` callback to report on which users are speaking + * and the speakers' volume. + * + * Once the \ref IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback is enabled, the SDK returns the volume indication in the at the time interval set + * in `enableAudioVolumeIndication`, regardless of whether any user is speaking in the channel. + * + * @param interval Sets the time interval between two consecutive volume indications: + * - <= 0: Disables the volume indication. + * - > 0: Time interval (ms) between two consecutive volume indications, + * and should be integral multiple of 200 (less than 200 will be set to 200). + * @param smooth The smoothing factor that sets the sensitivity of the audio volume + * indicator. The value range is [0, 10]. The greater the value, the more sensitive the + * indicator. The recommended value is 3. + * @param reportVad + * - `true`: Enable the voice activity detection of the local user. Once it is enabled, the `vad` parameter of the + * `onAudioVolumeIndication` callback reports the voice activity status of the local user. + * - `false`: (Default) Disable the voice activity detection of the local user. Once it is disabled, the `vad` parameter + * of the `onAudioVolumeIndication` callback does not report the voice activity status of the local user, except for + * the scenario where the engine automatically detects the voice activity of the local user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudioVolumeIndication(int interval, int smooth, bool reportVad) = 0; + + /** Starts an audio recording. + + The SDK allows recording during a call, which supports either one of the + following two formats: + + - .wav: Large file size with high sound fidelity + - .aac: Small file size with low sound fidelity + + Ensure that the directory to save the recording file exists and is writable. + This method is usually called after the joinChannel() method. + The recording automatically stops when the leaveChannel() method is + called. + + @param filePath Full file path of the recording file. The string of the file + name is in UTF-8 code. + @param quality Sets the audio recording quality: #AUDIO_RECORDING_QUALITY_TYPE. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioRecording(const char* filePath, + AUDIO_RECORDING_QUALITY_TYPE quality) = 0; + /** Starts an audio recording. + + The SDK allows recording during a call, which supports either one of the + following two formats: + + - .wav: Large file size with high sound fidelity + - .aac: Small file size with low sound fidelity + + Ensure that the directory to save the recording file exists and is writable. + This method is usually called after the joinChannel() method. + The recording automatically stops when the leaveChannel() method is + called. + + @param filePath Full file path of the recording file. The string of the file + name is in UTF-8 code. + @param sampleRate Sample rate, value should be 16000, 32000, 44100, or 48000. + @param quality Sets the audio recording quality: #AUDIO_RECORDING_QUALITY_TYPE. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioRecording(const char* filePath, + int sampleRate, + AUDIO_RECORDING_QUALITY_TYPE quality) = 0; + + /** Starts an audio recording. + + The SDK allows recording during a call, which supports either one of the + following two formats: + + - .wav: Large file size with high sound fidelity + - .aac: Small file size with low sound fidelity + + Ensure that the directory to save the recording file exists and is writable. + This method is usually called after the joinChannel() method. + The recording automatically stops when the leaveChannel() method is + called. + + @param config Audio recording config. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioRecording(const AudioRecordingConfiguration& config) = 0; + + /** register encoded audio frame observer + @return + - 0: Success. + - < 0: Failure.p + */ + virtual int registerAudioEncodedFrameObserver(const AudioEncodedFrameObserverConfig& config, IAudioEncodedFrameObserver *observer) = 0; + + /** Stops the audio recording on the client. + + The recording automatically stops when the leaveChannel() method is called. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int stopAudioRecording() = 0; + + /** + * Creates a media player source object and return its pointer. If full featured + * media player source is supported, it will create it, or it will create a simple + * media player. + * + * @return + * - The pointer to \ref rtc::IMediaPlayerSource "IMediaPlayerSource", + * if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ + virtual agora_refptr createMediaPlayer() = 0; + + /** + * Destroy a media player source instance. + * If a media player source instance is destroyed, the video and audio of it cannot + * be published. + * + * @param media_player The pointer to \ref rtc::IMediaPlayerSource. + * + * @return + * - >0: The id of media player source instance. + * - < 0: Failure. + */ + virtual int destroyMediaPlayer(agora_refptr media_player) = 0; + + /** Starts playing and mixing the music file. + + This method mixes the specified local audio file with the audio stream from + the microphone. You can choose whether the other user can hear the local + audio playback and specify the number of playback loops. This method also + supports online music playback. + + After calling this method successfully, the SDK triggers the + + \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (PLAY) + callback on the local client. + When the audio mixing file playback finishes after calling this method, the + SDK triggers the + \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (STOPPED) + callback on the local client. + + @note + - Call this method after joining a channel, otherwise issues may occur. + - If the local audio mixing file does not exist, or if the SDK does not + support the file format or cannot access the music file URL, the SDK returns + #WARN_AUDIO_MIXING_OPEN_ERROR (701). + - If you want to play an online music file, ensure that the time interval + between calling this method is more than 100 ms, or the + `AUDIO_MIXING_ERROR_TOO_FREQUENT_CALL(702)` error code occurs. + + @param filePath Pointer to the absolute path (including the suffixes of the + filename) of the local or online audio file to mix, for example, c:/music/au + dio.mp4. Supported audio formats: 3GP, ASF, ADTS, AVI, MP3, MP4, MPEG-4, + SAMI, and WAVE. + @param loopback Sets which user can hear the audio mixing: + - true: Only the local user can hear the audio mixing. + - false: Both users can hear the audio mixing. + + @param cycle Sets the number of playback loops: + - Positive integer: Number of playback loops. + - `-1`: Infinite playback loops. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioMixing(const char* filePath, bool loopback, int cycle) = 0; + + /** Starts playing and mixing the music file. + + This method mixes the specified local audio file with the audio stream from + the microphone. You can choose whether the other user can hear the local + audio playback and specify the number of playback loops. This method also + supports online music playback. + + After calling this method successfully, the SDK triggers the + + \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (PLAY) + callback on the local client. + When the audio mixing file playback finishes after calling this method, the + SDK triggers the + \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (STOPPED) + callback on the local client. + + @note + - Call this method after joining a channel, otherwise issues may occur. + - If the local audio mixing file does not exist, or if the SDK does not + support the file format or cannot access the music file URL, the SDK returns + #WARN_AUDIO_MIXING_OPEN_ERROR (701). + - If you want to play an online music file, ensure that the time interval + between calling this method is more than 100 ms, or the + `AUDIO_MIXING_ERROR_TOO_FREQUENT_CALL(702)` error code occurs. + + @param filePath Pointer to the absolute path (including the suffixes of the + filename) of the local or online audio file to mix, for example, c:/music/au + dio.mp4. Supported audio formats: 3GP, ASF, ADTS, AVI, MP3, MP4, MPEG-4, + SAMI, and WAVE. + @param loopback Sets which user can hear the audio mixing: + - true: Only the local user can hear the audio mixing. + - false: Both users can hear the audio mixing. + + @param cycle Sets the number of playback loops: + - Positive integer: Number of playback loops. + - `-1`: Infinite playback loops. + + @param startPos The playback position (ms) of the music file. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioMixing(const char* filePath, bool loopback, int cycle, int startPos) = 0; + + /** Stops playing and mixing the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int stopAudioMixing() = 0; + + /** Pauses playing and mixing the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int pauseAudioMixing() = 0; + + /** Resumes playing and mixing the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int resumeAudioMixing() = 0; + + /** Select audio track for the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int selectAudioTrack(int index) = 0; + /** Get audio track count of the music file. + + Call this method when you are in a channel. + + @return + - ≥ 0: Audio track count of the music file, if the method call is successful. + - < 0: Failure. + */ + virtual int getAudioTrackCount() = 0; + + /** Adjusts the volume during audio mixing. + + Call this method when you are in a channel. + + @note This method does not affect the volume of audio effect file playback + invoked by the \ref IRtcEngine::playEffect "playEffect" method. + + @param volume The audio mixing volume. The value ranges between 0 and 100 + (default). + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustAudioMixingVolume(int volume) = 0; + + /** Adjusts the audio mixing volume for publishing (for remote users). + @note Call this method when you are in a channel. + @param volume Audio mixing volume for publishing. The value ranges between 0 and 100 (default). + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustAudioMixingPublishVolume(int volume) = 0; + + /** Retrieves the audio mixing volume for publishing. + This method helps troubleshoot audio volume related issues. + @note Call this method when you are in a channel. + @return + - ≥ 0: The audio mixing volume for publishing, if this method call succeeds. The value range is [0,100]. + - < 0: Failure. + */ + virtual int getAudioMixingPublishVolume() = 0; + + /** Adjusts the audio mixing volume for local playback. + @note Call this method when you are in a channel. + @param volume Audio mixing volume for local playback. The value ranges between 0 and 100 (default). + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustAudioMixingPlayoutVolume(int volume) = 0; + + /** Retrieves the audio mixing volume for local playback. + This method helps troubleshoot audio volume related issues. + @note Call this method when you are in a channel. + @return + - ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100]. + - < 0: Failure. + */ + virtual int getAudioMixingPlayoutVolume() = 0; + + /** Gets the duration (ms) of the music file. + + Call this API when you are in a channel. + + @return + - Returns the audio mixing duration, if the method call is successful. + - < 0: Failure. + */ + virtual int getAudioMixingDuration() = 0; + + /** Gets the playback position (ms) of the music file. + + Call this method when you are in a channel. + + @return + - ≥ 0: The current playback position of the audio mixing, if this method + call succeeds. + - < 0: Failure. + */ + virtual int getAudioMixingCurrentPosition() = 0; + + /** Sets the playback position of the music file to a different starting + position (the default plays from the beginning). + + @param pos The playback starting position (ms) of the audio mixing file. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setAudioMixingPosition(int pos /*in ms*/) = 0; + + /** In dual-channel music files, different audio data can be stored on the left and right channels. + * According to actual needs, you can set the channel mode as the original mode, + * the left channel mode, the right channel mode or the mixed mode + + @param mode The mode of channel mode + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setAudioMixingDualMonoMode(media::AUDIO_MIXING_DUAL_MONO_MODE mode) = 0; + + /** Sets the pitch of the local music file. + * + * When a local music file is mixed with a local human voice, call this method to set the pitch of the local music file only. + * + * @note Call this method after calling \ref IRtcEngine::startAudioMixing "startAudioMixing" and + * receiving the \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (AUDIO_MIXING_STATE_PLAYING) callback. + * + * @param pitch Sets the pitch of the local music file by chromatic scale. The default value is 0, + * which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between + * consecutive values is a chromatic value. The greater the absolute value of this parameter, the + * higher or lower the pitch of the local music file. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioMixingPitch(int pitch) = 0; + /** + * Gets the volume of audio effects. + * + * @return + * - ≥ 0: The volume of audio effects. The value ranges between 0 and 100 (original volume). + * - < 0: Failure. + */ + virtual int getEffectsVolume() = 0; + /** Sets the volume of audio effects. + * + * @param volume The volume of audio effects. The value ranges between 0 + * and 100 (original volume). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEffectsVolume(int volume) = 0; + /** Preloads a specified audio effect. + * + * This method preloads only one specified audio effect into the memory each time + * it is called. To preload multiple audio effects, call this method multiple times. + * + * After preloading, you can call \ref IRtcEngine::playEffect "playEffect" + * to play the preloaded audio effect or call + * \ref IRtcEngine::playAllEffects "playAllEffects" to play all the preloaded + * audio effects. + * + * @note + * - To ensure smooth communication, limit the size of the audio effect file. + * - Agora recommends calling this method before joining the channel. + * + * @param soundId The ID of the audio effect. + * @param filePath The absolute path of the local audio effect file or the URL + * of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, + * 3gp, mkv, and wav. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preloadEffect(int soundId, const char* filePath, int startPos = 0) = 0; + /** Plays a specified audio effect. + * + * After calling \ref IRtcEngine::preloadEffect "preloadEffect", you can call + * this method to play the specified audio effect for all users in + * the channel. + * + * This method plays only one specified audio effect each time it is called. + * To play multiple audio effects, call this method multiple times. + * + * @note + * - Agora recommends playing no more than three audio effects at the same time. + * - The ID and file path of the audio effect in this method must be the same + * as that in the \ref IRtcEngine::preloadEffect "preloadEffect" method. + * + * @param soundId The ID of the audio effect. + * @param filePath The absolute path of the local audio effect file or the URL + * of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, + * 3gp, mkv, and wav. + * @param loopCount The number of times the audio effect loops: + * - `-1`: Play the audio effect in an indefinite loop until + * \ref IRtcEngine::stopEffect "stopEffect" or + * \ref IRtcEngine::stopAllEffects "stopAllEffects" + * - `0`: Play the audio effect once. + * - `1`: Play the audio effect twice. + * @param pitch The pitch of the audio effect. The value ranges between 0.5 and 2.0. + * The default value is `1.0` (original pitch). The lower the value, the lower the pitch. + * @param pan The spatial position of the audio effect. The value ranges between -1.0 and 1.0: + * - `-1.0`: The audio effect displays to the left. + * - `0.0`: The audio effect displays ahead. + * - `1.0`: The audio effect displays to the right. + * @param gain The volume of the audio effect. The value ranges between 0 and 100. + * The default value is `100` (original volume). The lower the value, the lower + * the volume of the audio effect. + * @param publish Sets whether to publish the audio effect to the remote: + * - true: Publish the audio effect to the remote. + * - false: (Default) Do not publish the audio effect to the remote. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int playEffect(int soundId, const char* filePath, int loopCount, double pitch, double pan, int gain, bool publish = false, int startPos = 0) = 0; + /** Plays all audio effects. + * + * After calling \ref IRtcEngine::preloadEffect "preloadEffect" multiple times + * to preload multiple audio effects into the memory, you can call this + * method to play all the specified audio effects for all users in + * the channel. + * + * @param loopCount The number of times the audio effect loops: + * - `-1`: Play the audio effect in an indefinite loop until + * \ref IRtcEngine::stopEffect "stopEffect" or + * \ref IRtcEngine::stopAllEffects "stopAllEffects" + * - `0`: Play the audio effect once. + * - `1`: Play the audio effect twice. + * @param pitch The pitch of the audio effect. The value ranges between 0.5 and 2.0. + * The default value is `1.0` (original pitch). The lower the value, the lower the pitch. + * @param pan The spatial position of the audio effect. The value ranges between -1.0 and 1.0: + * - `-1.0`: The audio effect displays to the left. + * - `0.0`: The audio effect displays ahead. + * - `1.0`: The audio effect displays to the right. + * @param gain The volume of the audio effect. The value ranges between 0 and 100. + * The default value is `100` (original volume). The lower the value, the lower + * the volume of the audio effect. + * @param publish Sets whether to publish the audio effect to the remote: + * - true: Publish the audio effect to the remote. + * - false: (Default) Do not publish the audio effect to the remote. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int playAllEffects(int loopCount, double pitch, double pan, int gain, bool publish = false) = 0; + + /** Gets the volume of the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - ≥ 0: The volume of the specified audio effect. The value ranges + * between 0 and 100 (original volume). + * - < 0: Failure. + */ + virtual int getVolumeOfEffect(int soundId) = 0; + + /** Sets the volume of the specified audio effect. + * + * @param soundId The ID of the audio effect. + * @param volume The volume of the specified audio effect. The value ranges + * between 0 and 100 (original volume). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVolumeOfEffect(int soundId, int volume) = 0; + /** Pauses playing the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pauseEffect(int soundId) = 0; + /** Pauses playing audio effects. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pauseAllEffects() = 0; + /** Resumes playing the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resumeEffect(int soundId) = 0; + /** Resumes playing audio effects. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resumeAllEffects() = 0; + /** Stops playing the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopEffect(int soundId) = 0; + /** Stops playing audio effects. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopAllEffects() = 0; + /** Releases the specified preloaded audio effect from the memory. + * + * @param soundId The ID of the audio effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unloadEffect(int soundId) = 0; + /** Releases preloaded audio effects from the memory. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unloadAllEffects() = 0; + /** + * Gets the duration of the audio effect file. + * @note + * - Call this method after joining a channel. + * - For the audio file formats supported by this method, see [What formats of audio files does the Agora RTC SDK support](https://docs.agora.io/en/faq/audio_format). + * + * @param filePath The absolute path or URL address (including the filename extensions) + * of the music file. For example: `C:\music\audio.mp4`. + * When you access a local file on Android, Agora recommends passing a URI address or the path starts + * with `/assets/` in this parameter. + * + * @return + * - ≥ 0: A successful method call. Returns the total duration (ms) of + * the specified audio effect file. + * - < 0: Failure. + * - `-22(ERR_RESOURCE_LIMITED)`: Cannot find the audio effect file. Please + * set a correct `filePath`. + */ + virtual int getEffectDuration(const char* filePath) = 0; + /** + * Sets the playback position of an audio effect file. + * After a successful setting, the local audio effect file starts playing at the specified position. + * + * @note Call this method after \ref IRtcEngine::playEffect(int,const char*,int,double,double,int,bool,int) "playEffect" . + * + * @param soundId Audio effect ID. Ensure that this parameter is set to the + * same value as in \ref IRtcEngine::playEffect(int,const char*,int,double,double,int,bool,int) "playEffect" . + * @param pos The playback position (ms) of the audio effect file. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - `-22(ERR_RESOURCE_LIMITED)`: Cannot find the audio effect file. Please + * set a correct `soundId`. + */ + virtual int setEffectPosition(int soundId, int pos) = 0; + /** + * Gets the playback position of the audio effect file. + * @note Call this method after \ref IRtcEngine::playEffect(int,const char*,int,double,double,int,bool,int) "playEffect" . + * + * @param soundId Audio effect ID. Ensure that this parameter is set to the + * same value as in \ref IRtcEngine::playEffect(int,const char*,int,double,double,int,bool,int) "playEffect" . + * + * @return + * - ≥ 0: A successful method call. Returns the playback position (ms) of + * the specified audio effect file. + * - < 0: Failure. + * - `-22(ERR_RESOURCE_LIMITED)`: Cannot find the audio effect file. Please + * set a correct `soundId`. + */ + virtual int getEffectCurrentPosition(int soundId) = 0; + /** Enables/Disables stereo panning for remote users. + + Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling \ref agora::rtc::IRtcEngine::setRemoteVoicePosition "setRemoteVoicePosition". + + @param enabled Sets whether or not to enable stereo panning for remote users: + - true: enables stereo panning. + - false: disables stereo panning. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSoundPositionIndication(bool enabled) = 0; + /** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + + @note + - For this method to work, enable stereo panning for remote users by calling the \ref agora::rtc::IRtcEngine::enableSoundPositionIndication "enableSoundPositionIndication" method before joining a channel. + - This method requires hardware support. For the best sound positioning, we recommend using a wired headset. + - Ensure that you call this method after joining a channel. + + @param uid The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + - 0.0: the remote sound comes from the front. + - -1.0: the remote sound comes from the left. + - 1.0: the remote sound comes from the right. + @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. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteVoicePosition(uid_t uid, double pan, double gain) = 0; + + /** enable spatial audio + + @param enabled enable/disable spatial audio: + - true: enable spatial audio. + - false: disable spatial audio. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSpatialAudio(bool enabled) = 0; + + /** Sets remote user parameters for spatial audio + + @param uid The ID of the remote user. + @param param spatial audio parameters: SpatialAudioParams. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteUserSpatialAudioParams(uid_t uid, const agora::SpatialAudioParams& params) = 0; + + /** Sets an SDK preset voice beautifier effect. + * + * Call this method to set an SDK preset voice beautifier effect for the local user who sends an + * audio stream. After setting a voice beautifier effect, all users in the channel can hear the + * effect. + * + * You can set different voice beautifier effects for different scenarios. See *Set the Voice + * Beautifier and Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" to + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call + * fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters": + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset voice beautifier effects: #VOICE_BEAUTIFIER_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET preset) = 0; + + /** Sets an SDK preset audio effect. + * + * Call this method to set an SDK preset audio effect for the local user who sends an audio + * stream. This audio effect does not change the gender characteristics of the original voice. + * After setting an audio effect, all users in the channel can hear the effect. + * + * You can set different audio effects for different scenarios. See *Set the Voice Beautifier and + * Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the profile `parameter` of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)` + * or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - If you call this method and set the `preset` parameter to enumerators except + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION`, do not call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters"; otherwise, + * `setAudioEffectParameters` overrides this method. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectPreset`: + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset audio effects. See #AUDIO_EFFECT_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioEffectPreset(AUDIO_EFFECT_PRESET preset) = 0; + + /** Sets an SDK preset voice conversion. + * + * Call this method to set an SDK preset voice conversion for the local user who sends an audio + * stream. After setting an voice conversion, all users in the channel can hear the effect. + * + * You can set different voice conversion for different scenarios. See *Set the Voice Beautifier and + * Audio Effects*. + * + * To achieve better voice conversion quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the profile `parameter` of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)` + * or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - If you call this method and set the `preset` parameter to enumerators, + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setVoiceConversionPreset`: + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * - \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" + * + * @param preset The options for SDK preset voice conversion. See #VOICE_CONVERSION_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVoiceConversionPreset(VOICE_CONVERSION_PRESET preset) = 0; + + /** Sets parameters for SDK preset audio effects. + * + * Call this method to set the following parameters for the local user who send an audio stream: + * - 3D voice effect: Sets the cycle period of the 3D voice effect. + * - Pitch correction effect: Sets the basic mode and tonic pitch of the pitch correction effect. + * Different songs have different modes and tonic pitches. Agora recommends bounding this method + * with interface elements to enable users to adjust the pitch correction interactively. + * + * After setting parameters, all users in the channel can hear the relevant effect. + * + * You can call this method directly or after \ref IRtcEngine::setAudioEffectPreset + * "setAudioEffectPreset". If you call this method after \ref IRtcEngine::setAudioEffectPreset + * "setAudioEffectPreset", ensure that you set the preset parameter of `setAudioEffectPreset` to + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION` and then call this method to set the same + * enumerator; otherwise, this method overrides `setAudioEffectPreset`. + * + * @note + * - You can call this method either before or after joining a channel. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" to + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call + * fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectParameters`: + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * @param preset The options for SDK preset audio effects: + * - 3D voice effect: `ROOM_ACOUSTICS_3D_VOICE`. + * - Call \ref IRtcEngine::setAudioProfile "setAudioProfile" and set the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator; otherwise, the enumerator setting does not take effect. + * - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear + * the anticipated voice effect. + * - Pitch correction effect: `PITCH_CORRECTION`. To achieve better audio effect quality, Agora + * recommends calling \ref IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` + * parameter to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before setting this enumerator. + * @param param1 + * - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, the `param1` sets the cycle period of the + * 3D voice effect. The value range is [1,60] and the unit is a second. The default value is 10 + * seconds, indicating that the voice moves around you every 10 seconds. + * - If you set `preset` to `PITCH_CORRECTION`, `param1` sets the basic mode of the pitch + * correction effect: + * - `1`: (Default) Natural major scale. + * - `2`: Natural minor scale. + * - `3`: Japanese pentatonic scale. + * @param param2 + * - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, you need to set `param2` to `0`. + * - If you set `preset` to `PITCH_CORRECTION`, `param2` sets the tonic pitch of the pitch + * correction effect: + * - `1`: A + * - `2`: A# + * - `3`: B + * - `4`: (Default) C + * - `5`: C# + * - `6`: D + * - `7`: D# + * - `8`: E + * - `9`: F + * - `10`: F# + * - `11`: G + * - `12`: G# + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioEffectParameters(AUDIO_EFFECT_PRESET preset, int param1, int param2) = 0; + + /** Sets parameters for SDK preset voice beautifier effects. + * + * Call this method to set a gender characteristic and a reverberation effect for the singing + * beautifier effect. This method sets parameters for the local user who sends an audio stream. + * + * After you call this method successfully, all users in the channel can hear the relevant effect. + * + * To achieve better audio effect quality, before you call this method, Agora recommends calling + * \ref IRtcEngine::setAudioProfile "setAudioProfile", and setting the `scenario` parameter as + * `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter as + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)`. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" as + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call does + * not take effect. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After you call this method, Agora recommends not calling the following methods, because they + * can override `setVoiceBeautifierParameters`: + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * + * @param preset The options for SDK preset voice beautifier effects: + * - `SINGING_BEAUTIFIER`: Singing beautifier effect. + * @param param1 The gender characteristics options for the singing voice: + * - `1`: A male-sounding voice. + * - `2`: A female-sounding voice. + * @param param2 The reverberation effects options: + * - `1`: The reverberation effect sounds like singing in a small room. + * - `2`: The reverberation effect sounds like singing in a large room. + * - `3`: The reverberation effect sounds like singing in a hall. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVoiceBeautifierParameters(VOICE_BEAUTIFIER_PRESET preset, + int param1, int param2) = 0; + + /** Set parameters for SDK preset voice conversion. + * + * @note + * - reserved interface + * + * @param preset The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET. + * @param param1 reserved. + * @param param2 reserved. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVoiceConversionParameters(VOICE_CONVERSION_PRESET preset, + int param1, int param2) = 0; + + /** Changes the voice pitch of the local speaker. + + @param pitch The voice pitch. The value ranges between 0.5 and 2.0. The lower + the value, the lower the voice pitch. The default value is 1.0 (no change to + the local voice pitch). + + @return + - 0: Success. + - -1: Failure. + */ + virtual int setLocalVoicePitch(double pitch) = 0; + + /** Sets the local voice equalization effect. + + @param bandFrequency The band frequency ranging from 0 to 9, representing the + respective 10-band center frequencies of the voice effects, including 31, 62, + 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. + @param bandGain Gain of each band in dB. The value ranges from -15 to 15. The + default value is 0. + @return + - 0: Success. + - -1: Failure. + */ + virtual int setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, + int bandGain) = 0; + + /** Sets the local voice reverberation. + + @param reverbKey The reverberation key: #AUDIO_REVERB_TYPE. + @param value The value of the reverberation key: #AUDIO_REVERB_TYPE. + @return + - 0: Success. + - -1: Failure. + */ + virtual int setLocalVoiceReverb(AUDIO_REVERB_TYPE reverbKey, int value) = 0; + /** Sets preset audio playback effect for remote headphones after remote audio is mixed. + + @param preset The preset key: #HEADPHONE_EQUALIZER_PRESET. + - HEADPHONE_EQUALIZER_OFF = 0x00000000 : Turn off the eualizer effect for headphones. + - HEADPHONE_EQUALIZER_OVEREAR = 0x04000001 : For over-ear headphones only. + - HEADPHONE_EQUALIZER_INEAR = 0x04000002 : For in-ear headphones only. + @return + - 0: Success. + - < 0: Failure. + - -1(ERR_FAILED): A general error occurs (no specified reason). + */ + virtual int setHeadphoneEQPreset(HEADPHONE_EQUALIZER_PRESET preset) = 0; + /** Sets the parameters of audio playback effect for remote headphones after remote audio is mixed. + + @param lowGain The higher the parameter value, the deeper the sound. The value range is [-10,10]. + @param highGain The higher the parameter value, the sharper the sound. The value range is [-10,10]. + @return + - 0: Success. + - < 0: Failure. + - -1(ERR_FAILED): A general error occurs (no specified reason). + */ + virtual int setHeadphoneEQParameters(int lowGain, int highGain) = 0; + + /** **DEPRECATED** Specifies an SDK output log file. + * + * The log file records all log data for the SDK’s operation. Ensure that the + * directory for the log file exists and is writable. + * + * @note + * Ensure that you call this method immediately after \ref initialize "initialize", + * or the output log may not be complete. + * + * @param filePath File path of the log file. The string of the log file is in UTF-8. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFile(const char* filePath) = 0; + + /** + * Sets the output log filter level of the SDK. + * + * You can use one or a combination of the filters. The log filter level follows the + * sequence of `OFF`, `CRITICAL`, `ERROR`, `WARNING`, `INFO`, and `DEBUG`. Choose a filter level + * and you will see logs preceding that filter level. For example, if you set the log filter level to + * `WARNING`, you see the logs within levels `CRITICAL`, `ERROR`, and `WARNING`. + * + * @param filter The log filter level: + * - `LOG_FILTER_DEBUG(0x80f)`: Output all API logs. Set your log filter as DEBUG + * if you want to get the most complete log file. + * - `LOG_FILTER_INFO(0x0f)`: Output logs of the CRITICAL, ERROR, WARNING, and INFO + * level. We recommend setting your log filter as this level. + * - `LOG_FILTER_WARNING(0x0e)`: Output logs of the CRITICAL, ERROR, and WARNING level. + * - `LOG_FILTER_ERROR(0x0c)`: Output logs of the CRITICAL and ERROR level. + * - `LOG_FILTER_CRITICAL(0x08)`: Output logs of the CRITICAL level. + * - `LOG_FILTER_OFF(0)`: Do not output any log. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFilter(unsigned int filter) = 0; + + /** + * Sets the output log level of the SDK. + * + * You can set the SDK to ouput the log files of the specified level. + * + * @param level The log level: + * - `LOG_LEVEL_NONE (0x0000)`: Do not output any log file. + * - `LOG_LEVEL_INFO (0x0001)`: (Recommended) Output log files of the INFO level. + * - `LOG_LEVEL_WARN (0x0002)`: Output log files of the WARN level. + * - `LOG_LEVEL_ERROR (0x0004)`: Output log files of the ERROR level. + * - `LOG_LEVEL_FATAL (0x0008)`: Output log files of the FATAL level. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogLevel(commons::LOG_LEVEL level) = 0; + + /** + * Sets the log file size (KB). + * + * The SDK has two log files, each with a default size of 512 KB. If you set + * `fileSizeInBytes` as 1024 KB, the SDK outputs log files with a total + * maximum size of 2 MB. + * If the total size of the log files exceed the set value, + * the new output log files overwrite the old output log files. + * + * @param fileSizeInKBytes The SDK log file size (KB). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFileSize(unsigned int fileSizeInKBytes) = 0; + + /** Upload current log file immediately to server. + * only use this when an error occurs + * block before log file upload success or timeout. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int uploadLogFile(agora::util::AString& requestId) = 0; + + /** * Write the log to SDK . @technical preview + * + * You can Write the log to SDK log files of the specified level. + * + * @param level The log level: + * - `LOG_LEVEL_NONE (0x0000)`: Do not output any log file. + * - `LOG_LEVEL_INFO (0x0001)`: (Recommended) Output log files of the INFO level. + * - `LOG_LEVEL_WARN (0x0002)`: Output log files of the WARN level. + * - `LOG_LEVEL_ERROR (0x0004)`: Output log files of the ERROR level. + * - `LOG_LEVEL_FATAL (0x0008)`: Output log files of the FATAL level. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int writeLog(commons::LOG_LEVEL level, const char* fmt, ...) = 0; + + /** + * Updates the display mode of the local video view. + * + * After initializing the local video view, you can call this method to update its rendering mode. + * It affects only the video view that the local user sees, not the published local video stream. + * + * @note + * - Ensure that you have called \ref setupLocalVideo "setupLocalVideo" to initialize the local video + * view before this method. + * - During a call, you can call this method as many times as necessary to update the local video view. + * + * @param renderMode Sets the local display mode. See #RENDER_MODE_TYPE. + * @param mirrorMode Sets the local mirror mode. See #VIDEO_MIRROR_MODE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode, VIDEO_MIRROR_MODE_TYPE mirrorMode) = 0; + /** + * Updates the display mode of the video view of a remote user. + * + * After initializing the video view of a remote user, you can call this method to update its + * rendering and mirror modes. This method affects only the video view that the local user sees. + * + * @note + * - Ensure that you have called \ref setupRemoteVideo "setupRemoteVideo" to initialize the remote video + * view before calling this method. + * - During a call, you can call this method as many times as necessary to update the display mode + * of the video view of a remote user. + * + * @param uid ID of the remote user. + * @param renderMode Sets the remote display mode. See #RENDER_MODE_TYPE. + * @param mirrorMode Sets the mirror type. See #VIDEO_MIRROR_MODE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteRenderMode(uid_t uid, media::base::RENDER_MODE_TYPE renderMode, + VIDEO_MIRROR_MODE_TYPE mirrorMode) = 0; + + // The following APIs are either deprecated and going to deleted. + + /** + * Updates the display mode of the local video view. + * + * After initializing the local video view, you can call this method to update its rendering mode. + * It affects only the video view that the local user sees, not the published local video stream. + * + * @note + * - Ensure that you have called \ref setupLocalVideo "setupLocalVideo" to initialize the local video + * view before this method. + * - During a call, you can call this method as many times as necessary to update the local video view. + * + * @param renderMode Sets the local display mode. See #RENDER_MODE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode) = 0; + + /** + * Sets the local video mirror mode. + * + * Use this method before calling the \ref startPreview "startPreview" method, or the mirror mode + * does not take effect until you call the `startPreview` method again. + * @param mirrorMode Sets the local video mirror mode. See #VIDEO_MIRROR_MODE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) = 0; + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableDualStreamMode(bool enabled) = 0; + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @param streamConfig + * - The minor stream config + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) = 0; + + + /** + * Enables, disables or auto enable the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param mode + * - The dual stream mode + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode) = 0; + + /** + * Enables, disables or auto enable the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param mode Dual stream mode: #SIMULCAST_STREAM_MODE. + * @param streamConfig Configurations of the low stream: SimulcastStreamConfig. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode, + const SimulcastStreamConfig& streamConfig) = 0; + + /** + * Sets the external audio track. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @param trackId custom audio track id. + * @param enabled Determines whether to local playback the external audio track: + * - true: Local playback the external audio track. + * - false: Local don`t playback the external audio track. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableCustomAudioLocalPlayback(track_id_t trackId, bool enabled) = 0; + + /** + * Enables or disables echo cancellation. + * + * @param enabled Whether to enable echo cancellation. + * @param audioSourceDelay The delayed time for capturing the audio source. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableEchoCancellationExternal(bool enabled, int audioSourceDelay) = 0; + + /** + * Sets the audio recording format for the + * \ref agora::media::IAudioFrameObserver::onRecordAudioFrame "onRecordAudioFrame" callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in the `onRecordAudioFrame` callback, which can set be + * as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of audio channels of the audio data returned in the `onRecordAudioFrame` callback, which can + * be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param mode This mode is deprecated. + * @param samplesPerCall not support. Sampling points in the called data returned in + * onRecordAudioFrame(). For example, it is usually set as 1024 for stream + * pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingAudioFrameParameters(int sampleRate, int channel, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode, + int samplesPerCall) = 0; + + /** + * Sets the audio recording format for the + * \ref agora::media::IAudioFrameObserver::onPublishAudioFrame "onPublishAudioFrame" callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in the `onPublishAudioFrame` callback, which can set be + * as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of audio channels of the audio data returned in the `onPublishAudioFrame` callback, which can + * be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param mode This mode is deprecated. + * @param samplesPerCall not support. Sampling points in the called data returned in + * onPublishAudioFrame(). For example, it is usually set as 1024 for stream + * pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPublishAudioFrameParameters(int sampleRate, int channel, + int samplesPerCall) = 0; + + /** + * Sets the audio playback format for the + * \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback. + * + * @param sampleRate Sets the sample rate (Hz) of the audio data returned in the `onPlaybackAudioFrame` callback, + * which can set be as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of channels of the audio data returned in the `onPlaybackAudioFrame` callback, which + * can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the onPlaybackAudioFrame() callback: + * agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall not support. Sampling points in the called data returned in + * onPlaybackAudioFrame(). For example, it is usually set as 1024 for stream + * pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackAudioFrameParameters(int sampleRate, int channel, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode, + int samplesPerCall) = 0; + + /** + * Sets the mixed audio format for the + * \ref agora::media::IAudioFrameObserver::onMixedAudioFrame "onMixedAudioFrame" callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in the `onMixedAudioFrame` callback, which can set + * be as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of channels of the audio data in `onMixedAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param samplesPerCall not support. Sampling points in the called data returned in + * `onMixedAudioFrame`. For example, it is usually set as 1024 for stream pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall) = 0; + + /** + * Sets the audio ear monitoring format for the + * \ref agora::media::IAudioFrameObserver::onEarMonitoringAudioFrame "onEarMonitoringAudioFrame" callback. + * + * @param sampleRate Sets the sample rate (Hz) of the audio data returned in the `onEarMonitoringAudioFrame` callback, + * which can set be as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of channels of the audio data returned in the `onEarMonitoringAudioFrame` callback, which + * can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the onEarMonitoringAudioFrame() callback: + * agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall not support. Sampling points in the called data returned in + * onEarMonitoringAudioFrame(). For example, it is usually set as 1024 for stream + * pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEarMonitoringAudioFrameParameters(int sampleRate, int channel, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode, + int samplesPerCall) = 0; + + /** + * Sets the audio playback format before mixing in the + * \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing "onPlaybackAudioFrameBeforeMixing" + * callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in + * `onPlaybackAudioFrameBeforeMixing`, which can set be as 8000, 16000, 32000, 44100, or 48000. + * @param channel Number of channels of the audio data returned in `onPlaybackAudioFrameBeforeMixing`, + * which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel) = 0; + + /** + * Enable the audio spectrum monitor. + * + * @param intervalInMS Sets the time interval(ms) between two consecutive audio spectrum callback. + * The default value is 100. This param should be larger than 10. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudioSpectrumMonitor(int intervalInMS = 100) = 0; + /** + * Disalbe the audio spectrum monitor. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableAudioSpectrumMonitor() = 0; + + /** + * Registers an audio spectrum observer. + * + * You need to implement the `IAudioSpectrumObserver` class in this method, and register the following callbacks + * according to your scenario: + * - \ref agora::media::IAudioSpectrumObserver::onAudioSpectrumComputed "onAudioSpectrumComputed": Occurs when + * the SDK receives the audio data and at set intervals. + * + * @param observer A pointer to the audio spectrum observer: \ref agora::media::IAudioSpectrumObserver + * "IAudioSpectrumObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioSpectrumObserver(agora::media::IAudioSpectrumObserver * observer) = 0; + /** + * Releases the audio spectrum observer. + * + * @param observer The pointer to the audio spectrum observer: \ref agora::media::IAudioSpectrumObserver + * "IAudioSpectrumObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioSpectrumObserver(agora::media::IAudioSpectrumObserver * observer) = 0; + + /** Adjusts the recording volume. + + @param volume The recording volume, which ranges from 0 to 400: + + - 0: Mute the recording volume. + - 100: The Original volume. + - 400: (Maximum) Four times the original volume with signal clipping + protection. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustRecordingSignalVolume(int volume) = 0; + + /** + * Mute or resume recording signal volume. + * + * @param mute Determines whether to mute or resume the recording signal volume. + * - true: Mute the recording signal volume. + * - false: (Default) Resume the recording signal volume. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRecordingSignal(bool mute) = 0; + + /** Adjusts the playback volume. + + @param volume The playback volume, which ranges from 0 to 400: + + - 0: Mute the recoridng volume. + - 100: The Original volume. + - 400: (Maximum) Four times the original volume with signal clipping + protection. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustPlaybackSignalVolume(int volume) = 0; + + /* + * Adjust the playback volume of the user specified by uid. + * + * You can call this method to adjust the playback volume of the user specified by uid + * in call. If you want to adjust playback volume of the multi user, you can call this + * this method multi times. + * + * @note + * Please call this method after join channel. + * This method adjust the playback volume of specified user. + * + * @param uid Remote user ID. + * @param volume The playback volume of the specified remote user. The value ranges between 0 and 400, including the following: + * 0: Mute. + * 100: (Default) Original volume. + * 400: Four times the original volume with signal-clipping protection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustUserPlaybackSignalVolume(unsigned int uid, int volume) = 0; + + /** Sets the fallback option for the published video stream based on the network conditions. + + If `option` is set as #STREAM_FALLBACK_OPTION_AUDIO_ONLY (2), the SDK will: + + - Disable the upstream video but enable audio only when the network conditions deteriorate and cannot support both video and audio. + - Re-enable the video when the network conditions improve. + + When the published video stream falls back to audio only or when the audio-only stream switches back to the video, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalPublishFallbackToAudioOnly "onLocalPublishFallbackToAudioOnly" callback. + + @note + - Agora does not recommend using this method for CDN live streaming, because the remote CDN live user will have a noticeable lag when the published video stream falls back to audio only. + - Ensure that you call this method before joining a channel. + + @param option Sets the fallback option for the published video stream: + - #STREAM_FALLBACK_OPTION_DISABLED (0): (Default) No fallback behavior for the published video stream when the uplink network condition is poor. The stream quality is not guaranteed. + - #STREAM_FALLBACK_OPTION_AUDIO_ONLY (2): The published video stream falls back to audio only when the uplink network condition is poor. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setLocalPublishFallbackOption(STREAM_FALLBACK_OPTIONS option) = 0; + + /** Sets the fallback option for the remotely subscribed video stream based on the network conditions. + + The default setting for `option` is #STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW (1), where the remotely subscribed video stream falls back to the low-stream video (low resolution and low bitrate) under poor downlink network conditions. + + If `option` is set as #STREAM_FALLBACK_OPTION_AUDIO_ONLY (2), the SDK automatically switches the video from a high-stream to a low-stream, or disables the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and restores the video stream when the network conditions improve. + + When the remotely subscribed video stream falls back to audio only or when the audio-only stream switches back to the video stream, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onRemoteSubscribeFallbackToAudioOnly "onRemoteSubscribeFallbackToAudioOnly" callback. + + @note Ensure that you call this method before joining a channel. + + @param option Sets the fallback option for the remotely subscribed video stream. See #STREAM_FALLBACK_OPTIONS. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteSubscribeFallbackOption(STREAM_FALLBACK_OPTIONS option) = 0; + + /** Enables loopback recording. + * + * If you enable loopback recording, the output of the default sound card is mixed into + * the audio stream sent to the other end. + * + * @note This method is for Windows only. + * + * @param enabled Sets whether to enable/disable loopback recording. + * - true: Enable loopback recording. + * - false: (Default) Disable loopback recording. + * @param deviceName Pointer to the device name of the sound card. The default value is NULL (the default sound card). + * - This method is for macOS and Windows only. + * - macOS does not support loopback capturing of the default sound card. If you need to use this method, + * please use a virtual sound card and pass its name to the deviceName parameter. Agora has tested and recommends using soundflower. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLoopbackRecording(bool enabled, const char* deviceName = NULL) = 0; + + + /** Adjusts the loopback recording volume. + + @param volume The loopback volume, which ranges from 0 to 100: + + - 0: Mute the recoridng volume. + - 100: The Original volume. + protection. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustLoopbackSignalVolume(int volume) = 0; + + /** Retrieves the audio volume for recording loopback. + @note Call this method when you are in a channel. + @return + - ≥ 0: The audio volume for loopback, if this method call succeeds. The value range is [0,100]. + - < 0: Failure. + */ + virtual int getLoopbackRecordingVolume() = 0; + + /** + * Enables in-ear monitoring. + * + * @param enabled Determines whether to enable in-ear monitoring. + * - true: Enable. + * - false: (Default) Disable. + * @param includeAudioFilters The type of the ear monitoring: #EAR_MONITORING_FILTER_TYPE + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableInEarMonitoring(bool enabled, int includeAudioFilters) = 0; + + /** + * Sets the volume of the in-ear monitor. + * + * @param volume Sets the volume of the in-ear monitor. The value ranges + * between 0 and 100 (default). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setInEarMonitoringVolume(int volume) = 0; + +#if defined (_WIN32) || defined(__linux__) || defined(__ANDROID__) + virtual int loadExtensionProvider(const char* path, bool unload_after_use = false) = 0; +#endif + + /** + * Sets the provider property of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExtensionProviderProperty( + const char* provider, const char* key, const char* value) = 0; + + /** + * Registers an extension. Normally you should call this function immediately after engine initialization. + * Once an extension is registered, SDK will create and add extension to pipeline automatically. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param type The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. The default is UNKNOWN_MEDIA_SOURCE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerExtension(const char* provider, const char* extension, + agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; + + /** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtension, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtension explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param enable Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * @param type The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. The default is UNKNOWN_MEDIA_SOURCE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableExtension( + const char* provider, const char* extension, bool enable=true, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; + + /** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtension, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtension explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. + * @param enable Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableExtension(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, bool enable = true) = 0; + + /** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExtensionProperty( + const char* provider, const char* extension, + const char* key, const char* value, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; + + /** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param value The value of the extension key. + * @param buf_len Maximum length of the JSON string indicating the extension property. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getExtensionProperty( + const char* provider, const char* extension, + const char* key, char* value, int buf_len, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; + + /** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, const char* value) = 0; + + /** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. + * @param key The key of the extension. + * @param value The value of the extension key. + * @param buf_len Maximum length of the JSON string indicating the extension property. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, char* value, int buf_len) = 0; + + /** Sets the camera capture configuration. + * @note Call this method before enabling the local camera. + * That said, you can call this method before calling \ref IRtcEngine::joinChannel "joinChannel", + * \ref IRtcEngine::enableVideo "enableVideo", or \ref IRtcEngine::enableLocalVideo "enableLocalVideo", + * depending on which method you use to turn on your local camera. + * + * @param config Sets the camera capturer configuration. See CameraCapturerConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraCapturerConfiguration(const CameraCapturerConfiguration& config) = 0; + + + /** + * Get an custom video track id created by internal,which could used to publish or preview + * + * @return + * - > 0: the useable video track id. + * - < 0: Failure. + */ + virtual video_track_id_t createCustomVideoTrack() = 0; + + /** + * Get an custom encoded video track id created by internal,which could used to publish or preview + * + * @return + * - > 0: the useable video track id. + * - < 0: Failure. + */ + virtual video_track_id_t createCustomEncodedVideoTrack(const SenderOptions& sender_option) = 0; + + /** + * destroy a created custom video track id + * + * @param video_track_id The video track id which was created by createCustomVideoTrack + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int destroyCustomVideoTrack(video_track_id_t video_track_id) = 0; + + /** + * destroy a created custom encoded video track id + * + * @param video_track_id The video track id which was created by createCustomEncodedVideoTrack + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int destroyCustomEncodedVideoTrack(video_track_id_t video_track_id) = 0; + + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + + /** + * Switches between front and rear cameras. + * + * @note This method applies to Android and iOS only. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchCamera() = 0; + + /** + * Checks whether the camera zoom function is supported. + * + * @return + * - true: The camera zoom function is supported. + * - false: The camera zoom function is not supported. + */ + virtual bool isCameraZoomSupported() = 0; + + /** + * Checks whether the camera face detect is supported. + * + * @return + * - true: The camera face detect is supported. + * - false: The camera face detect is not supported. + */ + virtual bool isCameraFaceDetectSupported() = 0; + + /** + * Checks whether the camera flash function is supported. + * + * @return + * - true: The camera flash function is supported. + * - false: The camera flash function is not supported. + */ + virtual bool isCameraTorchSupported() = 0; + + /** + * Checks whether the camera manual focus function is supported. + * + * @return + * - true: The camera manual focus function is supported. + * - false: The camera manual focus function is not supported. + */ + virtual bool isCameraFocusSupported() = 0; + + /** + * Checks whether the camera auto focus function is supported. + * + * @return + * - true: The camera auto focus function is supported. + * - false: The camera auto focus function is not supported. + */ + virtual bool isCameraAutoFocusFaceModeSupported() = 0; + + /** + * Sets the camera zoom ratio. + * + * @param factor The camera zoom factor. It ranges from 1.0 to the maximum zoom + * supported by the camera. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraZoomFactor(float factor) = 0; + + /** + * Sets the camera face detection. + * + * @param enabled The camera face detection enabled. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableFaceDetection(bool enabled) = 0; + + /** + * Gets the maximum zoom ratio supported by the camera. + * @return The maximum zoom ratio supported by the camera. + */ + virtual float getCameraMaxZoomFactor() = 0; + + /** + * Sets the manual focus position. + * + * @param positionX The horizontal coordinate of the touch point in the view. + * @param positionY The vertical coordinate of the touch point in the view. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraFocusPositionInPreview(float positionX, float positionY) = 0; + + /** + * Enables the camera flash. + * + * @param isOn Determines whether to enable the camera flash. + * - true: Enable the flash. + * - false: Do not enable the flash. + */ + virtual int setCameraTorchOn(bool isOn) = 0; + + /** + * Enables the camera auto focus face function. + * + * @param enabled Determines whether to enable the camera auto focus face mode. + * - true: Enable the auto focus face function. + * - false: Do not enable the auto focus face function. + */ + virtual int setCameraAutoFocusFaceModeEnabled(bool enabled) = 0; + + /** Checks whether the camera exposure function is supported. + * + * Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`. + * + * @since v2.3.2. + * @return + *
      + *
    • true: The device supports the camera exposure function.
    • + *
    • false: The device does not support the camera exposure function.
    • + *
    + */ + virtual bool isCameraExposurePositionSupported() = 0; + + /** Sets the camera exposure position. + * + * Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`. + * + * A successful setCameraExposurePosition method call triggers the {@link IRtcEngineEventHandler#onCameraExposureAreaChanged onCameraExposureAreaChanged} callback on the local client. + * @since v2.3.2. + * @param positionXinView The horizontal coordinate of the touch point in the view. + * @param positionYinView The vertical coordinate of the touch point in the view. + * + * @return + *
      + *
    • 0: Success.
    • + *
    • < 0: Failure.
    • + *
    + */ + virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0; + + /** + * Checks whether the camera exposure function is supported. + * + * @return + * - true: The camera exposure function is supported. + * - false: The camera exposure function is not supported. + */ + virtual bool isCameraExposureSupported() = 0; + + /** + * Sets the camera exposure bias. + * + * @param factor The camera exposure factor. The recommended camera exposure factor ranging from -8.0 to 8.0. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraExposureFactor(float factor) = 0; + +#if defined(__APPLE__) + /** + * Checks whether the camera auto exposure function is supported. + * + * @return + * - true: The camera auto exposure function is supported. + * - false: The camera auto exposure function is not supported. + */ + virtual bool isCameraAutoExposureFaceModeSupported() = 0; + + + /** + * Enables the camera auto exposure face function. + * + * @param enabled Determines whether to enable the camera auto exposure face mode. + * - true: Enable the auto exposure face function. + * - false: Do not enable the auto exposure face function. + */ + virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0; +#endif + + /** Sets the default audio route (for Android and iOS only). + + Most mobile phones have two audio routes: an earpiece at the top, and a + speakerphone at the bottom. The earpiece plays at a lower volume, and the + speakerphone at a higher volume. + + When setting the default audio route, you determine whether audio playback + comes through the earpiece or speakerphone when no external audio device is + connected. + + Depending on the scenario, Agora uses different default audio routes: + - Voice call: Earpiece + - Audio broadcast: Speakerphone + - Video call: Speakerphone + - Video broadcast: Speakerphone + + Call this method before, during, or after a call, to change the default + audio route. When the audio route changes, the SDK triggers the + \ref IRtcEngineEventHandler::onAudioRoutingChanged "onAudioRoutingChanged" + callback. + + @note The system audio route changes when an external audio device, such as + a headphone or a Bluetooth audio device, is connected. See *Principles for changing the audio route*. + + @param defaultToSpeaker Whether to set the speakerphone as the default audio + route: + - true: Set the speakerphone as the default audio route. + - false: Do not set the speakerphone as the default audio route. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker) = 0; + + /** Enables/Disables the speakerphone temporarily (for Android and iOS only). + + When the audio route changes, the SDK triggers the + \ref IRtcEngineEventHandler::onAudioRoutingChanged "onAudioRoutingChanged" + callback. + + You can call this method before, during, or after a call. However, Agora + recommends calling this method only when you are in a channel to change + the audio route temporarily. + + @note This method sets the audio route temporarily. Plugging in or + unplugging a headphone, or the SDK re-enabling the audio device module + (ADM) to adjust the media volume in some scenarios relating to audio, leads + to a change in the audio route. See *Principles for changing the audio + route*. + + @param speakerOn Whether to set the speakerphone as the temporary audio + route: + - true: Set the speakerphone as the audio route temporarily. (For iOS only: + calling setEnableSpeakerphone(true) does not change the audio route to the + speakerphone if a headphone or a Bluetooth audio device is connected.) + - false: Do not set the speakerphone as the audio route. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setEnableSpeakerphone(bool speakerOn) = 0; + + /** Checks whether the speakerphone is enabled (for Android and iOS only). + + @return + - true: The speakerphone is enabled, and the audio plays from the speakerphone. + - false: The speakerphone is not enabled, and the audio plays from devices + other than the speakerphone. For example, the headset or earpiece. + */ + virtual bool isSpeakerphoneEnabled() = 0; + +#endif // __ANDROID__ || (__APPLE__ && TARGET_OS_IOS) + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + /** Get \ref ScreenCaptureSourceInfo list including available windows and screens. + * + * @param thumbSize Set expected size for thumb, image will be scaled accordingly. For windows, SIZE is defined in windef.h. + * @param iconSize Set expected size for icon, image will be scaled accordingly. For windows, SIZE is defined in windef.h. + * @param includeScreen Determines whether to include screens info. + * - true: sources will have screens info + * - false: source will only have windows info + * @return + * - IScreenCaptureSourceList* a pointer to an instance of IScreenCaptureSourceList + */ + virtual IScreenCaptureSourceList* getScreenCaptureSources(const SIZE& thumbSize, const SIZE& iconSize, const bool includeScreen) = 0; +#endif // _WIN32 || (__APPLE__ && !TARGET_OS_IPHONE && TARGET_OS_MAC) +#if (defined(__APPLE__) && TARGET_OS_IOS) + /** Sets the operational permission of the SDK on the audio session. + * + * The SDK and the app can both configure the audio session by default. If + * you need to only use the app to configure the audio session, this method + * restricts the operational permission of the SDK on the audio session. + * + * You can call this method either before or after joining a channel. Once + * you call this method to restrict the operational permission of the SDK + * on the audio session, the restriction takes effect when the SDK needs to + * change the audio session. + * + * @note + * - This method is for iOS only. + * - This method does not restrict the operational permission of the app on + * the audio session. + * + * @param restriction The operational permission of the SDK on the audio session. + * See #AUDIO_SESSION_OPERATION_RESTRICTION. This parameter is in bit mask + * format, and each bit corresponds to a permission. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioSessionOperationRestriction(AUDIO_SESSION_OPERATION_RESTRICTION restriction) = 0; +#endif // __APPLE__ && TARGET_OS_IOS + +#if defined(_WIN32) || (defined(__APPLE__) && !TARGET_OS_IPHONE && TARGET_OS_MAC) + + /** Shares the whole or part of a screen by specifying the display ID. + + @note This method applies to macOS only. + + @param displayId The display ID of the screen to be shared. This parameter + specifies which screen you want to share. For information on how to get the + displayId, see the advanced guide: Share the Screen. + @param regionRect (Optional) Sets the relative location of the region to the + screen. NIL means sharing the whole screen. See Rectangle. + If the specified region overruns the screen, the SDK shares only the region + within it; if you set width or height as 0, the SDK shares the whole screen. + @param captureParams Sets the screen sharing encoding parameters. See + ScreenCaptureParameters. + + @return + - 0: Success. + - < 0: Failure: + - ERR_INVALID_ARGUMENT (2): The argument is invalid. + - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when try to start screen capture. + */ + virtual int startScreenCaptureByDisplayId(uint32_t displayId, const Rectangle& regionRect, + const ScreenCaptureParameters& captureParams) = 0; + +#endif // __APPLE__ && TARGET_OS_MAC && !TARGET_OS_IPHONE + +#if defined(_WIN32) + + /** + * Shares the whole or part of a screen by specifying the screen rect. + * + * @deprecated This method is deprecated, use \ref IRtcEngine::startScreenCaptureByDisplayId "startScreenCaptureByDisplayId" instead. Agora strongly recommends using `startScreenCaptureByDisplayId` if you need to start screen sharing on a device connected to another display. + * + * @note This method applies to Windows only. + * + * @param screenRect Sets the relative location of the screen to the virtual + * screen. For information on how to get screenRect, see the advanced guide: + * Share the Screen. + * @param regionRect (Optional) Sets the relative location of the region to the + * screen. NULL means sharing the whole screen. See Rectangle. + * If the specified region overruns the screen, the SDK shares only the region + * within it; if you set width or height as 0, the SDK shares the whole screen. + * @param captureParams Sets the screen sharing encoding parameters. See + * ScreenCaptureParameters. + * + * @return + * - 0: Success. + * - < 0: Failure: + * - ERR_INVALID_ARGUMENT (2): The argument is invalid. + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when try to start screen capture. + */ + virtual int startScreenCaptureByScreenRect(const Rectangle& screenRect, + const Rectangle& regionRect, + const ScreenCaptureParameters& captureParams) = 0; + +#endif // _WIN32 + +#if defined(__ANDROID__) + /** + * Gets the the Audio device Info + * @return + * - 0: Success. + * - < 0: Failure.. + */ + virtual int getAudioDeviceInfo(DeviceInfo& deviceInfo) = 0; + +#endif // __ANDROID__ + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + + /** Shares the whole or part of a window by specifying the window ID. + * + * @param windowId The ID of the window to be shared. For information on how to + * get the windowId, see the advanced guide *Share Screen*. + * @param regionRect (Optional) The relative location of the region to the + * window. NULL means sharing the whole window. See Rectangle. If the + * specified region overruns the window, the SDK shares only the region within + * it; if you set width or height as 0, the SDK shares the whole window. + * @param captureParams The window sharing encoding parameters. See + * ScreenCaptureParameters. + * + * @return + * - 0: Success. + * - < 0: Failure: + * - ERR_INVALID_ARGUMENT (2): The argument is invalid. + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when try to start screen capture. + */ + virtual int startScreenCaptureByWindowId(view_t windowId, const Rectangle& regionRect, + const ScreenCaptureParameters& captureParams) = 0; + + /** + * Sets the content hint for screen sharing. + * + * A content hint suggests the type of the content being shared, so that the SDK applies different + * optimization algorithm to different types of content. + * + * @param contentHint Sets the content hint for screen sharing: #VIDEO_CONTENT_HINT. + * + * @return + * - 0: Success. + * - < 0: Failure: + * - ERR_NOT_SUPPORTED (4): unable to set screencapture content hint + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when set screen capture content hint. + */ + virtual int setScreenCaptureContentHint(VIDEO_CONTENT_HINT contentHint) = 0; + + /** + * Updates the screen sharing region. + * + * @param regionRect Sets the relative location of the region to the screen or + * window. NULL means sharing the whole screen or window. See Rectangle. + * If the specified region overruns the screen or window, the SDK shares only + * the region within it; if you set width or height as 0, the SDK shares the + * whole screen or window. + * + * @return + * - 0: Success. + * - < 0: Failure: + * - ERR_NOT_SUPPORTED (4): unable to update screen capture region + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when update screen capture regoin. + */ + virtual int updateScreenCaptureRegion(const Rectangle& regionRect) = 0; + + /** + * Updates the screen sharing parameters. + * + * @param captureParams Sets the screen sharing encoding parameters: ScreenCaptureParameters. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_NOT_SUPPORTED (4): unable to update screen capture parameters + * - ERR_INVALID_ARGUMENT (2): The argument is invalid. + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when update screen capture parameters. + */ + virtual int updateScreenCaptureParameters(const ScreenCaptureParameters& captureParams) = 0; +#endif // _WIN32 || (__APPLE__ && !TARGET_OS_IPHONE && TARGET_OS_MAC) + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + /** + * Starts screen sharing. + * + * @param captureParams The configuration of the screen sharing. See {@link + * ScreenCaptureParameters ScreenCaptureParameters}. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startScreenCapture(const ScreenCaptureParameters2& captureParams) = 0; + + /** + * Updates the screen sharing configuration. + * + * @param captureParams The configuration of the screen sharing. See {@link + * ScreenCaptureParameters ScreenCaptureParameters}. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateScreenCapture(const ScreenCaptureParameters2& captureParams) = 0; + + /** + * Queries the ability of screen sharing to support the minimum frame rate. + * + * @since v4.2.0 + * + * @return + * - 0: support 15 fps, Low devices. + * - 1: support 30 fps, Usually low - to mid-range devices. + * - 2: support 60 fps, Advanced devices. + * - < 0: Failure. + */ + virtual int queryScreenCaptureCapability() = 0; +#endif + +#if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) + /** + * Sets the screen sharing scenario. + * + * + * When you start screen sharing or window sharing, you can call this method to set the screen sharing scenario. The SDK adjusts the video quality and experience of the sharing according to the scenario. + * + * + * @param screenScenario The screen sharing scenario. See #SCREEN_SCENARIO_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_NOT_SUPPORTED (4): unable to set screencapture scenario + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when set screencapture scenario. + */ + virtual int setScreenCaptureScenario(SCREEN_SCENARIO_TYPE screenScenario) = 0; + + /** + * Stops the screen sharing. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopScreenCapture() = 0; +#endif // _WIN32 || (__APPLE__ && !TARGET_OS_IPHONE && TARGET_OS_MAC) || __ANDROID__ + + /** + * Gets the current call ID. + * + * When a user joins a channel on a client, a `callId` is generated to identify + * the call. + * + * After a call ends, you can call `rate` or `complain` to gather feedback from the customer. + * These methods require a `callId` parameter. To use these feedback methods, call the this + * method first to retrieve the `callId` during the call, and then pass the value as an + * argument in the `rate` or `complain` method after the call ends. + * + * @param callId The reference to the call ID. + * @return + * - The call ID if the method call is successful. + * - < 0: Failure. + */ + virtual int getCallId(agora::util::AString& callId) = 0; + + /** + * Allows a user to rate the call. + * + * It is usually called after the call ends. + * + * @param callId The call ID retrieved from the \ref getCallId "getCallId" method. + * @param rating The rating of the call between 1 (the lowest score) to 5 (the highest score). + * @param description (Optional) The description of the rating. The string length must be less than + * 800 bytes. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int rate(const char* callId, int rating, + const char* description) = 0; // 0~10 + + /** + * Allows a user to complain about the call quality. + * + * This method is usually called after the call ends. + * + * @param callId The call ID retrieved from the `getCallId` method. + * @param description (Optional) The description of the complaint. The string length must be less than + * 800 bytes. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int complain(const char* callId, const char* description) = 0; + + /** Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.) + + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback. + + * The \ref agora::rtc::IRtcEngine::startRtmpStreamWithoutTranscoding "startRtmpStreamWithoutTranscoding" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN. + * @note + * - Ensure that the user joins the channel before calling this method. + * - This method adds only one stream RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ + virtual int startRtmpStreamWithoutTranscoding(const char* url) = 0; + + /** Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.) + + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback. + + * The \ref agora::rtc::IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN. + * @note + * - Ensure that the user joins the channel before calling this method. + * - This method adds only one stream RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ + virtual int startRtmpStreamWithTranscoding(const char* url, const LiveTranscoding& transcoding) = 0; + + /** Update the video layout and audio settings for CDN live. (CDN live only.) + * @note This method applies to Live Broadcast only. + + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateRtmpTranscoding(const LiveTranscoding& transcoding) = 0; + /** Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.) + + * This method removes the RTMP URL address (added by the \ref IRtcEngine::startRtmpStreamWithoutTranscoding "startRtmpStreamWithoutTranscoding" method + * or IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method) from a CDN live stream. + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamUnpublished "onStreamUnpublished" callback. + + * The \ref agora::rtc::IRtcEngine::stopRtmpStream "stopRtmpStream" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of removing an RTMP stream from the CDN. + * @note + * - This method removes only one RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRtmpStream(const char* url) = 0; + + + virtual int startLocalVideoTranscoder(const LocalTranscoderConfiguration& config) = 0; + virtual int updateLocalTranscoderConfiguration(const LocalTranscoderConfiguration& config) = 0; + virtual int stopLocalVideoTranscoder() = 0; + /** + * Starts video capture with a camera. + * + * @param config The configuration of the video capture with a primary camera. For details, see CameraCaptureConfiguration. + * @param type Source type of camera. See #VIDEO_SOURCE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startCameraCapture(VIDEO_SOURCE_TYPE type, const CameraCapturerConfiguration& config) = 0; + + /** + * Stops capturing video through camera. + * + * You can call this method to stop capturing video through the first camera after calling `startCameraCapture`. + * + * @param type Source type of camera. See #VIDEO_SOURCE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopCameraCapture(VIDEO_SOURCE_TYPE type) = 0; + /** + * Sets the rotation angle of the video captured by the camera. + * + * When the video capture device does not have the gravity sensing function, you can call this method to manually adjust the rotation angle of the captured video. + * + * @param type The video source type. See #VIDEO_SOURCE_TYPE. + * @param orientation The clockwise rotation angle. See #VIDEO_ORIENTATION. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraDeviceOrientation(VIDEO_SOURCE_TYPE type, VIDEO_ORIENTATION orientation) = 0; + /** + * Sets the rotation angle of the video captured by the screen. + * + * When the screen capture device does not have the gravity sensing function, you can call this method to manually adjust the rotation angle of the captured video. + * + * @param type The video source type. See #VIDEO_SOURCE_TYPE. + * @param orientation The clockwise rotation angle. See #VIDEO_ORIENTATION. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setScreenCaptureOrientation(VIDEO_SOURCE_TYPE type, VIDEO_ORIENTATION orientation) = 0; + + /** + * Starts sharing a screen. + * + * @param config The configuration of the captured screen. For details, see ScreenCaptureConfiguration. + * @param type source type of screen. See #VIDEO_SOURCE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startScreenCapture(VIDEO_SOURCE_TYPE type, const ScreenCaptureConfiguration& config) = 0; + + /** + * Stop sharing the screen. + * + * After calling `startScreenCapture`, you can call this method to stop sharing the first screen. + * + * @param type source type of screen. See #VIDEO_SOURCE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopScreenCapture(VIDEO_SOURCE_TYPE type) = 0; + + /** Gets the current connection state of the SDK. + + @return #CONNECTION_STATE_TYPE. + */ + virtual CONNECTION_STATE_TYPE getConnectionState() = 0; + + // The following APIs are not implemented yet. + virtual bool registerEventHandler(IRtcEngineEventHandler* eventHandler) = 0; + virtual bool unregisterEventHandler(IRtcEngineEventHandler* eventHandler) = 0; + virtual int setRemoteUserPriority(uid_t uid, PRIORITY_TYPE userPriority) = 0; + + /** + * Registers a packet observer. + * + * The Agora Native SDK allows your app to register a packet observer to + * receive events whenever a voice or video packet is transmitting. + * + * @param observer The IPacketObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerPacketObserver(IPacketObserver* observer) = 0; + + /** + * Sets the built-in encryption mode. + * + * @deprecated This method is deprecated. Use enableEncryption(bool enabled, const EncryptionConfig&) instead. + * + * The Agora Native SDK supports built-in encryption. + * Call this API to set the encryption mode. + * + * All users in the same channel must use the same encryption mode and password. + * Refer to information related to the encryption algorithm on the differences + * between encryption modes. + * + * @note + * Call \ref setEncryptionSecret "setEncryptionSecret" to enable the built-in encryption function + * before calling this API. + * @param encryptionMode Encryption mode: + * - "sm4-128-ecb": 128-bit SM4 encryption, ECB mode. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEncryptionMode(const char* encryptionMode) __deprecated = 0; + + /** + * Enables built-in encryption. + * + * @deprecated This method is deprecated. Use enableEncryption(bool enabled, const EncryptionConfig&) instead. + * + * Use this method to specify an encryption password to enable built-in + * encryption before joining a channel. All users in a channel must set the same + * encryption password. The encryption password is automatically cleared once a + * user has left the channel. If the encryption password is not specified or set to + * empty, the encryption function will be disabled. + * + * @param secret The encryption password. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEncryptionSecret(const char* secret) __deprecated = 0; + + /** Enables/Disables the built-in encryption. + * + * In scenarios requiring high security, Agora recommends calling this method to enable the built-in encryption before joining a channel. + * + * All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + * + * @note + * - If you enable the built-in encryption, you cannot use the RTMP streaming function. + * + * @param enabled Whether to enable the built-in encryption: + * - true: Enable the built-in encryption. + * - false: Disable the built-in encryption. + * @param config Configurations of built-in encryption schemas. See EncryptionConfig. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT): An invalid parameter is used. Set the parameter with a valid value. + * - -4(ERR_NOT_SUPPORTED): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. + * - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int enableEncryption(bool enabled, const EncryptionConfig& config) = 0; + + /** Creates a data stream. + * + * You can call this method to create a data stream and improve the + * reliability and ordering of data tranmission. + * + * @note + * - Ensure that you set the same value for `reliable` and `ordered`. + * - Each user can only create a maximum of 5 data streams during a RtcEngine + * lifecycle. + * - The data channel allows a data delay of up to 5 seconds. If the receiver + * does not receive the data stream within 5 seconds, the data channel reports + * an error. + * + * @param[out] streamId The ID of the stream data. + * @param reliable Sets whether the recipients are guaranteed to receive + * the data stream from the sender within five seconds: + * - true: The recipients receive the data stream from the sender within + * five seconds. If the recipient does not receive the data stream within + * five seconds, an error is reported to the application. + * - false: There is no guarantee that the recipients receive the data stream + * within five seconds and no error message is reported for any delay or + * missing data stream. + * @param ordered Sets whether the recipients receive the data stream + * in the sent order: + * - true: The recipients receive the data stream in the sent order. + * - false: The recipients do not receive the data stream in the sent order. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int createDataStream(int* streamId, bool reliable, bool ordered) = 0; + + /** Creates a data stream. + * + * Each user can create up to five data streams during the lifecycle of the IChannel. + * @param streamId The ID of the created data stream. + * @param config The config of data stream. + * @return int + * - Returns 0: Success. + * - < 0: Failure. + */ + virtual int createDataStream(int* streamId, DataStreamConfig& config) = 0; + + /** Sends a data stream. + * + * After calling \ref IRtcEngine::createDataStream "createDataStream", you can call + * this method to send a data stream to all users in the channel. + * + * The SDK has the following restrictions on this method: + * - Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB. + * - Each client can send up to 30 KB of data per second. + * - Each user can have up to five data streams simultaneously. + * + * After the remote user receives the data stream within 5 seconds, the SDK triggers the + * \ref IRtcEngineEventHandler::onStreamMessage "onStreamMessage" callback on + * the remote client. After the remote user does not receive the data stream within 5 seconds, + * the SDK triggers the \ref IRtcEngineEventHandler::onStreamMessageError "onStreamMessageError" + * callback on the remote client. + * + * @note + * - Call this method after calling \ref IRtcEngine::createDataStream "createDataStream". + * - This method applies only to the `COMMUNICATION` profile or to + * the hosts in the `LIVE_BROADCASTING` profile. If an audience in the + * `LIVE_BROADCASTING` profile calls this method, the audience may be switched to a host. + * + * @param streamId The ID of the stream data. + * @param data The data stream. + * @param length The length (byte) of the data stream. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendStreamMessage(int streamId, const char* data, size_t length) = 0; + + /** **DEPRECATED** Adds a watermark image to the local video or CDN live stream. + + This method is not recommend, Use \ref agora::rtc::IRtcEngine::addVideoWatermark(const char* watermarkUrl, const WatermarkOptions& options) "addVideoWatermark"2 instead. + + This method adds a PNG watermark image to the local video stream for the recording device, channel audience, and CDN live audience to view and capture. + + To add the PNG file to the CDN live publishing stream, see the \ref IRtcEngine::setLiveTranscoding "setLiveTranscoding" method. + + @param watermark Pointer to the watermark image to be added to the local video stream. See RtcImage. + + @note + - The URL descriptions are different for the local video and CDN live streams: + - In a local video stream, `url` in RtcImage refers to the absolute path of the added watermark image file in the local video stream. + - In a CDN live stream, `url` in RtcImage refers to the URL address of the added watermark image in the CDN live broadcast. + - The source file of the watermark image must be in the PNG file format. If the width and height of the PNG file differ from your settings in this method, the PNG file will be cropped to conform to your settings. + - The Agora SDK supports adding only one watermark image onto a local video or CDN live stream. The newly added watermark image replaces the previous one. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int addVideoWatermark(const RtcImage& watermark) = 0; + + /** Adds a watermark image to the local video. + + This method adds a PNG watermark image to the local video in a live broadcast. Once the watermark image is added, all the audience in the channel (CDN audience included), + and the recording device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one. + + The watermark position depends on the settings in the \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration" method: + - If the orientation mode of the encoding video is #ORIENTATION_MODE_FIXED_LANDSCAPE, or the landscape mode in #ORIENTATION_MODE_ADAPTIVE, the watermark uses the landscape orientation. + - If the orientation mode of the encoding video is #ORIENTATION_MODE_FIXED_PORTRAIT, or the portrait mode in #ORIENTATION_MODE_ADAPTIVE, the watermark uses the portrait orientation. + - When setting the watermark position, the region must be less than the dimensions set in the `setVideoEncoderConfiguration` method. Otherwise, the watermark image will be cropped. + + @note + - Ensure that you have called the \ref agora::rtc::IRtcEngine::enableVideo "enableVideo" method to enable the video module before calling this method. + - If you only want to add a watermark image to the local video for the audience in the CDN live broadcast channel to see and capture, you can call this method or the \ref agora::rtc::IRtcEngine::setLiveTranscoding "setLiveTranscoding" method. + - This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray. + - If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings. + - If you have enabled the local video preview by calling the \ref agora::rtc::IRtcEngine::startPreview "startPreview" method, you can use the `visibleInPreview` member in the WatermarkOptions class to set whether or not the watermark is visible in preview. + - If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. + + @param watermarkUrl The local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path. + @param options Pointer to the watermark's options to be added. See WatermarkOptions for more infomation. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int addVideoWatermark(const char* watermarkUrl, const WatermarkOptions& options) = 0; + + /** Removes the watermark image on the video stream added by + addVideoWatermark(). + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int clearVideoWatermarks() = 0; + + // The following APIs are either deprecated and going to deleted. + + /** @deprecated Use disableAudio() instead. + + Disables the audio function in the channel. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int pauseAudio() __deprecated = 0; + /** @deprecated Use enableAudio() instead. + + Resumes the audio function in the channel. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int resumeAudio() __deprecated = 0; + + /** + * Enables interoperability with the Agora Web SDK (Live Broadcast only). + * + * @deprecated The Agora NG SDK enables the interoperablity with the Web SDK. + * + * Use this method when the channel profile is Live Broadcast. Interoperability + * with the Agora Web SDK is enabled by default when the channel profile is + * Communication. + * + * @param enabled Determines whether to enable interoperability with the Agora Web SDK. + * - true: (Default) Enable interoperability with the Agora Native SDK. + * - false: Disable interoperability with the Agora Native SDK. + * + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableWebSdkInteroperability(bool enabled) __deprecated = 0; + + /** Agora supports reporting and analyzing customized messages. + * + * This function is in the beta stage with a free trial. The ability provided + * in its beta test version is reporting a maximum of 10 message pieces within + * 6 seconds, with each message piece not exceeding 256 bytes. + * + * To try out this function, contact [support@agora.io](mailto:support@agora.io) + * and discuss the format of customized messages with us. + */ + virtual int sendCustomReportMessage( + const char* id, const char* category, const char* event, const char* label, int value) = 0; + + /** Registers the metadata observer. + + You need to implement the IMetadataObserver class and specify the metadata type + in this method. This method enables you to add synchronized metadata in the video + stream for more diversified live interactive streaming, such as sending + shopping links, digital coupons, and online quizzes. + + A successful call of this method triggers + the \ref agora::rtc::IMetadataObserver::getMaxMetadataSize "getMaxMetadataSize" callback. + + @note + - Call this method before the `joinChannel` method. + - This method applies to the `LIVE_BROADCASTING` channel profile. + + @param observer IMetadataObserver. + @param type The metadata type. See \ref IMetadataObserver::METADATA_TYPE "METADATA_TYPE". The SDK supports VIDEO_METADATA (0) only for now. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int registerMediaMetadataObserver(IMetadataObserver *observer, IMetadataObserver::METADATA_TYPE type) = 0; + + /** Unregisters the metadata observer. + @param observer IMetadataObserver. + @param type The metadata type. See \ref IMetadataObserver::METADATA_TYPE "METADATA_TYPE". The SDK supports VIDEO_METADATA (0) only for now. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int unregisterMediaMetadataObserver(IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) = 0; + + /** Start audio frame dump. + + Optional `location` is: "pre_apm_proc", "apm", "pre_send_proc", "filter", "enc", "tx_mixer", + "at_record", "atw_record" for audio sending. + "dec", "mixed", "play", "rx_mixer", "playback_mixer", "pcm_source_playback_mixer", + "pre_play_proc", "at_playout", "atw_playout" for audio receiving. + + */ + + virtual int startAudioFrameDump(const char* channel_id, uid_t user_id, const char* location, + const char* uuid, const char* passwd, long duration_ms, bool auto_upload) = 0; + /** + * Stops the audio frame dump. + */ + virtual int stopAudioFrameDump(const char* channel_id, uid_t user_id, const char* location) = 0; + + /** Registers a user account. + * + * Once registered, the user account can be used to identify the local user when the user joins the channel. + * After the user successfully registers a user account, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" callback on the local client, + * reporting the user ID and user account of the local user. + * + * To join a channel with a user account, you can choose either of the following: + * + * - Call the \ref agora::rtc::IRtcEngine::registerLocalUserAccount "registerLocalUserAccount" method to create a user account, and then the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method to join the channel. + * - Call the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method to join the channel. + * + * The difference between the two is that for the former, the time elapsed between calling the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method + * and joining the channel is shorter than the latter. + * + * @note + * - Ensure that you set the `userAccount` parameter. Otherwise, this method does not take effect. + * - Ensure that the value of the `userAccount` parameter is unique in the channel. + * - To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param appId The App ID of your project. + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerLocalUserAccount(const char* appId, const char* userAccount) = 0; + + /** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int joinChannelWithUserAccount(const char* token, const char* channelId, + const char* userAccount) = 0; + + /** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param options The channel media options: \ref agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions" + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int joinChannelWithUserAccount(const char* token, const char* channelId, + const char* userAccount, const ChannelMediaOptions& options) = 0; + + /** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param options The channel media options: \ref agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions" + * @param eventHandler The pointer to the IRtcEngine event handler: IRtcEngineEventHandler. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int joinChannelWithUserAccountEx(const char* token, const char* channelId, + const char* userAccount, const ChannelMediaOptions& options, + IRtcEngineEventHandler* eventHandler) = 0; + + /** Gets the user information by passing in the user account. + * + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them + * in a mapping table object (`userInfo`), and triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback on the local client. + * + * After receiving the o\ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback, you can call this method to get the user ID of the + * remote user from the `userInfo` object by passing in the user account. + * + * @param userAccount The user account of the user. Ensure that you set this parameter. + * @param [in,out] userInfo A userInfo object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUserAccount(const char* userAccount, rtc::UserInfo* userInfo) = 0; + + /** Gets the user information by passing in the user ID. + * + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, + * caches them in a mapping table object (`userInfo`), and triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback on the local client. + * + * After receiving the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback, you can call this method to get the user account of the remote user + * from the `userInfo` object by passing in the user ID. + * + * @param uid The user ID of the remote user. Ensure that you set this parameter. + * @param[in,out] userInfo A userInfo object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUid(uid_t uid, rtc::UserInfo* userInfo) = 0; + /** Starts to relay media streams across channels. + * + * After a successful method call, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" and + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayEvent + * "onChannelMediaRelayEvent" callbacks, and these callbacks return the + * state and events of the media stream relay. + * - If the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback returns + * #RELAY_STATE_RUNNING (2) and #RELAY_OK (0), and the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayEvent + * "onChannelMediaRelayEvent" callback returns + * #RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL (4), the host starts + * sending data to the destination channel. + * - If the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback returns + * #RELAY_STATE_FAILURE (3), an exception occurs during the media stream + * relay. + * + * @note + * - Call this method after the \ref joinChannel() "joinChannel" method. + * - This method takes effect only when you are a host in a + * `LIVE_BROADCASTING` channel. + * - After a successful method call, if you want to call this method + * again, ensure that you call the + * \ref stopChannelMediaRelay() "stopChannelMediaRelay" method to quit the + * current relay. + * - Contact sales-us@agora.io before implementing this function. + * - We do not support string user accounts in this API. + * + * @param configuration The configuration of the media stream relay: + * ChannelMediaRelayConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) = 0; + + /** Updates the channels for media stream relay. After a successful + * \ref startChannelMediaRelay() "startChannelMediaRelay" method call, if + * you want to relay the media stream to more channels, or leave the + * current relay channel, you can call the + * \ref updateChannelMediaRelay() "updateChannelMediaRelay" method. + * + * After a successful method call, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayEvent + * "onChannelMediaRelayEvent" callback with the + * #RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL (7) state code. + * + * @note + * Call this method after the + * \ref startChannelMediaRelay() "startChannelMediaRelay" method to update + * the destination channel. + * + * @param configuration The media stream relay configuration: + * ChannelMediaRelayConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) = 0; + + /** Stops the media stream relay. + * + * Once the relay stops, the host quits all the destination + * channels. + * + * After a successful method call, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback. If the callback returns + * #RELAY_STATE_IDLE (0) and #RELAY_OK (0), the host successfully + * stops the relay. + * + * @note + * If the method call fails, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback with the + * #RELAY_ERROR_SERVER_NO_RESPONSE (2) or + * #RELAY_ERROR_SERVER_CONNECTION_LOST (8) state code. You can leave the + * channel by calling the \ref leaveChannel() "leaveChannel" method, and + * the media stream relay automatically stops. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopChannelMediaRelay() = 0; + + + /** pause the channels for media stream relay. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pauseAllChannelMediaRelay() = 0; + + /** resume the channels for media stream relay. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resumeAllChannelMediaRelay() = 0; + + /** Set audio parameters for direct streaming to CDN + * + * @note + * Must call this api before "startDirectCdnStreaming" + * + * @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels: + * #AUDIO_PROFILE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDirectCdnStreamingAudioConfiguration(AUDIO_PROFILE_TYPE profile) = 0; + + /** Set video parameters for direct streaming to CDN + * + * Each configuration profile corresponds to a set of video parameters, including + * the resolution, frame rate, and bitrate. + * + * @note + * Must call this api before "startDirectCdnStreaming" + * + * @param config The local video encoder configuration: VideoEncoderConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDirectCdnStreamingVideoConfiguration(const VideoEncoderConfiguration& config) = 0; + + /** Start direct cdn streaming + * + * @param eventHandler A pointer to the direct cdn streaming event handler: \ref agora::rtc::IDirectCdnStreamingEventHandler + * "IDirectCdnStreamingEventHandler". + * @param publishUrl The url of the cdn used to publish the stream. + * @param options The direct cdn streaming media options: DirectCdnStreamingMediaOptions. + * This API must pass an audio-related option, and temporarily cannot pass more than one. + * Video-related options may not be passed, or one, but not multiple. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startDirectCdnStreaming(IDirectCdnStreamingEventHandler* eventHandler, + const char* publishUrl, const DirectCdnStreamingMediaOptions& options) = 0; + + /** Stop direct cdn streaming + * + * @note + * This method is synchronous. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopDirectCdnStreaming() = 0; + + /** Change the media source during the pushing + * + * @note + * This method is temporarily not supported. + * + * @param options The direct cdn streaming media options: DirectCdnStreamingMediaOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateDirectCdnStreamingMediaOptions(const DirectCdnStreamingMediaOptions& options) = 0; + + /** Enables the rhythm player. + * + * @param sound1 The absolute path or URL address (including the filename extensions) of the file for the downbeat. + * @param sound2 The absolute path or URL address (including the filename extensions) of the file for the upbeats. + * @param config The configuration of rhythm player. + * + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRhythmPlayer(const char* sound1, const char* sound2, const AgoraRhythmPlayerConfig& config) = 0; + + /** Disables the rhythm player. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRhythmPlayer() = 0; + + /** Configures the rhythm player. + * + * @param config The configuration of rhythm player. + * + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int configRhythmPlayer(const AgoraRhythmPlayerConfig& config) = 0; + /** + * Takes a snapshot of a video stream. + * + * This method takes a snapshot of a video stream from the specified user, generates a JPG + * image, and saves it to the specified path. + * + * The method is asynchronous, and the SDK has not taken the snapshot when the method call + * returns. After a successful method call, the SDK triggers the `onSnapshotTaken` callback + * to report whether the snapshot is successfully taken, as well as the details for that + * snapshot. + * + * @note + * - Call this method after joining a channel. + * - This method takes a snapshot of the published video stream specified in `ChannelMediaOptions`. + * - If the user's video has been preprocessed, for example, watermarked or beautified, the resulting + * snapshot includes the pre-processing effect. + * + * @param uid The user ID. Set uid as 0 if you want to take a snapshot of the local user's video. + * @param filePath The local path (including filename extensions) of the snapshot. For example: + * - Windows: `C:\Users\\AppData\Local\Agora\\example.jpg` + * - iOS: `/App Sandbox/Library/Caches/example.jpg` + * - macOS: `~/Library/Logs/example.jpg` + * - Android: `/storage/emulated/0/Android/data//files/example.jpg` + * + * Ensure that the path you specify exists and is writable. + * @return + * - 0 : Success. + * - < 0 : Failure. + */ + virtual int takeSnapshot(uid_t uid, const char* filePath) = 0; + /** Enables the content inspect. + @param enabled Whether to enable content inspect: + - `true`: Yes. + - `false`: No. + @param config The configuration for the content inspection. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableContentInspect(bool enabled, const media::ContentInspectConfig &config) = 0; + /* + * Adjust the custom audio publish volume by track id. + * @param trackId custom audio track id. + * @param volume The volume, range is [0,100]: + * 0: mute, 100: The original volume + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustCustomAudioPublishVolume(track_id_t trackId, int volume) = 0; + + /* + * Adjust the custom audio playout volume by track id. + * @param trackId custom audio track id. + * @param volume The volume, range is [0,100]: + * 0: mute, 100: The original volume + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustCustomAudioPlayoutVolume(track_id_t trackId, int volume) = 0; + + /** Sets the Agora cloud proxy service. + * + * @since v3.3.0 + * + * When the user's firewall restricts the IP address and port, refer to *Use Cloud Proxy* to add the specific + * IP addresses and ports to the firewall allowlist; then, call this method to enable the cloud proxy and set + * the `proxyType` parameter as `UDP_PROXY(1)`, which is the cloud proxy for the UDP protocol. + * + * After a successfully cloud proxy connection, the SDK triggers + * the \ref IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" (CONNECTION_STATE_CONNECTING, CONNECTION_CHANGED_SETTING_PROXY_SERVER) callback. + * + * To disable the cloud proxy that has been set, call `setCloudProxy(NONE_PROXY)`. To change the cloud proxy type that has been set, + * call `setCloudProxy(NONE_PROXY)` first, and then call `setCloudProxy`, and pass the value that you expect in `proxyType`. + * + * @note + * - Agora recommends that you call this method before joining the channel or after leaving the channel. + * - For the SDK v3.3.x, the services for pushing streams to CDN and co-hosting across channels are not available + * when you use the cloud proxy for the UDP protocol. For the SDK v3.4.0 and later, the services for pushing streams + * to CDN and co-hosting across channels are not available when the user is in a network environment with a firewall + * and uses the cloud proxy for the UDP protocol. + * + * @param proxyType The cloud proxy type, see #CLOUD_PROXY_TYPE. This parameter is required, and the SDK reports an error if you do not pass in a value. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - `-2(ERR_INVALID_ARGUMENT)`: The parameter is invalid. + * - `-7(ERR_NOT_INITIALIZED)`: The SDK is not initialized. + */ + virtual int setCloudProxy(CLOUD_PROXY_TYPE proxyType) = 0; + /** set local access point addresses in local proxy mode. use this method before join channel. + + @param config The LocalAccessPointConfiguration class, See the definition of LocalAccessPointConfiguration for details. + + @return + - 0: Success + - < 0: Failure + */ + virtual int setLocalAccessPoint(const LocalAccessPointConfiguration& config) = 0; + + /** set advanced audio options. + @param options The AdvancedAudioOptions class, See the definition of AdvancedAudioOptions for details. + + @return + - 0: Success + - < 0: Failure + */ + virtual int setAdvancedAudioOptions(AdvancedAudioOptions &options, int sourceType = 0) = 0; + + /** Bind local user and a remote user as an audio&video sync group. The remote user is defined by cid and uid. + * There’s a usage limit that local user must be a video stream sender. On the receiver side, media streams from same sync group will be time-synced + * + * @param channelId The channel id + * @param uid The user ID of the remote user to be bound with (local user) + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAVSyncSource(const char* channelId, uid_t uid) = 0; + + /** + * @brief enable or disable video image source to replace the current video source published or resume it + * + * @param enable true for enable, false for disable + * @param options options for image track + */ + virtual int enableVideoImageSource(bool enable, const ImageTrackOptions& options) = 0; + + /* + * Get monotonic time in ms which can be used by capture time, + * typical scenario is as follows: + * + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * | // custom audio/video base capture time, e.g. the first audio/video capture time. | + * | int64_t custom_capture_time_base; | + * | | + * | int64_t agora_monotonic_time = getCurrentMonotonicTimeInMs(); | + * | | + * | // offset is fixed once calculated in the begining. | + * | const int64_t offset = agora_monotonic_time - custom_capture_time_base; | + * | | + * | // realtime_custom_audio/video_capture_time is the origin capture time that customer provided.| + * | // actual_audio/video_capture_time is the actual capture time transfered to sdk. | + * | int64_t actual_audio_capture_time = realtime_custom_audio_capture_time + offset; | + * | int64_t actual_video_capture_time = realtime_custom_video_capture_time + offset; | + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * + * @return + * - >= 0: Success. + * - < 0: Failure. + */ + virtual int64_t getCurrentMonotonicTimeInMs() = 0; + + /** + * Turns WIFI acceleration on or off. + * + * @note + * - This method is called before and after joining a channel. + * - Users check the WIFI router app for information about acceleration. Therefore, if this interface is invoked, the caller accepts that the caller's name will be displayed to the user in the WIFI router application on behalf of the caller. + * + * @param enabled + * - true:Turn WIFI acceleration on. + * - false:Turn WIFI acceleration off. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableWirelessAccelerate(bool enabled) = 0; + + /** + * get network type value + * + * @return + * - 0: DISCONNECTED. + * - 1: LAN. + * - 2: WIFI. + * - 3: MOBILE_2G. + * - 4: MOBILE_3G. + * - 5: MOBILE_4G. + * - 6: MOBILE_5G. + * - -1: UNKNOWN. + */ + + virtual int getNetworkType() = 0; + + /** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + + @param parameters Pointer to the set parameters in a JSON string. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setParameters(const char* parameters) = 0; + + /** + @brief Start tracing media rendering events. + @since v4.1.1 + @discussion + - SDK will trace media rendering events when this API is called. + - The tracing result can be obtained through callback `IRtcEngineEventHandler::onVideoRenderingTracingResult` + @note + - By default, SDK will trace media rendering events when `IRtcEngine::joinChannel` is called. + - The start point of event tracing will be reset after leaving channel. + @return + - 0: Success. + - < 0: Failure. + - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int startMediaRenderingTracing() = 0; + + /** + @brief Enable instant media rendering. + @since v4.1.1 + @discussion + - This method enable SDK to render video or playout audio faster. + @note + - Once enable this mode, we should destroy rtc engine to disable it. + - Enable this mode, will sacrifice some part of experience. + @return + - 0: Success. + - < 0: Failure. + - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int enableInstantMediaRendering() = 0; + + /** + * Return current NTP(unix timestamp) time in milliseconds. + */ + virtual uint64_t getNtpWallTimeInMs() = 0; + + /** + * @brief Whether the device support target feautre. + * @since v4.1.0 + * @param type The feature type. See FeatureType. + * @return + * - true: support. + * - false: not support. + */ + virtual bool isFeatureAvailableOnDevice(FeatureType type) = 0; + + /** + * @technical preview + */ + virtual int sendAudioMetadata(const char* metadata, size_t length) = 0; +}; + +class AAudioDeviceManager : public agora::util::AutoPtr { + public: + AAudioDeviceManager(IRtcEngine* engine) { + queryInterface(engine, AGORA_IID_AUDIO_DEVICE_MANAGER); + } +}; + +class AVideoDeviceManager : public agora::util::AutoPtr { + public: + AVideoDeviceManager(IRtcEngine* engine) { + queryInterface(engine, AGORA_IID_VIDEO_DEVICE_MANAGER); + } +}; + +// The following types are either deprecated or not implmented yet. +enum QUALITY_REPORT_FORMAT_TYPE { + /** 0: The quality report in JSON format, + */ + QUALITY_REPORT_JSON = 0, + /** 1: The quality report in HTML format. + */ + QUALITY_REPORT_HTML = 1, +}; + +/** Media device states. */ +enum MEDIA_DEVICE_STATE_TYPE { + /** 0: The device is ready for use. + */ + MEDIA_DEVICE_STATE_IDLE = 0, + /** 1: The device is active. + */ + MEDIA_DEVICE_STATE_ACTIVE = 1, + /** 2: The device is disabled. + */ + MEDIA_DEVICE_STATE_DISABLED = 2, + /** 4: The device is not present. + */ + MEDIA_DEVICE_STATE_NOT_PRESENT = 4, + /** 8: The device is unplugged. + */ + MEDIA_DEVICE_STATE_UNPLUGGED = 8 +}; + +enum VIDEO_PROFILE_TYPE { + /** 0: 160 x 120 @ 15 fps */ // res fps + VIDEO_PROFILE_LANDSCAPE_120P = 0, // 160x120 15 + /** 2: 120 x 120 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_120P_3 = 2, // 120x120 15 + /** 10: 320 x 180 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_180P = 10, // 320x180 15 + /** 12: 180 x 180 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_180P_3 = 12, // 180x180 15 + /** 13: 240 x 180 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_180P_4 = 13, // 240x180 15 + /** 20: 320 x 240 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_240P = 20, // 320x240 15 + /** 22: 240 x 240 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_240P_3 = 22, // 240x240 15 + /** 23: 424 x 240 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_240P_4 = 23, // 424x240 15 + /** 30: 640 x 360 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_360P = 30, // 640x360 15 + /** 32: 360 x 360 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_3 = 32, // 360x360 15 + /** 33: 640 x 360 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_4 = 33, // 640x360 30 + /** 35: 360 x 360 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_6 = 35, // 360x360 30 + /** 36: 480 x 360 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_7 = 36, // 480x360 15 + /** 37: 480 x 360 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_8 = 37, // 480x360 30 + /** 38: 640 x 360 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_9 = 38, // 640x360 15 + /** 39: 640 x 360 @ 24 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_10 = 39, // 640x360 24 + /** 100: 640 x 360 @ 24 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_11 = 100, // 640x360 24 + /** 40: 640 x 480 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_480P = 40, // 640x480 15 + /** 42: 480 x 480 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_3 = 42, // 480x480 15 + /** 43: 640 x 480 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_4 = 43, // 640x480 30 + /** 45: 480 x 480 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_6 = 45, // 480x480 30 + /** 47: 848 x 480 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_8 = 47, // 848x480 15 + /** 48: 848 x 480 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_9 = 48, // 848x480 30 + /** 49: 640 x 480 @ 10 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_10 = 49, // 640x480 10 + /** 50: 1280 x 720 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_720P = 50, // 1280x720 15 + /** 52: 1280 x 720 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_720P_3 = 52, // 1280x720 30 + /** 54: 960 x 720 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_720P_5 = 54, // 960x720 15 + /** 55: 960 x 720 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_720P_6 = 55, // 960x720 30 + /** 60: 1920 x 1080 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_1080P = 60, // 1920x1080 15 + /** 62: 1920 x 1080 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_1080P_3 = 62, // 1920x1080 30 + /** 64: 1920 x 1080 @ 60 fps */ + VIDEO_PROFILE_LANDSCAPE_1080P_5 = 64, // 1920x1080 60 + /** 66: 2560 x 1440 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_1440P = 66, // 2560x1440 30 + /** 67: 2560 x 1440 @ 60 fps */ + VIDEO_PROFILE_LANDSCAPE_1440P_2 = 67, // 2560x1440 60 + /** 70: 3840 x 2160 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_4K = 70, // 3840x2160 30 + /** 72: 3840 x 2160 @ 60 fps */ + VIDEO_PROFILE_LANDSCAPE_4K_3 = 72, // 3840x2160 60 + /** 1000: 120 x 160 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_120P = 1000, // 120x160 15 + /** 1002: 120 x 120 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_120P_3 = 1002, // 120x120 15 + /** 1010: 180 x 320 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_180P = 1010, // 180x320 15 + /** 1012: 180 x 180 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_180P_3 = 1012, // 180x180 15 + /** 1013: 180 x 240 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_180P_4 = 1013, // 180x240 15 + /** 1020: 240 x 320 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_240P = 1020, // 240x320 15 + /** 1022: 240 x 240 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_240P_3 = 1022, // 240x240 15 + /** 1023: 240 x 424 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_240P_4 = 1023, // 240x424 15 + /** 1030: 360 x 640 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_360P = 1030, // 360x640 15 + /** 1032: 360 x 360 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_360P_3 = 1032, // 360x360 15 + /** 1033: 360 x 640 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_360P_4 = 1033, // 360x640 30 + /** 1035: 360 x 360 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_360P_6 = 1035, // 360x360 30 + /** 1036: 360 x 480 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_360P_7 = 1036, // 360x480 15 + /** 1037: 360 x 480 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_360P_8 = 1037, // 360x480 30 + /** 1038: 360 x 640 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_360P_9 = 1038, // 360x640 15 + /** 1039: 360 x 640 @ 24 fps */ + VIDEO_PROFILE_PORTRAIT_360P_10 = 1039, // 360x640 24 + /** 1100: 360 x 640 @ 24 fps */ + VIDEO_PROFILE_PORTRAIT_360P_11 = 1100, // 360x640 24 + /** 1040: 480 x 640 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_480P = 1040, // 480x640 15 + /** 1042: 480 x 480 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_480P_3 = 1042, // 480x480 15 + /** 1043: 480 x 640 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_480P_4 = 1043, // 480x640 30 + /** 1045: 480 x 480 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_480P_6 = 1045, // 480x480 30 + /** 1047: 480 x 848 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_480P_8 = 1047, // 480x848 15 + /** 1048: 480 x 848 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_480P_9 = 1048, // 480x848 30 + /** 1049: 480 x 640 @ 10 fps */ + VIDEO_PROFILE_PORTRAIT_480P_10 = 1049, // 480x640 10 + /** 1050: 720 x 1280 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_720P = 1050, // 720x1280 15 + /** 1052: 720 x 1280 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_720P_3 = 1052, // 720x1280 30 + /** 1054: 720 x 960 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_720P_5 = 1054, // 720x960 15 + /** 1055: 720 x 960 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_720P_6 = 1055, // 720x960 30 + /** 1060: 1080 x 1920 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_1080P = 1060, // 1080x1920 15 + /** 1062: 1080 x 1920 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_1080P_3 = 1062, // 1080x1920 30 + /** 1064: 1080 x 1920 @ 60 fps */ + VIDEO_PROFILE_PORTRAIT_1080P_5 = 1064, // 1080x1920 60 + /** 1066: 1440 x 2560 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_1440P = 1066, // 1440x2560 30 + /** 1067: 1440 x 2560 @ 60 fps */ + VIDEO_PROFILE_PORTRAIT_1440P_2 = 1067, // 1440x2560 60 + /** 1070: 2160 x 3840 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_4K = 1070, // 2160x3840 30 + /** 1072: 2160 x 3840 @ 60 fps */ + VIDEO_PROFILE_PORTRAIT_4K_3 = 1072, // 2160x3840 60 + /** Default 640 x 360 @ 15 fps */ + VIDEO_PROFILE_DEFAULT = VIDEO_PROFILE_LANDSCAPE_360P, +}; + +} // namespace rtc +} // namespace agora + +/** Gets the SDK version number. + +@param build Build number of Agora the SDK. +* @return String of the SDK version. +*/ +#define getAgoraRtcEngineVersion getAgoraSdkVersion + +//////////////////////////////////////////////////////// +/** \addtogroup createAgoraRtcEngine + @{ + */ +//////////////////////////////////////////////////////// + +/** Creates the RTC engine object and returns the pointer. + +* @return Pointer of the RTC engine object. +*/ +AGORA_API agora::rtc::IRtcEngine* AGORA_CALL createAgoraRtcEngine(); + +//////////////////////////////////////////////////////// +/** @} */ +//////////////////////////////////////////////////////// + +/** Creates the RTC engine object and returns the pointer. + + @param err Error Code. +* @return Description of the Error Code: agora::ERROR_CODE_TYPE +*/ +#define getAgoraRtcEngineErrorDescription getAgoraSdkErrorDescription +#define setAgoraRtcEngineExternalSymbolLoader setAgoraSdkExternalSymbolLoader diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtcEngineEx.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtcEngineEx.h new file mode 100644 index 0000000..555239d --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtcEngineEx.h @@ -0,0 +1,1976 @@ +// +// Agora Media SDK +// +// Created by Sting Feng in 2015-05. +// Updated by Tommy Miao in 2020-11. +// Copyright (c) 2015 Agora IO. All rights reserved. +// +#pragma once + +#include "IAgoraRtcEngine.h" + +namespace agora { +namespace rtc { + +// OPTIONAL_ENUM_CLASS RTC_EVENT; + +/** + * Rtc Connection. + */ +struct RtcConnection { + /** + * The unique channel name for the AgoraRTC session in the string format. The string + * length must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + */ + const char* channelId; + /** + * User ID: A 32-bit unsigned integer ranging from 1 to (2^32-1). It must be unique. + */ + uid_t localUid; + + RtcConnection() : channelId(NULL), localUid(0) {} + RtcConnection(const char* channel_id, uid_t local_uid) + : channelId(channel_id), localUid(local_uid) {} +}; + +class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { + public: + using IRtcEngineEventHandler::eventHandlerType; + using IRtcEngineEventHandler::onJoinChannelSuccess; + using IRtcEngineEventHandler::onRejoinChannelSuccess; + using IRtcEngineEventHandler::onAudioQuality; + using IRtcEngineEventHandler::onAudioVolumeIndication; + using IRtcEngineEventHandler::onLeaveChannel; + using IRtcEngineEventHandler::onRtcStats; + using IRtcEngineEventHandler::onNetworkQuality; + using IRtcEngineEventHandler::onIntraRequestReceived; + using IRtcEngineEventHandler::onFirstLocalVideoFrame; + using IRtcEngineEventHandler::onFirstLocalVideoFramePublished; + using IRtcEngineEventHandler::onFirstRemoteVideoDecoded; + using IRtcEngineEventHandler::onVideoSizeChanged; + using IRtcEngineEventHandler::onLocalVideoStateChanged; + using IRtcEngineEventHandler::onRemoteVideoStateChanged; + using IRtcEngineEventHandler::onFirstRemoteVideoFrame; + using IRtcEngineEventHandler::onUserJoined; + using IRtcEngineEventHandler::onUserOffline; + using IRtcEngineEventHandler::onUserMuteAudio; + using IRtcEngineEventHandler::onUserMuteVideo; + using IRtcEngineEventHandler::onUserEnableVideo; + using IRtcEngineEventHandler::onUserEnableLocalVideo; + using IRtcEngineEventHandler::onUserStateChanged; + using IRtcEngineEventHandler::onLocalAudioStats; + using IRtcEngineEventHandler::onRemoteAudioStats; + using IRtcEngineEventHandler::onLocalVideoStats; + using IRtcEngineEventHandler::onRemoteVideoStats; + using IRtcEngineEventHandler::onConnectionLost; + using IRtcEngineEventHandler::onConnectionInterrupted; + using IRtcEngineEventHandler::onConnectionBanned; + using IRtcEngineEventHandler::onStreamMessage; + using IRtcEngineEventHandler::onStreamMessageError; + using IRtcEngineEventHandler::onRequestToken; + using IRtcEngineEventHandler::onTokenPrivilegeWillExpire; + using IRtcEngineEventHandler::onLicenseValidationFailure; + using IRtcEngineEventHandler::onFirstLocalAudioFramePublished; + using IRtcEngineEventHandler::onFirstRemoteAudioFrame; + using IRtcEngineEventHandler::onFirstRemoteAudioDecoded; + using IRtcEngineEventHandler::onLocalAudioStateChanged; + using IRtcEngineEventHandler::onRemoteAudioStateChanged; + using IRtcEngineEventHandler::onActiveSpeaker; + using IRtcEngineEventHandler::onClientRoleChanged; + using IRtcEngineEventHandler::onClientRoleChangeFailed; + using IRtcEngineEventHandler::onRemoteAudioTransportStats; + using IRtcEngineEventHandler::onRemoteVideoTransportStats; + using IRtcEngineEventHandler::onConnectionStateChanged; + using IRtcEngineEventHandler::onWlAccMessage; + using IRtcEngineEventHandler::onWlAccStats; + using IRtcEngineEventHandler::onNetworkTypeChanged; + using IRtcEngineEventHandler::onEncryptionError; + using IRtcEngineEventHandler::onUploadLogResult; + using IRtcEngineEventHandler::onUserAccountUpdated; + using IRtcEngineEventHandler::onAudioSubscribeStateChanged; + using IRtcEngineEventHandler::onVideoSubscribeStateChanged; + using IRtcEngineEventHandler::onAudioPublishStateChanged; + using IRtcEngineEventHandler::onVideoPublishStateChanged; + using IRtcEngineEventHandler::onSnapshotTaken; + using IRtcEngineEventHandler::onVideoRenderingTracingResult; + using IRtcEngineEventHandler::onTranscodedStreamLayoutInfo; + using IRtcEngineEventHandler::onAudioMetadataReceived; + + virtual const char* eventHandlerType() const { return "event_handler_ex"; } + + /** + * Occurs when a user joins a channel. + * + * This callback notifies the application that a user joins a specified channel. + * + * @param connection The RtcConnection object. + * @param elapsed The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback. + */ + virtual void onJoinChannelSuccess(const RtcConnection& connection, int elapsed) { + (void)connection; + (void)elapsed; + } + + /** + * Occurs when a user rejoins the channel. + * + * When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect + * and triggers this callback upon reconnection. + * + * @param connection The RtcConnection object. + * @param elapsed Time elapsed (ms) from the local user calling the joinChannel method until this callback is triggered. + */ + virtual void onRejoinChannelSuccess(const RtcConnection& connection, int elapsed) { + (void)connection; + (void)elapsed; + } + + /** Reports the statistics of the audio stream from each remote + user/broadcaster. + + @deprecated This callback is deprecated. Use onRemoteAudioStats instead. + + The SDK triggers this callback once every two seconds to report the audio + quality of each remote user/host sending an audio stream. If a channel has + multiple remote users/hosts sending audio streams, the SDK triggers this + callback as many times. + + @param connection The RtcConnection object. + @param remoteUid The user ID of the remote user sending the audio stream. + @param quality The audio quality of the user: #QUALITY_TYPE + @param delay The network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering. + @param lost The audio packet loss rate (%) from the sender to the receiver. + */ + virtual void onAudioQuality(const RtcConnection& connection, uid_t remoteUid, int quality, unsigned short delay, unsigned short lost) { + (void)connection; + (void)remoteUid; + (void)quality; + (void)delay; + (void)lost; + } + /** + * Reports the volume information of users. + * + * By default, this callback is disabled. You can enable it by calling `enableAudioVolumeIndication`. Once this + * callback is enabled and users send streams in the channel, the SDK triggers the `onAudioVolumeIndication` + * callback at the time interval set in `enableAudioVolumeIndication`. The SDK triggers two independent + * `onAudioVolumeIndication` callbacks simultaneously, which separately report the volume information of the + * local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest. + * + * @note After you enable this callback, calling muteLocalAudioStream affects the SDK's behavior as follows: + * - If the local user stops publishing the audio stream, the SDK stops triggering the local user's callback. + * - 20 seconds after a remote user whose volume is one of the three highest stops publishing the audio stream, + * the callback excludes this user's information; 20 seconds after all remote users stop publishing audio streams, + * the SDK stops triggering the callback for remote users. + * + * @param connection The RtcConnection object. + * @param speakers The volume information of the users, see AudioVolumeInfo. An empty `speakers` array in the + * callback indicates that no remote user is in the channel or sending a stream at the moment. + * @param speakerNumber The total number of speakers. + * - In the local user's callback, when the local user sends a stream, `speakerNumber` is 1. + * - In the callback for remote users, the value range of speakerNumber is [0,3]. If the number of remote users who + * send streams is greater than or equal to three, the value of `speakerNumber` is 3. + * @param totalVolume The volume of the speaker. The value ranges between 0 (lowest volume) and 255 (highest volume). + * - In the local user's callback, `totalVolume` is the volume of the local user who sends a stream. + * - In the remote users' callback, `totalVolume` is the sum of all remote users (up to three) whose instantaneous + * volume is the highest. If the user calls `startAudioMixing`, `totalVolume` is the volume after audio mixing. + */ + virtual void onAudioVolumeIndication(const RtcConnection& connection, const AudioVolumeInfo* speakers, + unsigned int speakerNumber, int totalVolume) { + (void)connection; + (void)speakers; + (void)speakerNumber; + (void)totalVolume; + } + + /** + * Occurs when a user leaves a channel. + * + * This callback notifies the app that the user leaves the channel by calling `leaveChannel`. From this callback, + * the app can get information such as the call duration and quality statistics. + * + * @param connection The RtcConnection object. + * @param stats The statistics on the call: RtcStats. + */ + virtual void onLeaveChannel(const RtcConnection& connection, const RtcStats& stats) { + (void)connection; + (void)stats; + } + + /** + * Reports the statistics of the current call. + * + * The SDK triggers this callback once every two seconds after the user joins the channel. + * + * @param connection The RtcConnection object. + * @param stats The statistics of the current call: RtcStats. + */ + virtual void onRtcStats(const RtcConnection& connection, const RtcStats& stats) { + (void)connection; + (void)stats; + } + + /** + * Reports the last mile network quality of each user in the channel. + * + * This callback reports the last mile network conditions of each user in the channel. Last mile refers to the + * connection between the local device and Agora's edge server. + * + * The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers + * this callback as many times. + * + * @note `txQuality` is UNKNOWN when the user is not sending a stream; `rxQuality` is UNKNOWN when the user is not + * receiving a stream. + * + * @param connection The RtcConnection object. + * @param remoteUid The user ID. The network quality of the user with this user ID is reported. + * @param txQuality Uplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, + * average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you + * understand how well the current uplink network conditions can support the selected video encoder configuration. + * For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame + * rate of 15 fps in the LIVE_BROADCASTING profile, but may be inadequate for resolutions higher than 1280 × 720. + * See #QUALITY_TYPE. + * @param rxQuality Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter + * of the downlink network. See #QUALITY_TYPE. + */ + virtual void onNetworkQuality(const RtcConnection& connection, uid_t remoteUid, int txQuality, int rxQuality) { + (void)connection; + (void)remoteUid; + (void)txQuality; + (void)rxQuality; + } + + /** + * Occurs when intra request from remote user is received. + * + * This callback is triggered once remote user needs one Key frame. + * + * @param connection The RtcConnection object. + */ + virtual void onIntraRequestReceived(const RtcConnection& connection) { + (void)connection; + } + + /** + * Occurs when the first local video frame is displayed on the video window. + * + * @deprecated 4.0.0 This callback is deprecated, use void onFirstLocalVideoFrame(VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) instead. + * + * @param connection The RtcConnection object. + * @param width The width (pixels) of the video stream. + * @param height The height (pixels) of the video stream. + * @param elapsed The time elapsed (ms) from the local user calling \ref IRtcEngine::joinChannel "joinChannel" until this callback is triggered. + */ + virtual void onFirstLocalVideoFrame(const RtcConnection& connection, int width, int height, int elapsed) { + (void)connection; + (void)width; + (void)height; + (void)elapsed; + } + + /** Occurs when the first local video frame is published. + * The SDK triggers this callback under one of the following circumstances: + * - The local client enables the video module and calls `joinChannel` successfully. + * - The local client calls `muteLocalVideoStream(true)` and muteLocalVideoStream(false) in sequence. + * - The local client calls `disableVideo` and `enableVideo` in sequence. + * - The local client calls `pushVideoFrame` to successfully push the video frame to the SDK. + * + * @param connection The RtcConnection object. + * @param elapsed The time elapsed (ms) from the local user calling joinChannel` to the SDK triggers + * this callback. + */ + virtual void onFirstLocalVideoFramePublished(const RtcConnection& connection, int elapsed) { + (void)connection; + (void)elapsed; + } + + /** Occurs when the first remote video frame is received and decoded. + + The SDK triggers this callback under one of the following circumstances: + - The remote user joins the channel and sends the video stream. + - The remote user stops sending the video stream and re-sends it after 15 seconds. Reasons for such an interruption include: + - The remote user leaves the channel. + - The remote user drops offline. + - The remote user calls `muteLocalVideoStream` to stop sending the video stream. + - The remote user calls `disableVideo` to disable video. + + @param connection The RtcConnection object. + @param remoteUid The user ID of the remote user sending the video stream. + @param width The width (pixels) of the video stream. + @param height The height (pixels) of the video stream. + @param elapsed The time elapsed (ms) from the local user calling `joinChannel` + until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoDecoded(const RtcConnection& connection, uid_t remoteUid, int width, int height, int elapsed) { + (void)connection; + (void)remoteUid; + (void)width; + (void)height; + (void)elapsed; + } + + /** + * Occurs when the local or remote video size or rotation has changed. + * + * @param connection The RtcConnection object. + * @param sourceType The video source type: #VIDEO_SOURCE_TYPE. + * @param uid The user ID. 0 indicates the local user. + * @param width The new width (pixels) of the video. + * @param height The new height (pixels) of the video. + * @param rotation The rotation information of the video. + */ + virtual void onVideoSizeChanged(const RtcConnection& connection, VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) { + (void)connection; + (void)uid; + (void)width; + (void)height; + (void)rotation; + } + /** Occurs when the local video stream state changes. + * + * When the state of the local video stream changes (including the state of the video capture and + * encoding), the SDK triggers this callback to report the current state. This callback indicates + * the state of the local video stream, including camera capturing and video encoding, and allows + * you to troubleshoot issues when exceptions occur. + * + * The SDK triggers the onLocalVideoStateChanged callback with the state code of `LOCAL_VIDEO_STREAM_STATE_FAILED` + * and error code of `LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE` in the following situations: + * - The app switches to the background, and the system gets the camera resource. + * - The camera starts normally, but does not output video for four consecutive seconds. + * + * When the camera outputs the captured video frames, if the video frames are the same for 15 + * consecutive frames, the SDK triggers the `onLocalVideoStateChanged` callback with the state code + * of `LOCAL_VIDEO_STREAM_STATE_CAPTURING` and error code of `LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE`. + * Note that the video frame duplication detection is only available for video frames with a resolution + * greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps. + * + * @note For some device models, the SDK does not trigger this callback when the state of the local + * video changes while the local video capturing device is in use, so you have to make your own + * timeout judgment. + * + * @param connection The RtcConnection object. + * @param state The state of the local video. See #LOCAL_VIDEO_STREAM_STATE. + * @param error The detailed error information. See #LOCAL_VIDEO_STREAM_ERROR. + */ + virtual void onLocalVideoStateChanged(const RtcConnection& connection, + LOCAL_VIDEO_STREAM_STATE state, + LOCAL_VIDEO_STREAM_ERROR errorCode) { + (void)connection; + (void)state; + (void)errorCode; + } + + /** + * Occurs when the remote video state changes. + * + * @note This callback does not work properly when the number of users (in the voice/video call + * channel) or hosts (in the live streaming channel) in the channel exceeds 17. + * + * @param connection The RtcConnection object. + * @param remoteUid The ID of the user whose video state has changed. + * @param state The remote video state: #REMOTE_VIDEO_STATE. + * @param reason The reason of the remote video state change: #REMOTE_VIDEO_STATE_REASON. + * @param elapsed The time elapsed (ms) from the local client calling `joinChannel` until this callback is triggered. + */ + virtual void onRemoteVideoStateChanged(const RtcConnection& connection, uid_t remoteUid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) { + (void)connection; + (void)remoteUid; + (void)state; + (void)reason; + (void)elapsed; + } + + /** Occurs when the renderer receives the first frame of the remote video. + * + * @param connection The RtcConnection object. + * @param remoteUid The user ID of the remote user sending the video stream. + * @param width The width (px) of the video frame. + * @param height The height (px) of the video stream. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoFrame(const RtcConnection& connection, uid_t remoteUid, int width, int height, int elapsed) { + (void)connection; + (void)remoteUid; + (void)width; + (void)height; + (void)elapsed; + } + + /** + * Occurs when a remote user or broadcaster joins the channel. + * + * - In the COMMUNICATION channel profile, this callback indicates that a remote user joins the channel. + * The SDK also triggers this callback to report the existing users in the channel when a user joins the + * channel. + * In the LIVE_BROADCASTING channel profile, this callback indicates that a host joins the channel. The + * SDK also triggers this callback to report the existing hosts in the channel when a host joins the + * channel. Agora recommends limiting the number of hosts to 17. + * + * The SDK triggers this callback under one of the following circumstances: + * - A remote user/host joins the channel by calling the `joinChannel` method. + * - A remote user switches the user role to the host after joining the channel. + * - A remote user/host rejoins the channel after a network interruption. + * + * @param connection The RtcConnection object. + * @param remoteUid The ID of the remote user or broadcaster joining the channel. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` or `setClientRole` + * until this callback is triggered. + */ + virtual void onUserJoined(const RtcConnection& connection, uid_t remoteUid, int elapsed) { + (void)connection; + (void)remoteUid; + (void)elapsed; + } + + /** + * Occurs when a remote user or broadcaster goes offline. + * + * There are two reasons for a user to go offline: + * - Leave the channel: When the user leaves the channel, the user sends a goodbye message. When this + * message is received, the SDK determines that the user leaves the channel. + * - Drop offline: When no data packet of the user is received for a certain period of time, the SDK assumes + * that the user drops offline. A poor network connection may lead to false detection, so we recommend using + * the RTM SDK for reliable offline detection. + * - The user switches the user role from a broadcaster to an audience. + * + * @param connection The RtcConnection object. + * @param remoteUid The ID of the remote user or broadcaster who leaves the channel or drops offline. + * @param reason The reason why the remote user goes offline: #USER_OFFLINE_REASON_TYPE. + */ + virtual void onUserOffline(const RtcConnection& connection, uid_t remoteUid, USER_OFFLINE_REASON_TYPE reason) { + (void)connection; + (void)remoteUid; + (void)reason; + } + + /** Occurs when a remote user's audio stream playback pauses/resumes. + * The SDK triggers this callback when the remote user stops or resumes sending the audio stream by + * calling the `muteLocalAudioStream` method. + * @note This callback can be inaccurate when the number of users (in the `COMMUNICATION` profile) or hosts (in the `LIVE_BROADCASTING` profile) in the channel exceeds 17. + * + * @param connection The RtcConnection object. + * @param remoteUid The user ID. + * @param muted Whether the remote user's audio stream is muted/unmuted: + * - true: Muted. + * - false: Unmuted. + */ + virtual void onUserMuteAudio(const RtcConnection& connection, uid_t remoteUid, bool muted) __deprecated { + (void)connection; + (void)remoteUid; + (void)muted; + } + + /** Occurs when a remote user pauses or resumes sending the video stream. + * + * When a remote user calls `muteLocalVideoStream` to stop or resume publishing the video stream, the + * SDK triggers this callback to report the state of the remote user's publishing stream to the local + * user. + * + * @note This callback can be inaccurate when the number of users or broadacasters in a + * channel exceeds 20. + * + * @param connection The RtcConnection object. + * @param remoteUid ID of the remote user. + * @param muted Whether the remote user stops publishing the video stream: + * - true: The remote user has paused sending the video stream. + * - false: The remote user has resumed sending the video stream. + */ + virtual void onUserMuteVideo(const RtcConnection& connection, uid_t remoteUid, bool muted) { + (void)connection; + (void)remoteUid; + (void)muted; + } + + /** Occurs when a remote user enables or disables the video module. + + Once the video function is disabled, the users cannot see any video. + + The SDK triggers this callback when a remote user enables or disables the video module by calling the + `enableVideo` or `disableVideo` method. + + @param connection The RtcConnection object. + @param remoteUid The ID of the remote user. + @param enabled Whether the video of the remote user is enabled: + - true: The remote user has enabled video. + - false: The remote user has disabled video. + */ + virtual void onUserEnableVideo(const RtcConnection& connection, uid_t remoteUid, bool enabled) __deprecated { + (void)connection; + (void)remoteUid; + (void)enabled; + } + + /** Occurs when a remote user enables or disables local video capturing. + + The SDK triggers this callback when the remote user resumes or stops capturing the video stream by + calling the `enableLocalVideo` method. + + @param connection The RtcConnection object. + @param remoteUid The ID of the remote user. + @param enabled Whether the specified remote user enables/disables local video: + - `true`: The remote user has enabled local video capturing. + - `false`: The remote user has disabled local video capturing. + */ + virtual void onUserEnableLocalVideo(const RtcConnection& connection, uid_t remoteUid, bool enabled) __deprecated { + (void)connection; + (void)remoteUid; + (void)enabled; + } + + /** + * Occurs when the remote user state is updated. + * + * @param connection The RtcConnection object. + * @param remoteUid The uid of the remote user. + * @param state The remote user state: #REMOTE_USER_STATE. + */ + virtual void onUserStateChanged(const RtcConnection& connection, uid_t remoteUid, uint32_t state) { + (void)connection; + (void)remoteUid; + (void)state; + } + + /** Reports the statistics of the local audio stream. + * + * The SDK triggers this callback once every two seconds. + * + * @param connection The RtcConnection object. + * @param stats The statistics of the local audio stream. + * See LocalAudioStats. + */ + virtual void onLocalAudioStats(const RtcConnection& connection, const LocalAudioStats& stats) { + (void)connection; + (void)stats; + } + + /** Reports the statistics of the audio stream from each remote user/host. + + The SDK triggers this callback once every two seconds for each remote user who is sending audio + streams. If a channel includes multiple remote users, the SDK triggers this callback as many times. + @param connection The RtcConnection object. + @param stats Statistics of the received remote audio streams. See RemoteAudioStats. + */ + virtual void onRemoteAudioStats(const RtcConnection& connection, const RemoteAudioStats& stats) { + (void)connection; + (void)stats; + } + + /** Reports the statistics of the local video stream. + * + * The SDK triggers this callback once every two seconds for each + * user/host. If there are multiple users/hosts in the channel, the SDK + * triggers this callback as many times. + * + * @note If you have called the `enableDualStreamMode` + * method, this callback reports the statistics of the high-video + * stream (high bitrate, and high-resolution video stream). + * + * @param connection The RtcConnection object. + * @param stats Statistics of the local video stream. See LocalVideoStats. + */ + virtual void onLocalVideoStats(const RtcConnection& connection, const LocalVideoStats& stats) { + (void)connection; + (void)stats; + } + + /** Reports the statistics of the video stream from each remote user/host. + * + * The SDK triggers this callback once every two seconds for each remote user. If a channel has + * multiple users/hosts sending video streams, the SDK triggers this callback as many times. + * + * @param connection The RtcConnection object. + * @param stats Statistics of the remote video stream. See + * RemoteVideoStats. + */ + virtual void onRemoteVideoStats(const RtcConnection& connection, const RemoteVideoStats& stats) { + (void)connection; + (void)stats; + } + + /** + * Occurs when the SDK cannot reconnect to the server 10 seconds after its connection to the server is + * interrupted. + * + * The SDK triggers this callback when it cannot connect to the server 10 seconds after calling + * `joinChannel`, regardless of whether it is in the channel or not. If the SDK fails to rejoin + * the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel. + * + * @param connection The RtcConnection object. + */ + virtual void onConnectionLost(const RtcConnection& connection) { + (void)connection; + } + + /** Occurs when the connection between the SDK and the server is interrupted. + * @deprecated Use `onConnectionStateChanged` instead. + + The SDK triggers this callback when it loses connection with the serer for more + than 4 seconds after the connection is established. After triggering this + callback, the SDK tries to reconnect to the server. If the reconnection fails + within a certain period (10 seconds by default), the onConnectionLost() + callback is triggered. If the SDK fails to rejoin the channel 20 minutes after + being disconnected from Agora's edge server, the SDK stops rejoining the channel. + + @param connection The RtcConnection object. + + */ + virtual void onConnectionInterrupted(const RtcConnection& connection) { + (void)connection; + } + + /** Occurs when your connection is banned by the Agora Server. + * + * @param connection The RtcConnection object. + */ + virtual void onConnectionBanned(const RtcConnection& connection) { + (void)connection; + } + + /** Occurs when the local user receives the data stream from the remote user. + * + * The SDK triggers this callback when the user receives the data stream that another user sends + * by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method. + * + * @param connection The RtcConnection object. + * @param remoteUid ID of the user who sends the data stream. + * @param streamId The ID of the stream data. + * @param data The data stream. + * @param length The length (byte) of the data stream. + * @param sentTs The time when the data stream sent. + */ + virtual void onStreamMessage(const RtcConnection& connection, uid_t remoteUid, int streamId, const char* data, size_t length, uint64_t sentTs) { + (void)connection; + (void)remoteUid; + (void)streamId; + (void)data; + (void)length; + (void)sentTs; + } + + /** Occurs when the local user does not receive the data stream from the remote user. + * + * The SDK triggers this callback when the user fails to receive the data stream that another user sends + * by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method. + * + * @param connection The RtcConnection object. + * @param remoteUid ID of the user who sends the data stream. + * @param streamId The ID of the stream data. + * @param code The error code. + * @param missed The number of lost messages. + * @param cached The number of incoming cached messages when the data stream is + * interrupted. + */ + virtual void onStreamMessageError(const RtcConnection& connection, uid_t remoteUid, int streamId, int code, int missed, int cached) { + (void)connection; + (void)remoteUid; + (void)streamId; + (void)code; + (void)missed; + (void)cached; + } + + /** + * Occurs when the token expires. + * + * When the token expires during a call, the SDK triggers this callback to remind the app to renew the token. + * + * Upon receiving this callback, generate a new token at your app server and call + * `joinChannel` to pass the new token to the SDK. + * + * @param connection The RtcConnection object. + */ + virtual void onRequestToken(const RtcConnection& connection) { + (void)connection; + } + + /** + * Occurs when connection license verification fails. + * + * You can know the reason accordding to error code + */ + virtual void onLicenseValidationFailure(const RtcConnection& connection, LICENSE_ERROR_TYPE reason) { + (void)connection; + (void)reason; + } + + /** + * Occurs when the token will expire in 30 seconds. + * + * When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token. + + * Upon receiving this callback, generate a new token at your app server and call + * \ref IRtcEngine::renewToken "renewToken" to pass the new Token to the SDK. + * + * @param connection The RtcConnection object. + * @param token The token that will expire in 30 seconds. + */ + virtual void onTokenPrivilegeWillExpire(const RtcConnection& connection, const char* token) { + (void)connection; + (void)token; + } + + /** Occurs when the first local audio frame is published. + * + * The SDK triggers this callback under one of the following circumstances: + * - The local client enables the audio module and calls `joinChannel` successfully. + * - The local client calls `muteLocalAudioStream(true)` and `muteLocalAudioStream(false)` in sequence. + * - The local client calls `disableAudio` and `enableAudio` in sequence. + * - The local client calls `pushAudioFrame` to successfully push the audio frame to the SDK. + * + * @param connection The RtcConnection object. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` to the SDK triggers this callback. + */ + virtual void onFirstLocalAudioFramePublished(const RtcConnection& connection, int elapsed) { + (void)connection; + (void)elapsed; + } + + /** Occurs when the SDK receives the first audio frame from a specific remote user. + * @deprecated Use `onRemoteAudioStateChanged` instead. + * + * @param connection The RtcConnection object. + * @param userId ID of the remote user. + * @param elapsed The time elapsed (ms) from the loca user calling `joinChannel` + * until this callback is triggered. + */ + virtual void onFirstRemoteAudioFrame(const RtcConnection& connection, uid_t userId, int elapsed) { + (void)connection; + (void)userId; + (void)elapsed; + } + + /** + * Occurs when the SDK decodes the first remote audio frame for playback. + * + * @deprecated Use `onRemoteAudioStateChanged` instead. + * The SDK triggers this callback under one of the following circumstances: + * - The remote user joins the channel and sends the audio stream for the first time. + * - The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot + * receive audio in 15 seconds. Reasons for such an interruption include: + * - The remote user leaves channel. + * - The remote user drops offline. + * - The remote user calls muteLocalAudioStream to stop sending the audio stream. + * - The remote user calls disableAudio to disable audio. + * @param connection The RtcConnection object. + * @param uid User ID of the remote user sending the audio stream. + * @param elapsed The time elapsed (ms) from the loca user calling `joinChannel` + * until this callback is triggered. + */ + virtual void onFirstRemoteAudioDecoded(const RtcConnection& connection, uid_t uid, int elapsed) { + (void)connection; + (void)uid; + (void)elapsed; + } + + /** Occurs when the local audio state changes. + * + * When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK + * triggers this callback to report the current state. This callback indicates the state of the local audio stream, + * and allows you to troubleshoot issues when audio exceptions occur. + * + * @note + * When the state is `LOCAL_AUDIO_STREAM_STATE_FAILED(3)`, see the `error` + * parameter for details. + * + * @param connection The RtcConnection object. + * @param state State of the local audio. See #LOCAL_AUDIO_STREAM_STATE. + * @param error The error information of the local audio. + * See #LOCAL_AUDIO_STREAM_ERROR. + */ + virtual void onLocalAudioStateChanged(const RtcConnection& connection, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error) { + (void)connection; + (void)state; + (void)error; + } + + /** Occurs when the remote audio state changes. + * + * When the audio state of a remote user (in the voice/video call channel) or host (in the live streaming channel) + * changes, the SDK triggers this callback to report the current state of the remote audio stream. + * + * @note This callback does not work properly when the number of users (in the voice/video call channel) or hosts + * (in the live streaming channel) in the channel exceeds 17. + * + * @param connection The RtcConnection object. + * @param remoteUid ID of the remote user whose audio state changes. + * @param state State of the remote audio. See #REMOTE_AUDIO_STATE. + * @param reason The reason of the remote audio state change. + * See #REMOTE_AUDIO_STATE_REASON. + * @param elapsed Time elapsed (ms) from the local user calling the + * `joinChannel` method until the SDK + * triggers this callback. + */ + virtual void onRemoteAudioStateChanged(const RtcConnection& connection, uid_t remoteUid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) { + (void)connection; + (void)remoteUid; + (void)state; + (void)reason; + (void)elapsed; + } + + /** + * Occurs when an active speaker is detected. + * + * After a successful call of `enableAudioVolumeIndication`, the SDK continuously detects which remote user has the + * loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, + * is the most active user. + * + * When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker. + * - If the most active remote speaker is always the same user, the SDK triggers the `onActiveSpeaker` callback only once. + * - If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker. + * + * @param connection The RtcConnection object. + * @param uid The ID of the active speaker. A `uid` of 0 means the local user. + */ + virtual void onActiveSpeaker(const RtcConnection& connection, uid_t uid) { + (void)connection; + (void)uid; + } + + /** + * Occurs when the user role switches in the interactive live streaming. + * + * @param connection The RtcConnection of the local user: #RtcConnection + * @param oldRole The old role of the user: #CLIENT_ROLE_TYPE + * @param newRole The new role of the user: #CLIENT_ROLE_TYPE + * @param newRoleOptions The client role options of the new role: #ClientRoleOptions. + */ + virtual void onClientRoleChanged(const RtcConnection& connection, CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) { + (void)connection; + (void)oldRole; + (void)newRole; + (void)newRoleOptions; + } + + /** + * Occurs when the user role in a Live-Broadcast channel fails to switch, for example, from a broadcaster + * to an audience or vice versa. + * + * @param connection The RtcConnection object. + * @param reason The reason for failing to change the client role: #CLIENT_ROLE_CHANGE_FAILED_REASON. + * @param currentRole The current role of the user: #CLIENT_ROLE_TYPE. + */ + virtual void onClientRoleChangeFailed(const RtcConnection& connection, CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) { + (void)connection; + (void)reason; + (void)currentRole; + } + + /** Reports the transport-layer statistics of each remote audio stream. + * @deprecated Use `onRemoteAudioStats` instead. + + This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every + two seconds after the local user receives an audio packet from a remote user. During a call, when the user receives + the audio packet sent by the remote user/host, the callback is triggered every 2 seconds. + + @param connection The RtcConnection object. + @param remoteUid ID of the remote user whose audio data packet is received. + @param delay The network time delay (ms) from the sender to the receiver. + @param lost The Packet loss rate (%) of the audio packet sent from the remote + user. + @param rxKBitRate Received bitrate (Kbps) of the audio packet sent from the + remote user. + */ + virtual void onRemoteAudioTransportStats(const RtcConnection& connection, uid_t remoteUid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) { + (void)connection; + (void)remoteUid; + (void)delay; + (void)lost; + (void)rxKBitRate; + } + + /** Reports the transport-layer statistics of each remote video stream. + * @deprecated Use `onRemoteVideoStats` instead. + + This callback reports the transport-layer statistics, such as the packet loss rate and network time + delay, once every two seconds after the local user receives a video packet from a remote user. + + During a call, when the user receives the video packet sent by the remote user/host, the callback is + triggered every 2 seconds. + + @param connection The RtcConnection object. + @param remoteUid ID of the remote user whose video packet is received. + @param delay The network time delay (ms) from the remote user sending the + video packet to the local user. + @param lost The packet loss rate (%) of the video packet sent from the remote + user. + @param rxKBitRate The bitrate (Kbps) of the video packet sent from + the remote user. + */ + virtual void onRemoteVideoTransportStats(const RtcConnection& connection, uid_t remoteUid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) { + (void)connection; + (void)remoteUid; + (void)delay; + (void)lost; + (void)rxKBitRate; + } + + /** Occurs when the network connection state changes. + * + * When the network connection state changes, the SDK triggers this callback and reports the current + * connection state and the reason for the change. + * + * @param connection The RtcConnection object. + * @param state The current connection state. See #CONNECTION_STATE_TYPE. + * @param reason The reason for a connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnectionStateChanged(const RtcConnection& connection, + CONNECTION_STATE_TYPE state, + CONNECTION_CHANGED_REASON_TYPE reason) { + (void)connection; + (void)state; + (void)reason; + } + + /** Occurs when the WIFI message need be sent to the user. + * + * @param connection The RtcConnection object. + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ + virtual void onWlAccMessage(const RtcConnection& connection, WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) { + (void)connection; + (void)reason; + (void)action; + (void)wlAccMsg; + } + + /** Occurs when SDK statistics wifi acceleration optimization effect. + * + * @param connection The RtcConnection object. + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ + virtual void onWlAccStats(const RtcConnection& connection, WlAccStats currentStats, WlAccStats averageStats) { + (void)connection; + (void)currentStats; + (void)averageStats; + } + + /** Occurs when the local network type changes. + * + * This callback occurs when the connection state of the local user changes. You can get the + * connection state and reason for the state change in this callback. When the network connection + * is interrupted, this callback indicates whether the interruption is caused by a network type + * change or poor network conditions. + * @param connection The RtcConnection object. + * @param type The type of the local network connection. See #NETWORK_TYPE. + */ + virtual void onNetworkTypeChanged(const RtcConnection& connection, NETWORK_TYPE type) { + (void)connection; + (void)type; + } + + /** Reports the built-in encryption errors. + * + * When encryption is enabled by calling `enableEncryption`, the SDK triggers this callback if an + * error occurs in encryption or decryption on the sender or the receiver side. + * @param connection The RtcConnection object. + * @param errorType The error type. See #ENCRYPTION_ERROR_TYPE. + */ + virtual void onEncryptionError(const RtcConnection& connection, ENCRYPTION_ERROR_TYPE errorType) { + (void)connection; + (void)errorType; + } + /** + * Reports the user log upload result + * @param connection The RtcConnection object. + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ + virtual void onUploadLogResult(const RtcConnection& connection, const char* requestId, bool success, UPLOAD_ERROR_REASON reason) { + (void)connection; + (void)requestId; + (void)success; + (void)reason; + } + /** + * Occurs when the user account is updated. + * + * @param connection The RtcConnection object. + * @param remoteUid The user ID. + * @param userAccount The user account. + */ + virtual void onUserAccountUpdated(const RtcConnection& connection, uid_t remoteUid, const char* userAccount){ + (void)connection; + (void)remoteUid; + (void)userAccount; + } + + /** Reports the result of taking a video snapshot. + * + * After a successful `takeSnapshot` method call, the SDK triggers this callback to report whether the snapshot is + * successfully taken, as well as the details for that snapshot. + * @param connection The RtcConnection object. + * @param uid The user ID. A `uid` of 0 indicates the local user. + * @param filePath The local path of the snapshot. + * @param width The width (px) of the snapshot. + * @param height The height (px) of the snapshot. + * @param errCode The message that confirms success or gives the reason why the snapshot is not successfully taken: + * - 0: Success. + * - < 0: Failure. + * - -1: The SDK fails to write data to a file or encode a JPEG image. + * - -2: The SDK does not find the video stream of the specified user within one second after the `takeSnapshot` method call succeeds. + * - -3: Calling the `takeSnapshot` method too frequently. Call the `takeSnapshot` method after receiving the `onSnapshotTaken` + * callback from the previous call. + */ + virtual void onSnapshotTaken(const RtcConnection& connection, uid_t uid, const char* filePath, int width, int height, int errCode) { + (void)uid; + (void)filePath; + (void)width; + (void)height; + (void)errCode; + } + + /** + * Reports the tracing result of video rendering event of the user. + * + * @param connection The RtcConnection object. + * @param uid The user ID. + * @param currentEvent The current event of the tracing result: #MEDIA_TRACE_EVENT. + * @param tracingInfo The tracing result: #VideoRenderingTracingInfo. + */ + virtual void onVideoRenderingTracingResult(const RtcConnection& connection, uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) { + (void)uid; + (void)currentEvent; + (void)tracingInfo; + } + + /** + * @technical preview + */ + virtual void onAudioMetadataReceived(const RtcConnection& connection, uid_t uid, const char* metadata, size_t length) { + (void)metadata; + (void)length; + } + + virtual void onTranscodedStreamLayoutInfo(const RtcConnection& connection, uid_t uid, int width, int height, int layoutCount,const VideoLayout* layoutlist) { + (void)uid; + (void)width; + (void)height; + (void)layoutCount; + (void)layoutlist; + } +}; + +class IRtcEngineEx : public IRtcEngine { +public: + /** + * Joins a channel with media options. + * + * This method enables users to join a channel. Users in the same channel can talk to each other, + * and multiple users in the same channel can start a group chat. Users with different App IDs + * cannot call each other. + * + * A successful call of this method triggers the following callbacks: + * - The local client: The `onJoinChannelSuccess` and `onConnectionStateChanged` callbacks. + * - The remote client: `onUserJoined`, if the user joining the channel is in the Communication + * profile or is a host in the Live-broadcasting profile. + * + * When the connection between the client and Agora's server is interrupted due to poor network + * conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins + * the channel, the SDK triggers the `onRejoinChannelSuccess` callback on the local client. + * + * Compared to `joinChannel`, this method adds the options parameter to configure whether to + * automatically subscribe to all remote audio and video streams in the channel when the user + * joins the channel. By default, the user subscribes to the audio and video streams of all + * the other users in the channel, giving rise to usage and billings. To unsubscribe, set the + * `options` parameter or call the `mute` methods accordingly. + * + * @note + * - This method allows users to join only one channel at a time. + * - Ensure that the app ID you use to generate the token is the same app ID that you pass in the + * `initialize` method; otherwise, you may fail to join the channel by token. + * + * @param connection The RtcConnection object. + * @param token The token generated on your server for authentication. + * @param options The channel media options: ChannelMediaOptions. + * @param eventHandler The event handler: IRtcEngineEventHandler. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set + * to an integer, or the value of a member in the `ChannelMediaOptions` structure is invalid. You need + * to pass in a valid parameter and join the channel again. + * - -3: Failes to initialize the `IRtcEngine` object. You need to reinitialize the IRtcEngine object. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -8: The internal state of the IRtcEngine object is wrong. The typical cause is that you call + * this method to join the channel without calling `stopEchoTest` to stop the test after calling + * `startEchoTest` to start a call loop test. You need to call `stopEchoTest` before calling this method. + * - -17: The request to join the channel is rejected. The typical cause is that the user is in the + * channel. Agora recommends using the `onConnectionStateChanged` callback to get whether the user is + * in the channel. Do not call this method to join the channel unless you receive the + * `CONNECTION_STATE_DISCONNECTED(1)` state. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * rejoin the channel. + * - -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel. + */ + virtual int joinChannelEx(const char* token, const RtcConnection& connection, + const ChannelMediaOptions& options, + IRtcEngineEventHandler* eventHandler) = 0; + + /** + * Leaves the channel. + * + * This method allows a user to leave the channel, for example, by hanging up or exiting a call. + * + * This method is an asynchronous call, which means that the result of this method returns even before + * the user has not actually left the channel. Once the user successfully leaves the channel, the + * SDK triggers the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel" callback. + * + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int leaveChannelEx(const RtcConnection& connection) = 0; + + /** + * Leaves the channel with the connection ID. + * + * @param connection connection. + * @param options The options for leaving the channel. See #LeaveChannelOptions. + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int leaveChannelEx(const RtcConnection& connection, const LeaveChannelOptions& options) = 0; + + /** + * Updates the channel media options after joining the channel. + * + * @param options The channel media options: ChannelMediaOptions. + * @param connection The RtcConnection object. + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateChannelMediaOptionsEx(const ChannelMediaOptions& options, const RtcConnection& connection) = 0; + /** + * Sets the video encoder configuration. + * + * Each configuration profile corresponds to a set of video parameters, including + * the resolution, frame rate, and bitrate. + * + * The parameters specified in this method are the maximum values under ideal network conditions. + * If the video engine cannot render the video using the specified parameters due + * to poor network conditions, the parameters further down the list are considered + * until a successful configuration is found. + * + * @param config The local video encoder configuration: VideoEncoderConfiguration. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVideoEncoderConfigurationEx(const VideoEncoderConfiguration& config, const RtcConnection& connection) = 0; + /** + * Initializes the video view of a remote user. + * + * This method initializes the video view of a remote stream on the local device. It affects only the + * video view that the local user sees. + * + * Usually the app should specify the `uid` of the remote video in the method call before the + * remote user joins the channel. If the remote `uid` is unknown to the app, set it later when the + * app receives the \ref IRtcEngineEventHandler::onUserJoined "onUserJoined" callback. + * + * To unbind the remote user from the view, set `view` in VideoCanvas as `null`. + * + * @note + * Ensure that you call this method in the UI thread. + * + * @param canvas The remote video view settings: VideoCanvas. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setupRemoteVideoEx(const VideoCanvas& canvas, const RtcConnection& connection) = 0; + /** + * Stops or resumes receiving the audio stream of a specified user. + * + * @note + * You can call this method before or after joining a channel. If a user + * leaves a channel, the settings in this method become invalid. + * + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the audio stream of the specified user: + * - true: Stop receiving the audio stream of the specified user. + * - false: (Default) Resume receiving the audio stream of the specified user. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRemoteAudioStreamEx(uid_t uid, bool mute, const RtcConnection& connection) = 0; + /** + * Stops or resumes receiving the video stream of a specified user. + * + * @note + * You can call this method before or after joining a channel. If a user + * leaves a channel, the settings in this method become invalid. + * + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the video stream of the specified user: + * - true: Stop receiving the video stream of the specified user. + * - false: (Default) Resume receiving the video stream of the specified user. + * @param connection The RtcConnetion object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRemoteVideoStreamEx(uid_t uid, bool mute, const RtcConnection& connection) = 0; + /** + * Sets the remote video stream type. + * + * If the remote user has enabled the dual-stream mode, by default the SDK receives the high-stream video by + * Call this method to switch to the low-stream video. + * + * @note + * This method applies to scenarios where the remote user has enabled the dual-stream mode using + * \ref enableDualStreamMode "enableDualStreamMode"(true) before joining the channel. + * + * @param uid ID of the remote user sending the video stream. + * @param streamType Sets the video stream type: #VIDEO_STREAM_TYPE. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteVideoStreamTypeEx(uid_t uid, VIDEO_STREAM_TYPE streamType, const RtcConnection& connection) = 0; + /** + *Stops or resumes sending the local audio stream with connection. + * + *@param mute Determines whether to send or stop sending the local audio stream: + *- true: Stop sending the local audio stream. + *- false: Send the local audio stream. + * + *@param connection The connection of the user ID. + * + *@return + *- 0: Success. + *- < 0: Failure. + */ + virtual int muteLocalAudioStreamEx(bool mute, const RtcConnection& connection) = 0; + + /** + *Stops or resumes sending the local video stream with connection. + * + *@param mute Determines whether to send or stop sending the local video stream: + *- true: Stop sending the local video stream. + *- false: Send the local video stream. + * + *@param connection The connection of the user ID. + * + *@return + *- 0: Success. + *- < 0: Failure. + */ + virtual int muteLocalVideoStreamEx(bool mute, const RtcConnection& connection) = 0; + + /** + *Stops or resumes receiving all remote audio stream with connection. + * + *@param mute Whether to stop receiving remote audio streams: + *- true: Stop receiving any remote audio stream. + *- false: Resume receiving all remote audio streams. + * + *@param connection The connection of the user ID. + * + *@return + *- 0: Success. + *- < 0: Failure. + */ + virtual int muteAllRemoteAudioStreamsEx(bool mute, const RtcConnection& connection) = 0; + + /** + *Stops or resumes receiving all remote video stream with connection. + * + *@param mute Whether to stop receiving remote audio streams: + *- true: Stop receiving any remote audio stream. + *- false: Resume receiving all remote audio streams. + * + *@param connection The connection of the user ID. + * + *@return + *- 0: Success. + *- < 0: Failure. + */ + virtual int muteAllRemoteVideoStreamsEx(bool mute, const RtcConnection& connection) = 0; + + + /** + * Sets the blocklist of subscribe remote stream audio. + * + * @note + * If uid is in uidList, the remote user's audio will not be subscribed, + * even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated. + * + * @param uidList The id list of users who do not subscribe to audio. + * @param uidNumber The number of uid in uidList. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0; + + /** + * Sets the allowlist of subscribe remote stream audio. + * + * @note + * - If uid is in uidList, the remote user's audio will be subscribed, + * even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated. + * - If a user is in the blacklist and whitelist at the same time, the user will not subscribe to audio. + * + * @param uidList The id list of users who do subscribe to audio. + * @param uidNumber The number of uid in uidList. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0; + + /** + * Sets the blocklist of subscribe remote stream video. + * + * @note + * If uid is in uidList, the remote user's video will not be subscribed, + * even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated. + * + * @param uidList The id list of users who do not subscribe to video. + * @param uidNumber The number of uid in uidList. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0; + + /** + * Sets the allowlist of subscribe remote stream video. + * + * @note + * - If uid is in uidList, the remote user's video will be subscribed, + * even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated. + * - If a user is in the blacklist and whitelist at the same time, the user will not subscribe to video. + * + * @param uidList The id list of users who do subscribe to video. + * @param uidNumber The number of uid in uidList. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0; + /** + * Sets the remote video subscription options + * + * + * @param uid ID of the remote user sending the video stream. + * @param options Sets the video subscription options: VideoSubscriptionOptions. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteVideoSubscriptionOptionsEx(uid_t uid, const VideoSubscriptionOptions& options, const RtcConnection& connection) = 0; + /** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + + @note + - For this method to work, enable stereo panning for remote users by calling the \ref agora::rtc::IRtcEngine::enableSoundPositionIndication "enableSoundPositionIndication" method before joining a channel. + - This method requires hardware support. For the best sound positioning, we recommend using a wired headset. + - Ensure that you call this method after joining a channel. + + @param uid The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + - 0.0: the remote sound comes from the front. + - -1.0: the remote sound comes from the left. + - 1.0: the remote sound comes from the right. + @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. + @param connection The RtcConnection object. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteVoicePositionEx(uid_t uid, double pan, double gain, const RtcConnection& connection) = 0; + /** Sets remote user parameters for spatial audio + + @param uid The ID of the remote user. + @param param spatial audio parameters: SpatialAudioParams. + @param connection The RtcConnection object. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteUserSpatialAudioParamsEx(uid_t uid, const agora::SpatialAudioParams& params, const RtcConnection& connection) = 0; + /** + * Updates the display mode of the video view of a remote user. + * + * After initializing the video view of a remote user, you can call this method to update its + * rendering and mirror modes. This method affects only the video view that the local user sees. + * + * @note + * - Ensure that you have called \ref setupRemoteVideo "setupRemoteVideo" to initialize the remote video + * view before calling this method. + * - During a call, you can call this method as many times as necessary to update the display mode + * of the video view of a remote user. + * + * @param uid ID of the remote user. + * @param renderMode Sets the remote display mode. See #RENDER_MODE_TYPE. + * @param mirrorMode Sets the mirror type. See #VIDEO_MIRROR_MODE_TYPE. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteRenderModeEx(uid_t uid, media::base::RENDER_MODE_TYPE renderMode, + VIDEO_MIRROR_MODE_TYPE mirrorMode, const RtcConnection& connection) = 0; + /** Enables loopback recording. + * + * If you enable loopback recording, the output of the default sound card is mixed into + * the audio stream sent to the other end. + * + * @note This method is for Windows only. + * + * @param connection The RtcConnection object. + * @param enabled Sets whether to enable/disable loopback recording. + * - true: Enable loopback recording. + * - false: (Default) Disable loopback recording. + * @param deviceName Pointer to the device name of the sound card. The default value is NULL (the default sound card). + * - This method is for macOS and Windows only. + * - macOS does not support loopback capturing of the default sound card. If you need to use this method, + * please use a virtual sound card and pass its name to the deviceName parameter. Agora has tested and recommends using soundflower. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLoopbackRecordingEx(const RtcConnection& connection, bool enabled, const char* deviceName = NULL) = 0; + + /** + * Adjusts the recording volume. + * + * @param volume The recording volume, which ranges from 0 to 400: + * - 0 : Mute the recording volume. + * - 100: The original volume. + * - 400: (Maximum) Four times the original volume with signal clipping protection. + * + * @param connection The RtcConnection object. + * + * @return + * - 0 : Success. + * - < 0: Failure. + */ + virtual int adjustRecordingSignalVolumeEx(int volume, const RtcConnection& connection) = 0; + + /** + * Mute or resume recording signal volume. + * + * @param mute Determines whether to mute or resume the recording signal volume. + * - true: Mute the recording signal volume. + * - false: (Default) Resume the recording signal volume. + * + * @param connection The RtcConnection object. + * + * @return + * - 0 : Success. + * - < 0: Failure. + */ + virtual int muteRecordingSignalEx(bool mute, const RtcConnection& connection) = 0; + + /** + * Adjust the playback signal volume of a specified remote user. + * You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user. + * + * @note + * The playback volume here refers to the mixed volume of a specified remote user. + * This method can only adjust the playback volume of one specified remote user at a time. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. + * + * @param uid The ID of the remote user. + * @param volume The playback volume of the specified remote user. The value ranges between 0 and 400, including the following: + * + * - 0: Mute. + * - 100: (Default) Original volume. + * @param connection RtcConnection + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustUserPlaybackSignalVolumeEx(unsigned int uid, int volume, const RtcConnection& connection) = 0; + + /** Gets the current connection state of the SDK. + @param connection The RtcConnection object. + @return #CONNECTION_STATE_TYPE. + */ + virtual CONNECTION_STATE_TYPE getConnectionStateEx(const RtcConnection& connection) = 0; + /** Enables/Disables the built-in encryption. + * + * In scenarios requiring high security, Agora recommends calling this method to enable the built-in encryption before joining a channel. + * + * All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + * + * @note + * - If you enable the built-in encryption, you cannot use the RTMP streaming function. + * + * @param connection The RtcConnection object. + * @param enabled Whether to enable the built-in encryption: + * - true: Enable the built-in encryption. + * - false: Disable the built-in encryption. + * @param config Configurations of built-in encryption schemas. See EncryptionConfig. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT): An invalid parameter is used. Set the parameter with a valid value. + * - -4(ERR_NOT_SUPPORTED): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. + * - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int enableEncryptionEx(const RtcConnection& connection, bool enabled, const EncryptionConfig& config) = 0; + /** Creates a data stream. + * + * You can call this method to create a data stream and improve the + * reliability and ordering of data tranmission. + * + * @note + * - Ensure that you set the same value for `reliable` and `ordered`. + * - Each user can only create a maximum of 5 data streams during a RtcEngine + * lifecycle. + * - The data channel allows a data delay of up to 5 seconds. If the receiver + * does not receive the data stream within 5 seconds, the data channel reports + * an error. + * + * @param[out] streamId The ID of the stream data. + * @param reliable Sets whether the recipients are guaranteed to receive + * the data stream from the sender within five seconds: + * - true: The recipients receive the data stream from the sender within + * five seconds. If the recipient does not receive the data stream within + * five seconds, an error is reported to the application. + * - false: There is no guarantee that the recipients receive the data stream + * within five seconds and no error message is reported for any delay or + * missing data stream. + * @param ordered Sets whether the recipients receive the data stream + * in the sent order: + * - true: The recipients receive the data stream in the sent order. + * - false: The recipients do not receive the data stream in the sent order. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int createDataStreamEx(int* streamId, bool reliable, bool ordered, const RtcConnection& connection) = 0; + /** Creates a data stream. + * + * Each user can create up to five data streams during the lifecycle of the IChannel. + * @param streamId The ID of the created data stream. + * @param config The config of data stream. + * @param connection The RtcConnection object. + * @return int + * - Returns 0: Success. + * - < 0: Failure. + */ + virtual int createDataStreamEx(int* streamId, DataStreamConfig& config, const RtcConnection& connection) = 0; + /** Sends a data stream. + * + * After calling \ref IRtcEngine::createDataStream "createDataStream", you can call + * this method to send a data stream to all users in the channel. + * + * The SDK has the following restrictions on this method: + * - Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB. + * - Each client can send up to 30 KB of data per second. + * - Each user can have up to five data streams simultaneously. + * + * After the remote user receives the data stream within 5 seconds, the SDK triggers the + * \ref IRtcEngineEventHandler::onStreamMessage "onStreamMessage" callback on + * the remote client. After the remote user does not receive the data stream within 5 seconds, + * the SDK triggers the \ref IRtcEngineEventHandler::onStreamMessageError "onStreamMessageError" + * callback on the remote client. + * + * @note + * - Call this method after calling \ref IRtcEngine::createDataStream "createDataStream". + * - This method applies only to the `COMMUNICATION` profile or to + * the hosts in the `LIVE_BROADCASTING` profile. If an audience in the + * `LIVE_BROADCASTING` profile calls this method, the audience may be switched to a host. + * + * @param streamId The ID of the stream data. + * @param data The data stream. + * @param length The length (byte) of the data stream. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendStreamMessageEx(int streamId, const char* data, size_t length, const RtcConnection& connection) = 0; + /** Adds a watermark image to the local video. + + This method adds a PNG watermark image to the local video in a live broadcast. Once the watermark image is added, all the audience in the channel (CDN audience included), + and the recording device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one. + + The watermark position depends on the settings in the \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration" method: + - If the orientation mode of the encoding video is #ORIENTATION_MODE_FIXED_LANDSCAPE, or the landscape mode in #ORIENTATION_MODE_ADAPTIVE, the watermark uses the landscape orientation. + - If the orientation mode of the encoding video is #ORIENTATION_MODE_FIXED_PORTRAIT, or the portrait mode in #ORIENTATION_MODE_ADAPTIVE, the watermark uses the portrait orientation. + - When setting the watermark position, the region must be less than the dimensions set in the `setVideoEncoderConfiguration` method. Otherwise, the watermark image will be cropped. + + @note + - Ensure that you have called the \ref agora::rtc::IRtcEngine::enableVideo "enableVideo" method to enable the video module before calling this method. + - If you only want to add a watermark image to the local video for the audience in the CDN live broadcast channel to see and capture, you can call this method or the \ref agora::rtc::IRtcEngine::setLiveTranscoding "setLiveTranscoding" method. + - This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray. + - If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings. + - If you have enabled the local video preview by calling the \ref agora::rtc::IRtcEngine::startPreview "startPreview" method, you can use the `visibleInPreview` member in the WatermarkOptions class to set whether or not the watermark is visible in preview. + - If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. + + @param watermarkUrl The local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path. + @param options Pointer to the watermark's options to be added. See WatermarkOptions for more infomation. + @param connection The RtcConnection object. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int addVideoWatermarkEx(const char* watermarkUrl, const WatermarkOptions& options, const RtcConnection& connection) = 0; + /** Removes the watermark image on the video stream added by + addVideoWatermark(). + + @param connection The RtcConnection object. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int clearVideoWatermarkEx(const RtcConnection& connection) = 0; + /** Agora supports reporting and analyzing customized messages. + * + * This function is in the beta stage with a free trial. The ability provided + * in its beta test version is reporting a maximum of 10 message pieces within + * 6 seconds, with each message piece not exceeding 256 bytes. + * + * To try out this function, contact [support@agora.io](mailto:support@agora.io) + * and discuss the format of customized messages with us. + */ + virtual int sendCustomReportMessageEx(const char* id, const char* category, const char* event, const char* label, + int value, const RtcConnection& connection) = 0; + + /** + * Enables the `onAudioVolumeIndication` callback to report on which users are speaking + * and the speakers' volume. + * + * Once the \ref IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback is enabled, the SDK returns the volume indication in the at the time interval set + * in `enableAudioVolumeIndication`, regardless of whether any user is speaking in the channel. + * + * @param interval Sets the time interval between two consecutive volume indications: + * - <= 0: Disables the volume indication. + * - > 0: Time interval (ms) between two consecutive volume indications, + * and should be integral multiple of 200 (less than 200 will be set to 200). + * @param smooth The smoothing factor that sets the sensitivity of the audio volume + * indicator. The value range is [0, 10]. The greater the value, the more sensitive the + * indicator. The recommended value is 3. + * @param reportVad + * - `true`: Enable the voice activity detection of the local user. Once it is enabled, the `vad` parameter of the + * `onAudioVolumeIndication` callback reports the voice activity status of the local user. + * - `false`: (Default) Disable the voice activity detection of the local user. Once it is disabled, the `vad` parameter + * of the `onAudioVolumeIndication` callback does not report the voice activity status of the local user, except for + * the scenario where the engine automatically detects the voice activity of the local user. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudioVolumeIndicationEx(int interval, int smooth, bool reportVad, const RtcConnection& connection) = 0; + + /** Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.) + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param connection RtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRtmpStreamWithoutTranscodingEx(const char* url, const RtcConnection& connection) = 0; + + /** Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.) + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + * @param connection RtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRtmpStreamWithTranscodingEx(const char* url, const LiveTranscoding& transcoding, const RtcConnection& connection) = 0; + + /** Update the video layout and audio settings for CDN live. (CDN live only.) + * @note This method applies to Live Broadcast only. + * + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + * @param connection RtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateRtmpTranscodingEx(const LiveTranscoding& transcoding, const RtcConnection& connection) = 0; + + /** Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.) + * @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRtmpStreamEx(const char* url, const RtcConnection& connection) = 0; + + /** Starts to relay media streams across channels. + * + * @param configuration The configuration of the media stream relay:ChannelMediaRelayConfiguration. + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) = 0; + + /** Updates the channels for media stream relay + * @param configuration The media stream relay configuration: ChannelMediaRelayConfiguration. + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) = 0; + + /** Stops the media stream relay. + * + * Once the relay stops, the host quits all the destination + * channels. + * + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopChannelMediaRelayEx(const RtcConnection& connection) = 0; + + /** pause the channels for media stream relay. + * + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pauseAllChannelMediaRelayEx(const RtcConnection& connection) = 0; + + /** resume the channels for media stream relay. + * + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resumeAllChannelMediaRelayEx(const RtcConnection& connection) = 0; + + /** Gets the user information by passing in the user account. + * It is same as agora::rtc::IRtcEngine::getUserInfoByUserAccount. + * + * @param userAccount The user account of the user. Ensure that you set this parameter. + * @param [in,out] userInfo A userInfo object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUserAccountEx(const char* userAccount, rtc::UserInfo* userInfo, const RtcConnection& connection) = 0; + + /** Gets the user information by passing in the user ID. + * It is same as agora::rtc::IRtcEngine::getUserInfoByUid. + * + * @param uid The user ID of the remote user. Ensure that you set this parameter. + * @param[in,out] userInfo A userInfo object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUidEx(uid_t uid, rtc::UserInfo* userInfo, const RtcConnection& connection) = 0; + + /** + * Specify video stream parameters based on video profile + * @param [in] width + * width of video resolution in pixel + * @param [in] height + * height of video resolution in pixel + * @param [in] frameRate + * frame rate in fps + * @param [in] bitrate + * bit rate in kbps + * @return return 0 if success or an error code + */ + virtual int setVideoProfileEx(int width, int height, int frameRate, int bitrate) = 0; + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video + * stream) video using {@link setRemoteVideoStreamType setRemoteVideoStreamType}. + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @param streamConfig The minor stream config + * @param connection The RtcConnection object. + */ + virtual int enableDualStreamModeEx(bool enabled, const SimulcastStreamConfig& streamConfig, + const RtcConnection& connection) = 0; + /** + * Enables, disables or auto enable the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video + * stream) video using {@link setRemoteVideoStreamType setRemoteVideoStreamType}. + * + * @param mode The dual stream mode: #SIMULCAST_STREAM_MODE. + * @param streamConfig The configuration of the low stream: SimulcastStreamConfig. + * @param connection The RtcConnection object. + */ + virtual int setDualStreamModeEx(SIMULCAST_STREAM_MODE mode, + const SimulcastStreamConfig& streamConfig, + const RtcConnection& connection) = 0; + + /** + * Turns WIFI acceleration on or off. + * + * @note + * - This method is called before and after joining a channel. + * - Users check the WIFI router app for information about acceleration. Therefore, if this interface is invoked, the caller accepts that the caller's name will be displayed to the user in the WIFI router application on behalf of the caller. + * + * @param enabled + * - true:Turn WIFI acceleration on. + * - false:Turn WIFI acceleration off. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableWirelessAccelerate(bool enabled) = 0; + /** + * Takes a snapshot of a video stream. + * + * This method takes a snapshot of a video stream from the specified user, generates a JPG + * image, and saves it to the specified path. + * + * The method is asynchronous, and the SDK has not taken the snapshot when the method call + * returns. After a successful method call, the SDK triggers the `onSnapshotTaken` callback + * to report whether the snapshot is successfully taken, as well as the details for that + * snapshot. + * + * @note + * - Call this method after joining a channel. + * - This method takes a snapshot of the published video stream specified in `ChannelMediaOptions`. + * - If the user's video has been preprocessed, for example, watermarked or beautified, the resulting + * snapshot includes the pre-processing effect. + * @param connection The RtcConnection object. + * @param uid The user ID. Set uid as 0 if you want to take a snapshot of the local user's video. + * @param filePath The local path (including filename extensions) of the snapshot. For example: + * - Windows: `C:\Users\\AppData\Local\Agora\\example.jpg` + * - iOS: `/App Sandbox/Library/Caches/example.jpg` + * - macOS: `~/Library/Logs/example.jpg` + * - Android: `/storage/emulated/0/Android/data//files/example.jpg` + * + * Ensure that the path you specify exists and is writable. + * @return + * - 0 : Success. + * - < 0 : Failure. + */ + virtual int takeSnapshotEx(const RtcConnection& connection, uid_t uid, const char* filePath) = 0; + + /** Enables the content inspect. + @param enabled Whether to enable content inspect: + - `true`: Yes. + - `false`: No. + @param config The configuration for the content inspection. + @param connection The RtcConnection object. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableContentInspectEx(bool enabled, const media::ContentInspectConfig &config, const RtcConnection& connection) = 0; + + /** + @brief Start tracing media rendering events. + @since v4.1.1 + @discussion + - SDK will trace media rendering events when this API is called. + - The tracing result can be obtained through callback `IRtcEngineEventHandler(Ex)::onVideoRenderingTracingResult` + @param connection The RtcConnection object. + @note + - By default, SDK will trace media rendering events when `IRtcEngineEx::joinChannelEx` is called. + - The start point of event tracing will be reset after leaving channel. + @return + - 0: Success. + - < 0: Failure. + - -2(ERR_INVALID_ARGUMENT): The parameter is invalid. Check the channel ID and local uid set by parameter `connection`. + - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int startMediaRenderingTracingEx(const RtcConnection& connection) = 0; + + /** + * @technical preview + */ + virtual int sendAudioMetadataEx(const RtcConnection& connection, const char* metadata, size_t length) = 0; + /** + * Gets the current call ID. + * + * When a user joins a channel on a client, a `callId` is generated to identify + * the call. + * + * After a call ends, you can call `rate` or `complain` to gather feedback from the customer. + * These methods require a `callId` parameter. To use these feedback methods, call the this + * method first to retrieve the `callId` during the call, and then pass the value as an + * argument in the `rate` or `complain` method after the call ends. + * + * @param callId The reference to the call ID. + * @param connection The RtcConnection object. + * @return + * - The call ID if the method call is successful. + * - < 0: Failure. + */ + virtual int getCallIdEx(agora::util::AString& callId, const RtcConnection& connection) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtmService.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtmService.h new file mode 100644 index 0000000..70dbbf1 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtmService.h @@ -0,0 +1,715 @@ +// +// Agora Rtm SDK +// +// Created by junhao Wang in 2018-05. +// Copyright (c) 2018 Agora IO. All rights reserved. +// +#pragma once + +#include + +namespace agora { + +namespace rtm { + +enum PEER_MESSAGE_STATE { + PEER_MESSAGE_INIT = 0, + PEER_MESSAGE_FAILURE = 1, + PEER_MESSAGE_PEER_UNREACHABLE = 2, + PEER_MESSAGE_RECEIVED_BY_PEER = 3, + PEER_MESSAGE_SENT_TIMEOUT = 4, +}; +/** + * The login error code. + */ +enum LOGIN_ERR_CODE { + /** + * 0: Login succeeds. No error occurs. + */ + LOGIN_ERR_OK = 0, + /** + * 1: Login fails for reasons unknown. + */ + LOGIN_ERR_UNKNOWN = 1, + /** + * 2: The server rejects the login, either because the user has already logged in, or because + * the RTM service is not initialized. + */ + LOGIN_ERR_REJECTED = 2, // ALREADY LOGIN OR NOT INITIALIZED, SERVER REJECT + /** + * 3: Invalid login arguments. + */ + LOGIN_ERR_INVALID_ARGUMENT = 3, + /** + * 4: The App ID is invalid. + */ + LOGIN_ERR_INVALID_APP_ID = 4, + /** + * 5: The token is invalid. + */ + LOGIN_ERR_INVALID_TOKEN = 5, + /** + * 6: The login is rejected because the token has expired. + */ + LOGIN_ERR_TOKEN_EXPIRED = 6, + /** + * 7: Authentication of the RTMP token fails. + */ + LOGIN_ERR_NOT_AUTHORIZED = 7, + /** + * 8: The login times out. The current timeout is set as six seconds. + */ + LOGIN_ERR_TIMEOUT = 8, +}; +/** + * The logout error code. + */ +enum LOGOUT_ERR_CODE { + /** + * 0: Logout succeeds. No error occurs. + */ + LOGOUT_ERR_OK = 0, + /** + * 1: Logout fails. + */ + LOGOUT_ERR_REJECTED = 1, +}; +/** + * The connection state. + */ +enum CONNECTION_STATE { + /** + * 1: The SDK has logged in the RTM service. + */ + CONNECTION_STATE_CONNECTED = 1, + /** + * 2: The initial state. The SDK is disconnected from the RTM service. + */ + CONNECTION_STATE_DISCONNECTED = 2, + /** + * 3: The SDK gives up logging in the RTM service, mainly because another instance has logged in the RTM + * service with the same user ID. + * + * Call the logout() method before calling login to log in the RTM service again. + */ + CONNECTION_STATE_ABORTED = 3, +}; + +/** + * The state of the channel message. + */ +enum CHANNEL_MESSAGE_STATE { + /** + * 1: The channel message is received by the server. + */ + CHANNEL_MESSAGE_RECEIVED_BY_SERVER = 1, + /** + * 3: The SDK has not received a response from the server in five seconds. The current timeout is set as + * five seconds. + */ + CHANNEL_MESSAGE_SENT_TIMEOUT = 3, +}; +/** + * The join channel error. + */ +enum JOIN_CHANNEL_ERR { + /** + 0: The method call succeeds, or the user joins the channel successfully. + */ + JOIN_CHANNEL_ERR_OK = 0, + + /** + 1: Common failure. The user fails to join the channel. + */ + JOIN_CHANNEL_ERR_FAILURE = 1, + + /** + 2: **RESERVED FOR FUTURE USE** + */ + JOIN_CHANNEL_ERR_REJECTED = 2, // Usually occurs when the user is already in the channel + + /** + 3: The user fails to join the channel because the argument is invalid. + */ + JOIN_CHANNEL_ERR_INVALID_ARGUMENT = 3, + + /** + 4: A timeout occurs when joining the channel. The current timeout is set as five seconds. Possible reasons: The user is in the \ref agora::rtm::CONNECTION_STATE_ABORTED "CONNECTION_STATE_ABORTED" state. + */ + JOIN_CHANNEL_TIMEOUT = 4, + + /** + 5: The number of the RTM channels you are in exceeds the limit of 20. + */ + JOIN_CHANNEL_ERR_EXCEED_LIMIT = 5, + + /** + 6: The user is joining or has joined the channel. + */ + JOIN_CHANNEL_ERR_ALREADY_JOINED = 6, + + /** + 7: The method call frequency exceeds 50 queries every three seconds. + */ + JOIN_CHANNEL_ERR_TOO_OFTEN = 7, + + /** + 8: The frequency of joining the same channel exceeds two times every five seconds. + */ + JOIN_CHANNEL_ERR_JOIN_SAME_CHANNEL_TOO_OFTEN = 8, + + /** + 101: \ref agora::rtm::IRtmService "IRtmService" is not initialized. + */ + JOIN_CHANNEL_ERR_NOT_INITIALIZED = 101, + + /** + 102: The user does not call the \ref agora::rtm::IRtmService::login "login" method, or the method call of \ref agora::rtm::IRtmService::login "login" does not succeed before joining the channel. + */ + JOIN_CHANNEL_ERR_USER_NOT_LOGGED_IN = 102, +}; +/** + @brief Error codes related to leaving a channel. + */ +enum LEAVE_CHANNEL_ERR { + + /** + 0: The method call succeeds, or the user leaves the channel successfully. + */ + LEAVE_CHANNEL_ERR_OK = 0, + + /** + 1: Common failure. The user fails to leave the channel. + */ + LEAVE_CHANNEL_ERR_FAILURE = 1, + + /** + 2: **RESERVED FOR FUTURE USE** + */ + LEAVE_CHANNEL_ERR_REJECTED = 2, + + /** + 3: The user is not in the channel. + */ + LEAVE_CHANNEL_ERR_NOT_IN_CHANNEL = 3, + + /** + 101: \ref agora::rtm::IRtmService "IRtmService" is not initialized. + */ + LEAVE_CHANNEL_ERR_NOT_INITIALIZED = 101, + + /** + 102: The user does not call the \ref agora::rtm::IRtmService::login "login" method, or the method call of \ref agora::rtm::IRtmService::login "login" does not succeed before calling the \ref agora::rtm::IChannel::leave "leave" method. + */ + LEAVE_CHANNEL_ERR_USER_NOT_LOGGED_IN = 102, +}; + +/** + * The reason for a user to leave the channel. + */ +enum LEAVE_CHANNEL_REASON { + /** + * 1: The user quits the channel. + */ + LEAVE_CHANNEL_REASON_QUIT = 1, + /** + * 2: The user is kicked off the channel. + */ + LEAVE_CHANNEL_REASON_KICKED = 2, +}; +/** + @brief Error codes related to sending a channel message. + */ +enum CHANNEL_MESSAGE_ERR_CODE { + + /** + 0: The method call succeeds, or the server receives the channel message. + */ + CHANNEL_MESSAGE_ERR_OK = 0, + + /** + 1: Common failure. The user fails to send the channel message. + */ + CHANNEL_MESSAGE_ERR_FAILURE = 1, + + /** + 2: The SDK does not receive a response from the server in 10 seconds. The current timeout is set as 10 seconds. Possible reasons: The user is in the \ref agora::rtm::CONNECTION_STATE_ABORTED "CONNECTION_STATE_ABORTED" state. + */ + CHANNEL_MESSAGE_ERR_SENT_TIMEOUT = 2, + + /** + 3: The method call frequency exceeds the limit of (RTM SDK for Windows C++) 180 calls every three seconds or (RTM SDK for Linux C++) 1500 calls every three seconds, with channel and peer messages taken together.. + */ + CHANNEL_MESSAGE_ERR_TOO_OFTEN = 3, + + /** + 4: The message is null or exceeds 32 KB in length. + */ + CHANNEL_MESSAGE_ERR_INVALID_MESSAGE = 4, + + /** + 101: \ref agora::rtm::IRtmService "IRtmService" is not initialized. + */ + CHANNEL_MESSAGE_ERR_NOT_INITIALIZED = 101, + + /** + 102: The user does not call the \ref agora::rtm::IRtmService::login "login" method, or the method call of \ref agora::rtm::IRtmService::login "login" does not succeed before sending out a channel message. + */ + CHANNEL_MESSAGE_ERR_USER_NOT_LOGGED_IN = 102, +}; + +/** + * The response code. + */ +enum RESPONSE_CODE { + /** + * 1: The response + */ + RESPONSE_CODE_SUCCESS = 1, + RESPONSE_CODE_FAILURE = 2, +}; +/** + * The message type. + */ +enum MESSAGE_TYPE { + /** + * 0: The message type is undefined. + */ + MESSAGE_TYPE_UNDEFINED = 0, + /** + * 1: A text message. + */ + MESSAGE_TYPE_TEXT = 1, + /** + * 2: A raw message in binary, for example, audio data, or video data. + */ + MESSAGE_TYPE_BINARY = 2, + /** + * 4: A converge message. + */ + MESSAGE_TYPE_CONVERGE = 4, +}; +/** + * The IMessage class. + */ +class IMessage { + public: + /** + * Creates an IMessage instance. + * + * The created IMessage instance can be either for a channel message or for a peer-to-peer message. + * + * You can set the content of the text message later using the setText() method. + * @return + * - An empty text IMessage instance, if the method call succeeds. + */ + static IMessage *createMessage(); + virtual ~IMessage() {} + /** + * Gets the ID of the message. + * @return The ID of the current IMessage instance. + */ + virtual int64_t getMessageId() const = 0; + /** + * Gets the message type. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMessageType() const = 0; + /** + * Sets the content of the text message, or the text description of the raw message. + * @param str The content of the text message, or the text description of the raw message. The maximum length + * is 32 KB. + */ + virtual void setText(const char *str) = 0; + /** + * Gets the content of the text messsage, or the text description of the raw message. + * @return + * - The content of the text message or the text description of the raw message. + */ + virtual const char *getText() const = 0; + /** + * Get pointer of custom raw message + * @return + * - The content of binary raw message + */ + virtual const unsigned char *getRawMessageData() const = 0; + /** + * Get length of custom raw message + * @return + * - The length of binary raw message in bytes + */ + virtual int getRawMessageLength() const = 0; + /** + * Set message type + */ + virtual void setMessageType(int32_t type) = 0; + /** + * Set raw binary message + */ + virtual void setRawMessage(const uint8_t* data, int length) = 0; + /** + * Releases the IMessage instance. + */ + virtual void release() = 0; +}; + +/** + * The IChannelMember class. + */ +class IChannelMember { + public: + virtual ~IChannelMember() {} + /** + * Gets the ID of the channel member. + * @return The ID of the channel member. + */ + virtual const char *getMemberId() const = 0; + /** + * Gets the ID of the channel. + * @return The ID of the channel. + */ + virtual const char *getChannelId() const = 0; + /** + * Releases the IChannelMember class. + */ + virtual void release() = 0; +}; +/** + * The IChannelAttributes class. + */ +class IChannelAttributes { + public: + /** + * Creates an IChannelAttributes instance. + * @return + * - An IChannelAttributes instance, if the method call succeeds. + */ + static IChannelAttributes *createChannelAttributes(); + /** + * Adds an attribute to a specified channel. + * + * @param key The pointer to the attribute key. + * @param value The pointer to the attribute value. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int addAttribute(const char *key, const char *value) = 0; + /** + * Removes an attribute from the channel. + * @param key The pointer to the attribute key. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeAttribute(const char *key) = 0; + /** + * Gets the size of the attributes. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getAttributesSize() const = 0; + /** + * Gets the channel attributes. + * @param size The size of the channel attributes. + * @param key The pointer to the key of each channel attribute. + * @param value The pointer to the value of each channel attribute. + */ + virtual void getAttributes(int size, char **key, + char **value) const = 0; // todo: discussion, how to traveral + /** + * Gets the value of a channel attribute using the attribute key. + * @param key The pointer to the key of the channel attribute that you want to get. + */ + virtual const char *getAttributeValue(const char *key) const = 0; + /** + * Releases the IChannelAttributes instance. + * @param + * - 0: Success. + * - < 0: Failure. + */ + virtual int release() = 0; +}; +/** + * The IChannelEventHandler class. + */ +class IChannelEventHandler { + public: + virtual ~IChannelEventHandler() {} + /** + * Occurs when the local user successfully joins a channel. + */ + virtual void onJoinSuccess() {} + /** + * Occurs when the local user fails to join a channel. + * @param errorCode The error code: #JOIN_CHANNEL_ERR. + */ + virtual void onJoinFailure(JOIN_CHANNEL_ERR errorCode) {} + /** + * Occurs when the local user leaves a channel. + * @param errorCode The error code. See #LEAVE_CHANNEL_ERR. + */ + virtual void onLeave(LEAVE_CHANNEL_ERR errorCode) {} + /** + * Occurs when the local user receives a channel message. + * @param message The pointer to the messsage: IMessage. + */ + virtual void onMessageReceived(const char *userId, const IMessage *message) {} + /** + * Reports the state of the message sent by the local user. + * @param messageId ID of the message. + * @param state The state of the message: #CHANNEL_MESSAGE_STATE. + */ + virtual void onSendMessageState(int64_t messageId, CHANNEL_MESSAGE_STATE state) {} + /** + Returns the result of the \ref agora::rtm::IChannel::sendMessage "sendMessage" method call. + + @param messageId The ID of the sent channel message. + @param state The error codes. See #CHANNEL_MESSAGE_ERR_CODE. + */ + virtual void onSendMessageResult(long long messageId, CHANNEL_MESSAGE_ERR_CODE state) {} + /** + * Occurs when another member joins the channel. + * @param member The pointer to the member who joins the channel: IChannelMember. + */ + virtual void onMemberJoined(IChannelMember *member) {} + /** + * Occurs when the other member leaves the channel. + * @param member The pointer to the member who leaves the channel: IChannelMember. + */ + virtual void onMemberLeft(IChannelMember *member) {} + /** + * Reports all the members in the channel. + * @param members The pointer to each member in the channel: IChannelMember. + * @param userCount The number of users in the channel. + */ + virtual void onMembersGotten(IChannelMember **members, int userCount) {} + /** + * Occurs when the channel attributes are updated. + * @param attributes The pointer to the current channel attributes: IChannelAttributes. + */ + virtual void onAttributesUpdated(const IChannelAttributes *attributes) {} + /** + * Occurs when the local user calls updateAttributes(). + * @param requestId ID of the current attribute update request. + * @param resCode The response code: #RESPONSE_CODE. + */ + virtual void onUpdateAttributesResponse(int64_t requestId, RESPONSE_CODE resCode) {} + /** + * Occurs when the channel attributes are deleted. + * @param attributes The pointer to the channel attributes that you want to remove: IChannelAttributes. + */ + virtual void onAttributesDeleted(const IChannelAttributes *attributes) {} + /** + * Occurs when the local user calls deleteAttributes(). + * @param requestId ID of the current attribute delete request. + * @param resCode The response code: #RESPONSE_CODE. + */ + virtual void onDeleteAttributesResponse(int64_t requestId, RESPONSE_CODE resCode) {} +}; +/** + * The IChannel class. + */ +class IChannel { + public: + /** + * Sets an event handler for IChannel. + * @param eventHandler The pointer to the event handler of IChannel: IChannelEventHandler. + */ + virtual void setEventHandler(IChannelEventHandler *eventHandler) = 0; + /** + * Joins the current channel. + * + * A successful method call triggers either onJoinSuccess() or onJoinFailure() on the local client, to report + * the state of joining the channel. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int join() = 0; + /** + * Leaves the current channel. + * + * After the local user successfully leaves the channel, the SDK triggers the onLeave() on the local client. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int leave() = 0; + /** + * Sends a channel message. + * + * After you successfully send a channel message, all members in the channel receive the message in the + * onMessageReceived() callback. + * @param message The pointer to the channel message that you want to send: IMessage. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendMessage(const IMessage *message) = 0; + /** + * Updates the channel attributes. + * + * A successful method call triggers the onUpdateAttributesResponse() callback on the local client. + * @param attributes The pointer to the channel attributes that you want to update: IChannelAttributes. + * @param requestId ID of the current update request. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateAttributes(IChannelAttributes *attributes, int64_t &requestId) = 0; + /** + * Removes the channel attributes. + * + * A successful method call triggers the onDeleteAttributesResponse() callback on the local client. + * @param attributes The pointer to the channel attributes that you want to remove: IChannelAttributes. + * @param requestId ID of the current delete request. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int deleteAttributes(IChannelAttributes *attributes, int64_t &requestId) = 0; + /** + * Gets the current request ID. + * @return + * - The pointer to the request ID, if the method call succeeds. + * - An empty pointer NULL, if the method call fails. + */ + virtual const char *getId() const = 0; + + // sync_call + /** + * Releases the IChannel instance. + * + * This is a synchronous method call, which means that the SDK reports the result of this method call + * after the IChannel instance is successfully released. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int release() = 0; +}; +/** + * The IRtmServiceEventHandler class. + */ +class IRtmServiceEventHandler { + public: + virtual ~IRtmServiceEventHandler() {} + + /** + * Occurs when the user successfully logs in the RTM service. + */ + virtual void onLoginSuccess() {} + /** + * Occurs when the user fails to log in the RTM service. + * @param errorCode The reason for the login failure: #LOGIN_ERR_CODE. + */ + virtual void onLoginFailure(LOGIN_ERR_CODE errorCode) {} + /** + * Occurs when the user successfully logs out of the RTM service. + */ + virtual void onLogout() {} + /** + * Occurs when the connection state of the local user has changed. + * @param state The current connection state: #CONNECTION_STATE. + */ + virtual void onConnectionStateChanged(CONNECTION_STATE state) {} + /** + * Reports the state of sending a message. + * @param messageId ID of the message. + * @param state The current state of the message: #PEER_MESSAGE_STATE. + */ + virtual void onSendMessageState(int64_t messageId, PEER_MESSAGE_STATE state) {} + /** + * Occurs when the local user receives a message from a remote user. + * @param peerId ID of the remote user that sends the message. + * @param message The pointer to the message: IMessage. + */ + virtual void onMessageReceivedFromPeer(const char *peerId, const IMessage *message) {} +}; +/** + * The IRtmService class. + */ +class IRtmService { + public: + virtual ~IRtmService() {} + /** + * Creates and gets an IRtmService instance. + * @param appId The pointer to the app ID. + * @param eventHandler The pointer to the IRtmServiceEventHandler object. + * @param eventSpace The connection specific ID, used during report to argus. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initialize(const char *appId, IRtmServiceEventHandler *eventHandler) = 0; + /** + * Releases the IRtmServiceEventHandler object. + * @param eventHandler The pointer to the IRtmServiceEventHandler object. + */ + virtual void unregisterObserver(IRtmServiceEventHandler *eventHandler) = 0; + /** + * Releases the IRtmService instance. + * @param sync Determines whether to report the result of this method call synchronously. + * - true: Report the result of this method call after the IRtmService instance is released. + * - false: (Default) Report the result of this method call immediately, even when the IRtmService is not + * released. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int release(bool sync = false) = 0; + /** + * Logs in the RTM service. + * + * @note + * - If you login with the same user ID from a different instance, your previous login will be kicked. + * - The call frequency limit of this method is 2 queries per second. + * @param token The token used to log in the RTM service. + * @param userId ID of the user logging in the RTM service. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int login(const char *token, const char *userId) = 0; + /** + * Logs out of the RTM service. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int logout() = 0; + /** + * Sends a peer message to a specified remote user. + * + * @param peerId The pointer to the ID of the remote user. + * @param message The pointer to message: IMessage. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendMessageToPeer(const char *peerId, const IMessage *message) = 0; + /** + * Creates an RTM channel. + * + * @param channelId The unique channel name for an RTM session. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", + * ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", "," + * + * @param eventHandler The pointer to IChannelEventHandler. + * @return + * - The pointer to an IChannel instance, if the method call succeeds. + * - An empty pointer NULL, if the method call fails. + */ + virtual IChannel *createChannel(const char *channelId, IChannelEventHandler *eventHandler) = 0; +}; + +} // namespace rtm +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtmpStreamingService.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtmpStreamingService.h new file mode 100644 index 0000000..59736d4 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraRtmpStreamingService.h @@ -0,0 +1,192 @@ + +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" +#include "IAgoraService.h" +#include "NGIAgoraRtcConnection.h" + +namespace agora { +namespace rtc { + +/** + * The events in the RTMP channel. +*/ +enum RTMP_CHANNEL_EVENT +{ + /** + * 0: The live stream service is disconnected. + */ + RTMP_CHANNEL_EVENT_DISCONNECT = 0, + /** + * 1: The live stream service has left the channel. + */ + RTMP_CHANNEL_EVENT_LEAVE_CHANNEL = 1, + /** + * 2: The live stream service is banned by the server. + */ + RTMP_CHANNEL_EVENT_BANNED_BY_SERVER = 2 +}; +/** + * The IRtmpStreamingObserver class, which monitors events in of the live streaming service. + */ +class IRtmpStreamingObserver { +public: + /** + * Occurs when the state of the RTMP streaming changes. + * + * The SDK triggers this callback to report the result of the local user calling + * `addPublishStreamUrl` or `removePublishStreamUrl`. + * + * This callback also reports the streaming URL and its current streaming state. When exceptions + * occur, you can troubleshoot issues by referring to the detailed error description in the `errCode` + * parameter. + * + * @param url The RTMP URL address. + * @param state The RTMP streaming state: #RTMP_STREAM_PUBLISH_STATE. + * @param errCode The detailed error information for streaming: #RTMP_STREAM_PUBLISH_ERROR_TYPE. + */ + virtual void onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, + RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) { + (void)url; + (void)state; + (void)errCode; + } + + /** Reports events during the RTMP or RTMPS streaming. + * + * @since v3.1.0 + * + * @param url The RTMP or RTMPS streaming URL. + * @param eventCode The event code. See #RTMP_STREAMING_EVENT + */ + virtual void onRtmpStreamingEvent(const char* url, RTMP_STREAMING_EVENT eventCode) { + (void)url; + (void)eventCode; + } + /** + * Occurs when the publisher's transcoding settings are updated. + * + * When the `LiveTranscoding` class in the `setLiveTransocding` method updates, the SDK triggers this callback + * to report the update information. + * + * @note + * If you call the `setLiveTranscoding` method to set the `LiveTranscoding` class for the first time, the SDK + * does not trigger this callback. + */ + virtual void onTranscodingUpdated() {} +}; +/** + * The IRtmpStreamingService class, which enables the live stream service. + */ +class IRtmpStreamingService : public RefCountInterface { + public: + + /** Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.) + + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback. + + * The \ref agora::rtc::IRtcEngine::startRtmpStreamWithoutTranscoding "startRtmpStreamWithoutTranscoding" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN. + * @note + * - Ensure that the user joins the channel before calling this method. + * - This method adds only one stream RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ + virtual int startRtmpStreamWithoutTranscoding(const char* url) = 0; + + /** Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.) + + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback. + + * The \ref agora::rtc::IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN. + * @note + * - Ensure that the user joins the channel before calling this method. + * - This method adds only one stream RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ + virtual int startRtmpStreamWithTranscoding(const char* url, const LiveTranscoding& transcoding) = 0; + + /** Update the video layout and audio settings for CDN live. (CDN live only.) + * @note This method applies to Live Broadcast only. + + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateRtmpTranscoding(const LiveTranscoding& transcoding) = 0; + /** Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.) + + * This method removes the RTMP URL address (added by the \ref IRtcEngine::startRtmpStreamWithoutTranscoding "startRtmpStreamWithoutTranscoding" method + * or IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method) from a CDN live stream. + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamUnpublished "onStreamUnpublished" callback. + + * The \ref agora::rtc::IRtcEngine::stopRtmpStream "stopRtmpStream" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of removing an RTMP stream from the CDN. + * @note + * - This method removes only one RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRtmpStream(const char* url) = 0; + + /** + * Registers an RTMP streaming observer. + * @param observer The pointer to an RTMP streaming observer. See \ref agora::rtc::IRtmpStreamingObserver "IRtmpStreamingObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerObserver(IRtmpStreamingObserver* observer) = 0; + /** + * Releases the RTMP streaming observer created by registerObserver(). + * @param observer The pointer to the RTMP streaming observer that you want to release. See \ref agora::rtc::IRtmpStreamingObserver "IRtmpStreamingObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterObserver(IRtmpStreamingObserver* observer) = 0; + + protected: + ~IRtmpStreamingService() {} +}; + + + + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraService.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraService.h new file mode 100644 index 0000000..6873eaf --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraService.h @@ -0,0 +1,968 @@ +// Agora SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "IAgoraLog.h" +#include "AgoraBase.h" +#include "AgoraOptional.h" + +namespace agora { +namespace rtc { +class IRtcConnection; +class IRtmpConnection; +class ILocalUser; +class IMediaDeviceManager; +class INGAudioDeviceManager; +struct TConnectionInfo; +struct RtcConnectionConfiguration; +struct RtmpConnectionConfiguration; +class ILocalAudioTrack; +class IMediaPlayerSource; +class IMediaStreamingSource; +class ICameraCapturer; +class IScreenCapturer; +class IScreenCapturer2; +class IAudioPcmDataSender; +class IAudioEncodedFrameSender; +class IVideoFrameSender; +class IVideoEncodedImageSender; +class IVideoSourceNode; +class IVideoMixerSource; +class IVideoFrameTransceiver; +class ILocalVideoTrack; +class IMediaNodeFactory; +class IRecordingDeviceSource; +class IRemoteAudioMixerSource; +class IRtmpStreamingService; +class IMediaPacketSender; +class IMediaRelayService; +class IAudioDeviceManager; +class IAudioDeviceManagerObserver; + +class IMediaExtensionObserver; +class IExtensionProvider; +class IFileUploaderService; +/** + * The audio encoder configuration. + */ +struct AudioEncoderConfiguration { + /** + * The audio profile: #AUDIO_PROFILE_TYPE + */ + AUDIO_PROFILE_TYPE audioProfile; + + AudioEncoderConfiguration() : audioProfile(AUDIO_PROFILE_DEFAULT) {} +}; + +} // namespace rtc + +namespace rtm { +class IRtmService; +} + +namespace base { +class IServiceObserver; + +/** + * The global configurations for \ref agora::base::IAgoraService "AgoraService". + * + * Set these configurations when calling \ref agora::base::IAgoraService::initialize "initialize". + */ +struct AgoraServiceConfiguration { + /** + * Whether to enable the audio processing module. + * - `true`: (Default) Enable the audio processing module. + * - `false`: Disable the audio processing module. If you disable the audio processing module, you cannot create audio tracks. + */ + bool enableAudioProcessor; + /** + * Whether to enable the audio device module. The function of the audio device module is to manage audio devices, + * such as recording and playing audio. + * - `true`: (Default) Enable the audio device module. Audio recording and playback is available. + * - `false`: Disable the audio device module. Audio recording and playback is unavailable. + * + * @note + * If you set `enableAudioDevice` as `false` and set `enableAudioProcessor` as `true`, you cannot use audio devices, + * but you can push PCM audio data. + */ + bool enableAudioDevice; + /** + * Whether to enable video. + * - `true`: Enable video. + * - `false`: (Default) Disable video. + */ + bool enableVideo; + /** + * The user context. + * - For Windows, it is the handle of the window that loads the video. Specify this value to support plugging or unplugging the video devices while the host is powered on. + * - For Android, it is the context of activity. + */ + void* context; + /** + * The App ID of your project. + */ + const char* appId; + + /** + * The supported area code, default is AREA_CODE_GLOB + */ + unsigned int areaCode; + + /** The channel profile. For details, see \ref agora::CHANNEL_PROFILE_TYPE "CHANNEL_PROFILE_TYPE". The default channel profile is `CHANNEL_PROFILE_LIVE_BROADCASTING`. + */ + agora::CHANNEL_PROFILE_TYPE channelProfile; + + /** + * The license used for verification when connectting channel. Charge according to the license + */ + const char* license; + + /** + * The audio scenario. See \ref agora::rtc::AUDIO_SCENARIO_TYPE "AUDIO_SCENARIO_TYPE". The default value is `AUDIO_SCENARIO_DEFAULT`. + */ + rtc::AUDIO_SCENARIO_TYPE audioScenario; + /** + * The config for custumer set log path, log size and log level. + */ + commons::LogConfig logConfig; + /** + * Whether to enable string uid. + */ + bool useStringUid; + /** + * The service observer. + */ + IServiceObserver* serviceObserver; + + /** + * Thread priority for SDK common threads + */ + Optional threadPriority; + /** + * Whether use egl context in current thread as sdk‘s root egl context + * which shared by all egl related modules. eg. camera capture, video renderer. + * @note + * This property applies to Android only. + */ + bool useExternalEglContext; + + /** + * Determines whether to enable domain limit. + * - `true`: only connect to servers that already parsed by DNS + * - `false`: (Default) connect to servers with no limit + */ + bool domainLimit; + + AgoraServiceConfiguration() : enableAudioProcessor(true), + enableAudioDevice(true), + enableVideo(false), + context(NULL), + appId(NULL), + areaCode(rtc::AREA_CODE_GLOB), + channelProfile(agora::CHANNEL_PROFILE_LIVE_BROADCASTING), + license(NULL), + audioScenario(rtc::AUDIO_SCENARIO_DEFAULT), + useStringUid(false), + serviceObserver(NULL), + useExternalEglContext(false), + domainLimit(false){} +}; +/** + * The audio session configurations. + * + * Set these configurations when calling \ref agora::base::IAgoraService::setAudioSessionConfiguration "setAudioSessionConfiguration". + */ +struct AudioSessionConfiguration { + /** + * Whether to enable audio input (recording) and audio output (playback): + * - `true`: Enable audio recording and playback. + * - `false`: Disable audio recording and playback, which prevents audio input + * and output. + * + * @note + * - For the recording function to work, the user must grant permission for audio recording. + * - By default, the audio of your app is nonmixable, which means + * activating audio sessions in your app interrupts other nonmixable audio sessions. + * Set `allowMixWithOthers` as `true` to allow audio mixing. + */ + Optional playbackAndRecord; + /** + * Whether to enable chat mode: + * - `true`: Enable chat mode. This mode is for apps that are engaged in two-way + * real-time communication, such as a voice or video chat. + * - `false`: Disable chat mode. + * + * For a video chat, set this member as `true` and set the audio route to the speaker. + */ + Optional chatMode; + /** + * Whether the audio defaults to the built-in speaker: + * - `true`: The audio defaults to the built-in speaker. + * - `false`: The audio does not default to the built-in speaker. + * + * @note + * This member is available only when `playbackAndRecord` is set as `true`. + */ + Optional defaultToSpeaker; + /** + * Whether to temporarily change the current audio route to the built-in speaker: + * - `true`: Set the current audio route to the built-in speaker. + * - `false`: Do not set the current audio route to the built-in speaker. + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional overrideSpeaker; + /** + * Whether to mix the audio from this session with the audio from active audio sessions in other apps. + * - `true`: Mix the audio sessions. + * - `false`: Do not mix the audio session. + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional allowMixWithOthers; + /** + * Whether to duck the audio from this session with the audio from active audio sessions in other apps. + * - `true`: Duck the audio sessions. + * - `false`: Do not duck the audio session. + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional allowDuckOthers; + /** + * Whether to allow Bluetooth handsfree devices to appear as available audio input + * devices: + * - `true`: Allow Bluetooth handsfree devices to appear as available audio input routes. + * - `false`: Do not allow Bluetooth handsfree devices to appear as available audio input + * routes. + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional allowBluetooth; + /** + * Whether to allow the audio from this session to be routed to Bluetooth + * devices that support the Advanced Audio Distribution Profile (A2DP). + * - `true`: Allow the audio from this session to be routed to Bluetooth devices that + * support the Advanced Audio Distribution Profile (A2DP). + * - `false`: Do not allow the audio from this session to be routed to Bluetooth devices that + * support the Advanced Audio Distribution Profile (A2DP). + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional allowBluetoothA2DP; + /** + * The expected audio sample rate (kHz) of this session. + * + * The value range is [8,48]. The actual sample rate may differ based on the audio sampling + * device in use. + */ + Optional sampleRate; + /** + * The expected input and output buffer duration (ms) of this session. + * + * The value range is [0,93]. The actual I/O buffer duration might be lower + * than the set value based on the hardware in use. + */ + Optional ioBufferDuration; + /** + * The expected number of input audio channels of this session. + */ + Optional inputNumberOfChannels; + /** + * The expected number of output audio channels of this session. + */ + Optional outputNumberOfChannels; + /** + * Initialize the AudioSession with the value for category. (iOS only) + */ + Optional category; + + void SetAll(const AudioSessionConfiguration& change) { + SetFrom(&playbackAndRecord, change.playbackAndRecord); + SetFrom(&chatMode, change.chatMode); + SetFrom(&defaultToSpeaker, change.defaultToSpeaker); + SetFrom(&overrideSpeaker, change.overrideSpeaker); + SetFrom(&allowMixWithOthers, change.allowMixWithOthers); + SetFrom(&allowDuckOthers, change.allowDuckOthers); + SetFrom(&allowBluetooth, change.allowBluetooth); + SetFrom(&allowBluetoothA2DP, change.allowBluetoothA2DP); + SetFrom(&sampleRate, change.sampleRate); + SetFrom(&ioBufferDuration, change.ioBufferDuration); + SetFrom(&inputNumberOfChannels, change.inputNumberOfChannels); + SetFrom(&outputNumberOfChannels, change.outputNumberOfChannels); + SetFrom(&category, change.category); + } + + bool operator==(const AudioSessionConfiguration& o) const { + return playbackAndRecord == o.playbackAndRecord && chatMode == o.chatMode && + defaultToSpeaker == o.defaultToSpeaker && overrideSpeaker == o.overrideSpeaker && + allowMixWithOthers == o.allowMixWithOthers && allowDuckOthers == o.allowDuckOthers && + allowBluetooth == o.allowBluetooth && allowBluetoothA2DP == o.allowBluetoothA2DP && sampleRate == o.sampleRate && + ioBufferDuration == o.ioBufferDuration && + inputNumberOfChannels == o.inputNumberOfChannels && + outputNumberOfChannels == o.outputNumberOfChannels && + category == o.category; + } + bool operator!=(const AudioSessionConfiguration& o) const { return !(*this == o); } + + private: + template + static void SetFrom(Optional* s, const Optional& o) { + if (o) { + *s = o; + } + } +}; +/** + * The audio mixing mode. + */ +enum TMixMode { + /** + * Mix all the local audio tracks in the channel. + */ + MIX_ENABLED, + /** + * Do not mix the local audio tracks in the channel. + */ + MIX_DISABLED, +}; + +/** + * The IServiceObserver class. + */ +class IServiceObserver { +public: + virtual ~IServiceObserver() {} + + /** + * Reports the permission error. + * @param permission {@link PERMISSION} + */ + virtual void onPermissionError(agora::rtc::PERMISSION_TYPE permissionType) {} + /** + * Reports the audio device error. + * @param error {@link ERROR_CODE_TYPE} + */ + virtual void onAudioDeviceError(ERROR_CODE_TYPE error, const char* description) {} +}; + +/** + * The IAgoraService class. + * + * `IAgoraService` is the entry point of Agora low-level APIs. Use this interface to + * create access points to Agora interfaces, including RTC connections and media tracks. + * + * You can create an `IAgoraService` object by calling \ref agora::base::IAgoraService::createAgoraService "createAgoraService". + * + * You can configure the `IAgoraService` object for different user scenarios on the global level by using `AgoraServiceConfiguration`. + */ +class IAgoraService { + public: + /** + * Initializes the \ref agora::base::IAgoraService "AgoraService" object. + * + * @param config The configuration of the initialization. For details, see \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + * @return + * - 0: Success. + * - < 0: Failure. + * - `ERR_INVALID_ARGUMENT`, if `context` in `AgoraServiceConfiguration` is not provided for + * Android. + * - `ERR_INIT_NET_ENGINE`, if the network engine cannot be initialized. On Windows, the error occurs mostly because the connection to the local port is disabled by the firewall. In this case, turn off the firewall and then turn it on again. + */ + virtual int initialize(const AgoraServiceConfiguration& config) = 0; + + /** + * Flush log & cache before exit + */ + virtual void atExit() = 0; + + /** + * Releases the \ref agora::base::IAgoraService "AgoraService" object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int release() = 0; + + /** + * Configures the preset audio scenario. + * + * @param scenario The preset audio scenario: \ref agora::rtc::AUDIO_SCENARIO_TYPE + * "AUDIO_SCENARIO_TYPE". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioSessionPreset(agora::rtc::AUDIO_SCENARIO_TYPE scenario) = 0; + + /** + * Customizes the audio session configuration. + * + * @param config The reference to the audio session configuration: \ref agora::base::AudioSessionConfiguration "AudioSessionConfiguration". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioSessionConfiguration(const AudioSessionConfiguration& config) = 0; + + /** + * Gets the audio session configuration. + * + * @param [out] config The pointer to the audio session configuration: \ref agora::base::AudioSessionConfiguration "AudioSessionConfiguration". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getAudioSessionConfiguration(AudioSessionConfiguration* config) = 0; + + /** + * Sets the path and size of the SDK log files. + * + * The SDK records all the log data during the SDK runtime in two log files, + * each with a default size of 512 KB. If you set `fileSize` as 1024 KB, + * the SDK outputs log files with a maximum size of 2 MB. If the total size + * of the log files exceeds the set value, the new output log + * overwrites the old output log. + * + * @note + * To ensure that the output log is complete, call this method immediately after calling + * \ref agora::base::IAgoraService::initialize "initialize". + * + * @param filePath The pointer to the log file. Ensure that the directory of the log file exists and is writable. + * @param fileSize The size of the SDK log file size (KB). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFile(const char* filePath, unsigned int fileSize) = 0; + /** + * Sets the SDK log output filter. + * + * The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. + * + * Select a level to output the logs in and above the selected level. + * For example, if you set the log level to WARNING, you can see the logs in the levels of CRITICAL, ERROR, and WARNING. + * + * @param filters The log output filter. + * - `LOG_LEVEL_NONE (0x0000)`: Do not output any log file. + * - `LOG_LEVEL_INFO (0x0001)`: (Recommended) Output log files of the INFO level. + * - `LOG_LEVEL_WARN (0x0002)`: Output log files of the WARN level. + * - `LOG_LEVEL_ERROR (0x0004)`: Output log files of the ERROR level. + * - `LOG_LEVEL_FATAL (0x0008)`: Output log files of the FATAL level. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFilter(unsigned int filters) = 0; + + /** + * Creates an \ref agora::rtc::IRtcConnection "RtcConnection" object and returns the pointer. + * + * @param cfg The reference to the RTC connection configuration: \ref agora::rtc::RtcConnectionConfiguration "RtcConnectionConfiguration". + * @return + * - The pointer to \ref rtc::IRtcConnection "IRtcConnection": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createRtcConnection( + const rtc::RtcConnectionConfiguration& cfg) = 0; + + virtual agora_refptr createRtmpConnection( + const rtc::RtmpConnectionConfiguration& cfg) = 0; + + /** + * Creates a local audio track object and returns the pointer. + * + * By default, the audio track is created from the selected audio input device, such as + * the built-in microphone on a mobile device. + * + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createLocalAudioTrack() = 0; + + /** + * Creates a local mixed audio track object and returns the pointer. + * + * By default, the audio track is created from mix source, which could mixed target track. + * + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createLocalMixedAudioTrack() = 0; + + /** + * Creates a local audio track object with a PCM data sender and returns the pointer. + * + * Once created, this track can be used to send PCM audio data. + * + * @param audioSource The pointer to the PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr audioSource) = 0; + + /** + * Creates a local audio track object with a PCM data sender and returns the pointer. + * The source is not intended to be mixed with other source. + * + * Once created, this track can be used to send PCM audio data. + * + * @param audioSource The pointer to the PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createDirectCustomAudioTrack( + agora_refptr audioSource) = 0; + + /** + * Creates a local audio track object with a PCM data sender and returns the pointer. + * + * Once created, this track can be used to send PCM audio data. + * + * @param audioSource The pointer to the PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @param enableAec Whether enable audio echo cancellation for PCM audio data. + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr audioSource, bool enableAec) = 0; + + /** + * Creates a local audio track object with two PCM data sender and returns the pointer. + * + * Once created, this track can be used to send PCM audio data with echo cancellation. + * + * @param audioSource The pointer to the recording PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @param audioReverseSource The pointer to the playout PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @param audioSourceDelay The delay of recording pcm data when do echo cancellation. + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createCustomAudioTrack(agora_refptr audioSource, + agora_refptr audioReverseSource, + int audioSourceDelay) = 0; + + /** + * Creates a local audio track object with a audio mixer source and returns the pointer. + * + * Once created, this track can be used to send PCM audio data. + * + * @param audioSource The pointer to the audio mixer source : \ref agora::rtc::IRemoteAudioMixerSource "IRemoteAudioMixerSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack", if the method call succeeds. + * - A null pointer, if the method call fails. + * - `INVALID_STATE`, if `enableAudioProcessor` in `AgoraServiceConfiguration` is set as `false`. + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr audioSource) = 0; + + /** + * Creates a local audio track object with an encoded audio frame sender and returns the pointer. + * + * Once created, this track can be used to send encoded audio frames, such as Opus frames. + * + * @param audioSource The pointer to the encoded audio frame sender: \ref agora::rtc::IAudioEncodedFrameSender "IAudioEncoderFrameSender". + * @param mixMode The mixing mode of the encoded audio in the channel: #TMixMode. + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr audioSource, TMixMode mixMode) = 0; +/// @cond (!Linux) + /** + * Creates a local audio track object with a media packet sender and returns the pointer. + * + * Once created, this track can be used to send audio packets, such as customized UDP/RTP packets. + * + * @param source The pointer to the media packet sender: \ref agora::rtc::IMediaPacketSender "IMediaPacketSender". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr source) = 0; + /// @endcond + /** + * Creates a local audio track object with an IMediaPlayerSource object and returns the pointer. + * + * Once created, this track can be used to send PCM audio data decoded from a media player. + * + * @param audioSource The pointer to the player source. See \ref agora::rtc::IMediaPlayerSource "IMediaPlayerSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + */ + virtual agora_refptr createMediaPlayerAudioTrack( + agora_refptr audioSource) = 0; + + /** + * Creates a local audio track object with an IMediaStreamingSource object and returns the pointer. + * + * Once created, this track can be used to send encoded audio data which demuxed from a media streaming. + * + * @param streamingSource The pointer to the streaming source. See \ref agora::rtc::IMediaStreamingSource "IMediaStreamingSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + */ + virtual agora_refptr createMediaStreamingAudioTrack( + agora_refptr streamingSource) = 0; + + /** + * Creates a local audio track object with the recording device source and returns the pointer. + * + * Once created, this track can be used to send audio data got from a recording device. + * @param audioSource The pointer to the recording device source. See \ref agora::rtc::IRecordingDeviceSource "IRecordingDeviceSource". + * @param enableAec Whether enable audio echo cancellation for loopback recording. If loopback + * recording device is a virtual sound card, it should be false, or it should be true. + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createRecordingDeviceAudioTrack( + agora_refptr audioSource, bool enableAec) = 0; + + /** + * Creates an audio device manager object and returns the pointer. + * + * @return + * - The pointer to \ref rtc::INGAudioDeviceManager "INGAudioDeviceManager": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioDeviceManager() = 0; + + /** + * Creates a media node factory object and returns the pointer. + * + * @return + * - The pointer to \ref rtc::IMediaNodeFactory "IMediaNodeFactory": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaNodeFactory() = 0; + + /** + * Creates a local video track object with a camera capturer and returns the pointer. + * + * Once created, this track can be used to send video data captured by the camera. + * + * @param videoSource The pointer to the camera capturer: \ref agora::rtc::ICameraCapturer "ICameraCapturer". + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCameraVideoTrack( + agora_refptr videoSource, const char* id = OPTIONAL_NULLPTR) = 0; + + /** + * Creates a local video track object with a screen capturer and returns the pointer. + * + * Once created, this track can be used to send video data for screen sharing. + * + * @param videoSource The pointer to the screen capturer: \ref agora::rtc::IScreenCapturer "IScreenCapturer". + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenVideoTrack( + agora_refptr videoSource, const char* id = OPTIONAL_NULLPTR) = 0; + + /** + * Creates a local video track object with a video mixer and returns the pointer. + * + * Once created, this track can be used to send video data processed by the video mixer. + * + * @param videoSource The pointer to the video mixer. See \ref agora::rtc::IVideoMixerSource "IVideoMixerSource". + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createMixedVideoTrack(agora_refptr videoSource, + const char* id = OPTIONAL_NULLPTR) = 0; + + /** + * Creates a local video track object with a video frame transceiver and returns the pointer. + * + * Once created, this track can be used to send video data processed by the transceiver. + * + * @param transceiver The pointer to the video transceiver. See \ref agora::rtc::IVideoFrameTransceiver "IVideoFrameTransceiver". + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createTranscodedVideoTrack(agora_refptr transceiver, + const char* id = OPTIONAL_NULLPTR) = 0; + +/// @cond (!RTSA) + /** + * Creates a local video track object with a customized video source and returns the pointer. + * + * Once created, this track can be used to send video data from a customized source. + * + * @param videoSource The pointer to the customized video frame sender: \ref agora::rtc::IVideoFrameSender "IVideoFrameSender". + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCustomVideoTrack( + agora_refptr videoSource, const char* id = OPTIONAL_NULLPTR) = 0; +/// @endcond + + /** + * Creates a local video track object with an encoded video image sender and returns the pointer. + * + * Once created, this track can be used to send encoded video images, such as H.264 or VP8 frames. + * + * @param videoSource The pointer to the encoded video frame sender. See \ref agora::rtc::IVideoEncodedImageSender "IVideoEncodedImageSender". + * @param options The configuration for creating video encoded image track. + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCustomVideoTrack( + agora_refptr videoSource, + const rtc::SenderOptions& options, + const char* id = OPTIONAL_NULLPTR) = 0; + +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + /** + * Creates a local video track object with a screen capture source extension and returns the pointer. + * + * Once created, this track can be used to work with the screen capture extension. + * + * @param screen The pointer to the screen capture source. + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCaptureVideoTrack( + agora_refptr screen) = 0; + +/** + * Creates a local audio track object with a screen capture source extension and returns the pointer. + * + * Once created, this track can be used to work with the screen capture extension. + * + * @param screen The pointer to the screen capture source. + * + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCaptureAudioTrack( + agora_refptr screen) = 0; +#else + /** + * Creates a local video track object with a screen capture source extension and returns the pointer. + * + * Once created, this track can be used to work with the screen capture extension. + * + * @param screen The pointer to the screen capture source. + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCaptureVideoTrack( + agora_refptr screen, const char* id = OPTIONAL_NULLPTR) = 0; +#endif + +/// @cond (!Linux) + /** + * Creates a local video track object with a media packet sender and returns the pointer. + * + * Once created, this track can be used to send video packets, such as customized UDP/RTP packets. + * + * @param source The pointer to the media packet sender: \ref agora::rtc::IMediaPacketSender "IMediaPacketSender". + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCustomVideoTrack( + agora_refptr source, const char* id = OPTIONAL_NULLPTR) = 0; +/// @endcond + /** + * Creates a local video track object with an IMediaPlayerSource object and returns the pointer. + * + * Once created, this track can be used to send YUV frames decoded from a player. + * + * @param videoSource The pointer to the player source. See \ref agora::rtc::IMediaPlayerSource "IMediaPlayerSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaPlayerVideoTrack( + agora_refptr videoSource, const char* id = OPTIONAL_NULLPTR) = 0; + + /** + * Creates a local video track object with an IMediaStreamingSource object and returns the pointer. + * + * Once created, this track can be used to send H264 frames which demuxed from a streaming. + * + * @param streamingSource The pointer to the player source. See \ref agora::rtc::IMediaStreamingSource "IMediaStreamingSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaStreamingVideoTrack( + agora_refptr streamingSource, const char* id = OPTIONAL_NULLPTR) = 0; + + + /** + * Creates an RTMP streaming service object and returns the pointer. + * + * @param rtcConnection The pointer to \ref rtc::IRtcConnection "IRtcConnection". + * @param appId The App ID of the live streaming service. + * @return + * - The pointer to \ref rtc::IRtmpStreamingService "IRtmpStreamingService": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createRtmpStreamingService( + agora_refptr rtcConnection, const char* appId) = 0; + + /** + * Creates an Media Relay service object and returns the pointer. + * + * @param rtcConnection The pointer to \ref rtc::IRtcConnection "IRtcConnection". + * @param appId The App ID of the media relay service. + * @return + * - The pointer to \ref rtc::IMediaRelayService "IMediaRelayService", if the method call + * succeeds. + * - A null pointer, if the method call fails. + */ + virtual agora_refptr createMediaRelayService( + agora_refptr rtcConnection, const char* appId) = 0; + + /** + * Creates an file upload object and returns the pointer. + * + * @param rtcConnection The pointer to \ref rtc::IRtcConnection "IRtcConnection". + * @param appId The App ID of the media relay service. + * @return + * - The pointer to \ref rtc::IFileUploaderService "IFileUploaderService", if the method call + * succeeds. + * - A null pointer, if the method call fails. + */ + virtual agora_refptr createFileUploadService( + agora_refptr rtcConnection, const char* appId) = 0; + + /** + * Creates an RTM servive object and returns the pointer. + * + * @return + * - The pointer to \ref rtm::IRtmService "IRtmService": Success. + * - A null pointer: Failure. + */ + virtual rtm::IRtmService* createRtmService() = 0; + + virtual int addExtensionObserver(agora::agora_refptr observer) = 0; + + virtual int removeExtensionObserver(agora::agora_refptr observer) = 0; + + /** + * Creates an audio device manager and returns the pointer. + * + * @return + * - The pointer to \ref rtc::IAudioDeviceManager "IAudioDeviceManager": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioDeviceManagerComponent( + rtc::IAudioDeviceManagerObserver *observer) = 0; + /** + * @brief Get the ID of the registered extension + * + * @param provider_name The pointer to provider name string (null-terminated) + * @param extension_name The pointer to extension name string (null-terminated) + * @return + * - Pointer to the extension id string (null-terminated). The pointer will be valid during service's lifetime + */ + virtual const char* getExtensionId(const char* provider_name, const char* extension_name) = 0; + +#if defined (_WIN32) || defined(__linux__) || defined(__ANDROID__) + /** + * @brief load the dynamic library of the extension + * + * @param path path of the extension library + * @param unload_after_use unload the library when engine release + * @return int + */ + virtual int loadExtensionProvider(const char* path, bool unload_after_use = false) = 0; +#endif + /** + * Enable extension. + * If the extension is enabled, the track loads the extension automatically. + * + * @param provider_name name for provider, e.g. agora.io. + * @param extension_name name for extension, e.g. agora.beauty. + * @param track_id id for the track, OPTIONAL_NULLPTR means effective on all tracks + * @param auto_enable_on_track if the extension is automatically open on track. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableExtension( + const char* provider_name, const char* extension_name, const char* track_id = NULL, + bool auto_enable_on_track = false) = 0; + /** + * Disable extension. + * + * @param provider_name name for provider, e.g. agora.io. + * @param extension_name name for extension, e.g. agora.beauty. + * @param track_id id for the track, OPTIONAL_NULLPTR means effective on all tracks + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableExtension( + const char* provider_name, const char* extension_name, const char* track_id = NULL) = 0; + + protected: + virtual ~IAgoraService() {} +}; + +} // namespace base +} // namespace agora + +/** \addtogroup createAgoraService + @{ + */ +/** + * Creates an \ref agora::base::IAgoraService "IAgoraService" object and returns the pointer. + * + * @return + * - The pointer to \ref agora::base::IAgoraService "IAgoraService": Success. + * - A null pointer: Failure. + */ +AGORA_API agora::base::IAgoraService* AGORA_CALL createAgoraService(); +/** @} */ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraSpatialAudio.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraSpatialAudio.h new file mode 100644 index 0000000..51b3825 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAgoraSpatialAudio.h @@ -0,0 +1,314 @@ +// +// AgoraRtcEngine SDK +// +// Copyright (c) 2019 Agora.io. All rights reserved. +// + +#ifndef AGORA_SPATIAL_AUDIO_H +#define AGORA_SPATIAL_AUDIO_H + +#include +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraRefPtr.h" +#include "IAgoraRtcEngineEx.h" + +namespace agora { +namespace rtc { + +// The information of remote voice position +struct RemoteVoicePositionInfo { + // The coordnate of remote voice source, (x, y, z) + float position[3]; + // The forward vector of remote voice, (x, y, z). When it's not set, the vector is forward to listner. + float forward[3]; + RemoteVoicePositionInfo() = default; +}; + +struct SpatialAudioZone { + //the zone id + int zoneSetId; + //zone center point + float position[3]; + //forward direction + float forward[3]; + //right direction + float right[3]; + //up direction + float up[3]; + //the forward side length of the zone + float forwardLength; + //tehe right side length of the zone + float rightLength; + //the up side length of the zone + float upLength; + //the audio attenuation of zone + float audioAttenuation; + SpatialAudioZone() = default; +}; + +/** The definition of LocalSpatialAudioConfig + */ +struct LocalSpatialAudioConfig { + /*The reference to \ref IRtcEngine, which is the base interface class of the Agora RTC SDK and provides + * the real-time audio and video communication functionality. + */ + agora::rtc::IRtcEngine* rtcEngine; + + LocalSpatialAudioConfig() : rtcEngine(NULL) {} +}; + +/** The IBaseSpatialAudioEngine class provides the common methods of ICloudSpatialAudioEngine and ILocalSpatialAudioEngine. + */ +class IBaseSpatialAudioEngine: public RefCountInterface { + protected: + virtual ~IBaseSpatialAudioEngine() {} + + public: + /** + * Releases all the resources occupied by spatial audio engine. + */ + virtual void release() = 0; + /** + * This method sets the maximum number of streams that a player can receive in a + * specified audio reception range. + * + * @note You can call this method either before or after calling enterRoom: + * - Calling this method before enterRoom affects the maximum number of received streams + * the next time the player enters a room. + * - Calling this method after entering a room changes the current maximum number of + * received streams of the player. + * + * @param maxCount The maximum number of streams that a player can receive within + * a specified audio reception range. If the number of receivable streams exceeds + * the set value, the SDK receives the set number of streams closest to the player. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setMaxAudioRecvCount(int maxCount) = 0; + /** + * This method sets the audio reception range. The unit of the audio reception range + * is the same as the unit of distance in the game engine. + * + * @note You can call this method either before or after calling enterRoom. + * During the game, you can call it multiple times to update the audio reception range. + * + * @param range The maximum audio reception range, in the unit of game engine distance. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setAudioRecvRange(float range) = 0; + + /** + * This method sets distance unit of game engine. The smaller the unit is, the sound fades slower + * with distance. + * + * @note You can call this method either before or after calling enterRoom. + * During the game, you can call it multiple times to update the distance unit. + * + * @param unit The number of meters that the game engine distance per unit is equal to. For example, setting unit as 2 means the game engine distance per unit equals 2 meters. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setDistanceUnit(float unit) = 0; + /** + * Updates the position of local user. + * When calling it in ICloudSpatialAudioEngine, it triggers the SDK to update the user position to the Agora spatial audio server. The Agora spatial audio server uses the users' world coordinates and audio reception range to determine whether they are within each other's specified audio reception range. + * When calling it in ILocalSpatialAudioEngine, it triggers the SDK to calculate the relative position between the local and remote users and updates spatial audio parameters. + * + * when calling it in ICloudSpatialAudioEngine, you should notice: + * @note + * - Call the method after calling enterRoom. + * - The call frequency is determined by the app. Agora recommends calling this method every + * 120 to 7000 ms. Otherwise, the SDK may lose synchronization with the server. + * + * @param position The sound position of the user. The coordinate order is forward, right, and up. + * @param axisForward The vector in the direction of the forward axis in the coordinate system. + * @param axisRight The vector in the direction of the right axis in the coordinate system. + * @param axisUp The vector in the direction of the up axis in the coordinate system. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updateSelfPosition(float position[3], float axisForward[3], float axisRight[3], float axisUp[3]) = 0; + /** + * Updates the position of local user. This method is used in scene with multi RtcConnection. + * + * @note + * - This method is only effective in ILocalSpatialAudioEngine currently. + * + * @param position The sound position of the user. The coordinate order is forward, right, and up. + * @param axisForward The vector in the direction of the forward axis in the coordinate system. + * @param axisRight The vector in the direction of the right axis in the coordinate system. + * @param axisUp The vector in the direction of the up axis in the coordinate system. + * @param connection The RTC connection whose spatial audio effect you want to update. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updateSelfPositionEx(float position[3], float axisForward[3], float axisRight[3], float axisUp[3], const RtcConnection& connection) = 0; + + /** + * Updates the position of a media player in scene. This method has same behavior both in ICloudSpatialAudioEngine and ILocalSpatialAudioEngine. + * + * @note + * - This method is suggested to be called once if you don't move media player in the virtual space. + * + * @param playerId The ID of the media player. You can get it by IMediaPlayer::getMediaPlayerId. + * @param positionInfo The position information of media player in the virtual space. For details inforamtion, see the declaration of RemoteVoicePositionInfo. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updatePlayerPositionInfo(int playerId, const RemoteVoicePositionInfo& positionInfo) = 0; + + /** + * Set parameters for spatial audio engine. It's deprecated for using. + * + * @param params The parameter string. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setParameters(const char* params) = 0; + + /** + * Mute or unmute local audio stream. + * + * @param mute When it's false, it will send local audio stream, otherwise it will not send local audio stream. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int muteLocalAudioStream(bool mute) = 0; + /** + * Mute all remote audio streams. It determines wether SDK receves remote audio streams or not. + * + * @param mute When it's false, SDK will receive remote audio streams, otherwise SDK will not receive remote audio streams. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int muteAllRemoteAudioStreams(bool mute) = 0; + + + /** + * Setting up sound Space + * + * @param zones The Sound space array + * @param zoneCount the sound Space count of array + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setZones(const SpatialAudioZone *zones, unsigned int zoneCount) = 0; + /** + * Set the audio attenuation coefficient of the player + * @param playerId The ID of the media player. You can get it by IMediaPlayer::getMediaPlayerId. + * @param attenuation The audio attenuation of the media player. + * @param forceSet Whether to force the setting of audio attenuation coefficient. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setPlayerAttenuation(int playerId, double attenuation, bool forceSet) = 0; + /** + * Mute or unmute remote user audio stream. + * + * @param uid The ID of the remote user. + * @param mute When it's false, SDK will receive remote user audio streams, otherwise SDK will not receive remote user audio streams. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int muteRemoteAudioStream(uid_t uid, bool mute) = 0; +}; + +class ILocalSpatialAudioEngine : public IBaseSpatialAudioEngine { +protected: + virtual ~ILocalSpatialAudioEngine() {} + +public: + /** + * Initializes the ILocalSpatialAudioEngine object and allocates the internal resources. + * + * @note Ensure that you call IRtcEngine::queryInterface and initialize before calling any other ILocalSpatialAudioEngine APIs. + * + * @param config The pointer to the LocalSpatialAudioConfig. See #LocalSpatialAudioConfig. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int initialize(const LocalSpatialAudioConfig& config) = 0; + /** + * Updates the position information of remote user. You should call it when remote user whose role is broadcaster moves. + * + * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @param posInfo The position information of remote user. See #RemoteVoicePositionInfo. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updateRemotePosition(uid_t uid, const RemoteVoicePositionInfo &posInfo) = 0; + /** + * Updates the position of remote user. It's supposed to use with IRtcEngineEx::joinChannelEx. + * + * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @param posInfo The position information of remote user. See #RemoteVoicePositionInfo. + * @param connection The RTC connection whose spatial audio effect you want to update. See #RtcConnection. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updateRemotePositionEx(uid_t uid, const RemoteVoicePositionInfo &posInfo, const RtcConnection& connection) = 0; + /** + * Remove the position information of remote user. You should call it when remote user called IRtcEngine::leaveChannel. + * + * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int removeRemotePosition(uid_t uid) = 0; + /** + * Remove the position information of remote user. It's supposed to use with IRtcEngineEx::joinChannelEx. + * + * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @param connection The RTC connection whose spatial audio effect you want to update. See #RtcConnection. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int removeRemotePositionEx(uid_t uid, const RtcConnection& connection) = 0; + /** + * Clear the position informations of remote users. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int clearRemotePositions() = 0; + /** + * Clear the position informations of remote users. It's supposed to use with IRtcEngineEx::joinChannelEx. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int clearRemotePositionsEx(const RtcConnection& connection) = 0; + + + virtual int setRemoteAudioAttenuation(uid_t uid, double attenuation, bool forceSet) = 0; +}; + +} // namespace rtc +} // namespace agora + +#endif diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAudioDeviceManager.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAudioDeviceManager.h new file mode 100644 index 0000000..77667b8 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/IAudioDeviceManager.h @@ -0,0 +1,482 @@ +// +// Agora SDK +// +// Copyright (c) 2021 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +namespace agora { +namespace rtc { + +/** + * The maximum device ID length. + */ +enum MAX_DEVICE_ID_LENGTH_TYPE { + /** + * The maximum device ID length is 512. + */ + MAX_DEVICE_ID_LENGTH = 512 +}; + +/** + * The IAudioDeviceCollection class. + */ +class IAudioDeviceCollection { +public: + virtual ~IAudioDeviceCollection() {} + + /** + * Gets the total number of the playback or recording devices. + * + * Call \ref IAudioDeviceManager::enumeratePlaybackDevices + * "enumeratePlaybackDevices" first, and then call this method to return the + * number of the audio playback devices. + * + * @return + * - The number of the audio devices, if the method call succeeds. + * - < 0, if the method call fails. + */ + virtual int getCount() = 0; + + /** + * Gets the information of a specified audio device. + * @param index An input parameter that specifies the audio device. + * @param deviceName An output parameter that indicates the device name. + * @param deviceId An output parameter that indicates the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], + char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Specifies a device with the device ID. + * @param deviceId The device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the default audio device of the system (for macOS and Windows only). + * + * @param deviceName The name of the system default audio device. + * @param deviceId The device ID of the the system default audio device. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDefaultDevice(char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Sets the volume of the app. + * + * @param volume The volume of the app. The value range is [0, 255]. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setApplicationVolume(int volume) = 0; + + /** + * Gets the volume of the app. + * + * @param volume The volume of the app. The value range is [0, 255] + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getApplicationVolume(int &volume) = 0; + + /** Mutes or unmutes the app. + * + * @param mute Determines whether to mute the app: + * - true: Mute the app. + * - false: Unmute the app. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setApplicationMute(bool mute) = 0; + + /** + * Gets the mute state of the app. + * + * @param mute A reference to the mute state of the app: + * - true: The app is muted. + * - false: The app is not muted. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int isApplicationMute(bool &mute) = 0; + + /** + * Releases all IAudioDeviceCollection resources. + */ + virtual void release() = 0; +}; + +/** + * The IAudioDeviceManager class. + */ +class IAudioDeviceManager : public RefCountInterface { +public: + virtual ~IAudioDeviceManager() {} + + /** + * Enumerates the audio playback devices. + * + * This method returns an IAudioDeviceCollection object that includes all the + * audio playback devices in the system. With the IAudioDeviceCollection + * object, the app can enumerate the audio playback devices. The app must call + * the \ref IAudioDeviceCollection::release "IAudioDeviceCollection::release" + * method to release the returned object after using it. + * + * @return + * - A pointer to the IAudioDeviceCollection object that includes all the + * audio playback devices in the system, if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ + virtual IAudioDeviceCollection *enumeratePlaybackDevices() = 0; + + /** + * Enumerates the audio recording devices. + * + * This method returns an IAudioDeviceCollection object that includes all the + * audio recording devices in the system. With the IAudioDeviceCollection + * object, the app can enumerate the audio recording devices. The app needs to + * call the \ref IAudioDeviceCollection::release + * "IAudioDeviceCollection::release" method to release the returned object + * after using it. + * + * @return + * - A pointer to the IAudioDeviceCollection object that includes all the + * audio recording devices in the system, if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ + virtual IAudioDeviceCollection *enumerateRecordingDevices() = 0; + + /** + * Specifies an audio playback device with the device ID. + * + * @param deviceId ID of the audio playback device. It can be retrieved by the + * \ref enumeratePlaybackDevices "enumeratePlaybackDevices" method. Plugging + * or unplugging the audio device does not change the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the ID of the audio playback device. + * @param deviceId An output parameter that specifies the ID of the audio + * playback device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the device ID and device name of the audio playback device. + * @param deviceId An output parameter that specifies the ID of the audio + * playback device. + * @param deviceName An output parameter that specifies the name of the audio + * playback device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], + char deviceName[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Sets the volume of the audio playback device. + * @param volume The volume of the audio playing device. The value range is + * [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackDeviceVolume(int volume) = 0; + + /** + * Gets the volume of the audio playback device. + * @param volume The volume of the audio playback device. The value range is + * [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDeviceVolume(int *volume) = 0; + + /** + * Specifies an audio recording device with the device ID. + * + * @param deviceId ID of the audio recording device. It can be retrieved by + * the \ref enumerateRecordingDevices "enumerateRecordingDevices" method. + * Plugging or unplugging the audio device does not change the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the audio recording device by the device ID. + * + * @param deviceId ID of the audio recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the information of the audio recording device by the device ID and + * device name. + * + * @param deviceId ID of the audio recording device. + * @param deviceName The name of the audio recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], + char deviceName[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Sets the volume of the recording device. + * @param volume The volume of the recording device. The value range is [0, + * 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingDeviceVolume(int volume) = 0; + + /** + * Gets the volume of the recording device. + * @param volume The volume of the microphone, ranging from 0 to 255. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDeviceVolume(int *volume) = 0; + + /** + * Specifies an audio loopback recording device with the device ID. + * + * @param deviceId ID of the audio loopback recording device. It can be retrieved by + * the \ref enumeratePlaybackDevices "enumeratePlaybackDevices" method. + * Plugging or unplugging the audio device does not change the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLoopbackDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the audio loopback recording device by the device ID. + * + * @param deviceId ID of the audio loopback recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getLoopbackDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Mutes or unmutes the audio playback device. + * + * @param mute Determines whether to mute the audio playback device. + * - true: Mute the device. + * - false: Unmute the device. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackDeviceMute(bool mute) = 0; + + /** + * Gets the mute state of the playback device. + * + * @param mute A pointer to the mute state of the playback device. + * - true: The playback device is muted. + * - false: The playback device is unmuted. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDeviceMute(bool *mute) = 0; + + /** + * Mutes or unmutes the audio recording device. + * + * @param mute Determines whether to mute the recording device. + * - true: Mute the microphone. + * - false: Unmute the microphone. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingDeviceMute(bool mute) = 0; + + /** + * Gets the mute state of the audio recording device. + * + * @param mute A pointer to the mute state of the recording device. + * - true: The microphone is muted. + * - false: The microphone is unmuted. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDeviceMute(bool *mute) = 0; + + /** + * Starts the audio playback device test. + * + * This method tests if the playback device works properly. In the test, the + * SDK plays an audio file specified by the user. If the user hears the audio, + * the playback device works properly. + * + * @param testAudioFilePath The file path of the audio file for the test, + * which is an absolute path in UTF8: + * - Supported file format: wav, mp3, m4a, and aac. + * - Supported file sampling rate: 8000, 16000, 32000, 44100, and 48000. + * + * @return + * - 0, if the method call succeeds and you can hear the sound of the + * specified audio file. + * - An error code, if the method call fails. + */ + virtual int startPlaybackDeviceTest(const char *testAudioFilePath) = 0; + + /** + * Stops the audio playback device test. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopPlaybackDeviceTest() = 0; + + /** + * Starts the recording device test. + * + * This method tests whether the recording device works properly. Once the + * test starts, the SDK uses the \ref + * IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback to notify the app on the volume information. + * + * @param indicationInterval The time interval (ms) between which the SDK + * triggers the `onAudioVolumeIndication` callback. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRecordingDeviceTest(int indicationInterval) = 0; + + /** + * Stops the recording device test. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRecordingDeviceTest() = 0; + + /** + * Starts the audio device loopback test. + * + * This method tests whether the local audio devices are working properly. + * After calling this method, the microphone captures the local audio and + * plays it through the speaker, and the \ref + * IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback returns the local audio volume information at the set interval. + * + * @note This method tests the local audio devices and does not report the + * network conditions. + * @param indicationInterval The time interval (ms) at which the \ref + * IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback returns. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startAudioDeviceLoopbackTest(int indicationInterval) = 0; + + /** + * Stops the audio device loopback test. + * + * @note Ensure that you call this method to stop the loopback test after + * calling the \ref IAudioDeviceManager::startAudioDeviceLoopbackTest + * "startAudioDeviceLoopbackTest" method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopAudioDeviceLoopbackTest() = 0; + + /** The status of following system default playback device. + + @note The status of following system default playback device. + + @param enable Variable to whether the current device follow system default playback device or not. + - true: The current device will change when the system default playback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemPlaybackDevice(bool enable) = 0; + + /** The status of following system default recording device. + + @note The status of following system default recording device. + + @param enable Variable to whether the current device follow system default recording device or not. + - true: The current device will change when the system default recording device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemRecordingDevice(bool enable) = 0; + + /** The status of following system default loopback device. + + @note The status of following system default loopback device. + + @param enable Variable to whether the current device follow system default loopback device or not. + - true: The current device will change when the system default loopback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemLoopbackDevice(bool enable) = 0; + + /** + * Releases all IAudioDeviceManager resources. + */ + virtual void release() = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraAudioDeviceManager.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraAudioDeviceManager.h new file mode 100644 index 0000000..3c68bf0 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraAudioDeviceManager.h @@ -0,0 +1,550 @@ +// +// Agora SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace media { +namespace base { +class IAudioFrameObserver; +} // namespace base +} // namespace media + +namespace rtc { + +static const int kAdmMaxDeviceNameSize = 128; +static const int kAdmMaxGuidSize = 128; +static const int kIntervalInMillseconds = 200; + + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) +/** + * The struct of AudioDeviceInfo. + * + * @note + * This struct applies to Windows and macOS only. + */ +struct AudioDeviceInfo { + /** + * The name of the device. The maximum name size is 128 bytes. The default value is 0. + */ + char deviceName[kAdmMaxDeviceNameSize]; + /** + * The ID of the device. The maximum size is 128 bytes. The default value is 0. + */ + char deviceId[kAdmMaxGuidSize]; + /** + * Determines whether the current device is selected for audio capturing or playback. + * - true: Select the current device for audio capturing or playback. + * - false: (Default) Do not select the current device for audio capturing or playback. + */ + bool isCurrentSelected; + /** + * Determines whether the current device is the audio playout device. + * - true: (Default) The current device is the playout device. + * - false: The current device is not the playout device. + */ + bool isPlayoutDevice; + + AudioDeviceInfo() : isCurrentSelected(false), + isPlayoutDevice(true) { + memset(deviceName, 0, sizeof(deviceName)); + memset(deviceId, 0, sizeof(deviceId)); + } +}; +#endif // _WIN32 || (TARGET_OS_MAC && !TARGET_OS_IPHONE) + +/** + * The struct of LoopbackRecordingOption + * + * @note + */ +struct LoopbackRecordingOption { + /** + * the name of the device. the maximum name size is 128 bytes. the default value is 0. + */ + Optional deviceName; + /** + * allow output device change when enable loopback recording. + */ + Optional allowDeviceChange; +}; + +/** + * The IAudioDeviceManagerObserver class. + */ +class IAudioDeviceManagerObserver +{ +public: + virtual ~IAudioDeviceManagerObserver() {} + + /** + * Occurs when the device state changes, for example, when a device is added or removed. + * + * To get the current information of the connected audio devices, call \ref agora::rtc::INGAudioDeviceManager::getNumberOfPlayoutDevices "getNumberOfPlayoutDevices". + */ + virtual void onDeviceStateChanged() = 0; + + /** + * Occurs when the device state changes, for example, when a device is added or removed or default device change. + * + * @note + * This method applies to Windows only now. + * + * @param deviceId Pointer to the device ID. + * @param deviceType Device type: #MEDIA_DEVICE_TYPE. + * @param deviceState Device state: #MEDIA_DEVICE_STATE_TYPE.. + */ + virtual void onAudioDeviceStateChanged(const char *deviceId, int deviceType, int deviceState) = 0; + + /** Indicates incoming volume. This can be used to test microphone or speaker. + * + * @param deviceType Device type: #MEDIA_DEVICE_TYPE. + * @param volume volume between 0 (lowest volume) to 255 (highest volume). + */ + virtual void onVolumeIndication(int deviceType, int volume) = 0; + + /** + * Occurs when the audio route changes. + * + * @param route The current audio route. See #AudioRoute. + */ + virtual void onRoutingChanged(AudioRoute route) = 0; + + /** + * Occurs when the audio device volume changes. + * + * @param deviceType The device type, see #MEDIA_DEVICE_TYPE. + * @param volume The volume of the audio device. + * @param muted Whether the audio device is muted: + * - true: The audio device is muted. + * - false: The audio device is not muted. + */ + virtual void onAudioDeviceVolumeChanged(int deviceType, int volume, bool muted) = 0; +}; + +class IRecordingDeviceSource : public RefCountInterface { + public: + /** + * Initialize the recording device source. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initRecording(const char* deviceName = NULL) = 0; + + /** + * Start the recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRecording() = 0; + + /** + * Stop the recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRecording() = 0; + + /** + * Registers an audio frame observer. + * + * @param observer The pointer to the IAudioFrameObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Releases the registered IAudioFrameObserver object. + * + * @param observer The pointer to the IAudioFrameObserver object created by the `registerAudioPcmDataCallback` method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Set parameter to object loopback device; + * @param option + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLoopbackDeviceParameter(const LoopbackRecordingOption &option) = 0; + + virtual ~IRecordingDeviceSource() {} +}; + +/** + * The INGAudioDeciceManager class. + * + * This class provides access to audio volume and audio route control, as well as device enumeration and + * selection on the PC. + */ +class INGAudioDeviceManager : public RefCountInterface { +public: + /** + * Creates a audio device source object and returns the pointer. + * + * @return + * - The pointer to \ref rtc::IRecordingDeviceSource "IRecordingDeviceSource", if the method call + * succeeds. + * - An empty pointer NULL: Failure. + */ + virtual agora_refptr createRecordingDeviceSource(char deviceId[kAdmMaxDeviceNameSize]) = 0; + + /** + * Sets the volume of the microphone. + * @param volume The volume of the microphone. The value range is [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMicrophoneVolume(unsigned int volume) = 0; + /** + * Gets the volume of the microphone. + * @param volume The volume of the microphone. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMicrophoneVolume(unsigned int& volume) = 0; + /** + * Sets the volume of the speaker. + * @param volume The volume of the speaker. The value range is [2, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSpeakerVolume(unsigned int volume) = 0; + /** + * Gets the volume of the speaker. + * @param volume The volume of the speaker. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getSpeakerVolume(unsigned int& volume) = 0; + /** + * Captures or stops capturing the local audio with the microphone. + * @param mute Determines whether to capture or stop capturing the local audio with the microphone. + * - true: Stop capturing the local audio. + * - false: (Default) Capture the local audio. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMicrophoneMute(bool mute) = 0; + /** + * Gets the mute state of the microphone. + * @param mute The mute state of the microphone. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMicrophoneMute(bool& mute) = 0; + /** + * Plays or stops playing the remote audio with the speaker. + * @param mute Determines whether to play or stop playing the remote audio. + * - true: Stop playing the remote audio. + * - false: (Default) Play the remote audio. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSpeakerMute(bool mute) = 0; + /** + * Gets the mute state of the speaker. + * @param mute A reference to the mute state of the speaker. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getSpeakerMute(bool& mute) = 0; + + /** + * Get the playout parameters of audio device. + * @param params A point to the struct AudioParameters. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlayoutAudioParameters(AudioParameters* params) const = 0; + + /** + * Get the record parameters of audio device. + * @param params A point to the struct AudioParameters. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordAudioParameters(AudioParameters* params) const = 0; + +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + /** + * Sets the default audio routing. + * + * This method allows apps to change the current audio route for the received audio. + * Noted: In Low Level API, we don't support default audio routing, i.e., + * setDefaultAudioRouteToSpeakerphone. This can be done in RTC engine. + * + * @note + * This method applies to Android and iOS only. + * + * @param route The default audio route. See #AudioRoute. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDefaultAudioRouting(AudioRoute route) = 0; + /** + * Changes the current audio routing. + * + * @note + * This method applies to Android and iOS only. + * + * @param route The audio route that you want to change to. See #AudioRoute. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int changeAudioRouting(AudioRoute route) = 0; + /** + * Gets the current audio routing. + * + * @note + * This method applies to Android and iOS only. + * + * @param route A reference to the audio route: AudioRoute. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getCurrentRouting(AudioRoute& route) = 0; +#endif // __ANDROID__ || TARGET_OS_IPHONE + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + /** + * Gets the index numbers of all audio playout devices. + * + * @note + * This method applies to Windows or macOS only. + * + * @return + * - The index numbers of the audio playout devices: Success. + * - < 0: Failure. + */ + virtual int getNumberOfPlayoutDevices() = 0; + + /** + * Gets the index numbers of all audio recording devices. + * + * @note + * This method applies to Windows or macOS only. + * + * @return + * - The index numbers of the audio recording devices: Success. + * - < 0: Failure. + */ + virtual int getNumberOfRecordingDevices() = 0; + /** + * Gets the information of the current audio playout device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the current audio playout device. + * @return + * The information of the audio playout device. See \ref agora::rtc::AudioDeviceInfo "AudioDeviceInfo". + */ + virtual AudioDeviceInfo getPlayoutDeviceInfo(int index) = 0; + /** + * Gets the information of the current recording device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the current recording device. + * @return + * The information of the recording device. See \ref agora::rtc::AudioDeviceInfo "AudioDeviceInfo". + */ + virtual AudioDeviceInfo getRecordingDeviceInfo(int index) = 0; + /** + * Sets the audio playback device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the audio playout device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlayoutDevice(int index) = 0; + /** + * Sets the recording device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingDevice(int index) = 0; + /** The status of following system default playback device. + + @note The status of following system default playback device. + + @param enable Variable to whether the current device follow system default playback device or not. + - true: The current device will change when the system default playback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemPlaybackDevice(bool enable) = 0; + + /** The status of following system default recording device. + + @note The status of following system default recording device. + + @param enable Variable to whether the current device follow system default recording device or not. + - true: The current device will change when the system default recording device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemRecordingDevice(bool enable) = 0; +#endif // _WIN32 || (TARGET_OS_MAC && !TARGET_OS_IPHONE) + +#if defined(_WIN32) + /** + * Sets the volume of the app. + * + * @note + * This method applies to Windows only. + * + * @param volume The volume of the app. The value range is [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setApplicationVolume(unsigned int volume) = 0; + /** + * Gets the volume of the app. + * + * @note + * This method applies to Windows only. + * + * @param volume The volume of the app. The value range is [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getApplicationVolume(unsigned int& volume) = 0; + /** + * Sets the mute state of the app. + * + * @note + * This method applies to Windows only. + * + * @param mute Determines whether to set the app to the mute state. + * - true: Set the app to the mute state. + * - false: (Default) Do not set the app to the mute state. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setApplicationMuteState(bool mute) = 0; + /** + * Gets the mute state of the app. + * + * @note + * This method applies to Windows only. + * + * @param mute A reference to the mute state of the app. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getApplicationMuteState(bool& mute) = 0; + /** + * Gets the information of the current audio loopback device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the current audio playout device. + * @return + * The information of the audio playout device. See \ref agora::rtc::AudioDeviceInfo "AudioDeviceInfo". + */ + virtual AudioDeviceInfo getLoopbackDeviceInfo(int index) = 0; + /** + * Sets the audio loopback device. + * + * @note + * This method applies to Windows only. + * + * @param index The index number of the audio playout device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLoopbackDevice(int index) = 0; + /** The status of following system default loopback device. + + @note The status of following system default loopback device. + + @param enable Variable to whether the current device follow system default loopback device or not. + - true: The current device will change when the system default loopback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemLoopbackDevice(bool enable) = 0; +#endif // _WIN32 + + /** + * Registers an IAudioDeviceManagerObserver object. + * + * You need to implement the IAudioDeviceManageObserver class in this method, and register callbacks + * according to your scenario. + * + * @param observer A pointer to the IAudioDeviceManagerObserver class. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerObserver(IAudioDeviceManagerObserver* observer, void(*safeDeleter)(IAudioDeviceManagerObserver*) = NULL) = 0; + /** + * Releases the IAudioDeviceManagerObserver object. + * @param observer The pointer to the IAudioDeviceManagerObserver class registered using #registerObserver. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterObserver(IAudioDeviceManagerObserver* observer) = 0; + +protected: + ~INGAudioDeviceManager() {} +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraAudioTrack.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraAudioTrack.h new file mode 100644 index 0000000..5889392 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraAudioTrack.h @@ -0,0 +1,724 @@ + +// Copyright (c) 2018 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" + +// FIXME(Ender): use this class instead of AudioSendStream as local track +namespace agora { +namespace rtc { +class IAudioTrackStateObserver; +class IAudioFilter; +class IAudioSinkBase; +class IMediaPacketReceiver; +class IAudioEncodedFrameReceiver; +/** + * Properties of audio frames expected by a sink. + * + * @note The source determines the audio frame to be sent to the sink based on a variety of factors, + * such as other sinks or the capability of the source. + * + */ +struct AudioSinkWants { + /** The sample rate of the audio frame to be sent to the sink. */ + int samplesPerSec; + + /** The number of audio channels of the audio frame to be sent to the sink. */ + size_t channels; + + /** The audio track number of the audio frame to be sent to the sink. */ + int audioTrackNumber; + + AudioSinkWants() : samplesPerSec(0), + channels(0), + audioTrackNumber(-1) {} + AudioSinkWants(int sampleRate, size_t chs) : samplesPerSec(sampleRate), + channels(chs) {audioTrackNumber = -1;} + AudioSinkWants(int sampleRate, size_t chs, int trackNum) : samplesPerSec(sampleRate), channels(chs), audioTrackNumber(trackNum) {} +}; + +/** + * The IAudioTrack class. + */ +class IAudioTrack : public RefCountInterface { + public: + /** + * The position of the audio filter in audio frame. + */ + enum AudioFilterPosition { + /** + * Work on the local playback + */ + RecordingLocalPlayback, + /** + * Work on the post audio processing. + */ + PostAudioProcessing, + /** + * Work on the remote audio before mixing. + */ + RemoteUserPlayback, + /** + * Work on the pcm source. + */ + PcmSource, + /** + * Work on the sending branch of the pcm source. + */ + PcmSourceSending, + /** + * Work on the local playback branch of the pcm source. + */ + PcmSourceLocalPlayback, + /** + * Work on the playback after remote-audio mix. + */ + RemoteMixedPlayback, + }; + + public: + /** + * Adjusts the playback volume. + * @param volume The playback volume. The value ranges between 0 and 100 (default). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustPlayoutVolume(int volume) = 0; + + /** + * Gets the current playback volume. + * @param volume A pointer to the playback volume. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlayoutVolume(int* volume) = 0; + + /** + * Adds an audio filter. + * + * By adding an audio filter, you can apply various audio effects to the audio, for example, voice change. + * @param filter A pointer to the audio filter. See \ref agora::rtc::IAudioFilter "IAudioFilter". + * @param position The position of the audio filter. See \ref agora::rtc::IAudioTrack::AudioFilterPosition "AudioFilterPosition". + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool addAudioFilter(agora_refptr filter, AudioFilterPosition position, ExtensionContext* extContext = NULL) = 0; + /** + * Removes the audio filter added by callling `addAudioFilter`. + * + * @param filter The pointer to the audio filter that you want to remove. See \ref agora::rtc::IAudioFilter "IAudioFilter". + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool removeAudioFilter(agora_refptr filter, AudioFilterPosition position) = 0; + + /** + * Enable / Disable specified audio filter + * @param id id of the filter + * @param enable enable / disable the filter with given id + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - 0: success + * - <0: failure + */ + virtual int enableAudioFilter(const char* id, bool enable, AudioFilterPosition position) { + (void)id; + (void)enable; + (void)position; + return -1; + } + + /** + * set the properties of the specified audio filter + * @param id id of the filter + * @param key key of the property + * @param jsonValue json str value of the property + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - 0: success + * - <0: failure + */ + virtual int setFilterProperty(const char* id, const char* key, const char* jsonValue, AudioFilterPosition position) { + (void)id; + (void)key; + (void)jsonValue; + (void)position; + return -1; + } + + /** + * get the properties of the specified video filter + * @param id id of the filter + * @param key key of the property + * @param jsonValue json str value of the property + * @param bufSize max length of the json value buffer + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - 0: success + * - <0: failure + */ + virtual int getFilterProperty(const char* id, const char* key, char* jsonValue, size_t bufSize, AudioFilterPosition position) { + (void)id; + (void)key; + (void)jsonValue; + (void)bufSize; + (void)position; + return -1; + } + + /** + * Gets the audio filter by its name. + * + * @param name The name of the audio filter. + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - The pointer to the audio filter: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr getAudioFilter(const char *name, AudioFilterPosition position) const = 0; + + /** + * Adds an audio sink to get PCM data from the audio track. + * + * @param sink The pointer to the audio sink. See \ref agora::rtc::IAudioSinkBase "IAudioSinkBase". + * @param wants The properties an audio frame should have when it is delivered to the sink. See \ref agora::rtc::AudioSinkWants "AudioSinkWants". + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool addAudioSink(agora_refptr sink, const AudioSinkWants& wants) = 0; + + /** + * Removes an audio sink. + * + * @param sink The pointer to the audio sink to be removed. See \ref agora::rtc::IAudioSinkBase "IAudioSinkBase". + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool removeAudioSink(agora_refptr sink) = 0; +}; + +/** + * The observer of the local audio track. + */ +class ILocalAudioTrackObserver { + public: + virtual ~ILocalAudioTrackObserver() {} + + /** + * Occurs when the state of a local audio track changes. + * + * @param state The state of the local audio track. + * @param errorCode The error information for a state failure: \ref agora::rtc::LOCAL_AUDIO_STREAM_ERROR "LOCAL_AUDIO_STREAM_ERROR". + */ + virtual void onLocalAudioTrackStateChanged(LOCAL_AUDIO_STREAM_STATE state, + LOCAL_AUDIO_STREAM_ERROR errorCode) = 0; +}; + +/** + * `ILocalAudioTrack` is the basic class for local audio tracks, providing main methods of local audio tracks. + * + * You can create a local audio track by calling one of the following methods: + * - `createLocalAudioTrack` + * - `createCustomAudioTrack` + * - `createMediaPlayerAudioTrack` + * @if (!Linux) + * You can also use the APIs in the \ref agora::rtc::INGAudioDeviceManager "IAudioDeviceManager" class if multiple recording devices are available in the system. + * @endif + * + * After creating local audio tracks, you can publish one or more local audio + * tracks by calling \ref agora::rtc::ILocalUser::publishAudio "publishAudio". + */ +class ILocalAudioTrack : public IAudioTrack { + public: + /** + * Statistics of a local audio track. + */ + struct LocalAudioTrackStats { + /** + * The source ID of the local audio track. + */ + uint32_t source_id; + /** + * The number of audio frames in the buffer. + * + * When sending PCM data, the PCM data is first stored in a buffer area. + * Then a thread gets audio frames from the buffer and sends PCM data. + */ + uint32_t buffered_pcm_data_list_size; + /** + * The number of audio frames missed by the thread that gets PCM data from the buffer. + */ + uint32_t missed_audio_frames; + /** + * The number of audio frames sent by the thread that gets PCM data from the buffer. + */ + uint32_t sent_audio_frames; + /** + * The number of audio frames sent by the user. + */ + uint32_t pushed_audio_frames; + /** + * The number of dropped audio frames caused by insufficient buffer size. + */ + uint32_t dropped_audio_frames; + /** + * The number of playout audio frames. + */ + uint32_t playout_audio_frames; + /** + * The type of audio effect. + */ + uint32_t effect_type; + /** + * Whether the hardware ear monitor is enabled. + */ + uint32_t hw_ear_monitor; + /** + * Whether the local audio track is enabled. + */ + bool enabled; + /** + * The volume that ranges from 0 to 255. + */ + uint32_t audio_volume; // [0,255] + + LocalAudioTrackStats() : source_id(0), + buffered_pcm_data_list_size(0), + missed_audio_frames(0), + sent_audio_frames(0), + pushed_audio_frames(0), + dropped_audio_frames(0), + playout_audio_frames(0), + effect_type(0), + hw_ear_monitor(0), + enabled(false), + audio_volume(0) {} + }; + + public: + /** + * Enables or disables the local audio track. + * + * Once the local audio is enabled, the SDK allows for local audio capturing, processing, and encoding. + * + * @param enable Whether to enable the audio track: + * - `true`: Enable the local audio track. + * - `false`: Disable the local audio track. + */ + virtual void setEnabled(bool enable) = 0; + + /** + * Gets whether the local audio track is enabled. + * @return Whether the local audio track is enabled: + * - `true`: The local track is enabled. + * - `false`: The local track is disabled. + */ + virtual bool isEnabled() const = 0; + + /** + * Gets the state of the local audio. + * @return The state of the local audio: #LOCAL_AUDIO_STREAM_STATE: Success. + */ + virtual LOCAL_AUDIO_STREAM_STATE getState() = 0; + + /** + * Gets the statistics of the local audio track: LocalAudioTrackStats. + * @return The statistics of the local audio: LocalAudioTrackStats: Success. + */ + virtual LocalAudioTrackStats GetStats() = 0; + + /** + * Adjusts the audio volume for publishing. + * + * @param volume The volume for publishing. The value ranges between 0 and 100 (default). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustPublishVolume(int volume) = 0; + + /** + * Gets the current volume for publishing. + * @param volume A pointer to the publishing volume. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPublishVolume(int* volume) = 0; + + /** + * Enables or disables local playback. + * @param enable Whether to enable local playback: + * - `true`: Enable local playback. + * - `false`: Disable local playback. + * @param sync Whether to destroy local playback synchronously: + * - `true`: Destroy local playback synchronously. + * - `false`: Destroy local playback asynchronously. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLocalPlayback(bool enable, bool sync = true) = 0; + + /** + * Enables in-ear monitoring (for Android and iOS only). + * + * @param enabled Determines whether to enable in-ear monitoring. + * - true: Enable. + * - false: (Default) Disable. + * @param includeAudioFilters The type of the ear monitoring: #EAR_MONITORING_FILTER_TYPE + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableEarMonitor(bool enable, int includeAudioFilters) = 0; + /** Register an local audio track observer + * + * @param observer A pointer to the local audio track observer: \ref agora::rtc::ILocalAudioTrackObserver + * "ILocalAudioTrackObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerTrackObserver(ILocalAudioTrackObserver* observer) = 0; + /** Releases the local audio track observer + * + * @param observer A pointer to the local audio track observer: \ref agora::rtc::ILocalAudioTrackObserver + * "ILocalAudioTrackObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterTrackObserver(ILocalAudioTrackObserver* observer) = 0; + + protected: + ~ILocalAudioTrack() {} +}; + +/** + * The statistics of a remote audio track. + */ +struct RemoteAudioTrackStats { + /** + * The user ID of the remote user who sends the audio track. + */ + uid_t uid; + /** + * The audio quality of the remote audio track: #QUALITY_TYPE. + */ + int quality; + /** + * The network delay (ms) from the sender to the receiver. + */ + int network_transport_delay; + /** + * The delay (ms) from the receiver to the jitter buffer. + */ + uint32_t jitter_buffer_delay; + /** + * The audio frame loss rate in the reported interval. + */ + int audio_loss_rate; + /** + * The number of audio channels. + */ + int num_channels; + /** + * The sample rate (Hz) of the received audio track in the reported interval. + */ + int received_sample_rate; + /** + * The average bitrate (Kbps) of the received audio track in the reported interval. + * */ + int received_bitrate; + /** + * The total freeze time (ms) of the remote audio track after the remote user joins the channel. + * In a session, audio freeze occurs when the audio frame loss rate reaches 4%. + * The total audio freeze time = The audio freeze number × 2 seconds. + */ + int total_frozen_time; + /** + * The total audio freeze time as a percentage (%) of the total time when the audio is available. + * */ + int frozen_rate; + /** + * The number of audio bytes received. + */ + int64_t received_bytes; + /** + * The average packet waiting time (ms) in the jitter buffer. + */ + int mean_waiting_time; + /** + * The samples of expanded speech. + */ + size_t expanded_speech_samples; + /** + * The samples of expanded noise. + */ + size_t expanded_noise_samples; + /** + * The timestamps since last report. + */ + uint32_t timestamps_since_last_report; + /** + * The minimum sequence number. + */ + uint16_t min_sequence_number; + /** + * The maximum sequence number. + */ + uint16_t max_sequence_number; + /** + * The audio energy. + */ + int32_t audio_level; + /** + * audio downlink average process time + */ + uint32_t downlink_process_time_ms; + /** + * audio neteq loss because of expired + */ + uint32_t packet_expired_loss; + /** + * audio neteq packet arrival expired time ms + */ + uint32_t packet_max_expired_ms; + /** + * audio neteq jitter peak num in two second + */ + uint32_t burst_peak_num; + /** + * audio neteq jitter calc by burst opti feature + */ + uint32_t burst_jitter; + /** + * audio base target level + */ + uint32_t target_level_base_ms; + /** + * audio average target level + */ + uint32_t target_level_prefered_ms; + /** + * audio average accelerate ratio in 2s + */ + uint16_t accelerate_rate; + /** + * audio average preemptive expand ratio in 2s + */ + uint16_t preemptive_expand_rate; + /** + * The count of 80 ms frozen in 2 seconds + */ + uint16_t frozen_count_80_ms; + /** + * The time of 80 ms frozen in 2 seconds + */ + uint16_t frozen_time_80_ms; + /** + * The count of 200 ms frozen in 2 seconds + */ + uint16_t frozen_count_200_ms; + /** + * The time of 200 ms frozen in 2 seconds + */ + uint16_t frozen_time_200_ms; + /** + * The estimate delay + */ + uint32_t delay_estimate_ms; + /** + * The MOS value + */ + uint32_t mos_value; + /** + * Duration of inbandfec + */ + int32_t fec_decode_ms; + /** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ + uint64_t total_active_time; + /** + * The total publish duration (ms) of the remote audio stream. + */ + uint64_t publish_duration; + + int32_t e2e_delay_ms; + /** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. See #EXPERIENCE_QUALITY_TYPE. + */ + int qoe_quality; + /** + * The reason for poor QoE of the local user when receiving a remote audio stream. See #EXPERIENCE_POOR_REASON. + */ + int32_t quality_changed_reason; + + /** + * The type of downlink audio effect. + */ + int32_t downlink_effect_type; + + RemoteAudioTrackStats() : + uid(0), + quality(0), + network_transport_delay(0), + jitter_buffer_delay(0), + audio_loss_rate(0), + num_channels(0), + received_sample_rate(0), + received_bitrate(0), + total_frozen_time(0), + frozen_rate(0), + received_bytes(0), + mean_waiting_time(0), + expanded_speech_samples(0), + expanded_noise_samples(0), + timestamps_since_last_report(0), + min_sequence_number(0xFFFF), + max_sequence_number(0), + audio_level(0), + downlink_process_time_ms(0), + packet_expired_loss(0), + packet_max_expired_ms(0), + burst_peak_num(0), + burst_jitter(0), + target_level_base_ms(0), + target_level_prefered_ms(0), + accelerate_rate(0), + preemptive_expand_rate(0), + frozen_count_80_ms(0), + frozen_time_80_ms(0), + frozen_count_200_ms(0), + frozen_time_200_ms(0), + delay_estimate_ms(0), + mos_value(0), + fec_decode_ms(-1), + total_active_time(0), + publish_duration(0), + e2e_delay_ms(0), + qoe_quality(0), + quality_changed_reason(0), + downlink_effect_type(0) {} +}; + +/** + * The IRemoteAudioTrack class. + */ +class IRemoteAudioTrack : public IAudioTrack { + public: + /** + * Gets the statistics of the remote audio track. + * @param stats A reference to the statistics of the remote audio track: RemoteAudioTrackStats. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getStatistics(RemoteAudioTrackStats& stats) = 0; + + /** + * Gets the state of the remote audio. + * @return The state of the remote audio: #REMOTE_AUDIO_STATE. + */ + virtual REMOTE_AUDIO_STATE getState() = 0; + + /** + * Registers an `IMediaPacketReceiver` object. + * + * You need to implement the `IMediaPacketReceiver` class in this method. Once you successfully register + * the media packet receiver, the SDK triggers the `onMediaPacketReceived` callback when it receives an + * audio packet. + * + * @param packetReceiver The pointer to the `IMediaPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerMediaPacketReceiver(IMediaPacketReceiver* packetReceiver) = 0; + + /** + * Releases the `IMediaPacketReceiver` object. + * @param packetReceiver The pointer to the `IMediaPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterMediaPacketReceiver(IMediaPacketReceiver* packetReceiver) = 0; + + /** + * Registers an `IAudioEncodedFrameReceiver` object. + * + * You need to implement the `IAudioEncodedFrameReceiver` class in this method. Once you successfully register + * the media packet receiver, the SDK triggers the `onEncodedAudioFrameReceived` callback when it receives an + * audio packet. + * + * @param packetReceiver The pointer to the `IAudioEncodedFrameReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioEncodedFrameReceiver(IAudioEncodedFrameReceiver* packetReceiver) = 0; + + /** + * Releases the `IAudioEncodedFrameReceiver` object. + * @param packetReceiver The pointer to the `IAudioEncodedFrameReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioEncodedFrameReceiver(IAudioEncodedFrameReceiver* packetReceiver) = 0; + + /** Sets the sound position and gain + + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + - 0.0: the remote sound comes from the front. + - -1.0: the remote sound comes from the left. + - 1.0: the remote sound comes from the right. + @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. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteVoicePosition(float pan, float gain) = 0; + + /** enable spatial audio + + @param enabled enable/disable spatial audio: + - true: enable spatial audio. + - false: disable spatial audio. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSpatialAudio(bool enabled) = 0; + + /** Sets remote user parameters for spatial audio + + @param params spatial audio parameters + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteUserSpatialAudioParams(const agora::SpatialAudioParams& params) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraCameraCapturer.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraCameraCapturer.h new file mode 100644 index 0000000..30e2856 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraCameraCapturer.h @@ -0,0 +1,565 @@ +// +// Agora SDK +// +// Copyright (c) 2019 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { +class IVideoSinkBase; +class ICameraCaptureObserver; +/** + * The ICameraCapturer class, which provides access to a camera capturer. + */ +class ICameraCapturer : public RefCountInterface { + + public: + /** + * The camera source. + */ + enum CAMERA_SOURCE { + /** + * The camera source is the rear camera. + */ + CAMERA_BACK, + /** + * The camera source is the front camera. + */ + CAMERA_FRONT, + }; + + /** + * The camera state. + */ + enum CAMERA_STATE { + /** + * The camera source is started. + */ + CAMERA_STARTED, + /** + * The camera source is stopped. + */ + CAMERA_STOPPED, + }; + + // Interface for receiving information about available camera devices. + /** + * The IDeviceInfo class, which manages the information of available cameras. + */ + class IDeviceInfo { + public: + virtual ~IDeviceInfo() {} + + /** + * Releases the device. + */ + virtual void release() = 0; + + /** + * Gets the number of all available cameras. + * @return The number of all available cameras. + */ + virtual uint32_t NumberOfDevices() = 0; + + /** + * Gets the name of a specified camera. + * @param deviceNumber The index number of the device. + * @param deviceNameUTF8 The name of the device. + * @param deviceNameLength The length of the device name. + * @param deviceUniqueIdUTF8 The unique ID of the device. + * @param deviceUniqueIdLength The length of the device ID. + * @param productUniqueIdUTF8 The unique ID of the product. + * @param productUniqueIdLength The length of the product ID. + * @param deviceTypeUTF8 The camera type of the device. + * @param deviceTypeLength The length of the camera type. + * @return + * The name of the device in the UTF8 format: Success. + */ + virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8, + uint32_t deviceNameLength, char* deviceUniqueIdUTF8, + uint32_t deviceUniqueIdLength, char* productUniqueIdUTF8 = 0, + uint32_t productUniqueIdLength = 0, + char* deviceTypeUTF8 = 0, uint32_t deviceTypeLength = 0) = 0; + + /** + * Sets the capability number for a specified device. + * @param deviceUniqueIdUTF8 The pointer to the ID of the device in the UTF8 format. + * @return + * The capability number of the device. + */ + virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) = 0; + + /** + * Gets the capability of a specified device. + * @param deviceUniqueIdUTF8 The pointer to the ID of the device in the UTF8 format. + * @param deviceCapabilityNumber The capability number of the device. + * @param capability The reference to the video capability. See {@link VideoFormat}. + * @return + * The capability number of the device. + */ + virtual int32_t GetCapability(const char* deviceUniqueIdUTF8, + const uint32_t deviceCapabilityNumber, + VideoFormat& capability) = 0; + }; + + public: +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE) + /** + * Sets the camera source. + * + * @note + * This method applies to Android and iOS only. + * + * @param source The camera source that you want to capture. See #CAMERA_SOURCE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraSource(CAMERA_SOURCE source) = 0; + /** + * Gets the camera source. + * + * @note + * This method applies to Android and iOS only. + * + * @return The camera source. See #CAMERA_SOURCE. + */ + virtual CAMERA_SOURCE getCameraSource() = 0; + /** + * Switch the camera source + * + * @note + * This method applies to Android and iOS only. + */ + virtual void switchCamera() = 0; + /** + * Returns whether zooming is supported by the current device. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after the device is initialized. + * + * @return + * - true: zooming is supported. + * - false: zooming is not supported or device is not initialized. + */ + virtual bool isZoomSupported() = 0; + /** + * Sets the zooming factor of the device. + * + * @note + * This method applies to Android and iOS only. + * + * @param zoomValue The zooming factor of the device. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t setCameraZoom(float zoomValue) = 0; + /** + * Gets the max zooming factor of the device. + * + * @note + * This method applies to Android and iOS only. + * + * @return + * - The max zooming factor of the device + */ + virtual float getCameraMaxZoom() = 0; + /** + * Returns whether auto-focus is supported by the current device. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after device is initialized. + * + * @return + * - true: auto-focus is supported. + * - false: auto-focus is not supported or device is not initialized. + */ + virtual bool isFocusSupported() = 0; + /** + * Sets the focus area of the current device. + * @note + * This method applies to Android and iOS only. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t setCameraFocus(float x, float y) = 0; + /** + * Returns whether auto face focus is supported by the current device. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after device is initialized. + * + * @return + * - true: auto-face-focus is supported. + * - false: auto-face-focus is not supported or device is not initialized. + */ + virtual bool isAutoFaceFocusSupported() = 0; + /** + * Enables or disables auto face focus. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after device is initialized. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t setCameraAutoFaceFocus(bool enable) = 0; + /** + * Enables or disables auto face detection. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after device is initialized. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t enableFaceDetection(bool enable) = 0; + + /** + * Checks whether the camera face detect is supported. + * + * @return + * - true: The camera face detect is supported. + * - false: The camera face detect is not supported. + */ + virtual bool isCameraFaceDetectSupported() = 0; + + /** + * Checks whether the camera flash function is supported. + * + * The SDK uses the front camera by default, so if you call `isCameraTorchSupported` directly, + * you can find out from the return value whether the device supports enabling the flash + * when using the front camera. If you want to check whether the device supports enabling the + * flash when using the rear camera, call \ref IRtcEngine::switchCamera "switchCamera" + * to switch the camera used by the SDK to the rear camera, and then call `isCameraTorchSupported`. + * + * @note + * - Call this method after the camera is started. + * - This method is for Android and iOS only. + * - On iPads with system version 15, even if `isCameraTorchSupported` returns true, you might + * fail to successfully enable the flash by calling \ref IRtcEngine::setCameraTorchOn "setCameraTorchOn" + * due to system issues. + * + * @return + * - true: The device supports enabling the flash. + * - false: The device does not support enabling the flash. + */ + virtual bool isCameraTorchSupported() = 0; + + /** + * @note + * - Call this method after the camera is started. + * - This method is for Android and iOS only. + * - On iPads with system version 15, even if \ref IRtcEngine::isCameraTorchSupported "isCameraTorchSupported" + * returns true, you might fail to successfully enable the flash by calling `setCameraTorchOn` due to + * system issues. + * + * @param isOn Determines whether to enable the flash: + * - true: Enable the flash. + * - false: Disable the flash. + * + * @return + * - 0: Success + * - < 0: Failure + */ + virtual int setCameraTorchOn(bool isOn) = 0; + + /** Checks whether the camera exposure function is supported. + * + * Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`. + * + * @since v2.3.2. + * @return + *
      + *
    • true: The device supports the camera exposure function.
    • + *
    • false: The device does not support the camera exposure function.
    • + *
    + */ + virtual bool isCameraExposurePositionSupported() = 0; + + /** Sets the camera exposure position. + * + * Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`. + * + * A successful setCameraExposurePosition method call triggers the {@link IRtcEngineEventHandler#onCameraExposureAreaChanged onCameraExposureAreaChanged} callback on the local client. + * @since v2.3.2. + * @param positionXinView The horizontal coordinate of the touch point in the view. + * @param positionYinView The vertical coordinate of the touch point in the view. + * + * @return + *
      + *
    • 0: Success.
    • + *
    • < 0: Failure.
    • + *
    + */ + virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0; + + /** + * @brief Set the camera mirror mode. + * + * This method applies to iOS only. It supports setting the mirror mode within and outside a channel. + * + * @param mirror The desired video mirror mode of the camera. + * + * Key considerations: + * - Call this method before starting the camera. The preferred call sequence is: setCameraMirror -> startPreview -> joinChannel. + * - Supported mirror modes are VIDEO_MIRROR_MODE_AUTO (front camera mirrored), VIDEO_MIRROR_MODE_ENABLED (front and back cameras mirrored), and VIDEO_MIRROR_MODE_DISABLED (no mirroring). + * - To optimize performance by using capture-side mirroring instead of calling setVideoEncoderConfiguration or videoframeobserver's getMirrorApplied method. + * - Use setLocalVideo and setRemoteVideo with the desired mirror settings for local and remote rendering. + Example usage: + Using the front camera, local mirroring and remote non-mirroring. + Using the rear camera, local non-mirroring, remote non-mirroring. + - No stickers.: + local:setLocalVideo:mirrorMode(auto) + remote:setRemoteVideo:mirrorMode(auto) + - With stickers: + local:setCameraMirror(auto) + setLocalVideo:mirrorMode(disable) + remote:setRemoteVideo:mirrorMode(auto) + * The API also supports private parameters: + * - Use parameter "{\"rtc.camera_capture_mirror_mode\":0}" to manually set the mirror mode. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +virtual int setCameraMirror(VIDEO_MIRROR_MODE_TYPE mirror) = 0; + +/** + * Returns whether exposure value adjusting is supported by the current device. + * @note + * This method applies to iOS only. + * This interface returns valid values only after the device is initialized. + * + * @return + * - true: exposure value adjusting is supported. + * - false: exposure value adjusting is not supported or device is not initialized. + */ + virtual bool isCameraExposureSupported() = 0; + /** + * Sets the exposure factor of the device. + * + * @note + * This method applies to iOS only. + * + * @param exposureValue The exposure value bias factor of the device. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t setCameraExposureFactor(float exposureValue) = 0; + +#if (defined(__APPLE__) && TARGET_OS_IOS) + /** + * Enables or disables the AVCaptureMultiCamSession. + * + * @param enable Determines whether to use the AVCaptureMultiCamSession: + * - true: Enable the AVCaptureMultiCamSession. + * - false: Disable the AVCaptureMultiCamSession. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual bool enableMultiCamera(bool enable) = 0; + /** + * Checks whether the camera auto exposure function is supported. + * + * @return + * - true: The camera auto exposure function is supported. + * - false: The camera auto exposure function is not supported. + */ + virtual bool isCameraAutoExposureFaceModeSupported() = 0; + + + /** + * Enables the camera auto exposure face function. + * + * @param enabled Determines whether to enable the camera auto exposure face mode. + * - true: Enable the auto exposure face function. + * - false: Do not enable the auto exposure face function. + * + * @return + *
      + *
    • 0: Success.
    • + *
    • < 0: Failure.
    • + *
    + */ + virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0; +#endif + +#elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \ + (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + + /** + * Creates a DeviceInfo object. + * + * @note + * This method applies to Windows, macOS, and Linux only. + * @return + * - The pointer to \ref agora::rtc::ICameraCapturer::IDeviceInfo "IDeviceInfo": Success. + * - An empty pointer NULL: Failure. + */ + virtual IDeviceInfo* createDeviceInfo() = 0; + /** + * Initializes the device with the device ID. + * + * @note + * This method applies to Windows, macOS, and Linux only. + * + * @param deviceId The pointer to the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithDeviceId(const char* deviceId) = 0; + /** + * Initializes the device with the device name. + * + * @note + * This method applies to Windows, macOS, and Linux only. + * + * @param deviceName The pointer to the device name. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithDeviceName(const char* deviceName) = 0; +#endif + + /** + * Set the device orientation of the capture device + * @param VIDEO_ORIENTATION orientaion of the device 0(by default), 90, 180, 270 + */ + virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation) = 0; + + /** + * Sets the format of the video captured by the camera. + * + * If you do not set the video capturing format, the SDK automatically chooses a proper format according to the video encoder configuration of the video track. + * + * @param capture_format The reference to the video format: VideoFormat. + */ + virtual void setCaptureFormat(const VideoFormat& capture_format) = 0; + /** + * Gets the format of the video captured by the camera. + * @return + * VideoFormat. + */ + virtual VideoFormat getCaptureFormat() = 0; + /** + * Register a camera observer. + * + * @param observer Instance of the capture observer. + */ + virtual int registerCameraObserver(ICameraCaptureObserver* observer) = 0; + /** + * Unregisters the camera observer. + * + * @param observer Instance of the capture observer. + */ + virtual int unregisterCameraObserver(ICameraCaptureObserver* observer) = 0; + + protected: + ~ICameraCapturer() {} +}; +/** + * The ICameraCaptureObserver class, which handles camera capture events. + */ +class ICameraCaptureObserver { + public: + /** + * Occurs when the camera focus area changes. + * + * @note The SDK triggers this callback when the local user changes the camera focus position by + * calling the \ref agora::rtc::ICameraCapturer::setCameraFocus "setCameraFocus" method. + * + * @param imageWidth Width of the changed camera focus area. + * @param imageHeight Height of the changed camera focus area. + * @param x x coordinate of the changed camera focus area. + * @param y y coordinate of the changed camera focus area. + */ + virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) { + (void) imageWidth; + (void) imageHeight; + (void) x; + (void) y; + + } + /** + * Reports the face detection result of the local user. Applies to Android and iOS only. + * + * Once you enable face detection by calling \ref agora::rtc::ICameraCapturer::setCameraFaceDetection "setCameraFaceDetection" (true), + * you can get the following information on the local user in real-time: + * - The width and height of the local video. + * - The position of the human face in the local video. + * - The distance between the human face and the device screen. + * This value is based on the fitting calculation of the local video size and the position of the human face. + * + * @note + * - If the SDK does not detect a face, it reduces the frequency of this callback to reduce power consumption on the local device. + * - The SDK stops triggering this callback when a human face is in close proximity to the screen. + * - On Android, the distance value reported in this callback may be slightly different from the actual distance. + * Therefore, Agora does not recommend using it for accurate calculation. + * + * @param imageWidth The width (px) of the local video. + * @param imageHeight The height (px) of the local video. + * @param vecRectangle The position and size of the human face on the local video: + * - `x`: The x coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, + * the x coordinate represents the relative lateral displacement of the top left corner of the human face to the origin. + * - `y`: The y coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, + * the y coordinate represents the relative longitudinal displacement of the top left corner of the human face to the origin. + * - `width`: The width (px) of the human face in the captured video. + * - `height`: The height (px) of the human face in the captured video. + * @param vecDistance The distance (cm) between the human face and the screen. + * @param numFaces The number of faces detected. If the value is 0, it means that no human face is detected. + */ + virtual void onFacePositionChanged( + int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) { + (void) imageWidth; + (void) imageHeight; + (void) vecRectangle; + (void) vecDistance; + (void) numFaces; + } + + /** Occurs when the camera exposure area changes. + * + * The SDK triggers this callback when the local user changes the camera exposure position by calling the setCameraExposurePosition method. + * + * @note This callback is for Android and iOS only. + * + * @param x x coordinate of the changed camera exposure area. + * @param y y coordinate of the changed camera exposure area. + * @param width Width of the changed camera exposure area. + * @param height Height of the changed camera exposure area. + */ + virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) { + (void)x; + (void)y; + (void)width; + (void)height; + } + + virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source) { + (void) state; + (void) source; + } + + protected: + virtual ~ICameraCaptureObserver() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraExtensionControl.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraExtensionControl.h new file mode 100644 index 0000000..5b27ffe --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraExtensionControl.h @@ -0,0 +1,100 @@ +// +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) +#include "AgoraBase.h" +#include "AgoraRefPtr.h" +#include "AgoraRefCountedObject.h" +#include "IAgoraLog.h" +#include "NGIAgoraVideoFrame.h" +#include "NGIAgoraExtensionProvider.h" + +namespace agora { +namespace rtc { +class IExtensionProvider; +/** + * Interface for handling agora extensions. + */ +class IExtensionControl { + public: + /** + * Agora Extension Capabilities. + */ + struct Capabilities { + /** + * Whether to support audio extensions. + */ + bool audio; + /** + * Whether to support video extensions. + */ + bool video; + }; + + /** + * Gets the capabilities of agora extensions. + * + * @param capabilities Supported extension capabilities. + */ + virtual void getCapabilities(Capabilities& capabilities) = 0; + + /** + * Recycles internal frame memory with a specified Video frame type. + * + * The SDK automatically recycles deprecated video frames. However, + * you can still call this method to perform an immediate memory recycle. + * @param type Frame type to be recycled. + */ + virtual void recycleVideoCache() = 0; + + /** + * This method dumps the content of the video frame to the specified file. + * + * @return + * - 0: The method call succeeds. + * - <0: The method call fails. + */ + virtual int dumpVideoFrame(agora_refptr frame, const char* file) = 0; + + /** + * Sets log file. + * + * @param level Logging level. See #commons::LOG_LEVEL. + * @param message Message to add to the log file. + * @return + * - 0: The method call succeeds. + * - <0: The method call fails. + */ + virtual int log(commons::LOG_LEVEL level, const char* message) = 0; + + /** + * Post extension events to SDK. + * + * @param provider name of the provider + * @param extension name of the extension + * @param event_key key of the extension event + * @param event_json_str string of the extension event + * @return + * - 0: The method call succeeds. + * - <0: The method call fails. + */ + virtual int fireEvent(const char* provider, const char* extension, const char* event_key, const char* value) = 0; + + /** + * Register provider to the SDK + * @param provider name of the provider + * @param instance instance of the provider + */ + virtual int registerProvider(const char* provider, agora_refptr instance) = 0; + + protected: + virtual ~IExtensionControl() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraExtensionProvider.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraExtensionProvider.h new file mode 100644 index 0000000..9a1a541 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraExtensionProvider.h @@ -0,0 +1,122 @@ +// +// Agora SDK +// +// Copyright (c) 2021 Agora.io. All rights reserved. +// + +#pragma once + +#include "AgoraRefPtr.h" +#include "NGIAgoraMediaNode.h" +#include "AgoraExtensionVersion.h" + +namespace agora { +namespace rtc { +class IExtensionControl; + +/** + * Interfaces for Extension Provider + * User can implement these interfaces for providing their own media node implementations to SDK. + * Please refer to \ref agora::RefCountedObject to wrap your implementation so that it can be + * held by agora::agora_refptr. + * For example: + * class YourExtensionProvide: public IExtensionProvider { + * // Your Concrete implementaion + * }; + * + * // Use agroa::RefCountedObject to provide RefCountInterface implementation for you implementation, + * // intantiate and wrap it with agora_refptr. + * + * agora_refptr provider = new RefCountedObject(Arg1, Arg2, ...); + * + * You can instantiate your AudioFilter/VideoFilter/VideoSink in the same way. + */ + +class IExtensionProvider : public RefCountInterface { + public: + enum EXTENSION_TYPE { + /** + * note: discarded, Don't use it anymore. + */ + AUDIO_FILTER, + VIDEO_PRE_PROCESSING_FILTER, + VIDEO_POST_PROCESSING_FILTER, + AUDIO_SINK, + VIDEO_SINK, + /* + * Used to modify locally captured audio data to play, such as ear monitoring. + */ + AUDIO_RECORDING_LOCAL_PLAYBACK_FILTER = 10000, + /* + * Used to modify audio data after the local APM (3A). + */ + AUDIO_POST_PROCESSING_FILTER = 10001, + /* + * Used to modify received and decoded remote user audio data. + */ + AUDIO_REMOTE_USER_PLAYBACK_FILTER = 10002, + /* + * note: It is used internally by agora and does not support users other than agora. + * + * Used to modify the audio data of the sender's PCM source to take effect for sending and local playback. + */ + AUDIO_PCM_SOURCE_FILTER = 10003, + /* + * note: It is used internally by agora and does not support users other than agora. + * + * Used to Modifying the audio data of the sender's PCM source is only effect for the sending. + */ + AUDIO_PCM_SOURCE_SENDING_FILTER = 10004, + /* + * note: It is used internally by agora and does not support users other than agora. + * + * Used to Modifying the audio data of the sender's PCM source is only effect for the local playback. + */ + AUDIO_PCM_SOURCE_LOCAL_PLAYBACK_FILTER = 10005, + /* + * note: It is used internally by agora and does not support users other than agora. + * + * Used to modify local playback audio data after the remote audio mixed. + */ + AUDIO_REMOTE_MIXED_PLAYBACK_FILTER = 10006, + UNKNOWN = 0xFFFF, + }; + + struct ExtensionMetaInfo { + EXTENSION_TYPE type; + const char* extension_name; + }; + + virtual void setExtensionControl(IExtensionControl* control) {} + + virtual void enumerateExtensions(ExtensionMetaInfo* extension_list, + int& extension_count) { + (void) extension_list; + extension_count = 0; + } + + virtual agora_refptr createAudioFilter(const char* name) { + return NULL; + } + + virtual agora_refptr createVideoFilter(const char* name) { + return NULL; + } + + virtual agora_refptr createVideoSink(const char* name) { + return NULL; + } + + virtual void setProperty(const char* key, const char* value) {} + + protected: + virtual ~IExtensionProvider() {} +}; + +class IExtensionProviderV2 : public IExtensionProvider { + public: + virtual void getExtensionVersion(const char* extension_name, ExtensionVersion& version) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraLocalUser.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraLocalUser.h new file mode 100644 index 0000000..52bdb62 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraLocalUser.h @@ -0,0 +1,1485 @@ +// +// Agora SDK +// +// Created by Zheng Ender in 2018-01. +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include + +#include "AgoraBase.h" +#include "AgoraOptional.h" + +namespace agora { +namespace media { +class IAudioFrameObserver; +} + +namespace rtc { +class IAudioEngineWrapper; + +class ILocalUserObserver; +class ILocalVideoTrack; +class IRemoteVideoTrack; +class IVideoFrameObserver2; + +class IMediaControlPacketSender; +class IMediaControlPacketReceiver; +struct AudioEncoderConfiguration; +struct VideoEncoderConfiguration; + +class ILocalAudioTrack; +struct RemoteAudioTrackStats; +class IRemoteAudioTrack; +struct LocalVideoTrackStats; +struct RemoteVideoTrackStats; +class IMediaPacketReceiver; +class IVideoSinkBase; +/** + * The ILocalUser class defines the behavior and state of a local user. + * + * Each RTC connection has its own local user. Apps can get the local + * user object by calling \ref agora::rtc::IRtcConnection::getLocalUser + * "IRtcConnection::getLocalUser". + * + * Each local user has two user roles: broadcaster (publisher and subscriber) and + * audience (subscriber only). A publisher publishes audio and video tracks, while + * audience receive them. + */ +class ILocalUser { + public: + /** + * The statistics related to audio network adaptation (ANA). + */ + struct ANAStats { + /** + * The number of actions taken by the ANA bitrate controller since the start of the call. + * + * If you do not set this parameter, the ANA bitrate controller is disabled. + */ + agora::Optional bitrate_action_counter; + /** + * The number of actions taken by the ANA channel controller since the start of the call. + * + * If you do not set this parameter, the ANA channel controller is disabled. + */ + agora::Optional channel_action_counter; + /** + * The number of actions taken by the ANA DTX controller since the start of the call. + * + * If you do not set this parameter, the ANA DTX controller is disabled. + */ + agora::Optional dtx_action_counter; + /** + * The number of actions taken by the ANA FEC (Forward Error Correction) controller since the start of the call. + * + * If you do not set this parameter, the ANA FEC controller is disabled. + */ + agora::Optional fec_action_counter; + /** + * The number of times that the ANA frame length controller increases the frame length + * since the start of the call. + * + * If you do not set this parameter, the ANA frame length controller is disabled. + */ + agora::Optional frame_length_increase_counter; + /** + * The number of times that the ANA frame length controller decreases the frame length + * since the start of the call. + * + * If you so not set this parameter, the ANA frame length controller is disabled. + */ + agora::Optional frame_length_decrease_counter; + /** + * The uplink packet loss fractions set by the ANA FEC controller. + * + * If you do not set this parameter, the ANA FEC controller is not active. + */ + agora::Optional uplink_packet_loss_fraction; + }; + + /** + * The statistics related to audio processing. + */ + struct AudioProcessingStats { + /** + * The echo return loss (ERL). + * + * ERL = 10log_10(P_far / P_echo). + * + * ERL measures the signal loss that comes back as an echo. A higher ratio corresponds to a smaller + * amount of echo. The higher the ERL the better. + */ + agora::Optional echo_return_loss; + // + /** + * The echo return loss enhancement (ERLE). + * + * ERLE = 10log_10(P_echo / P_out). + * + * The performance of an echo canceller is measured in echo return loss enhancement, which is the amount + * of additional signal loss applied by the echo canceller. + * + * The total signal loss of the echo is the sum of ERL and ERLE. + */ + agora::Optional echo_return_loss_enhancement; + /** + * The fraction of time that the AEC (Acoustic Echo Cancelling) linear filter is divergent, in a + * 1-second non-overlapped aggregation window. + */ + agora::Optional divergent_filter_fraction; + + /** + * The delay metrics (ms). + * + * It consists of the delay median and standard deviation. It also consists of the + * fraction of delay estimates that can make the echo cancellation perform poorly. The values are + * aggregated until the first call of \ref agora::rtc::IRemoteAudioTrack::getStatistics "getStatistics" and afterwards aggregated and updated every + * second. + * @note + * If there are several clients pulling metrics from + * `getStatistics` during a session, the first call from any of them will change to one second + * aggregation window for all. + */ + agora::Optional delay_median_ms; + /** + * The delay standard deviation(ms). + */ + agora::Optional delay_standard_deviation_ms; + + /** + * The residual echo detector likelihood. + */ + agora::Optional residual_echo_likelihood; + /** + * The maximum residual echo likelihood from the last time period. + */ + agora::Optional residual_echo_likelihood_recent_max; + + /** + * The instantaneous delay estimate produced in the AEC (ms). + * The value is the instantaneous value at the time of calling \ref agora::rtc::IRemoteAudioTrack::getStatistics "getStatistics". + */ + agora::Optional delay_ms; + }; + + /** + * The detailed statistics of the local audio. + */ + struct LocalAudioDetailedStats { + /** + * The synchronization source (SSRC) to identify the stream of RTP packets from the local audio. + */ + uint32_t local_ssrc; + /** + * The number of sent audio bytes. + */ + int64_t bytes_sent; + /** + * The number of sent audio packets. + */ + int32_t packets_sent; + /** + * The number of lost audio packets. + */ + int32_t packets_lost; + /** + * The fraction packet loss reported for this SSRC. + */ + float fraction_lost; + /** + * The codec name. + */ + char codec_name[media::base::kMaxCodecNameLength]; + /** + * The payload type as used in RTP encoding or decoding. + */ + agora::Optional codec_payload_type; + /** + * The ext sequence number. + */ + int32_t ext_seqnum; + /** + * The jitter duration (ms). + */ + int32_t jitter_ms; + /** + * The RTT (Round-Trip Time) duration (ms). + */ + int64_t rtt_ms; + /** + * The audio level (dBov) of the media source. + */ + int32_t audio_level; + /** + * The audio energy of the media source. + */ + double total_input_energy; + /** + * The audio duration of the media source. + */ + double total_input_duration; + /** + * Whether the typing noise is detected. + * - `true`: The typing noise is detected. + * - `false`: The typing noise is not detected. + */ + bool typing_noise_detected; + + /** + * The audio process time from record done to encode done + */ + + ANAStats ana_statistics; + AudioProcessingStats apm_statistics; + + LocalAudioDetailedStats() : local_ssrc(0), bytes_sent(0), packets_sent(0), packets_lost(-1), fraction_lost(-1.0f), + ext_seqnum(-1), jitter_ms(-1), rtt_ms(-1), audio_level(-1), + total_input_energy(0.0), total_input_duration(0.0), typing_noise_detected(false) { + memset(codec_name, 0, sizeof(codec_name)); + } + }; + + enum NS_MODE { + ElderNsStatistical = 0, /* Elder Statistical Noise Suppression.*/ + NsNGStatistical = 1, /* Next Generation Statistical Noise Suppression.*/ + NsNG = 2 /* Next Generation Noise Suppression.*/ + }; + enum NS_LEVEL { + Soft = 0,/* Soft Noise Suppression.*/ + Aggressive = 1 /* Aggressiveness Noise Suppression.*/ + }; + enum NS_DELAY { + HighQuality = 0,/* High Audio Quality with High Delay.*/ + Balance = 1,/* Balanced Audio Quality and Delay.*/ + LowDelay = 2/* Slight Low Audio Quality with Low Delay.*/ + }; + + public: + virtual ~ILocalUser() {} + + /** + * Sets the role of the user. + * + * You can call this method either before or after connecting to an Agora channel: + * - Before connecting: This method sets the user role as publisher or subscriber (default). + * - After connecting: This method allows you to switch the user role between publisher and + * subscriber. + * The \ref IRtcConnectionObserver::onChangeRoleSuccess "onChangeRoleSuccess" and + * \ref IRtcConnectionObserver::onChangeRoleFailure "onChangeRoleFailure" + * callbacks indicate the result of this method call. + * + * @note + * If the token in the \ref IRtcConnection::connect "connect" method does not have the same role + * as `role`, the connection fails with the \ref IRtcConnectionObserver::onConnectionFailure "onConnectionFailure" callback. + * @param role The role of the user. See \ref rtc::CLIENT_ROLE_TYPE "CLIENT_ROLE_TYPE". + */ + virtual void setUserRole(rtc::CLIENT_ROLE_TYPE role) = 0; + + /** + * Gets the role of the user. + * + * @return The role of the user: Success. + */ + virtual CLIENT_ROLE_TYPE getUserRole() = 0; + + + virtual void setAudienceLatencyLevel(AUDIENCE_LATENCY_LEVEL_TYPE level) = 0; + + virtual AUDIENCE_LATENCY_LEVEL_TYPE getAudienceLatencyLevel() = 0; + + /** + * Configures the audio encoder. + * + * The SDK applies the configurations to all the sending audio tracks. + * + * @param config The reference to the audio encoder configurations. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioEncoderConfiguration(const rtc::AudioEncoderConfiguration& config) = 0; + + /** + * Sets the audio parameters and application scenarios. + * + * @param scenario Sets the audio application scenarios: #AUDIO_SCENARIO_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioScenario(AUDIO_SCENARIO_TYPE scenario) = 0; + + /** + * Gets the detailed statistics of the local audio. + * + * @param[out] stats The reference to the detailed statistics of the local audio. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getLocalAudioStatistics(LocalAudioDetailedStats& stats) = 0; + + /** + * Publishes a local audio track to the channel. + * + * By default, all published audio tracks are mixed. + * + * @param audioTrack The local audio track to be published. + * @return + * - 0: Success. + * - < 0: Failure. + * - -5(ERR_REFUSED), if the role of the local user is not broadcaster. + */ + virtual int publishAudio(agora_refptr audioTrack) = 0; + + /** + * Stops publishing the local audio track to the channel. + * + * @param audioTrack The local audio track that you want to stop publishing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishAudio(agora_refptr audioTrack) = 0; + + /** + * Publishes a local video track to the channel. + * + * @param videoTrack The local video track to be published. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int publishVideo(agora_refptr videoTrack) = 0; + + /** + * Stops publishing the local video track to the channel. + * + * @param videoTrack The local video track that you want to stop publishing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishVideo(agora_refptr videoTrack) = 0; + + /** + * Subscribes to the audio of a specified remote user in channel. + * + * @param userId The ID of the remote user whose audio you want to subscribe to. + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if no such user exists or `userId` is invalid. + */ + virtual int subscribeAudio(user_id_t userId) = 0; + + /** + * Subscribes to the audio of all remote users in the channel. + * + * This method also automatically subscribes to the audio of any subsequent user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int subscribeAllAudio() = 0; + + /** + * Stops subscribing to the audio of a specified remote user in the channel. + * + * @param userId The ID of the user whose audio you want to stop subscribing to. + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if no such user exists or `userId` is invalid. + */ + virtual int unsubscribeAudio(user_id_t userId) = 0; + + /** + * Stops subscribing to the audio of all remote users in the channel. + * + * This method automatically stops subscribing to the audio of any subsequent user, unless you explicitly + * call \ref subscribeAudio "subscribeAudio" or \ref subscribeAllAudio "subscribeAllAudio". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unsubscribeAllAudio() = 0; + + /** + * Adjusts the playback signal volume. + * @param volume The playback volume. The value ranges between 0 and 400, including the following: + * 0: Mute. + * 100: (Default) Original volume. + * 400: Four times the original volume with signal-clipping protection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustPlaybackSignalVolume(int volume) = 0; + + /** + * Gets the current playback signal volume. + * @param volume A pointer to the playback signal volume. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackSignalVolume(int* volume) = 0; + + /* + * Adjust the playback volume of the user specified by uid. + * + * You can call this method to adjust the playback volume of the user specified by uid + * in call. If you want to adjust playback volume of the multi user, you can call this + * this method multi times. + * + * @note + * Please call this method after join channel. + * This method adjust the playback volume of specified user. + * + * @param userId The ID of the Remote user. + * @param volume The playback volume of the specified remote user. The value ranges between 0 and 400, including the following: + * 0: Mute. + * 100: (Default) Original volume. + * 400: Four times the original volume with signal-clipping protection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustUserPlaybackSignalVolume(user_id_t userId, int volume) = 0; + + /** + * Gets the current playback signal volume of specified user. + * @param userId The ID of the Remote user. + * @param volume A pointer to the playback signal volume. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserPlaybackSignalVolume(user_id_t userId, int* volume) = 0; + + /** Enables/Disables stereo panning for remote users. + + Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling \ref agora::rtc::IRtcEngine::setRemoteVoicePosition "setRemoteVoicePosition". + + @param enabled Sets whether or not to enable stereo panning for remote users: + - true: enables stereo panning. + - false: disables stereo panning. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSoundPositionIndication(bool enabled) = 0; + + /** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + + @note + - For this method to work, enable stereo panning for remote users by calling the \ref agora::rtc::IRtcEngine::enableSoundPositionIndication "enableSoundPositionIndication" method before joining a channel. + - This method requires hardware support. For the best sound positioning, we recommend using a wired headset. + - Ensure that you call this method after joining a channel. + + @param userId The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + - 0.0: the remote sound comes from the front. + - -1.0: the remote sound comes from the left. + - 1.0: the remote sound comes from the right. + @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. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteVoicePosition(user_id_t userId, double pan, double gain) = 0; + + /** enable spatial audio + + @param enabled enable/disable spatial audio: + - true: enable spatial audio. + - false: disable spatial audio. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSpatialAudio(bool enabled) = 0; + + /** Sets remote user parameters for spatial audio + + @param userId The ID of the remote user. + @param param spatial audio parameters + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteUserSpatialAudioParams(user_id_t userId, const agora::SpatialAudioParams& param) = 0; + + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame + * "onPlaybackAudioFrame" callback. + * + * @param numberOfChannels The number of audio channels of the audio frame in the `onPlaybackAudioFrame` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onPlaybackAudioFrame` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * @param mode Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall The number of samples of the audio frame. * + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackAudioFrameParameters(size_t numberOfChannels, + uint32_t sampleRateHz, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode = RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, + int samplesPerCall = 0) = 0; + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onRecordAudioFrame + * "onRecordAudioFrame" callback. + * + * @param numberOfChannels The number of channels of the audio frame in the `onRecordAudioFrame` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onRecordAudioFrame` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * @param mode Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall The number of samples of the audio frame. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingAudioFrameParameters(size_t numberOfChannels, + uint32_t sampleRateHz, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode = RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, + int samplesPerCall = 0) = 0; + + virtual int setPublishAudioFrameParameters(size_t numberOfChannels, + uint32_t sampleRateHz, + int samplesPerCall = 0) = 0; + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onMixedAudioFrame + * "onMixedAudioFrame" callback. + * + * @param numberOfChannels The number of channels of the audio frame in the `onMixedAudioFrame` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onMixedAudioFrame` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMixedAudioFrameParameters(size_t numberOfChannels, + uint32_t sampleRateHz, + int samplesPerCall = 0) = 0; + + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onEarMonitoringAudioFrame + * "onEarMonitoringAudioFrame" callback. + * @param enabled Determines whether to enable ear monitoring audio frame observer. + * - true: Enable ear monitoring audio frame observer. + * - false: Disable ear monitoring audio frame observer. + * @param numberOfChannels The number of audio channels of the audio frame in the `onEarMonitoringAudioFrame` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onEarMonitoringAudioFrame` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * @param mode Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall The number of samples of the audio frame. * + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEarMonitoringAudioFrameParameters(bool enabled, + size_t numberOfChannels, + uint32_t sampleRateHz, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode = RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, + int samplesPerCall = 0) = 0; + + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing + * "onPlaybackAudioFrameBeforeMixing" callback. + * + * @param numberOfChannels The number of channels of the audio frame in the `onPlaybackAudioFrameBeforeMixing` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onPlaybackAudioFrameBeforeMixing` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackAudioFrameBeforeMixingParameters(size_t numberOfChannels, + uint32_t sampleRateHz) = 0; + + /** + * Registers an audio frame observer. + * + * You need to implement the `IAudioFrameObserverBase` class in this method, and register the following callbacks + * according to your scenario: + * - \ref agora::media::IAudioFrameObserverBase::onRecordAudioFrame "onRecordAudioFrame": Occurs when the SDK receives the audio data captured by the local recording device. + * - \ref agora::media::IAudioFrameObserverBase::onPlaybackAudioFrame "onPlaybackAudioFrame": Occurs when the SDK receives the remote audio data for playback. + * - \ref agora::media::IAudioFrameObserverBase::onPlaybackAudioFrameBeforeMixing "onPlaybackAudioFrameBeforeMixing": Occurs when the SDK receives the remote audio data of a specified + * remote user before mixing. + * - \ref agora::media::IAudioFrameObserverBase::onMixedAudioFrame "onMixedAudioFrame": Occurs when the SDK receives the mixed data of recorded and playback audio. + * + * @param observer A pointer to the audio frame observer: \ref agora::media::IAudioFrameObserverBase "IAudioFrameObserverBase". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(agora::media::IAudioFrameObserverBase * observer) = 0; + /** + * Releases the audio frame observer. + * + * @param observer The pointer to the audio frame observer: \ref agora::media::IAudioFrameObserverBase "IAudioFrameObserverBase". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioFrameObserver(agora::media::IAudioFrameObserverBase * observer) = 0; + + /** + * Enable the audio spectrum monitor. + * + * @param intervalInMS Sets the time interval(ms) between two consecutive audio spectrum callback. + * The default value is 100. This param should be larger than 10. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudioSpectrumMonitor(int intervalInMS = 100) = 0; + /** + * Disalbe the audio spectrum monitor. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableAudioSpectrumMonitor() = 0; + + /** + * Registers an audio spectrum observer. + * + * You need to implement the `IAudioSpectrumObserver` class in this method, and register the following callbacks + * according to your scenario: + * - \ref agora::media::IAudioSpectrumObserver::onAudioSpectrumComputed "onAudioSpectrumComputed": Occurs when + * the SDK receives the audio data and at set intervals. + * + * @param observer A pointer to the audio spectrum observer: \ref agora::media::IAudioSpectrumObserver + * "IAudioSpectrumObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioSpectrumObserver(agora::media::IAudioSpectrumObserver * observer, void (*safeDeleter)(agora::media::IAudioSpectrumObserver*)) = 0; + /** + * Releases the audio spectrum observer. + * + * @param observer The pointer to the audio spectrum observer: \ref agora::media::IAudioSpectrumObserver + * "IAudioSpectrumObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioSpectrumObserver(agora::media::IAudioSpectrumObserver * observer) = 0; + + /** + * Registers an \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * + * You need to implement the `IVideoEncodedFrameObserver` class in this method. Once you successfully register + * the local encoded frame observer, the SDK triggers the \ref agora::media::IVideoEncodedFrameObserver::onEncodedVideoFrameReceived + * "onEncodedVideoFrameReceived" callback when it receives the encoded video image. + * + * @param observer The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerLocalVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0; + /** + * Releases the \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * @param observer The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterLocalVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0; + /** + * Force trigger to intra-frame the next frame. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int forceNextIntraFrame() = 0; + /** + * Registers an \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * + * You need to implement the `IVideoEncodedFrameObserver` class in this method. Once you successfully register + * the encoded frame observer, the SDK triggers the \ref agora::media::IVideoEncodedFrameObserver::onEncodedVideoFrameReceived + * "onEncodedVideoFrameReceived" callback when it receives the encoded video image. + * + * @param observer The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0; + /** + * Releases the \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * @param observer The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0; + + /** + * Registers an \ref agora::rtc::IVideoFrameObserver2 "IVideoFrameObserver2" object. + * + * You need to implement the `IVideoFrameObserver2` class in this method. Once you successfully register + * the video frame observer, the SDK triggers the \ref agora::media::IVideoFrameObserver2::onFrame + * "onFrame" callback when it receives the video image. + * + * @param observer The pointer to the `IVideoFrameObserver2` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoFrameObserver(IVideoFrameObserver2* observer) = 0; + /** + * Releases the \ref agora::rtc::IVideoFrameObserver2 "IVideoFrameObserver2" object. + * @param observer The pointer to the `IVideoFrameObserver2` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterVideoFrameObserver(IVideoFrameObserver2* observer) = 0; + + virtual int setVideoSubscriptionOptions(user_id_t userId, + const VideoSubscriptionOptions& options) = 0; + + /** + * Sets the blocklist of subscribe remote stream audio. + * + * @param userList The id list of users who do not subscribe to audio. + * @param userNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's audio will not be subscribed, + * even if subscribeAudio(uid) and subscribeAllAudio(true) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioBlocklist(user_id_t* userList, int userNumber) = 0; + + /** + * Sets the allowlist of subscribe remote stream audio. + * + * @param userList The id list of users who do subscribe to audio. + * @param userNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's audio will be subscribed, + * even if unsubscribeAudio(uid) and unsubscribeAllAudio(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to audio. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioAllowlist(user_id_t* userList, int userNumber) = 0; + + /** + * Sets the blocklist of subscribe remote stream video. + * + * @param userList The id list of users who do not subscribe to video. + * @param userNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's video will not be subscribed, + * even if subscribeVideo(uid) and subscribeAllVideo(true) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoBlocklist(user_id_t* userList, int userNumber) = 0; + + /** + * Sets the allowlist of subscribe remote stream video. + * + * @param userList The id list of users who do subscribe to video. + * @param userNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's video will be subscribed, + * even if unsubscribeVideo(uid) and unsubscribeAllVideo(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoAllowlist(user_id_t* userList, int userNumber) = 0; + + /** + * Subscribes to the video of a specified remote user in the channel. + * + * @param userId The ID of the user whose video you want to subscribe to. + * @param subscriptionOptions The reference to the video subscription options: \ref agora::rtc::VideoSubscriptionOptions "VideoSubscriptionOptions". + * For example, subscribing to encoded video data only or subscribing to low-stream video. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if `userId` is invalid. + */ + virtual int subscribeVideo(user_id_t userId, + const VideoSubscriptionOptions &subscriptionOptions) = 0; + + /** + * Subscribes to the video of all remote users in the channel. + * + * This method also automatically subscribes to the video of any subsequent remote user. + * + * @param subscriptionOptions The reference to the video subscription options: \ref agora::rtc::VideoSubscriptionOptions "VideoSubscriptionOptions". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int subscribeAllVideo(const VideoSubscriptionOptions &subscriptionOptions) = 0; + + /** + * Stops subscribing to the video of a specified remote user in the channel. + * + * @param userId The ID of the user whose video you want to stop subscribing to. + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if `userId` is invalid. + */ + virtual int unsubscribeVideo(user_id_t userId) = 0; + + /** + * Stops subscribing to the video of all remote users in the channel. + * + * This method automatically stops subscribing to the video of any subsequent user, unless you explicitly + * call \ref subscribeVideo "subscribeVideo" or \ref subscribeAllVideo "subscribeAllVideo". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unsubscribeAllVideo() = 0; + + /** + * Sets the time interval and the volume smoothing factor of the \ref agora::rtc::ILocalUserObserver::onAudioVolumeIndication "onAudioVolumeIndication" callback. + * + * By default, the SDK triggers the `onAudioVolumeIndication` + * callback once every 500 ms, with a smoothing factor of 3. + * + * @param intervalInMS Sets the time interval(ms) between two consecutive volume indications. The default + * value is 500. + * - ≤ 10: Disables the volume indication. + * - > 10: The time interval (ms) between two consecutive callbacks. + * + * @param smooth The smoothing factor that sets the sensitivity of the audio volume indicator. + * The value range is [0,10]. The greater the value, the more sensitive the indicator.The default value is 3. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if `intervalInMS` or `smooth` is out of range. + */ + virtual int setAudioVolumeIndicationParameters(int intervalInMS, int smooth, bool reportVad) = 0; + + /** + * Registers a local user observer object. + * + * You need to implement the \ref agora::rtc::ILocalUserObserver "ILocalUserObserver" class in this method. Once registered, the + * ILocalUserObserver receives events of the \ref agora::rtc::ILocalUser "ILocalUser" object. + * + * @param observer The pointer to the `ILocalUserObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerLocalUserObserver( + ILocalUserObserver* observer, + void(*safeDeleter)(ILocalUserObserver*) = NULL) = 0; + + /** + * Releases the \ref agora::rtc::ILocalUserObserver "ILocalUserObserver" object. + * + * @param observer The pointer to the `ILocalUserObserver` object that you want to release. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterLocalUserObserver(ILocalUserObserver* observer) = 0; + + /** + * Gets the media control packet sender. + * + * @return + * - The pointer to the media control packet sender IMediaControlPacketSender: Success. + * - A null pointer: Failure. + */ + virtual IMediaControlPacketSender* getMediaControlPacketSender() = 0; + + /** + * Registers a media control packet receiver. + * + * You need to implement the `IMediaControlPacketReceiver` class in this method. Once you successfully + * register the media control packet receiver, the SDK triggers the \ref agora::rtc::IMediaControlPacketReceiver::onMediaControlPacketReceived "onMediaControlPacketReceived" + * callback when it receives the media control packet. + * + * @param ctrlPacketReceiver The pointer to the IMediaControlPacketReceiver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerMediaControlPacketReceiver(IMediaControlPacketReceiver* ctrlPacketReceiver) = 0; + + /** + * Releases the media control packet receiver. + * @param ctrlPacketReceiver The pointer to the `IMediaControlPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterMediaControlPacketReceiver(IMediaControlPacketReceiver* ctrlPacketReceiver) = 0; + + /** + * Sends intra-frame request to the broadcaster with a specified uid. + * + * The local user receives the `onIntraRequestReceived` callback when the broadcaster receives the request. + * + * @param userId The user ID of the target broadcaster . + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendIntraRequest(user_id_t userId) = 0; + + /** + * Set local audio filterable by topn + * + * The local user receives the `onIntraRequestReceived` callback when the broadcaster receives the request. + * + * @param userId The user ID of the target broadcaster . + * @return + * - 0: Success. + * - < 0: Failure. + */ + + virtual int setAudioFilterable(bool filterable) = 0; + +/** + * Enable / Disable specified audio filter + * @param userId The ID of the remote user + * @param id id of the filter + * @param enable enable / disable the filter with given id + * @return + * - 0: success + * - <0: failure + */ + virtual int enableRemoteAudioTrackFilter(user_id_t userId, const char* id, bool enable) = 0; + + /** + * set the properties of the specified audio filter + * @param userId The ID of the remote user + * @param id id of the filter + * @param key key of the property + * @param jsonValue json str value of the property + * @return + * - 0: success + * - <0: failure + */ + virtual int setRemoteAudioTrackFilterProperty(user_id_t userId, const char* id, const char* key, const char* jsonValue) = 0; + + /** + * get the properties of the specified audio filter + * @param userId The ID of the remote user + * @param id id of the filter + * @param key key of the property + * @param jsonValue json str value of the property + * @param bufSize max length of the json value buffer + * @return + * - 0: success + * - <0: failure + */ + virtual int getRemoteAudioTrackFilterProperty(user_id_t userId, const char* id, const char* key, char* jsonValue, size_t bufSize) = 0; + /** + * set the profile of audio noise suppression module + * @param NsEnable enable ns or not + * @param NsMode type of ns + * @param NsLevel level of the suppression + * @param NsDelay algorithm delay + * @return + * - 0: success + * - <0: failure + */ + virtual int SetAudioNsMode(bool NsEnable, NS_MODE NsMode, NS_LEVEL NsLevel, + NS_DELAY NsDelay) = 0; + + /** + * enable the mix track that mix special track + * + * @param track The special mixed audio track. + * @param enalble Action of start mixing this user's audio. + * @param MixLocal Mix publish stream. + * @param MixRemote Mix remote stream. + * @return + * - 0: success + * - <0: failure + */ + virtual int EnableLocalMixedAudioTrack(agora_refptr& track, bool enable, bool MixLocal, bool MixRemote) = 0; + + /** + * @technical preview + */ + virtual int sendAudioMetadata(const char* metadata, size_t length) = 0; +}; + + +/** + * The definition of the AudioVolumeInformation struct. + */ +struct AudioVolumeInformation { + /** + * User ID of the speaker. + */ + user_id_t userId; + + /** + * The volume of the speaker that ranges from 0 to 255. + */ + unsigned int volume; + + /* + * The activity status of remote users + */ + unsigned int vad; + + /** + * Voice pitch frequency in Hz + */ + double voicePitch; + + AudioVolumeInformation() : userId(NULL), volume(0), vad(0), voicePitch(0.0) {} +}; + +/** + * The `ILocalUserObserver` class. + */ +class ILocalUserObserver { + public: + virtual ~ILocalUserObserver() {} + + virtual void onAudioTrackPublishStart(agora_refptr audioTrack) = 0; + /** + * Occurs when the first packet of the local audio track is sent, indicating that the local audio track + * is successfully published. + * + * @param audioTrack The pointer to \ref agora::rtc::ILocalAudioTrack "ILocalAudioTrack". + */ + virtual void onAudioTrackPublishSuccess(agora_refptr audioTrack) = 0; + + virtual void onAudioTrackUnpublished(agora_refptr audioTrack) = 0; + + /** + * Occurs when a local audio track fails to be published. + * + * @param audioTrack The pointer to `ILocalAudioTrack`. + * @param error The error information: #ERROR_CODE_TYPE. + */ + virtual void onAudioTrackPublicationFailure(agora_refptr audioTrack, + ERROR_CODE_TYPE error) = 0; + + /** + * Reports the statistics of a local audio track. + * + * @param stats The reference to the statistics of the local audio track. + */ + virtual void onLocalAudioTrackStatistics(const LocalAudioStats& stats) = 0; + /** + * Reports the statistics of a remote audio track. + * + * @param audioTrack The pointer to `IRemoteAudioTrack`. + * @param stats The statistics of the remote audio track. + */ + virtual void onRemoteAudioTrackStatistics(agora_refptr audioTrack, const RemoteAudioTrackStats& stats) = 0; + /** + * Occurs when the first remote audio frame is received. + * + * This callback indicates that the local user has subscribed to a specified remote audio track, and the first + * frame of this audio track has been received. + * + * @param userId The ID of the remote user whose audio frame is received. + * @param audioTrack The pointer to `IRemoteAudioTrack`. + */ + virtual void onUserAudioTrackSubscribed(user_id_t userId, + agora_refptr audioTrack) = 0; + + /** + * Occurs when the state of a remote audio track changes. + * + * @param userId The ID of the remote user whose audio track state has changed. + * @param audioTrack The pointer to `IRemoteAudioTrack`. + * @param state The current state of the audio track. + * @param reason The reason for the state change. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onUserAudioTrackStateChanged(user_id_t userId, + agora_refptr audioTrack, + REMOTE_AUDIO_STATE state, + REMOTE_AUDIO_STATE_REASON reason, + int elapsed) = 0; + + virtual void onVideoTrackPublishStart(agora_refptr videoTrack) = 0; + /** + * Occurs when the first packet of a local video track is sent, indicating that the local video track + * is successfully published. + * @param videoTrack The pointer to `ILocalVideoTrack`. + */ + virtual void onVideoTrackPublishSuccess(agora_refptr videoTrack) = 0; + + /** + * Occurs when a local video track fails to be published. + * + * @param videoTrack The pointer to `ILocalVideoTrack`. + * @param error The error information: #ERROR_CODE_TYPE. + */ + virtual void onVideoTrackPublicationFailure(agora_refptr videoTrack, + ERROR_CODE_TYPE error) = 0; + + virtual void onVideoTrackUnpublished(agora_refptr videoTrack) = 0; + /** + * Occurs when the state of a local video track changes. + * @note + * When you receive error from this callback, the corresponding track is in error state. + * To make the track recover from error state, we highly recommend that you disable the track and + * try re-enabling it again. + * + * @param videoTrack The pointer to `ILocalVideoTrack`. + * @param state The state of the local video track. + * @param errorCode The error information. + */ + virtual void onLocalVideoTrackStateChanged(agora_refptr videoTrack, + LOCAL_VIDEO_STREAM_STATE state, + LOCAL_VIDEO_STREAM_ERROR errorCode) = 0; + + /** + * Reports the statistics of a local video track. + * + * @param videoTrack The pointer to `ILocalVideoTrack`. + * @param stats The statistics of the local video track. + */ + virtual void onLocalVideoTrackStatistics(agora_refptr videoTrack, + const LocalVideoTrackStats& stats) = 0; + + /** + * Occurs when the first remote video frame is received. + * + * This callback indicates that the local user has subscribed to a specified remote video track, and + * the first frame of this video track has been received. + * + * @param userId The ID of the remote user whose video frame is received. + * @param trackInfo The information of the remote video track. + * @param videoTrack The pointer to `IRemoteVideoTrack`. + */ + virtual void onUserVideoTrackSubscribed(user_id_t userId, VideoTrackInfo trackInfo, + agora_refptr videoTrack) = 0; + + /** + * Occurs when the state of a remote video track changes. + * + * @param userId the ID of the remote user whose video track state has changed. + * @param videoTrack The pointer to `IRemoteVideoTrack`. + * @param state The current state of the video track. + * @param reason The reason for the state change. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onUserVideoTrackStateChanged(user_id_t userId, + agora_refptr videoTrack, + REMOTE_VIDEO_STATE state, + REMOTE_VIDEO_STATE_REASON reason, + int elapsed) = 0; + + /** + * Occurs when the first remote video frame is rendered. + * + * @param userId the ID of the remote user. + * @param width Width (px) of the video frame. + * @param height Height (px) of the video stream. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onFirstRemoteVideoFrameRendered(user_id_t userId, int width, + int height, int elapsed) = 0; + + + /** + * Reports the statistics of a remote video track. + * + * @param videoTrack The pointer to `IRemoteVideoTrack`. + * @param stats The statistics of the remote video track. + */ + virtual void onRemoteVideoTrackStatistics(agora_refptr videoTrack, + const RemoteVideoTrackStats& stats) = 0; + + /** + * Reports which users are speaking, the speakers' volumes, and whether the local user is speaking. + * + * This callback reports the IDs and volumes of the loudest speakers at the moment in the channel, + * and whether the local user is speaking. + * + * You can set the time interval of this callback using \ref ILocalUser::setAudioVolumeIndicationParameters "setAudioVolumeIndicationParameters". + * + * The SDK triggers two `onAudioVolumeIndication` callbacks at one time, one reporting the + * volume information of the local user and the other reporting the volume information of all remote users. + * + * @note + * - To detect whether the local user is speaking, set `report_vad` in `enableAudioVolumeIndication` to `true`. + * + * @param speakers The pointer to \ref agora::rtc::AudioVolumeInformation "AudioVolumeInformation", which is an array containing the user ID and volume information for each speaker. + * - In the local user's callback, this array contains the following members: + * - `uid`, which is always `0` + * - `volume`, which reports the sum of the voice volume and the audio-mixing volume of the local user + * - `vad`, which reports whether the local user is speaking + * - In the remote users' callback, this array contains the following members: + * - `uid`, which is the UID of each remote speaker + * - `volume`, which reports the sum of the voice volume and the audio-mixing volume of each remote speaker. + * - `vad`, which is always `0` + * An empty `speakers` array in the callback indicates that no remote user is speaking at the moment. + * @param speakerNumber The total number of the speakers. + * @param totalVolume The total volume after audio mixing. The value ranges between 0 (lowest volume) and 255 (highest volume). + * - In the local user's callback, `totalVolume` is the sum of the voice volume and the audio-mixing volume of the local user. + * - In the remote speakers' callback, `totalVolume` is the sum of the voice volume and the audio-mixing volume of all remote speakers. + */ + virtual void onAudioVolumeIndication(const AudioVolumeInformation* speakers, unsigned int speakerNumber, + int totalVolume) = 0; + + /** + * Occurs when an active speaker is detected. + * + * You can add relative functions on your app, for example, the active speaker, once detected, + * will have the portrait zoomed in. + * + * @note + * - The active speaker means the user ID of the speaker who speaks at the highest volume during a + * certain period of time. + * + * @param userId The ID of the active speaker. A `userId` of `0` means the local user. + */ + virtual void onActiveSpeaker(user_id_t userId) = 0; + + /** + * Occurs when the audio subscribe state changed. + * + * @param channel The channel name of user joined. + * @param userId The remote string user ID that is subscribed to. + * @param oldState The old state of the audio stream subscribe : #STREAM_SUBSCRIBE_STATE. + * @param newState The new state of the audio stream subscribe : #STREAM_SUBSCRIBE_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ + virtual void onAudioSubscribeStateChanged(const char* channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) = 0; + + /** + * Occurs when the video subscribe state changed. + * + * @param channel The channel name of user joined. + * @param userId The remote string user ID that is subscribed to. + * @param oldState The old state of the video stream subscribe : #STREAM_SUBSCRIBE_STATE. + * @param newState The new state of the video stream subscribe : #STREAM_SUBSCRIBE_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ + virtual void onVideoSubscribeStateChanged(const char* channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) = 0; + + /** + * Occurs when the audio publish state changed. + * + * @param channel The channel name of user joined. + * @param oldState The old state of the audio stream publish : #STREAM_PUBLISH_STATE. + * @param newState The new state of the audio stream publish : #STREAM_PUBLISH_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ + virtual void onAudioPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) = 0; + + /** + * Occurs when the video publish state changed. + * + * @param channel The channel name of user joined. + * @param oldState The old state of the video stream publish : #STREAM_PUBLISH_STATE. + * @param newState The new state of the video stream publish : #STREAM_PUBLISH_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ + virtual void onVideoPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) = 0; + + /** Occurs when the first remote audio frame is received. + * + * @param userId ID of the remote user. + * @param isFallbackOrRecover Whether the remotely subscribed media stream + * falls back to audio-only or switches back to the video: + * - true: The remotely subscribed media stream falls back to audio-only + * due to poor network conditions. + * - false: The remotely subscribed media stream switches back to the + * video stream after the network conditions improved. + **/ + virtual void onRemoteSubscribeFallbackToAudioOnly(user_id_t userId, bool isFallbackOrRecover) { + (void)userId; + (void)isFallbackOrRecover; + } + + /** Occurs when the first remote audio frame is received. + * + * @param userId ID of the remote user. + * @param elapsed The time (ms) since the user connects to an Agora channel. + **/ + virtual void onFirstRemoteAudioFrame(user_id_t userId, int elapsed) = 0; + + /** + * Occurs when the SDK decodes the first remote audio frame for playback. + * + * @param uid User ID of the remote user sending the audio stream. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onFirstRemoteAudioDecoded(user_id_t userId, int elapsed) = 0; + + /** + * Occurs when the first remote video frame is rendered. + * The SDK triggers this callback when the first frame of the remote video is displayed in the user's video window. The application can get the time elapsed from a user joining the channel until the first video frame is displayed. + * + * @param userId ID of the remote user. + * @param width Width (px) of the video frame. + * @param height Height (px) of the video stream. + * @param elapsed Time elapsed (ms) from the local user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoFrame(user_id_t userId, int width, int height, int elapsed) = 0; + + /** + * Occurs when the SDK decodes the first remote video frame for playback. + * + * @param userId ID of the remote user. + * @param width Width (px) of the video stream. + * @param height Height (px) of the video stream. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onFirstRemoteVideoDecoded(user_id_t userId, int width, int height, int elapsed) = 0; + + /** + * The local or remote video size or rotation changed. + * + * @param uid User ID of the user whose video size or rotation has changed. + * @param width Width (pixels) of the video stream. + * @param height Height (pixels) of the video stream. + * @param rotation Rotation [0 to 360). + */ + virtual void onVideoSizeChanged(user_id_t userId, int width, int height, int rotation) = 0; + + /** + * @technical preview + */ + virtual void onAudioMetadataReceived(user_id_t userId, const char* metadata, size_t length) { + (void)userId; + (void)metadata; + (void)length; + } + + /** + * The media information of a specified user. + */ + enum USER_MEDIA_INFO { + /** + * 0: The user has muted the audio. + */ + USER_MEDIA_INFO_MUTE_AUDIO = 0, + /** + * 1: The user has muted the video. + */ + USER_MEDIA_INFO_MUTE_VIDEO = 1, + /** + * 4: The user has enabled the video, which includes video capturing and encoding. + */ + USER_MEDIA_INFO_ENABLE_VIDEO = 4, + /** + * 8: The user has enabled the local video capturing. + */ + USER_MEDIA_INFO_ENABLE_LOCAL_VIDEO = 8, + }; + + /** + * Occurs when the user media information is updated. + * + * + * @param userId The ID of the user. + * @param msg The media information of the user. See #USER_MEDIA_INFO. + * @param val Whether the user is muted. + */ + virtual void onUserInfoUpdated(user_id_t userId, USER_MEDIA_INFO msg, bool val) { + (void)userId; + (void)msg; + (void)val; + } + + /** + * Occurs when the intra request is received from a remote user. + * + * The method notifies the local user to encode a key frame. + * + */ + virtual void onIntraRequestReceived() {} + + /** + * datastream from this connection. + */ + virtual void onStreamMessage(user_id_t userId, int streamId, const char* data, size_t length) {} + + /** + * Occurs when the remote user state is updated. + * @param uid The uid of the remote user. + * @param state The remote user state.Just & #REMOTE_USER_STATE + */ + virtual void onUserStateChanged(user_id_t userId, uint32_t state){} + + virtual void onVideoRenderingTracingResult(user_id_t user_id, MEDIA_TRACE_EVENT currentState, VideoRenderingTracingInfo tracingInfo) {} +}; + +class IVideoFrameObserver2 { + public: + /** + * Occurs each time the player receives a video frame. + * + * After registering the video frame observer, + * the callback occurs each time receives a video frame to report the detailed information of the video frame. + * @param channelId The channel name + * @param remoteUid ID of the remote user. + * @param frame The detailed information of the video frame. See {@link VideoFrame}. + */ + virtual void onFrame(const char* channelId, user_id_t remoteUid, const media::base::VideoFrame* frame) = 0; + + virtual ~IVideoFrameObserver2() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraMediaNode.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraMediaNode.h new file mode 100644 index 0000000..30a3e6a --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraMediaNode.h @@ -0,0 +1,893 @@ +#pragma once +#include "AgoraRefPtr.h" +#include "AgoraBase.h" +#include "IAgoraLog.h" +#include "NGIAgoraVideoFrame.h" +#include "AgoraExtensionVersion.h" + +#ifndef OPTIONAL_PROCESSRESULT_SPECIFIER +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_PROCESSRESULT_SPECIFIER ProcessResult:: +#else +#define OPTIONAL_PROCESSRESULT_SPECIFIER +#endif +#endif + +namespace webrtc { +struct AudioFrameHandleInfo; +} // namespace webrtc + +namespace agora { +namespace rtc { +/** + * The `IAudioFilterBase` class is the base class for audio filters. You can use this class to implement your own filter + * and add it to an audio track. + */ +class IAudioFilterBase : public RefCountInterface { + public: + // Return false if filter decide to drop the frame. + // Implementation should not change samples_per_channel_/sample_rate_hz_/num_channels_ + // Implementation should just adapt data of audio frame. + /** + * Adapts the audio frame. + * @param inAudioFrame The reference to the audio frame that you want to adapt. + * @param adaptedFrame The reference to the adapted audio frame. + * @return + * - `true`: Success. + * - `false`: Failure. For example, the IAudiofilter object drops the audio frame. + */ + virtual bool adaptAudioFrame(const media::base::AudioPcmFrame& inAudioFrame, + media::base::AudioPcmFrame& adaptedFrame) = 0; + + /** + * Get the sample rate supported by the audio filter, the framework will resample + * the audio data and then pass it to the audio filter. + * @return + * - 0: Audio data will not be resampled. + * - > 0: Audio data will be resampled to this sample rate. + */ + virtual int getPreferredSampleRate() = 0; + + /** + * Get the channel number supported by the audio filter, the framework will resample + * the audio data and then pass it to the audio filter. If the user does not + * overwrite, resampling will not be done by default. + * @return + * - 0: Audio data will not be resampled. + * - > 0: Audio data will be resampled to this sample rate. + */ + virtual int getPreferredChannelNumbers() = 0; + + protected: + ~IAudioFilterBase() {} +}; + +/** + * The `IAudioFilter` class. + * + * This class is the intermediate node for audio, which reads audio frames from the underlying + * pipeline and writes audio frames back after adaptation. + */ +class IAudioFilter : public IAudioFilterBase { + public: + /** + * Enables or disables the audio filter. + * @param enable Whether to enable the audio filter: + * - `true`: Enable the audio filter. + * - `false`: Do not enable the audio filter. + */ + virtual void setEnabled(bool enable) = 0; + /** + * Checks whether the audio filter is enabled. + * @return + * - `true`: The audio filter is enabled. + * - `false`: The audio filter is not enabled. + */ + virtual bool isEnabled() const = 0; + /** + * Sets a private property in the `IAudioFilter` class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int setProperty(const char* key, const void* buf, int buf_size) = 0; + /** + * Gets a private property in the `IAudioFilter` class. + * + * @param name The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int getProperty(const char* key, void* buf, int buf_size) const = 0; + /** + * Gets the name of the `IAudioFilter` class. + * + * @return + * - The name of the audio filter, if the method call succeeds. + * - An empty string, if the method call fails. + */ + virtual const char * getName() const = 0; + + /** + * Get the sample rate supported by the audio filter, the framework will resample + * the audio data and then pass it to the audio filter. If the user does not + * overwrite, resampling will not be done by default. + * @return + * - 0: Audio data will not be resampled. + * - > 0: Audio data will be resampled to this sample rate. + */ + virtual int getPreferredSampleRate() { return 0; }; + + /** + * Get the channel number supported by the audio filter, the framework will resample + * the audio data and then pass it to the audio filter. If the user does not + * overwrite, resampling will not be done by default. + * @return + * - 0: Audio data will not be resampled. + * - > 0: Audio data will be resampled to this sample rate. + */ + virtual int getPreferredChannelNumbers() { return 0; }; + + protected: + ~IAudioFilter() {} +}; + +class IAudioFilterV2 : public IAudioFilter { +public: + class Control : public RefCountInterface { + public: + /** + * @brief Post an event and notify the end users. + * @param key '\0' ended string that describes the key of the event + * @param value '\0' ended string that describes the value of the event + */ + virtual int postEvent(const char* key, const char* value) = 0; + /** + * @brief print log to the SDK. + * @param level Log level @ref agora::commons::LOG_LEVEL + * @param format log formatter string + * @param ... variadic arguments + */ + virtual void printLog(commons::LOG_LEVEL level, const char* format, ...) = 0; + }; +public: + /** + * @brief AgoraSDK set IAudioFilterV2::Control to filter + * @param control IAudioFilterV2::Control + */ + virtual void setExtensionControl(agora::agora_refptr control) = 0; +}; + +/** + * The `IVideoFilterBase` class is the base class for video filters. You can use this class to implement your own filter + * and add the filter to a video track. + */ +class IVideoFilterBase : public RefCountInterface { + public: + /** + * Adapts the video frame. + * + * @param capturedFrame The reference to the captured video frame that you want to adapt. + * @param adaptedFrame The reference to the adapted video frame. + * + * @return + * - `true`: Success. + * - `false`: Failure, if, for example, the `IVideofilter` object drops the video frame. + */ + virtual bool adaptVideoFrame(const media::base::VideoFrame& capturedFrame, + media::base::VideoFrame& adaptedFrame) = 0; +}; + +// TODO(Bob): private inherit? +/** + * The IVideoFilter class. + * + * This class is the intermediate node for video, which contains both the video source and the video + * sink. It reads video frames from the underlying video pipeline and writes video frames back after + * adaptation. + */ +class IVideoFilter : public IVideoFilterBase { + public: + /** + * Enables or disables the video filter. + * @param enable Whether to enable the video filter: + * - `true`: (Default) Enable the video filter. + * - `false`: Do not enable the video filter. If the filter is disabled, frames will be passed without + * adaption. + */ + virtual void setEnabled(bool enable) {} + /** + * Checks whether the video filter is enabled. + * @return + * - `true`: The video filter is enabled. + * - `false`: The video filter is not enabled. + */ + virtual bool isEnabled() { return true; } + /** + * Sets a private property in the `IVideoFilter` class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int setProperty(const char* key, const void* buf, size_t buf_size) { return -1; } + /** + * Gets a private property in the IVideoFilter class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int getProperty(const char* key, void* buf, size_t buf_size) { return -1; } + /** + * This function is invoked right before data stream starts. + * Custom filter can override this function for initialization. + * @return + * - `true`: The initialization succeeds. + * - `false`: The initialization fails. + */ + virtual bool onDataStreamWillStart() { return true; } + /** + * This function is invoked right before data stream stops. + * Custom filter can override this function for deinitialization. + */ + virtual void onDataStreamWillStop() { } + /** + * This function indicates if the filter is for internal use. + * @note Do not override this function. + * @return + * - `true`: The filter is implemented by external users. + * - `false`: The filter is implemented by internal users. + */ + virtual bool isExternal() { return true; } + /** + * This function indicates if the filter is implemented by third-party providers. + * @note Do not override this function. + * @return + * - `true`: The filter is implemented by third-party providers. + * - `false`: otherwise. + */ + virtual bool isExtensionFilter() { return false; } +}; + +/** + * The IExtensionVideoFilter class. + * + * This class defines the interfaces that a external video extension provider can implement + * so as to be loaded by SDK as an "3rd party extension" for video pre- or post- processing. + */ +class IExtensionVideoFilter : public IVideoFilter { + public: + enum ProcessMode { + kSync, // Indicates that video frame data will be exchanged via "adaptVideoFrame" + kAsync, // Indicates that video frame data will be exchanged via "pendVideoFrame" & "deliverVideoFrame" + }; + + enum ProcessResult { + kSuccess, // Video frame data is successfully processed + kBypass, // Video frame data should bypass the current filter and flow to its successsors + kDrop, // Video Frame data should be discarded + }; + + /** + * The IExtensionVideoFilter::Control class. + * + * This class defines the interfaces that the extension filter can leverage to interact with the SDK. + * The "IExtensionVideoFilter::Control" object will be passed to the filter when SDK invoke the filter's + * "start" interface. + */ + class Control : public RefCountInterface { + public: + /** + * @brief Filter can invoke this function to deliver the processed frame to SDK if the Process Mode is + * designated as "kAsync" by the filter via "getProcessMode". + * @param frame the processed video frame + * @return see @ref ProcessResult + */ + virtual ProcessResult deliverVideoFrame(agora::agora_refptr frame) = 0; + /** + * @brief Filter can invoke this function to get the IVideoFrameMemoryPool object if a new IVideoFrame + * data object is needed. + */ + virtual agora::agora_refptr getMemoryPool() = 0; + /** + * @brief Post an event and notify the end users. + * @param key '\0' ended string that describes the key of the event + * @param value '\0' ended string that describes the value of the event + */ + virtual int postEvent(const char* key, const char* value) = 0; + /** + * @brief print log to the SDK. + * @param level Log level @ref agora::commons::LOG_LEVEL + * @param format log formatter string + * @param ... variadic arguments + */ + virtual void printLog(commons::LOG_LEVEL level, const char* format, ...) = 0; + /** + * @brief Ask SDK to disable the current filter if a fatal error is detected + * @param error error code + * @param msg error message + */ + virtual void disableMe(int error, const char* msg) = 0; + }; + + /** + * @brief SDK will invoke this API first to get the filter's requested process mode @ref ProcessMode and threading model + * @param mode [out] filter assign its desired the process mode @ref ProcessMode + * @param independent_thread [out] filter assign its desired threading model. When this boolean is set "true", an + * indepent thread will be assigned to the current filter and all invocations from SDK afterwards are ensured to + * happen on that fixed thread. If this boolean flag is set "false", the filter will re-use the thread of the SDK's + * data path. All invocations from SDK afterwards are also ensured to be on the same thread, however that thread is shared. + * @note If the filter implementation is not thread sensitive, we recommend to set the boolean to "false" to reduce thread context + * switching. + */ + virtual void getProcessMode(ProcessMode& mode, bool& independent_thread) = 0; + /** + * @brief SDK will invoke this API before feeding video frame data to the filter. Filter can perform its initialization/preparation job + * in this step. + * + * @param control object to @ref IExtensionFilter::Control that pass to the filter which can be used for future interaction with the SDK + * @return error code + */ + virtual int start(agora::agora_refptr control) = 0; + /** + * @brief SDK will invoke this API when the data stream is about to stop. Filter can perform cleanup jobs in this step + * + * @return error code + */ + virtual int stop() = 0; + /** + * @brief SDK will invoke this API every time before sending data to the filter. Filter can desigante the type @ref VideoFrameInfo::Type + * and format @ref MemPixelBuffer::Format of the next frame. SDK will then try to perform type / format conversion before sending data to + * the filter. + * + * @param type requested type of the next frame + * @param format requested formant of the next frame + */ + virtual void getVideoFormatWanted(VideoFrameData::Type& type, RawPixelBuffer::Format& format) = 0; + /** + * @brief SDK will invoke this API to send video frame to the filter if process mode is "Async". Filter invokes control's "deliverFrame" + * to send back the frame after processing. + * + * @param frame frame pending for processing + */ + virtual ProcessResult pendVideoFrame(agora::agora_refptr frame) { + return OPTIONAL_PROCESSRESULT_SPECIFIER kBypass; + } + /** + * @brief SDK will invoke this API to send video frame to the filter if process mode is "Sync". + * + * @param frame frame pending for processing + */ + virtual ProcessResult adaptVideoFrame(agora::agora_refptr in, agora::agora_refptr& out) { + return OPTIONAL_PROCESSRESULT_SPECIFIER kBypass; + } + /* Occurs each time needs to get rotation apply. + * + * @return Determines whether to rotate. + * - true: need to rotate. + * - false: no rotate. + */ + virtual bool getRotationApplied() { return false; } + + // NOTE: The following two interfaces should never be overriden! + virtual bool isExtensionFilter() { return true; } + virtual bool adaptVideoFrame( + const media::base::VideoFrame& capturedFrame, + media::base::VideoFrame& adaptedFrame) { + return -ERR_NOT_SUPPORTED; + } +}; + +/** + * The `IVideoSinkBase` class is the base class for the custom video sink. + */ +class IVideoSinkBase : public RefCountInterface { + public: + /** + * Sets a private property in the `IVideoFilter` class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int setProperty(const char* key, const void* buf, int buf_size) { return -1; } + /** + * Gets a private property in the `IVideoFilter` class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int getProperty(const char* key, void* buf, int buf_size) { return -1; } + /** + * Occurs when the `IVideoSinkBase` object receives the video frame. + * @param videoFrame The reference to the video frame. + */ + virtual int onFrame(const media::base::VideoFrame& videoFrame) = 0; + /** + * Used internally to distinguish between external and internal sinks. + * External application should not override this interface. + */ + virtual bool isExternalSink() { return true; } + /** + * This function is invoked right before data stream starts. + * Custom sink can override this function for initialization. + * @return + * - `true`, if initialization succeeds. + * - `false`, if initialization fails. + */ + virtual bool onDataStreamWillStart() { return true; } + /** + * This function is invoked right before data stream stops. + * Custom sink can override this function for deinitialization. + */ + virtual void onDataStreamWillStop() { } + /** + * Whether to mirror the video frame. + * @return + * - true: mirror the video frame. + * - false: do not mirror the video frame. + */ + virtual bool applyMirror() { return false; } + /** + * Whether to rotate the video frame. + * @return + * - true: rotate the video frame. + * - false: do not rotate the video frame. + */ + virtual bool applyRotation() { return false; } +}; + +class IMediaExtensionObserver : public RefCountInterface { +public: + virtual ~IMediaExtensionObserver() {} + virtual void onEvent(const char* provider, const char* extension, const char* key, const char* json_value) __deprecated {} + virtual void onExtensionStopped(const char* provider, const char* extension) __deprecated {} + virtual void onExtensionStarted(const char* provider, const char* extension) __deprecated {} + virtual void onExtensionError(const char* provider, const char* extension, int error, const char* message) __deprecated {} + + virtual bool needExtensionContext() {return false;} // callback with conetxt interface if true + virtual void onEventWithContext(const ExtensionContext& context, const char* key, const char* json_value) {} + virtual void onExtensionStoppedWithContext(const ExtensionContext& context) {} + virtual void onExtensionStartedWithContext(const ExtensionContext& context) {} + virtual void onExtensionErrorWithContext(const ExtensionContext& context, int error, const char* message) {} +}; + +/** + * The IAudioPcmDataSender class. + * + * In scenarios involving custom audio source, you can use the `IAudioPcmDataSender` class to send PCM audio data directly to the audio track. If the audio track is disabled, the sent audio data is automatically discarded. + */ +class IAudioPcmDataSender : public RefCountInterface { + public: + /** + * Sends the PCM audio data to the local audio track. + * + * @param audio_data The PCM audio data to be sent. + * @param samples_per_channel The number of audio samples in 10 ms for each audio channel. + * @param bytes_per_sample The number of bytes in each sample. + * @param number_of_channels The number of audio channels. + * @param sample_rate The sample rate (Hz). The minimum value is 8000. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendAudioPcmData( + const void* audio_data, uint32_t capture_timestamp, + const size_t samples_per_channel, // for 10ms Data, number_of_samples * 100 = sample_rate + const agora::rtc::BYTES_PER_SAMPLE bytes_per_sample, // 2 + const size_t number_of_channels, + const uint32_t sample_rate) = 0; // sample_rate > 8000) + + protected: + ~IAudioPcmDataSender() {} +}; + +/** + * The `IAudioEncodedFrameSender` class. + * + * In scenarios involving custom audio source, you can use the `IAudioEncodedFrameSender` class to + * send encoded audio data directly to the audio track. If the track is disabled, the sent audio + * data will be automatically discarded. + */ +class IAudioEncodedFrameSender : public RefCountInterface { + public: + /** + * Sends the encoded audio frame to the local audio track. + * + * @param payload_data The pointer to the payload data. + * @param payload_size The payload size. + * @param audioFrameInfo The reference to the information of the audio frame: + * \ref agora::rtc::EncodedAudioFrameInfo "EncodedAudioFrameInfo". + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool sendEncodedAudioFrame(const uint8_t* payload_data, size_t payload_size, + const EncodedAudioFrameInfo& audioFrameInfo) = 0; + + protected: + ~IAudioEncodedFrameSender() {} +}; + +class IAudioEncodedFrameReceiver { + public: + /** + * Occurs when the track receives an audio encodeed frame packet. + * + * @param packet The pointer to the audio packet. + * @param length The length of the packet. + * @param info The packet info. + * + */ + virtual bool onEncodedAudioFrameReceived ( + const uint8_t *packet, size_t length, const media::base::AudioEncodedFrameInfo& info) = 0; + + virtual ~IAudioEncodedFrameReceiver() {} +}; + +/** + * The IMediaPacketReceiver class. You can register a receiver in remote audio or video tracks to trigger + * callbacks when RTP/UDP packets are received. + */ +class IMediaPacketReceiver { + public: + /** + * Occurs when the track receives a media packet. + * + * @param packet The pointer to the media packet. + * @param length The length of the packet. + * @param options The packet info. + * + */ + virtual bool onMediaPacketReceived( + const uint8_t *packet, size_t length, const agora::media::base::PacketOptions& options) = 0; + + virtual ~IMediaPacketReceiver() {} +}; + +/** + * The IMediaControlPacketReceiver class. + * + * You can register a receiver in audio or video tracks to trigger callbacks + * when RTCP/UDP packets are received. + */ +class IMediaControlPacketReceiver { + public: + /** + * Occurs when the track receives media control packet. + * + * @param packet The pointer to the media packet. + * @param length The length of the packet. + * + */ + virtual bool onMediaControlPacketReceived(uid_t uid, const uint8_t *packet, size_t length) = 0; + + virtual ~IMediaControlPacketReceiver() {} +}; + +/** + * The `IMediaPacketSender` class. + * + * You can use the `IMediaPacketSender` class to create a LocalVideoTrack or LocalAudioTrack, + * and then send media packets directly to the track. The media packets are RTP/UDP packets that contain + * media payload. If the track is disabled, the packets will be automatically discarded. + */ +class IMediaPacketSender : public RefCountInterface { + public: + /** + * Sends the frame packet to the local track. + * + * @param packet The pointer to the packet. + * @param length The packet size. + * @param options The packet information: {@link media::base::PacketOptions PacketOptions}. + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual int sendMediaPacket(const uint8_t *packet, size_t length, + const media::base::PacketOptions &options) = 0; + protected: + ~IMediaPacketSender() {} +}; + +/** + * The `IMediaControlPacketSender` class. + * + * You can get the `IMediaControlPacketSender` class object from a video track or audio track, + * and then send media control packets directly. The media control packets are RTCP/UDP packets that contain + * media control payload. If the track is disabled, the packets will be automatically discarded. + */ +class IMediaControlPacketSender { + public: + /** + * Sends the media control packet to a specified user. + * Currently, we only support sending packets through video tracks. + * + * @param userId ID of the user to send the packet to. + * @param packet The pointer to the packet. + * @param length The packet size. + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual int sendPeerMediaControlPacket(media::base::user_id_t userId, + const uint8_t *packet, + size_t length) = 0; + + /** + * Sends the media transport control packet to all users. + * Currently, we only support sending packets through video tracks. + * @param packet The pointer to the packet. + * @param length The packet size. + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual int sendBroadcastMediaControlPacket(const uint8_t *packet, size_t length) = 0; + + virtual ~IMediaControlPacketSender() {} +}; + +/** + * The `IAudioSinkBase` class is the base class for the audio sink. You can use this class to implement your own sink + * and add the sink to an audio track. + */ +class IAudioSinkBase : public RefCountInterface { + public: + /** Gets the audio frame. + * + * @param audioframe {@link media::base::AudioPcmFrame AudioPcmFrame} + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool onAudioFrame(const media::base::AudioPcmFrame& audioFrame) = 0; + + protected: + ~IAudioSinkBase() {} +}; + +/** + * The `IVideoFrameSender` class. + * + * In scenarios involving custom video sources, you can use this class to send the video + * data directly to a video track. If the video track is disabled, the sent data will + * be automatically discarded. + */ +class IVideoFrameSender : public RefCountInterface { + public: + /** + * Sends the video frame to the video track. + * + * @param videoFrame The reference to the video frame to send. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendVideoFrame(const media::base::ExternalVideoFrame& videoFrame) = 0; + + protected: + ~IVideoFrameSender() {} +}; + +/** + * The `IVideoEncodedImageSender` class. + * + * In scenarios involving custom video sources, you can use this class to send the encoded video data + * directly to the video track. If the video track is disabled, the sent video image will be + * automatically discarded. + */ +class IVideoEncodedImageSender : public RefCountInterface { + public: + /** + * Sends the encoded video image to the video track. + * @param imageBuffer The video buffer. + * @param length The data length of the video data. + * @param videoEncodedFrameInfo The reference to the information of the encoded video frame: + * {@link EncodedVideoFrameInfo}. + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool sendEncodedVideoImage(const uint8_t* imageBuffer, size_t length, + const EncodedVideoFrameInfo& videoEncodedFrameInfo) = 0; + + protected: + ~IVideoEncodedImageSender() {} +}; + +/** + * The IVideoBeautyFilter class. + */ +class IVideoBeautyFilter : public IVideoFilter { + public: + /** + * The video image enhancement options. + */ + struct BeautyOptions { + /** + * The lightening contrast level. + */ + enum LIGHTENING_CONTRAST_LEVEL { + /** + * 0: Low contrast level. + */ + LIGHTENING_CONTRAST_LOW = 0, + /** + * (Default) Normal contrast level. + */ + LIGHTENING_CONTRAST_NORMAL, + /** + * High contrast level. + */ + LIGHTENING_CONTRAST_HIGH + }; + + /** + * The contrast level, usually used with {@link lighteningLevel} to brighten the video: + * #LIGHTENING_CONTRAST_LEVEL. + */ + LIGHTENING_CONTRAST_LEVEL lighteningContrastLevel; + + /** + * The brightness level. The value ranges from 0.0 (original) to 1.0. + */ + float lighteningLevel; + + /** + * The sharpness level. The value ranges from 0.0 (original) to 1.0. This parameter is usually + * used to remove blemishes. + */ + float smoothnessLevel; + + /** + * The redness level. The value ranges from 0.0 (original) to 1.0. This parameter adjusts the + * red saturation level. + */ + float rednessLevel; + + BeautyOptions(LIGHTENING_CONTRAST_LEVEL contrastLevel, float lightening, float smoothness, + float redness) + : lighteningContrastLevel(contrastLevel), + lighteningLevel(lightening), + smoothnessLevel(smoothness), + rednessLevel(redness) {} + + BeautyOptions() + : lighteningContrastLevel(LIGHTENING_CONTRAST_NORMAL), + lighteningLevel(0), + smoothnessLevel(0), + rednessLevel(0) {} + }; + /** + * Sets the image enhancement options. + * @param enabled Whether to enable image enhancement. + * - `true`: Enable image enhancement. + * - `false`: Do not enable image enhancement. + * @param options The image enhancement options: BeautyOptions. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setBeautyEffectOptions(bool enabled, BeautyOptions options) = 0; +}; + +/** + * The `IVideoRenderer` class. + */ +class IVideoRenderer : public IVideoSinkBase { + public: + /** + * Sets the render mode. + * @param renderMode The video render mode. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRenderMode(media::base::RENDER_MODE_TYPE renderMode) = 0; + /** + * Sets the render mode of the view. + * @param view the view to set render mode. + * @param renderMode The video render mode. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRenderMode(void* view, media::base::RENDER_MODE_TYPE renderMode) = 0; + /** + * Sets whether to mirror the video. + * @param mirror Whether to mirror the video: + * - `true`: Mirror the video. + * - `false`: Do not mirror the video. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMirror(bool mirror) = 0; + /** + * Sets whether to mirror the video. + * @param view the view to set mirror mode. + * @param mirror Whether to mirror the video: + * - `true`: Mirror the video. + * - `false`: Do not mirror the video. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMirror(void* view, bool mirror) = 0; + /** + * Sets the video display window. + * @param view The pointer to the video display window. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setView(void* view) = 0; + /** + * Sets the video display window. + * @param view The pointer to the video display window. + * @param cropArea (Optional) Sets the relative location of the region to show. See Rectangle. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int addView(void* view, const Rectangle& cropArea) = 0; + /** + * Stops rendering the video view on the window. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unsetView() = 0; + /** + * remove rendering the video view on the window. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeView(void* view) = 0; +}; + +static const int kDeviceIdSize = 128; + +class IVideoTrack; +/** + * The `IVideoFrameTransceiver` class. + */ +class IVideoFrameTransceiver : public RefCountInterface { + public: + virtual int getTranscodingDelayMs() = 0; + virtual int addVideoTrack(agora_refptr track) = 0; + virtual int removeVideoTrack(agora_refptr track) = 0; +}; + +} +} diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraMediaNodeFactory.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraMediaNodeFactory.h new file mode 100644 index 0000000..5a53ce5 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraMediaNodeFactory.h @@ -0,0 +1,256 @@ +// +// Agora SDK +// +// Copyright (c) 2019 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" + +namespace agora { +namespace rtc { + +class IAudioPcmDataSender; +class IAudioEncodedFrameSender; +class IRemoteAudioMixerSource; +class ICameraCapturer; +class IScreenCapturer; +class IVideoMixerSource; +class IVideoFrameTransceiver; +class IVideoFrameSender; +class IVideoRenderer; +class IVideoFilter; +class IAudioFilter; +class IVideoSinkBase; +class IVideoEncodedImageSender; +class IMediaPlayerSource; +class IMediaPacketSender; +class IMediaStreamingSource; +class IScreenCapturer2; + + +/** + * The `IMediaNodeFactory` class. + */ +class IMediaNodeFactory : public RefCountInterface { + public: + /** + * Creates a PCM audio data sender. + * + * This method creates an `IAudioPcmDataSender` object, which can be used by \ref agora::base::IAgoraService::createCustomAudioTrack(agora_refptr< rtc::IAudioPcmDataSender > audioSource) "createCustomAudioTrack" to send PCM audio data. + * + * @return + * - The pointer to \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioPcmDataSender() = 0; + + /** + * Creates an encoded audio data sender. + * + * This method creates an IAudioEncodedFrameSender object, which can be used by \ref agora::base::IAgoraService::createCustomAudioTrack(agora_refptr< rtc::IAudioEncodedFrameSender > audioSource, TMixMode mixMode) "createCustomAudioTrack" to send encoded audio data. + * + * @return + * - The pointer to IAudioEncodedFrameSender: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioEncodedFrameSender() = 0; + + /** + * Creates a remote audio mixer source object and returns the pointer. + * + * @param type The type of audio mixer source you want to create. + * + * @return + * - The pointer to \ref rtc::IRemoteAudioMixerSource "IRemoteAudioMixerSource", if the method call succeeds. + * - A null pointer, if the method call fails. + */ + virtual agora_refptr createRemoteAudioMixerSource() = 0; + + /** + * Creates a camera capturer. + * + * Once a camera capturer object is created, you can use the video data captured by the camera as + * the custom video source. + * + * @return + * - The pointer to ICameraCapturer: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCameraCapturer() = 0; + + /** + * Creates a screen capturer. + * + * Once a screen capturer object is created, you can use the screen video data as the custom video + * source. + * + * @return + * - The pointer to IScreenCapturer: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCapturer() = 0; + + /** + * Creates a video mixer. + * + * Once a video mixer object is created, you can use the video mixer data as the custom video + * source. + * + * @return + * - The pointer to IVideoMixerSource: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoMixer() = 0; + + /** + * Creates a video transceiver. + * + * Once a video transceiver object is created, you can use the video transceiver data as the custom video + * source. + * + * @return + * - The pointer to IVideoFrameTransceiver: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoFrameTransceiver() = 0; + + /** + * Creates a video frame sender. + * + * This method creates an `IVideoFrameSender` object, which can be used by \ref agora::base::IAgoraService::createCustomVideoTrack(agora_refptr videoSource) "createCustomVideoTrack" to + * send the custom video data. + * + * @return + * - The pointer to \ref agora::rtc::IVideoFrameSender "IVideoFrameSender": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoFrameSender() = 0; + + /** + * Creates an encoded video image sender. + * + * This method creates an `IVideoEncodedImageSender` object, which can be used by \ref agora::base::IAgoraService::createCustomVideoTrack(agora_refptr videoSource, SenderOptions& options) "createCustomVideoTrack" to send the encoded video data. + * + * @return + * - The pointer to `IVideoEncodedImageSender`: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoEncodedImageSender() = 0; + + /** + * Creates a built-in video renderer. + * + * @param view The video window view. + * @return + * - The pointer to `IVideoRenderer`: Success. + * - A null pointer: Failure. + * + */ + virtual agora_refptr createVideoRenderer() = 0; + + /** + * Creates an audio filter for the extension. + * + * This method creates an `IAudioFilter` object, which can be used to filter the audio data from the + * inside extension. + * + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IAudioFilter: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioFilter(const char* provider_name, const char* extension_name) = 0; + + /** + * Creates a video filter for the extension. + * + * This method creates an `IVideoFilter` object, which can be used to filter the video from inside + * extension. + * + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IVideoFilter: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoFilter(const char* provider_name, const char* extension_name) = 0; + + /** + * Creates a video sink for the extension. + * + * This method creates an IVideoSinkBase object, which can be used to receive the video from the + * inside extension. + * + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IVideoSinkBase: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoSink(const char* provider_name, const char* extension_name) = 0; + + /** + * Creates a media player source object and returns the pointer. + * + * @param type The type of media player source you want to create. + * + * @return + * - The pointer to \ref rtc::IMediaPlayerSource "IMediaPlayerSource", if the method call + * succeeds. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaPlayerSource(media::base::MEDIA_PLAYER_SOURCE_TYPE type = agora::media::base::MEDIA_PLAYER_SOURCE_DEFAULT) = 0; + + /** + * @brief Creates a media streaming source object and returns the pointer. + * + * @param type The type of media streaming source you want to create. + * + * @return + * - The pointer to \ref rtc::IMediaStreamingSource "IMediaStreamingSource", if the method call + * succeeds. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaStreamingSource() = 0; + + /** + * Creates a media packet sender object and returns the pointer. + * + * @return + * - The pointer to \ref rtc::IMediaPacketSender "IMediaPacketSender", if the method call + * succeeds. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaPacketSender() = 0; + +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + /** + * Creates screen capture source extension with given provider&extension names + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IScreenCapturer: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCapturer2(const char* provider_name, const char* extension_name) = 0; +#else + /** + * Creates screen capture source extension with given provider&extension names + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IScreenCapturer: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCapturer(const char* provider_name, const char* extension_name) = 0; +#endif + + protected: + ~IMediaNodeFactory() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRemoteAudioMixerSource.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRemoteAudioMixerSource.h new file mode 100644 index 0000000..e471071 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRemoteAudioMixerSource.h @@ -0,0 +1,44 @@ +// +// Agora SDK +// +// Copyright (c) 2020 Agora.io. All rights reserved. +// + +#pragma once + +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +class IRemoteAudioTrack; + +/** + * The IRemoteAudioMixerSource class abstracts a multi-in-single-out audio source which receives audio + * streams from multiple remote audio tracks and generate mixed audio stream in user defined output + * format. + */ +class IRemoteAudioMixerSource : public RefCountInterface { + public: + virtual ~IRemoteAudioMixerSource() {} + + /** + * Add a audio track for mixing. Automatically starts mixing if add audio track + * @param track The instance of the audio track that you want mixer to receive its audio stream. + */ + virtual int addAudioTrack(agora_refptr track) = 0; + + /** + * Remove a audio track for mixing. Automatically stops the mixed stream if all audio tracks are removed + * @param track The instance of the audio track that you want to remove from the mixer. + */ + virtual int removeAudioTrack(agora_refptr track) = 0; + + /** + * Gets the delay time for mix. + */ + virtual int getMixDelay() const = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtcConnection.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtcConnection.h new file mode 100644 index 0000000..bbb5de0 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtcConnection.h @@ -0,0 +1,857 @@ +// +// Agora SDK +// +// Created by Sting Feng in 2018-01. +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "time_utils.h" + +namespace agora { +namespace rtc { +class IAudioEncodedFrameSender; +class IRtcConnectionObserver; +class INetworkObserver; +class IRtcConnection; +class IVideoEncodedImageSender; +class ILocalUser; + +/** + * The information of an RTC Connection. + */ +struct TConnectionInfo { + /** + * The ID of the RTC Connection. + */ + conn_id_t id; + /** + * The ID of the channel. If you have not called \ref agora::rtc::IRtcConnection::connect "connect", this member is `NULL`. + */ + util::AString channelId; + /** + * The connection state: #CONNECTION_STATE_TYPE. + */ + CONNECTION_STATE_TYPE state; + /** + * The ID of the local user. + */ + util::AString localUserId; + /** + * Internal use only. + */ + uid_t internalUid; + + int proxyType; + + util::AString connectionIp; + + TConnectionInfo() : id(-1), state(CONNECTION_STATE_DISCONNECTED), internalUid(0), proxyType(0) {} +}; + +struct TConnectSettings { + /** + * The app ID. + */ + const char* token; + /** + The channel name. It must be in the string format and not exceed 64 bytes in length. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", + * "-", ":", ";", "<", "=", + * ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", "," + */ + const char* channelId; + /** + The ID of the local user. If you do not specify a user ID or set `userId` as `null`, + * the SDK returns a user ID in the \ref IRtcConnectionObserver::onConnected "onConnected" + * callback. Your app must record and maintain the `userId` since the SDK does not do so. + */ + user_id_t userId; + + /* + App can provide a app defined start time to trace some events like connect cost , first video, etc. + */ + agora::Optional appDefinedStartTimeMs; +}; + +/** + * Configurations for an RTC connection. + * + * Set these configurations when calling \ref agora::base::IAgoraService::createRtcConnection "createRtcConnection". + */ +struct RtcConnectionConfiguration { + /** + * Whether to subscribe to all audio tracks automatically. + * - `true`: (Default) Subscribe to all audio tracks automatically. + * - `false`: Do not subscribe to any audio track automatically. + */ + bool autoSubscribeAudio; + /** + * Whether to subscribe to all video tracks automatically. + * - `true`: (Default) Subscribe to all video tracks automatically. + * - `false`: Do not subscribe to any video track automatically. + */ + bool autoSubscribeVideo; + /** + * Whether to enable audio recording or playout. + * - `true`: Enables audio recording or playout. Use this option when you publish and mix audio tracks, or subscribe to one or multiple audio tracks and play audio. + * - `false`: Disables audio recording or playout. Use this option when you publish external audio frames without audio mixing, or you do not need audio devices to play audio. + */ + bool enableAudioRecordingOrPlayout; + /** + * The maximum sending bitrate. + */ + int maxSendBitrate; + /** + * The minimum port. + */ + int minPort; + /** + * The maximum port. + */ + int maxPort; + /** + * The user role. For details, see #CLIENT_ROLE_TYPE. The default user role is `CLIENT_ROLE_AUDIENCE`. + */ + CLIENT_ROLE_TYPE clientRoleType; + /** The channel profile. For details, see #CHANNEL_PROFILE_TYPE. The default channel profile is `CHANNEL_PROFILE_LIVE_BROADCASTING`. + */ + CHANNEL_PROFILE_TYPE channelProfile; + + /** + * Determines whether to receive audio encoded frame or not. + */ + bool audioRecvEncodedFrame; + + /** + * Determines whether to receive audio media packet or not. + */ + bool audioRecvMediaPacket; + + /** + * Determines whether to receive video media packet or not. + */ + bool videoRecvMediaPacket; + + /** + * This mode is only used for audience. In PK mode, client might join one + * channel as broadcaster, and join another channel as interactive audience to + * achieve low lentancy and smooth video from remote user. + * - true: Enable low lentancy and smooth video when joining as an audience. + * - false: (Default) Use default settings for audience role. + */ + bool isInteractiveAudience; + + RtcConnectionConfiguration() + : autoSubscribeAudio(true), + autoSubscribeVideo(true), + enableAudioRecordingOrPlayout(true), + maxSendBitrate(-1), + minPort(0), + maxPort(0), + clientRoleType(CLIENT_ROLE_AUDIENCE), + channelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING), + audioRecvEncodedFrame(false), + audioRecvMediaPacket(false), + videoRecvMediaPacket(false), + isInteractiveAudience(false) {} +}; + +/** + * The `IRtcConnection` class. + * + * You can use this class for managing the connection between your app and an Agora Channel. + * + * Once connected, your app gets an `AgoraLocalUser` object for publishing and subscribing to media streams in the Agora Channel. + * + * Connecting to a channel is done asynchronously, and your app can listen for the connection states or events through `IRtcConnectionObserver`. + * `IRtcConnection` also monitors remote users in the channel. The SDK notifies your app when a remote user joins or leaves the channel. + */ +class IRtcConnection : public RefCountInterface { + protected: + ~IRtcConnection() {} + + public: + /** + * Connects to an Agora channel. + * + * When the method call succeeds, the connection state changes from `CONNECTION_STATE_DISCONNECTED(1)` to + * `CONNECTION_STATE_CONNECTING(2)`. + * + * Depending on the whether the connection succeeds or not, the + * connection state changes to either `CONNECTION_STATE_CONNECTED(3)` or `CONNECTION_STATE_FAILED(5)`. The SDK also triggers `onConnected` or `onDisconnected` to notify you of the state change. + * + * @param token The app ID. + * @param channelId The channel name. It must be in the string format and not exceed 64 bytes in length. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", + * "-", ":", ";", "<", "=", + * ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", "," + * @param userId The ID of the local user. If you do not specify a user ID or set `userId` as `null`, + * the SDK returns a user ID in the \ref IRtcConnectionObserver::onConnected "onConnected" + * callback. Your app must record and maintain the `userId` since the SDK does not do so. + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT): The argument that you pass is invalid. + * - -8(ERR_INVALID_STATE): The current connection state is not CONNECTION_STATE_DISCONNECTED(1). + */ + virtual int connect(const char* token, const char* channelId, user_id_t userId) = 0; + + /** + * Connects to an Agora channel. + * + * When the method call succeeds, the connection state changes from `CONNECTION_STATE_DISCONNECTED(1)` to + * `CONNECTION_STATE_CONNECTING(2)`. + * + * Depending on the whether the connection succeeds or not, the + * connection state changes to either `CONNECTION_STATE_CONNECTED(3)` or `CONNECTION_STATE_FAILED(5)`. + * The SDK also triggers `onConnected` or `onDisconnected` to notify you of the state change. + * @param settings The settings of connecting. + */ + virtual int connect(const TConnectSettings& settings) = 0; + + /** + * Disconnects from the Agora channel. + * + * Once your app successful disconnects from the channel, the connection state changes to + * `CONNECTION_STATE_DISCONNECTED(1)`. You are also notified with the callback + * \ref IRtcConnectionObserver::onDisconnected "onDisconnected". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disconnect() = 0; + + /** + * Starts the last-mile network probe test. + * + * Call this method before connecting to the channel to get the uplink and + * downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and + * round-trip time (RTT). + * + * After you enable the last-mile network probe test, the SDK triggers the following callbacks: + * - \ref IRtcConnectionObserver::onLastmileQuality "onLastmileQuality": The SDK triggers this + * callback within two seconds depending on the network conditions. This callback rates the network + * conditions and is more closely linked to the user experience. + * - \ref IRtcConnectionObserver::onLastmileProbeResult "onLastmileProbeResult": The SDK triggers + * this callback within 30 seconds depending on the network conditions. This callback reports the + * real-time statistics of the network conditions and is more objective. + * + * @note + * - Do not call any other method before receiving the \ref IRtcConnectionObserver::onLastmileQuality + * "onLastmileQuality" and \ref IRtcConnectionObserver::onLastmileProbeResult "onLastmileProbeResult" + * callbacks. Otherwise, the callbacks may be interrupted. + * - In the live-broadcast profile, a host should not call this method after connecting to a channel. + * + * @param config The configurations of the last-mile network probe test. See \ref agora::rtc::LastmileProbeConfig "LastmileProbeConfig". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startLastmileProbeTest(const LastmileProbeConfig& config) = 0; + + /** + * Stops the last-mile network probe test. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopLastmileProbeTest() = 0; + + /** + * Renews the token. + * + * The token expires after a certain period of time. + * When the \ref IRtcConnectionObserver::onError "onError" callback reports `ERR_TOKEN_EXPIRED(109)`, you must generate a new token from the server + * and then call this method to renew it. Otherwise, the SDK disconnects from the Agora channel. + * + * @param token The pointer to the new token. + */ + virtual int renewToken(const char* token) = 0; + + /** + * Gets the connection information. + * + * @return + * - The pointer to the \ref agora::rtc::TConnectionInfo "TConnectionInfo" object: Success. + * - A null pointer: Failure. + */ + virtual TConnectionInfo getConnectionInfo() = 0; + + /** + * Gets the \ref agora::rtc::ILocalUser "ILocalUser" object. + * + * @return + * - The pointer to the \ref agora::rtc::ILocalUser "ILocalUser" object: Success. + * - A null pointer: Failure. + */ + virtual ILocalUser* getLocalUser() = 0; + + /** + * Gets the information of all the remote users in the channel. + * + * After a user successfully connects to the channel, you can also get the information of this remote user + * with the \ref IRtcConnectionObserver::onUserJoined "onUserJoined" callback. + * + * @param [out] users The reference to the \ref agora::UserList "UserList" object, which contains the information of all users + * in the channel. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRemoteUsers(UserList& users) = 0; + + /** + * Gets the information of a specified remote user in the channel. + * + * @param [in] userId ID of the user whose information you want to get. + * @param [out] userInfo The reference to the \ref agora::UserInfo "UserInfo" object, which contains the information of the + * specified user. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfo(user_id_t userId, agora::UserInfo& userInfo) = 0; + + /** + * Registers an RTC connection observer. You can call this method only after creating an `IRtcConnection` object. + * + * @param observer The pointer to the IRtcConnectionObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerObserver(IRtcConnectionObserver* observer, void(*safeDeleter)(IRtcConnectionObserver*) = NULL) = 0; + + /** + * Releases the registered IRtcConnectionObserver object. + * + * @param observer The pointer to the IRtcConnectionObserver object created by the \ref registerObserver + * "registerObserver" method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterObserver(IRtcConnectionObserver* observer) = 0; + + /** + * Registers an network observer object. + * + * @param observer The pointer to the INetworkObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerNetworkObserver(INetworkObserver* observer, void(*safeDeleter)(INetworkObserver*) = NULL) = 0; + + /** + * Releases the registered INetworkObserver object. + * + * @param observer The pointer to the INetworkObserver object created by the \ref registerNetworkObserver + * "registerNetworkObserver" method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterNetworkObserver(INetworkObserver* observer) = 0; + + /** + * Gets the ID of the connection. + * + * @return + * - The connection ID: Success. + * - A null pointer: Failure. + */ + virtual conn_id_t getConnId() = 0; + + /** + * Gets the transportation statistics of the RTC connection. + * + * @return + * - The pointer to \ref agora::rtc::RtcStats "RtcStats": Success. + * - A null pointer: Failure. + */ + virtual RtcStats getTransportStats() = 0; + + /** + * Gets the IAgoraParameter object. + * + * @return + * - The pointer to the \ref agora::base::IAgoraParameter "IAgoraParameter" object. + * - A null pointer: Failure. + */ + virtual agora::base::IAgoraParameter* getAgoraParameter() = 0; + + /** + * Creates a data stream. + * + * Each user can create up to five data streams during the lifecycle of an RTC connection. + * + * @note Set both the `reliable` and `ordered` parameters as `true` or `false`. Do not set one as `true` and the other as `false`. + * + * @param streamId The pointer to the ID of the data stream. + * @param reliable Whether to guarantee the receivers receive the data stream within five seconds: + * - `true`: Guarantee that the receivers receive the data stream within five seconds. If the receivers do not receive the data stream within five seconds, the SDK reports an error to the application. + * - `false`: Do not guarantee that the receivers receive the data stream within five seconds and the SDK does not report any error message for data stream delay or missing. + * @param ordered Whether the receivers receive the data stream in the order of sending: + * - `true`: The receivers receive the data stream in the order of sending. + * - `false`: The receivers do not receive the data stream in the order of sending. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int createDataStream(int* streamId, bool reliable, bool ordered, bool sync) = 0; + + /** Sends data stream messages to all users in a channel. + * + * @note This method has the following restrictions: + * - Up to 30 packets can be sent per second in a channel with a maximum size of 1 kB for each packet. + * - Each client can send up to 6 kB of data per second. + * - Each user can have up to five data streams simultaneously. + * + * @param streamId The ID of the sent data stream, returned in the \ref agora::rtc::IRtcConnection::createDataStream "createDataStream" method. + * @param data The pointer to the sent data. + * @param length The length of the sent data. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendStreamMessage(int streamId, const char* data, size_t length) = 0; + + /** Enables/Disables the built-in encryption. + * + * In scenarios requiring high security, Agora recommends calling this method to enable the built-in encryption before joining a channel. + * + * All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + * + * @note + * - If you enable the built-in encryption, you cannot use the RTMP streaming function. + * + * @param enabled Whether to enable the built-in encryption: + * - true: Enable the built-in encryption. + * - false: Disable the built-in encryption. + * @param config Configurations of built-in encryption schemas. See \ref agora::rtc::EncryptionConfig "EncryptionConfig". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableEncryption(bool enabled, const EncryptionConfig& config) = 0; + + /** + * Reports a custom event to Agora. + * + * @param id The custom event ID. + * @param category The category of the custom event. + * @param event The custom event to report. + * @param label The label of the custom event. + * @param value The value of the custom event. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendCustomReportMessage(const char* id, const char* category, const char* event, const char* label, int value) = 0; + /** Gets the user information by user account, which is in string format. + * + * @param userAccount The user account of the user. + * @param [in,out] userInfo A \ref rtc::UserInfo "UserInfo" object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUserAccount(const char* userAccount, rtc::UserInfo* userInfo) = 0; + /** Gets the user information by user ID, which is in integer format. + * + * @param uid The ID of the remote user. + * @param [in,out] userInfo A \ref rtc::UserInfo "UserInfo" object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUid(uid_t uid, rtc::UserInfo* userInfo) = 0; +}; + +/** + * The IRtcConnectionObserver class, which observes the connection state of the SDK. + */ +class IRtcConnectionObserver { + public: + virtual ~IRtcConnectionObserver() {} + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_CONNECTED(3)`. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + * @param reason The reason of the connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnected(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_DISCONNECTED(1)`. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + * @param reason The reason of the connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onDisconnected(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_CONNECTING(2)`. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + * @param reason The reason of the connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnecting(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_RECONNECTING(4)`. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + * @param reason The reason of the connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onReconnecting(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + // This should be deleted. onConnected is enough. + virtual void onReconnected(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when the SDK loses connection with the Agora channel. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + */ + virtual void onConnectionLost(const TConnectionInfo& connectionInfo) = 0; + + /** + * Reports the quality of the last-mile network. + * + * The SDK triggers this callback within two seconds after the app calls \ref IRtcConnection::startLastmileProbeTest "startLastmileProbeTest". + * + * @param quality Quality of the last-mile network: #QUALITY_TYPE. + */ + virtual void onLastmileQuality(const QUALITY_TYPE quality) = 0; + + /** + * Reports the result of the last-mile network probe test. + * + * The SDK triggers this callback within 30 seconds after the app calls \ref IRtcConnection::startLastmileProbeTest "startLastmileProbeTest". + * + * @param result The result of the last-mile network probe test: \ref agora::rtc::LastmileProbeResult "LastmileProbeResult". + */ + virtual void onLastmileProbeResult(const LastmileProbeResult& result) = 0; + + /** + * Occurs when the token expires in 30 seconds. + * + * The SDK triggers this callback to remind the app to get a new token before the token privilege expires. + * + * Upon receiving this callback, you must generate a new token on your server and call \ref IRtcConnection::renewToken + * "renewToken" to pass the new token to the SDK. + * + * @param token The pointer to the token that expires in 30 seconds. + */ + virtual void onTokenPrivilegeWillExpire(const char* token) = 0; + + /** + * Occurs when the token has expired. + * + * Upon receiving this callback, you must generate a new token on your server and call \ref IRtcConnection::renewToken + * "renewToken" to pass the new token to the SDK. + */ + virtual void onTokenPrivilegeDidExpire() = 0; + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_FAILED(5)`. + * + * @param connectionInfo The connection information: TConnectionInfo. + * @param reason The reason of the connection state change: #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnectionFailure(const TConnectionInfo& connectionInfo, + CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when a remote user joins the channel. + * + * You can get the ID of the remote user in this callback. + * + * @param userId The ID of the remote user who joins the channel. + */ + virtual void onUserJoined(user_id_t userId) = 0; + + /** + * Occurs when a remote user leaves the channel. + * + * You can know why the user leaves the channel through the `reason` parameter. + * + * @param userId The ID of the user who leaves the channel. + * @param reason The reason why the remote user leaves the channel: #USER_OFFLINE_REASON_TYPE. + */ + virtual void onUserLeft(user_id_t userId, USER_OFFLINE_REASON_TYPE reason) = 0; + + /** + * Reports the transport statistics of the connection. + * + * The SDK triggers this callback once every two seconds when the connection state is `CONNECTION_STATE_CONNECTED`. + * + * @param stats The pointer to \ref rtc::RtcStats "RtcStats". + */ + virtual void onTransportStats(const RtcStats& stats) = 0; + + /** + * Occurs when the role of the local user changes. + * + * @param oldRole The previous role of the local user: \ref rtc::CLIENT_ROLE_TYPE "CLIENT_ROLE_TYPE". + * @param newRole The current role of the local user: \ref rtc::CLIENT_ROLE_TYPE "CLIENT_ROLE_TYPE". + * @param newRoleOptions The client role options of the current role of the local user: \ref rtc::ClientRoleOptions "ClientRoleOptions". + */ + virtual void onChangeRoleSuccess(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) { + (void)oldRole; + (void)newRole; + (void)newRoleOptions; + } + + /** + * Occurs when the local user fails to change the user role. + */ + virtual void onChangeRoleFailure(CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) { + (void)reason; + (void)currentRole; + } + + /** + * Occurs when connection license verification fails + * + * You can know the reason accordding to error code + * @param error verify fail reason + */ + virtual void onLicenseValidationFailure(LICENSE_ERROR_TYPE error) { + (void)error; + } + + /** + * Reports the network quality of each user. + * + * The SDK triggers this callback once every two seconds to report the uplink and downlink network conditions + * of each user in the channel, including the local user. + * + * @param userId The ID of the user. If `userId` is empty, this callback reports the network quality of the local user. + * @param txQuality The uplink network quality: #QUALITY_TYPE. + * @param rxQuality The downlink network quality: #QUALITY_TYPE. + */ + virtual void onUserNetworkQuality(user_id_t userId, QUALITY_TYPE txQuality, + QUALITY_TYPE rxQuality) { + (void)userId; + (void)txQuality; + (void)rxQuality; + } + + /** Occurs when the network type is changed. + * @param type The current network type. See #NETWORK_TYPE. + */ + virtual void onNetworkTypeChanged(NETWORK_TYPE type) { + (void)type; + } + + /** + * Occurs when an API method is executed. + * @deprecated This callback is deprecated. Use other specific event callbacks instead. + * + * @param err The error code that the SDK reports when the method call fails. If the SDK reports 0, + * the method call succeeds. + * @param api The API method that is executed. + * @param result The result of the method call. + */ + virtual void onApiCallExecuted(int err, const char* api, const char* result) __deprecated { + (void)err; + (void)api; + (void)result; + } + + /** Reports result of Content Inspect*/ + virtual void onContentInspectResult(media::CONTENT_INSPECT_RESULT result) { (void)result; } + /** Occurs when takeSnapshot API result is obtained + * + * + * @brief snapshot taken callback + * + * @param channel channel name + * @param uid user id + * @param filePath image is saveed file path + * @param width image width + * @param height image height + * @param errCode 0 is ok negative is error + */ + virtual void onSnapshotTaken(uid_t uid, const char* filePath, int width, int height, int errCode) { + (void)uid; + (void)filePath; + (void)width; + (void)height; + (void)errCode; + } + /** + * Reports the error code and error message. + * @param error The error code: #ERROR_CODE_TYPE. + * @param msg The error message. + */ + virtual void onError(ERROR_CODE_TYPE error, const char* msg) { + (void)error; + (void)msg; + } + + /** + * Occurs when the state of the channel media relay changes. + * + * + * @param state The state code: + * - `RELAY_STATE_IDLE(0)`: The SDK is initializing. + * - `RELAY_STATE_CONNECTING(1)`: The SDK tries to relay the media stream to the destination + * channel. + * - `RELAY_STATE_RUNNING(2)`: The SDK successfully relays the media stream to the destination + * channel. + * - `RELAY_STATE_FAILURE(3)`: A failure occurs. See the details in `code`. + * @param code The error code: + * - `RELAY_OK(0)`: The state is normal. + * - `RELAY_ERROR_SERVER_ERROR_RESPONSE(1)`: An error occurs in the server response. + * - `RELAY_ERROR_SERVER_NO_RESPONSE(2)`: No server response. You can call the leaveChannel method + * to leave the channel. + * - `RELAY_ERROR_NO_RESOURCE_AVAILABLE(3)`: The SDK fails to access the service, probably due to + * limited resources of the server. + * - `RELAY_ERROR_FAILED_JOIN_SRC(4)`: Fails to send the relay request. + * - `RELAY_ERROR_FAILED_JOIN_DEST(5)`: Fails to accept the relay request. + * - `RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC(6)`: The server fails to receive the media + * stream. + * - `RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST(7)`: The server fails to send the media stream. + * - `RELAY_ERROR_SERVER_CONNECTION_LOST(8)`: The SDK disconnects from the server due to poor + * network connections. You can call the leaveChannel method to leave the channel. + * - `RELAY_ERROR_INTERNAL_ERROR(9)`: An internal error occurs in the server. + * - `RELAY_ERROR_SRC_TOKEN_EXPIRED(10)`: The token of the source channel has expired. + * - `RELAY_ERROR_DEST_TOKEN_EXPIRED(11)`: The token of the destination channel has expired. + */ + virtual void onChannelMediaRelayStateChanged(int state, int code) = 0; + + /** Occurs when the local user successfully registers a user account by calling the \ref IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method.This callback reports the user ID and user account of the local user. + * + * @param uid The ID of the local user. + * @param userAccount The user account of the local user. + */ + virtual void onLocalUserRegistered(uid_t uid, const char* userAccount) { + (void)uid; + (void)userAccount; + } + + /** Technical Preview, please do not depend on this event. */ + virtual void onUserAccountUpdated(uid_t uid, const char* userAccount) { + (void)uid; + (void)userAccount; + } + + /** + * Reports the error that occurs when receiving data stream messages. + * + * @param userId The ID of the user sending the data stream. + * @param streamId the ID of the sent data stream, returned in the \ref agora::rtc::IRtcConnection::createDataStream "createDataStream" method. + * @param code The error code. + * @param missed The number of lost messages. + * @param cached The number of incoming cached messages when the data stream is interrupted. + */ + virtual void onStreamMessageError(user_id_t userId, int streamId, int code, int missed, + int cached) { + (void)userId; + (void)streamId; + (void)code; + (void)missed; + (void)cached; + } + + /** + * Reports the error type of encryption. + * @param type See #ENCRYPTION_ERROR_TYPE. + */ + virtual void onEncryptionError(ENCRYPTION_ERROR_TYPE errorType) { + (void)errorType; + } + /** + * Reports the user log upload result + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ + virtual void onUploadLogResult(const char* requestId, bool success, UPLOAD_ERROR_REASON reason) { + (void)requestId; + (void)success; + (void)reason; + } + + /** Occurs when the WIFI message need be sent to the user. + * + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ + virtual void onWlAccMessage(WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) { + (void)reason; + (void)action; + (void)wlAccMsg; + } + + /** Occurs when SDK statistics wifi acceleration optimization effect. + * + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ + virtual void onWlAccStats(WlAccStats currentStats, WlAccStats averageStats) { + (void)currentStats; + (void)averageStats; + } +}; + +class INetworkObserver { + public: + virtual ~INetworkObserver() {} + + public: + /** + * Occurs when downlink network info is updated. + * + * This callback is used for notifying user to adjust the send pace based + * on the target bitrate. + * + * @param info The uplink network info collections. + */ + virtual void onUplinkNetworkInfoUpdated(const UplinkNetworkInfo& info) { + (void)info; + } + + /** + * Occurs when downlink network info is updated. + * + * This callback is used for notifying user to switch major/minor stream if needed. + * + * @param info The downlink network info collections. + */ + virtual void onDownlinkNetworkInfoUpdated(const DownlinkNetworkInfo& info) { + (void)info; + } +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtmpConnection.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtmpConnection.h new file mode 100644 index 0000000..98bdfad --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtmpConnection.h @@ -0,0 +1,393 @@ +// +// Agora RTMP connection +// +// Created by Haonong Yu in 2020-02. +// Copyright (c) 2020 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +class IRtmpLocalUser; + +/** + * Configurations for the RTMP audio stream. + */ +struct RtmpStreamingAudioConfiguration { + /** + * Sampling rate (Hz). The default value is 44100 (i.e. 44.1kHz). + */ + int sampleRateHz; + + /** + * Number of bytes per sample. The default value is 2 (i.e. 16-bit PCM). + */ + int bytesPerSample; + + /** + * Number of channels. The default value is 1 (i.e. mono). + */ + int numberOfChannels; + + /** + * The target bitrate (Kbps) of the output audio stream to be published. + * The default value is 48 Kbps. + */ + int bitrate; + + RtmpStreamingAudioConfiguration(): sampleRateHz(44100), bytesPerSample(2), + numberOfChannels(1), bitrate(48000) {} +}; + +/** + * Configurations for the RTMP video stream. + */ +struct RtmpStreamingVideoConfiguration { + /** + * The width (in pixels) of the video. The default value is 640. + * + * @note + * - The value of the dimension (with the |height| below) does not indicate the orientation mode + * of the output ratio. For how to set the video orientation, + * see {@link OrientationMode OrientationMode}. + */ + int width; + + /** + * The height (in pixels) of the video. The default value is 360. + * + * @note + * - The value of the dimension (with the |width| above) does not indicate the orientation mode + * of the output ratio. For how to set the video orientation, + * see {@link OrientationMode OrientationMode}. + */ + int height; + + /** + * Frame rate (fps) of the output video stream to be published. The default + * value is 15 fps. + */ + int framerate; + + /** + * The target bitrate (Kbps) of the output video stream to be published. + * The default value is 800 Kbps. + */ + int bitrate; + + /** + * (For future use) The maximum bitrate (Kbps) for video. + * The default value is 960 Kbps. + */ + int maxBitrate; + + /** + * (For future use) The minimum bitrate (Kbps) for video. + * The default value is 600 Kbps. + */ + int minBitrate; + + /** + * The interval between two keyframes. + * The default value is 2000ms. + */ + unsigned int gopInMs; + + /** + * Whether the encoder enables hard coding or soft coding. + * The default value is 0. + * 0: default + * 1: hardware encoder + * 2: software encoder + */ + int encoderHwSwMode; + + /** + * Whether the encoder enables CBR coding or VBR coding. + * The default value is 0. + * 0: CBR + * 1: VBR + */ + int encoderBitrateControlMode; + + /** + * The orientation mode. + * See {@link ORIENTATION_MODE ORIENTATION_MODE}. + */ + ORIENTATION_MODE orientationMode; + + RtmpStreamingVideoConfiguration(): width(640), height(360), framerate(15), + bitrate(800), maxBitrate(960), minBitrate(600), gopInMs(2000), encoderHwSwMode(0),encoderBitrateControlMode(0), + orientationMode(ORIENTATION_MODE_ADAPTIVE) {} +}; + + +/** + * The RTMP Connection error codes. + */ +enum RTMP_CONNECTION_ERROR { + /** + * 0: No error occurs. + */ + RTMP_CONNECTION_ERR_OK = 0, + + /** + * 1: A general error occurs (no specified reason). + */ + RTMP_CONNECTION_ERR_FAILED = 1, + + /** + * 2: The rtmp url is invalid. + */ + RTMP_CONNECTION_ERR_INVALID_URL = 2, + + /** + * 3: Already exist stream name. + */ + RTMP_CONNECTION_ERR_BAD_NAME = 3, +}; + +/** + * The connection state between the SDK and the RTMP server. + */ +enum RTMP_CONNECTION_STATE { + /** + * 1: The SDK is disconnected from the RTMP server. + * + * This is the initial state when an RTMP Connetion is created by + * the \ref IAgoraService::createRtmoConnection "createRtmpConnection" method. + * + * The RTMP Connection also enters this state if you call the + * \ref disconnect "disconnect" method when the SDK is in the + * STATE_CONNECTING(2), STATE_CONNECTED(3), STATE_RECONNECTING(4) or + * STATE_FAILED(5) state. + */ + STATE_DISCONNECTED = 1, + + /** + * 2: The SDK is connecting to the RTMP server. + * + * The SDK goes to this state after you call the \ref connect "connect" method, + * indicating that the SDK is in the process of establishing a connection + * to the RTMP server. + * + * Once successfully connected, it enters the STATE_CONNECTED(3) state. + * + * If the SDK fails to connect to RTMP server, the SDK goes to STATE_FAILED(5). + */ + STATE_CONNECTING = 2, + + /** + * 3: The SDK is connected to the RTMP server. + * + * This state indicates that the SDK has established a connection to the + * RTMP server, and you can publish media streams through this connection. + * + * Once the connection is interrupted, for example, due to network deterioration or + * network type change, the SDK tries to reconnect to the RTMP server + * and enters the STATE_RECONNECTING(4) state. + */ + STATE_CONNECTED = 3, + + /** + * 4: The SDK is reconnecting to the RTMP server. + * + * This state indicates that the connection is interrupted by + * some network issue. The SDK keeps trying connecting to the + * server. If the SDK fails to reconnect, the SDK goes to + * STATE_FAILED(5). + */ + STATE_RECONNECTING = 4, + + /** + * 5: The SDK fails to connect to the RTMP server. + * + * In this state, SDK stops connecting to the server. Call the + * - \ref IRtmpConnection::disconnect "disconnect" method to leave this state and the + * - \ref IRtmpConnection::connect "connect" method to reconnect. + */ + STATE_FAILED = 5, + + /** + * 6: The SDK is reconnected to the RTMP server. + * + * This state indicates that the connection is interrupted by + * some network issue. The SDK keeps trying connecting to the + * server. If the SDK reconnected to server, the SDK goes to + * STATE_RECONNECTED(6). + */ + STATE_RECONNECTED = 6 +}; + +/** + * Configurations for the RTMP connection. + */ +struct RtmpConnectionConfiguration { + RtmpStreamingAudioConfiguration audioConfig; + RtmpStreamingVideoConfiguration videoConfig; + bool enableWriteFlvFile; + bool audioOnly; + RtmpConnectionConfiguration() : enableWriteFlvFile(false), + audioOnly(false) {} +}; + +/** + * The information on the RTMP Connection. + */ +struct RtmpConnectionInfo { + /** + * The state of the current connection: #RTMP_CONNECTION_STATE. + */ + RTMP_CONNECTION_STATE state; + + RtmpConnectionInfo() : state(STATE_DISCONNECTED) {} +}; + + +/** + * The IRtmpConnectionObserver class, which observes the RTMP connection state of the SDK. + */ +class IRtmpConnectionObserver { + public: + /** + * Occurs when the connection state between the SDK and the RTMP server changes to STATE_CONNECTED(3). + * + * @param connectionInfo The information of the current connection: RtmpConnectionInfo. + */ + virtual void onConnected(const RtmpConnectionInfo& connectionInfo) = 0; + + /** + * Occurs when the connection state between the SDK and the RTMP server changes to STATE_DISCONNECTED(1). + * + * @param connectionInfo The information of the current connection: RtmpConnectionInfo. + */ + virtual void onDisconnected(const RtmpConnectionInfo& connectionInfo) = 0; + + /** + * Occurs when the connection state between the SDK and RTMP server changes to STATE_RECONNECTING(4). + * + * @param connectionInfo The information of the current connection: RtmpConnectionInfo. + */ + virtual void onReconnecting(const RtmpConnectionInfo& connectionInfo) = 0; + + /** + * Occurs when the connection state between the SDK and RTMP server changes to STATE_RECONNECTED(6). + * + * @param connectionInfo The information of the current connection: RtmpConnectionInfo. + */ + virtual void onReconnected(const RtmpConnectionInfo& connectionInfo) = 0; + + /** + * Occurs when the connection state between the SDK and the RTMP server changes to STATE_FAILED(5). + * + * @param connectionInfo The connection information: RtmpConnectionInfo. + * @param errCode The error code for the connection failure. + */ + virtual void onConnectionFailure(const RtmpConnectionInfo& connectionInfo, + RTMP_CONNECTION_ERROR errCode) = 0; + + /** + * Occurs every 1s when the connection transmits data, report the current video bitrate, audio bitrate and video framerate. + * + * @param video_width The width of the video frame actually pushed out + * @param video_height The height of the video frame actually pushed out + * @param video_bitrate The actual bitrate of the video stream being pushed out + * @param audio_bitrate The actual bitrate of the audio stream being pushed out + * @param video_frame_rate The frame rate of the video stream actually pushed out + */ + virtual void onTransferStatistics(uint64_t video_width, uint64_t video_height, uint64_t video_bitrate, uint64_t audio_bitrate, uint64_t video_frame_rate, uint64_t push_video_frame_cnt, uint64_t pop_video_frame_cnt) = 0; + + virtual ~IRtmpConnectionObserver() {} +}; + +/** + * The IRtmpConnection class. + * + * With this class, an app can establish a connection to a RTMP server. + * Once connected, the app gets an RtmpUser object, which + * can publish media streams to the RTMP server. + * + * Connecting to the server is done asynchronous, and apps can listen for the + * connection states or events with IRtmpConnectionObserver. + */ +class IRtmpConnection : public RefCountInterface { + public: + ~IRtmpConnection() {} + + /** + * Connects to a RTMP server. + * + * When the method call succeeds, the RTMP connection state changes to + * STATE_CONNECTING(2). + * + * Depending on the success or failure of the connection establishment, the RTMP + * connection will make a second state transition to either + * STATE_CONNECTED(3) or STATE_FAILED(5). You will also be notified with the either + * onConnected() or onDisconnected(). + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 + * bytes. The URL address must not contain special characters, such as Chinese language characters. + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_INVALID_ARGUMENT: The passed in argument is invalid. + * - ERR_INVALID_STATE: The current connection state is not STATE_DISCONNECTED(3). + */ + virtual int connect(const char* url) = 0; + + /** + * Disconnects from the RTMP server. + * + * A successful call of this method changes the connection state to + * STATE_DISCONNECTED(4). You will be notified with the callback + * \ref onDisconnected "onDisconnected". + */ + virtual int disconnect() = 0; + + /** + * Gets the current connection information. + * + * @return + * - A pointer to the RtmpConnectionInfo object, if the method call succeeds. + * - An empty pointer NULL, if the method call fails. + */ + virtual RtmpConnectionInfo getConnectionInfo() = 0; + + /** + * Gets the IRtmpUser object. + * + * @return + * - A pointer to the IRtmpUser object, if the method call succeeds. + * - An empty pointer NULL, if the method call fails. + */ + virtual IRtmpLocalUser* getRtmpLocalUser() = 0; + + /** + * Registers an IRtmpConnectionObserver object. + * + * @param observer A pointer to the IRtmpConnectionObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerObserver(IRtmpConnectionObserver* observer, void(*safeDeleter)(IRtmpConnectionObserver*) = NULL) = 0; + + /** + * Releases the registered IRtmpConnectionObserver object. + * + * @param observer The pointer to the IRtmpConnectionObserver object created by the \ref registerObserver + * "registerObserver" method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterObserver(IRtmpConnectionObserver* observer) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtmpLocalUser.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtmpLocalUser.h new file mode 100644 index 0000000..aedc927 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraRtmpLocalUser.h @@ -0,0 +1,247 @@ +// +// Agora RTMP connection +// +// Created by Haonong Yu in 2020-02. +// Copyright (c) 2020 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "NGIAgoraAudioTrack.h" +#include "NGIAgoraVideoTrack.h" + +namespace agora { +namespace rtc { + +struct RtmpStreamingAudioConfiguration; +struct RtmpStreamingVideoConfiguration; + +/** + * The error occurs while publising audio stream. + */ +enum PublishAudioError { + /** + * 0: No error occurs. + */ + PUBLISH_AUDIO_ERR_OK = 0, + + /** + * 1: A general error occurs (no specified reason). + */ + PUBLISH_AUDIO_ERR_FAILED = 1, +}; + +/** + * The error occurs while publising video stream. + */ +enum PublishVideoError { + /** + * 0: No error occurs. + */ + PUBLISH_VIDEO_ERR_OK = 0, + + /** + * 1: A general error occurs (no specified reason). + */ + PUBLISH_VIDEO_ERR_FAILED = 1, +}; + +/** + * The IRtmpLocalUserObserver class. + */ +class IRtmpLocalUserObserver { + public: + virtual ~IRtmpLocalUserObserver() {} + + /** + * Occurs when the first packet of the local audio track is sent, indicating that the local audio track + * is successfully published. + * + * @param audioTrack The pointer to ILocalAudioTrack. + */ + virtual void onAudioTrackPublishSuccess(agora_refptr audioTrack) = 0; + virtual void onAudioTrackPublishStart(agora_refptr audioTrack) = 0; + virtual void onAudioTrackUnpublished(agora_refptr audioTrack) = 0; + + /** + * Occurs when the local audio track fails to be published. + * + * @param audioTrack The pointer to ILocalAudioTrack. + * @param error The error information: #RtmpAudioStreamError. + */ + virtual void onAudioTrackPublicationFailure(agora_refptr audioTrack, + PublishAudioError error) = 0; + + /** + * Occurs when the first packet of the local video track is sent, indicating that the local video track + * is successfully published. + * @param videoTrack The pointer to ILocalVideoTrack. + */ + virtual void onVideoTrackPublishSuccess(agora_refptr videoTrack) = 0; + virtual void onVideoTrackPublishStart(agora_refptr videoTrack) = 0; + virtual void onVideoTrackUnpublished(agora_refptr videoTrack) = 0; + + /** + * Occurs when the local video track fails to be published. + * + * @param videoTrack The pointer to ILocalVideoTrack. + * @param error The error information: #RtmpVideoStreamError. + */ + virtual void onVideoTrackPublicationFailure(agora_refptr videoTrack, + PublishVideoError error) = 0; +}; + +/** + * The IRtmpLocalUser class defines the behavior and state of the RTMP user. + * + * Once connected, a RTMP connection has its own user. Apps can get the + * user object using \ref agora::rtmp::IRtmpConnection::getUser + * "IRtmpConnection::getUser". + */ +class IRtmpLocalUser { + public: + + enum VideoBitrateAdjustType { + None = 0, + Increasing = 1, // The buffer is in good declining state to increase bitrate + Decreasing = 2, // The buffer is in bad increasing state to decrease bitrate + }; + + virtual ~IRtmpLocalUser() {} + + virtual int setAudioStreamConfiguration(const RtmpStreamingAudioConfiguration& config) = 0; + + virtual int setVideoStreamConfiguration(const RtmpStreamingVideoConfiguration& config) = 0; + + virtual int adjustRecordingSignalVolume(int volume) = 0; + + virtual int getRecordingSignalVolume(int32_t* volume) = 0; + + virtual int setAudioEnabled(bool enabled) = 0; + + virtual void adjustVideoBitrate(VideoBitrateAdjustType type) = 0; + + virtual int setVideoEnabled(bool enabled) = 0; + + /** + * Publishes a local audio track to the RTMP connection. + * + * @param audioTrack The local audio track to be published: ILocalAudioTrack. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int publishAudio(agora_refptr audioTrack) = 0; + + /** + * Stops publishing the local audio track to the RTMP connection. + * + * @param audioTrack The local audio track that you want to stop publishing: ILocalAudioTrack. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishAudio(agora_refptr audioTrack) = 0; + + /** + * Publishes a media player local audio track to the RTMP connection. + * + * @param audioTrack The local audio track to be published: ILocalAudioTrack. + * @param playerId The player source ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int publishMediaPlayerAudio(agora_refptr audioTrack, int32_t playerId=0) = 0; + + /** + * Stops publishing the media player local audio track to the RTMP connection. + * + * @param audioTrack The local audio track that you want to stop publishing: ILocalAudioTrack. + * @param playerId The player source ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishMediaPlayerAudio(agora_refptr audioTrack, int32_t playerId=0) = 0; + + /** + * Publishes a local video track to the RTMP connection. + * + * @param videoTrack The local video track to be published: ILocalVideoTrack. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int publishVideo(agora_refptr videoTrack) = 0; + + /** + * Stops publishing the local video track to the RTMP connection. + * + * @param videoTrack The local video track that you want to stop publishing: ILocalVideoTrack. + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishVideo(agora_refptr videoTrack) = 0; + + /** + * Registers a RTMP user observer object. + * + * You need to implement the IRtmpLocalUserObserver class in this method. Once registered, the + * IRtmpLocalUserObserver receives events sent by the IRtmpLocalUser object. + * + * @param observer The pointer to the IRtmpLocalUserObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerRtmpUserObserver(IRtmpLocalUserObserver* observer, void(*safeDeleter)(IRtmpLocalUserObserver*) = NULL) = 0; + + /** + * Releases the IRtmpLocalUserObserver object previously registered using registerRtmpUserObserver(). + * + * @param observer The pointer to the IRtmpLocalUserObserver object that you want to release. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisteRtmpUserObserver(IRtmpLocalUserObserver* observer) = 0; + /** + * Registers an audio frame observer object. + * + * @param observer A pointer to the audio frame observer object: IAudioFrameObserver. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Unregisters an audio frame observer object. + * + * @param observer A pointer to the audio frame observer object: IAudioFrameObserver. + */ + virtual void unregisterAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Registers a video frame observer object. + * + * @param observer A pointer to the video frame observer: IVideoFrameObserver. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoFrameObserver(media::base::IVideoFrameObserver* observer) = 0; + + /** + * Unregisters a video frame observer object. + * + * @param observer A pointer to the video frame observer: IVideoFrameObserver. + */ + virtual void unregisterVideoFrameObserver(media::base::IVideoFrameObserver* observer) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraScreenCapturer.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraScreenCapturer.h new file mode 100644 index 0000000..a5e5e16 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraScreenCapturer.h @@ -0,0 +1,202 @@ +// +// Agora SDK +// +// Copyright (c) 2019 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +/** + * The IScreenCapturer class, which provides access to the screen capturer. + */ +class IScreenCapturer : public RefCountInterface { + public: +#if defined (_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + /** + * Initializes the screen capturer by specifying a display ID. + * + * @note + * This method applies to macOS only. + * + * This method shares a whole or part of a screen specified by the display ID. + * @param displayId The display ID of the screen to be shared. This parameter specifies which screen you want + * to share. + * @param regionRect The reference to the relative location of the region to the screen: Rectangle. + * - If the specified region overruns the screen, only the region within the screen will be captured. + * - If you set `width` or `height` as 0, the whole screen will be captured. + * Note that the coordinates of rectangle are relative to the window and follows system specifications. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithDisplayId(uint32_t displayId, const Rectangle& regionRect) = 0; +#endif + +#if defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) + /** + * Initializes the screen capturer by specifying a screen Rect. + * + * @note + * This method applies to Windows only. + * + * This method shares a whole or part of a screen specified by the screen Rect. + * @param screenRect The reference to the Rect of the screen to be shared. This parameter specifies which screen you want + * to share. + * @param regionRect The reference to the relative location of the region to the screen. See \ref agora::rtc::Rectangle ®ionRect "regionRect". + * - If the specified region overruns the screen, only the region within the screen will be captured. + * - If you set `width` or `height` as 0, the whole screen will be captured. + * Note that the coordinates of rectangle are relative to the window and follows system specifications. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithScreenRect(const Rectangle& screenRect, + const Rectangle& regionRect) = 0; +#endif // TARGET_OS_MAC && !TARGET_OS_IPHONE + + /** + * Initializes the screen capturer by specifying a window ID. + * + * This method shares a whole or part of a window specified by the window ID. + * + * @note + * This method applies to Windows and macOS only. + * @param windowId The ID of the window to be shared. This parameter specifies which window you want + * to share. + * @param regionRect The reference to the relative location of the region to the window. See \ref agora::rtc::Rectangle ®ionRect "regionRect". + * - If the specified region overruns the window, only the region within the screen will be captured. + * - If you set `width` or `height` as 0, the whole window will be captured. + * Note that the coordinates of rectangle are relative to the window and follows system specifications. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithWindowId(view_t windowId, const Rectangle& regionRect) = 0; + + /** + * Sets the content hint for screen sharing. + * + * A content hint suggests the type of the content being shared, so that the SDK applies different + * optimization algorithms to different types of content. + * @param contentHint The content hint for screen capture: \ref rtc::VIDEO_CONTENT_HINT "VIDEO_CONTENT_HINT". + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_NOT_READY: No screen or window is being shared. + */ + virtual int setContentHint(VIDEO_CONTENT_HINT contentHint) = 0; + + /** + * Updates the screen capture region. + * @param regionRect The reference to the relative location of the region to the screen or window. See \ref agora::rtc::Rectangle "Rectangle". + * - If the specified region overruns the screen or window, the screen capturer captures only the region within it. + * - If you set `width` or `height` as 0, the SDK shares the whole screen or window. + * @return + * - 0: Success. + * - < 0: Failure. + * - No screen or window is being shared. + */ + virtual int updateScreenCaptureRegion(const Rectangle& regionRect) = 0; + + /** + * Set orientation of the captured screen image + * @param VIDEO_ORIENTATION orientaion of the device 0(by default), 90, 180, 270 + */ + virtual void setScreenOrientation(VIDEO_ORIENTATION orientation) = 0; + + /** + * Set frame rate of the screen capture source + * @param rate frame rate (in fps) + */ + virtual void setFrameRate(int rate) = 0; + +#if defined(__ANDROID__) + /** + * Initializes the screen capturer by specifying the Intent data obtained from MediaProjection. + * + * This method shares the whole screen. + * + * @note + * This method applies to Android only. + * @param data The Intent data from `onActivityResult (int requestCode, int resultCode, Intent data)` after you create + * an Intent from `MediaProjection` and sends the Intent to `startActivityForResult`. + * @param dimensions The reference to the captured screen's resolution in terms of width × height. + * - If you set `width` or `height` as 0, the dimensions will be the screen's width × height. + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_INVALID_ARGUMENT if data is null. + */ + virtual int initWithMediaProjectionPermissionResultData(void* data, + const VideoDimensions& dimensions) = 0; +#endif // __ANDROID__ + + protected: + ~IScreenCapturer() {} +}; + +#if defined(__ANDROID__) || TARGET_OS_IPHONE +class IScreenCapturer2 : public RefCountInterface { + public: + /** + * Screen capture's resolution. + * + * @param dimensions The reference to the captured screen's resolution in terms of width × height. + * - If you set `width` or `height` as 0, the dimensions will be the screen's width × height. + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_INVALID_ARGUMENT if data is null. + */ + virtual int setScreenCaptureDimensions(const VideoDimensions& dimensions) = 0; + + /** + * Updates the screen capture region. + * @param regionRect The reference to the relative location of the region to the screen or window. See \ref agora::rtc::Rectangle "Rectangle". + * - If the specified region overruns the screen or window, the screen capturer captures only the region within it. + * - If you set `width` or `height` as 0, the SDK shares the whole screen or window. + * @return + * - 0: Success. + * - < 0: Failure. + * - No screen or window is being shared. + */ + virtual int updateScreenCaptureRegion(const Rectangle& regionRect) = 0; + + /** + * Set frame rate of the screen capture source + * @param rate frame rate (in fps) + */ + virtual int setFrameRate(int rate) = 0; + + /** + * Set channels and sample rate of screen audio capturing + * @param channels: channels of system audio capture + * @param sampleRate: sample rate of system audio capture + * @return + * - 0: Sucess. + * - < 0: Failure + */ + virtual int setAudioRecordConfig(int channels, int sampleRate) = 0; + + /** + * Set volume of screen audio capturing + * @param volume: volume of system audio capture + * @return + * - 0: Sucess. + * - < 0: Failure + */ + virtual int setAudioVolume(uint32_t volume) = 0; + + protected: + virtual ~IScreenCapturer2() {} +}; +#endif + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoFrame.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoFrame.h new file mode 100644 index 0000000..ab12ff5 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoFrame.h @@ -0,0 +1,265 @@ + +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" + +#ifndef OPTIONAL_ENUM_CLASS +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_CLASS enum class +#else +#define OPTIONAL_ENUM_CLASS enum +#endif +#endif + +namespace agora { +namespace rtc { + +/** + * This structure defines the video frame of texture type on Android + * @note For technical preview, not supported for the moment. Use RawPixelBuffer instead. + * + */ +struct TextureInfo { + OPTIONAL_ENUM_CLASS TextureType { + kGlTextureOes, + kGlTexture2D, + }; + OPTIONAL_ENUM_CLASS EglContextType { + kEglContext10, + kEglContext14, + }; + + TextureType texture_type; + EglContextType context_type; + void* shared_context; + int texture_id; + int64_t fence_object; + float transform_matrix[16]; +}; + +/** + * This structure defines the raw video frame data in memory + * + */ +struct RawPixelBuffer { + OPTIONAL_ENUM_CLASS Format { + kUnknown, + kI420, + kI422, + kNV21, + kNV12, + kRGBA, + kARGB, + kBGRA + }; + Format format; + uint8_t* data; + int size; +}; + +struct PaddedRawPixelBuffer { + RawPixelBuffer::Format format; + uint8_t* data; + int size; + int stride; + PaddedRawPixelBuffer() + : data(NULL), size(0), stride(0) {} +}; + +struct ColorSpace { + enum PrimaryID { + // The indices are equal to the values specified in T-REC H.273 Table 2. + PRIMARYID_BT709 = 1, + PRIMARYID_UNSPECIFIED = 2, + PRIMARYID_BT470M = 4, + PRIMARYID_BT470BG = 5, + PRIMARYID_SMPTE170M = 6, // Identical to BT601 + PRIMARYID_SMPTE240M = 7, + PRIMARYID_FILM = 8, + PRIMARYID_BT2020 = 9, + PRIMARYID_SMPTEST428 = 10, + PRIMARYID_SMPTEST431 = 11, + PRIMARYID_SMPTEST432 = 12, + PRIMARYID_JEDECP22 = 22, // Identical to EBU3213-E + }; + + enum RangeID { + // The indices are equal to the values specified at + // https://www.webmproject.org/docs/container/#colour for the element Range. + RANGEID_INVALID = 0, + // Limited Rec. 709 color range with RGB values ranging from 16 to 235. + RANGEID_LIMITED = 1, + // Full RGB color range with RGB valees from 0 to 255. + RANGEID_FULL = 2, + // Range is defined by MatrixCoefficients/TransferCharacteristics. + RANGEID_DERIVED = 3, + }; + + enum MatrixID { + // The indices are equal to the values specified in T-REC H.273 Table 4. + MATRIXID_RGB = 0, + MATRIXID_BT709 = 1, + MATRIXID_UNSPECIFIED = 2, + MATRIXID_FCC = 4, + MATRIXID_BT470BG = 5, + MATRIXID_SMPTE170M = 6, + MATRIXID_SMPTE240M = 7, + MATRIXID_YCOCG = 8, + MATRIXID_BT2020_NCL = 9, + MATRIXID_BT2020_CL = 10, + MATRIXID_SMPTE2085 = 11, + MATRIXID_CDNCLS = 12, + MATRIXID_CDCLS = 13, + MATRIXID_BT2100_ICTCP = 14, + }; + + enum TransferID { + // The indices are equal to the values specified in T-REC H.273 Table 3. + TRANSFERID_BT709 = 1, + TRANSFERID_UNSPECIFIED = 2, + TRANSFERID_GAMMA22 = 4, + TRANSFERID_GAMMA28 = 5, + TRANSFERID_SMPTE170M = 6, + TRANSFERID_SMPTE240M = 7, + TRANSFERID_LINEAR = 8, + TRANSFERID_LOG = 9, + TRANSFERID_LOG_SQRT = 10, + TRANSFERID_IEC61966_2_4 = 11, + TRANSFERID_BT1361_ECG = 12, + TRANSFERID_IEC61966_2_1 = 13, + TRANSFERID_BT2020_10 = 14, + TRANSFERID_BT2020_12 = 15, + TRANSFERID_SMPTEST2084 = 16, + TRANSFERID_SMPTEST428 = 17, + TRANSFERID_ARIB_STD_B67 = 18, + }; + + PrimaryID primaries; + TransferID transfer; + MatrixID matrix; + RangeID range; + + ColorSpace() + : primaries(PRIMARYID_UNSPECIFIED), transfer(TRANSFERID_UNSPECIFIED), + matrix(MATRIXID_UNSPECIFIED), range(RANGEID_INVALID) {} +}; + +/** + * This structure defines underlying detailed video frame data of @ref agora::rtc::IVideoFrame + * + */ +struct VideoFrameData { + OPTIONAL_ENUM_CLASS Type { + kRawPixels, // Raw pixels in memory + kTexture, // Deprecated Android: GL_TEXTURE_2D/GL_TEXTURE_OES + kCVPixelBuffer, // iOS: CVPixelBufferRef + kPaddedRawPixels, // Raw pixels with paddings + kTextureOES,// Android: GL_TEXTURE_OES + kTexture2D, // Android: GL_TEXTURE_2D + }; + Type type; + union { + TextureInfo texture; // Android (To be supported) + RawPixelBuffer pixels; // All platform + void* cvpixelbuffer; // iOS (To be supported) + }; + int width; + int height; + int rotation; + ColorSpace color_space; + int64_t timestamp_ms; // Capture time in milli-seconds +}; + +struct VideoFrameDataV2 : public VideoFrameData { + PaddedRawPixelBuffer padded_pixels; // All platform +}; + +OPTIONAL_ENUM_CLASS VideoFrameMetaDataType { + kAlphaChannel, + kScreenMetaInfo, + kVideoSourceType, + kFaceInfo, + // Add other types afterwards +}; + +struct AlphaChannel { + uint8_t* data; + int size; +}; + +typedef int32_t VideoSourceType; + +/** + * The IVideoFrame class defines the interface to + * send video frame data to the SDK or get video frame data from the SDK. + */ +class IVideoFrame : public RefCountInterface { + public: + /** + * Get the concrete video frame data of the underlying buffer. + * @param data [out] The video frame data. + * @return + * - int: error code. 0 for success. + */ + virtual int getVideoFrameData(VideoFrameData& data) const = 0; + + /** + * Fill the underlying buffer with source buffer info contained in VideoFrameInfo + * For frames of type "Type::kMemPixels", This function first tries to fill in-place with no copy and reallocation. + * When it fails, a copy or copy-plus-reallocation may happen + * @param data [in] Data to be filled in. + * @return + * - 0: if succeeds + * - <0: failure + */ + virtual int fillVideoFrameData(const VideoFrameData& data) = 0; + + /** + * Get the underlying meta data of the given type. + * e.g. If type is VideoFrameMetaDataType::kAlphaChannel, then data value can be casted to AlphaChannel; + * @param type @ref VideoFrameMetaDataType type of the meta data wanted + * @param data [out] pointer to the the meta data object of the given type + * @return + * - 0: if succeeds + * - <0: failure + */ + virtual int getVideoFrameMetaData(VideoFrameMetaDataType type, void* data) = 0; + + /** + * Fill the underlying meta data of the given type. + * e.g. If type is VideoFrameMetaDataType::kAlphaChannel, then data should point to AlphaChannel object; + * @param type @ref VideoFrameMetaDataType type of the meta data to fill + * @param data [in] pointer to the the meta data object of the given type + * @return + * - 0: if succeeds + * - <0: failure + */ + virtual int fillVideoFrameMetaData(VideoFrameMetaDataType type, const void* data) = 0; + + protected: + ~IVideoFrame() {} +}; + +class IVideoFrameMemoryPool : public RefCountInterface { + public: + /** + * Create IVideoFrame + * @param data video frame data of the new video frame + * @param metatypes pointer to the array of meta types + * @param count number of the meta types in the array + */ + virtual agora::agora_refptr createVideoFrame( + const VideoFrameData& data, const VideoFrameMetaDataType* metatypes = NULL, int count = 0) = 0; + protected: + virtual ~IVideoFrameMemoryPool() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoMixerSource.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoMixerSource.h new file mode 100644 index 0000000..f179cda --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoMixerSource.h @@ -0,0 +1,159 @@ +// +// Agora SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" +#include "IAgoraService.h" + +namespace agora { +namespace rtc { + +class IVideoTrack; + +struct MixerLayoutConfig { + int32_t x; + int32_t y; + int32_t width; + int32_t height; + int32_t zOrder; // larger zOrder prioritizes smaller ones + float alpha; + bool mirror; + const char* image_path; // url of the place holder picture + + MixerLayoutConfig() : x(0), y(0), width(0), height(0), zOrder(0), alpha(1.0), mirror(false), image_path(NULL) {} + MixerLayoutConfig(int ox, int oy, int w, int h, int order) : x(ox), y(oy), width(w), height(h), zOrder(order), alpha(1.0), mirror(false), image_path(NULL) {} +}; + +enum ImageType { + kPng, + kJpeg, + kGif +}; + +/** + * The IVideoMixerSource class abstracts a multi-in-multi-out video source which receives video + * streams from multiple local or remote video tracks and generate mixed video stream in user defined output + * format. When only one video track is added to the mixer, it simply forwards the incoming video frames + * to its sinks. + */ +class IVideoMixerSource : public RefCountInterface { +public: + /** + * Add a video track for mixing. + * @param id The unique id of the stream. + * @param track The instance of the video track that you want mixer to receive its video stream. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int addVideoTrack(const char* id, agora_refptr track) = 0; + /** + * Remove the video track. + * @param id The unique id of the stream. + * @param track The instance of the video track that you want to remove from the mixer. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int removeVideoTrack(const char* id, agora_refptr track) = 0; + /** + * Configures the layout of video frames comming from a specific track (indicated by uid) + * on the mixer canvas. + * @param id The unique id of the stream. + * @param config The layout configuration + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setStreamLayout(const char* id, const MixerLayoutConfig& config) = 0; + /** + * Remove the user layout on the mixer canvas + * @param id The unique id of the stream. + * @param uid The uid of the stream. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int delStreamLayout(const char* id) = 0; + /** + * Add a image source to the mixer with its layout configuration on the mixer canvas. + * @param id The unique id of the image. + * @param config The layout configuration + * @return + * 0 - Success + * <0 - Failure + */ + virtual int addImageSource(const char* id, const MixerLayoutConfig& config, ImageType type = kPng) = 0; + /** + * Delete a image source to the mixer. + * @param id The unique id of the image. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int delImageSource(const char* id) = 0; + /** + * Clear all the layout settings set previously + */ + virtual void clearLayout() = 0; + /** + * Refresh the user layout on the mixer canvas + * @return + * 0 - Success + * <0 - Failure + */ + virtual int refresh() = 0; + /** + * Set the mixer canvas background to override the default configuration + * @param width width of the canvas + * @param height height of the canvas + * @param fps fps of the mixed video stream + * @param color_argb mixer canvas background color in argb + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setBackground(uint32_t width, uint32_t height, int fps, uint32_t color_argb = 0) = 0; + /** + * Set the mixer canvas background to override the default configuration + * @param width width of the canvas + * @param height height of the canvas + * @param fps fps of the mixed video stream + * @param url URL of the canvas background image + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setBackground(uint32_t width, uint32_t height, int fps, const char* url) = 0; + /** + * Set the rotation of the mixed video stream + * @param rotation:0:none, 1:90°, 2:180°, 3:270° + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setRotation(uint8_t rotation) = 0; + /** + * Get the average delay in ms introduced by the mixer module, which includes the average + * mixing delay plus the encoder delay. + * @return + * delay in ms + */ + virtual int getAvgMixerDelay() = 0; + /** + * Set the master clock source for mixed video frame. The master clock source serves as the + * reference clock for audio/video synchronization after mixing. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setMasterClockSource(const char* id = NULL) = 0; +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoTrack.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoTrack.h new file mode 100644 index 0000000..3ac6eda --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/NGIAgoraVideoTrack.h @@ -0,0 +1,531 @@ + +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" + +#ifndef OPTIONAL_OVERRIDE +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_OVERRIDE override +#else +#define OPTIONAL_OVERRIDE +#endif +#endif + +namespace agora { +namespace rtc { +class IVideoFilter; +class IVideoEncodedFrameObserver; +class IMediaPacketReceiver; +class IVideoSinkBase; + +enum VideoTrackType { + LOCAL_VIDEO_TRACK, + REMOTE_VIDEO_TRACK, + REMOTE_VIDEO_IMAGE_TRACK, +}; + +/** + * The `IVideoTrack` class defines the behavior and status of a video track. + */ +class IVideoTrack : public RefCountInterface { + public: + /** + * Adds a video filter to the video track. + * + * Add a video filter in either of the following ways: + * - Use the \ref agora::rtc::IMediaNodeFactory "IMediaNodeFactory" object to create a built-in video filter. + * - Use a custom video filter by implementing the \ref agora::rtc::IVideoFilter "IVideoFilter" class. + * + * To add multiple filters, call this method multiple times. The order of the added filters depends on when + * the app successfully adds the filter. + * + * @param filter The video filter that you want to add to the video track. + * @param position The position where the filter is added. + * @param id id of the filter + * @return + * - `true`: The video filter is added successfully. + * - `false`: The video filter fails to be added. + */ + virtual bool addVideoFilter( + agora_refptr filter, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER, + const char* id = NULL) = 0; + + /** + * Removes the video filter added by `addVideoFilter` from the video track. + * + * @param filter The video filter that you want to remove: `IVideoFilter`. + * @param position The position of the filter. + * @id id of the filter + * @return + * - `true`: The video filter is removed successfully. + * - `false`: The video filter fails to be removed. + */ + virtual bool removeVideoFilter( + agora_refptr filter, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER, + const char* id = NULL) = 0; + + /** + * Whether a video filter exists + * @param id id of the filter + * @return + * - true: exist + * - false: not exist + */ + virtual bool hasVideoFilter(const char* id, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER) = 0; + + /** + * Adds a video renderer to the video track. + * + * Add a video renderer in either of the following ways: + * - Use the built-in video renderer by implementing the `IVideoRenderer` in the `IMediaNodeFactory` class. + * - Use a custom video renderer by implementing the `IVideoSinkBase` class. + * + * @param videoRenderer The video renderer that you want to add: IVideoSinkBase. + * @param position The position where the renderer is added. + * + * @return + * - `true`: The video renderer is added successfully. + * - `false`: The video renderer fails to be added. + */ + virtual bool addRenderer(agora_refptr videoRenderer, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_PRE_RENDERER) = 0; + /** + * Removes the video renderer added by `addRenderer` from the video track. + * + * @param videoRenderer The video renderer that you want to remove: IVideoSinkBase. + * @param position The position where the renderer is removed: \ref media::base::VIDEO_MODULE_POSITION "VIDEO_MODULE_POSITION". + * @return + * - `true`: The video renderer is removed successfully. + * - `false`: The video renderer fails to be removed. + */ + virtual bool removeRenderer(agora_refptr videoRenderer, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_PRE_RENDERER) = 0; + /** + * Get the track type of the video track + * @return + * - VideoTrackType + */ + virtual VideoTrackType getType() = 0; + + /** + * Enable / Disable specified video filter + * @param id id of the filter + * @param enable enable / disable the filter with given id + * @return + * - 0: success + * - <0: failure + */ + virtual int enableVideoFilter(const char* id, bool enable) { return -1; } + + /** + * set the properties of the specified video filter + * @param id id of the filter + * @param key key of the property + * @param json_value json str value of the property + * @return + * - 0: success + * - <0: failure + */ + virtual int setFilterProperty(const char* id, const char* key, const char* json_value) { return -1; } + + /** + * get the properties of the specified video filter + * @param id id of the filter + * @param key key of the property + * @param json_value json str value of the property + * @return + * - 0: success + * - <0: failure + */ + virtual int getFilterProperty(const char* id, const char* key, char* json_value, size_t buf_size) { return -1; } + + protected: + ~IVideoTrack() {} +}; + +/** + * The statistics of the local video track. + */ +struct LocalVideoTrackStats { + /** + * The number of streams. + */ + uint64_t number_of_streams; + /** + * The number of bytes of the major stream. + */ + uint64_t bytes_major_stream; + /** + * The number of bytes of the minor stream. + */ + uint64_t bytes_minor_stream; + /** + * The number of encoded frames. + */ + uint32_t frames_encoded; + /** + * The SSRC (synchronization source) of the major stream. + */ + uint32_t ssrc_major_stream; + /** + * The SSRC (synchronization source) of the minor stream. + */ + uint32_t ssrc_minor_stream; + /** + * The capture frame rate of the video. + */ + int capture_frame_rate; + /** + * The regulated frame rate of capture frame rate according to video encoder configuration. + */ + int regulated_capture_frame_rate; + /** + * The input frame rate of the encoder. + */ + int input_frame_rate; + /** + * The output frame rate of the encoder. + */ + int encode_frame_rate; + /** + * The rendering frame rate. + */ + int render_frame_rate; + /** + * The target bitrate (bps). + */ + int target_media_bitrate_bps; + /** + * The frame rate excluding FEC. + */ + int media_bitrate_bps; + /** + * The total frame rate including FEC. + */ + int total_bitrate_bps; // Include FEC + /** + * The capture frame width (pixel). + */ + int capture_width; + /** + * The capture frame height (pixel). + */ + int capture_height; + /** + * The regulated frame width (pixel) of capture frame width according to video encoder configuration. + */ + int regulated_capture_width; + /** + * The regulated frame height (pixel) of capture frame height according to video encoder configuration. + */ + int regulated_capture_height; + /** + * The frame width (pixel). + */ + int width; + /** + * The frame height (pixel). + */ + int height; + uint32_t encoder_type; + uint32_t hw_encoder_accelerating; + /** + * The average time diff between frame captured and framed encoded. + */ + uint32_t uplink_cost_time_ms; + /** Quality change of the local video in terms of target frame rate and + * target bit rate in this reported interval. See #QUALITY_ADAPT_INDICATION. + */ + QUALITY_ADAPT_INDICATION quality_adapt_indication; + /** + * The video packet loss rate (%) from the local client to the Agora edge server before applying the anti-packet loss strategies. + */ + unsigned short txPacketLossRate; + + /** The brightness level of the video image captured by the local camera. See #CAPTURE_BRIGHTNESS_LEVEL_TYPE. + */ + CAPTURE_BRIGHTNESS_LEVEL_TYPE capture_brightness_level; + + LocalVideoTrackStats() : number_of_streams(0), + bytes_major_stream(0), + bytes_minor_stream(0), + frames_encoded(0), + ssrc_major_stream(0), + ssrc_minor_stream(0), + capture_frame_rate(0), + regulated_capture_frame_rate(0), + input_frame_rate(0), + encode_frame_rate(0), + render_frame_rate(0), + target_media_bitrate_bps(0), + media_bitrate_bps(0), + total_bitrate_bps(0), + capture_width(0), + capture_height(0), + regulated_capture_width(0), + regulated_capture_height(0), + width(0), + height(0), + encoder_type(0), + uplink_cost_time_ms(0), + quality_adapt_indication(ADAPT_NONE), + txPacketLossRate(0), + capture_brightness_level(CAPTURE_BRIGHTNESS_LEVEL_INVALID) {} +}; + +/** + * `ILocalVideoTrack` is the basic class for local video tracks, providing the main methods of local video tracks. + * You can create a local video track by calling one of the following methods: + * - `createCameraVideoTrack` + * - `createScreenVideoTrack` + * - `createMixedVideoTrack` + * - `createCustomVideoTrack` + * - `createMediaPlayerVideoTrack` + * + * After creating local video tracks, you can publish one or more local video tracks by calling \ref agora::rtc::ILocalUser::publishVideo "publishVideo". + */ +class ILocalVideoTrack : public IVideoTrack { + public: + /** + * Enables or disables the local video track. + * + * Once the local video track is enabled, the SDK allows for local video capturing, processing, and encoding. + * + * @param enable Determines whether to enable the local video track. + * - `true`: Enable the local video track. + * - `false`: Disable the local video track. + */ + virtual void setEnabled(bool enable) = 0; + + /** + * Sets the video encoder configuration. + * + * Each video encoder configuration corresponds to a set of video parameters, including the + * resolution, frame rate, bitrate, and video orientation. + * + * The configurations specified in this method are the maximum values under ideal network conditions. If + * the video engine cannot render the video using the specified parameters due to poor network + * conditions, the configurations further down the list are considered until a successful configuration + * is found. + * + * @param config The reference to the video encoder configuration. See \ref agora::rtc::VideoEncoderConfiguration "VideoEncoderConfiguration". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVideoEncoderConfiguration(const VideoEncoderConfiguration& config) = 0; + + /** + * Set simulcast stream mode, enable, disable or auto enable + * + * @param mode Determines simulcast stream mode. See \ref agora::rtc::SIMULCAST_STREAM_MODE "SIMULCAST_STREAM_MODE". + * @param config The reference to the configurations for the simulcast stream mode. See \ref agora::rtc::SimulcastStreamConfig "SimulcastStreamConfig". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSimulcastStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& config) = 0; + + /** + * Gets the state of the local video stream. + * + * @return The current state of the local video stream. + */ + virtual LOCAL_VIDEO_STREAM_STATE getState() = 0; + + /** + * Gets the statistics of the local video track. + * + * @param[out] stats The reference to the statistics of the local video track. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getStatistics(LocalVideoTrackStats& stats) = 0; + + virtual VideoTrackType getType() OPTIONAL_OVERRIDE { return LOCAL_VIDEO_TRACK; } + + protected: + ~ILocalVideoTrack() {} +}; +/** + * The struct of RemoteVideoTrackStats. + */ +struct RemoteVideoTrackStats { + /** + The ID of the remote user. + */ + uid_t uid; + /** + * The overall delay (ms) of the video frames. + */ + int delay; + /** + * The width (pixel) of the remote video track. + */ + int width; + /** + * The height (pixel) of the remote video track. + */ + int height; + /** + * The bitrate (Kbps) received in the reported interval. + */ + int receivedBitrate; + /** The decoder output frame rate (fps) of the remote video track. + */ + int decoderOutputFrameRate; + /** The render output frame rate (fps) of the remote video track. + */ + int rendererOutputFrameRate; + /** The video frame loss rate (%) of the remote video stream in the reported interval. + */ + int frameLossRate; + /** The packet loss rate (%) of the remote video track after using the anti-packet-loss method. + */ + int packetLossRate; + /** + * The remote video stream type: #VIDEO_STREAM_TYPE. + */ + VIDEO_STREAM_TYPE rxStreamType; + /** + The total freeze time (ms) of the remote video track after the remote user joins the channel. + In a video session where the frame rate is set to no less than 5 fps, video freeze occurs when + the time interval between two adjacent renderable video frames is more than 500 ms. + */ + int totalFrozenTime; + /** + The total video freeze time as a percentage (%) of the total time when the video is available. + */ + int frozenRate; + /** + * The number of video bytes received. + */ + uint32_t received_bytes; + /** + The total number of decoded video frames. + */ + uint32_t totalDecodedFrames; + /** + The offset (ms) between audio and video stream. A positive value indicates the audio leads the + video, and a negative value indicates the audio lags the video. + */ + int avSyncTimeMs; + /** + The average offset(ms) between receive first packet which composite the frame and the frame + ready to render. + */ + uint32_t downlink_process_time_ms; + /** + The average time cost in renderer. + */ + uint32_t frame_render_delay_ms; + /** + The total time (ms) when the remote user neither stops sending the video + stream nor disables the video module after joining the channel. + */ + uint64_t totalActiveTime; + /** + The total publish duration (ms) of the remote video stream. + */ + uint64_t publishDuration; + /** + decoded frame vqa mos value after all filter. + */ + int vqa_mos; + /** + vqa avg cost ms + */ + int vqa_avg_cost_ms; + + RemoteVideoTrackStats() : uid(0), delay(0), width(0), height(0), + receivedBitrate(0), decoderOutputFrameRate(0), rendererOutputFrameRate(0), + frameLossRate(0), packetLossRate(0), rxStreamType(VIDEO_STREAM_HIGH), + totalFrozenTime(0), frozenRate(0), received_bytes(0), totalDecodedFrames(0), avSyncTimeMs(0), + downlink_process_time_ms(0), frame_render_delay_ms(0), totalActiveTime(0), + publishDuration(0), vqa_mos(0), vqa_avg_cost_ms(0) {} +}; + +/** + * The IRemoteVideoTrack class. + */ +class IRemoteVideoTrack : public IVideoTrack { + public: + /** + * Gets the statistics of the remote video track. + * @param[out] stats The reference to the statistics of the remote video track. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getStatistics(RemoteVideoTrackStats& stats) = 0; + /** + * Gets the state of the remote video track. + * @return The state of the remote video track. + */ + virtual REMOTE_VIDEO_STATE getState() = 0; + /** + * Gets the information of the remote video track. + * @param[out] info The reference to the information of the remote video track. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getTrackInfo(VideoTrackInfo& info) = 0; + /** + * Registers an \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * + * You need to implement the `IVideoEncodedFrameObserver` class in this method. Once you successfully register + * the encoded image receiver, the SDK triggers the \ref agora::rtc::IVideoEncodedFrameObserver::onEncodedVideoFrameReceived "onEncodedVideoFrameReceived" callback when it receives the + * encoded video image. + * + * @param encodedObserver The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* encodedObserver) = 0; + /** + * Releases the \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * @param encodedObserver The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* encodedObserver) = 0; + + /** + * Registers an \ref agora::rtc::IMediaPacketReceiver "IMediaPacketReceiver" object. + * + * You need to implement the `IMediaPacketReceiver` class in this method. Once you successfully register + * the media packet receiver, the SDK triggers the \ref agora::rtc::IMediaPacketReceiver::onMediaPacketReceived "onMediaPacketReceived" callback when it receives the + * video packet. + * + * @param videoReceiver The pointer to the `IMediaPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerMediaPacketReceiver(IMediaPacketReceiver* videoReceiver) = 0; + /** + * Releases the \ref agora::rtc::IMediaPacketReceiver "IMediaPacketReceiver" object. + * @param videoReceiver The pointer to the `IMediaPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterMediaPacketReceiver(IMediaPacketReceiver* videoReceiver) = 0; + + virtual VideoTrackType getType() OPTIONAL_OVERRIDE { return REMOTE_VIDEO_TRACK; } + + protected: + ~IRemoteVideoTrack() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/time_utils.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/time_utils.h new file mode 100644 index 0000000..bb4759b --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Headers/time_utils.h @@ -0,0 +1,85 @@ +// +// Agora Media SDK +// +// Copyright (c) 2021 Agora IO. All rights reserved. +// + +#pragma once +#include + +namespace agora { +namespace base { + +class NtpTime { + public: + static const uint64_t ntpFracPerSecond = 4294967296; + + NtpTime() : ms_(0) {} + + NtpTime(uint64_t ms) : ms_(ms) {} + + NtpTime(uint32_t seconds, uint32_t fractions) { + const double fracMs = fractions * 1000.0 / static_cast(ntpFracPerSecond); + ms_ = static_cast(seconds) * 1000 + static_cast(0.5 + fracMs); + } + + operator uint64_t() const { return ms_; } + + /** Gets the NTP time. + * + * @return + * - The wallclock time which is in milliseconds relative to 0h UTC on 1 January 1900. + */ + uint64_t Ms() const { + return ms_; + } + + /** Check that whether the NtpTime object is valid + * + * - `true`: the NtpTime object is valid. + * - `false`: the NtpTime object is invalid. + */ + bool Valid() const { return ms_ != 0; } + + /** Gets the integer part of the NTP timestamp. + * + * @return + * - An uint32_t value. + */ + uint32_t ToSeconds() const { + return static_cast(ms_ / 1000); + } + + /** Gets the fractional part of the NTP timestamp. + * + * @return + * - An uint32_t value. + */ + uint32_t ToFractions() const { + return static_cast((ms_ % 1000) * static_cast(ntpFracPerSecond) / 1000.0); + } + + /** Gets the NTP timestamp. + * + * @note + * - The full resolution NTP timestamp is a 64-bit unsigned fixed-point number with the integer part in the first 32 bits and the fractional part in the last 32 bits. + * + * @return + * - An uint64_t value. + */ + uint64_t ToTimestamp() const { + return ToSeconds() * ntpFracPerSecond + ToFractions(); + } + + private: + uint64_t ms_; +}; + +inline bool operator==(const NtpTime& n1, const NtpTime& n2) { + return static_cast(n1) == static_cast(n2); +} + +inline bool operator!=(const NtpTime& n1, const NtpTime& n2) { return !(n1 == n2); } + +} // namespace base +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Info.plist b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Info.plist new file mode 100644 index 0000000..6d39ba1 Binary files /dev/null and b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Info.plist differ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Modules/module.modulemap b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Modules/module.modulemap new file mode 100644 index 0000000..937fbd4 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/Modules/module.modulemap @@ -0,0 +1,16 @@ +framework module AgoraRtcKit { + header "AgoraRtcKit.h" + header "AgoraRtcEngineKit.h" + header "AgoraRtcEngineKitEx.h" + header "AgoraBaseDelegate.h" + header "AgoraRtcAudioSpectrumDelegate.h" + header "AgoraMediaFilterEventDelegate.h" + header "AgoraConstants.h" + header "AgoraEnumerates.h" + header "AgoraObjects.h" + header "AgoraRtcEngineDelegate2.h" + header "AgoraRtcMediaPlayerProtocol.h" + header "AgoraSpatialAudioKit.h" + header "AgoraMusicContentCenter.h" + export * +} diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/PrivacyInfo.xcprivacy b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..88a9660 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_armv7/AgoraRtcKit.framework/PrivacyInfo.xcprivacy @@ -0,0 +1,37 @@ + + + + + NSPrivacyTracking + + NSPrivacyCollectedDataTypes + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + DDA9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + + diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/AgoraRtcKit b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/AgoraRtcKit new file mode 100755 index 0000000..78579cc Binary files /dev/null and b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/AgoraRtcKit differ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraAtomicOps.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraAtomicOps.h new file mode 100644 index 0000000..f0c4610 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraAtomicOps.h @@ -0,0 +1,73 @@ +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. +#pragma once + +#if defined(_WIN32) +// clang-format off +// clang formating would change include order. + +// Include WinSock2.h before including to maintain consistency with +// win32.h. To include win32.h directly, it must be broken out into its own +// build target. +#include +#include +// clang-format on +#endif // _WIN32 + +namespace agora { + +class AtomicOps { + public: +#if defined(_WIN32) + // Assumes sizeof(int) == sizeof(LONG), which it is on Win32 and Win64. + static int Increment(volatile int* i) { + return ::InterlockedIncrement(reinterpret_cast(i)); + } + static int Decrement(volatile int* i) { + return ::InterlockedDecrement(reinterpret_cast(i)); + } + static int AcquireLoad(volatile const int* i) { return *i; } + static void ReleaseStore(volatile int* i, int value) { *i = value; } + static int CompareAndSwap(volatile int* i, int old_value, int new_value) { + return ::InterlockedCompareExchange(reinterpret_cast(i), + new_value, old_value); + } + // Pointer variants. + template + static T* AcquireLoadPtr(T* volatile* ptr) { + return *ptr; + } + template + static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) { + return static_cast(::InterlockedCompareExchangePointer( + reinterpret_cast(ptr), new_value, old_value)); + } +#else + static int Increment(volatile int* i) { return __sync_add_and_fetch(i, 1); } + static int Decrement(volatile int* i) { return __sync_sub_and_fetch(i, 1); } + static int AcquireLoad(volatile const int* i) { + return __atomic_load_n(i, __ATOMIC_ACQUIRE); + } + static void ReleaseStore(volatile int* i, int value) { + __atomic_store_n(i, value, __ATOMIC_RELEASE); + } + static int CompareAndSwap(volatile int* i, int old_value, int new_value) { + return __sync_val_compare_and_swap(i, old_value, new_value); + } + // Pointer variants. + template + static T* AcquireLoadPtr(T* volatile* ptr) { + return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); + } + template + static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) { + return __sync_val_compare_and_swap(ptr, old_value, new_value); + } +#endif // _WIN32 +}; + +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraBase.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraBase.h new file mode 100644 index 0000000..b57ff7c --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraBase.h @@ -0,0 +1,6096 @@ +// +// Agora Engine SDK +// +// Created by Sting Feng in 2017-11. +// Copyright (c) 2017 Agora.io. All rights reserved. +// + +// This header file is included by both high level and low level APIs, +#pragma once // NOLINT(build/header_guard) + +#include +#include +#include +#include +#include + +#include "IAgoraParameter.h" +#include "AgoraMediaBase.h" +#include "AgoraRefPtr.h" +#include "AgoraOptional.h" + +#define MAX_PATH_260 (260) + +#if defined(_WIN32) + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif // !WIN32_LEAN_AND_MEAN +#if defined(__aarch64__) +#include +#endif +#include + +#if defined(AGORARTC_EXPORT) +#define AGORA_API extern "C" __declspec(dllexport) +#else +#define AGORA_API extern "C" __declspec(dllimport) +#endif // AGORARTC_EXPORT + +#define AGORA_CALL __cdecl + +#define __deprecated + +#elif defined(__APPLE__) + +#include + +#define AGORA_API extern "C" __attribute__((visibility("default"))) +#define AGORA_CALL + +#elif defined(__ANDROID__) || defined(__linux__) + +#define AGORA_API extern "C" __attribute__((visibility("default"))) +#define AGORA_CALL + +#define __deprecated + +#else // !_WIN32 && !__APPLE__ && !(__ANDROID__ || __linux__) + +#define AGORA_API extern "C" +#define AGORA_CALL + +#define __deprecated + +#endif // _WIN32 + +#ifndef OPTIONAL_ENUM_SIZE_T +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_SIZE_T enum : size_t +#else +#define OPTIONAL_ENUM_SIZE_T enum +#endif +#endif + +#ifndef OPTIONAL_NULLPTR +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_NULLPTR nullptr +#else +#define OPTIONAL_NULLPTR NULL +#endif +#endif + +#define INVALID_DISPLAY_ID 0xffff + +namespace agora { +namespace commons { +namespace cjson { +class JsonWrapper; +} // namespace cjson +} // namespace commons + +typedef commons::cjson::JsonWrapper any_document_t; + +namespace util { + +template +class AutoPtr { + protected: + typedef T value_type; + typedef T* pointer_type; + + public: + explicit AutoPtr(pointer_type p = NULL) : ptr_(p) {} + + ~AutoPtr() { + if (ptr_) { + ptr_->release(); + ptr_ = NULL; + } + } + + operator bool() const { return (ptr_ != NULL); } + + value_type& operator*() const { return *get(); } + + pointer_type operator->() const { return get(); } + + pointer_type get() const { return ptr_; } + + pointer_type release() { + pointer_type ret = ptr_; + ptr_ = 0; + return ret; + } + + void reset(pointer_type ptr = NULL) { + if (ptr != ptr_ && ptr_) { + ptr_->release(); + } + + ptr_ = ptr; + } + + template + bool queryInterface(C1* c, C2 iid) { + pointer_type p = NULL; + if (c && !c->queryInterface(iid, reinterpret_cast(&p))) { + reset(p); + } + + return (p != NULL); + } + + private: + AutoPtr(const AutoPtr&); + AutoPtr& operator=(const AutoPtr&); + + private: + pointer_type ptr_; +}; + +template +class CopyableAutoPtr : public AutoPtr { + typedef typename AutoPtr::pointer_type pointer_type; + + public: + explicit CopyableAutoPtr(pointer_type p = 0) : AutoPtr(p) {} + explicit CopyableAutoPtr(const CopyableAutoPtr& rhs) { this->reset(rhs.clone()); } + CopyableAutoPtr& operator=(const CopyableAutoPtr& rhs) { + if (this != &rhs) this->reset(rhs.clone()); + return *this; + } + pointer_type clone() const { + if (!this->get()) return NULL; + return this->get()->clone(); + } +}; + +class IString { + public: + virtual bool empty() const = 0; + virtual const char* c_str() = 0; + virtual const char* data() = 0; + virtual size_t length() = 0; + virtual IString* clone() = 0; + virtual void release() = 0; + virtual ~IString() {} +}; +typedef CopyableAutoPtr AString; + +class IIterator { + public: + virtual void* current() = 0; + virtual const void* const_current() const = 0; + virtual bool next() = 0; + virtual void release() = 0; + virtual ~IIterator() {} +}; + +class IContainer { + public: + virtual IIterator* begin() = 0; + virtual size_t size() const = 0; + virtual void release() = 0; + virtual ~IContainer() {} +}; + +template +class AOutputIterator { + IIterator* p; + + public: + typedef T value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + explicit AOutputIterator(IIterator* it = NULL) : p(it) {} + ~AOutputIterator() { + if (p) p->release(); + } + AOutputIterator(const AOutputIterator& rhs) : p(rhs.p) {} + AOutputIterator& operator++() { + p->next(); + return *this; + } + bool operator==(const AOutputIterator& rhs) const { + if (p && rhs.p) + return p->current() == rhs.p->current(); + else + return valid() == rhs.valid(); + } + bool operator!=(const AOutputIterator& rhs) const { return !this->operator==(rhs); } + reference operator*() { return *reinterpret_cast(p->current()); } + const_reference operator*() const { return *reinterpret_cast(p->const_current()); } + bool valid() const { return p && p->current() != NULL; } +}; + +template +class AList { + IContainer* container; + bool owner; + + public: + typedef T value_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef size_t size_type; + typedef AOutputIterator iterator; + typedef const AOutputIterator const_iterator; + + public: + AList() : container(NULL), owner(false) {} + AList(IContainer* c, bool take_ownership) : container(c), owner(take_ownership) {} + ~AList() { reset(); } + void reset(IContainer* c = NULL, bool take_ownership = false) { + if (owner && container) container->release(); + container = c; + owner = take_ownership; + } + iterator begin() { return container ? iterator(container->begin()) : iterator(NULL); } + iterator end() { return iterator(NULL); } + size_type size() const { return container ? container->size() : 0; } + bool empty() const { return size() == 0; } +}; + +} // namespace util + +/** + * The channel profile. + */ +enum CHANNEL_PROFILE_TYPE { + /** + * 0: Communication. + * + * This profile prioritizes smoothness and applies to the one-to-one scenario. + */ + CHANNEL_PROFILE_COMMUNICATION = 0, + /** + * 1: (Default) Live Broadcast. + * + * This profile prioritizes supporting a large audience in a live broadcast channel. + */ + CHANNEL_PROFILE_LIVE_BROADCASTING = 1, + /** + * 2: Gaming. + * @deprecated This profile is deprecated. + */ + CHANNEL_PROFILE_GAME __deprecated = 2, + /** + * 3: Cloud Gaming. + * + * @deprecated This profile is deprecated. + */ + CHANNEL_PROFILE_CLOUD_GAMING __deprecated = 3, + + /** + * 4: Communication 1v1. + * @deprecated This profile is deprecated. + */ + CHANNEL_PROFILE_COMMUNICATION_1v1 __deprecated = 4, +}; + +/** + * The warning codes. + */ +enum WARN_CODE_TYPE { + /** + * 8: The specified view is invalid. To use the video function, you need to specify + * a valid view. + */ + WARN_INVALID_VIEW = 8, + /** + * 16: Fails to initialize the video function, probably due to a lack of + * resources. Users fail to see each other, but can still communicate with voice. + */ + WARN_INIT_VIDEO = 16, + /** + * 20: The request is pending, usually because some module is not ready, + * and the SDK postpones processing the request. + */ + WARN_PENDING = 20, + /** + * 103: No channel resources are available, probably because the server cannot + * allocate any channel resource. + */ + WARN_NO_AVAILABLE_CHANNEL = 103, + /** + * 104: A timeout occurs when looking for the channel. When joining a channel, + * the SDK looks up the specified channel. This warning usually occurs when the + * network condition is too poor to connect to the server. + */ + WARN_LOOKUP_CHANNEL_TIMEOUT = 104, + /** + * 105: The server rejects the request to look for the channel. The server + * cannot process this request or the request is illegal. + */ + WARN_LOOKUP_CHANNEL_REJECTED = 105, + /** + * 106: A timeout occurs when opening the channel. Once the specific channel + * is found, the SDK opens the channel. This warning usually occurs when the + * network condition is too poor to connect to the server. + */ + WARN_OPEN_CHANNEL_TIMEOUT = 106, + /** + * 107: The server rejects the request to open the channel. The server + * cannot process this request or the request is illegal. + */ + WARN_OPEN_CHANNEL_REJECTED = 107, + + // sdk: 100~1000 + /** + * 111: A timeout occurs when switching the live video. + */ + WARN_SWITCH_LIVE_VIDEO_TIMEOUT = 111, + /** + * 118: A timeout occurs when setting the user role. + */ + WARN_SET_CLIENT_ROLE_TIMEOUT = 118, + /** + * 121: The ticket to open the channel is invalid. + */ + WARN_OPEN_CHANNEL_INVALID_TICKET = 121, + /** + * 122: The SDK is trying connecting to another server. + */ + WARN_OPEN_CHANNEL_TRY_NEXT_VOS = 122, + /** + * 131: The channel connection cannot be recovered. + */ + WARN_CHANNEL_CONNECTION_UNRECOVERABLE = 131, + /** + * 132: The SDK connection IP has changed. + */ + WARN_CHANNEL_CONNECTION_IP_CHANGED = 132, + /** + * 133: The SDK connection port has changed. + */ + WARN_CHANNEL_CONNECTION_PORT_CHANGED = 133, + /** 134: The socket error occurs, try to rejoin channel. + */ + WARN_CHANNEL_SOCKET_ERROR = 134, + /** + * 701: An error occurs when opening the file for audio mixing. + */ + WARN_AUDIO_MIXING_OPEN_ERROR = 701, + /** + * 1014: Audio Device Module: An exception occurs in the playback device. + */ + WARN_ADM_RUNTIME_PLAYOUT_WARNING = 1014, + /** + * 1016: Audio Device Module: A warning occurs in the recording device. + */ + WARN_ADM_RUNTIME_RECORDING_WARNING = 1016, + /** + * 1019: Audio Device Module: No valid audio data is collected. + */ + WARN_ADM_RECORD_AUDIO_SILENCE = 1019, + /** + * 1020: Audio Device Module: The playback device fails to start. + */ + WARN_ADM_PLAYOUT_MALFUNCTION = 1020, + /** + * 1021: Audio Device Module: The recording device fails to start. + */ + WARN_ADM_RECORD_MALFUNCTION = 1021, + /** + * 1031: Audio Device Module: The recorded audio volume is too low. + */ + WARN_ADM_RECORD_AUDIO_LOWLEVEL = 1031, + /** + * 1032: Audio Device Module: The playback audio volume is too low. + */ + WARN_ADM_PLAYOUT_AUDIO_LOWLEVEL = 1032, + /** + * 1040: Audio device module: An exception occurs with the audio drive. + * Choose one of the following solutions: + * - Disable or re-enable the audio device. + * - Re-enable your device. + * - Update the sound card drive. + */ + WARN_ADM_WINDOWS_NO_DATA_READY_EVENT = 1040, + /** + * 1051: Audio Device Module: The SDK detects howling. + */ + WARN_APM_HOWLING = 1051, + /** + * 1052: Audio Device Module: The audio device is in a glitching state. + */ + WARN_ADM_GLITCH_STATE = 1052, + /** + * 1053: Audio Device Module: The settings are improper. + */ + WARN_ADM_IMPROPER_SETTINGS = 1053, + /** + * 1060: Audio Device Module: Could not register phone state listener. + */ + WARN_ADM_REG_PHONE_LISTENNER_FAILED = 1060, + /** + * 1322: No recording device. + */ + WARN_ADM_WIN_CORE_NO_RECORDING_DEVICE = 1322, + /** + * 1323: Audio device module: No available playback device. + * You can try plugging in the audio device. + */ + WARN_ADM_WIN_CORE_NO_PLAYOUT_DEVICE = 1323, + /** + * 1324: Audio device module: The capture device is released improperly. + * Choose one of the following solutions: + * - Disable or re-enable the audio device. + * - Re-enable your audio device. + * - Update the sound card drive. + */ + WARN_ADM_WIN_CORE_IMPROPER_CAPTURE_RELEASE = 1324, +}; + +/** + * The error codes. + */ +enum ERROR_CODE_TYPE { + /** + * 0: No error occurs. + */ + ERR_OK = 0, + // 1~1000 + /** + * 1: A general error occurs (no specified reason). + */ + ERR_FAILED = 1, + /** + * 2: The argument is invalid. For example, the specific channel name + * includes illegal characters. + */ + ERR_INVALID_ARGUMENT = 2, + /** + * 3: The SDK module is not ready. Choose one of the following solutions: + * - Check the audio device. + * - Check the completeness of the app. + * - Reinitialize the RTC engine. + */ + ERR_NOT_READY = 3, + /** + * 4: The SDK does not support this function. + */ + ERR_NOT_SUPPORTED = 4, + /** + * 5: The request is rejected. + */ + ERR_REFUSED = 5, + /** + * 6: The buffer size is not big enough to store the returned data. + */ + ERR_BUFFER_TOO_SMALL = 6, + /** + * 7: The SDK is not initialized before calling this method. + */ + ERR_NOT_INITIALIZED = 7, + /** + * 8: The state is invalid. + */ + ERR_INVALID_STATE = 8, + /** + * 9: No permission. This is for internal use only, and does + * not return to the app through any method or callback. + */ + ERR_NO_PERMISSION = 9, + /** + * 10: An API timeout occurs. Some API methods require the SDK to return the + * execution result, and this error occurs if the request takes too long + * (more than 10 seconds) for the SDK to process. + */ + ERR_TIMEDOUT = 10, + /** + * 11: The request is cancelled. This is for internal use only, + * and does not return to the app through any method or callback. + */ + ERR_CANCELED = 11, + /** + * 12: The method is called too often. This is for internal use + * only, and does not return to the app through any method or + * callback. + */ + ERR_TOO_OFTEN = 12, + /** + * 13: The SDK fails to bind to the network socket. This is for internal + * use only, and does not return to the app through any method or + * callback. + */ + ERR_BIND_SOCKET = 13, + /** + * 14: The network is unavailable. This is for internal use only, and + * does not return to the app through any method or callback. + */ + ERR_NET_DOWN = 14, + /** + * 17: The request to join the channel is rejected. This error usually occurs + * when the user is already in the channel, and still calls the method to join + * the channel, for example, \ref agora::rtc::IRtcEngine::joinChannel "joinChannel()". + */ + ERR_JOIN_CHANNEL_REJECTED = 17, + /** + * 18: The request to leave the channel is rejected. This error usually + * occurs when the user has already left the channel, and still calls the + * method to leave the channel, for example, \ref agora::rtc::IRtcEngine::leaveChannel + * "leaveChannel". + */ + ERR_LEAVE_CHANNEL_REJECTED = 18, + /** + * 19: The resources have been occupied and cannot be reused. + */ + ERR_ALREADY_IN_USE = 19, + /** + * 20: The SDK gives up the request due to too many requests. This is for + * internal use only, and does not return to the app through any method or callback. + */ + ERR_ABORTED = 20, + /** + * 21: On Windows, specific firewall settings can cause the SDK to fail to + * initialize and crash. + */ + ERR_INIT_NET_ENGINE = 21, + /** + * 22: The app uses too much of the system resource and the SDK + * fails to allocate any resource. + */ + ERR_RESOURCE_LIMITED = 22, + /** + * 101: The App ID is invalid, usually because the data format of the App ID is incorrect. + * + * Solution: Check the data format of your App ID. Ensure that you use the correct App ID to initialize the Agora service. + */ + ERR_INVALID_APP_ID = 101, + /** + * 102: The specified channel name is invalid. Please try to rejoin the + * channel with a valid channel name. + */ + ERR_INVALID_CHANNEL_NAME = 102, + /** + * 103: Fails to get server resources in the specified region. Please try to + * specify another region when calling \ref agora::rtc::IRtcEngine::initialize + * "initialize". + */ + ERR_NO_SERVER_RESOURCES = 103, + /** + * 109: The token has expired, usually for the following reasons: + * - Timeout for token authorization: Once a token is generated, you must use it to access the + * Agora service within 24 hours. Otherwise, the token times out and you can no longer use it. + * - The token privilege expires: To generate a token, you need to set a timestamp for the token + * privilege to expire. For example, If you set it as seven days, the token expires seven days after + * its usage. In that case, you can no longer access the Agora service. The users cannot make calls, + * or are kicked out of the channel. + * + * Solution: Regardless of whether token authorization times out or the token privilege expires, + * you need to generate a new token on your server, and try to join the channel. + */ + ERR_TOKEN_EXPIRED = 109, + /** + * 110: The token is invalid, usually for one of the following reasons: + * - Did not provide a token when joining a channel in a situation where the project has enabled the + * App Certificate. + * - Tried to join a channel with a token in a situation where the project has not enabled the App + * Certificate. + * - The App ID, user ID and channel name that you use to generate the token on the server do not match + * those that you use when joining a channel. + * + * Solution: + * - Before joining a channel, check whether your project has enabled the App certificate. If yes, you + * must provide a token when joining a channel; if no, join a channel without a token. + * - When using a token to join a channel, ensure that the App ID, user ID, and channel name that you + * use to generate the token is the same as the App ID that you use to initialize the Agora service, and + * the user ID and channel name that you use to join the channel. + */ + ERR_INVALID_TOKEN = 110, + /** + * 111: The internet connection is interrupted. This applies to the Agora Web + * SDK only. + */ + ERR_CONNECTION_INTERRUPTED = 111, // only used in web sdk + /** + * 112: The internet connection is lost. This applies to the Agora Web SDK + * only. + */ + ERR_CONNECTION_LOST = 112, // only used in web sdk + /** + * 113: The user is not in the channel when calling the + * \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage()" method. + */ + ERR_NOT_IN_CHANNEL = 113, + /** + * 114: The data size is over 1024 bytes when the user calls the + * \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage()" method. + */ + ERR_SIZE_TOO_LARGE = 114, + /** + * 115: The bitrate of the sent data exceeds the limit of 6 Kbps when the + * user calls the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage()". + */ + ERR_BITRATE_LIMIT = 115, + /** + * 116: Too many data streams (over 5) are created when the user + * calls the \ref agora::rtc::IRtcEngine::createDataStream "createDataStream()" method. + */ + ERR_TOO_MANY_DATA_STREAMS = 116, + /** + * 117: A timeout occurs for the data stream transmission. + */ + ERR_STREAM_MESSAGE_TIMEOUT = 117, + /** + * 119: Switching the user role fails. Please try to rejoin the channel. + */ + ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119, + /** + * 120: MediaStream decryption fails. The user may have tried to join the channel with a wrong + * password. Check your settings or try rejoining the channel. + */ + ERR_DECRYPTION_FAILED = 120, + /** + * 121: The user ID is invalid. + */ + ERR_INVALID_USER_ID = 121, + /** + * 122: DataStream decryption fails. The peer may have tried to join the channel with a wrong + * password, or did't enable datastream encryption + */ + ERR_DATASTREAM_DECRYPTION_FAILED = 122, + /** + * 123: The app is banned by the server. + */ + ERR_CLIENT_IS_BANNED_BY_SERVER = 123, + /** + * 130: Encryption is enabled when the user calls the + * \ref agora::rtc::IRtcEngine::addPublishStreamUrl "addPublishStreamUrl()" method + * (CDN live streaming does not support encrypted streams). + */ + ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISH = 130, + + /** + * 131: License credential is invalid + */ + ERR_LICENSE_CREDENTIAL_INVALID = 131, + + /** + * 134: The user account is invalid, usually because the data format of the user account is incorrect. + */ + ERR_INVALID_USER_ACCOUNT = 134, + /** + * 135: When encryption enabled, a failure occurs when verifying the server's certification. + */ + ERR_CERT_VERIFY_FAILURE = 135, + + /** 157: The necessary dynamical library is not integrated. For example, if you call + * the \ref agora::rtc::IRtcEngine::enableDeepLearningDenoise "enableDeepLearningDenoise" but do not integrate the dynamical + * library for the deep-learning noise reduction into your project, the SDK reports this error code. + * + */ + ERR_MODULE_NOT_FOUND = 157, + + // Licensing, keep the license error code same as the main version + ERR_CERT_RAW = 157, + ERR_CERT_JSON_PART = 158, + ERR_CERT_JSON_INVAL = 159, + ERR_CERT_JSON_NOMEM = 160, + ERR_CERT_CUSTOM = 161, + ERR_CERT_CREDENTIAL = 162, + ERR_CERT_SIGN = 163, + ERR_CERT_FAIL = 164, + ERR_CERT_BUF = 165, + ERR_CERT_NULL = 166, + ERR_CERT_DUEDATE = 167, + ERR_CERT_REQUEST = 168, + + // PcmSend Error num + ERR_PCMSEND_FORMAT = 200, // unsupport pcm format + ERR_PCMSEND_BUFFEROVERFLOW = 201, // buffer overflow, the pcm send rate too quickly + + /// @cond + // signaling: 400~600 + ERR_LOGIN_ALREADY_LOGIN = 428, + + /// @endcond + // 1001~2000 + /** + * 1001: Fails to load the media engine. + */ + ERR_LOAD_MEDIA_ENGINE = 1001, + /** + * 1005: Audio device module: A general error occurs in the Audio Device Module (no specified + * reason). Check if the audio device is used by another app, or try + * rejoining the channel. + */ + ERR_ADM_GENERAL_ERROR = 1005, + /** + * 1008: Audio Device Module: An error occurs in initializing the playback + * device. + */ + ERR_ADM_INIT_PLAYOUT = 1008, + /** + * 1009: Audio Device Module: An error occurs in starting the playback device. + */ + ERR_ADM_START_PLAYOUT = 1009, + /** + * 1010: Audio Device Module: An error occurs in stopping the playback device. + */ + ERR_ADM_STOP_PLAYOUT = 1010, + /** + * 1011: Audio Device Module: An error occurs in initializing the recording + * device. + */ + ERR_ADM_INIT_RECORDING = 1011, + /** + * 1012: Audio Device Module: An error occurs in starting the recording device. + */ + ERR_ADM_START_RECORDING = 1012, + /** + * 1013: Audio Device Module: An error occurs in stopping the recording device. + */ + ERR_ADM_STOP_RECORDING = 1013, + /** + * 1501: Video Device Module: The camera is not authorized. + */ + ERR_VDM_CAMERA_NOT_AUTHORIZED = 1501, +}; + +enum LICENSE_ERROR_TYPE { + /** + * 1: Invalid license + */ + LICENSE_ERR_INVALID = 1, + /** + * 2: License expired + */ + LICENSE_ERR_EXPIRE = 2, + /** + * 3: Exceed license minutes limit + */ + LICENSE_ERR_MINUTES_EXCEED = 3, + /** + * 4: License use in limited period + */ + LICENSE_ERR_LIMITED_PERIOD = 4, + /** + * 5: Same license used in different devices at the same time + */ + LICENSE_ERR_DIFF_DEVICES = 5, + /** + * 99: SDK internal error + */ + LICENSE_ERR_INTERNAL = 99, +}; + +/** + * The operational permission of the SDK on the audio session. + */ +enum AUDIO_SESSION_OPERATION_RESTRICTION { + /** + * 0: No restriction; the SDK can change the audio session. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_NONE = 0, + /** + * 1: The SDK cannot change the audio session category. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_SET_CATEGORY = 1, + /** + * 2: The SDK cannot change the audio session category, mode, or categoryOptions. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_CONFIGURE_SESSION = 1 << 1, + /** + * 4: The SDK keeps the audio session active when the user leaves the + * channel, for example, to play an audio file in the background. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_DEACTIVATE_SESSION = 1 << 2, + /** + * 128: Completely restricts the operational permission of the SDK on the + * audio session; the SDK cannot change the audio session. + */ + AUDIO_SESSION_OPERATION_RESTRICTION_ALL = 1 << 7, +}; + +typedef const char* user_id_t; +typedef void* view_t; + +/** + * The definition of the UserInfo struct. + */ +struct UserInfo { + /** + * ID of the user. + */ + util::AString userId; + /** + * Whether the user has enabled audio: + * - true: The user has enabled audio. + * - false: The user has disabled audio. + */ + bool hasAudio; + /** + * Whether the user has enabled video: + * - true: The user has enabled video. + * - false: The user has disabled video. + */ + bool hasVideo; + + UserInfo() : hasAudio(false), hasVideo(false) {} +}; + +typedef util::AList UserList; + +// Shared between Agora Service and Rtc Engine +namespace rtc { + +/** + * Reasons for a user being offline. + */ +enum USER_OFFLINE_REASON_TYPE { + /** + * 0: The user leaves the current channel. + */ + USER_OFFLINE_QUIT = 0, + /** + * 1: The SDK times out and the user drops offline because no data packet was received within a certain + * period of time. If a user quits the call and the message is not passed to the SDK (due to an + * unreliable channel), the SDK assumes that the user drops offline. + */ + USER_OFFLINE_DROPPED = 1, + /** + * 2: The user switches the client role from the host to the audience. + */ + USER_OFFLINE_BECOME_AUDIENCE = 2, +}; + +enum INTERFACE_ID_TYPE { + AGORA_IID_AUDIO_DEVICE_MANAGER = 1, + AGORA_IID_VIDEO_DEVICE_MANAGER = 2, + AGORA_IID_PARAMETER_ENGINE = 3, + AGORA_IID_MEDIA_ENGINE = 4, + AGORA_IID_AUDIO_ENGINE = 5, + AGORA_IID_VIDEO_ENGINE = 6, + AGORA_IID_RTC_CONNECTION = 7, + AGORA_IID_SIGNALING_ENGINE = 8, + AGORA_IID_MEDIA_ENGINE_REGULATOR = 9, + AGORA_IID_CLOUD_SPATIAL_AUDIO = 10, + AGORA_IID_LOCAL_SPATIAL_AUDIO = 11, + AGORA_IID_MEDIA_RECORDER = 12, + AGORA_IID_STATE_SYNC = 13, + AGORA_IID_METACHAT_SERVICE = 14, + AGORA_IID_MUSIC_CONTENT_CENTER = 15, +}; + +/** + * The network quality types. + */ +enum QUALITY_TYPE { + /** + * 0: The network quality is unknown. + * @deprecated This member is deprecated. + */ + QUALITY_UNKNOWN __deprecated = 0, + /** + * 1: The quality is excellent. + */ + QUALITY_EXCELLENT = 1, + /** + * 2: The quality is quite good, but the bitrate may be slightly + * lower than excellent. + */ + QUALITY_GOOD = 2, + /** + * 3: Users can feel the communication slightly impaired. + */ + QUALITY_POOR = 3, + /** + * 4: Users cannot communicate smoothly. + */ + QUALITY_BAD = 4, + /** + * 5: Users can barely communicate. + */ + QUALITY_VBAD = 5, + /** + * 6: Users cannot communicate at all. + */ + QUALITY_DOWN = 6, + /** + * 7: (For future use) The network quality cannot be detected. + */ + QUALITY_UNSUPPORTED = 7, + /** + * 8: Detecting the network quality. + */ + QUALITY_DETECTING = 8, +}; + +/** + * Content fit modes. + */ +enum FIT_MODE_TYPE { + /** + * 1: Uniformly scale the video until it fills the visible boundaries (cropped). + * One dimension of the video may have clipped contents. + */ + MODE_COVER = 1, + + /** + * 2: Uniformly scale the video until one of its dimension fits the boundary + * (zoomed to fit). Areas that are not filled due to disparity in the aspect + * ratio are filled with black. + */ + MODE_CONTAIN = 2, +}; + +/** + * The rotation information. + */ +enum VIDEO_ORIENTATION { + /** + * 0: Rotate the video by 0 degree clockwise. + */ + VIDEO_ORIENTATION_0 = 0, + /** + * 90: Rotate the video by 90 degrees clockwise. + */ + VIDEO_ORIENTATION_90 = 90, + /** + * 180: Rotate the video by 180 degrees clockwise. + */ + VIDEO_ORIENTATION_180 = 180, + /** + * 270: Rotate the video by 270 degrees clockwise. + */ + VIDEO_ORIENTATION_270 = 270 +}; + +/** + * The video frame rate. + */ +enum FRAME_RATE { + /** + * 1: 1 fps. + */ + FRAME_RATE_FPS_1 = 1, + /** + * 7: 7 fps. + */ + FRAME_RATE_FPS_7 = 7, + /** + * 10: 10 fps. + */ + FRAME_RATE_FPS_10 = 10, + /** + * 15: 15 fps. + */ + FRAME_RATE_FPS_15 = 15, + /** + * 24: 24 fps. + */ + FRAME_RATE_FPS_24 = 24, + /** + * 30: 30 fps. + */ + FRAME_RATE_FPS_30 = 30, + /** + * 60: 60 fps. Applies to Windows and macOS only. + */ + FRAME_RATE_FPS_60 = 60, +}; + +enum FRAME_WIDTH { + FRAME_WIDTH_960 = 960, +}; + +enum FRAME_HEIGHT { + FRAME_HEIGHT_540 = 540, +}; + + +/** + * Types of the video frame. + */ +enum VIDEO_FRAME_TYPE { + /** 0: A black frame. */ + VIDEO_FRAME_TYPE_BLANK_FRAME = 0, + /** 3: Key frame. */ + VIDEO_FRAME_TYPE_KEY_FRAME = 3, + /** 4: Delta frame. */ + VIDEO_FRAME_TYPE_DELTA_FRAME = 4, + /** 5: The B frame.*/ + VIDEO_FRAME_TYPE_B_FRAME = 5, + /** 6: A discarded frame. */ + VIDEO_FRAME_TYPE_DROPPABLE_FRAME = 6, + /** Unknown frame. */ + VIDEO_FRAME_TYPE_UNKNOW +}; + +/** + * Video output orientation modes. + */ +enum ORIENTATION_MODE { + /** + * 0: The output video always follows the orientation of the captured video. The receiver takes + * the rotational information passed on from the video encoder. This mode applies to scenarios + * where video orientation can be adjusted on the receiver: + * - If the captured video is in landscape mode, the output video is in landscape mode. + * - If the captured video is in portrait mode, the output video is in portrait mode. + */ + ORIENTATION_MODE_ADAPTIVE = 0, + /** + * 1: Landscape mode. In this mode, the SDK always outputs videos in landscape (horizontal) mode. + * If the captured video is in portrait mode, the video encoder crops it to fit the output. Applies + * to situations where the receiving end cannot process the rotational information. For example, + * CDN live streaming. + */ + ORIENTATION_MODE_FIXED_LANDSCAPE = 1, + /** + * 2: Portrait mode. In this mode, the SDK always outputs video in portrait (portrait) mode. If + * the captured video is in landscape mode, the video encoder crops it to fit the output. Applies + * to situations where the receiving end cannot process the rotational information. For example, + * CDN live streaming. + */ + ORIENTATION_MODE_FIXED_PORTRAIT = 2, +}; + +/** + * (For future use) Video degradation preferences under limited bandwidth. + */ +enum DEGRADATION_PREFERENCE { + /** + * 0: (Default) Prefers to reduce the video frame rate while maintaining video quality during video + * encoding under limited bandwidth. This degradation preference is suitable for scenarios where + * video quality is prioritized. + * @note In the COMMUNICATION channel profile, the resolution of the video sent may change, so + * remote users need to handle this issue. + */ + MAINTAIN_QUALITY = 0, + /** + * 1: Prefers to reduce the video quality while maintaining the video frame rate during video + * encoding under limited bandwidth. This degradation preference is suitable for scenarios where + * smoothness is prioritized and video quality is allowed to be reduced. + */ + MAINTAIN_FRAMERATE = 1, + /** + * 2: Reduces the video frame rate and video quality simultaneously during video encoding under + * limited bandwidth. MAINTAIN_BALANCED has a lower reduction than MAINTAIN_QUALITY and MAINTAIN_FRAMERATE, + * and this preference is suitable for scenarios where both smoothness and video quality are a + * priority. + */ + MAINTAIN_BALANCED = 2, + /** + * 3: Degrade framerate in order to maintain resolution. + */ + MAINTAIN_RESOLUTION = 3, + /** + * 4: Disable VQC adjustion. + */ + DISABLED = 100, +}; + +/** + * The definition of the VideoDimensions struct. + */ +struct VideoDimensions { + /** + * The width of the video, in pixels. + */ + int width; + /** + * The height of the video, in pixels. + */ + int height; + VideoDimensions() : width(640), height(480) {} + VideoDimensions(int w, int h) : width(w), height(h) {} + bool operator==(const VideoDimensions& rhs) const { + return width == rhs.width && height == rhs.height; + } +}; + +/** + * (Recommended) 0: Standard bitrate mode. + * + * In this mode, the video bitrate is twice the base bitrate. + */ +const int STANDARD_BITRATE = 0; + +/** + * -1: Compatible bitrate mode. + * + * In this mode, the video bitrate is the same as the base bitrate.. If you choose + * this mode in the live-broadcast profile, the video frame rate may be lower + * than the set value. + */ +const int COMPATIBLE_BITRATE = -1; + +/** + * -1: (For future use) The default minimum bitrate. + */ +const int DEFAULT_MIN_BITRATE = -1; + +/** + * -2: (For future use) Set minimum bitrate the same as target bitrate. + */ +const int DEFAULT_MIN_BITRATE_EQUAL_TO_TARGET_BITRATE = -2; + +/** + * screen sharing supported capability level. + */ +enum SCREEN_CAPTURE_CAPABILITY_LEVEL { + SCREEN_CAPTURE_CAPABILITY_LEVEL_15_FPS = 0, + SCREEN_CAPTURE_CAPABILITY_LEVEL_30_FPS = 1, + SCREEN_CAPTURE_CAPABILITY_LEVEL_60_FPS = 2, +}; + +/** + * Video codec capability levels. + */ +enum VIDEO_CODEC_CAPABILITY_LEVEL { + /** No specified level */ + CODEC_CAPABILITY_LEVEL_UNSPECIFIED = -1, + /** Only provide basic support for the codec type */ + CODEC_CAPABILITY_LEVEL_BASIC_SUPPORT = 5, + /** Can process 1080p video at a rate of approximately 30 fps. */ + CODEC_CAPABILITY_LEVEL_1080P30FPS = 10, + /** Can process 1080p video at a rate of approximately 60 fps. */ + CODEC_CAPABILITY_LEVEL_1080P60FPS = 20, + /** Can process 2k video at a rate of approximately 30 fps. */ + CODEC_CAPABILITY_LEVEL_2K30FPS = 23, + /** Can process 2k video at a rate of approximately 60 fps. */ + CODEC_CAPABILITY_LEVEL_2K60FPS = 26, + /** Can process 4k video at a rate of approximately 30 fps. */ + CODEC_CAPABILITY_LEVEL_4K60FPS = 30, +}; + +/** + * The video codec types. + */ +enum VIDEO_CODEC_TYPE { + VIDEO_CODEC_NONE = 0, + /** + * 1: Standard VP8. + */ + VIDEO_CODEC_VP8 = 1, + /** + * 2: Standard H.264. + */ + VIDEO_CODEC_H264 = 2, + /** + * 3: Standard H.265. + */ + VIDEO_CODEC_H265 = 3, + /** + * 6: Generic. This type is used for transmitting raw video data, such as encrypted video frames. + * The SDK returns this type of video frames in callbacks, and you need to decode and render the frames yourself. + */ + VIDEO_CODEC_GENERIC = 6, + /** + * 7: Generic H264. + */ + VIDEO_CODEC_GENERIC_H264 = 7, + /** + * 12: AV1. + */ + VIDEO_CODEC_AV1 = 12, + /** + * 5: VP9. + */ + VIDEO_CODEC_VP9 = 13, + /** + * 20: Generic JPEG. This type consumes minimum computing resources and applies to IoT devices. + */ + VIDEO_CODEC_GENERIC_JPEG = 20, +}; + +/** + * The CC (Congestion Control) mode options. + */ +enum TCcMode { + /** + * Enable CC mode. + */ + CC_ENABLED, + /** + * Disable CC mode. + */ + CC_DISABLED, +}; + +/** + * The configuration for creating a local video track with an encoded image sender. + */ +struct SenderOptions { + /** + * Whether to enable CC mode. See #TCcMode. + */ + TCcMode ccMode; + /** + * The codec type used for the encoded images: \ref agora::rtc::VIDEO_CODEC_TYPE "VIDEO_CODEC_TYPE". + */ + VIDEO_CODEC_TYPE codecType; + + /** + * Target bitrate (Kbps) for video encoding. + * + * Choose one of the following options: + * + * - \ref agora::rtc::STANDARD_BITRATE "STANDARD_BITRATE": (Recommended) Standard bitrate. + * - Communication profile: The encoding bitrate equals the base bitrate. + * - Live-broadcast profile: The encoding bitrate is twice the base bitrate. + * - \ref agora::rtc::COMPATIBLE_BITRATE "COMPATIBLE_BITRATE": Compatible bitrate. The bitrate stays the same + * regardless of the profile. + * + * The Communication profile prioritizes smoothness, while the Live Broadcast + * profile prioritizes video quality (requiring a higher bitrate). Agora + * recommends setting the bitrate mode as \ref agora::rtc::STANDARD_BITRATE "STANDARD_BITRATE" or simply to + * address this difference. + * + * The following table lists the recommended video encoder configurations, + * where the base bitrate applies to the communication profile. Set your + * bitrate based on this table. If the bitrate you set is beyond the proper + * range, the SDK automatically sets it to within the range. + + | Resolution | Frame Rate (fps) | Base Bitrate (Kbps, for Communication) | Live Bitrate (Kbps, for Live Broadcast)| + |------------------------|------------------|----------------------------------------|----------------------------------------| + | 160 × 120 | 15 | 65 | 130 | + | 120 × 120 | 15 | 50 | 100 | + | 320 × 180 | 15 | 140 | 280 | + | 180 × 180 | 15 | 100 | 200 | + | 240 × 180 | 15 | 120 | 240 | + | 320 × 240 | 15 | 200 | 400 | + | 240 × 240 | 15 | 140 | 280 | + | 424 × 240 | 15 | 220 | 440 | + | 640 × 360 | 15 | 400 | 800 | + | 360 × 360 | 15 | 260 | 520 | + | 640 × 360 | 30 | 600 | 1200 | + | 360 × 360 | 30 | 400 | 800 | + | 480 × 360 | 15 | 320 | 640 | + | 480 × 360 | 30 | 490 | 980 | + | 640 × 480 | 15 | 500 | 1000 | + | 480 × 480 | 15 | 400 | 800 | + | 640 × 480 | 30 | 750 | 1500 | + | 480 × 480 | 30 | 600 | 1200 | + | 848 × 480 | 15 | 610 | 1220 | + | 848 × 480 | 30 | 930 | 1860 | + | 640 × 480 | 10 | 400 | 800 | + | 1280 × 720 | 15 | 1130 | 2260 | + | 1280 × 720 | 30 | 1710 | 3420 | + | 960 × 720 | 15 | 910 | 1820 | + | 960 × 720 | 30 | 1380 | 2760 | + | 1920 × 1080 | 15 | 2080 | 4160 | + | 1920 × 1080 | 30 | 3150 | 6300 | + | 1920 × 1080 | 60 | 4780 | 6500 | + | 2560 × 1440 | 30 | 4850 | 6500 | + | 2560 × 1440 | 60 | 6500 | 6500 | + | 3840 × 2160 | 30 | 6500 | 6500 | + | 3840 × 2160 | 60 | 6500 | 6500 | + */ + int targetBitrate; + + SenderOptions() + : ccMode(CC_ENABLED), + codecType(VIDEO_CODEC_H264), + targetBitrate(6500) {} +}; + +/** + * Audio codec types. + */ +enum AUDIO_CODEC_TYPE { + /** + * 1: OPUS. + */ + AUDIO_CODEC_OPUS = 1, + // kIsac = 2, + /** + * 3: PCMA. + */ + AUDIO_CODEC_PCMA = 3, + /** + * 4: PCMU. + */ + AUDIO_CODEC_PCMU = 4, + /** + * 5: G722. + */ + AUDIO_CODEC_G722 = 5, + // kIlbc = 6, + /** 7: AAC. */ + // AUDIO_CODEC_AAC = 7, + /** + * 8: AAC LC. + */ + AUDIO_CODEC_AACLC = 8, + /** + * 9: HE AAC. + */ + AUDIO_CODEC_HEAAC = 9, + /** + * 10: JC1. + */ + AUDIO_CODEC_JC1 = 10, + /** + * 11: HE-AAC v2. + */ + AUDIO_CODEC_HEAAC2 = 11, + /** + * 12: LPCNET. + */ + AUDIO_CODEC_LPCNET = 12, +}; + +/** + * Audio encoding types of the audio encoded frame observer. + */ +enum AUDIO_ENCODING_TYPE { + /** + * AAC encoding format, 16000 Hz sampling rate, bass quality. A file with an audio duration of 10 + * minutes is approximately 1.2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_16000_LOW = 0x010101, + /** + * AAC encoding format, 16000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_16000_MEDIUM = 0x010102, + /** + * AAC encoding format, 32000 Hz sampling rate, bass quality. A file with an audio duration of 10 + * minutes is approximately 1.2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_32000_LOW = 0x010201, + /** + * AAC encoding format, 32000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_32000_MEDIUM = 0x010202, + /** + * AAC encoding format, 32000 Hz sampling rate, high sound quality. A file with an audio duration of + * 10 minutes is approximately 3.5 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_32000_HIGH = 0x010203, + /** + * AAC encoding format, 48000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_48000_MEDIUM = 0x010302, + /** + * AAC encoding format, 48000 Hz sampling rate, high sound quality. A file with an audio duration + * of 10 minutes is approximately 3.5 MB after encoding. + */ + AUDIO_ENCODING_TYPE_AAC_48000_HIGH = 0x010303, + /** + * OPUS encoding format, 16000 Hz sampling rate, bass quality. A file with an audio duration of 10 + * minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_OPUS_16000_LOW = 0x020101, + /** + * OPUS encoding format, 16000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_OPUS_16000_MEDIUM = 0x020102, + /** + * OPUS encoding format, 48000 Hz sampling rate, medium sound quality. A file with an audio duration + * of 10 minutes is approximately 2 MB after encoding. + */ + AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM = 0x020302, + /** + * OPUS encoding format, 48000 Hz sampling rate, high sound quality. A file with an audio duration of + * 10 minutes is approximately 3.5 MB after encoding. + */ + AUDIO_ENCODING_TYPE_OPUS_48000_HIGH = 0x020303, +}; + +/** + * The adaptation mode of the watermark. + */ +enum WATERMARK_FIT_MODE { + /** + * Use the `positionInLandscapeMode` and `positionInPortraitMode` values you set in #WatermarkOptions. + * The settings in `WatermarkRatio` are invalid. + */ + FIT_MODE_COVER_POSITION, + /** + * Use the value you set in `WatermarkRatio`. The settings in `positionInLandscapeMode` and `positionInPortraitMode` + * in `WatermarkOptions` are invalid. + */ + FIT_MODE_USE_IMAGE_RATIO +}; + +/** + * The advanced settings of encoded audio frame. + */ +struct EncodedAudioFrameAdvancedSettings { + EncodedAudioFrameAdvancedSettings() + : speech(true), + sendEvenIfEmpty(true) {} + + /** + * Determines whether the audio source is speech. + * - true: (Default) The audio source is speech. + * - false: The audio source is not speech. + */ + bool speech; + /** + * Whether to send the audio frame even when it is empty. + * - true: (Default) Send the audio frame even when it is empty. + * - false: Do not send the audio frame when it is empty. + */ + bool sendEvenIfEmpty; +}; + +/** + * The definition of the EncodedAudioFrameInfo struct. + */ +struct EncodedAudioFrameInfo { + EncodedAudioFrameInfo() + : codec(AUDIO_CODEC_AACLC), + sampleRateHz(0), + samplesPerChannel(0), + numberOfChannels(0), + captureTimeMs(0) {} + + EncodedAudioFrameInfo(const EncodedAudioFrameInfo& rhs) + : codec(rhs.codec), + sampleRateHz(rhs.sampleRateHz), + samplesPerChannel(rhs.samplesPerChannel), + numberOfChannels(rhs.numberOfChannels), + advancedSettings(rhs.advancedSettings), + captureTimeMs(rhs.captureTimeMs) {} + /** + * The audio codec: #AUDIO_CODEC_TYPE. + */ + AUDIO_CODEC_TYPE codec; + /** + * The sample rate (Hz) of the audio frame. + */ + int sampleRateHz; + /** + * The number of samples per audio channel. + * + * If this value is not set, it is 1024 for AAC, or 960 for OPUS by default. + */ + int samplesPerChannel; + /** + * The number of audio channels of the audio frame. + */ + int numberOfChannels; + /** + * The advanced settings of the audio frame. + */ + EncodedAudioFrameAdvancedSettings advancedSettings; + + /** + * This is a input parameter which means the timestamp for capturing the audio frame. + */ + int64_t captureTimeMs; +}; +/** + * The definition of the AudioPcmDataInfo struct. + */ +struct AudioPcmDataInfo { + AudioPcmDataInfo() : samplesPerChannel(0), channelNum(0), samplesOut(0), elapsedTimeMs(0), ntpTimeMs(0) {} + + AudioPcmDataInfo(const AudioPcmDataInfo& rhs) + : samplesPerChannel(rhs.samplesPerChannel), + channelNum(rhs.channelNum), + samplesOut(rhs.samplesOut), + elapsedTimeMs(rhs.elapsedTimeMs), + ntpTimeMs(rhs.ntpTimeMs) {} + + /** + * The sample count of the PCM data that you expect. + */ + size_t samplesPerChannel; + + int16_t channelNum; + + // Output + /** + * The number of output samples. + */ + size_t samplesOut; + /** + * The rendering time (ms). + */ + int64_t elapsedTimeMs; + /** + * The NTP (Network Time Protocol) timestamp (ms). + */ + int64_t ntpTimeMs; +}; +/** + * Packetization modes. Applies to H.264 only. + */ +enum H264PacketizeMode { + /** + * Non-interleaved mode. See RFC 6184. + */ + NonInterleaved = 0, // Mode 1 - STAP-A, FU-A is allowed + /** + * Single NAL unit mode. See RFC 6184. + */ + SingleNalUnit, // Mode 0 - only single NALU allowed +}; + +/** + * Video stream types. + */ +enum VIDEO_STREAM_TYPE { + /** + * 0: The high-quality video stream, which has a higher resolution and bitrate. + */ + VIDEO_STREAM_HIGH = 0, + /** + * 1: The low-quality video stream, which has a lower resolution and bitrate. + */ + VIDEO_STREAM_LOW = 1, +}; + +struct VideoSubscriptionOptions { + /** + * The type of the video stream to subscribe to. + * + * The default value is `VIDEO_STREAM_HIGH`, which means the high-quality + * video stream. + */ + Optional type; + /** + * Whether to subscribe to encoded video data only: + * - `true`: Subscribe to encoded video data only. + * - `false`: (Default) Subscribe to decoded video data. + */ + Optional encodedFrameOnly; + + VideoSubscriptionOptions() {} +}; + +/** + * The definition of the EncodedVideoFrameInfo struct, which contains the information of the external encoded video frame. + */ +struct EncodedVideoFrameInfo { + EncodedVideoFrameInfo() + : codecType(VIDEO_CODEC_H264), + width(0), + height(0), + framesPerSecond(0), + frameType(VIDEO_FRAME_TYPE_BLANK_FRAME), + rotation(VIDEO_ORIENTATION_0), + trackId(0), + captureTimeMs(0), + decodeTimeMs(0), + uid(0), + streamType(VIDEO_STREAM_HIGH) {} + + EncodedVideoFrameInfo(const EncodedVideoFrameInfo& rhs) + : codecType(rhs.codecType), + width(rhs.width), + height(rhs.height), + framesPerSecond(rhs.framesPerSecond), + frameType(rhs.frameType), + rotation(rhs.rotation), + trackId(rhs.trackId), + captureTimeMs(rhs.captureTimeMs), + decodeTimeMs(rhs.decodeTimeMs), + uid(rhs.uid), + streamType(rhs.streamType) {} + + EncodedVideoFrameInfo& operator=(const EncodedVideoFrameInfo& rhs) { + if (this == &rhs) return *this; + codecType = rhs.codecType; + width = rhs.width; + height = rhs.height; + framesPerSecond = rhs.framesPerSecond; + frameType = rhs.frameType; + rotation = rhs.rotation; + trackId = rhs.trackId; + captureTimeMs = rhs.captureTimeMs; + decodeTimeMs = rhs.decodeTimeMs; + uid = rhs.uid; + streamType = rhs.streamType; + return *this; + } + /** + * The codec type of the local video stream. See #VIDEO_CODEC_TYPE. The default value is `VIDEO_CODEC_H264 (2)`. + */ + VIDEO_CODEC_TYPE codecType; + /** + * The width (px) of the video frame. + */ + int width; + /** + * The height (px) of the video frame. + */ + int height; + /** + * The number of video frames per second. + * When this parameter is not 0, you can use it to calculate the Unix timestamp of the external + * encoded video frames. + */ + int framesPerSecond; + /** + * The video frame type: #VIDEO_FRAME_TYPE. + */ + VIDEO_FRAME_TYPE frameType; + /** + * The rotation information of the video frame: #VIDEO_ORIENTATION. + */ + VIDEO_ORIENTATION rotation; + /** + * The track ID of the video frame. + */ + int trackId; // This can be reserved for multiple video tracks, we need to create different ssrc + // and additional payload for later implementation. + /** + * This is a input parameter which means the timestamp for capturing the video. + */ + int64_t captureTimeMs; + /** + * The timestamp for decoding the video. + */ + int64_t decodeTimeMs; + /** + * ID of the user that pushes the the external encoded video frame.. + */ + uid_t uid; + /** + * The stream type of video frame. + */ + VIDEO_STREAM_TYPE streamType; + +}; +/** +* Video compression preference. +*/ +enum COMPRESSION_PREFERENCE { + /** + * (Default) Low latency is preferred, usually used in real-time communication where low latency is the number one priority. + */ + PREFER_LOW_LATENCY, + /** + * Prefer quality in sacrifice of a degree of latency, usually around 30ms ~ 150ms, depends target fps + */ + PREFER_QUALITY, +}; + +/** +* The video encoder type preference. +*/ +enum ENCODING_PREFERENCE { + /** + *Default . + */ + PREFER_AUTO = -1, + /** + * Software encoding. + */ + PREFER_SOFTWARE = 0, + /** + * Hardware encoding + */ + PREFER_HARDWARE = 1, +}; + +/** + * The definition of the AdvanceOptions struct. + */ +struct AdvanceOptions { + + /** + * The video encoder type preference.. + */ + ENCODING_PREFERENCE encodingPreference; + + /** + * Video compression preference. + */ + COMPRESSION_PREFERENCE compressionPreference; + + AdvanceOptions() : encodingPreference(PREFER_AUTO), + compressionPreference(PREFER_LOW_LATENCY) {} + + AdvanceOptions(ENCODING_PREFERENCE encoding_preference, + COMPRESSION_PREFERENCE compression_preference) : + encodingPreference(encoding_preference), + compressionPreference(compression_preference) {} + + bool operator==(const AdvanceOptions& rhs) const { + return encodingPreference == rhs.encodingPreference && + compressionPreference == rhs.compressionPreference; + } + +}; + +/** + * Video mirror mode types. + */ +enum VIDEO_MIRROR_MODE_TYPE { + /** + * (Default) 0: The mirror mode determined by the SDK. + */ + VIDEO_MIRROR_MODE_AUTO = 0, + /** + * 1: Enable the mirror mode. + */ + VIDEO_MIRROR_MODE_ENABLED = 1, + /** + * 2: Disable the mirror mode. + */ + VIDEO_MIRROR_MODE_DISABLED = 2, +}; + +#if defined(__APPLE__) && TARGET_OS_IOS +/** + * Camera capturer configuration for format type. + */ +enum CAMERA_FORMAT_TYPE { + /** 0: (Default) NV12. */ + CAMERA_FORMAT_NV12, + /** 1: BGRA. */ + CAMERA_FORMAT_BGRA, +}; +#endif + +/** Supported codec type bit mask. */ +enum CODEC_CAP_MASK { + /** 0: No codec support. */ + CODEC_CAP_MASK_NONE = 0, + + /** bit 1: Hardware decoder support flag. */ + CODEC_CAP_MASK_HW_DEC = 1 << 0, + + /** bit 2: Hardware encoder support flag. */ + CODEC_CAP_MASK_HW_ENC = 1 << 1, + + /** bit 3: Software decoder support flag. */ + CODEC_CAP_MASK_SW_DEC = 1 << 2, + + /** bit 4: Software encoder support flag. */ + CODEC_CAP_MASK_SW_ENC = 1 << 3, +}; + +struct CodecCapLevels { + VIDEO_CODEC_CAPABILITY_LEVEL hwDecodingLevel; + VIDEO_CODEC_CAPABILITY_LEVEL swDecodingLevel; + + CodecCapLevels(): hwDecodingLevel(CODEC_CAPABILITY_LEVEL_UNSPECIFIED), swDecodingLevel(CODEC_CAPABILITY_LEVEL_UNSPECIFIED) {} +}; + +/** The codec support information. */ +struct CodecCapInfo { + /** The codec type: #VIDEO_CODEC_TYPE. */ + VIDEO_CODEC_TYPE codecType; + /** The codec support flag. */ + int codecCapMask; + /** The codec capability level, estimated based on the device hardware.*/ + CodecCapLevels codecLevels; +}; + +/** + * The definition of the VideoEncoderConfiguration struct. + */ +struct VideoEncoderConfiguration { + /** + * The video encoder code type: #VIDEO_CODEC_TYPE. + */ + VIDEO_CODEC_TYPE codecType; + /** + * The video dimension: VideoDimensions. + */ + VideoDimensions dimensions; + /** + * The frame rate of the video. You can set it manually, or choose one from #FRAME_RATE. + */ + int frameRate; + /** + * The bitrate (Kbps) of the video. + * + * Refer to the **Video Bitrate Table** below and set your bitrate. If you set a bitrate beyond the + * proper range, the SDK automatically adjusts it to a value within the range. You can also choose + * from the following options: + * + * - #STANDARD_BITRATE: (Recommended) Standard bitrate mode. In this mode, the bitrates differ between + * the Live Broadcast and Communication profiles: + * - In the Communication profile, the video bitrate is the same as the base bitrate. + * - In the Live Broadcast profile, the video bitrate is twice the base bitrate. + * - #COMPATIBLE_BITRATE: Compatible bitrate mode. The compatible bitrate mode. In this mode, the bitrate + * stays the same regardless of the profile. If you choose this mode for the Live Broadcast profile, + * the video frame rate may be lower than the set value. + * + * Agora uses different video codecs for different profiles to optimize the user experience. For example, + * the communication profile prioritizes the smoothness while the live-broadcast profile prioritizes the + * video quality (a higher bitrate). Therefore, We recommend setting this parameter as #STANDARD_BITRATE. + * + * | Resolution | Frame Rate (fps) | Base Bitrate (Kbps) | Live Bitrate (Kbps)| + * |------------------------|------------------|---------------------|--------------------| + * | 160 * 120 | 15 | 65 | 110 | + * | 120 * 120 | 15 | 50 | 90 | + * | 320 * 180 | 15 | 140 | 240 | + * | 180 * 180 | 15 | 100 | 160 | + * | 240 * 180 | 15 | 120 | 200 | + * | 320 * 240 | 15 | 200 | 300 | + * | 240 * 240 | 15 | 140 | 240 | + * | 424 * 240 | 15 | 220 | 370 | + * | 640 * 360 | 15 | 400 | 680 | + * | 360 * 360 | 15 | 260 | 440 | + * | 640 * 360 | 30 | 600 | 1030 | + * | 360 * 360 | 30 | 400 | 670 | + * | 480 * 360 | 15 | 320 | 550 | + * | 480 * 360 | 30 | 490 | 830 | + * | 640 * 480 | 15 | 500 | 750 | + * | 480 * 480 | 15 | 400 | 680 | + * | 640 * 480 | 30 | 750 | 1130 | + * | 480 * 480 | 30 | 600 | 1030 | + * | 848 * 480 | 15 | 610 | 920 | + * | 848 * 480 | 30 | 930 | 1400 | + * | 640 * 480 | 10 | 400 | 600 | + * | 960 * 540 | 15 | 750 | 1100 | + * | 960 * 540 | 30 | 1110 | 1670 | + * | 1280 * 720 | 15 | 1130 | 1600 | + * | 1280 * 720 | 30 | 1710 | 2400 | + * | 960 * 720 | 15 | 910 | 1280 | + * | 960 * 720 | 30 | 1380 | 2000 | + * | 1920 * 1080 | 15 | 2080 | 2500 | + * | 1920 * 1080 | 30 | 3150 | 3780 | + * | 1920 * 1080 | 60 | 4780 | 5730 | + * | 2560 * 1440 | 30 | 4850 | 4850 | + * | 2560 * 1440 | 60 | 7350 | 7350 | + * | 3840 * 2160 | 30 | 8910 | 8910 | + * | 3840 * 2160 | 60 | 13500 | 13500 | + */ + int bitrate; + + /** + * The minimum encoding bitrate (Kbps). + * + * The Agora SDK automatically adjusts the encoding bitrate to adapt to the + * network conditions. + * + * Using a value greater than the default value forces the video encoder to + * output high-quality images but may cause more packet loss and hence + * sacrifice the smoothness of the video transmission. That said, unless you + * have special requirements for image quality, Agora does not recommend + * changing this value. + * + * @note + * This parameter applies to the live-broadcast profile only. + */ + int minBitrate; + /** + * The video orientation mode: #ORIENTATION_MODE. + */ + ORIENTATION_MODE orientationMode; + /** + * The video degradation preference under limited bandwidth: #DEGRADATION_PREFERENCE. + */ + DEGRADATION_PREFERENCE degradationPreference; + + /** + * If mirror_type is set to VIDEO_MIRROR_MODE_ENABLED, then the video frame would be mirrored before encoding. + */ + VIDEO_MIRROR_MODE_TYPE mirrorMode; + + /** + * The advanced options for the video encoder configuration. See AdvanceOptions. + */ + AdvanceOptions advanceOptions; + + VideoEncoderConfiguration(const VideoDimensions& d, int f, int b, ORIENTATION_MODE m, VIDEO_MIRROR_MODE_TYPE mirror = VIDEO_MIRROR_MODE_DISABLED) + : codecType(VIDEO_CODEC_H264), + dimensions(d), + frameRate(f), + bitrate(b), + minBitrate(DEFAULT_MIN_BITRATE), + orientationMode(m), + degradationPreference(MAINTAIN_QUALITY), + mirrorMode(mirror), + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + VideoEncoderConfiguration(int width, int height, int f, int b, ORIENTATION_MODE m, VIDEO_MIRROR_MODE_TYPE mirror = VIDEO_MIRROR_MODE_DISABLED) + : codecType(VIDEO_CODEC_H264), + dimensions(width, height), + frameRate(f), + bitrate(b), + minBitrate(DEFAULT_MIN_BITRATE), + orientationMode(m), + degradationPreference(MAINTAIN_QUALITY), + mirrorMode(mirror), + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + VideoEncoderConfiguration(const VideoEncoderConfiguration& config) + : codecType(config.codecType), + dimensions(config.dimensions), + frameRate(config.frameRate), + bitrate(config.bitrate), + minBitrate(config.minBitrate), + orientationMode(config.orientationMode), + degradationPreference(config.degradationPreference), + mirrorMode(config.mirrorMode), + advanceOptions(config.advanceOptions) {} + VideoEncoderConfiguration() + : codecType(VIDEO_CODEC_H264), + dimensions(FRAME_WIDTH_960, FRAME_HEIGHT_540), + frameRate(FRAME_RATE_FPS_15), + bitrate(STANDARD_BITRATE), + minBitrate(DEFAULT_MIN_BITRATE), + orientationMode(ORIENTATION_MODE_ADAPTIVE), + degradationPreference(MAINTAIN_QUALITY), + mirrorMode(VIDEO_MIRROR_MODE_DISABLED), + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + + VideoEncoderConfiguration& operator=(const VideoEncoderConfiguration& rhs) { + if (this == &rhs) return *this; + codecType = rhs.codecType; + dimensions = rhs.dimensions; + frameRate = rhs.frameRate; + bitrate = rhs.bitrate; + minBitrate = rhs.minBitrate; + orientationMode = rhs.orientationMode; + degradationPreference = rhs.degradationPreference; + mirrorMode = rhs.mirrorMode; + advanceOptions = rhs.advanceOptions; + return *this; + } +}; + +/** + * The configurations for the data stream. + */ +struct DataStreamConfig { + /** + * Whether to synchronize the data packet with the published audio packet. + * - `true`: Synchronize the data packet with the audio packet. + * - `false`: Do not synchronize the data packet with the audio packet. + * + * When you set the data packet to synchronize with the audio, then if the data packet delay is + * within the audio delay, the SDK triggers the `onStreamMessage` callback when the synchronized + * audio packet is played out. Do not set this parameter as true if you need the receiver to receive + * the data packet immediately. Agora recommends that you set this parameter to `true` only when you + * need to implement specific functions, for example lyric synchronization. + */ + bool syncWithAudio; + /** + * Whether the SDK guarantees that the receiver receives the data in the sent order. + * - `true`: Guarantee that the receiver receives the data in the sent order. + * - `false`: Do not guarantee that the receiver receives the data in the sent order. + * + * Do not set this parameter as `true` if you need the receiver to receive the data packet immediately. + */ + bool ordered; +}; + +/** + * The definition of SIMULCAST_STREAM_MODE + */ +enum SIMULCAST_STREAM_MODE { + /* + * disable simulcast stream until receive request for enable simulcast stream by other broadcaster + */ + AUTO_SIMULCAST_STREAM = -1, + /* + * disable simulcast stream + */ + DISABLE_SIMULCAST_STREAM = 0, + /* + * always enable simulcast stream + */ + ENABLE_SIMULCAST_STREAM = 1, +}; + +/** + * The configuration of the low-quality video stream. + */ +struct SimulcastStreamConfig { + /** + * The video frame dimension: VideoDimensions. The default value is 160 × 120. + */ + VideoDimensions dimensions; + /** + * The video bitrate (Kbps), represented by an instantaneous value. The default value of the log level is 5. + */ + int kBitrate; + /** + * he capture frame rate (fps) of the local video. The default value is 5. + */ + int framerate; + SimulcastStreamConfig() : dimensions(160, 120), kBitrate(65), framerate(5) {} + bool operator==(const SimulcastStreamConfig& rhs) const { + return dimensions == rhs.dimensions && kBitrate == rhs.kBitrate && framerate == rhs.framerate; + } +}; + +/** + * The location of the target area relative to the screen or window. If you do not set this parameter, + * the SDK selects the whole screen or window. + */ +struct Rectangle { + /** + * The horizontal offset from the top-left corner. + */ + int x; + /** + * The vertical offset from the top-left corner. + */ + int y; + /** + * The width of the region. + */ + int width; + /** + * The height of the region. + */ + int height; + + Rectangle() : x(0), y(0), width(0), height(0) {} + Rectangle(int xx, int yy, int ww, int hh) : x(xx), y(yy), width(ww), height(hh) {} +}; + +/** + * The position and size of the watermark on the screen. + * + * The position and size of the watermark on the screen are determined by `xRatio`, `yRatio`, and `widthRatio`: + * - (`xRatio`, `yRatio`) refers to the coordinates of the upper left corner of the watermark, which determines + * the distance from the upper left corner of the watermark to the upper left corner of the screen. + * The `widthRatio` determines the width of the watermark. + */ +struct WatermarkRatio { + /** + * The x-coordinate of the upper left corner of the watermark. The horizontal position relative to + * the origin, where the upper left corner of the screen is the origin, and the x-coordinate is the + * upper left corner of the watermark. The value range is [0.0,1.0], and the default value is 0. + */ + float xRatio; + /** + * The y-coordinate of the upper left corner of the watermark. The vertical position relative to the + * origin, where the upper left corner of the screen is the origin, and the y-coordinate is the upper + * left corner of the screen. The value range is [0.0,1.0], and the default value is 0. + */ + float yRatio; + /** + * The width of the watermark. The SDK calculates the height of the watermark proportionally according + * to this parameter value to ensure that the enlarged or reduced watermark image is not distorted. + * The value range is [0,1], and the default value is 0, which means no watermark is displayed. + */ + float widthRatio; + + WatermarkRatio() : xRatio(0.0), yRatio(0.0), widthRatio(0.0) {} + WatermarkRatio(float x, float y, float width) : xRatio(x), yRatio(y), widthRatio(width) {} +}; + +/** + * Configurations of the watermark image. + */ +struct WatermarkOptions { + /** + * Whether or not the watermark image is visible in the local video preview: + * - true: (Default) The watermark image is visible in preview. + * - false: The watermark image is not visible in preview. + */ + bool visibleInPreview; + /** + * When the adaptation mode of the watermark is `FIT_MODE_COVER_POSITION`, it is used to set the + * area of the watermark image in landscape mode. See #FIT_MODE_COVER_POSITION for details. + */ + Rectangle positionInLandscapeMode; + /** + * When the adaptation mode of the watermark is `FIT_MODE_COVER_POSITION`, it is used to set the + * area of the watermark image in portrait mode. See #FIT_MODE_COVER_POSITION for details. + */ + Rectangle positionInPortraitMode; + /** + * When the watermark adaptation mode is `FIT_MODE_USE_IMAGE_RATIO`, this parameter is used to set + * the watermark coordinates. See WatermarkRatio for details. + */ + WatermarkRatio watermarkRatio; + /** + * The adaptation mode of the watermark. See #WATERMARK_FIT_MODE for details. + */ + WATERMARK_FIT_MODE mode; + + WatermarkOptions() + : visibleInPreview(true), + positionInLandscapeMode(0, 0, 0, 0), + positionInPortraitMode(0, 0, 0, 0), + mode(FIT_MODE_COVER_POSITION) {} +}; + +/** + * The definition of the RtcStats struct. + */ +struct RtcStats { + /** + * The call duration (s), represented by an aggregate value. + */ + unsigned int duration; + /** + * The total number of bytes transmitted, represented by an aggregate value. + */ + unsigned int txBytes; + /** + * The total number of bytes received, represented by an aggregate value. + */ + unsigned int rxBytes; + /** + * The total number of audio bytes sent (bytes), represented by an aggregate value. + */ + unsigned int txAudioBytes; + /** + * The total number of video bytes sent (bytes), represented by an aggregate value. + */ + unsigned int txVideoBytes; + /** + * The total number of audio bytes received (bytes), represented by an aggregate value. + */ + unsigned int rxAudioBytes; + /** + * The total number of video bytes received (bytes), represented by an aggregate value. + */ + unsigned int rxVideoBytes; + /** + * The transmission bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short txKBitRate; + /** + * The receiving bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short rxKBitRate; + /** + * Audio receiving bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short rxAudioKBitRate; + /** + * The audio transmission bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short txAudioKBitRate; + /** + * The video receive bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short rxVideoKBitRate; + /** + * The video transmission bitrate (Kbps), represented by an instantaneous value. + */ + unsigned short txVideoKBitRate; + /** + * The VOS client-server latency (ms). + */ + unsigned short lastmileDelay; + /** + * The number of users in the channel. + */ + unsigned int userCount; + /** + * The app CPU usage (%). + * @note + * - The value of `cpuAppUsage` is always reported as 0 in the `onLeaveChannel` callback. + * - As of Android 8.1, you cannot get the CPU usage from this attribute due to system limitations. + */ + double cpuAppUsage; + /** + * The system CPU usage (%). + * + * For Windows, in the multi-kernel environment, this member represents the average CPU usage. The + * value = (100 - System Idle Progress in Task Manager)/100. + * @note + * - The value of `cpuTotalUsage` is always reported as 0 in the `onLeaveChannel` callback. + * - As of Android 8.1, you cannot get the CPU usage from this attribute due to system limitations. + */ + double cpuTotalUsage; + /** + * The round-trip time delay from the client to the local router. + * @note On Android, to get `gatewayRtt`, ensure that you add the `android.permission.ACCESS_WIFI_STATE` + * permission after `` in the `AndroidManifest.xml` file in your project. + */ + int gatewayRtt; + /** + * The memory usage ratio of the app (%). + * @note This value is for reference only. Due to system limitations, you may not get this value. + */ + double memoryAppUsageRatio; + /** + * The memory usage ratio of the system (%). + * @note This value is for reference only. Due to system limitations, you may not get this value. + */ + double memoryTotalUsageRatio; + /** + * The memory usage of the app (KB). + * @note This value is for reference only. Due to system limitations, you may not get this value. + */ + int memoryAppUsageInKbytes; + /** + * The time elapsed from the when the app starts connecting to an Agora channel + * to when the connection is established. 0 indicates that this member does not apply. + */ + int connectTimeMs; + /** + * The duration (ms) between the app starting connecting to an Agora channel + * and the first audio packet is received. 0 indicates that this member does not apply. + */ + int firstAudioPacketDuration; + /** + * The duration (ms) between the app starting connecting to an Agora channel + * and the first video packet is received. 0 indicates that this member does not apply. + */ + int firstVideoPacketDuration; + /** + * The duration (ms) between the app starting connecting to an Agora channel + * and the first video key frame is received. 0 indicates that this member does not apply. + */ + int firstVideoKeyFramePacketDuration; + /** + * The number of video packets before the first video key frame is received. + * 0 indicates that this member does not apply. + */ + int packetsBeforeFirstKeyFramePacket; + /** + * The duration (ms) between the last time unmute audio and the first audio packet is received. + * 0 indicates that this member does not apply. + */ + int firstAudioPacketDurationAfterUnmute; + /** + * The duration (ms) between the last time unmute video and the first video packet is received. + * 0 indicates that this member does not apply. + */ + int firstVideoPacketDurationAfterUnmute; + /** + * The duration (ms) between the last time unmute video and the first video key frame is received. + * 0 indicates that this member does not apply. + */ + int firstVideoKeyFramePacketDurationAfterUnmute; + /** + * The duration (ms) between the last time unmute video and the first video key frame is decoded. + * 0 indicates that this member does not apply. + */ + int firstVideoKeyFrameDecodedDurationAfterUnmute; + /** + * The duration (ms) between the last time unmute video and the first video key frame is rendered. + * 0 indicates that this member does not apply. + */ + int firstVideoKeyFrameRenderedDurationAfterUnmute; + /** + * The packet loss rate of sender(broadcaster). + */ + int txPacketLossRate; + /** + * The packet loss rate of receiver(audience). + */ + int rxPacketLossRate; + /** + * The audio playout device glitch count. + */ + int playoutDeviceGlitch; + RtcStats() + : duration(0), + txBytes(0), + rxBytes(0), + txAudioBytes(0), + txVideoBytes(0), + rxAudioBytes(0), + rxVideoBytes(0), + txKBitRate(0), + rxKBitRate(0), + rxAudioKBitRate(0), + txAudioKBitRate(0), + rxVideoKBitRate(0), + txVideoKBitRate(0), + lastmileDelay(0), + userCount(0), + cpuAppUsage(0.0), + cpuTotalUsage(0.0), + gatewayRtt(0), + memoryAppUsageRatio(0.0), + memoryTotalUsageRatio(0.0), + memoryAppUsageInKbytes(0), + connectTimeMs(0), + firstAudioPacketDuration(0), + firstVideoPacketDuration(0), + firstVideoKeyFramePacketDuration(0), + packetsBeforeFirstKeyFramePacket(0), + firstAudioPacketDurationAfterUnmute(0), + firstVideoPacketDurationAfterUnmute(0), + firstVideoKeyFramePacketDurationAfterUnmute(0), + firstVideoKeyFrameDecodedDurationAfterUnmute(0), + firstVideoKeyFrameRenderedDurationAfterUnmute(0), + txPacketLossRate(0), + rxPacketLossRate(0), + playoutDeviceGlitch(0) {} +}; + +/** + * User role types. + */ +enum CLIENT_ROLE_TYPE { + /** + * 1: Broadcaster. A broadcaster can both send and receive streams. + */ + CLIENT_ROLE_BROADCASTER = 1, + /** + * 2: Audience. An audience member can only receive streams. + */ + CLIENT_ROLE_AUDIENCE = 2, +}; + +/** + * Quality change of the local video in terms of target frame rate and target bit rate since last count. + */ +enum QUALITY_ADAPT_INDICATION { + /** + * 0: The quality of the local video stays the same. + */ + ADAPT_NONE = 0, + /** + * 1: The quality improves because the network bandwidth increases. + */ + ADAPT_UP_BANDWIDTH = 1, + /** + * 2: The quality worsens because the network bandwidth decreases. + */ + ADAPT_DOWN_BANDWIDTH = 2, +}; + +/** + * The latency level of an audience member in interactive live streaming. This enum takes effect only + * when the user role is set to `CLIENT_ROLE_AUDIENCE`. + */ +enum AUDIENCE_LATENCY_LEVEL_TYPE +{ + /** + * 1: Low latency. + */ + AUDIENCE_LATENCY_LEVEL_LOW_LATENCY = 1, + /** + * 2: Ultra low latency. + */ + AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY = 2, +}; + +/** + * The detailed options of a user. + */ +struct ClientRoleOptions +{ + /** + * The latency level of an audience member in interactive live streaming. See `AUDIENCE_LATENCY_LEVEL_TYPE`. + */ + AUDIENCE_LATENCY_LEVEL_TYPE audienceLatencyLevel; + + ClientRoleOptions() + : audienceLatencyLevel(AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY) {} +}; + +/** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. + */ +enum EXPERIENCE_QUALITY_TYPE { + /** 0: QoE of the local user is good. */ + EXPERIENCE_QUALITY_GOOD = 0, + /** 1: QoE of the local user is poor. */ + EXPERIENCE_QUALITY_BAD = 1, +}; + +/** + * Reasons why the QoE of the local user when receiving a remote audio stream is poor. + */ +enum EXPERIENCE_POOR_REASON { + /** + * 0: No reason, indicating good QoE of the local user. + */ + EXPERIENCE_REASON_NONE = 0, + /** + * 1: The remote user's network quality is poor. + */ + REMOTE_NETWORK_QUALITY_POOR = 1, + /** + * 2: The local user's network quality is poor. + */ + LOCAL_NETWORK_QUALITY_POOR = 2, + /** + * 4: The local user's Wi-Fi or mobile network signal is weak. + */ + WIRELESS_SIGNAL_POOR = 4, + /** + * 8: The local user enables both Wi-Fi and bluetooth, and their signals interfere with each other. + * As a result, audio transmission quality is undermined. + */ + WIFI_BLUETOOTH_COEXIST = 8, +}; + +/** + * Audio profile types. + */ +enum AUDIO_PROFILE_TYPE { + /** + * 0: The default audio profile. + * - For the Communication profile: + * - Windows: A sample rate of 16 kHz, audio encoding, mono, and a bitrate of up to 16 Kbps. + * - Android/macOS/iOS: A sample rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. + * of up to 16 Kbps. + * - For the Live-broadcast profile: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. + */ + AUDIO_PROFILE_DEFAULT = 0, + /** + * 1: A sample rate of 32 kHz, audio encoding, mono, and a bitrate of up to 18 Kbps. + */ + AUDIO_PROFILE_SPEECH_STANDARD = 1, + /** + * 2: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. + */ + AUDIO_PROFILE_MUSIC_STANDARD = 2, + /** + * 3: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 80 Kbps. + * + * To implement stereo audio, you also need to call `setAdvancedAudioOptions` and set `audioProcessingChannels` + * to `AUDIO_PROCESSING_STEREO` in `AdvancedAudioOptions`. + */ + AUDIO_PROFILE_MUSIC_STANDARD_STEREO = 3, + /** + * 4: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 96 Kbps. + */ + AUDIO_PROFILE_MUSIC_HIGH_QUALITY = 4, + /** + * 5: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 128 Kbps. + * + * To implement stereo audio, you also need to call `setAdvancedAudioOptions` and set `audioProcessingChannels` + * to `AUDIO_PROCESSING_STEREO` in `AdvancedAudioOptions`. + */ + AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO = 5, + /** + * 6: A sample rate of 16 kHz, audio encoding, mono, and Acoustic Echo Cancellation (AES) enabled. + */ + AUDIO_PROFILE_IOT = 6, + AUDIO_PROFILE_NUM = 7 +}; + +/** + * The audio scenario. + */ +enum AUDIO_SCENARIO_TYPE { + /** + * 0: Automatic scenario, where the SDK chooses the appropriate audio quality according to the + * user role and audio route. + */ + AUDIO_SCENARIO_DEFAULT = 0, + /** + * 3: (Recommended) The live gaming scenario, which needs to enable gaming + * audio effects in the speaker. Choose this scenario to achieve high-fidelity + * music playback. + */ + AUDIO_SCENARIO_GAME_STREAMING = 3, + /** + * 5: The chatroom scenario, which needs to keep recording when setClientRole to audience. + * Normally, app developer can also use mute api to achieve the same result, + * and we implement this 'non-orthogonal' behavior only to make API backward compatible. + */ + AUDIO_SCENARIO_CHATROOM = 5, + /** + * 7: Real-time chorus scenario, where users have good network conditions and require ultra-low latency. + */ + AUDIO_SCENARIO_CHORUS = 7, + /** + * 8: Meeting + */ + AUDIO_SCENARIO_MEETING = 8, + /** + * 9: The number of enumerations. + */ + AUDIO_SCENARIO_NUM = 9, +}; + +/** + * The format of the video frame. + */ +struct VideoFormat { + OPTIONAL_ENUM_SIZE_T { + /** The maximum value (px) of the width. */ + kMaxWidthInPixels = 3840, + /** The maximum value (px) of the height. */ + kMaxHeightInPixels = 2160, + /** The maximum value (fps) of the frame rate. */ + kMaxFps = 60, + }; + + /** + * The width (px) of the video. + */ + int width; // Number of pixels. + /** + * The height (px) of the video. + */ + int height; // Number of pixels. + /** + * The video frame rate (fps). + */ + int fps; + VideoFormat() : width(FRAME_WIDTH_960), height(FRAME_HEIGHT_540), fps(FRAME_RATE_FPS_15) {} + VideoFormat(int w, int h, int f) : width(w), height(h), fps(f) {} + + bool operator<(const VideoFormat& fmt) const { + if (height != fmt.height) { + return height < fmt.height; + } else if (width != fmt.width) { + return width < fmt.width; + } else { + return fps < fmt.fps; + } + } + bool operator==(const VideoFormat& fmt) const { + return width == fmt.width && height == fmt.height && fps == fmt.fps; + } + bool operator!=(const VideoFormat& fmt) const { + return !operator==(fmt); + } +}; + +/** + * Video content hints. + */ +enum VIDEO_CONTENT_HINT { + /** + * (Default) No content hint. In this case, the SDK balances smoothness with sharpness. + */ + CONTENT_HINT_NONE, + /** + * Choose this option if you prefer smoothness or when + * you are sharing motion-intensive content such as a video clip, movie, or video game. + * + * + */ + CONTENT_HINT_MOTION, + /** + * Choose this option if you prefer sharpness or when you are + * sharing montionless content such as a picture, PowerPoint slide, ot text. + * + */ + CONTENT_HINT_DETAILS +}; +/** + * The screen sharing scenario. + */ +enum SCREEN_SCENARIO_TYPE { + /** + * 1: Document. This scenario prioritizes the video quality of screen sharing and reduces the + * latency of the shared video for the receiver. If you share documents, slides, and tables, + * you can set this scenario. + */ + SCREEN_SCENARIO_DOCUMENT = 1, + /** + * 2: Game. This scenario prioritizes the smoothness of screen sharing. If you share games, you + * can set this scenario. + */ + SCREEN_SCENARIO_GAMING = 2, + /** + * 3: Video. This scenario prioritizes the smoothness of screen sharing. If you share movies or + * live videos, you can set this scenario. + */ + SCREEN_SCENARIO_VIDEO = 3, + /** + * 4: Remote control. This scenario prioritizes the video quality of screen sharing and reduces + * the latency of the shared video for the receiver. If you share the device desktop being + * remotely controlled, you can set this scenario. + */ + SCREEN_SCENARIO_RDC = 4, +}; + +/** + * The brightness level of the video image captured by the local camera. + */ +enum CAPTURE_BRIGHTNESS_LEVEL_TYPE { + /** -1: The SDK does not detect the brightness level of the video image. + * Wait a few seconds to get the brightness level from `CAPTURE_BRIGHTNESS_LEVEL_TYPE` in the next callback. + */ + CAPTURE_BRIGHTNESS_LEVEL_INVALID = -1, + /** 0: The brightness level of the video image is normal. + */ + CAPTURE_BRIGHTNESS_LEVEL_NORMAL = 0, + /** 1: The brightness level of the video image is too bright. + */ + CAPTURE_BRIGHTNESS_LEVEL_BRIGHT = 1, + /** 2: The brightness level of the video image is too dark. + */ + CAPTURE_BRIGHTNESS_LEVEL_DARK = 2, +}; + +/** + * Local audio states. + */ +enum LOCAL_AUDIO_STREAM_STATE { + /** + * 0: The local audio is in the initial state. + */ + LOCAL_AUDIO_STREAM_STATE_STOPPED = 0, + /** + * 1: The capturing device starts successfully. + */ + LOCAL_AUDIO_STREAM_STATE_RECORDING = 1, + /** + * 2: The first audio frame encodes successfully. + */ + LOCAL_AUDIO_STREAM_STATE_ENCODING = 2, + /** + * 3: The local audio fails to start. + */ + LOCAL_AUDIO_STREAM_STATE_FAILED = 3 +}; + +/** + * Local audio state error codes. + */ +enum LOCAL_AUDIO_STREAM_ERROR { + /** + * 0: The local audio is normal. + */ + LOCAL_AUDIO_STREAM_ERROR_OK = 0, + /** + * 1: No specified reason for the local audio failure. Remind your users to try to rejoin the channel. + */ + LOCAL_AUDIO_STREAM_ERROR_FAILURE = 1, + /** + * 2: No permission to use the local audio device. Remind your users to grant permission. + */ + LOCAL_AUDIO_STREAM_ERROR_DEVICE_NO_PERMISSION = 2, + /** + * 3: (Android and iOS only) The local audio capture device is used. Remind your users to check + * whether another application occupies the microphone. Local audio capture automatically resume + * after the microphone is idle for about five seconds. You can also try to rejoin the channel + * after the microphone is idle. + */ + LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY = 3, + /** + * 4: The local audio capture failed. + */ + LOCAL_AUDIO_STREAM_ERROR_RECORD_FAILURE = 4, + /** + * 5: The local audio encoding failed. + */ + LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE = 5, + /** 6: The SDK cannot find the local audio recording device. + */ + LOCAL_AUDIO_STREAM_ERROR_NO_RECORDING_DEVICE = 6, + /** 7: The SDK cannot find the local audio playback device. + */ + LOCAL_AUDIO_STREAM_ERROR_NO_PLAYOUT_DEVICE = 7, + /** + * 8: The local audio capturing is interrupted by the system call. + */ + LOCAL_AUDIO_STREAM_ERROR_INTERRUPTED = 8, + /** 9: An invalid audio capture device ID. + */ + LOCAL_AUDIO_STREAM_ERROR_RECORD_INVALID_ID = 9, + /** 10: An invalid audio playback device ID. + */ + LOCAL_AUDIO_STREAM_ERROR_PLAYOUT_INVALID_ID = 10, +}; + +/** Local video state types. + */ +enum LOCAL_VIDEO_STREAM_STATE { + /** + * 0: The local video is in the initial state. + */ + LOCAL_VIDEO_STREAM_STATE_STOPPED = 0, + /** + * 1: The local video capturing device starts successfully. The SDK also reports this state when + * you call `startScreenCaptureByWindowId` to share a maximized window. + */ + LOCAL_VIDEO_STREAM_STATE_CAPTURING = 1, + /** + * 2: The first video frame is successfully encoded. + */ + LOCAL_VIDEO_STREAM_STATE_ENCODING = 2, + /** + * 3: Fails to start the local video. + */ + LOCAL_VIDEO_STREAM_STATE_FAILED = 3 +}; + +/** + * Local video state error codes. + */ +enum LOCAL_VIDEO_STREAM_ERROR { + /** + * 0: The local video is normal. + */ + LOCAL_VIDEO_STREAM_ERROR_OK = 0, + /** + * 1: No specified reason for the local video failure. + */ + LOCAL_VIDEO_STREAM_ERROR_FAILURE = 1, + /** + * 2: No permission to use the local video capturing device. Remind the user to grant permission + * and rejoin the channel. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_NO_PERMISSION = 2, + /** + * 3: The local video capturing device is in use. Remind the user to check whether another + * application occupies the camera. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY = 3, + /** + * 4: The local video capture fails. Remind the user to check whether the video capture device + * is working properly or the camera is occupied by another application, and then to rejoin the + * channel. + */ + LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE = 4, + /** + * 5: The local video encoder is not supported. + */ + LOCAL_VIDEO_STREAM_ERROR_CODEC_NOT_SUPPORT = 5, + /** + * 6: (iOS only) The app is in the background. Remind the user that video capture cannot be + * performed normally when the app is in the background. + */ + LOCAL_VIDEO_STREAM_ERROR_CAPTURE_INBACKGROUND = 6, + /** + * 7: (iOS only) The current application window is running in Slide Over, Split View, or Picture + * in Picture mode, and another app is occupying the camera. Remind the user that the application + * cannot capture video properly when the app is running in Slide Over, Split View, or Picture in + * Picture mode and another app is occupying the camera. + */ + LOCAL_VIDEO_STREAM_ERROR_CAPTURE_MULTIPLE_FOREGROUND_APPS = 7, + /** + * 8: Fails to find a local video capture device. Remind the user to check whether the camera is + * connected to the device properly or the camera is working properly, and then to rejoin the + * channel. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_NOT_FOUND = 8, + /** + * 9: (macOS only) The video capture device currently in use is disconnected (such as being + * unplugged). + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_DISCONNECTED = 9, + /** + * 10: (macOS and Windows only) The SDK cannot find the video device in the video device list. + * Check whether the ID of the video device is valid. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_INVALID_ID = 10, + /** + * 14: (Android only) Video capture was interrupted, possibly due to the camera being occupied + * or some policy reasons such as background termination. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_INTERRUPT = 14, + /** + * 15: (Android only) The device may need to be shut down and restarted to restore camera function, + * or there may be a persistent hardware problem. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_FATAL_ERROR = 15, + /** + * 101: The current video capture device is unavailable due to excessive system pressure. + */ + LOCAL_VIDEO_STREAM_ERROR_DEVICE_SYSTEM_PRESSURE = 101, + /** + * 11: (macOS only) The shared window is minimized when you call `startScreenCaptureByWindowId` + * to share a window. The SDK cannot share a minimized window. You can cancel the minimization + * of this window at the application layer, for example by maximizing this window. + */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_MINIMIZED = 11, + /** + * 12: (macOS and Windows only) The error code indicates that a window shared by the window ID + * has been closed or a full-screen window shared by the window ID has exited full-screen mode. + * After exiting full-screen mode, remote users cannot see the shared window. To prevent remote + * users from seeing a black screen, Agora recommends that you immediately stop screen sharing. + * + * Common scenarios for reporting this error code: + * - When the local user closes the shared window, the SDK reports this error code. + * - The local user shows some slides in full-screen mode first, and then shares the windows of + * the slides. After the user exits full-screen mode, the SDK reports this error code. + * - The local user watches a web video or reads a web document in full-screen mode first, and + * then shares the window of the web video or document. After the user exits full-screen mode, + * the SDK reports this error code. + */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_CLOSED = 12, + /** 13: The local screen capture window is occluded. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_OCCLUDED = 13, + /** 20: The local screen capture window is not supported. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_NOT_SUPPORTED = 20, + /** 21: The screen capture fails. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_FAILURE = 21, + /** 22: No permision to capture screen. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_NO_PERMISSION = 22, + /** 25: (Windows only) The local screen capture window is currently hidden and not visible on the desktop. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_HIDDEN = 25, + /** 26: (Windows only) The local screen capture window is recovered from its hidden state. */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_RECOVER_FROM_HIDDEN = 26, + /** 27:(Windows only) The window is recovered from miniminzed */ + LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_RECOVER_FROM_MINIMIZED = 27, +}; + +/** + * Remote audio states. + */ +enum REMOTE_AUDIO_STATE +{ + /** + * 0: The remote audio is in the default state. The SDK reports this state in the case of + * `REMOTE_AUDIO_REASON_LOCAL_MUTED(3)`, `REMOTE_AUDIO_REASON_REMOTE_MUTED(5)`, or + * `REMOTE_AUDIO_REASON_REMOTE_OFFLINE(7)`. + */ + REMOTE_AUDIO_STATE_STOPPED = 0, // Default state, audio is started or remote user disabled/muted audio stream + /** + * 1: The first remote audio packet is received. + */ + REMOTE_AUDIO_STATE_STARTING = 1, // The first audio frame packet has been received + /** + * 2: The remote audio stream is decoded and plays normally. The SDK reports this state in the case of + * `REMOTE_AUDIO_REASON_NETWORK_RECOVERY(2)`, `REMOTE_AUDIO_REASON_LOCAL_UNMUTED(4)`, or + * `REMOTE_AUDIO_REASON_REMOTE_UNMUTED(6)`. + */ + REMOTE_AUDIO_STATE_DECODING = 2, // The first remote audio frame has been decoded or fronzen state ends + /** + * 3: The remote audio is frozen. The SDK reports this state in the case of + * `REMOTE_AUDIO_REASON_NETWORK_CONGESTION(1)`. + */ + REMOTE_AUDIO_STATE_FROZEN = 3, // Remote audio is frozen, probably due to network issue + /** + * 4: The remote audio fails to start. The SDK reports this state in the case of + * `REMOTE_AUDIO_REASON_INTERNAL(0)`. + */ + REMOTE_AUDIO_STATE_FAILED = 4, // Remote audio play failed +}; + +/** + * Reasons for the remote audio state change. + */ +enum REMOTE_AUDIO_STATE_REASON +{ + /** + * 0: The SDK reports this reason when the video state changes. + */ + REMOTE_AUDIO_REASON_INTERNAL = 0, + /** + * 1: Network congestion. + */ + REMOTE_AUDIO_REASON_NETWORK_CONGESTION = 1, + /** + * 2: Network recovery. + */ + REMOTE_AUDIO_REASON_NETWORK_RECOVERY = 2, + /** + * 3: The local user stops receiving the remote audio stream or + * disables the audio module. + */ + REMOTE_AUDIO_REASON_LOCAL_MUTED = 3, + /** + * 4: The local user resumes receiving the remote audio stream or + * enables the audio module. + */ + REMOTE_AUDIO_REASON_LOCAL_UNMUTED = 4, + /** + * 5: The remote user stops sending the audio stream or disables the + * audio module. + */ + REMOTE_AUDIO_REASON_REMOTE_MUTED = 5, + /** + * 6: The remote user resumes sending the audio stream or enables the + * audio module. + */ + REMOTE_AUDIO_REASON_REMOTE_UNMUTED = 6, + /** + * 7: The remote user leaves the channel. + */ + REMOTE_AUDIO_REASON_REMOTE_OFFLINE = 7, +}; + +/** + * The state of the remote video. + */ +enum REMOTE_VIDEO_STATE { + /** + * 0: The remote video is in the default state. The SDK reports this state in the case of + * `REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED (3)`, `REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED (5)`, + * `REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE (7)`, or `REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK (8)`. + */ + REMOTE_VIDEO_STATE_STOPPED = 0, + /** + * 1: The first remote video packet is received. + */ + REMOTE_VIDEO_STATE_STARTING = 1, + /** + * 2: The remote video stream is decoded and plays normally. The SDK reports this state in the case of + * `REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY (2)`, `REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED (4)`, + * `REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED (6)`, or `REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY (9)`. + */ + REMOTE_VIDEO_STATE_DECODING = 2, + /** 3: The remote video is frozen, probably due to + * #REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION (1). + */ + REMOTE_VIDEO_STATE_FROZEN = 3, + /** 4: The remote video fails to start. The SDK reports this state in the case of + * `REMOTE_VIDEO_STATE_REASON_INTERNAL (0)`. + */ + REMOTE_VIDEO_STATE_FAILED = 4, +}; +/** + * The reason for the remote video state change. + */ +enum REMOTE_VIDEO_STATE_REASON { + /** + * 0: The SDK reports this reason when the video state changes. + */ + REMOTE_VIDEO_STATE_REASON_INTERNAL = 0, + /** + * 1: Network congestion. + */ + REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION = 1, + /** + * 2: Network recovery. + */ + REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY = 2, + /** + * 3: The local user stops receiving the remote video stream or disables the video module. + */ + REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED = 3, + /** + * 4: The local user resumes receiving the remote video stream or enables the video module. + */ + REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED = 4, + /** + * 5: The remote user stops sending the video stream or disables the video module. + */ + REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED = 5, + /** + * 6: The remote user resumes sending the video stream or enables the video module. + */ + REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED = 6, + /** + * 7: The remote user leaves the channel. + */ + REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE = 7, + /** 8: The remote audio-and-video stream falls back to the audio-only stream + * due to poor network conditions. + */ + REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK = 8, + /** 9: The remote audio-only stream switches back to the audio-and-video + * stream after the network conditions improve. + */ + REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY = 9, + /** (Internal use only) 10: The remote video stream type change to low stream type + */ + REMOTE_VIDEO_STATE_REASON_VIDEO_STREAM_TYPE_CHANGE_TO_LOW = 10, + /** (Internal use only) 11: The remote video stream type change to high stream type + */ + REMOTE_VIDEO_STATE_REASON_VIDEO_STREAM_TYPE_CHANGE_TO_HIGH = 11, + /** (iOS only) 12: The app of the remote user is in background. + */ + REMOTE_VIDEO_STATE_REASON_SDK_IN_BACKGROUND = 12, + + /** 13: The remote video stream is not supported by the decoder + */ + REMOTE_VIDEO_STATE_REASON_CODEC_NOT_SUPPORT = 13, + +}; + +/** + * The remote user state information. + */ +enum REMOTE_USER_STATE { + /** + * The remote user has muted the audio. + */ + USER_STATE_MUTE_AUDIO = (1 << 0), + /** + * The remote user has muted the video. + */ + USER_STATE_MUTE_VIDEO = (1 << 1), + /** + * The remote user has enabled the video, which includes video capturing and encoding. + */ + USER_STATE_ENABLE_VIDEO = (1 << 4), + /** + * The remote user has enabled the local video capturing. + */ + USER_STATE_ENABLE_LOCAL_VIDEO = (1 << 8), + +}; + +/** + * The definition of the VideoTrackInfo struct, which contains information of + * the video track. + */ +struct VideoTrackInfo { + VideoTrackInfo() + : isLocal(false), ownerUid(0), trackId(0), channelId(OPTIONAL_NULLPTR) + , streamType(VIDEO_STREAM_HIGH), codecType(VIDEO_CODEC_H264) + , encodedFrameOnly(false), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY) + , observationPosition(agora::media::base::POSITION_POST_CAPTURER) {} + /** + * Whether the video track is local or remote. + * - true: The video track is local. + * - false: The video track is remote. + */ + bool isLocal; + /** + * ID of the user who publishes the video track. + */ + uid_t ownerUid; + + /** + * ID of the video track. + */ + track_id_t trackId; + /** + * The channel ID of the video track. + */ + const char* channelId; + /** + * The video stream type: #VIDEO_STREAM_TYPE. + */ + VIDEO_STREAM_TYPE streamType; + /** + * The video codec type: #VIDEO_CODEC_TYPE. + */ + VIDEO_CODEC_TYPE codecType; + /** + * Whether the video track contains encoded video frame only. + * - true: The video track contains encoded video frame only. + * - false: The video track does not contain encoded video frame only. + */ + bool encodedFrameOnly; + /** + * The video source type: #VIDEO_SOURCE_TYPE + */ + VIDEO_SOURCE_TYPE sourceType; + /** + * the frame position for the video observer: #VIDEO_MODULE_POSITION + */ + uint32_t observationPosition; +}; + +/** + * The downscale level of the remote video stream . The higher the downscale level, the more the video downscales. + */ +enum REMOTE_VIDEO_DOWNSCALE_LEVEL { + /** + * No downscale. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE, + /** + * Downscale level 1. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_1, + /** + * Downscale level 2. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_2, + /** + * Downscale level 3. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_3, + /** + * Downscale level 4. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL_4, +}; + +/** + * The volume information of users. + */ +struct AudioVolumeInfo { + /** + * User ID of the speaker. + * - In the local user's callback, `uid` = 0. + * - In the remote users' callback, `uid` is the user ID of a remote user whose instantaneous + * volume is one of the three highest. + */ + uid_t uid; + /** + * The volume of the user. The value ranges between 0 (the lowest volume) and 255 (the highest + * volume). If the user calls `startAudioMixing`, the value of volume is the volume after audio + * mixing. + */ + unsigned int volume; // [0,255] + /** + * Voice activity status of the local user. + * - 0: The local user is not speaking. + * - 1: The local user is speaking. + * @note + * - The `vad` parameter does not report the voice activity status of remote users. In a remote + * user's callback, the value of `vad` is always 1. + * - To use this parameter, you must set `reportVad` to true when calling `enableAudioVolumeIndication`. + */ + unsigned int vad; + /** + * The voice pitch (Hz) of the local user. The value ranges between 0.0 and 4000.0. + * @note The `voicePitch` parameter does not report the voice pitch of remote users. In the + * remote users' callback, the value of `voicePitch` is always 0.0. + */ + double voicePitch; + + AudioVolumeInfo() : uid(0), volume(0), vad(0), voicePitch(0.0) {} +}; + +/** + * The audio device information. + */ +struct DeviceInfo { + /* + * Whether the audio device supports ultra-low-latency capture and playback: + * - `true`: The device supports ultra-low-latency capture and playback. + * - `false`: The device does not support ultra-low-latency capture and playback. + */ + bool isLowLatencyAudioSupported; + + DeviceInfo() : isLowLatencyAudioSupported(false) {} +}; + +/** + * The definition of the IPacketObserver struct. + */ +class IPacketObserver { + public: + virtual ~IPacketObserver() {} + /** + * The definition of the Packet struct. + */ + struct Packet { + /** + * The buffer address of the sent or received data. + * @note Agora recommends setting `buffer` to a value larger than 2048 bytes. Otherwise, you + * may encounter undefined behaviors (such as crashes). + */ + const unsigned char* buffer; + /** + * The buffer size of the sent or received data. + */ + unsigned int size; + + Packet() : buffer(NULL), size(0) {} + }; + /** + * Occurs when the SDK is ready to send the audio packet. + * @param packet The audio packet to be sent: Packet. + * @return Whether to send the audio packet: + * - true: Send the packet. + * - false: Do not send the packet, in which case the audio packet will be discarded. + */ + virtual bool onSendAudioPacket(Packet& packet) = 0; + /** + * Occurs when the SDK is ready to send the video packet. + * @param packet The video packet to be sent: Packet. + * @return Whether to send the video packet: + * - true: Send the packet. + * - false: Do not send the packet, in which case the audio packet will be discarded. + */ + virtual bool onSendVideoPacket(Packet& packet) = 0; + /** + * Occurs when the audio packet is received. + * @param packet The received audio packet: Packet. + * @return Whether to process the audio packet: + * - true: Process the packet. + * - false: Do not process the packet, in which case the audio packet will be discarded. + */ + virtual bool onReceiveAudioPacket(Packet& packet) = 0; + /** + * Occurs when the video packet is received. + * @param packet The received video packet: Packet. + * @return Whether to process the audio packet: + * - true: Process the packet. + * - false: Do not process the packet, in which case the video packet will be discarded. + */ + virtual bool onReceiveVideoPacket(Packet& packet) = 0; +}; + +/** + * Audio sample rate types. + */ +enum AUDIO_SAMPLE_RATE_TYPE { + /** + * 32000: 32 KHz. + */ + AUDIO_SAMPLE_RATE_32000 = 32000, + /** + * 44100: 44.1 KHz. + */ + AUDIO_SAMPLE_RATE_44100 = 44100, + /** + * 48000: 48 KHz. + */ + AUDIO_SAMPLE_RATE_48000 = 48000, +}; +/** + * The codec type of the output video. + */ +enum VIDEO_CODEC_TYPE_FOR_STREAM { + /** + * 1: H.264. + */ + VIDEO_CODEC_H264_FOR_STREAM = 1, + /** + * 2: H.265. + */ + VIDEO_CODEC_H265_FOR_STREAM = 2, +}; + +/** + * Video codec profile types. + */ +enum VIDEO_CODEC_PROFILE_TYPE { + /** + * 66: Baseline video codec profile. Generally used in video calls on mobile phones. + */ + VIDEO_CODEC_PROFILE_BASELINE = 66, + /** + * 77: Main video codec profile. Generally used in mainstream electronics, such as MP4 players, portable video players, PSP, and iPads. + */ + VIDEO_CODEC_PROFILE_MAIN = 77, + /** + * 100: High video codec profile. Generally used in high-resolution broadcasts or television. + */ + VIDEO_CODEC_PROFILE_HIGH = 100, +}; + + +/** + * Self-defined audio codec profile. + */ +enum AUDIO_CODEC_PROFILE_TYPE { + /** + * 0: LC-AAC. + */ + AUDIO_CODEC_PROFILE_LC_AAC = 0, + /** + * 1: HE-AAC. + */ + AUDIO_CODEC_PROFILE_HE_AAC = 1, + /** + * 2: HE-AAC v2. + */ + AUDIO_CODEC_PROFILE_HE_AAC_V2 = 2, +}; + +/** + * Local audio statistics. + */ +struct LocalAudioStats +{ + /** + * The number of audio channels. + */ + int numChannels; + /** + * The sampling rate (Hz) of sending the local user's audio stream. + */ + int sentSampleRate; + /** + * The average bitrate (Kbps) of sending the local user's audio stream. + */ + int sentBitrate; + /** + * The internal payload codec. + */ + int internalCodec; + /** + * The packet loss rate (%) from the local client to the Agora server before applying the anti-packet loss strategies. + */ + unsigned short txPacketLossRate; + /** + * The audio delay of the device, contains record and playout delay + */ + int audioDeviceDelay; + /** + * The playout delay of the device + */ + int audioPlayoutDelay; + /** + * The estimated delay of audio in-ear monitoring + */ + int earMonitorDelay; + /** + * The estimated signal delay (ms) from AEC nearin and farin + */ + int aecEstimatedDelay; + /** + * The AI-Voice-Activity-Detection result + */ + int aedVoiceRes; + /** + * The AI-Music-Detection result + */ + int aedMusicRes; +}; + + +/** + * States of the Media Push. + */ +enum RTMP_STREAM_PUBLISH_STATE { + /** + * 0: The Media Push has not started or has ended. This state is also triggered after you remove a RTMP or RTMPS stream from the CDN by calling `removePublishStreamUrl`. + */ + RTMP_STREAM_PUBLISH_STATE_IDLE = 0, + /** + * 1: The SDK is connecting to Agora's streaming server and the CDN server. This state is triggered after you call the `addPublishStreamUrl` method. + */ + RTMP_STREAM_PUBLISH_STATE_CONNECTING = 1, + /** + * 2: The RTMP or RTMPS streaming publishes. The SDK successfully publishes the RTMP or RTMPS streaming and returns this state. + */ + RTMP_STREAM_PUBLISH_STATE_RUNNING = 2, + /** + * 3: The RTMP or RTMPS streaming is recovering. When exceptions occur to the CDN, or the streaming is interrupted, the SDK tries to resume RTMP or RTMPS streaming and returns this state. + * - If the SDK successfully resumes the streaming, #RTMP_STREAM_PUBLISH_STATE_RUNNING (2) returns. + * - If the streaming does not resume within 60 seconds or server errors occur, #RTMP_STREAM_PUBLISH_STATE_FAILURE (4) returns. You can also reconnect to the server by calling the `removePublishStreamUrl` and `addPublishStreamUrl` methods. + */ + RTMP_STREAM_PUBLISH_STATE_RECOVERING = 3, + /** + * 4: The RTMP or RTMPS streaming fails. See the `errCode` parameter for the detailed error information. You can also call the `addPublishStreamUrl` method to publish the RTMP or RTMPS streaming again. + */ + RTMP_STREAM_PUBLISH_STATE_FAILURE = 4, + /** + * 5: The SDK is disconnecting to Agora's streaming server and the CDN server. This state is triggered after you call the `removePublishStreamUrl` method. + */ + RTMP_STREAM_PUBLISH_STATE_DISCONNECTING = 5, +}; + +/** + * Error codes of the RTMP or RTMPS streaming. + */ +enum RTMP_STREAM_PUBLISH_ERROR_TYPE { + /** + * 0: The RTMP or RTMPS streaming publishes successfully. + */ + RTMP_STREAM_PUBLISH_ERROR_OK = 0, + /** + * 1: Invalid argument used. If, for example, you do not call the `setLiveTranscoding` method to configure the LiveTranscoding parameters before calling the addPublishStreamUrl method, + * the SDK returns this error. Check whether you set the parameters in the `setLiveTranscoding` method properly. + */ + RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMENT = 1, + /** + * 2: The RTMP or RTMPS streaming is encrypted and cannot be published. + */ + RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED = 2, + /** + * 3: Timeout for the RTMP or RTMPS streaming. Call the `addPublishStreamUrl` method to publish the streaming again. + */ + RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT = 3, + /** + * 4: An error occurs in Agora's streaming server. Call the `addPublishStreamUrl` method to publish the streaming again. + */ + RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR = 4, + /** + * 5: An error occurs in the CDN server. + */ + RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR = 5, + /** + * 6: The RTMP or RTMPS streaming publishes too frequently. + */ + RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN = 6, + /** + * 7: The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones. + */ + RTMP_STREAM_PUBLISH_ERROR_REACH_LIMIT = 7, + /** + * 8: The host manipulates other hosts' URLs. Check your app logic. + */ + RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED = 8, + /** + * 9: Agora's server fails to find the RTMP or RTMPS streaming. + */ + RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND = 9, + /** + * 10: The format of the RTMP or RTMPS streaming URL is not supported. Check whether the URL format is correct. + */ + RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED = 10, + /** + * 11: The user role is not host, so the user cannot use the CDN live streaming function. Check your application code logic. + */ + RTMP_STREAM_PUBLISH_ERROR_NOT_BROADCASTER = 11, // Note: match to ERR_PUBLISH_STREAM_NOT_BROADCASTER in AgoraBase.h + /** + * 13: The `updateRtmpTranscoding` or `setLiveTranscoding` method is called to update the transcoding configuration in a scenario where there is streaming without transcoding. Check your application code logic. + */ + RTMP_STREAM_PUBLISH_ERROR_TRANSCODING_NO_MIX_STREAM = 13, // Note: match to ERR_PUBLISH_STREAM_TRANSCODING_NO_MIX_STREAM in AgoraBase.h + /** + * 14: Errors occurred in the host's network. + */ + RTMP_STREAM_PUBLISH_ERROR_NET_DOWN = 14, // Note: match to ERR_NET_DOWN in AgoraBase.h + /** + * 15: Your App ID does not have permission to use the CDN live streaming function. + */ + RTMP_STREAM_PUBLISH_ERROR_INVALID_APPID = 15, // Note: match to ERR_PUBLISH_STREAM_APPID_INVALID in AgoraBase.h + /** invalid privilege. */ + RTMP_STREAM_PUBLISH_ERROR_INVALID_PRIVILEGE = 16, + /** + * 100: The streaming has been stopped normally. After you call `removePublishStreamUrl` to stop streaming, the SDK returns this value. + */ + RTMP_STREAM_UNPUBLISH_ERROR_OK = 100, +}; + +/** Events during the RTMP or RTMPS streaming. */ +enum RTMP_STREAMING_EVENT { + /** + * 1: An error occurs when you add a background image or a watermark image to the RTMP or RTMPS stream. + */ + RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE = 1, + /** + * 2: The streaming URL is already being used for CDN live streaming. If you want to start new streaming, use a new streaming URL. + */ + RTMP_STREAMING_EVENT_URL_ALREADY_IN_USE = 2, + /** + * 3: The feature is not supported. + */ + RTMP_STREAMING_EVENT_ADVANCED_FEATURE_NOT_SUPPORT = 3, + /** + * 4: Client request too frequently. + */ + RTMP_STREAMING_EVENT_REQUEST_TOO_OFTEN = 4, +}; + +/** + * Image properties. + */ +typedef struct RtcImage { + /** + *The HTTP/HTTPS URL address of the image in the live video. The maximum length of this parameter is 1024 bytes. + */ + const char* url; + /** + * The x coordinate (pixel) of the image on the video frame (taking the upper left corner of the video frame as the origin). + */ + int x; + /** + * The y coordinate (pixel) of the image on the video frame (taking the upper left corner of the video frame as the origin). + */ + int y; + /** + * The width (pixel) of the image on the video frame. + */ + int width; + /** + * The height (pixel) of the image on the video frame. + */ + int height; + /** + * The layer index of the watermark or background image. When you use the watermark array to add + * a watermark or multiple watermarks, you must pass a value to `zOrder` in the range [1,255]; + * otherwise, the SDK reports an error. In other cases, zOrder can optionally be passed in the + * range [0,255], with 0 being the default value. 0 means the bottom layer and 255 means the top + * layer. + */ + int zOrder; + /** The transparency level of the image. The value ranges between 0.0 and 1.0: + * + * - 0.0: Completely transparent. + * - 1.0: (Default) Opaque. + */ + double alpha; + + RtcImage() : url(NULL), x(0), y(0), width(0), height(0), zOrder(0), alpha(1.0) {} +} RtcImage; +/** + * The configuration for advanced features of the RTMP or RTMPS streaming with transcoding. + * + * If you want to enable the advanced features of streaming with transcoding, contact support@agora.io. + */ +struct LiveStreamAdvancedFeature { + LiveStreamAdvancedFeature() : featureName(NULL), opened(false) {} + LiveStreamAdvancedFeature(const char* feat_name, bool open) : featureName(feat_name), opened(open) {} + /** The advanced feature for high-quality video with a lower bitrate. */ + // static const char* LBHQ = "lbhq"; + /** The advanced feature for the optimized video encoder. */ + // static const char* VEO = "veo"; + + /** + * The feature names, including LBHQ (high-quality video with a lower bitrate) and VEO (optimized video encoder). + */ + const char* featureName; + + /** + * Whether to enable the advanced features of streaming with transcoding: + * - `true`: Enable the advanced feature. + * - `false`: (Default) Disable the advanced feature. + */ + bool opened; +} ; + +/** + * Connection state types. + */ +enum CONNECTION_STATE_TYPE +{ + /** + * 1: The SDK is disconnected from the Agora edge server. The state indicates the SDK is in one of the following phases: + * - The initial state before calling the `joinChannel` method. + * - The app calls the `leaveChannel` method. + */ + CONNECTION_STATE_DISCONNECTED = 1, + /** + * 2: The SDK is connecting to the Agora edge server. This state indicates that the SDK is + * establishing a connection with the specified channel after the app calls `joinChannel`. + * - If the SDK successfully joins the channel, it triggers the `onConnectionStateChanged` + * callback and the connection state switches to `CONNECTION_STATE_CONNECTED`. + * - After the connection is established, the SDK also initializes the media and triggers + * `onJoinChannelSuccess` when everything is ready. + */ + CONNECTION_STATE_CONNECTING = 2, + /** + * 3: The SDK is connected to the Agora edge server. This state also indicates that the user + * has joined a channel and can now publish or subscribe to a media stream in the channel. + * If the connection to the Agora edge server is lost because, for example, the network is down + * or switched, the SDK automatically tries to reconnect and triggers `onConnectionStateChanged` + * that indicates the connection state switches to `CONNECTION_STATE_RECONNECTING`. + */ + CONNECTION_STATE_CONNECTED = 3, + /** + * 4: The SDK keeps reconnecting to the Agora edge server. The SDK keeps rejoining the channel + * after being disconnected from a joined channel because of network issues. + * - If the SDK cannot rejoin the channel within 10 seconds, it triggers `onConnectionLost`, + * stays in the `CONNECTION_STATE_RECONNECTING` state, and keeps rejoining the channel. + * - If the SDK fails to rejoin the channel 20 minutes after being disconnected from the Agora + * edge server, the SDK triggers the `onConnectionStateChanged` callback, switches to the + * `CONNECTION_STATE_FAILED` state, and stops rejoining the channel. + */ + CONNECTION_STATE_RECONNECTING = 4, + /** + * 5: The SDK fails to connect to the Agora edge server or join the channel. This state indicates + * that the SDK stops trying to rejoin the channel. You must call `leaveChannel` to leave the + * channel. + * - You can call `joinChannel` to rejoin the channel. + * - If the SDK is banned from joining the channel by the Agora edge server through the RESTful + * API, the SDK triggers the `onConnectionStateChanged` callback. + */ + CONNECTION_STATE_FAILED = 5, +}; + +/** + * Transcoding configurations of each host. + */ +struct TranscodingUser { + /** + * The user ID of the host. + */ + uid_t uid; + /** + * The x coordinate (pixel) of the host's video on the output video frame (taking the upper left corner of the video frame as the origin). The value range is [0, width], where width is the `width` set in `LiveTranscoding`. + */ + int x; + /** + * The y coordinate (pixel) of the host's video on the output video frame (taking the upper left corner of the video frame as the origin). The value range is [0, height], where height is the `height` set in `LiveTranscoding`. + */ + int y; + /** + * The width (pixel) of the host's video. + */ + int width; + /** + * The height (pixel) of the host's video. + */ + int height; + /** + * The layer index number of the host's video. The value range is [0, 100]. + * - 0: (Default) The host's video is the bottom layer. + * - 100: The host's video is the top layer. + * + * If the value is beyond this range, the SDK reports the error code `ERR_INVALID_ARGUMENT`. + */ + int zOrder; + /** + * The transparency of the host's video. The value range is [0.0, 1.0]. + * - 0.0: Completely transparent. + * - 1.0: (Default) Opaque. + */ + double alpha; + /** + * The audio channel used by the host's audio in the output audio. The default value is 0, and the value range is [0, 5]. + * - `0`: (Recommended) The defaut setting, which supports dual channels at most and depends on the upstream of the host. + * - `1`: The host's audio uses the FL audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `2`: The host's audio uses the FC audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `3`: The host's audio uses the FR audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `4`: The host's audio uses the BL audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `5`: The host's audio uses the BR audio channel. If the host's upstream uses multiple audio channels, the Agora server mixes them into mono first. + * - `0xFF` or a value greater than 5: The host's audio is muted, and the Agora server removes the host's audio. + * + * @note If the value is not `0`, a special player is required. + */ + int audioChannel; + TranscodingUser() + : uid(0), + x(0), + y(0), + width(0), + height(0), + zOrder(0), + alpha(1.0), + audioChannel(0) {} +}; + +/** + * Transcoding configurations for Media Push. + */ +struct LiveTranscoding { + /** The width of the video in pixels. The default value is 360. + * - When pushing video streams to the CDN, the value range of `width` is [64,1920]. + * If the value is less than 64, Agora server automatically adjusts it to 64; if the + * value is greater than 1920, Agora server automatically adjusts it to 1920. + * - When pushing audio streams to the CDN, set `width` and `height` as 0. + */ + int width; + /** The height of the video in pixels. The default value is 640. + * - When pushing video streams to the CDN, the value range of `height` is [64,1080]. + * If the value is less than 64, Agora server automatically adjusts it to 64; if the + * value is greater than 1080, Agora server automatically adjusts it to 1080. + * - When pushing audio streams to the CDN, set `width` and `height` as 0. + */ + int height; + /** Bitrate of the CDN live output video stream. The default value is 400 Kbps. + + Set this parameter according to the Video Bitrate Table. If you set a bitrate beyond the proper range, the SDK automatically adapts it to a value within the range. + */ + int videoBitrate; + /** Frame rate of the output video stream set for the CDN live streaming. The default value is 15 fps, and the value range is (0,30]. + + @note The Agora server adjusts any value over 30 to 30. + */ + int videoFramerate; + + /** **DEPRECATED** Latency mode: + + - true: Low latency with unassured quality. + - false: (Default) High latency with assured quality. + */ + bool lowLatency; + + /** Video GOP in frames. The default value is 30 fps. + */ + int videoGop; + /** Self-defined video codec profile: #VIDEO_CODEC_PROFILE_TYPE. + + @note If you set this parameter to other values, Agora adjusts it to the default value of 100. + */ + VIDEO_CODEC_PROFILE_TYPE videoCodecProfile; + /** The background color in RGB hex value. Value only. Do not include a preceeding #. For example, 0xFFB6C1 (light pink). The default value is 0x000000 (black). + */ + unsigned int backgroundColor; + /** Video codec profile types for Media Push. See VIDEO_CODEC_TYPE_FOR_STREAM. */ + VIDEO_CODEC_TYPE_FOR_STREAM videoCodecType; + /** The number of users in the live interactive streaming. + * The value range is [0, 17]. + */ + unsigned int userCount; + /** Manages the user layout configuration in the Media Push. Agora supports a maximum of 17 transcoding users in a Media Push channel. See `TranscodingUser`. + */ + TranscodingUser* transcodingUsers; + /** Reserved property. Extra user-defined information to send SEI for the H.264/H.265 video stream to the CDN live client. Maximum length: 4096 Bytes. + + For more information on SEI frame, see [SEI-related questions](https://docs.agora.io/en/faq/sei). + */ + const char* transcodingExtraInfo; + + /** **DEPRECATED** The metadata sent to the CDN live client. + */ + const char* metadata; + /** The watermark on the live video. The image format needs to be PNG. See `RtcImage`. + + You can add one watermark, or add multiple watermarks using an array. This parameter is used with `watermarkCount`. + */ + RtcImage* watermark; + /** + * The number of watermarks on the live video. The total number of watermarks and background images can range from 0 to 10. This parameter is used with `watermark`. + */ + unsigned int watermarkCount; + + /** The number of background images on the live video. The image format needs to be PNG. See `RtcImage`. + * + * You can add a background image or use an array to add multiple background images. This parameter is used with `backgroundImageCount`. + */ + RtcImage* backgroundImage; + /** + * The number of background images on the live video. The total number of watermarks and background images can range from 0 to 10. This parameter is used with `backgroundImage`. + */ + unsigned int backgroundImageCount; + + /** The audio sampling rate (Hz) of the output media stream. See #AUDIO_SAMPLE_RATE_TYPE. + */ + AUDIO_SAMPLE_RATE_TYPE audioSampleRate; + /** Bitrate (Kbps) of the audio output stream for Media Push. The default value is 48, and the highest value is 128. + */ + int audioBitrate; + /** The number of audio channels for Media Push. Agora recommends choosing 1 (mono), or 2 (stereo) audio channels. Special players are required if you choose 3, 4, or 5. + * - 1: (Default) Mono. + * - 2: Stereo. + * - 3: Three audio channels. + * - 4: Four audio channels. + * - 5: Five audio channels. + */ + int audioChannels; + /** Audio codec profile type for Media Push. See #AUDIO_CODEC_PROFILE_TYPE. + */ + AUDIO_CODEC_PROFILE_TYPE audioCodecProfile; + /** Advanced features of the RTMP or RTMPS streaming with transcoding. See LiveStreamAdvancedFeature. + */ + LiveStreamAdvancedFeature* advancedFeatures; + + /** The number of enabled advanced features. The default value is 0. */ + unsigned int advancedFeatureCount; + LiveTranscoding() : width(360), height(640), videoBitrate(400), videoFramerate(15), lowLatency(false), videoGop(30), videoCodecProfile(VIDEO_CODEC_PROFILE_HIGH), backgroundColor(0x000000), videoCodecType(VIDEO_CODEC_H264_FOR_STREAM), userCount(0), transcodingUsers(NULL), transcodingExtraInfo(NULL), metadata(NULL), watermark(NULL), watermarkCount(0), backgroundImage(NULL), backgroundImageCount(0), audioSampleRate(AUDIO_SAMPLE_RATE_48000), audioBitrate(48), audioChannels(1), audioCodecProfile(AUDIO_CODEC_PROFILE_LC_AAC), advancedFeatures(NULL), advancedFeatureCount(0) {} +}; + +/** + * The video streams for the video mixing on the local client. + */ +struct TranscodingVideoStream { + /** + * The source type of video for the video mixing on the local client. See #VIDEO_SOURCE_TYPE. + */ + VIDEO_SOURCE_TYPE sourceType; + /** + * The ID of the remote user. + * @note Use this parameter only when the source type of the video for the video mixing on the local client is `VIDEO_SOURCE_REMOTE`. + */ + uid_t remoteUserUid; + /** + * The URL of the image. + * @note Use this parameter only when the source type of the video for the video mixing on the local client is `RTC_IMAGE`. + */ + const char* imageUrl; + /** + * MediaPlayer id if sourceType is MEDIA_PLAYER_SOURCE. + */ + int mediaPlayerId; + /** + * The horizontal displacement of the top-left corner of the video for the video mixing on the client relative to the top-left corner (origin) of the canvas for this video mixing. + */ + int x; + /** + * The vertical displacement of the top-left corner of the video for the video mixing on the client relative to the top-left corner (origin) of the canvas for this video mixing. + */ + int y; + /** + * The width (px) of the video for the video mixing on the local client. + */ + int width; + /** + * The height (px) of the video for the video mixing on the local client. + */ + int height; + /** + * The number of the layer to which the video for the video mixing on the local client belongs. The value range is [0,100]. + * - 0: (Default) The layer is at the bottom. + * - 100: The layer is at the top. + */ + int zOrder; + /** + * The transparency of the video for the video mixing on the local client. The value range is [0.0,1.0]. 0.0 means the transparency is completely transparent. 1.0 means the transparency is opaque. + */ + double alpha; + /** + * Whether to mirror the video for the video mixing on the local client. + * - true: Mirroring. + * - false: (Default) Do not mirror. + * @note The paramter only works for videos with the source type `CAMERA`. + */ + bool mirror; + + TranscodingVideoStream() + : sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), + remoteUserUid(0), + imageUrl(NULL), + mediaPlayerId(0), + x(0), + y(0), + width(0), + height(0), + zOrder(0), + alpha(1.0), + mirror(false) {} +}; + + +/** + * The configuration of the video mixing on the local client. + */ +struct LocalTranscoderConfiguration { + /** + * The number of the video streams for the video mixing on the local client. + */ + unsigned int streamCount; + /** + * The video streams for the video mixing on the local client. See TranscodingVideoStream. + */ + TranscodingVideoStream* videoInputStreams; + /** + * The encoding configuration of the mixed video stream after the video mixing on the local client. See VideoEncoderConfiguration. + */ + VideoEncoderConfiguration videoOutputConfiguration; + /** + * Whether to use the timestamp when the primary camera captures the video frame as the timestamp of the mixed video frame. + * - true: (Default) Use the timestamp of the captured video frame as the timestamp of the mixed video frame. + * - false: Do not use the timestamp of the captured video frame as the timestamp of the mixed video frame. Instead, use the timestamp when the mixed video frame is constructed. + */ + bool syncWithPrimaryCamera; + + LocalTranscoderConfiguration() + : streamCount(0), + videoInputStreams(NULL), + videoOutputConfiguration(), + syncWithPrimaryCamera(true) {} +}; + +enum VIDEO_TRANSCODER_ERROR { + /** + * No error + */ + VT_ERR_OK = 0, + /** + * The video track of the video source is not started. + */ + VT_ERR_VIDEO_SOURCE_NOT_READY = 1, + /** + * The video source type is not supported. + */ + VT_ERR_INVALID_VIDEO_SOURCE_TYPE = 2, + /** + * The image url is not correctly of image source. + */ + VT_ERR_INVALID_IMAGE_PATH = 3, + /** + * The image format not the type png/jpeg/gif of image source. + */ + VT_ERR_UNSUPPORT_IMAGE_FORMAT = 4, + /** + * The layout is invalid such as width is zero. + */ + VT_ERR_INVALID_LAYOUT = 5, + /** + * Internal error. + */ + VT_ERR_INTERNAL = 20 +}; + +/** + * Configurations of the last-mile network test. + */ +struct LastmileProbeConfig { + /** + * Determines whether to test the uplink network. Some users, for example, + * the audience in a live broadcast channel, do not need such a test: + * - true: Test. + * - false: Do not test. + */ + bool probeUplink; + /** + * Determines whether to test the downlink network: + * - true: Test. + * - false: Do not test. + */ + bool probeDownlink; + /** + * The expected maximum sending bitrate (bps) of the local user. The value range is [100000, 5000000]. We recommend setting this parameter + * according to the bitrate value set by `setVideoEncoderConfiguration`. + */ + unsigned int expectedUplinkBitrate; + /** + * The expected maximum receiving bitrate (bps) of the local user. The value range is [100000,5000000]. + */ + unsigned int expectedDownlinkBitrate; +}; + +/** + * The status of the last-mile network tests. + */ +enum LASTMILE_PROBE_RESULT_STATE { + /** + * 1: The last-mile network probe test is complete. + */ + LASTMILE_PROBE_RESULT_COMPLETE = 1, + /** + * 2: The last-mile network probe test is incomplete because the bandwidth estimation is not available due to limited test resources. + */ + LASTMILE_PROBE_RESULT_INCOMPLETE_NO_BWE = 2, + /** + * 3: The last-mile network probe test is not carried out, probably due to poor network conditions. + */ + LASTMILE_PROBE_RESULT_UNAVAILABLE = 3 +}; + +/** + * Results of the uplink or downlink last-mile network test. + */ +struct LastmileProbeOneWayResult { + /** + * The packet loss rate (%). + */ + unsigned int packetLossRate; + /** + * The network jitter (ms). + */ + unsigned int jitter; + /** + * The estimated available bandwidth (bps). + */ + unsigned int availableBandwidth; + + LastmileProbeOneWayResult() : packetLossRate(0), + jitter(0), + availableBandwidth(0) {} +}; + +/** + * Results of the uplink and downlink last-mile network tests. + */ +struct LastmileProbeResult { + /** + * The status of the last-mile network tests. See #LASTMILE_PROBE_RESULT_STATE. + */ + LASTMILE_PROBE_RESULT_STATE state; + /** + * Results of the uplink last-mile network test. For details, see LastmileProbeOneWayResult. + */ + LastmileProbeOneWayResult uplinkReport; + /** + * Results of the downlink last-mile network test. For details, see LastmileProbeOneWayResult. + */ + LastmileProbeOneWayResult downlinkReport; + /** + * The round-trip time (ms). + */ + unsigned int rtt; + + LastmileProbeResult() + : state(LASTMILE_PROBE_RESULT_UNAVAILABLE), + rtt(0) {} +}; + +/** + * Reasons causing the change of the connection state. + */ +enum CONNECTION_CHANGED_REASON_TYPE +{ + /** + * 0: The SDK is connecting to the server. + */ + CONNECTION_CHANGED_CONNECTING = 0, + /** + * 1: The SDK has joined the channel successfully. + */ + CONNECTION_CHANGED_JOIN_SUCCESS = 1, + /** + * 2: The connection between the SDK and the server is interrupted. + */ + CONNECTION_CHANGED_INTERRUPTED = 2, + /** + * 3: The connection between the SDK and the server is banned by the server. This error occurs when the user is kicked out of the channel by the server. + */ + CONNECTION_CHANGED_BANNED_BY_SERVER = 3, + /** + * 4: The SDK fails to join the channel. When the SDK fails to join the channel for more than 20 minutes, this error occurs and the SDK stops reconnecting to the channel. + */ + CONNECTION_CHANGED_JOIN_FAILED = 4, + /** + * 5: The SDK has left the channel. + */ + CONNECTION_CHANGED_LEAVE_CHANNEL = 5, + /** + * 6: The connection fails because the App ID is not valid. + */ + CONNECTION_CHANGED_INVALID_APP_ID = 6, + /** + * 7: The connection fails because the channel name is not valid. Please rejoin the channel with a valid channel name. + */ + CONNECTION_CHANGED_INVALID_CHANNEL_NAME = 7, + /** + * 8: The connection fails because the token is not valid. Typical reasons include: + * - The App Certificate for the project is enabled in Agora Console, but you do not use a token when joining the channel. If you enable the App Certificate, you must use a token to join the channel. + * - The `uid` specified when calling `joinChannel` to join the channel is inconsistent with the `uid` passed in when generating the token. + */ + CONNECTION_CHANGED_INVALID_TOKEN = 8, + /** + * 9: The connection fails because the token has expired. + */ + CONNECTION_CHANGED_TOKEN_EXPIRED = 9, + /** + * 10: The connection is rejected by the server. Typical reasons include: + * - The user is already in the channel and still calls a method, for example, `joinChannel`, to join the channel. Stop calling this method to clear this error. + * - The user tries to join the channel when conducting a pre-call test. The user needs to call the channel after the call test ends. + */ + CONNECTION_CHANGED_REJECTED_BY_SERVER = 10, + /** + * 11: The connection changes to reconnecting because the SDK has set a proxy server. + */ + CONNECTION_CHANGED_SETTING_PROXY_SERVER = 11, + /** + * 12: The connection state changed because the token is renewed. + */ + CONNECTION_CHANGED_RENEW_TOKEN = 12, + /** + * 13: The IP address of the client has changed, possibly because the network type, IP address, or port has been changed. + */ + CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED = 13, + /** + * 14: Timeout for the keep-alive of the connection between the SDK and the Agora edge server. The connection state changes to CONNECTION_STATE_RECONNECTING. + */ + CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT = 14, + /** + * 15: The SDK has rejoined the channel successfully. + */ + CONNECTION_CHANGED_REJOIN_SUCCESS = 15, + /** + * 16: The connection between the SDK and the server is lost. + */ + CONNECTION_CHANGED_LOST = 16, + /** + * 17: The change of connection state is caused by echo test. + */ + CONNECTION_CHANGED_ECHO_TEST = 17, + /** + * 18: The local IP Address is changed by user. + */ + CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED_BY_USER = 18, + /** + * 19: The connection is failed due to join the same channel on another device with the same uid. + */ + CONNECTION_CHANGED_SAME_UID_LOGIN = 19, + /** + * 20: The connection is failed due to too many broadcasters in the channel. + */ + CONNECTION_CHANGED_TOO_MANY_BROADCASTERS = 20, + + /** + * 21: The connection is failed due to license validation failure. + */ + CONNECTION_CHANGED_LICENSE_VALIDATION_FAILURE = 21, + /** + * 22: The connection is failed due to certification verify failure. + */ + CONNECTION_CHANGED_CERTIFICATION_VERYFY_FAILURE = 22, +}; + +/** + * The reason of changing role's failure. + */ +enum CLIENT_ROLE_CHANGE_FAILED_REASON { + /** + * 1: Too many broadcasters in the channel. + */ + CLIENT_ROLE_CHANGE_FAILED_TOO_MANY_BROADCASTERS = 1, + /** + * 2: The operation of changing role is not authorized. + */ + CLIENT_ROLE_CHANGE_FAILED_NOT_AUTHORIZED = 2, + /** + * 3: The operation of changing role is timeout. + */ + CLIENT_ROLE_CHANGE_FAILED_REQUEST_TIME_OUT = 3, + /** + * 4: The operation of changing role is interrupted since we lost connection with agora service. + */ + CLIENT_ROLE_CHANGE_FAILED_CONNECTION_FAILED = 4, +}; + +/** + * The reason of notifying the user of a message. + */ +enum WLACC_MESSAGE_REASON { + /** + * WIFI signal is weak. + */ + WLACC_MESSAGE_REASON_WEAK_SIGNAL = 0, + /** + * Channel congestion. + */ + WLACC_MESSAGE_REASON_CHANNEL_CONGESTION = 1, +}; + +/** + * Suggest an action for the user. + */ +enum WLACC_SUGGEST_ACTION { + /** + * Please get close to AP. + */ + WLACC_SUGGEST_ACTION_CLOSE_TO_WIFI = 0, + /** + * The user is advised to connect to the prompted SSID. + */ + WLACC_SUGGEST_ACTION_CONNECT_SSID = 1, + /** + * The user is advised to check whether the AP supports 5G band and enable 5G band (the aciton link is attached), or purchases an AP that supports 5G. AP does not support 5G band. + */ + WLACC_SUGGEST_ACTION_CHECK_5G = 2, + /** + * The user is advised to change the SSID of the 2.4G or 5G band (the aciton link is attached). The SSID of the 2.4G band AP is the same as that of the 5G band. + */ + WLACC_SUGGEST_ACTION_MODIFY_SSID = 3, +}; + +/** + * Indicator optimization degree. + */ +struct WlAccStats { + /** + * End-to-end delay optimization percentage. + */ + unsigned short e2eDelayPercent; + /** + * Frozen Ratio optimization percentage. + */ + unsigned short frozenRatioPercent; + /** + * Loss Rate optimization percentage. + */ + unsigned short lossRatePercent; +}; + +/** + * The network type. + */ +enum NETWORK_TYPE { + /** + * -1: The network type is unknown. + */ + NETWORK_TYPE_UNKNOWN = -1, + /** + * 0: The SDK disconnects from the network. + */ + NETWORK_TYPE_DISCONNECTED = 0, + /** + * 1: The network type is LAN. + */ + NETWORK_TYPE_LAN = 1, + /** + * 2: The network type is Wi-Fi (including hotspots). + */ + NETWORK_TYPE_WIFI = 2, + /** + * 3: The network type is mobile 2G. + */ + NETWORK_TYPE_MOBILE_2G = 3, + /** + * 4: The network type is mobile 3G. + */ + NETWORK_TYPE_MOBILE_3G = 4, + /** + * 5: The network type is mobile 4G. + */ + NETWORK_TYPE_MOBILE_4G = 5, + /** + * 6: The network type is mobile 5G. + */ + NETWORK_TYPE_MOBILE_5G = 6, +}; + +/** + * The mode of setting up video views. + */ +enum VIDEO_VIEW_SETUP_MODE { + /** + * 0: replace one view + */ + VIDEO_VIEW_SETUP_REPLACE = 0, + /** + * 1: add one view + */ + VIDEO_VIEW_SETUP_ADD = 1, + /** + * 2: remove one view + */ + VIDEO_VIEW_SETUP_REMOVE = 2, +}; + +/** + * Attributes of video canvas object. + */ +struct VideoCanvas { + /** + * Video display window. + */ + view_t view; + /** + * The user id of local video. + */ + uid_t uid; + + uid_t subviewUid; + /** + * The video render mode. See \ref agora::media::base::RENDER_MODE_TYPE "RENDER_MODE_TYPE". + * The default value is RENDER_MODE_HIDDEN. + */ + media::base::RENDER_MODE_TYPE renderMode; + /** + * The video mirror mode. See \ref VIDEO_MIRROR_MODE_TYPE "VIDEO_MIRROR_MODE_TYPE". + * The default value is VIDEO_MIRROR_MODE_AUTO. + * @note + * - For the mirror mode of the local video view: + * If you use a front camera, the SDK enables the mirror mode by default; + * if you use a rear camera, the SDK disables the mirror mode by default. + * - For the remote user: The mirror mode is disabled by default. + */ + VIDEO_MIRROR_MODE_TYPE mirrorMode; + /** + * The mode of setting up video view. See \ref VIDEO_VIEW_SETUP_MODE "VIDEO_VIEW_SETUP_MODE" + * The default value is VIDEO_VIEW_SETUP_REPLACE. + */ + VIDEO_VIEW_SETUP_MODE setupMode; + /** + * The video source type. See \ref VIDEO_SOURCE_TYPE "VIDEO_SOURCE_TYPE". + * The default value is VIDEO_SOURCE_CAMERA_PRIMARY. + */ + VIDEO_SOURCE_TYPE sourceType; + /** + * The media player id of AgoraMediaPlayer. It should set this parameter when the + * sourceType is VIDEO_SOURCE_MEDIA_PLAYER to show the video that AgoraMediaPlayer is playing. + * You can get this value by calling the method \ref getMediaPlayerId(). + */ + int mediaPlayerId; + /** + * If you want to display a certain part of a video frame, you can set + * this value to crop the video frame to show. + * The default value is empty(that is, if it has zero width or height), which means no cropping. + */ + Rectangle cropArea; + + /** + * default false. if set to true, the video will apply alpha mask if exist.(Mac only) + */ + bool enableAlphaMask; + + VideoCanvas() + : view(NULL), uid(0),subviewUid(0),renderMode(media::base::RENDER_MODE_HIDDEN), mirrorMode(VIDEO_MIRROR_MODE_AUTO), + setupMode(VIDEO_VIEW_SETUP_REPLACE), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false) {} + + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, uid_t u) + : view(v), uid(u),subviewUid(0), renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), + sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false) {} + + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, uid_t u,uid_t subu) + : view(v), uid(u),subviewUid(subu), renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), + sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false) {} + + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, user_id_t) + : view(v), uid(0),subviewUid(0),renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), + sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false) {} +}; + +/** Image enhancement options. + */ +struct BeautyOptions { + /** The contrast level. + */ + enum LIGHTENING_CONTRAST_LEVEL { + /** Low contrast level. */ + LIGHTENING_CONTRAST_LOW = 0, + /** (Default) Normal contrast level. */ + LIGHTENING_CONTRAST_NORMAL = 1, + /** High contrast level. */ + LIGHTENING_CONTRAST_HIGH = 2, + }; + + /** The contrast level, used with the `lighteningLevel` parameter. The larger the value, the greater the contrast between light and dark. See #LIGHTENING_CONTRAST_LEVEL. + */ + LIGHTENING_CONTRAST_LEVEL lighteningContrastLevel; + + /** The brightness level. The value ranges from 0.0 (original) to 1.0. The default value is 0.0. The greater the value, the greater the degree of whitening. */ + float lighteningLevel; + + /** The value ranges from 0.0 (original) to 1.0. The default value is 0.0. The greater the value, the greater the degree of skin grinding. + */ + float smoothnessLevel; + + /** The redness level. The value ranges from 0.0 (original) to 1.0. The default value is 0.0. The larger the value, the greater the rosy degree. + */ + float rednessLevel; + + /** The sharpness level. The value ranges from 0.0 (original) to 1.0. The default value is 0.0. The larger the value, the greater the sharpening degree. + */ + float sharpnessLevel; + + BeautyOptions(LIGHTENING_CONTRAST_LEVEL contrastLevel, float lightening, float smoothness, float redness, float sharpness) : lighteningContrastLevel(contrastLevel), lighteningLevel(lightening), smoothnessLevel(smoothness), rednessLevel(redness), sharpnessLevel(sharpness) {} + + BeautyOptions() : lighteningContrastLevel(LIGHTENING_CONTRAST_NORMAL), lighteningLevel(0), smoothnessLevel(0), rednessLevel(0), sharpnessLevel(0) {} +}; + +struct LowlightEnhanceOptions { + /** + * The low-light enhancement mode. + */ + enum LOW_LIGHT_ENHANCE_MODE { + /** 0: (Default) Automatic mode. The SDK automatically enables or disables the low-light enhancement feature according to the ambient light to compensate for the lighting level or prevent overexposure, as necessary. */ + LOW_LIGHT_ENHANCE_AUTO = 0, + /** Manual mode. Users need to enable or disable the low-light enhancement feature manually. */ + LOW_LIGHT_ENHANCE_MANUAL = 1, + }; + /** + * The low-light enhancement level. + */ + enum LOW_LIGHT_ENHANCE_LEVEL { + /** + * 0: (Default) Promotes video quality during low-light enhancement. It processes the brightness, details, and noise of the video image. The performance consumption is moderate, the processing speed is moderate, and the overall video quality is optimal. + */ + LOW_LIGHT_ENHANCE_LEVEL_HIGH_QUALITY = 0, + /** + * Promotes performance during low-light enhancement. It processes the brightness and details of the video image. The processing speed is faster. + */ + LOW_LIGHT_ENHANCE_LEVEL_FAST = 1, + }; + + /** The low-light enhancement mode. See #LOW_LIGHT_ENHANCE_MODE. + */ + LOW_LIGHT_ENHANCE_MODE mode; + + /** The low-light enhancement level. See #LOW_LIGHT_ENHANCE_LEVEL. + */ + LOW_LIGHT_ENHANCE_LEVEL level; + + LowlightEnhanceOptions(LOW_LIGHT_ENHANCE_MODE lowlightMode, LOW_LIGHT_ENHANCE_LEVEL lowlightLevel) : mode(lowlightMode), level(lowlightLevel) {} + + LowlightEnhanceOptions() : mode(LOW_LIGHT_ENHANCE_AUTO), level(LOW_LIGHT_ENHANCE_LEVEL_HIGH_QUALITY) {} +}; +/** + * The video noise reduction options. + * + * @since v4.0.0 + */ +struct VideoDenoiserOptions { + /** The video noise reduction mode. + */ + enum VIDEO_DENOISER_MODE { + /** 0: (Default) Automatic mode. The SDK automatically enables or disables the video noise reduction feature according to the ambient light. */ + VIDEO_DENOISER_AUTO = 0, + /** Manual mode. Users need to enable or disable the video noise reduction feature manually. */ + VIDEO_DENOISER_MANUAL = 1, + }; + /** + * The video noise reduction level. + */ + enum VIDEO_DENOISER_LEVEL { + /** + * 0: (Default) Promotes video quality during video noise reduction. `HIGH_QUALITY` balances performance consumption and video noise reduction quality. + * The performance consumption is moderate, the video noise reduction speed is moderate, and the overall video quality is optimal. + */ + VIDEO_DENOISER_LEVEL_HIGH_QUALITY = 0, + /** + * Promotes reducing performance consumption during video noise reduction. `FAST` prioritizes reducing performance consumption over video noise reduction quality. + * The performance consumption is lower, and the video noise reduction speed is faster. To avoid a noticeable shadowing effect (shadows trailing behind moving objects) in the processed video, Agora recommends that you use `FAST` when the camera is fixed. + */ + VIDEO_DENOISER_LEVEL_FAST = 1, + /** + * Enhanced video noise reduction. `STRENGTH` prioritizes video noise reduction quality over reducing performance consumption. + * The performance consumption is higher, the video noise reduction speed is slower, and the video noise reduction quality is better. + * If `HIGH_QUALITY` is not enough for your video noise reduction needs, you can use `STRENGTH`. + */ + VIDEO_DENOISER_LEVEL_STRENGTH = 2, + }; + /** The video noise reduction mode. See #VIDEO_DENOISER_MODE. + */ + VIDEO_DENOISER_MODE mode; + + /** The video noise reduction level. See #VIDEO_DENOISER_LEVEL. + */ + VIDEO_DENOISER_LEVEL level; + + VideoDenoiserOptions(VIDEO_DENOISER_MODE denoiserMode, VIDEO_DENOISER_LEVEL denoiserLevel) : mode(denoiserMode), level(denoiserLevel) {} + + VideoDenoiserOptions() : mode(VIDEO_DENOISER_AUTO), level(VIDEO_DENOISER_LEVEL_HIGH_QUALITY) {} +}; + +/** The color enhancement options. + * + * @since v4.0.0 + */ +struct ColorEnhanceOptions { + /** The level of color enhancement. The value range is [0.0,1.0]. `0.0` is the default value, which means no color enhancement is applied to the video. The higher the value, the higher the level of color enhancement. + */ + float strengthLevel; + + /** The level of skin tone protection. The value range is [0.0,1.0]. `0.0` means no skin tone protection. The higher the value, the higher the level of skin tone protection. + * The default value is `1.0`. When the level of color enhancement is higher, the portrait skin tone can be significantly distorted, so you need to set the level of skin tone protection; when the level of skin tone protection is higher, the color enhancement effect can be slightly reduced. + * Therefore, to get the best color enhancement effect, Agora recommends that you adjust `strengthLevel` and `skinProtectLevel` to get the most appropriate values. + */ + float skinProtectLevel; + + ColorEnhanceOptions(float stength, float skinProtect) : strengthLevel(stength), skinProtectLevel(skinProtect) {} + + ColorEnhanceOptions() : strengthLevel(0), skinProtectLevel(1) {} +}; + +/** + * The custom background image. + */ +struct VirtualBackgroundSource { + /** The type of the custom background image. + */ + enum BACKGROUND_SOURCE_TYPE { + /** + * 1: (Default) The background image is a solid color. + */ + BACKGROUND_COLOR = 1, + /** + * The background image is a file in PNG or JPG format. + */ + BACKGROUND_IMG = 2, + /** The background image is the blurred background. */ + BACKGROUND_BLUR = 3, + }; + + /** The degree of blurring applied to the custom background image.. + */ + enum BACKGROUND_BLUR_DEGREE { + /** 1: The degree of blurring applied to the custom background image is low. The user can almost see the background clearly. */ + BLUR_DEGREE_LOW = 1, + /** 2: The degree of blurring applied to the custom background image is medium. It is difficult for the user to recognize details in the background. */ + BLUR_DEGREE_MEDIUM = 2, + /** 3: (Default) The degree of blurring applied to the custom background image is high. The user can barely see any distinguishing features in the background. */ + BLUR_DEGREE_HIGH = 3, + }; + + /** The type of the custom background image. See #BACKGROUND_SOURCE_TYPE. + */ + BACKGROUND_SOURCE_TYPE background_source_type; + + /** + * The color of the custom background image. The format is a hexadecimal integer defined by RGB, without the # sign, + * such as 0xFFB6C1 for light pink. The default value is 0xFFFFFF, which signifies white. The value range + * is [0x000000,0xFFFFFF]. If the value is invalid, the SDK replaces the original background image with a white + * background image. + * + * @note This parameter takes effect only when the type of the custom background image is `BACKGROUND_COLOR`. + */ + unsigned int color; + + /** + * The local absolute path of the custom background image. PNG and JPG formats are supported. If the path is invalid, + * the SDK replaces the original background image with a white background image. + * + * @note This parameter takes effect only when the type of the custom background image is `BACKGROUND_IMG`. + */ + const char* source; + + /** The degree of blurring applied to the custom background image. See BACKGROUND_BLUR_DEGREE. + * @note This parameter takes effect only when the type of the custom background image is `BACKGROUND_BLUR`. + */ + BACKGROUND_BLUR_DEGREE blur_degree; + + VirtualBackgroundSource() : background_source_type(BACKGROUND_COLOR), color(0xffffff), source(NULL), blur_degree(BLUR_DEGREE_HIGH) {} +}; + +struct SegmentationProperty { + + enum SEG_MODEL_TYPE { + + SEG_MODEL_AI = 1, + SEG_MODEL_GREEN = 2 + }; + + SEG_MODEL_TYPE modelType; + + float greenCapacity; + + + SegmentationProperty() : modelType(SEG_MODEL_AI), greenCapacity(0.5){} +}; + +/** The type of custom audio track +*/ +enum AUDIO_TRACK_TYPE { + /** + * -1: Invalid audio track + */ + AUDIO_TRACK_INVALID = -1, + /** + * 0: Mixable audio track + * You can push more than one mixable Audio tracks into one RTC connection(channel id + uid), + * and SDK will mix these tracks into one audio track automatically. + * However, compare to direct audio track, mixable track might cause extra 30ms+ delay. + */ + AUDIO_TRACK_MIXABLE = 0, + /** + * 1: Direct audio track + * You can only push one direct (non-mixable) audio track into one RTC connection(channel id + uid). + * Compare to mixable stream, you can have lower lantency using direct audio track. + */ + AUDIO_TRACK_DIRECT = 1, +}; + +/** The configuration of custom audio track +*/ +struct AudioTrackConfig { + /** + * Enable local playback, enabled by default + * true: (Default) Enable local playback + * false: Do not enable local playback + */ + bool enableLocalPlayback; + + AudioTrackConfig() + : enableLocalPlayback(true) {} +}; + +/** + * Preset local voice reverberation options. + * bitmap allocation: + * | bit31 | bit30 - bit24 | bit23 - bit16 | bit15 - bit8 | bit7 - bit0 | + * |---------|--------------------|-----------------------------|--------------|----------------| + * |reserved | 0x1: voice beauty | 0x1: chat beautification | effect types | effect settings| + * | | | 0x2: singing beautification | | | + * | | | 0x3: timbre transform | | | + * | | | 0x4: ultra high_quality | | | + * | |--------------------|-----------------------------| | | + * | | 0x2: audio effect | 0x1: space construction | | | + * | | | 0x2: voice changer effect | | | + * | | | 0x3: style transform | | | + * | | | 0x4: electronic sound | | | + * | | | 0x5: magic tone | | | + * | |--------------------|-----------------------------| | | + * | | 0x3: voice changer | 0x1: voice transform | | | + */ +/** The options for SDK preset voice beautifier effects. + */ +enum VOICE_BEAUTIFIER_PRESET { + /** Turn off voice beautifier effects and use the original voice. + */ + VOICE_BEAUTIFIER_OFF = 0x00000000, + /** A more magnetic voice. + * + * @note Agora recommends using this enumerator to process a male-sounding voice; otherwise, you + * may experience vocal distortion. + */ + CHAT_BEAUTIFIER_MAGNETIC = 0x01010100, + /** A fresher voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you + * may experience vocal distortion. + */ + CHAT_BEAUTIFIER_FRESH = 0x01010200, + /** A more vital voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you + * may experience vocal distortion. + */ + CHAT_BEAUTIFIER_VITALITY = 0x01010300, + /** + * Singing beautifier effect. + * - If you call `setVoiceBeautifierPreset`(SINGING_BEAUTIFIER), you can beautify a male-sounding voice and add a reverberation effect + * that sounds like singing in a small room. Agora recommends not using `setVoiceBeautifierPreset`(SINGING_BEAUTIFIER) to process + * a female-sounding voice; otherwise, you may experience vocal distortion. + * - If you call `setVoiceBeautifierParameters`(SINGING_BEAUTIFIER, param1, param2), you can beautify a male- or + * female-sounding voice and add a reverberation effect. + */ + SINGING_BEAUTIFIER = 0x01020100, + /** A more vigorous voice. + */ + TIMBRE_TRANSFORMATION_VIGOROUS = 0x01030100, + /** A deeper voice. + */ + TIMBRE_TRANSFORMATION_DEEP = 0x01030200, + /** A mellower voice. + */ + TIMBRE_TRANSFORMATION_MELLOW = 0x01030300, + /** A falsetto voice. + */ + TIMBRE_TRANSFORMATION_FALSETTO = 0x01030400, + /** A fuller voice. + */ + TIMBRE_TRANSFORMATION_FULL = 0x01030500, + /** A clearer voice. + */ + TIMBRE_TRANSFORMATION_CLEAR = 0x01030600, + /** A more resounding voice. + */ + TIMBRE_TRANSFORMATION_RESOUNDING = 0x01030700, + /** A more ringing voice. + */ + TIMBRE_TRANSFORMATION_RINGING = 0x01030800, + /** + * A ultra-high quality voice, which makes the audio clearer and restores more details. + * - To achieve better audio effect quality, Agora recommends that you call `setAudioProfile` + * and set the `profile` to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` + * and `scenario` to `AUDIO_SCENARIO_HIGH_DEFINITION(6)` before calling `setVoiceBeautifierPreset`. + * - If you have an audio capturing device that can already restore audio details to a high + * degree, Agora recommends that you do not enable ultra-high quality; otherwise, the SDK may + * over-restore audio details, and you may not hear the anticipated voice effect. + */ + ULTRA_HIGH_QUALITY_VOICE = 0x01040100 +}; + +/** Preset voice effects. + * + * For better voice effects, Agora recommends setting the `profile` parameter of `setAudioProfile` to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO` before using the following presets: + * + * - `ROOM_ACOUSTICS_KTV` + * - `AUDIO_EFFECT_OFF_HARMONY` + * - `ROOM_ACOUSTICS_KTV_HARMONY` + * - `ROOM_ACOUSTICS_VOCAL_CONCERT` + * - `ROOM_ACOUSTICS_VOCAL_CONCERT_HARMONY` + * - `ROOM_ACOUSTICS_STUDIO` + * - `ROOM_ACOUSTICS_STUDIO_HARMONY` + * - `ROOM_ACOUSTICS_PHONOGRAPH` + * - `ROOM_ACOUSTICS_PHONOGRAPH_HARMONY` + * - `ROOM_ACOUSTICS_SPACIAL` + * - `ROOM_ACOUSTICS_ETHEREAL` + * - `ROOM_ACOUSTICS_CHORUS` + * - `VOICE_CHANGER_EFFECT_UNCLE` + * - `VOICE_CHANGER_EFFECT_OLDMAN` + * - `VOICE_CHANGER_EFFECT_BOY` + * - `VOICE_CHANGER_EFFECT_SISTER` + * - `VOICE_CHANGER_EFFECT_GIRL` + * - `VOICE_CHANGER_EFFECT_PIGKING` + * - `VOICE_CHANGER_EFFECT_HULK` + * - `PITCH_CORRECTION` + */ +enum AUDIO_EFFECT_PRESET { + /** Turn off voice effects, that is, use the original voice. + */ + AUDIO_EFFECT_OFF = 0x00000000, + /** The voice effect for backing vocals when the lead vocal turns off audio effect. + * @note: When this effect is used, the voice of the backing vocals will be softer. + */ + AUDIO_EFFECT_OFF_HARMONY = 0x02010120, + /** The voice effect typical of a KTV venue. + */ + ROOM_ACOUSTICS_KTV = 0x02010100, + /** The voice effect typical of a KTV venue for backing vocals. + * @note: This effect is used for backing vocals when KTV venue is chosen for the lead vocal. + */ + ROOM_ACOUSTICS_KTV_HARMONY = 0x02010110, + /** The voice effect typical of a concert hall. + */ + ROOM_ACOUSTICS_VOCAL_CONCERT = 0x02010200, + /** The voice effect typical of a concert hall for backing vocals. + * @note: This effect is used for backing vocals when concert hall is chosen for the lead vocal. + */ + ROOM_ACOUSTICS_VOCAL_CONCERT_HARMONY = 0x02010210, + /** The voice effect typical of a recording studio. + */ + ROOM_ACOUSTICS_STUDIO = 0x02010300, + /** The voice effect typical of a studio venue for backing vocals. + * @note: This effect is used for backing vocals when studio venue is chosen for the lead vocal. + */ + ROOM_ACOUSTICS_STUDIO_HARMONY = 0x02010310, + /** The voice effect typical of a vintage phonograph. + */ + ROOM_ACOUSTICS_PHONOGRAPH = 0x02010400, + /** The voice effect typical of a phonograph venue for backing vocals. + * @note: This effect is used for backing vocals when phonograph venue is chosen for the lead vocal. + */ + ROOM_ACOUSTICS_PHONOGRAPH_HARMONY = 0x02010410, + /** The virtual stereo effect, which renders monophonic audio as stereo audio. + * + * @note Before using this preset, set the `profile` parameter of `setAudioProfile` + * to `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)`; + * otherwise, the preset setting is invalid. + */ + ROOM_ACOUSTICS_VIRTUAL_STEREO = 0x02010500, + /** A more spatial voice effect. + */ + ROOM_ACOUSTICS_SPACIAL = 0x02010600, + /** A more ethereal voice effect. + */ + ROOM_ACOUSTICS_ETHEREAL = 0x02010700, + /** A 3D voice effect that makes the voice appear to be moving around the user. The default cycle + * period of the 3D voice effect is 10 seconds. To change the cycle period, call `setAudioEffectParameters` + * after this method. + * + * @note + * - Before using this preset, set the `profile` parameter of `setAudioProfile` to + * `AUDIO_PROFILE_MUSIC_STANDARD_STEREO` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO`; otherwise, + * the preset setting is invalid. + * - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear + * the anticipated voice effect. + */ + ROOM_ACOUSTICS_3D_VOICE = 0x02010800, + /** virtual suround sound. + * + * @note + * - Agora recommends using this enumerator to process virtual suround sound; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND = 0x02010900, + /** The voice effect for chorus. + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + ROOM_ACOUSTICS_CHORUS = 0x02010D00, + /** A middle-aged man's voice. + * + * @note + * Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_UNCLE = 0x02020100, + /** A senior man's voice. + * + * @note Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_OLDMAN = 0x02020200, + /** A boy's voice. + * + * @note Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_BOY = 0x02020300, + /** A young woman's voice. + * + * @note + * - Agora recommends using this enumerator to process a female-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_SISTER = 0x02020400, + /** A girl's voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + */ + VOICE_CHANGER_EFFECT_GIRL = 0x02020500, + /** The voice of Pig King, a character in Journey to the West who has a voice like a growling + * bear. + */ + VOICE_CHANGER_EFFECT_PIGKING = 0x02020600, + /** The Hulk's voice. + */ + VOICE_CHANGER_EFFECT_HULK = 0x02020700, + /** An audio effect typical of R&B music. + * + * @note Before using this preset, set the `profile` parameter of `setAudioProfile` to + - `AUDIO_PROFILE_MUSIC_HIGH_QUALITY` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO`; otherwise, + * the preset setting is invalid. + */ + STYLE_TRANSFORMATION_RNB = 0x02030100, + /** The voice effect typical of popular music. + * + * @note Before using this preset, set the `profile` parameter of `setAudioProfile` to + - `AUDIO_PROFILE_MUSIC_HIGH_QUALITY` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO`; otherwise, + * the preset setting is invalid. + */ + STYLE_TRANSFORMATION_POPULAR = 0x02030200, + /** A pitch correction effect that corrects the user's pitch based on the pitch of the natural C + * major scale. After setting this voice effect, you can call `setAudioEffectParameters` to adjust + * the basic mode of tuning and the pitch of the main tone. + */ + PITCH_CORRECTION = 0x02040100, + + /** Todo: Electronic sound, Magic tone haven't been implemented. + * + */ +}; + +/** The options for SDK preset voice conversion. + */ +enum VOICE_CONVERSION_PRESET { + /** Turn off voice conversion and use the original voice. + */ + VOICE_CONVERSION_OFF = 0x00000000, + /** A gender-neutral voice. To avoid audio distortion, ensure that you use this enumerator to process a female-sounding voice. + */ + VOICE_CHANGER_NEUTRAL = 0x03010100, + /** A sweet voice. To avoid audio distortion, ensure that you use this enumerator to process a female-sounding voice. + */ + VOICE_CHANGER_SWEET = 0x03010200, + /** A steady voice. To avoid audio distortion, ensure that you use this enumerator to process a male-sounding voice. + */ + VOICE_CHANGER_SOLID = 0x03010300, + /** A deep voice. To avoid audio distortion, ensure that you use this enumerator to process a male-sounding voice. + */ + VOICE_CHANGER_BASS = 0x03010400 +}; + +/** The options for SDK preset headphone equalizer. + */ +enum HEADPHONE_EQUALIZER_PRESET { + /** Turn off headphone EQ and use the original voice. + */ + HEADPHONE_EQUALIZER_OFF = 0x00000000, + /** For over-ear headphones. + */ + HEADPHONE_EQUALIZER_OVEREAR = 0x04000001, + /** For in-ear headphones. + */ + HEADPHONE_EQUALIZER_INEAR = 0x04000002 +}; + +/** + * Screen sharing configurations. + */ +struct ScreenCaptureParameters { + /** + * On Windows and macOS, it represents the video encoding resolution of the shared screen stream. + * See `VideoDimensions`. The default value is 1920 x 1080, that is, 2,073,600 pixels. Agora uses + * the value of this parameter to calculate the charges. + * + * If the aspect ratio is different between the encoding dimensions and screen dimensions, Agora + * applies the following algorithms for encoding. Suppose dimensions are 1920 x 1080: + * - If the value of the screen dimensions is lower than that of dimensions, for example, + * 1000 x 1000 pixels, the SDK uses 1000 x 1000 pixels for encoding. + * - If the value of the screen dimensions is higher than that of dimensions, for example, + * 2000 x 1500, the SDK uses the maximum value under dimensions with the aspect ratio of + * the screen dimension (4:3) for encoding, that is, 1440 x 1080. + */ + VideoDimensions dimensions; + /** + * On Windows and macOS, it represents the video encoding frame rate (fps) of the shared screen stream. + * The frame rate (fps) of the shared region. The default value is 5. We do not recommend setting + * this to a value greater than 15. + */ + int frameRate; + /** + * On Windows and macOS, it represents the video encoding bitrate of the shared screen stream. + * The bitrate (Kbps) of the shared region. The default value is 0 (the SDK works out a bitrate + * according to the dimensions of the current screen). + */ + int bitrate; + /** Whether to capture the mouse in screen sharing: + * - `true`: (Default) Capture the mouse. + * - `false`: Do not capture the mouse. + */ + bool captureMouseCursor; + /** + * Whether to bring the window to the front when calling the `startScreenCaptureByWindowId` method to share it: + * - `true`: Bring the window to the front. + * - `false`: (Default) Do not bring the window to the front. + */ + bool windowFocus; + /** + * A list of IDs of windows to be blocked. When calling `startScreenCaptureByDisplayId` to start screen sharing, + * you can use this parameter to block a specified window. When calling `updateScreenCaptureParameters` to update + * screen sharing configurations, you can use this parameter to dynamically block the specified windows during + * screen sharing. + */ + view_t *excludeWindowList; + /** + * The number of windows to be blocked. + */ + int excludeWindowCount; + + /** The width (px) of the border. Defaults to 0, and the value range is [0,50]. + * + */ + int highLightWidth; + /** The color of the border in RGBA format. The default value is 0xFF8CBF26. + * + */ + unsigned int highLightColor; + /** Whether to place a border around the shared window or screen: + * - true: Place a border. + * - false: (Default) Do not place a border. + * + * @note When you share a part of a window or screen, the SDK places a border around the entire window or screen if you set `enableHighLight` as true. + * + */ + bool enableHighLight; + + ScreenCaptureParameters() + : dimensions(1920, 1080), frameRate(5), bitrate(STANDARD_BITRATE), captureMouseCursor(true), windowFocus(false), excludeWindowList(OPTIONAL_NULLPTR), excludeWindowCount(0), highLightWidth(0), highLightColor(0), enableHighLight(false) {} + ScreenCaptureParameters(const VideoDimensions& d, int f, int b) + : dimensions(d), frameRate(f), bitrate(b), captureMouseCursor(true), windowFocus(false), excludeWindowList(OPTIONAL_NULLPTR), excludeWindowCount(0), highLightWidth(0), highLightColor(0), enableHighLight(false) {} + ScreenCaptureParameters(int width, int height, int f, int b) + : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(true), windowFocus(false), excludeWindowList(OPTIONAL_NULLPTR), excludeWindowCount(0), highLightWidth(0), highLightColor(0), enableHighLight(false){} + ScreenCaptureParameters(int width, int height, int f, int b, bool cur, bool fcs) + : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(cur), windowFocus(fcs), excludeWindowList(OPTIONAL_NULLPTR), excludeWindowCount(0), highLightWidth(0), highLightColor(0), enableHighLight(false) {} + ScreenCaptureParameters(int width, int height, int f, int b, view_t *ex, int cnt) + : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(true), windowFocus(false), excludeWindowList(ex), excludeWindowCount(cnt), highLightWidth(0), highLightColor(0), enableHighLight(false) {} + ScreenCaptureParameters(int width, int height, int f, int b, bool cur, bool fcs, view_t *ex, int cnt) + : dimensions(width, height), frameRate(f), bitrate(b), captureMouseCursor(cur), windowFocus(fcs), excludeWindowList(ex), excludeWindowCount(cnt), highLightWidth(0), highLightColor(0), enableHighLight(false) {} +}; + +/** + * Audio recording quality. + */ +enum AUDIO_RECORDING_QUALITY_TYPE { + /** + * 0: Low quality. The sample rate is 32 kHz, and the file size is around 1.2 MB after 10 minutes of recording. + */ + AUDIO_RECORDING_QUALITY_LOW = 0, + /** + * 1: Medium quality. The sample rate is 32 kHz, and the file size is around 2 MB after 10 minutes of recording. + */ + AUDIO_RECORDING_QUALITY_MEDIUM = 1, + /** + * 2: High quality. The sample rate is 32 kHz, and the file size is around 3.75 MB after 10 minutes of recording. + */ + AUDIO_RECORDING_QUALITY_HIGH = 2, + /** + * 3: Ultra high audio recording quality. + */ + AUDIO_RECORDING_QUALITY_ULTRA_HIGH = 3, +}; + +/** + * Recording content. Set in `startAudioRecording`. + */ +enum AUDIO_FILE_RECORDING_TYPE { + /** + * 1: Only records the audio of the local user. + */ + AUDIO_FILE_RECORDING_MIC = 1, + /** + * 2: Only records the audio of all remote users. + */ + AUDIO_FILE_RECORDING_PLAYBACK = 2, + /** + * 3: Records the mixed audio of the local and all remote users. + */ + AUDIO_FILE_RECORDING_MIXED = 3, + /** + * 4: publish audio file recording. + */ + AUDIO_FILE_RECORDING_PUBLISH = 4, +}; + +/** + * Audio encoded frame observer position. + */ +enum AUDIO_ENCODED_FRAME_OBSERVER_POSITION { + /** + * 1: Only records the audio of the local user. + */ + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_RECORD = 1, + /** + * 2: Only records the audio of all remote users. + */ + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK = 2, + /** + * 3: Records the mixed audio of the local and all remote users. + */ + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_MIXED = 3, +}; + +/** + * Recording configuration. + */ +struct AudioRecordingConfiguration { + /** + * The absolute path (including the filename extensions) of the recording file. For example: `C:\music\audio.mp4`. + * @note Ensure that the directory for the log files exists and is writable. + */ + const char* filePath; + /** + * Whether to encode the audio data: + * - `true`: Encode audio data in AAC. + * - `false`: (Default) Do not encode audio data, but save the recorded audio data directly. + */ + bool encode; + /** + * Recording sample rate (Hz). + * - 16000 + * - (Default) 32000 + * - 44100 + * - 48000 + * @note If you set this parameter to 44100 or 48000, Agora recommends recording WAV files, or AAC files with quality + * to be `AUDIO_RECORDING_QUALITY_MEDIUM` or `AUDIO_RECORDING_QUALITY_HIGH` for better recording quality. + */ + int sampleRate; + /** + * The recording content. See `AUDIO_FILE_RECORDING_TYPE`. + */ + AUDIO_FILE_RECORDING_TYPE fileRecordingType; + /** + * Recording quality. See `AUDIO_RECORDING_QUALITY_TYPE`. + * @note This parameter applies to AAC files only. + */ + AUDIO_RECORDING_QUALITY_TYPE quality; + + /** + * Recording channel. The following values are supported: + * - (Default) 1 + * - 2 + */ + int recordingChannel; + + AudioRecordingConfiguration() + : filePath(NULL), + encode(false), + sampleRate(32000), + fileRecordingType(AUDIO_FILE_RECORDING_MIXED), + quality(AUDIO_RECORDING_QUALITY_LOW), + recordingChannel(1) {} + + AudioRecordingConfiguration(const char* file_path, int sample_rate, AUDIO_RECORDING_QUALITY_TYPE quality_type, int channel) + : filePath(file_path), + encode(false), + sampleRate(sample_rate), + fileRecordingType(AUDIO_FILE_RECORDING_MIXED), + quality(quality_type), + recordingChannel(channel) {} + + AudioRecordingConfiguration(const char* file_path, bool enc, int sample_rate, AUDIO_FILE_RECORDING_TYPE type, AUDIO_RECORDING_QUALITY_TYPE quality_type, int channel) + : filePath(file_path), + encode(enc), + sampleRate(sample_rate), + fileRecordingType(type), + quality(quality_type), + recordingChannel(channel) {} + + AudioRecordingConfiguration(const AudioRecordingConfiguration &rhs) + : filePath(rhs.filePath), + encode(rhs.encode), + sampleRate(rhs.sampleRate), + fileRecordingType(rhs.fileRecordingType), + quality(rhs.quality), + recordingChannel(rhs.recordingChannel) {} +}; + +/** + * Observer settings for the encoded audio. + */ +struct AudioEncodedFrameObserverConfig { + /** + * Audio profile. For details, see `AUDIO_ENCODED_FRAME_OBSERVER_POSITION`. + */ + AUDIO_ENCODED_FRAME_OBSERVER_POSITION postionType; + /** + * Audio encoding type. For details, see `AUDIO_ENCODING_TYPE`. + */ + AUDIO_ENCODING_TYPE encodingType; + + AudioEncodedFrameObserverConfig() + : postionType(AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK), + encodingType(AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM){} + +}; +/** + * The encoded audio observer. + */ +class IAudioEncodedFrameObserver { +public: +/** +* Gets the encoded audio data of the local user. +* +* After calling `registerAudioEncodedFrameObserver` and setting the encoded audio as `AUDIO_ENCODED_FRAME_OBSERVER_POSITION_RECORD`, +* you can get the encoded audio data of the local user from this callback. +* +* @param frameBuffer The pointer to the audio frame buffer. +* @param length The data length (byte) of the audio frame. +* @param audioEncodedFrameInfo Audio information after encoding. For details, see `EncodedAudioFrameInfo`. +*/ +virtual void OnRecordAudioEncodedFrame(const uint8_t* frameBuffer, int length, const EncodedAudioFrameInfo& audioEncodedFrameInfo) = 0; + +/** +* Gets the encoded audio data of all remote users. +* +* After calling `registerAudioEncodedFrameObserver` and setting the encoded audio as `AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK`, +* you can get encoded audio data of all remote users through this callback. +* +* @param frameBuffer The pointer to the audio frame buffer. +* @param length The data length (byte) of the audio frame. +* @param audioEncodedFrameInfo Audio information after encoding. For details, see `EncodedAudioFrameInfo`. +*/ +virtual void OnPlaybackAudioEncodedFrame(const uint8_t* frameBuffer, int length, const EncodedAudioFrameInfo& audioEncodedFrameInfo) = 0; + +/** +* Gets the mixed and encoded audio data of the local and all remote users. +* +* After calling `registerAudioEncodedFrameObserver` and setting the audio profile as `AUDIO_ENCODED_FRAME_OBSERVER_POSITION_MIXED`, +* you can get the mixed and encoded audio data of the local and all remote users through this callback. +* +* @param frameBuffer The pointer to the audio frame buffer. +* @param length The data length (byte) of the audio frame. +* @param audioEncodedFrameInfo Audio information after encoding. For details, see `EncodedAudioFrameInfo`. +*/ +virtual void OnMixedAudioEncodedFrame(const uint8_t* frameBuffer, int length, const EncodedAudioFrameInfo& audioEncodedFrameInfo) = 0; + +/** +* Occurs each time the SDK receives an encoded before-publish audio frame. +* @param frameBuffer The pointer to the audio frame buffer. +* @param length The data length of the audio frame. +* @param audioEncodedFrameInfo The information of the encoded audio frame: EncodedAudioFrameInfo. + +*/ +virtual void OnPublishAudioEncodedFrame(const uint8_t* frameBuffer, int length, const EncodedAudioFrameInfo& audioEncodedFrameInfo) = 0; + +virtual ~IAudioEncodedFrameObserver () {} +}; + +/** The region for connection, which is the region where the server the SDK connects to is located. + */ +enum AREA_CODE { + /** + * Mainland China. + */ + AREA_CODE_CN = 0x00000001, + /** + * North America. + */ + AREA_CODE_NA = 0x00000002, + /** + * Europe. + */ + AREA_CODE_EU = 0x00000004, + /** + * Asia, excluding Mainland China. + */ + AREA_CODE_AS = 0x00000008, + /** + * Japan. + */ + AREA_CODE_JP = 0x00000010, + /** + * India. + */ + AREA_CODE_IN = 0x00000020, + /** + * (Default) Global. + */ + AREA_CODE_GLOB = (0xFFFFFFFF) +}; + +enum AREA_CODE_EX { + /** + * Oceania + */ + AREA_CODE_OC = 0x00000040, + /** + * South-American + */ + AREA_CODE_SA = 0x00000080, + /** + * Africa + */ + AREA_CODE_AF = 0x00000100, + /** + * South Korea + */ + AREA_CODE_KR = 0x00000200, + /** + * Hong Kong and Macou + */ + AREA_CODE_HKMC = 0x00000400, + /** + * United States + */ + AREA_CODE_US = 0x00000800, + /** + * Russia + */ + AREA_CODE_RU = 0x00001000, + /** + * The global area (except China) + */ + AREA_CODE_OVS = 0xFFFFFFFE +}; + +/** + * The error code of the channel media replay. + */ +enum CHANNEL_MEDIA_RELAY_ERROR { + /** 0: No error. + */ + RELAY_OK = 0, + /** 1: An error occurs in the server response. + */ + RELAY_ERROR_SERVER_ERROR_RESPONSE = 1, + /** 2: No server response. You can call the `leaveChannel` method to leave the channel. + * + * This error can also occur if your project has not enabled co-host token authentication. You can contact technical + * support to enable the service for cohosting across channels before starting a channel media relay. + */ + RELAY_ERROR_SERVER_NO_RESPONSE = 2, + /** 3: The SDK fails to access the service, probably due to limited resources of the server. + */ + RELAY_ERROR_NO_RESOURCE_AVAILABLE = 3, + /** 4: Fails to send the relay request. + */ + RELAY_ERROR_FAILED_JOIN_SRC = 4, + /** 5: Fails to accept the relay request. + */ + RELAY_ERROR_FAILED_JOIN_DEST = 5, + /** 6: The server fails to receive the media stream. + */ + RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC = 6, + /** 7: The server fails to send the media stream. + */ + RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST = 7, + /** 8: The SDK disconnects from the server due to poor network connections. You can call the `leaveChannel` method to + * leave the channel. + */ + RELAY_ERROR_SERVER_CONNECTION_LOST = 8, + /** 9: An internal error occurs in the server. + */ + RELAY_ERROR_INTERNAL_ERROR = 9, + /** 10: The token of the source channel has expired. + */ + RELAY_ERROR_SRC_TOKEN_EXPIRED = 10, + /** 11: The token of the destination channel has expired. + */ + RELAY_ERROR_DEST_TOKEN_EXPIRED = 11, +}; + +/** + * The event code of channel media relay. + */ +enum CHANNEL_MEDIA_RELAY_EVENT { + /** 0: The user disconnects from the server due to poor network connections. + */ + RELAY_EVENT_NETWORK_DISCONNECTED = 0, + /** 1: The user is connected to the server. + */ + RELAY_EVENT_NETWORK_CONNECTED = 1, + /** 2: The user joins the source channel. + */ + RELAY_EVENT_PACKET_JOINED_SRC_CHANNEL = 2, + /** 3: The user joins the destination channel. + */ + RELAY_EVENT_PACKET_JOINED_DEST_CHANNEL = 3, + /** 4: The SDK starts relaying the media stream to the destination channel. + */ + RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL = 4, + /** 5: The server receives the video stream from the source channel. + */ + RELAY_EVENT_PACKET_RECEIVED_VIDEO_FROM_SRC = 5, + /** 6: The server receives the audio stream from the source channel. + */ + RELAY_EVENT_PACKET_RECEIVED_AUDIO_FROM_SRC = 6, + /** 7: The destination channel is updated. + */ + RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL = 7, + /** 8: The destination channel update fails due to internal reasons. + */ + RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_REFUSED = 8, + /** 9: The destination channel does not change, which means that the destination channel fails to be updated. + */ + RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE = 9, + /** 10: The destination channel name is NULL. + */ + RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL = 10, + /** 11: The video profile is sent to the server. + */ + RELAY_EVENT_VIDEO_PROFILE_UPDATE = 11, + /** 12: The SDK successfully pauses relaying the media stream to destination channels. + */ + RELAY_EVENT_PAUSE_SEND_PACKET_TO_DEST_CHANNEL_SUCCESS = 12, + /** 13: The SDK fails to pause relaying the media stream to destination channels. + */ + RELAY_EVENT_PAUSE_SEND_PACKET_TO_DEST_CHANNEL_FAILED = 13, + /** 14: The SDK successfully resumes relaying the media stream to destination channels. + */ + RELAY_EVENT_RESUME_SEND_PACKET_TO_DEST_CHANNEL_SUCCESS = 14, + /** 15: The SDK fails to resume relaying the media stream to destination channels. + */ + RELAY_EVENT_RESUME_SEND_PACKET_TO_DEST_CHANNEL_FAILED = 15, +}; +/** + * The state code of the channel media relay. + */ +enum CHANNEL_MEDIA_RELAY_STATE { + /** 0: The initial state. After you successfully stop the channel media relay by calling `stopChannelMediaRelay`, + * the `onChannelMediaRelayStateChanged` callback returns this state. + */ + RELAY_STATE_IDLE = 0, + /** 1: The SDK tries to relay the media stream to the destination channel. + */ + RELAY_STATE_CONNECTING = 1, + /** 2: The SDK successfully relays the media stream to the destination channel. + */ + RELAY_STATE_RUNNING = 2, + /** 3: An error occurs. See `code` in `onChannelMediaRelayStateChanged` for the error code. + */ + RELAY_STATE_FAILURE = 3, +}; + +/** The definition of ChannelMediaInfo. + */ +struct ChannelMediaInfo { + /** The channel name. The default value is NULL, which means that the SDK + * applies the current channel name. + */ + const char* channelName; + /** The token that enables the user to join the channel. The default value + * is NULL, which means that the SDK applies the current token. + */ + const char* token; + /** The user ID. + */ + uid_t uid; +}; + +/** The definition of ChannelMediaRelayConfiguration. + */ +struct ChannelMediaRelayConfiguration { + /** The information of the source channel `ChannelMediaInfo`. It contains the following members: + * - `channelName`: The name of the source channel. The default value is `NULL`, which means the SDK applies the name + * of the current channel. + * - `uid`: The unique ID to identify the relay stream in the source channel. The default value is 0, which means the + * SDK generates a random UID. You must set it as 0. + * - `token`: The token for joining the source channel. It is generated with the `channelName` and `uid` you set in + * `srcInfo`. + * - If you have not enabled the App Certificate, set this parameter as the default value `NULL`, which means the + * SDK applies the App ID. + * - If you have enabled the App Certificate, you must use the token generated with the `channelName` and `uid`, and + * the `uid` must be set as 0. + */ + ChannelMediaInfo *srcInfo; + /** The information of the destination channel `ChannelMediaInfo`. It contains the following members: + * - `channelName`: The name of the destination channel. + * - `uid`: The unique ID to identify the relay stream in the destination channel. The value + * ranges from 0 to (2^32-1). To avoid UID conflicts, this `UID` must be different from any + * other `UID` in the destination channel. The default value is 0, which means the SDK generates + * a random `UID`. Do not set this parameter as the `UID` of the host in the destination channel, + * and ensure that this `UID` is different from any other `UID` in the channel. + * - `token`: The token for joining the destination channel. It is generated with the `channelName` + * and `uid` you set in `destInfos`. + * - If you have not enabled the App Certificate, set this parameter as the default value NULL, + * which means the SDK applies the App ID. + * If you have enabled the App Certificate, you must use the token generated with the `channelName` + * and `uid`. + */ + ChannelMediaInfo *destInfos; + /** The number of destination channels. The default value is 0, and the value range is from 0 to + * 4. Ensure that the value of this parameter corresponds to the number of `ChannelMediaInfo` + * structs you define in `destInfo`. + */ + int destCount; + + ChannelMediaRelayConfiguration() + : srcInfo(NULL), + destInfos(NULL), + destCount(0) + {} +}; + +/** + * The uplink network information. + */ +struct UplinkNetworkInfo { + /** + * The target video encoder bitrate (bps). + */ + int video_encoder_target_bitrate_bps; + + UplinkNetworkInfo() : video_encoder_target_bitrate_bps(0) {} + + bool operator==(const UplinkNetworkInfo& rhs) const { + return (video_encoder_target_bitrate_bps == rhs.video_encoder_target_bitrate_bps); + } +}; + +/** + * The collections of downlink network info. + */ +struct DownlinkNetworkInfo { + struct PeerDownlinkInfo { + /** + * The ID of the user who owns the remote video stream. + */ + const char* uid; + /** + * The remote video stream type: #VIDEO_STREAM_TYPE. + */ + VIDEO_STREAM_TYPE stream_type; + /** + * The remote video downscale type: #REMOTE_VIDEO_DOWNSCALE_LEVEL. + */ + REMOTE_VIDEO_DOWNSCALE_LEVEL current_downscale_level; + /** + * The expected bitrate in bps. + */ + int expected_bitrate_bps; + + PeerDownlinkInfo() + : uid(OPTIONAL_NULLPTR), + stream_type(VIDEO_STREAM_HIGH), + current_downscale_level(REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE), + expected_bitrate_bps(-1) {} + + PeerDownlinkInfo& operator=(const PeerDownlinkInfo& rhs) { + if (this == &rhs) return *this; + uid = OPTIONAL_NULLPTR; + stream_type = rhs.stream_type; + current_downscale_level = rhs.current_downscale_level; + expected_bitrate_bps = rhs.expected_bitrate_bps; + if (rhs.uid != OPTIONAL_NULLPTR) { + char* temp = new char[strlen(rhs.uid) + 1]; + strcpy(temp, rhs.uid); + uid = temp; + } + return *this; + } + + ~PeerDownlinkInfo() { + if (uid) { delete [] uid; } + } + }; + + /** + * The lastmile buffer delay queue time in ms. + */ + int lastmile_buffer_delay_time_ms; + /** + * The current downlink bandwidth estimation(bps) after downscale. + */ + int bandwidth_estimation_bps; + /** + * The total video downscale level count. + */ + int total_downscale_level_count; + /** + * The peer video downlink info array. + */ + PeerDownlinkInfo* peer_downlink_info; + /** + * The total video received count. + */ + int total_received_video_count; + + DownlinkNetworkInfo() + : lastmile_buffer_delay_time_ms(-1), + bandwidth_estimation_bps(-1), + total_downscale_level_count(-1), + peer_downlink_info(OPTIONAL_NULLPTR), + total_received_video_count(-1) {} + + DownlinkNetworkInfo(const DownlinkNetworkInfo& info) + : lastmile_buffer_delay_time_ms(info.lastmile_buffer_delay_time_ms), + bandwidth_estimation_bps(info.bandwidth_estimation_bps), + total_downscale_level_count(info.total_downscale_level_count), + peer_downlink_info(OPTIONAL_NULLPTR), + total_received_video_count(info.total_received_video_count) { + if (total_received_video_count <= 0) return; + peer_downlink_info = new PeerDownlinkInfo[total_received_video_count]; + for (int i = 0; i < total_received_video_count; ++i) + peer_downlink_info[i] = info.peer_downlink_info[i]; + } + + DownlinkNetworkInfo& operator=(const DownlinkNetworkInfo& rhs) { + if (this == &rhs) return *this; + lastmile_buffer_delay_time_ms = rhs.lastmile_buffer_delay_time_ms; + bandwidth_estimation_bps = rhs.bandwidth_estimation_bps; + total_downscale_level_count = rhs.total_downscale_level_count; + peer_downlink_info = OPTIONAL_NULLPTR; + total_received_video_count = rhs.total_received_video_count; + if (total_received_video_count > 0) { + peer_downlink_info = new PeerDownlinkInfo[total_received_video_count]; + for (int i = 0; i < total_received_video_count; ++i) + peer_downlink_info[i] = rhs.peer_downlink_info[i]; + } + return *this; + } + + ~DownlinkNetworkInfo() { + if (peer_downlink_info) delete [] peer_downlink_info; + } +}; + +/** + * The built-in encryption mode. + * + * Agora recommends using AES_128_GCM2 or AES_256_GCM2 encrypted mode. These two modes support the + * use of salt for higher security. + */ +enum ENCRYPTION_MODE { + /** 1: 128-bit AES encryption, XTS mode. + */ + AES_128_XTS = 1, + /** 2: 128-bit AES encryption, ECB mode. + */ + AES_128_ECB = 2, + /** 3: 256-bit AES encryption, XTS mode. + */ + AES_256_XTS = 3, + /** 4: 128-bit SM4 encryption, ECB mode. + */ + SM4_128_ECB = 4, + /** 5: 128-bit AES encryption, GCM mode. + */ + AES_128_GCM = 5, + /** 6: 256-bit AES encryption, GCM mode. + */ + AES_256_GCM = 6, + /** 7: (Default) 128-bit AES encryption, GCM mode. This encryption mode requires the setting of + * salt (`encryptionKdfSalt`). + */ + AES_128_GCM2 = 7, + /** 8: 256-bit AES encryption, GCM mode. This encryption mode requires the setting of salt (`encryptionKdfSalt`). + */ + AES_256_GCM2 = 8, + /** Enumerator boundary. + */ + MODE_END, +}; + +/** Built-in encryption configurations. */ +struct EncryptionConfig { + /** + * The built-in encryption mode. See #ENCRYPTION_MODE. Agora recommends using `AES_128_GCM2` + * or `AES_256_GCM2` encrypted mode. These two modes support the use of salt for higher security. + */ + ENCRYPTION_MODE encryptionMode; + /** + * Encryption key in string type with unlimited length. Agora recommends using a 32-byte key. + * + * @note If you do not set an encryption key or set it as NULL, you cannot use the built-in encryption, and the SDK returns #ERR_INVALID_ARGUMENT (-2). + */ + const char* encryptionKey; + /** + * Salt, 32 bytes in length. Agora recommends that you use OpenSSL to generate salt on the server side. + * + * @note This parameter takes effect only in `AES_128_GCM2` or `AES_256_GCM2` encrypted mode. + * In this case, ensure that this parameter is not 0. + */ + uint8_t encryptionKdfSalt[32]; + + bool datastreamEncryptionEnabled; + + EncryptionConfig() + : encryptionMode(AES_128_GCM2), + encryptionKey(NULL), + datastreamEncryptionEnabled(false) + { + memset(encryptionKdfSalt, 0, sizeof(encryptionKdfSalt)); + } + + /// @cond + const char* getEncryptionString() const { + switch(encryptionMode) { + case AES_128_XTS: + return "aes-128-xts"; + case AES_128_ECB: + return "aes-128-ecb"; + case AES_256_XTS: + return "aes-256-xts"; + case SM4_128_ECB: + return "sm4-128-ecb"; + case AES_128_GCM: + return "aes-128-gcm"; + case AES_256_GCM: + return "aes-256-gcm"; + case AES_128_GCM2: + return "aes-128-gcm-2"; + case AES_256_GCM2: + return "aes-256-gcm-2"; + default: + return "aes-128-gcm-2"; + } + return "aes-128-gcm-2"; + } + /// @endcond +}; + +/** Encryption error type. + */ +enum ENCRYPTION_ERROR_TYPE { + /** + * 0: Internal reason. + */ + ENCRYPTION_ERROR_INTERNAL_FAILURE = 0, + /** + * 1: MediaStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + */ + ENCRYPTION_ERROR_DECRYPTION_FAILURE = 1, + /** + * 2: MediaStream encryption errors. + */ + ENCRYPTION_ERROR_ENCRYPTION_FAILURE = 2, + /** + * 3: DataStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + */ + ENCRYPTION_ERROR_DATASTREAM_DECRYPTION_FAILURE = 3, + /** + * 4: DataStream encryption errors. + */ + ENCRYPTION_ERROR_DATASTREAM_ENCRYPTION_FAILURE = 4, +}; + +enum UPLOAD_ERROR_REASON +{ + UPLOAD_SUCCESS = 0, + UPLOAD_NET_ERROR = 1, + UPLOAD_SERVER_ERROR = 2, +}; + +/** The type of the device permission. + */ +enum PERMISSION_TYPE { + /** + * 0: Permission for the audio capture device. + */ + RECORD_AUDIO = 0, + /** + * 1: Permission for the camera. + */ + CAMERA = 1, + + SCREEN_CAPTURE = 2, +}; + +/** The maximum length of the user account. + */ +enum MAX_USER_ACCOUNT_LENGTH_TYPE +{ + /** The maximum length of the user account is 256 bytes. + */ + MAX_USER_ACCOUNT_LENGTH = 256 +}; + +/** + * The subscribing state. + */ +enum STREAM_SUBSCRIBE_STATE { + /** + * 0: The initial subscribing state after joining the channel. + */ + SUB_STATE_IDLE = 0, + /** + * 1: Fails to subscribe to the remote stream. Possible reasons: + * - The remote user: + * - Calls `muteLocalAudioStream(true)` or `muteLocalVideoStream(true)` to stop sending local + * media stream. + * - Calls `disableAudio` or `disableVideo `to disable the local audio or video module. + * - Calls `enableLocalAudio(false)` or `enableLocalVideo(false)` to disable the local audio or video capture. + * - The role of the remote user is audience. + * - The local user calls the following methods to stop receiving remote streams: + * - Calls `muteRemoteAudioStream(true)`, `muteAllRemoteAudioStreams(true)` or `setDefaultMuteAllRemoteAudioStreams(true)` to stop receiving the remote audio streams. + * - Calls `muteRemoteVideoStream(true)`, `muteAllRemoteVideoStreams(true)` or `setDefaultMuteAllRemoteVideoStreams(true)` to stop receiving the remote video streams. + */ + SUB_STATE_NO_SUBSCRIBED = 1, + /** + * 2: Subscribing. + */ + SUB_STATE_SUBSCRIBING = 2, + /** + * 3: Subscribes to and receives the remote stream successfully. + */ + SUB_STATE_SUBSCRIBED = 3 +}; + +/** + * The publishing state. + */ +enum STREAM_PUBLISH_STATE { + /** + * 0: The initial publishing state after joining the channel. + */ + PUB_STATE_IDLE = 0, + /** + * 1: Fails to publish the local stream. Possible reasons: + * - The local user calls `muteLocalAudioStream(true)` or `muteLocalVideoStream(true)` to stop sending the local media stream. + * - The local user calls `disableAudio` or `disableVideo` to disable the local audio or video module. + * - The local user calls `enableLocalAudio(false)` or `enableLocalVideo(false)` to disable the local audio or video capture. + * - The role of the local user is audience. + */ + PUB_STATE_NO_PUBLISHED = 1, + /** + * 2: Publishing. + */ + PUB_STATE_PUBLISHING = 2, + /** + * 3: Publishes successfully. + */ + PUB_STATE_PUBLISHED = 3 +}; + +/** + * The EchoTestConfiguration struct. + */ +struct EchoTestConfiguration { + view_t view; + bool enableAudio; + bool enableVideo; + const char* token; + const char* channelId; + + EchoTestConfiguration(view_t v, bool ea, bool ev, const char* t, const char* c) + : view(v), enableAudio(ea), enableVideo(ev), token(t), channelId(c) {} + + EchoTestConfiguration() + : view(OPTIONAL_NULLPTR), enableAudio(true), enableVideo(true), token(OPTIONAL_NULLPTR), channelId(OPTIONAL_NULLPTR) {} +}; + +/** + * The information of the user. + */ +struct UserInfo { + /** + * The user ID. + */ + uid_t uid; + /** + * The user account. The maximum data length is `MAX_USER_ACCOUNT_LENGTH_TYPE`. + */ + char userAccount[MAX_USER_ACCOUNT_LENGTH]; + UserInfo() + : uid(0) { + userAccount[0] = '\0'; + } +}; + +/** + * The audio filter of in-ear monitoring. + */ +enum EAR_MONITORING_FILTER_TYPE { + /** + * 1: Do not add an audio filter to the in-ear monitor. + */ + EAR_MONITORING_FILTER_NONE = (1<<0), + /** + * 2: Enable audio filters to the in-ear monitor. If you implement functions such as voice + * beautifier and audio effect, users can hear the voice after adding these effects. + */ + EAR_MONITORING_FILTER_BUILT_IN_AUDIO_FILTERS = (1<<1), + /** + * 4: Enable noise suppression to the in-ear monitor. + */ + EAR_MONITORING_FILTER_NOISE_SUPPRESSION = (1<<2) +}; + +/** + * Thread priority type. + */ +enum THREAD_PRIORITY_TYPE { + /** + * 0: Lowest priority. + */ + LOWEST = 0, + /** + * 1: Low priority. + */ + LOW = 1, + /** + * 2: Normal priority. + */ + NORMAL = 2, + /** + * 3: High priority. + */ + HIGH = 3, + /** + * 4. Highest priority. + */ + HIGHEST = 4, + /** + * 5. Critical priority. + */ + CRITICAL = 5, +}; + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + +/** + * The video configuration for the shared screen stream. + */ +struct ScreenVideoParameters { + /** + * The dimensions of the video encoding resolution. The default value is `1280` x `720`. + * For recommended values, see [Recommended video + * profiles](https://docs.agora.io/en/Interactive%20Broadcast/game_streaming_video_profile?platform=Android#recommended-video-profiles). + * If the aspect ratio is different between width and height and the screen, the SDK adjusts the + * video encoding resolution according to the following rules (using an example where `width` × + * `height` is 1280 × 720): + * - When the width and height of the screen are both lower than `width` and `height`, the SDK + * uses the resolution of the screen for video encoding. For example, if the screen is 640 × + * 360, The SDK uses 640 × 360 for video encoding. + * - When either the width or height of the screen is higher than `width` or `height`, the SDK + * uses the maximum values that do not exceed those of `width` and `height` while maintaining + * the aspect ratio of the screen for video encoding. For example, if the screen is 2000 × 1500, + * the SDK uses 960 × 720 for video encoding. + * + * @note + * - The billing of the screen sharing stream is based on the values of width and height. + * When you do not pass in these values, Agora bills you at 1280 × 720; + * when you pass in these values, Agora bills you at those values. + * For details, see [Pricing for Real-time + * Communication](https://docs.agora.io/en/Interactive%20Broadcast/billing_rtc). + * - This value does not indicate the orientation mode of the output ratio. + * For how to set the video orientation, see `ORIENTATION_MODE`. + * - Whether the SDK can support a resolution at 720P depends on the performance of the device. + * If you set 720P but the device cannot support it, the video frame rate can be lower. + */ + VideoDimensions dimensions; + /** + * The video encoding frame rate (fps). The default value is `15`. + * For recommended values, see [Recommended video + * profiles](https://docs.agora.io/en/Interactive%20Broadcast/game_streaming_video_profile?platform=Android#recommended-video-profiles). + */ + int frameRate = 15; + /** + * The video encoding bitrate (Kbps). For recommended values, see [Recommended video + * profiles](https://docs.agora.io/en/Interactive%20Broadcast/game_streaming_video_profile?platform=Android#recommended-video-profiles). + */ + int bitrate; + /* + * The content hint of the screen sharing: + */ + VIDEO_CONTENT_HINT contentHint = VIDEO_CONTENT_HINT::CONTENT_HINT_MOTION; + + ScreenVideoParameters() : dimensions(1280, 720) {} +}; + +/** + * The audio configuration for the shared screen stream. + */ +struct ScreenAudioParameters { + /** + * The audio sample rate (Hz). The default value is `48000`. + */ + int sampleRate = 48000; + /** + * The number of audio channels. The default value is `2`, indicating dual channels. + */ + int channels = 2; + /** + * The volume of the captured system audio. The value range is [0,100]. The default value is + * `100`. + */ + int captureSignalVolume = 100; +}; + +/** + * The configuration of the screen sharing + */ +struct ScreenCaptureParameters2 { + /** + * Determines whether to capture system audio during screen sharing: + * - `true`: Capture. + * - `false`: (Default) Do not capture. + * + * **Note** + * Due to system limitations, capturing system audio is only available for Android API level 29 + * and later (that is, Android 10 and later). + */ + bool captureAudio = false; + /** + * The audio configuration for the shared screen stream. + */ + ScreenAudioParameters audioParams; + /** + * Determines whether to capture the screen during screen sharing: + * - `true`: (Default) Capture. + * - `false`: Do not capture. + * + * **Note** + * Due to system limitations, screen capture is only available for Android API level 21 and later + * (that is, Android 5 and later). + */ + bool captureVideo = true; + /** + * The video configuration for the shared screen stream. + */ + ScreenVideoParameters videoParams; +}; +#endif + +/** + * The tracing event of media rendering. + */ +enum MEDIA_TRACE_EVENT { + /** + * 0: The media frame has been rendered. + */ + MEDIA_TRACE_EVENT_VIDEO_RENDERED = 0, + /** + * 1: The media frame has been decoded. + */ + MEDIA_TRACE_EVENT_VIDEO_DECODED, +}; + +/** + * The video rendering tracing result + */ +struct VideoRenderingTracingInfo { + /** + * Elapsed time from the start tracing time to the time when the tracing event occurred. + */ + int elapsedTime; + /** + * Elapsed time from the start tracing time to the time when join channel. + * + * **Note** + * If the start tracing time is behind the time when join channel, this value will be negative. + */ + int start2JoinChannel; + /** + * Elapsed time from joining channel to finishing joining channel. + */ + int join2JoinSuccess; + /** + * Elapsed time from finishing joining channel to remote user joined. + * + * **Note** + * If the start tracing time is after the time finishing join channel, this value will be + * the elapsed time from the start tracing time to remote user joined. The minimum value is 0. + */ + int joinSuccess2RemoteJoined; + /** + * Elapsed time from remote user joined to set the view. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to set the view. The minimum value is 0. + */ + int remoteJoined2SetView; + /** + * Elapsed time from remote user joined to the time subscribing remote video stream. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to the time subscribing remote video stream. + * The minimum value is 0. + */ + int remoteJoined2UnmuteVideo; + /** + * Elapsed time from remote user joined to the remote video packet received. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to the time subscribing remote video stream. + * The minimum value is 0. + */ + int remoteJoined2PacketReceived; +}; + +} // namespace rtc + +namespace base { + +class IEngineBase { + public: + virtual int queryInterface(rtc::INTERFACE_ID_TYPE iid, void** inter) = 0; + virtual ~IEngineBase() {} +}; + +class AParameter : public agora::util::AutoPtr { + public: + AParameter(IEngineBase& engine) { initialize(&engine); } + AParameter(IEngineBase* engine) { initialize(engine); } + AParameter(IAgoraParameter* p) : agora::util::AutoPtr(p) {} + + private: + bool initialize(IEngineBase* engine) { + IAgoraParameter* p = NULL; + if (engine && !engine->queryInterface(rtc::AGORA_IID_PARAMETER_ENGINE, (void**)&p)) reset(p); + return p != NULL; + } +}; + +class LicenseCallback { + public: + virtual ~LicenseCallback() {} + virtual void onCertificateRequired() = 0; + virtual void onLicenseRequest() = 0; + virtual void onLicenseValidated() = 0; + virtual void onLicenseError(int result) = 0; +}; + +} // namespace base + +/** + * Spatial audio parameters + */ +struct SpatialAudioParams { + /** + * Speaker azimuth in a spherical coordinate system centered on the listener. + */ + Optional speaker_azimuth; + /** + * Speaker elevation in a spherical coordinate system centered on the listener. + */ + Optional speaker_elevation; + /** + * Distance between speaker and listener. + */ + Optional speaker_distance; + /** + * Speaker orientation [0-180], 0 degree is the same with listener orientation. + */ + Optional speaker_orientation; + /** + * Enable blur or not for the speaker. + */ + Optional enable_blur; + /** + * Enable air absorb or not for the speaker. + */ + Optional enable_air_absorb; + /** + * Speaker attenuation factor. + */ + Optional speaker_attenuation; + /** + * Enable doppler factor. + */ + Optional enable_doppler; +}; + +struct VideoLayout +{ + const char* channelId; + uint32_t uid; + const char* strUid; + uint32_t x; + uint32_t y; + uint32_t width; + uint32_t height; + uint32_t videoState; +}; +} // namespace agora + +/** + * Gets the version of the SDK. + * @param [out] build The build number of Agora SDK. + * @return The string of the version of the SDK. + */ +AGORA_API const char* AGORA_CALL getAgoraSdkVersion(int* build); + +/** + * Gets error description of an error code. + * @param [in] err The error code. + * @return The description of the error code. + */ +AGORA_API const char* AGORA_CALL getAgoraSdkErrorDescription(int err); + +AGORA_API int AGORA_CALL setAgoraSdkExternalSymbolLoader(void* (*func)(const char* symname)); + +/** + * Generate credential + * @param [in, out] credential The content of the credential. + * @return The description of the error code. + * @note For license only, everytime will generate a different credential. + * So, just need to call once for a device, and then save the credential + */ +AGORA_API int AGORA_CALL createAgoraCredential(agora::util::AString &credential); + +/** + * Verify given certificate and return the result + * When you receive onCertificateRequired event, you must validate the certificate by calling + * this function. This is sync call, and if validation is success, it will return ERR_OK. And + * if failed to pass validation, you won't be able to joinChannel and ERR_CERT_FAIL will be + * returned. + * @param [in] credential_buf pointer to the credential's content. + * @param [in] credential_len the length of the credential's content. + * @param [in] certificate_buf pointer to the certificate's content. + * @param [in] certificate_len the length of the certificate's content. + * @return The description of the error code. + * @note For license only. + */ +AGORA_API int AGORA_CALL getAgoraCertificateVerifyResult(const char *credential_buf, int credential_len, + const char *certificate_buf, int certificate_len); + +/** + * @brief Implement the agora::base::LicenseCallback, + * create a LicenseCallback object to receive callbacks of license. + * + * @param [in] callback The object of agora::LiceseCallback, + * set the callback to null before delete it. + */ +AGORA_API void setAgoraLicenseCallback(agora::base::LicenseCallback *callback); + +/** + * @brief Get the LicenseCallback pointer if already setup, + * otherwise, return null. + * + * @return a pointer of agora::base::LicenseCallback + */ + +AGORA_API agora::base::LicenseCallback* getAgoraLicenseCallback(); + +/* + * Get monotonic time in ms which can be used by capture time, + * typical scenario is as follows: + * + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * | // custom audio/video base capture time, e.g. the first audio/video capture time. | + * | int64_t custom_capture_time_base; | + * | | + * | int64_t agora_monotonic_time = getAgoraCurrentMonotonicTimeInMs(); | + * | | + * | // offset is fixed once calculated in the begining. | + * | const int64_t offset = agora_monotonic_time - custom_capture_time_base; | + * | | + * | // realtime_custom_audio/video_capture_time is the origin capture time that customer provided.| + * | // actual_audio/video_capture_time is the actual capture time transfered to sdk. | + * | int64_t actual_audio_capture_time = realtime_custom_audio_capture_time + offset; | + * | int64_t actual_video_capture_time = realtime_custom_video_capture_time + offset; | + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * + * @return + * - >= 0: Success. + * - < 0: Failure. + */ +AGORA_API int64_t AGORA_CALL getAgoraCurrentMonotonicTimeInMs(); diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraBaseDelegate.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraBaseDelegate.h new file mode 100644 index 0000000..c9d3289 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraBaseDelegate.h @@ -0,0 +1,420 @@ +// +// AgoraRtcEngineKit.h +// AgoraRtcEngineKit +// +// Created by Sting Feng on 2015-8-11. +// Copyright (c) 2015 Agora. All rights reserved. +// + +@class AgoraRtcEngineKit; +#import "AgoraObjects.h" + +@protocol AgoraBaseDelegate +@optional +#pragma mark SDK common delegates + +#pragma mark String UID + +/** Occurs when the local user successfully registers a user account by calling the + * This callback reports the user ID and user account of the local user. + * @param uid The ID of the local user. + * @param userAccount The user account of the local user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalUserRegisteredWithUserId:(NSUInteger)uid userAccount:(NSString * _Nonnull)userAccount NS_SWIFT_NAME(rtcEngine(_:didLocalUserRegisteredWithUserId:userAccount:)); + +/** Occurs when the SDK gets the user ID and user account of the remote user. + + * After a remote user joins the channel, the SDK gets the UID and user account of the remote user, + * caches them in a mapping table object (`userInfo`), and triggers this callback on the local client. + + * @param uid The ID of the remote user. + * @param userInfo The `AgoraUserInfo` object that contains the user ID and user account of the remote user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didUserInfoUpdatedWithUserId:(NSUInteger)uid userInfo:(AgoraUserInfo* _Nonnull)userInfo NS_SWIFT_NAME(rtcEngine(_:didUserInfoUpdatedWithUserId:userInfo:)); + +/** + * The warning occurred in SDK. The APP could igonre the warning, and the SDK could try to resume automically. + * + * @param engine The engine kit + * @param warningCode The warning code + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurWarning:(AgoraWarningCode)warningCode NS_SWIFT_NAME(rtcEngine(_:didOccurWarning:)); + +/** + * The error occurred in SDK. The SDK couldn't resume to normal state, and the app need to handle it. + * + * @param engine The engine kit + * @param errorCode The error code + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurError:(AgoraErrorCode)errorCode NS_SWIFT_NAME(rtcEngine(_:didOccurError:)); + +/** + * Event of load media engine success + * + * @param engine The engine kit + */ +- (void)rtcEngineMediaEngineDidLoaded:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineMediaEngineDidLoaded(_:)); + +/** + * Event of media engine start call success + * + * @param engine The engine kit + */ +- (void)rtcEngineMediaEngineDidStartCall:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineMediaEngineDidStartCall(_:)); + +/** + * when token is enabled, and specified token is invalid or expired, this function will be called. + * APP should generate a new token and call renewToken() to refresh the token. + * NOTE: to be compatible with previous version, ERR_TOKEN_EXPIRED and ERR_INVALID_TOKEN are also reported via onError() callback. + * You should move renew of token logic into this callback. + * @param engine The engine kit + */ +- (void)rtcEngineRequestToken:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRequestToken(_:)); + +/** + * Event of disconnected with server. This event is reported at the moment SDK loses connection with server. + * In the mean time SDK automatically tries to reconnect with the server until APP calls leaveChannel. + * + * @param engine The engine kit + */ +- (void)rtcEngineConnectionDidInterrupted:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidInterrupted(_:)); + +/** + * Event of loss connection with server. This event is reported after the connection is interrupted and exceed the retry period (10 seconds by default). + * In the mean time SDK automatically tries to reconnect with the server until APP calls leaveChannel. + * + * @param engine The engine kit + */ +- (void)rtcEngineConnectionDidLost:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidLost(_:)); + +/** + * Event of connection banned by server. This event is reported after the connection is banned by server. + * In the mean time SDK will not try to reconnect the server. + */ +- (void)rtcEngineConnectionDidBanned:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidBanned(_:)); + +/** + * Statistics of rtc engine status. Updated every two seconds. + * + * @param engine The engine kit + * @param stats The statistics of rtc status, including duration, sent bytes and received bytes + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine reportRtcStats:(AgoraChannelStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:reportRtcStats:)); + +/** + * The network quality of lastmile test. + * + * @param engine The engine kit + * @param quality The network quality + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileQuality:(AgoraNetworkQuality)quality NS_SWIFT_NAME(rtcEngine(_:lastmileQuality:)); + +/** + * Reports the last-mile network probe result. + * + * The SDK triggers this callback within 30 seconds after the app calls the [startLastmileProbeTest]([AgoraRtcEngineKit startLastmileProbeTest:]) method. + * + * @param engine AgoraRtcEngineKit object. + * @param result The uplink and downlink last-mile network probe test result, see [AgoraLastmileProbeResult](AgoraLastmileProbeResult). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileProbeTestResult:(AgoraLastmileProbeResult * _Nonnull)result NS_SWIFT_NAME(rtcEngine(_:lastmileProbeTest:)); + +/** + * Event of API call executed + * @deprecated This callback is deprecated. Use other specific event callbacks instead. + * + * @param engine The engine kit + * @param api The API description + * @param error The error code + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didApiCallExecute:(NSInteger)error api:(NSString * _Nonnull)api result:(NSString * _Nonnull)result NS_SWIFT_NAME(rtcEngine(_:didApiCallExecute:api:result:)) __deprecated; + + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +/** + * the notificaitoin of device added removed + * + * @param engine The engine kit + * @param deviceId the identification of device + * @param deviceType type of device: -1: audio unknown; 0: audio recording ; 1: audio playout ; 2: render; 4: capture + * @param state state of device: 0: added; 1: removed + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine device:(NSString * _Nonnull)deviceId type:(AgoraMediaDeviceType)deviceType stateChanged:(NSInteger)state NS_SWIFT_NAME(rtcEngine(_:device:type:stateChanged:)); + +#endif + +/** + * An error of encryption occurred during SDK runtime. + * + * @param errorType AgoraEncryptionErrorType + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurEncryptionError:(AgoraEncryptionErrorType)errorType NS_SWIFT_NAME(rtcEngine(_:didOccur:)); +/** + * Reports the user log upload result + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine uploadLogResultRequestId:(NSString * _Nonnull)requestId success:(BOOL)success reason:(AgoraUploadErrorReason)reason NS_SWIFT_NAME(rtcEngine(_:uploadLogResultRequestId:success:reason:)); + +#pragma mark Local user common delegates + +/** + * Event of cient role change. only take effect under broadcasting mode + * + * @param engine The engine kit + * @param oldRole The previous role of the local user + * @param newRole The new role of the local user + * @param newRoleOptions The client role options of the current role of the local user + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didClientRoleChanged:(AgoraClientRole)oldRole newRole:(AgoraClientRole)newRole newRoleOptions:(AgoraClientRoleOptions * _Nullable)newRoleOptions NS_SWIFT_NAME(rtcEngine(_:didClientRoleChanged:newRole:newRoleOptions:)); + +/** + * Event of cient role change. only take effect under broadcasting mode + * + * @param engine The engine kit + * @param reason The reason of the failure of the local user role switches + * @param currentRole The current role of the user + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didClientRoleChangeFailed:(AgoraClientRoleChangeFailedReason)reason currentRole:(AgoraClientRole)currentRole NS_SWIFT_NAME(rtcEngine(_:didClientRoleChangeFailed:currentRole:)); + +/** + * The statistics of the call when leave channel + * + * @param engine The engine kit + * @param stats The statistics of the call, including duration, sent bytes and received bytes + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLeaveChannelWithStats:(AgoraChannelStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:didLeaveChannelWith:)); + +#pragma mark Local user audio delegates +/** + * Event of the first audio frame is sent. + * + * @param engine The engine kit + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalAudioFramePublished:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstLocalAudioFramePublished:)); + +/** The statistics of the local audio stream. + + Same as [localAudioStatBlock]([AgoraRtcEngineKit localAudioStatBlock:]). The SDK updates the application on the statistics of the local audio stream once every two seconds. + + * @param engine The AgoraRtcEngineKit object. + * @param stats AgoraRtcLocalAudioStats + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localAudioStats:(AgoraRtcLocalAudioStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:localAudioStats:)); + +/** + * Event of local audio route changed + * + * @param engine The engine kit + * @param routing the current audio output routing + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didAudioRouteChanged:(AgoraAudioOutputRouting)routing NS_SWIFT_NAME(rtcEngine(_:didAudioRouteChanged:)); + +/** + * Event of finish audio mixing. + * + * @param engine The engine kit + */ +- (void)rtcEngineLocalAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineLocalAudioMixingDidFinish(_:)); + +/** Audio mixing state changed. + + * @param engine The AgoraRtcEngineKit object. + * @param state AgoraAudioMixingStateType + * @param reasonCode AgoraAudioMixingReasonType + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingStateChanged:(AgoraAudioMixingStateType)state + reasonCode:(AgoraAudioMixingReasonCode)reasonCode NS_SWIFT_NAME(rtcEngine(_:audioMixingStateChanged:reasonCode:)); + +/** + * @brief Reports current AudioMixing progress. + * + * The callback occurs once every one second during the playback and reports the current playback progress. + * @param position Current AudioMixing progress (millisecond). + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingPositionChanged:(NSInteger)position NS_SWIFT_NAME(rtcEngine(_:audioMixingPositionChanged:)); + +/** + * Event of finish audio effect. + * + * @param engine The engine kit + */ +- (void)rtcEngineDidAudioEffectFinish:(AgoraRtcEngineKit * _Nonnull)engine soundId:(int)soundId NS_SWIFT_NAME(rtcEngineDidAudioEffectFinish(_:soundId:)); + + +#pragma mark Local user video delegates +/** + * Event of camera opened + * + * @param engine The engine kit + */ +- (void)rtcEngineCameraDidReady:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineCameraDidReady(_:)); + +#if TARGET_OS_IPHONE +/** + * Event of camera focus position changed + * + * @param engine The engine kit + * @param rect The focus rect in local preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine cameraFocusDidChangedToRect:(CGRect)rect NS_SWIFT_NAME(rtcEngine(_:cameraFocusDidChangedTo:)); + +/** A camera exposure position changed. + + @param engine AgoraRtcEngineKit object + @param rect Exposure rectangle in the local preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine cameraExposureDidChangedToRect:(CGRect)rect NS_SWIFT_NAME(rtcEngine(_:cameraExposureDidChangedTo:)); + +#endif + +/** + * Event of camera stopped + * + * @param engine The engine kit + */ +- (void)rtcEngineVideoDidStop:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineVideoDidStop(_:)); + +/** Event of the first local video frame is published. + * @param engine The engine kit + * @param elapsed The elapsed time(ms) from the beginning of the session. + * + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed + sourceType:(AgoraVideoSourceType)source NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFramePublishedWithElapsed:sourceType:)); + +/** + * Event of the first local frame starts rendering on the screen. + * + * @param engine The engine kit + * @param size The size of local video stream + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFrameWithSize:(CGSize)size elapsed:(NSInteger)elapsed sourceType:(AgoraVideoSourceType)source NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFrameWith:elapsed:sourceType:)); + +/** + * The statistics of local video stream. Update every two seconds. + * + * @param engine The engine kit + * @param stats The statistics of local video, including sent bitrate, sent framerate + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats + sourceType:(AgoraVideoSourceType)source NS_SWIFT_NAME(rtcEngine(_:localVideoStats:sourceType:)); + +#pragma mark Remote user audio delegates + +/** + * The sdk reports the volume of a speaker. The interface is disable by default, and it could be enable by API "enableAudioVolumeIndication" + * + * @param engine The engine kit + * @param speakers AgoraRtcAudioVolumeInfo array + * @param totalVolume The total volume of speakers + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine reportAudioVolumeIndicationOfSpeakers:(NSArray * _Nonnull)speakers totalVolume:(NSInteger)totalVolume NS_SWIFT_NAME(rtcEngine(_:reportAudioVolumeIndicationOfSpeakers:totalVolume:)); + +/** + * Event of remote start audio mixing. + * + * @param engine The engine kit + */ +- (void)rtcEngineRemoteAudioMixingDidStart:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRemoteAudioMixingDidStart(_:)); + +/** + * Event of remote finish audio mixing. + * + * @param engine The engine kit + */ +- (void)rtcEngineRemoteAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRemoteAudioMixingDidFinish(_:)); + +/** + * The statistics of remote audio stream. Update every two seconds. + * + * @param engine The engine kit + * @param stats The statistics of audio video, including user id, delay, resolution, received bitrate, received framerate, audio stream type + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteAudioStats:(AgoraRtcRemoteAudioStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:remoteAudioStats:)); + +#pragma mark Remote user video delegates + +/** + * The statistics of remote video stream. Update every two seconds. + * + * @param engine The engine kit + * @param stats The statistics of remote video, including user id, delay, resolution, received bitrate, received framerate, video stream type + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStats:(AgoraRtcRemoteVideoStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:remoteVideoStats:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine rtmpStreamingChangedToState:(NSString * _Nonnull)url + state:(AgoraRtmpStreamingState)state + errCode:(AgoraRtmpStreamingErrorCode)errCode NS_SWIFT_NAME(rtcEngine(_:rtmpStreamingChangedToState:state:errCode:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine rtmpStreamingEventWithUrl:(NSString* _Nonnull)url eventCode:(AgoraRtmpStreamingEvent)eventCode NS_SWIFT_NAME(rtcEngine(_:rtmpStreamingEventWithUrl:eventCode:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamPublishedWithUrl:(NSString * _Nonnull)url errorCode:(AgoraErrorCode)errorCode NS_SWIFT_NAME(rtcEngine(_:streamPublishedWithUrl:errorCode:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamUnpublishedWithUrl:(NSString * _Nonnull)url NS_SWIFT_NAME(rtcEngine(_:streamUnpublishedWithUrl:)); + +- (void)rtcEngineTranscodingUpdated:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineTranscodingUpdated(_:)); + +#pragma mark Face Detection Delegate Methods +/**----------------------------------------------------------------------------- + * @name Face Detection Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** Reports the face detection result of the local user. (iOS only) + + **Since:** v3.0.1. + + Once you enable face detection by calling [enableFaceDetection]([AgoraRtcEngineKit enableFaceDetection:]), you can get the following information on the local user in real-time: + + - The width and height of the local video. + - The position of the human face in the local video. + - The distance between the human face and the device screen. This value is based on the fitting calculation of the local video size and the position of the human face. + + **Note** + + - If the SDK does not detect a face, it reduces the frequency of this callback to reduce power consumption on the local device. + - The SDK stops triggering this callback when a human face is in close proximity to the screen. + + @param engine AgoraRtcEngineKit object. + @param width The width (px) of the local video. + @param height The height (px) of the local video. + @param faces An AgoraFacePositionInfo array, which contains the information of the detected human face. + + The number of the AgoraFacePositionInfo array depends on the number of human faces detected. If the array length is 0, it means that no human face is detected. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine facePositionDidChangeWidth:(int)width previewHeight:(int)height faces:(NSArray* _Nullable)faces NS_SWIFT_NAME(rtcEngine(_:facePositionDidChangeWidth:previewHeight:faces:)); + +@end + +/* + +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + info:(NSString * _Nullable)info + userId:(NSString * _Nullable)userId NS_SWIFT_NAME(joinChannel(byToken:channelId:info:userId:)); + +- (int)setRemoteRenderModeWithUid:(NSString * _Nonnull)userId + mode:(AgoraVideoRenderMode)mode NS_SWIFT_NAME(setRemoteRenderModeWithUid(_:mode:)); + +- (int)switchView:(NSString * _Nonnull)userId1 + andAnother:(NSString * _Nonnull)userId2 NS_SWIFT_NAME(switchView(_:andAnother:)) __deprecated; + +- (int)muteRemoteAudioStream:(NSString * _Nonnull)userId mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteAudioStream(_:mute:)); + +- (int)setRemoteVideoStream:(NSString * _Nonnull)userId + type:(AgoraVideoStreamType)streamType NS_SWIFT_NAME(setRemoteVideoStream(_:type:)); +- (int)muteRemoteVideoStream:(NSString * _Nonnull)userId + mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteVideoStream(_:mute:)); + +- (void)setRemoteVideoRenderer:(id _Nullable)videoRenderer withUserId:(NSString * _Nonnull)userId NS_SWIFT_NAME(setRemoteVideoRenderer(_:withUserId:)); + +- (int)sendPublishingRequestToOwner:(NSString * _Nonnull)userId NS_SWIFT_NAME(sendPublishingRequestToOwner(_:)); +- (int)answerPublishingRequestOfUid:(NSString * _Nonnull)userId accepted:(bool)accepted NS_SWIFT_NAME(answerPublishingRequestOfUid(_:accepted:)); +- (int)sendUnpublishingRequestToUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(sendUnpublishingRequestToUid(_:)); + +- (id _Nullable)remoteVideoRendererOfUserId:(NSString * _Nonnull)userId NS_SWIFT_NAME(remoteVideoRendererOfUserId(_:)); +*/ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraConstants.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraConstants.h new file mode 100644 index 0000000..8ce5f7f --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraConstants.h @@ -0,0 +1,122 @@ +// +// AgoraConstants.h +// AgoraRtcEngineKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// +#import +#if TARGET_OS_IPHONE +#import +#elif TARGET_OS_MAC +#import +#endif + +/** The standard bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]). + + (Recommended) In a live broadcast, Agora recommends setting a larger bitrate to improve the video quality. When you choose AgoraVideoBitrateStandard, the bitrate value doubles in a live broadcast mode, and remains the same as in AgoraVideoProfile in a communication mode. + */ +extern NSInteger const AgoraVideoBitrateStandard; + +/** The compatible bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]). + + The bitrate in both the live broadcast and communication modes remain the same as in AgoraVideoProfile. + */ +extern NSInteger const AgoraVideoBitrateCompatible; + + +/** The min bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]). + + The min bitrate set to default value + */ +extern NSInteger const AgoraVideoDefaultMinBitrate; + +/** The min bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]). + + The min bitrate will be equal to bitrate + */ +extern NSInteger const AgoraVideoMinBitrateEqualToBitrate; + +/** + * set analyze duration for real time stream + * @example "setPlayerOption(AgoraRtcMediaPlayerRealTimeStreamAnalyzeDuration,1000000)" + */ +extern NSString* const AgoraRtcMediaPlayerRealTimeStreamAnalyzeDuration; + +/** + * make the player to enable audio or not + * @example "setPlayerOption(AgoraRtcMediaPlayerEnableAudio,0)" + */ +extern NSString* const AgoraRtcMediaPlayerEnableAudio; + +/** + * make the player to enable video or not + * @example "setPlayerOption(AgoraRtcMediaPlayerEnableVideo,0)" + */ +extern NSString* const AgoraRtcMediaPlayerEnableVideo; + +/** + * set the player enable to search metadata + * @example "setPlayerOption(AgoraRtcMediaPlayerEnableSearchMetadata,0)" + */ +extern NSString* const AgoraRtcMediaPlayerEnableSearchMetadata; + +/** 120 x 120 + */ +extern CGSize const AgoraVideoDimension120x120; +/** 160 x 120 + */ +extern CGSize const AgoraVideoDimension160x120; +/** 180 x 180 + */ +extern CGSize const AgoraVideoDimension180x180; +/** 240 x 180 + */ +extern CGSize const AgoraVideoDimension240x180; +/** 320 x 180 + */ +extern CGSize const AgoraVideoDimension320x180; +/** 240 x 240 + */ +extern CGSize const AgoraVideoDimension240x240; +/** 320 x 240 + */ +extern CGSize const AgoraVideoDimension320x240; +/** 424 x 240 + */ +extern CGSize const AgoraVideoDimension424x240; +/** 360 x 360 + */ +extern CGSize const AgoraVideoDimension360x360; +/** 480 x 360 + */ +extern CGSize const AgoraVideoDimension480x360; +/** 640 x 360 + */ +extern CGSize const AgoraVideoDimension640x360; +/** 480 x 480 + */ +extern CGSize const AgoraVideoDimension480x480; +/** 640 x 480 + */ +extern CGSize const AgoraVideoDimension640x480; +/** 840 x 480 + */ +extern CGSize const AgoraVideoDimension840x480; +/** 960 x 540 + */ +extern CGSize const AgoraVideoDimension960x540; +/** 960 x 720 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension960x720; +/** 1280 x 720 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension1280x720; +/** 1920 x 1080 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension1920x1080; +/** 25400 x 1440 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension2540x1440; +/** 3840 x 2160 (Depends on the hardware) + */ +extern CGSize const AgoraVideoDimension3840x2160; diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraEnumerates.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraEnumerates.h new file mode 100644 index 0000000..dca4410 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraEnumerates.h @@ -0,0 +1,3273 @@ +// +// AgoraEnumerates.h +// AgoraRtcEngineKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#import + +/** + * Warning code. + * + * Warning codes occur when the SDK encounters an error that may be recovered automatically. + * These are only notifications, and can generally be ignored. For example, when the SDK loses connection to the server, the SDK reports the AgoraWarningCodeOpenChannelTimeout(106) warning and tries to reconnect automatically. + */ +typedef NS_ENUM(NSInteger, AgoraWarningCode) { + /** 8: The specified view is invalid. Specify a view when using the video call function. */ + AgoraWarningCodeInvalidView = 8, + /** 16: Failed to initialize the video function, possibly caused by a lack of resources. The users cannot see the video while the voice communication is not affected. */ + AgoraWarningCodeInitVideo = 16, + /** 20: The request is pending, usually due to some module not being ready, and the SDK postpones processing the request. */ + AgoraWarningCodePending = 20, + /** 103: No channel resources are available. Maybe because the server cannot allocate any channel resource. */ + AgoraWarningCodeNoAvailableChannel = 103, + /** 104: A timeout occurs when looking up the channel. When joining a channel, the SDK looks up the specified channel. The warning usually occurs when the network condition is too poor for the SDK to connect to the server. */ + AgoraWarningCodeLookupChannelTimeout = 104, + /** 105: The server rejects the request to look up the channel. The server cannot process this request or the request is illegal. */ + AgoraWarningCodeLookupChannelRejected = 105, + /** 106: The server rejects the request to look up the channel. The server cannot process this request or the request is illegal. */ + AgoraWarningCodeOpenChannelTimeout = 106, + /** 107: The server rejects the request to open the channel. The server cannot process this request or the request is illegal. */ + AgoraWarningCodeOpenChannelRejected = 107, + /** 111: A timeout occurs when switching to the live video. */ + AgoraWarningCodeSwitchLiveVideoTimeout = 111, + /** 118: A timeout occurs when setting the client role in the live broadcast profile. */ + AgoraWarningCodeSetClientRoleTimeout = 118, + /** 119: The client role is unauthorized. */ + AgoraWarningCodeSetClientRoleNotAuthorized = 119, + /** 121: The ticket to open the channel is invalid. */ + AgoraWarningCodeOpenChannelInvalidTicket = 121, + /** 122: Try connecting to another server. */ + AgoraWarningCodeOpenChannelTryNextVos = 122, + /** 701: An error occurs in opening the audio mixing file. */ + AgoraWarningCodeAudioMixingOpenError = 701, + /** 1014: Audio Device Module: a warning occurs in the playback device. */ + AgoraWarningCodeAdmRuntimePlayoutWarning = 1014, + /** 1016: Audio Device Module: a warning occurs in the recording device. */ + AgoraWarningCodeAdmRuntimeRecordingWarning = 1016, + /** 1019: Audio Device Module: no valid audio data is collected. */ + AgoraWarningCodeAdmRecordAudioSilence = 1019, + /** 1020: Audio Device Module: a playback device fails. */ + AgoraWarningCodeAdmPlaybackMalfunction = 1020, + /** 1021: Audio Device Module: a recording device fails. */ + AgoraWarningCodeAdmRecordMalfunction = 1021, + /** 1025: Call is interrupted by system events such as phone call or Siri. */ + AgoraWarningCodeAdmInterruption = 1025, + /** 1031: Audio Device Module: the recorded audio is too low. */ + AgoraWarningCodeAdmRecordAudioLowlevel = 1031, + /** 1032: Audio Device Module: the playback audio is too low. */ + AgoraWarningCodeAdmPlayoutAudioLowlevel = 1032, + /** 1051: Audio Device Module: howling is detected. */ + AgoraWarningCodeApmHowling = 1051, + /** 1052: Audio Device Module: the device is in the glitch state. */ + AgoraWarningCodeAdmGlitchState = 1052, + /** 1053: Audio Device Module: the underlying audio settings have changed. */ + AgoraWarningCodeAdmImproperSettings = 1053, +}; + +/** + * Error code. + * + * Error codes occur when the SDK encounters an error that cannot be recovered automatically without any app intervention. + * For example, the SDK reports the \ref AgoraErrorCodeStartCall(1002) error if it fails to start a call. + */ +typedef NS_ENUM(NSInteger, AgoraErrorCode) { + /** 0: No error occurs. */ + AgoraErrorCodeNoError = 0, + /** 1: A general error occurs (no specified reason). */ + AgoraErrorCodeFailed = 1, + /** 2: An invalid parameter is used. For example, the specific channel name includes illegal characters. */ + AgoraErrorCodeInvalidArgument = 2, + /** + * 3: The SDK module is not ready. + * + * Possible solutions: + * - Check the audio device. + * - Check the completeness of the app. + * - Re-initialize the SDK. + */ + AgoraErrorCodeNotReady = 3, + /** 4: The current state of the SDK does not support this function. */ + AgoraErrorCodeNotSupported = 4, + /** 5: The request is rejected. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeRefused = 5, + /** 6: The buffer size is not big enough to store the returned data. */ + AgoraErrorCodeBufferTooSmall = 6, + /** 7: The SDK is not initialized before calling this method. */ + AgoraErrorCodeNotInitialized = 7, + /** 7: The state is invalid. */ + AgoraErrorCodeInvalidState = 8, + /** 9: No permission exists. Check if the user has granted access to the audio or video device. */ + AgoraErrorCodeNoPermission = 9, + /** 10: An API method timeout occurs. Some API methods require the SDK to return the execution result, and this error occurs if the request takes too long (over 10 seconds) for the SDK to process. */ + AgoraErrorCodeTimedOut = 10, + /** 11: The request is canceled. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeCanceled = 11, + /** 12: The method is called too often. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeTooOften = 12, + /** 13: The SDK fails to bind to the network socket. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeBindSocket = 13, + /** 14: The network is unavailable. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeNetDown = 14, + /** 15: No network buffers are available. This is for internal SDK use only, and is not returned to the app through any method or callback. */ + AgoraErrorCodeNoBufs = 15, + /** + * 17: The request to join the channel is rejected. + * + * Possible reasons: + * - The user is already in the channel, and still calls the API method to join the channel, for example `joinChannelByToken`. + * - The user tries joining the channel during the echo test. Please join the channel after the echo test ends. + */ + AgoraErrorCodeJoinChannelRejected = 17, + /** + * 18: The request to leave the channel is rejected. + * + * Possible reasons are: + * - The user left the channel and still calls the API method to leave the channel, for example, \ref AgoraRtcEngineKit.leaveChannel: leaveChannel. + * - The user has not joined the channel and calls the API method to leave the channel. + */ + AgoraErrorCodeLeaveChannelRejected = 18, + /** 19: The resources are occupied and cannot be used. */ + AgoraErrorCodeAlreadyInUse = 19, + /** 20: The SDK gave up the request due to too many requests. */ + AgoraErrorCodeAbort = 20, + /** 21: In Windows, specific firewall settings cause the SDK to fail to initialize and crash. */ + AgoraErrorCodeInitNetEngine = 21, + /** 22: The app uses too much of the system resources and the SDK fails to allocate the resources. */ + AgoraErrorCodeResourceLimited = 22, + /** 101: The specified App ID is invalid. Please try to rejoin the channel with a valid App ID.*/ + AgoraErrorCodeInvalidAppId = 101, + /** 102: The specified channel name is invalid. Please try to rejoin the channel with a valid channel name. */ + AgoraErrorCodeInvalidChannelId = 102, + /** 103: Fails to get server resources in the specified region. Please try to specify another region when calling sharedEngine.*/ + AgoraErrorCodeNoServerResources = 103, + /** + * 109: The token expired. + * + * Possible reasons are: + * - Authorized Timestamp expired: The timestamp is represented by the number of seconds elapsed since 1/1/1970. The user can use the token to access the Agora service within 24 hours after the token is generated. If the user does not access the Agora service after 24 hours, this token is no longer valid. + * - Call Expiration Timestamp expired: The timestamp is the exact time when a user can no longer use the Agora service (for example, when a user is forced to leave an ongoing call). When a value is set for the Call Expiration Timestamp, it does not mean that the token will expire, but that the user will be banned from the channel. + */ + AgoraErrorCodeTokenExpired = 109, + /** + * 110: The token is invalid. + * + * Possible reasons are: + * - The App Certificate for the project is enabled in Console, but the user is using the App ID. Once the App Certificate is enabled, the user must use a token. + * - The uid is mandatory, and users must set the same uid as the one set in the `joinChannelByToken` method. + */ + AgoraErrorCodeInvalidToken = 110, + /** 111: The Internet connection is interrupted. This applies to the Agora Web SDK only. */ + AgoraErrorCodeConnectionInterrupted = 111, + /** 112: The Internet connection is lost. This applies to the Agora Web SDK only. */ + AgoraErrorCodeConnectionLost = 112, + /** 113: The user is not in the channel when calling the `sendStreamMessage` or `getUserInfoByUserAccount` method. */ + AgoraErrorCodeNotInChannel = 113, + /** 114: The size of the sent data is over 1024 bytes when the user calls the `sendStreamMessage` method. */ + AgoraErrorCodeSizeTooLarge = 114, + /** 115: The bitrate of the sent data exceeds the limit of 6 Kbps when the user calls the `sendStreamMessage` method. */ + AgoraErrorCodeBitrateLimit = 115, + /** 116: Too many data streams (over five streams) are created when the user calls the `createDataStream` method. */ + AgoraErrorCodeTooManyDataStreams = 116, + /** 117: A timeout occurs for the data stream transmission.*/ + AgoraErrorCodeStreamMessageTimeout = 117, + /** 119: Switching the user role fails. Please try to rejoin the channel.*/ + AgoraErrorCodeSetClientRoleNotAuthorzed = 119, + /** 120: Decryption fails. The user may have used a different encryption password to join the channel. Check your settings or try rejoining the channel. */ + AgoraErrorCodeDecryptionFailed = 120, + /** 121: The user ID is invalid.*/ + AgoraErrorCodeInvalidUserId = 121, + /** 123: The app is banned by the server.*/ + AgoraErrorCodeClientIsBannedByServer = 123, + /** 130: The encrypted stream is not allowed to publish. */ + AgoraErrorCodeEncryptedStreamNotAllowedPublish = 130, + /** 134: The user account is invalid. */ + AgoraErrorCodeInvalidUserAccount = 134, + /** 135: When encryption enabled, a failure occurs when verifying the server's certification. */ + AgoraErrorCodeCertVerifyFailure = 135, + /** Stream publishing failed. */ + AgoraErrorCodePublishFailed = 150, + /** 151: CDN related errors. Remove the original URL address and add a new one by calling the [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:]) and [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) methods. */ + AgoraErrorCodePublishStreamCDNError = 151, + /** 157: The extension library is not integrated, such as the library for enabling deep-learning noise reduction. */ + AgoraErrorCodeModuleNotFound = 157, + /** 1001: Fails to load the media engine. */ + AgoraErrorCodeLoadMediaEngine = 1001, + /** 1002: Fails to start the call after enabling the media engine. */ + AgoraErrorCodeStartCall = 1002, + /** 1003: Fails to start the camera. */ + AgoraErrorCodeStartCamera = 1003, + /** 1004: Fails to start the video rendering module. */ + AgoraErrorCodeStartVideoRender = 1004, + /** 1005: A general error occurs in the Audio Device Module (the reason is not classified specifically). Check if the audio device is used by another app, or try rejoining the channel. */ + AgoraErrorCodeAdmGeneralError = 1005, + /** 1006: Audio Device Module: An error occurs in using the Java resources. */ + AgoraErrorCodeAdmJavaResource = 1006, + /** 1007: Audio Device Module: An error occurs in setting the sampling frequency. */ + AgoraErrorCodeAdmSampleRate = 1007, + /** 1008: Audio Device Module: An error occurs in initializing the playback device. */ + AgoraErrorCodeAdmInitPlayout = 1008, + /** 1009: Audio Device Module: An error occurs in starting the playback device. */ + AgoraErrorCodeAdmStartPlayout = 1009, + /** 1010: Audio Device Module: An error occurs in stopping the playback device. */ + AgoraErrorCodeAdmStopPlayout = 1010, + /** 1011: Audio Device Module: An error occurs in initializing the recording device. */ + AgoraErrorCodeAdmInitRecording = 1011, + /** 1012: Audio Device Module: An error occurs in starting the recording device. */ + AgoraErrorCodeAdmStartRecording = 1012, + /** 1013: Audio Device Module: An error occurs in stopping the recording device. */ + AgoraErrorCodeAdmStopRecording = 1013, + /** 1015: Audio Device Module: A playback error occurs. Check your playback device, or try rejoining the channel. */ + AgoraErrorCodeAdmRuntimePlayoutError = 1015, + /** 1017: Audio Device Module: A recording error occurs. */ + AgoraErrorCodeAdmRuntimeRecordingError = 1017, + /** 1018: Audio Device Module: Fails to record. */ + AgoraErrorCodeAdmRecordAudioFailed = 1018, + /** 1020: Audio Device Module: Abnormal audio playback frequency. */ + AgoraErrorCodeAdmPlayAbnormalFrequency = 1020, + /** 1021: Audio Device Module: Abnormal audio recording frequency. */ + AgoraErrorCodeAdmRecordAbnormalFrequency = 1021, + /** 1022: Audio Device Module: An error occurs in initializing the loopback device. */ + AgoraErrorCodeAdmInitLoopback = 1022, + /** 1023: Audio Device Module: An error occurs in starting the loopback device. */ + AgoraErrorCodeAdmStartLoopback = 1023, + /** 1359: No recording device exists. */ + AgoraErrorCodeAdmNoRecordingDevice = 1359, + /** 1360: No playback device exists. */ + AgoraErrorCodeAdmNoPlayoutDevice = 1360, + /** 1501: Video Device Module: The camera is unauthorized. */ + AgoraErrorCodeVdmCameraNotAuthorized = 1501, + /** 1600: Video Device Module: An unknown error occurs. */ + AgoraErrorCodeVcmUnknownError = 1600, + /** 1601: Video Device Module: An error occurs in initializing the video encoder. */ + AgoraErrorCodeVcmEncoderInitError = 1601, + /** 1602: Video Device Module: An error occurs in video encoding. */ + AgoraErrorCodeVcmEncoderEncodeError = 1602, + /** @deprecated + * 1603: Video Device Module: An error occurs in setting the video encoder. + */ + AgoraErrorCodeVcmEncoderSetError __deprecated = 1603, +}; + +/** @deprecated + Video Profile */ +typedef NS_ENUM(NSInteger, AgoraVideoProfile) { + /** Invalid profile */ + AgoraVideoProfileInvalid = -1, + /** 160 x 120 @ 15 fps */ + AgoraVideoProfileLandscape120P = 0, + /** 120 x 120 @ 15 fps */ + AgoraVideoProfileLandscape120P_3 = 2, // iOS + /** 320 x 180 @ 15 fps */ + AgoraVideoProfileLandscape180P = 10, // iOS + /** 180 x 180 @ 15 fps */ + AgoraVideoProfileLandscape180P_3 = 12, // iOS + /** 240 x 180 @ 15 fps */ + AgoraVideoProfileLandscape180P_4 = 13, // iOS + /** 320 x 240 @ 15 fps */ + AgoraVideoProfileLandscape240P = 20, + /** 240 x 240 @ 15 fps */ + AgoraVideoProfileLandscape240P_3 = 22, //iOS + /** 424 x 240 @ 15 fps */ + AgoraVideoProfileLandscape240P_4 = 23, // iOS + /** 640 x 360 @ 15 fps */ + AgoraVideoProfileLandscape360P = 30, + /** 360 x 360 @ 15 fps */ + AgoraVideoProfileLandscape360P_3 = 32, // iOS + /** 640 x 360 @ 30 fps */ + AgoraVideoProfileLandscape360P_4 = 33, + /** 360 x 360 @ 30 fps */ + AgoraVideoProfileLandscape360P_6 = 35, + /** 480 x 360 @ 15 fps */ + AgoraVideoProfileLandscape360P_7 = 36, + /** 480 x 360 @ 30 fps */ + AgoraVideoProfileLandscape360P_8 = 37, + /** 640 x 360 @ 15 fps */ + AgoraVideoProfileLandscape360P_9 = 38, + /** 640 x 360 @ 24 fps */ + AgoraVideoProfileLandscape360P_10 = 39, + /** 640 x 360 @ 24 fps */ + AgoraVideoProfileLandscape360P_11 = 100, + /** 640 x 480 @ 15 fps */ + AgoraVideoProfileLandscape480P = 40, + /** 480 x 480 @ 15 fps */ + AgoraVideoProfileLandscape480P_3 = 42, // iOS + /** 640 x 480 @ 30 fps */ + AgoraVideoProfileLandscape480P_4 = 43, + /** 480 x 480 @ 30 fps */ + AgoraVideoProfileLandscape480P_6 = 45, + /** 848 x 480 @ 15 fps */ + AgoraVideoProfileLandscape480P_8 = 47, + /** 848 x 480 @ 30 fps */ + AgoraVideoProfileLandscape480P_9 = 48, + /** 640 x 480 @ 10 fps */ + AgoraVideoProfileLandscape480P_10 = 49, + /** 1280 x 720 @ 15 fps */ + AgoraVideoProfileLandscape720P = 50, + /** 1280 x 720 @ 30 fps */ + AgoraVideoProfileLandscape720P_3 = 52, + /** 960 x 720 @ 15 fps */ + AgoraVideoProfileLandscape720P_5 = 54, + /** 960 x 720 @ 30 fps */ + AgoraVideoProfileLandscape720P_6 = 55, + /** 1920 x 1080 @ 15 fps */ + AgoraVideoProfileLandscape1080P = 60, + /** 1920 x 1080 @ 30 fps */ + AgoraVideoProfileLandscape1080P_3 = 62, + /** 1920 x 1080 @ 60 fps */ + AgoraVideoProfileLandscape1080P_5 = 64, + /** 2560 x 1440 @ 30 fps */ + AgoraVideoProfileLandscape1440P = 66, + /** 2560 x 1440 @ 60 fps */ + AgoraVideoProfileLandscape1440P_2 = 67, + /** 3840 x 2160 @ 30 fps */ + AgoraVideoProfileLandscape4K = 70, + /** 3840 x 2160 @ 60 fps */ + AgoraVideoProfileLandscape4K_3 = 72, + /** 120 x 160 @ 15 fps */ + AgoraVideoProfilePortrait120P = 1000, + /** 120 x 120 @ 15 fps */ + AgoraVideoProfilePortrait120P_3 = 1002, //iOS + /** 180 x 320 @ 15 fps */ + AgoraVideoProfilePortrait180P = 1010, // iOS + /** 180 x 180 @ 15 fps */ + AgoraVideoProfilePortrait180P_3 = 1012, // iOS + /** 180 x 240 @ 15 fps */ + AgoraVideoProfilePortrait180P_4 = 1013, // iOS + /** 240 x 320 @ 15 fps */ + AgoraVideoProfilePortrait240P = 1020, + /** 240 x 240 @ 15 fps */ + AgoraVideoProfilePortrait240P_3 = 1022, // iOS + /** 240 x 424 @ 15 fps */ + AgoraVideoProfilePortrait240P_4 = 1023, + /** 360 x 640 @ 15 fps */ + AgoraVideoProfilePortrait360P = 1030, // iOS + /** 360 x 360 @ 15 fps */ + AgoraVideoProfilePortrait360P_3 = 1032, // iOS + /** 360 x 640 @ 30 fps */ + AgoraVideoProfilePortrait360P_4 = 1033, + /** 360 x 360 @ 30 fps */ + AgoraVideoProfilePortrait360P_6 = 1035, + /** 360 x 480 @ 15 fps */ + AgoraVideoProfilePortrait360P_7 = 1036, + /** 360 x 480 @ 30 fps */ + AgoraVideoProfilePortrait360P_8 = 1037, + /** 360 x 640 @ 15 fps */ + AgoraVideoProfilePortrait360P_9 = 1038, + /** 360 x 640 @ 24 fps */ + AgoraVideoProfilePortrait360P_10 = 1039, + /** 360 x 640 @ 24 fps */ + AgoraVideoProfilePortrait360P_11 = 1100, + /** 480 x 640 @ 15 fps */ + AgoraVideoProfilePortrait480P = 1040, + /** 480 x 480 @ 15 fps */ + AgoraVideoProfilePortrait480P_3 = 1042, // iOS + /** 480 x 640 @ 30 fps */ + AgoraVideoProfilePortrait480P_4 = 1043, + /** 480 x 480 @ 30 fps */ + AgoraVideoProfilePortrait480P_6 = 1045, + /** 480 x 848 @ 15 fps */ + AgoraVideoProfilePortrait480P_8 = 1047, + /** 480 x 848 @ 30 fps */ + AgoraVideoProfilePortrait480P_9 = 1048, + /** 480 x 640 @ 10 fps */ + AgoraVideoProfilePortrait480P_10 = 1049, + /** 720 x 1280 @ 15 fps */ + AgoraVideoProfilePortrait720P = 1050, + /** 720 x 1280 @ 30 fps */ + AgoraVideoProfilePortrait720P_3 = 1052, + /** 720 x 960 @ 15 fps */ + AgoraVideoProfilePortrait720P_5 = 1054, + /** 720 x 960 @ 30 fps */ + AgoraVideoProfilePortrait720P_6 = 1055, + /** 1080 x 1920 @ 15 fps */ + AgoraVideoProfilePortrait1080P = 1060, // macOS + /** 1080 x 1920 @ 30 fps */ + AgoraVideoProfilePortrait1080P_3 = 1062, // macOS + /** 1080 x 1920 @ 60 fps */ + AgoraVideoProfilePortrait1080P_5 = 1064, // macOS + /** 1440 x 2560 @ 30 fps */ + AgoraVideoProfilePortrait1440P = 1066, // macOS + /** 1440 x 2560 @ 60 fps */ + AgoraVideoProfilePortrait1440P_2 = 1067, // macOS + /** 2160 x 3840 @ 30 fps */ + AgoraVideoProfilePortrait4K = 1070, // macOS + /** 2160 x 3840 @ 60 fps */ + AgoraVideoProfilePortrait4K_3 = 1072, // macOS + /** Default 640 x 360 @ 15 fps */ + AgoraVideoProfileDEFAULT = AgoraVideoProfileLandscape360P, +}; + +typedef NS_ENUM(NSInteger, AgoraVideoCodecCapabilityLevel) { + AgoraVideoCodecCapabilityLevelUnspecified = -1, + AgoraVideoCodecCapabilityLevelBasicSupport = 5, + AgoraVideoCodecCapabilityLevel1080p30fps = 10, + AgoraVideoCodecCapabilityLevel1080p60fps = 20, + AgoraVideoCodecCapabilityLevel2k30fps = 23, + AgoraVideoCodecCapabilityLevel2k60fps = 26, + AgoraVideoCodecCapabilityLevel4k60fps = 30, +}; + +typedef NS_ENUM(NSInteger, AgoraVideoCodecType) { + AgoraVideoCodecTypeVP8 = 1, + AgoraVideoCodecTypeH264 = 2, + AgoraVideoCodecTypeH265 = 3, + AgoraVideoCodecTypeVP9 = 5, + AgoraVideoCodecTypeGeneric = 6, + AgoraVideoCodecTypeGenericH264 = 7, + AgoraVideoCodecTypeGenericJpeg = 20, +}; + +typedef NS_ENUM(NSInteger, AgoraVideoHwEncoderAccelerating) { + AgoraVideoHwEncoderSoftware = 0, + AgoraVideoHwEncoderHardware = 1, +}; + +typedef NS_ENUM(NSInteger, AgoraVideoFrameOrientation) { + AgoraVideoFrameOrientation0 = 0, + AgoraVideoFrameOrientation90 = 90, + AgoraVideoFrameOrientation180 = 180, + AgoraVideoFrameOrientation270 = 270, +}; + +/** The video codec type of the output video stream. + + @since v3.2.0 + */ +typedef NS_ENUM(NSInteger, AgoraVideoCodecTypeForStream) { + /** 1: (Default) H.264 */ + AgoraVideoCodecTypeH264ForStream = 1, + /** 2: H.265 */ + AgoraVideoCodecTypeH265ForStream = 2, +}; + +/** Video frame rate */ +typedef NS_ENUM(NSInteger, AgoraVideoFrameRate) { + /** 1 fps */ + AgoraVideoFrameRateFps1 = 1, + /** 7 fps */ + AgoraVideoFrameRateFps7 = 7, + /** 10 fps */ + AgoraVideoFrameRateFps10 = 10, + /** 15 fps */ + AgoraVideoFrameRateFps15 = 15, + /** 24 fps */ + AgoraVideoFrameRateFps24 = 24, + /** 30 fps */ + AgoraVideoFrameRateFps30 = 30, + /** 60 fps */ + AgoraVideoFrameRateFps60 = 60, +}; + +/** Video output orientation mode + + Note: When a custom video source is used, if you set AgoraVideoOutputOrientationMode as AgoraVideoOutputOrientationModeFixedLandscape(1) or AgoraVideoOutputOrientationModeFixedPortrait(2), when the rotated video image has a different orientation than the specified output orientation, the video encoder will first crop it and then encode it. + */ +typedef NS_ENUM(NSInteger, AgoraVideoOutputOrientationMode) { + /** Adaptive mode (Default). + + The video encoder adapts to the orientation mode of the video input device. + + - If the width of the captured video from the SDK is larger than the height, the video sent out by the encoder is in landscape mode. The encoder also sends out the rotational information of the video, and the receiving end will rotate the received video based on the rotational information. + - When a custom video source is used, the output video from the encoder inherits the orientation of the original video. If the original video is in portrait mode, the output video from the encoder is also in portrait mode. The encoder also sends out the rotational information of the video to the receiver. + */ + AgoraVideoOutputOrientationModeAdaptative = 0, + /** Landscape mode. + + The video encoder always sends out the video in landscape mode. The original video is rotated before being sent out and the rotational information is therefore 0. This mode applies to scenarios involving CDN streaming. + */ + AgoraVideoOutputOrientationModeFixedLandscape = 1, + /** Portrait mode. + + The video encoder always sends out the video in portrait mode. The original video is rotated before being sent out and the rotational information is therefore 0. This mode applies to scenarios involving CDN streaming. + */ + AgoraVideoOutputOrientationModeFixedPortrait = 2, +}; + +/** + * The channel profile. + */ +typedef NS_ENUM(NSInteger, AgoraChannelProfile) { + /** + * 0: Communication. + * + * This profile prioritizes smoothness and applies to the one-to-one scenario. + */ + AgoraChannelProfileCommunication = 0, + /** + * 1: (Default) Live Broadcast. + * + * This profile prioritizes supporting a large audience in a live broadcast channel. + */ + AgoraChannelProfileLiveBroadcasting = 1, + /** + * @deprecated + * 2: Gaming. + * + */ + AgoraChannelProfileGame __deprecated = 2, + /** + * @deprecated + * 3: Cloud Gaming. + * + */ + AgoraChannelProfileCloudGaming __deprecated = 3, + + /** + * @deprecated + * 4:1-to-1 communication. + */ + AgoraChannelProfileCommunication_1v1 __deprecated = 4, +}; + +/** Client role. */ +typedef NS_ENUM(NSInteger, AgoraClientRole) { + /** Broadcaster */ + AgoraClientRoleBroadcaster = 1, + /** Audience */ + AgoraClientRoleAudience = 2, +}; + +/** Audience latency levels in broadcaster mode. */ +typedef NS_ENUM(NSInteger, AgoraAudienceLatencyLevelType) { + /** 1: Low latency. A low latency audience's jitter buffer is 1.2 second. */ + AgoraAudienceLatencyLevelLowLatency = 1, + /** 2: Default Ultra low latency. An ultra low latency audience's jitter buffer is 0.5 second. */ + AgoraAudienceLatencyLevelUltraLowLatency = 2, +}; + +/** The brightness level of the video image captured by the local camera. */ +typedef NS_ENUM(NSInteger, AgoraCaptureBrightnessLevelType) { + /** -1: The SDK does not detect the brightness level of the video image. + Wait a few seconds to get the brightness level in the next callback. + */ + AgoraCaptureBrightnessLevelInvalid = -1, + /** 0: The brightness level of the video image is normal. + */ + AgoraCaptureBrightnessLevelNormal = 0, + /** 1: The brightness level of the video image is too bright. + */ + AgoraCaptureBrightnessLevelBright = 1, + /** 2: The brightness level of the video image is too dark. + */ + AgoraCaptureBrightnessLevelDark = 2, +} NS_SWIFT_NAME(AgoraCaptureBrightnessLevelType); + +/** Media type */ +typedef NS_ENUM(NSInteger, AgoraMediaType) { + /** No audio and video */ + AgoraMediaTypeNone = 0, + /** Audio only */ + AgoraMediaTypeAudioOnly = 1, + /** Video only */ + AgoraMediaTypeVideoOnly = 2, + /** Audio and video */ + AgoraMediaTypeAudioAndVideo = 3, +}; + + +/** Encryption mode */ +typedef NS_ENUM(NSInteger, AgoraEncryptionMode) { + /** 128-bit AES encryption, XTS mode. */ + AgoraEncryptionModeAES128XTS = 1, + /** 128-bit AES encryption, ECB mode. */ + AgoraEncryptionModeAES128ECB = 2, + /** 256-bit AES encryption, XTS mode. */ + AgoraEncryptionModeAES256XTS = 3, + /** 128-bit SM4 encryption, ECB mode. */ + AgoraEncryptionModeSM4128ECB = 4, + /** 128-bit AES encryption, GCM mode. */ + AgoraEncryptionModeAES128GCM = 5, + /** 256-bit AES encryption, GCM mode. */ + AgoraEncryptionModeAES256GCM = 6, + /** 128-bit AES encryption, GCM mode, with KDF salt */ + AgoraEncryptionModeAES128GCM2 = 7, + /** 256-bit AES encryption, GCM mode, with KDF salt */ + AgoraEncryptionModeAES256GCM2 = 8, + /** Enumerator boundary */ + AgoraEncryptionModeEnd, +}; + +/** The cloud proxy type. + */ +typedef NS_ENUM(NSUInteger, AgoraCloudProxyType) { + /** Do not use the cloud proxy. + */ + AgoraNoneProxy = 0, + /** The cloud proxy for the UDP protocol. + */ + AgoraUdpProxy = 1, + /** The cloud proxy for the TCP (encrypted) protocol. + */ + AgoraTcpProxy = 2, +} NS_SWIFT_NAME(AgoraCloudProxyType); + +/** Reason for the user being offline */ +typedef NS_ENUM(NSUInteger, AgoraUserOfflineReason) { + /** A user has quit the call. */ + AgoraUserOfflineReasonQuit = 0, + /** The SDK timed out and the user dropped offline because it has not received any data package within a certain period of time. If a user quits the call and the message is not passed to the SDK (due to an unreliable channel), the SDK assumes the event has timed out. */ + AgoraUserOfflineReasonDropped = 1, + /** User switched to an audience */ + AgoraUserOfflineReasonBecomeAudience = 2, +}; + +/** Status of importing an external video stream in a live broadcast */ +typedef NS_ENUM(NSUInteger, AgoraInjectStreamStatus) { + /** The external video stream imported successfully. */ + AgoraInjectStreamStatusStartSuccess = 0, + /** The external video stream already exists. */ + AgoraInjectStreamStatusStartAlreadyExists = 1, + /** The external video stream import is unauthorized */ + AgoraInjectStreamStatusStartUnauthorized = 2, + /** Import external video stream timeout. */ + AgoraInjectStreamStatusStartTimedout = 3, + /** The external video stream failed to import. */ + AgoraInjectStreamStatusStartFailed = 4, + /** The xternal video stream imports successfully. */ + AgoraInjectStreamStatusStopSuccess = 5, + /** No external video stream is found. */ + AgoraInjectStreamStatusStopNotFound = 6, + /** The external video stream is stopped from being unauthorized. */ + AgoraInjectStreamStatusStopUnauthorized = 7, + /** Importing the external video stream timeout. */ + AgoraInjectStreamStatusStopTimedout = 8, + /** Importing the external video stream failed. */ + AgoraInjectStreamStatusStopFailed = 9, + /** The external video stream is broken. */ + AgoraInjectStreamStatusBroken = 10, +}; + +/** Output log filter level */ +typedef NS_ENUM(NSUInteger, AgoraLogFilter) { + /** Do not output any log information. */ + AgoraLogFilterOff = 0, + /** Output all API log information */ + AgoraLogFilterDebug = 0x080f, + /** Output CRITICAL, ERROR, WARNING, and INFO level log information. */ + AgoraLogFilterInfo = 0x000f, + /** Outputs CRITICAL, ERROR, and WARNING level log information. */ + AgoraLogFilterWarning = 0x000e, + /** Outputs CRITICAL and ERROR level log information */ + AgoraLogFilterError = 0x000c, + /** Outputs CRITICAL level log information. */ + AgoraLogFilterCritical = 0x0008, +}; + +/** Audio recording quality */ +typedef NS_ENUM(NSInteger, AgoraAudioRecordingQuality) { + /** Low quality, file size around 1.2 MB after 10 minutes of recording. */ + AgoraAudioRecordingQualityLow = 0, + /** Medium quality, file size around 2 MB after 10 minutes of recording. */ + AgoraAudioRecordingQualityMedium = 1, + /** High quality, file size around 3.75 MB after 10 minutes of recording. */ + AgoraAudioRecordingQualityHigh = 2, + /** Ultra high quality, file size around 7.5 after 10 minutes of recording. */ + AgoraAudioRecordingQualityUltraHigh = 3, +}; + +/** The audio file record type. */ +typedef NS_ENUM(NSInteger, AgoraAudioFileRecordingType) { + /** mic audio file recording. */ + AgoraAudioFileRecordingTypeMic = 1, + /** playback audio file recording. */ + AgoraAudioFileRecordingTypePlayback = 2, + /** mixed audio file recording. */ + AgoraAudioFileRecordingTypeMixed = 3, + AgoraAudioFileRecordingTypePublish = 4, +}; + +/** The encoded audio frame observer position. */ +typedef NS_ENUM(NSInteger, AgoraAudioEncodedFrameDelegatePosition) { + /** mic audio file recording. */ + AgoraAudioEncodedFrameObserverPositionRecord = 1, + /** playback audio file recording. */ + AgoraAudioEncodedFrameObserverPositionPlayback = 2, + /** mixed audio file recording. */ + AgoraAudioEncodedFrameObserverPositionMixed = 3, + /** publish audio file recording. */ + AgoraAudioEncodedFrameObserverPositionPublish = 4, +}; + +/** The codec type of audio */ +typedef NS_ENUM(NSInteger, AgoraAudioCodecType) { + AgoraAudioCodecTypeOPUS = 1, + AgoraAudioCodecTypeAACLC = 8, + AgoraAudioCodecTypeHEAAC = 9, + AgoraAudioCodecTypeHEAAC2 = 11, +}; +/** the audio encoding type of audio encoded frame delegate */ +typedef NS_ENUM(NSInteger, AgoraAudioEncodingType) { + /** codecType AAC; sampleRate 16000; quality low which around 1.2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC16000Low = 0x010101, + /** codecType AAC; sampleRate 16000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC16000Medium = 0x010102, + /** codecType AAC; sampleRate 32000; quality low which around 1.2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC32000Low = 0x010201, + /** codecType AAC; sampleRate 32000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC32000Medium = 0x010202, + /** codecType AAC; sampleRate 32000; quality high which around 3.5 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC32000High = 0x010203, + /** codecType AAC; sampleRate 48000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC48000Medium = 0x010302, + /** codecType AAC; sampleRate 48000; quality high which around 3.5 MB after 10 minutes */ + AgoraAudioEncodingTypeAAC48000High = 0x010303, + /** codecType OPUS; sampleRate 16000; quality low which around 1.2 MB after 10 minutes */ + AgoraAudioEncodingTypeOPUS16000Low = 0x020101, + /** codecType OPUS; sampleRate 16000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeOPUS6000Medium = 0x020102, + /** codecType OPUS; sampleRate 48000; quality medium which around 2 MB after 10 minutes */ + AgoraAudioEncodingTypeOPUS48000Medium = 0x020302, + /** codecType OPUS; sampleRate 48000; quality high which around 3.5 MB after 10 minutes */ + AgoraAudioEncodingTypeOPUS48000High = 0x020303, +}; + +/** Video stream lifecyle of CDN Live. */ +typedef NS_ENUM(NSInteger, AgoraRtmpStreamLifeCycle) { + /** Bound to the channel lifecycle. */ + AgoraRtmpStreamLifeCycleBindToChannel = 1, + /** Bound to the owner of the RTMP stream. */ + AgoraRtmpStreamLifeCycleBindToOwner = 2, +}; + +/** Network quality */ +typedef NS_ENUM(NSUInteger, AgoraNetworkQuality) { + /** The network quality is unknown. */ + AgoraNetworkQualityUnknown = 0, + /** The network quality is excellent. */ + AgoraNetworkQualityExcellent = 1, + /** The network quality is quite good, but the bitrate may be slightly lower than excellent. */ + AgoraNetworkQualityGood = 2, + /** Users can feel the communication slightly impaired. */ + AgoraNetworkQualityPoor = 3, + /** Users can communicate only not very smoothly. */ + AgoraNetworkQualityBad = 4, + /** The network is so bad that users can hardly communicate. */ + AgoraNetworkQualityVBad = 5, + /** The network is down and users cannot communicate at all. */ + AgoraNetworkQualityDown = 6, + /** Users cannot detect the network quality. (Not in use.) */ + AgoraNetworkQualityUnsupported = 7, + /** Detecting the network quality. */ + AgoraNetworkQualityDetecting = 8, +}; + +/** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. + */ +typedef NS_ENUM(NSUInteger, AgoraExperienceQuality) { + /** QoE of the local user is good. */ + AgoraExperienceQualityGood = 0, + /** QoE of the local user is poor. */ + AgoraExperienceQualityBad = 1, +}; + +/** + * The reason for poor QoE of the local user when receiving a remote audio stream. + * + */ +typedef NS_ENUM(NSUInteger, AgoraExperiencePoorReason) { + /** 0: No reason, indicating good QoE of the local user. + */ + AgoraExperiencePoorReasonNone = 0, + /** 1: The remote user's network quality is poor. + */ + AgoraExperiencePoorReasonRemoteNetworkQualityPoor = 1, + /** 2: The local user's network quality is poor. + */ + AgoraExperiencePoorReasonLocalNetworkQualityPoor = 2, + /** 4: The local user's Wi-Fi or mobile network signal is weak. + */ + AgoraExperiencePoorReasonWirelessSignalPoor = 4, + /** 8: The local user enables both Wi-Fi and bluetooth, and their signals interfere with each other. + * As a result, audio transmission quality is undermined. + */ + AgoraExperiencePoorReasonWifiBluetoothCoexist = 8, +}; + +/** + * The state of the probe test. + */ +typedef NS_ENUM(NSUInteger, AgoraLastmileProbeResultState) { + /** + * 1: The last-mile network probe test is complete. + */ + AgoraLastmileProbeResultComplete = 1, + /** + * 2: The last-mile network probe test is incomplete and the bandwidth estimation is not available, probably due to limited test resources. + */ + AgoraLastmileProbeResultIncompleteNoBwe = 2, + /** + * 3: The last-mile network probe test is not carried out, probably due to poor network conditions. + */ + AgoraLastmileProbeResultUnavailable = 3, +}; + +typedef NS_ENUM(NSInteger, AgoraUploadErrorReason) { + AgoraUploadErrorReasonSuccess = 0, + AgoraUploadErrorReasonNetError = 1, + AgoraUploadErrorReasonServerError = 2, +}; + +/** Video stream type */ +typedef NS_ENUM(NSInteger, AgoraVideoStreamType) { + /** High-video stream */ + AgoraVideoStreamTypeHigh = 0, + /** Low-video stream */ + AgoraVideoStreamTypeLow = 1, +}; + +/** Quality change of the local video in terms of target frame rate and target bit rate since last count. */ +typedef NS_ENUM(NSInteger, AgoraVideoQualityAdaptIndication) { + /** The quality of the local video stays the same. */ + AgoraVideoQualityAdaptNone = 0, + /** The quality improves because the network bandwidth increases. */ + AgoraVideoQualityAdaptUpBandwidth = 1, + /** The quality worsens because the network bandwidth decreases. */ + AgoraVideoQualityAdaptDownBandwidth = 2, +} NS_SWIFT_NAME(AgoraVideoQualityAdaptIndication); + +/** Video display mode */ +typedef NS_ENUM(NSUInteger, AgoraVideoRenderMode) { + /** Hidden(1): Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents. */ + AgoraVideoRenderModeHidden = 1, + + /** Fit(2): Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black. */ + AgoraVideoRenderModeFit = 2, + + /** @deprecated + Adaptive(3):This mode is obsolete. + */ + AgoraVideoRenderModeAdaptive __deprecated_enum_msg("AgoraVideoRenderModeAdaptive is deprecated.") = 3, +}; + +/** Video codec profile type */ +typedef NS_ENUM(NSInteger, AgoraVideoCodecProfileType) { + /** Baseline video codec profile */ + AgoraVideoCodecProfileTypeBaseLine = 66, + /** Main video codec profile */ + AgoraVideoCodecProfileTypeMain = 77, + /** High Video codec profile (default) */ + AgoraVideoCodecProfileTypeHigh = 100 +}; + +/** Video mirror mode */ +typedef NS_ENUM(NSUInteger, AgoraVideoMirrorMode) { + /** + * 0: The default mirror mode (the SDK determines the mirror mode). + */ + AgoraVideoMirrorModeAuto = 0, + /** + * 1: Enable the mirror mode. + */ + AgoraVideoMirrorModeEnabled = 1, + /** + * 2: Disable the mirror mode. + */ + AgoraVideoMirrorModeDisabled = 2, +}; + +/** States of the local video. */ +typedef NS_ENUM(NSUInteger, AgoraVideoLocalState) { + /** + * 0: The local video is in the initial state. + */ + AgoraVideoLocalStateStopped = 0, + /** + * 1: The capturer starts successfully. + */ + AgoraVideoLocalStateCapturing = 1, + /** + * 2: The first video frame is encoded successfully. + */ + AgoraVideoLocalStateEncoding = 2, + /** + * 3: The local video fails to start. + */ + AgoraVideoLocalStateFailed = 3 +}; + +/** States of the local video. */ +typedef NS_ENUM(NSUInteger, AgoraLocalVideoStreamError) { + /** 0: The local video is normal. + */ + AgoraLocalVideoStreamErrorOK = 0, + /** 1: No specified reason for the local video failure. + */ + AgoraLocalVideoStreamErrorFailure = 1, + /** 2: The application does not have permission to start the local video capture device. Remind your user to grant permission and rejoin the channel. + */ + AgoraLocalVideoStreamErrorDeviceNoPermission = 2, + /** 3: The local video capture device is in use. Check whether the camera is occupied by another application or try to rejoin the channel. + */ + AgoraLocalVideoStreamErrorDeviceBusy = 3, + /** 4: The local video capture failed. Check whether the video capture device is working properly, check whether the camera is occupied by another application, or try to rejoin the channel. + */ + AgoraLocalVideoStreamErrorCaptureFailure = 4, + /** 5: The local video encoding fails. + */ + AgoraLocalVideoStreamErrorEncodeFailure = 5, + /** 6: (iOS only) The application is in the background. Remind your user that the application cannot capture video properly when the application is in the background. + */ + AgoraLocalVideoStreamErrorCaptureInBackGround = 6, + /** 7: (iOS only) The application is running in Slide Over, Split View, or Picture in Picture mode. Remind your user that the application cannot capture video properly when the application is running in Slide Over, Split View, or Picture in Picture mode. + */ + AgoraLocalVideoStreamErrorCaptureMultipleForegroundApps = 7, + /** 8: The SDK cannot find the local video capture device. Check whether the camera is connected to the device properly, check whether the camera is working properly, or try to rejoin the channel. + */ + AgoraLocalVideoStreamErrorCaptureNoDeviceFound = 8, + /** 9: (macOS only) The external camera currently in use is disconnected + (such as being unplugged). + */ + AgoraLocalVideoStreamErrorCaptureDeviceDisconnected = 9, + /** 10: The SDK cannot find the local video device id in device list, device id is invalid. + */ + AgoraLocalVideoStreamErrorCaptureDeviceInvalidId = 10, + /** 11: (macOS only) The shared window is minimized when you call + [startScreenCaptureByWindowId]([AgoraRtcEngineKit startScreenCaptureByWindowId:rectangle:parameters:]) to share a window. + Remind your user that the window cannot be shared properly when the shared window is minimized. + */ + AgoraLocalVideoStreamErrorScreenCaptureWindowMinimized = 11, + /** 12: (macOS only) The error code indicates that a window shared by the window ID has been closed, or a full-screen + window shared by the window ID has exited full-screen mode. After exiting + full-screen mode, remote users cannot see the shared window. To prevent remote users from seeing a black screen, Agora recommends + that you immediately stop screen sharing. +

    Common scenarios for reporting this error code:

    +
  • When the local user closes the shared window, the SDK reports this error code.
  • t +
  • The local user shows some slides in full-screen mode first, and then shares the windows of the slides. After the user exits full-screen + mode, the SDK reports this error code.
  • +
  • The local user watches web video or reads web document in full-screen mode first, and then shares the window of the web video or + document. After the user exits full-screen mode, the SDK reports this error code.
  • + */ + AgoraLocalVideoStreamErrorScreenCaptureWindowClosed = 12, + + /** 22: No permision to capture screen. */ + AgoraLocalVideoStreamErrorScreenCaptureNoPermission = 22, +}; + +/** The state of the remote video. */ +typedef NS_ENUM(NSUInteger, AgoraVideoRemoteState) { + /** 0: The remote video is in the default state, probably due to `AgoraVideoRemoteStateReasonLocalMuted(3)`, `AgoraVideoRemoteStateReasonRemoteMuted(5)`, or `AgoraVideoRemoteStateReasonRemoteOffline(7)`. */ + AgoraVideoRemoteStateStopped = 0, + /** 1: The first remote video packet is received. */ + AgoraVideoRemoteStateStarting = 1, + /** 2: The remote video stream is decoded and plays normally, probably due to `AgoraVideoRemoteStateReasonNetworkRecovery(2)`, `AgoraVideoRemoteStateReasonLocalUnmuted(4)`, `AgoraVideoRemoteStateReasonRemoteUnmuted(6)`, or `AgoraVideoRemoteStateReasonAudioFallbackRecovery(9)`. */ + AgoraVideoRemoteStateDecoding = 2, + /** 3: The remote video is frozen, probably due to `AgoraVideoRemoteStateReasonNetworkCongestion(1)` or `AgoraVideoRemoteStateReasonAudioFallback(8)`. */ + AgoraVideoRemoteStateFrozen = 3, + /** 4: The remote video fails to start, probably due to `AgoraVideoRemoteStateReasonInternal(0)`. */ + AgoraVideoRemoteStateFailed = 4, +}; + +/** + * The reason of the remote video state change. + */ +typedef NS_ENUM(NSUInteger, AgoraVideoRemoteReason) { + /** + * 0: Internal reasons. + */ + AgoraVideoRemoteReasonInternal = 0, + + /** + * 1: Network congestion. + */ + AgoraVideoRemoteReasonCongestion = 1, + + /** + * 2: Network recovery. + */ + AgoraVideoRemoteReasonRecovery = 2, + + /** + * 3: The local user stops receiving the remote video stream or disables the video module. + */ + AgoraVideoRemoteReasonLocalMuted = 3, + + /** + * 4: The local user resumes receiving the remote video stream or enables the video module. + */ + AgoraVideoRemoteReasonLocalUnmuted = 4, + + /** + * 5: The remote user stops sending the video stream or disables the video module. + */ + AgoraVideoRemoteReasonRemoteMuted = 5, + + /** + * 6: The remote user resumes sending the video stream or enables the video module. + */ + AgoraVideoRemoteReasonRemoteUnmuted = 6, + + /** + * 7: The remote user leaves the channel. + */ + AgoraVideoRemoteReasonRemoteOffline = 7, + + /** + * 8: The remote media stream falls back to the audio-only stream due to poor network conditions. + */ + AgoraVideoRemoteReasonAudioFallback = 8, + + /** + * 9: The remote media stream switches back to the video stream after the network conditions improve. + */ + AgoraVideoRemoteReasonAudioFallbackRecovery = 9 +}; + +/** + * The state of the local audio. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioLocalState) { + /** + * 0: The local audio is in the initial state. + */ + AgoraAudioLocalStateStopped = 0, + /** + * 1: The recording device starts successfully. + */ + AgoraAudioLocalStateRecording = 1, + /** + * 2: The first audio frame encodes successfully. + */ + AgoraAudioLocalStateEncoding = 2, + /** + * 3: The local audio fails to start. + */ + AgoraAudioLocalStateFailed = 3, +}; + +/** + * The error information of the local audio. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioLocalError) { + /** + * 0: No error. + */ + AgoraAudioLocalErrorOK = 0, + /** + * 1: No specified reason for the local audio failure. + */ + AgoraAudioLocalErrorFailure = 1, + /** + * 2: No permission to use the local audio device. + */ + AgoraAudioLocalErrorDeviceNoPermission = 2, + /** + * 3: The microphone is in use. + */ + AgoraAudioLocalErrorDeviceBusy = 3, + /** + * 4: The local audio recording fails. Check whether the recording device is working properly. + */ + AgoraAudioLocalErrorRecordFailure = 4, + /** + * 5: The local audio encoding fails. + */ + AgoraAudioLocalErrorEncodeFailure = 5, +}; + +/** Audio codec profile. */ +typedef NS_ENUM(NSInteger, AgoraAudioCodecProfileType) { + /** (Default) LC-AAC, the low-complexity audio codec profile. */ + AgoraAudioCodecProfileLCAAC = 0, + /** HE-AAC, the high-efficiency audio codec profile. */ + AgoraAudioCodecProfileHEAAC = 1, + /** HE-AACv2, which is the high-efficiency audio codec type.*/ + AgoraAudioCodecProfileHEAACv2 = 2 +}; + +typedef NS_ENUM(NSInteger, AgoraLicenseVerifyCode) { + /** + * 1: Invalid license + */ + AgoraLicenseVerifyInvalid = 1, + /** + * 2: License expired + */ + AgoraLicenseVerifyExpire = 2, + /** + * 3: Exceed license minutes limit + */ + AgoraLicenseVerifyMinutesExceed = 3, + /** + * 4: License use in limited period + */ + AgoraLicenseVerifyLimitedPeriod = 4, + /** + * 5: Same license used in different devices at the same time + */ + AgoraLicenseVerifyDiffDevices = 5, + /** + * 99: SDK internal error + */ + AgoraLicenseVerifyInternal = 99, +}; + +/** + * The state of the remote audio. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioRemoteState) { + /** + * 0: The remote audio stops (the default state). The following are possible reasons: + * - \ref AgoraAudioRemoteReasonLocalMuted(3) + * - \ref AgoraAudioRemoteReasonRemoteMuted(5) + * - \ref AgoraAudioRemoteReasonRemoteOffline(7) + */ + AgoraAudioRemoteStateStopped = 0, + /** + * 1: The first remote audio packet is received. + */ + AgoraAudioRemoteStateStarting = 1, + /** + * 2: The remote audio stream is decoded and plays normally. The following are possible reasons: + * - \ref AgoraAudioRemoteReasonNetworkRecovery(2) + * - \ref AgoraAudioRemoteReasonLocalUnmuted(4) + * - \ref AgoraAudioRemoteReasonRemoteUnmuted(6) + */ + AgoraAudioRemoteStateDecoding = 2, + /** + * 3: The remote audio is frozen. The possible reason is \ref AgoraAudioRemoteReasonNetworkCongestion(1). + */ + AgoraAudioRemoteStateFrozen = 3, + /** + * 4: The remote audio fails to start. The possible reason is \ref AgoraAudioRemoteReasonInternal(0). + */ + AgoraAudioRemoteStateFailed = 4, +}; + +/** + * The reason of the remote audio state change. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioRemoteReason) { + /** + * 0: Internal reasons. + */ + AgoraAudioRemoteReasonInternal = 0, + /** + * 1: Network congestion. + */ + AgoraAudioRemoteReasonNetworkCongestion = 1, + /** + * 2: Network recovery. + */ + AgoraAudioRemoteReasonNetworkRecovery = 2, + /** + * 3: The local user stops receiving the remote audio stream or disables the audio module. + */ + AgoraAudioRemoteReasonLocalMuted = 3, + /** + * 4: The local user resumes receiving the remote audio stream or enables the audio module. + */ + AgoraAudioRemoteReasonLocalUnmuted = 4, + /** + * 5: The remote user stops sending the audio stream or disables the audio module. + */ + AgoraAudioRemoteReasonRemoteMuted = 5, + /** + * 6: The remote user resumes sending the audio stream or enables the audio module. + */ + AgoraAudioRemoteReasonRemoteUnmuted = 6, + /** + * 7: The remote user leaves the channel. + */ + AgoraAudioRemoteReasonRemoteOffline = 7, +}; + +/** Stream fallback option */ +typedef NS_ENUM(NSInteger, AgoraStreamFallbackOptions) { + /** + * No fallback operation for the stream when the network condition is poor. The stream quality cannot be guaranteed. + */ + AgoraStreamFallbackOptionDisabled = 0, + /** + * Default option. + * Under poor network conditions, the SDK will send or receive AgoraVideoStreamTypeLow. + * You can only set this option in [setRemoteSubscribeFallbackOption]([AgoraRtcEngineKit setRemoteSubscribeFallbackOption:]). + * Nothing happens when you set this in [setLocalPublishFallbackOption]([AgoraRtcEngineKit setLocalPublishFallbackOption:]). + */ + AgoraStreamFallbackOptionVideoStreamLow = 1, + /** + * Under poor network conditions, the SDK may receive AgoraVideoStreamTypeLow first. + * But if the network still does not allow displaying the video, the SDK will send or receive audio only. + */ + AgoraStreamFallbackOptionAudioOnly = 2, +}; + +/** Audio sampling rate */ +typedef NS_ENUM(NSInteger, AgoraAudioSampleRateType) { + /** 32 kHz */ + AgoraAudioSampleRateType32000 = 32000, + /** 44.1 kHz */ + AgoraAudioSampleRateType44100 = 44100, + /** 48 kHz */ + AgoraAudioSampleRateType48000 = 48000, +}; + +/** + * Audio profile types. + */ +typedef NS_ENUM(NSInteger, AgoraAudioProfile) { + /** + * 0: The default audio profile. + * - In the Communication profile, it represents a sample rate of 16 kHz, music encoding, mono, and a bitrate + * of up to 16 Kbps. + * - In the Live-broadcast profile, it represents a sample rate of 48 kHz, music encoding, mono, and a bitrate + * of up to 64 Kbps. + */ + AgoraAudioProfileDefault = 0, + /** + * 1: A sample rate of 32 kHz, audio encoding, mono, and a bitrate up to 18 Kbps. + */ + AgoraAudioProfileSpeechStandard = 1, + /** + * 2: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 64 Kbps. + */ + AgoraAudioProfileMusicStandard = 2, + /** + * 3: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 80 + * Kbps. + */ + AgoraAudioProfileMusicStandardStereo = 3, + /** + * 4: A sample rate of 48 kHz, music encoding, mono, and a bitrate of up to 96 Kbps. + */ + AgoraAudioProfileMusicHighQuality = 4, + /** + * 5: A sample rate of 48 kHz, music encoding, stereo, and a bitrate of up to 128 Kbps. + */ + AgoraAudioProfileMusicHighQualityStereo = 5, + /** + * 6: A sample rate of 16 kHz, audio encoding, mono, and a bitrate of up to 64 Kbps. + */ + AgoraAudioProfileIot = 6, +}; + +/** + * Audio application scenarios. + */ +typedef NS_ENUM(NSInteger, AgoraAudioScenario) { + /** + * 0: (Recommended) The default audio scenario. + */ + AgoraAudioScenarioDefault = 0, + /** + * 3: (Recommended) The live gaming scenario, which needs to enable gaming + * audio effects in the speaker. Choose this scenario to achieve high-fidelity + * music playback. + */ + AgoraAudioScenarioGameStreaming = 3, + /** + * 5: The chatroom scenario. + */ + AgoraAudioScenarioChatRoom = 5, + /** Chorus */ + AgoraAudioScenarioChorus = 7, + /** Meeting */ + AgoraAudioScenarioMeeting = 8 +}; + +/** + * The audio output routing. + */ +typedef NS_ENUM(NSInteger, AgoraAudioOutputRouting) { + /** + * -1: The default audio route. + */ + AgoraAudioOutputRoutingDefault = -1, + /** + * 0: Headset. + */ + AgoraAudioOutputRoutingHeadset = 0, + /** + * 1: Earpiece. + */ + AgoraAudioOutputRoutingEarpiece = 1, + /** + * 2: Headset with no microphone. + */ + AgoraAudioOutputRoutingHeadsetNoMic = 2, + /** + * 3: Speakerphone. + */ + AgoraAudioOutputRoutingSpeakerphone = 3, + /** + * 4: Loudspeaker. + */ + AgoraAudioOutputRoutingLoudspeaker = 4, + /** + * 5: Bluetooth headset. + */ + AgoraAudioOutputRoutingHeadsetBluetooth = 5, + /** + * 6: (macOS only) HDMI peripheral. + */ + AgoraAudioOutputRoutingHdmi = 6, + /** + * 7: (macOS only) USB peripheral. + */ + AgoraAudioOutputRoutingUsb = 7, + /** + * 8: (macOS only) DisplayPort peripheral. + */ + AgoraAudioOutputRoutingDisplayPort = 8, + /** + * 9: Apple AirPlay. + */ + AgoraAudioOutputRoutingAirPlay = 9, + /** + * 10: Bluetooth Speaker via a2dp. + */ + AgoraAudioOutputRoutingBluetoothSpeaker = 10 +}; + +/** Use mode of the onRecordAudioFrame callback */ +typedef NS_ENUM(NSInteger, AgoraAudioRawFrameOperationMode) { + /** Read-only mode: Users only read the AudioFrame data without modifying anything. For example, when users acquire data with the Agora SDK then push the RTMP streams. */ + AgoraAudioRawFrameOperationModeReadOnly = 0, + /** Read and write mode: Users read the data from AudioFrame, modify it, and then play it. For example, when users have their own sound-effect processing module and do some voice pre-processing such as a voice change. */ + AgoraAudioRawFrameOperationModeReadWrite = 2, +}; + +/** Audio equalization band frequency */ +typedef NS_ENUM(NSInteger, AgoraAudioEqualizationBandFrequency) { + /** 31 Hz */ + AgoraAudioEqualizationBand31 = 0, + /** 62 Hz */ + AgoraAudioEqualizationBand62 = 1, + /** 125 Hz */ + AgoraAudioEqualizationBand125 = 2, + /** 250 Hz */ + AgoraAudioEqualizationBand250 = 3, + /** 500 Hz */ + AgoraAudioEqualizationBand500 = 4, + /** 1 kHz */ + AgoraAudioEqualizationBand1K = 5, + /** 2 kHz */ + AgoraAudioEqualizationBand2K = 6, + /** 4 kHz */ + AgoraAudioEqualizationBand4K = 7, + /** 8 kHz */ + AgoraAudioEqualizationBand8K = 8, + /** 16 kHz */ + AgoraAudioEqualizationBand16K = 9, +}; + +/** Audio reverberation type */ +typedef NS_ENUM(NSInteger, AgoraAudioReverbType) { + /** (dB, -20 to 10), the level of the dry signal */ + AgoraAudioReverbDryLevel = 0, + /** (dB, -20 to 10), the level of the early reflection signal (wet signal) */ + AgoraAudioReverbWetLevel = 1, + /** (0 to 100), the room size of the reflection */ + AgoraAudioReverbRoomSize = 2, + /** (ms, 0 to 200), the length of the initial delay of the wet signal in ms */ + AgoraAudioReverbWetDelay = 3, + /** (0 to 100), the strength of the late reverberation */ + AgoraAudioReverbStrength = 4, +}; + +/** The options for SDK preset voice beautifier effects.*/ +typedef NS_ENUM(NSInteger, AgoraVoiceBeautifierPreset) { + /** Turn off voice beautifier effects and use the original voice. + */ + AgoraVoiceBeautifierPresetOff = 0x00000000, + /** A more magnetic voice. + * + * @note Agora recommends using this enumerator to process a male-sounding voice; otherwise, you + * may experience vocal distortion. + */ + AgoraVoiceBeautifierPresetChatBeautifierMagnetic = 0x01010100, + /** A fresher voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you + * may experience vocal distortion. + */ + AgoraVoiceBeautifierPresetChatBeautifierFresh = 0x01010200, + /** A more vital voice. + * + * @note Agora recommends using this enumerator to process a female-sounding voice; otherwise, you + * may experience vocal distortion. + */ + AgoraVoiceBeautifierPresetChatBeautifierVitality = 0x01010300, + /** + * @since v3.3.0 + * + * Singing beautifier effect. + * - If you call \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * (SINGING_BEAUTIFIER), you can beautify a male-sounding voice and add a reverberation effect + * that sounds like singing in a small room. Agora recommends not using \ref + * IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" (SINGING_BEAUTIFIER) to process + * a female-sounding voice; otherwise, you may experience vocal distortion. + * - If you call \ref IRtcEngine::setVoiceBeautifierParameters + * "setVoiceBeautifierParameters"(SINGING_BEAUTIFIER, param1, param2), you can beautify a male- or + * female-sounding voice and add a reverberation effect. + */ + AgoraVoiceBeautifierPresetSingingBeautifier= 0x01020100, + /** A more vigorous voice. + */ + AgoraVoiceBeautifierTimbreTransformationVigorous = 0x01030100, + /** A deeper voice. + */ + AgoraVoiceBeautifierTimbreTransformationDeep = 0x01030200, + /** A mellower voice. + */ + AgoraVoiceBeautifierTimbreTransformationMellow= 0x01030300, + /** A falsetto voice. + */ + AgoraVoiceBeautifierTimbreTransformationFalsetto= 0x01030400, + /** A fuller voice. + */ + AgoraVoiceBeautifierTimbreTransformationFull = 0x01030500, + /** A clearer voice. + */ + AgoraVoiceBeautifierTimbreTransformationClear = 0x01030600, + /** A more resounding voice. + */ + AgoraVoiceBeautifierTimbreTransformationResounding = 0x01030700, + /** A more ringing voice. + */ + AgoraVoiceBeautifierTimbreTransformatRinging= 0x01030800, + + AgoraVoiceBeautifierUltraHighQuality = 0x01040100 +}; + +/** The options for SDK preset audio effects.*/ +typedef NS_ENUM(NSInteger, AgoraAudioEffectPreset) { + /** Turn off audio effects and use the original voice. + */ + AgoraAudioEffectPresetOff = 0x00000000, + /** The voice effect for backing vocals when the lead vocal turns off audio effect. + * @note: When this effect is used, the voice of the backing vocals will be softer. + */ + AgoraAudioEffectPresetOffHarmony = 0x02010120, + /** An audio effect typical of a KTV venue. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousticsKTV = 0x02010100, + /** An audio effect typical of a KTV venue for backing vocals. + * + * @note: This effect is used for backing vocals when KTV venue is chosen for the lead vocal. + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousticsKTVHarmony = 0x02010110, + /** An audio effect typical of a concert hall. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousVocalConcer = 0x02010200, + /** An audio effect typical of a concert hall for backing vocals. + * + * @note: This effect is used for backing vocals when concert hall is chosen for the lead vocal. + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousVocalConcerHarmony = 0x02010210, + /** An audio effect typical of a recording studio. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousStudio = 0x02010300, + /** The voice effect typical of a studio venue for backing vocals. + * + * @note: This effect is used for backing vocals when studio venue is chosen for the lead vocal. + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousStudioHarmony = 0x02010310, + /** An audio effect typical of a vintage phonograph. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousPhonograph = 0x02010400, + /** The voice effect typical of a phonograph venue for backing vocals. + * + * @note: This effect is used for backing vocals when phonograph venue is chosen for the lead vocal. + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousPhonographHarmony = 0x02010410, + /** A virtual stereo effect that renders monophonic audio as stereo audio. + * + * @note Call \ref IRtcEngine::setAudioProfile "setAudioProfile" and set the `profile` parameter + * to `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` + * before setting this enumerator; otherwise, the enumerator setting does not take effect. + */ + AgoraAudioEffectPresetRoomAcousVirtualStereo = 0x02010500, + /** A more spatial audio effect. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousSpatial = 0x02010600, + /** A more ethereal audio effect. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousEthereal = 0x02010700, + /** A 3D voice effect that makes the voice appear to be moving around the user. The default cycle + * period of the 3D voice effect is 10 seconds. To change the cycle period, call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" after this method. + * + * @note + * - Call \ref IRtcEngine::setAudioProfile "setAudioProfile" and set the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator; otherwise, the enumerator setting does not take effect. + * - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear + * the anticipated voice effect. + */ + AgoraAudioEffectPresetRoomAcous3DVoice = 0x02010800, + /** virtual suround sound. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousVirtualSurroundSound = 0x02010900, + /** An audio effect for chorus. + * + * @note: To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetRoomAcousticsChorus = 0x02010D00, + /** The voice of an uncle. + * + * @note + * - Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectUncle = 0x02020100, + /** The voice of an old man. + * + * @note + * - Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectOldMan = 0x02020200, + /** The voice of a boy. + * + * @note + * - Agora recommends using this enumerator to process a male-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectBoy= 0x02020300, + /** The voice of a young woman. + * + * @note + * - Agora recommends using this enumerator to process a female-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectSister= 0x02020400, + /** The voice of a girl. + * + * @note + * - Agora recommends using this enumerator to process a female-sounding voice; otherwise, you may + * not hear the anticipated voice effect. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectGirl = 0x02020500, + /** The voice of Pig King, a character in Journey to the West who has a voice like a growling + * bear. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectPigKin = 0x02020600, + /** The voice of Hulk. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetVoiceChangerEffectHulk = 0x02020700, + /** An audio effect typical of R&B music. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetStyleTransformationRnb = 0x02030100, + /** An audio effect typical of popular music. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetStyleTransformationPopular= 0x02030200, + /** A pitch correction effect that corrects the user's pitch based on the pitch of the natural C + * major scale. To change the basic mode and tonic pitch, call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" after this method. + * + * @note To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator. + */ + AgoraAudioEffectPresetPitchCorrection = 0x02040100 +}; + +/** The options for SDK preset voice conversion. */ +typedef NS_ENUM(NSInteger, AgoraVoiceConversionPreset) { + /** Turn off voice conversion and use the original voice. */ + AgoraVoiceConversionPresetOff = 0x00000000, + /** A neutral voice. */ + AgoraVoiceConversionPresetNeutral = 0x03010100, + /** A sweet voice. */ + AgoraVoiceConversionPresetSweet = 0x03010200, + /** A solid voice. */ + AgoraVoiceConversionPresetChangerSolid = 0x03010300, + /** A bass voice. */ + AgoraVoiceConversionPresetChangerBass = 0x03010400 +}; + +/** The preset local voice reverberation option. */ +typedef NS_ENUM(NSInteger, AgoraAudioReverbPreset) { + /** The original voice (no local voice reverberation). */ + AgoraAudioReverbPresetOff = 0x00000000, + /** The reverberation style typical of a KTV venue (enhanced). */ + AgoraAudioReverbPresetFxKTV = 0x02010100, + /** The reverberation style typical of a concert hall (enhanced). */ + AgoraAudioReverbPresetFxVocalConcert = 0x02010200, + /** The reverberation style typical of an uncle's voice. */ + AgoraAudioReverbPresetFxUncle = 0x02020100, + /** The reverberation style typical of a little sister's voice. */ + AgoraAudioReverbPresetFxSister = 0x02020400, + /** The reverberation style typical of a recording studio (enhanced). */ + AgoraAudioReverbPresetFxStudio = 0x02010300, + /** The reverberation style typical of popular music (enhanced). */ + AgoraAudioReverbPresetFxPopular = 0x02030200, + /** The reverberation style typical of R&B music (enhanced). */ + AgoraAudioReverbPresetFxRNB = 0x02030100, + /** The reverberation style typical of the vintage phonograph. */ + AgoraAudioReverbPresetFxPhonograph = 0x02010400, + /** The reverberation style typical of chorus. */ + AgoraAudioReverbPresetFxChorus = 0x02010D00 +}; + +typedef NS_ENUM(NSInteger, AgoraHeadphoneEQPreset){ + /** Turn off headphone EQ and use the original voice. */ + AgoraAudioHeadphoneEQPresetOff = 0x00000000, + /** For over-ear headphones. */ + AgoraAudioHeadphoneEQPresetOverear = 0x04000001, + /** For in-ear headphones. */ + AgoraAudioHeadphoneEQPresetInear = 0x04000002 +}; + +/** Audio session restriction */ +typedef NS_OPTIONS(NSUInteger, AgoraAudioSessionOperationRestriction) { + /** No restriction, the SDK has full control on the audio session operations. */ + AgoraAudioSessionOperationRestrictionNone = 0, + /** The SDK will not change the audio session category */ + AgoraAudioSessionOperationRestrictionSetCategory = 1, + /** The SDK will not change any setting of the audio session (category, mode, categoryOptions) */ + AgoraAudioSessionOperationRestrictionConfigureSession = 1 << 1, + /** The SDK will keep the audio session active when leaving a channel */ + AgoraAudioSessionOperationRestrictionDeactivateSession = 1 << 2, + /** The SDK will not configure the audio session anymore */ + AgoraAudioSessionOperationRestrictionAll = 1 << 7 +}; + +/** Media device type */ +typedef NS_ENUM(NSInteger, AgoraMediaDeviceType) { + /** Unknown device*/ + AgoraMediaDeviceTypeAudioUnknown = -1, + /** Audio playback device */ + AgoraMediaDeviceTypeAudioPlayout = 0, + /** Microphone device */ + AgoraMediaDeviceTypeAudioRecording = 1, + /** Video render device*/ + AgoraMediaDeviceTypeVideoRender = 2, + /** Video capture device*/ + AgoraMediaDeviceTypeVideoCapture = 3, +}; + +/** Video frame format */ +typedef NS_ENUM(NSInteger, AgoraVideoFormat) { + /** i420 video frame fromat*/ + AgoraVideoFormatI420 = 1, + /** BGRA video frame fromat*/ + AgoraVideoFormatBGRA = 2, + /** NV21 video frame fromat*/ + AgoraVideoFormatNV21 = 3, + /** RGBA video frame fromat*/ + AgoraVideoFormatRGBA = 4, + /** NV12 video frame fromat*/ + AgoraVideoFormatNV12 = 8, + /** iOS texture NV12 (CVPixelBufferRef)*/ + AgoraVideoFormatCVPixelNV12 = 12, + /** iOS texture I420 (CVPixelBufferRef)*/ + AgoraVideoFormatCVPixelI420 = 13, + /** iOS texture BGRA (CVPixelBufferRef)*/ + AgoraVideoFormatCVPixelBGRA = 14, + /** I422 video frame fromat*/ + AgoraVideoFormatI422 = 16, + /** Internal default fromat*/ + AgoraVideoFormatDefault = 0, +}; + +/** + * Types of the video frame. + */ +typedef NS_ENUM(NSInteger, AgoraVideoFrameType) { + /** (Default) Blank frame */ + AgoraVideoFrameTypeBlankFrame = 0, + /** (Default) Key frame */ + AgoraVideoFrameTypeKeyFrame = 3, + /** (Default) Delta frame */ + AgoraVideoFrameTypeDeltaFrame = 4, + /** (Default) B frame */ + AgoraVideoFrameTypeBFrame = 5, + /** (Default) Droppable frame */ + AgoraVideoFrameTypeDroppableFrame = 6, + /** (Default) Unknown frame type */ + AgoraVideoFrameTypeUnknow +}; + +typedef NS_ENUM(NSInteger, AgoraVideoFrameProcessMode) { + AgoraVideoFrameProcessModeReadOnly, // Observer works as a pure renderer and will not modify the original frame. + AgoraVideoFrameProcessModeReadWrite, // Observer works as a filter that will process the video frame and affect the following frame processing in SDK. +}; + +/** The connection state of the SDK. */ +typedef NS_ENUM(NSInteger, AgoraConnectionState) { + /** + * 1: The SDK is disconnected from the edge server. + */ + AgoraConnectionStateDisconnected = 1, + /** + * 2: The SDK is connecting to the edge server. + */ + AgoraConnectionStateConnecting = 2, + /** + * 3: The SDK is connected to the edge server and has joined a channel. You can now publish or subscribe to a media stream in the channel. + */ + AgoraConnectionStateConnected = 3, + /** + * 4: The SDK keeps rejoining the channel after being disconnected from a joined channel because of network issues. + */ + AgoraConnectionStateReconnecting = 4, + /** + * 5: The SDK fails to connect to the edge server or join the channel. + */ + AgoraConnectionStateFailed = 5, +}; + +/** The network type. */ +typedef NS_ENUM(NSInteger, AgoraNetworkType) { + /** + * -1: The network type is unknown. + */ + AgoraNetworkTypeUnknown = -1, + /** + * 0: The network type is disconnected. + */ + AgoraNetworkTypeDisconnected = 0, + /** + * 1: The network type is LAN. + */ + AgoraNetworkTypeLAN = 1, + /** + * 2: The network type is Wi-Fi. + */ + AgoraNetworkTypeWIFI = 2, + /** + * 3: The network type is mobile 2G. + */ + AgoraNetworkType2G = 3, + /** + * 4: The network type is mobile 3G. + */ + AgoraNetworkType3G = 4, + /** + * 5: The network type is mobile 4G. + */ + AgoraNetworkType4G = 5, + /** + * 6: The network type is mobile 5G. + */ + AgoraNetworkType5G = 6, +}; + +/** The video encoding degradation preference under limited bandwidth. */ +typedef NS_ENUM(NSInteger, AgoraDegradationPreference) { + /** (Default) Degrade the frame rate and keep resolution to guarantee the video quality. */ + AgoraDegradationMaintainQuality = 0, + /** Degrade resolution in order to maintain framerate. */ + AgoraDegradationMaintainFramerate = 1, + /** Maintain resolution in video quality control process. Under limited bandwidth, degrade video quality first and then degrade frame rate. */ + AgoraDegradationBalanced = 2, + /** Degrade framerate in order to maintain resolution. */ + AgoraDegradationMaintainResolution = 3, +}; + +/** The video AgoraHardwareEncoding. */ +typedef NS_ENUM(NSInteger, AgoraEncodingPreference) { + /** + * Default encoding. + */ + AgoraEncodingPreferAuto = -1, + /** + * Software encoding. + */ + AgoraEncodingPrefersoftware = 0, + /** + * Hardware encoding + */ + AgoraEncodingPreferhardware = 1, +}; + +/** The video compression preference. */ +typedef NS_ENUM(NSInteger, AgoraCompressionPreference) { + /** (Default) Prefer low latency, it is default behavior, normally in real-time communication, latency is the first priority. + */ + AgoraCompressionLowLatency = 0, + /** Prefer quality in sacrifice of a degree of latency, usually around 30ms ~ 150ms, depends target fps + */ + AgoraCompressionQuality = 1, +}; + +/** Supported codec bit mask types. */ +typedef NS_ENUM(NSInteger, AgoraCodecCapMask) { + /** No codec support. + */ + AgoraCodecMaskNone = 0, + /** bit 1: Hardware decoder support flag + */ + AgoraCodecMaskHwDec = 1, + /** bit 2: Hardware encoder support flag + */ + AgoraCodecMaskHwEnc = 2, + /** bit 3: Software decoder support flag + */ + AgoraCodecMaskSwDec = 4, + /** bit 4: Software encoder support flag + */ + AgoraCodecMaskSwEnc = 8, +}; + +/** The lightening contrast level. */ +typedef NS_ENUM(NSUInteger, AgoraLighteningContrastLevel) { + /** Low contrast level. */ + AgoraLighteningContrastLow = 0, + /** (Default) Normal contrast level. */ + AgoraLighteningContrastNormal = 1, + /** High contrast level. */ + AgoraLighteningContrastHigh = 2, +}; + +/** The video noise reduction mode. + + @since v4.0.0 + */ +typedef NS_ENUM(NSUInteger, AgoraVideoDenoiserMode) { + /** 0: (Default) Automatic mode. The SDK automatically enables or disables the video noise reduction feature according to the ambient light. */ + AgoraVideoDenoiserModeAuto = 0, + /** 1: Manual mode. Users need to enable or disable the video noise reduction feature manually. */ + AgoraVideoDenoiserModeManual = 1, +}; + +/** The video noise reduction level. + + @since v4.0.0 + */ +typedef NS_ENUM(NSUInteger, AgoraVideoDenoiserLevel) { + /** 0: (Default) Promotes video quality during video noise reduction. `HighQuality` balances performance consumption and video noise reduction quality. The performance consumption is moderate, the video noise reduction speed is moderate, and the overall video quality is optimal. */ + AgoraVideoDenoiserLevelHighQuality = 0, + /** 1: Promotes reducing performance consumption during video noise reduction. `Fast` prioritizes reducing performance consumption over video noise reduction quality. The performance consumption is lower, and the video noise reduction speed is faster. To avoid a noticeable shadowing effect (shadows trailing behind moving objects) in the processed video, Agora recommends that you use `Fast` when the camera is fixed. */ + AgoraVideoDenoiserLevelFast = 1, + /** 2: Enhanced video noise reduction. `Strength` prioritizes video noise reduction quality over reducing performance consumption. The performance consumption is higher, the video noise reduction speed is slower, and the video noise reduction quality is better. If `HighQuality` is not enough for your video noise reduction needs, you can use `Strength`. */ + AgoraVideoDenoiserLevelStrength = 2, + +}; + +/** The low-light enhancement mode. + + @since v4.0.0 + */ +typedef NS_ENUM(NSUInteger, AgoraLowlightEnhanceMode) { + /** 0: (Default) Automatic mode. The SDK automatically enables or disables the low-light enhancement feature according to the ambient light to compensate for the lighting level or prevent overexposure, as necessary. */ + AgoraLowlightEnhanceModeAuto = 0, + /** 1: Manual mode. Users need to enable or disable the low-light enhancement feature manually. */ + AgoraLowlightEnhanceModeManual = 1, +}; + +/** The low-light enhancement level. + + @since v4.0.0 + */ +typedef NS_ENUM(NSUInteger, AgoraLowlightEnhanceLevel) { + /** 0: (Default) Promotes video quality during low-light enhancement. It processes the brightness, details, and noise of the video image. The performance consumption is moderate, the processing speed is moderate, and the overall video quality is optimal. */ + AgoraLowlightEnhanceLevelQuality = 0, + /** 1: Promotes performance during low-light enhancement. It processes the brightness and details of the video image. The processing speed is faster. */ + AgoraLowlightEnhanceLevelFast = 1, +}; + +/** The type of the custom background image. + @since v3.7.200 + */ +typedef NS_ENUM(NSUInteger, AgoraVirtualBackgroundSourceType) { + /** 1: (Default) The background image is a solid color.*/ + AgoraVirtualBackgroundColor = 1, + /** 2: The background image is a file in PNG or JPG format.*/ + AgoraVirtualBackgroundImg = 2, + /** Background source is blur your background */ + AgoraVirtualBackgroundBlur = 3, +} NS_SWIFT_NAME(AgoraVirtualBackgroundSourceType); + +/** The lightening contrast level. */ +typedef NS_ENUM(NSUInteger, AgoraBlurDegree) { + /** Background few things*/ + AgoraBlurLow = 1, + /** Background blur more things*/ + AgoraBlurMedium = 2, + /** Background blur most */ + AgoraBlurHigh = 3, +} NS_SWIFT_NAME(AgoraBlurDegree); + +typedef NS_ENUM(NSUInteger, SegModelType) { + SegModelAgoraAi = 1, + SegModelAgoraGreen = 2, +} NS_SWIFT_NAME(SegModelType); + +typedef NS_ENUM(NSInteger, AgoraConnectionChangedReason) { + /** + * 0: The SDK is connecting to Agora's edge server. + */ + AgoraConnectionChangedReasonConnecting = 0, + /** + * 1: The SDK has joined the channel successfully. + */ + AgoraConnectionChangedReasonJoinSuccess = 1, + /** + * 2: The connection between the SDK and Agora's edge server is interrupted. + */ + AgoraConnectionChangedReasonInterrupted = 2, + /** + * 3: The connection between the SDK and Agora's edge server is banned by Agora's edge server. + */ + AgoraConnectionChangedReasonBannedByServer = 3, + /** + * 4: The SDK fails to join the channel for more than 20 minutes and stops reconnecting to the channel. + */ + AgoraConnectionChangedReasonJoinFailed = 4, + /** + * 5: The SDK has left the channel. + */ + AgoraConnectionChangedReasonLeaveChannel = 5, + /** + * 6: The connection failed since Appid is not valid. + */ + AgoraConnectionChangedReasonInvalidAppId = 6, + /** + * 7: The connection failed since channel name is not valid. + */ + AgoraConnectionChangedReasonInvalidChannelName = 7, + /** + * 8: The connection failed since token is not valid, possibly because: + - The App Certificate for the project is enabled in Console, but you do not use Token when + joining the channel. If you enable the App Certificate, you must use a token to join the channel. + - The uid that you specify in the `joinChannel` method + is different from the uid that you pass for generating the token. + */ + AgoraConnectionChangedReasonInvalidToken = 8, + /** + * 9: The connection failed since token is expired. + */ + AgoraConnectionChangedReasonTokenExpired = 9, + /** + * 10: The connection is rejected by server. + */ + AgoraConnectionChangedReasonRejectedByServer = 10, + /** + * 11: The connection changed to reconnecting since SDK has set a proxy server. + */ + AgoraConnectionChangedReasonSettingProxyServer = 11, + /** + * 12: When SDK is in connection failed, the renew token operation will make it connecting. + */ + AgoraConnectionChangedReasonRenewToken = 12, + /** + * 13: The IP Address of SDK client has changed. i.e., Network type or IP/Port changed by network + operator might change client IP address. + */ + AgoraConnectionChangedReasonClientIpAddressChanged = 13, + /** + * 14: Timeout for the keep-alive of the connection between the SDK and Agora's edge server. The + connection state changes to CONNECTION_STATE_RECONNECTING(4). + */ + AgoraConnectionChangedReasonKeepAliveTimeout = 14, + /** + * 15: The SDK has rejoined the channel successfully. + */ + AgoraConnectionChangedReasonRejoinSuccess = 15, + /** + * 16: The connection between the SDK and Agora's edge server is lost. + */ + AgoraConnectionChangedReasonLost = 16, + /** + * 17: The change of connection state is caused by echo test. + */ + AgoraConnectionChangedReasonEchoTest = 17, + /** + * 18: The local IP Address is changed by user. + */ + AgoraConnectionChangedClientIpAddressChangedByUser = 18, + /** + * 19: There is a disconnection due to joining channel on another device with the same uid. + */ + AgoraConnectionChangedSameUidLogin = 19, + /** + * 20: The connection is failed due to too many broadcasters in the channel. + */ + AgoraConnectionChangedTooManyBroadcasters = 20, + /** + * 21: The connection is failed due to license validation failure. + */ + AgoraConnectionChangedLicenseValidationFailure = 21, + /** + * 22: The connection is failed due to certification verify failure. + */ + AgoraConnectionChangedCertificationVerifyFailure = 22, +}; + +typedef NS_ENUM(NSInteger, AgoraClientRoleChangeFailedReason) { + /** + * 1: Too many broadcasters in the channel. + */ + AgoraClientRoleChangeFailedTooManyBroadcasters = 1, + /** + * 2: The operation of changing role is not authorized. + */ + AgoraClientRoleChangeFailedNotAuthorized = 2, + /** + * 3: The operation of changing role is timeout. + */ + AgoraClientRoleChangeFailedRequestTimeout = 3, + /** + * 4: The operation of changing role is interrupted since we lost connection with agora service. + */ + AgoraClientRoleChangeFailedConnectionFailed = 4, +}; + +/** + * The playback state of the audio mixing file. + */ +typedef NS_ENUM(NSInteger, AgoraAudioMixingStateType) { + /** + * 710: The audio mixing file is playing. + */ + AgoraAudioMixingStateTypePlaying = 710, + /** + * 711: The audio mixing file pauses playing. + */ + AgoraAudioMixingStateTypePaused = 711, + /** + * 713: The audio mixing file stops playing. + */ + AgoraAudioMixingStateTypeStopped = 713, + /** + * 714: The audio mixing file playback fails. See `AgoraAudioMixingReasonCode` for details. + */ + AgoraAudioMixingStateTypeFailed = 714, +}; + +/** + * The audio mixing error code. + */ +typedef NS_ENUM(NSInteger, AgoraAudioMixingReasonCode) { + /** + * 701: The SDK cannot open the audio file. + */ + AgoraAudioMixingReasonCanNotOpen = 701, + /** + * 702: The SDK opens the audio mixing file too frequently. Ensure that the time interval between calling \ref AgoraRtcEngineKit.startAudioMixing:loopback:replace:cycle: startAudioMixing is more than 100 ms. + */ + AgoraAudioMixingReasonTooFrequentlyCall = 702, + /** + * 703: The audio mixing file playback is interrupted. + */ + + AgoraAudioMixingReasonInterruptedEOF = 703, + /** 715: The audio mixing file is played once. */ + + AgoraAudioMixingReasonOneLoopCompleted = 721, + + /** 716: The audio mixing file is all played out. */ + AgoraAudioMixingReasonAllLoopsCompleted = 723, + + /** 716: The audio mixing file stopped by user */ + AgoraAudioMixingReasonStoppedByUser = 724, + /** + * 0: No error. + */ + AgoraAudioMixingReasonTypeOk = 0, +}; + +typedef NS_ENUM (NSInteger, AgoraMetadataType) { + /** -1: The metadata type is unknown. + */ + AgoraMetadataTypeUnknown = -1, + /** 0: The metadata type is video. + */ + AgoraMetadataTypeVideo = 0 +}; + +/** + * The maximum metadata size. + */ +typedef NS_ENUM (NSInteger, AgoraMaxMetadataSizeType) { + AgoraMaxMetadataSizeTypeInvalid = -1, + AgoraMaxMetadataSizeTypeDefault = 512, + AgoraMaxMetadataSizeTypeMax = 1024 +}; + +/** + * Supported logging severities of SDK. + */ +typedef NS_ENUM (NSInteger, AgoraLogLevel) { + /** + * Do not output any log file. + */ + AgoraLogLevelNone = 0x0000, + /** + * (Recommended) Output log files of the Info level. + */ + AgoraLogLevelInfo = 0x0001, + /** + * Output log files of the Warning level. + */ + AgoraLogLevelWarn = 0x0002, + /** + * Output log files of the Error level. + */ + AgoraLogLevelError = 0x0004, + /** + * Output log files of the Critical level. + */ + AgoraLogLevelFatal = 0x0008 +}; + +/** Areas for geofencing. + */ +typedef NS_ENUM(NSUInteger, AgoraAreaCodeType) { + /** + * Mainland China. + */ + AgoraAreaCodeTypeCN = 0x1, + /** + * North America. + */ + AgoraAreaCodeTypeNA = 0x2, + /** + * Europe. + */ + AgoraAreaCodeTypeEUR = 0x4, + /** + * Asia, excluding Mainland China. + */ + AgoraAreaCodeTypeAS = 0x8, + /** + * Japan. + */ + AgoraAreaCodeTypeJP = 0x10, + /** + * India + */ + AgoraAreaCodeTypeIN = 0x20, + /** + * Russia + */ + AgoraAreaCodeTypeRU = 0x1000, + /** + * (Default) Global. + */ + AgoraAreaCodeTypeGlobal = 0xFFFFFFFF +}; + +/** The RTMP or RTMPS streaming state. */ +typedef NS_ENUM(NSUInteger, AgoraRtmpStreamingState) { + /** The RTMP or RTMPS streaming has not started or has ended. This state is also triggered after you remove an RTMP or RTMPS stream from the CDN by calling [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:]).*/ + AgoraRtmpStreamingStateIdle = 0, + /** The SDK is connecting to Agora's streaming server and the CDN server. This state is triggered after you call the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method. */ + AgoraRtmpStreamingStateConnecting = 1, + /** The RTMP or RTMPS streaming is being published. The SDK successfully publishes the RTMP or RTMPS streaming and returns this state. */ + AgoraRtmpStreamingStateRunning = 2, + /** The RTMP or RTMPS streaming is recovering. When exceptions occur to the CDN, or the streaming is interrupted, the SDK attempts to resume RTMP or RTMPS streaming and returns this state. +
  • If the SDK successfully resumes the streaming, `AgoraRtmpStreamingStateRunning(2)` returns. +
  • If the streaming does not resume within 60 seconds or server errors occur, AgoraRtmpStreamingStateFailure(4) returns. You can also reconnect to the server by calling the [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:]) and [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) methods. */ + AgoraRtmpStreamingStateRecovering = 3, + /** The RTMP or RTMPS streaming fails. See the errorCode parameter for the detailed error information. You can also call the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method to publish the RTMP or RTMPS streaming again. */ + AgoraRtmpStreamingStateFailure = 4, + /** The SDK is disconnecting to Agora's streaming server and the CDN server. This state is triggered after you call the [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:transcodingEnabled:]) method. */ + AgoraRtmpStreamingStateDisconnecting = 5, +}; + +/** The detailed error information for streaming. */ +typedef NS_ENUM(NSUInteger, AgoraRtmpStreamingErrorCode) { + /** The RTMP or RTMPS streaming publishes successfully. */ + AgoraRtmpStreamingErrorCodeOK = 0, + /** Invalid argument used. If, for example, you do not call the [setLiveTranscoding]([AgoraRtcEngineKit setLiveTranscoding:]) method to configure the LiveTranscoding parameters before calling the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method, the SDK returns this error. Check whether you set the parameters in the setLiveTranscoding method properly. */ + AgoraRtmpStreamingErrorCodeInvalidParameters = 1, + /** The RTMP or RTMPS streaming is encrypted and cannot be published. */ + AgoraRtmpStreamingErrorCodeEncryptedStreamNotAllowed = 2, + /** Timeout for the RTMP or RTMPS streaming. Call the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method to publish the streaming again. */ + AgoraRtmpStreamingErrorCodeConnectionTimeout = 3, + /** An error occurs in Agora's streaming server. Call the [addPublishStreamUrl]([AgoraRtcEngineKit addPublishStreamUrl:transcodingEnabled:]) method to publish the streaming again. */ + AgoraRtmpStreamingErrorCodeInternalServerError = 4, + /** An error occurs in the CDN server. */ + AgoraRtmpStreamingErrorCodeRtmpServerError = 5, + /** The RTMP or RTMPS streaming publishes too frequently. */ + AgoraRtmpStreamingErrorCodeTooOften = 6, + /** The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones. */ + AgoraRtmpStreamingErrorCodeReachLimit = 7, + /** The host manipulates other hosts' URLs. Check your app logic. */ + AgoraRtmpStreamingErrorCodeNotAuthorized = 8, + /** Agora's server fails to find the RTMP or RTMPS streaming. */ + AgoraRtmpStreamingErrorCodeStreamNotFound = 9, + /** The format of the RTMP or RTMPS streaming URL is not supported. Check whether the URL format is correct. */ + AgoraRtmpStreamingErrorCodeFormatNotSupported = 10, + /** Current role is not broadcaster. Check whether the role of the current channel. */ + AgoraRtmpStreamingErrorNotBroadcaster = 11, + /** Call updateTranscoding, but no mix stream. */ + AgoraRtmpStreamingErrorTranscodingNoMixStream = 13, + /** Network error. */ + AgoraRtmpStreamingErrorNetDown = 14, + /** User AppId have not authorized to push stream. */ + AgoraRtmpStreamingErrorInvalidAppId = 15, + /** invalid privilege. */ + AgoraRtmpStreamingErrorInvalidPrivilege = 16, + /** The streaming has been stopped normally. After you call + [removePublishStreamUrl]([AgoraRtcEngineKit removePublishStreamUrl:]) to + stop streaming, the SDK returns this value. + + @since v3.4.5 + */ + AgoraRtmpStreamingErrorCodeUnpublishOK = 100, +}; + +/** Events during the RTMP or RTMPS streaming. */ +typedef NS_ENUM(NSUInteger, AgoraRtmpStreamingEvent) { + /** 1: An error occurs when you add a background image or a watermark image + to the RTMP stream. + */ + AgoraRtmpStreamingEventFailedLoadImage = 1, + /** 2: The streaming URL is already being used for CDN live streaming. If you + want to start new streaming, use a new streaming URL. + + @since v3.4.5 + */ + AgoraRtmpStreamingEventUrlAlreadyInUse = 2, + /** advanced feature not support. */ + AgoraRtmpStreamingEventAdvancedFeatureNotSupport = 3, + /** Client request too frequently. */ + AgoraRtmpStreamingEventRequestTooOften = 4, +}; + +/** + * Encryption error type. + */ +typedef NS_ENUM(NSInteger, AgoraEncryptionErrorType) { +/** + * 0: Internal reason. + */ + ENCRYPTION_ERROR_INTERNAL_FAILURE = 0, +/** + * 1: MediaStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + */ + ENCRYPTION_ERROR_DECRYPTION_FAILURE = 1, +/** + * 2: MediaStream encryption errors. + */ + ENCRYPTION_ERROR_ENCRYPTION_FAILURE = 2, +/** + * 3: DataStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + */ + ENCRYPTION_ERROR_DATASTREAM_DECRYPTION_FAILURE = 3, +/** + * 4: DataStream encryption errors. + */ + ENCRYPTION_ERROR_DATASTREAM_ENCRYPTION_FAILURE = 4, + +}; + +/** + * The camera direction + */ +typedef NS_ENUM(NSUInteger, AgoraCameraDirection) { + /** + * 0: Uses the rear camera. + */ + AgoraCameraDirectionRear = 0, + /** + * 1: Uses the front camera. + */ + AgoraCameraDirectionFront = 1, +}; + +/** The state code in AgoraChannelMediaRelayState. + */ +typedef NS_ENUM(NSInteger, AgoraChannelMediaRelayState) { + /** 0: The SDK is initializing. + */ + AgoraChannelMediaRelayStateIdle = 0, + /** 1: The SDK tries to relay the media stream to the destination channel. + */ + AgoraChannelMediaRelayStateConnecting = 1, + /** 2: The SDK successfully relays the media stream to the destination channel. + */ + AgoraChannelMediaRelayStateRunning = 2, + /** 3: A failure occurs. See the details in `error`. + */ + AgoraChannelMediaRelayStateFailure = 3, +}; + +/** The event code in AgoraChannelMediaRelayEvent. + */ +typedef NS_ENUM(NSInteger, AgoraChannelMediaRelayEvent) { + /** 0: The user disconnects from the server due to poor network connections. + */ + AgoraChannelMediaRelayEventDisconnect = 0, + /** 1: The network reconnects. + */ + AgoraChannelMediaRelayEventConnected = 1, + /** 2: The user joins the source channel. + */ + AgoraChannelMediaRelayEventJoinedSourceChannel = 2, + /** 3: The user joins the destination channel. + */ + AgoraChannelMediaRelayEventJoinedDestinationChannel = 3, + /** 4: The SDK starts relaying the media stream to the destination channel. + */ + AgoraChannelMediaRelayEventSentToDestinationChannel = 4, + /** 5: The server receives the video stream from the source channel. + */ + AgoraChannelMediaRelayEventReceivedVideoPacketFromSource = 5, + /** 6: The server receives the audio stream from the source channel. + */ + AgoraChannelMediaRelayEventReceivedAudioPacketFromSource = 6, + /** 7: The destination channel is updated. + */ + AgoraChannelMediaRelayEventUpdateDestinationChannel = 7, + /** 8: The destination channel update fails due to internal reasons. + */ + AgoraChannelMediaRelayEventUpdateDestinationChannelRefused = 8, + /** 9: The destination channel does not change, which means that the destination channel fails to be updated. + */ + AgoraChannelMediaRelayEventUpdateDestinationChannelNotChange = 9, + /** 10: The destination channel name is NULL. + */ + AgoraChannelMediaRelayEventUpdateDestinationChannelIsNil = 10, + /** 11: The video profile is sent to the server. + */ + AgoraChannelMediaRelayEventVideoProfileUpdate = 11, +}; + +/** The error code in AgoraChannelMediaRelayError. + */ +typedef NS_ENUM(NSInteger, AgoraChannelMediaRelayError) { + /** 0: The state is normal. + */ + AgoraChannelMediaRelayErrorNone = 0, + /** 1: An error occurs in the server response. + */ + AgoraChannelMediaRelayErrorServerErrorResponse = 1, + /** 2: No server response. You can call the [leaveChannel]([AgoraRtcEngineKit leaveChannel:]) method to leave the channel. + */ + AgoraChannelMediaRelayErrorServerNoResponse = 2, + /** 3: The SDK fails to access the service, probably due to limited resources of the server. + */ + AgoraChannelMediaRelayErrorNoResourceAvailable = 3, + /** 4: Fails to send the relay request. + */ + AgoraChannelMediaRelayErrorFailedJoinSourceChannel = 4, + /** 5: Fails to accept the relay request. + */ + AgoraChannelMediaRelayErrorFailedJoinDestinationChannel = 5, + /** 6: The server fails to receive the media stream. + */ + AgoraChannelMediaRelayErrorFailedPacketReceivedFromSource = 6, + /** 7: The server fails to send the media stream. + */ + AgoraChannelMediaRelayErrorFailedPacketSentToDestination = 7, + /** 8: The SDK disconnects from the server due to poor network connections. You can call the [leaveChannel]([AgoraRtcEngineKit leaveChannel:]) method to leave the channel. + */ + AgoraChannelMediaRelayErrorServerConnectionLost = 8, + /** 9: An internal error occurs in the server. + */ + AgoraChannelMediaRelayErrorInternalError = 9, + /** 10: The token of the source channel has expired. + */ + AgoraChannelMediaRelayErrorSourceTokenExpired = 10, + /** 11: The token of the destination channel has expired. + */ + AgoraChannelMediaRelayErrorDestinationTokenExpired = 11, +}; + +/* + * The stream subscribe state. + */ +typedef NS_ENUM (NSInteger, AgoraStreamSubscribeState) { + AgoraStreamSubscribeStateIdle = 0, + AgoraStreamSubscribeStateNoSubscribed = 1, + AgoraStreamSubscribeStateSubscribing = 2, + AgoraStreamSubscribeStateSubscribed = 3 +}; + +/** + * The stream publish state. + */ +typedef NS_ENUM (NSInteger, AgoraStreamPublishState) { + AgoraStreamPublishStateIdle = 0, + AgoraStreamPublishStateNoPublished = 1, + AgoraStreamPublishStatePublishing = 2, + AgoraStreamPublishStatePublished = 3 +}; +/** + * The screen sharing scenario. + * + * @since v4.0.0 + */ +typedef NS_ENUM(NSInteger, AgoraScreenScenarioType) { + /** 1: (Default) Document. This scenario prioritizes the video quality of screen sharing and reduces the latency of the shared video for the receiver. If you share documents, slides, and tables, you can set this scenario. + */ + AgoraScreenScenarioDocument = 1, + /** 2: Game. This scenario prioritizes the smoothness of screen sharing. If you share games, you can set this scenario. + */ + AgoraScreenScenarioGaming = 2, + /** 3: Video. This scenario prioritizes the smoothness of screen sharing. If you share movies or live videos, you can set this scenario. + */ + AgoraScreenScenarioVideo = 3, + /** 4: Remote control. This scenario prioritizes the video quality of screen sharing and reduces the latency of the shared video for the receiver. If you share the device desktop being remotely controlled, you can set this scenario. + */ + AgoraScreenScenarioRDC = 4, +}; +/** + * Media source types definition. + */ +typedef NS_ENUM(NSInteger, AgoraMediaSourceType) { + /** + * 0: The audio playback device. + */ + AgoraMediaSourceTypeAudioPlayout = 0, + /** + * 1: Microphone. + */ + AgoraMediaSourceTypeRecording = 1, + /** + * 2: Video captured by primary camera. + */ + AgoraMediaSourceTypePrimaryCamera = 2, + /** + * 3: Video captured by secondary camera. + */ + AgoraMediaSourceTypeSecondaryCamera = 3, + /** + * 4: Video captured by primary screen capturer. + */ + AgoraMediaSourceTypePrimaryScreen = 4, + /** + * 5: Video captured by secondary screen capturer. + */ + AgoraMediaSourceTypeSecondaryScreen = 5, + /** + * 6: Video captured by custom video source. + */ + AgoraMediaSourceTypeCustomVideo = 6, + /** + * 7: Video for media player sharing. + */ + AgoraMediaSourceTypeMediaPlayer = 7, + /** + * 8: Video for png image. + */ + AgoraMediaSourceTypeRtcImagePng = 8, + /** + * 9: Video for jpeg image. + */ + AgoraMediaSourceTypeRtcImageJpeg = 9, + /** + * 10: Video for gif image. + */ + AgoraMediaSourceTypeRtcImageGif = 10, + /** + * 11: Remote video received from network. + */ + AgoraMediaSourceTypeRemoteVideo = 11, + /** + * 12: Video for transcoded. + */ + AgoraMediaSourceTypeTranscodedVideo = 12, + /** + * 100: unknown media source. + */ + AgoraMediaSourceTypeUnknown = 100 +}; + +/** + * Video source types definition. + */ +typedef NS_ENUM(NSInteger, AgoraVideoSourceType) { + /** Video captured by the camera. + */ + AgoraVideoSourceTypeCamera = 0, + /** Video captured by the secondary camera. + */ + AgoraVideoSourceTypeCameraSecondary = 1, + /** Video for screen sharing. + */ + AgoraVideoSourceTypeScreen = 2, + /** Video for secondary screen sharing. + */ + AgoraVideoSourceTypeScreenSecondary = 3, + /** Video for custom video. + */ + AgoraVideoSourceTypeCustom = 4, + /** Video for media player sharing. + */ + AgoraVideoSourceTypeMediaPlayer = 5, + /** Video for png image. + */ + AgoraVideoSourceTypeImagePNG = 6, + /** Video for JPEG image. + */ + AgoraVideoSourceTypeImageJPEG = 7, + /** Video for GIF image. + */ + AgoraVideoSourceTypeImageGIF = 8, + /** Remote video received from network. + */ + AgoraVideoSourceTypeRemote = 9, + /** Video for transcoded. + */ + AgoraVideoSourceTypeTransCoded = 10, + /** Video captured by the third camera. + */ + AgoraVideoSourceTypeCameraThird = 11, + /** Video captured by the fourth camera. + */ + AgoraVideoSourceTypeCameraFourth = 12, + /** Video for third screen sharing. + */ + AgoraVideoSourceTypeScreenThird = 13, + /** Video for fourth screen sharing. + */ + AgoraVideoSourceTypeScreenFourth = 14, + /** Not define. + */ + AgoraVideoSourceTypeUnknown = 100 +}; + +/** + * The external video source type. + */ +typedef NS_ENUM(NSInteger, AgoraExternalVideoSourceType) { + /** + * 0: non-encoded video frame. + */ + AgoraExternalVideoSourceTypeVideoFrame = 0, + /** + * 1: encoded video frame. + */ + AgoraExternalVideoSourceTypeEncodedVideoFrame, +}; + +/** + * The dual stream mode + */ +typedef NS_ENUM(NSInteger, AgoraSimulcastStreamMode) { + /** -1 : disable simulcast stream until receive request for enable simulcast stream by other broadcaster + */ + AgoraAutoSimulcastStream = -1, + /** 0 : disable simulcast stream + */ + AgoraDisableSimulcastStream = 0, + /** 1 : always enable simulcast stream + */ + AgoraEnableSimulcastStream = 1, +}; + +/** + * AgoraMediaStreamType, reporting the type of the media stream. + */ +typedef NS_ENUM(NSInteger, AgoraMediaStreamType) { + /** `0`: The type is unknown. */ + AgoraMediaStreamTypeUnknown = 0, + /** `1`: The video stream. */ + AgoraMediaStreamTypeVideo = 1, + /** `2`: The audio stream. */ + AgoraMediaStreamTypeAudio = 2, + /** `3`: The subtitle stream. */ + AgoraMediaStreamTypeSubtitle = 3, +}; + +/** + * @brief Player state + * + */ +typedef NS_ENUM(NSInteger, AgoraMediaPlayerState) { + /** Player idle + */ + AgoraMediaPlayerStateIdle = 0, + /** Opening media file + */ + AgoraMediaPlayerStateOpening, + /** Media file opened successfully + */ + AgoraMediaPlayerStateOpenCompleted, + /** Player playing + */ + AgoraMediaPlayerStatePlaying, + /** Player paused + */ + AgoraMediaPlayerStatePaused, + /** Player playback one loop completed + */ + AgoraMediaPlayerStatePlayBackCompleted, + /** Player playback all loops completed + */ + AgoraMediaPlayerStatePlayBackAllLoopsCompleted, + /** Player stopped + */ + AgoraMediaPlayerStateStopped, + /** Player pausing (internal) + */ + AgoraMediaPlayerStatePausingInternal = 50, + /** Player stopping (internal) + */ + AgoraMediaPlayerStateStoppingInternal, + /** Player seeking state (internal) + */ + AgoraMediaPlayerStateSeekingInternal, + /** Player getting state (internal) + */ + AgoraMediaPlayerStateGettingInternal, + /** None state for state machine (internal) + */ + AgoraMediaPlayerStateNoneInternal, + /** Do nothing state for state machine (internal) + */ + AgoraMediaPlayerStateDoNothingInternal, + /** Player set track state (internal) + */ + AgoraMediaPlayerStateSetTrackInternal, + /** Player failed + */ + AgoraMediaPlayerStateFailed = 100, +}; + +/** + * The video display mode. + */ +typedef NS_ENUM(NSUInteger, AgoraMediaPlayerRenderMode) { + /** + * 1: Uniformly scale the video until it fills the visible boundaries + * (cropped). One dimension of the video may have clipped contents. + */ + AgoraMediaPlayerRenderModeHidden = 1, + /** + * 2: Uniformly scale the video until one of its dimension fits the boundary + * (zoomed to fit). Areas that are not filled due to the disparity in the + * aspect ratio will be filled with black. + */ + AgoraMediaPlayerRenderModeFit = 2, +}; + +/** AgoraMediaPlayerError, reporting the player's error code. */ +typedef NS_ENUM(NSInteger, AgoraMediaPlayerError) { + /** `0`: No error. */ + AgoraMediaPlayerErrorNone = 0, + /** `-1`: Invalid arguments. */ + AgoraMediaPlayerErrorInvalidArguments = -1, + /** `-2`: Internal error. */ + AgoraMediaPlayerErrorInternal = -2, + /** `-3`: No resource. */ + AgoraMediaPlayerErrorNoSource = -3, + /** `-4`: Invalid media resource. */ + AgoraMediaPlayerErrorInvalidMediaSource = -4, + /** `-5`: The type of the media stream is unknown. */ + AgoraMediaPlayerErrorUnknowStreamType = -5, + /** `-6`: The object is not initialized. */ + AgoraMediaPlayerErrorObjNotInitialized = -6, + /** `-7`: The codec is not supported. */ + AgoraMediaPlayerErrorCodecNotSupported = -7, + /** `-8`: Invalid renderer. */ + AgoraMediaPlayerErrorVideoRenderFailed = -8, + /** `-9`: Error occurs in the internal state of the player. */ + AgoraMediaPlayerErrorInvalidState = -9, + /** `-10`: The URL of the media resource can not be found. */ + AgoraMediaPlayerErrorUrlNotFound = -10, + /** `-11`: Invalid connection between the player and Agora's Server. */ + AgoraMediaPlayerErrorInvalidConnectState = -11, + /** `-12`: The playback buffer is insufficient. */ + AgoraMediaPlayerErrorSrcBufferUnderflow = -12, + /** `-13`: The audio mixing file playback is interrupted. */ + AgoraMediaPlayerErrorInterrupted = -13, + /** `-14`: The SDK does not support this function.*/ + AgoraMediaPlayerErrorNotSupported = -14, + /** `-15`: The token has expired.*/ + AgoraMediaPlayerErrorTokenExpired = -15, + /** `-16`: The ip has expired.*/ + AgoraMediaPlayerErrorIpExpired = -16, + /** `-17`: An unknown error occurs.*/ + AgoraMediaPlayerErrorUnknown = -17, +}; + +/** AgoraMediaPlayerEvent, reporting the result of the seek operation to the new + playback position. +*/ +typedef NS_ENUM(NSInteger, AgoraMediaPlayerEvent) { + /** `0`: Begins to seek to the new playback position. */ + AgoraMediaPlayerEventSeekBegin = 0, + /** `1`: Finish seeking to the new playback position. */ + AgoraMediaPlayerEventSeekComplete = 1, + /** `2`: Error occurs when seeking to the new playback position. */ + AgoraMediaPlayerEventSeekError = 2, + /** The player changes the audio track for playback. */ + AgoraMediaPlayerEventAudioTrackChanged= 5, + /** player buffer low. */ + AgoraMediaPlayerEventBufferLow = 6, + /** player buffer recover. */ + AgoraMediaPlayerEventBufferRecover = 7, + /** `8`: The video or audio is interrupted. */ + AgoraMediaPlayerEventFreezeStart = 8, + /** `9`: Interrupt at the end of the video or audio. */ + AgoraMediaPlayerEventFreezeStop = 9, + /** switch source begin. */ + AgoraMediaPlayerEventSwitchBegin = 10, + /** switch source complete. */ + AgoraMediaPlayerEventSwitchComplete = 11, + /** switch source error. */ + AgoraMediaPlayerEventSwitchError = 12, + /** An application can render the video to less than a second. */ + AgoraMediaPlayerEventFirstDisplayed = 13, + /** cache resources exceed the maximum number */ + AgoraMediaPlayerEventReachCacheFileMaxCount = 14, + /** cache resources exceed the maximum file size */ + AgoraMediaPlayerEventReachCacheFileMaxSize = 15, + /** Triggered when a retry is required to open the media*/ + AgoraMediaPlayerEventTryOpenStart = 16, + /** Triggered when the retry to open the media is successful*/ + AgoraMediaPlayerEventTryOpenSucceed = 17, + /** Triggered when retrying to open media fails*/ + AgoraMediaPlayerEventTryOpenFailed = 18, +}; + +/** + * @brief The play preload another source event. + */ +typedef NS_ENUM(NSUInteger, AgoraMediaPlayerPreloadEvent) { + /** preload source begin. */ + AgoraMediaPlayerPreloadEventBegin = 0, + /** preload source complete. */ + AgoraMediaPlayerPreloadEventComplete = 1, + /** preload source error. */ + AgoraMediaPlayerPreloadEventError = 2, +}; + +/** + * AgoraMediaPlayerMetaDataType, reporting the type of the media metadata. + */ +typedef NS_ENUM(NSUInteger, AgoraMediaPlayerMetaDataType) { + /** `0`: The type is unknown. */ + AgoraMediaPlayerMetaDataTypeUnknown = 0, + /** `1`: The type is SEI. */ + AgoraMediaPlayerMetaDataTypeSEI = 1, +}; + +/** Type of permission. + */ +typedef NS_ENUM(NSInteger, AgoraPermissionType) { + /** 0: Permission, Record Audio + */ + AgoraPermissionTypeRecordAudio = 0, + /** 1:Permission, Camera + */ + AgoraPermissionTypeCamera = 1, +}; + +/** + * @brief Streaming state + * + */ +typedef NS_ENUM(NSInteger, AgoraDirectCdnStreamingState) { + /** State idle. */ + AgoraDirectCdnStreamingStateIdle = 0, + /** Start pushing the stream. */ + AgoraDirectCdnStreamingStateRunning = 1, + /** Stop push stream. */ + AgoraDirectCdnStreamingStateStopped = 2, + /** Failed to push the stream.*/ + AgoraDirectCdnStreamingStateFailed = 3, + /** Retrying to push stream */ + AgoraDirectCdnStreamingStateRecovering = 4, +}; + +/** + */ +typedef NS_ENUM(NSInteger, AgoraDirectCdnStreamingError) { +// No error occurs. + AgoraDirectCdnStreamingErrorOK = 0, +// A general error occurs (no specified reason). + AgoraDirectCdnStreamingErrorFailed = 1, +// Audio publication error. + AgoraDirectCdnStreamingErrorAudioPublication = 2, +// Video publication error. + AgoraDirectCdnStreamingErrorVideoPublication = 3, +// Network connect error. + AgoraDirectCdnStreamingErrorNetConnect = 4, +// Already exist stream name. + AgoraDirectCdnStreamingErrorBadName = 5, +}; + +/** Type of ear monitoring. + */ +typedef NS_OPTIONS(NSInteger, AgoraEarMonitoringFilterType) { + /** + * 1: Do not add an audio filter to the in-ear monitor. + */ + AgoraEarMonitoringFilterNone = (1<<0), + /** + * 2: Add an audio filter to the in-ear monitor. + */ + AgoraEarMonitoringFilterBuiltInAudioFilters = (1<<1), + /** + * 4: Enable noise suppression to the in-ear monitor. + */ + AgoraEarMonitoringFilterNoiseSuppression = (1<<2), + /** + * 6: Enable both audio fileter and noise suppression to the in-ear monitor. + */ + AgoraEarMonitoringFilterBuiltInAudioFiltersWithNoiseSuppression = (1<<1) | (1<<2) +}; + +/** The bit mask that controls the audio observation positions. + */ +typedef NS_OPTIONS(NSUInteger, AgoraAudioFramePosition) { + /** The position for observing the playback audio of all remote users after + mixing, which enables the SDK to trigger the + [onPlaybackAudioFrame]([AgoraAudioFrameDelegate onPlaybackAudioFrame:]) + callback. + */ + AgoraAudioFramePositionPlayback = 1 << 0, + /** The position for observing the recorded audio of the local user, which + enables the SDK to trigger the + [onRecordAudioFrame]([AgoraAudioFrameDelegate onRecordAudioFrame:]) + callback. + */ + AgoraAudioFramePositionRecord = 1 << 1, + /** The position for observing the mixed audio of the local user and all + remote users, which enables the SDK to trigger the + [onMixedAudioFrame]([AgoraAudioFrameDelegate onMixedAudioFrame:]) + callback. + */ + AgoraAudioFramePositionMixed = 1 << 2, + /** The position for observing the audio of a single remote user before + mixing, which enables the SDK to trigger the + [onPlaybackAudioFrameBeforeMixing]([AgoraAudioFrameDelegate onPlaybackAudioFrameBeforeMixing:uid:]) + callback. + */ + AgoraAudioFramePositionBeforeMixing = 1 << 3, + /** The position for observing the ear monitoring audio of the local user + [onEarMonitoringAudioFrame]([AgoraAudioFrameDelegate onEarMonitoringAudioFrame:]) callback. + */ + AgoraAudioFramePositionEarMonitoring = 1 << 4, + /** The position for observing the before-publishing audio of the local user + [onPublishAudioFrame]([AgoraAudioFrameDelegate onPublishAudioFrame:]) callback. + */ + AgoraAudioFramePositionPublish = 1 << 5, +}; + +/** The content hint for screen sharing. */ +typedef NS_ENUM(NSUInteger, AgoraVideoContentHint) { + /** 0: (Default) No content hint. */ + AgoraVideoContentHintNone = 0, + /** 1: Motion-intensive content. Choose this option if you prefer smoothness or when you are sharing a video clip, movie, or video game. */ + AgoraVideoContentHintMotion = 1, + /** 2: Motionless content. Choose this option if you prefer sharpness or when you are sharing a picture, PowerPoint slide, or text. */ + AgoraVideoContentHintDetails = 2, +}; + +/** Thread priority type. + */ +typedef NS_ENUM(NSInteger, AgoraThreadPriorityType) { + /** + * 0: Lowest priority. + */ + AgoraThreadPriorityTypeLowest = 0, + /** + * 1: Low priority. + */ + AgoraThreadPriorityTypeLow = 1, + /** + * 2: Normal priority. + */ + AgoraThreadPriorityTypeNormal = 2, + /** + * 3: High priority. + */ + AgoraThreadPriorityTypeHigh = 3, + /** + * 4. Highest priority. + */ + AgoraThreadPriorityTypeHighest = 4, + /** + * 5. Critical priority. + */ + AgoraThreadPriorityTypeCritical = 5, +}; + +typedef NS_ENUM(NSUInteger, AgoraContentInspectType) { + /** default type is invalid */ + AgoraContentInspectTypeInvalid = 0, + /** + * @deprecated + * content inspect type moderation + */ + AgoraContentInspectTypeModeration __deprecated = 1, + /** content inspect type supervise */ + AgoraContentInspectTypeSupervise = 2, + /** content inspect type image moderation */ + AgoraContentInspectTypeImageModeration = 3, +}; + +typedef NS_ENUM(NSUInteger, AgoraContentInspectResult) { + AgoraContentInspectNeutral = 1, + // background image does not exist + AgoraContentInspectSexy = 2, + // color format is not supported + AgoraContentInspectPorn = 3, +}; + +/** The audio dual-mono output mode. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioDualMonoMode) { + /**< ChanLOut=ChanLin, ChanRout=ChanRin */ + AgoraAudioDualMonoStereo, + /**< ChanLOut=ChanRout=ChanLin */ + AgoraAudioDualMonoL, + /**< ChanLOut=ChanRout=ChanRin */ + AgoraAudioDualMonoR, + /**< ChanLout=ChanRout=(ChanLin+ChanRin)/2 */ + AgoraAudioDualMonoMix +}; + +/** The audio mixing dual-mono output mode. + */ +typedef NS_ENUM(NSUInteger, AgoraAudioMixingDualMonoMode) { + /* 0: Original mode */ + AgoraAudioMixingDualMonoAuto = 0, + /* 1: Left channel mode */ + AgoraAudioMixingDualMonoL = 1, + /* 2: Right channel mode */ + AgoraAudioMixingDualMonoR = 2, + /* 3: Mixed channel mode */ + AgoraAudioMixingDualMonoMix = 3, +}; + +/** + The states of the rhythm player. + */ +typedef NS_ENUM(NSInteger, AgoraRhythmPlayerState) { + /** 810: The rhythm player is idle. */ + AgoraRhythmPlayerStateIdle = 810, + /** 811: The rhythm player is opening files. */ + AgoraRhythmPlayerStateOpening, + /** 812: 812: Files opened successfully, the rhythm player starts decoding files. */ + AgoraRhythmPlayerStateDecoding, + /** 813: Files decoded successfully, the rhythm player starts mixing the two files and playing back them locally. */ + AgoraRhythmPlayerStatePlaying, + /** 814: The rhythm player is starting to fail, and you need to check the error code for detailed failure reasons. */ + AgoraRhythmPlayerStateFailed, +}; + +/** + The error codes of the rhythm player. + */ +typedef NS_ENUM(NSInteger, AgoraRhythmPlayerError) { + /** 0: The rhythm player works well. */ + AgoraRhythmPlayerErrorOK = 0, + /** 1: The rhythm player occurs a internal error. */ + AgoraRhythmPlayerErrorFailed = 1, + /** 801: The rhythm player can not open the file. */ + AgoraRhythmPlayerErrorCanNotOpen = 801, + /** 802: The rhythm player can not play the file. */ + AgoraRhythmPlayerErrorCanNotPlay, + /** 803: The file duration over the limit. The file duration limit is 1.2 seconds. */ + AgoraRhythmPlayerErrorFileOverDurationLimit, +}; + +/** + The error codes of the local video transcoder. + */ +typedef NS_ENUM(NSInteger, AgoraVideoTranscoderError) { + /** + * No error + */ + AgoraVideoTranscoderErrorOK = 0, + /** + * Occurs when video track not started of video source. + */ + AgoraVideoTranscoderErrorVideoSourceNotReady = 1, + /** + * Occurs when source type not on support list. + */ + AgoraVideoTranscoderErrorInvalidVideoSourceType = 2, + /** + * Occurs when image url is not correctly of image source. + */ + AgoraVideoTranscoderErrorInvalidImagePath = 3, + /** + * Occurs when image format not the type png/jpeg/gif of image source. + */ + AgoraVideoTranscoderErrorUnsupportImageFormat = 4, + /** + * Occurs when layout is invalid such as width is zero. + */ + AgoraVideoTranscoderErrorInvalidLayout = 5, + /** + * Internal error. + */ + AgoraVideoTranscoderErrorInternal = 20 +}; + +typedef NS_ENUM(NSUInteger, AgoraLocalProxyMode) { + /** Connect local proxy with high priority, if not connected to local proxy, fallback to sdrtn. + */ + AgoraConnectivityFirst = 0, + /** Only connect local proxy. + */ + AgoraLocalOnly = 1, +} NS_SWIFT_NAME(AgoraLocalProxyMode); + +/** The proxy type. + */ +typedef NS_ENUM(NSUInteger, AgoraProxyType) { + /** Not connected cloud proxy or local proxy. + */ + AgoraNoneProxyType = 0, + /** The cloud proxy for the UDP protocol. + */ + AgoraUdpProxyType = 1, + /** The cloud proxy for the TCP (encrypted) protocol. + */ + AgoraTcpProxyType = 2, + /** The local proxy + */ + AgoraLocalProxyType = 3, + /** The cloud proxy, auto fallback. + */ + AgoraTcpProxyAutoFallbackType = 4, +} NS_SWIFT_NAME(AgoraProxyType); + + +/** mode of setting view. + */ +typedef NS_ENUM(NSInteger, AgoraVideoViewSetupMode) { + AgoraVideoViewSetupReplace = 0, + AgoraVideoViewSetupAdd = 1, + AgoraVideoViewSetupRemove = 2, +}; + +typedef NS_ENUM(NSInteger, AgoraAudioProcessChannels) { + AgoraAudioProcessChannelsMono = 1, + AgoraAudioProcessChannelstereo = 2, +}; + +/** + * The frame position of the video observer. + */ +typedef NS_OPTIONS(NSUInteger, AgoraVideoFramePosition) { + /** 1: The post-capturer position, which corresponds to the video data in the onCaptureVideoFrame callback. + */ + AgoraVideoFramePositionPostCapture = 1 << 0, + /** 2: The pre-renderer position, which corresponds to the video data in the onRenderVideoFrame callback. + */ + AgoraVideoFramePositionPreRenderer = 1 << 1, + /** 4: The pre-encoder position, which corresponds to the video data in the onPreEncodeVideoFrame callback. + */ + AgoraVideoFramePositionPreEncoder = 1 << 2, +}; + +/** + * The reason of notifying the user of a message. + */ +typedef NS_ENUM(NSUInteger, AgoraWlAccReason) { + /** + * WIFI signal is weak. + */ + AgoraWlAccMessageReasonWeakSignal = 0, + /** + * Channel congestion. + */ + AgoraWlAccMessageReasonChannelCongestion = 1, +}; + +/** + * Suggest an action for the user. + */ +typedef NS_ENUM(NSUInteger, AgoraWlAccAction) { + /** + * Please get close to AP. + */ + AgoraWlAccSuggestActionCloseToWIFI = 0, + /** + * The user is advised to connect to the prompted SSID. + */ + AgoraWlAccSuggestActionConnectSSID = 1, + /** + * The user is advised to check whether the AP supports 5G band and enable 5G band (the aciton link is attached), or purchases an AP that supports 5G. AP does not support 5G band. + */ + AgoraWlAccSuggestActionCheck5G = 2, + /** + * The user is advised to change the SSID of the 2.4G or 5G band (the aciton link is attached). The SSID of the 2.4G band AP is the same as that of the 5G band. + */ + AgoraWlAccSuggestActionModifySSID = 3, +}; + +/** The state of agora media recorder. */ +typedef NS_ENUM(NSInteger, AgoraMediaRecorderState) { + /** -1: Media recorder is in wrong state. */ + AgoraMediaRecorderStateError = -1, + /** 2: Media recorder is started. */ + AgoraMediaRecorderStateStarted = 2, + /** 3: Media recorder is stopped. */ + AgoraMediaRecorderStateStopped = 3, +}; +/** Recorder error code. */ +typedef NS_ENUM(NSInteger, AgoraMediaRecorderErrorCode) { + /** 0: No error occurs. */ + AgoraMediaRecorderErrorCodeNoError = 0, + /** 1: Store media data into local file failed. */ + AgoraMediaRecorderErrorCodeWriteFailed = 1, + /** 2: Occurs when there is no media stream. */ + AgoraMediaRecorderErrorCodeNoStream = 2, + /** 3: Occurs when duration of media stream is already over maxmium stream duration. */ + AgoraMediaRecorderErrorCodeOverMaxDuration = 3, + /** 4: Occurs when recording configuration changes. */ + AgoraMediaRecorderErrorCodeConfigChange = 4, +}; +/** Recorder stream type. */ +typedef NS_ENUM(NSInteger, AgoraMediaRecorderStreamType) { + /** 1: Record audio only. */ + AgoraMediaRecorderStreamTypeAudio = 1, + /** 2: Record video only. */ + AgoraMediaRecorderStreamTypeVideo = 2, + /** 3: Record both audio and video. */ + AgoraMediaRecorderStreamTypeBoth = 3, +}; +/** Recorder container format. */ +typedef NS_ENUM(NSInteger, AgoraMediaRecorderContainerFormat) { + /** 1: Format of mp4. */ + AgoraMediaRecorderContainerFormatMP4 = 1, +}; + +/** +The type of the shared target. +*/ + +typedef NS_ENUM(NSInteger, AgoraScreenCaptureSourceType) { + /** -1: Unknown type. */ + AgoraScreenCaptureSourceTypeUnknown = -1, + /** 0: The shared target is a window. */ + AgoraScreenCaptureSourceTypeWindow = 0, + /** 1: The shared target is a screen of a particular monitor. */ + AgoraScreenCaptureSourceTypeScreen = 1, + /** 2: Reserved parameter. */ + AgoraScreenCaptureSourceTypeCustom = 2, +}; + +typedef NS_ENUM(NSInteger, AgoraScreenCaptureFrameRateCapability) { + AgoraScreenCaptureFrameRateUnKonw = -1, + AgoraScreenCaptureFrameRate15FPS = 0, + AgoraScreenCaptureFrameRate30FPS = 1, + AgoraScreenCaptureFrameRate60FPS = 2, +}; + +/** + * The tracing event of media rendering. + */ +typedef NS_ENUM(NSInteger, AgoraMediaTraceEvent) { + /** + * 0: The media frame has been rendered. + */ + AgoraMediaTraceEventVideoRendered = 0, + /** + * 1: The media frame has been decoded. + */ + AgoraMediaTraceEventVideoDecoded = 1, +}; + +typedef NS_ENUM(NSUInteger, AgoraFeatureType) { + AgoraVideoPreprocessVirtualBackground = 1, + AgoraVideoPreprocessBeauty = 2, +}; + +typedef NS_ENUM(NSInteger, AgoraAudioTrackType) { + /** + * 0: Mixable audio track + * You can push more than one mixable Audio tracks into one RTC connection(channel id + uid), + * and SDK will mix these tracks into one audio track automatically. + * However, compare to direct audio track, mixable track might cause extra 30ms+ delay. + */ + AgoraAudioTrackTypeMixable = 0, + /** + * 1: Direct audio track + * You can only push one direct (non-mixable) audio track into one RTC connection(channel id + uid). + * Compare to mixable stream, you can have lower lantency using direct audio track. + */ + AgoraAudioTrackTypeDirect = 1, +}; diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraExtensionProviderEntry.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraExtensionProviderEntry.h new file mode 100644 index 0000000..66c43e7 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraExtensionProviderEntry.h @@ -0,0 +1,49 @@ +// +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "NGIAgoraExtensionControl.h" +AGORA_API agora::rtc::IExtensionControl* AGORA_CALL getAgoraExtensionControl(); +AGORA_API void AGORA_CALL declareProviderVersion( + const char*, const agora::rtc::ExtensionVersion&); +typedef void(*agora_ext_entry_func_t)(void); +AGORA_API void AGORA_CALL registerProviderEntry(const char*, agora_ext_entry_func_t); + +#define DECLARE_CREATE_AND_REGISTER_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, ...) \ +static void register_##PROVIDER_NAME##_to_agora() { \ + auto control = getAgoraExtensionControl(); \ + agora::rtc::ExtensionVersion version = \ + agora::rtc::ExtensionInterfaceVersion::Version(); \ + declareProviderVersion(#PROVIDER_NAME, version); \ + if (#PROVIDER_NAME && control) { \ + control->registerProvider(#PROVIDER_NAME, \ + new agora::RefCountedObject(__VA_ARGS__)); \ + } \ +} \ + +#if defined (__GNUC__) +#define REGISTER_AGORA_EXTENSION_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, ...) \ +DECLARE_CREATE_AND_REGISTER_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, __VA_ARGS__); \ +__attribute__((constructor, used)) \ +static void _##PROVIDER_NAME##_provider_entry() { \ + registerProviderEntry(#PROVIDER_NAME, register_##PROVIDER_NAME##_to_agora); \ +} \ + +#elif defined (_MSC_VER) +#define REGISTER_AGORA_EXTENSION_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, ...) \ +DECLARE_CREATE_AND_REGISTER_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, __VA_ARGS__); \ +static int _##PROVIDER_NAME##_provider_entry() { \ + registerProviderEntry(#PROVIDER_NAME, register_##PROVIDER_NAME##_to_agora); \ + return 0; \ +} \ +const int DUMMY_AGORA_REGEXT_##PROVIDE_NAME##_VAR = _##PROVIDER_NAME##_provider_entry(); \ + +#else +#error Unsupported Compilation Toolchain! +#endif diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraExtensionVersion.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraExtensionVersion.h new file mode 100644 index 0000000..da4d563 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraExtensionVersion.h @@ -0,0 +1,111 @@ +// +// Copyright (c) 2021 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once + +namespace agora { +namespace rtc { + +struct ExtensionVersion { + // Extension Framework Version : major.minor.micro + int major_v; + int minor_v; + int micro_v; + + ExtensionVersion() + : major_v(0), minor_v(0), micro_v(0) {} + ExtensionVersion(int majorV, int minorV = 0, int microV = 0) + : major_v(majorV), minor_v(minorV), micro_v(microV) {} + + bool operator==(const ExtensionVersion& other) const { + return major_v == other.major_v && minor_v == other.minor_v && micro_v == other.micro_v; + } + + bool operator>(const ExtensionVersion& other) const { + return major_v > other.major_v || (major_v == other.major_v && minor_v > other.minor_v) + || (major_v == other.major_v && minor_v == other.minor_v && micro_v > other.micro_v); + } + + bool operator<(const ExtensionVersion& other) const { + return major_v < other.major_v || (major_v == other.major_v && minor_v < other.minor_v) + || (major_v == other.major_v && minor_v == other.minor_v && micro_v < other.micro_v); + } + + bool operator<=(const ExtensionVersion& other) const { + return !operator>(other); + } + + bool operator>=(const ExtensionVersion& other) const { + return !operator<(other); + } +}; + +#define BUMP_MAJOR_VERSION(VERSION) \ + ExtensionVersion(VERSION.major_v + 1, 0, 0); \ + +#define BUMP_MINOR_VERSION(VERSION) \ + ExtensionVersion(VERSION.major_v, VERSION.minor_v + 1, 0); \ + +#define BUMP_MICRO_VERSION(VERSION) \ + ExtensionVersion(VERSION.major_v, VERSION.minor_v, VERSION.micro_v + 1); \ + +class IExtensionProvider; +class IExtensionProviderV2; +class IExtensionProviderV3; +class IAudioFilter; +class IAudioFilterV2; +class IExtensionVideoFilter; +class IScreenCaptureSource; + +template +struct ExtensionInterfaceVersion; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return ExtensionVersion(1, 0, 0); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion::Version()); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return ExtensionVersion(1, 0, 0); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion::Version()); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return ExtensionVersion(1, 0, 0); + } +}; + +template <> +struct ExtensionInterfaceVersion { + static ExtensionVersion Version() { + return ExtensionVersion(1, 0, 0); + } +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaBase.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaBase.h new file mode 100644 index 0000000..a1e24bd --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaBase.h @@ -0,0 +1,1662 @@ +// +// Agora Engine SDK +// +// Created by Sting Feng in 2017-11. +// Copyright (c) 2017 Agora.io. All rights reserved. + +#pragma once // NOLINT(build/header_guard) + +#include +#include +#include +#include + +#ifndef OPTIONAL_ENUM_SIZE_T +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_SIZE_T enum : size_t +#else +#define OPTIONAL_ENUM_SIZE_T enum +#endif +#endif + +#if !defined(__APPLE__) +#define __deprecated +#endif + +namespace agora { +namespace rtc { + +typedef unsigned int uid_t; +typedef unsigned int track_id_t; +typedef unsigned int conn_id_t; +typedef unsigned int video_track_id_t; + +static const unsigned int INVALID_TRACK_ID = 0xffffffff; +static const unsigned int DEFAULT_CONNECTION_ID = 0; +static const unsigned int DUMMY_CONNECTION_ID = (std::numeric_limits::max)(); + + +struct EncodedVideoFrameInfo; + +struct ExtensionContext { + /** Whether uid is valid. + */ + bool isValid; + /** Default 0 when "isValid" is false + * Local user is 0 and remote user great than 0 when "isValid" is true + */ + uid_t uid; + /** current extension's provider name + */ + const char *providerName; + /** current extension's name + */ + const char *extensionName; + ExtensionContext():isValid(false), uid(0), providerName(NULL), extensionName(NULL) {} +}; + + +/** +* Video source types definition. +**/ +enum VIDEO_SOURCE_TYPE { + /** Video captured by the camera. + */ + VIDEO_SOURCE_CAMERA_PRIMARY = 0, + VIDEO_SOURCE_CAMERA = VIDEO_SOURCE_CAMERA_PRIMARY, + /** Video captured by the secondary camera. + */ + VIDEO_SOURCE_CAMERA_SECONDARY = 1, + /** Video for screen sharing. + */ + VIDEO_SOURCE_SCREEN_PRIMARY = 2, + VIDEO_SOURCE_SCREEN = VIDEO_SOURCE_SCREEN_PRIMARY, + /** Video for secondary screen sharing. + */ + VIDEO_SOURCE_SCREEN_SECONDARY = 3, + /** Not define. + */ + VIDEO_SOURCE_CUSTOM = 4, + /** Video for media player sharing. + */ + VIDEO_SOURCE_MEDIA_PLAYER = 5, + /** Video for png image. + */ + VIDEO_SOURCE_RTC_IMAGE_PNG = 6, + /** Video for png image. + */ + VIDEO_SOURCE_RTC_IMAGE_JPEG = 7, + /** Video for png image. + */ + VIDEO_SOURCE_RTC_IMAGE_GIF = 8, + /** Remote video received from network. + */ + VIDEO_SOURCE_REMOTE = 9, + /** Video for transcoded. + */ + VIDEO_SOURCE_TRANSCODED = 10, + + /** Video captured by the third camera. + */ + VIDEO_SOURCE_CAMERA_THIRD = 11, + /** Video captured by the fourth camera. + */ + VIDEO_SOURCE_CAMERA_FOURTH = 12, + /** Video for third screen sharing. + */ + VIDEO_SOURCE_SCREEN_THIRD = 13, + /** Video for fourth screen sharing. + */ + VIDEO_SOURCE_SCREEN_FOURTH = 14, + + VIDEO_SOURCE_UNKNOWN = 100 +}; + +/** + * Audio routes. + */ +enum AudioRoute +{ + /** + * -1: The default audio route. + */ + ROUTE_DEFAULT = -1, + /** + * The headset. + */ + ROUTE_HEADSET = 0, + /** + * The earpiece. + */ + ROUTE_EARPIECE = 1, + /** + * The headset with no microphone. + */ + ROUTE_HEADSETNOMIC = 2, + /** + * The speakerphone. + */ + ROUTE_SPEAKERPHONE = 3, + /** + * The loudspeaker. + */ + ROUTE_LOUDSPEAKER = 4, + /** + * The Bluetooth headset. + */ + ROUTE_HEADSETBLUETOOTH = 5, + /** + * The USB + */ + ROUTE_USB = 6, + /** + * The HDMI + */ + ROUTE_HDMI = 7, + /** + * The DISPLAYPORT + */ + ROUTE_DISPLAYPORT = 8, + /** + * The AIRPLAY + */ + ROUTE_AIRPLAY = 9, + /** + * The BLUETOOTH Speaker via a2dp + */ + ROUTE_BLUETOOTH_SPEAKER = 10, +}; + +/** + * Bytes per sample + */ +enum BYTES_PER_SAMPLE { + /** + * two bytes per sample + */ + TWO_BYTES_PER_SAMPLE = 2, +}; + +struct AudioParameters { + int sample_rate; + size_t channels; + size_t frames_per_buffer; + + AudioParameters() + : sample_rate(0), + channels(0), + frames_per_buffer(0) {} +}; + +/** + * The use mode of the audio data. + */ +enum RAW_AUDIO_FRAME_OP_MODE_TYPE { + /** 0: Read-only mode: Users only read the data from `AudioFrame` without modifying anything. + * For example, when users acquire the data with the Agora SDK, then start the media push. + */ + RAW_AUDIO_FRAME_OP_MODE_READ_ONLY = 0, + + /** 2: Read and write mode: Users read the data from `AudioFrame`, modify it, and then play it. + * For example, when users have their own audio-effect processing module and perform some voice pre-processing, such as a voice change. + */ + RAW_AUDIO_FRAME_OP_MODE_READ_WRITE = 2, +}; + +} // namespace rtc + +namespace media { + /** + * The type of media device. + */ +enum MEDIA_SOURCE_TYPE { + /** + * 0: The audio playback device. + */ + AUDIO_PLAYOUT_SOURCE = 0, + /** + * 1: Microphone. + */ + AUDIO_RECORDING_SOURCE = 1, + /** + * 2: Video captured by primary camera. + */ + PRIMARY_CAMERA_SOURCE = 2, + /** + * 3: Video captured by secondary camera. + */ + SECONDARY_CAMERA_SOURCE = 3, + /** + * 4: Video captured by primary screen capturer. + */ + PRIMARY_SCREEN_SOURCE = 4, + /** + * 5: Video captured by secondary screen capturer. + */ + SECONDARY_SCREEN_SOURCE = 5, + /** + * 6: Video captured by custom video source. + */ + CUSTOM_VIDEO_SOURCE = 6, + /** + * 7: Video for media player sharing. + */ + MEDIA_PLAYER_SOURCE = 7, + /** + * 8: Video for png image. + */ + RTC_IMAGE_PNG_SOURCE = 8, + /** + * 9: Video for jpeg image. + */ + RTC_IMAGE_JPEG_SOURCE = 9, + /** + * 10: Video for gif image. + */ + RTC_IMAGE_GIF_SOURCE = 10, + /** + * 11: Remote video received from network. + */ + REMOTE_VIDEO_SOURCE = 11, + /** + * 12: Video for transcoded. + */ + TRANSCODED_VIDEO_SOURCE = 12, + /** + * 100: Internal Usage only. + */ + UNKNOWN_MEDIA_SOURCE = 100 +}; +/** Definition of contentinspect + */ +#define MAX_CONTENT_INSPECT_MODULE_COUNT 32 +enum CONTENT_INSPECT_RESULT { + CONTENT_INSPECT_NEUTRAL = 1, + CONTENT_INSPECT_SEXY = 2, + CONTENT_INSPECT_PORN = 3, +}; + +enum CONTENT_INSPECT_TYPE { +/** + * (Default) content inspect type invalid + */ +CONTENT_INSPECT_INVALID = 0, +/** + * @deprecated + * Content inspect type moderation + */ +CONTENT_INSPECT_MODERATION __deprecated = 1, +/** + * Content inspect type supervise + */ +CONTENT_INSPECT_SUPERVISION = 2, +/** + * Content inspect type image moderation + */ +CONTENT_INSPECT_IMAGE_MODERATION = 3 +}; + +struct ContentInspectModule { + /** + * The content inspect module type. + */ + CONTENT_INSPECT_TYPE type; + /**The content inspect frequency, default is 0 second. + * the frequency <= 0 is invalid. + */ + unsigned int interval; + ContentInspectModule() { + type = CONTENT_INSPECT_INVALID; + interval = 0; + } +}; +/** Definition of ContentInspectConfig. + */ +struct ContentInspectConfig { + const char* extraInfo; + + /**The content inspect modules, max length of modules is 32. + * the content(snapshot of send video stream, image) can be used to max of 32 types functions. + */ + ContentInspectModule modules[MAX_CONTENT_INSPECT_MODULE_COUNT]; + /**The content inspect module count. + */ + int moduleCount; + ContentInspectConfig& operator=(const ContentInspectConfig& rth) + { + extraInfo = rth.extraInfo; + moduleCount = rth.moduleCount; + memcpy(&modules, &rth.modules, MAX_CONTENT_INSPECT_MODULE_COUNT * sizeof(ContentInspectModule)); + return *this; + } + ContentInspectConfig() :extraInfo(NULL), moduleCount(0){} +}; + +namespace base { + +typedef void* view_t; + +typedef const char* user_id_t; + +static const uint8_t kMaxCodecNameLength = 50; + +/** + * The definition of the PacketOptions struct, which contains infomation of the packet + * in the RTP (Real-time Transport Protocal) header. + */ +struct PacketOptions { + /** + * The timestamp of the packet. + */ + uint32_t timestamp; + // Audio level indication. + uint8_t audioLevelIndication; + PacketOptions() + : timestamp(0), + audioLevelIndication(127) {} +}; + +/** + * The detailed information of the incoming audio encoded frame. + */ + +struct AudioEncodedFrameInfo { + /** + * The send time of the packet. + */ + uint64_t sendTs; + /** + * The codec of the packet. + */ + uint8_t codec; + AudioEncodedFrameInfo() + : sendTs(0), + codec(0) {} +}; + +/** + * The detailed information of the incoming audio frame in the PCM format. + */ +struct AudioPcmFrame { + /** + * The buffer size of the PCM audio frame. + */ + OPTIONAL_ENUM_SIZE_T { + // Stereo, 32 kHz, 60 ms (2 * 32 * 60) + /** + * The max number of the samples of the data. + * + * When the number of audio channel is two, the sample rate is 32 kHZ, + * the buffer length of the data is 60 ms, the number of the samples of the data is 3840 (2 x 32 x 60). + */ + kMaxDataSizeSamples = 3840, + /** The max number of the bytes of the data. */ + kMaxDataSizeBytes = kMaxDataSizeSamples * sizeof(int16_t), + }; + + /** The timestamp (ms) of the audio frame. + */ + int64_t capture_timestamp; + /** The number of samples per channel. + */ + size_t samples_per_channel_; + /** The sample rate (Hz) of the audio data. + */ + int sample_rate_hz_; + /** The channel number. + */ + size_t num_channels_; + /** The number of bytes per sample. + */ + rtc::BYTES_PER_SAMPLE bytes_per_sample; + /** The audio frame data. */ + int16_t data_[kMaxDataSizeSamples]; + + AudioPcmFrame& operator=(const AudioPcmFrame& src) { + if(this == &src) { + return *this; + } + + this->capture_timestamp = src.capture_timestamp; + this->samples_per_channel_ = src.samples_per_channel_; + this->sample_rate_hz_ = src.sample_rate_hz_; + this->bytes_per_sample = src.bytes_per_sample; + this->num_channels_ = src.num_channels_; + + size_t length = src.samples_per_channel_ * src.num_channels_; + if (length > kMaxDataSizeSamples) { + length = kMaxDataSizeSamples; + } + + memcpy(this->data_, src.data_, length * sizeof(int16_t)); + + return *this; + } + + AudioPcmFrame() + : capture_timestamp(0), + samples_per_channel_(0), + sample_rate_hz_(0), + num_channels_(0), + bytes_per_sample(rtc::TWO_BYTES_PER_SAMPLE) { + memset(data_, 0, sizeof(data_)); + } + + AudioPcmFrame(const AudioPcmFrame& src) + : capture_timestamp(src.capture_timestamp), + samples_per_channel_(src.samples_per_channel_), + sample_rate_hz_(src.sample_rate_hz_), + num_channels_(src.num_channels_), + bytes_per_sample(src.bytes_per_sample) { + size_t length = src.samples_per_channel_ * src.num_channels_; + if (length > kMaxDataSizeSamples) { + length = kMaxDataSizeSamples; + } + + memcpy(this->data_, src.data_, length * sizeof(int16_t)); + } +}; + +/** Audio dual-mono output mode + */ +enum AUDIO_DUAL_MONO_MODE { + /**< ChanLOut=ChanLin, ChanRout=ChanRin */ + AUDIO_DUAL_MONO_STEREO = 0, + /**< ChanLOut=ChanRout=ChanLin */ + AUDIO_DUAL_MONO_L = 1, + /**< ChanLOut=ChanRout=ChanRin */ + AUDIO_DUAL_MONO_R = 2, + /**< ChanLout=ChanRout=(ChanLin+ChanRin)/2 */ + AUDIO_DUAL_MONO_MIX = 3 +}; +/** + * The audio frame observer. + */ +class IAudioFrameObserver { + public: + /** + * Occurs when each time the player receives an audio frame. + * + * After registering the audio frame observer, + * the callback occurs when each time the player receives an audio frame, + * reporting the detailed information of the audio frame. + * @param frame The detailed information of the audio frame. See {@link AudioPcmFrame}. + */ + virtual void onFrame(AudioPcmFrame* frame) = 0; + virtual ~IAudioFrameObserver() {} +}; + +/** + * Video pixel formats. + */ +enum VIDEO_PIXEL_FORMAT { + /** + * 0: Default format. + */ + VIDEO_PIXEL_DEFAULT = 0, + /** + * 1: I420. + */ + VIDEO_PIXEL_I420 = 1, + /** + * 2: BGRA. + */ + VIDEO_PIXEL_BGRA = 2, + /** + * 3: NV21. + */ + VIDEO_PIXEL_NV21 = 3, + /** + * 4: RGBA. + */ + VIDEO_PIXEL_RGBA = 4, + /** + * 8: NV12. + */ + VIDEO_PIXEL_NV12 = 8, + /** + * 10: GL_TEXTURE_2D + */ + VIDEO_TEXTURE_2D = 10, + /** + * 11: GL_TEXTURE_OES + */ + VIDEO_TEXTURE_OES = 11, + /* + 12: pixel format for iOS CVPixelBuffer NV12 + */ + VIDEO_CVPIXEL_NV12 = 12, + /* + 13: pixel format for iOS CVPixelBuffer I420 + */ + VIDEO_CVPIXEL_I420 = 13, + /* + 14: pixel format for iOS CVPixelBuffer BGRA + */ + VIDEO_CVPIXEL_BGRA = 14, + /** + * 16: I422. + */ + VIDEO_PIXEL_I422 = 16, +}; + +/** + * The video display mode. + */ +enum RENDER_MODE_TYPE { + /** + * 1: Uniformly scale the video until it fills the visible boundaries + * (cropped). One dimension of the video may have clipped contents. + */ + RENDER_MODE_HIDDEN = 1, + /** + * 2: Uniformly scale the video until one of its dimension fits the boundary + * (zoomed to fit). Areas that are not filled due to the disparity in the + * aspect ratio will be filled with black. + */ + RENDER_MODE_FIT = 2, + /** + * @deprecated + * 3: This mode is deprecated. + */ + RENDER_MODE_ADAPTIVE __deprecated = 3, +}; + +/** + * The camera video source type + */ +enum CAMERA_VIDEO_SOURCE_TYPE { + /** + * 0: the video frame comes from the front camera + */ + CAMERA_SOURCE_FRONT = 0, + /** + * 1: the video frame comes from the back camera + */ + CAMERA_SOURCE_BACK = 1, + /** + * 1: the video frame source is unsepcified + */ + VIDEO_SOURCE_UNSPECIFIED = 2, +}; + +/** + * The definition of the ExternalVideoFrame struct. + */ +struct ExternalVideoFrame { + ExternalVideoFrame() + : type(VIDEO_BUFFER_RAW_DATA), + format(VIDEO_PIXEL_DEFAULT), + buffer(NULL), + stride(0), + height(0), + cropLeft(0), + cropTop(0), + cropRight(0), + cropBottom(0), + rotation(0), + timestamp(0), + eglContext(NULL), + eglType(EGL_CONTEXT10), + textureId(0), + fence_object(0), + metadata_buffer(NULL), + metadata_size(0), + alphaBuffer(NULL), + fillAlphaBuffer(false){} + + /** + * The EGL context type. + */ + enum EGL_CONTEXT_TYPE { + /** + * 0: When using the OpenGL interface (javax.microedition.khronos.egl.*) defined by Khronos + */ + EGL_CONTEXT10 = 0, + /** + * 0: When using the OpenGL interface (android.opengl.*) defined by Android + */ + EGL_CONTEXT14 = 1, + }; + + /** + * Video buffer types. + */ + enum VIDEO_BUFFER_TYPE { + /** + * 1: Raw data. + */ + VIDEO_BUFFER_RAW_DATA = 1, + /** + * 2: The same as VIDEO_BUFFER_RAW_DATA. + */ + VIDEO_BUFFER_ARRAY = 2, + /** + * 3: The video buffer in the format of texture. + */ + VIDEO_BUFFER_TEXTURE = 3, + }; + + /** + * The buffer type: #VIDEO_BUFFER_TYPE. + */ + VIDEO_BUFFER_TYPE type; + /** + * The pixel format: #VIDEO_PIXEL_FORMAT + */ + VIDEO_PIXEL_FORMAT format; + /** + * The video buffer. + */ + void* buffer; + /** + * The line spacing of the incoming video frame (px). For + * texture, it is the width of the texture. + */ + int stride; + /** + * The height of the incoming video frame. + */ + int height; + /** + * [Raw data related parameter] The number of pixels trimmed from the left. The default value is + * 0. + */ + int cropLeft; + /** + * [Raw data related parameter] The number of pixels trimmed from the top. The default value is + * 0. + */ + int cropTop; + /** + * [Raw data related parameter] The number of pixels trimmed from the right. The default value is + * 0. + */ + int cropRight; + /** + * [Raw data related parameter] The number of pixels trimmed from the bottom. The default value + * is 0. + */ + int cropBottom; + /** + * [Raw data related parameter] The clockwise rotation information of the video frame. You can set the + * rotation angle as 0, 90, 180, or 270. The default value is 0. + */ + int rotation; + /** + * The timestamp (ms) of the incoming video frame. An incorrect timestamp results in a frame loss or + * unsynchronized audio and video. + * + * Please refer to getAgoraCurrentMonotonicTimeInMs or getCurrentMonotonicTimeInMs + * to determine how to fill this filed. + */ + long long timestamp; + /** + * [Texture-related parameter] + * When using the OpenGL interface (javax.microedition.khronos.egl.*) defined by Khronos, set EGLContext to this field. + * When using the OpenGL interface (android.opengl.*) defined by Android, set EGLContext to this field. + */ + void *eglContext; + /** + * [Texture related parameter] Texture ID used by the video frame. + */ + EGL_CONTEXT_TYPE eglType; + /** + * [Texture related parameter] Incoming 4 × 4 transformational matrix. The typical value is a unit matrix. + */ + int textureId; + /** + * [Texture related parameter] + */ + long long fence_object; + /** + * [Texture related parameter] Incoming 4 × 4 transformational matrix. The typical value is a unit matrix. + */ + float matrix[16]; + /** + * [Texture related parameter] The MetaData buffer. + * The default value is NULL + */ + uint8_t* metadata_buffer; + /** + * [Texture related parameter] The MetaData size. + * The default value is 0 + */ + int metadata_size; + /** + * Indicates the alpha channel of current frame, which is consistent with the dimension of the video frame. + * The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground. + * The default value is NULL. + */ + uint8_t* alphaBuffer; + /** + * Extract alphaBuffer from bgra or rgba data. Set it true if you do not explicitly specify the alphabuffer. + * The default value is false + */ + bool fillAlphaBuffer; +}; + +/** + * The definition of the VideoFrame struct. + */ +struct VideoFrame { + VideoFrame(): + type(VIDEO_PIXEL_DEFAULT), + width(0), + height(0), + yStride(0), + uStride(0), + vStride(0), + yBuffer(NULL), + uBuffer(NULL), + vBuffer(NULL), + rotation(0), + renderTimeMs(0), + avsync_type(0), + metadata_buffer(NULL), + metadata_size(0), + sharedContext(0), + textureId(0), + fence_object(0), + alphaBuffer(NULL), + pixelBuffer(NULL){} + /** + * The video pixel format: #VIDEO_PIXEL_FORMAT. + */ + VIDEO_PIXEL_FORMAT type; + /** + * The width of the video frame. + */ + int width; + /** + * The height of the video frame. + */ + int height; + /** + * The line span of Y buffer in the YUV data. + */ + int yStride; + /** + * The line span of U buffer in the YUV data. + */ + int uStride; + /** + * The line span of V buffer in the YUV data. + */ + int vStride; + /** + * The pointer to the Y buffer in the YUV data. + */ + uint8_t* yBuffer; + /** + * The pointer to the U buffer in the YUV data. + */ + uint8_t* uBuffer; + /** + * The pointer to the V buffer in the YUV data. + */ + uint8_t* vBuffer; + /** + * The clockwise rotation information of this frame. You can set it as 0, 90, 180 or 270. + */ + int rotation; + /** + * The timestamp to render the video stream. Use this parameter for audio-video synchronization when + * rendering the video. + * + * @note This parameter is for rendering the video, not capturing the video. + */ + int64_t renderTimeMs; + /** + * The type of audio-video synchronization. + */ + int avsync_type; + /** + * [Texture related parameter] The MetaData buffer. + * The default value is NULL + */ + uint8_t* metadata_buffer; + /** + * [Texture related parameter] The MetaData size. + * The default value is 0 + */ + int metadata_size; + /** + * [Texture related parameter], egl context. + */ + void* sharedContext; + /** + * [Texture related parameter], Texture ID used by the video frame. + */ + int textureId; + /** + * [Texture related parameter] + */ + long long fence_object; + /** + * [Texture related parameter], Incoming 4 × 4 transformational matrix. + */ + float matrix[16]; + /** + * Indicates the alpha channel of current frame, which is consistent with the dimension of the video frame. + * The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground. + * The default value is NULL. + */ + uint8_t* alphaBuffer; + /** + *The type of CVPixelBufferRef, for iOS and macOS only. + */ + void* pixelBuffer; +}; + +/** + * The IVideoFrameObserver class. + */ +class IVideoFrameObserver { + public: + /** + * Occurs each time the player receives a video frame. + * + * After registering the video frame observer, + * the callback occurs each time the player receives a video frame to report the detailed information of the video frame. + * @param frame The detailed information of the video frame. See {@link VideoFrame}. + */ + virtual void onFrame(const VideoFrame* frame) = 0; + virtual ~IVideoFrameObserver() {} + virtual bool isExternal() { return true; } + virtual VIDEO_PIXEL_FORMAT getVideoFormatPreference() { return VIDEO_PIXEL_DEFAULT; } +}; + +enum MEDIA_PLAYER_SOURCE_TYPE { + /** + * The real type of media player when use MEDIA_PLAYER_SOURCE_DEFAULT is decided by the + * type of SDK package. It is full feature media player in full-featured SDK, or simple + * media player in others. + */ + MEDIA_PLAYER_SOURCE_DEFAULT, + /** + * Full featured media player is designed to support more codecs and media format, which + * requires more package size than simple player. If you need this player enabled, you + * might need to download a full-featured SDK. + */ + MEDIA_PLAYER_SOURCE_FULL_FEATURED, + /** + * Simple media player with limit codec supported, which requires minimal package size + * requirement and is enabled by default + */ + MEDIA_PLAYER_SOURCE_SIMPLE, +}; + +enum VIDEO_MODULE_POSITION { + POSITION_POST_CAPTURER = 1 << 0, + POSITION_PRE_RENDERER = 1 << 1, + POSITION_PRE_ENCODER = 1 << 2, +}; + +} // namespace base + +/** + * The IAudioFrameObserverBase class. + */ +class IAudioFrameObserverBase { + public: + /** + * Audio frame types. + */ + enum AUDIO_FRAME_TYPE { + /** + * 0: 16-bit PCM. + */ + FRAME_TYPE_PCM16 = 0, + }; + enum { MAX_HANDLE_TIME_CNT = 10 }; + /** + * The definition of the AudioFrame struct. + */ + struct AudioFrame { + /** + * The audio frame type: #AUDIO_FRAME_TYPE. + */ + AUDIO_FRAME_TYPE type; + /** + * The number of samples per channel in this frame. + */ + int samplesPerChannel; + /** + * The number of bytes per sample: #BYTES_PER_SAMPLE + */ + agora::rtc::BYTES_PER_SAMPLE bytesPerSample; + /** + * The number of audio channels (data is interleaved, if stereo). + * - 1: Mono. + * - 2: Stereo. + */ + int channels; + /** + *The number of samples per channel in the audio frame. + */ + int samplesPerSec; + /** + * The data buffer of the audio frame. When the audio frame uses a stereo channel, the data + * buffer is interleaved. + * + * Buffer data size: buffer = samples × channels × bytesPerSample. + */ + void* buffer; + /** + * The timestamp to render the audio data. + * + * You can use this timestamp to restore the order of the captured audio frame, and synchronize + * audio and video frames in video scenarios, including scenarios where external video sources + * are used. + */ + int64_t renderTimeMs; + /** + * The number of the audio track. + */ + int audioTrackNumber; + /** + * A reserved parameter. + */ + int avsync_type; + + AudioFrame() : type(FRAME_TYPE_PCM16), + samplesPerChannel(0), + bytesPerSample(rtc::TWO_BYTES_PER_SAMPLE), + channels(0), + samplesPerSec(0), + buffer(NULL), + renderTimeMs(0), + audioTrackNumber(0), + avsync_type(0) {} + }; + + enum AUDIO_FRAME_POSITION { + AUDIO_FRAME_POSITION_NONE = 0x0000, + /** The position for observing the playback audio of all remote users after mixing + */ + AUDIO_FRAME_POSITION_PLAYBACK = 0x0001, + /** The position for observing the recorded audio of the local user + */ + AUDIO_FRAME_POSITION_RECORD = 0x0002, + /** The position for observing the mixed audio of the local user and all remote users + */ + AUDIO_FRAME_POSITION_MIXED = 0x0004, + /** The position for observing the audio of a single remote user before mixing + */ + AUDIO_FRAME_POSITION_BEFORE_MIXING = 0x0008, + /** The position for observing the ear monitoring audio of the local user + */ + AUDIO_FRAME_POSITION_EAR_MONITORING = 0x0010, + /** The position for observing the before-publish audio of the local user + */ + AUDIO_FRAME_POSITION_BEFORE_PUBLISH = 0x0020, + }; + + struct AudioParams { + /** The audio sample rate (Hz), which can be set as one of the following values: + + - `8000` + - `16000` (Default) + - `32000` + - `44100 ` + - `48000` + */ + int sample_rate; + + /* The number of audio channels, which can be set as either of the following values: + + - `1`: Mono (Default) + - `2`: Stereo + */ + int channels; + + /* The use mode of the audio data. See AgoraAudioRawFrameOperationMode. + */ + rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE mode; + + /** The number of samples. For example, set it as 1024 for RTMP or RTMPS + streaming. + */ + int samples_per_call; + + AudioParams() : sample_rate(0), channels(0), mode(rtc::RAW_AUDIO_FRAME_OP_MODE_READ_ONLY), samples_per_call(0) {} + AudioParams(int samplerate, int channel, rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE type, int samplesPerCall) : sample_rate(samplerate), channels(channel), mode(type), samples_per_call(samplesPerCall) {} + }; + + public: + virtual ~IAudioFrameObserverBase() {} + + /** + * Occurs when the recorded audio frame is received. + * @param channelId The channel name + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The recorded audio frame is valid and is encoded and sent. + * - false: The recorded audio frame is invalid and is not encoded or sent. + */ + virtual bool onRecordAudioFrame(const char* channelId, AudioFrame& audioFrame) = 0; + /** + * Occurs when the before-publishing audio frame is received. + * @param channelId The channel name + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The recorded audio frame is valid and is encoded and sent. + * - false: The recorded audio frame is invalid and is not encoded or sent. + */ + virtual bool onPublishAudioFrame(const char* channelId, AudioFrame& audioFrame) { + (void) channelId; + (void) audioFrame; + return true; + } + /** + * Occurs when the playback audio frame is received. + * @param channelId The channel name + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The playback audio frame is valid and is encoded and sent. + * - false: The playback audio frame is invalid and is not encoded or sent. + */ + virtual bool onPlaybackAudioFrame(const char* channelId, AudioFrame& audioFrame) = 0; + /** + * Occurs when the mixed audio data is received. + * @param channelId The channel name + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The mixed audio data is valid and is encoded and sent. + * - false: The mixed audio data is invalid and is not encoded or sent. + */ + virtual bool onMixedAudioFrame(const char* channelId, AudioFrame& audioFrame) = 0; + /** + * Occurs when the ear monitoring audio frame is received. + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The ear monitoring audio data is valid and is encoded and sent. + * - false: The ear monitoring audio data is invalid and is not encoded or sent. + */ + virtual bool onEarMonitoringAudioFrame(AudioFrame& audioFrame) = 0; + /** + * Occurs when the before-mixing playback audio frame is received. + * @param channelId The channel name + * @param userId ID of the remote user. + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The before-mixing playback audio frame is valid and is encoded and sent. + * - false: The before-mixing playback audio frame is invalid and is not encoded or sent. + */ + virtual bool onPlaybackAudioFrameBeforeMixing(const char* channelId, base::user_id_t userId, AudioFrame& audioFrame) { + (void) channelId; + (void) userId; + (void) audioFrame; + return true; + } + + /** + * Sets the frame position for the audio observer. + * @return A bit mask that controls the frame position of the audio observer. + * @note - Use '|' (the OR operator) to observe multiple frame positions. + *

    + * After you successfully register the audio observer, the SDK triggers this callback each time it receives a audio frame. You can determine which position to observe by setting the return value. + * The SDK provides 4 positions for observer. Each position corresponds to a callback function: + * - `AUDIO_FRAME_POSITION_PLAYBACK (1 << 0)`: The position for playback audio frame is received, which corresponds to the \ref onPlaybackFrame "onPlaybackFrame" callback. + * - `AUDIO_FRAME_POSITION_RECORD (1 << 1)`: The position for record audio frame is received, which corresponds to the \ref onRecordFrame "onRecordFrame" callback. + * - `AUDIO_FRAME_POSITION_MIXED (1 << 2)`: The position for mixed audio frame is received, which corresponds to the \ref onMixedFrame "onMixedFrame" callback. + * - `AUDIO_FRAME_POSITION_BEFORE_MIXING (1 << 3)`: The position for playback audio frame before mixing is received, which corresponds to the \ref onPlaybackFrameBeforeMixing "onPlaybackFrameBeforeMixing" callback. + * @return The bit mask that controls the audio observation positions. + * See AUDIO_FRAME_POSITION. + */ + + virtual int getObservedAudioFramePosition() = 0; + + /** Sets the audio playback format + **Note**: + + - The SDK calculates the sample interval according to the `AudioParams` + you set in the return value of this callback and triggers the + `onPlaybackAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ + virtual AudioParams getPlaybackAudioParams() = 0; + + virtual AudioParams getPublishAudioParams() {return AudioParams();} + + /** Sets the audio recording format + **Note**: + - The SDK calculates the sample interval according to the `AudioParams` + you set in the return value of this callback and triggers the + `onRecordAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ + virtual AudioParams getRecordAudioParams() = 0; + + /** Sets the audio mixing format + **Note**: + - The SDK calculates the sample interval according to the `AudioParams` + you set in the return value of this callback and triggers the + `onMixedAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ + virtual AudioParams getMixedAudioParams() = 0; + + /** Sets the ear monitoring audio format + **Note**: + - The SDK calculates the sample interval according to the `AudioParams` + you set in the return value of this callback and triggers the + `onEarMonitoringAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ + virtual AudioParams getEarMonitoringAudioParams() = 0; +}; + +/** + * The IAudioFrameObserver class. + */ +class IAudioFrameObserver : public IAudioFrameObserverBase { + public: + using IAudioFrameObserverBase::onPlaybackAudioFrameBeforeMixing; + /** + * Occurs when the before-mixing playback audio frame is received. + * @param channelId The channel name + * @param uid ID of the remote user. + * @param audioFrame The reference to the audio frame: AudioFrame. + * @return + * - true: The before-mixing playback audio frame is valid and is encoded and sent. + * - false: The before-mixing playback audio frame is invalid and is not encoded or sent. + */ + virtual bool onPlaybackAudioFrameBeforeMixing(const char* channelId, rtc::uid_t uid, AudioFrame& audioFrame) = 0; +}; + +struct AudioSpectrumData { + /** + * The audio spectrum data of audio. + */ + const float *audioSpectrumData; + /** + * The data length of audio spectrum data. + */ + int dataLength; + + AudioSpectrumData() : audioSpectrumData(NULL), dataLength(0) {} + AudioSpectrumData(const float *data, int length) : + audioSpectrumData(data), dataLength(length) {} +}; + +struct UserAudioSpectrumInfo { + /** + * User ID of the speaker. + */ + agora::rtc::uid_t uid; + /** + * The audio spectrum data of audio. + */ + struct AudioSpectrumData spectrumData; + + UserAudioSpectrumInfo () : uid(0), spectrumData() {} + UserAudioSpectrumInfo(agora::rtc::uid_t _uid, const float *data, int length) : + uid(_uid) { spectrumData.audioSpectrumData = data; spectrumData.dataLength = length; } +}; + +/** + * The IAudioSpectrumObserver class. + */ +class IAudioSpectrumObserver { +public: + virtual ~IAudioSpectrumObserver() {} + + /** + * Reports the audio spectrum of local audio. + * + * This callback reports the audio spectrum data of the local audio at the moment + * in the channel. + * + * You can set the time interval of this callback using \ref ILocalUser::enableAudioSpectrumMonitor "enableAudioSpectrumMonitor". + * + * @param data The audio spectrum data of local audio. + * - true: Processed. + * - false: Not processed. + */ + virtual bool onLocalAudioSpectrum(const AudioSpectrumData& data) = 0; + + /** + * Reports the audio spectrum of remote user. + * + * This callback reports the IDs and audio spectrum data of the loudest speakers at the moment + * in the channel. + * + * You can set the time interval of this callback using \ref ILocalUser::enableAudioSpectrumMonitor "enableAudioSpectrumMonitor". + * + * @param spectrums The pointer to \ref agora::media::UserAudioSpectrumInfo "UserAudioSpectrumInfo", which is an array containing + * the user ID and audio spectrum data for each speaker. + * - This array contains the following members: + * - `uid`, which is the UID of each remote speaker + * - `spectrumData`, which reports the audio spectrum of each remote speaker. + * @param spectrumNumber The array length of the spectrums. + * - true: Processed. + * - false: Not processed. + */ + virtual bool onRemoteAudioSpectrum(const UserAudioSpectrumInfo * spectrums, unsigned int spectrumNumber) = 0; +}; + +/** + * The IVideoEncodedFrameObserver class. + */ +class IVideoEncodedFrameObserver { + public: + /** + * Occurs each time the SDK receives an encoded video image. + * @param uid The user id of remote user. + * @param imageBuffer The pointer to the video image buffer. + * @param length The data length of the video image. + * @param videoEncodedFrameInfo The information of the encoded video frame: EncodedVideoFrameInfo. + * @return Determines whether to accept encoded video image. + * - true: Accept. + * - false: Do not accept. + */ + virtual bool onEncodedVideoFrameReceived(rtc::uid_t uid, const uint8_t* imageBuffer, size_t length, + const rtc::EncodedVideoFrameInfo& videoEncodedFrameInfo) = 0; + + virtual ~IVideoEncodedFrameObserver() {} +}; + +/** + * The IVideoFrameObserver class. + */ +class IVideoFrameObserver { + public: + typedef media::base::VideoFrame VideoFrame; + /** + * The process mode of the video frame: + */ + enum VIDEO_FRAME_PROCESS_MODE { + /** + * Read-only mode. + * + * In this mode, you do not modify the video frame. The video frame observer is a renderer. + */ + PROCESS_MODE_READ_ONLY, // Observer works as a pure renderer and will not modify the original frame. + /** + * Read and write mode. + * + * In this mode, you modify the video frame. The video frame observer is a video filter. + */ + PROCESS_MODE_READ_WRITE, // Observer works as a filter that will process the video frame and affect the following frame processing in SDK. + }; + + public: + virtual ~IVideoFrameObserver() {} + + /** + * Occurs each time the SDK receives a video frame captured by the local camera. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time + * a video frame is received. In this callback, you can get the video data captured by the local + * camera. You can then pre-process the data according to your scenarios. + * + * After pre-processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @note + * - If you get the video data in RGBA color encoding format, Agora does not support using this callback to send the processed data in RGBA color encoding format back to the SDK. + * - The video data that this callback gets has not been pre-processed, such as watermarking, cropping content, rotating, or image enhancement. + * + * @param videoFrame A pointer to the video frame: VideoFrame + * @param type source type of video frame. See #VIDEO_SOURCE_TYPE. + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ + virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) = 0; + + /** + * Occurs each time the SDK receives a video frame before encoding. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time + * when it receives a video frame. In this callback, you can get the video data before encoding. You can then + * process the data according to your particular scenarios. + * + * After processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @note + * - To get the video data captured from the second screen before encoding, you need to set (1 << 2) as a frame position through `getObservedFramePosition`. + * - The video data that this callback gets has been pre-processed, such as watermarking, cropping content, rotating, or image enhancement. + * - This callback does not support sending processed RGBA video data back to the SDK. + * + * @param videoFrame A pointer to the video frame: VideoFrame + * @param type source type of video frame. See #VIDEO_SOURCE_TYPE. + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ + virtual bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) = 0; + + /** + * Occurs each time the SDK receives a video frame decoded by the MediaPlayer. + * + * After you successfully register the video frame observer, the SDK triggers this callback each + * time a video frame is decoded. In this callback, you can get the video data decoded by the + * MediaPlayer. You can then pre-process the data according to your scenarios. + * + * After pre-processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @note + * If the returned agora::media::base::VIDEO_PIXEL_DEFAULT format is specified by getVideoFormatPreference, + * the video frame you get through onMediaPlayerVideoFrame is in agora::media::base::VIDEO_PIXEL_I420 format. + * + * @param videoFrame A pointer to the video frame: VideoFrame + * @param mediaPlayerId ID of the mediaPlayer. + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ + virtual bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) = 0; + + /** + * Occurs each time the SDK receives a video frame sent by the remote user. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time a + * video frame is received. In this callback, you can get the video data sent by the remote user. You + * can then post-process the data according to your scenarios. + * + * After post-processing, you can send the processed data back to the SDK by setting the `videoFrame` + * parameter in this callback. + * + * @note This callback does not support sending processed RGBA video data back to the SDK. + * + * @param channelId The channel name + * @param remoteUid ID of the remote user who sends the current video frame. + * @param videoFrame A pointer to the video frame: VideoFrame + * @return Determines whether to ignore the current video frame if the post-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ + virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame) = 0; + + virtual bool onTranscodedVideoFrame(VideoFrame& videoFrame) = 0; + + /** + * Occurs each time the SDK receives a video frame and prompts you to set the process mode of the video frame. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time it receives + * a video frame. You need to set your preferred process mode in the return value of this callback. + * @return VIDEO_FRAME_PROCESS_MODE. + */ + virtual VIDEO_FRAME_PROCESS_MODE getVideoFrameProcessMode() { + return PROCESS_MODE_READ_ONLY; + } + + /** + * Sets the format of the raw video data output by the SDK. + * + * If you want to get raw video data in a color encoding format other than YUV 420, register this callback when + * calling `registerVideoFrameObserver`. After you successfully register the video frame observer, the SDK triggers + * this callback each time it receives a video frame. You need to set your preferred video data in the return value + * of this callback. + * + * @note If you want the video captured by the sender to be the original format, set the original video data format + * to VIDEO_PIXEL_DEFAULT in the return value. On different platforms, the original video pixel format is also + * different, for the actual video pixel format, see `VideoFrame`. + * + * @return Sets the video format. See VIDEO_PIXEL_FORMAT. + */ + virtual base::VIDEO_PIXEL_FORMAT getVideoFormatPreference() { return base::VIDEO_PIXEL_DEFAULT; } + + /** + * Occurs each time the SDK receives a video frame, and prompts you whether to rotate the captured video. + * + * If you want to rotate the captured video according to the rotation member in the `VideoFrame` class, register this + * callback by calling `registerVideoFrameObserver`. After you successfully register the video frame observer, the + * SDK triggers this callback each time it receives a video frame. You need to set whether to rotate the video frame + * in the return value of this callback. + * + * @note This function only supports video data in RGBA or YUV420. + * + * @return Determines whether to rotate. + * - `true`: Rotate the captured video. + * - `false`: (Default) Do not rotate the captured video. + */ + virtual bool getRotationApplied() { return false; } + + /** + * Occurs each time the SDK receives a video frame and prompts you whether or not to mirror the captured video. + * + * If the video data you want to obtain is a mirror image of the original video, you need to register this callback + * when calling `registerVideoFrameObserver`. After you successfully register the video frame observer, the SDK + * triggers this callback each time it receives a video frame. You need to set whether or not to mirror the video + * frame in the return value of this callback. + * + * @note This function only supports video data in RGBA and YUV420 formats. + * + * @return Determines whether to mirror. + * - `true`: Mirror the captured video. + * - `false`: (Default) Do not mirror the captured video. + */ + virtual bool getMirrorApplied() { return false; } + + /** + * Sets the frame position for the video observer. + * + * After you successfully register the video observer, the SDK triggers this callback each time it receives + * a video frame. You can determine which position to observe by setting the return value. The SDK provides + * 3 positions for observer. Each position corresponds to a callback function: + * + * POSITION_POST_CAPTURER(1 << 0): The position after capturing the video data, which corresponds to the onCaptureVideoFrame callback. + * POSITION_PRE_RENDERER(1 << 1): The position before receiving the remote video data, which corresponds to the onRenderVideoFrame callback. + * POSITION_PRE_ENCODER(1 << 2): The position before encoding the video data, which corresponds to the onPreEncodeVideoFrame callback. + * + * To observe multiple frame positions, use '|' (the OR operator). + * This callback observes POSITION_POST_CAPTURER(1 << 0) and POSITION_PRE_RENDERER(1 << 1) by default. + * To conserve the system consumption, you can reduce the number of frame positions that you want to observe. + * + * @return A bit mask that controls the frame position of the video observer: VIDEO_OBSERVER_POSITION. + */ + virtual uint32_t getObservedFramePosition() { + return base::POSITION_POST_CAPTURER | base::POSITION_PRE_RENDERER; + } + + /** + * Indicate if the observer is for internal use. + * Note: Never override this function + * @return + * - true: the observer is for external use + * - false: the observer is for internal use + */ + virtual bool isExternal() { return true; } +}; + +/** + * The external video source type. + */ +enum EXTERNAL_VIDEO_SOURCE_TYPE { + /** + * 0: non-encoded video frame. + */ + VIDEO_FRAME = 0, + /** + * 1: encoded video frame. + */ + ENCODED_VIDEO_FRAME, +}; + +/** + * The format of the recording file. + * + * @since v3.5.2 + */ +enum MediaRecorderContainerFormat { + /** + * 1: (Default) MP4. + */ + FORMAT_MP4 = 1, +}; +/** + * The recording content. + * + * @since v3.5.2 + */ +enum MediaRecorderStreamType { + /** + * Only audio. + */ + STREAM_TYPE_AUDIO = 0x01, + /** + * Only video. + */ + STREAM_TYPE_VIDEO = 0x02, + /** + * (Default) Audio and video. + */ + STREAM_TYPE_BOTH = STREAM_TYPE_AUDIO | STREAM_TYPE_VIDEO, +}; +/** + * The current recording state. + * + * @since v3.5.2 + */ +enum RecorderState { + /** + * -1: An error occurs during the recording. See RecorderErrorCode for the reason. + */ + RECORDER_STATE_ERROR = -1, + /** + * 2: The audio and video recording is started. + */ + RECORDER_STATE_START = 2, + /** + * 3: The audio and video recording is stopped. + */ + RECORDER_STATE_STOP = 3, +}; +/** + * The reason for the state change + * + * @since v3.5.2 + */ +enum RecorderErrorCode { + /** + * 0: No error occurs. + */ + RECORDER_ERROR_NONE = 0, + /** + * 1: The SDK fails to write the recorded data to a file. + */ + RECORDER_ERROR_WRITE_FAILED = 1, + /** + * 2: The SDK does not detect audio and video streams to be recorded, or audio and video streams are interrupted for more than five seconds during recording. + */ + RECORDER_ERROR_NO_STREAM = 2, + /** + * 3: The recording duration exceeds the upper limit. + */ + RECORDER_ERROR_OVER_MAX_DURATION = 3, + /** + * 4: The recording configuration changes. + */ + RECORDER_ERROR_CONFIG_CHANGED = 4, +}; +/** + * Configurations for the local audio and video recording. + * + * @since v3.5.2 + */ +struct MediaRecorderConfiguration { + /** + * The absolute path (including the filename extensions) of the recording file. + * For example, `C:\Users\\AppData\Local\Agora\\example.mp4` on Windows, + * `/App Sandbox/Library/Caches/example.mp4` on iOS, `/Library/Logs/example.mp4` on macOS, and + * `/storage/emulated/0/Android/data//files/example.mp4` on Android. + * + * @note Ensure that the specified path exists and is writable. + */ + const char* storagePath; + /** + * The format of the recording file. See \ref agora::rtc::MediaRecorderContainerFormat "MediaRecorderContainerFormat". + */ + MediaRecorderContainerFormat containerFormat; + /** + * The recording content. See \ref agora::rtc::MediaRecorderStreamType "MediaRecorderStreamType". + */ + MediaRecorderStreamType streamType; + /** + * The maximum recording duration, in milliseconds. The default value is 120000. + */ + int maxDurationMs; + /** + * The interval (ms) of updating the recording information. The value range is + * [1000,10000]. Based on the set value of `recorderInfoUpdateInterval`, the + * SDK triggers the \ref IMediaRecorderObserver::onRecorderInfoUpdated "onRecorderInfoUpdated" + * callback to report the updated recording information. + */ + int recorderInfoUpdateInterval; + + MediaRecorderConfiguration() : storagePath(NULL), containerFormat(FORMAT_MP4), streamType(STREAM_TYPE_BOTH), maxDurationMs(120000), recorderInfoUpdateInterval(0) {} + MediaRecorderConfiguration(const char* path, MediaRecorderContainerFormat format, MediaRecorderStreamType type, int duration, int interval) : storagePath(path), containerFormat(format), streamType(type), maxDurationMs(duration), recorderInfoUpdateInterval(interval) {} +}; +/** + * Information for the recording file. + * + * @since v3.5.2 + */ +struct RecorderInfo { + /** + * The absolute path of the recording file. + */ + const char* fileName; + /** + * The recording duration, in milliseconds. + */ + unsigned int durationMs; + /** + * The size in bytes of the recording file. + */ + unsigned int fileSize; + + RecorderInfo() : fileName(NULL), durationMs(0), fileSize(0) {} + RecorderInfo(const char* name, unsigned int dur, unsigned int size) : fileName(name), durationMs(dur), fileSize(size) {} +}; + + +class IMediaRecorderObserver { + public: + /** + * Occurs when the recording state changes. + * + * @since v3.5.2 + * + * When the local audio and video recording state changes, the SDK triggers this callback to report the current + * recording state and the reason for the change. + * + * @param state The current recording state. See \ref agora::rtc::RecorderState "RecorderState". + * @param error The reason for the state change. See \ref agora::rtc::RecorderErrorCode "RecorderErrorCode". + */ + virtual void onRecorderStateChanged(RecorderState state, RecorderErrorCode error) = 0; + /** + * Occurs when the recording information is updated. + * + * @since v3.5.2 + * + * After you successfully register this callback and enable the local audio and video recording, the SDK periodically triggers + * the `onRecorderInfoUpdated` callback based on the set value of `recorderInfoUpdateInterval`. This callback reports the + * filename, duration, and size of the current recording file. + * + * @param info Information for the recording file. See RecorderInfo. + * + */ + virtual void onRecorderInfoUpdated(const RecorderInfo& info) = 0; + virtual ~IMediaRecorderObserver() {} +}; +} // namespace media +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaFilterEventDelegate.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaFilterEventDelegate.h new file mode 100644 index 0000000..5e2a6d6 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaFilterEventDelegate.h @@ -0,0 +1,67 @@ +// +// AgoraMediaFilterEventDelegate.h +// Agora SDK +// +// Created by LLF on 2020-9-21. +// Copyright (c) 2020 Agora. All rights reserved. +// + +#import + +@interface AgoraExtensionContext : NSObject +/** Whether uid is valid. + */ +@property (assign, nonatomic) BOOL isValid; +/** Default 0 when "isValid is NO + * Local user is 0 and remote user great than 0 when "isValid" is YES + */ +@property (assign, nonatomic) NSUInteger uid; +@property (copy, nonatomic) NSString * _Nullable providerName; +@property (copy, nonatomic) NSString * _Nullable extensionName; + +@end + +@protocol AgoraMediaFilterEventDelegate +@optional +/* Meida filter(audio filter or video filter) event callback + */ +- (void)onEvent:(NSString * __nullable)provider + extension:(NSString * __nullable)extension + key:(NSString * __nullable)key + value:(NSString * __nullable)value NS_SWIFT_NAME(onEvent(_:extension:key:value:)) __deprecated_msg("override needExtensionContext, use onEventWithContext instead"); + +- (void)onExtensionStopped:(NSString * __nullable)provider + extension:(NSString * __nullable)extension NS_SWIFT_NAME(onExtensionStopped(_:extension:)) + __deprecated_msg("override needExtensionContext, use onExtensionStoppedWithContext instead"); + +- (void)onExtensionStarted:(NSString * __nullable)provider + extension:(NSString * __nullable)extension NS_SWIFT_NAME(onExtensionStarted(_:extension:)) + __deprecated_msg("override needExtensionContext, use onExtensionStartedWithContext instead"); + +- (void)onExtensionError:(NSString * __nullable)provider + extension:(NSString * __nullable)extension + error:(int)error + message:(NSString * __nullable)message NS_SWIFT_NAME(onExtensionError(_:extension:error:message:)) + __deprecated_msg("override needExtensionContext, use onExtensionErrorWithContext instead"); + +/** Whether need ExtensionContext, default NO if doesn't impl + * + * recommend override for YES + * return NO, then callback interface with onEvent、onExtensionStarted、onExtensionStopped、onExtensionError + * return YES, then callback interface conterpart with *WithContext interface + */ +- (BOOL)needExtensionContext NS_SWIFT_NAME(needExtensionContext());// + +- (void)onEventWithContext:(AgoraExtensionContext * __nonnull)context + key:(NSString * __nullable)key + value:(NSString * __nullable)value NS_SWIFT_NAME(onEventWithContext(_:key:value:)); + +- (void)onExtensionStartedWithContext:(AgoraExtensionContext * __nonnull)context NS_SWIFT_NAME(onExtensionStartedWithContext(_:)); + +- (void)onExtensionStoppedWithContext:(AgoraExtensionContext * __nonnull)context NS_SWIFT_NAME(onExtensionStoppedWithContext(_:)); + +- (void)onExtensionErrorWithContext:(AgoraExtensionContext * __nonnull)context + error:(int)error + message:(NSString * __nullable)message NS_SWIFT_NAME(onExtensionErrorWithContext(_:error:message:)); + +@end diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaPlayerTypes.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaPlayerTypes.h new file mode 100644 index 0000000..b446bf0 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMediaPlayerTypes.h @@ -0,0 +1,474 @@ +// +// Agora Engine SDK +// +// Created by Sting Feng in 2020-05. +// Copyright (c) 2017 Agora.io. All rights reserved. + +#pragma once // NOLINT(build/header_guard) + +#include +#include + +#include "AgoraOptional.h" + +/** + * set analyze duration for real time stream + * @example "setPlayerOption(KEY_PLAYER_REAL_TIME_STREAM_ANALYZE_DURATION,1000000)" + */ +#define KEY_PLAYER_REAL_TIME_STREAM_ANALYZE_DURATION "analyze_duration" + +/** + * make the player to enable audio or not + * @example "setPlayerOption(KEY_PLAYER_ENABLE_AUDIO,0)" + */ +#define KEY_PLAYER_ENABLE_AUDIO "enable_audio" + +/** + * make the player to enable video or not + * @example "setPlayerOption(KEY_PLAYER_ENABLE_VIDEO,0)" + */ +#define KEY_PLAYER_ENABLE_VIDEO "enable_video" + +/** + * set the player enable to search metadata + * @example "setPlayerOption(KEY_PLAYER_DISABLE_SEARCH_METADATA,0)" + */ +#define KEY_PLAYER_ENABLE_SEARCH_METADATA "enable_search_metadata" + +/** + * set the player sei filter type + * @example "setPlayerOption(KEY_PLAYER_SEI_FILTER_TYPE,"5")" + */ +#define KEY_PLAYER_SEI_FILTER_TYPE "set_sei_filter_type" + +namespace agora { + +namespace media { + +namespace base { +static const uint8_t kMaxCharBufferLength = 50; +/** + * @brief The playback state. + * + */ +enum MEDIA_PLAYER_STATE { + /** Default state. + */ + PLAYER_STATE_IDLE = 0, + /** Opening the media file. + */ + PLAYER_STATE_OPENING, + /** The media file is opened successfully. + */ + PLAYER_STATE_OPEN_COMPLETED, + /** Playing the media file. + */ + PLAYER_STATE_PLAYING, + /** The playback is paused. + */ + PLAYER_STATE_PAUSED, + /** The playback is completed. + */ + PLAYER_STATE_PLAYBACK_COMPLETED, + /** All loops are completed. + */ + PLAYER_STATE_PLAYBACK_ALL_LOOPS_COMPLETED, + /** The playback is stopped. + */ + PLAYER_STATE_STOPPED, + /** Player pausing (internal) + */ + PLAYER_STATE_PAUSING_INTERNAL = 50, + /** Player stopping (internal) + */ + PLAYER_STATE_STOPPING_INTERNAL, + /** Player seeking state (internal) + */ + PLAYER_STATE_SEEKING_INTERNAL, + /** Player getting state (internal) + */ + PLAYER_STATE_GETTING_INTERNAL, + /** None state for state machine (internal) + */ + PLAYER_STATE_NONE_INTERNAL, + /** Do nothing state for state machine (internal) + */ + PLAYER_STATE_DO_NOTHING_INTERNAL, + /** Player set track state (internal) + */ + PLAYER_STATE_SET_TRACK_INTERNAL, + /** The playback fails. + */ + PLAYER_STATE_FAILED = 100, +}; +/** + * @brief Player error code + * + */ +enum MEDIA_PLAYER_ERROR { + /** No error. + */ + PLAYER_ERROR_NONE = 0, + /** The parameter is invalid. + */ + PLAYER_ERROR_INVALID_ARGUMENTS = -1, + /** Internel error. + */ + PLAYER_ERROR_INTERNAL = -2, + /** No resource. + */ + PLAYER_ERROR_NO_RESOURCE = -3, + /** Invalid media source. + */ + PLAYER_ERROR_INVALID_MEDIA_SOURCE = -4, + /** The type of the media stream is unknown. + */ + PLAYER_ERROR_UNKNOWN_STREAM_TYPE = -5, + /** The object is not initialized. + */ + PLAYER_ERROR_OBJ_NOT_INITIALIZED = -6, + /** The codec is not supported. + */ + PLAYER_ERROR_CODEC_NOT_SUPPORTED = -7, + /** Invalid renderer. + */ + PLAYER_ERROR_VIDEO_RENDER_FAILED = -8, + /** An error occurs in the internal state of the player. + */ + PLAYER_ERROR_INVALID_STATE = -9, + /** The URL of the media file cannot be found. + */ + PLAYER_ERROR_URL_NOT_FOUND = -10, + /** Invalid connection between the player and the Agora server. + */ + PLAYER_ERROR_INVALID_CONNECTION_STATE = -11, + /** The playback buffer is insufficient. + */ + PLAYER_ERROR_SRC_BUFFER_UNDERFLOW = -12, + /** The audio mixing file playback is interrupted. + */ + PLAYER_ERROR_INTERRUPTED = -13, + /** The SDK does not support this function. + */ + PLAYER_ERROR_NOT_SUPPORTED = -14, + /** The token has expired. + */ + PLAYER_ERROR_TOKEN_EXPIRED = -15, + /** The ip has expired. + */ + PLAYER_ERROR_IP_EXPIRED = -16, + /** An unknown error occurs. + */ + PLAYER_ERROR_UNKNOWN = -17, +}; + +/** + * @brief The type of the media stream. + * + */ +enum MEDIA_STREAM_TYPE { + /** The type is unknown. + */ + STREAM_TYPE_UNKNOWN = 0, + /** The video stream. + */ + STREAM_TYPE_VIDEO = 1, + /** The audio stream. + */ + STREAM_TYPE_AUDIO = 2, + /** The subtitle stream. + */ + STREAM_TYPE_SUBTITLE = 3, +}; + +/** + * @brief The playback event. + * + */ +enum MEDIA_PLAYER_EVENT { + /** The player begins to seek to the new playback position. + */ + PLAYER_EVENT_SEEK_BEGIN = 0, + /** The seek operation completes. + */ + PLAYER_EVENT_SEEK_COMPLETE = 1, + /** An error occurs during the seek operation. + */ + PLAYER_EVENT_SEEK_ERROR = 2, + /** The player changes the audio track for playback. + */ + PLAYER_EVENT_AUDIO_TRACK_CHANGED = 5, + /** player buffer low + */ + PLAYER_EVENT_BUFFER_LOW = 6, + /** player buffer recover + */ + PLAYER_EVENT_BUFFER_RECOVER = 7, + /** The video or audio is interrupted + */ + PLAYER_EVENT_FREEZE_START = 8, + /** Interrupt at the end of the video or audio + */ + PLAYER_EVENT_FREEZE_STOP = 9, + /** switch source begin + */ + PLAYER_EVENT_SWITCH_BEGIN = 10, + /** switch source complete + */ + PLAYER_EVENT_SWITCH_COMPLETE = 11, + /** switch source error + */ + PLAYER_EVENT_SWITCH_ERROR = 12, + /** An application can render the video to less than a second + */ + PLAYER_EVENT_FIRST_DISPLAYED = 13, + /** cache resources exceed the maximum file count + */ + PLAYER_EVENT_REACH_CACHE_FILE_MAX_COUNT = 14, + /** cache resources exceed the maximum file size + */ + PLAYER_EVENT_REACH_CACHE_FILE_MAX_SIZE = 15, + /** Triggered when a retry is required to open the media + */ + PLAYER_EVENT_TRY_OPEN_START = 16, + /** Triggered when the retry to open the media is successful + */ + PLAYER_EVENT_TRY_OPEN_SUCCEED = 17, + /** Triggered when retrying to open media fails + */ + PLAYER_EVENT_TRY_OPEN_FAILED = 18, +}; + +/** + * @brief The play preload another source event. + * + */ +enum PLAYER_PRELOAD_EVENT { + /** preload source begin + */ + PLAYER_PRELOAD_EVENT_BEGIN = 0, + /** preload source complete + */ + PLAYER_PRELOAD_EVENT_COMPLETE = 1, + /** preload source error + */ + PLAYER_PRELOAD_EVENT_ERROR = 2, +}; + +/** + * @brief The information of the media stream object. + * + */ +struct PlayerStreamInfo { + /** The index of the media stream. */ + int streamIndex; + + /** The type of the media stream. See {@link MEDIA_STREAM_TYPE}. */ + MEDIA_STREAM_TYPE streamType; + + /** The codec of the media stream. */ + char codecName[kMaxCharBufferLength]; + + /** The language of the media stream. */ + char language[kMaxCharBufferLength]; + + /** The frame rate (fps) if the stream is video. */ + int videoFrameRate; + + /** The video bitrate (bps) if the stream is video. */ + int videoBitRate; + + /** The video width (pixel) if the stream is video. */ + int videoWidth; + + /** The video height (pixel) if the stream is video. */ + int videoHeight; + + /** The rotation angle if the steam is video. */ + int videoRotation; + + /** The sample rate if the stream is audio. */ + int audioSampleRate; + + /** The number of audio channels if the stream is audio. */ + int audioChannels; + + /** The number of bits per sample if the stream is audio. */ + int audioBitsPerSample; + + /** The total duration (millisecond) of the media stream. */ + int64_t duration; + + PlayerStreamInfo() : streamIndex(0), + streamType(STREAM_TYPE_UNKNOWN), + videoFrameRate(0), + videoBitRate(0), + videoWidth(0), + videoHeight(0), + videoRotation(0), + audioSampleRate(0), + audioChannels(0), + audioBitsPerSample(0), + duration(0) { + memset(codecName, 0, sizeof(codecName)); + memset(language, 0, sizeof(language)); + } +}; + +/** + * @brief The information of the media stream object. + * + */ +struct SrcInfo { + /** The bitrate of the media stream. The unit of the number is kbps. + * + */ + int bitrateInKbps; + + /** The name of the media stream. + * + */ + const char* name; + +}; + +/** + * @brief The type of the media metadata. + * + */ +enum MEDIA_PLAYER_METADATA_TYPE { + /** The type is unknown. + */ + PLAYER_METADATA_TYPE_UNKNOWN = 0, + /** The type is SEI. + */ + PLAYER_METADATA_TYPE_SEI = 1, +}; + +struct CacheStatistics { + /** total data size of uri + */ + int64_t fileSize; + /** data of uri has cached + */ + int64_t cacheSize; + /** data of uri has downloaded + */ + int64_t downloadSize; +}; + +struct PlayerUpdatedInfo { + /** playerId has value when user trigger interface of opening + */ + Optional playerId; + + /** deviceId has value when user trigger interface of opening + */ + Optional deviceId; + + /** cacheStatistics exist if you enable cache, triggered 1s at a time after openning url + */ + Optional cacheStatistics; +}; + +/** + * The custom data source provides a data stream input callback, and the player will continue to call back this interface, requesting the user to fill in the data that needs to be played. + */ +class IMediaPlayerCustomDataProvider { +public: + + /** + * @brief The player requests to read the data callback, you need to fill the specified length of data into the buffer + * @param buffer the buffer pointer that you need to fill data. + * @param bufferSize the bufferSize need to fill of the buffer pointer. + * @return you need return offset value if succeed. return 0 if failed. + */ + virtual int onReadData(unsigned char *buffer, int bufferSize) = 0; + + /** + * @brief The Player seek event callback, you need to operate the corresponding stream seek operation, You can refer to the definition of lseek() at https://man7.org/linux/man-pages/man2/lseek.2.html + * @param offset the value of seek offset. + * @param whence the postion of start seeking, the directive whence as follows: + * 0 - SEEK_SET : The file offset is set to offset bytes. + * 1 - SEEK_CUR : The file offset is set to its current location plus offset bytes. + * 2 - SEEK_END : The file offset is set to the size of the file plus offset bytes. + * 65536 - AVSEEK_SIZE : Optional. Passing this as the "whence" parameter to a seek function causes it to return the filesize without seeking anywhere. + * @return + * whence == 65536, return filesize if you need. + * whence >= 0 && whence < 3 , return offset value if succeed. return -1 if failed. + */ + virtual int64_t onSeek(int64_t offset, int whence) = 0; + + virtual ~IMediaPlayerCustomDataProvider() {} +}; + +struct MediaSource { + /** + * The URL of the media file that you want to play. + */ + const char* url; + /** + * The URI of the media file + * + * When caching is enabled, if the url cannot distinguish the cache file name, + * the uri must be able to ensure that the cache file name corresponding to the url is unique. + */ + const char* uri; + /** + * Set the starting position for playback, in ms. + */ + int64_t startPos; + /** + * Determines whether to autoplay after opening a media resource. + * - true: (Default) Autoplay after opening a media resource. + * - false: Do not autoplay after opening a media resource. + */ + bool autoPlay; + /** + * Determines whether to enable cache streaming to local files. If enable cached, the media player will + * use the url or uri as the cache index. + * + * @note + * The local cache function only supports on-demand video/audio streams and does not support live streams. + * Caching video and audio files based on the HLS protocol (m3u8) to your local device is not supported. + * + * - true: Enable cache. + * - false: (Default) Disable cache. + */ + bool enableCache; + /** + * Determines whether to enable multi-track audio stream decoding. + * Then you can select multi audio track of the media file for playback or publish to channel + * + * @note + * If you use the selectMultiAudioTrack API, you must set enableMultiAudioTrack to true. + * + * - true: Enable MultiAudioTrack;. + * - false: (Default) Disable MultiAudioTrack;. + */ + bool enableMultiAudioTrack; + /** + * Determines whether the opened media resource is a stream through the Agora Broadcast Streaming Network(CDN). + * - true: It is a stream through the Agora Broadcast Streaming Network. + * - false: (Default) It is not a stream through the Agora Broadcast Streaming Network. + */ + Optional isAgoraSource; + /** + * Determines whether the opened media resource is a live stream. If is a live stream, it can speed up the opening of media resources. + * - true: It is a live stream. + * - false: (Default) It is not is a live stream. + */ + Optional isLiveSource; + /** + * External custom data source object + */ + IMediaPlayerCustomDataProvider* provider; + + MediaSource() : url(NULL), uri(NULL), startPos(0), autoPlay(true), enableCache(false), + enableMultiAudioTrack(false), provider(NULL){ + } +}; + +} // namespace base +} // namespace media +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMusicContentCenter.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMusicContentCenter.h new file mode 100644 index 0000000..98c0156 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraMusicContentCenter.h @@ -0,0 +1,485 @@ +// +// AgoraMusicContentCenter.h +// AgoraMusicContentCenter +// +// Created by dingyusong on 2022/6/1. +// Copyright © 2022 Agora. All rights reserved. +// + +#import +#import "AgoraRtcEngineKit.h" +/** + * The status of preload request + */ +typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterPreloadStatus) { + /** + * 0: No error occurs and preload succeeds. + */ + AgoraMusicContentCenterPreloadStatusOK = 0, + + /** + * 1: A general error occurs. + */ + AgoraMusicContentCenterPreloadStatusError = 1, + + /** + * 2: The media file is preloading. + */ + AgoraMusicContentCenterPreloadStatusPreloading = 2, + + /** + * 3: The media file is removed. + */ + AgoraMusicContentCenterPreloadStatusRemoveCache = 3, +}; + +/** + * the status of search or get top list request + */ +typedef NS_ENUM(NSUInteger, AgoraMusicContentCenterStatusCode) { + /** + * 0: No error occurs and request succeeds. + */ + AgoraMusicContentCenterStatusCodeOK = 0, + /** + * 1: A general error occurs. + */ + AgoraMusicContentCenterStatusCodeError = 1, + /** + * 2: The gateway error. There are several possible reasons: + * - Token is expired. Check if your token is expired. + * - Token is invalid. Check the type of token you passed in. + * - Network error. Check your network. + */ + AgoraMusicContentCenterStatusCodeErrorGateway = 2, + /** + * 3: Permission and resource error. There are several possible reasons: + * - Your appid may not have the mcc permission. Please contact technical support + * - The resource may not exist. Please contact technical support + */ + AgoraMusicContentCenterStatusCodeErrorPermissionAndResource = 3, + /** + * 4: Internal data parse error. Please contact technical support + */ + AgoraMusicContentCenterStatusCodeErrorInternalDataParse = 4, + /** + * 5: Music loading error. Please contact technical support + */ + AgoraMusicContentCenterStatusCodeErrorMusicLoading = 5, + /** + * 6: Music decryption error. Please contact technical support + */ + AgoraMusicContentCenterStatusCodeErrorMusicDecryption = 6, + /** + * 7: Http internal error. suggest retry later. + */ + AgoraMusicContentCenterStatusCodeErrorHttpInternalError = 7, +}; + +typedef NS_ENUM(NSUInteger, AgoraMusicCacheStatusType) { + /** + * 0: The media file is already cached. + */ + AgoraMusicCacheStatusTypeCached = 0, + + /** + * 1: The media file is being cached. + */ + AgoraMusicCacheStatusTypeCaching = 1, +}; + +NS_ASSUME_NONNULL_BEGIN + +__attribute__((visibility("default"))) @interface AgoraMusicCacheInfo : NSObject +/** + * The songCode of the music + */ +@property(nonatomic, assign) NSInteger songCode; + +/** + * The cache status of the music + */ +@property(nonatomic, assign) AgoraMusicCacheStatusType statusType; +@end + +__attribute__((visibility("default"))) @interface AgoraMusicChartInfo : NSObject +/** + * Name of the music chart + */ +@property (nonatomic, copy) NSString *chartName; +/** + * Id of the music chart, which is used to get music list + */ +@property (nonatomic, assign) NSInteger identify; +@end + +__attribute__((visibility("default"))) @interface AgoraMvProperty : NSObject +/** + * The resolution of the mv + */ +@property (nonatomic, copy) NSString *resolution; +/** + * The bandwidth of the mv + */ +@property (nonatomic, copy) NSString *bandwidth; +@end + +__attribute__((visibility("default"))) @interface AgoraClimaxSegment : NSObject +/** + * The start time of climax segment + */ +@property(nonatomic, assign) NSInteger startTimeMs; +/** + * The end time of climax segment + */ +@property(nonatomic, assign) NSInteger endTimeMs; +@end + +/** + * The music info + */ +__attribute__((visibility("default"))) @interface AgoraMusic : NSObject +/** + * The songCode of music + */ +@property(nonatomic, assign) NSInteger songCode; +/** + * The type of music + * 1, mp3 with instrumental accompaniment and original + * 2, mp3 only with instrumental accompaniment + * 3, mp3 only with original + * 4, mp4 with instrumental accompaniment and original + * 5, mv only + * 6, new type mp4 with instrumental accompaniment and original + * detail at document of music media center + */ +@property(nonatomic, assign) NSInteger type; +/** + * The pitch type of music. + * 1, xml lyric has pitch + * 2, lyric has no pitch + */ +@property(nonatomic, assign) NSInteger pitchType; +/** + * The name of music + */ +@property(nonatomic, copy) NSString* name; +/** + * The singer of music + */ +@property(nonatomic, copy) NSString* singer; +/** + * The poster url of music + */ +@property(nonatomic, copy) NSString* poster; + +/** + * The release time of music + */ +@property(nonatomic, copy) NSString* releaseTime; +/** + * The duration (in seconds) of music + */ +@property(nonatomic, assign) NSInteger durationS; +/** + * The lyric list of music + * 0, xml + * 1, lrc + */ +@property(nonatomic, strong) NSArray* lyricList; +/** + * The mv property list of music + */ +@property(nonatomic, strong) NSArray* mvPropertyList; +/** + * The climax segment list of music + */ +@property(nonatomic, strong) NSArray* climaxSegmentList; +@end + +/** + * The music collection info + */ +__attribute__((visibility("default"))) @interface AgoraMusicCollection : NSObject +/** + * This page contains how many AgoraMusic object + */ +@property(nonatomic, assign) NSInteger count; +/** + * Total number of this search result or total number of the type music sources + */ +@property(nonatomic, assign) NSInteger total; +/** + * This current page number + */ +@property(nonatomic, assign) NSInteger page; +/** + * This request page size + */ +@property(nonatomic, assign) NSInteger pageSize; +/** + * This music list of the request result + */ +@property(nonatomic, strong) NSArray* musicList; +@end + +/** + * The request event delegate callback + */ +@protocol AgoraMusicContentCenterEventDelegate +/** + * The music chart result callback; occurs when getMusicCharts method is called. + * + * @param requestId The request id is same as that returned by getMusicCharts. + * @param result The result of music chart collection + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onMusicChartsResult:(NSString *)requestId result:(NSArray *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode; + +/** + * Music collection, occurs when getMusicCollectionByMusicChartId or searchMusic method is called. + * + * @param requestId The request id is the same with that returned by getMusicCollectionByMusicChartId or searchMusic + * @param result The result of music collection + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onMusicCollectionResult:(NSString *)requestId result:(AgoraMusicCollection *)result errorCode:(AgoraMusicContentCenterStatusCode)errorCode; + +/** + * Lyric url callback of getLyric, occurs when getLyric is called + * + * @param requestId The request id is same as that returned by getLyric + * @param songCode Song code + * @param lyricUrl The lyric url of this music + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onLyricResult:(NSString*)requestId songCode:(NSInteger)songCode lyricUrl:(NSString* _Nullable)lyricUrl errorCode:(AgoraMusicContentCenterStatusCode)errorCode; + +/** + * Simple info callback of getSongSimpleInfo, occurs when getSongSimpleInfo is called + * + * @param requestId The request id is same as that returned by getSongSimpleInfo. + * @param songCode Song code + * @param simpleinfo The metadata of the music. + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onSongSimpleInfoResult:(NSString*)requestId songCode:(NSInteger)songCode simpleInfo:(NSString* _Nullable)simpleInfo errorCode:(AgoraMusicContentCenterStatusCode)errorCode; + +/** + * Preload process callback, occurs when preload is called + * + * @param requestId The request id is same as that returned by preload. + * @param songCode Song code + * @param percent Preload progress (0 ~ 100) + * @param lyricUrl The lyric url of this music + * @param status Preload status; see PreloadStatusCode. + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ +- (void)onPreLoadEvent:(NSString*)requestId songCode:(NSInteger)songCode percent:(NSInteger)percent lyricUrl:(NSString * _Nullable)lyricUrl status:(AgoraMusicContentCenterPreloadStatus)status errorCode:(AgoraMusicContentCenterStatusCode)errorCode; +@end + + +@class AgoraRtcEngineKit; +__attribute__((visibility("default"))) @interface AgoraMusicContentCenterConfig : NSObject +@property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine; +/** + * The app ID of the project that has enabled the music content center + */ +@property (nonatomic, copy) NSString *appId; +/** + * music content center need token to connect with server + */ +@property (nonatomic, copy) NSString *token; +/** + * The user ID when using music content center. It can be different from that of the rtc product. + */ +@property (nonatomic, assign) NSInteger mccUid; +/** + * The max number which the music content center caches cannot exceed 50. + */ +@property (nonatomic, assign) NSUInteger maxCacheSize; +/** + * The mccdomain, used to control the domain name of music contenter center,usually developer do not need to set it.Only under Tech supporter's help, can set the value + */ +@property(nonatomic, copy) NSString* mccDomain; +/** + * Event handler to get callback result. + */ +@property(nonatomic, weak) id eventDelegate; +@end + +@protocol AgoraMusicPlayerProtocol +/** + * Open a media file with specified parameters. + * + * @param songCode The identifier of the media file that you want to play. + * @param startPos The playback position (ms) of the music file. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (NSInteger)openMediaWithSongCode:(NSInteger)songCode startPos:(NSInteger)startPos NS_SWIFT_NAME(openMedia(songCode:startPos:)); +@end + + +__attribute__((visibility("default"))) @interface AgoraMusicContentCenter : NSObject + +/** + * Create an AgoraMusicContentCenter instance. + * + * @param config Configurations for the AgoraMusicContentCenter instance. For details, see AgoraMusicContentCenterConfig. + * @return An shared instance of AgoraMusicContentCenter +*/ ++ (instancetype _Nullable)sharedContentCenterWithConfig:(AgoraMusicContentCenterConfig *)config NS_SWIFT_NAME(sharedContentCenter(config:)); + +/** +* Renew token of music content center +* @param token The new token. +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (NSInteger)renewToken:(NSString * _Nonnull)token; + +/** + * Register an event delegate, only the last delegate is working. + * + * @param eventDelegate the object who need AgoraRtcMediaPlayerDelegate method to get the player information , + * if you want remove the delegate, just pass nil + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (NSInteger)registerEventDelegate:(id _Nullable)eventDelegate; + +/** + * Creates a music player source object and return its pointer. + * + * @param delegate The object who need AgoraRtcMediaPlayerDelegate method to get the player information + * @return + * - The pointer to an object who realize the AgoraMusicPlayerProtocol, if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ +- (id _Nullable)createMusicPlayerWithDelegate:(id _Nullable)delegate NS_SWIFT_NAME(createMusicPlayer(delegate:)); + +/** + * Get music chart collection of music.If the method call success, get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicChartsResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(NSArray *)result; match the callback "requestId" parameter to get the request result. + * + * @return The request identification + */ +- (NSString *)getMusicCharts; + +/** + * Get hot music list by hotType and page info.If the method call success, get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicCollectionResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(AgoraMusicCollection *)result; match the callback "requestId" parameter to get the request result. + * + * @param musicChartId The music chart id obtained from getMusicCharts. + * @param page The page of the music chart, starting from 1 + * @param pageSize The page size, max is 50. + * @param jsonOption The ext param, default is null. + * @return The request identification + */ +- (NSString *)getMusicCollectionWithMusicChartId:(NSInteger)musicChartId page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getMusicCollection(musicChartId:page:pageSize:jsonOption:)); + +/** + * Search music by keyword and page info. get result from the AgoraMusicContentCenterEventDelegate - (void)onMusicCollectionResult:(NSString *)requestId status:(AgoraMusicContentCenterStatusCode)status result:(AgoraMusicCollection *)result; match the callback "requestId" parameter to get the request result. + * + * @param keyWord The key word to search. + * @param page The page of the music search result, starting from 1 + * @param pageSize The page size, max is 50. + * @param jsonOption The ext param, default is null. + * @return The request identification + */ +- (NSString *)searchMusicWithKeyWord:(NSString *)keyWord page:(NSInteger)page pageSize:(NSInteger)pageSize jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(searchMusic(keyWord:page:pageSize:jsonOption:)); + +/** + * Preload a media file with specified parameters. + * + * @deprecated This method is deprecated. Use preload(songCode:) instead. + * @param songCode The identify of the media file that you want to play. + * @param jsonOption The ext param, default is null. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (NSInteger)preloadWithSongCode:(NSInteger)songCode jsonOption:(NSString* _Nullable)jsonOption NS_SWIFT_NAME(preload(songCode:jsonOption:)) __attribute__((deprecated("Use preload(songCode:) instead."))); + +/** + * Preload a media file with specified parameters. + * + * @param songCode The identify of the media file that you want to play. + * @return The request identification + */ +- (NSString *)preloadWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(preload(songCode:)); + +/** + * Preload a media file with specified parameters. + * + * @param songCode The identify of the media file that you want to play. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (NSInteger)isPreloadedWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(isPreloaded(songCode:)); + +/** + * Remove a media file cache + * + * @param songCode The identifier of the media file that you want to play. + * @return + * - 0: Success; the cached media file is removed. + * - < 0: Failure. + */ +- (NSInteger)removeCacheWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(removeCache(songCode:)); + +/** + * Get media cache files. + * + * @return The caches Array contains songCode and status of the music. + */ +- (NSArray *)getCaches NS_SWIFT_NAME(getCaches()); + +/** + * Get internal songCodeKey from songCode and jsonOption + * + * @param songCode The identifier of the media file. + * @param jsonOption An extention parameter. The default value is null. it’s a json-format string and the `key` and `value` can be customized according to your scenarios. + * @return + * - Internal songCode key, if the method call succeeds. + * - The number less than zero, if the method call fails. + */ +- (NSInteger)getInternalSongCode:(NSInteger)songCode jsonOption:(NSString * _Nullable)jsonOption NS_SWIFT_NAME(getInternalSongCode(songCode:jsonOption:)); + +/** + * Get lyric of the song. get result from the AgoraMusicContentCenterEventDelegate - (void)onLyricResult:(NSString*)requestId lyricUrl:(NSString*)lyricUrl; match the callback "requestId" parameter to get the request result. + * + * @param songCode The identify of the media file that you want to play. + * @param lyricType The type of the lyric file. may be 0:xml or 1:lrc. + * @return The request identification + */ +- (NSString *)getLyricWithSongCode:(NSInteger)songCode lyricType:(NSInteger)lyricType NS_SWIFT_NAME(getLyric(songCode:lyricType:)); + +/** + * Gets the metadata of a specific music. Once this method is called, the SDK triggers the onSongSimpleInfoResult callback to report the metadata of the music. + * + * @param songCode The identify of the media file that you want to play. + * @return The request identification + */ +- (NSString *)getSongSimpleInfoWithSongCode:(NSInteger)songCode NS_SWIFT_NAME(getSongSimpleInfo(songCode:)); + +/** + * If you want AgoraMusicContentCenterEventDelegate methods callback in the mainThread ,you should set enable YES. Default the delegate callback in subthread. + * - `NO`: (Default)Send the delegate callback in subthread. + * - `YES`: Send the delegate callback in mainthread. + */ +- (void)enableMainQueueDispatch:(BOOL)enabled; + +/** + * Destroy the shared instance of AgoraMusicContentCenter + * + * @note If you call the method, you should call it brefore AgoraRtcEngineKit destroy + */ ++ (void)destroy; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraObjects.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraObjects.h new file mode 100644 index 0000000..18b3073 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraObjects.h @@ -0,0 +1,3284 @@ +// +// AgoraObjects.h +// AgoraRtcEngineKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#import +#import +#import "AgoraEnumerates.h" +#import "AgoraMediaFilterEventDelegate.h" + +#if TARGET_OS_IPHONE +#import +typedef UIView VIEW_CLASS; +typedef UIColor COLOR_CLASS; +typedef UIImage IMAGE_CLASS; +#elif TARGET_OS_MAC +#import +typedef NSView VIEW_CLASS; +typedef NSColor COLOR_CLASS; +typedef NSImage IMAGE_CLASS; +#endif + +@protocol AgoraRtcMediaPlayerProtocol; +/** + * @brief The player requests to read the data callback, you need to fill the specified length of data into the buffer + * @param playerKit the player instance. \ref AgoraRtcMediaPlayerProtocol. + * @param buffer the buffer pointer that you need to fill data. + * @param bufferSize the bufferSize need to fill of the buffer pointer. + * @return you need return offset value if succeed. return 0 if failed. + */ +typedef int(^AgoraRtcMediaPlayerCustomSourceOnReadCallback)(id _Nonnull playerKit, unsigned char * _Nullable buffer, int bufferSize); + +/** + * @brief The Player seek event callback, you need to operate the corresponding stream seek operation, You can refer to the definition of lseek() at https://man7.org/linux/man-pages/man2/lseek.2.html + * @param playerKit the player instance. \ref AgoraRtcMediaPlayerProtocol. + * @param offset the value of seek offset, + * @param whence the postion of start seeking, the directive whence as follows: + * SEEK_SET : The file offset is set to offset bytes. + * SEEK_CUR : The file offset is set to its current location plus offset bytes. + * SEEK_END : The file offset is set to the size of the file plus offset bytes. + * 65536 - AVSEEK_SIZE : Optional. Passing this as the "whence" parameter to a seek function causes it to return the filesize without seeking anywhere. + * @return + * whence == 65536, return filesize if you need. + * whence >= 0 && whence < 3 , return offset value if succeed. return -1 if failed. + */ +typedef long long(^AgoraRtcMediaPlayerCustomSourceOnSeekCallback)(id _Nonnull playerKit, long long offset, int whence); + +__attribute__((visibility("default"))) @interface AgoraMediaSource : NSObject +/** + * The URL of the media file that you want to play. + */ +@property(copy, nonatomic) NSString *_Nullable url; +/** + * The URI of the media file. + */ +@property(copy, nonatomic) NSString *_Nullable uri; +/** + * Set the starting position for playback, in seconds (ms) + */ +@property(assign, nonatomic) NSUInteger startPos; +/** + * Determines whether to autoplay after opening a media resource. + * - `YES`: (Default) Autoplay after opening a media resource. + * - `NO`: Do not autoplay after opening a media resource. + */ +@property(assign, nonatomic) BOOL autoPlay; +/** + * Determines whether to enable cache streaming to local files. If enable cached, the media player will + * use the url or uri as the cache index. + * + * @note + * The local cache function only supports on-demand video/audio streams and does not support live streams. + * Caching video and audio files based on the HLS protocol (m3u8) to your local device is not supported. + * + * - `YES`: Enable cache. + * - `NO`: (Default) Disable cache. + */ +@property(assign, nonatomic) BOOL enableCache; +/** + * Determines whether to enable multi-track audio stream decoding. + * Then you can select multi audio track of the media file for playback or publish to channel + * + * @note + * If you use the selectMultiAudioTrack API, you must set enableMultiAudioTrack to true. + * + * - `YES`: Enable MultiAudioTrack;. + * - `NO`: (Default) Disable MultiAudioTrack;. + */ +@property(assign, nonatomic) BOOL enableMultiAudioTrack; +/** + * Determines whether the opened media resource is a stream through the Agora Broadcast Streaming Network(CDN). + * - `YES`: It is a stream through the Agora Broadcast Streaming Network. + * - `NO`: (Default) It is not a stream through the Agora Broadcast Streaming Network. + */ +@property(assign, nonatomic) BOOL isAgoraSource; +/** + * Determines whether the opened media resource is a live stream. If is a live stream, it can speed up the opening of media resources. + * - `YES`: It is a live stream. + * - `NO`: (Default) It is not is a live stream. + */ +@property(assign, nonatomic) BOOL isLiveSource; +/** + * External custom data source callback + */ +@property(copy, nonatomic) AgoraRtcMediaPlayerCustomSourceOnReadCallback _Nonnull playerOnReadCallback; +@property(copy, nonatomic) AgoraRtcMediaPlayerCustomSourceOnSeekCallback _Nonnull playerOnSeekCallback; + +@end + +__attribute__((visibility("default"))) @interface AgoraMediaPlayerCacheStatistics : NSObject + +@property(assign, nonatomic) NSInteger fileSize; +@property(assign, nonatomic) NSInteger cacheSize; +@property(assign, nonatomic) NSInteger downloadSize; + +@end + +/** + * @brief player_id and device_id has value when user trigger interface of opening. + * + */ +__attribute__((visibility("default"))) @interface AgoraMediaPlayerUpdatedInfo : NSObject +@property(copy, nonatomic) NSString *_Nullable playerId; +@property(copy, nonatomic) NSString *_Nullable deviceId; +@property(strong, nonatomic) AgoraMediaPlayerCacheStatistics *_Nullable cacheStatistics; +@end + +/** + * @brief The information of the media stream object. + * + */ +__attribute__((visibility("default"))) @interface AgoraMediaPlayerSrcInfo : NSObject +/** + * The bitrate of the media stream. The unit of the number is kbps. + */ +@property(assign, nonatomic) int bitrateInKbps; +/** + * The name of the media stream. +*/ +@property(copy, nonatomic) NSString *_Nullable name; + +@end + + +/** + * The statistics of the Direct Cdn Streams. + */ +__attribute__((visibility("default"))) @interface AgoraDirectCdnStreamingStats : NSObject +/** + * Width of the video pushed by rtmp. + */ +@property(assign, nonatomic) NSUInteger videoWidth; +/** + * Height of the video pushed by rtmp. + */ +@property(assign, nonatomic) NSUInteger videoHeight; +/** + * The frame rate of the video pushed by rtmp. + */ +@property(assign, nonatomic) NSUInteger fps; +/** + * Real-time bit rate of the video streamed by rtmp. + */ +@property(assign, nonatomic) NSUInteger videoBitrate; +/** + * Real-time bit rate of the audio pushed by rtmp. + */ +@property(assign, nonatomic) NSUInteger audioBitrate; + +@end + +/** + * The cdn streaming media options. + */ +__attribute__((visibility("default"))) @interface AgoraDirectCdnStreamingMediaOptions : NSObject +/** + * Determines whether to publish the video of the camera track. + * - `YES`: Publish the video track of the camera capturer. + * - `NO`: (Default) Do not publish the video track of the camera capturer. + */ +@property(assign, nonatomic) BOOL publishCameraTrack; +/** + * Determines whether to publish the recorded audio. + * - `YES`: Publish the recorded audio. + * - `NO`: (Default) Do not publish the recorded audio. + */ +@property(assign, nonatomic) BOOL publishMicrophoneTrack; +/** + * Determines whether to publish the audio of the custom audio track. + * - `YES`: Publish the audio of the custom audio track. + * - `NO`: (Default) Do not publish the audio of the custom audio track. + */ +@property(assign, nonatomic) BOOL publishCustomAudioTrack; +/** + * Determines whether to publish the video of the custom video track. + * - `YES`: Publish the video of the custom video track. + * - `NO`: (Default) Do not publish the video of the custom video track. + */ +@property(assign, nonatomic) BOOL publishCustomVideoTrack; +/** + * Determines whether to publish the audio track of media player source. + * - `YES`: Publish the audio track of media player source. + * - `NO`: (Default) Do not publish the audio track of media player source. +*/ +@property(assign, nonatomic) BOOL publishMediaPlayerAudioTrack; +/** + * Determines which media player source should be published. + * This parameter get from function getMediaPlayerId() of AgoraMediaPlayer. +*/ +@property(assign, nonatomic) NSInteger publishMediaPlayerId; + +/** + * The custom video track id which will used to publish. + */ +@property(assign, nonatomic) NSInteger customVideoTrackId; + +@end + +/** + * The video encoded track options. + */ +__attribute__((visibility("default"))) @interface AgoraEncodedVideoTrackOptions : NSObject +/** + * Whether to enable CC mode. + * - TCC_ENABLED = 0: (Default) enable cc. + * - TCC_DISABLED = 1: disable cc. + */ +@property(assign, nonatomic) int ccMode; +/** + * The codec type used for the encoded images. + * - VIDEO_CODEC_VP8 = 1: VP8. + * - VIDEO_CODEC_H264 = 2: (Default) H.264. + * - VIDEO_CODEC_H265 = 3: H.265. + * - VIDEO_CODEC_VP9 = 5: VP9. + * - VIDEO_CODEC_GENERIC = 6: GENERIC. + * - VIDEO_CODEC_GENERIC_H264 = 7: GENERIC_H264. + * - VIDEO_CODEC_GENERIC_JPEG = 20: GENERIC_JPEG. + */ +@property(assign, nonatomic) int codecType; +/** + * Target bitrate (Kbps) for sending encoded video frame. + */ +@property(assign, nonatomic) int targetBitrate; +@end + +/** + * The channel media options. + */ +__attribute__((visibility("default"))) @interface AgoraRtcChannelMediaOptions : NSObject +/** + * Determines whether to publish the video of the camera track. + * - `YES`: (Default) Publish the video track of the camera capturer. + * - `NO`: Do not publish the video track of the camera capturer. + */ +@property(assign, nonatomic) BOOL publishCameraTrack; +/** + * Determines whether to publish the video of the secondary camera track. + * - `YES`: Publish the video track of the secondary camera capturer. + * - `NO`: (Default) Do not publish the video track of the secondary camera capturer. + */ +@property(assign, nonatomic) BOOL publishSecondaryCameraTrack; +/** + * Determines whether to publish the recorded audio of microphone. + * - `YES`: (Default) Publish the recorded audio of microphone. + * - `NO`: Do not publish the recorded audio of microphone. + */ +@property(assign, nonatomic) BOOL publishMicrophoneTrack; +#if TARGET_OS_IPHONE +/** + * Determines whether to publish the video of the screen capturer. + * - `YES`: Publish the video track of the screen capturer. + * - `NO`: (Default) Do not publish the video track of the screen capturer. + */ +@property(assign, nonatomic) BOOL publishScreenCaptureVideo; +/** + * Determines whether to publish the audio of the screen capturer. + * - `YES`: Publish the audio track of the screen capturer. + * - `NO`: (Default) Do not publish the audio track of the screen capturer. + */ +@property(assign, nonatomic) BOOL publishScreenCaptureAudio; +#elif TARGET_OS_MAC +/** + * Determines whether to publish the video of the third camera track. + * - `YES`: Publish the video track of the third camera capturer. + * - `NO`: (Default) Do not publish the video track of the third camera capturer. + */ +@property(assign, nonatomic) BOOL publishThirdCameraTrack; +/** + * Determines whether to publish the video of the fourth camera track. + * - `YES`: Publish the video track of the fourth camera capturer. + * - `NO`: (Default) Do not publish the video track of the fourth camera capturer. + */ +@property(assign, nonatomic) BOOL publishFourthCameraTrack; +/** + * Determines whether to publish the video of the screen capturer. + * - `YES`: Publish the video track of the screen capturer. + * - `NO`: (Default) Do not publish the video track of the screen capturer. + */ +@property(assign, nonatomic) BOOL publishScreenTrack; +/** + * Determines whether to publish the video of the secondary screen track. + * - `YES`: Publish the video track of the secondary screen capturer. + * - `NO`: (Default) Do not publish the video track of the secondary screen capturer. + */ +@property(assign, nonatomic) BOOL publishSecondaryScreenTrack; +/** + * Determines whether to publish the video of the third screen track. + * - `YES`: Publish the video track of the secondary third capturer. + * - `NO`: (Default) Do not publish the video track of the third screen capturer. + */ +@property(assign, nonatomic) BOOL publishThirdScreenTrack; +/** + * Determines whether to publish the video of the fourth screen track. + * - `YES`: Publish the video track of the secondary fourth capturer. + * - `NO`: (Default) Do not publish the video track of the fourth screen capturer. + */ +@property(assign, nonatomic) BOOL publishFourthScreenTrack; +#endif +/** + * Determines whether to publish the audio of the custom audio track. + * - `YES`: Publish the audio of the custom audio track. + * - `NO`: (Default) Do not publish the audio of the custom audio track. + */ +@property(assign, nonatomic) BOOL publishCustomAudioTrack; +/** + * The custom audio track id. The default value is 0. + */ +@property(assign, nonatomic) NSInteger publishCustomAudioTrackId; +/** + * Determines whether to publish AEC custom audio track. + * - `YES`: Publish AEC track. + * - `NO`: (Default) Do not publish AEC track. + */ +@property(assign, nonatomic) BOOL publishCustomAudioTrackAec; +/** + * Determines whether to publish the video of the custom video track. + * - `YES`: Publish the video of the custom video track. + * - `NO`: (Default) Do not publish the video of the custom video track. + */ +@property(assign, nonatomic) BOOL publishCustomVideoTrack; +/** + * Determines whether to publish the video of the encoded video track. + * - `YES`: Publish the video of the encoded video track. + * - `NO`: (Default) Do not publish the video of the encoded video track. + */ +@property(assign, nonatomic) BOOL publishEncodedVideoTrack; +/** + * Determines whether to publish the audio track of media player. + * - `YES`: Publish the audio track of media player. + * - `NO`: (Default) Do not publish the audio track of media player. + */ +@property(assign, nonatomic) BOOL publishMediaPlayerAudioTrack; +/** +* Determines whether to publish the video track of media player source. +* - `YES`: Publish the video track of media player source. +* - `NO`: (Default) Do not publish the video track of media player source. +*/ +@property(assign, nonatomic) BOOL publishMediaPlayerVideoTrack; +/** +* Determines whether to publish the local transcoded video track. +* - `YES`: Publish the video track of local transcoded video track. +* - `NO`: (Default) Do not publish the local transcoded video track. +*/ +@property(assign, nonatomic) BOOL publishTrancodedVideoTrack; +/** +* Determines whether to publish the local mixed audio track. +* - `YES`: Publish the audio track of local mixed audio track. +* - `NO`: (Default) Do not publish the local mixed audio track. +*/ +@property(assign, nonatomic) BOOL publishMixedAudioTrack; +/** + * Determines whether to subscribe all remote audio streams automatically. + * This property replaces calling \ref AgoraRtcEngineKit.setDefaultMuteAllRemoteAudioStreams: setDefaultMuteAllRemoteAudioStreams + * before joining a channel. + * - `YES`: (Default) Subscribe all remote audio streams automatically. + * - `NO`: Do not subscribe any remote audio stream automatically. + */ +@property(assign, nonatomic) BOOL autoSubscribeAudio; +/** + * Determines whether to subscribe all remote video streams automatically. + * This property replaces calling \ref AgoraRtcEngineKit.setDefaultMuteAllRemoteVideoStreams: setDefaultMuteAllRemoteVideoStreams + * before joining a channel. + * - `YES`: (Default) Subscribe all remote video streams automatically. + * - `NO`: Do not subscribe any remote video stream automatically. + */ +@property(assign, nonatomic) BOOL autoSubscribeVideo; +/** + * Determines whether to enable audio recording or playout. + * - `YES`: (Default) It's used to publish audio and mix microphone, or subscribe audio and playout. + * - `NO`: It's used to publish extenal audio frame only without mixing microphone, or no need audio device to playout audio either. + */ +@property(assign, nonatomic) BOOL enableAudioRecordingOrPlayout; +/** +* Determines which media player source should be published. +* This parameter get from function getMediaPlayerId() of AgoraMediaPlayer. +*/ +@property(assign, nonatomic) NSInteger publishMediaPlayerId; +/** + * The client role type: \ref AgoraClientRole. + * Default is AgoraClientRoleAudience. + */ +@property(assign, nonatomic) AgoraClientRole clientRoleType; +/** + * The audience latency level type: \ref AgoraAudienceLatencyLevelType. + * Default is AgoraAudienceLatencyLevelUltraLowLatency. + */ +@property(assign, nonatomic) AgoraAudienceLatencyLevelType audienceLatencyLevel; +/** + * The default video stream type: \ref AgoraVideoStreamType. + * Default is AgoraVideoStreamTypeHigh. + */ +@property(assign, nonatomic) AgoraVideoStreamType defaultVideoStreamType; +/** + * The channel profile: \ref AgoraChannelProfile. + * Default is AgoraChannelProfileLiveBroadcasting. + */ +@property(assign, nonatomic) AgoraChannelProfile channelProfile; +/** + * The delay in ms for sending audio frames. This is used for explicit control of A/V sync. + * To switch off the delay, set the value to zero. + */ +@property(assign, nonatomic) NSInteger audioDelayMs; +/** + * The delay in ms for sending media player audio frames. This is used for explicit control of A/V sync. + * To switch off the delay, set the value to zero. + */ +@property(assign, nonatomic) NSInteger mediaPlayerAudioDelayMs; +/** + * The token to be renewed. + */ +@property(copy, nonatomic) NSString * _Nullable token; +/** + * Enable media packet encryption. + * It will be ignored when calling function updateChannelMediaOptions(). + * - `YES`: Enable media packet encryption. + * - `NO`: (Default) Do not Enable media packet encryption. + */ +@property(assign, nonatomic) BOOL enableBuiltInMediaEncryption; + +/** + * Determines whether to publish the sound of the rhythm player to remote users. + * - true: (Default) Publish the sound of the rhythm player. + * - false: Do not publish the sound of the rhythm player. + */ +@property(assign, nonatomic) BOOL publishRhythmPlayerTrack; +/** + * This mode is only used for audience. In PK mode, client might join one + * channel as broadcaster, and join another channel as interactive audience to + * achieve low lentancy and smooth video from remote user. + * - `YES`: Enable low lentancy and smooth video when joining as an audience. + * - `NO`: (default) Use default settings for audience role. + */ +@property(assign, nonatomic) BOOL isInteractiveAudience; + +/** + * The custom video track id which will used to publish or preview. + */ +@property(assign, nonatomic) NSInteger customVideoTrackId; + +/** + * Determines whether local audio stream can be filtered. + * - `YES`: (Default) Can be filtered when audio level is low. + * - `NO`: Do not filter this audio stream. + */ +@property(assign, nonatomic) BOOL isAudioFilterable; + +/** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + */ +@property(copy, nonatomic) NSString * _Nullable parameters; + +@end + +/** Properties of the video canvas object. + */ +__attribute__((visibility("default"))) @interface AgoraRtcVideoCanvas : NSObject +/** + *The video display view. The SDK does not maintain the lifecycle of the view. + * + *The view can be safely released after calling [leaveChannel]([AgoraRtcEngineKit + *leaveChannel:]) with a returned value. The SDK keeps a cache of the view value, so calling + *[setupLocalVideo]([AgoraRtcEngineKit setupLocalVideo:]) to set the view value to nil can + *clear the cache before switching or releasing the view. + */ +@property(strong, nonatomic) VIEW_CLASS *_Nullable view; +/** + * The user id of local video. + */ +@property(assign, nonatomic) NSUInteger uid; + +@property(assign, nonatomic) NSUInteger subviewUid; + +/** + * The video render mode. See \ref AgoraVideoRenderMode. + * The default value is AgoraVideoRenderModeHidden. + */ +@property(assign, nonatomic) AgoraVideoRenderMode renderMode; +/** + * The video mirror mode. See \ref AgoraVideoMirrorMode. + * The default value is AgoraVideoMirrorModeAuto. + * @note + * - For the mirror mode of the local video view: + * If you use a front camera, the SDK enables the mirror mode by default; + * if you use a rear camera, the SDK disables the mirror mode by default. + * - For the remote user: The mirror mode is disabled by default. + */ +@property(assign, nonatomic) AgoraVideoMirrorMode mirrorMode; +/** + * The mode of setting up video view. See \ref AgoraVideoViewSetupMode. + * The default value is AgoraVideoViewSetupReplace. + */ +@property(assign, nonatomic) AgoraVideoViewSetupMode setupMode; +/** + * The video source type. See \ref AgoraVideoSourceType + * The default value is AgoraVideoSourceTypeCamera. + */ +@property(nonatomic, assign) AgoraVideoSourceType sourceType; +/** + * The media player id of AgoraMediaPlayer. It should set this parameter when the + * sourceType is AgoraVideoSourceTypeMediaPlayer to show the video that AgoraMediaPlayer is playing. + * You can get this value by calling the method \ref getMediaPlayerId(). + */ +@property(nonatomic, assign) int mediaPlayerId; +/** + * If you want to display a certain part of a video frame, you can set + * this value to crop the video frame to show. + * The default value is empty(that is, if it has zero width or height), which means no cropping. + */ +@property(assign, nonatomic) CGRect cropArea; +/** + * default NO. if set to YES, the video will apply alpha mask if exist.(Mac only) + */ +@property(assign, nonatomic) BOOL enableAlphaMask; + +@end + +/** + * The configurations for the last-mile network probe test. + */ +__attribute__((visibility("default"))) @interface AgoraLastmileProbeConfig : NSObject +/** + * Sets whether or not to test the uplink network. + * + * Some users, for example, the audience in a live-broadcast channel, do not need such a test. + * - `YES`: Enables the test. + * - `NO`: Disables the test. + */ +@property (assign, nonatomic) BOOL probeUplink; +/** + * Sets whether or not to test the downlink network. + * - `YES`: Enables the test. + * - `NO`: Disables the test. + */ +@property (assign, nonatomic) BOOL probeDownlink; +/** + * Sets the expected maximum sending bitrate (bps) of the local user. + * + * The value ranges between 100000 and 5000000. Agora recommends + * setting this value according to the required bitrate of selected video profile. + */ +@property (assign, nonatomic) NSUInteger expectedUplinkBitrate; +/** + * Sets the expected maximum receiving bitrate (bps) of the local user. + * The value ranges between 100000 and 5000000. + */ +@property (assign, nonatomic) NSUInteger expectedDownlinkBitrate; +@end + +/** + * The one-way last-mile probe result. + */ +__attribute__((visibility("default"))) @interface AgoraLastmileProbeOneWayResult : NSObject +/** + * The packet loss rate (%). + */ +@property (assign, nonatomic) NSUInteger packetLossRate; +/** + * The network jitter (ms). + */ +@property (assign, nonatomic) NSUInteger jitter; +/** + * The estimated available bandwidth (bps). + */ +@property (assign, nonatomic) NSUInteger availableBandwidth; +@end + +/** + * Statistics of the last-mile probe. + */ +__attribute__((visibility("default"))) @interface AgoraLastmileProbeResult : NSObject +/** + * The state of the probe test. + * See \ref AgoraLastmileProbeResultState. + */ +@property (assign, nonatomic) AgoraLastmileProbeResultState state; +/** + * The round-trip delay time (ms). + */ +@property (assign, nonatomic) NSUInteger rtt; +/** + * The uplink last-mile network report. + * + * See \ref AgoraLastmileProbeOneWayResult. + */ +@property (strong, nonatomic) AgoraLastmileProbeOneWayResult *_Nonnull uplinkReport; +/** + * The downlink last-mile network report. + * + * See \ref AgoraLastmileProbeOneWayResult. + */ +@property (strong, nonatomic) AgoraLastmileProbeOneWayResult *_Nonnull downlinkReport; +@end + + +/** + * The statistics of the local video stream. + */ +__attribute__((visibility("default"))) @interface AgoraRtcLocalVideoStats : NSObject +/** + * Bitrate (Kbps) sent in the reported interval, which does not include + * the bitrate of the retransmission video after packet loss. + */ +@property(assign, nonatomic) NSUInteger sentBitrate; +/** + * Frame rate (fps) sent in the reported interval, which does not include + * the frame rate of the retransmission video after packet loss. + */ +@property(assign, nonatomic) NSUInteger sentFrameRate; +/** + * ID of the local user. + */ +@property(assign, nonatomic) NSUInteger uid; + +/** The capture frame rate (fps) of the local video. + */ +@property(assign, nonatomic) NSInteger captureFrameRate; +/** The width of the capture frame (px). + */ +@property(assign, nonatomic) NSInteger captureFrameWidth; +/** The height of the capture frame (px). + */ +@property(assign, nonatomic) NSInteger captureFrameHeight; +/** + * The regulated frame rate of capture frame rate according to video encoder configuration. + */ +@property(assign, nonatomic) NSInteger regulatedCaptureFrameRate; +/** + * The regulated frame width (pixel) of capture frame width according to video encoder configuration. + */ +@property(assign, nonatomic) NSInteger regulatedCaptureFrameWidth; +/** + * The regulated frame height (pixel) of capture frame height according to video encoder configuration. + */ +@property(assign, nonatomic) NSInteger regulatedCaptureFrameHeight; + +/** The encoder output frame rate (fps) of the local video. + */ +@property(assign, nonatomic) NSInteger encoderOutputFrameRate; +/** The render output frame rate (fps) of the local video. + */ +@property(assign, nonatomic) NSInteger rendererOutputFrameRate; +/** The target frame rate (fps) of the current encoder. + */ +@property(assign, nonatomic) NSInteger targetFrameRate; +/** Quality change of the local video in terms of target frame rate and target bit rate in this reported interval, see [AgoraVideoQualityAdaptIndication](AgoraVideoQualityAdaptIndication). */ +@property(assign, nonatomic) AgoraVideoQualityAdaptIndication qualityAdaptIndication; +/** + * The target bitrate (Kbps) of the current encoder. This value is + * estimated by the SDK based on the current network conditions. + */ +@property(assign, nonatomic) NSInteger targetBitrate; +/** + * The encoding bitrate (Kbps), which does not include the bitrate of the + * re-transmission video after packet loss. + */ +@property(assign, nonatomic) NSInteger encodedBitrate; +/** + * The width of the encoding frame (px). + */ +@property(assign, nonatomic) NSInteger encodedFrameWidth; +/** + * The height of the encoding frame (px). + */ +@property(assign, nonatomic) NSInteger encodedFrameHeight; +/** + * The number of the sent frames, represented by an aggregate value. + */ +@property(assign, nonatomic) NSInteger encodedFrameCount; +/** + * The codec type of the local video: + * - VIDEO_CODEC_VP8 = 1: VP8. + * - VIDEO_CODEC_H264 = 2: (Default) H.264. + */ +@property(assign, nonatomic) AgoraVideoCodecType codecType; +/** + * The hw_encoder_accelerating of the local video: + * - hwEncoderAccelerating = 0: the encoder is software + * - hwEncoderAccelerating = 1: the encoder is hardware + */ +@property(assign, nonatomic) AgoraVideoHwEncoderAccelerating hwEncoderAccelerating; +/** + * The video packet loss rate (%) from the local client to the Agora edge server before applying the anti-packet loss strategies. + */ +@property(assign, nonatomic) NSInteger txPacketLossRate; +/** + * The brightness level of the video image captured by the local camera. See AgoraCaptureBrightnessLevelType. + */ +@property(assign, nonatomic) AgoraCaptureBrightnessLevelType captureBrightnessLevel NS_SWIFT_NAME(captureBrightnessLevel); +/** + * Whether we send dual stream now. + */ +@property(assign, nonatomic) BOOL dualStreamEnabled; +@end + +/** Statistics of the remote video stream. */ +__attribute__((visibility("default"))) @interface AgoraRtcRemoteVideoStats : NSObject +/** + * ID of the remote user sending the video stream. + */ +@property(assign, nonatomic) NSUInteger uid; +/** Time delay (ms). + */ +@property(assign, nonatomic) NSUInteger delay __deprecated; +/** Width (pixels) of the video stream. + */ +@property(assign, nonatomic) NSUInteger width; +/** Height (pixels) of the video stream. + */ +@property(assign, nonatomic) NSUInteger height; +/** Data receive bitrate (Kbps) since last count. + */ +@property(assign, nonatomic) NSUInteger receivedBitrate; +/** Data receive frame rate (fps) since last count. + */ +@property(assign, nonatomic) NSUInteger receivedFrameRate; +/** Video stream type; high- or low-video stream. + */ +@property(assign, nonatomic) AgoraVideoStreamType rxStreamType; + +/** The decoder output frame rate (fps) of the remote video. + */ +@property(assign, nonatomic) NSInteger decoderOutputFrameRate; +/** The render output frame rate (fps) of the remote video. + */ +@property(assign, nonatomic) NSInteger rendererOutputFrameRate; +/** The video frame loss rate (%) of the remote video stream in the reported interval. + */ +@property(assign, nonatomic) NSInteger frameLossRate; +/** Packet loss rate (%) of the remote video stream after using the anti-packet-loss method. + */ +@property(assign, nonatomic) NSInteger packetLossRate; +/** + The total freeze time (ms) of the remote video stream after the remote user joins the channel. + In a video session where the frame rate is set to no less than 5 fps, video freeze occurs when + the time interval between two adjacent renderable video frames is more than 500 ms. + */ +@property(assign, nonatomic) NSInteger totalFrozenTime; +/** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ +@property(assign, nonatomic) NSUInteger totalActiveTime; +/** + * The total publish duration (ms) of the remote audio stream. + */ +@property(assign, nonatomic) NSInteger publishDuration; +/** + The total video freeze time as a percentage (%) of the total time when the video is available. + */ +@property(assign, nonatomic) NSInteger frozenRate; +/** + The offset (ms) between audio and video stream. A positive value indicates the audio leads the + video, and a negative value indicates the audio lags the video. + */ +@property(assign, nonatomic) NSInteger avSyncTimeMs; +/** + * The quality of the remote video stream in the reported interval. + * The quality is determined by the Agora real-time video MOS (Mean Opinion Score) measurement method. + * The return value range is [0, 500]. + * Dividing the return value by 100 gets the MOS score, which ranges from 0 to 5. The higher the score, the better the video quality. + * @note For textured video data, this parameter always returns 0. + */ +@property(assign, nonatomic) NSInteger mosValue; +/** + * Total number of video bytes received (bytes), represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxVideoBytes; + +@end + +/** + * The statistics of the local audio. + */ +__attribute__((visibility("default"))) @interface AgoraRtcLocalAudioStats : NSObject +/** + * The number of audio channels. + */ +@property(assign, nonatomic) NSUInteger numChannels; +/** + * The sample rate (Hz). + */ +@property(assign, nonatomic) NSUInteger sentSampleRate; +/** + * The average sending bitrate (Kbps). + */ +@property(assign, nonatomic) NSUInteger sentBitrate; +/** The internal payload type. + */ +@property(assign, nonatomic) NSUInteger internalCodec; +/** The audio packet loss rate (%) from the local client to the Agora edge server before applying the anti-packet loss strategies. + */ +@property(assign, nonatomic) NSUInteger txPacketLossRate; +/** + * The audio delay of the device, contains record and playout delay + */ +@property(assign, nonatomic) NSUInteger audioDeviceDelay; +/** + * The audio playout delay of the device + */ +@property(assign, nonatomic) NSUInteger audioPlayoutDelay; +/** + * The estimated delay of audio in-ear monitoring + */ +@property(assign, nonatomic) NSUInteger earMonitorDelay; +/** + * The estimated signal delay (ms) from AEC nearin and farin + */ +@property(assign, nonatomic) NSUInteger aecEstimatedDelay; +/** + * The AIMD result + */ +@property(assign, nonatomic) NSInteger aedMusicRes; +/** + * The AIVAD result + */ +@property(assign, nonatomic) NSInteger aedVoiceRes; + +@end + +/** + * The statistics of the remote audio. + */ +__attribute__((visibility("default"))) @interface AgoraRtcRemoteAudioStats : NSObject +/** + * ID of the user sending the audio stream. + */ +@property(assign, nonatomic) NSUInteger uid; +/** + * The receiving audio quality. + * + * - 0: The quality is unknown. + * - 1: The quality is excellent. + * - 2: The quality is quite good, but the bitrate may be slightly + * lower than excellent. + * - 3: Users can feel the communication slightly impaired. + * - 4: Users can communicate not very smoothly. + * - 5: The quality is so bad that users can barely communicate. + * - 6: The network is disconnected and users cannot communicate at all. + */ +@property(assign, nonatomic) NSUInteger quality; +/** + * The network delay (ms) from the sender to the receiver. + */ +@property(assign, nonatomic) NSUInteger networkTransportDelay; +/** + * The jitter buffer delay (ms) at the receiver. + */ +@property(assign, nonatomic) NSUInteger jitterBufferDelay; +/** + * The packet loss rate in the reported interval. + */ +@property(assign, nonatomic) NSUInteger audioLossRate; +/** + * The number of audio channels. + */ +@property(assign, nonatomic) NSUInteger numChannels; +/** + * The sample rate (Hz) of the received audio stream, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger receivedSampleRate; +/** + * The bitrate (Kbps) of the received audio stream, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger receivedBitrate; +/** + * The total freeze time (ms) of the remote audio stream after the remote user joins the channel. + * In a session, audio freeze occurs when the audio frame loss rate reaches 4% within two seconds. + * Agora uses 2 seconds as an audio piece unit to calculate the audio freeze time. + * The total audio freeze time = The audio freeze number × 2 seconds + */ +@property(assign, nonatomic) NSUInteger totalFrozenTime; +/** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ +@property(assign, nonatomic) NSUInteger totalActiveTime; +/** + * The total publish duration (ms) of the remote audio stream. + */ +@property(assign, nonatomic) NSInteger publishDuration; +/** + * The total audio freeze time as a percentage (%) of the total time when the audio is available. + */ +@property(assign, nonatomic) NSUInteger frozenRate; +/** + * The quality of the remote audio stream as determined by the Agora real-time + * audio MOS (Mean Opinion Score) measurement method in the reported interval. + * The return value ranges from 0 to 500. Dividing the return value by 100 gets + * the MOS score, which ranges from 0 to 5. The higher the score, the better the audio quality. + * + * The subjective perception of audio quality corresponding to the Agora real-time audio MOS scores is as follows: + * + * | MOS score | Perception of audio quality | + * | :------------- | :----------------------------------------------------------- | + * | Greater than 4 | Excellent. The audio sounds clear and smooth. | + * | From 3.5 to 4 | Good. The audio has some perceptible impairment, but still sounds clear. | + * | From 3 to 3.5 | Fair. The audio freezes occasionally and requires attentive listening. | + * | From 2.5 to 3 | Poor. The audio sounds choppy and requires considerable effort to understand. | + * | From 2 to 2.5 | Bad. The audio has occasional noise. Consecutive audio dropouts occur, resulting in some information loss. The users can communicate only with difficulty. | + * | Less than 2 | Very bad. The audio has persistent noise. Consecutive audio dropouts are frequent, resulting in severe information loss. Communication is nearly impossible. | + */ +@property(assign, nonatomic) NSUInteger mosValue; +/** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. + */ +@property(assign, nonatomic) AgoraExperienceQuality qoeQuality; +/** + * The reason for poor QoE of the local user when receiving a remote audio stream. See #EXPERIENCE_POOR_REASON. + */ +@property(assign, nonatomic) AgoraExperiencePoorReason qualityChangedReason; +/** + * Total number of audio bytes received (bytes) before network countermeasures, represented by + * an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxAudioBytes; +/** + * The end-to-end delay (ms) from the sender to the receiver. + */ +@property(assign, nonatomic) NSInteger e2eDelay; +@end + +/** Properties of the audio volume information. + */ +__attribute__((visibility("default"))) @interface AgoraRtcAudioVolumeInfo : NSObject +/** User ID of the speaker. + */ +@property(assign, nonatomic) NSUInteger uid; +/** The volume of the speaker that ranges from 0 (lowest volume) to 255 (highest volume). + */ +@property(assign, nonatomic) NSUInteger volume; + +@property(assign, nonatomic) NSUInteger vad; + +/** Voice pitch frequency in Hz. + */ +@property (assign, nonatomic) double voicePitch; + +@end + +/** + * The Statistics of the channel. + */ +__attribute__((visibility("default"))) @interface AgoraChannelStats : NSObject +/** + * The call duration in seconds, represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger duration; +/** + * The total number of bytes transmitted, represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger txBytes; +/** + * The total number of bytes received, represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxBytes; +/** + * The audio transmission bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger txAudioKBitrate; +/** + * The audio receiving bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger rxAudioKBitrate; +/** + * The video transmission bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger txVideoKBitrate; +/** + * The video receiving bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger rxVideoKBitrate; +/** + * Total number of audio bytes sent (bytes), represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger txAudioBytes; +/** + * Total number of video bytes sent (bytes), represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger txVideoBytes; +/** + * Total number of audio bytes received (bytes) before network countermeasures, represented by + * an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxAudioBytes; +/** + * Total number of video bytes received (bytes), represented by an aggregate value. + */ +@property(assign, nonatomic) NSUInteger rxVideoBytes; +/** + * The client-server latency (ms). + */ +@property(assign, nonatomic) NSUInteger lastmileDelay; +/** + * The number of users in the channel. + */ +@property(assign, nonatomic) NSUInteger userCount; +/** Application CPU usage (%). + */ +@property(assign, nonatomic) double cpuAppUsage; +/** System CPU usage (%). + */ +@property(assign, nonatomic) double cpuTotalUsage; +/** Gateway Rtt. + */ +@property(assign, nonatomic) NSInteger gatewayRtt; +/** + * The memory usage ratio of the app (%). + */ +@property(assign, nonatomic) double memoryAppUsageRatio; +/** + * The memory usage ratio of the system (%). + */ +@property(assign, nonatomic) double memoryTotalUsageRatio; +/** + * The memory usage of the app (KB). + */ +@property(assign, nonatomic) NSInteger memoryAppUsageInKbytes; +/** + * The time interval (ms) between establishing the connection and the connection succeeds, 0 if not valid. + */ +@property(assign, nonatomic) NSInteger connectTimeMs; + +/** + * The transmission bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger txKBitrate; +/** + * The receiving bitrate in Kbps, represented by an instantaneous value. + */ +@property(assign, nonatomic) NSUInteger rxKBitrate; + +/**The duration(ms) between first audio packet received and connection start, 0 if not valid + */ +@property(assign, nonatomic) NSInteger firstAudioPacketDuration; +/** The duration(ms) between first video packet received and connection start, 0 if not valid + */ +@property(assign, nonatomic) NSInteger firstVideoPacketDuration; +/** The duration(ms) between first video key frame received and connection start, 0 if not valid + */ +@property(assign, nonatomic) NSInteger firstVideoKeyFramePacketDuration; +/** Video packet number before first video key frame received, 0 if not valid + */ +@property(assign, nonatomic) NSInteger packetsBeforeFirstKeyFramePacket; +/** + * The packet loss rate of sender(broadcaster). + */ +@property(assign, nonatomic) NSInteger txPacketLossRate; +/** + * The packet loss rate of receiver(audience). + */ +@property(assign, nonatomic) NSInteger rxPacketLossRate; + +@end +/** Properties of the video encoder configuration. +*/ +__attribute__((visibility("default"))) @interface AgoraAdvancedVideoOptions : NSObject +/** +* The video encoder encodingPreference hard or soft +*/ +@property(assign, nonatomic) AgoraEncodingPreference encodingPreference; + +/** The video compression preference. */ +@property(assign, nonatomic) AgoraCompressionPreference compressionPreference; + +@end + +__attribute__((visibility("default"))) @interface AgoraVideoCodecCapLevels : NSObject + +@property(assign, nonatomic) AgoraVideoCodecCapabilityLevel hwDecodingLevel; +@property(assign, nonatomic) AgoraVideoCodecCapabilityLevel swDecodingLevel; + +@end + +/** + * The codec support information. +*/ +__attribute__((visibility("default"))) @interface AgoraVideoCodecCapInfo : NSObject + +/** The codec type. */ +@property(assign, nonatomic) AgoraVideoCodecType codecType; +/** The codec type mask. bit 1 Hardware decoder support flag, bit 2: Hardware encoder support flag, + * bit 3: Software decoder support flag, bit 4: Software encoder support flag */ +@property(assign, nonatomic) NSUInteger codecCapMask; + +/** The codec capability level, estimated based on the device hardware.*/ +@property(strong, nonatomic) AgoraVideoCodecCapLevels *_Nonnull codecCapLevels; + +@end +/** Properties of the video encoder configuration. + */ +__attribute__((visibility("default"))) @interface AgoraVideoEncoderConfiguration : NSObject +/** Video resolution that can be set manually or by choosing from one of the following + enumerations, the default value is 960x540: + + - AgoraVideoDimension120x120 + - AgoraVideoDimension160x120 + - AgoraVideoDimension180x180 + - AgoraVideoDimension240x180 + - AgoraVideoDimension320x180 + - AgoraVideoDimension240x240 + - AgoraVideoDimension320x240 + - AgoraVideoDimension424x240 + - AgoraVideoDimension360x360 + - AgoraVideoDimension480x360 + - AgoraVideoDimension640x360 + - AgoraVideoDimension480x480 + - AgoraVideoDimension640x480 + - AgoraVideoDimension840x480 + - AgoraVideoDimension960x540 + - AgoraVideoDimension960x720 + - AgoraVideoDimension1280x720 + - AgoraVideoDimension1920x1080 + - AgoraVideoDimension2540x1440 + - AgoraVideoDimension3840x2160 + + @note Whether 720p can be supported depends on the device. If the device cannot support 720p, + the frame rate will be lower than the one listed in the table. Agora optimizes the video in + lower-end devices. Contact mailto:support@agora.io for special requirements. + */ +@property(assign, nonatomic) CGSize dimensions; + +/** Codec type. See \ref AgoraVideoCodecType. + */ +@property(assign, nonatomic) AgoraVideoCodecType codecType; + +/** Frame rate of the video: AgoraVideoFrameRate + */ +@property(assign, nonatomic) AgoraVideoFrameRate frameRate; + +/** Bitrate of the video: + + Refer to AgoraVideoProfile and set your desired bitrate. If the bitrate you set is beyond the + proper range, the SDK will automatically adjust it to a value within the range. You can also choose + from the following options: + + - AgoraVideoBitrateStandard: + + - The standard bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit + setVideoEncoderConfiguration:]). - (Recommended) In a live broadcast, Agora recommends setting a + larger bitrate to improve the video quality. When you choose AgoraVideoBitrateStandard, the bitrate + value doubles in a live broadcast mode, and remains the same as in AgoraVideoProfile in a + communication mode. + + - AgoraVideoBitrateCompatible: + + - The compatible bitrate in [setVideoEncoderConfiguration]([AgoraRtcEngineKit + setVideoEncoderConfiguration:]). - The bitrate in both the live broadcast and communication modes + remain the same as in AgoraVideoProfile. + */ +@property(assign, nonatomic) NSInteger bitrate; + +@property(assign, nonatomic) NSInteger minBitrate; + +/** Video orientation mode of the video: AgoraVideoOutputOrientationMode. + */ +@property(assign, nonatomic) AgoraVideoOutputOrientationMode orientationMode; + +/** Video mirror mode of the video: AgoraVideoMirrorMode. + */ +@property(assign, nonatomic) AgoraVideoMirrorMode mirrorMode; + +/** The video encoding degradation preference under limited bandwidth. + +AgoraDegradationPreference: + +* AgoraDegradationMaintainQuality(0): (Default) Degrades the frame rate to guarantee the video quality. +* AgoraDegradationMaintainFramerate(1): Degrades the video quality to guarantee the frame rate. +*/ +@property (assign, nonatomic) AgoraDegradationPreference degradationPreference; + +/** The video hardwareEncoding. */ +@property (strong, nonatomic) AgoraAdvancedVideoOptions *_Nullable advancedVideoOptions; + +/** Initializes and returns a newly allocated AgoraVideoEncoderConfiguration object with the + specified video resolution. + + @param size Video resolution + @param frameRate Video frame rate + @param bitrate Video bitrate + @param orientationMode AgoraVideoOutputOrientationMode + @param mirrorMode AgoraVideoMirrorMode + @return An initialized AgoraVideoEncoderConfiguration object + */ +- (instancetype _Nonnull)initWithSize:(CGSize)size + frameRate:(AgoraVideoFrameRate)frameRate + bitrate:(NSInteger)bitrate + orientationMode:(AgoraVideoOutputOrientationMode)orientationMode + mirrorMode:(AgoraVideoMirrorMode)mirrorMode NS_SWIFT_NAME(init(size:frameRate:bitrate:orientationMode:mirrorMode:)); + +/** Initializes and returns a newly allocated AgoraVideoEncoderConfiguration object with the + specified video width and height. + + @param width Width of the video + @param height Height of the video + @param frameRate Video frame rate + @param bitrate Video bitrate + @param orientationMode AgoraVideoOutputOrientationMode + @param mirrorMode AgoraVideoMirrorMode + @return An initialized AgoraVideoEncoderConfiguration object + */ +- (instancetype _Nonnull)initWithWidth:(NSInteger)width + height:(NSInteger)height + frameRate:(AgoraVideoFrameRate)frameRate + bitrate:(NSInteger)bitrate + orientationMode:(AgoraVideoOutputOrientationMode)orientationMode + mirrorMode:(AgoraVideoMirrorMode)mirrorMode NS_SWIFT_NAME(init(width:height:frameRate:bitrate:orientationMode:mirrorMode:)); +@end + +/** A class for providing user-specific audio/video transcoding settings. + */ +__attribute__((visibility("default"))) @interface AgoraLiveTranscodingUser : NSObject +/** User ID. + */ +@property(assign, nonatomic) NSUInteger uid; +/** Position and size of the video frame. + */ +@property(assign, nonatomic) CGRect rect; +/** Video frame layer number, in the range of 1 to 100. + + * 1: The video frame image is in the lowest layer (default) + * 100: The video frame image is in the highest layer + */ +@property(assign, nonatomic) NSInteger zOrder; +/** Transparency of the video frame, between 0 and 1.0: + + * 0: Completely transparent + * 1.0: Opaque (default) + */ +@property(assign, nonatomic) double alpha; +/** The audio channel of the sound. The default value is 0: + + * 0: (default) Supports dual channels at most, depending on the upstream of the broadcaster. + * 1: The audio stream of the broadcaster is in the FL audio channel. If the upstream of the + broadcaster uses dual-sound channel, only the left-sound channel will be used for streaming. * 2: + The audio stream of the broadcaster is in the FC audio channel. If the upstream of the broadcaster + uses dual-sound channel, only the left-sound channel will be used for streaming. * 3: The audio + stream of the broadcaster is in the FR audio channel. If the upstream of the broadcaster uses + dual-sound channel, only the left-sound channel will be used for streaming. * 4: The audio stream + of the broadcaster is in the BL audio channel. If the upstream of the broadcaster uses dual-sound + channel, only the left-sound channel will be used for streaming. * 5: The audio stream of the + broadcaster is in the BR audio channel. If the upstream of the broadcaster uses dual-sound channel, + only the left-sound channel will be used for streaming. + */ +@property(assign, nonatomic) NSInteger audioChannel; +@end + +/** The configuration for advanced features of the RTMP or RTMPS streaming with transcoding. + */ +__attribute__((visibility("default"))) @interface AgoraLiveStreamAdvancedFeature : NSObject + +/** The name of the advanced feature, including the following: + + - LBHQ: The advanced feature for high-quality video with a lower bitrate. + - VEO: The advanced feature for the optimized video encoder. +*/ +@property(copy, nonatomic) NSString* _Nullable featureName; + +/** Whether to enable the advanced feature: + + - YES: Enable the advanced feature. + - NO: (Default) Disable the advanced feature. + */ +@property(assign, nonatomic) BOOL opened; +@end + +/** Watermark image properties. + */ +__attribute__((visibility("default"))) @interface AgoraImage : NSObject +/** URL address of the watermark on the broadcasting video + */ +@property(strong, nonatomic) NSURL *_Nonnull url; +/** Position and size of the watermark on the broadcasting video in CGRect + */ +@property(assign, nonatomic) CGRect rect; +/** + * Order attribute for an ordering of overlapping two-dimensional objects. +*/ +@property (assign, nonatomic) NSInteger zOrder; +/** The transparency level of the image. + + The value ranges between 0.0 and 1.0: + + * 0.0: Completely transparent. + * 1.0: (Default) Opaque. + */ +@property(assign, nonatomic) double alpha; +@end + +/** The options of the watermark image to be added. + */ +__attribute__((visibility("default"))) @interface WatermarkOptions : NSObject +/** Sets whether or not the watermark image is visible in the local video preview: + + - YES: (Default) The watermark image is visible in preview. + - NO: The watermark image is not visible in preview. + */ +@property(assign, nonatomic) BOOL visibleInPreview; +/** The watermark position in landscape mode of *Rotate the Video*. This parameter contains the following members: + + - `x`: The horizontal offset of the watermark from the top-left corner. + - `y`: The vertical offset of the watermark from the top-left corner. + - `width`: The width (pixel) of the watermark region. + - `height`: The height (pixel) of the watermark region. + */ +@property(assign, nonatomic) CGRect positionInLandscapeMode; +/** The watermark position in portrait mode of *Rotate the Video*. This parameter contains the following members: + + - `x`: The horizontal offset of the watermark from the top-left corner. + - `y`: The vertical offset of the watermark from the top-left corner. + - `width`: The width (pixel) of the watermark region. + - `height`: The height (pixel) of the watermark region. + */ +@property(assign, nonatomic) CGRect positionInPortraitMode; +@end + +/** A class for managing CDN transcoding. + */ +__attribute__((visibility("default"))) @interface AgoraLiveTranscoding : NSObject +/** The size of the video (width and height in pixels). + +- When pushing video streams to the CDN, note the following: + + - The value range of the width is [64,1920]. If the value is less than 64, + Agora server automatically adjusts it to 64; if the value is greater than + 1920, Agora server automatically adjusts it to 1920. + - The value range of the height is [64,1080]. If the value is less than 64, + Agora server automatically adjusts it to 64; if the value is greater than + 1080, Agora server automatically adjusts it to 1080. + +- When pushing audio streams to the CDN, set the width and height as 0. + */ +@property(assign, nonatomic) CGSize size; +/** Bitrate of the CDN live output video stream. + +The default value is 400 Kbps. + +Set this parameter according to the Video Bitrate Table. If you set a bitrate beyond the proper range, the SDK automatically adapts it to a value within the range. + */ +@property(assign, nonatomic) NSInteger videoBitrate; +/** Frame rate of the CDN live output video stream. + +The default value is 15 fps, and the value range is (0,30]. + + @note The Agora server adjusts any value over 30 to 30. + */ +@property(assign, nonatomic) NSInteger videoFramerate; +/** Latency mode. **DEPRECATED** from v2.8.0 + + * YES: Low latency with unassured quality. + * NO:(Default)High latency with assured quality. + */ +@property(assign, nonatomic) BOOL lowLatency; +/** Video GOP in frames. The default value is 30 fps. */ +@property(assign, nonatomic) NSInteger videoGop; +/** Video codec profile type + +Set it as 66, 77, or 100 (default), see [AgoraVideoCodecProfileType](AgoraVideoCodecProfileType). + +If you set this parameter to other values, Agora adjusts it to the default value of 100. + */ +@property(assign, nonatomic) AgoraVideoCodecProfileType videoCodecProfile; + +/** The video codec type of the output video stream. See AgoraVideoCodecTypeForStream. + + @since v3.2.0 + */ +@property(assign, nonatomic) AgoraVideoCodecTypeForStream videoCodecType; + +/** An AgoraLiveTranscodingUser 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. See AgoraLiveTranscodingUser. + */ +@property(copy, nonatomic) NSArray* _Nullable transcodingUsers; + +/** Reserved property. Extra user-defined information to send SEI for the H.264/H.265 video stream to the CDN live client. Maximum length: 4096 bytes. For more information on SEI, see [SEI-related questions](https://docs.agora.io/en/faq/sei). + */ +@property(copy, nonatomic) NSString* _Nullable transcodingExtraInfo; + +/** + * add few watermarks + */ +@property(copy, nonatomic) NSArray* _Nullable watermarkArray; + +/** + * add few backgroundImage + */ +@property(copy, nonatomic) NSArray* _Nullable backgroundImageArray; + +/** The background color in RGB hex. + +Value only. Do not include a preceding #. For example, 0xFFB6C1 (light pink). The default value is 0x000000 (black). + +COLOR_CLASS is a general name for the type: + +* iOS: UIColor +* macOS: NSColor + */ +@property(strong, nonatomic) COLOR_CLASS* _Nullable backgroundColor; + +/** Self-defined audio sample rate: AgoraAudioSampleRateType. + */ +@property(assign, nonatomic) AgoraAudioSampleRateType audioSampleRate; +/** Bitrate (Kbps) of the CDN live audio output stream. The default value is 48, and the highest value is 128. + */ +@property(assign, nonatomic) NSInteger audioBitrate; +/** The number of audio channels for the CDN live stream. + + Agora recommends choosing 1 (mono), or 2 (stereo) audio channels. Special players are required if you choose 3, 4, or 5. + + * 1: (Default) Mono + * 2: Stereo + * 3: Three audio channels + * 4: Four audio channels + * 5: Five audio channels + */ +@property(assign, nonatomic) NSInteger audioChannels; +/** + Audio codec profile. See AgoraAudioCodecProfileType. + + The default value is AgoraAudioCodecProfileLCAAC(0). + */ +@property(assign, nonatomic) AgoraAudioCodecProfileType audioCodecProfile; + +/** Creates a default transcoding object. + + @return Default AgoraLiveTranscoding object. + */ ++ (AgoraLiveTranscoding* _Nonnull)defaultTranscoding NS_SWIFT_NAME(default()); + +/** Adds a user displaying the video in CDN live. + + @param user The transcoding user. See AgoraLiveTranscodingUser. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)addUser:(AgoraLiveTranscodingUser* _Nonnull)user NS_SWIFT_NAME(add(_:)); + +/** Removes a user from CDN live. + + @param uid The user ID of the user to remove from CDN live. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)removeUser:(NSUInteger)uid NS_SWIFT_NAME(removeUser(_:)); + +/** Enables/Disables advanced features of the RTMP or RTMPS streaming with transcoding. + + @param featureName The name of the advanced feature, including the following: +

  • LBHQ: The advanced feature for high-quality video with a lower bitrate.
  • +
  • VEO: The advanced feature for the optimized video encoder.
  • + @param opened Whether to enable the advanced feature: +
  • YES: Enable the advanced feature.
  • +
  • NO: (Default) Disable the advanced feature.
  • + */ +- (void)setAdvancedFeatures:(NSString* _Nonnull)featureName opened:(BOOL)opened NS_SWIFT_NAME(setAdvancedFeatures(_:opened:)); + +/** Checks whether advanced features of the RTMP or RTMPS streaming with transcoding are enabled. + @return The name of each advanced feature and whether the advanced feature is enabled. + */ +- (NSArray* _Nullable)getAdvancedFeatures NS_SWIFT_NAME(getAdvancedFeatures()); + +@end + +/** Live broadcast import stream configuration. + */ +__attribute__((visibility("default"))) @interface AgoraLiveInjectStreamConfig : NSObject +/** Size of the stream to be imported into the live broadcast. The default value is 0; same + * size as the original stream. + */ +@property(assign, nonatomic) CGSize size; +/** Video GOP of the stream to be added into the broadcast. The default value is 30. + */ +@property(assign, nonatomic) NSInteger videoGop; +/** Video frame rate of the stream to be added into the broadcast. The default value is 15 fps. + */ +@property(assign, nonatomic) NSInteger videoFramerate; +/** Video bitrate of the stream to be added into the broadcast. The default value is 400 Kbps. + */ +@property(assign, nonatomic) NSInteger videoBitrate; + +/** Audio sampling rate of the stream to be added into the broadcast. The default value is 48000. + */ +@property(assign, nonatomic) AgoraAudioSampleRateType audioSampleRate; +/** Audio bitrate of the stream to be added into the broadcast. The default value is 48 Kbps. + */ +@property(assign, nonatomic) NSInteger audioBitrate; +/** Audio channels to be added into the broadcast. The default value is 1. + */ +@property(assign, nonatomic) NSInteger audioChannels; + +/** Create a default stream config + + @return default stream config + */ ++ (AgoraLiveInjectStreamConfig *_Nonnull)defaultConfig NS_SWIFT_NAME(defaultConfig()); +@end + + __deprecated + + /** AgoraRtcVideoCompositingRegion array. + */ + __attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingRegion + : NSObject + /** User ID of the user with the video to be displayed in the region. + */ + @property(assign, nonatomic) NSUInteger uid; +/** Horizontal position of the region on the screen (0.0 to 1.0). + */ +@property(assign, nonatomic) CGFloat x; +/** Vertical position of the region on the screen (0.0 to 1.0). + */ +@property(assign, nonatomic) CGFloat y; +/** Actual width of the region (0.0 to 1.0). + */ +@property(assign, nonatomic) CGFloat width; +/** Actual height of the region (0.0 to 1.0). + */ +@property(assign, nonatomic) CGFloat height; +/** 0 means the region is at the bottom, and 100 means the region is at the top. + */ +@property(assign, nonatomic) NSInteger zOrder; +/** 0 means the region is transparent, and 1 means the region is opaque. The default value is 1.0. + */ +@property(assign, nonatomic) CGFloat alpha; +/** Render mode: AgoraVideoRenderMode + */ +@property(assign, nonatomic) AgoraVideoRenderMode renderMode; +@end + + __deprecated + /** Rtc video compositing layout. + */ + __attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingLayout + : NSObject + /** Width of the entire canvas (display window or screen). + */ + @property(assign, nonatomic) NSInteger canvasWidth; +/** Height of the entire canvas (display window or screen). + */ +@property(assign, nonatomic) NSInteger canvasHeight; +/** Enter any of the 6-digit symbols defined in RGB. For example, "#c0c0c0" + */ +@property(copy, nonatomic) NSString *_Nullable backgroundColor; +/** AgoraRtcVideoCompositingRegion array. + */ +@property(copy, nonatomic) NSArray *_Nullable regions; +/** Application defined data. + */ +@property(copy, nonatomic) NSString *_Nullable appData; +@end + + /** + @deprecated + + Sets whether the current host is the RTMP stream owner. + */ + __deprecated __attribute__((visibility("default"))) @interface AgoraPublisherConfiguration + : NSObject + /** + - YES: The current host is the RTMP stream owner and the push-stream configuration is enabled + (default). - NO: The current host is not the RTMP stream owner and the push-stream + configuration is disabled. + */ + @property(assign, nonatomic) BOOL owner; + +/** Width of the output data stream set for CDN Live. 360 is the default value + */ +@property(assign, nonatomic) NSInteger width; +/** Height of the output data stream set for CDN Live. 640 is the default value + */ +@property(assign, nonatomic) NSInteger height; +/** Frame rate of the output data stream set for CDN Live. 15 fps is the default value + */ +@property(assign, nonatomic) NSInteger framerate; +/** Bitrate of the output data stream set for CDN Live. 500 kbit/s is the default value + */ +@property(assign, nonatomic) NSInteger bitrate; +/** Audio sample rate of the output data stream set for CDN Live. The default value is 48000. + */ +@property(assign, nonatomic) NSInteger audiosamplerate; +/** Audio bitrate of the output data stream set for CDN Live. The default value is 48. + */ +@property(assign, nonatomic) NSInteger audiobitrate; +/** Audio channels of the output data stream set for CDN Live. The default value is 1. + */ +@property(assign, nonatomic) NSInteger audiochannels; + +/** + +* 0: Tile Horizontally +* 1: Layered Windows +* 2: Tile Vertically + */ +@property(assign, nonatomic) NSInteger defaultLayout; +/** Video stream lifecycle of CDN Live: AgoraRtmpStreamLifeCycle + */ +@property(assign, nonatomic) AgoraRtmpStreamLifeCycle lifeCycle; + +/** Width of the stream to be injected. Set it as 0. + */ +@property(assign, nonatomic) NSInteger injectStreamWidth; + +/** Height of the stream to be injected. Set it as 0. + */ +@property(assign, nonatomic) NSInteger injectStreamHeight; + +/** Address of the stream to be injected to the channel. + */ +@property(copy, nonatomic) NSString *_Nullable injectStreamUrl; + +/** The push-stream address for the picture-in-picture layouts. The default value is *NULL*. + */ +@property(copy, nonatomic) NSString *_Nullable publishUrl; + +/** The push-stream address of the original stream which does not require picture-blending. The + * default value is NULL. + */ +@property(copy, nonatomic) NSString *_Nullable rawStreamUrl; + +/** Reserved field. The default value is NULL. + */ +@property(copy, nonatomic) NSString *_Nullable extraInfo; + +/** Check if configuration is validate + */ +- (BOOL)validate NS_SWIFT_NAME(validate()); + +- (NSString * _Nullable)toJsonString NS_SWIFT_NAME(toJsonString()); +@end + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) + +/** AgoraRtcDeviceInfo array. + */ +__attribute__((visibility("default"))) @interface AgoraRtcDeviceInfo : NSObject +@property (assign, nonatomic) int __deprecated index; + +/** AgoraMediaDeviceType + */ +@property(assign, nonatomic) AgoraMediaDeviceType type; + +/** Device ID. + */ +@property(copy, nonatomic) NSString *_Nullable deviceId; + +/** Device name. + */ +@property(copy, nonatomic) NSString *_Nullable deviceName; +@end +#endif + +/** Properties of the AgoraVideoFrame object. + */ +__attribute__((visibility("default"))) @interface AgoraVideoFrame : NSObject +/** Video format: + + * - 1: I420 + * - 2: BGRA + * - 3: NV21 + * - 4: RGBA + * - 5: IMC2 + * - 7: ARGB + * - 8: NV12 + * - 12: iOS texture (CVPixelBufferRef) + * - 13: Still Image (UIImage for iPhone, NSImage for Mac) + */ +@property(assign, nonatomic) NSInteger format; + +/** Timestamp of the incoming video frame (ms). An incorrect timestamp will result in frame loss or + * unsynchronized audio and video. + */ +@property(assign, nonatomic) CMTime time; // Time for this frame. + +/** + @deprecated Use strideInPixels instead. + */ +@property(assign, nonatomic) int stride DEPRECATED_MSG_ATTRIBUTE("use strideInPixels instead"); + +/** Line spacing of the incoming video frame, which must be in pixels instead of bytes. For + * textures, it is the width of the texture. + */ +@property(assign, nonatomic) int strideInPixels; // Number of pixels between two consecutive rows. + // Note: in pixel, not byte. Not used for iOS + // textures. + +/** Height of the incoming video frame. + */ +@property(assign, nonatomic) int height; // Number of rows of pixels. Not used for iOS textures. + +/** CVPixelBuffer + */ +@property(assign, nonatomic) CVPixelBufferRef _Nullable textureBuf; + +/** Still Image (UIImage for iPhone, NSImage for Mac) + */ +@property(strong, nonatomic) IMAGE_CLASS * _Nullable image; + +/** Raw data buffer. + */ +@property(strong, nonatomic) NSData *_Nullable dataBuf; // Raw data buffer. Not used for iOS textures. + +/** + * Indicates the alpha channel of current frame, which is consistent with the dimension of the video frame. + * The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground. + * The default value is nill. + */ +@property(strong, nonatomic) NSData *_Nullable alphaBuf; + +/** (Optional) Specifies the number of pixels trimmed from the left, which is set as 0 by default. + */ +@property(assign, nonatomic) int cropLeft; // Number of pixels to crop on the left boundary. +/** (Optional) Specifies the number of pixels trimmed from the top, which is set as 0 by default. + */ +@property(assign, nonatomic) int cropTop; // Number of pixels to crop on the top boundary. +/** (Optional) Specifies the number of pixels trimmed from the right, which is set as 0 by default. + */ +@property(assign, nonatomic) int cropRight; // Number of pixels to crop on the right boundary. +/** (Optional) Specifies the number of pixels trimmed from the bottom, which is set as 0 by default. + */ +@property(assign, nonatomic) int cropBottom; // Number of pixels to crop on the bottom boundary. +/** (Optional) Specifies whether to rotate the incoming video group. Optional values: 0, 90, 180, or + * 270 clockwise. Set as 0 by default. + */ +@property(assign, nonatomic) int rotation; // 0, 90, 180, 270. See document for rotation calculation. +/* Note + * 1. strideInPixels + * Stride is in pixels, not bytes + * 2. About the frame width and height + * No field is defined for the width. However, it can be deduced by: + * croppedWidth = (strideInPixels - cropLeft - cropRight) + * And + * croppedHeight = (height - cropTop - cropBottom) + * 3. About crop + * _________________________________________________________________..... + * | ^ | ^ + * | | | | + * | cropTop | | + * | | | | + * | v | | + * | ________________________________ | | + * | | | | | + * | | | | | + * |<-- cropLeft -->| valid region |<- cropRight ->| + * | | | | height + * | | | | + * | |_____________________________ | | | + * | ^ | | + * | | | | + * | cropBottom | | + * | | | | + * | v | v + * _________________________________________________________________...... + * | | + * |<---------------- strideInPixels ----------------------------->| + * + * If your buffer contains garbage data, you can crop them. For example, the frame size is + * 360 x 640, often the buffer stride is 368, that is, there extra 8 pixels on the + * right are for padding, and should be removed. In this case, you can set: + * strideInPixels = 368; + * height = 640; + * cropRight = 8; + * // cropLeft, cropTop, cropBottom are set to a default of 0 + */ + +/** If data format is BGRA or RGBA and alphaBuf is nill, it is required to call fillAlphaData to fill alphaBuf. + */ +- (void)fillAlphaData; +@end + +__attribute__((visibility("default"))) @interface AgoraLogConfig: NSObject +/** The absolute path of log files. + + Ensure that the directory for the log + files exists and is writable. The default file path is as follows: + + - iOS: `App Sandbox/Library/caches/agorasdk.log` + - macOS: + - Sandbox enabled: `App Sandbox/Library/Logs/agorasdk.log`, such as + `/Users//Library/Containers//Data/Library/Logs/agorasdk.log` + - Sandbox disabled: `�Library/Logs/agorasdk.log` + */ +@property (copy, nonatomic) NSString * _Nullable filePath; +/** The size (KB) of a log file. + + The default value is 1024 KB. If you set + this parameter to 1024 KB, the SDK outputs at most 5 MB log files; if + you set it to less than 1024 KB, the setting is invalid, and the maximum + size of a log file is still 1024 KB. + */ +@property (assign, nonatomic) NSInteger fileSizeInKB; +/** The output log level of the SDK. See details in AgoraLogLevel. + + For example, if you set the log level to `AgoraLogLevelWarn`, the SDK outputs the logs + within levels `AgoraLogLevelFatal`, `AgoraLogLevelError`, and `AgoraLogLevelWarn`. + */ +@property (assign, nonatomic) AgoraLogLevel level; +@end + +/** + * The config of AgoraRtcEngine. + */ +__attribute__((visibility("default"))) @interface AgoraRtcEngineConfig: NSObject + + /** + * The App ID issued to the developers by Agora. Apply for a new one from Agora if it is missing from + * your kit. + */ + @property (copy, nonatomic) NSString * _Nullable appId; + +/** + * The channel profile. See #AgoraChannelProfile. + */ + @property (assign, nonatomic) AgoraChannelProfile channelProfile; + + /** + * The license used for verification when connectting channel. Charge according to the license + */ + @property (copy, nonatomic) NSString * _Nullable license; + + /** + * The audio application scenario. See #AgoraAudioScenario. + * + * @note Agora recommends the following scenarios: + * - `AgoraAudioScenarioDefault = 0` + * - `AgoraAudioScenarioGameStreaming = 3` + */ + @property (assign, nonatomic) AgoraAudioScenario audioScenario; + /** + * The region for connection. This advanced feature applies to scenarios that + * have regional restrictions. + * + * For the regions that Agora supports, see \ref AgoraAreaCodeType. + * + * After specifying the region, the SDK connects to the Agora servers within + * that region. + */ + @property (assign, nonatomic) AgoraAreaCodeType areaCode; + @property (strong, nonatomic) AgoraLogConfig * _Nullable logConfig; + /** + * Thread priority for SDK common threads + * + * See \ref AgoraThreadPriorityType. + */ + @property (assign, nonatomic) AgoraThreadPriorityType threadPriority; + @property (weak, nonatomic) id _Nullable eventDelegate; + /** + * Determines whether to enable domain limit. + * - `true`: only connect to servers that already parsed by DNS + * - `false`: (Default) connect to servers with no limit + */ + @property (assign, nonatomic) BOOL domainLimit; +@end + +/** + * The class of AgoraAudioFrame. + */ +__attribute__((visibility("default"))) @interface AgoraAudioFrame : NSObject +/** The number of samples per channel. + */ +@property(assign, nonatomic) NSInteger samplesPerChannel; +/** The number of bytes per audio sample. For example, each PCM audio sample + usually takes up 16 bits (2 bytes). + */ +@property(assign, nonatomic) NSInteger bytesPerSample; +/** The number of audio channels. If the channel uses stereo, the data is + interleaved. + +- 1: Mono. +- 2: Stereo. + */ +@property(assign, nonatomic) NSInteger channels; +/** The sample rate. + */ +@property(assign, nonatomic) NSInteger samplesPerSec; +/** The buffer of the sample audio data. When the audio frame uses a stereo + channel, the data buffer is interleaved. The size of the data buffer is as + follows: `buffer` = `samplesPerChannel` × `channels` × `bytesPerSample`. + */ +@property(assign, nonatomic) void* _Nullable buffer; +/** The timestamp of the external audio frame. You can use this parameter for + the following purposes: + +- Restore the order of the captured audio frame. +- Synchronize audio and video frames in video-related scenarios, including +where external video sources are used. + */ +@property(assign, nonatomic) int64_t renderTimeMs; +/** Reserved for future use. + */ +@property(assign, nonatomic) NSInteger avSyncType; +@end + +/** The AgoraAudioParams interface + You can pass the `AgoraAudioParams` object in the return value of the following + callbacks to set the audio data format for the corresponding callbacks: + + - [getRecordAudioParams]([AgoraAudioFrameDelegate getRecordAudioParams]): + Sets the audio recording format for the + [onRecordAudioFrame]([AgoraAudioFrameDelegate onRecordAudioFrame:]) + callback. + - [getPlaybackAudioParams]([AgoraAudioFrameDelegate getPlaybackAudioParams]): + Sets the audio playback format for the + [onPlaybackAudioFrame]([AgoraAudioFrameDelegate onPlaybackAudioFrame:]) + callback. + - [getMixedAudioParams]([AgoraAudioFrameDelegate getMixedAudioParams]): + Sets the audio mixing format for the + [onMixedAudioFrame]([AgoraAudioFrameDelegate onMixedAudioFrame:]) callback. + + @note The SDK calculates the sample interval according to the + `samplesPerCall`, `sampleRate`, and `channel` values in the + `AgoraAudioParams` interface and triggers the following callbacks at the + calculated sample interval: + + - [onRecordAudioFrame]([AgoraAudioFrameDelegate onRecordAudioFrame:]) + - [onPlaybackAudioFrame]([AgoraAudioFrameDelegate onPlaybackAudioFrame:]) + - [onMixedAudioFrame]([AgoraAudioFrameDelegate onMixedAudioFrame:]) + + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + */ +__attribute__((visibility("default"))) @interface AgoraAudioParams : NSObject + +/** The audio sample rate (Hz), which can be set as one of the following values: + + - `8000` + - `16000` (Default) + - `32000` + - `44100 ` + - `48000` + */ +@property (assign, nonatomic) NSInteger sampleRate; + +/* The number of audio channels, which can be set as either of the following values: + + - `1`: Mono (Default) + - `2`: Stereo + */ +@property (assign, nonatomic) NSInteger channel; + +/* The use mode of the audio data. See AgoraAudioRawFrameOperationMode. + */ +@property (assign, nonatomic) AgoraAudioRawFrameOperationMode mode; + +/** The number of samples. For example, set it as 1024 for RTMP or RTMPS + streaming. + */ +@property (assign, nonatomic) NSInteger samplesPerCall; + +@end + +/** + * The class of AgoraEncodedAudioFrameInfo. + */ +__attribute__((visibility("default"))) @interface AgoraEncodedAudioFrameInfo: NSObject + @property (assign, nonatomic) NSInteger samplesPerChannel; + @property (assign, nonatomic) NSInteger channels; + @property (assign, nonatomic) NSInteger samplesPerSec; + @property (assign, nonatomic) AgoraAudioCodecType codecType; +@end + +/** + * The collections of uplink network info. + */ +__attribute__((visibility("default"))) @interface AgoraUplinkNetworkInfo : NSObject +/** +* The target video encoder bitrate bps. +*/ +@property(nonatomic, assign) int videoEncoderTargetBitrateBps; +@end + +/** + * The collections of downlink network info. + */ +__attribute__((visibility("default"))) @interface AgoraDownlinkNetworkInfo : NSObject +/** +* The lastmile buffer delay time in ms. +*/ +@property(nonatomic, assign) int lastmileBufferDelayTimeMs; +/** +* The downlink bandwidth estimation bitrate bps. +*/ +@property(nonatomic, assign) int bandwidthEstimationBps; +@end + +/** + * The leave channel options. + */ +__attribute__((visibility("default"))) @interface AgoraLeaveChannelOptions : NSObject +/** + * Determines whether to stop playing and mixing the music file when leave channel. + * - true: (Default) Stop playing and mixing the music file. + * - false: Do not stop playing and mixing the music file. + */ +@property(nonatomic, assign) BOOL stopAudioMixing; + +/** + * Determines whether to stop all music effects when leave channel. + * - true: (Default) Stop all music effects. + * - false: Do not stop the music effect. + */ +@property(nonatomic, assign) BOOL stopAllEffect; + +/** + * Determines whether to stop microphone recording when leave channel. + * - true: (Default) Stop microphone recording. + * - false: Do not stop microphone recording. + */ +@property(nonatomic, assign) BOOL stopMicrophoneRecording; + +@end + +__attribute__((visibility("default"))) @interface AgoraOutputVideoFrame : NSObject + +/** Video format: + * - 1: I420 + * - 2: BGRA + * - 3: NV21 + * - 4: RGBA + * - 5: IMC2 + * - 7: ARGB + * - 8: NV12 + * - 12: iOS texture NV12 (CVPixelBufferRef) + * - 13: iOS texture I420 (CVPixelBufferRef) + * - 14: iOS texture BGRA (CVPixelBufferRef) + */ +@property (nonatomic, assign) NSInteger type; +/** + * The width of the Video frame. + */ +@property (nonatomic, assign) int width; +/** + * The height of the video frame. + */ +@property (nonatomic, assign) int height; +/** + * The line span of Y buffer in the YUV data. + */ +@property (nonatomic, assign) int yStride; +/** + * The line span of U buffer in the YUV data. + */ +@property (nonatomic, assign) int uStride; +/** + * The line span of V buffer in the YUV data. + */ +@property (nonatomic, assign) int vStride; +/** + * The pointer to the Y buffer in the YUV data. + */ +@property (nonatomic, assign) uint8_t* _Nullable yBuffer; +/** + * The pointer to the U buffer in the YUV data. + */ +@property (nonatomic, assign) uint8_t* _Nullable uBuffer; +/** + * The pointer to the V buffer in the YUV data. + */ +@property (nonatomic, assign) uint8_t* _Nullable vBuffer; +/** + * The clockwise rotation information of this frame. You can set it as 0, 90, 180 or 270. + */ +@property (nonatomic, assign) int rotation; +/** + * The timestamp to render the video stream. Use this parameter for audio-video synchronization when + * rendering the video. + * + * @note This parameter is for rendering the video, not capturing the video. + */ +@property (nonatomic, assign) int64_t renderTimeMs; +/** + * The type of audio-video synchronization. + */ +@property (nonatomic, assign) int avSyncType; + +/** CVPixelBuffer + */ +@property(assign, nonatomic) CVPixelBufferRef _Nullable pixelBuffer; +/** + * Portrait Segmentation meta buffer, dimension of which is the same as AgoraOutputVideoFrame. + * Pixl value is between 0-255, 0 represents totally background, 255 represents totally foreground. + */ +@property (nonatomic, assign) uint8_t* _Nullable alphaBuffer; + +@end + +/** Configurations of built-in encryption schemas. + */ +__attribute__((visibility("default"))) @interface AgoraEncryptionConfig: NSObject + + /** Encryption mode. The default encryption mode is `AgoraEncryptionModeAES128GCM2`. See AgoraEncryptionMode. + */ + @property (assign, nonatomic) AgoraEncryptionMode encryptionMode; + + /** Encryption key in string type. + + **Note** + + If you do not set an encryption key or set it as `nil`, you cannot use the built-in encryption, and the SDK returns `-2` (`AgoraErrorCodeInvalidArgument`). + */ + @property (copy, nonatomic) NSString * _Nullable encryptionKey; + @property (strong, nonatomic) NSData * _Nullable encryptionKdfSalt; + @property (assign, nonatomic) BOOL datastreamEncryptionEnabled; + @end + +/** AgoraUserInfo. + */ +__attribute__((visibility("default"))) @interface AgoraUserInfo: NSObject + + /** The user ID + */ +@property(assign, nonatomic) NSUInteger uid; + + /** The user account + */ + @property (copy, nonatomic) NSString * _Nullable userAccount; + @end + +/** Client role options for the AgoraRtcEngineKit instance. + */ +__attribute__((visibility("default"))) @interface AgoraClientRoleOptions: NSObject + +/** Audicnce latency level. The default level is `AgoraAudienceLatencyLevelUltraLowLatency`. See AgoraAudienceLatencyLevelType. + */ +@property (assign, nonatomic) AgoraAudienceLatencyLevelType audienceLatencyLevel; + +@end + +/** The configuration of camera capturer. + */ +__attribute__((visibility("default"))) @interface AgoraCameraCapturerConfiguration: NSObject +/** The camera direction. See AgoraCameraDirection: + + - AgoraCameraDirectionRear: The rear camera. + - AgoraCameraDirectionFront: The front camera. + */ +#if TARGET_OS_IOS +@property (assign, nonatomic) AgoraCameraDirection cameraDirection; +#elif TARGET_OS_MAC +/** + *The device ID of the playback device. + */ +@property (copy, nonatomic) NSString * _Nullable deviceId; +#endif + +/** + * The dimensions of camera capture. + */ +@property(assign, nonatomic) CGSize dimensions; + +/** Frame rate of the camera capture. + */ +@property(assign, nonatomic) int frameRate; + +/** Follow the dimension ratio of setVideoEncoderConfiguration + * - YES: (Default) follow the dimension ratio. + * - NO: Do not follow the dimension ratio. + */ +@property(assign, nonatomic) BOOL followEncodeDimensionRatio; + +@end + +/** the configuration of datastream. + */ +__attribute__((visibility("default"))) @interface AgoraDataStreamConfig: NSObject + +@property (assign, nonatomic) BOOL ordered; + +@property (assign, nonatomic) BOOL syncWithAudio; +@end + + +/** The definition of AgoraChannelMediaRelayInfo. + */ +__attribute__((visibility("default"))) @interface AgoraChannelMediaRelayInfo: NSObject +/** The token that enables the user to join the channel. + */ +@property (copy, nonatomic) NSString * _Nullable token; +/** The channel name. + */ +@property (copy, nonatomic) NSString * _Nullable channelName; +/** The user ID. + */ +@property (assign, nonatomic) NSUInteger uid; +/** Initializes the AgoraChannelMediaRelayInfo object + + @param token The token that enables the user to join the channel. + */ +- (instancetype _Nonnull)initWithToken:(NSString *_Nullable)token NS_SWIFT_NAME(init(token:)); +@end + +/** The definition of AgoraChannelMediaRelayConfiguration. + */ +__attribute__((visibility("default"))) @interface AgoraChannelMediaRelayConfiguration: NSObject +/** The information of the destination channel: AgoraChannelMediaRelayInfo. It contains the following members: + + - `channelName`: The name of the destination channel. + - `uid`: ID of the broadcaster in the destination channel. The value ranges from 0 to (232-1). To avoid UID conflicts, this `uid` must be different from any other UIDs in the destination channel. The default value is 0, which means the SDK generates a random UID. + - `token`: The token for joining the destination channel. It is generated with the `channelName` and `uid` you set in `destinationInfos`. + + - If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID. + - If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`. + */ +@property (strong, nonatomic, readonly) NSDictionary *_Nullable destinationInfos; +/** The information of the source channel: AgoraChannelMediaRelayInfo. It contains the following members: + + - `channelName`: The name of the source channel. The default value is `nil`, which means the SDK applies the name of the current channel. + - `uid`: ID of the broadcaster whose media stream you want to relay. The default value is 0, which means the SDK generates a random UID. You must set it as 0. + - `token`: The token for joining the source channel. It is generated with the `channelName` and `uid` you set in `sourceInfo`. + + - If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID. + - If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`, and the `uid` must be set as 0. + */ +@property (strong, nonatomic) AgoraChannelMediaRelayInfo *_Nonnull sourceInfo; +/** Sets the information of the destination channel. + + If you want to relay the media stream to multiple channels, call this method as many times (at most four). + + @param destinationInfo The information of the destination channel: AgoraChannelMediaRelayInfo. It contains the following members: + + - `channelName`: The name of the destination channel. + - `uid`: ID of the broadcaster in the destination channel. The value ranges from 0 to (232-1). To avoid UID conflicts, this `uid` must be different from any other UIDs in the destination channel. The default value is 0, which means the SDK generates a random UID. + - `token`: The token for joining the destination channel. It is generated with the `channelName` and `uid` you set in `destinationInfo`. + + - If you have not enabled the App Certificate, set this parameter as the default value `nil`, which means the SDK applies the App ID. + - If you have enabled the App Certificate, you must use the `token` generated with the `channelName` and `uid`. + + @param channelName The name of the destination channel. Ensure that the value of this parameter is the same as that of the `channelName` member in `destinationInfo`. + + @return - YES: Success. + - NO: Failure. + */ +- (BOOL)setDestinationInfo:(AgoraChannelMediaRelayInfo *_Nonnull)destinationInfo forChannelName:(NSString *_Nonnull)channelName NS_SWIFT_NAME(setDestinationInfo(_:forChannelName:)); +/** Removes the destination channel. + + @param channelName The name of the destination channel. + + @return - YES: Success. + - NO: Failure. + */ +- (BOOL)removeDestinationInfoForChannelName:(NSString *_Nonnull)channelName NS_SWIFT_NAME(removeDestinationInfo(forChannelName:)); +@end + + +/** The image enhancement options in [setBeautyEffectOptions]([AgoraRtcEngineKit setBeautyEffectOptions:options:]). */ +__attribute__((visibility("default"))) @interface AgoraBeautyOptions : NSObject + +/** The lightening contrast level + +[AgoraLighteningContrastLevel](AgoraLighteningContrastLevel), used with the lighteningLevel property: + +- 0: Low contrast level. +- 1: (Default) Normal contrast level. +- 2: High contrast level. +*/ +@property(nonatomic, assign) AgoraLighteningContrastLevel lighteningContrastLevel; + +/** The brightness level. + +The default value is 0.7. The value ranges from 0.0 (original) to 1.0. + */ +@property(nonatomic, assign) float lighteningLevel; + +/** The smoothness level. + +The default value is 0.5. The value ranges from 0.0 (original) to 1.0. This parameter is usually used to remove blemishes. + */ +@property(nonatomic, assign) float smoothnessLevel; + +/** The redness level. + +The default value is 0.1. The value ranges from 0.0 (original) to 1.0. This parameter adjusts the red saturation level. +*/ +@property(nonatomic, assign) float rednessLevel; + +/** The sharpness level. + +The default value is 0.1. The value ranges from 0.0 (original) to 1.0. +*/ +@property(nonatomic, assign) float sharpnessLevel; + +@end + +/** + The video noise reduction options. + + **Since** v3.6.2 + */ +__attribute__((visibility("default"))) @interface AgoraVideoDenoiserOptions : NSObject + +/** The video noise reduction mode. See AgoraVideoDenoiserMode. + */ +@property(nonatomic, assign) AgoraVideoDenoiserMode mode; + +/** The video noise reduction level. See AgoraVideoDenoiserLevel. + */ +@property(nonatomic, assign) AgoraVideoDenoiserLevel level; + +@end + +/** + The video noise reduction options. + + **Since** v3.6.2 + */ +__attribute__((visibility("default"))) @interface AgoraLowlightEnhanceOptions : NSObject + +/** The low-light enhancement mode. See AgoraLowlightEnhanceMode. */ +@property(nonatomic, assign) AgoraLowlightEnhanceMode mode; + +/** The low-light enhancement level. See AgoraLowlightEnhanceLevel. */ +@property(nonatomic, assign) AgoraLowlightEnhanceLevel level; + +@end + +/** + The color enhancement options. + + **Since** v3.6.2 + */ +__attribute__((visibility("default"))) @interface AgoraColorEnhanceOptions : NSObject + +/** The level of color enhancement. The value range is [0.0,1.0]. `0.0` is the default value, which means no color enhancement is applied to the video. The higher the value, the higher the level of color enhancement. */ +@property(nonatomic, assign) float strengthLevel; + +/** The level of skin tone protection. The value range is [0.0,1.0]. `0.0` means no skin tone protection. The higher the value, the higher the level of skin tone protection. The default value is `1.0.` When the level of color enhancement is higher, the portrait skin tone can be significantly distorted, so you need to set the level of skin tone protection; when the level of skin tone protection is higher, the color enhancement effect can be slightly reduced. Therefore, to get the best color enhancement effect, Agora recommends that you adjust strengthLevel and skinProtectLevel to get the most appropriate values. */ +@property(nonatomic, assign) float skinProtectLevel; + +@end + + +/** The custom background image. + */ +__attribute__((visibility("default"))) @interface AgoraVirtualBackgroundSource : NSObject + +/** The type of the custom background image. See AgoraVirtualBackgroundSourceType. + */ +@property(nonatomic, assign) AgoraVirtualBackgroundSourceType backgroundSourceType NS_SWIFT_NAME(backgroundSourceType); + +/** The color of the custom background image. The format is a hexadecimal + integer defined by RGB, without the # sign, such as `0xFFB6C1` for light pink. + The default value is `0xFFFFFF`, which signifies white. The value range is + [0x000000,0xFFFFFF]. If the value is invalid, the SDK replaces the original + background image with a white background image. +

    Note: This parameter takes effect only when the type of the custom + background image is AgoraVirtualBackgroundColor.

    + */ +@property(nonatomic, assign) NSUInteger color NS_SWIFT_NAME(color); + +/** The local absolute path of the custom background image. PNG and JPG formats + are supported. If the path is invalid, the SDK replaces the original + background image with a white background image. +

    Note: This parameter takes effect only when the type of the custom + background image is AgoraVirtualBackgroundImg.

    + */ +@property(nonatomic, copy) NSString* _Nullable source NS_SWIFT_NAME(source); + +/** Background blur degree, for example: 1 2 3 */ +@property(nonatomic, assign) AgoraBlurDegree blurDegree; + +@end + +/** The custom green capacity. + */ +__attribute__((visibility("default"))) @interface AgoraSegmentationProperty: NSObject + +@property(nonatomic, assign) SegModelType modelType; + +@property(nonatomic, assign) float greenCapacity; + +@end + + +/** The definition of AgoraTranscodingVideoStream. + */ +__attribute__((visibility("default"))) @interface AgoraTranscodingVideoStream: NSObject +/** + * Source type of video stream. + */ +@property (assign, nonatomic) AgoraVideoSourceType sourceType; +/** + * Remote user uid if sourceType is AgoraMediaSourceTypeRemote. + */ +@property (assign, nonatomic) NSUInteger remoteUserUid; +/** + * RTC image if sourceType is AgoraMediaSourceTypeRtcImage. + */ +@property (copy, nonatomic) NSString * _Nullable imageUrl; +/** + * MediaPlayer id if sourceType is AgoraMediaSourceTypeMediaPlayer. + */ +@property(assign, nonatomic) NSUInteger mediaPlayerId; +/** + * Position and size of the video frame. + */ +@property (assign, nonatomic) CGRect rect; +/** + * The layer of the video frame that ranges from 1 to 100: + - 1: (Default) The lowest layer. + - 100: The highest layer. + */ +@property (assign, nonatomic) NSInteger zOrder; +/** + * The transparency of the video frame. + */ +@property(assign, nonatomic) double alpha; +/** + * Mirror of the source video frame (only valid for camera streams) + */ +@property(assign, nonatomic) BOOL mirror; + +@end +__attribute__((visibility("default"))) @interface AgoraVideoLayout: NSObject +@property(copy, nonatomic) NSString* _Nonnull channelId NS_SWIFT_NAME(channelId); +@property (assign, nonatomic) NSUInteger uid NS_SWIFT_NAME(uid); +@property(copy, nonatomic) NSString* _Nullable strUid NS_SWIFT_NAME(strUid); +@property (assign, nonatomic) NSUInteger videoState NS_SWIFT_NAME(videoState); +@property (assign, nonatomic) NSUInteger x NS_SWIFT_NAME(x); +@property (assign, nonatomic) NSUInteger y NS_SWIFT_NAME(y); +@property (assign, nonatomic) NSUInteger width NS_SWIFT_NAME(width); +@property (assign, nonatomic) NSUInteger height NS_SWIFT_NAME(height); +@end +/** The definition of AgoraVideoLayoutInfo. + */ +__attribute__((visibility("default"))) @interface AgoraVideoLayoutInfo: NSObject +@property (assign, nonatomic) NSUInteger width NS_SWIFT_NAME(width); +@property (assign, nonatomic) NSUInteger height NS_SWIFT_NAME(height); +@property (assign, nonatomic) NSUInteger layoutCount NS_SWIFT_NAME(layoutCount); +@property(copy, nonatomic) NSArray *_Nullable layoutList NS_SWIFT_NAME(layoutList); +@end + +/** The definition of AgoraLocalTranscoderConfiguration. + */ +__attribute__((visibility("default"))) @interface AgoraLocalTranscoderConfiguration: NSObject +/** + * The video stream layout configuration in the transcoder. + */ +@property(copy, nonatomic) NSArray *_Nullable videoInputStreams; +/** + * The video encoder configuration of transcoded video. + */ +@property (strong, nonatomic) AgoraVideoEncoderConfiguration *_Nonnull videoOutputConfiguration; + +/** + * Whether to use the timestamp when the primary camera captures the video frame as the timestamp of the mixed video frame. + * - true: (Default) Use the timestamp of the captured video frame as the timestamp of the mixed video frame. + * - false: Do not use the timestamp of the captured video frame as the timestamp of the mixed video frame. use the timestamp when the mixed video frame is constructed Instead. + */ +@property(assign, nonatomic) BOOL syncWithPrimaryCamera; + +@end + +/** The definition of the screen sharing encoding parameters. + */ +__attribute__((visibility("default"))) @interface AgoraScreenCaptureParameters: NSObject +/** + * The dimensions of the shared region in terms of width × height. The default value is 0, which means + * the original dimensions of the shared screen. + */ +@property (assign, nonatomic) CGSize dimensions; +/** + * The frame rate (fps) of the shared region. The default value is 5. We do not recommend setting + * this to a value greater than 15. + */ +@property (assign, nonatomic) NSInteger frameRate; +/** + * The bitrate (Kbps) of the shared region. The default value is 0, which means the SDK works out a bitrate + * according to the dimensions of the current screen. + */ +@property (assign, nonatomic) NSInteger bitrate; + +/** Sets whether to capture the mouse for screen sharing. + +- YES: (Default) Capture the mouse. +- NO: Do not capture the mouse. + */ +@property(assign, nonatomic) BOOL captureMouseCursor; + +/** Whether to bring the window to the front when calling [startScreenCaptureByWindowId]([AgoraRtcEngineKit startScreenCaptureByWindowId:rectangle:parameters:]) to share the window: + + - YES: Bring the window to the front. + - NO: (Default) Do not bring the window to the front. + + @note Due to system limitations, `windowFocus` only supports bringing the main window of an application to the front. + + */ +@property(assign, nonatomic) BOOL windowFocus; + +/** A list of IDs of windows to be blocked. + + When calling [startScreenCaptureByDisplayId]([AgoraRtcEngineKit startScreenCaptureByDisplayId:rectangle:parameters:]) + and pass `0` in the `displayId` parameter to start sharing a main screen, you can use this parameter to block the specified windows. When calling + [updateScreenCaptureParameters]([AgoraRtcEngineKit updateScreenCaptureParameters:]) to update the configuration for the main screen sharing, you can use this + parameter to dynamically block the specified windows during the main screen sharing. + + */ +@property(copy, nonatomic) NSArray* _Nullable excludeWindowList; + +/** (macOS only) Determines whether to place a border around the shared window or screen: + + - YES: Place a border. + - NO: (Default) Do not place a border. + + @note When you share a part of a window or screen, the SDK places a border around the entire window or screen if you set `highLighted` as YES. + + */ +@property(assign, nonatomic) BOOL highLighted; +/** (macOS only) The color of the border in RGBA format. The default value is 0xFF8CBF26. + + on macOS, `COLOR_CLASS` refers to `NSColor`. + + */ +@property(strong, nonatomic) COLOR_CLASS* _Nullable highLightColor; +/** (macOS only) The width (px) of the border. Defaults to 0, and the value range is [0,50]. + + */ +@property(assign, nonatomic) NSUInteger highLightWidth; + +@end + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +/** The configuration of camera capturer. + */ +__attribute__((visibility("default"))) @interface AgoraScreenCaptureConfiguration: NSObject +/** + * Whether to capture the window on the screen: + * - `true`: Capture the window. + * - `false`: (Default) Capture the screen, not the window. + */ +@property(assign, nonatomic) BOOL isCaptureWindow; +/** + * (macOS only) The display ID of the screen. + */ +@property(assign, nonatomic) NSInteger displayId; +/** + * (For Windows and macOS only) The window ID. + * @note This parameter takes effect only when you want to capture the window. + */ + +@property(assign, nonatomic) NSInteger windowId; + +/** + * (For Windows and macOS only) The screen capture configuration. For details, see ScreenCaptureParameters. + */ +@property(strong, nonatomic) AgoraScreenCaptureParameters* _Nonnull params; +/** + * (For Windows and macOS only) The relative position of the shared region to the whole screen. For details, see Rectangle. + * + * If you do not set this parameter, the SDK shares the whole screen. If the region you set exceeds the boundary of the + * screen, only the region within in the screen is shared. If you set width or height in Rectangle as 0, the whole + * screen is shared. + */ +@property(assign, nonatomic) CGRect regionRect; + +@end +#endif + +__attribute__((visibility("default"))) @interface AgoraScreenVideoParameters : NSObject + +/** CGSizezero Since the applicable below 720p + + You can customize the dimension, or select from the following list: + + - AgoraVideoDimension120x120 + - AgoraVideoDimension160x120 + - AgoraVideoDimension180x180 + - AgoraVideoDimension240x180 + - AgoraVideoDimension320x180 + - AgoraVideoDimension240x240 + - AgoraVideoDimension320x240 + - AgoraVideoDimension424x240 + - AgoraVideoDimension360x360 + - AgoraVideoDimension480x360 + - AgoraVideoDimension640x360 + - AgoraVideoDimension480x480 + - AgoraVideoDimension640x480 + - AgoraVideoDimension840x480 + - AgoraVideoDimension960x540 + - AgoraVideoDimension960x720 + - AgoraVideoDimension1280x720 + - AgoraVideoDimension1920x1080 (macOS only) + + Note: + + - The dimension does not specify the orientation mode of the output ratio. For how to set the video orientation, see [AgoraVideoOutputOrientationMode](AgoraVideoOutputOrientationMode). + - Whether 720p can be supported depends on the device. If the device cannot support 720p, the frame rate will be lower than the one listed in the table. Agora optimizes the video in lower-end devices. + - iPhones do not support video frame dimensions above 720p. + + */ +@property(assign, nonatomic) CGSize dimensions; +/** The frame rate of the video (fps). + + You can either set the frame rate manually or choose from the following options. The default value is 15. We do not recommend setting this to a value greater than 30. + + * AgoraVideoFrameRateFps1(1): 1 fps + * AgoraVideoFrameRateFps7(7): 7 fps + * AgoraVideoFrameRateFps10(10): 10 fps + * AgoraVideoFrameRateFps15(15): 15 fps + * AgoraVideoFrameRateFps24(24): 24 fps + * AgoraVideoFrameRateFps30(30): 30 fps + * AgoraVideoFrameRateFps60(30): 60 fps (macOS only) + */ +@property(assign, nonatomic) AgoraVideoFrameRate frameRate; +/** The bitrate of the video. + + Sets the video bitrate (Kbps). Refer to the table below and set your bitrate. If you set a bitrate beyond the proper range, the SDK automatically adjusts it to a value within the range. You can also choose from the following options: + + - AgoraVideoBitrateStandard: (recommended) the standard bitrate mode. In this mode, the bitrates differ between the interactive live streaming and Communication profiles: + + - Communication profile: the video bitrate is the same as the base bitrate. + - Interactive live streaming profile: the video bitrate is twice the base bitrate. + + - AgoraVideoBitrateCompatible: the compatible bitrate mode. In this mode, the bitrate stays the same regardless of the profile. In the interactive live streaming profile, if you choose this mode, the video frame rate may be lower than the set value. + +Agora uses different video codecs for different profiles to optimize the user experience. For example, the Communication profile prioritizes the smoothness while the interactive live streaming profile prioritizes the video quality (a higher bitrate). Therefore, Agora recommends setting this parameter as AgoraVideoBitrateStandard. + +**Video Bitrate Table** + +| Resolution | Frame Rate (fps) | Base Bitrate (Kbps, for Communication) | Live Bitrate (Kbps, for Live Broadcast) | +|-------------------|------------------|----------------------------------------|-----------------------------------------| +| 160 * 120 | 15 | 65 | 130 | +| 120 * 120 | 15 | 50 | 100 | +| 320 * 180 | 15 | 140 | 280 | +| 180 * 180 | 15 | 100 | 200 | +| 240 * 180 | 15 | 120 | 240 | +| 320 * 240 | 15 | 200 | 400 | +| 240 * 240 | 15 | 140 | 280 | +| 424 * 240 | 15 | 220 | 440 | +| 640 * 360 | 15 | 400 | 800 | +| 360 * 360 | 15 | 260 | 520 | +| 640 * 360 | 30 | 600 | 1200 | +| 360 * 360 | 30 | 400 | 800 | +| 480 * 360 | 15 | 320 | 640 | +| 480 * 360 | 30 | 490 | 980 | +| 640 * 480 | 15 | 500 | 1000 | +| 480 * 480 | 15 | 400 | 800 | +| 640 * 480 | 30 | 750 | 1500 | +| 480 * 480 | 30 | 600 | 1200 | +| 848 * 480 | 15 | 610 | 1220 | +| 848 * 480 | 30 | 930 | 1860 | +| 640 * 480 | 10 | 400 | 800 | +| 1280 * 720 | 15 | 1130 | 2260 | +| 1280 * 720 | 30 | 1710 | 3420 | +| 960 * 720 | 15 | 910 | 1820 | +| 960 * 720 | 30 | 1380 | 2760 | +| 1920 * 1080 | 15 | 2080 | 4160 | +| 1920 * 1080 | 30 | 3150 | 6300 | +| 1920 * 1080 | 60 | 4780 | 6500 | + + +**Note:** + +The base bitrate in this table applies to the Communication profile. The interactive live streaming profile generally requires a higher bitrate for better video quality. Agora recommends setting the bitrate mode as AgoraVideoBitrateStandard. You can also set the bitrate as twice the base bitrate. + + +*/ +@property(assign, nonatomic) NSInteger bitrate; + +/** contentHint The content hint for screen sharing, see [AgoraVideoContentHint](AgoraVideoContentHint). + */ +@property(assign, nonatomic) AgoraVideoContentHint contentHint; + +@end + +__attribute__((visibility("default"))) @interface AgoraScreenAudioParameters : NSObject + +@property(assign, nonatomic) NSInteger captureSignalVolume; + +@end + +__attribute__((visibility("default"))) @interface AgoraScreenCaptureParameters2 : NSObject +/** + * when captureAudio is YES, ReplayKit will push sample buffer with RPSampleBufferTypeAudioApp, default NO. + */ +@property(assign, nonatomic) BOOL captureAudio; +/** + * screen share with audio parameters + */ +@property(strong, nonatomic) AgoraScreenAudioParameters* _Nonnull audioParams; +/** + * when captureVideo is YES, ReplayKit will push sample buffer with RPSampleBufferTypeVideo, default YES. + */ +@property(assign, nonatomic) BOOL captureVideo; +/** + * screen share with video parameters + */ +@property(strong, nonatomic) AgoraScreenVideoParameters* _Nonnull videoParams; +@end + +/** Configurations of SimulcastStreamConfig. + */ + +__attribute__((visibility("default"))) @interface AgoraAudioRecordingConfiguration: NSObject +/** + * The absolute path (including the filename extensions) of the recording file. For example: `/var/mobile/Containers/Data/audio.aac`. + * @note Ensure that the path you specify exists and is writable. + */ +@property (copy, nonatomic) NSString * _Nullable filePath; +/** + * Recording sample rate (Hz). The following values are supported: + * - 16000 + * - (Default) 32000 + * - 44100 + * - 48000 + * @note If this parameter is set to `44100` or `48000`, for better recording effects, Agora recommends recording WAV + * files or AAC files whose `quality` is `AgoraAudioRecordingQualityMedium` or `AgoraAudioRecordingQualityHigh`. + */ +@property (assign, nonatomic) NSUInteger sampleRate; +/** + * Recording content. See AgoraAudioFileRecordingType. + */ +@property (assign, nonatomic) AgoraAudioFileRecordingType fileRecordOption; +/** + * Audio recording quality. See AgoraAudioRecordingQuality. + * @note This parameter applies for AAC files only. + */ +@property (assign, nonatomic) AgoraAudioRecordingQuality quality; + +/** + * Recording channel.The following values are supported: + * - (Default) 1 + * - 2 + */ +@property (assign, nonatomic) NSInteger recordingChannel; + +@end + +/** Configurations of SimulcastStreamConfig. + */ +__attribute__((visibility("default"))) @interface AgoraSimulcastStreamConfig: NSObject + +/** + * The video bitrate (Kbps). + */ + @property (assign, nonatomic) int kBitrate; +/** + * The video framerate. + */ + @property (assign, nonatomic) int framerate; + /** + * The video frame dimension. + */ + @property (assign, nonatomic) CGSize dimensions; + @end + +/** The AgoraMediaStreamInfo class, reporting the whole detailed information of + the media stream. + */ +__attribute__((visibility("default"))) @interface AgoraRtcMediaStreamInfo : NSObject +/** The index of the media stream. */ +@property(nonatomic, assign) NSInteger streamIndex; +/** The type of the media stream. See AgoraMediaStreamType for details. */ +@property(nonatomic, assign) AgoraMediaStreamType streamType; +/** The codec of the media stream. */ +@property(nonatomic, copy) NSString *_Nonnull codecName; +/** The language of the media stream. */ +@property(nonatomic, copy) NSString *_Nullable language; +/** For video stream, gets the frame rate (fps). */ +@property(nonatomic, assign) NSInteger videoFrameRate; +/** For video stream, gets the bitrate (bps). */ +@property(nonatomic, assign) NSInteger videoBitRate; +/** For video stream, gets the width (pixel) of the video. */ +@property(nonatomic, assign) NSInteger videoWidth; +/** For video stream, gets the height (pixel) of the video. */ +@property(nonatomic, assign) NSInteger videoHeight; +/** For the audio stream, gets the sample rate (Hz). */ +@property(nonatomic, assign) NSInteger audioSampleRate; +/** For the audio stream, gets the channel number. */ +@property(nonatomic, assign) NSInteger audioChannels; +/** The total duration (s) of the media stream. */ +@property(nonatomic, assign) NSInteger duration; +/** The rotation of the video stream. */ +@property(nonatomic, assign) NSInteger rotation; + +@end + +__attribute__((visibility("default"))) @interface AgoraAudioSpectrumInfo : NSObject + +/** User ID of the speaker. */ +@property(nonatomic, assign) NSInteger uid; +@property(nonatomic, strong) NSArray * _Nullable audioSpectrumData; + +@end + +/** + * The configurations for the audio encoded freame. + */ +__attribute__((visibility("default"))) @interface AgoraAudioEncodedFrameDelegateConfig: NSObject +/** + * The position where SDK record the audio, and callback to encoded audio frame observer. + */ +@property (assign, nonatomic) AgoraAudioEncodedFrameDelegatePosition postionType; +/** + * audio encoding type. + */ +@property (assign, nonatomic) AgoraAudioEncodingType encodingType; +@end + +__attribute__((visibility("default"))) @interface AgoraContentInspectModule: NSObject +@property (assign, nonatomic) AgoraContentInspectType type; + +@property (assign, nonatomic) NSInteger interval; +@end + +__attribute__((visibility("default"))) @interface AgoraContentInspectConfig: NSObject +@property (nonatomic, copy) NSString* _Nullable extraInfo; +@property(copy, nonatomic) NSArray* _Nullable modules; +@end +/** + * The AgoraRtcConnection for the AgoraRtcEngineKitEx. + */ +__attribute__((visibility("default"))) @interface AgoraRtcConnection: NSObject + +/** + * Init AgoraRtcConnection with channelId and localUid + * + * @param channelId Unique channel name for the AgoraRTC session in the string. + * @param localUid Local User ID. A 32-bit unsigned integer. + * @return AgoraRtcConnection. + */ +- (instancetype _Nonnull)initWithChannelId:(NSString *_Nonnull)channelId localUid:(NSInteger)localUid; + +/* channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + */ +@property (nonatomic, copy) NSString *_Nonnull channelId; +/* uid Local User ID. A 32-bit unsigned integer with a value ranging from 1 to + * (232-1). The `uid` must be unique and not set to 0 . Your app + * must record and maintain the returned `uid` since the SDK does not do so. + */ +@property (nonatomic, assign) NSUInteger localUid; + +@end +/** + * remote video subscription options + */ +__attribute__((visibility("default"))) @interface AgoraVideoSubscriptionOptions: NSObject + +/* +* The type of the video stream to subscribe to. +* +* The default value is `VIDEO_STREAM_HIGH`, which means the high-quality +* video stream. +*/ +@property (nonatomic, assign) AgoraVideoStreamType type; +/* +* Whether to subscribe to encoded video data only: +* - `true`: Subscribe to encoded video data only. +* - `false`: (Default) Subscribe to decoded video data. +*/ +@property (nonatomic, assign) bool encodedFrameOnly; + +@end +/** + * The configurations for the audio encoded freame. + */ +__attribute__((visibility("default"))) @interface AgoraEncodedVideoFrameInfo: NSObject + +/** + * The video codec: #VIDEO_CODEC_TYPE. + */ +@property (assign, nonatomic) AgoraVideoCodecType codecType; +/** + * The width (px) of the video. + */ +@property (assign, nonatomic) NSInteger width; +/** + * The height (px) of the video. + */ +@property (assign, nonatomic) NSInteger height; +/** + * The number of video frames per second. + * This value will be used for calculating timestamps of the encoded image. + * If framesPerSecond equals zero, then real timestamp will be used. + * Otherwise, timestamp will be adjusted to the value of framesPerSecond set. + */ +@property (assign, nonatomic) NSInteger framesPerSecond; +/** + * The frame type of the encoded video frame: #VIDEO_FRAME_TYPE. + */ +@property (assign, nonatomic) AgoraVideoFrameType frameType; +/** + * The rotation information of the encoded video frame: #VIDEO_ORIENTATION. + */ +@property (assign, nonatomic) NSInteger rotation; +/** + * The track ID of the video frame. + */ +@property (assign, nonatomic) NSInteger trackId; // This can be reserved for multiple video tracks, we need to create different ssrc + // and additional payload for later implementation. +/** + * This is a input parameter which means the timestamp for capturing the video. + */ +@property (assign, nonatomic) NSInteger captureTimeMs; +/** + * This is a output parameter which means the timestamp for decoding the video. + */ +@property (assign, nonatomic) NSInteger decodeTimeMs; +/** + * ID of the user. + */ +@property (assign, nonatomic) NSInteger uid; +/** + * The stream type of video frame. + */ +@property (assign, nonatomic) AgoraVideoStreamType streamType; +@end + +NS_SWIFT_NAME(LogUploadServerInfo) __attribute__((visibility("default"))) @interface LogUploadServerInfo : NSObject +/** Log upload server domain + */ +@property(copy, nonatomic) NSString* _Nullable serverDomain; +/** Log upload server path + */ +@property(copy, nonatomic) NSString* _Nullable serverPath; +/** Log upload server port + */ +@property(assign, nonatomic) NSInteger serverPort; +/** Whether to use HTTPS request: + - true: Use HTTPS request + - fasle: Use HTTP request + */ +@property(assign, nonatomic) BOOL serverHttps; +@end + +NS_SWIFT_NAME(AdvancedConfigInfo) __attribute__((visibility("default"))) @interface AdvancedConfigInfo : NSObject +/** Log upload server + */ +@property(strong, nonatomic) LogUploadServerInfo* _Nullable logUploadServer; +@end + +NS_SWIFT_NAME(AgoraLocalAccessPointConfiguration) __attribute__((visibility("default"))) @interface AgoraLocalAccessPointConfiguration : NSObject +/** Local access point IP address list. + */ +@property(copy, nonatomic) NSArray* _Nullable ipList NS_SWIFT_NAME(ipList); +/** Local access point domain list. + */ +@property(copy, nonatomic) NSArray* _Nullable domainList NS_SWIFT_NAME(domainList); +/** Certificate domain name installed on specific local access point. pass "" means using sni domain on specific local access point + * SNI(Server Name Indication) is an extension to the TLS protocol. + */ +@property(copy, nonatomic) NSString* _Nullable verifyDomainName NS_SWIFT_NAME(verifyDomainName); +/** Local proxy connection mode, connectivity first or local only. + */ +@property(assign, nonatomic) AgoraLocalProxyMode mode NS_SWIFT_NAME(mode); +/** Local proxy connection, advanced config info. + */ +@property(strong, nonatomic) AdvancedConfigInfo* _Nullable advancedConfig NS_SWIFT_NAME(advancedConfig); +@end + +/** + * The configuration of rhythm player, + * which is set in startRhythmPlayer or configRhythmPlayer. + */ +__attribute__((visibility("default"))) @interface AgoraRhythmPlayerConfig: NSObject +/** + * The number of beats per measure. The range is 1 to 9. + * The default value is 4, + * which means that each measure contains one downbeat and three upbeats. + */ +@property (assign, nonatomic) int beatsPerMeasure; +/* + * The range is 60 to 360. + * The default value is 60, + * which means that the rhythm player plays 60 beats in one minute. + */ +@property (assign, nonatomic) int beatsPerMinute; + +@end + +/** AgoraFacePositionInfo. + */ +NS_SWIFT_NAME(AgoraFacePositionInfo) __attribute__((visibility("default"))) @interface AgoraFacePositionInfo : NSObject + +/** The x coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, the x coordinate represents the relative lateral displacement of the top left corner of the human face to the origin. + */ +@property(assign, nonatomic) NSInteger x NS_SWIFT_NAME(x); + +/** The y coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, the y coordinate represents the relative longitudinal displacement of the top left corner of the human face to the origin. + */ +@property(assign, nonatomic) NSInteger y NS_SWIFT_NAME(y); + +/** The width (px) of the human face in the captured video. + */ +@property(assign, nonatomic) NSInteger width NS_SWIFT_NAME(width); + +/** The height (px) of the human face in the captured video. + */ +@property(assign, nonatomic) NSInteger height NS_SWIFT_NAME(height); + +/** The distance (cm) between the human face and the screen. + */ +@property(assign, nonatomic) NSInteger distance NS_SWIFT_NAME(distance); +@end + +/** AgoraAdvancedAudioOptions. + */ +__attribute__((visibility("default"))) @interface AgoraAdvancedAudioOptions: NSObject + +@property(assign, nonatomic) AgoraAudioProcessChannels audioProcessingChannels; + +@end + +__attribute__((visibility("default"))) @interface AgoraImageTrackOptions : NSObject +@property(copy, nonatomic) NSString *_Nullable imageUrl; +@property(assign, nonatomic) int fps; +@property(assign, nonatomic) AgoraVideoMirrorMode mirrorMode; +@end + +/** + * spatial audio parameters + * . + */ +__attribute__((visibility("default"))) @interface AgoraSpatialAudioParams : NSObject +/** + * Speaker azimuth in a spherical coordinate system centered on the listener. + */ +@property(assign, nonatomic) double speaker_azimuth; +/** + * Speaker elevation in a spherical coordinate system centered on the listener. + */ +@property(assign, nonatomic) double speaker_elevation; +/** + * Distance between speaker and listener. + */ +@property(assign, nonatomic) double speaker_distance; +/** + * Speaker orientation [0-180], 0 degree is the same with listener orientation. + */ +@property(assign, nonatomic) NSInteger speaker_orientation; +/** + * Enable blur or not for the speaker. + */ +@property(assign, nonatomic) BOOL enable_blur; +/** + * Enable air absorb or not for the speaker. + */ +@property(assign, nonatomic) BOOL enable_air_absorb; +/** + * Speaker attenuation factor. + */ +@property(assign, nonatomic) double speaker_attenuation; +/** + * Enable doppler factor. + */ +@property(assign, nonatomic) BOOL enable_doppler; +@end + +NS_SWIFT_NAME(AgoraEchoTestConfiguration) +__attribute__((visibility("default"))) @interface AgoraEchoTestConfiguration : NSObject +/** The video display view. + + VIEW_CLASS is a general name for this property. See the following definitions for iOS and macOS: + + - iOS: UIView + - MacOS: NSView + */ +@property(strong, nonatomic) VIEW_CLASS* _Nullable view NS_SWIFT_NAME(view); +/** Whether to enable audio. + */ +@property(assign, nonatomic) BOOL enableAudio NS_SWIFT_NAME(enableAudio); +/** Whether to enable video. + */ +@property(assign, nonatomic) BOOL enableVideo NS_SWIFT_NAME(enableVideo); +/** The token for join channel. + */ +@property(copy, nonatomic) NSString* _Nullable token NS_SWIFT_NAME(token); +/** The channelId. + */ +@property(copy, nonatomic) NSString* _Nonnull channelId NS_SWIFT_NAME(channelId); +@end + +/** + * Indicator optimization degree. + */ +NS_SWIFT_NAME(AgoraWlAccStats) __attribute__((visibility("default"))) @interface AgoraWlAccStats : NSObject +/** + * End-to-end delay optimization percentage. + */ +@property(assign, nonatomic) NSInteger e2eDelayPercent NS_SWIFT_NAME(e2eDelayPercent); +/** + * Frozen Ratio optimization percentage. + */ +@property(assign, nonatomic) NSInteger frozenRatioPercent NS_SWIFT_NAME(frozenRatioPercent); +/** + * Loss Rate optimization percentage. + */ +@property(assign, nonatomic) NSInteger lossRatePercent NS_SWIFT_NAME(lossRatePercent); +@end + +__attribute__((visibility("default"))) @interface AgoraMediaRecorderInfo : NSObject + +/** Recorder file name. It contains file's absolute path. + */ +@property(copy, nonatomic) NSString* _Nonnull recorderFileName; +/** Record duration (ms). + */ +@property(assign, nonatomic) NSUInteger durationMs; +/** Record file size (Byte). + */ +@property(assign, nonatomic) NSUInteger fileSize; + +@end + +__attribute__((visibility("default"))) @interface AgoraMediaRecorderConfiguration : NSObject + +/** Recorder file storage path. It contains file name (absolute path), such as -xxx.flv, -xxx.mp4, etc. + */ +@property(copy, nonatomic) NSString* _Nonnull storagePath; +/** Container format. See AgoraMediaRecorderContainerFormat. + */ +@property(assign, nonatomic) AgoraMediaRecorderContainerFormat containerFormat; +/** Stream Type. See AgoraMediaRecorderStreamType. + */ +@property(assign, nonatomic) AgoraMediaRecorderStreamType streamType; +/** Max duration (ms). Default 120000ms. + */ +@property(assign, nonatomic) NSUInteger maxDurationMs; +/** Recorder information update interval (ms, [1000~10000]). If it is set to other values, there won't be any callback. + */ +@property(assign, nonatomic) NSUInteger recorderInfoUpdateInterval; + +@end + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) + +/** + The AgoraScreenCaptureSourceInfo interface. (macOS only) + */ +__attribute__((visibility("default"))) @interface AgoraScreenCaptureSourceInfo : NSObject +/** The type of the shared target. See ScreenCaptureSourceType. */ +@property(assign, nonatomic) AgoraScreenCaptureSourceType type; +/** The window ID for a window or the display ID for a screen. */ +@property(assign, nonatomic) CGWindowID sourceId; +/** The name of the window or screen. UTF-8 encoding. */ +@property(copy, nonatomic) NSString* _Nonnull sourceName; +/** The image content of the thumbnail.. */ +@property(strong, nonatomic) NSImage* _Nonnull thumbImage; +/** The image content of the icon. . */ +@property(strong, nonatomic) NSImage* _Nullable iconImage; +/** The process to which the window belongs. UTF-8 encoding. */ +@property(copy, nonatomic) NSString* _Nonnull processPath; +/** The name of the processName. UTF-8 encoding. */ +@property(copy, nonatomic) NSString* _Nonnull sourceTitle; +/** The relative position of the shared region to the screen space (A virtual space include all the screens). */ +@property(assign, nonatomic) CGRect position; +/** Determines whether the screen is the primary display: + + - YES: The screen is the primary display. + - NO: The screen is not the primary display. + */ +@property(assign, nonatomic) BOOL primaryMonitor; + +@end + +#endif + +NS_SWIFT_NAME(AgoraExtensionInfo) __attribute__((visibility("default"))) @interface AgoraExtensionInfo : NSObject + +/** + * The type of media device. + */ +@property (assign, nonatomic) AgoraMediaSourceType sourceType NS_SWIFT_NAME(sourceType); + +/** + * The id of the remote user on which the extension works. + * + * @note remoteUid = 0 means that the extension works on all remote streams. + */ +@property (assign, nonatomic) NSUInteger remoteUid NS_SWIFT_NAME(remoteUid); + +/** + * The unique channel name for the AgoraRTC session in the string format. The string + * length must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", + * "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + */ +@property (copy, nonatomic) NSString *_Nonnull channelId NS_SWIFT_NAME(channelId); + +/** + * User ID: A 32-bit unsigned integer ranging from 1 to (2^32-1). It must be unique. + */ +@property (assign, nonatomic) NSUInteger localUid NS_SWIFT_NAME(localUid); + +@end + +/** + * The video rendering tracing result + */ +NS_SWIFT_NAME(AgoraVideoRenderingTracingInfo) __attribute__((visibility("default"))) @interface AgoraVideoRenderingTracingInfo : NSObject +/** + * Elapsed time from the start tracing time to the time when the tracing event occurred. + */ +@property (assign, nonatomic) NSInteger elapsedTime NS_SWIFT_NAME(elapsedTime); +/** + * Elapsed time from the start tracing time to the time when join channel. + * + * **Note** + * If the start tracing time is behind the time when join channel, this value will be negative. + */ +@property (assign, nonatomic) NSInteger start2JoinChannel NS_SWIFT_NAME(start2JoinChannel); +/** + * Elapsed time from joining channel to finishing joining channel. + */ +@property (assign, nonatomic) NSInteger join2JoinSuccess NS_SWIFT_NAME(join2JoinSuccess); +/** + * Elapsed time from finishing joining channel to remote user joined. + * + * **Note** + * If the start tracing time is after the time finishing join channel, this value will be + * the elapsed time from the start tracing time to remote user joined. The minimum value is 0. + */ +@property (assign, nonatomic) NSInteger joinSuccess2RemoteJoined NS_SWIFT_NAME(joinSuccess2RemoteJoined); +/** + * Elapsed time from remote user joined to set the view. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to set the view. The minimum value is 0. + */ +@property (assign, nonatomic) NSInteger remoteJoined2SetView NS_SWIFT_NAME(remoteJoined2SetView); +/** + * Elapsed time from remote user joined to the time subscribing remote video stream. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to the time subscribing remote video stream. + * The minimum value is 0. + */ +@property (assign, nonatomic) NSInteger remoteJoined2UnmuteVideo NS_SWIFT_NAME(remoteJoined2UnmuteVideo); +/** + * Elapsed time from remote user joined to the remote video packet received. + * + * **Note** + * If the start tracing time is after the time when remote user joined, this value will be + * the elapsed time from the start tracing time to the time subscribing remote video stream. + * The minimum value is 0. + */ +@property (assign, nonatomic) NSInteger remoteJoined2PacketReceived NS_SWIFT_NAME(remoteJoined2PacketReceived); + +@end + +/** The configuration of custom audio track +*/ +NS_SWIFT_NAME(AgoraAudioTrackConfig) __attribute__((visibility("default"))) @interface AgoraAudioTrackConfig : NSObject +/** + * Enable local playback, enabled by default + * true: (Default) Enable local playback + * false: Do not enable local playback + */ +@property (assign, nonatomic) BOOL enableLocalPlayback NS_SWIFT_NAME(enableLocalPlayback); + +@end diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraOptional.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraOptional.h new file mode 100644 index 0000000..97595be --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraOptional.h @@ -0,0 +1,891 @@ +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. +#pragma once + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#include +#endif +#include + +#ifndef CONSTEXPR +#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) +#define CONSTEXPR constexpr +#else +#define CONSTEXPR +#endif +#endif // !CONSTEXPR + +#ifndef NOEXCEPT +#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) +#define NOEXCEPT(Expr) noexcept(Expr) +#else +#define NOEXCEPT(Expr) +#endif +#endif // !NOEXCEPT + +namespace agora { + +// Specification: +// http://en.cppreference.com/w/cpp/utility/optional/in_place_t +struct in_place_t {}; + +// Specification: +// http://en.cppreference.com/w/cpp/utility/optional/nullopt_t +struct nullopt_t { + CONSTEXPR explicit nullopt_t(int) {} +}; + +// Specification: +// http://en.cppreference.com/w/cpp/utility/optional/in_place +/*CONSTEXPR*/ const in_place_t in_place = {}; + +// Specification: +// http://en.cppreference.com/w/cpp/utility/optional/nullopt +/*CONSTEXPR*/ const nullopt_t nullopt(0); + +// Forward declaration, which is refered by following helpers. +template +class Optional; + +namespace internal { + +template +struct OptionalStorageBase { + // Initializing |empty_| here instead of using default member initializing + // to avoid errors in g++ 4.8. + CONSTEXPR OptionalStorageBase() : is_populated_(false), empty_('\0') {} + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + CONSTEXPR explicit OptionalStorageBase(in_place_t, Args&&... args) + : is_populated_(true), value_(std::forward(args)...) {} +#else + CONSTEXPR explicit OptionalStorageBase(in_place_t, const T& _value) + : is_populated_(true), value_(_value) {} +#endif + // When T is not trivially destructible we must call its + // destructor before deallocating its memory. + // Note that this hides the (implicitly declared) move constructor, which + // would be used for constexpr move constructor in OptionalStorage. + // It is needed iff T is trivially move constructible. However, the current + // is_trivially_{copy,move}_constructible implementation requires + // is_trivially_destructible (which looks a bug, cf: + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51452 and + // http://cplusplus.github.io/LWG/lwg-active.html#2116), so it is not + // necessary for this case at the moment. Please see also the destructor + // comment in "is_trivially_destructible = true" specialization below. + ~OptionalStorageBase() { + if (is_populated_) + value_.~T(); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + void Init(Args&&... args) { + ::new (&value_) T(std::forward(args)...); + is_populated_ = true; + } +#else + void Init(const T& _value) { + ::new (&value_) T(_value); + is_populated_ = true; + } +#endif + + bool is_populated_; + + union { + // |empty_| exists so that the union will always be initialized, even when + // it doesn't contain a value. Union members must be initialized for the + // constructor to be 'constexpr'. + char empty_; + T value_; + }; +}; + +// Implement conditional constexpr copy and move constructors. These are +// constexpr if is_trivially_{copy,move}_constructible::value is true +// respectively. If each is true, the corresponding constructor is defined as +// "= default;", which generates a constexpr constructor (In this case, +// the condition of constexpr-ness is satisfied because the base class also has +// compiler generated constexpr {copy,move} constructors). Note that +// placement-new is prohibited in constexpr. +template +struct OptionalStorage : OptionalStorageBase { + // This is no trivially {copy,move} constructible case. Other cases are + // defined below as specializations. + + // Accessing the members of template base class requires explicit + // declaration. + using OptionalStorageBase::is_populated_; + using OptionalStorageBase::value_; + using OptionalStorageBase::Init; + + // Inherit constructors (specifically, the in_place constructor). + //using OptionalStorageBase::OptionalStorageBase; + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + CONSTEXPR explicit OptionalStorage(in_place_t in_place, Args&&... args) + : OptionalStorageBase(in_place, std::forward(args)...) {} +#else + CONSTEXPR explicit OptionalStorage(in_place_t in_place, const T& _value) + : OptionalStorageBase(in_place, _value) {} +#endif + + // User defined constructor deletes the default constructor. + // Define it explicitly. + OptionalStorage() {} + + OptionalStorage(const OptionalStorage& other) { + if (other.is_populated_) + Init(other.value_); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + OptionalStorage(OptionalStorage&& other) NOEXCEPT(std::is_nothrow_move_constructible::value) { + if (other.is_populated_) + Init(std::move(other.value_)); + } +#endif +}; + +// Base class to support conditionally usable copy-/move- constructors +// and assign operators. +template +class OptionalBase { + // This class provides implementation rather than public API, so everything + // should be hidden. Often we use composition, but we cannot in this case + // because of C++ language restriction. + protected: + CONSTEXPR OptionalBase() {} + CONSTEXPR OptionalBase(const OptionalBase& other) : storage_(other.storage_) {} +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR OptionalBase(OptionalBase&& other) : storage_(std::move(other.storage_)) {} + + template + CONSTEXPR explicit OptionalBase(in_place_t, Args&&... args) + : storage_(in_place, std::forward(args)...) {} +#else + CONSTEXPR explicit OptionalBase(in_place_t, const T& _value) + : storage_(in_place, _value) {} +#endif + + // Implementation of converting constructors. + template + explicit OptionalBase(const OptionalBase& other) { + if (other.storage_.is_populated_) + storage_.Init(other.storage_.value_); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + explicit OptionalBase(OptionalBase&& other) { + if (other.storage_.is_populated_) + storage_.Init(std::move(other.storage_.value_)); + } +#endif + + ~OptionalBase() {} + + OptionalBase& operator=(const OptionalBase& other) { + CopyAssign(other); + return *this; + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + OptionalBase& operator=(OptionalBase&& other) NOEXCEPT( + std::is_nothrow_move_assignable::value && + std::is_nothrow_move_constructible::value) { + MoveAssign(std::move(other)); + return *this; + } +#endif + + template + void CopyAssign(const OptionalBase& other) { + if (other.storage_.is_populated_) + InitOrAssign(other.storage_.value_); + else + FreeIfNeeded(); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + void MoveAssign(OptionalBase&& other) { + if (other.storage_.is_populated_) + InitOrAssign(std::move(other.storage_.value_)); + else + FreeIfNeeded(); + } +#endif + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + void InitOrAssign(U&& value) { + if (storage_.is_populated_) + storage_.value_ = std::forward(value); + else + storage_.Init(std::forward(value)); + } +#else + void InitOrAssign(const U& value) { + if (storage_.is_populated_) + storage_.value_ = value; + else + storage_.Init(value); + } +#endif + + + void FreeIfNeeded() { + if (!storage_.is_populated_) + return; + storage_.value_.~T(); + storage_.is_populated_ = false; + } + + // For implementing conversion, allow access to other typed OptionalBase + // class. + template + friend class OptionalBase; + + OptionalStorage storage_; +}; + +// The following {Copy,Move}{Constructible,Assignable} structs are helpers to +// implement constructor/assign-operator overloading. Specifically, if T is +// is not movable but copyable, Optional's move constructor should not +// participate in overload resolution. This inheritance trick implements that. +template +struct CopyConstructible {}; + +template <> +struct CopyConstructible { + CONSTEXPR CopyConstructible() {} + CopyConstructible& operator=(const CopyConstructible&) { return *this; } +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR CopyConstructible(CopyConstructible&&) {} + CopyConstructible& operator=(CopyConstructible&&) { return *this; } +#endif + private: + CONSTEXPR CopyConstructible(const CopyConstructible&); +}; + +template +struct MoveConstructible {}; + +template <> +struct MoveConstructible { + CONSTEXPR MoveConstructible() {} + CONSTEXPR MoveConstructible(const MoveConstructible&) {} + MoveConstructible& operator=(const MoveConstructible&) { return *this; } +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + MoveConstructible& operator=(MoveConstructible&&) { return *this; } + private: + CONSTEXPR MoveConstructible(MoveConstructible&&); +#endif +}; + +template +struct CopyAssignable {}; + +template <> +struct CopyAssignable { + CONSTEXPR CopyAssignable() {} + CONSTEXPR CopyAssignable(const CopyAssignable&) {} +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR CopyAssignable(CopyAssignable&&) {} + CopyAssignable& operator=(CopyAssignable&&) { return *this; } +#endif + private: + CopyAssignable& operator=(const CopyAssignable&); +}; + +template +struct MoveAssignable {}; + +template <> +struct MoveAssignable { + CONSTEXPR MoveAssignable() {} + CONSTEXPR MoveAssignable(const MoveAssignable&) {} + MoveAssignable& operator=(const MoveAssignable&) { return *this; } +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR MoveAssignable(MoveAssignable&&) {} + + private: + MoveAssignable& operator=(MoveAssignable&&); +#endif +}; + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +// Helper to conditionally enable converting constructors and assign operators. +template +struct IsConvertibleFromOptional + : std::integral_constant< + bool, + std::is_constructible&>::value || + std::is_constructible&>::value || + std::is_constructible&&>::value || + std::is_constructible&&>::value || + std::is_convertible&, T>::value || + std::is_convertible&, T>::value || + std::is_convertible&&, T>::value || + std::is_convertible&&, T>::value> {}; + +template +struct IsAssignableFromOptional + : std::integral_constant< + bool, + IsConvertibleFromOptional::value || + std::is_assignable&>::value || + std::is_assignable&>::value || + std::is_assignable&&>::value || + std::is_assignable&&>::value> {}; + +// Forward compatibility for C++17. +// Introduce one more deeper nested namespace to avoid leaking using std::swap. +namespace swappable_impl { +using std::swap; + +struct IsSwappableImpl { + // Tests if swap can be called. Check(0) returns true_type iff swap + // is available for T. Otherwise, Check's overload resolution falls back + // to Check(...) declared below thanks to SFINAE, so returns false_type. + template + static auto Check(int) + -> decltype(swap(std::declval(), std::declval()), std::true_type()); + + template + static std::false_type Check(...); +}; +} // namespace swappable_impl +template +struct IsSwappable : decltype(swappable_impl::IsSwappableImpl::Check(0)) {}; +#endif +} // namespace internal + +// On Windows, by default, empty-base class optimization does not work, +// which means even if the base class is empty struct, it still consumes one +// byte for its body. __declspec(empty_bases) enables the optimization. +// cf) +// https://blogs.msdn.microsoft.com/vcblog/2016/03/30/optimizing-the-layout-of-empty-base-classes-in-vs2015-update-2-3/ +#if defined(_WIN32) +#define OPTIONAL_DECLSPEC_EMPTY_BASES __declspec(empty_bases) +#else +#define OPTIONAL_DECLSPEC_EMPTY_BASES +#endif + +// Optional is a Chromium version of the C++17 optional class: +// std::optional documentation: +// http://en.cppreference.com/w/cpp/utility/optional +// Chromium documentation: +// https://chromium.googlesource.com/chromium/src/+/master/docs/optional.md +// +// These are the differences between the specification and the implementation: +// - Constructors do not use 'constexpr' as it is a C++14 extension. +// - 'constexpr' might be missing in some places for reasons specified locally. +// - No exceptions are thrown, because they are banned from Chromium. +// Marked noexcept for only move constructor and move assign operators. +// - All the non-members are in the 'base' namespace instead of 'std'. +// +// Note that T cannot have a constructor T(Optional) etc. Optional checks +// T's constructor (specifically via IsConvertibleFromOptional), and in the +// check whether T can be constructible from Optional, which is recursive +// so it does not work. As of Feb 2018, std::optional C++17 implementation in +// both clang and gcc has same limitation. MSVC SFINAE looks to have different +// behavior, but anyway it reports an error, too. +template +class OPTIONAL_DECLSPEC_EMPTY_BASES Optional + : public internal::OptionalBase +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + , public internal::CopyConstructible::value>, + public internal::MoveConstructible::value>, + public internal::CopyAssignable::value && + std::is_copy_assignable::value>, + public internal::MoveAssignable::value && + std::is_move_assignable::value> +#endif +{ + public: +#undef OPTIONAL_DECLSPEC_EMPTY_BASES + + typedef T value_type; + + // Defer default/copy/move constructor implementation to OptionalBase. + CONSTEXPR Optional() {} + CONSTEXPR Optional(const Optional& other) : internal::OptionalBase(other) {} + + CONSTEXPR Optional(nullopt_t) {} // NOLINT(runtime/explicit) + + // Converting copy constructor. "explicit" only if + // std::is_convertible::value is false. It is implemented by + // declaring two almost same constructors, but that condition in enable_if_t + // is different, so that either one is chosen, thanks to SFINAE. + template + Optional(const Optional& other) : internal::OptionalBase(other) {} + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + // Converting move constructor. Similar to converting copy constructor, + // declaring two (explicit and non-explicit) constructors. + template + Optional(Optional&& other) : internal::OptionalBase(std::move(other)) {} + + template + CONSTEXPR explicit Optional(in_place_t, Args&&... args) + : internal::OptionalBase(in_place, std::forward(args)...) {} + + template + CONSTEXPR explicit Optional(in_place_t, + std::initializer_list il, + Args&&... args) + : internal::OptionalBase(in_place, il, std::forward(args)...) {} +#else + CONSTEXPR explicit Optional(in_place_t, const T& _value) + : internal::OptionalBase(in_place, _value) {} + template + CONSTEXPR explicit Optional(in_place_t, + const U il[], + const T& _value) + : internal::OptionalBase(in_place, il, _value) {} +#endif + + // Forward value constructor. Similar to converting constructors, + // conditionally explicit. +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + CONSTEXPR Optional(U&& value) + : internal::OptionalBase(in_place, std::forward(value)) {} +#else + template + CONSTEXPR Optional(const U& value) + : internal::OptionalBase(in_place, value) {} +#endif + + ~Optional() {} + + // Defer copy-/move- assign operator implementation to OptionalBase. + Optional& operator=(const Optional& other) { + if (&other == this) { + return *this; + } + + internal::OptionalBase::operator=(other); + return *this; + } + + Optional& operator=(nullopt_t) { + FreeIfNeeded(); + return *this; + } + + // Perfect-forwarded assignment. + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + Optional& operator=(U&& value) { + InitOrAssign(std::forward(value)); + return *this; + } +#else + Optional& operator=(const U& value) { + InitOrAssign(value); + return *this; + } +#endif + + // Copy assign the state of other. + template + Optional& operator=(const Optional& other) { + CopyAssign(other); + return *this; + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + // Move assign the state of other. + template + Optional& operator=(Optional&& other) { + MoveAssign(std::move(other)); + return *this; + } +#endif + + const T* operator->() const { + return &storage_.value_; + } + + T* operator->() { + return &storage_.value_; + } + + const T& operator*() const { + return storage_.value_; + } + + T& operator*() { + return storage_.value_; + } + + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR explicit operator bool() const { return storage_.is_populated_; } +#else + CONSTEXPR operator bool() const { return storage_.is_populated_; } +#endif + + CONSTEXPR bool has_value() const { return storage_.is_populated_; } + +#if 1 + const T& value() const { + return storage_.value_; + } + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR T value_or(U&& default_value) const { + // TODO(mlamouri): add the following assert when possible: + // static_assert(std::is_copy_constructible::value, + // "T must be copy constructible"); + static_assert(std::is_convertible::value, + "U must be convertible to T"); + return storage_.is_populated_ + ? value() + : static_cast(std::forward(default_value)); + } +#else + CONSTEXPR T value_or(const U& default_value) const { + return storage_.is_populated_ + ? value() + : static_cast(default_value); + } +#endif +#else + const T& value() const & { + return storage_.value_; + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + const T&& value() const && { + return std::move(storage_.value_); + } +#endif + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR T value_or(U&& default_value) const & { + // TODO(mlamouri): add the following assert when possible: + // static_assert(std::is_copy_constructible::value, + // "T must be copy constructible"); + static_assert(std::is_convertible::value, + "U must be convertible to T"); + return storage_.is_populated_ + ? value() + : static_cast(std::forward(default_value)); + } +#else + CONSTEXPR T value_or(const U& default_value) const & { + // TODO(mlamouri): add the following assert when possible: + // static_assert(std::is_copy_constructible::value, + // "T must be copy constructible"); + static_assert(std::is_convertible::value, + "U must be convertible to T"); + return storage_.is_populated_ + ? value() + : static_cast(default_value); + } +#endif + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + CONSTEXPR T value_or(U&& default_value) const && { + // TODO(mlamouri): add the following assert when possible: + // static_assert(std::is_move_constructible::value, + // "T must be move constructible"); + static_assert(std::is_convertible::value, + "U must be convertible to T"); + return storage_.is_populated_ + ? std::move(value()) + : static_cast(std::forward(default_value)); + } +#endif +#endif // 1 + + void swap(Optional& other) { + if (!storage_.is_populated_ && !other.storage_.is_populated_) + return; + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + if (storage_.is_populated_ != other.storage_.is_populated_) { + if (storage_.is_populated_) { + other.storage_.Init(std::move(storage_.value_)); + FreeIfNeeded(); + } else { + storage_.Init(std::move(other.storage_.value_)); + other.FreeIfNeeded(); + } + return; + } +#endif + using std::swap; + swap(**this, *other); + } + + void reset() { FreeIfNeeded(); } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + T& emplace(Args&&... args) { + FreeIfNeeded(); + storage_.Init(std::forward(args)...); + return storage_.value_; + } + + template + T& emplace(std::initializer_list il, Args&&... args) { + FreeIfNeeded(); + storage_.Init(il, std::forward(args)...); + return storage_.value_; + } +#else + T& emplace(const T& _value) { + FreeIfNeeded(); + storage_.Init(_value); + return storage_.value_; + } + template + T& emplace(const U il[], const T& _value) { + FreeIfNeeded(); + storage_.Init(il, _value); + return storage_.value_; + } +#endif + + private: + // Accessing template base class's protected member needs explicit + // declaration to do so. + using internal::OptionalBase::CopyAssign; + using internal::OptionalBase::FreeIfNeeded; + using internal::OptionalBase::InitOrAssign; +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + using internal::OptionalBase::MoveAssign; +#endif + using internal::OptionalBase::storage_; +}; + +// Here after defines comparation operators. The definition follows +// http://en.cppreference.com/w/cpp/utility/optional/operator_cmp +// while bool() casting is replaced by has_value() to meet the chromium +// style guide. +template +bool operator==(const Optional& lhs, const Optional& rhs) { + if (lhs.has_value() != rhs.has_value()) + return false; + if (!lhs.has_value()) + return true; + return *lhs == *rhs; +} + +template +bool operator!=(const Optional& lhs, const Optional& rhs) { + if (lhs.has_value() != rhs.has_value()) + return true; + if (!lhs.has_value()) + return false; + return *lhs != *rhs; +} + +template +bool operator<(const Optional& lhs, const Optional& rhs) { + if (!rhs.has_value()) + return false; + if (!lhs.has_value()) + return true; + return *lhs < *rhs; +} + +template +bool operator<=(const Optional& lhs, const Optional& rhs) { + if (!lhs.has_value()) + return true; + if (!rhs.has_value()) + return false; + return *lhs <= *rhs; +} + +template +bool operator>(const Optional& lhs, const Optional& rhs) { + if (!lhs.has_value()) + return false; + if (!rhs.has_value()) + return true; + return *lhs > *rhs; +} + +template +bool operator>=(const Optional& lhs, const Optional& rhs) { + if (!rhs.has_value()) + return true; + if (!lhs.has_value()) + return false; + return *lhs >= *rhs; +} + +template +CONSTEXPR bool operator==(const Optional& opt, nullopt_t) { + return !opt; +} + +template +CONSTEXPR bool operator==(nullopt_t, const Optional& opt) { + return !opt; +} + +template +CONSTEXPR bool operator!=(const Optional& opt, nullopt_t) { + return opt.has_value(); +} + +template +CONSTEXPR bool operator!=(nullopt_t, const Optional& opt) { + return opt.has_value(); +} + +template +CONSTEXPR bool operator<(const Optional& , nullopt_t) { + return false; +} + +template +CONSTEXPR bool operator<(nullopt_t, const Optional& opt) { + return opt.has_value(); +} + +template +CONSTEXPR bool operator<=(const Optional& opt, nullopt_t) { + return !opt; +} + +template +CONSTEXPR bool operator<=(nullopt_t, const Optional& ) { + return true; +} + +template +CONSTEXPR bool operator>(const Optional& opt, nullopt_t) { + return opt.has_value(); +} + +template +CONSTEXPR bool operator>(nullopt_t, const Optional& ) { + return false; +} + +template +CONSTEXPR bool operator>=(const Optional& , nullopt_t) { + return true; +} + +template +CONSTEXPR bool operator>=(nullopt_t, const Optional& opt) { + return !opt; +} + +template +CONSTEXPR bool operator==(const Optional& opt, const U& value) { + return opt.has_value() ? *opt == value : false; +} + +template +CONSTEXPR bool operator==(const U& value, const Optional& opt) { + return opt.has_value() ? value == *opt : false; +} + +template +CONSTEXPR bool operator!=(const Optional& opt, const U& value) { + return opt.has_value() ? *opt != value : true; +} + +template +CONSTEXPR bool operator!=(const U& value, const Optional& opt) { + return opt.has_value() ? value != *opt : true; +} + +template +CONSTEXPR bool operator<(const Optional& opt, const U& value) { + return opt.has_value() ? *opt < value : true; +} + +template +CONSTEXPR bool operator<(const U& value, const Optional& opt) { + return opt.has_value() ? value < *opt : false; +} + +template +CONSTEXPR bool operator<=(const Optional& opt, const U& value) { + return opt.has_value() ? *opt <= value : true; +} + +template +CONSTEXPR bool operator<=(const U& value, const Optional& opt) { + return opt.has_value() ? value <= *opt : false; +} + +template +CONSTEXPR bool operator>(const Optional& opt, const U& value) { + return opt.has_value() ? *opt > value : false; +} + +template +CONSTEXPR bool operator>(const U& value, const Optional& opt) { + return opt.has_value() ? value > *opt : true; +} + +template +CONSTEXPR bool operator>=(const Optional& opt, const U& value) { + return opt.has_value() ? *opt >= value : false; +} + +template +CONSTEXPR bool operator>=(const U& value, const Optional& opt) { + return opt.has_value() ? value >= *opt : true; +} + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +template +CONSTEXPR Optional make_optional(Args&&... args) { + return Optional(in_place, std::forward(args)...); +} + +template +CONSTEXPR Optional make_optional(std::initializer_list il, + Args&&... args) { + return Optional(in_place, il, std::forward(args)...); +} +#endif + +// Partial specialization for a function template is not allowed. Also, it is +// not allowed to add overload function to std namespace, while it is allowed +// to specialize the template in std. Thus, swap() (kind of) overloading is +// defined in base namespace, instead. +template +void swap(Optional& lhs, Optional& rhs) { + lhs.swap(rhs); +} + +} // namespace agora + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +namespace std { +template +struct hash > { + size_t operator()(const agora::Optional& opt) const { + return opt == agora::nullopt ? 0 : std::hash()(*opt); + } +}; +} // namespace std +#endif +#undef CONSTEXPR +#undef NOEXCEPT diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRefCountedObject.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRefCountedObject.h new file mode 100644 index 0000000..a457ef7 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRefCountedObject.h @@ -0,0 +1,129 @@ + +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. +#pragma once + +#include "AgoraRefPtr.h" +#include "AgoraAtomicOps.h" + +#ifndef OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER agora::RefCountReleaseStatus:: +#else +#define OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER +#endif +#endif +namespace agora { + +class RefCounter { + public: + explicit RefCounter(int ref_count) : ref_count_(ref_count) {} + + void IncRef() { AtomicOps::Increment(&ref_count_); } + + /** + * Returns true if this was the last reference, and the resource protected by + * the reference counter can be deleted. + */ + agora::RefCountReleaseStatus DecRef() { + return (AtomicOps::Decrement(&ref_count_) == 0 + ? OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER kDroppedLastRef + : OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER kOtherRefsRemained); + } + + /** + * Return whether the reference count is one. If the reference count is used + * in the conventional way, a reference count of 1 implies that the current + * thread owns the reference and no other thread shares it. This call performs + * the test for a reference count of one, and performs the memory barrier + * needed for the owning thread to act on the resource protected by the + * reference counter, knowing that it has exclusive access. + */ + bool HasOneRef() const { return (AtomicOps::AcquireLoad(&ref_count_) == 1); } + + private: + RefCounter(); + + private: + volatile int ref_count_; +}; + +/** + * Agora sample code for wrapping a class that needs to inherit from RefCountInterface in order + * to be held by agora::agora_refptr + * Usage: + * agora::agora_refptr ptr = new RefCountedObject(Arg1, Arg2, ...); + */ + +template +class RefCountedObject : public T { + public: + RefCountedObject(): ref_count_(0) {} + + template +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + explicit RefCountedObject(P0&& p0) : T(std::forward(p0)), ref_count_(0) {} +#else + explicit RefCountedObject(const P0& p0) : T(p0), ref_count_(0) {} +#endif + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + template + RefCountedObject(P0&& p0, P1&& p1, Args&&... args) + : T(std::forward(p0), + std::forward(p1), + std::forward(args)...), + ref_count_(0) {} +#endif + + virtual void AddRef() const { ref_count_.IncRef(); } + + virtual agora::RefCountReleaseStatus Release() const { + const agora::RefCountReleaseStatus status = ref_count_.DecRef(); + if (status == OPTIONAL_REFCOUNTRELEASESTATUS_SPECIFIER kDroppedLastRef) { + delete this; + } + return status; + } + + /** + * Return whether the reference count is one. If the reference count is used + * in the conventional way, a reference count of 1 implies that the current + * thread owns the reference and no other thread shares it. This call + * performs the test for a reference count of one, and performs the memory + * barrier needed for the owning thread to act on the object, knowing that it + * has exclusive access to the object. + */ + virtual bool HasOneRef() const { return ref_count_.HasOneRef(); } + + protected: + virtual ~RefCountedObject() {} + + private: + RefCountedObject(const RefCountedObject&); + RefCountedObject& operator=(const RefCountedObject&); + + protected: + mutable agora::RefCounter ref_count_; +}; + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +template +inline agora_refptr make_refptr(types&&... args) { + return agora_refptr(new RefCountedObject(std::forward(args)...)); +} +#else +template +inline agora_refptr make_refptr() { + return agora_refptr(new RefCountedObject()); +} +template +inline agora_refptr make_refptr(const P0& p0) { + return agora_refptr(new RefCountedObject(p0)); +} +#endif +} // namespace agora \ No newline at end of file diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRefPtr.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRefPtr.h new file mode 100644 index 0000000..97594cb --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRefPtr.h @@ -0,0 +1,156 @@ + +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once + +#include +#if !(__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)) +#include +#endif +#ifndef OPTIONAL_ENUM_CLASS +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_CLASS enum class +#else +#define OPTIONAL_ENUM_CLASS enum +#endif +#endif + +namespace agora { + +OPTIONAL_ENUM_CLASS RefCountReleaseStatus { kDroppedLastRef, kOtherRefsRemained }; + +// Interfaces where refcounting is part of the public api should +// inherit this abstract interface. The implementation of these +// methods is usually provided by the RefCountedObject template class, +// applied as a leaf in the inheritance tree. +class RefCountInterface { + public: + virtual void AddRef() const = 0; + virtual RefCountReleaseStatus Release() const = 0; + virtual bool HasOneRef() const = 0; + + // Non-public destructor, because Release() has exclusive responsibility for + // destroying the object. + protected: + virtual ~RefCountInterface() {} +}; + +template +class agora_refptr { + public: + agora_refptr() : ptr_(NULL) {} + + agora_refptr(T* p) : ptr_(p) { + if (ptr_) ptr_->AddRef(); + } + + template + agora_refptr(U* p) : ptr_(p) { + if (ptr_) ptr_->AddRef(); + } + + agora_refptr(const agora_refptr& r) : ptr_(r.get()) { + if (ptr_) ptr_->AddRef(); + } + + template + agora_refptr(const agora_refptr& r) : ptr_(r.get()) { + if (ptr_) ptr_->AddRef(); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + agora_refptr(agora_refptr&& r) : ptr_(r.move()) {} + + template + agora_refptr(agora_refptr&& r) : ptr_(r.move()) {} +#endif + + ~agora_refptr() { + reset(); + } + + T* get() const { return ptr_; } + operator bool() const { return (ptr_ != NULL); } + + T* operator->() const { return ptr_; } + T& operator*() const { return *ptr_; } + + // Returns the (possibly null) raw pointer, and makes the agora_refptr hold a + // null pointer, all without touching the reference count of the underlying + // pointed-to object. The object is still reference counted, and the caller of + // move() is now the proud owner of one reference, so it is responsible for + // calling Release() once on the object when no longer using it. + T* move() { + T* retVal = ptr_; + ptr_ = NULL; + return retVal; + } + + agora_refptr& operator=(T* p) { + if (ptr_ == p) return *this; + + if (p) p->AddRef(); + if (ptr_) ptr_->Release(); + ptr_ = p; + return *this; + } + + agora_refptr& operator=(const agora_refptr& r) { + return *this = r.get(); + } + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) + agora_refptr& operator=(agora_refptr&& r) { + agora_refptr(std::move(r)).swap(*this); + return *this; + } + + template + agora_refptr& operator=(agora_refptr&& r) { + agora_refptr(std::move(r)).swap(*this); + return *this; + } +#endif + + // For working with std::find() + bool operator==(const agora_refptr& r) const { return ptr_ == r.ptr_; } + + // For working with std::set + bool operator<(const agora_refptr& r) const { return ptr_ < r.ptr_; } + + void swap(T** pp) { + T* p = ptr_; + ptr_ = *pp; + *pp = p; + } + + void swap(agora_refptr& r) { swap(&r.ptr_); } + + void reset() { + if (ptr_) { + ptr_->Release(); + ptr_ = NULL; + } + } + + protected: + T* ptr_; +}; + +} // namespace agora + +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +namespace std { +template +struct hash> { + std::size_t operator()(const agora::agora_refptr& k) const { + return reinterpret_cast(k.get()); + } +}; +} // namespace std +#endif \ No newline at end of file diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcAudioSpectrumDelegate.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcAudioSpectrumDelegate.h new file mode 100644 index 0000000..865e208 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcAudioSpectrumDelegate.h @@ -0,0 +1,48 @@ +// +// AgoraRtcMediaPlayerProtocol.h +// AgoraRtcMediaPlayerProtocol +// +// Copyright (c) 2020 Agora. All rights reserved. +// + +#import +#import "AgoraObjects.h" + + +@protocol AgoraAudioSpectrumDelegate + +@optional +/** + * Reports the audio spectrum of audio recording. + * + * This callback reports the audio spectrum data of the audio recording at the moment + * in the channel. + * + * You can set the time interval of this callback using "enableAudioSpectrumMonitor". + * + * @param audioSpectrumData The audio spectrum data of audio recording. + * - true: Processed. + * - false: Not processed. + */ +- (BOOL)onLocalAudioSpectrum:(NSArray * _Nullable)audioSpectrumData NS_SWIFT_NAME(onLocalAudioSpectrum(_:)); +/** + * Reports the audio spectrum of remote user. + * + * This callback reports the IDs and audio spectrum data of the loudest speakers at the moment + * in the channel. + * + * You can set the time interval of this callback using "enableAudioSpectrumMonitor". + * + * @param AudioSpectrumInfo The pointer to AudioSpectrumInfo, which is an array containing + * the user ID and audio spectrum data for each speaker. + * - This array contains the following members: + * - `uid`, which is the UID of each remote speaker + * - `audioSpectrumData`, which reports the audio spectrum of each remote speaker. + * - `spectrumDataLength`, the length of audio spectrum data. + * - true: Processed. + * - false: Not processed. + */ +- (BOOL)onRemoteAudioSpectrum:(NSArray * _Nullable)AudioSpectrumInfo NS_SWIFT_NAME(onRemoteAudioSpectrum(_:)); + + +@end diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineDelegate2.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineDelegate2.h new file mode 100644 index 0000000..f9d0de4 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineDelegate2.h @@ -0,0 +1,467 @@ +// +// AgoraRtcEngineKit2.h +// AgoraRtcEngineKit +// +// Created by Sting Feng on 2015-8-11. +// Copyright (c) 2015 Agora. All rights reserved. +// + +#import "AgoraBaseDelegate.h" +#import "AgoraEnumerates.h" + +@class AgoraRtcEngineKit; + +@protocol AgoraRtcEngineDelegate2 +@optional + +#pragma mark Local user common delegates +/** + * Event of the user joined the channel. + * + * @param engine The engine kit + * @param channelId The channel name + * @param userId The remote user id + * @param elapsed The elapsed time (ms) from session beginning + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinChannel:(NSString * _Nonnull)channelId withUid:(NSString * _Nonnull)userId elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didJoinChannel:withUid:elapsed:)); + +/** + * Event of the user rejoined the channel + * + * @param engine The engine kit + * @param channelId The channel name + * @param userId The user id + * @param elapsed The elapsed time (ms) from session beginning + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRejoinChannel:(NSString * _Nonnull)channelId withUid:(NSString * _Nonnull)userId elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didRejoinChannel:withUid:elapsed:)); + +/** + * The network quality of local user. + * + * @param engine The engine kit + * @param userId The id of user + * @param txQuality The sending network quality + * @param rxQuality The receiving network quality + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine networkQuality:(NSString * _Nonnull)userId txQuality:(AgoraNetworkQuality)txQuality rxQuality:(AgoraNetworkQuality)rxQuality NS_SWIFT_NAME(rtcEngine(_:networkQuality:txQuality:rxQuality:)); + +#pragma mark Remote user common delegates +/** + * Event of remote user joined + * + * @param engine The engine kit + * @param userId The remote user id + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinedOfUid:(NSString * _Nonnull)userId elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didJoinedOfUid:elapsed:)); + +/** + * Event of remote user offlined + * + * @param engine The engine kit + * @param userId The remote user id + * @param reason Reason of user offline, quit, drop or became audience + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOfflineOfUid:(NSString * _Nonnull)userId reason:(AgoraUserOfflineReason)reason NS_SWIFT_NAME(rtcEngine(_:didOfflineOfUid:reason:)); + +/** + * receive custom data from remote user + * + * @param engine The engine kit + * @param userId The remote user id + * @param streamId The stream id + * @param data The user defined data + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine receiveStreamMessageFromUid:(NSString * _Nonnull)userId streamId:(NSInteger)streamId data:(NSData * _Nonnull)data NS_SWIFT_NAME(rtcEngine(_:receiveStreamMessageFromUid:streamId:data:)); + +/** + * the local user has not received the data stream from the other user within 5 seconds. + * + * @param engine The engine kit + * @param userId The remote user id + * @param streamId The stream id + * @param error The error code + * @param missed The number of lost messages + * @param cached The number of incoming cached messages when the data stream is interrupted + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurStreamMessageErrorFromUid:(NSString * _Nonnull)userId streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached NS_SWIFT_NAME(rtcEngine(_:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached:)); + +#pragma mark Local user audio delegates + +/** + * This callback indicates local audio stream state has changed. + * + * @param engine The engine kit + * @param state Stopped: The initial state + * Recording: The capturer starts successfully + * Encoding: The first video frame is successfully encoded + * Failed: The local video fails to start + * @param error OK: The local audio is normal + * Failure: No specified reason for the local audio failure. + * DeviceNoPermission: No permission to use the local audio device + * DeviceBusy: The microphone is in use + * RecordFailure: The local audio recording fails. Check whether the recording device is working properly + * EncodeFailure: The local audio encoding fails + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localAudioStateChanged:(AgoraAudioLocalState)state error:(AgoraAudioLocalError)error NS_SWIFT_NAME(rtcEngine(_:localAudioStateChanged:error:)); + +#pragma mark Remote user audio delegates + +/** The first audio frame received and decoded from the remote user. + + @param engine The AgoraRtcEngineKit object. + @param userId Remote user ID. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteAudioFrameOfUid:(NSString * _Nonnull)userId elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameOfUid:elapsed:)); + +/** Occurs when the SDK decodes the first remote audio frame for playback. + + **Deprecated** . Use `AgoraAudioRemoteStateDecoding(2)` in the [remoteAudioStateChangedOfUid]([AgoraRtcEngineDelegate rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:]) callback instead. + + This callback is triggered in either of the following scenarios: + + - The remote user joins the channel and sends the audio stream. + - The remote user stops sending the audio stream and re-sends it after 15 seconds. Reasons for such an interruption include: + + - The remote user leaves channel. + - The remote user drops offline. + - The remote user calls the [muteLocalAudioStream]([AgoraRtcEngineKit muteLocalAudioStream:]) method to stop sending the local audio stream. + - The remote user calls the [disableAudio]([AgoraRtcEngineKit disableAudio]) method to disable audio. + + @param engine AgoraRtcEngineKit object. + @param uid User ID of the remote user sending the audio stream. + @param elapsed The time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine firstRemoteAudioFrameDecodedOfUid:(NSString * _Nonnull)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameDecodedOfUid:elapsed:)); + + +/** + * This callback indicates remote audio stream state has changed. + * + * @param engine The engine kit + * @param userId The user id + * @param state Stopped // The remote audio stopped, default state, audio is started or remote user disabled/muted audio stream. + * Starting // The first remote audio packet is received. + * Decoding // The remote audio stream is decoded and plays normally. + * Frozen // The remote audio is frozen. + * Failed // The remote audio fails to start. + * @param reason Interal // Internal reasons. + * NetworkCongestion // Network congestion. + * NetworkRecovery // Network recovery. + * LocalMuted // The local user stops receiving the remote audio stream or disables the audio module. + * LocalUnmuted // The local user resumes receiving the remote audio stream or enables the audio module. + * RemoteMuted // The remote user stops sending the audio stream or disables the audio module. + * RemoteUnmuted // The remote user resumes sending the audio stream or enables the audio module. + * Offline // The remote user leaves the channel. + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteAudioStateChangedOfUid:(NSString * _Nonnull)userId state:(AgoraAudioRemoteState)state reason:(AgoraAudioRemoteReason)reason elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:remoteAudioStateChangedOfUid:state:reason:elapsed:)); + +/** + * The sdk reports who is active speaker in the channel + * + * @param engine The engine kit + * @param speakerUid The speaker who is talking + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine activeSpeaker:(NSString * _Nonnull)speakerUid NS_SWIFT_NAME(rtcEngine(_:activeSpeaker:)); + +/** + * The audio quality of the user. updated every two seconds. + * + * @param engine The engine kit + * @param userId The id of user + * @param quality The audio quality + * @param delay The delay from the remote user + * @param lost The percentage of lost packets + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine audioQualityOfUid:(NSString * _Nonnull)userId quality:(AgoraNetworkQuality)quality delay:(NSUInteger)delay lost:(NSUInteger)lost NS_SWIFT_NAME(rtcEngine(_:audioQualityOfUid:quality:delay:lost:)); + +/** + * Occurs when the audio subscribe state changed. + * + * @param channelId The channel name of user joined. + * @param uid The remote user ID that is subscribed to. + * @param oldState The old state of the audio stream subscribe : #AgoraStreamSubscribeState. + * @param newState The new state of the audio stream subscribe : #AgoraStreamSubscribeState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioSubscribeStateChange:(NSString * _Nonnull)channelId + uid:(unsigned int)uid + oldState:(AgoraStreamSubscribeState)oldState + newState:(AgoraStreamSubscribeState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didAudioSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:)); + +/** + * Occurs when the audio publish state changed. + * + * @param channelId The channel name of user joined. + * @param oldState The old state of the audio stream publish : #AgoraStreamPublishState. + * @param newState The new state of the audio stream publish : #AgoraStreamPublishState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioPublishStateChange:(NSString * _Nonnull)channelId + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didAudioPublishStateChange:oldState:newState:elapseSinceLastState:)); + +#pragma mark Remote user video delegates +/** + * Event of the first frame of remote user is decoded successfully. + * + * @param engine The engine kit + * @param userId The remote user id + * @param size The size of video stream + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoDecodedOfUid:(NSString * _Nonnull)userId size:(CGSize)size elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteVideoDecodedOfUid:size:elapsed:)); + +/** + * Event of the first frame of remote user is rendering on the screen. + * + * @param engine The engine kit + * @param userId The remote user id + * @param size The size of video stream + * @param elapsed The elapsed time(ms) from the beginning of the session. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoFrameOfUid:(NSString * _Nonnull)userId size:(CGSize)size elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteVideoFrameOfUid:size:elapsed:)); + +/** Occurs when the local or remote video size or rotation has changed. + * + * @param engine AgoraRtcEngineKit object. + * @param sourceType The video source type. + * @param uid The user ID. 0 indicates the local user. + * @param size Size of the video (width and height) in pixels. + * @param rotation The rotation information of the video. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfSourceType:(AgoraVideoSourceType)sourceType uid:(NSString * _Nonnull)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOf:uid:size:rotation:)); +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine contentInspectResult:(AgoraContentInspectResult)result NS_SWIFT_NAME(rtcEngine(_:contentInspectResult:)); +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine snapshotTaken:(NSUInteger)uid filePath:(NSString* _Nonnull)filePath width:(NSInteger)width height:(NSInteger)height errCode:(NSInteger)errCode NS_SWIFT_NAME(rtcEngine(_:snapshotTaken:filePath:width:height:errCode:)); + +/** + * @technical preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine audioMetadataReceived:(NSString * _Nonnull)userId metadata:(NSData * _Nonnull)metadata NS_SWIFT_NAME(rtcEngine(_:audioMetadataReceived:metadata:)); +/** Occurs when the local video stream state changes + * + * This callback indicates the state of the local video stream, including camera capturing and video encoding, + * and allows you to troubleshoot issues when exceptions occur. + * + * @note For some device models, the SDK will not trigger this callback when the state of the local video changes + * while the local video capturing device is in use, so you have to make your own timeout judgment. + * @param engine AgoraRtcEngineKit object + * @param state State type #AgoraVideoLocalState. When the state is AgoraVideoLocalStateFailed (3), see the `error` parameter for details. + * @param error The detailed error information: #AgoraLocalVideoStreamError. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStateChangedOfState:(AgoraVideoLocalState)state + error:(AgoraLocalVideoStreamError)error + sourceType:(AgoraVideoSourceType)source NS_SWIFT_NAME(rtcEngine(_:localVideoStateChangedOf:error:sourceType:)); + +/** + * This callback indicates remote video stream state has changed. + * + * @param engine The engine kit + * @param userId The user id + * @param state Stopped // Default state, video is started or remote user disabled/muted video stream + Running // Running state, remote video can be displayed normally + Frozen // Remote video is frozen, probably due to network issue. + * @param reason Interal // Internal reasons. + * NetworkCongestion // Network congestion. + * NetworkRecovery // Network recovery. + * LocalMuted // The local user stops receiving the remote audio stream or disables the audio module. + * LocalUnmuted // The local user resumes receiving the remote audio stream or enables the audio module. + * RemoteMuted // The remote user stops sending the audio stream or disables the audio module. + * RemoteUnmuted // The remote user resumes sending the audio stream or enables the audio module. + * Offline // The remote user leaves the channel. + * AudioFallback //The remote media stream falls back to the audio-only stream due to poor network conditions. + * AudioFallbackRecovery // The remote media stream switches back to the video stream after the network conditions improve. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStateChangedOfUid:(NSString * _Nonnull)userId state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteReason)reason elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:remoteVideoStateChangedOfUid:state:reason:elapsed:)); + +/** + * Event of remote user audio muted or unmuted + * + * @param engine The engine kit + * @param muted Muted or unmuted + * @param userId The remote user id + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didAudioMuted:(BOOL)muted byUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:didAudioMuted:byUid:)); + +/** + * Event of remote user video muted or unmuted + * + * @param engine The engine kit + * @param muted Muted or unmuted + * @param userId The remote user id + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didVideoMuted:(BOOL)muted byUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:didVideoMuted:byUid:)); + +/** + * Event of remote user video enabled or disabled + * + * @param engine The engine kit + * @param enabled Enabled or disabled + * @param userId The remote user id + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didVideoEnabled:(BOOL)enabled byUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:didVideoEnabled:byUid:)); + +/** + * Event of remote user local video enabled or disabled + * + * @param engine The engine kit + * @param enabled Enabled or disabled + * @param userId The remote user id + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:didLocalVideoEnabled:byUid:)); + +/** + * Occurs when the remote user state is updated. + * + * @param engine The engine kit + * @param userId The remote user id + * @param state The remote user state + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteUserStateChangedOfUid:(NSString * _Nonnull)userId state:(NSUInteger)state NS_SWIFT_NAME(rtcEngine(_:remoteUserStateChangedOfUid:state:)); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine publishingRequestReceivedFromUid:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:publishingRequestReceivedFromUid:)); +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine publishingRequestAnsweredByOwner:(NSString * _Nonnull)userId accepted:(BOOL)accepted error:(AgoraErrorCode)error NS_SWIFT_NAME(rtcEngine(_:publishingRequestAnsweredByOwner:accepted:error:)); +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine unpublishingRequestReceivedFromOwner:(NSString * _Nonnull)userId NS_SWIFT_NAME(rtcEngine(_:unpublishingRequestReceivedFromOwner:)); +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamInjectedStatusOfUrl:(NSString * _Nonnull)url uid:(NSString * _Nonnull)userId status:(AgoraInjectStreamStatus)status NS_SWIFT_NAME(rtcEngine(_:streamInjectedStatusOfUrl:uid:status:)); + +/** Intra request received. + * @param engine The AgoraRtcEngineKit object. +*/ +- (void)rtcEngineIntraRequestReceived:(AgoraRtcEngineKit *_Nonnull)engine NS_SWIFT_NAME(rtcEngineIntraRequestReceived(_:)); + +/** Target bitrate updated. + * @param engine The AgoraRtcEngineKit object. + * @param bweInfo The uplink network info, including target bitrate bps. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine uplinkNetworkInfoUpdate:(AgoraUplinkNetworkInfo *_Nonnull)bweInfo NS_SWIFT_NAME(rtcEngine(_:uplinkNetworkInfoUpdate:)); + +/** Downlink network info updated. + * @param engine The AgoraRtcEngineKit object. + * @param networkInfo The downlink network info. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine downlinkNetworkInfoUpdate:(AgoraDownlinkNetworkInfo *_Nonnull)networkInfo NS_SWIFT_NAME(rtcEngine(_:downlinkNetworkInfoUpdate:)); + +#pragma mark Connection state delegates + +/** Occurs when the connection state of the SDK to the server is changed. + * + * @param state See #AgoraConnectionState. + * @param reason See #AgoraConnectionChangedReason. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine connectionChangedToState:(AgoraConnectionState)state reason:(AgoraConnectionChangedReason)reason NS_SWIFT_NAME(rtcEngine(_:connectionChangedTo:reason:)); + +/** + * Reports WIFI user message. + * When the user needs to be prompted to approach the AP or switch the frequency band connected to the AP, the SDK will trigger this callback to notify the APP. + * @param engine AgoraRtcEngineKit object. + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine wlAccMessage:(AgoraWlAccReason)reason action:(AgoraWlAccAction)action wlAccMsg:(NSString * _Nonnull)wlAccMsg NS_SWIFT_NAME(rtcEngine(_:wlAccMessage:action:wlAccMsg:)); + +/** + * Reports WIFI accelerate status. + * When the optimized end-to-end delay, frozen ratio and packet loss rate need to be displayed to the user, the SDK will trigger this callback to notify the APP. + * @param engine AgoraRtcEngineKit object. + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine wlAccStats:(AgoraWlAccStats * _Nonnull)currentStats averageStats:(AgoraWlAccStats * _Nonnull)averageStats NS_SWIFT_NAME(rtcEngine(_:wlAccStats:averageStats:)); + +/** + * Occurs when the connection state of the SDK to the server is changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param type See \ref AgoraNetworkType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine networkTypeChanged:(AgoraNetworkType)type NS_SWIFT_NAME(rtcEngine(_:networkTypeChanged:)); + +/** + * Occurs when permission error + * + * @param engine The AgoraRtcEngineKit object. + * @param type See \ref AgoraPermissionType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine permissionError:(AgoraPermissionType)type NS_SWIFT_NAME(rtcEngine(_:permissionError:)); + +/** Occurs when the state of the media stream relay changes. + + The SDK reports the state of the current media relay and possible error messages in this callback. + + @param engine AgoraRtcEngineKit object. + @param state The state code in [AgoraChannelMediaRelayState](AgoraChannelMediaRelayState). + @param error The error code in [AgoraChannelMediaRelayError](AgoraChannelMediaRelayError). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine +channelMediaRelayStateDidChange:(AgoraChannelMediaRelayState)state + error:(AgoraChannelMediaRelayError)error NS_SWIFT_NAME(rtcEngine(_:channelMediaRelayStateDidChange:error:)); + +/** Reports events during the media stream relay. + + @param engine AgoraRtcEngineKit object. + @param event The event code in [AgoraChannelMediaRelayEvent](AgoraChannelMediaRelayEvent). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine +didReceiveChannelMediaRelayEvent:(AgoraChannelMediaRelayEvent)event NS_SWIFT_NAME(rtcEngine(_:didReceive:)); + +/** Occurs when the video subscribe state changed. + * + * @param engine AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param uid The remote user ID that is subscribed to. + * @param oldState The old state of the video stream subscribe : #AgoraStreamSubscribeState. + * @param newState The new state of the video stream subscribe : #AgoraStreamSubscribeState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoSubscribeStateChange:(NSString * _Nonnull)channelId + uid:(unsigned int)uid + oldState:(AgoraStreamSubscribeState)oldState + newState:(AgoraStreamSubscribeState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:)); + +/** + * Occurs when the video publish state changed. + * + * @param engine AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param oldState The old state of the video stream publish : #AgoraStreamPublishState. + * @param newState The new state of the video stream publish : #AgoraStreamPublishState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoPublishStateChange:(NSString * _Nonnull)channelId +sourceType:(AgoraVideoSourceType)source + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState:)); + +#pragma mark Rhythm Player Delegates Methods + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRhythmPlayerStateChanged:(AgoraRhythmPlayerState)state + errorCode:(AgoraRhythmPlayerError)errorCode NS_SWIFT_NAME(rtcEngine(_:didRhythmPlayerStateChanged:errorCode:)); + +#pragma mark Local Video Transcoder Delegates Methods +/** + * Occurs when local video transcoder stream has error. + * + * @param stream Stream type of AgoraTranscodingVideoStream. + * @param error Error code of AgoraVideoTranscoderError. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoTranscoderErrorWithStream:(AgoraTranscodingVideoStream * _Nonnull )stream + errorCode:(AgoraVideoTranscoderError)errorCode NS_SWIFT_NAME(rtcEngine(_:didLocalVideoTranscoderErrorWithStream:errorCode:)); + +#pragma mark Remote Video Layout Info Delegates Methods +/** + * Occurs when local video transcoder stream has error. + * + * @param uid The ID of the remote user. + * @param videoLayoutInfo The `AgoraVideoLayoutInfo` object that contains video layout info of the remote user.. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didTranscodedStreamLayoutInfoUpdatedWithUserId:(NSUInteger)uid videoLayoutInfo:(AgoraVideoLayoutInfo* _Nonnull)videoLayoutInfo NS_SWIFT_NAME(rtcEngine(_:didTranscodedStreamLayoutInfoUpdatedWithUserId:videoLayoutInfo:)); + +@end diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineKit.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineKit.h new file mode 100644 index 0000000..43b21d8 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineKit.h @@ -0,0 +1,7464 @@ +// +// AgoraRtcEngineKit.h +// AgoraRtcEngineKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#import +#import "AgoraConstants.h" +#import "AgoraObjects.h" +#import "AgoraRtcEngineDelegate2.h" +#import "AgoraBaseDelegate.h" +#import "AgoraRtcMediaPlayerProtocol.h" + +/** Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through a virtual global network that is especially optimized for real-time web and mobile-to-mobile applications. + + The AgoraRtcEngineKit class is the entry point of the Agora SDK that provides simple APIs for applications to easily start voice and video communication. + */ +@class AgoraRtcEngineKit; + +/** + * The AgoraAudioFrameDelegate protocol enables audio frame callback event notifications to your application. + */ +@protocol AgoraAudioFrameDelegate +@optional + +/** + * Occurs when the recorded audio frame is received. + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @return + * - true: The recorded audio frame is valid and is encoded and sent. + * - false: The recorded audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onRecordAudioFrame:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onRecordAudioFrame(_:channelId:)); + +/** + * Occurs when the recorded audio frame is received. + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @return + * - true: The recorded audio frame is valid and is encoded and sent. + * - false: The recorded audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onPublishAudioFrame:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onPublishAudioFrame(_:channelId:)); + +/** + * Occurs when the playback audio frame is received. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @return + * - true: The playback audio frame is valid and is encoded and sent. + * - false: The playback audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onPlaybackAudioFrame:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onPlaybackAudioFrame(_:channelId:)); + +/** + * Occurs when the mixed audio data is received. + * @param frame The A pointer to the audio frame: AgoraAudioFrame. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @return + * - true: The mixed audio data is valid and is encoded and sent. + * - false: The mixed audio data is invalid and is not encoded or sent. + */ +- (BOOL)onMixedAudioFrame:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onMixedAudioFrame(_:channelId:)); + +/** + * Occurs when the ear monitoring audio frame is received. + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @return + * - true: The ear monitoring audio frame is valid and is encoded and sent. + * - false: The ear monitoring audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onEarMonitoringAudioFrame:(AgoraAudioFrame* _Nonnull)frame NS_SWIFT_NAME(onEarMonitoringAudioFrame(_:)); + +/** + * Occurs when the before-mixing playback audio frame is received. + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid ID of the remote user. + * @param frame A pointer to the audio frame: AgoraAudioFrame. + * @return + * - true: The before-mixing playback audio frame is valid and is encoded and sent. + * - false: The before-mixing playback audio frame is invalid and is not encoded or sent. + */ +- (BOOL)onPlaybackAudioFrameBeforeMixing:(AgoraAudioFrame* _Nonnull)frame channelId:(NSString * _Nonnull)channelId uid:(NSUInteger)uid NS_SWIFT_NAME(onPlaybackAudioFrame(beforeMixing:channelId:uid:)); + +/** + Sets the frame position for the audio observer. + * @return A bit mask that controls the frame position of the audio observer. + * @note - Use '|' (the OR operator) to observe multiple frame positions. + *

    + * After you successfully register the audio observer, the SDK triggers this callback each time it receives a audio frame. You can determine which position to observe by setting the return value. + * The SDK provides 4 positions for observer. Each position corresponds to a callback function: + * - `AgoraAudioFramePositionPlayback (1 << 0)`: The position for playback audio frame is received, which corresponds to the \ref onPlaybackFrame "onPlaybackFrame" callback. + * - `AgoraAudioFramePositionRecord (1 << 1)`: The position for record audio frame is received, which corresponds to the \ref onRecordFrame "onRecordFrame" callback. + * - `AgoraAudioFramePositionMixed (1 << 2)`: The position for mixed audio frame is received, which corresponds to the \ref onMixedFrame "onMixedFrame" callback. + * - `AgoraAudioFramePositionBeforeMixing (1 << 3)`: The position for playback audio frame before mixing is received, which corresponds to the \ref onPlaybackFrameBeforeMixing "onPlaybackFrameBeforeMixing" callback. + * @return The bit mask that controls the audio observation positions. + See AgoraAudioFramePosition. + */ + +- (AgoraAudioFramePosition)getObservedAudioFramePosition NS_SWIFT_NAME(getObservedAudioFramePosition()); + +/** Sets the audio mixing format for the + [onMixedAudioFrame]([AgoraAudioFrameDelegate onMixedAudioFrame:]) callback. + + Register the `getMixedAudioParams` callback when calling the + [setAudioFrameDelegate]([AgoraRtcEngineKit setAudioFrameDelegate:]) method. After you + successfully register the audio delegate, the SDK triggers this callback each + time it receives an audio frame. You can set the audio mixing format in + the return value of this callback. + + **Note**: + + - The SDK calculates the sample interval according to the `AgoraAudioParams` + you set in the return value of this callback and triggers the + `onMixedAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ +- (AgoraAudioParams* _Nonnull)getMixedAudioParams NS_SWIFT_NAME(getMixedAudioParams()); + +/** Sets the audio recording format for the + [onRecordAudioFrame]([AgoraAudioFrameDelegate onRecordAudioFrame:]) + callback. + + Register the `getRecordAudioParams` callback when calling the + [setAudioFrameDelegate]([AgoraRtcEngineKit setAudioFrameDelegate:]) method. After you + successfully register the audio delegate, the SDK triggers this callback each + time it receives an audio frame. You can set the audio recording format in + the return value of this callback. + + **Note**: + + - This callback applies to iOS only. + - The SDK calculates the sample interval according to the `AgoraAudioParams` + you set in the return value of this callback and triggers the + `onRecordAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ +- (AgoraAudioParams* _Nonnull)getRecordAudioParams NS_SWIFT_NAME(getRecordAudioParams()); + + +- (AgoraAudioParams* _Nonnull)getPublishAudioParams NS_SWIFT_NAME(getPublishAudioParams()); +/** Sets the audio playback format for the + [onPlaybackAudioFrame]([AgoraAudioFrameDelegate onPlaybackAudioFrame:]) + callback. + + Register the `getPlaybackAudioParams` callback when calling the + [setAudioFrameDelegate]([AgoraRtcEngineKit setAudioFrameDelegate:]) method. After you + successfully register the audio delegate, the SDK triggers this callback each + time it receives an audio frame. You can set the audio playback format in + the return value of this callback. + + **Note**: + + - The SDK calculates the sample interval according to the `AgoraAudioParams` + you set in the return value of this callback and triggers the + `onPlaybackAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ +- (AgoraAudioParams* _Nonnull)getPlaybackAudioParams NS_SWIFT_NAME(getPlaybackAudioParams()); + +/** Sets the audio recording format for the + [onEarMonitoringAudioFrame]([AgoraAudioFrameDelegate onEarMonitoringAudioFrame:]) + callback. + + Register the `getEarMonitoringAudioParams` callback when calling the + [setAudioFrameDelegate]([AgoraRtcEngineKit setAudioFrameDelegate:]) method. After you + successfully register the audio delegate, the SDK triggers this callback each + time it receives an audio frame. You can set the audio recording format in + the return value of this callback. + + **Note**: + + - This callback applies to iOS only. + - The SDK calculates the sample interval according to the `AgoraAudioParams` + you set in the return value of this callback and triggers the + `onEarMonitoringAudioFrame` callback at the calculated sample interval. + Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`). + Ensure that the value of sample interval is equal to or greater than 0.01. + + @return Sets the audio format. See AgoraAudioParams. + */ +- (AgoraAudioParams* _Nonnull)getEarMonitoringAudioParams NS_SWIFT_NAME(getEarMonitoringAudioParams()); + +@end + +@protocol AgoraAudioEncodedFrameDelegate +@required + +/** + * Occurs when the record audio data is received. + */ +- (void)onRecordEncodedAudioFrame:(NSData* _Nonnull)frameData info:(AgoraEncodedAudioFrameInfo* _Nonnull)info NS_SWIFT_NAME(onRecordEncodedAudioFrame(_:info:)); + +/** + * Occurs when the playback audio data is received. + */ +- (void)onPlaybackEncodedAudioFrame:(NSData* _Nonnull)frameData info:(AgoraEncodedAudioFrameInfo* _Nonnull)info NS_SWIFT_NAME(onPlaybackEncodedAudioFrame(_:info:)); + +/** + * Occurs when the mixed audio data is received. + */ +- (void)onMixedEncodedAudioFrame:(NSData* _Nonnull)frameData info:(AgoraEncodedAudioFrameInfo* _Nonnull)info NS_SWIFT_NAME(onMixedEncodedAudioFrame(_:info:)); +/** + * Occurs when the publish audio data is received. + */ +- (void)onPublishEncodedAudioFrame:(NSData* _Nonnull)frameData info:(AgoraEncodedAudioFrameInfo* _Nonnull) info; +@end + +@protocol AgoraEncodedVideoFrameDelegate +@optional + +/** + * Occurs when get H264 video data interface before decoding + */ + +- (BOOL)onEncodedVideoFrameReceived:(NSData * _Nonnull )videoData length:(size_t)length info:(AgoraEncodedVideoFrameInfo * _Nonnull)videoFrameInfo NS_SWIFT_NAME(onEncodedVideoFrameReceived(_:length:info:)); +@end + +@protocol AgoraVideoFrameDelegate +@optional + +/** + * Occurs each time the SDK receives a video frame captured by the local camera. + * Notes: If getVideoFrameProcessMode is read-only, use MUST implement this method + * + * After you successfully register the video frame observer, the SDK triggers this callback each time + * a video frame is received. In this callback, you can get the video data captured by the local + * camera. You can then pre-process the data according to your scenarios. + * + * After pre-processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @param videoFrame A pointer to the video frame: AgoraOutputVideoFrame + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ +- (BOOL)onCaptureVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame sourceType:(AgoraVideoSourceType)sourceType; + +/** + * Occurs each time the SDK receives a video frame before encoding. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time + * when it receives a video frame. In this callback, you can get the video data before encoding. You can then + * process the data according to your particular scenarios. + * + * After processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * The video data that this callback gets has been pre-processed, with its content cropped, rotated, and the image enhanced. + * + * @param videoFrame A pointer to the video frame: VideoFrame + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ +- (BOOL)onPreEncodeVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame sourceType:(AgoraVideoSourceType)sourceType; + + +- (BOOL)onTranscodedVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame NS_SWIFT_NAME(onTranscodedVideoFrame(_:)); + +/** + * Occurs each time the SDK receives a video frame sent by the remote user. + * + * After you successfully register the video frame observer, the SDK triggers this callback each time a + * video frame is received. In this callback, you can get the video data sent by the remote user. You + * can then post-process the data according to your scenarios. + * + * After post-processing, you can send the processed data back to the SDK by setting the `videoFrame` + * parameter in this callback. + * + * @param uid ID of the remote user who sends the current video frame. + * @param channelId Channel name. + * @param videoFrame A pointer to the video frame: AgoraOutputVideoFrame + * @return Determines whether to ignore the current video frame if the post-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ +- (BOOL)onRenderVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame uid:(NSUInteger)uid channelId:(NSString * _Nonnull)channelId NS_SWIFT_NAME(onRenderVideoFrame(_:uid:channelId:)); + +/** + * Occurs each time the SDK receives a video frame decoded by the MediaPlayer. + * + * After you successfully register the video frame observer, the SDK triggers this callback each + * time a video frame is decoded. In this callback, you can get the video data decoded by the + * MediaPlayer. You can then pre-process the data according to your scenarios. + * + * After pre-processing, you can send the processed video data back to the SDK by setting the + * `videoFrame` parameter in this callback. + * + * @note + * If the returned agora::media::base::VIDEO_PIXEL_DEFAULT format is specified by getVideoFormatPreference, + * the video frame you get through onMediaPlayerVideoFrame is in agora::media::base::VIDEO_PIXEL_I420 format. + * + * @param videoFrame A pointer to the video frame: AgoraOutputVideoFrame + * @param mediaPlayerId of the mediaPlayer. + * @return Determines whether to ignore the current video frame if the pre-processing fails: + * - true: Do not ignore. + * - false: Ignore, in which case this method does not sent the current video frame to the SDK. + */ +- (BOOL)onMediaPlayerVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame mediaPlayerId:(NSInteger)mediaPlayerId NS_SWIFT_NAME(onMediaPlayerVideoFrame(_:mediaPlayerId:)); + +/** + * Occurs each time needs to get rotation angle. + * @return rotation angle. + */ +- (BOOL)getRotationApplied NS_SWIFT_NAME(getRotationApplied()); + +/** + * Occurs each time needs to get whether mirror is applied or not. + * @return Determines whether to mirror. + * - true: need to mirror. + * - false: no mirror. + */ +- (BOOL)getMirrorApplied NS_SWIFT_NAME(getMirrorApplied()); + +/** + * Indicate the video frame mode of the observer. + * @return AgoraVideoFrameProcessMode + */ +- (AgoraVideoFrameProcessMode)getVideoFrameProcessMode NS_SWIFT_NAME(getVideoFrameProcessMode()); + +/** + * Occurs each time needs to get preference video frame type. + * @return AgoraVideoFormat. + */ +- (AgoraVideoFormat)getVideoFormatPreference NS_SWIFT_NAME(getVideoFormatPreference()); + +/** + * Sets the frame position for the video observer. + * + * After you successfully register the video observer, the SDK triggers this callback each time it receives + * a video frame. You can determine which position to observe by setting the return value. The SDK provides + * 3 positions for observer. Each position corresponds to a callback function: + * + * AgoraVideoFramePositionPostCapture(1 << 0): The position after capturing the video data, which corresponds to the onCaptureVideoFrame callback. + * AgoraVideoFramePositionPreRenderer(1 << 1): The position before receiving the remote video data, which corresponds to the onRenderVideoFrame callback. + * AgoraVideoFramePositionPreEncoder(1 << 2): The position before encoding the video data, which corresponds to the onPreEncodeVideoFrame callback. + * + * To observe multiple frame positions, use '|' (the OR operator). + * This callback observes AgoraVideoFramePositionPostCapture(1 << 0) and AgoraVideoFramePositionPreRenderer(1 << 1) by default. + * To conserve the system consumption, you can reduce the number of frame positions that you want to observe. + * + * @return A bit mask that controls the frame position of the video observer: AgoraVideoFramePosition. + */ +- (AgoraVideoFramePosition)getObservedFramePosition NS_SWIFT_NAME(getObservedFramePosition()); + +@end + +@protocol AgoraRtcMediaPlayerDelegate + +@optional + + +/** Reports the playback state change. + + @param playerKit AgoraRtcMediaPlayer + + @param state The new playback state after change. See AgoraMediaPlayerState. + + @param error The player's error code. See AgoraMediaPlayerError. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didChangedToState:(AgoraMediaPlayerState)state + error:(AgoraMediaPlayerError)error NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didChangedTo:error:)); + +/** Reports current playback progress. + + The callback occurs once every one second during the playback and reports + current playback progress. + + @param playerKit AgoraMediaPlayer + + @param positionMs Current playback progress (ms). + @param timestampMs The NTP timestamp (ms) when the position is sent. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didChangedToPosition:(NSInteger)positionMs + atTimestamp:(NSTimeInterval)timestampMs NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didChangedTo:atTimestamp:)); + +/** Reports the result of the seek operation. + + @param playerKit AgoraRtcMediaPlayer + @param eventCode AgoraMediaPlayerEvent + @param elapsedTime The playback elapsed time. + @param message NSString + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didOccurEvent:(AgoraMediaPlayerEvent)eventCode + elapsedTime:(NSInteger)elapsedTime + message:(NSString *_Nullable)message NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didOccur:elapsedTime:message:)); + +/** Reports the reception of the media metadata. + + The callback occurs when the player receivers the media metadata and reports + the detailed information of the media metadata. + + @param playerKit AgoraRtcMediaPlayer + + @param data The detailed data of the media metadata. + + @param length The length (byte) of the data. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didReceiveData:(NSString *_Nullable)data + length:(NSInteger)length NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didReceiveData:length:)); + +/** + * @brief Triggered when play buffer updated, once every 1 second + * + * @param playerKit AgoraRtcMediaPlayer + * @param playCachedBuffer NSInteger + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didPlayBufferUpdated:(NSInteger)playCachedBuffer NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didPlayBufferUpdated:)); + +/** + * @brief Triggered when the player preloadSrc + * + * @param playerKit AgoraRtcMediaPlayer + * @param event AgoraMediaPlayerPreloadEvent + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didPreloadEvent:(AgoraMediaPlayerPreloadEvent)event NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didPreloadEvent:)); + +/** + * @brief Reports current playback source bitrate changed. + * + * @param to Streaming media information after the change. + * @param from Streaming media information before the change. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit playerSrcInfoDidChange:(AgoraMediaPlayerSrcInfo *_Nonnull)to from:(AgoraMediaPlayerSrcInfo *_Nonnull)from NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:playerSrcInfoDidChange:from:)); + +/** + * @brief Triggered when media player information updated. + * + * @param info Include information of media player. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit infoUpdated:(AgoraMediaPlayerUpdatedInfo *_Nonnull)info NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:infoUpdated:)); + +/** + * @brief AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken(const char* + * src). + */ +- (void)onAgoraCDNTokenWillExpire NS_SWIFT_NAME(onAgoraCDNTokenWillExpire()); + +/** + * @brief Triggered when play volume updated, once every 200 millisecond + * + * @param volume volume of current player. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + volumeIndicationDidReceive:(NSInteger)volume NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:volumeIndicationDidReceive:)); +@end + + +@protocol AgoraRtcMediaPlayerVideoFrameDelegate +@optional +/** Occurs when each time the player receives a video frame. + + After registering the video frame observer, the callback occurs when each + time the player receives a video frame, reporting the detailed + information of the video frame. + + @param playerKit AgoraRtcMediaPlayer + + @param videoFrame The detailed information of the video frame. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didReceiveVideoFrame:(AgoraOutputVideoFrame * _Nonnull)videoFrame NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didReceiveVideoFrame:)); + +/** Occurs when each time the player receives a video frame. + + After registering the video frame observer, the callback occurs when each + time the player receives a video frame, reporting the detailed + information of the CVPixelBufferRef. + + @param playerKit AgoraRtcMediaPlayer + + @param pixelBuffer The detailed information of the CVPixelBufferRef. Format define by AgoraRtcMediaPlayerGetVideoPixelFormat. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didReceivePixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didReceivePixelBuffer:)); + +/** + * Occurs each time needs to get preference video frame type. + * @return AgoraVideoFormat. + */ +- (AgoraVideoFormat)AgoraRtcMediaPlayerGetVideoPixelFormat NS_SWIFT_NAME(AgoraRtcMediaPlayerGetVideoPixelFormat()); + +@end + + +@protocol AgoraRtcMediaPlayerAudioFrameDelegate + +/** Occurs when each time the player receives an audio frame. + + After registering the audio frame observer, the callback occurs when each + time the player receives an audio frame, reporting the detailed + information of the audio frame. + + @param playerKit AgoraRtcMediaPlayer + + @param audioFrame The detailed information of the audio frame. + */ +- (void)AgoraRtcMediaPlayer:(id _Nonnull)playerKit + didReceiveAudioFrame:(AgoraAudioFrame* _Nonnull)audioFrame NS_SWIFT_NAME(AgoraRtcMediaPlayer(_:didReceiveAudioFrame:)); + +@end + + +/** + * The event handler for direct cdn streaming + * + */ +@protocol AgoraDirectCdnStreamingEventDelegate + + @optional + +/** + * Event callback of direct cdn streaming + * @param state Current status + * @param error Error Code + * @param message Message + */ +- (void)onDirectCdnStreamingStateChanged:(AgoraDirectCdnStreamingState)state + error:(AgoraDirectCdnStreamingError)error + message:(NSString *_Nullable)message NS_SWIFT_NAME(onDirectCdnStreamingStateChanged(_:error:message:)); + +- (void)onDirectCdnStreamingStats:(AgoraDirectCdnStreamingStats *_Nonnull)stats NS_SWIFT_NAME(onDirectCdnStreamingStats(_:)); + +@end + +/** The definition of the AgoraMediaMetadataDataSource protocol. + * @note Implement all the callbacks in this protocol in the critical thread. We recommend avoiding any time-consuming + * operation in the critical thread. +*/ +@protocol AgoraMediaMetadataDataSource +@required + +/** Occurs when the SDK requests the maximum size of the metadata. +* +* After calling the \ref AgoraRtcEngineKit.setMediaMetadataDataSource:withType: setMediaMetadataDataSource method, +* the SDK triggers this callback to query the maximum size of your metadata. +* You must specify the maximum size in the return value and then pass it to the SDK. +* +* @return The maximum size (bytes) of the buffer of the metadata. See \ref AgoraMediaMetadataDataSource.readyToSendMetadataAtTimestamp: readyToSendMetadataAtTimestamp. The value must not exceed 1024 bytes. +* You must specify the maximum size in this return value. + */ +- (NSInteger)metadataMaxSize NS_SWIFT_NAME(metadataMaxSize()); + +/** Occurs when the SDK is ready to send metadata. + +You need to specify the metadata in the return value of this method. + + @note Ensure that the size of the metadata that you specify in this callback does not exceed the value set in the \ref AgoraMediaMetadataDataSource.metadataMaxSize metadataMaxSize callback. + @param timestamp The timestamp (ms) of the current metadata. + @return The metadata that you want to send in the format of NSData, including the following parameters: + - `uid`: ID of the user who sends the metadata. + - `size`: The size of the sent metadata. + - `buffer`: The sent metadata. + - `timeStampMs`: The NTP timestamp (ms) when the metadata is sent. + */ +- (NSData * _Nullable)readyToSendMetadataAtTimestamp:(NSTimeInterval)timestamp sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(readyToSendMetadata(atTimestamp:sourceType:)); + +@end + +/** The definition of AgoraMediaMetadataDelegate. +@note Implement the callback in this protocol in the critical thread. We recommend avoiding any time-consuming operation in the critical thread. +*/ +@protocol AgoraMediaMetadataDelegate +@required + +/** Occurs when the local user receives the metadata. + @param data The received metadata. + @param uid The ID of the user who sends the metadata. + @param timestamp The NTP timestamp (ms) when the metadata is sent. + @note If the receiver is audience, the receiver cannot get the NTP timestamp (ms) from `timestamp`. + */ +- (void)receiveMetadata:(NSData * _Nonnull)data fromUser:(NSInteger)uid atTimestamp:(NSTimeInterval)timestamp NS_SWIFT_NAME(receiveMetadata(_:fromUser:atTimestamp:)); + +@end + +/** + * The AgoraRtcEngineDelegate protocol enables callback event notifications to your application. + + The SDK uses delegate callbacks in the AgoraRtcEngineDelegate protocol to report runtime events to the application. + From v1.1, some block callbacks in the SDK are replaced with delegate callbacks. The old block callbacks are therefore deprecated, but can still be used in the current version. However, Agora recommends replacing block callbacks with delegate callbacks. The SDK calls the block callback if a callback is defined in both the block and delegate callbacks. + */ +@protocol AgoraRtcEngineDelegate +@optional + +#pragma mark Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Delegate Methods + + The SDK uses delegate callbacks in the AgoraRtcEngineDelegate protocol to report runtime events to the application. + From v1.1, some block callbacks in the SDK are replaced with delegate callbacks. The old block callbacks are therefore deprecated, but can still be used in the current version. However, Agora recommends replacing block callbacks with delegate callbacks. The SDK calls the block callback if a callback is defined in both the block and delegate callbacks. + * ----------------------------------------------------------------------------- + */ + +#pragma mark Core Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Core Delegate Methods + * ----------------------------------------------------------------------------- + */ +/** A warning occurred during SDK runtime. + + In most cases, the application can ignore the warnings reported by the SDK because the SDK can usually fix the issue and resume running. + For instance, the SDK may report an AgoraRtc_Error_OpenChannelTimeout(106) warning upon disconnection from the server and attempts to reconnect. + + @param engine AgoraRtcEngineKit object + @param warningCode AgoraWarningCode + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurWarning:(AgoraWarningCode)warningCode NS_SWIFT_NAME(rtcEngine(_:didOccurWarning:)); + +/** An error occurred during SDK runtime. + + In most cases, reporting an error means that the SDK cannot fix the issue and resume running, and therefore requires actions from the application or simply informs the user on the issue. + For instance, the SDK reports an AgoraErrorCodeStartCall = 1002 error when failing to initialize a call. In this case, the application informs the user that the call initialization failed and calls the \ref AgoraRtcEngineKit.leaveChannel: leaveChannel method to exit the channel. + + @param engine AgoraRtcEngineKit object + @param errorCode AgoraErrorCode + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurError:(AgoraErrorCode)errorCode NS_SWIFT_NAME(rtcEngine(_:didOccurError:)); + +/** The media engine loaded successfully. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineMediaEngineDidLoaded:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineMediaEngineDidLoaded(_:)); + +/** The media engine started successfully. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineMediaEngineDidStartCall:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineMediaEngineDidStartCall(_:)); + + +/** + * Occurs when the token has expired. + * + * If a token is specified when calling `joinChannelByToken`, + * the token expires after a certain period of time and you need a new token to + * reconnect to the server. + * + * Upon receiving this callback, generate a new token at your app server and + * call \ref AgoraRtcEngineKit.renewToken: renewToken to pass the new token + * to the SDK. + * @param engine The AgoraRtcEngineKit object. + * @sa [How to generate a token](https://docs.agora.io/en/Interactive%20Broadcast/token_server_cpp?platform=CPP). + */ +- (void)rtcEngineRequestToken:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRequestToken(_:)); + +/** + * Occurs when the token will expire in 30 seconds. + * + * If the token you specified when calling + * `joinChannelByToken` + * expires, the user drops offline. This callback is triggered 30 seconds + * before the token expires, to remind you to renew the token. + * Upon receiving this callback, generate a new token at your app server and + * call \ref AgoraRtcEngineKit.renewToken: renewToken to pass the new token + * to the SDK. + * @param engine The AgoraRtcEngineKit object. + * @param token The token that will expire in 30 seconds. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine tokenPrivilegeWillExpire:(NSString *_Nonnull)token NS_SWIFT_NAME(rtcEngine(_:tokenPrivilegeWillExpire:)); + +/** + * Occurs when connection license verification fails + * + * You can know the reason accordding to error code + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine licenseValidationFailure:(AgoraLicenseVerifyCode) error; + +/** The SDK disconnected from the server. + + Once the connection is lost, the SDK tries to reconnect it repeatedly until the application calls [leave](@ref AgoraRtcEngineKit.leaveChannel:) . + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineConnectionDidInterrupted:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidInterrupted(_:)); + + +/** + * Occurs when the SDK cannot reconnect to Agora's edge server 10 seconds after + * its connection to the server is interrupted. + * + * The SDK triggers this callback when it cannot connect to the server 10 seconds after calling + * `joinChannelByToken`, regardless of whether it is in the channel or not. + * @param engine The AgoraRtcEngineKit object. + */ +- (void)rtcEngineConnectionDidLost:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidLost(_:)); + + +/** A connection is banned by the server. + + The SDK will not try to reconnect the server. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineConnectionDidBanned:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineConnectionDidBanned(_:)); + +/** + * Occurs when the connection state of the SDK to the server is changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param type See \ref AgoraNetworkType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine networkTypeChanged:(AgoraNetworkType)type NS_SWIFT_NAME(rtcEngine(_:networkTypeChanged:)); + +/** + * Occurs when permission error + * + * @param engine The AgoraRtcEngineKit object. + * @param type See \ref AgoraPermissionType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine permissionError:(AgoraPermissionType)type NS_SWIFT_NAME(rtcEngine(_:permissionError:)); + +/** + * Occurs when the connection state of the SDK to the server is changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param state See \ref AgoraConnectionState. + * @param reason See \ref AgoraConnectionChangedReason. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine connectionChangedToState:(AgoraConnectionState)state reason:(AgoraConnectionChangedReason)reason NS_SWIFT_NAME(rtcEngine(_:connectionChangedTo:reason:)); + + +/** + * Reports WIFI user message. + * When the user needs to be prompted to approach the AP or switch the frequency band connected to the AP, the SDK will trigger this callback to notify the APP. + * @param engine AgoraRtcEngineKit object. + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine wlAccMessage:(AgoraWlAccReason)reason action:(AgoraWlAccAction)action wlAccMsg:(NSString * _Nonnull)wlAccMsg NS_SWIFT_NAME(rtcEngine(_:wlAccMessage:action:wlAccMsg:)); + +/** + * Reports WIFI accelerate status. + * When the optimized end-to-end delay, frozen ratio and packet loss rate need to be displayed to the user, the SDK will trigger this callback to notify the APP. + * @param engine AgoraRtcEngineKit object. + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine wlAccStats:(AgoraWlAccStats * _Nonnull)currentStats averageStats:(AgoraWlAccStats * _Nonnull)averageStats NS_SWIFT_NAME(rtcEngine(_:wlAccStats:averageStats:)); + +/** + * Reports the statistics of the current call. + * + * This callback is triggered once every two seconds after the user joins the channel. + * + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics on the current call: #AgoraChannelStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine reportRtcStats:(AgoraChannelStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:reportRtcStats:)); + + +/** The last mile network quality of the local user. + + This callback is triggered once after you have called [startLastmileProbeTest]([AgoraRtcEngineKit startLastmileProbeTest]) to report the network quality of the local user. + + @param engine AgoraRtcEngineKit object + @param quality AgoraNetworkQuality + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileQuality:(AgoraNetworkQuality)quality NS_SWIFT_NAME(rtcEngine(_:lastmileQuality:)); + + +/** + * Reports the last-mile network probe result. + * + * The SDK triggers this callback within 30 seconds after the app calls the \ref AgoraRtcEngineKit.startLastmileProbeTest: startLastmileProbeTest method. + * @param engine The AgoraRtcEngineKit object. + * @param result The uplink and downlink last-mile network probe test result, see \ref AgoraLastmileProbeResult. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine lastmileProbeTestResult:(AgoraLastmileProbeResult * _Nonnull)result NS_SWIFT_NAME(rtcEngine(_:lastmileProbeTest:)); + +/** + * The API call was executed successfully. + * @deprecated This callback is deprecated. Use other specific event callbacks instead. + * + * @param engine The AgoraRtcEngineKit object. + * @param error \ref AgoraErrorCode + * @param api The method executed by the SDK. + * @param result The result of the method call. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didApiCallExecute:(NSInteger)error api:(NSString * _Nonnull)api result:(NSString * _Nonnull)result NS_SWIFT_NAME(rtcEngine(_:didApiCallExecute:api:result:)) __deprecated; + + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) + +/** The specified device state. + + @note This method applies to macOS only. + + @param engine AgoraRtcEngineKit object + @param deviceId Device ID + @param deviceType AgoraMediaDeviceType + @param state State of the device: + + * 0: Added. + * 1: Removed. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine device:(NSString * _Nonnull)deviceId type:(AgoraMediaDeviceType)deviceType stateChanged:(NSInteger)state NS_SWIFT_NAME(rtcEngine(_:device:type:stateChanged:)); + +#endif + +/** An error of encryption occurred during SDK runtime. + + @param errorType AgoraEncryptionErrorType + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurEncryptionError:(AgoraEncryptionErrorType)errorType NS_SWIFT_NAME(rtcEngine(_:didOccur:)); +/** + * Reports the user log upload result + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine uploadLogResultRequestId:(NSString * _Nonnull)requestId success:(BOOL)success reason:(AgoraUploadErrorReason)reason NS_SWIFT_NAME(rtcEngine(_:uploadLogResultRequestId:success:reason:)); + +#pragma mark Local User Core Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Local User Core Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** + * Occurs when the local user successfully joins a specified channel. + * + * @param engine AgoraRtcEngineKit object + * @param channel The channel name. + * @param uid The user ID. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannelByToken` until this event occurs. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinChannel:(NSString * _Nonnull)channel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didJoinChannel:withUid:elapsed:)); + +/** + * Occurs when the local user rejoins a channel. + * + * If the client loses connection with the server because of network problems, + * the SDK automatically attempts to reconnect and then triggers this callback + * upon reconnection, indicating that the user rejoins the channel with the + * assigned channel ID and user ID. + * + * @param engine The AgoraRtcEngineKit object. + * @param channel The channel name. + * @param uid The user ID. + * @param elapsed Time elapsed (ms) from the local user calling `joinChannelByToken` until this event occurs. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRejoinChannel:(NSString * _Nonnull)channel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didRejoinChannel:withUid:elapsed:)); + +/** + * Occurs when the local user role switches in a live broadcast. + * + * @param engine The AgoraRtcEngineKit object. + * @param oldRole The role that the user switches from: #AgoraClientRole. + * @param newRole The role that the user switches to: #AgoraClientRole. + * @param newRoleOptions The client role option of the new role: #AgoraClientRoleOptions. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didClientRoleChanged:(AgoraClientRole)oldRole newRole:(AgoraClientRole)newRole newRoleOptions:(AgoraClientRoleOptions * _Nullable)newRoleOptions NS_SWIFT_NAME(rtcEngine(_:didClientRoleChanged:newRole:newRoleOptions:)); + +/** + * Occurs when the local user role switches in a live broadcast. + * + * @param engine The AgoraRtcEngineKit object. + * @param reason The reason of the failure of the local user role switches: #AgoraClientRoleChangeFailedReason. + * @param currentRole The current role of the user: #AgoraClientRole. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didClientRoleChangeFailed:(AgoraClientRoleChangeFailedReason)reason currentRole:(AgoraClientRole)currentRole NS_SWIFT_NAME(rtcEngine(_:didClientRoleChangeFailed:currentRole:)); + +/** + * Occurs when the local user leaves a channel. + * + * When the user successfully leaves the channel after calling + * \ref AgoraRtcEngineKit.leaveChannel: leaveChannel method, this callback + * notifies the app that a user leaves a channel. + * + * This callback also reports information such as the call duration and the + * statistics of data received or transmitted by the SDK. + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics of the call. See #AgoraChannelStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLeaveChannelWithStats:(AgoraChannelStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:didLeaveChannelWith:)); + + +/** The network quality of a specified user in a channel. + + This callback is triggered every two seconds to update the application on the network quality of the specified user in a communication or live broadcast channel. + + @param engine AgoraRtcEngineKit object + @param uid User ID + @param txQuality Network transmission quality defined in AgoraNetworkQuality. + @param rxQuality Network receiving quality defined in AgoraNetworkQuality. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine networkQuality:(NSUInteger)uid txQuality:(AgoraNetworkQuality)txQuality rxQuality:(AgoraNetworkQuality)rxQuality NS_SWIFT_NAME(rtcEngine(_:networkQuality:txQuality:rxQuality:)); + + +#pragma mark Local User Audio Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Local User Audio Delegate Methods + * ----------------------------------------------------------------------------- + */ +/** + * Occurs when the first local audio frame is published. + * + * @param engine The AgoraRtcEngineKit object. + * @param elapsed The time elapsed (ms) from calling `joinChannelByToken` until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalAudioFramePublished:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstLocalAudioFramePublished:)); + +/** + * Reports the statistics of the local audio stream. + * + * The SDK triggers this callback once every two seconds. + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics of the local audio stream. See \ref AgoraRtcLocalAudioStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localAudioStats:(AgoraRtcLocalAudioStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:localAudioStats:)); + +/** + * Occurs when the local audio stream state changes. + * + * This callback indicates the state change of the local audio stream, including + * the state of the audio recording and encoding, and allows you to troubleshoot + * issues when exceptions occur. + * + * @note + * When the state is `AgoraAudioLocalStateFailed`(3), see the `error` parameter for details. + * @param engine AgoraRtcEngineKit object + * @param state The state of the local audio. See \ref AgoraAudioLocalState. + * @param error The error information of the local audio. See \ref AgoraAudioLocalError. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localAudioStateChanged:(AgoraAudioLocalState)state error:(AgoraAudioLocalError)error NS_SWIFT_NAME(rtcEngine(_:localAudioStateChanged:error:)); + +/** + * Occurs when the local audio route changes. + * + * The SDK triggers this callback when the local audio route changes. + * @param engine The AgoraRtcEngineKit object. + * @param routing The audio route. See \ref AgoraAudioOutputRouting. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didAudioRouteChanged:(AgoraAudioOutputRouting)routing NS_SWIFT_NAME(rtcEngine(_:didAudioRouteChanged:)); + +/** The audio mixing file playback stopped after calling [startAudioMixing]([AgoraRtcEngineKit startAudioMixing:loopback:replace:cycle:]). + + If you failed to call [startAudioMixing]([AgoraRtcEngineKit startAudioMixing:loopback:replace:cycle:]), it returns the error code in the [didOccurError]([AgoraRtcEngineDelegate rtcEngine:didOccurError:]) callback. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineLocalAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineLocalAudioMixingDidFinish(_:)); + +/** Occurs when the local audio effect playback finishes. + + You can start a local audio effect playback by calling the \ref AgoraRtcEngineKit.playEffect:filePath:loopCount:pitch:pan:gain:publish: playEffect method. The SDK triggers this callback when the local audio effect file playback finishes. + + @param engine AgoraRtcEngineKit object. + @param soundId ID of the local audio effect. Each local audio effect has a unique ID. + */ +- (void)rtcEngineDidAudioEffectFinish:(AgoraRtcEngineKit * _Nonnull)engine soundId:(int)soundId NS_SWIFT_NAME(rtcEngineDidAudioEffectFinish(_:soundId:)); + + +#pragma mark Local User Video Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Local User Video Delegate Methods + * ----------------------------------------------------------------------------- + */ + + +/** A camera turned on and is ready to capture video. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineCameraDidReady:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineCameraDidReady(_:)); + +#if TARGET_OS_IPHONE + +/** A camera focus position changed. + + @param engine AgoraRtcEngineKit object + @param rect Focus rectangle in the local preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine cameraFocusDidChangedToRect:(CGRect)rect NS_SWIFT_NAME(rtcEngine(_:cameraFocusDidChangedTo:)); + +/** A camera exposure position changed. + + @param engine AgoraRtcEngineKit object + @param rect Exposure rectangle in the local preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine cameraExposureDidChangedToRect:(CGRect)rect NS_SWIFT_NAME(rtcEngine(_:cameraExposureDidChangedTo:)); + +#endif + +/** The video playback stopped. + + The application can use this callback to change the configuration of the view (for example, displaying other pictures in the view) after the video stops. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineVideoDidStop:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineVideoDidStop(_:)); + +/** Event of the first local video frame is published. + * @param engine The engine kit + * @param elapsed The elapsed time(ms) from the beginning of the session. + * @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFramePublishedWithElapsed:sourceType:)); + +/** The first local frame displayed on the video window. + + Same as [firstLocalVideoFrameBlock]([AgoraRtcEngineKit firstLocalVideoFrameBlock:]). + + @param engine The AgoraRtcEngineKit object. + @param size Size of the video (width and height). + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFrameWithSize:(CGSize)size elapsed:(NSInteger)elapsed sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFrameWith:elapsed:sourceType:)); + +/** Reports the statistics of the local video stream. + + * The SDK triggers this callback once every two seconds for each + * user/host. If there are multiple users/hosts in the channel, the SDK + * triggers this callback as many times. + * + * @note If you have called the + * \ref AgoraRtcEngineKit.enableDualStreamMode: enableDualStreamMode + * method, this callback reports the statistics of the high-video + * stream (high bitrate, and high-resolution video stream). + * @param engine The \ref AgoraRtcEngineKitobject. + * @param stats Statistics of the local video stream. See \ref AgoraRtcLocalVideoStats. + * @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(rtcEngine(_:localVideoStats:sourceType:)); + +/** The local published media stream fell back to an audio-only stream in poor network conditions or switched back to the video when the network conditions improved. + + If you call [setLocalPublishFallbackOption]([AgoraRtcEngineKit setLocalPublishFallbackOption:]) and set *option* as AgoraStreamFallbackOptionAudioOnly, this callback will be triggered when the local publish stream falls back to audio-only mode due to poor uplink conditions, or when the audio stream switches back to the video when the uplink network condition improves. + + @note Once the local publish stream falls back to audio only, the remote app will receive the [userMuteVideoBlock]([AgoraRtcEngineKit userMuteVideoBlock:])callback. + + @param engine The AgoraRtcEngineKit object. + @param isFallbackOrRecover * YES: The local publish stream fell back to audio-only due to poor network conditions. + * NO: The local publish stream switched back to the video when the network conditions improved. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalPublishFallbackToAudioOnly:(BOOL)isFallbackOrRecover NS_SWIFT_NAME(rtcEngine(_:didLocalPublishFallbackToAudioOnly:)); + +/** + * Reports the tracing result of video rendering event of the user. + * + * @param uid The user ID. + * @param currentEvent The current event of the tracing result: #AgoraMediaTraceEvent. + * @param tracingInfo The tracing result: #AgoraVideoRenderingTracingInfo. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoRenderingTracingResultOfUid:(NSUInteger)uid currentEvent:(AgoraMediaTraceEvent)currentEvent tracingInfo:(AgoraVideoRenderingTracingInfo * _Nonnull)tracingInfo NS_SWIFT_NAME(rtcEngine(_:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:)); + + + +#pragma mark Remote User Core Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Remote User Core Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** + * Occurs when a remote user or user joins the channel. + * + * If other users or hosts are already in the channel, the SDK also reports to + * the app on the existing users/hosts. + * + * The SDK triggers this callback under one of the following circumstances: + * - A remote user/host joins the channel by calling `joinChannelByToken`. + * - A remote user switches the user role to the host by calling + * \ref AgoraRtcEngineKit.setClientRole: setClientRole method after joining + * the channel. + * - A remote user/host rejoins the channel after a network interruption. + * @note + * When a web user joins the channel, this callback is triggered as long as the + * user publishes a stream. + @param engine The AgoraRtcEngineKit object. + @param uid The user ID. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didJoinedOfUid:elapsed:)); + +/** + * Occurs when a remote user or host goes offline. + * + * There are two reasons for a user to go offline: + * - Leave the channel: When the user leaves the channel, the user sends a + * goodbye message. When this message is received, the SDK determines that the + * user leaves the channel. + * - Drop offline: When no data packet of the user is received for a certain + * period of time, the SDK assumes that the user drops offline. A poor network + * connection may lead to false detection, so we recommend using + * the RTM SDK for reliable offline detection. + * + * @param engine The AgoraRtcEngineKit object. + * @param uid The ID of the user who goes offline. + * @param reason The reason why the user goes offline: #AgoraUserOfflineReason. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOfflineOfUid:(NSUInteger)uid reason:(AgoraUserOfflineReason)reason NS_SWIFT_NAME(rtcEngine(_:didOfflineOfUid:reason:)); + + +/** Occurs when the user receives the data stream. + +The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the \ref AgoraRtcEngineKit.sendStreamMessage:data: sendStreamMessage method within five seconds. + + @param engine AgoraRtcEngineKit object. + @param uid User ID of the remote user sending the message. + @param streamId Stream ID. + @param data Data received by the local user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine receiveStreamMessageFromUid:(NSUInteger)uid streamId:(NSInteger)streamId data:(NSData * _Nonnull)data NS_SWIFT_NAME(rtcEngine(_:receiveStreamMessageFromUid:streamId:data:)); + +/** Occurs when the user does not receive the data stream. + + The SDK triggers this callback when the local user fails to receive the stream message that the remote user sends by calling the \ref AgoraRtcEngineKit.sendStreamMessage:data: sendStreamMessage + method within five seconds. + + @param engine AgoraRtcEngineKit object. + @param uid User ID of the remote user sending the message. + @param streamId Stream ID. + @param error Error code. See \ref AgoraErrorCode. + @param missed Number of lost messages. + @param cached Number of incoming cached messages when the data stream is interrupted. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didOccurStreamMessageErrorFromUid:(NSUInteger)uid streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached NS_SWIFT_NAME(rtcEngine(_:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached:)); + + +#pragma mark Remote User Audio Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Remote User Audio Delegate Methods + * ----------------------------------------------------------------------------- + */ + + +/** The first audio frame received and decoded from the remote user. + + @param engine The AgoraRtcEngineKit object. + @param uid Remote user ID. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteAudioFrameOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameOfUid:elapsed:)); + + +/** Occurs when the SDK decodes the first remote audio frame for playback. + + **Deprecated** from v3.0.0. Use `AgoraAudioRemoteStateDecoding(2)` in the [remoteAudioStateChangedOfUid]([AgoraRtcEngineDelegate rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:]) callback instead. + + This callback is triggered in either of the following scenarios: + + - The remote user joins the channel and sends the audio stream. + - The remote user stops sending the audio stream and re-sends it after 15 seconds. Reasons for such an interruption include: + + - The remote user leaves channel. + - The remote user drops offline. + - The remote user calls the [muteLocalAudioStream]([AgoraRtcEngineKit muteLocalAudioStream:]) method to stop sending the local audio stream. + - The remote user calls the [disableAudio]([AgoraRtcEngineKit disableAudio]) method to disable audio. + + @param engine AgoraRtcEngineKit object. + @param uid User ID of the remote user sending the audio stream. + @param elapsed The time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine firstRemoteAudioFrameDecodedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameDecodedOfUid:elapsed:)) __deprecated_msg("use rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed: instead."); + +/** + * Reports the statistics of the remote audio stream. + * + * The SDK triggers this callback once every two seconds for each remote user or broadcaster. If a + * channel has multiple remote users, the SDK triggers this callback as many times. + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics of the received audio. See \ref AgoraRtcRemoteAudioStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteAudioStats:(AgoraRtcRemoteAudioStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:remoteAudioStats:)); + +/** A remote user's audio was muted or unmuted. + + @param engine AgoraRtcEngineKit object + @param muted Mute or unmute + @param uid Remote user ID + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didAudioMuted:(BOOL)muted byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didAudioMuted:byUid:)); + + +/** + * This callback reports the IDs and volumes of the loudest speakers at the + * moment in the channel, and whether the local user is speaking. + * + * Once enabled, this callback is triggered at the set interval, regardless of + * whether a user speaks or not. + * + * The SDK triggers two independent `reportAudioVolumeIndicationOfSpeakers` + * callbacks at one time, which separately report the volume information of the + * local user and all the remote speakers. + * + * @param engine The AgoraRtcEngineKit object. + * @param speakers An array containing the user ID and volume information + * for each speaker: #AgoraRtcAudioVolumeInfo. + * - In the local user's callback, this array contains the following members: + * - `uid` = 0, + * - `volume` = `totalVolume`, which reports the sum of the voice volume + * and audio-mixing volume of the local user. + * - In the remote users' callback, this array contains the following members: + * - `uid` of each remote speaker. + * - `volume`, which reports the sum of the voice volume and audio-mixing + * volume of each remote speaker. + * An empty `speakers` array in the callback indicates that no remote user is + * speaking at the moment. + * @param totalVolume The total volume after audio mixing. The value ranges + * between 0 (the lowest volume) and 255 (the highest volume). + * - In the local user's callback, `totalVolume` is the sum of the voice volume + * and audio-mixing volume of the local user. + * - In the remote users' callback, `totalVolume` is the sum of the voice + * volume and audio-mixing volume of all the remote speakers. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine reportAudioVolumeIndicationOfSpeakers:(NSArray * _Nonnull)speakers totalVolume:(NSInteger)totalVolume NS_SWIFT_NAME(rtcEngine(_:reportAudioVolumeIndicationOfSpeakers:totalVolume:)); + + +/** + * Occurs when an active speaker is detected. + * + * If you have called \ref AgoraRtcEngineKit.enableAudioVolumeIndication:smooth: enableAudioVolumeIndication, + * this callback is triggered when the volume detecting unit has detected an + * active speaker in the channel. This callback also returns the `uid` of the + * active speaker. + * + * @note + * - You need to call `enableAudioVolumeIndication` to receive this callback. + * - The active speaker means the user ID of the speaker who speaks at the + * highest volume during a certain period of time. + * @param engine The AgoraRtcEngineKit object. + * @param speakerUid The ID of the active speaker. A `speakerUid` of 0 means + * the local user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine activeSpeaker:(NSUInteger)speakerUid NS_SWIFT_NAME(rtcEngine(_:activeSpeaker:)); + +/** Occurs when a remote user starts audio mixing. + + The SDK triggers this callback when a remote user calls the [startAudioMixing]([AgoraRtcEngineKit startAudioMixing:loopback:replace:cycle:]) method. + + @param engine AgoraRtcEngineKit object. + */ +- (void)rtcEngineRemoteAudioMixingDidStart:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRemoteAudioMixingDidStart(_:)); + +/** The remote user ended audio mixing. + + @param engine AgoraRtcEngineKit object + */ +- (void)rtcEngineRemoteAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineRemoteAudioMixingDidFinish(_:)); + +/** The audio quality of the specified user every two seconds. Same as [audioQualityBlock]([AgoraRtcEngineKit audioQualityBlock:]). + + @param engine The AgoraRtcEngineKit object. + @param uid User ID of the speaker. + @param quality AgoraNetworkQuality + @param delay Time delay (ms). + @param lost Packet loss rate (%). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine audioQualityOfUid:(NSUInteger)uid quality:(AgoraNetworkQuality)quality delay:(NSUInteger)delay lost:(NSUInteger)lost NS_SWIFT_NAME(rtcEngine(_:audioQualityOfUid:quality:delay:lost:)); + +/** The remote audio transport statistics. + + This callback is triggered every two seconds after the user receives the audio data packet sent from a remote user. + + @param engine The AgoraRtcEngineKit object. + @param uid User ID of the remote user whose audio data packet has been received. + @param delay Time delay (ms) from the remote user to the local client. + @param lost Packet loss rate (%). + @param rxKBitRate Received audio bitrate (kbit/s) of the packet from the remote user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine audioTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate NS_SWIFT_NAME(rtcEngine(_:audioTransportStatsOfUid:delay:lost:rxKBitRate:)); + + +/** Intra request received. + * @param engine The AgoraRtcEngineKit object. +*/ +- (void)rtcEngineIntraRequestReceived:(AgoraRtcEngineKit *_Nonnull)engine NS_SWIFT_NAME(rtcEngineIntraRequestReceived(_:)); + +/** Target bitrate updated. + * @param engine The AgoraRtcEngineKit object. + * @param networkInfo The uplink network info, including target bitrate bps. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine uplinkNetworkInfoUpdate:(AgoraUplinkNetworkInfo *_Nonnull)networkInfo NS_SWIFT_NAME(rtcEngine(_:uplinkNetworkInfoUpdate:)); + +/** Downlink network info updated. + * @param engine The AgoraRtcEngineKit object. + * @param networkInfo The network info. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine downlinkNetworkInfoUpdate:(AgoraDownlinkNetworkInfo *_Nonnull)networkInfo NS_SWIFT_NAME(rtcEngine(_:downlinkNetworkInfoUpdate:)); + +/** + * Occurs when the audio subscribe state changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param uid The remote user ID that is subscribed to. + * @param oldState The old state of the audio stream subscribe : #AgoraStreamSubscribeState. + * @param newState The new state of the audio stream subscribe : #AgoraStreamSubscribeState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioSubscribeStateChange:(NSString * _Nonnull)channelId + uid:(unsigned int)uid + oldState:(AgoraStreamSubscribeState)oldState + newState:(AgoraStreamSubscribeState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didAudioSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:)); + +/** + * Occurs when the audio publish state changed. + * + * @param channelId The channel name of user joined. + * @param oldState The old state of the audio stream publish : #AgoraStreamPublishState. + * @param newState The new state of the audio stream publish : #AgoraStreamPublishState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioPublishStateChange:(NSString * _Nonnull)channelId + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didAudioPublishStateChange:oldState:newState:elapseSinceLastState:)); + +#pragma mark String UID + +/** Occurs when the local user successfully registers a user account by calling the + * This callback reports the user ID and user account of the local user. + * @param engine The AgoraRtcEngineKit object. + * @param uid The ID of the local user. + * @param userAccount The user account of the local user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalUserRegisteredWithUserId:(NSUInteger)uid userAccount:(NSString * _Nonnull)userAccount NS_SWIFT_NAME(rtcEngine(_:didLocalUserRegisteredWithUserId:userAccount:)); + +/** Occurs when the SDK gets the user ID and user account of the remote user. + + * After a remote user joins the channel, the SDK gets the UID and user account of the remote user, + * caches them in a mapping table object (`userInfo`), and triggers this callback on the local client. + + * @param engine The AgoraRtcEngineKit object. + * @param uid The ID of the remote user. + * @param userInfo The `AgoraUserInfo` object that contains the user ID and user account of the remote user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didUserInfoUpdatedWithUserId:(NSUInteger)uid userInfo:(AgoraUserInfo* _Nonnull)userInfo NS_SWIFT_NAME(rtcEngine(_:didUserInfoUpdatedWithUserId:userInfo:)); + +#pragma mark Rhythm Player Delegates Methods + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRhythmPlayerStateChanged:(AgoraRhythmPlayerState)state + errorCode:(AgoraRhythmPlayerError)errorCode NS_SWIFT_NAME(rtcEngine(_:didRhythmPlayerStateChanged:errorCode:)); + +#pragma mark Local Video Transcoder Delegates Methods +/** + * Occurs when local video transcoder stream has error. + * + * @param stream Stream type of AgoraTranscodingVideoStream. + * @param error Error code of AgoraVideoTranscoderError. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoTranscoderErrorWithStream:(AgoraTranscodingVideoStream * _Nonnull )stream + errorCode:(AgoraVideoTranscoderError)errorCode NS_SWIFT_NAME(rtcEngine(_:didLocalVideoTranscoderErrorWithStream:errorCode:)); + +#pragma mark Remote Video Layout Info Delegates Methods +/** + * Occurs when local video transcoder stream has error. + * + * @param uid The ID of the remote user. + * @param videoLayoutInfo The `AgoraVideoLayoutInfo` object that contains video layout info of the remote user.. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didTranscodedStreamLayoutInfoUpdatedWithUserId:(NSUInteger)uid videoLayoutInfo:(AgoraVideoLayoutInfo* _Nonnull)videoLayoutInfo NS_SWIFT_NAME(rtcEngine(_:didTranscodedStreamLayoutInfoUpdatedWithUserId:videoLayoutInfo:)); + +#pragma mark Remote User Video Delegates Methods + +/**----------------------------------------------------------------------------- + * @name Remote User Video Delegates Methods + * ----------------------------------------------------------------------------- + */ + + +/** Occurs when the first frame of the remote user was decoded successfully. + + @deprecated This callback is deprecated. Use [remoteVideoStateChangedOfUid](remoteVideoStateChangedOfUid:state:reason:elapsed:) + instead. + + This callback is triggered upon the SDK receiving and successfully decoding + the first video frame from a remote video. The app can configure the + user view settings in this delegate. + + @param engine The AgoraRtcEngineKit object. + @param uid ID of the user whose video streams are received. + @param size Size of the video (width and height) in pixels. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteVideoDecodedOfUid:size:elapsed:)) __deprecated; + +/** The first frame of the remote user was displayed successfully. Same as [firstRemoteVideoFrameBlock]([AgoraRtcEngineKit firstRemoteVideoFrameBlock:]). + + @param engine The AgoraRtcEngineKit object. + @param uid Remote user ID. + @param size Size of the video (width and height) in pixels. + @param elapsed Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstRemoteVideoFrameOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteVideoFrameOfUid:size:elapsed:)); + + /** Occurs when the local or remote video size or rotation has changed. + * + * @param engine AgoraRtcEngineKit object. + * @param sourceType The video source type. + * @param uid The user ID. 0 indicates the local user. + * @param size Size of the video (width and height) in pixels. + * @param rotation The rotation information of the video. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfSourceType:(AgoraVideoSourceType)sourceType uid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOf:uid:size:rotation:)); +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine contentInspectResult:(AgoraContentInspectResult)result NS_SWIFT_NAME(rtcEngine(_:contentInspectResult:)); +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine snapshotTaken:(NSUInteger)uid filePath:(NSString* _Nonnull)filePath width:(NSInteger)width height:(NSInteger)height errCode:(NSInteger)errCode NS_SWIFT_NAME(rtcEngine(_:snapshotTaken:filePath:width:height:errCode:)); + +/** + * @technical preview + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine audioMetadataReceived:(NSUInteger)uid metadata:(NSData * _Nonnull)metadata NS_SWIFT_NAME(rtcEngine(_:audioMetadataReceived:metadata:)); +/** Occurs when the local video stream state changes. + * + * This callback indicates the state of the local video stream, including camera capturing and video encoding, + * and allows you to troubleshoot issues when exceptions occur. + * + * @note For some device models, the SDK will not trigger this callback when the state of the local video changes + * while the local video capturing device is in use, so you have to make your own timeout judgment. + * @param engine AgoraRtcEngineKit object + * @param state State type #AgoraVideoLocalState. When the state is AgoraVideoLocalStateFailed (3), see the `error` parameter for details. + * @param error The detailed error information: #AgoraLocalVideoStreamError. + * @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStateChangedOfState:(AgoraVideoLocalState)state error:(AgoraLocalVideoStreamError)error sourceType:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(rtcEngine(_:localVideoStateChangedOf:error:sourceType:)); + +/** Occurs when the remote video state has changed. + * + * @note This callback does not work properly when the number of users (in the `AgoraChannelProfileCommunication` profile) or hosts + * (in the `AgoraChannelProfileLiveBroadcasting` profile) in the channel exceeds 17. + * + * @param engine AgoraRtcEngineKit object. + * @param uid ID of the user whose video state has changed. + * @param state The remote video state: #AgoraVideoRemoteState. + * @param reason The reason of the remote video state change: #AgoraVideoRemoteReason. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` until this callback is triggered. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteReason)reason elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:remoteVideoStateChangedOfUid:state:reason:elapsed:)); + +/** + * Occurs when the state of a remote audio stream changes. + * + * @param engine The AgoraRtcEngineKit object. + * @param uid The ID of the user whose audio state has changed. + * @param state The state of the remote audio. See \ref AgoraAudioRemoteState. + * @param reason The reason of the remote audio state change. See \ref AgoraAudioRemoteReason. + * @param elapsed The time elapsed (ms) from calling `joinChannelByToken` until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteAudioStateChangedOfUid:(NSUInteger)uid state:(AgoraAudioRemoteState)state reason:(AgoraAudioRemoteReason)reason elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:remoteAudioStateChangedOfUid:state:reason:elapsed:)); + +/** Occurs when the state of the media stream relay changes. + + The SDK reports the state of the current media relay and possible error messages in this callback. + + @param engine AgoraRtcEngineKit object. + @param state The state code in [AgoraChannelMediaRelayState](AgoraChannelMediaRelayState). + @param error The error code in [AgoraChannelMediaRelayError](AgoraChannelMediaRelayError). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine +channelMediaRelayStateDidChange:(AgoraChannelMediaRelayState)state + error:(AgoraChannelMediaRelayError)error NS_SWIFT_NAME(rtcEngine(_:channelMediaRelayStateDidChange:error:)); + +/** Reports events during the media stream relay. + + @param engine AgoraRtcEngineKit object. + @param event The event code in [AgoraChannelMediaRelayEvent](AgoraChannelMediaRelayEvent). + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine +didReceiveChannelMediaRelayEvent:(AgoraChannelMediaRelayEvent)event NS_SWIFT_NAME(rtcEngine(_:didReceive:)); + +/** A remote user's video paused or resumed. Same as [userMuteVideoBlock]([AgoraRtcEngineKit userMuteVideoBlock:]). + @deprecated + @note Invalid when the number of users in a channel exceeds 20. + + @param engine The AgoraRtcEngineKit object. + @param muted Paused or resumed: + + * Yes: Remote user's video paused. + * No: Remote user's video resumed. + + @param uid Remote user ID. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didVideoMuted:(BOOL)muted byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didVideoMuted:byUid:)) __deprecated_msg("use rtcEngine:remoteVideoStateChangedOfUid:state:reason: instead."); + +/** A remote user's video was enabled or disabled. + @deprecated + Once the video function is disabled, users can only perform an audio call and cannot see any video. + + @note Invalid when the number of users in a channel exceeds 20. + + @param engine The AgoraRtcEngineKit object. + @param enabled Enabled or disabled: + + * Yes: User has enabled the video function. + * No: User has disabled the video function. + + @param uid Remote user ID. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didVideoEnabled:byUid:)) __deprecated_msg("use rtcEngine:remoteVideoStateChangedOfUid:state:reason: instead."); + +/** A remote user's local video was enabled or disabled. + @deprecated + @param engine The AgoraRtcEngineKit object. + @param enabled Enabled or disabled: + + * Yes: User has enabled the local video function. + * No: User has disabled the local video function. + + @param uid Remote user ID. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didLocalVideoEnabled:byUid:)) __deprecated_msg("use rtcEngine:remoteVideoStateChangedOfUid:state:reason: instead."); + +/** Occurs when join success after calling [setLocalAccessPoint]([AgoraRtcEngineKit setLocalAccessPoint:channelId:info:uid:joinSuccess:]) or [setCloudProxy]([AgoraRtcEngineKit setCloudProxy:proxyType]) + @param engine AgoraRtcEngineKit object. + @param channel Channel name. + @param uid User ID. If the `uid` is specified in the [joinChannelByToken]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) method, the specified user ID is returned. If the user ID is not specified when the joinChannel method is called, the server automatically assigns a `uid`. + @param proxyType type of proxy agora sdk connected, proxyType will be AgoraNoneProxyType if not connected to proxy(fallback). + @param localProxyIp local proxy ip list, if not join local proxy, it will be "" + @param elapsed Time elapsed (ms) from the user calling the [joinChannelByToken]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) method until the SDK triggers this callback. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine didProxyConnected:(NSString* _Nonnull)channel withUid:(NSUInteger)uid proxyType:(AgoraProxyType)proxyType localProxyIp:(NSString* _Nonnull)localProxyIp elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:didProxyConnected:withUid:proxyType:localProxyIp:elapsed:)); + +/** + * Occurs when the remote user state is updated. + * + * @param engine The AgoraRtcEngineKit object. + * @param uid Remote user ID. + * @param state The remote user state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteUserStateChangedOfUid:(NSUInteger)uid state:(NSUInteger)state NS_SWIFT_NAME(rtcEngine(_:remoteUserStateChangedOfUid:state:)); + +/** + * Reports the statistics of the video stream from each remote user/host. + * + * The SDK triggers this callback once every two seconds for each remote user + * or host. If a channel includes multiple remote users, the SDK triggers this + * callback as many times. + * + * @param engine The AgoraRtcEngineKit object. + * @param stats The statistics of the received remote video streams. See + * #AgoraRtcRemoteVideoStats. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStats:(AgoraRtcRemoteVideoStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:remoteVideoStats:)); + + + /** The remote published media stream fell back to an audio-only stream in poor network conditions or switched back to the video when the network conditions improved. + + Once you enabled [setRemoteSubscribeFallbackOption]([AgoraRtcEngineKit setRemoteSubscribeFallbackOption:]), + this event will be triggered to receive audio only due to poor network conditions or resubscribes the video when the network condition improves. + + @note Once the remote subscribe stream is switched to the low stream due to poor network conditions, you can monitor the stream switch between a high and low stream in the [remoteVideoStats]([AgoraRtcEngineDelegate rtcEngine:remoteVideoStats:]) callback. + + @param engine The AgoraRtcEngineKit object. + @param isFallbackOrRecover * YES: The remote subscribe stream fell back to audio-only due to poor network conditions. + * NO: The remote subscribe stream switched back to the video stream when the network conditions improved. + @param uid Remote user ID + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didRemoteSubscribeFallbackToAudioOnly:(BOOL)isFallbackOrRecover byUid:(NSUInteger)uid NS_SWIFT_NAME(rtcEngine(_:didRemoteSubscribeFallbackToAudioOnly:byUid:)); + +/** The remote video transport statistics. + + This callback is triggered every two seconds after the user receives the video data packet sent from a remote user. + + @param engine The AgoraRtcEngineKit object. + @param uid User ID of the remote user whose video packet has been received. + @param delay Time delay (ms) from the remote user to the local client. + @param lost Packet loss rate (%). + @param rxKBitRate Received video bitrate (kbit/s) of the packet from the remote user. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate NS_SWIFT_NAME(rtcEngine(_:videoTransportStatsOfUid:delay:lost:rxKBitRate:)); + +/** + * Occurs when the video subscribe state changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param uid The remote user ID that is subscribed to. + * @param oldState The old state of the video stream subscribe : #AgoraStreamSubscribeState. + * @param newState The new state of the video stream subscribe : #AgoraStreamSubscribeState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoSubscribeStateChange:(NSString * _Nonnull)channelId + uid:(unsigned int)uid + oldState:(AgoraStreamSubscribeState)oldState + newState:(AgoraStreamSubscribeState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:)); + +/** + * Occurs when the video publish state changed. + * + * @param engine The AgoraRtcEngineKit object. + * @param channelId The channel name of user joined. + * @param sourceType source type of the orignated video source. See \ref AgoraVideoSourceType. + * @param oldState The old state of the video stream publish : #AgoraStreamPublishState. + * @param newState The new state of the video stream publish : #AgoraStreamPublishState. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoPublishStateChange:(NSString * _Nonnull)channelId + sourceType:(AgoraVideoSourceType)sourceType + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState:)); + +#pragma mark Stream Publish Delegate Methods + +/**----------------------------------------------------------------------------- + * @name Stream Publish Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/**----------------------------------------------------------------------------- + * @name CDN Live Streaming Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** Occurs when the state of the RTMP or RTMPS streaming changes. + +The SDK triggers this callback to report the result of the local user calling the [addPublishStreamUrl](addPublishStreamUrl:transcodingEnabled:) or [removePublishStreamUrl](removePublishStreamUrl:) method. + +This callback returns the URL and its current streaming state. + +This callback indicates the state of the RTMP or RTMPS streaming. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the `errorCode` parameter. + +@param engine AgoraRtcEngineKit object. +@param url The CDN streaming URL. +@param state The RTMP or RTMPS streaming state: AgoraRtmpStreamingState. +@param errCode The detailed error information for streaming: AgoraRtmpStreamingErrorCode. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine rtmpStreamingChangedToState:(NSString* _Nonnull)url state:(AgoraRtmpStreamingState)state errCode:(AgoraRtmpStreamingErrorCode)errCode NS_SWIFT_NAME(rtcEngine(_:rtmpStreamingChangedToState:state:errCode:)); + +/** Reports events during the RTMP or RTMPS streaming. + + @since v3.1.0 + + @param engine AgoraRtcEngineKit object. + @param url The RTMP or RTMPS streaming URL. + @param eventCode The event code. See AgoraRtmpStreamingEvent. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine rtmpStreamingEventWithUrl:(NSString* _Nonnull)url eventCode:(AgoraRtmpStreamingEvent)eventCode NS_SWIFT_NAME(rtcEngine(_:rtmpStreamingEventWithUrl:eventCode:)); + + +/** A stream was published. + + @param engine The AgoraRtcEngineKit object. + @param url Address to which the publisher publishes the stream. + @param errorCode [AgoraErrorCode]([AgoraErrorCode]) + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamPublishedWithUrl:(NSString * _Nonnull)url errorCode:(AgoraErrorCode)errorCode NS_SWIFT_NAME(rtcEngine(_:streamPublishedWithUrl:errorCode:)); + +/** A stream was unpublished. + + @param engine The AgoraRtcEngineKit object. + @param url Address to which the publisher unpublishes the stream. + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamUnpublishedWithUrl:(NSString * _Nonnull)url NS_SWIFT_NAME(rtcEngine(_:streamUnpublishedWithUrl:)); + +/** The publisher transcoding was updated. + + @param engine The AgoraRtcEngineKit object. + */ +- (void)rtcEngineTranscodingUpdated:(AgoraRtcEngineKit * _Nonnull)engine NS_SWIFT_NAME(rtcEngineTranscodingUpdated(_:)); + +/** The status of the injected stream. + +@param engine The AgoraRtcEngineKit object. +@param url URL address added to the broadcast. +@param uid User ID +@param status AgoraInjectStreamStatus + */ +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine streamInjectedStatusOfUrl:(NSString * _Nonnull)url uid:(NSUInteger)uid status:(AgoraInjectStreamStatus)status NS_SWIFT_NAME(rtcEngine(_:streamInjectedStatusOfUrl:uid:status:)); + +/** Audio mixing state changed. + * @param engine The AgoraRtcEngineKit object. + * @param state AgoraAudioMixingStateType + * @param reasonCode AgoraAudioMixingReasonCode +*/ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingStateChanged:(AgoraAudioMixingStateType)state + reasonCode:(AgoraAudioMixingReasonCode)reasonCode NS_SWIFT_NAME(rtcEngine(_:audioMixingStateChanged:reasonCode:)); + +/** + * @brief Reports current AudioMixing progress. + * + * The callback occurs once every one second during the playback and reports the current playback progress. + * @param position Current AudioMixing progress (millisecond). + */ +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingPositionChanged:(NSInteger)position NS_SWIFT_NAME(rtcEngine(_:audioMixingPositionChanged:)); + +#if TARGET_OS_IPHONE +#pragma mark Face Detection Delegate Methods +/**----------------------------------------------------------------------------- + * @name Face Detection Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** Reports the face detection result of the local user. (iOS only) + + **Since:** v3.0.1. + + Once you enable face detection by calling [enableFaceDetection]([AgoraRtcEngineKit enableFaceDetection:]), you can get the following information on the local user in real-time: + + - The width and height of the local video. + - The position of the human face in the local video. + - The distance between the human face and the device screen. This value is based on the fitting calculation of the local video size and the position of the human face. + + **Note** + + - If the SDK does not detect a face, it reduces the frequency of this callback to reduce power consumption on the local device. + - The SDK stops triggering this callback when a human face is in close proximity to the screen. + + @param engine AgoraRtcEngineKit object. + @param width The width (px) of the local video. + @param height The height (px) of the local video. + @param faces An AgoraFacePositionInfo array, which contains the information of the detected human face. + + The number of the AgoraFacePositionInfo array depends on the number of human faces detected. If the array length is 0, it means that no human face is detected. + */ +- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine facePositionDidChangeWidth:(int)width previewHeight:(int)height faces:(NSArray* _Nullable)faces NS_SWIFT_NAME(rtcEngine(_:facePositionDidChangeWidth:previewHeight:faces:)); +#endif + +#pragma mark - Unavailable Delegate Methods +#if TARGET_OS_IPHONE +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStateChangedOfState:(AgoraVideoLocalState)state error:(AgoraLocalVideoStreamError)error NS_SWIFT_NAME(rtcEngine(_:localVideoStateChangedOf:error:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:localVideoStateChangedOfState:error:sourceType instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:localVideoStats:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:localVideoStats:sourceType instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoPublishStateChange:(NSString * _Nonnull)channelId + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoPublishStateChange:oldState:newState:elapseSinceLastState:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState: instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFramePublishedWithElapsed:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType: instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOfUid:size:rotation:)) __attribute__((availability(ios,deprecated=7_0,message="Use rtcEngine:videoSizeChangedOfSourceType:uid:size:rotation instead."))); +#endif + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStateChangedOfState:(AgoraVideoLocalState)state error:(AgoraLocalVideoStreamError)error NS_SWIFT_NAME(rtcEngine(_:localVideoStateChangedOf:error:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:localVideoStateChangedOfState:error:sourceType instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats * _Nonnull)stats NS_SWIFT_NAME(rtcEngine(_:localVideoStats:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:localVideoStats:sourceType instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoPublishStateChange:(NSString * _Nonnull)channelId + oldState:(AgoraStreamPublishState)oldState + newState:(AgoraStreamPublishState)newState +elapseSinceLastState:(int)elapseSinceLastState NS_SWIFT_NAME(rtcEngine(_:didVideoPublishStateChange:oldState:newState:elapseSinceLastState:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState: instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstLocalVideoFramePublishedWithElapsed:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType: instead."))); + +- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOfUid:size:rotation:)) __attribute__((availability(macos,deprecated=10_9,message="Use rtcEngine:videoSizeChangedOfSourceType:uid:size:rotation instead."))); +#endif +@end + +#pragma mark - AgoraRtcEngineKit + +/** + * Provides all methods that can be invoked by your application. + * + * Agora provides ensured quality of experience (QoE) for worldwide + * Internet-based voice and video communications through a virtual global + * network that is especially optimized for real-time web and mobile-to-mobile + * applications. + * + * `AgoraRtcEngineKit` is the basic interface class of Agora Native SDK. Creating an AgoraRtcEngineKit object and then calling the methods of this object enables the use of Agora Native SDK’s communication functionality. +*/ +__attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject + +#pragma mark Core Methods + +/**----------------------------------------------------------------------------- + * @name Core Methods + * ----------------------------------------------------------------------------- + */ + +/** + * Sets and retrieves the SDK delegate. + * + * The SDK uses the delegate to inform the app on engine runtime events. All methods defined in the + * delegate are optional implementation methods. + */ +@property(nonatomic, weak) id _Nullable delegate; + +/** + * Preload a channel. + * + * This method enables users to preload a channel. + * + * A successful call of this method will reduce the time of joining the same channel. + * + * Note: + * 1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available. + * 2. Renew the token of the preloaded channel by calling this method with the same 'channelId' and 'uid'. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid The user ID. This parameter is used to identify the user in the channel for real-time + * audio and video interaction. You need to set and manage user IDs yourself, and ensure that each + * user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value + * range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user + * ID and returns it in the onJoinChannelSuccess callback. Your application must record and maintain + * the returned user ID, because the SDK does not do so. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * preload the channel again. + */ +- (int)preloadChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + uid:(NSUInteger)uid NS_SWIFT_NAME(preloadChannel(byToken:channelId:uid:)); + +/** + * Preload a channel. + * + * This method enables users to preload a channel. + * + * A successful call of this method will reduce the time of joining the same channel. + * + * Note: + * 1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available. + * 2. Renew the token of the preloaded channel by calling this method with the same 'channelId' and 'userAccount'. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the userAccount parameter is empty. + * You need to pass in a valid parameter and preload the channel again. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * preload the channel again. + */ +- (int)preloadChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + userAccount:(NSString * _Nonnull)userAccount NS_SWIFT_NAME(preloadChannel(byToken:channelId:userAccount:)); + +/** + * Update token of the preloaded channels. + * + * An easy way to update all preloaded channels' tokens, if all preloaded channels use the same token. + * + * If preloaded channels use different tokens, we need to call the 'preloadChannel' method with the same 'channelId' + * and 'uid' or 'userAccount' to update the corresponding token. + * + * @param token The token generated on your server for authentication. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The token is invalid. You need to pass in a valid token and update the token again. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + */ +- (int)updatePreloadChannelToken:(NSString * _Nonnull)token NS_SWIFT_NAME(updatePreloadChannelToken(_:)); + +/** + * Joins a channel. + * + * Users in the same channel can talk to each other, and multiple users in the + * same channel can start a group chat. Users with different App IDs cannot + * call each other even if they join the same channel. + * + * You must call the \ref leaveChannel: leaveChannel method to exit the + * current call before entering another channel. This method call is + * asynchronous; therefore, you can call this method in the main user interface + * thread. + * + * A successful method call triggers the following callbacks: + * + * - The local client: \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. + * - The remote client: \ref AgoraRtcEngineDelegate.rtcEngine:didJoinedOfUid:elapsed: didJoinedOfUid, + * if the user joining the channel is in the Communication profile, or is a + * BROADCASTER in the Live Broadcast profile. + * + * When the connection between the client and Agora's server is interrupted due + * to poor network conditions, the SDK tries reconnecting to the server. When + * the local client successfully rejoins the channel, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didRejoinChannel:withUid:elapsed: didRejoinChannel callback on the local client. + * + * @note + * - When joining a channel, the SDK calls + * `setCategory(AVAudioSessionCategoryPlayAndRecord)` to set `AVAudioSession` + * to `PlayAndRecord` mode. When `AVAudioSession` is set to `PlayAndRecord` + * mode, the sound played (for example a ringtone) is interrupted. The app + * should not set `AVAudioSession` to any other mode. + * - The SDK uses the iOS's AVAudioSession shared object for audio recording + * and playback. Using this object may affect the SDK’s audio functions. + * @param token The token for authentication. + * - In situations not requiring high security: You can use the temporary token + * generated at Console. For details, see [Get a temporary token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-temporary-token). + * - In situations requiring high security: Set it as the token generated at + * you server. For details, see [Generate a token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-token). + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param info (Optional) Additional information about the channel. This + * parameter can be set to `nil` or contain channel related information. Other + * users in the channel do not receive this message. + * @param uid User ID. A 32-bit unsigned integer with a value ranging from 1 to + * (232-1). The `uid` must be unique. If a `uid` is not assigned (or + * set to 0), the SDK assigns and returns a `uid` in the callback. Your app + * must record and maintain the returned `uid` since the SDK does not do so. + * @param joinSuccessBlock Same as \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. We recommend you set this parameter as `nil` to use `didJoinChannel`. + * - If `joinSuccessBlock` is nil, the SDK triggers the `didJoinChannel` callback. + * - If you implement both `joinSuccessBlock` and `didJoinChannel`, `joinSuccessBlock` takes higher priority than `didJoinChannel`. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: #AgoraErrorCodeInvalidArgument + * - -3: #AgoraErrorCodeNotReady + * - -5: #AgoraErrorCodeRefused + */ +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + info:(NSString * _Nullable)info + uid:(NSUInteger)uid + joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannel(byToken:channelId:info:uid:joinSuccess:)); + +/** + * Joins a channel. + * + * Users in the same channel can talk to each other, and multiple users in the + * same channel can start a group chat. Users with different App IDs cannot + * call each other even if they join the same channel. + * + * You must call the \ref leaveChannel: leaveChannel method to exit the + * current call before entering another channel. This method call is + * asynchronous; therefore, you can call this method in the main user interface + * thread. + * + * A successful method call triggers the following callbacks: + * + * - The local client: \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. + * - The remote client: \ref AgoraRtcEngineDelegate.rtcEngine:didJoinedOfUid:elapsed: didJoinedOfUid, + * if the user joining the channel is in the Communication profile, or is a + * BROADCASTER in the Live Broadcast profile. + * + * When the connection between the client and Agora's server is interrupted due + * to poor network conditions, the SDK tries reconnecting to the server. When + * the local client successfully rejoins the channel, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didRejoinChannel:withUid:elapsed: didRejoinChannel callback on the local client. + * + * @note + * - When joining a channel, the SDK calls + * `setCategory(AVAudioSessionCategoryPlayAndRecord)` to set `AVAudioSession` + * to `PlayAndRecord` mode. When `AVAudioSession` is set to `PlayAndRecord` + * mode, the sound played (for example a ringtone) is interrupted. The app + * should not set `AVAudioSession` to any other mode. + * - The SDK uses the iOS's AVAudioSession shared object for audio recording + * and playback. Using this object may affect the SDK’s audio functions. + * @param token The token for authentication. + * - In situations not requiring high security: You can use the temporary token + * generated at Console. For details, see [Get a temporary token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-temporary-token). + * - In situations requiring high security: Set it as the token generated at + * you server. For details, see [Generate a token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-token). + * @param channelId Unique channel name for the AgoraRTC session in the string + * format. The string length must be less than 64 bytes. Supported character + * scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid User ID. A 32-bit unsigned integer with a value ranging from 1 to + * (232-1). The `uid` must be unique. If a `uid` is not assigned (or + * set to 0), the SDK assigns and returns a `uid` in the callback. Your app + * must record and maintain the returned `uid` since the SDK does not do so. + * @param mediaOptions AgoraRtcChannelMediaOptions Object. + * @param joinSuccessBlock Same as \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. We recommend you set this parameter as `nil` to use `didJoinChannel`. + * - If `joinSuccessBlock` is nil, the SDK triggers the `didJoinChannel` callback. + * - If you implement both `joinSuccessBlock` and `didJoinChannel`, `joinSuccessBlock` takes higher priority than `didJoinChannel`. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: #AgoraErrorCodeInvalidArgument + * - -3: #AgoraErrorCodeNotReady + * - -5: #AgoraErrorCodeRefused + */ +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + uid:(NSUInteger)uid + mediaOptions:(AgoraRtcChannelMediaOptions * _Nonnull)mediaOptions + joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannel(byToken:channelId:uid:mediaOptions:joinSuccess:)); + +- (int)startMultipleVideoStreams:(VIEW_CLASS * _Nonnull)view screen:(VIEW_CLASS * _Nonnull)screenView remotes:(NSArray * _Nullable)remoteViews NS_SWIFT_NAME(startMultipleVideoStreams(_:screen:remotes:)); + + +/** + * Leaves the channel. + * + * This method allows a user to leave the channel, for example, by hanging up or + * exiting a call. + * + * This method also releases all resources related to the call. + * + * This method is an asynchronous call, which means that the result of this + * method returns before the user has not actually left the channel. Once + * the user successfully leaves the channel, the SDK triggers the + * \ref AgoraRtcEngineDelegate.rtcEngine:didLeaveChannelWithStats: didLeaveChannelWithStats callback. + * + * @note + * - If you call \ref destroy immediately after this method, the leaveChannel + * process is interrupted, and the SDK does not trigger the + * `didLeaveChannelWithStats` callback. + * - When you call this method, the SDK deactivates the audio session on iOS by + * default, and may affect other apps. + * + * @param leaveChannelBlock This callback indicates that a user leaves a channel, and provides the statistics of the call in #AgoraChannelStats. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)leaveChannel:(void(^ _Nullable)(AgoraChannelStats * _Nonnull stat))leaveChannelBlock NS_SWIFT_NAME(leaveChannel(_:)); + +/** + * Leaves the channel. + * + * This method allows a user to leave the channel, for example, by hanging up or + * exiting a call. + * + * This method also releases all resources related to the call. + * + * This method is an asynchronous call, which means that the result of this + * method returns before the user has not actually left the channel. Once + * the user successfully leaves the channel, the SDK triggers the + * \ref AgoraRtcEngineDelegate.rtcEngine:didLeaveChannelWithStats: didLeaveChannelWithStats callback. + * + * @note + * - If you call \ref destroy immediately after this method, the leaveChannel + * process is interrupted, and the SDK does not trigger the + * `didLeaveChannelWithStats` callback. + * - When you call this method, the SDK deactivates the audio session on iOS by + * default, and may affect other apps. + * + * @param options The leave channel options. + * @param leaveChannelBlock This callback indicates that a user leaves a channel, and provides the statistics of the call in #AgoraChannelStats. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)leaveChannel:(AgoraLeaveChannelOptions * _Nonnull)options + leaveChannelBlock:(void (^ _Nullable)(AgoraChannelStats * _Nonnull))leaveChannelBlock NS_SWIFT_NAME(leaveChannel(_:leaveChannelBlock:)); + +/** + * Sets the channel profile. + * + * The SDK differentiates channel profiles and applies different optimization + * algorithms accordingly. + * + * @note + * - To ensure the quality of real-time communication, we recommend that all + * users in a channel use the same channel profile. + * - Call this method before calling `joinChannelByToken`. You + * cannot set the channel profile once you have joined the channel. + * + * @param profile The channel profile: #AgoraChannelProfile. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setChannelProfile:(AgoraChannelProfile)profile NS_SWIFT_NAME(setChannelProfile(_:)); + +/** + * Updates the channel media options after joining the channel. + * + * @param mediaOptions The channel media options: ChannelMediaOptions. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateChannelWithMediaOptions:(AgoraRtcChannelMediaOptions* _Nonnull)mediaOptions NS_SWIFT_NAME(updateChannel(with:)); + +/** + * Sets the role of a user. + * + * This method sets the role of a user as either a broadcaster or an audience. + * - The broadcaster sends and receives streams. + * - The audience receives streams only. + * @note + * By default, all users are audience regardless of the channel profile. Call + * this method to change the user role to BROADCASTER so that the user can send + * a stream. + * @param role Role of the client: #AgoraClientRole. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setClientRole:(AgoraClientRole)role NS_SWIFT_NAME(setClientRole(_:)); + +/** Sets the role of a user. + +This method is applicable only to the live interactive streaming profile. + +Sets the role of a user, such as a host or an audience (default), before joining a channel. + +This method can be used to switch the user role after a user joins a channel. + +When a user switches user roles after joining a channel, a successful method call triggers the following callback: + +- The local client: [didClientRoleChanged]([AgoraRtcEngineDelegate rtcEngine:didClientRoleChanged:newRole:]) +- Remote clients: [didJoinedOfUid]([AgoraRtcEngineDelegate rtcEngine:didJoinedOfUid:elapsed:]) or [didOfflineOfUid(AgoraUserOfflineReasonBecomeAudience)]([AgoraRtcEngineDelegate rtcEngine:didOfflineOfUid:reason:]) + + @param role The role of the user: + + - `AgoraClientRoleBroadcaster(1)`: Host. A host can both send and receive streams. + - `AgoraClientRoleAudience(2)`: Audience, the default role. An audience can only receive streams. + + @param options The client role of the user, see AgoraClientRoleOptions. + + @return - `0`(`AgoraRtmpStreamingErrorCodeOK`): Success. +- < `0`: Failure. + + - `-1`(`AgoraErrorCodeFailed`): A general error occurs (no specified reason). + - `-2`(`AgoraErrorCodeInvalidArgument`): The parameter is invalid. + - `-7`(`AgoraErrorCodeNotInitialized`): The SDK is not initialized. + */ +- (int)setClientRole:(AgoraClientRole)role options:(AgoraClientRoleOptions * _Nullable)options NS_SWIFT_NAME(setClientRole(_:options:)); + +/** + * Renews the token. + * + * Once a token is enabled and used, it expires after a certain period of time. + * + * Under the following circumstances, generate a new token on your server, and + * then call this method to renew it. Failure to do so results in the SDK + * disconnecting from the server. + * - The \ref AgoraRtcEngineDelegate.rtcEngine:tokenPrivilegeWillExpire: tokenPrivilegeWillExpire callback is triggered. + * - The \ref AgoraRtcEngineDelegate.rtcEngineRequestToken: rtcEngineRequestToken callback is triggered. + * - The `AgoraErrorCodeTokenExpired`(-109) error is reported. + * @param token The new token. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)renewToken:(NSString * _Nonnull)token NS_SWIFT_NAME(renewToken(_:)); + +/** + * Gets the connection state of the SDK. + * + * @return The connection state. See \ref AgoraConnectionState. + */ +- (AgoraConnectionState)getConnectionState NS_SWIFT_NAME(getConnectionState()); + +/** Starts to relay media streams across channels. + + After a successful method call, the SDK triggers the [channelMediaRelayStateDidChange]([AgoraRtcEngineDelegate rtcEngine:channelMediaRelayStateDidChange:error:]) and [didReceiveChannelMediaRelayEvent]([AgoraRtcEngineDelegate rtcEngine:didReceiveChannelMediaRelayEvent:]) callbacks, and these callbacks return the state and events of the media stream relay. + + - If the `channelMediaRelayStateDidChange` callback returns AgoraChannelMediaRelayStateRunning(2) and AgoraChannelMediaRelayStateIdle(0), and the `didReceiveChannelMediaRelayEvent` callback returns AgoraChannelMediaRelayEventSentToDestinationChannel(4), the SDK starts relaying media streams between the original and the destination channel. + - If the `channelMediaRelayStateDidChange` callback returns AgoraChannelMediaRelayStateFailure(3), an exception occurs during the media stream relay. + + **Note** + + - Call this method after the [joinChannel]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) method. + - This method takes effect only when you are a broadcaster in a Live-broadcast channel. + - After a successful method call, if you want to call this method again, ensure that you call the [stopChannelMediaRelay]([AgoraRtcEngineKit stopChannelMediaRelay]) method to quit the current relay. + - Contact sales-us@agora.io before implementing this function. + - We do not support string user accounts in this API. + + @param config The configuration of the media stream relay: [AgoraChannelMediaRelayConfiguration](AgoraChannelMediaRelayConfiguration). + + @return - 0: Success. + - < 0: Failure. + */ +- (int)startChannelMediaRelay:(AgoraChannelMediaRelayConfiguration * _Nonnull)config NS_SWIFT_NAME(startChannelMediaRelay(_:)); + +/** Updates the channels for media stream relay. + + After the channel media relay starts, if you want to relay the media stream to more channels, or leave the current relay channel, you can call the `updateChannelMediaRelay` method. + + After a successful method call, the SDK triggers the [didReceiveChannelMediaRelayEvent]([AgoraRtcEngineDelegate rtcEngine:didReceiveChannelMediaRelayEvent:]) callback with the AgoraChannelMediaRelayEventUpdateDestinationChannel(7) state code. + + **Note** + + - Call this method after the [startChannelMediaRelay]([AgoraRtcEngineKit startChannelMediaRelay:]) method to update the destination channel. + - This method supports adding at most four destination channels in the relay. If there are already four destination channels in the relay, remove the unnecessary ones with the `removeDestinationInfoForChannelName` method in channelMediaRelayConfiguration before calling this method. + + @param config The media stream relay configuration: [AgoraChannelMediaRelayConfiguration](AgoraChannelMediaRelayConfiguration). + + @return - 0: Success. + - < 0: Failure. + */ +- (int)updateChannelMediaRelay:(AgoraChannelMediaRelayConfiguration * _Nonnull)config NS_SWIFT_NAME(updateChannelMediaRelay(_:)); + +/** Stops the media stream relay. + + Once the relay stops, the broadcaster quits all the destination channels. + + After a successful method call, the SDK triggers the [channelMediaRelayStateDidChange]([AgoraRtcEngineDelegate rtcEngine:channelMediaRelayStateDidChange:error:]) callback. If the callback returns AgoraChannelMediaRelayStateIdle(0) and AgoraChannelMediaRelayErrorNone(0), the broadcaster successfully stops the relay. + + @note If the method call fails, the SDK triggers the [channelMediaRelayStateDidChange]([AgoraRtcEngineDelegate rtcEngine:channelMediaRelayStateDidChange:error:]) callback with the AgoraChannelMediaRelayErrorServerNoResponse(2) or AgoraChannelMediaRelayEventUpdateDestinationChannelRefused(8) state code. You can leave the channel by calling the [leaveChannel]([AgoraRtcEngineKit leaveChannel:]) method, and the media stream relay automatically stops. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)stopChannelMediaRelay NS_SWIFT_NAME(stopChannelMediaRelay()); + +/** pause the channels for media stream relay. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)pauseAllChannelMediaRelay NS_SWIFT_NAME(pauseAllChannelMediaRelay()); + +/** resume the channels for media stream relay. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)resumeAllChannelMediaRelay NS_SWIFT_NAME(resumeAllChannelMediaRelay()); + +/** Turn WIFI acceleration on or off. + * + * @note + * - This method is called before and after joining a channel. + * - Users check the WIFI router app for information about acceleration. Therefore, if this interface is invoked, the caller accepts that the caller's name will be displayed to the user in the WIFI router application on behalf of the caller. + * + * @param enabled + * - true:Turn WIFI acceleration on. + * - false:Turn WIFI acceleration off. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableWirelessAccelerate:(BOOL)enabled NS_SWIFT_NAME(enableWirelessAccelerate(_:)); + +- (int)startLocalVideoTranscoder:(AgoraLocalTranscoderConfiguration* _Nonnull)config NS_SWIFT_NAME(startLocalVideoTranscoder(_:)); + +- (int)updateLocalTranscoderConfiguration:(AgoraLocalTranscoderConfiguration* _Nonnull)config NS_SWIFT_NAME(updateLocalTranscoderConfiguration(_:)); + +- (int)stopLocalVideoTranscoder NS_SWIFT_NAME(stopLocalVideoTranscoder()); + + +/** + @brief Start tracing media rendering events. + @since v4.1.1 + @discussion + - SDK will trace media rendering events when this API is called. + - The tracing result can be obtained through callback `[AgoraRtcEngineDelegate rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:]` + @note + - By default, SDK will trace media rendering events when join channel. + - The start point of event tracing will be reset after leaving channel. + @return + - 0: Success. + - < 0: Failure. + - `-7(AgoraErrorCodeNotInitialized)`: The SDK is not initialized. + */ +- (int)startMediaRenderingTracing NS_SWIFT_NAME(startMediaRenderingTracing()); + +/** + @brief Enable instant media rendering. + @since v4.1.1 + @discussion + - This method enable SDK to render video or playout audio faster. + @note + - Once enable this mode, we should destroy rtc engine to disable it. + - Enable this mode, will sacrifice some part of experience. + @return + - 0: Success. + - < 0: Failure. + - `-7(AgoraErrorCodeNotInitialized)`: The SDK is not initialized. + */ +- (int)enableInstantMediaRendering NS_SWIFT_NAME(enableInstantMediaRendering()); + +/** + * @deprecated Web SDK interoperability is by default enabled. + * + * @param enabled Whether interoperability with the Agora Web SDK is enabled: + * - YES: Enabled. + * - NO: Disabled. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)enableWebSdkInteroperability:(BOOL)enabled NS_SWIFT_NAME(enableWebSdkInteroperability(_:)) __deprecated; + +/** + * Initializes the Agora SDK service. + * + * After the initialization, the service is set to enable audio by default. + * @note Ensure that you call this method before calling any other API. + * @warning Only users with the same App ID can call each other. + * @warning One AgoraRtcEngineKit can use only one App ID. If you need to + * change the App ID, call \ref destroy to release the current instance + * first, and then call this method to create a new instance. + @param appId [App ID](https://docs.agora.io/en/Agora%20Platform/terms?platform=All%20Platforms#a-nameappidaapp-id) of + your Agora project. + @param delegate AgoraRtcEngineDelegate. + @return An AgoraRtcEngineKit object. + */ ++ (instancetype _Nonnull)sharedEngineWithAppId:(NSString * _Nonnull)appId + delegate:(id _Nullable)delegate NS_SWIFT_NAME(sharedEngine(withAppId:delegate:)); + +/** Creates an AgoraRtcEngineKit instance. + + Unless otherwise specified, all the methods provided by the AgoraRtcEngineKit instance are executed asynchronously. Agora recommends calling these methods in the same thread. + + @note + - You must create the AgoraRtcEngineKit instance before calling any other method. + - You can create an AgoraRtcEngineKit instance either by calling this method or by calling \ref AgoraRtcEngineKit.sharedEngineWithAppId:delegate: sharedEngineWithAppId. The difference between `sharedEngineWithAppId` and this method is that this method enables you to specify the connection area. + - The SDK supports creating only one AgoraRtcEngineKit instance for an app for now. + + @param config Configurations for the AgoraRtcEngineKit instance. For details, see AgoraRtcEngineConfig. + @param delegate AgoraRtcEngineDelegate. + + @return - The AgoraRtcEngineKit instance, if this method call succeeds. + - The error code, if this method call fails. + + - `-1`(`AgoraErrorCodeFailed`): A general error occurs (no specified reason). + - `-2`(`AgoraErrorCodeInvalidArgument`): No `AgoraRtcEngineDelegate` object is specified. + - `-7`(`AgoraErrorCodeNotInitialized`): The SDK is not initialized. + - `-101`(`AgoraErrorCodeInvalidAppId`): The App ID is invalid. + */ ++ (instancetype _Nonnull)sharedEngineWithConfig:(AgoraRtcEngineConfig * _Nonnull)config + delegate:(id _Nullable)delegate NS_SWIFT_NAME(sharedEngine(with:delegate:)); + +/** + * This method releases all the resources used by the Agora SDK. This is useful + * for applications that occasionally make voice or video calls, to free up + * resources for other operations when not making calls. + * Once the application has called this method to destroy the created + * AgoraRtcEngineKit instance, no other methods in the SDK can be used and no + * callbacks occur. To start communications again, call + * \ref sharedEngineWithAppId:delegate: sharedEngineWithAppId to establish a + * new AgoraRtcEngineKit instance. + * @note + * - Call this method in the subthread. + * - This method is a synchronous call, which means that the result of + * this method call returns after the AgoraRtcEngineKit object resources are + * released. Do not call this method in any callback generated by the SDK, or + * it may result in a deadlock. + */ ++ (void)destroy NS_SWIFT_NAME(destroy()); + +#pragma mark Core Audio + +/**----------------------------------------------------------------------------- + * @name Core Audio + * ----------------------------------------------------------------------------- + */ + +/** + * Enables the audio. + * + * The audio is enabled by default. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAudio NS_SWIFT_NAME(enableAudio()); + +/** + * Disables the audio. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)disableAudio NS_SWIFT_NAME(disableAudio()); + +/** + * Enables or disables the local audio capture. + * + * The audio function is enabled by default. This method disables or re-enables the + * local audio function, that is, to stop or restart local audio capture and + * processing. + * + * This method does not affect receiving or playing the remote audio streams, + * and `enableLocalAudio` (NO) is applicable to scenarios where the user wants + * to receive remote audio streams without sending any audio stream to other users + * in the channel. + * + * @param enabled Determines whether to disable or re-enable the local audio function: + * - `YES`: (Default) Re-enable the local audio function, that is, to start local + * audio capture and processing. + * - `NO`: Disable the local audio function, that is, to stop local audio + * capture and processing. + * + * @return + * - 0: Success. + * - < 0: Failure. +*/ +- (int)enableLocalAudio:(BOOL)enabled NS_SWIFT_NAME(enableLocalAudio(_:)); + +/** + * Sets the audio profile. + * @note + * - Call this method before calling `joinChannelByToken`. + * - In scenarios requiring high-quality audio, Agora recommends setting `profile` + * as `AgoraAudioProfileMusicHighQuality`(4). + * - To set the audio scenario, call the \ref sharedEngineWithConfig:delegate: sharedEngineWithConfig + * method. + * @param profile The audio profile, such as the sample rate, bitrate, encoding mode, and the number of + * channels, see #AgoraAudioProfile. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setAudioProfile:(AgoraAudioProfile)profile NS_SWIFT_NAME(setAudioProfile(_:)); + +- (int)setAudioScenario:(AgoraAudioScenario)scenario NS_SWIFT_NAME(setAudioScenario(_:)); + +/** + * Enables the `reportAudioVolumeIndicationOfSpeakers` callback to report on + * which users are speaking and the speakers' volume. + * + * Once the \ref AgoraRtcEngineDelegate.rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume: reportAudioVolumeIndicationOfSpeakers + * callback is enabled, the SDK returns the volume indication in the at the + * time interval set in `enableAudioVolumeIndication`, regardless of whether + * any user is speaking in the channel. + * + * @param interval Sets the time interval between two consecutive volume indications: + * - <= 0: Disables the volume indication. + * - > 0: Time interval (ms) between two consecutive volume indications, + * and should be integral multiple of 200 (less than 200 will be set to 200). + * @param smooth The smoothing factor that sets the sensitivity of the audio + * volume indicator. The value range is [0, 10]. The greater the value, the + * more sensitive the indicator. The recommended value is 3. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAudioVolumeIndication:(NSInteger)interval + smooth:(NSInteger)smooth + reportVad:(BOOL)reportVad NS_SWIFT_NAME(enableAudioVolumeIndication(_:smooth:reportVad:)); + + +#if TARGET_OS_IPHONE +/** + * Enables/Disables the speakerphone temporarily. (iOS only) + * + * When the audio route changes, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didAudioRouteChanged: didAudioRouteChanged callback. + * + * You can call this method before, during, or after a call. However, Agora recommends calling this method only when you are in a channel to change the audio route temporarily. + * @note + * - The SDK calls `setCategory(AVAudioSessionCategoryPlayAndRecord)` with options to configure the headset or speakerphone, so this method call applies to all audio playback in the system. + * - This method sets the audio route temporarily. Plugging in or unplugging a headphone, or the SDK re-enabling the audio device module (ADM) + * to adjust the media volume in some scenarios relating to audio, leads to a change in the audio route. See *Principles for Changing the Audio Route*. + * @param enableSpeaker Whether to set the speakerphone as the temporary audio route: + * - `YES`: Set the speakerphone as the audio route temporarily. This setting does not take effect if a headphone or a Bluetooth audio device is connected. + * - `NO`: Do not set the speakerphone as the audio route. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setEnableSpeakerphone:(BOOL)enableSpeaker NS_SWIFT_NAME(setEnableSpeakerphone(_:)); + +/** + * Checks whether the speakerphone is enabled. (iOS only) + * + * @return + * - `YES`: The speakerphone is enabled, and the audio plays from the + * speakerphone. + * - `NO`: The speakerphone is not enabled, and the audio plays from devices + * other than the speakerphone. For example, the headset or earpiece. + */ +- (BOOL)isSpeakerphoneEnabled NS_SWIFT_NAME(isSpeakerphoneEnabled()); + +/** + * Sets the default audio route. (iOS only) + * + * Most mobile phones have two audio routes: An earpiece at the top, and a speakerphone at the bottom. + * The earpiece plays at a lower volume, and the speakerphone plays at a higher volume. + * + * By setting the default audio route, you determine whether the audio playback comes through the earpiece or speakerphone + * when no external audio device is connected. + * + * Depending on the scenario, Agora uses different default audio routes: + * - Voice call: Earpiece + * - Audio broadcast: Speakerphone + * - Video call: Speakerphone + * - Video broadcast: Speakerphone + * + * Call this method to change the default audio route before, during, or after a call. + * When the audio route changes, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didAudioRouteChanged: didAudioRouteChanged callback. + * @note + * The system audio route changes when an external audio device, such as a headphone or a Bluetooth audio device, is connected. See *Principles for Changing the Audio Route*. + * @param defaultToSpeaker Whether to set the speakerphone as the default audio route: + * - `YES`: Set the speakerphone as the default audio route. + * - `NO`: Do not set the speakerphone as the default audio route. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDefaultAudioRouteToSpeakerphone:(BOOL)defaultToSpeaker NS_SWIFT_NAME(setDefaultAudioRouteToSpeakerphone(_:)); +#endif + +/** Adjusts the recording volume. + + @param volume Recording volume; ranges from 0 to 400: + + * 0: Mute + * 100: Original volume + * 400: (Maximum) Four times the original volume with signal clipping protection + + @return * 0: Success. +* <0: Failure. + */ +- (int)adjustRecordingSignalVolume:(NSInteger)volume NS_SWIFT_NAME(adjustRecordingSignalVolume(_:)); + +/** Adjusts the playback volume. + + @param volume Playback volume; ranges from 0 to 400: + + * 0: Mute + * 100: Original volume + * 400: (Maximum) Four times the original volume with signal clipping protection + + @return * 0: Success. +* <0: Failure. + */ +- (int)adjustPlaybackSignalVolume:(NSInteger)volume NS_SWIFT_NAME(adjustPlaybackSignalVolume(_:)); + +/** Adjust the playback signal volume of a specified remote user. + + You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user. + + **Note** + + - Call this method after joining a channel. + - The playback volume here refers to the mixed volume of a specified remote user. + - This method can only adjust the playback volume of one specified remote user at a time. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. + + @param uid The ID of the remote user. + @param volume The playback volume of the specified remote user. The value ranges from 0 to 100: + + - 0: Mute. + - 100: Original volume. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)adjustUserPlaybackSignalVolume:(NSUInteger)uid volume:(int)volume NS_SWIFT_NAME(adjustUserPlaybackSignalVolume(_:volume:)); + +/** Mutes the recording signal. + + @param muted * YES: Mute the recording signal + * NO: Unmute the recording signal + + @return * 0: Success. +* <0: Failure. + */ +- (int)muteRecordingSignal:(BOOL)muted NS_SWIFT_NAME(muteRecordingSignal(_:)); + +/** + * Stops or resumes sending the local audio stream. + * + * @param mute Whether to send or stop sending the local audio stream: + * - `YES`: Stops sending the local audio stream. + * - `NO`: (Default) Sends the local audio stream. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteLocalAudioStream:(BOOL)mute NS_SWIFT_NAME(muteLocalAudioStream(_:)); + +/** + * Stops/Resumes receiving the audio stream of a specified user. + * + * You can call this method before or after joining a channel. + * If a user leaves a channel, the settings in this method become invalid. + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the audio stream of the specified user: + * - `YES`: Stop receiving the audio stream of the specified user. + * - `NO`: (Default) Resume receiving the audio stream of the specified user. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteRemoteAudioStream:(NSUInteger)uid mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteAudioStream(_:mute:)); + +/** + * Stops/Resumes receiving all remote audio streams. + * + * This method works for all remote users that join or will join a channel. You can call this method before, during, or after a call. + * - If you call `muteAllRemoteAudioStreams`(YES) before joining a channel, the local user does not receive any audio stream after joining the channel. + * - If you call `muteAllRemoteAudioStreams`(YES) after joining a channel, the local use stops receiving any audio stream from any user in the channel, including any user who joins the channel after you call this method. + * - If you call `muteAllRemoteAudioStreams`(YES) after leaving a channel, the local user does not receive any audio stream the next time the user joins a channel. + * + * After you successfully call `muteAllRemoteAudioStreams`(YES), you can take the following actions: + * - To resume receiving all remote audio streams, call `muteAllRemoteAudioStreams`(NO). + * - To resume receiving the audio stream of a specified user, call \ref muteRemoteAudioStream:mute: muteRemoteAudioStream(uid, NO), where `uid` is the ID of the user whose audio stream you want to resume receiving. + * + * @note + * - The result of calling this method is affected by calling \ref enableAudio and \ref disableAudio. Settings in `muteAllRemoteAudioStreams` stop taking effect if either of the following occurs: + * - Calling `enableAudio` after `muteAllRemoteAudioStreams`(YES). + * - Calling `disableAudio` after `muteAllRemoteAudioStreams`(NO). + * - In scenarios involving multiple channels, use \ref AgoraRtcChannelMediaOptions.autoSubscribeAudio autoSubscribeAudio to set whether to receive remote audio streams for a specific channel. + * @param mute Whether to stop receiving remote audio streams: + * - `YES`: Stop receiving any remote audio stream. + * - `NO`: (Default) Resume receiving all remote audio streams. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)muteAllRemoteAudioStreams:(BOOL)mute NS_SWIFT_NAME(muteAllRemoteAudioStreams(_:)); + +/** + * @deprecated + * To set whether to receive remote audio streams by default, call \ref muteAllRemoteAudioStreams: muteAllRemoteAudioStreams before calling `joinChannelByToken`. + * + * Determines whether to receive all remote audio streams by default. + * + * @param mute Whether to receive remote audio streams by default: + * - `YES`: Do not receive any remote audio stream by default. + * - `NO`: (Default) Receive remote audio streams by default. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setDefaultMuteAllRemoteAudioStreams:(BOOL)mute NS_SWIFT_NAME(setDefaultMuteAllRemoteAudioStreams(_:)) __deprecated; + +/** + * Registers an extension. Normally, you should call this function immediately after initializing the engine. + * Once an extension is registered, SDK will create and add extension to pipeline automatically. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param sourceType The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)registerExtensionWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + sourceType:(AgoraMediaSourceType)sourceType NS_SWIFT_NAME(registerExtension(withVendor:extension:sourceType:)); + +/** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtensionWithVendor, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtensionWithVendor explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param enabled Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableExtensionWithVendor:(NSString * __nonnull)provider extension:(NSString * __nonnull)extension enabled:(BOOL)enabled NS_SWIFT_NAME(enableExtension(withVendor:extension:enabled:)); + +/** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtensionWithVendor, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtensionWithVendor explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param enabled Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * @param sourceType The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableExtensionWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + enabled:(BOOL)enabled + sourceType:(AgoraMediaSourceType)sourceType NS_SWIFT_NAME(enableExtension(withVendor:extension:enabled:sourceType:)); + +/** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtensionWithVendor, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtensionWithVendor explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension definition see AgoraExtensionInfo + * @param enabled Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableExtensionWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + extensionInfo:(AgoraExtensionInfo * __nonnull)extensionInfo + enabled:(BOOL)enabled NS_SWIFT_NAME(enableExtension(withVendor:extension:extensionInfo:enabled:)); + +/** + * Sets the provider property of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExtensionProviderPropertyWithVendor:(NSString * __nonnull)provider + key:(NSString * __nonnull)key + value:(NSString * __nonnull)value NS_SWIFT_NAME(setExtensionProviderPropertyWithVendor(_:key:value:)); + +/** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return true, if get property success, otherwise false + */ +- (int)setExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + key:(NSString * __nonnull)key + value:(NSString * __nonnull)value NS_SWIFT_NAME(setExtensionPropertyWithVendor(_:extension:key:value:)); + +/** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * @param sourceType The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + key:(NSString * __nonnull)key + value:(NSString * __nonnull)value + sourceType:(AgoraMediaSourceType)sourceType NS_SWIFT_NAME(setExtensionPropertyWithVendor(_:extension:key:value:sourceType:)); +/** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. See AgoraExtensionInfo. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + extensionInfo:(AgoraExtensionInfo * __nonnull)extensionInfo + key:(NSString * __nonnull)key + value:(NSString * __nonnull)value NS_SWIFT_NAME(setExtensionPropertyWithVendor(_:extension:extensionInfo:key:value:)); + +/** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * + * @return + * - json formatted string of property's value; return null if failed + */ +- (NSString * _Nullable)getExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + key:(NSString * __nonnull)key NS_SWIFT_NAME(getExtensionProperty(withVendor:extension:key:)); + +/** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param sourceType The source type of the extension, e.g. AgoraMediaSourceTypePrimaryCamera. See AgoraMediaSourceType. + * + * @return + * - json formatted string of property's value; return null if failed + */ +- (NSString * _Nullable)getExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + key:(NSString * __nonnull)key + sourceType:(AgoraMediaSourceType)sourceType NS_SWIFT_NAME(getExtensionProperty(withVendor:extension:key:sourceType:)); + +/** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. See AgoraExtensionInfo. + * @param key The key of the extension. + * + * @return + * - json formatted string of property's value; return null if failed + */ +- (NSString * _Nullable)getExtensionPropertyWithVendor:(NSString * __nonnull)provider + extension:(NSString * __nonnull)extension + extensionInfo:(AgoraExtensionInfo * __nonnull)extensionInfo + key:(NSString * __nonnull)key NS_SWIFT_NAME(getExtensionProperty(withVendor:extension:extensionInfo:key:)); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) + +/** Enables loopback sampling. (macOS only) + * If you enable loopback sampling, the output of the sound card is mixed into the audio stream sent to the other end. + + * You can call this method either before or after joining a channel. + + * *Note:** + * macOS does not support loopback sampling of the default sound card. If you need to use this method, + * please use a virtual sound card and pass its name to the `deviceName` parameter. Agora has tested and recommends using soundflower. + + * @param enabled Sets whether to enable/disable loopback sampling. + * YES: Enable loopback sampling. + * NO: (Default) Disable loopback sampling. + + * @param deviceName Pointer to the device name of the sound card. The default value is nil (default sound card). + * If you use a virtual sound card like "Soundflower", set this parameter as the name of the sound card, "Soundflower", + * and the SDK will find the corresponding sound card and start capturing. + * @return + * 0: Success. + * < 0: Failure. + */ +- (int)enableLoopbackRecording:(BOOL)enabled deviceName:(NSString* _Nullable)deviceName NS_SWIFT_NAME(enableLoopbackRecording(_:deviceName:)); + +/** Adjusts the loopback recording volume. + * + * @param volume The loopback volume, which ranges from 0 to 100: + + * - 0: Mute the recoridng volume. + * - 100: The Original volume. + * protection. + + * @return + * - 0: Success. + *- < 0: Failure. +*/ +- (int)adjustLoopbackSignalVolume:(NSInteger)volume NS_SWIFT_NAME(adjustLoopbackSignalVolume(_:)); + +/** Retrieves the audio volume for recording loopback. + * @note Call this method when you are in a channel. + * @return + * - >= 0: The audio volume for loopback, if this method call succeeds. The value range is [0, 100]. + * - < 0: Failure. +*/ +- (int)getLoopbackRecordingVolume NS_SWIFT_NAME(getLoopbackRecordingVolume()); + +#endif + +#pragma mark Core Video + +/**----------------------------------------------------------------------------- + * @name Core Video + * ----------------------------------------------------------------------------- + */ + +/** + * Enables the video. + * + * You can call this method either before joining a channel or during a call. + * If you call this method before entering a channel, the service starts the + * video; if you call it during a call, the audio call switches to a video call. + * + * @note + * This method controls the underlying states of the engine. It is still + * valid after one leaves the channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableVideo NS_SWIFT_NAME(enableVideo()); + +/** + * Disables the video. + * + * This method stops capturing the local video and receiving all remote video. + * To enable the local preview function, call \ref enableLocalVideo: enableLocalVideo(YES). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)disableVideo NS_SWIFT_NAME(disableVideo()); + +/** + * Disables or re-enables the local video capture. + * + * Once you enable the video using \ref enableVideo, the local video is + * enabled by default. This method disables or re-enables the local video + * capture. + * + * `enableLocalVideo(NO)` applies to scenarios when the user wants to watch the + * remote video without sending any video stream to the other user. + * + * @note + * Call this method after `enableVideo`. Otherwise, this method may not work properly. + * + * @param enabled Determines whether to disable or re-enable the local video, + * including the capturer, renderer, and sender: + * - `YES`: (Default) Re-enable the local video. + * - `NO`: Disable the local video. Once the local video is disabled, the remote + * users can no longer receive the video stream of this user, while this user + * can still receive the video streams of other remote users. When you set + * `enabled` as `NO`, this method does not require a local camera. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableLocalVideo:(BOOL)enabled NS_SWIFT_NAME(enableLocalVideo(_:)); + +/** + * QueryCodecCapability. + * query current device codec capacity. and will return codec actual capability. + * + * @param a array for save result + * + */ +- (NSArray *__nullable)queryCodecCapability ; + +/** + * Queries the score of the current device. + * + * @return + * > 0: If the value is greater than 0, it means that the device score has been retrieved and represents the score value. + * Most devices score between 60-100, with higher scores indicating better performance. + * + * < 0: Failure. + */ +- (int)queryDeviceScore NS_SWIFT_NAME(queryDeviceScore()); + +/** + * Sets the video encoder configuration. + * + * Each configuration profile corresponds to a set of video parameters, + * including the resolution, frame rate, and bitrate. + * + * The parameters specified in this method are the maximum values under ideal network conditions. + * If the video engine cannot render the video using the specified parameters + * due to poor network conditions, the parameters further down the list are + * considered until a successful configuration is found. + * + * @param config The local video encoder configuration, see #AgoraVideoEncoderConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVideoEncoderConfiguration:(AgoraVideoEncoderConfiguration * _Nonnull)config NS_SWIFT_NAME(setVideoEncoderConfiguration(_:)); + + +/** + * This method initializes the video view of the local stream on the local + * device. + * + * It affects only the video view that the local user sees, not the published + * local video stream. + * + * Call this method to bind the local video stream to a video view and to set + * the rendering and mirror modes of the video view. To unbind the `view`, set + * the `view` in #AgoraRtcVideoCanvas to `nil`. + * + * @note + * Call this method before joining a channel. + * @param local The local video view and settings. See #AgoraRtcVideoCanvas. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setupLocalVideo:(AgoraRtcVideoCanvas * _Nullable)local NS_SWIFT_NAME(setupLocalVideo(_:)); + +/** + * @deprecated + */ +- (int)setLocalVideoMirrorMode:(AgoraVideoMirrorMode)mode NS_SWIFT_NAME(setLocalVideoMirrorMode(_:)) __deprecated; + +/** + * @deprecated + */ +- (int)setLocalRenderMode:(NSUInteger)uid + mode:(AgoraVideoRenderMode)mode NS_SWIFT_NAME(setLocalRenderMode(_:mode:)) __deprecated; + +/** + * Updates the display mode of the local video view. + * + * After initialzing the local video view, you can call this method to update + * its rendering mode. It affects only the video view that the local user sees, not the published local video stream. + * + * @note + * - Ensure that you have called \ref setupLocalVideo: setupLocalVideo to + * initialize the local video view before this method. + * - During a call, you can call this method as many times as necessary to update the local video view. + * + * @param mode Sets the local display mode. See #AgoraVideoRenderMode. + * @param mirror Sets the mirror mode. See #AgoraVideoMirrorMode + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLocalRenderMode:(AgoraVideoRenderMode)mode + mirror:(AgoraVideoMirrorMode)mirror NS_SWIFT_NAME(setLocalRenderMode(_:mirror:)); + +/** + * Starts the local video preview before joining a channel. + * + * Once you call this method to start the local video preview, if you leave + * the channel by calling \ref leaveChannel: leaveChannel, the local video + * preview remains until you call \ref stopPreview to disable it. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + +- (int)startPreview NS_SWIFT_NAME(startPreview()); + +/** + * Starts the local video preview before joining a channel. + * + * Once you call this method to start the local video preview, if you leave + * the channel by calling \ref leaveChannel: leaveChannel, the local video + * preview remains until you call \ref stopPreview to disable it. + * @param sourceType source type of video. See #AgoraVideoSourceType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + +- (int)startPreview: (AgoraVideoSourceType)sourceType NS_SWIFT_NAME(startPreview(_:)); + +/** + * Stops the local video preview and the video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopPreview NS_SWIFT_NAME(stopPreview()); + +/** + * Stops the local video preview and the video. + * @param sourceType source type of video. See #AgoraVideoSourceType. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopPreview: (AgoraVideoSourceType)sourceType NS_SWIFT_NAME(stopPreview(_:)); + +/** Binds the remote user to the video display window, that is, sets the view for the user of the specified uid. + + Usually, the application should specify the uid of the remote video in the method call before the user enters a channel. If the remote uid is unknown to the application, set it later when the application receives the [userJoinedBlock]([AgoraRtcEngineKit userJoinedBlock:]) event. + If the Video Recording function is enabled, the Video Recording Service joins the channel as a dumb client, which means other clients will also receive the [didJoinedOfUid]([AgoraRtcEngineDelegate rtcEngine:didJoinedOfUid:elapsed:]) event. Your application should not bind it with the view, because it does not send any video stream. If your application cannot recognize the dumb client, bind it with the view when the [firstRemoteVideoDecodedOfUid]([AgoraRtcEngineDelegate rtcEngine:firstRemoteVideoDecodedOfUid:size:elapsed:]) event is triggered. To unbind the user with the view, set the view to null. After the user has left the channel, the SDK unbinds the remote user. + + @param remote AgoraRtcVideoCanvas + + @return * 0: Success. +* <0: Failure. + */ +- (int)setupRemoteVideo:(AgoraRtcVideoCanvas * _Nonnull)remote NS_SWIFT_NAME(setupRemoteVideo(_:)); + +/** Configures the remote video display mode. The application can call this method multiple times to change the display mode. + + @param uid User id of the user whose video streams are received. + @param mode AgoraVideoRenderMode + @param mirror AgoraVideoMirrorMode + + @return * 0: Success. +* <0: Failure. + */ +- (int)setRemoteRenderMode:(NSUInteger)uid + mode:(AgoraVideoRenderMode)mode + mirror:(AgoraVideoMirrorMode)mirror NS_SWIFT_NAME(setRemoteRenderMode(_:mode:mirror:)); + + +/** + * Stops or resumes sending the local video stream. + * + * @param mute Determines whether to send or stop sending the local video + * stream: + * - `YES`: Stop sending the local video stream. + * - `NO`: (Default) Send the local video stream. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteLocalVideoStream:(BOOL)mute NS_SWIFT_NAME(muteLocalVideoStream(_:)); + +/** + * Stops/Resumes receiving all remote video streams. + * + * This method works for all remote users that join or will join a channel. You can call this method before, during, or after a call. + * - If you call `muteAllRemoteVideoStreams`(YES) before joining a channel, the local user does not receive any video stream after joining the channel. + * - If you call `muteAllRemoteVideoStreams`(YES) after joining a channel, the local use stops receiving any video stream from any user in the channel, including any user who joins the channel after you call this method. + * - If you call `muteAllRemoteVideoStreams`(YES) after leaving a channel, the local user does not receive any video stream the next time the user joins a channel. + * + * After you successfully call `muteAllRemoteVideoStreams`(YES), you can take the following actions: + * - To resume receiving all remote video streams, call `muteAllRemoteVideoStreams`(NO). + * - To resume receiving the video stream of a specified user, call \ref muteRemoteVideoStream:mute: muteRemoteVideoStream(uid, NO), where `uid` is the ID of the user whose video stream you want to resume receiving. + * + * @note + * - The result of calling this method is affected by calling \ref enableVideo and \ref disableVideo. Settings in `muteAllRemoteVideoStreams` stop taking effect if either of the following occurs: + * - Calling `enableVideo` after `muteAllRemoteVideoStreams`(YES). + * - Calling `disableVideo` after `muteAllRemoteVideoStreams`(NO). + * - In scenarios involving multiple channels, use \ref AgoraRtcChannelMediaOptions.autoSubscribeVideo autoSubscribeVideo to set whether to receive remote video streams for a specific channel. + * @param mute Whether to stop receiving remote video streams: + * - `YES`: Stop receiving any remote video stream. + * - `NO`: (Default) Resume receiving all remote video streams. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)muteAllRemoteVideoStreams:(BOOL)mute NS_SWIFT_NAME(muteAllRemoteVideoStreams(_:)); + +/** + * @deprecated + * To set whether to receive remote video streams by default, call \ref muteAllRemoteVideoStreams: muteAllRemoteVideoStreams before calling `joinChannelByToken`. + * + * Determines whether to receive all remote video streams by default. + * + * @param mute Whether to receive remote video streams by default: + * - `YES`: Do not receive any remote video stream by default. + * - `NO`: (Default) Receive remote video streams by default. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDefaultMuteAllRemoteVideoStreams:(BOOL)mute NS_SWIFT_NAME(setDefaultMuteAllRemoteVideoStreams(_:)) __deprecated; + +/** + * Stops or resumes receiving the video stream of a specified user. + * + * You can call this method before or after joining a channel. + * If a user leaves a channel, the settings in this method become invalid. + * + * @param uid ID of the specified remote user. + * @param mute Whether to stop receiving the video stream of the specified user: + * - `YES`: Stop receiving the video stream of the specified user. + * - `NO`: (Default) Resume receiving the video stream of the specified user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteRemoteVideoStream:(NSUInteger)uid + mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteVideoStream(_:mute:)); + +/** Enables/Disables image enhancement and sets the options. + +@note Call this method after calling the [enableVideo]([AgoraRtcEngineKit enableVideo]) method. + +@param enable Sets whether or not to enable image enhancement: + +- `YES`: Enable image enhancement. +- `NO`: Disable image enhancement. +@param options The image enhancement options, see AgoraBeautyOptions. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)setBeautyEffectOptions:(BOOL)enable options:(AgoraBeautyOptions* _Nullable)options NS_SWIFT_NAME(setBeautyEffectOptions(_:options:)); +/** Sets video noise reduction. + +@since v4.0.0 + +Underlit environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding. + +You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect. + +**Note:** + +- Before calling this method, ensure that you have integrated the `AgoraClearVisionExtension.xcframework` dynamic library. +- Call this method after [enableVideo]([AgoraRtcEngineKit enableVideo]). +- The video noise reduction feature has certain performance requirements on devices. If your device overheats after you enable video noise reduction, Agora recommends modifying the video noise reduction options to a less performance-consuming level or disabling video noise reduction entirely. + +@param enable Sets whether to enable video noise reduction: + +- YES: Enable. +- NO: (Default) Disable. + +@param options The video noise reduction options. See AgoraVideoDenoiserOptions. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)setVideoDenoiserOptions:(BOOL)enable options:(AgoraVideoDenoiserOptions* _Nullable)options NS_SWIFT_NAME(setVideoDenoiserOptions(_:options:)); +/** Sets low-light enhancement. + +@since v4.0.0 + +The low-light enhancement feature can adaptively adjust the brightness value of the video captured in situations with low or uneven lighting, such as backlit, cloudy, or dark scenes. It restores or highlights the image details and improves the overall visual effect of the video. + +You can call this method to enable the low-light enhancement feature and set the options of the low-light enhancement effect. + +**Note:** + +- Before calling this method, ensure that you have integrated the `AgoraClearVisionExtension.xcframework` dynamic library. +- Call this method after [enableVideo]([AgoraRtcEngineKit enableVideo]). +- The low-light enhancement feature has certain performance requirements on devices. If your device overheats after you enable low-light enhancement, Agora recommends modifying the low-light enhancement options to a less performance-consuming level or disabling low-light enhancement entirely. + +@param enable Sets whether to enable low-light enhancement: + +- YES: Enable. +- NO: (Default) Disable. + +@param options The low-light enhancement options. See AgoraLowlightEnhanceOptions. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)setLowlightEnhanceOptions:(BOOL)enable options:(AgoraLowlightEnhanceOptions* _Nullable)options NS_SWIFT_NAME(setLowlightEnhanceOptions(_:options:)); +/** Sets color enhancement. + +@since v4.0.0 + +The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid. + +You can call this method to enable the color enhancement feature and set the options of the color enhancement effect. + +**Note:** + +- Before calling this method, ensure that you have integrated the `AgoraClearVisionExtension.xcframework` dynamic library. +- Call this method after [enableVideo]([AgoraRtcEngineKit enableVideo]). +- The color enhancement feature has certain performance requirements on devices. If your device overheats after you enable color enhancement, Agora recommends modifying the color enhancement options to a less performance-consuming level or disabling color enhancement entirely. + +@param enable Sets whether to enable color enhancement: + +- YES: Enable. +- NO: (Default) Disable. + +@param options The color enhancement options. See AgoraColorEnhanceOptions. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)setColorEnhanceOptions:(BOOL)enable options:(AgoraColorEnhanceOptions* _Nullable)options NS_SWIFT_NAME(setColorEnhanceOptions(_:options:)); + +/** Enables/Disables the virtual background. (beta function) + + @since v3.7.200 + + After enabling the virtual background function, you can replace the original + background image of the local user with a custom background image. After the + replacement, all users in the channel can see the custom background image. You + can find out from the [virtualBackgroundSourceEnabled]([AgoraRtcEngineDelegate rtcEngine:virtualBackgroundSourceEnabled:reason:]) + callback whether the virtual background is successfully enabled or the cause + of any errors. + + **Note**: + + - This method applies to macOS and iOS. + - Before calling this method, ensure that you have integrated the + `AgoraVideoSegmentationExtension.framework` dynamic library into the project + folder. + - Call this method after [enableVideo]([AgoraRtcEngineKit enableVideo]). + - This function requires a high-performance device. Agora recommends that you + use this function on devices with an i5 CPU and better. + - Agora recommends that you use this function in scenarios that meet the + following conditions: + + - A high-definition camera device is used, and the environment is uniformly + lit. + - The captured video image is uncluttered, the user's portrait is + half-length and largely unobstructed, and the background is a single color + that differs from the color of the user's clothing. + + @param enable Sets whether to enable the virtual background: + + - `YES`: Enable. + - `NO`: Disable. + @param backData The custom background image. See AgoraVirtualBackgroundSource. +

    Note: To adapt the resolution of the custom background image to the + resolution of the SDK capturing video, the SDK scales and crops the custom + background image while ensuring that the content of the custom background + image is not distorted.

    + @param segData + @return + * 0: Success. + * < 0: Failure. + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_SUCCESS = 0, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_IMAGE_NOT_EXIST = -1, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_COLOR_FORMAT_NOT_SUPPORTED = -2, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_DEVICE_NOT_SUPPORTED = -3, + */ +- (int)enableVirtualBackground:(BOOL)enable backData:(AgoraVirtualBackgroundSource* _Nullable)backData segData:(AgoraSegmentationProperty* _Nullable)segData NS_SWIFT_NAME(enableVirtualBackground(_:backData:segData:)); + +/** Whether the device support target feautre. + + @param type The feature type. See AgoraFeatureType. + + @return + - true: support. + - false: not support. + */ +- (bool)isFeatureAvailableOnDevice:(AgoraFeatureType)type; + +#pragma mark Audio Effect + +/**----------------------------------------------------------------------------- + * @name Audio Effect + * ----------------------------------------------------------------------------- + */ + +/** Sets the voice pitch of the local speaker. + + @note This method applies to macOS only. + + @param pitch Voice frequency, in the range of 0.5 to 2.0. The default value is 1.0. + + @return * 0: Success. +* <0: Failure. + */ +- (int)setLocalVoicePitch:(double)pitch NS_SWIFT_NAME(setLocalVoicePitch(_:)); + +/** Sets the local voice equalization. + + @note This method applies to macOS only. + + @param bandFrequency The band frequency ranging from 0 to 9; representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. + @param gain Gain of each band in dB; ranging from -15 to 15. + */ +- (int)setLocalVoiceEqualizationOfBandFrequency:(AgoraAudioEqualizationBandFrequency)bandFrequency withGain:(NSInteger)gain NS_SWIFT_NAME(setLocalVoiceEqualizationOf(_:withGain:)); + +/** Sets the local voice reverberation. + + @note This method applies to macOS only. + + @param reverbType Reverberation type. + @param value AgoraAudioReverbType + */ +- (int)setLocalVoiceReverbOfType:(AgoraAudioReverbType)reverbType withValue:(NSInteger)value NS_SWIFT_NAME(setLocalVoiceReverbOf(_:withValue:)); + +#pragma mark Audio Effect Playback + +/**----------------------------------------------------------------------------- + * @name Audio Effect Playback + * ----------------------------------------------------------------------------- + */ + +/** Preloads a specified audio effect. + * + * This method preloads only one specified audio effect into the memory each time + * it is called. To preload multiple audio effects, call this method multiple times. + * + * After preloading, you can call \ref playEffect:filePath:loopCount:pitch:pan:gain:publish: playEffect + * to play the preloaded audio effect or call + * \ref playAllEffectsWithLoopCount:pitch:pan:gain:publish: playAllEffects to play all the preloaded + * audio effects. + * + * @note + * - To ensure smooth communication, limit the size of the audio effect file. + * - Agora recommends calling this method before joining the channel. + * + * @param soundId The ID of the audio effect. + * @param filePath The absolute path of the local audio effect file or the URL + * of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, + * 3gp, mkv and wav. + + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)preloadEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath NS_SWIFT_NAME(preloadEffect(_:filePath:)); + +/** Preloads a specified audio effect. + * + * This method preloads only one specified audio effect into the memory each time + * it is called. To preload multiple audio effects, call this method multiple times. + * + * After preloading, you can call \ref playEffect:filePath:loopCount:pitch:pan:gain:publish: playEffect + * to play the preloaded audio effect or call + * \ref playAllEffectsWithLoopCount:pitch:pan:gain:publish: playAllEffects to play all the preloaded + * audio effects. + * + * @note + * - To ensure smooth communication, limit the size of the audio effect file. + * - Agora recommends calling this method before joining the channel. + * + * @param soundId The ID of the audio effect. + * @param filePath The absolute path of the local audio effect file or the URL + * of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, + * 3gp, mkv and wav. + * @param startPos The playback position (ms) of the audio effect file. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + +- (int)preloadEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + startPos:(int)startPos NS_SWIFT_NAME(preloadEffect(_:filePath:startPos:)); + +/** Plays a specified audio effect. +* +* @see [playEffect](playEffect:filePath:loopCount:pitch:pan:gain:publish:) +* @param soundId ID of the audio effect. Each audio effect has a unique ID. +* +* @note If you preloaded the audio effect into the memory through the [preloadEffect]([AgoraRtcEngineKit preloadEffect:filePath:]) method, ensure that the `soundID` value is set to the same value as in preloadEffect. +* @param filePath Absolute path of the audio effect file. +* @param loopCount Sets the number of times looping the audio effect: +* - 0: Plays the audio effect once. +* - 1: Plays the audio effect twice. +* - -1: Plays the audio effect in an indefinite loop until you call the [stopEffect]([AgoraRtcEngineKit stopEffect:]) or [stopAllEffects]([AgoraRtcEngineKit stopAllEffects]) method +* +* @param pitch Sets whether to change the pitch of the audio effect. The value ranges between 0.5 and 2. +* The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. +* @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0. +* - 0.0: The audio effect displays ahead. +* - 1.0: The audio effect displays to the right. +* - -1.0: The audio effect displays to the left. +* +* @param gain Sets the volume of the sound effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the sound effect. +* @return * 0: Success. +* < 0: Failure. + */ +- (int)playEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + loopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain NS_SWIFT_NAME(playEffect(_:filePath:loopCount:pitch:pan:gain:)); + +/** Plays a specified audio effect. +* +* @see [playEffect](playEffect:filePath:loopCount:pitch:pan:gain:publish:) +* @param soundId ID of the audio effect. Each audio effect has a unique ID. +* +* @note If you preloaded the audio effect into the memory through the [preloadEffect]([AgoraRtcEngineKit preloadEffect:filePath:]) method, ensure that the `soundID` value is set to the same value as in preloadEffect. +* @param filePath Absolute path of the audio effect file. +* @param loopCount Sets the number of times looping the audio effect: +* - 0: Plays the audio effect once. +* - 1: Plays the audio effect twice. +* - -1: Plays the audio effect in an indefinite loop until you call the [stopEffect]([AgoraRtcEngineKit stopEffect:]) or [stopAllEffects]([AgoraRtcEngineKit stopAllEffects]) method +* +* @param pitch Sets whether to change the pitch of the audio effect. The value ranges between 0.5 and 2. +* The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. +* @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0. +* - 0.0: The audio effect displays ahead. +* - 1.0: The audio effect displays to the right. +* - -1.0: The audio effect displays to the left. +* +* @param gain Sets the volume of the sound effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the sound effect. +* @param startPos The playback position (ms) of the audio effect file. +* @return * 0: Success. +* < 0: Failure. + */ +- (int)playEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + loopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain + startPos:(int)startPos NS_SWIFT_NAME(playEffect(_:filePath:loopCount:pitch:pan:gain:startPos:)); + +/** Plays a specified audio effect. + +* With this method, you can set the loop count, pitch, pan, and gain of the audio effect file and whether the remote user can hear the audio effect. +* +* To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time. +* +* When the audio effect file playback is finished, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngineDidAudioEffectFinish:soundId: rtcEngineDidAudioEffectFinish callback. +* +* @param soundId ID of the specified audio effect. Each audio effect has a unique ID. +* If the audio effect is preloaded into the memory through the \ref preloadEffect:filePath: preloadEffect method, ensure that the `soundId` value is set to the same value as in \ref preloadEffect:filePath: preloadEffect. +* @param filePath Specifies the absolute path (including the suffixes of the filename) to the local audio effect file or the URL of the online audio effect file, for example, `/var/mobile/Containers/Data/audio.mp4`. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. +* @param loopCount Sets the number of times the audio effect loops: +* - 0: Plays the audio effect once. +* - 1: Plays the audio effect twice. +* - -1: Plays the audio effect in an indefinite loop until you call the \ref stopEffect: stopEffect or \ref stopAllEffects stopAllEffects method. +* +* @param pitch Sets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. +* @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0. +* - 0.0: The audio effect displays ahead. +* - 1.0: The audio effect displays to the right. +* - -1.0: The audio effect displays to the left. +* +* @param gain Sets the volume of the audio effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the audio effect. +* @param publish Sets whether or not to publish the specified audio effect to the remote stream: +* - YES: The played audio effect is published to the Agora Cloud and the remote users can hear it. +* - NO: The played audio effect is not published to the Agora Cloud and the remote users cannot hear it. +* +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (int)playEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + loopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain + publish:(BOOL)publish NS_SWIFT_NAME(playEffect(_:filePath:loopCount:pitch:pan:gain:publish:)); + +/** Plays a specified audio effect. + +* With this method, you can set the loop count, pitch, pan, and gain of the audio effect file and whether the remote user can hear the audio effect. +* +* To play multiple audio effect files simultaneously, call this method multiple times with different soundIds and filePaths. We recommend playing no more than three audio effect files at the same time. +* +* When the audio effect file playback is finished, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngineDidAudioEffectFinish:soundId: rtcEngineDidAudioEffectFinish callback. +* +* @param soundId ID of the specified audio effect. Each audio effect has a unique ID. +* If the audio effect is preloaded into the memory through the \ref preloadEffect:filePath: preloadEffect method, ensure that the `soundId` value is set to the same value as in \ref preloadEffect:filePath: preloadEffect. +* @param filePath Specifies the absolute path (including the suffixes of the filename) to the local audio effect file or the URL of the online audio effect file, for example, `/var/mobile/Containers/Data/audio.mp4`. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. +* @param loopCount Sets the number of times the audio effect loops: +* - 0: Plays the audio effect once. +* - 1: Plays the audio effect twice. +* - -1: Plays the audio effect in an indefinite loop until you call the \ref stopEffect: stopEffect or \ref stopAllEffects stopAllEffects method. +* +* @param pitch Sets the pitch of the audio effect. The value ranges between 0.5 and 2. The default value is 1 (no change to the pitch). The lower the value, the lower the pitch. +* @param pan Sets the spatial position of the audio effect. The value ranges between -1.0 and 1.0. +* - 0.0: The audio effect displays ahead. +* - 1.0: The audio effect displays to the right. +* - -1.0: The audio effect displays to the left. +* +* @param gain Sets the volume of the audio effect. The value ranges between 0.0 and 100.0 (default). The lower the value, the lower the volume of the audio effect. +* @param publish Sets whether or not to publish the specified audio effect to the remote stream: +* - YES: The played audio effect is published to the Agora Cloud and the remote users can hear it. +* - NO: The played audio effect is not published to the Agora Cloud and the remote users cannot hear it. +* @param startPos The playback position (ms) of the audio effect file. +* +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (int)playEffect:(int)soundId + filePath:(NSString* _Nonnull)filePath + loopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain + publish:(BOOL)publish + startPos:(int)startPos NS_SWIFT_NAME(playEffect(_:filePath:loopCount:pitch:pan:gain:publish:startPos:)); + +/** Plays all audio effects. + * + * After calling \ref preloadEffect:filePath: preloadEffect multiple times + * to preload multiple audio effects into the memory, you can call this + * method to play all the specified audio effects for all users in + * the channel. + * + * @param loopCount The number of times the audio effect loops: + * - `-1`: Play the audio effect in an indefinite loop until + * \ref AgoraRtcEngineKit.stopEffect: stopEffect or + * \ref AgoraRtcEngineKit.stopAllEffects stopAllEffects + * - `0`: Play the audio effect once. + * - `1`: Play the audio effect twice. + * @param pitch The pitch of the audio effect. The value ranges between 0.5 and 2.0. + * The default value is `1.0` (original pitch). The lower the value, the lower the pitch. + * @param pan The spatial position of the audio effect. The value ranges between -1.0 and 1.0: + * - `-1.0`: The audio effect displays to the left. + * - `0.0`: The audio effect displays ahead. + * - `1.0`: The audio effect displays to the right. + * @param gain The volume of the audio effect. The value ranges between 0 and 100. + * The default value is `100` (original volume). The lower the value, the lower + * the volume of the audio effect. + * @param publish Sets whether to publish the audio effect to the remote: + * - true: Publish the audio effect to the remote. + * - false: Do not publish the audio effect to the remote. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)playAllEffectsWithLoopCount:(NSInteger)loopCount + pitch:(double)pitch + pan:(double)pan + gain:(NSInteger)gain + publish:(BOOL)publish NS_SWIFT_NAME(playAllEffects(withLoopCount:pitch:pan:gain:publish:)); + + /** + * Gets the volume of audio effects. + * + * @return + * - ≥ 0: The volume of audio effects. The value ranges between 0 and 100 (original volume). + * - < 0: Failure. + */ +- (int)getEffectsVolume NS_SWIFT_NAME(getEffectsVolume()); + + /** Sets the volume of audio effects. + * + * @param volume The volume of audio effects. The value ranges between 0 + * and 100 (original volume). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setEffectsVolume:(NSInteger)volume NS_SWIFT_NAME(setEffectsVolume(_:)); + + /** Sets the volume of the specified audio effect. + * + * @param soundId The ID of the audio effect. + * @param volume The volume of the specified audio effect. The value ranges + * between 0 and 100 (original volume). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVolumeOfEffect:(int)soundId + withVolume:(int)volume NS_SWIFT_NAME(setVolumeOfEffect(_:withVolume:)); + + /** Gets the volume of the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - ≥ 0: The volume of the specified audio effect. The value ranges + * between 0 and 100 (original volume). + * - < 0: Failure. + */ +- (int)getVolumeOfEffect:(int)soundId NS_SWIFT_NAME(getVolumeOfEffect(_:)); + +/** Pauses playing a specific audio effect. + + * @param soundId ID of the audio effect. Each audio effect has a unique ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)pauseEffect:(int)soundId NS_SWIFT_NAME(pauseEffect(_:)); + +/** Pauses playing all audio effects. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)pauseAllEffects NS_SWIFT_NAME(pauseAllEffects()); + +/** Resumes playing the specified audio effect. + + * @param soundId The ID of the audio effect. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)resumeEffect:(int)soundId NS_SWIFT_NAME(resumeEffect(_:)); + +/** Resumes playing all audio effects. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)resumeAllEffects NS_SWIFT_NAME(resumeAllEffects()); + +/** Stops playing a specific audio effect. + + * @param soundId The ID of the audio effect. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopEffect:(int)soundId NS_SWIFT_NAME(stopEffect(_:)); + +/** Stops playing all audio effects. + + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopAllEffects NS_SWIFT_NAME(stopAllEffects()); + +/** Gets the duration of the audio effect file. + + + **Note** + + - Call this method after joining a channel. + - For the audio file formats supported by this method, see + [What formats of audio files does the Agora RTC SDK support](https://docs.agora.io/en/faq/audio_format). + + @param filePath The absolute path (including the filename extensions) of the local audio effect file. For example: + `/var/mobile/Containers/Data/audio.mp4`. + @return - ≥ 0: A successful method call. Returns the total duration (ms) of the specified audio effect file. +- < 0: Failure. + + - `-22(AgoraErrorCodeResourceLimited)`: Cannot find the audio effect file. Please set a correct `filePath`. + */ +- (int)getEffectDuration:(NSString* _Nonnull)filePath NS_SWIFT_NAME(getEffectDuration(_:)); +/** Sets the playback position of an audio effect file. + + After a successful setting, the local audio effect file starts playing at the specified position. + + @note Call this method after [playEffect]([AgoraRtcEngineKit playEffect:filePath:loopCount:pitch:pan:gain:publish:startPos:]). + + @param soundId Audio effect ID. Ensure that this parameter is set to the same value as in `playEffect`. + @param pos The playback position (ms) of the audio effect file. + + @return - 0: Success. +- < 0: Failure. + + - `-22(AgoraErrorCodeResourceLimited)`: Cannot find the audio effect file. Please set a correct `soundId`. + */ +- (int)setEffectPosition:(int)soundId pos:(NSInteger)pos NS_SWIFT_NAME(setEffectPosition(_:pos:)); +/** Gets the playback position of the audio effect file. + + @note Call this method after [playEffect]([AgoraRtcEngineKit playEffect:filePath:loopCount:pitch:pan:gain:publish:startPos:]). + + @param soundId Audio effect ID. Ensure that this parameter is set to the same value as in `playEffect`. + @return - ≥ 0: A successful method call. Returns the playback position (ms) of the specified audio effect file. +- < 0: Failure. + + - `-22(AgoraErrorCodeResourceLimited)`: Cannot find the audio effect file. Please set a correct `soundId`. + */ +- (int)getEffectCurrentPosition:(int)soundId NS_SWIFT_NAME(getEffectCurrentPosition(_:)); + + + + +/** Releases a specific preloaded audio effect from the memory. + + * @param soundId The ID of the audio effect. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)unloadEffect:(int)soundId NS_SWIFT_NAME(unloadEffect(_:)); + +/** Release all preloaded audio effects from the memory. + + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)unloadAllEffects NS_SWIFT_NAME(unloadAllEffects()); + +#pragma mark beautifier effect +/** Sets an SDK preset voice beautifier effect. + * + * Call this method to set an SDK preset voice beautifier effect for the local user who sends an + * audio stream. After setting a voice beautifier effect, all users in the channel can hear the + * effect. + * + * You can set different voice beautifier effects for different scenarios. See *Set the Voice + * Beautifier and Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" to + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call + * fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters": + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset voice beautifier effects: #VOICE_BEAUTIFIER_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVoiceBeautifierPreset:(AgoraVoiceBeautifierPreset)preset NS_SWIFT_NAME(setVoiceBeautifierPreset(_:)); + +/** Sets an SDK preset audio effect. + * + * Call this method to set an SDK preset audio effect for the local user who sends an audio + * stream. This audio effect does not change the gender characteristics of the original voice. + * After setting an audio effect, all users in the channel can hear the effect. + * + * You can set different audio effects for different scenarios. See *Set the Voice Beautifier and + * Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the profile `parameter` of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)` + * or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - If you call this method and set the `preset` parameter to enumerators except + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION`, do not call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters"; otherwise, + * `setAudioEffectParameters` overrides this method. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectPreset`: + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset audio effects. See #AUDIO_EFFECT_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setAudioEffectPreset:(AgoraAudioEffectPreset)preset NS_SWIFT_NAME(setAudioEffectPreset(_:)); + +/** Sets an SDK preset voice conversion. + * + * Call this method to set an SDK preset audio effect for the local user who sends an audio + * stream. This audio effect does not change the gender characteristics of the original voice. + * After setting an audio effect, all users in the channel can hear the effect. + * + * You can set different audio effects for different scenarios. See *Set the Voice Beautifier and + * Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the profile `parameter` of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)` + * or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - If you call this method and set the `preset` parameter to enumerators except + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION`, do not call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters"; otherwise, + * `setAudioEffectParameters` overrides this method. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectPreset`: + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVoiceConversionPreset:(AgoraVoiceConversionPreset)preset NS_SWIFT_NAME(setVoiceConversionPreset(_:)); + +/** Sets parameters for SDK preset audio effects. + * + * Call this method to set the following parameters for the local user who send an audio stream: + * - 3D voice effect: Sets the cycle period of the 3D voice effect. + * - Pitch correction effect: Sets the basic mode and tonic pitch of the pitch correction effect. + * Different songs have different modes and tonic pitches. Agora recommends bounding this method + * with interface elements to enable users to adjust the pitch correction interactively. + * + * After setting parameters, all users in the channel can hear the relevant effect. + * + * You can call this method directly or after \ref IRtcEngine::setAudioEffectPreset + * "setAudioEffectPreset". If you call this method after \ref IRtcEngine::setAudioEffectPreset + * "setAudioEffectPreset", ensure that you set the preset parameter of `setAudioEffectPreset` to + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION` and then call this method to set the same + * enumerator; otherwise, this method overrides `setAudioEffectPreset`. + * + * @note + * - You can call this method either before or after joining a channel. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" to + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call + * fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectParameters`: + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * @param preset The options for SDK preset audio effects: + * - 3D voice effect: `ROOM_ACOUSTICS_3D_VOICE`. + * - Call \ref IRtcEngine::setAudioProfile "setAudioProfile" and set the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator; otherwise, the enumerator setting does not take effect. + * - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear + * the anticipated voice effect. + * - Pitch correction effect: `PITCH_CORRECTION`. To achieve better audio effect quality, Agora + * recommends calling \ref IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` + * parameter to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before setting this enumerator. + * @param param1 + * - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, the `param1` sets the cycle period of the + * 3D voice effect. The value range is [1,60] and the unit is a second. The default value is 10 + * seconds, indicating that the voice moves around you every 10 seconds. + * - If you set `preset` to `PITCH_CORRECTION`, `param1` sets the basic mode of the pitch + * correction effect: + * - `1`: (Default) Natural major scale. + * - `2`: Natural minor scale. + * - `3`: Japanese pentatonic scale. + * @param param2 + * - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, you need to set `param2` to `0`. + * - If you set `preset` to `PITCH_CORRECTION`, `param2` sets the tonic pitch of the pitch + * correction effect: + * - `1`: A + * - `2`: A# + * - `3`: B + * - `4`: (Default) C + * - `5`: C# + * - `6`: D + * - `7`: D# + * - `8`: E + * - `9`: F + * - `10`: F# + * - `11`: G + * - `12`: G# + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setAudioEffectParameters:(AgoraAudioEffectPreset)preset param1:(int)param1 param2:(int)param2 NS_SWIFT_NAME(setAudioEffectParameters(_:param1:param2:)); + +/** Sets parameters for SDK preset voice beautifier effects. + * + * Call this method to set a gender characteristic and a reverberation effect for the singing + * beautifier effect. This method sets parameters for the local user who sends an audio stream. + * + * After you call this method successfully, all users in the channel can hear the relevant effect. + * + * To achieve better audio effect quality, before you call this method, Agora recommends calling + * \ref IRtcEngine::setAudioProfile "setAudioProfile", and setting the `scenario` parameter as + * `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter as + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)`. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" as + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call does + * not take effect. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After you call this method, Agora recommends not calling the following methods, because they + * can override `setVoiceBeautifierParameters`: + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * + * @param preset The options for SDK preset voice beautifier effects: + * - `SINGING_BEAUTIFIER`: Singing beautifier effect. + * @param param1 The gender characteristics options for the singing voice: + * - `1`: A male-sounding voice. + * - `2`: A female-sounding voice. + * @param param2 The reverberation effects options: + * - `1`: The reverberation effect sounds like singing in a small room. + * - `2`: The reverberation effect sounds like singing in a large room. + * - `3`: The reverberation effect sounds like singing in a hall. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVoiceBeautifierParameters:(AgoraVoiceBeautifierPreset)preset param1:(int)param1 param2:(int)param2 NS_SWIFT_NAME(setVoiceBeautifierParameters(_:param1:param2:)); + +/** Set parameters for SDK preset voice conversion. + * + * @note + * - reserved interface + * + * @param preset The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET. + * @param param1 reserved. + * @param param2 reserved. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVoiceConversionParameters:(AgoraVoiceConversionPreset)preset param1:(int)param1 param2:(int)param2 NS_SWIFT_NAME(setVoiceConversionParameters(_:param1:param2:)); +/** Sets preset audio playback effect for remote headphones after remote audio is mixed. + * + * @param preset The preset key: #HEADPHONE_EQUALIZER_PRESET. + * - HEADPHONE_EQUALIZER_OFF = 0x00000000 : Turn off the eualizer effect for headphones. + * - HEADPHONE_EQUALIZER_OVEREAR = 0x04000001 : For over-ear headphones only. + * - HEADPHONE_EQUALIZER_INEAR = 0x04000002 : For in-ear headphones only. + * @return + * - 0: Success. + * - < 0: Failure. + * - -1(ERR_FAILED): A general error occurs (no specified reason). + */ +- (int)setHeadphoneEQPreset:(AgoraHeadphoneEQPreset)preset NS_SWIFT_NAME(setHeadphoneEQPreset(_:)); +/** Sets the parameters of audio playback effect for remote headphones after remote audio is mixed. + * + * @param lowGain The higher the parameter value, the deeper the sound. The value range is [-10,10]. + * @param highGain The higher the parameter value, the sharper the sound. The value range is [-10,10]. + * @return + * - 0: Success. + * - < 0: Failure. + * - -1(ERR_FAILED): A general error occurs (no specified reason). + */ +- (int)setHeadphoneEQParameters:(int)lowGain highGain:(int)highGain NS_SWIFT_NAME(setHeadphoneEQParameters(_:highGain:)); + +#pragma mark Sound Position Indication + +/**----------------------------------------------------------------------------- + * @name Sound Position Indication + * ----------------------------------------------------------------------------- + */ +/** Enables/Disables stereo panning for remote users. + +If you need to use the [setRemoteVoicePosition]([AgoraRtcEngineKit setRemoteVoicePosition:pan:gain:]) method, ensure that you call this method before joining a channel to enable stereo panning for remote users. + + @param enabled Sets whether or not to enable stereo panning for remote users: + + - `YES`: enables stereo panning. + - `NO`: disables stereo panning. + + @return * 0: Success. + * < 0: Failure. + - `-157`(`AgoraErrorCodeModuleNotFound`): The library for enabling deep-learning + noise reduction is not integrated. + */ +- (int)enableSoundPositionIndication:(BOOL)enabled NS_SWIFT_NAME(enableSoundPositionIndication(_:)); + +/** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + +**Note:** + +- Ensure that you call this method after joining a channel. For this method to work, enable stereo panning for remote users by calling [enableSoundPositionIndication]([AgoraRtcEngineKit enableSoundPositionIndication:]) before joining a channel. +This method requires hardware support. +- For the best effect, we recommend using the following audio output devices: + - (iOS) A stereo headset. + - (macOS) A stereo loudspeaker. + @param uid The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + + * 0.0: (default) the remote sound comes from the front. + * -1.0: the remote sound comes from the left. + * 1.0: the remote sound comes from the right. + + @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. + + @return * 0: Success. +* < 0: Failure. + */ +- (int)setRemoteVoicePosition:(NSUInteger)uid pan:(double)pan gain:(double)gain NS_SWIFT_NAME(setRemoteVoicePosition(_:pan:gain:)); + +/** Enables/Disables spatial audio for remote users. + + @param enabled Sets whether or not to enable spatial audio for remote users: + + - `YES`: enables spatial audio. + - `NO`: disables spatial audio. + + @return * 0: Success. + * < 0: Failure + */ +- (int)enableSpatialAudio:(BOOL)enabled NS_SWIFT_NAME(enableSpatialAudio(_:)); + +/** Sets spatial audio parameters of a remote user. + + When the local user calls this method to set the spatial audio parameters of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of spatial. + +**Note:** + +- For the best effect, we recommend using the following audio output devices: + - (iOS) A stereo headset. + - (macOS) A stereo loudspeaker. + @param uid The ID of the remote user. + @param params The spatial audio parameters of the remote user. + + @return * 0: Success. +* < 0: Failure. + */ +- (int)setRemoteUserSpatialAudioParams:(NSUInteger)uid + params:(AgoraSpatialAudioParams* _Nonnull)params NS_SWIFT_NAME(setRemoteUserSpatialAudioParams(_:params:)); + +#pragma mark Audio Mixing + +/**----------------------------------------------------------------------------- + * @name Audio Mixing + * ----------------------------------------------------------------------------- + */ + +/** + * Starts audio mixing. + * + * This method mixes the specified local audio file with the audio stream from the microphone, or replaces the microphone’s audio stream with the specified local audio file. + * + * You can choose whether the other users can hear the local audio playback and specify the number of playback loops. + * + * This method also supports online music playback. + * + * A successful method call triggers the \ref AgoraRtcEngineDelegate.rtcEngine:audioMixingStateChanged:errorType: audioMixingStateChanged callback on the local client to report the `AgoraAudioMixingStateTypePlaying` state. + * + * When the audio mixing file playback finishes, the SDK triggers the `audioMixingStateChanged` callback on the local client to report the `AgoraAudioMixingStateTypeStopped` state. + * @note + * - To use this method, ensure that the iOS device version is 8.0 and later. + * - Call this method when the user is in a channel. + * - To play an online music file, ensure that the time interval between calling this method is more than 100 ms, or the `audioMixingStateChanged` callback reports the `AgoraAudioMixingReasonTooFrequentlyCall`(702) error. + * @param filePath Specifies the absolute path (including the suffixes of the filename) of the local or online audio file to be mixed. + * For example, `/var/mobile/Containers/Data/audio.mp4`. Supported audio formats: MP3, MP4, M4A, AAC, 3GP, MKV, and WAV. + * @param loopback Sets which user can hear the audio mixing: + * - `YES`: Only the local user can hear the audio mixing. + * - `NO`: All users can hear the audio mixing. + * @param cycle Sets the number of playback loops: + * - Positive integer: Number of playback loops. + * - -1: Infinite playback loops. + * + * @return + * - 0: Success. + * - <0: Failure. + * - -701: The local audio mixing file does not exist, the SDK does not support the file format, or the online audio packet is not received within five seconds + * after it is opened. + */ +- (int)startAudioMixing:(NSString * _Nonnull)filePath + loopback:(BOOL)loopback + cycle:(NSInteger)cycle NS_SWIFT_NAME(startAudioMixing(_:loopback:cycle:)); + +/** + * Starts audio mixing. + * + * This method mixes the specified local audio file with the audio stream from the microphone, or replaces the microphone’s audio stream with the specified local audio file. + * + * You can choose whether the other users can hear the local audio playback and specify the number of playback loops. + * + * This method also supports online music playback. + * + * A successful method call triggers the \ref AgoraRtcEngineDelegate.rtcEngine:audioMixingStateChanged:errorType: audioMixingStateChanged callback on the local client to report the `AgoraAudioMixingStateTypePlaying` state. + * + * When the audio mixing file playback finishes, the SDK triggers the `audioMixingStateChanged` callback on the local client to report the `AgoraAudioMixingStateTypeStopped` state. + * @note + * - To use this method, ensure that the iOS device version is 8.0 and later. + * - Call this method when the user is in a channel. + * - To play an online music file, ensure that the time interval between calling this method is more than 100 ms, or the `audioMixingStateChanged` callback reports the `AgoraAudioMixingReasonTypeTooFrequentlyCall`(702) error. + * @param filePath Specifies the absolute path (including the suffixes of the filename) of the local or online audio file to be mixed. + * For example, `/var/mobile/Containers/Data/audio.mp4`. Supported audio formats: MP3, MP4, M4A, AAC, 3GP, MKV, and WAV. + * @param loopback Sets which user can hear the audio mixing: + * - `YES`: Only the local user can hear the audio mixing. + * - `NO`: All users can hear the audio mixing. + * @param cycle Sets the number of playback loops: + * - Positive integer: Number of playback loops. + * - -1: Infinite playback loops. + * @param startPos The playback position (ms) of the music file. + * + * @return + * - 0: Success. + * - <0: Failure. + * - -701: The local audio mixing file does not exist, the SDK does not support the file format, or the online audio packet is not received within five seconds + * after it is opened. + */ +- (int)startAudioMixing:(NSString * _Nonnull)filePath + loopback:(BOOL)loopback + cycle:(NSInteger)cycle + startPos:(NSInteger)startPos NS_SWIFT_NAME(startAudioMixing(_:loopback:cycle:startPos:)); + +/** + * Stops audio mixing. + * + * Call this method when the user is in a channel. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)stopAudioMixing NS_SWIFT_NAME(stopAudioMixing()); + +/** + * Pauses audio mixing. + * + * Call this method when the user is in a channel. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)pauseAudioMixing NS_SWIFT_NAME(pauseAudioMixing()); + +/** + * Resumes audio mixing. + * + * Call this API when the user is in a channel. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)resumeAudioMixing NS_SWIFT_NAME(resumeAudioMixing()); + +/** Select audio track for the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ +- (int)selectAudioTrack:(NSInteger)index NS_SWIFT_NAME(selectAudioTrack(_:)); +/** Get audio track count of the music file. + + Call this method when you are in a channel. + + @return + - ≥ 0: Audio track count of the music file, if the method call is successful. + - < 0: Failure. + */ +- (int)getAudioTrackCount NS_SWIFT_NAME(getAudioTrackCount()); + +/** + * Adjusts the volume of audio mixing. + * + * Call this API when the user is in a channel. + * + * @param volume Audio mixing volume. The value ranges between 0 and 100 (default). 100 is the original volume. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)adjustAudioMixingVolume:(NSInteger)volume NS_SWIFT_NAME(adjustAudioMixingVolume(_:)); + + +/** + * Adjusts the audio mixing volume for publishing (for remote users). + * @note Call this method when you are in a channel. + * @param volume Audio mixing volume for publishing. The value ranges between 0 and 100 (default). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)adjustAudioMixingPublishVolume:(NSInteger)volume NS_SWIFT_NAME(adjustAudioMixingPublishVolume(_:)); + +/** + * Retrieves the audio mixing volume for publishing. + * This method helps troubleshoot audio volume related issues. + * @note Call this method when you are in a channel. + * @return + * - ≥ 0: The audio mixing volume for publishing, if this method call succeeds. The value range is [0,100]. + * - < 0: Failure. + */ +- (int)getAudioMixingPublishVolume NS_SWIFT_NAME(getAudioMixingPublishVolume()); + +/** + * Adjusts the audio mixing volume for local playback. + * @note Call this method when you are in a channel. + * @param volume Audio mixing volume for local playback. The value ranges between 0 and 100 (default). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)adjustAudioMixingPlayoutVolume:(NSInteger)volume NS_SWIFT_NAME(adjustAudioMixingPlayoutVolume(_:)); + +/** + * Retrieves the audio mixing volume for local playback. + * This method helps troubleshoot audio volume related issues. + * @note Call this method when you are in a channel. + * @return + * - ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100]. + * - < 0: Failure. + */ +- (int)getAudioMixingPlayoutVolume NS_SWIFT_NAME(getAudioMixingPlayoutVolume()); + + +/** + * Gets the duration of audio mixing. + * + * Call this API when the user is in a channel. + * + * @return + * - >= 0: The audio mixing duration (ms), if this method call is successful. + * - < 0: Failure. + */ +- (int)getAudioMixingDuration NS_SWIFT_NAME(getAudioMixingDuration()); + +/** + * Gets the playback position of the audio. + * + * Call this API when the user is in a channel. + * @return + * - >= 0: The current playback position (ms), if this method call is successful. + * - < 0: Failure. + */ +- (int)getAudioMixingCurrentPosition NS_SWIFT_NAME(getAudioMixingCurrentPosition()); + +/** + * Sets the playback position of the audio mixing file. + * + * Sets the playback starting position of the audio mixing file instead of playing it from the beginning. + * + * @param pos Integer. The playback starting position of the audio mixing file (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setAudioMixingPosition:(NSInteger)pos NS_SWIFT_NAME(setAudioMixingPosition(_:)); + +/** In dual-channel music files, different audio data can be stored on the left and right channels. + * According to actual needs, you can set the channel mode as the original mode, + * the left channel mode, the right channel mode or the mixed mode + + @param mode The mode of channel mode + + @return + - 0: Success. + - < 0: Failure. + */ +- (int)setAudioMixingDualMonoMode:(AgoraAudioMixingDualMonoMode)mode NS_SWIFT_NAME(setAudioMixingDualMonoMode(_:)); + +/** Sets the pitch of the local music file. + When a local music file is mixed with a local human voice, call this method to set the pitch of the local music file only. + @note Call this method after calling [startAudioMixing]([AgoraRtcEngineKit startAudioMixing:loopback:cycle:]). + + @param pitch Sets the pitch of the local music file by chromatic scale. The default value is 0, which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between consecutive values is a chromatic value. The greater the absolute value of this parameter, the higher or lower the pitch of the local music file. + + @return * 0: Success. + * < 0: Failure. + */ +- (int)setAudioMixingPitch:(NSInteger)pitch NS_SWIFT_NAME(setAudioMixingPitch(_:)); + +#pragma mark Audio Recording + +/**----------------------------------------------------------------------------- + * @name Audio Recording + * ----------------------------------------------------------------------------- + */ + +/** Starts an audio recording. + + The SDK allows recording during a call, which supports either one of the following two formats: + + * .wav: Large file size with high sound fidelity + * .aac: Small file size with low sound fidelity + + Ensure that the saving directory in the application exists and is writable. This method is usually called after the `joinChannelByToken` method. The recording automatically stops when the [leaveChannel](leaveChannel:) method is called. + + @param filePath Full file path of the recording file. The string of the file name is in UTF-8 code. + @param quality Sets the audio recording quality: #AUDIO_RECORDING_QUALITY_TYPE. + @return + - 0: Success. + - < 0: Failure. +*/ +- (int)startAudioRecording:(NSString * _Nonnull)filePath + quality:(AgoraAudioRecordingQuality)quality NS_SWIFT_NAME(startAudioRecording(_:quality:)); + +/** Starts an audio recording on the client. + + The SDK allows recording audio during a call. After successfully calling this method, you can record the audio of + users in the channel and get an audio recording file. Supported file formats are as follows: + + - WAV: High-fidelity files with typically larger file sizes. For example, if the sample rate is 32,000 Hz, the file + size for a 10-minute recording is approximately 73 MB. + - AAC: Low-fidelity files with typically smaller file sizes. For example, if the sample rate is 32,000 Hz and the + recording quality is `AgoraAudioRecordingQualityMedium`, the file size for a 10-minute recording is approximately 2 MB. + + Once the user leaves the channel, the recording automatically stops. + + @note Call this method after joining a channel. + + @param config Recording configuration. See AgoraAudioRecordingConfiguration. + + @return - 0: Success. + - < 0: Failure. + + -160(`AgoraErrorCodeAlreadyInRecording`): The client is already recording audio. To start a new recording, call + [stopAudioRecording]([AgoraRtcEngineKit stopAudioRecording]) to stop the current recording first, and then call + `startAudioRecordingWithConfig`. + */ +- (int)startAudioRecordingWithConfig:(AgoraAudioRecordingConfiguration * _Nonnull)config NS_SWIFT_NAME(startAudioRecording(withConfig:)); + +- (int)setAudioEncodedFrameDelegate:(id _Nullable)delegate config:(AgoraAudioEncodedFrameDelegateConfig * _Nonnull)config NS_SWIFT_NAME(setAudioEncodedFrameDelegate(_:config:)); +/** Stops the audio recording. + + @note Call this method before calling [leaveChannel](leaveChannel:), otherwise the recording automatically stops when the [leaveChannel](leaveChannel:) method is called. + + @return * 0: Success. +* <0: Failure. + */ +- (int)stopAudioRecording NS_SWIFT_NAME(stopAudioRecording()); + +#pragma mark Echo Test + +/**----------------------------------------------------------------------------- + * @name Echo Test + * ----------------------------------------------------------------------------- + */ + +/** Launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly. + + In the test, the user first speaks, and the recording is played back in 10 seconds. If the user can hear the recording in 10 seconds, it indicates that the audio devices and network connection work properly. + + @note After calling this method, always call stopEchoTest to end the test, otherwise the application will not be able to run the next echo test, nor can it call the `joinChannelByToken` method to start a new call. + + @param successBlock Callback on successfully starting the echo test. See JoinSuccessBlock in `joinChannelByToken` for a description of the callback parameters. + + @return * 0: Success. +* <0: Failure. + For example, AgoraErrorCodeRefused(-5):Failed to launch the echo test. + */ +- (int)startEchoTest:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))successBlock NS_SWIFT_NAME(startEchoTest(_:)); + +/** Starts an audio call test. + + This method starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly. + In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly. + + @note + - Call this method before joining a channel. + - After calling this method, call the stopEchoTest method to end the test. Otherwise, the app cannot run the next echo test, or join a channel. + - In the live interactive streaming profile, only a host can call this method. + + @param interval The time interval (s) between when you speak and when the recording plays back. + @param successBlock The SDK triggers the `successBlock` callback if this method call is successful. + + @return * 0: Success. + * < 0: Failure. +*/ +- (int)startEchoTestWithInterval:(NSInteger)interval + successBlock:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))successBlock NS_SWIFT_NAME(startEchoTest(withInterval:successBlock:)); + +/** Starts an audio/video call loop test. + + @param config The configuration for audio/video echo test. + + @return * 0: Success. + * < 0: Failure. + */ +- (int)startEchoTestWithConfig:(AgoraEchoTestConfiguration* _Nonnull)config NS_SWIFT_NAME(startEchoTest(withConfig:)); + +/** Stops the audio call test. + + @note This method applies to macOS only. + + @return * 0: Success. +* <0: Failure. For example, AgoraErrorCodeRefused(-5):Failed to stop the echo test. It could be that the echo test is not running. + */ +- (int)stopEchoTest NS_SWIFT_NAME(stopEchoTest()); + + +#pragma mark Miscellaneous Audio Control + +/**----------------------------------------------------------------------------- + * @name Miscellaneous Audio Control + * ----------------------------------------------------------------------------- + */ + +/** + * Enables in-ear monitoring. + * + * @param enabled Determines whether to enable in-ear monitoring. + * - `YES`: Enable in-ear monitoring. + * - `NO`: Disable in-ear monitoring. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableInEarMonitoring:(BOOL)enabled NS_SWIFT_NAME(enable(inEarMonitoring:)); + +/** + * Enables in-ear monitoring. + * + * @param enabled Determines whether to enable in-ear monitoring. + * - `YES`: Enable in-ear monitoring. + * - `NO`: Disable in-ear monitoring. + * @param includeAudioFilters The type of the ear monitoring: #AgoraEarMonitoringFilterType. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableInEarMonitoring:(BOOL)enabled includeAudioFilters:(AgoraEarMonitoringFilterType)includeAudioFilters NS_SWIFT_NAME(enable(inEarMonitoring:includeAudioFilters:)); + +/** + * Sets the volume of the in-ear monitoring. + * + * @param volume The volume of the in-ear monitor, ranging from 0 to 100, + * can be amplified to 400, but not suggested. + * The default value is 100. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setInEarMonitoringVolume:(NSInteger)volume NS_SWIFT_NAME(setInEarMonitoringVolume(_:)); + +#if TARGET_OS_IPHONE + +/** Sets the audio session operation restriction. + + @note This method applies to iOS only. + + The SDK and the application can both configure the audio session by default. The application may occassionally use other applications or third-party components to manipulate the audio session and restrict the SDK from doing so. This API allows the application to restrict the SDK's manipulation of the audio session. + + @note This method restricts the SDK's manipulation of the audio session. Any operation to the audio session relies solely on the application, other applications, or third-party components. + */ +- (void)setAudioSessionOperationRestriction:(AgoraAudioSessionOperationRestriction)restriction NS_SWIFT_NAME(setAudioSessionOperationRestriction(_:)); + +#endif + +#pragma mark Dual Video Mode + +/**----------------------------------------------------------------------------- + * @name Dual Video Mode + * ----------------------------------------------------------------------------- + */ + +/** + * Enables or disables the dual video stream mode. + * + * @param enabled + * - `YES`: Enable the dual-stream mode. + * - `NO`: (default) Disable the dual-stream mode. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)enableDualStreamMode:(BOOL)enabled NS_SWIFT_NAME(enableDualStreamMode(_:)); + +/** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @param streamConfig + * - The minor stream config + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableDualStreamMode:(BOOL)enabled + streamConfig:(AgoraSimulcastStreamConfig* _Nonnull)streamConfig NS_SWIFT_NAME(enableDualStreamMode(_:streamConfig:)); + +/** + * Enables, disables or auto enable the dual video stream mode. + * + * @param mode + * - The dual-stream mode. + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setDualStreamMode:(AgoraSimulcastStreamMode)mode NS_SWIFT_NAME(setDualStreamMode(_:)); + +/** + * Enables, disables or auto enable the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * If dual-stream mode is auto, if user subscriber low-stream, then we will send low-stream + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param mode + * - The dual-stream mode. + * @param streamConfig + * - The minor stream config + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDualStreamMode:(AgoraSimulcastStreamMode)mode + streamConfig:(AgoraSimulcastStreamConfig* _Nonnull)streamConfig NS_SWIFT_NAME(setDualStreamMode(_:streamConfig:)); +/** + * Sets the remote video stream type. + * + * If the remote user has enabled the dual-stream mode, by default the SDK + * receives the high-stream video. Call this method to switch to the low-stream + * video. + * + * @note + * This method applies to scenarios where the remote user has enabled the + * dual-stream mode by \ref enableDualStreamMode: enableDualStreamMode + * before joining the channel. + * + * @param uid ID of the remote user sending the video stream. + * @param streamType The video stream type: #AgoraVideoStreamType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteVideoStream:(NSUInteger)uid + type:(AgoraVideoStreamType)streamType NS_SWIFT_NAME(setRemoteVideoStream(_:type:)); + +/** + * Sets the remote video subscription options + * + * + * @param uid ID of the remote user sending the video stream. + * @param options Sets the video subscription options. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteVideoSubscriptionOptions:(NSUInteger)uid + options:(AgoraVideoSubscriptionOptions* _Nonnull)options NS_SWIFT_NAME(setRemoteVideoSubscriptionOptions(_:options:)); +/** + * Sets the default stream type of the remote video if the remote user has + * enabled the dual-stream mode. + * + * @param streamType The default video stream type: #AgoraVideoStreamType. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteDefaultVideoStreamType:(AgoraVideoStreamType)streamType NS_SWIFT_NAME(setRemoteDefaultVideoStreamType(_:)); + +#pragma mark Subscribe Blocklist / Allowlist + +/** + * Sets the blocklist of subscribe remote stream audio. + * + * @param blocklist The uid list of users who do not subscribe to audio. + * + * @note + * If uid is in blacklist, the remote user's audio will not be subscribed, + * even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeAudioBlocklist:(NSArray *_Nonnull)blocklist NS_SWIFT_NAME(setSubscribeAudioBlocklist(_:)); + +/** + * Sets the allowlist of subscribe remote stream audio. + * + * @param allowlist The uid list of users who do subscribe to audio. + * + * @note + * If uid is in allowlist, the remote user's audio will be subscribed, + * even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to audio. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeAudioAllowlist:(NSArray *_Nonnull)allowlist NS_SWIFT_NAME(setSubscribeAudioAllowlist(_:)); + +/** + * Sets the blocklist of subscribe remote stream video. + * + * @param blocklist The uid list of users who do not subscribe to video. + * + * @note + * If uid is in blocklist, the remote user's video will not be subscribed, + * even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeVideoBlocklist:(NSArray *_Nonnull)blocklist NS_SWIFT_NAME(setSubscribeVideoBlocklist(_:)); + +/** + * Sets the allowlist of subscribe remote stream video. + * + * @param allowlist The uid list of users who do subscribe to video. + * + * @note + * If uid is in allowlist, the remote user's video will be subscribed, + * even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeVideoAllowlist:(NSArray *_Nonnull)allowlist NS_SWIFT_NAME(setSubscribeVideoAllowlist(_:)); + +#pragma mark Stream Fallback + +/**----------------------------------------------------------------------------- + * @name Stream Fallback + * ----------------------------------------------------------------------------- + */ + +/** Sets the local publish stream fallback option. + + This method disables/enables the local publish stream fallback option according to the network conditions. + + If you set the option as AgoraStreamFallbackOptionAudioOnly = 2, the SDK will: + + * Disable the upstream video when the network cannot support both video and audio. + * Reenable the video when the network condition improves. + + When the local publish stream falls back to audio-only or when the audio stream switches back to the video, the [didLocalPublishFallbackToAudioOnly]([AgoraRtcEngineDelegate rtcEngine:didLocalPublishFallbackToAudioOnly:]) callback will be triggered. + + @note Agora does not recommend using this method for CDN streaming, because the remote CDN user will notice a lag when the local publish stream falls back to audio-only. + + @param option AgoraStreamFallbackOptions + @return * 0: Success. +* <0: Failure. + */ +- (int)setLocalPublishFallbackOption:(AgoraStreamFallbackOptions)option NS_SWIFT_NAME(setLocalPublishFallbackOption(_:)); + +/** Sets the remote subscribe stream fallback option. + + This method disables/enables the remote subscribe stream fallback option according to the network conditions. + + If you use the option as AgoraStreamFallbackOptionAudioOnly = 2, the SDK will automatically switch the video from a high-stream to a low-stream, or disable the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and re-enables the video stream when the network conditions improve. + Once the local publish stream falls back to audio only, or the audio stream switches back to the video stream, the [didRemoteSubscribeFallbackToAudioOnly]([AgoraRtcEngineDelegate rtcEngine:didRemoteSubscribeFallbackToAudioOnly:byUid:]) callback will be triggered. + + @param option AgoraStreamFallbackOptions + @return * 0: Success. +* <0: Failure. + */ +- (int)setRemoteSubscribeFallbackOption:(AgoraStreamFallbackOptions)option NS_SWIFT_NAME(setRemoteSubscribeFallbackOption(_:)); + +#pragma mark Video Quality Control + +/**----------------------------------------------------------------------------- + * @name Video Quality Control + * ----------------------------------------------------------------------------- + */ + +/** Sets the video quality preferences. + + @param preferFrameRateOverImageQuality The video preference to be set: + + * YES: Frame rate over image quality + * NO: Image quality over frame rate (default) + + @return * 0: Success. +* <0: Failure. + */ +- (int)setVideoQualityParameters:(BOOL)preferFrameRateOverImageQuality NS_SWIFT_NAME(setVideoQualityParameters(_:)); + +#pragma mark External Media Source + +/**----------------------------------------------------------------------------- + * @name External Media Source + * ----------------------------------------------------------------------------- + */ + +/** + * Sets the external video source. + * + * Call this API before `enableVideo` or `startPreview`. + * + * @param enable Determines whether to enable the external video source. + * - `YES`: Use external video source. + * - `NO`: Do not use external video source. + * + * The Agora SDK does not support switching video sources dynamically in the + * channel. If an external video source is enabled and you are in a channel, if + * you want to switch to an internal video source, you must exit the channel. + * Then call this method to set enable as NO, and join the channel again. + * @param useTexture Determines whether to use textured video data. + * - `YES`: Use the texture as an input. + * - `NO`: Do not use the texture as an input. + * @param sourceType Determines the type of the external video source. + * - see AgoraExternalVideoSourceType in AgoraEnumerates.h + */ +- (void)setExternalVideoSource:(BOOL)enable useTexture:(BOOL)useTexture sourceType:(AgoraExternalVideoSourceType)sourceType NS_SWIFT_NAME(setExternalVideoSource(_:useTexture:sourceType:)); + +/** + * Sets the external video source. + * + * Call this API before `enableVideo` or `startPreview`. + * + * @param enable Determines whether to enable the external video source. + * - `YES`: Use external video source. + * - `NO`: Do not use external video source. + * + * The Agora SDK does not support switching video sources dynamically in the + * channel. If an external video source is enabled and you are in a channel, if + * you want to switch to an internal video source, you must exit the channel. + * Then call this method to set enable as NO, and join the channel again. + * @param useTexture Determines whether to use textured video data. + * - `YES`: Use the texture as an input. + * - `NO`: Do not use the texture as an input. + * @param sourceType Determines the type of the external video source. + * @param encodedVideoTrackOption Determines encoded video track options. + */ +- (void)setExternalVideoSource:(BOOL)enable useTexture:(BOOL)useTexture + sourceType:(AgoraExternalVideoSourceType)sourceType + encodedVideoTrackOption:(AgoraEncodedVideoTrackOptions* _Nonnull)encodedVideoTrackOption NS_SWIFT_NAME(setExternalVideoSource(_:useTexture:sourceType:encodedVideoTrackOption:)); + +/** + * Pushes the encoded external video frame to Agora SDK. + * + * @note + * Ensure that you have configured encoded video source before calling this method. + * + * @param data The encoded external video data, which must be the direct buffer. + * @param frameInfo The encoded external video frame info: AgoraEncodedVideoFrameInfo. + * + * @return + * - 0: Success, which means that the encoded external video frame is pushed successfully. + * - < 0: Failure, which means that the encoded external video frame fails to be pushed. + */ +- (int)pushExternalEncodedVideoFrame:(NSData* _Nonnull)frame + info:(AgoraEncodedVideoFrameInfo * _Nonnull)info NS_SWIFT_NAME(pushExternalEncodedVideoFrame(_:info:)); + +/** + * Pushes the external video frame. + * + * This method pushes the video frame using the AgoraVideoFrame class and + * passes it to the Agora SDK with the `format` parameter in AgoraVideoFormat. + * + * Call \ref setExternalVideoSource:useTexture:pushMode: setExternalVideoSource + * and set the `pushMode` parameter as `YES` before calling this method. + * @note + * In the Communication profile, this method does not support pushing textured + * video frames. + * @param frame Video frame containing the SDK's encoded video data to be + * pushed: #AgoraVideoFrame. + * @return + * - `YES`: Success. + * - `NO`: Failure. + */ +- (BOOL)pushExternalVideoFrame:(AgoraVideoFrame * _Nonnull)frame NS_SWIFT_NAME(pushExternalVideoFrame(_:)); + + +/** + * Get an custom video track id created by internal,which could used to publish or preview + * + * @return + * - > 0: the useable video track id. + * - < 0: Failure. + */ +- (unsigned int)createCustomVideoTrack NS_SWIFT_NAME(createCustomVideoTrack()); + +/** + * Get an custom encoded video track id created by internal,which could used to publish or preview + * + * @return + * - > 0: the useable video track id. + * - < 0: Failure. + */ +- (unsigned int)createCustomEncodedVideoTrack:(AgoraEncodedVideoTrackOptions* _Nonnull)encodedVideoTrackOption NS_SWIFT_NAME(createCustomEncodedVideoTrack(_:)); + +/** + * destroy a created custom video track id + * + * @param videoTrackId The video track id which was created by createCustomVideoTrack + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)destroyCustomVideoTrack:(NSUInteger)videoTrackId NS_SWIFT_NAME(destroyCustomVideoTrack(_:)); + +/** + * destroy a created custom encoded video track id + * + * @param videoTrackId The video track id which was created by createCustomEncodedVideoTrack + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)destroyCustomEncodedVideoTrack:(NSUInteger)videoTrackId NS_SWIFT_NAME(destroyCustomEncodedVideoTrack(_:)); + +#pragma mark External Audio Data +/** Enables the external audio sink. + + This method applies to scenarios where you want to use external audio data for playback. After enabling the external audio sink, you can call the [pullPlaybackAudioFrameRawData]([AgoraRtcEngineKit pullPlaybackAudioFrameRawData:lengthInByte:]) / [pullPlaybackAudioFrameSampleBufferByLengthInByte]([AgoraRtcEngineKit pullPlaybackAudioFrameSampleBufferByLengthInByte:]) method to pull the remote audio data, process it, and play it with the audio effects that you want. + @param enabled Determines whether to enable the external audio sick: + - true: Enable the external audio sick. + - false: Disable the external audio sick. + @param sampleRate Sets the sample rate (Hz) of the external audio sink. You can set this parameter as 16000, 32000, 44100 or 48000. + @param channels Sets the number of audio channels of the external audio sink: + + - 1: Mono + - 2: Stereo + + */ +- (void)enableExternalAudioSink:(BOOL)enabled + sampleRate:(NSUInteger)sampleRate + channels:(NSUInteger)channels NS_SWIFT_NAME(enableExternalAudioSink(_:sampleRate:channels:)); + +/** Pulls the remote audio data in the RawData format. + + Before calling this method, call the [enableExternalAudioSink]([AgoraRtcEngineKit enableExternalAudioSink:channels:]) method to enable and set the external audio sink. + + After a successful method call, the app pulls the decoded and mixed audio data for playback. + + **Note** + + @param data The audio data that you want to pull. The data format is in byte[]. + @param lengthInByte The data length (byte) of the external audio data. + + The value of this parameter is related to the value of the `sampleRate` parameter that you set in the [enableExternalAudioSink]([AgoraRtcEngineKit enableExternalAudioSink:channels:]) method: lengthInByte = sampleRate / 100 * 2 * number of channels * time (ms). + + @return - YES: Success. + - NO: Failure. + */ +- (BOOL)pullPlaybackAudioFrameRawData:(void * _Nonnull)data + lengthInByte:(NSUInteger)lengthInByte NS_SWIFT_NAME(pullPlaybackAudioFrameRawData(_:lengthInByte:)); + +/** Pulls the remote audio data in the SampleBuffer format. + + Before calling this method, call the [enableExternalAudioSink]([AgoraRtcEngineKit enableExternalAudioSink:channels:]) method to enable and set the external audio sink. + + After a successful method call, the app pulls the decoded and mixed audio data for playback. + + **Note** + + @param lengthInByte The data length (byte) of the external audio data. + + The value of this parameter is related to the value of the sampleRate parameter that you set in the [enableExternalAudioSink]([AgoraRtcEngineKit enableExternalAudioSink:channels:]) method: + + - `lengthInByte` = `sampleRate` / 100 * 2 * number of channels * time (ms). + - This parameter should be divisible by the value of sampleRate. + + @return - NOT NULL: Success. + - NULL: Failure. + */ +- (CMSampleBufferRef _Nullable)pullPlaybackAudioFrameSampleBufferByLengthInByte:(NSUInteger)lengthInByte NS_SWIFT_NAME(pullPlaybackAudioFrameSampleBufferBy(lengthInByte:)); + + +/** + * Create a custom audio track and get the audio track id. + * + * @note Ensure that you call this method before calling `joinChannel`. + + * @param trackType The type of custom audio track + * See AgoraAudioTrackType. + * + * @param config The config of custom audio track + * See AgoraAudioTrackConfig. + * + * @return + * - If the call is successful, SDK returns audio track id. + * - If the call fails, SDK returns 0xffffffff. + */ +- (int)createCustomAudioTrack:(AgoraAudioTrackType)trackType + config:(AgoraAudioTrackConfig* _Nonnull)config; + +/** + * Destroy custom audio track by trackId + * + * @param trackId The custom audio track id + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)destroyCustomAudioTrack:(NSInteger)trackId; + +/** + * Sets the external audio source. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @param trackId custom audio track id. + * @param enabled Enable/Disables the local playback of external audio track: + * - true: Enable local playback + * - false: Do not enable local playback + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableCustomAudioLocalPlayback:(NSInteger)trackId enabled:(BOOL)enabled NS_SWIFT_NAME(enableCustomAudioLocalPlayback(_:enabled:)); + +/** Pushes the external audio frame to the Agora SDK for encoding. + * + * @param data External audio data. + * @param samples Number of samples for the push. + * @param trackId The audio track ID. + * @param timestamp Time stamp of the external audio frame to be synchronized with the external video source. + * @return * 0: Success. + * <0: Failure. + */ +- (int)pushExternalAudioFrameRawData:(void * _Nonnull)data + samples:(NSInteger)samples + trackId:(NSInteger)trackId + timestamp:(NSTimeInterval)timestamp NS_SWIFT_NAME(pushExternalAudioFrameRawData(_:samples:trackId:timestamp:)); + +- (int)pushCaptureAudioFrame:(AgoraAudioFrame* _Nonnull)audioFrame NS_SWIFT_NAME(pushCaptureAudioFrame(_:)); + +- (int)pushReverseAudioFrame:(AgoraAudioFrame* _Nonnull)audioFrame NS_SWIFT_NAME(pushReverseAudioFrame(_:)); + +/** Pushes the external audio frame to the Agora SDK for encoding. + * + * @param data External audio data. + * @param samples Number of samples for the push, which can be set as "samples = data.length / sizeof(int16_t)" + * @param sampleRate The Sample rate (Hz) , which can set be as 8000, 16000, 32000, 44100, or 48000. + * @param channels The number of channels, which can be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param trackId The audio track ID. + * @param timestamp Time stamp of the external audio frame to be synchronized with the external video source. + * @return * 0: Success. + * <0: Failure. + */ +- (int)pushExternalAudioFrameRawData:(void* _Nonnull)data + samples:(NSInteger)samples + sampleRate:(NSInteger)sampleRate + channels:(NSInteger)channels + trackId:(NSInteger)trackId + timestamp:(NSTimeInterval)timestamp NS_SWIFT_NAME(pushExternalAudioFrameRawData(_:samples:sampleRate:channels:trackId:timestamp:)); +/** + * Pushes the external audio frame to the sample buffer for encoding. + * + * @param sampleBuffer Sample buffer + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)pushExternalAudioFrameSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer NS_SWIFT_NAME(pushExternalAudioFrameSampleBuffer(_:)); + +/** + * Enable or disable the external audio source local playback. + * + * * @param enable Determines whether to enable the external audio source local playback: + * - true: Enable the external audio source local playback. + * - false: (default) Disable the external audio source local playback. + * @return int + * - 0: Success. + * - <0: Failure. + */ +- (int)enableExternalAudioSourceLocalPlayback:(BOOL)enable NS_SWIFT_NAME(enableExternalAudioSourceLocalPlayback(_:)); + +/** + * Sets the audio recording format for the `onRecordAudioFrame` callback. + * + * The SDK calculates the sample interval according to the value of the + * `sampleRate`, `channel`, and `samplesPerCall` parameters you set in this + * method. Sample interval (sec) = `samplePerCall`/(`sampleRate` × + * `channel`). Ensure that the value of sample interval is no less than 0.01. + * The SDK triggers the `onRecordAudioFrame` callback according to the sample interval. + * + * @param sampleRate The audio sample rate (`samplesPerSec`) returned in + * the `onRecordAudioFrame` callback, which can be set as 8000, 16000, 32000, + * 44100, or 48000 Hz. + * @param channel The number of audio channels (`channels`) returned in + * the `onRecordAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the `onRecordAudioFrame` callback.See #AgoraAudioRawFrameOperationMode. + * @param samplesPerCall The number of samples the `onRecordAudioFrame` + * callback returns. Set it as 1024 for RTMP streaming. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRecordingAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + mode:(AgoraAudioRawFrameOperationMode)mode + samplesPerCall:(NSInteger)samplesPerCall NS_SWIFT_NAME(setRecordingAudioFrameParametersWithSampleRate(_:channel:mode:samplesPerCall:)); + +- (int)setPublishAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + samplesPerCall:(NSInteger)samplesPerCall; +/** + * Sets the audio playback format for the `onPlaybackAudioFrame` callback. + * + * The SDK calculates the sample interval according to the value of the + * `sampleRate`, `channel`, and `samplesPerCall` parameters you set in this + * method. Sample interval (sec) = `samplePerCall`/(`sampleRate` × + * `channel`). Ensure that the value of sample interval is no less than 0.01. + * The SDK triggers the `onPlaybackAudioFrame` callback according to the sample + * interval. + * @param sampleRate The sample rate (`samplesPerSec`) returned in the + * `onPlaybackAudioFrame` callback, which can be set as 8000, 16000, 32000, + * 44100, or 48000 Hz. + * @param channel The number of audio channels (`channels`) returned in + * the `onPlaybackAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the `onPlaybackAudioFrame` callback. + * See #AgoraAudioRawFrameOperationMode. + * @param samplesPerCall The number of samples the `onPlaybackAudioFrame` + * callback returns. Set it as 1024 for RTMP streaming. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setPlaybackAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + mode:(AgoraAudioRawFrameOperationMode)mode + samplesPerCall:(NSInteger)samplesPerCall NS_SWIFT_NAME(setPlaybackAudioFrameParametersWithSampleRate(_:channel:mode:samplesPerCall:)); + +/** + * Sets the mixed audio format for the `onMixedAudioFrame` callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in the + * `onMixedAudioFrame` callback, which can set be as 8000, 16000, 32000, 44100, + * or 48000. + * @param channel The number of channels of the audio data in + * `onMixedAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param samplesPerCall Not supported. Sampling points in the called data + * returned in `onMixedAudioFrame`. For example, it is usually set as 1024 for + * stream pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setMixedAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + samplesPerCall:(NSInteger)samplesPerCall NS_SWIFT_NAME(setMixedAudioFrameParametersWithSampleRate(_:channel:samplesPerCall:)); + +/** + * Sets the audio ear monitoring format for the `onEarMonitoringAudioFrame` callback. + * + * The SDK calculates the sample interval according to the value of the + * `sampleRate`, `channel`, and `samplesPerCall` parameters you set in this + * method. Sample interval (sec) = `samplePerCall`/(`sampleRate` × + * `channel`). Ensure that the value of sample interval is no less than 0.01. + * The SDK triggers the `onEarMonitoringAudioFrame` callback according to the sample + * interval. + * @param sampleRate The sample rate (`samplesPerSec`) returned in the + * `onEarMonitoringAudioFrame` callback, which can be set as 8000, 16000, 32000, + * 44100, or 48000 Hz. + * @param channel The number of audio channels (`channels`) returned in + * the `onEarMonitoringAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the `onEarMonitoringAudioFrame` callback. + * See #AgoraAudioRawFrameOperationMode. + * @param samplesPerCall The number of samples the `onEarMonitoringAudioFrame` + * callback returns. Set it as 1024 for RTMP streaming. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setEarMonitoringAudioFrameParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel + mode:(AgoraAudioRawFrameOperationMode)mode + samplesPerCall:(NSInteger)samplesPerCall NS_SWIFT_NAME(setEarMonitoringAudioFrameParametersWithSampleRate(_:channel:mode:samplesPerCall:)); + + +/** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing + * "onPlaybackAudioFrameBeforeMixing" callback. + * + * @param sampleRate The sample rate(Hz) contained in the `onPlaybackAudioFrameBeforeMixing` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of channels contained in the `onPlaybackAudioFrameBeforeMixing` callback. + * - 1: Mono. + * - 2: Stereo. + * @return int + * - 0: Success. + * - < 0: Failure. + */ +- (int)setPlaybackAudioFrameBeforeMixingParametersWithSampleRate:(NSInteger)sampleRate + channel:(NSInteger)channel NS_SWIFT_NAME(setPlaybackAudioFrameBeforeMixingParametersWithSampleRate(_:channel:)); +/* + * Adjust the custom audio publish volume by track id. + * @param trackId custom audio track id. + * @param volume The volume, range is [0,100]: + * 0: mute, 100: The original volume + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)adjustCustomAudioPublishVolume:(NSInteger)trackId volume:(NSInteger)volume NS_SWIFT_NAME(adjustCustomAudioPublishVolume(_:volume:)); + +/* + * Adjust the custom audio playout volume by track id. + * @param trackId custom audio track id. + * @param volume The volume, range is [0,100]: + * 0: mute, 100: The original volume + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)adjustCustomAudioPlayoutVolume:(NSInteger)trackId volume:(NSInteger)volume NS_SWIFT_NAME(adjustCustomAudioPlayoutVolume(_:volume:)); + +/* + * Get monotonic time in ms which can be used by capture time, + * typical scenario is as follows: + * + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * | // custom audio/video base capture time, e.g. the first audio/video capture time. | + * | int64_t custom_capture_time_base; | + * | | + * | int64_t agora_monotonic_time = getAgoraCurrentMonotonicTimeInMs(); | + * | | + * | // offset is fixed once calculated in the begining. | + * | const int64_t offset = agora_monotonic_time - custom_capture_time_base; | + * | | + * | // realtime_custom_audio/video_capture_time is the origin capture time that customer provided.| + * | // actual_audio/video_capture_time is the actual capture time transfered to sdk. | + * | int64_t actual_audio_capture_time = realtime_custom_audio_capture_time + offset; | + * | int64_t actual_video_capture_time = realtime_custom_video_capture_time + offset; | + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * + * @return + * - >= 0: Success. + * - < 0: Failure. + */ +- (int64_t)getCurrentMonotonicTimeInMs NS_SWIFT_NAME(getCurrentMonotonicTimeInMs()); + +#pragma mark Audio spectrum monitor + +/** + * Enable the audio spectrum monitor. + * + * @param intervalInMS Sets the time interval(ms) between two consecutive audio spectrum callback. + * The default value is 100. This param should be larger than 10. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAudioSpectrumMonitor:(int)intervalInMS NS_SWIFT_NAME(enableAudioSpectrumMonitor(_:)); + +/** + * Disalbe the audio spectrum monitor. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)disableAudioSpectrumMonitor NS_SWIFT_NAME(disableAudioSpectrumMonitor()); + +/** + * Registers an audio spectrum delegate. + * + * You need to register the following callbacks + * according to your scenario: + * - "onAudioSpectrumComputed": Occurs when the SDK receives the audio data and at set intervals. + * + * @param delegate AgoraAudioSpectrumDelegate + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)registerAudioSpectrumDelegate:(id _Nullable )delegate NS_SWIFT_NAME(registerAudioSpectrumDelegate(_:)); + + /** + * Releases the audio spectrum delegate. + * + * @param delegate AgoraAudioSpectrumDelegate + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)unregisterAudioSpectrumDelegate:(id _Nullable)delegate NS_SWIFT_NAME(unregisterAudioSpectrumDelegate(_:)); + +#pragma mark Built-in Encryption + +/**----------------------------------------------------------------------------- + * @name Built-in Encryption + * ----------------------------------------------------------------------------- + */ + +/** Enables/Disables the built-in encryption. + + In scenarios requiring high security, Agora recommends calling enableEncryption to enable the built-in encryption before joining a channel. + + All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + + **Note** + + - If you enable the built-in encryption, you cannot use the RTMP streaming function. + + @param enabled Whether to enable the built-in encryption: + + - YES: Enable the built-in encryption. + - NO: Disable the built-in encryption. + + @param config Configurations of built-in encryption schemas. See AgoraEncryptionConfig. + + @return - 0: Success. + - < 0: Failure. + + - -2 (`AgoraErrorCodeInvalidArgument`): An invalid parameter is used. Set the parameter with a valid value. + - -7 (`AgoraErrorCodeNotInitialized`): The SDK is not initialized. Initialize the `AgoraRtcEngineKit` instance before calling this method. + - -4 (`AgoraErrorCodeNotSupported`): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. + */ +- (int)enableEncryption:(bool)enabled encryptionConfig:(AgoraEncryptionConfig * _Nonnull)config NS_SWIFT_NAME(enableEncryption(_:encryptionConfig:)); + + +#pragma mark Data Stream + +/**----------------------------------------------------------------------------- + * @name Data Steam + * ----------------------------------------------------------------------------- + */ +/** Creates a data stream. +* +* Each user can create up to five data streams during the lifecycle of the `AgoraRtcEngineKit`. +* +* @note Set both the `reliable` and `ordered` parameters to `YES` or `NO`. Do not set one as `YES` and the other as `NO`. +* +* @param streamId ID of the created data stream. +* @param reliable Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds: +* - YES: The recipients receive the data stream from the sender within five seconds. If the recipient does not receive the data stream within five seconds, an error is reported to the app. +* - NO: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream. +* +* @param ordered Sets whether or not the recipients receive the data stream in the sent order: +* - YES: The recipients receive the data stream in the sent order. +* - NO: The recipients do not receive the data stream in the sent order. +* +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (int)createDataStream:(NSInteger * _Nonnull)streamId + reliable:(BOOL)reliable + ordered:(BOOL)ordered NS_SWIFT_NAME(createDataStream(_:reliable:ordered:)); +/** Creates a data stream. + + Each user can create up to five data streams during the lifecycle of the [AgoraRtcChannel](AgoraRtcChannel). + + @param streamId ID of the created data stream. + @param config the config of data stream. + @return * 0: Success. +* < 0: Failure. + */ +- (int)createDataStream:(NSInteger * _Nonnull)streamId + config:(AgoraDataStreamConfig * _Nonnull)config NS_SWIFT_NAME(createDataStream(_:config:)); +/** Sends data stream messages to all users in a channel. + +The SDK has the following restrictions on this method: + +- Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB. +- Each client can send up to 30 KB of data per second. +- Each user can have up to five data streams simultaneously. + +If the remote user receives the data stream within five seconds, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:receiveStreamMessageFromUid:streamId:data: receiveStreamMessageFromUid callback on the remote client, from which the remote user gets the stream message. + +If the remote user does not receive the data stream within five seconds, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached: didOccurStreamMessageErrorFromUid callback on the remote client. + + @note + - This method applies only to the Communication profile or to the hosts in the live interactive streaming profile. If an audience in the live interactive streaming profile calls this method, the audience role may be changed to a host. + - Ensure that you have created the data stream using \ref createDataStream:reliable:ordered: createDataStream before calling this method. + + @param streamId ID of the sent data stream returned in the `createDataStream` method. + @param data Sent data. + + @return + - 0: Success. + - < 0: Failure. +*/ +- (int)sendStreamMessage:(NSInteger)streamId + data:(NSData * _Nonnull)data NS_SWIFT_NAME(sendStreamMessage(_:data:)); + +#pragma mark Stream Publish + +/**----------------------------------------------------------------------------- + * @name Stream Publish + * ----------------------------------------------------------------------------- + */ + + +/** + * New publish stream interface, just publish raw stream + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. The RTMP URL address must not contain special characters, such as Chinese language characters. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ +- (int)startRtmpStreamWithoutTranscoding:(NSString* _Nonnull)url NS_SWIFT_NAME(startRtmpStreamWithoutTranscoding(_:)); + +/** + * New publish stream interface, just publish mix stream + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. The RTMP URL address must not contain special characters, such as Chinese language characters. + * @param transcoding Sets the CDN live audio/video transcoding settings. See AgoraLiveTranscoding. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ +- (int)startRtmpStreamWithTranscoding:(NSString* _Nonnull)url transcoding:(AgoraLiveTranscoding* _Nullable)transcoding NS_SWIFT_NAME(startRtmpStream(withTranscoding:transcoding:)); + +/** Sets the video layout and audio settings for CDN live. (CDN live only.) + + The SDK triggers the [rtcEngineTranscodingUpdated]([AgoraRtcEngineDelegate rtcEngineTranscodingUpdated:]) callback when you call the `setLiveTranscoding` method to update the transcoding setting. + + **Note** + + - This method applies to live-broadcast profile only. + - Ensure that you enable the RTMP Converter service before using this function. See [Prerequisites](https://docs.agora.io/en/Interactive%20Broadcast/cdn_streaming_apple?platform=iOS#prerequisites). + - If you call the `setLiveTranscoding` method to update the transcoding setting for the first time, the SDK does not trigger the `rtcEngineTranscodingUpdated` callback. + + + @param transcoding Sets the CDN live audio/video transcoding settings. See AgoraLiveTranscoding. + + @return = 0: Success. + * < 0: Failure. + */ +- (int)updateRtmpTranscoding:(AgoraLiveTranscoding* _Nullable)transcoding NS_SWIFT_NAME(updateRtmpTranscoding(_:)); + +/** Removes an RTMP stream from the CDN. + +This method removes the RTMP URL address added by the [addPublishStreamUrl](addPublishStreamUrl:transcodingEnabled:) method from a CDN live stream. + +This method call triggers the [rtmpStreamingChangedToState]([AgoraRtcEngineDelegate rtcEngine:rtmpStreamingChangedToState:state:errorCode:]) callback on the local client to report the state of removing an RTMP stream from the CDN. + + **Note:** + + * This method applies to live-broadcast profile only. + * This method removes only one URL each time it is called. + * The URL must not contain special characters, such as Chinese language characters. + + @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + + @return = 0: Success. + * < 0: Failure. + */ +- (int)stopRtmpStream:(NSString* _Nonnull)url NS_SWIFT_NAME(stopRtmpStream(_:)); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +#pragma mark Screen Capture + +/**----------------------------------------------------------------------------- + * @name Screen Capture + * ----------------------------------------------------------------------------- + */ + +/** Starts screen sharing. + * + * @param sourceType source type of screen. See #AgoraVideoSourceType. + * @param parameters The configuration of the screen sharing. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startScreenCapture:(AgoraVideoSourceType)sourceType config:(AgoraScreenCaptureConfiguration * _Nullable)config NS_SWIFT_NAME(startScreenCapture(_:config:)); + +/** Stops a screen capture. + + @note This method applies to macOS only. + + @param The capture type of the custom video source. See #AgoraVideoSourceType. + @return * 0: Success. +* <0: Failure. + - `ERR_INVALID_ARGUMENT`: the argument is invalid. + */ +- (int)stopScreenCapture:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(stopScreenCapture(_:)); + +/** Shares the whole or part of a screen by specifying the display ID. (macOS only.) + +@param displayId The ID ( type of CGDirectDisplayId) of the display screen to be shared. This parameter specifies which display screen you want to share. For information on how to get the displayId, see [Share the Screen](../../../screensharing_mac). +@param regionRect (Optional) The relative location of the region to the display screen. nil means sharing the whole screen. This parameter contains the following properties: + +- x: the horizontal offset from the top-left corner. +- y: the vertical offset from the top-left corner. +- width: the width of the region. +- height: the height of the region. + +If the specified region overruns the screen, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen. +@param captureParams The screen sharing encoding parameters, see [AgoraScreenCaptureParameters](AgoraScreenCaptureParameters). + +@return * 0: Success. +* < 0: Failure. + + - `ERR_INVALID_STATE`: the screen sharing state is invalid, probably because another screen or window is being shared. Call [stopScreenCapture]([AgoraRtcEngineKit stopScreenCapture]) to stop sharing the current window. + - `ERR_INVALID_ARGUMENT`: the argument is invalid. + */ +- (int)startScreenCaptureByDisplayId:(UInt32)displayId + regionRect:(CGRect)regionRect + captureParams:(AgoraScreenCaptureParameters *_Nonnull)captureParams NS_SWIFT_NAME(startScreenCapture(byDisplayId:regionRect:captureParams:)); + +/** Shares the whole or part of a window by specifying the window ID. (macOS only.) + +@param windowId The ID of the window ( type of CGWindowId) to be shared. This parameter specifies which window you want to share. For information on how to get the windowId, see [Share the Screen](../../../screensharing_mac). +@param regionRect (Optional) The relative location of the region to the window. nil means sharing the whole window. This parameter contains the following properties: + +- x: the horizontal offset from the top-left corner. +- y: the vertical offset from the top-left corner. +- width: the width of the region. +- height: the height of the region. + +If the specified region overruns the window, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole window. +@param captureParams The window sharing encoding parameters, see [AgoraScreenCaptureParameters](AgoraScreenCaptureParameters). + +@return * 0: Success. +* < 0: Failure. + + - `ERR_INVALID_STATE`: the window sharing state is invalid, probably because another screen or window is being shared. Call [stopScreenCapture]([AgoraRtcEngineKit stopScreenCapture]) to stop sharing the current window. + - `ERR_INVALID_ARGUMENT`: the argument is invalid. + */ +- (int)startScreenCaptureByWindowId:(UInt32)windowId + regionRect:(CGRect)regionRect + captureParams:(AgoraScreenCaptureParameters *_Nonnull)captureParams NS_SWIFT_NAME(startScreenCapture(byWindowId:regionRect:captureParams:)); + +/** Updates the screen capture region. + + @note This method applies to macOS only. + + @param rect The screen capture region. + + @return * 0: Success. +* <0: Failure. + */ +- (int)updateScreenCaptureRegion:(CGRect)rect NS_SWIFT_NAME(updateScreenCaptureRegion(_:)); + +/** Updates the screen sharing parameters. (macOS only.) + +@param captureParams The screen sharing encoding parameters, see [AgoraScreenCaptureParameters](AgoraScreenCaptureParameters). + +@return * 0: Success. +* < 0: Failure. + + - `ERR_NOT_READY`: no screen or windows is being shared. + */ +- (int)updateScreenCaptureParameters:(AgoraScreenCaptureParameters * _Nonnull)captureParams NS_SWIFT_NAME(updateScreenCaptureParameters(_:)); + +/** + Gets a list of shareable screens and windows. + + You can call this method before sharing a screen or window to get a list of + shareable screens and windows, which enables a user to use thumbnails in the + list to easily choose a particular screen or window to share. This list also + contains important information such as window ID and screen ID, with which you + can call [startScreenCaptureByWindowId]([AgoraRtcEngineKit startScreenCaptureByWindowId:rectangle:parameters:]) + or [startScreenCaptureByDisplayId]([AgoraRtcEngineKit startScreenCaptureByDisplayId:rectangle:parameters:]) + to start the sharing. + + @note This method applies to macOS only. + + @param thumbSize The target size of the screen or window thumbnail. The width and height are in pixels. The SDK scales + the original image to make the length of the longest side of the image the same as that of the target size without + distorting the original image. For example, if the original image is 400 × 300 and `thumbSize` is 100 × 100, the + actual size of the thumbnail is 100 × 75. If the target size is larger than the original size, the thumbnail is the + original image and the SDK does not scale it. + @param iconSize The target size of the icon corresponding to the application program. The width and height are in pixels. + The SDK scales the original image to make the length of the longest side of the image the same as that of the target + size without distorting the original image. For example, if the original image is 400 × 300 and `iconSize` is 100 × 100, + the actual size of the icon is 100 × 75. If the target size is larger than the original size, the icon is the original + image and the SDK does not scale it. + @param includeScreen Whether the SDK returns screen information in addition to window information: + + - YES: The SDK returns screen and window information. + - NO: The SDK returns window information only. + + @return AgoraScreenCaptureSourceInfo + */ +- (NSArray* _Nullable)getScreenCaptureSourcesWithThumbSize:(NSSize)thumbSize iconSize:(NSSize)iconSize includeScreen:(BOOL)includeScreen NS_SWIFT_NAME(getScreenCaptureSources(withThumbSize:iconSize:includeScreen:)); + +#endif + +/** Setting the screen sharing capture scenario. + +@param scenarioType The screen sharing scenario parameters, see [AgoraScreenScenarioType](AgoraScreenScenarioType). + +@return * 0: Success. +* < 0: Failure. + + - `ERR_NOT_READY`: no screen or windows is being shared. + */ +- (int)setScreenCaptureScenario:(AgoraScreenScenarioType)scenarioType NS_SWIFT_NAME(setScreenCaptureScenario(_:)); + +/** Stops a screen capture. + + @note This method applies to macOS / iOS. + + @return * 0: Success. +* <0: Failure. + */ +- (int)stopScreenCapture NS_SWIFT_NAME(stopScreenCapture()); + +#if TARGET_OS_IPHONE +/** Starts screen sharing. + + * Before calling this method, ensure that you have integrated AgoraRelayKitExtension.framework. + * When you call this method, AgoraRtcEngine will establish a socket connection to the ReplayKit extension. + * In the ReplayKit extension, inherit the AgoraReplayKitHandler, and then AgoraRtcEngine will get the screen share data. + + * A successful call of this method triggers the [AgoraRtcEngineDelegate]([AgoraRtcEngineDelegate rtcEngine:localVideoStateChangedOfState:state:error:sourceType]) callback: + - When sourceType == AgoraVideoSourceTypeScreen and state == AgoraVideoLocalStateCapturing, you can call [AgoraRtcEngine updateChannelWithMediaOptions:] + to change the publishScreenCaptureVideo/publishScreenCaptureAudio = YES and then publish the screen share video stream. + + - When sourceType == AgoraVideoSourceTypeScreen and state == AgoraVideoLocalStateStopped, you can call [AgoraRtcEngine updateChannelWithMediaOptions:] + to change the publishScreenCaptureVideo/publishScreenCaptureAudio = NO and then stop publishing the screen share video stream. + + * @note This method applies to iOS 11+ only. + * @param parameters The configuration of the screen sharing. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startScreenCapture:(AgoraScreenCaptureParameters2* _Nullable)parameters NS_SWIFT_NAME(startScreenCapture(_:)); + +/** + * Updates the screen sharing configuration. + * + * @param parameters The configuration of the screen sharing. + * @note This method applies to iOS 11+ only. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateScreenCapture:(AgoraScreenCaptureParameters2* _Nullable)parameters NS_SWIFT_NAME(updateScreenCapture(_:)); + +- (AgoraScreenCaptureFrameRateCapability)queryScreenCaptureCapability NS_SWIFT_NAME(queryScreenCaptureCapability()); + +#pragma mark Camera Control + +/**----------------------------------------------------------------------------- + * @name Camera Control + * ----------------------------------------------------------------------------- + */ + +/** Checks whether camera zoom is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the camera zoom function + * NO: The device does not support the camera zoom function + */ +- (BOOL)isCameraZoomSupported NS_SWIFT_NAME(isCameraZoomSupported()); + +/** get the max camera zoom ratio. + + @note This method applies to iOS only, not to macOS. + + @return the max camera zoom ratio. +*/ +- (CGFloat)cameraMaxZoomFactor NS_SWIFT_NAME(cameraMaxZoomFactor()); + +/** Sets the camera zoom ratio. + + @note This method applies to iOS only, not to macOS. + + @param zoomFactor The camera zoom factor ranging from 1.0 to maximum zoom. + */ +- (CGFloat)setCameraZoomFactor:(CGFloat)zoomFactor NS_SWIFT_NAME(setCameraZoomFactor(_:)); + +/** Checks whether the manual focus is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the manual focus function + * NO: The device does not support the manual focus function + */ +- (BOOL)isCameraFocusPositionInPreviewSupported NS_SWIFT_NAME(isCameraFocusPositionInPreviewSupported()); + +/** Sets the manual focus position. + + @note This method applies to iOS only, not to macOS. + + @param position * positionX: Horizontal coordinate of the touch point in the view + * positionY: Vertical coordinate of the touch point in the view + */ +- (BOOL)setCameraFocusPositionInPreview:(CGPoint)position NS_SWIFT_NAME(setCameraFocusPositionInPreview(_:)); + +/** Checks whether the manual exposure is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the manual exposure function + * NO: The device does not support the manual exposure function + */ +- (BOOL)isCameraExposurePositionSupported NS_SWIFT_NAME(isCameraExposurePositionSupported()); + +/** Sets the manual exposure position. + + @note This method applies to iOS only, not to macOS. + + @param positionInView * positionX: Horizontal coordinate of the touch point in the view + * positionY: Vertical coordinate of the touch point in the view + */ +- (BOOL)setCameraExposurePosition:(CGPoint)positionInView NS_SWIFT_NAME(setCameraExposurePosition(_:)); + +/** Checks whether camera supports to set exposure value. + +@note This method applies to iOS only, not to macOS. + +@return * YES: The device supports the camera exposure function +* NO: The device does not support the camera exposure function +*/ +- (BOOL)isCameraExposureSupported NS_SWIFT_NAME(isCameraExposureSupported()); + +/** Sets the camera exposure value bias. + +@note This method applies to iOS only, not to macOS. + +@param exposureFactor the recommended camera exposure factor ranging from -8.0 to 8.0. Absolute EV bias will set to camera. +*/ +- (CGFloat)setCameraExposureFactor:(CGFloat)exposureFactor NS_SWIFT_NAME(setCameraExposureFactor(_:)); + +/** Checks whether the device supports enabling the flash. (iOS only.) + + The SDK uses the front camera by default, so if you call + `isCameraTorchSupported` directly, you can find out from the return value + whether the device supports enabling the flash when using the front camera. + If you want to check whether the device supports enabling the flash when + using the rear camera, call [switchCamera]([AgoraRtcEngineKit switchCamera]) + to switch the camera used by the SDK to the rear camera, and then call + `isCameraTorchSupported`. + + **Note** + + - Call this method after the camera is started. + - On iPads with system version 15, even if `isCameraTorchSupported` + returns `YES`, you might fail to successfully enable the flash by calling + [setCameraTorchOn]([AgoraRtcEngineKit setCameraTorchOn:]) due to system issues. + + @return * YES: The device supports enabling the flash. + * NO: The device does not support enabling the flash. + */ +- (BOOL)isCameraTorchSupported NS_SWIFT_NAME(isCameraTorchSupported()); + +/** Sets whether to enable the flash. (iOS only.) + + **Note** + + - Call this method after the camera is started. + - On iPads with system version 15, even if [isCameraTorchSupported]([AgoraRtcEngineKit isCameraTorchSupported]) + returns `YES`, you might fail to successfully enable the flash by calling `setCameraTorchOn` due to system issues. + + @param isOn Determines whether to enable the flash: + + * YES: Enable the flash. + * NO: Do not enable the flash. + + @return * YES: Success. +* NO: Failure. + */ +- (BOOL)setCameraTorchOn:(BOOL)isOn NS_SWIFT_NAME(setCameraTorchOn(_:)); + +/** Checks whether the autofocus is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the autofocus function + * NO: The device does not support the autofocus function + */ +- (BOOL)isCameraAutoFocusFaceModeSupported NS_SWIFT_NAME(isCameraAutoFocusFaceModeSupported()); + +/** Enables the camera autoFocus. + + @note This method applies to iOS only, not to macOS. + + @param enable * YES: Enable the camera autofocus + * NO: Disable the camera autofocus + + @return + * YES: Success. + * NO: Failure. + */ +- (BOOL)setCameraAutoFocusFaceModeEnabled:(BOOL)enable NS_SWIFT_NAME(setCameraAutoFocusFaceModeEnabled(_:)); + +/** Checks whether the autoexposure is supported. + + @note This method applies to iOS only, not to macOS. + + @return * YES: The device supports the autoexposure function + * NO: The device does not support the autoexposure function + */ +- (BOOL)isCameraAutoExposureFaceModeSupported NS_SWIFT_NAME(isCameraAutoExposureFaceModeSupported()); + +/** Enables the camera autoExposure. + + @note This method applies to iOS only, not to macOS. + + @param enable * YES: Enable the camera autoexposure + * NO: Disable the camera autoexposure + + @return + * YES: Success. + * NO: Failure. + */ +- (BOOL)setCameraAutoExposureFaceModeEnabled:(BOOL)enable NS_SWIFT_NAME(setCameraAutoExposureFaceModeEnabled(_:)); + +/** + * Switches between the front and rear cameras. + * @note This method applies to iOS only, not to macOS. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)switchCamera NS_SWIFT_NAME(switchCamera()); + +/** Enables the SDK use AVCaptureMultiCamSession or AVCaptureSession. Applies to iOS 13.0+ only. + * @param enabled Whether to enable multi-camera when capturing video: + * - true: Enable multi-camera, and the SDK uses AVCaptureMultiCamSession. + * - false: Disable multi-camera, and the SDK uses AVCaptureSession. + * @param config The config for secondary camera capture session. See \ref AgoraCameraCapturerConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableMultiCamera:(BOOL)enabled config:(AgoraCameraCapturerConfiguration* _Nullable)config NS_SWIFT_NAME(enableMultiCamera(_:config:)); +#endif + + +/** Sets the camera capture configuration. + * @note Call this method before enabling the local camera. + * That said, you can call this method before calling \ref IRtcEngine::joinChannel "joinChannel", + * \ref IRtcEngine::enableVideo "enableVideo", or \ref IRtcEngine::enableLocalVideo "enableLocalVideo", + * depending on which method you use to turn on your local camera. + * + * @param config Sets the camera capturer configuration. See AgoraCameraCapturerConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setCameraCapturerConfiguration:(AgoraCameraCapturerConfiguration * _Nullable)config NS_SWIFT_NAME(setCameraCapturerConfiguration(_:)); + + +/** + * Start the camera capture + * + * @param sourceType source type of camera. See #AgoraVideoSourceType. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startCameraCapture:(AgoraVideoSourceType)sourceType config:(AgoraCameraCapturerConfiguration * _Nullable)config NS_SWIFT_NAME(startCameraCapture(_:config:)); + +/** + * Stop the camera capture + * + * @param sourceType source type of camera. See #AgoraVideoSourceType. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopCameraCapture:(AgoraVideoSourceType)sourceType NS_SWIFT_NAME(stopCameraCapture(_:)); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +#pragma mark macOS Device +/**----------------------------------------------------------------------------- + * @name macOS Device + * ----------------------------------------------------------------------------- + */ + +/** Monitors the change of a device state. + + @note This method applies to macOS only, not to iOS. + + @param enabled - YES: Enable the monitoring of a device state change + - Fales: Disable the monitoring a device state change + */ +- (void)monitorDeviceChange:(BOOL)enabled NS_SWIFT_NAME(monitorDeviceChange(_:)); + +/** Gets all the devices in the system. + + @note This method applies to macOS only, not to iOS. + + This method returns an NSArray object, including all the devices in the system. + Your application can use the AgoraRtcDeviceInfo array object to enumerate the devices. + + @note Do not call this method in the main thread. + + @param type AgoraMediaDeviceType + @return When called successfully, it returns an AgoraRtcDeviceInfo NSArray object including all the devices. + */ +- (NSArray * _Nullable)enumerateDevices:(AgoraMediaDeviceType)type NS_SWIFT_NAME(enumerateDevices(_:)); + +/** Gets the device info; such as a recording, playback, or video capture device. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @return When called successfully, it returns the device info of the device. Otherwise, it returns nil. + */ +- (AgoraRtcDeviceInfo * _Nullable)getDeviceInfo:(AgoraMediaDeviceType)type NS_SWIFT_NAME(getDeviceInfo(_:)); + +/** Specifies the player, recording, or audio-sampling device. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @param deviceId Device ID of the device, which can be fetched by calling [enumerateDevices](enumerateDevices:). The deviceId does not change when plugged or unplugged. + @return * 0: Success. +* <0: Failure. + */ + +- (int)setDevice:(AgoraMediaDeviceType)type deviceId:(NSString * _Nonnull)deviceId NS_SWIFT_NAME(setDevice(_:deviceId:)); + +/** Gets the default audio device of the system (macOS only). + + @param type Device type: AgoraMediaDeviceType. + @return * The device information (AgoraRtcDeviceInfo), if this method call is successful. + * nil: Failure. +*/ +- (AgoraRtcDeviceInfo* _Nullable)getDefaultAudioDevice:(AgoraMediaDeviceType)type NS_SWIFT_NAME(getDefaultAudioDevice(_:)); + +/** Gets the specified device's volume. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @return * 0: Success. +* <0: Failure. + */ +- (int)getDeviceVolume:(AgoraMediaDeviceType)type NS_SWIFT_NAME(getDeviceVolume(_:)); + +/** Sets the specified device's volume. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @param volume The volume to set, ranging from 0 to 255. + @return * 0: Success. +* <0: Failure. + */ +- (int)setDeviceVolume:(AgoraMediaDeviceType)type volume:(int)volume NS_SWIFT_NAME(setDeviceVolume(_:volume:)); + +/** Starts the microphone test. + + @note This method applies to macOS only, not to iOS. + + This method tests whether the microphone works properly. Once the test starts, the SDK reports the volume information by using the [reportAudioVolumeIndicationOfSpeakers]([AgoraRtcEngineDelegate rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:]) callback method. + + @param indicationInterval Interval (ms) at which to report the microphone volume. + @return * 0: Success. +* <0: Failure. + */ +- (int)startRecordingDeviceTest:(int)indicationInterval NS_SWIFT_NAME(startRecordingDeviceTest(_:)); + +/** Stops the microphone test. + + @note This method applies to macOS only, not to iOS. + + This method stops testing the microphone. You must call this method to stop the test after calling the [startRecordingDeviceTest](startRecordingDeviceTest:) method. + + @return * 0: Success. +* <0: Failure. + */ +- (int)stopRecordingDeviceTest NS_SWIFT_NAME(stopRecordingDeviceTest()); + + /** Starts a playback device test. + + @note This method applies to macOS only, not to iOS. + + This method tests whether the playback device works properly with the specified playback audio file. + + @param audioFileName File path of the audio file for the test, which is in utf8 absolute path: + + - Supported File Format: wav, mp3, m4a, and aac + - Supported File Sampling Rate: 8000, 16000, 32000, 44100, and 48000 + + @return * 0: Success. +* <0: Failure. + */ +- (int)startPlaybackDeviceTest:(NSString * _Nonnull)audioFileName NS_SWIFT_NAME(startPlaybackDeviceTest(_:)); + +/** Stops the playback device test. + + @note This method applies to macOS only, not to iOS. + + This method stops testing the playback device. You must call this method to stop the test after calling [startPlaybackDeviceTest](startPlaybackDeviceTest:). + + @return * 0: Success. +* <0: Failure. + */ +- (int)stopPlaybackDeviceTest NS_SWIFT_NAME(stopPlaybackDeviceTest()); + +/** Starts the audio device loopback test. (macOS only.) + +This method tests whether the local audio devices are working properly. After calling this method, the microphone captures the local audio and plays it through the speaker. The [reportAudioVolumeIndicationOfSpeakers]([AgoraRtcEngineDelegate rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:]) callback returns the local audio volume information at the set interval. + +**Note:** + +This method tests the local audio devices and does not report the network conditions. + +@param indicationInterval The time interval (ms) at which the [reportAudioVolumeIndicationOfSpeakers]([AgoraRtcEngineDelegate rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:]) callback returns. We recommend setting it as greater than 200 ms. The minimum value is 10 ms. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)startAudioDeviceLoopbackTest:(int)indicationInterval NS_SWIFT_NAME(startAudioDeviceLoopbackTest(_:)); + +/** Stops the audio device loopback test. (macOS only.) + +Ensure that you call this method to stop the loopback test after calling the [startAudioDeviceLoopbackTest]([AgoraRtcEngineKit startAudioDeviceLoopbackTest:]) method. + +@return * 0: Success. +* < 0: Failure. +*/ +- (int)stopAudioDeviceLoopbackTest NS_SWIFT_NAME(stopAudioDeviceLoopbackTest()); + +/** The status of following system default playback device. + + @note The status of following system default playback device. + + @param enable Variable to whether the current device follow system default playback device or not. + - true: The current device will change when the system default playback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. +*/ +- (int)followSystemPlaybackDevice:(BOOL)enable NS_SWIFT_NAME(followSystemPlaybackDevice(_:)); + +/** The status of following system default recording device. + + @note The status of following system default recording device. + + @param enable Variable to whether the current device follow system default recording device or not. + - true: The current device will change when the system default recording device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ +- (int)followSystemRecordingDevice:(BOOL)enable NS_SWIFT_NAME(followSystemRecordingDevice(_:)); + +/** Starts the capture device test. + + @note This method applies to macOS only, not to iOS. + + This method tests whether the current video capture device works properly. Ensure that you have called enableVideo before calling this method and that the parameter view window is valid. + + @param view Input parameter, for displaying the video window. + */ +- (int)startCaptureDeviceTest:(NSView * _Nonnull)view NS_SWIFT_NAME(startCaptureDeviceTest(_:)); + +/** Stops the capture device test. + + @note This method applies to macOS only, not to iOS. + + This method stops testing the capture device. You must call this method to stop the test after calling [startCaptureDeviceTest](startCaptureDeviceTest:). + */ +- (int)stopCaptureDeviceTest NS_SWIFT_NAME(stopCaptureDeviceTest()); +#endif + +#pragma mark Face Detection + +#if TARGET_OS_IPHONE + +/**----------------------------------------------------------------------------- + * @name Face Detection + * ----------------------------------------------------------------------------- + */ + +/** Enables/Disables face detection for the local user. (iOS only) + + Once face detection is enabled, the SDK triggers the [facePositionDidChangeWidth]([AgoraRtcEngineDelegate rtcEngine:facePositionDidChangeWidth:previewHeight:faces:]) callback to report the face information of the local user, which includes the following aspects: + + - The width and height of the local video. + - The position of the human face in the local video. + - The distance between the human face and the device screen. + + You can call this method either before or after joining a channel. + + @param enable Determines whether to enable the face detection function for the local user: + + - YES: Enable face detection. + - NO: Disable face detection. + + @return - 0: Success. + - < 0: Failure. + */ +- (int)enableFaceDetection:(bool)enable NS_SWIFT_NAME(enableFaceDetection(_:)); +#endif + +#pragma mark Watermark + +/**----------------------------------------------------------------------------- + * @name Watermark + * ----------------------------------------------------------------------------- + */ + +/** Adds a watermark in the PNG file format onto the local video stream so that the recording device and the audience in the channel and CDN can see or capture it. + + To add the PNG file onto a CDN publishing stream only, see the method described in [setLiveTranscoding](setLiveTranscoding:). + + @param watermark AgoraImage + */ +- (int)addVideoWatermark:(AgoraImage * _Nonnull)watermark NS_SWIFT_NAME(addVideoWatermark(_:)) __deprecated_msg("use addVideoWatermark:url options instead."); + +/** Adds a watermark image to the local video. + + This method adds a PNG watermark image to the local video in the interactive live streaming. Once the watermark image is added, all the audience in the channel (CDN audience included), and the capturing device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one. + + The watermark position depends on the settings in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method: + + - If the orientation mode of the encoding video is AgoraVideoOutputOrientationModeFixedLandscape, or the landscape mode in AgoraVideoOutputOrientationModeAdaptative, the watermark uses the landscape orientation. + - If the orientation mode of the encoding video is AgoraVideoOutputOrientationModeFixedPortrait, or the portrait mode in AgoraVideoOutputOrientationModeAdaptative, the watermark uses the portrait orientation. + - When setting the watermark position, the region must be less than the dimensions set in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method. Otherwise, the watermark image will be cropped. + + **Note** + + - Ensure that you have called the [enableVideo]([AgoraRtcEngineKit enableVideo]) method to enable the video module before calling this method. + - If you only want to add a watermark image to the local video for the audience in the CDN live streaming channel to see and capture, you can call this method or the [setLiveTranscoding]([AgoraRtcEngineKit setLiveTranscoding:]) method. + - This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray. + - If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings. + - If you have enabled the local video preview by calling the [startPreview]([AgoraRtcEngineKit startPreview]) method, you can use the `visibleInPreview` member in the WatermarkOptions class to set whether or not the watermark is visible in preview. + - If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. + + @param url The local file path of the watermark image to be added. This method supports adding a watermark image from the local file path. If the watermark image to be added is in the project file, you need to change the image's Type from PNG image to Data in the Xcode property, otherwise, the Agora Native SDK cannot recognize the image. + @param options The options of the watermark image to be added. See WatermarkOptions. + + @return * 0: Success. + * < 0: Failure. + */ +- (int)addVideoWatermark:(NSURL* _Nonnull)url options:(WatermarkOptions* _Nonnull)options NS_SWIFT_NAME(addVideoWatermark(_:options:)); + +/** Clears the watermark image on the video stream. +@return * 0: Success. + * < 0: Failure. + */ +- (int)clearVideoWatermarks NS_SWIFT_NAME(clearVideoWatermarks()); + +#pragma mark String UID + +/** Registers a user account. + * + * Once registered, the user account can be used to identify the local user when the user joins the channel. + * After the user successfully registers a user account, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" callback on the local client, + * reporting the user ID and user account of the local user. + * + * To join a channel with a user account, you can choose either of the following: + * + * Call the [registerLocalUserAccount]([AgoraRtcEngineKit registerLocalUserAccount:appId:]) method to create a user account, and then the [joinChannelByUserAccount]([AgoraRtcEngineKit joinChannelByUserAccount:token:channelId:joinSuccess:]) method to join the channel. + * Call the [joinChannelByUserAccount]([AgoraRtcEngineKit joinChannelByUserAccount:token:channelId:joinSuccess:]) method to join the channel. + + * + * The difference between the two is that for the former, the time elapsed between calling the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method + * and joining the channel is shorter than the latter. + * + * @note + * - Ensure that you set the `userAccount` parameter. Otherwise, this method does not take effect. + * - Ensure that the value of the `userAccount` parameter is unique in the channel. + * - To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param appID The App ID of your project. + + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)registerLocalUserAccount:(NSString* _Nonnull)userAccount appId:(NSString* _Nonnull)appId NS_SWIFT_NAME(registerLocalUserAccount(_:appId:)); + +/** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param joinSuccessBlock callback block + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (-2) + * - #ERR_NOT_READY (-3) + * - #ERR_REFUSED (-5) + */ +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + userAccount:(NSString * _Nonnull)userAccount + joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannel(byToken:channelId:userAccount:joinSuccess:)); + +/** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param mediaOptions The channel media options: \ref agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions" + * @param joinSuccessBlock callback block + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (-2) + * - #ERR_NOT_READY (-3) + * - #ERR_REFUSED (-5) + */ +- (int)joinChannelByToken:(NSString * _Nullable)token + channelId:(NSString * _Nonnull)channelId + userAccount:(NSString * _Nonnull)userAccount + mediaOptions:(AgoraRtcChannelMediaOptions * _Nonnull)mediaOptions + joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannel(byToken:channelId:userAccount:mediaOptions:joinSuccess:)); + +/** Gets the user information by passing in the user account. + + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (`AgoraUserInfo`), and triggers the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback on the local client. + + * After receiving the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback, you can call this method to get the user ID of the remote user from the `userInfo` object by passing in the user account. + + * @param userAccount The user account of the user. Ensure that you set this parameter. + * @param error The pointer to [AgoraErrorCode](AgoraErrorCode). It can be set as nil. + * @return An [AgoraUserInfo](AgoraUserInfo) object that contains the user account and user ID of the user. + */ +- (AgoraUserInfo* _Nullable)getUserInfoByUserAccount:(NSString* _Nonnull)userAccount withError:(AgoraErrorCode* _Nullable)error NS_SWIFT_NAME(getUserInfo(byUserAccount:withError:)); + +/** Gets the user information by passing in the user ID. + + * After a user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (`AgoraUserInfo`), and triggers the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback on the local client. + + * After receiving the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback, you can call this method to get the user account of the user from the `userInfo` object by passing in the user ID. + + * @param uid The user ID of the user. Ensure that you set this parameter. + * @param error The pointer to [AgoraErrorCode](AgoraErrorCode). It can be set as nil. + * @return An [AgoraUserInfo](AgoraUserInfo) object that contains the user account and user ID of the user. + */ +- (AgoraUserInfo* _Nullable)getUserInfoByUid:(NSUInteger)uid withError:(AgoraErrorCode* _Nullable)error NS_SWIFT_NAME(getUserInfo(byUid:withError:)); + +#pragma mark Custom Audio PCM Frame + +/** + * @brief register & unregister the player audio observer + * + * @param delegate observer object, pass nil to unregister + * @return int <= 0 On behalf of an error, the value corresponds to one of PLAYER_ERROR + */ +- (BOOL)setAudioFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setAudioFrameDelegate(_:)); + +#pragma mark Custom Video Frame + +/** + * Registers & unregister video frame observer object. + * + * @note + * - Ensure that you call this method before joining the channel. + * + * @param delegate An object to the video frame observer: id. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (BOOL)setVideoFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setVideoFrameDelegate(_:)); + +#pragma mark Encoded Video Frame + +/** + * Obtain H264 video data before decoding. + * + * @note + * - Ensure that you call this method before joining the channel. + * + * @param delegate An object to the video frame observer: id. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (BOOL)setEncodedVideoFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setEncodedVideoFrameDelegate(_:)); + +#pragma mark Custom Media Metadata + +/**----------------------------------------------------------------------------- + * @name Media Metadata + * ----------------------------------------------------------------------------- + */ + +/** Sets the data source of the metadata. + + You need to implement the \ref AgoraMediaMetadataDataSource protocol and specify the type of metadata in this method. + + Use this method with the \ref AgoraRtcEngineKit.setMediaMetadataDelegate:withType: setMediaMetadataDelegate method to add synchronized metadata in the video stream. You can create more diversified live interactive streaming interactions, such as sending shopping links, digital coupons, and online quizzes. + + **Note** + + - Call this method before the `joinChannelByToken` method. + - This method applies to the live interactive streaming channel profile only. + + @param metadataDataSource The AgoraMediaMetadataDataSource protocol. + @param type The metadata type. See \ref AgoraMetadataType. Currently, the SDK supports video metadata only. + @return + - YES: Success. + - NO: Failure. + */ +- (BOOL)setMediaMetadataDataSource:(id _Nullable)metadataDataSource withType:(AgoraMetadataType)type NS_SWIFT_NAME(setMediaMetadataDataSource(_:with:)); + +/** Sets the delegate of the metadata. + + You need to implement the AgoraMediaMetadataDelegate protocol and specify the type of metadata in this method. + + **Note** + + - Call this method before the `joinChannelByToken` method. + - This method applies to the live interactive streaming channel profile only. + + @param metadataDelegate The AgoraMediaMetadataDelegate protocol. + @param type The metadata type. See \ref AgoraMetadataType. Currently, the SDK supports video metadata only. + @return + - YES: Success. + - NO: Failure. + */ +- (BOOL)setMediaMetadataDelegate:(id _Nullable)metadataDelegate withType:(AgoraMetadataType)type NS_SWIFT_NAME(setMediaMetadataDelegate(_:with:)); + +#pragma mark Miscellaneous Methods + +/**----------------------------------------------------------------------------- + * @name Miscellaneous Methods + * ----------------------------------------------------------------------------- + */ + +/** + * Gets the Agora SDK version. + * + * @return The version of the current SDK in the string format. + */ ++ (NSString * _Nonnull)getSdkVersion NS_SWIFT_NAME(getSdkVersion()); + +/** + * Gets the warning or error description. + * @param error The warning or error code. + * @return The detailed warning or error description. + */ ++ (NSString* _Nonnull)getErrorDescription:(NSInteger)error NS_SWIFT_NAME(getErrorDescription(_:)); + + +/** Returns the native handler of the SDK Engine. + + This interface is used to get native the C++ handler of the SDK engine that can be used in special scenarios, such as register the audio and video frame observer. + */ +- (void * _Nullable)getNativeHandle NS_SWIFT_NAME(getNativeHandle()); + + +/** + * Specifies an SDK output log file. + * + * The log file records all log data for the SDK’s operation. Ensure that the + * directory for the log file exists and is writable. + * + * @note + * - The default log file location is as follows: + * - iOS: `App Sandbox/Library/caches/agorasdk.log` + * - macOS + * - Sandbox enabled: `App Sandbox/Library/Logs/agorasdk.log`, for + * example `/Users//Library/Containers//Data/Library/Logs/agorasdk.log`. + * - Sandbox disabled: `~/Library/Logs/agorasdk.log`. + * - Ensure that you call this method immediately after calling the + * \ref sharedEngineWithAppId:delegate: sharedEngineWithAppId method, + * otherwise the output log might not be complete. + * @param filePath Absolute path of the log file. The string of the log file is + * in UTF-8 code. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setLogFile:(NSString * _Nonnull)filePath NS_SWIFT_NAME(setLogFile(_:)); + +/** Sets the output log filter level of the SDK. + +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 filter level to `Warning`, you see the logs within levels `Critical`, `Error`, and `Warning`. + + @see \ref AgoraRtcEngineKit.setLogFile: setLogFile + + @param filter Log filter level: \ref AgoraLogFilter. + + @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLogFilter:(NSUInteger)filter NS_SWIFT_NAME(setLogFilter(_:)); + +/** + * Sets the log file size (KB). + * + * The SDK has two log files, each with a default size of 512 KB. If you set + * `fileSizeInBytes` as 1024 KB, the SDK outputs log files with a total + * maximum size of 2 MB. + * If the total size of the log files exceed the set value, + * the new output log files overwrite the old output log files. + * + * @param fileSizeInKBytes The SDK log file size (KB). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLogFileSize:(NSUInteger)fileSizeInKBytes NS_SWIFT_NAME(setLogFileSize(_:)); + +/** Upload current log file immediately to server. + * only use this when an error occurs + * block before log file upload success or timeout. + * + * @return + * requestID the id of this upload. + */ +- (NSString * _Nullable)uploadLogFile NS_SWIFT_NAME(uploadLogFile()); + +/** * Write the log to SDK . @technical preview + + You can Write the log to SDK log files of the specified level + + @param level Log level: \ref AgoraLogLevel. + + @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)writeLog:(AgoraLogLevel)level content:(NSString * _Nonnull)content NS_SWIFT_NAME(writeLog(_:content:)); + +/** + * Gets the current call ID. + * + * When a user joins a channel, a call ID is generated to identify the call. + * + * After a call ends, you can call `rate` or `complain` to gather feedback from + * your customer. + * + * @return The call ID if the method call is successful. + */ +- (NSString * _Nullable)getCallId NS_SWIFT_NAME(getCallId()); + +/** + * Allows a user to rate the call. + * + * It is usually called after the call ends. + * + * @param callId The call ID retrieved from the \ref getCallId method. + * @param rating The rating of the call between 1 (the lowest score) to 5 (the + * highest score). If you set a value out of this range, the + * #AgoraErrorCodeInvalidArgument(-2) error occurs. + * @param description (Optional) The description of the rating. The string + * length must be less than 800 bytes. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: #AgoraErrorCodeInvalidArgument. The passed argument is invalid. For + * example, `callId` is invalid. + * - -3: #AgoraErrorCodeNotReady. The SDK status is incorrect. For example, + * initialization fails. + */ +- (int)rate:(NSString * _Nonnull)callId + rating:(NSInteger)rating +description:(NSString * _Nullable)description NS_SWIFT_NAME(rate(_:rating:description:)); + +/** + * Allows a user to complain about the call quality. + * + * This method is usually called after the call ends. + * + * @param callId The call ID retrieved from the \ref getCallId method. + * @param description (Optional) The description of the complaint. The string + * length must be less than 800 bytes. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: #AgoraErrorCodeInvalidArgument. The passed argument is invalid. For + * example, `callId` is invalid. + * - -3: #AgoraErrorCodeNotReady. The SDK status is incorrect. For example, + * initialization fails. + */ +- (int)complain:(NSString * _Nonnull)callId + description:(NSString * _Nullable)description NS_SWIFT_NAME(complain(_:description:)); + + +/** Enables/Disables dispatching the delegate to the main queue. + + If disabled, the application should dispatch the UI operating to the main queue. + + @param enabled * YES: Dispatch the delegate method to the main queue. + * NO: Do not dispatch the delegate methods to the main queue + + @return * 0: Success. +* <0: Failure. + */ +- (int)enableMainQueueDispatch:(BOOL)enabled NS_SWIFT_NAME(enableMainQueueDispatch(_:)); + + +/** + * Starts the last-mile network probe test. + * + * Starts the last-mile network probe test before joining a channel to get the uplink and downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT). + * + * Call this method to check the uplink network quality before users join a channel or before an audience switches to a host. + * + * Once this method is enabled, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:lastmileProbeTestResult: lastmileProbeTestResult callback + * within 30 seconds depending on the network conditions. This callback reports the real-time statistics of the network conditions. + * + * @note + * - Do not call other methods before receiving the `lastmileProbeTestResult` callback. Otherwise, the callback may be interrupted. + * - This method consumes extra network traffic and may affect communication quality. + * + * @param config The configurations for the last-mile network probe test. See \ref AgoraLastmileProbeConfig. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startLastmileProbeTest:(AgoraLastmileProbeConfig *_Nullable)config NS_SWIFT_NAME(startLastmileProbeTest(_:)); + +/** + * Stops the last-mile network probe test. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopLastmileProbeTest NS_SWIFT_NAME(stopLastmileProbeTest()); + +/** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + + @note The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way. Contact support@agora.io for more information. + + @param options SDK options in JSON format. + */ +- (int)setParameters:(NSString * _Nonnull)options NS_SWIFT_NAME(setParameters(_:)); + +/** Gets the Agora SDK's parameters for customization purposes. + + @note This method is not public. Contact support@agora.io for more information. + + */ +- (NSString * _Nullable)getParameter:(NSString * _Nonnull)parameter + args:(NSString * _Nullable)args NS_SWIFT_NAME(getParameter(_:args:)); + + +/** + * Return current NTP(unix timestamp) time in milliseconds. + */ +- (uint64_t)getNtpWallTimeInMs; + +#pragma mark MediaPlayer +/**----------------------------------------------------------------------------- + * @name MediaPlayer publish + * ----------------------------------------------------------------------------- + */ +/** + * create MediaPlayer + * @param delegate An object to the mediaPlayer observer: id. + * @return id + */ +- (id_Nullable)createMediaPlayerWithDelegate:(id_Nullable)delegate NS_SWIFT_NAME(createMediaPlayer(with:)); +/** + * create MediaPlayer cache manager + * @return id + */ +- (id _Nullable)createMediaPlayerCacheManager NS_SWIFT_NAME(createMediaPlayerCacheManager()); + +/** + * Destroy a media player source instance. + * If a media player source instance is destroyed, the video and audio of it cannot + * be published. + * + * @param mediaPlayer id + * + * @return + * - >0: The id of media player source instance. + * - < 0: Failure. + */ +- (int)destroyMediaPlayer:(id_Nullable)mediaPlayer NS_SWIFT_NAME(destroyMediaPlayer(_:)); + +/** + * getMediaPlayer + * @param mediaPlayerId of the mediaPlayer. + * @return id + */ +- (id _Nullable)getMediaPlayer:(int)mediaPlayerId NS_SWIFT_NAME(getMediaPlayer(_:)); + +#pragma mark rhythm player + +/** Enables the rhythm player. + * + * @param sound1 The absolute path or URL address (including the filename extensions) of the file for the downbeat. + * @param sound2 The absolute path or URL address (including the filename extensions) of the file for the upbeats. + * @param config The configuration of rhythm player. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startRhythmPlayer:(NSString * _Nonnull)sound1 sound2:(NSString * _Nonnull)sound2 config:(AgoraRhythmPlayerConfig * _Nullable)config NS_SWIFT_NAME(startRhythmPlayer(_:sound2:config:)); + +/** Disables the rhythm player. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopRhythmPlayer NS_SWIFT_NAME(stopRhythmPlayer()); + +/** Configures the rhythm player. + * + * @param config The configuration of rhythm player. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)configRhythmPlayer:(AgoraRhythmPlayerConfig * _Nullable)config NS_SWIFT_NAME(configRhythmPlayer(_:)); + +#pragma mark Streaming Kit + +/** Set audio parameters for direct streaming to CDN + * + * @note + * Must call this api before "startDirectCdnStreaming" + * + * @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels: + * #AUDIO_PROFILE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDirectCdnStreamingAudioConfiguration:(AgoraAudioProfile)profile NS_SWIFT_NAME(setDirectCdnStreamingAudioConfiguration(_:)); + +/** Set video parameters for direct streaming to CDN + * + * Each configuration profile corresponds to a set of video parameters, including + * the resolution, frame rate, and bitrate. + * + * @note + * Must call this api before "startDirectCdnStreaming" + * + * @param config The local video encoder configuration: VideoEncoderConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setDirectCdnStreamingVideoConfiguration:(AgoraVideoEncoderConfiguration * _Nonnull)config NS_SWIFT_NAME(setDirectCdnStreamingVideoConfiguration(_:)); + +/** Start direct cdn streaming + * + * @param delegate A pointer to the direct cdn streaming event handler: \ref agora::rtc::IDirectCdnStreamingEventHandler + * "IDirectCdnStreamingEventHandler". + * @param publishUrl The url of the cdn used to publish the stream. + * @param options The direct cdn streaming media options: AgoraDirectCdnStreamingMediaOptions. + * This API must pass an audio-related option, and temporarily cannot pass more than one. + * Video-related options may not be passed, or one, but not multiple. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startDirectCdnStreaming:(id _Nonnull)delegate + publishUrl:(NSString * _Nonnull)publishUrl + mediaOptions:(AgoraDirectCdnStreamingMediaOptions * _Nonnull)options NS_SWIFT_NAME(startDirectCdnStreaming(_:publishUrl:mediaOptions:)); + +/** Stop direct cdn streaming + * + * @note + * This method is temporarily not supported. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopDirectCdnStreaming NS_SWIFT_NAME(stopDirectCdnStreaming()); + +/** Change the media source during the pushing + * + * @note + * This method is synchronous. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateDirectCdnStreamingMediaOptions:(AgoraDirectCdnStreamingMediaOptions * _Nonnull)options NS_SWIFT_NAME(updateDirectCdnStreamingMediaOptions(_:)); + + + +#pragma mark Deprecated Methods + +/**----------------------------------------------------------------------------- + * @name Deprecated Methods + * ----------------------------------------------------------------------------- + */ + +/** The user who is talking and the speaker’s volume. + @deprecated From v1.1 + + By default it is disabled. If needed, use the [enableAudioVolumeIndication]([AgoraRtcEngineKit enableAudioVolumeIndication:smooth:]) method to configure it. + + @param audioVolumeIndicationBlock callback block, which contains the following + speakers The speakers (array). Each speaker (): + - uid: User ID of the speaker. + - volume:Volume of the speaker, between 0 (lowest volume) to 255 (highest volume). + totalVolume Total volume after audio mixing between 0 (lowest volume) to 255 (highest volume). + */ +- (void)audioVolumeIndicationBlock:(void(^ _Nullable)(NSArray * _Nonnull speakers, NSInteger totalVolume))audioVolumeIndicationBlock NS_SWIFT_NAME(audioVolumeIndicationBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The first local video frame is displayed on the screen. + @deprecated From v1.1 + + @param firstLocalVideoFrameBlock callback block, which contains the following + width Width (pixels) of the video stream. + height Height (pixels) of the video stream. + elapsed Time elapsed (ms) from a user joining the channel until this callback is triggered. + */ +- (void)firstLocalVideoFrameBlock:(void(^ _Nullable)(NSInteger width, NSInteger height, NSInteger elapsed))firstLocalVideoFrameBlock NS_SWIFT_NAME(firstLocalVideoFrameBlock(_:)) __deprecated_msg("use delegate instead."); + +/** Occurs when the first remote video frame is received and decoded. + + @deprecated This callback is deprecated. + + @param firstRemoteVideoDecodedBlock callback block, which contains the following + uid User ID of the user whose video streams are received. + width Width (pixels) of the video stream. + height Height (pixels) of the video stream. + elapsed Time elapsed (ms) from the user joining the channel until this callback is triggered. + */ +- (void)firstRemoteVideoDecodedBlock:(void(^ _Nullable)(NSUInteger uid, NSInteger width, NSInteger height, NSInteger elapsed))firstRemoteVideoDecodedBlock NS_SWIFT_NAME(firstRemoteVideoDecodedBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The first remote video frame is received and decoded. + @deprecated From v1.1 + + @param firstRemoteVideoFrameBlock callback block, which contains the following + uid User ID of the user whose video streams are received. + width Width (pixels) of the video stream. + height Height (pixels) of the video stream. + elapsed Time elapsed (ms) from the user joining the channel until this callback is triggered. + */ +- (void)firstRemoteVideoFrameBlock:(void(^ _Nullable)(NSUInteger uid, NSInteger width, NSInteger height, NSInteger elapsed))firstRemoteVideoFrameBlock NS_SWIFT_NAME(firstRemoteVideoFrameBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user has successfully joined the channel. + @deprecated From v1.1 + + If there are other users in the channel when this user joins, the SDK also reports to the application on the existing users who are already in the channel. + + @param userJoinedBlock callback block, which contains the following: + uid User ID. If the uid is specified in the `joinChannelByToken` method, it returns the specified ID; if not, it returns an ID that is automatically assigned by the Agora server. + elapsed Time elapsed (ms) from calling joinChannelByToken until this callback is triggered. + */ +- (void)userJoinedBlock:(void(^ _Nullable)(NSUInteger uid, NSInteger elapsed))userJoinedBlock NS_SWIFT_NAME(userJoinedBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user has left the call or gone offline. + @deprecated From v1.1 + + The SDK reads the timeout data to determine if a user has left the channel (or has gone offline). If no data package is received from the user in 15 seconds, the SDK assumes the user is offline. Sometimes a weak network connection may lead to false detections; therefore, Agora recommends using signaling for reliable offline detection. + + @param userOfflineBlock callback block, which contains the following: + uid User ID. + */ +- (void)userOfflineBlock:(void(^ _Nullable)(NSUInteger uid))userOfflineBlock NS_SWIFT_NAME(userOfflineBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user's audio stream has muted/unmuted. + @deprecated From v1.1 + + @param userMuteAudioBlock callback block, which contains the following: + uid User ID. + muted + - YES: Muted. + - NO: Unmuted. +*/ +- (void)userMuteAudioBlock:(void(^ _Nullable)(NSUInteger uid, BOOL muted))userMuteAudioBlock NS_SWIFT_NAME(userMuteAudioBlock(_:)) __deprecated_msg("use delegate instead."); + +/** Occurs when a remote user pauses or resumes sending the video stream. + + @deprecated This callback is deprecated. Use [remoteVideoStateChangedOfUid](remoteVideoStateChangedOfUid:state:reason:elapsed:) + instead. + + @note This callback is invalid when the number of users or broadacasters in a + channel exceeds 20. + + @param userMuteVideoBlock callback block, which contains the following: + userId ID of the remote user. + muted + - YES: The remote user has paused sending the video stream. + - NO: The remote user has resumed sending the video stream. + */ +- (void)userMuteVideoBlock:(void(^ _Nullable)(NSUInteger uid, BOOL muted))userMuteVideoBlock NS_SWIFT_NAME(userMuteVideoBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The SDK updates the application about the statistics of the uploading local video streams once every two seconds. + @deprecated From v1.1 + + @param localVideoStatBlock callback block, which contains the following: + sentBytes Total bytes sent since last count. + sentFrames Total frames sent since last count. + */ +- (void)localVideoStatBlock:(void(^ _Nullable)(NSInteger sentBitrate, NSInteger sentFrameRate))localVideoStatBlock NS_SWIFT_NAME(localVideoStatBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The SDK updates the application about the statistics of receiving remote video streams once every two seconds. + @deprecated From v1.1 + + @param remoteVideoStatBlock callback block, which contains the following: + uid User ID that specifies whose video streams are received. + rameCount Total frames received since last count. + delay Time delay (ms) + receivedBytes Total bytes received since last count. + */ +- (void)remoteVideoStatBlock:(void(^ _Nullable)(NSUInteger uid, NSInteger delay, NSInteger receivedBitrate, NSInteger receivedFrameRate))remoteVideoStatBlock NS_SWIFT_NAME(remoteVideoStatBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The camera is turned on and ready to capture the video. + @deprecated From v1.1 + */ +- (void)cameraReadyBlock:(void(^ _Nullable)(void))cameraReadyBlock NS_SWIFT_NAME(cameraReadyBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The SDK has lost network connection with the server. + @deprecated From v1.1 + */ +- (void)connectionLostBlock:(void(^ _Nullable)(void))connectionLostBlock NS_SWIFT_NAME(connectionLostBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user has rejoined the channel with the reported channel ID and user ID. + @deprecated From v1.1 + + When the local machine loses connection with the server because of network problems, the SDK automatically attempts to reconnect, and then triggers this callback method upon reconnection. + + @param rejoinChannelSuccessBlock callback block, which contains the following: + channel Channel name. + uid User ID. + elapsed Time delay (ns) in rejoining the channel. + */ +- (void)rejoinChannelSuccessBlock:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))rejoinChannelSuccessBlock NS_SWIFT_NAME(rejoinChannelSuccessBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The RtcEngine runtime statistics reported once every two seconds. + @deprecated From v1.1 + + @param rtcStatsBlock callback block, which contains the following: + stat AgoraChannelStats + */ +- (void)rtcStatsBlock:(void(^ _Nullable)(AgoraChannelStats * _Nonnull stat))rtcStatsBlock NS_SWIFT_NAME(rtcStatsBlock(_:)) __deprecated_msg("use delegate instead."); + +/** A user has left the channel. + @deprecated From v1.1 + + This callback also provides call session statistics, including the duration of the call and the transmitting and receiving bytes. + + @param leaveChannelBlock callback block, which contains the following: + stat AgoraChannelStats + */ +- (void)leaveChannelBlock:(void(^ _Nullable)(AgoraChannelStats * _Nonnull stat))leaveChannelBlock NS_SWIFT_NAME(leaveChannelBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The audio quality of the current call reported once every two seconds. + @deprecated From v1.1 + + @param audioQualityBlock callback block, which contains the following: + uid User ID of the speaker + quality AgoraNetworkQuality + delay Time delay (ms) + lost The packet loss rate (%) + */ +- (void)audioQualityBlock:(void(^ _Nullable)(NSUInteger uid, AgoraNetworkQuality quality, NSUInteger delay, NSUInteger lost))audioQualityBlock NS_SWIFT_NAME(audioQualityBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The network quality of the specified user in a communication or live broadcast channel reported once every two seconds. + @deprecated From v1.1 + + @param networkQualityBlock callback block, which contains the following: + uid User ID. The network quality of the user with this UID will be reported. If uid is 0, the local network quality is reported. + txQuality The transmission quality of the user: AgoraNetworkQuality + rxQuality The receiving quality of the user: AgoraNetworkQuality + */ +- (void)networkQualityBlock:(void(^ _Nullable)(NSUInteger uid, AgoraNetworkQuality txQuality, AgoraNetworkQuality rxQuality))networkQualityBlock NS_SWIFT_NAME(networkQualityBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The network quality of the local user reported once after you have called [startLastmileProbeTest]([AgoraRtcEngineKit startLastmileProbeTest]). + @deprecated From v1.1 + + @param lastmileQualityBlock callback block, which contains the following: + quality Quality of the last mile network: AgoraNetworkQuality + */ +- (void)lastmileQualityBlock:(void(^ _Nullable)(AgoraNetworkQuality quality))lastmileQualityBlock NS_SWIFT_NAME(lastmileQualityBlock(_:)) __deprecated_msg("use delegate instead."); + +/** The media engine event. + @deprecated From v1.1. + */ +- (void)mediaEngineEventBlock:(void(^ _Nullable)(NSInteger code))mediaEngineEventBlock NS_SWIFT_NAME(mediaEngineEventBlock(_:)) __deprecated_msg("use delegate instead."); + +/** Disables the audio function in the channel. + + Replaced with the disableAudio method from v2.3. + + @deprecated Replaced with the disableAudio method from v2.3. + + @return * 0: Success. +* <0: Failure. + */ +- (int)pauseAudio __deprecated_msg("use disableAudio instead."); + +/** Enables the audio function in the channel. + + Replaced with the enableAudio method from v2.3. + + @deprecated Replaced with the enableAudio method from v2.3. + + @return * 0: Success. +* <0: Failure. + */ +- (int)resumeAudio __deprecated_msg("use enableAudio instead."); + +/** Initializes the The AgoraRtcEngineKit object. + + Replaced with [sharedEngineWithAppId]([AgoraRtcEngineKit sharedEngineWithAppId:delegate:]). + + @deprecated Replaced with sharedEngineWithAppId. + */ ++ (instancetype _Nonnull)sharedEngineWithAppId:(NSString * _Nonnull)AppId + error:(void(^ _Nullable)(AgoraErrorCode errorCode))errorBlock NS_SWIFT_NAME(sharedEngine(withAppId:error:)) __deprecated_msg("use sharedEngineWithAppId:delegate: instead."); + +/** Sets the high-quality audio parameters. + @deprecated + + Replaced with [setAudioProfile](setAudioProfile:scenario:). + */ +- (int)setHighQualityAudioParametersWithFullband:(BOOL)fullband + stereo:(BOOL)stereo + fullBitrate:(BOOL)fullBitrate NS_SWIFT_NAME(setHighQualityAudioParametersWithFullband(_:stereo:fullBitrate:)) __deprecated_msg("use setAudioProfile:scenario: instead."); + +/** Sets the video encoding profile. + @deprecated From v2.3 + + Each profile includes a set of parameters, such as the resolution, frame rate, and bitrate. When the camera does not support the specified resolution, the SDK chooses a suitable camera resolution, while the encoder resolution is the one specified by [setVideoProfile](setVideoProfile:swapWidthAndHeight:). + + @note * Always set the video profile after calling the enableVideo method. + * Always set the video profile before calling the `joinChannelByToken` or startPreview method. + + @param profile Enumeration definition about the video resolution, fps, and maximum kbit/s. See AgoraVideoProfile. + @param swapWidthAndHeight The width and height of the output video is consistent with that of the video profile you set. This parameter sets whether to swap the width and height of the stream: + + * YES: Swap the width and height. After that the video will be in the portrait mode, that is, width < height. + * NO: (Default) Do not swap the width and height, and the video remains in the landscape mode, that is, width > height. + + @return * 0: Success. +* <0: Failure. + */ +- (int)setVideoProfile:(AgoraVideoProfile)profile + swapWidthAndHeight:(BOOL)swapWidthAndHeight NS_SWIFT_NAME(setVideoProfile(_:swapWidthAndHeight:)) __deprecated_msg("use setVideoEncoderConfiguration: instead."); + +/** Sets the video encoding profile manually. + @deprecated From v2.3 + + @param size Size of the video that you want to set. The highest value is 1280 x 720. + @param frameRate Frame rate of the video that you want to set. The highest value is 30. You can set it to 5, 10, 15, 24, 30, and so on. + @param bitrate Bitrate of the video that you want to set. You need to manually work out the frame rate according to the width, height, and frame rate. With the same width and height, the bitrate varies with the change of the frame rate: + + * If the frame rate is 5 fps, divide the recommended bitrate by 2. + * If the frame rate is 15 fps, use the recommended bitrate. + * If the frame rate is 30 fps, multiply the recommended bitrate by 1.5. + * Calculate your bitrate with the ratio if you choose other frame rates. + + For example, the resolution is 320 x 240 and the frame rate is 15 fps, hence, the bitrate is 200: + + * If the frame rate is 5 fps, the bitrate is 100. + * If the frame rate is 30 fps, the bitrate is 300. + * If the bitrate you set is beyond the proper range, the SDK will automatically adjust it to a value within the range. + */ +- (int)setVideoResolution:(CGSize)size andFrameRate:(NSInteger)frameRate bitrate:(NSInteger)bitrate NS_SWIFT_NAME(setVideoResolution(_:andFrameRate:bitrate:)) __deprecated_msg("use setVideoEncoderConfiguration: instead."); + +/** + * Sets the audio parameters and application scenarios. + * @deprecated This method is deprecated. You can use the + * \ref AgoraRtcEngineKit.setAudioProfile: setAudioProfile + * method instead. + * + * @note + * - Call this method before calling `joinChannelByToken`. + * - In scenarios requiring high-quality audio, we recommend setting `profile` + * as `AgoraAudioProfileMusicHighQuality`(4) and `scenario` as + * `AgoraAudioScenarioGameStreaming`(3). + * @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels. See #AgoraAudioProfile. + * @param scenario Sets the audio application scenarios. See #AgoraAudioScenario. + * + * @return + * - 0: Success. + * - <0: Failure. + */ +- (int)setAudioProfile:(AgoraAudioProfile)profile scenario:(AgoraAudioScenario)scenario NS_SWIFT_NAME(setAudioProfile(_:scenario:)) __deprecated; + +/** Gets the device type; such as a recording, playback, or video capture device. + + @note This method applies to macOS only, not to iOS. + + @param type AgoraMediaDeviceType + @return When called successfully, it returns the device ID of the device. Otherwise, it returns nil. + */ +- (NSString * _Nullable)getDeviceId:(AgoraMediaDeviceType)type NS_SWIFT_NAME(getDeviceId(_:)) __deprecated_msg("use getDeviceInfo: instead."); + +/** + * Sets the external audio source. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @deprecated This method is deprecated. Use createCustomAudioTrack:(AgoraAudioTrackType)trackType config:(AgoraAudioTrackConfig* _Nonnull)config instead. + * + * @param enabled Determines whether to enable the external audio source: + * - true: Enable the external audio source. + * - false: (default) Disable the external audio source. + * @param sampleRate The Sample rate (Hz) of the external audio source, which can set be as + * 8000, 16000, 32000, 44100, or 48000. + * @param channels The number of channels of the external audio source, which can be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExternalAudioSource:(BOOL)enabled + sampleRate:(NSInteger)sampleRate + channels:(NSInteger)channels NS_SWIFT_NAME(setExternalAudioSource(_:sampleRate:channels:)) __deprecated_msg("use createCustomAudioTrack:config: instead."); + +- (int)enableEchoCancellationExternal:(BOOL)enabled + audioSourceDelay:(NSInteger)audioSourceDelay NS_SWIFT_NAME(enableEchoCancellationExternal(_:audioSourceDelay:)); + +/** + * Sets the external audio source. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @deprecated This method is deprecated. Use createCustomAudioTrack:(AgoraAudioTrackType)trackType config:(AgoraAudioTrackConfig* _Nonnull)config instead. + * + * @param enabled Determines whether to enable the external audio source: + * - true: Enable the external audio source. + * - false: (default) Disable the external audio source. + * @param sampleRate The Sample rate (Hz) of the external audio source, which can set be as + * 8000, 16000, 32000, 44100, or 48000. + * @param channels The number of channels of the external audio source, which can be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param localPlayback Enable/Disables the local playback of external audio track: + * - true: Enable local playback + * - false: (Default) Do not enable local playback + * @param publish Determines whether to publish the external audio track: + * - true: (Default) Publish the external audio track. + * - false: Don`t publish the external audio track. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExternalAudioSource:(BOOL)enabled + sampleRate:(NSInteger)sampleRate + channels:(NSInteger)channels + localPlayback:(BOOL)localPlayback + publish:(BOOL)publish NS_SWIFT_NAME(setExternalAudioSource(_:sampleRate:channels:localPlayback:publish:)) __deprecated_msg("use createCustomAudioTrack:config: instead."); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +/** Sets the speakerphone volume. + + @note This method applies to macOS only, not to iOS. + + @param volume 0 (lowest volume) to 255 (highest volume). + + @return * 0: Success. +* <0: Failure. + */ +- (int)setSpeakerphoneVolume:(NSUInteger)volume NS_SWIFT_NAME(setSpeakerphoneVolume(_:)) __deprecated_msg("use setDeviceVolume:volume: instead."); + +- (int)startScreenCapture:(NSUInteger)windowId + withCaptureFreq:(NSInteger)captureFreq + bitRate:(NSInteger)bitRate + andRect:(CGRect)rect NS_SWIFT_NAME(startScreenCapture(_:withCaptureFreq:bitRate:andRect:)) __deprecated_msg("use startScreenCaptureByWindowId:regionRect:captureParams: instead."); +#endif + +/** Returns the Media Engine version. + @deprecated From v2.3 + + @return string, Media engine version + */ ++ (NSString * _Nonnull)getMediaEngineVersion __deprecated NS_SWIFT_NAME(getMediaEngineVersion()); + +/** set advanced audio options. use this method before join channel / enableAudio / enableLocalAudio. + @param options The AgoraAdvancedAudioOptions class, See the definition of AgoraAdvancedAudioOptions for details. + + @return + - 0: Success + - < 0: Failure + */ +- (int)setAdvancedAudioOptions:(AgoraAdvancedAudioOptions * _Nonnull)options NS_SWIFT_NAME(setAdvancedAudioOptions(_:)); + +- (BOOL)isSecure NS_SWIFT_NAME(isSecure()); + + +/** Agora supports reporting and analyzing customized messages. + * + * This function is in the beta stage with a free trial. The ability provided + * in its beta test version is reporting a maximum of 10 message pieces within + * 6 seconds, with each message piece not exceeding 256 bytes. + * + * To try out this function, contact [support@agora.io](mailto:support@agora.io) + * and discuss the format of customized messages with us. + */ +- (int)sendCustomReportMessage:(NSString * _Nullable)messageId + category:(NSString * _Nullable)category + event:(NSString * _Nullable)event + label:(NSString * _Nullable)label + value:(NSInteger)value NS_SWIFT_NAME(sendCustomReportMessage(_:category:event:label:value:)); +/** + * Sets the output log level of the SDK. + * + * You can set the SDK to ouput the log files of the specified level. + * + * @param level The log level: + - `AgoraLogFilterOff (0)`: Do not output any log file. + - `AgoraLogFilterInfo (0x000f)`: (Recommended) Output log files of the Info level. + - `AgoraLogFilterWarning (0x000e)`: Output log files of the Warning level. + - `AgoraLogFilterError (0x000c)`: Output log files of the Error level. + - `AgoraLogFilterCritical (0x0008)`: Output log files of the Critical level. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLogLevel:(AgoraLogLevel)level NS_SWIFT_NAME(setLogLevel(_:)); + +/** Sets the built-in encryption mode. + @deprecated + + The Agora Native SDK supports built-in encryption. Call this API to set the encryption mode. + All users in the same channel must use the same encryption mode and password. Refer to information related to the encryption algorithm on the differences between encryption modes. + Call [setEncryptionSecret](setEncryptionSecret:) to enable the built-in encryption function before calling this API. + + @note Do not use this function together with CDN. + + @param encryptionMode Sets the encryption mode. + - "sm4-128-ecb": 128-bit SM4 encryption, ECB mode. + + @return * 0: Success. +* <0: Failure. + */ +- (int)setEncryptionMode:(NSString * _Nullable)encryptionMode NS_SWIFT_NAME(setEncryptionMode(_:)) __deprecated_msg("use enableEncryption: instead."); + +/** Enables built-in encryption. + @deprecated + + Use this method to specify an encryption password to enable built-in encryption before joining a channel. + All users in a channel must set the same encryption password. + The encryption password is automatically cleared once a user has left the channel. + If the encryption password is not specified or set to empty, the encryption function will be disabled. + + @note Do not use this function together with CDN. + + @param secret Encryption password + @return * 0: Success. +* <0: Failure. + */ +- (int)setEncryptionSecret:(NSString * _Nullable)secret NS_SWIFT_NAME(setEncryptionSecret(_:)) __deprecated_msg("use enableEncryption: instead."); + +/** Set local access point configuration for local proxy service. + Use this method before join channel. + @param config The configuration for local access point. + @return * 0: Success. + * < 0: Failure. + */ + +- (int)setLocalAccessPoint:(AgoraLocalAccessPointConfiguration* _Nonnull)config NS_SWIFT_NAME(setLocalAccessPoint(withConfig:)); + +/** Sets the Agora cloud proxy service. + + @since v3.3.0 + + When the user's firewall restricts the IP address and port, refer to + *Use Cloud Proxy* to add the specific IP addresses and ports to the firewall + allowlist; then, call this method to enable the cloud proxy and set the cloud + proxy type with the `proxyType` parameter as `AgoraUdpProxy(1)`, which is the + cloud proxy for the UDP protocol. + + After a successfully cloud proxy connection, the SDK triggers the + [connectionChangedToState(AgoraConnectionStateConnecting, AgoraConnectionChangedSettingProxyServer)]([AgoraRtcEngineDelegate rtcEngine:connectionChangedToState:reason:]) + callback. + + To disable the cloud proxy that has been set, call `setCloudProxy(AgoraNoneProxy)`. + To change the cloud proxy type that has been set, call `setCloudProxy(AgoraNoneProxy)` + first, and then call `setCloudProxy`, and pass the value that you expect in + `proxyType`. + + **Note** + + - Agora recommends that you call this method before joining the channel or + after leaving the channel. + - For the SDK v3.3.x, the services for pushing streams to CDN and co-hosting + across channels are not available when you use the cloud proxy for the UDP + protocol. For the SDK v3.4.0 and later, the services for pushing streams to + CDN and co-hosting across channels are not available when the user is in a + network environment with a firewall and uses the cloud proxy for the UDP protocol. + + @param proxyType The cloud proxy type, see AgoraCloudProxyType. This + parameter is required, and the SDK reports an error if you do not pass in a value. + + @return - 0: Success. +- < 0: Failure. + + - `-2(AgoraErrorCodeInvalidArgument)`: The parameter is invalid. + - `-7(AgoraErrorCodeNotInitialized)`: The SDK is not initialized. + */ +- (int)setCloudProxy:(AgoraCloudProxyType)proxyType NS_SWIFT_NAME(setCloudProxy(_:)); + +- (NSInteger)takeSnapshot:(NSInteger)uid filePath:(NSString* _Nonnull)filePath NS_SWIFT_NAME(takeSnapshot(_:filePath:)); + +- (int)enableContentInspect:(BOOL)enabled config:(AgoraContentInspectConfig* _Nonnull)config NS_SWIFT_NAME(enableContentInspect(_:config:)); + +/** Bind local user and a remote user as an audio&video sync group. The remote user is defined by cid and uid. + There’s a usage limit that local user must be a video stream sender. On the receiver side, media streams from same sync group will be time-synced + + @param channelId The channel id + @param uid The user ID of the remote user to be bound with (local user) + + @return + - 0: Success. + - < 0: Failure. + */ +- (int)setAVSyncSource:(NSString* _Nonnull)channelId uid:(NSUInteger)uid NS_SWIFT_NAME(setAVSyncSource(_:uid:)); + +/** + @technical preview + */ +- (int)sendAudioMetadata:(NSData * _Nonnull)metadata NS_SWIFT_NAME(sendAudioMetadata(_:)); + +/** + Enable or disable video image source to replace the current video source published or resume it + + @param enable true for enable, false for disable + @param options options for image track + */ +- (int)enableVideoImageSource:(BOOL)enable + options:(AgoraImageTrackOptions *_Nullable)options NS_SWIFT_NAME(enableVideoImageSource(_:options:)); +/** get network Type + +@return +- 0: DISCONNECTED. +- 1: LAN. +- 2: WIFI. +- 3: MOBILE_2G +- 4: MOBILE_3G +- 5: MOBILE_4G +- 6: MOBILE_5G +- -1: UNKNOWN +*/ +- (int)getNetworkType NS_SWIFT_NAME(getNetworkType()); + +/** + * Adds multiple SDK delegate. + * + * @param delegate The AgoraRtcEngineDelegate object. + */ +- (void)addDelegate:(id _Nonnull)delegate NS_SWIFT_NAME(addDelegate(_:)); + +/** + * Removes multiple SDK delegate. + * + * @param delegate The AgoraRtcEngineDelegate object. + */ +- (void)removeDelegate:(id _Nonnull)delegate NS_SWIFT_NAME(removeDelegate(_:)); + +@end + +@class AgoraMediaRecorder; +@protocol AgoraMediaRecorderDelegate +#pragma mark Media Recorder Delegate Methods +/**----------------------------------------------------------------------------- + * @name Media Recorder Delegate Methods + * ----------------------------------------------------------------------------- + */ + +/** + Occurs when media recorder state is changed. + + @param recorder AgoraMediaRecorder object. + @param state Recorder state. See AgoraMediaRecorderState. + @param error Error code. See AgoraMediaRecorderError. + */ +- (void)mediaRecorder:(AgoraMediaRecorder* _Nonnull)recorder stateDidChanged:(AgoraMediaRecorderState)state error:(AgoraMediaRecorderErrorCode)error NS_SWIFT_NAME(mediaRecorder(_:stateDidChanged:error:)); + +/** + Occurs when media recorder information is updated. + + @param recorder AgoraMediaRecorder object. + @param info Recorder information. See AgoraMediaRecorderInfo. + */ +- (void)mediaRecorder:(AgoraMediaRecorder* _Nonnull)recorder informationDidUpdated:(AgoraMediaRecorderInfo* _Nonnull)info NS_SWIFT_NAME(mediaRecorder(_:informationDidUpdated:)); + +@end + +__attribute__((visibility("default"))) @interface AgoraMediaRecorder : NSObject + +/** + Initializes the AgoraMediaRecorder object. + + @param engine AgoraRtcEngineKit object. + @param delegate AgoraMediaRecorderDelegate. + @return An object of AgoraMediaRecorder class. + */ ++ (instancetype _Nonnull)sharedMediaRecorderWithRtcEngine:(AgoraRtcEngineKit* _Nonnull)engine NS_SWIFT_NAME(sharedMediaRecorder(withRtcEngine:)); + +- (int)setMediaRecorderDelegate:(AgoraRtcConnection * _Nonnull)connection + delegate:(id _Nullable)delegate NS_SWIFT_NAME(setMediaRecorderDelegate(_:delegate:)); +/** + Destroys the RtcEngine instance and releases all resources used by the SDK. + */ ++ (void)destroy NS_SWIFT_NAME(destroy()); + +/** Enables/Disables dispatching delegate methods to the main queue. + + If disabled, the app should dispatch UI operations to the main queue. + @param enabled Sets whether or not to dispatch delegate methods to the main queue: + * YES: Dispatch delegate methods to the main queue. + * NO: Do not dispatch delegate methods to the main queue + @return * 0: Success. + * < 0: Failure. + */ +- (int)enableMainQueueDispatch:(BOOL)enabled NS_SWIFT_NAME(enableMainQueueDispatch(_:)); + +/** + Start recording. + @param config AgoraMediaRecorderConfiguration object. + @return 0: Success. + * < 0: Failure. + */ +- (int)startRecording:(AgoraRtcConnection * _Nonnull)connection + config:(AgoraMediaRecorderConfiguration* _Nonnull)config NS_SWIFT_NAME(startRecording(_:config:)); + + +/** + Stop recording. + @return 0: Success. + * < 0: Failure. + */ +- (int)stopRecording:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(stopRecording(_:)); + +@end + + diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineKitEx.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineKitEx.h new file mode 100644 index 0000000..1162d88 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcEngineKitEx.h @@ -0,0 +1,940 @@ +// +// AgoraRtcEngineKitEx.h +// AgoraRtcEngineKit +// +// Copyright (c) 2020 Agora. All rights reserved. +// Created by LLF on 2020/3/9. +// + +#import "AgoraRtcEngineKit.h" +#import "AgoraObjects.h" + +#if TARGET_OS_IPHONE +#import +#elif TARGET_OS_MAC +#import +#endif + +NS_ASSUME_NONNULL_BEGIN +@interface AgoraRtcEngineKit(Ex) + +/** + * Joins a channel. + * + * You can call this method multiple times to join multiple channels. + * + * @param token The token for authentication. + * - In situations not requiring high security: You can use the temporary token + * generated at Console. For details, see [Get a temporary token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-temporary-token). + * - In situations requiring high security: Set it as the token generated at + * you server. For details, see [Generate a token](https://docs.agora.io/en/Agora%20Platform/token?platform=All%20Platforms#get-a-token). + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @param delegate AgoraRtcEngineDelegate protocol.(Need a new object when called) + * @param mediaOptions AgoraRtcChannelMediaOptions Object. + * @param joinSuccessBlock Same as \ref AgoraRtcEngineDelegate.rtcEngine:didJoinChannel:withUid:elapsed: didJoinChannel. We recommend you set this parameter as `nil` to use `didJoinChannel`. + * - If `joinSuccessBlock` is nil, the SDK triggers the `didJoinChannel` callback. + * - If you implement both `joinSuccessBlock` and `didJoinChannel`, `joinSuccessBlock` takes higher priority than `didJoinChannel`. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)joinChannelExByToken:(NSString* _Nullable)token + connection:(AgoraRtcConnection * _Nonnull)connection + delegate:(id _Nullable)delegate + mediaOptions:(AgoraRtcChannelMediaOptions* _Nonnull)mediaOptions + joinSuccess:(void(^ _Nullable)(NSString* _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannelEx(byToken:connection:delegate:mediaOptions:joinSuccess:)); + +/** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param delegate AgoraRtcEngineDelegate protocol. + * @param mediaOptions The channel media options: \ref agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions" + * + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (-2) + * - #ERR_NOT_READY (-3) + * - #ERR_REFUSED (-5) + */ +- (int)joinChannelExByToken:(NSString* _Nullable)token + channelId:(NSString* _Nonnull)channelId + userAccount:(NSString* _Nonnull)userAccount + delegate:(id _Nullable)delegate + mediaOptions:(AgoraRtcChannelMediaOptions* _Nonnull)mediaOptions + joinSuccess:(void(^ _Nullable)(NSString* _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock NS_SWIFT_NAME(joinChannelEx(byToken:channelId:userAccount:delegate:mediaOptions:joinSuccess:)); + +/** + * Updates the channel media options after joining the channel. + * + * @param mediaOptions The channel media options: ChannelMediaOptions. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateChannelExWithMediaOptions:(AgoraRtcChannelMediaOptions* _Nonnull)mediaOptions + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateChannelEx(with:connection:)); + +/** + * Leaves the channel by connection. + * + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @param leaveChannelBlock This callback indicates that a user leaves a channel, and provides the statistics of the call in #AgoraChannelStats. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)leaveChannelEx:(AgoraRtcConnection * _Nonnull)connection + leaveChannelBlock:(void(^ _Nullable)(AgoraChannelStats* _Nonnull stat))leaveChannelBlock NS_SWIFT_NAME(leaveChannelEx(_:leaveChannelBlock:)); + +/** + * Resets the SDK delegate. + * + * The SDK uses the delegate to inform the app on engine runtime events. All methods defined in the + * delegate are optional implementation methods. + * + * @param delegate The AgoraRtcEngineDelegate protocol. + * @param connection The AgoraRtcConnection object. + */ +- (int)setDelegateEx:(id _Nullable)delegate connection:(AgoraRtcConnection * _Nonnull)connection; + +/** + *Stops or resumes sending the local audio stream with connection. + * + *@param mute Determines whether to send or stop sending the local audio stream: + *- `YES`: Stop sending the local audio stream. + *- `NO`: Send the local audio stream. + * + *@param connection \ref AgoraRtcConnection by channelId and uid combine + * + *@return + *- 0: Success. + *- < 0: Failure. + */ +- (int)muteLocalAudioStreamEx:(BOOL)mute connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteLocalAudioStreamEx(_:connection:)); +/** + *Stops or resumes sending the local video stream with connection. + * + *@param mute Determines whether to send or stop sending the local video stream: + *- `YES`: Stop sending the local video stream. + *- `NO`: Send the local video stream. + * + *@param connection \ref AgoraRtcConnection by channelId and uid combine + * + *@return + *- 0: Success. + *- < 0: Failure. + */ +- (int)muteLocalVideoStreamEx:(BOOL)mute connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteLocalVideoStreamEx(_:connection:)); + +/** + * Leaves the channel by connection. + * + * @param connection {@link AgoraRtcConnection} by channelId and uid combine + * @param options The options for leaving the channel. See {@link LeaveChannelOptions}. + * @param leaveChannelBlock This callback indicates that a user leaves a channel, and provides the statistics of the call in #AgoraChannelStats. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)leaveChannelEx:(AgoraRtcConnection * _Nonnull)connection + options:(AgoraLeaveChannelOptions * _Nonnull)options + leaveChannelBlock:(void(^ _Nullable)(AgoraChannelStats* _Nonnull stat))leaveChannelBlock; + +/** Mutes a specified remote user's audio stream. + + @note When setting to YES, this method stops playing audio streams without affecting the audio stream receiving process. + + @param uid User ID whose audio streams the user intends to mute. + @param mute * YES: Stops playing a specified user’s audio streams. + * NO: Resumes playing a specified user’s audio streams. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. +* <0: Failure. + */ +- (int)muteRemoteAudioStreamEx:(NSUInteger)uid + mute:(BOOL)mute + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteRemoteAudioStreamEx(_:mute:connection:)); + +/** + *Stops or resumes receiving all remote audio stream with connection. + * + *@param mute Whether to stop receiving remote audio streams: + *- `YES`: Stop receiving any remote audio stream. + *- `NO`: Resume receiving all remote audio streams. + * + *@param connection \ref AgoraRtcConnection by channelId and uid combine + * + *@return + *- 0: Success. + *- < 0: Failure. + */ +- (int)muteAllRemoteAudioStreamsEx:(BOOL)mute + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteAllRemoteAudioStreamsEx(_:connection:)); + +/** + * Sets the video encoder configuration. + * + * Each configuration profile corresponds to a set of video parameters, + * including the resolution, frame rate, and bitrate. + * + * The parameters specified in this method are the maximum values under ideal network conditions. + * If the video engine cannot render the video using the specified parameters + * due to poor network conditions, the parameters further down the list are + * considered until a successful configuration is found. + * + * @param config The local video encoder configuration, see #AgoraVideoEncoderConfiguration. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setVideoEncoderConfigurationEx:(AgoraVideoEncoderConfiguration* _Nonnull)config + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setVideoEncoderConfigurationEx(_:connection:)); + +/** Binds the remote user to the video display window, that is, sets the view for the user of the specified uid. +* +* Usually, the application should specify the uid of the remote video in the method call before the user enters a channel. If the remote uid is unknown to the application, you can set the uid after receiving the \ref AgoraRtcEngineDelegate.rtcEngine:didJoinedOfUid:elapsed: didJoinedOfUid event. +* +* @param remote \ref AgoraRtcVideoCanvas +* @param connection \ref AgoraRtcConnection by channelId and uid combine +* @return +* - 0: Success. +* - <0: Failure. + */ +- (int)setupRemoteVideoEx:(AgoraRtcVideoCanvas* _Nonnull)remote + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setupRemoteVideoEx(_:connection:)); + +/** Configures the remote video display mode. The application can call this method multiple times to change the display mode. +* +* @param uid User id of the user whose video streams are received. +* @param mode AgoraVideoRenderMode +* @param mirror AgoraVideoMirrorMode +* @param connection \ref AgoraRtcConnection by channelId and uid combine +* +* @return +* - 0: Success. +* - <0: Failure. +*/ +- (int)setRemoteRenderModeEx:(NSUInteger)uid + mode:(AgoraVideoRenderMode)mode + mirror:(AgoraVideoMirrorMode)mirror + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setRemoteRenderModeEx(_:mode:mirror:connection:)); + +/** + * Stops or resumes receiving the video stream of a specified user. + * + * @note + * Once you leave the channel, the settings in this method becomes invalid. + * + * @param uid ID of the specified remote user. + * @param mute Determines whether to receive or stop receiving a specified video stream: + * - `YES`: Stop receiving the specified video stream. + * - `NO`: (Default) Receive the specified video stream. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)muteRemoteVideoStreamEx:(NSUInteger)uid + mute:(BOOL)mute + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteRemoteVideoStreamEx(_:mute:connection:)); + +/** + *Stops or resumes receiving all remote video stream with connection. + * + *@param mute Whether to stop receiving remote video streams: + *- `YES`: Stop receiving any remote video stream. + *- `NO`: Resume receiving all remote video streams. + * + *@param connection \ref AgoraRtcConnection by channelId and uid combine + * + *@return + *- 0: Success. + *- < 0: Failure. + */ +- (int)muteAllRemoteVideoStreamsEx:(BOOL)mute + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(muteAllRemoteVideoStreamsEx(_:connection:)); + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video + * stream) video using \ref setRemoteVideoStreamType setRemoteVideoStreamType. + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @param streamConfig The minor stream config + * @param connection An output parameter which is used to control different connection instances. + */ +- (int)enableDualStreamModeEx:(BOOL)enabled + streamConfig:(AgoraSimulcastStreamConfig*)streamConfig + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(enableDualStreamModeEx(_:streamConfig:connection:)); + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video + * stream) video using \ref setRemoteVideoStreamType setRemoteVideoStreamType. + * + * @param mode The dual-stream mode. + * @param streamConfig The minor stream config + * @param connection An output parameter which is used to control different connection instances. + */ +- (int)setDualStreamModeEx:(AgoraSimulcastStreamMode)mode + streamConfig:(AgoraSimulcastStreamConfig*)streamConfig + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(setDualStreamModeEx(_:streamConfig:connection:)); + + +/** + * Sets the remote video stream type. + * + * If the remote user has enabled the dual-stream mode, by default the SDK + * receives the high-stream video. Call this method to switch to the low-stream + * video. + * + * @note + * This method applies to scenarios where the remote user has enabled the + * dual-stream mode by \ref enableDualStreamMode: enableDualStreamMode + * before joining the channel. + * + * @param uid ID of the remote user sending the video stream. + * @param streamType The video stream type: #AgoraVideoStreamType. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteVideoStreamEx:(NSUInteger)uid + type:(AgoraVideoStreamType)streamType + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setRemoteVideoStreamEx(_:type:connection:)); +/** + * Sets the remote video subscription options + * + * + * @param uid ID of the remote user sending the video stream. + * @param options Sets the video subscription options. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setRemoteVideoSubscriptionOptionsEx:(NSUInteger)uid + options:(AgoraVideoSubscriptionOptions* _Nonnull)options + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(setRemoteVideoSubscriptionOptionsEx(_:options:connection:)); + +/** + * Pushes the encoded external video frame to specified connection in Agora SDK. + * + * @note + * Ensure that you have configured encoded video source before calling this method. + * + * @param data The encoded external video data, which must be the direct buffer. + * @param frameInfo The encoded external video frame info: AgoraEncodedVideoFrameInfo. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0: Success, which means that the encoded external video frame is pushed successfully. + * - < 0: Failure, which means that the encoded external video frame fails to be pushed. + */ +- (int)pushExternalEncodedVideoFrameEx:(NSData* _Nonnull)frame + info:(AgoraEncodedVideoFrameInfo * _Nonnull)info + videoTrackId:(NSUInteger)videoTrackId NS_SWIFT_NAME(pushExternalEncodedVideoFrameEx(_:info:videoTrackId:)); + +/** + * Pushes the external video frame. + * + * This method pushes the video frame using the AgoraVideoFrame class and + * passes it to the Agora SDK with the `format` parameter in AgoraVideoFormat. + * + * Call \ref setExternalVideoSource:useTexture:pushMode: setExternalVideoSource + * and set the `pushMode` parameter as `YES` before calling this method. + * @note + * In the Communication profile, this method does not support pushing textured + * video frames. + * @param frame Video frame containing the SDK's encoded video data to be + * pushed: #AgoraVideoFrame. + * @param videoTrackId The id of the video track. + * @return + * - `YES`: Success. + * - `NO`: Failure. + */ +- (BOOL)pushExternalVideoFrame:(AgoraVideoFrame * _Nonnull)frame videoTrackId:(NSUInteger)videoTrackId NS_SWIFT_NAME(pushExternalVideoFrame(_:videoTrackId:)); + +/** Gets the user information by passing in the user account. + + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them in a mapping table object (`AgoraUserInfo`), and triggers the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback on the local client. + + * After receiving the [didUpdatedUserInfo]([AgoraRtcEngineDelegate rtcEngine:didUpdatedUserInfo:withUid:]) callback, you can call this method to get the user ID of the remote user from the `userInfo` object by passing in the user account. + + * @param userAccount The user account of the user. Ensure that you set this parameter. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return An [AgoraUserInfo](AgoraUserInfo) object that contains the user account and user ID of the user. + */ +- (AgoraUserInfo* _Nullable)getUserInfoByUserAccountEx:(NSString* _Nonnull)userAccount + connection:(AgoraRtcConnection * _Nonnull)connection + withError:(AgoraErrorCode* _Nullable)error NS_SWIFT_NAME(getUserInfo(byUserAccountEx:connection:withError:)); + +/** Gets the user information by passing in the user ID. + * + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, + * caches them in a mapping table object (`userInfo`), and triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback on the local client. + * + * After receiving the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback, you can call this method to get the user account of the remote user + * from the `userInfo` object by passing in the user ID. + * + * @param uid The user ID of the remote user. Ensure that you set this parameter. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return An [AgoraUserInfo](AgoraUserInfo) object that contains the user account and user ID of the user. + */ +- (AgoraUserInfo* _Nullable)getUserInfoByUidEx:(NSUInteger)uid + connection:(AgoraRtcConnection * _Nonnull)connection + withError:(AgoraErrorCode* _Nullable)error NS_SWIFT_NAME(getUserInfo(byUidEx:connection:withError:)); + +/** + * Gets the connection state of the SDK. + * + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return The connection state. See \ref AgoraConnectionState. + */ +- (AgoraConnectionState)getConnectionStateEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(getConnectionStateEx(_:)); + +#if (!(TARGET_OS_IPHONE) && (TARGET_OS_MAC)) +/** Enables loopback sampling. (macOS only) + * If you enable loopback sampling, the output of the sound card is mixed into the audio stream sent to the other end. + * You can call this method either before or after joining a channel. + + * *Note:** + * macOS does not support loopback sampling of the default sound card. If you need to use this method, + * please use a virtual sound card and pass its name to the `deviceName` parameter. Agora has tested and recommends using soundflower. + + * @param enabled Sets whether to enable/disable loopback sampling. + * YES: Enable loopback sampling. + * NO: (Default) Disable loopback sampling. + + * @param deviceName Pointer to the device name of the sound card. The default value is nil (default sound card). + * If you use a virtual sound card like "Soundflower", set this parameter as the name of the sound card, "Soundflower", + * and the SDK will find the corresponding sound card and start capturing. + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * @return + * 0: Success. + * < 0: Failure. + */ +- (int)enableLoopbackRecordingEx:(BOOL)enabled + deviceName:(NSString* _Nullable)deviceName + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(enableLoopbackRecordingEx(_:deviceName:connection:)); +#endif + +/** + * Adjusts the recording volume. + * + * @param volume The recording volume, which ranges from 0 to 400: + * - 0 : Mute the recording volume. + * - 100: The original volume. + * - 400: (Maximum) Four times the original volume with signal clipping protection. + * + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0 : Success. + * - < 0: Failure. + */ +- (int)adjustRecordingSignalVolumeEx:(NSInteger)volume + connection:(AgoraRtcConnection* _Nonnull)connection; + +/** + * Mute or resume recording signal volume. + * + * @param mute Determines whether to mute or resume the recording signal volume. + * - YES: Mute the recording signal volume. + * - NO: (Default) Resume the recording signal volume. + * + * @param connection \ref AgoraRtcConnection by channelId and uid combine + * + * @return + * - 0 : Success. + * - < 0: Failure. + */ +- (int)muteRecordingSignalEx:(BOOL)mute + connection:(AgoraRtcConnection* _Nonnull)connection; + +/** Adjust the playback signal volume of a specified remote user. + + You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user. + + **Note** + + - The playback volume here refers to the mixed volume of a specified remote user. + - This method can only adjust the playback volume of one specified remote user at a time. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. + + @param uid The ID of the remote user. + @param volume The playback volume of the specified remote user. The value + ranges between 0 and 400, including the following: + + - 0: Mute. + - 100: (Default) Original volume. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return + - 0: Success. + - < 0: Failure. + */ + +- (int)adjustUserPlaybackSignalVolumeEx:(NSUInteger)uid + volume:(NSInteger)volume + connection:(AgoraRtcConnection* _Nonnull)connection; + +- (int)sendCustomReportMessageEx:(NSString * _Nullable)messageId + category:(NSString * _Nullable)category + event:(NSString * _Nullable)event + label:(NSString * _Nullable)label + value:(NSInteger)value + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(sendCustomReportMessageEx(_:category:event:label:value:connection:)); + +- (int)enableAudioVolumeIndicationEx:(NSInteger)interval + smooth:(NSInteger)smooth + reportVad:(BOOL)reportVad + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(enableAudioVolumeIndicationEx(_:smooth:reportVad:connection:)); + +/** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + +**Note:** + +- Ensure that you call this method after joining a channel. For this method to work, enable stereo panning for remote users by calling [enableSoundPositionIndication]([AgoraRtcEngineKit enableSoundPositionIndication:]) before joining a channel. +This method requires hardware support. +- For the best effect, we recommend using the following audio output devices: + - (iOS) A stereo headset. + - (macOS) A stereo loudspeaker. + @param uid The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + + * 0.0: (default) the remote sound comes from the front. + * -1.0: the remote sound comes from the left. + * 1.0: the remote sound comes from the right. + + @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. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. +* < 0: Failure. + */ +- (int)setRemoteVoicePositionEx:(NSUInteger)uid + pan:(double)pan + gain:(double)gain + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setRemoteVoicePositionEx(_:pan:gain:connection:)); + +/** Sets spatial audio parameters of a remote user. + + When the local user calls this method to set the spatial audio parameters of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of spatial. + +**Note:** + +- For the best effect, we recommend using the following audio output devices: + - (iOS) A stereo headset. + - (macOS) A stereo loudspeaker. + @param uid The ID of the remote user. + @param params The spatial audio parameters of the remote user. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. +* < 0: Failure. + */ +- (int)setRemoteUserSpatialAudioParamsEx:(NSUInteger)uid + params:(AgoraSpatialAudioParams* _Nonnull)params + connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(setRemoteUserSpatialAudioParamsEx(_:params:connection:)); + +/** Adds a watermark image to the local video. + + This method adds a PNG watermark image to the local video in the interactive live streaming. Once the watermark image is added, all the audience in the channel (CDN audience included), and the capturing device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one. + + The watermark position depends on the settings in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method: + + - If the orientation mode of the encoding video is AgoraVideoOutputOrientationModeFixedLandscape, or the landscape mode in AgoraVideoOutputOrientationModeAdaptative, the watermark uses the landscape orientation. + - If the orientation mode of the encoding video is AgoraVideoOutputOrientationModeFixedPortrait, or the portrait mode in AgoraVideoOutputOrientationModeAdaptative, the watermark uses the portrait orientation. + - When setting the watermark position, the region must be less than the dimensions set in the [setVideoEncoderConfiguration]([AgoraRtcEngineKit setVideoEncoderConfiguration:]) method. Otherwise, the watermark image will be cropped. + + **Note** + + - Ensure that you have called the [enableVideo]([AgoraRtcEngineKit enableVideo]) method to enable the video module before calling this method. + - If you only want to add a watermark image to the local video for the audience in the CDN live streaming channel to see and capture, you can call this method or the [setLiveTranscoding]([AgoraRtcEngineKit setLiveTranscoding:]) method. + - This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray. + - If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings. + - If you have enabled the local video preview by calling the [startPreview]([AgoraRtcEngineKit startPreview]) method, you can use the `visibleInPreview` member in the WatermarkOptions class to set whether or not the watermark is visible in preview. + - If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. + + @param url The local file path of the watermark image to be added. This method supports adding a watermark image from the local file path. If the watermark image to be added is in the project file, you need to change the image's Type from PNG image to Data in the Xcode property, otherwise, the Agora Native SDK cannot recognize the image. + @param options The options of the watermark image to be added. See WatermarkOptions. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. + * < 0: Failure. + */ +- (int)addVideoWatermarkEx:(NSURL* _Nonnull)url options:(WatermarkOptions* _Nonnull)options connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(addVideoWatermarkEx(_:options:connection:)); + +/** Clears the watermark image on the video stream. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return * 0: Success. + * < 0: Failure. + */ +- (int)clearVideoWatermarkEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(clearVideoWatermarkEx(_:)); + +/**----------------------------------------------------------------------------- + * @name Data Steam + * ----------------------------------------------------------------------------- + */ +/** Creates a data stream. +* +* Each user can create up to five data streams during the lifecycle of the `AgoraRtcEngineKit`. +* +* @note Set both the `reliable` and `ordered` parameters to `YES` or `NO`. Do not set one as `YES` and the other as `NO`. +* +* @param streamId ID of the created data stream. +* @param reliable Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds: +* - YES: The recipients receive the data stream from the sender within five seconds. If the recipient does not receive the data stream within five seconds, an error is reported to the app. +* - NO: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream. +* +* @param ordered Sets whether or not the recipients receive the data stream in the sent order: +* - YES: The recipients receive the data stream in the sent order. +* - NO: The recipients do not receive the data stream in the sent order. +* @param connection \ref AgoraRtcConnection by channelId and uid combine. +* +* @return +* - 0: Success. +* - < 0: Failure. +*/ +- (int)createDataStreamEx:(NSInteger * _Nonnull)streamId + reliable:(BOOL)reliable + ordered:(BOOL)ordered + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(createDataStreamEx(_:reliable:ordered:connection:)); +/** Creates a data stream. + + Each user can create up to five data streams during the lifecycle of the [AgoraRtcChannel](AgoraRtcChannel). + + @param streamId ID of the created data stream. + @param config the config of data stream. + @param connection \ref AgoraRtcConnection by channelId and uid combine. + @return * 0: Success. +* < 0: Failure. + */ +- (int)createDataStreamEx:(NSInteger * _Nonnull)streamId + config:(AgoraDataStreamConfig * _Nonnull)config + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(createDataStreamEx(_:config:connection:)); + +/** Sends data stream messages to all users in a channel. + +The SDK has the following restrictions on this method: + +- Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB. +- Each client can send up to 30 KB of data per second. +- Each user can have up to five data streams simultaneously. + +If the remote user receives the data stream within five seconds, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:receiveStreamMessageFromUid:streamId:data: receiveStreamMessageFromUid callback on the remote client, from which the remote user gets the stream message. + +If the remote user does not receive the data stream within five seconds, the SDK triggers the \ref AgoraRtcEngineDelegate.rtcEngine:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached: didOccurStreamMessageErrorFromUid callback on the remote client. + + @note + - This method applies only to the Communication profile or to the hosts in the live interactive streaming profile. If an audience in the live interactive streaming profile calls this method, the audience role may be changed to a host. + - Ensure that you have created the data stream using \ref createDataStream:reliable:ordered: createDataStream before calling this method. + + @param streamId ID of the sent data stream returned in the `createDataStream` method. + @param data Sent data. + @param connection \ref AgoraRtcConnection by channelId and uid combine. + + @return + - 0: Success. + - < 0: Failure. +*/ +- (int)sendStreamMessageEx:(NSInteger)streamId + data:(NSData * _Nonnull)data + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(sendStreamMessageEx(_:data:connection:)); + +/**----------------------------------------------------------------------------- + * @name Stream Publish + * ----------------------------------------------------------------------------- + */ + + /** + * Sets the blocklist of subscribe remote stream audio. + * + * @param blocklist The uid list of users who do not subscribe to audio. + * @param connection \ref AgoraRtcConnection by channelId and uid combine. + * @note + * If uid is in blocklist, the remote user's audio will not be subscribed, + * even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeAudioBlocklistEx:(NSArray *_Nonnull)blocklist connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setSubscribeAudioBlocklistEx(_:connection:)); + +/** + * Sets the allowlist of subscribe remote stream audio. + * + * @param allowlist The uid list of users who do subscribe to audio. + * @param connection \ref AgoraRtcConnection by channelId and uid combine. + * @note + * If uid is in allowlist, the remote user's audio will be subscribed, + * even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to audio. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeAudioAllowlistEx:(NSArray *_Nonnull)allowlist connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setSubscribeAudioAllowlistEx(_:connection:)); + +/** + * Sets the blocklist of subscribe remote stream video. + * + * @param blocklist The uid list of users who do not subscribe to video. + * @param connection \ref AgoraRtcConnection by channelId and uid combine. + * @note + * If uid is in blocklist, the remote user's video will not be subscribed, + * even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeVideoBlocklistEx:(NSArray *_Nonnull)blocklist connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setSubscribeVideoBlocklistEx(_:connection:)); + +/** + * Sets the allowlist of subscribe remote stream video. + * + * @param allowlist The uid list of users who do subscribe to video. + * @param connection \ref AgoraRtcConnection by channelId and uid combine. + * @note + * If uid is in whitelist, the remote user's video will be subscribed, + * even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSubscribeVideoAllowlistEx:(NSArray *_Nonnull)allowlist connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(setSubscribeVideoAllowlistEx(_:connection:)); + +- (NSInteger)takeSnapshotEx:(AgoraRtcConnection * _Nonnull)connection uid:(NSInteger)uid filePath:(NSString* _Nonnull)filePath NS_SWIFT_NAME(takeSnapshotEx(_:uid:filePath:)); + +/** + * @technical preview + */ +- (int)sendAudioMetadataEx:(AgoraRtcConnection * _Nonnull)connection metadata:(NSData * _Nonnull)metadata NS_SWIFT_NAME(sendAudioMetadataEx(_:metadata:)); + +- (int)enableContentInspectEx:(BOOL)enabled config:(AgoraContentInspectConfig* _Nonnull)config connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(enableContentInspectEx(_:config:connection:)); + +/** Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.) + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startRtmpStreamWithoutTranscodingEx:(NSString* _Nonnull)url + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(startRtmpStreamWithoutTranscodingEx(_:connection:)); + +/** Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.) + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + * @param connection AgoraRtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startRtmpStreamWithTranscodingEx:(NSString* _Nonnull)url + transcoding:(AgoraLiveTranscoding* _Nullable)transcoding + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(startRtmpStreamWithTranscodingEx(_:transcoding:connection:)); + +/** Update the video layout and audio settings for CDN live. (CDN live only.) + * @note This method applies to Live Broadcast only. + * + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + * @param connection AgoraRtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateRtmpTranscodingEx:(AgoraLiveTranscoding* _Nullable)transcoding + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateRtmpTranscodingEx(_:connection:)); + +/** Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.) + * @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopRtmpStreamEx:(NSString* _Nonnull)url + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(stopRtmpStreamEx(_:connection:)); + +/** Starts to relay media streams across channels. + * + * @param configuration The configuration of the media stream relay:AgoraChannelMediaRelayConfiguration. + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)startChannelMediaRelayEx:(AgoraChannelMediaRelayConfiguration * _Nonnull)config connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(startChannelMediaRelayEx(_:connection:)); + +/** Updates the channels for media stream relay + * @param configuration The media stream relay configuration: AgoraChannelMediaRelayConfiguration. + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)updateChannelMediaRelayEx:(AgoraChannelMediaRelayConfiguration * _Nonnull)config connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateChannelMediaRelayEx(_:connection:)); + +/** Stops the media stream relay. + * + * Once the relay stops, the host quits all the destination + * channels. + * + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)stopChannelMediaRelayEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(stopChannelMediaRelayEx(_:)); + +/** pause the channels for media stream relay. + * + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)pauseAllChannelMediaRelayEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(pauseAllChannelMediaRelayEx(_:)); + +/** resume the channels for media stream relay. + * + * @param connection AgoraRtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)resumeAllChannelMediaRelayEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(resumeAllChannelMediaRelayEx(_:)); + +/** + @brief Start tracing media rendering events. + @since v4.1.1 + @discussion + - SDK will trace media rendering events when this API is called. + - The tracing result can be obtained through callback `[AgoraRtcEngineDelegate rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:]` + @param connection AgoraRtcConnection. + @note + - By default, SDK will trace media rendering events when join channel. + - The start point of event tracing will be reset after leaving channel. + @return + - 0: Success. + - < 0: Failure. + - `-2(AgoraErrorCodeInvalidArgument)`: The parameter is invalid. Check the channel ID and local uid set by parameter `connection`. + - `-7(AgoraErrorCodeNotInitialized)`: The SDK is not initialized. + */ +- (int)startMediaRenderingTracingEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(startMediaRenderingTracingEx(_:)); + +/** + * Adds multiple SDK delegate. + * + * @param delegate The AgoraRtcEngineDelegate object. + * @param connection The AgoraRtcConnection object. + */ +- (void)addDelegateEx:(id _Nonnull)delegate connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(addDelegateEx(_:connection:)); + +/**----------------------------------------------------------------------------- + * @name Built-in Encryption + * ----------------------------------------------------------------------------- + */ + +/** Enables/Disables the built-in encryption. + + In scenarios requiring high security, Agora recommends calling enableEncryption to enable the built-in encryption before joining a channel. + + All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + + **Note** + + - If you enable the built-in encryption, you cannot use the RTMP streaming function. + + @param enabled Whether to enable the built-in encryption: + + - YES: Enable the built-in encryption. + - NO: Disable the built-in encryption. + + @param config Configurations of built-in encryption schemas. See AgoraEncryptionConfig. + @param connection \ref AgoraRtcConnection by channelId and uid combine + + @return - 0: Success. + - < 0: Failure. + + - -2 (`AgoraErrorCodeInvalidArgument`): An invalid parameter is used. Set the parameter with a valid value. + - -7 (`AgoraErrorCodeNotInitialized`): The SDK is not initialized. Initialize the `AgoraRtcEngineKit` instance before calling this method. + - -4 (`AgoraErrorCodeNotSupported`): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. + */ +- (int)enableEncryptionEx:(bool)enabled encryptionConfig:(AgoraEncryptionConfig *_Nonnull)config connection:(AgoraRtcConnection* _Nonnull)connection NS_SWIFT_NAME(enableEncryptionEx(_:encryptionConfig:connection:)); + +/** + * Removes multiple SDK delegate. + * + * @param delegate The AgoraRtcEngineDelegate object. + * @param connection The AgoraRtcConnection object. + */ +- (void)removeDelegateEx:(id _Nonnull)delegate connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(removeDelegateEx(_:connection:)); + +/** + * Gets the current call ID. + * + * When a user joins a channel, a call ID is generated to identify the call. + * + * After a call ends, you can call `rate` or `complain` to gather feedback from + * your customer. + * + * @param connection The AgoraRtcConnection object. + * @return The call ID if the method call is successful. + */ +- (NSString * _Nullable)getCallIdEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(getCallIdEx(_:)); + +@end +NS_ASSUME_NONNULL_END diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcKit.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcKit.h new file mode 100644 index 0000000..d3a39ac --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcKit.h @@ -0,0 +1,19 @@ +// +// AgoraRtcKit.h +// AgoraRtcKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcMediaPlayerProtocol.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcMediaPlayerProtocol.h new file mode 100644 index 0000000..ddbd598 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraRtcMediaPlayerProtocol.h @@ -0,0 +1,551 @@ +// +// AgoraRtcMediaPlayerProtocol.h +// AgoraRtcMediaPlayerProtocol +// +// Copyright (c) 2020 Agora. All rights reserved. +// + +#import +#import "AgoraObjects.h" +#import "AgoraRtcAudioSpectrumDelegate.h" +#if TARGET_OS_IPHONE +#import +typedef UIView View; +#elif TARGET_OS_MAC +#import +typedef NSView View; +#endif + +@protocol AgoraRtcMediaPlayerAudioFrameDelegate; +@protocol AgoraRtcMediaPlayerVideoFrameDelegate; + +NS_ASSUME_NONNULL_BEGIN +@protocol AgoraRtcMediaPlayerProtocol + +/** + * Get unique media player id of the media player entity. + * @return + * - >= 0: The mediaPlayerId of this media player entity. + * - < 0: Failure. + */ +- (int)getMediaPlayerId NS_SWIFT_NAME(getMediaPlayerId()); +/** + * Opens a media file with a specified URL. + * @param url The URL of the media file that you want to play. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)open:(NSString *)url startPos:(NSInteger)startPos NS_SWIFT_NAME(open(_:startPos:)); + + +/** + * Opens a media file with MediaSource + * @param source see `AgoraMediaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)openWithMediaSource:(AgoraMediaSource *)source NS_SWIFT_NAME(open(with:)); + +/** + * Open the Agora CDN media source. + * @param src The src of the media file that you want to play. + * @param startPos The playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)openWithAgoraCDNSrc:(NSString *)src startPos:(NSInteger)startPos NS_SWIFT_NAME(open(withAgoraCDNSrc:startPos:)); + +/** + * Gets the number of Agora CDN lines. + * @return + * - > 0: number of CDN. + * - <= 0: Failure. + */ +- (int)getAgoraCDNLineCount NS_SWIFT_NAME(getAgoraCDNLineCount()); + +/** + * Switch Agora CDN lines. + * @param index Specific line. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)switchAgoraCDNLineByIndex:(int)index NS_SWIFT_NAME(switchAgoraCDNLine(by:)); + +/** + * Gets the line of the current CDN. + * @return + * - >= 0: Specific line. + * - < 0: Failure. + */ +- (int)getCurrentAgoraCDNIndex NS_SWIFT_NAME(getCurrentAgoraCDNIndex()); + +/** + * Enable automatic CDN line switching. + * @param enable Whether enable. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAutoSwitchAgoraCDN:(BOOL)enable NS_SWIFT_NAME(enableAutoSwitchAgoraCDN(_:)); + +/** + * Update the CDN source token and timestamp. + * @param token token. + * @param ts ts. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)renewAgoraCDNSrcToken:(NSString *)token ts:(NSInteger)ts NS_SWIFT_NAME(renewAgoraCDNSrcToken(_:ts:)); + +/** + * Switch the CDN source. + * @param src Specific line. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)switchAgoraCDNSrc:(NSString *)src syncPts:(BOOL)syncPts NS_SWIFT_NAME(switchAgoraCDNSrc(_:syncPts:)); + +/** + * Plays the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)play NS_SWIFT_NAME(play()); + +/** + * Pauses playing the media file. + */ +- (int)pause NS_SWIFT_NAME(pause()); + +/** + * Stops playing the current media file. + */ +- (int)stop NS_SWIFT_NAME(stop()); + +/** + * Resumes playing the media file. + */ +- (int)resume NS_SWIFT_NAME(resume()); + +/** + * Sets the current playback position of the media file. + * @param position The new playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)seekToPosition:(NSInteger)position NS_SWIFT_NAME(seek(toPosition:)); + +/** + * Sets the pitch of the current media file. + * @param pitch Sets the pitch of the local music file by chromatic scale. The default value is 0, + * which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value + * between consecutive values is a chromatic value. The greater the absolute value of this + * parameter, the higher or lower the pitch of the local music file. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setAudioPitch:(NSInteger)pitch NS_SWIFT_NAME(setAudioPitch(_:)); + +/** + * Gets the duration of the media file. + */ +- (NSInteger)getDuration NS_SWIFT_NAME(getDuration()); +/** + * Gets the current playback position of the media file.(ms). + */ +- (NSInteger)getPosition NS_SWIFT_NAME(getPosition()); +/** + * Gets the number of the media streams in the media resource. + */ +- (NSInteger)getStreamCount NS_SWIFT_NAME(getStreamCount()); + +/** Gets the detailed information of the media stream. + + @param index The index of the media stream. + + @return * If the call succeeds, returns the detailed information of the media + stream. See AgoraMediaStreamInfo. + * If the call fails and returns nil. + */ +- (AgoraRtcMediaStreamInfo *_Nullable)getStreamByIndex:(int)index NS_SWIFT_NAME(getStreamBy(_:)); + +/** + * Sets whether to loop the media file for playback. + * @param loopCount the number of times looping the media file. + * - 0: Play the audio effect once. + * - 1: Play the audio effect twice. + * - -1: Play the audio effect in a loop indefinitely, until stopEffect() or stop() is called. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setLoopCount:(int)loopCount NS_SWIFT_NAME(setLoopCount(_:)); + +/** + * Change playback speed + * @param speed the enum of playback speed + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setPlaybackSpeed:(int)speed NS_SWIFT_NAME(setPlaybackSpeed(_:)); + +/** + * Select playback audio track of the media file + * @param index the index of the audio track in media file + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)selectAudioTrack:(int)index NS_SWIFT_NAME(selectAudioTrack(_:)); + +/** + * Selects multi audio track of the media file for playback or publish to channel. + * @param playoutTrackIndex The index of the audio track in media file for local playback. + * @param publishTrackIndex The index of the audio track in the media file published to the remote. + * + * @note + * You can obtain the streamIndex of the audio track by calling getStreamInfo.. + * If you want to use selectMultiAudioTrack, you need to open the media file with openWithMediaSource and set enableMultiAudioTrack to true. + * + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - -2: Invalid argument. Argument must be greater than or equal to zero. + * - -8: Invalid State.You must open the media file with openWithMediaSource and set enableMultiAudioTrack to true + */ +- (int)selectMultiAudioTrack:(NSInteger)playoutTrackIndex publishTrackIndex:(NSInteger)publishTrackIndex NS_SWIFT_NAME(selectMultiAudioTrack(_:publishTrackIndex:)); + +/** + * take screenshot while playing video + * @param filename the filename of screenshot file + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)takeScreenshot:(NSString *)filename NS_SWIFT_NAME(takeScreenshot(_:)); + +/** + * select internal subtitles in video + * @param index the index of the internal subtitles + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)selectInternalSubtitle:(int)index NS_SWIFT_NAME(selectInternalSubtitle(_:)); + +/** + * set an external subtitle for video + * @param url The URL of the subtitle file that you want to load. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setExternalSubtitle:(NSString *)url NS_SWIFT_NAME(setExternalSubtitle(_:)); + +/** Gets current playback state. + + @return * The call succeeds and returns current playback state. See + AgoraMediaPlayerState. + * The call fails and returns nil. + */ +- (AgoraMediaPlayerState)getPlayerState NS_SWIFT_NAME(getPlayerState()); + +/** + * @brief Turn mute on or off + * + * @param isMute Whether the media source is mute. + * YES: Yes. + * NO: No. + * @return mute Whether to mute on + */ +- (int)mute:(bool)isMute NS_SWIFT_NAME(mute(_:)); + +/** + * @brief Get mute state + * + * @return mute Whether is mute on + */ +- (BOOL)getMute NS_SWIFT_NAME(getMute()); + +/** + * @brief Adjust playback volume + * + * @param volume The volume value to be adjusted + * The volume can be adjusted from 0 to 400: + * 0: mute; + * 100: original volume; + * 400: Up to 4 times the original volume (with built-in overflow protection). + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ +- (int)adjustPlayoutVolume:(int)volume NS_SWIFT_NAME(adjustPlayoutVolume(_:)); + +/** + * @brief Get the current playback volume + * + * @return volume + */ +- (int)getPlayoutVolume NS_SWIFT_NAME(getPlayoutVolume()); + +/** + * @brief adjust publish signal volume + */ +- (int)adjustPublishSignalVolume:(int)volume NS_SWIFT_NAME(adjustPublishSignalVolume(_:)); + +/** + * @brief get publish signal volume + */ +- (int)getPublishSignalVolume NS_SWIFT_NAME(getPublishSignalVolume()); + +/** + * @brief Modify player option before opening file or url, + * @param [in] key + * the option key name + * @param [in] value + * the option value + * @return + * - 0: Success. + * - < 0: Failure. See AgoraMediaPlayerError. + */ +- (int)setPlayerOption:(NSString *)key value:(NSInteger)value NS_SWIFT_NAME(setPlayerOption(_:value:)); + +/** + * @brief Modify player option before opening file or url, + * @param [in] key + * the option key name + * @param [in] value + * the option value + * @return + * - 0: Success. + * - < 0: Failure. See AgoraMediaPlayerError. + */ +- (int)setPlayerOptionString:(NSString *)key value:(NSString *)value NS_SWIFT_NAME(setPlayerOptionString(_:value:)); + +/** + * @brief Set video rendering view + */ +- (int)setView:(View *_Nullable)view NS_SWIFT_NAME(setView(_:)); + +/** + * @brief Set video display mode + * + * @param mode Video display mode + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ +- (int)setRenderMode:(AgoraMediaPlayerRenderMode)mode NS_SWIFT_NAME(setRenderMode(_:)); + +/** + * Get the current play src. + * @return + * - current play src of raw bytes. + */ +- (NSString *)getPlaySrc NS_SWIFT_NAME(getPlaySrc()); + +/** + * Switch the media source when open a media through "open" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)switchSrc:(NSString *)src syncPts:(BOOL)syncPts NS_SWIFT_NAME(switchSrc(_:syncPts:)); + +/** + * Preload a media source + * @param src Specific src. + * @param startPos The starting position (ms) for playback. Default value is 0. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)preloadSrc:(NSString *)src startPos:(int)startPos NS_SWIFT_NAME(preloadSrc(_:startPos:)); + +/** + * unload a media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)unloadSrc:(NSString *)src NS_SWIFT_NAME(unloadSrc(_:)); + +/** + * Play a pre-loaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)playPreloadedSrc:(NSString *)src NS_SWIFT_NAME(playPreloadedSrc(_:)); + +/** Set dual-mono output mode of the music file. + @param mode The audio dual mono mode. See AgoraAudioDualMonoMode. + + @return + - 0: Success. + - < 0: Failure. + */ +- (int)setAudioDualMonoMode:(AgoraAudioDualMonoMode)mode NS_SWIFT_NAME(setAudioDualMonoMode(_:)); + +/** + * @deprecated + * Open media file or stream with custom soucrce. + * The custom data source provides a data stream input callback, and the player will continue to call back this interface, requesting the user to fill in the data that needs to be played. + * + * @param startPos Set the starting position for playback, in seconds. + * @param onReadDataCallback The player requests to read the data callback , see `AgoraRtcMediaPlayerOnReadCallback` + * @param onSeekCallback The Player seek event callback, see `AgoraRtcMediaPlayerOnSeekCallback` + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)openWithCustomSourceAtStartPos:(NSInteger)startPos + withPlayerOnReadData:(AgoraRtcMediaPlayerCustomSourceOnReadCallback)onReadDataCallback + andPlayerOnSeek:(AgoraRtcMediaPlayerCustomSourceOnSeekCallback)onSeekCallback NS_SWIFT_NAME(openWithCustomSourceAtStartPos(_:withPlayerOnReadData:andPlayerOnSeek:)); + +/** + * Set spatial audio params for the music file. It can be called after the media player + * was created. + * + * @params params See `AgoraSpatialAudioParams`. If it's + * not set, then the spatial audio will be disabled; or it will be enabled. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setSpatialAudioParams:(AgoraSpatialAudioParams* _Nonnull)params NS_SWIFT_NAME(setSpatialAudioParams(_:)); + +#pragma mark Callback Audio PCM Frame + +/** + * Registers & unregister the player audio observer + * + * @param delegate observer object, pass nil to unregister + * @return + * - YES: Success. + * - NO: Failure. + */ +- (BOOL)setAudioFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setAudioFrameDelegate(_:)); + +#pragma mark Callback Video Frame + +/** + * Registers & unregister the player video observer + * + * @param delegate observer object, pass nil to unregister. + * @return + * - YES: Success. + * - NO: Failure. + */ +- (BOOL)setVideoFrameDelegate:(id _Nullable)delegate NS_SWIFT_NAME(setVideoFrameDelegate(_:)); + +- (int)registerMediaPlayerAudioSpectrumDelegate:(id _Nullable)delegate + intervalInMS:(NSUInteger)intervalInMS NS_SWIFT_NAME(registerMediaPlayerAudioSpectrumDelegate(_:intervalInMS:)); + +- (int)unregisterMediaPlayerAudioSpectrumDelegate:(id _Nullable)delegate NS_SWIFT_NAME(unregisterMediaPlayerAudioSpectrumDelegate(_:)); +@end + + +@protocol AgoraRtcMediaPlayerCacheManagerProtocol + +/** + * Get shared cacheManager instance. + * @return cacheManager instance. + */ ++ (instancetype)sharedInstance NS_SWIFT_NAME(sharedInstance()); +/** + * Remove all media resource cache files. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)removeAllCaches NS_SWIFT_NAME(removeAllCaches()); +/** + * Remove the latest media resource cache file. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)removeOldCache NS_SWIFT_NAME(removeOldCache()); +/** + * Remove the cache file by uri, setting by MediaSource. + * @param uri URI,identify the uniqueness of the property, Set from `MeidaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)removeCacheByUri:(NSString *)uri NS_SWIFT_NAME(removeCache(byUri:)); +/** + * Set cache file path that files will be saved to. + * @param cacheDir cacheDir path. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setCacheDir:(NSString *)cacheDir NS_SWIFT_NAME(setCacheDir(_:)); +/** + * Set the maximum number of cached files. + * @param count maximum number of cached files. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setMaxCacheFileCount:(NSInteger)count NS_SWIFT_NAME(setMaxCacheFileCount(_:)); +/** + * Set the total size of the largest cache file. + * @param cacheSize total size of the largest cache file. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)setMaxCacheFileSize:(NSInteger)cacheSize NS_SWIFT_NAME(setMaxCacheFileSize(_:)); +/** + * Set whether the player will clean up the cache in the order of resource usage. + * @param enable enable the player to automatically clear the cache. + * @return + * - 0: Success. + * - < 0: Failure. + */ +- (int)enableAutoRemoveCache:(BOOL)enable NS_SWIFT_NAME(enableAutoRemoveCache(_:)); +/** + * Get the cache directory you have set. + * @return cacheDir + */ +- (NSString *)cacheDir NS_SWIFT_NAME(cacheDir()); +/** + * Get the maximum number of cached files. + * @return + * > 0: file count. + * - < 0: Failure. + */ +- (NSInteger)maxCacheFileCount NS_SWIFT_NAME(maxCacheFileCount()); +/** + * Get the total size of the largest cache file + * @return + * > 0: file size. + * - < 0: Failure. + */ +- (NSInteger)maxCacheFileSize NS_SWIFT_NAME(maxCacheFileSize()); +/** + * Get the number of all cache files. + * @return + * > 0: file count. + * - < 0: Failure. + */ +- (NSInteger)cacheFileCount NS_SWIFT_NAME(cacheFileCount()); + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraSpatialAudioKit.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraSpatialAudioKit.h new file mode 100644 index 0000000..40f5499 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/AgoraSpatialAudioKit.h @@ -0,0 +1,108 @@ +// +// AgoraSpatialAudioKit.h +// AgoraRtcKit +// +// Copyright (c) 2018 Agora. All rights reserved. +// + +#ifndef AgoraSpatialAudioKit_h +#define AgoraSpatialAudioKit_h + +#import +#import "AgoraEnumerates.h" +#import "AgoraObjects.h" + +__attribute__((visibility("default"))) @interface AgoraRemoteVoicePositionInfo : NSObject +@property(strong, nonatomic) NSArray * _Nonnull position; +@property(strong, nonatomic) NSArray * _Nullable forward; +@end + +__attribute__((visibility("default"))) @interface AgoraSpatialAudioZone : NSObject +//the zone id +@property(assign, nonatomic) NSInteger zoneSetId; +//zone center point +@property(strong, nonatomic) NSArray * _Nonnull position; +//forward direction +@property(strong, nonatomic) NSArray * _Nonnull forward; +//right direction +@property(strong, nonatomic) NSArray * _Nonnull right; +//up direction +@property(strong, nonatomic) NSArray * _Nonnull up; +//the forward side length of the zone +@property(assign, nonatomic) float forwardLength; +//tehe right side length of the zone +@property(assign, nonatomic) float rightLength; +//the up side length of the zone +@property(assign, nonatomic) float upLength; +//the audio attenuation of zone +@property(assign, nonatomic) float audioAttenuation; +@end + +@class AgoraRtcEngineKit, AgoraBaseSpatialAudioKit, AgoraLocalSpatialAudioKit; + +__attribute__((visibility("default"))) @interface AgoraCloudSpatialAudioConfig : NSObject +@property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine; +/** 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 AgoraRtcEngineKit instance. To change your App ID, call [destroy]([AgoraRtcEngineKit destroy]) to `destroy` the current AgoraRtcEngineKit instance, and after `destroy` returns 0, call [sharedEngineWithConfig]([AgoraRtcEngineKit sharedEngineWithConfig:delegate:]) to create an AgoraRtcEngineKit instance with the new App ID. + */ +@property(copy, nonatomic) NSString* _Nullable appId; +/** The region for connection. This advanced feature applies to scenarios that have regional restrictions.

    For the regions that Agora supports, see AgoraAreaCode. The area codes support bitwise operation. After specifying the region, the SDK connects to the Agora servers within that region.

    + */ +@property(assign, nonatomic) NSUInteger deployRegion; +@end + +__attribute__((visibility("default"))) @interface AgoraLocalSpatialAudioConfig : NSObject +@property(assign, nonatomic) AgoraRtcEngineKit* _Nullable rtcEngine; +@end + +__attribute__((visibility("default"))) @interface AgoraBaseSpatialAudioKit : NSObject + +- (int)setMaxAudioRecvCount:(NSUInteger)maxCount NS_SWIFT_NAME(setMaxAudioRecvCount(_:)); + +- (int)setAudioRecvRange:(float)range NS_SWIFT_NAME(setAudioRecvRange(_:)); + +- (int)setDistanceUnit:(float)unit NS_SWIFT_NAME(setDistanceUnit(_:)); + +- (int)updatePlayerPositionInfo:(NSInteger)playerId positionInfo:(AgoraRemoteVoicePositionInfo* _Nonnull)positionInfo NS_SWIFT_NAME(updatePlayerPositionInfo(_:positionInfo:)); + +- (int)updateSelfPosition:(NSArray* _Nonnull)position axisForward:(NSArray* _Nonnull)axisForward axisRight:(NSArray* _Nonnull)axisRight axisUp:(NSArray* _Nonnull)axisUp NS_SWIFT_NAME(updateSelfPosition(_:axisForward:axisRight:axisUp:)); + +- (int)updateSelfPositionEx:(NSArray* _Nonnull)position + axisForward:(NSArray* _Nonnull)axisForward + axisRight:(NSArray* _Nonnull)axisRight + axisUp:(NSArray* _Nonnull)axisUp + connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateSelfPositionEx(_:axisForward:axisRight:axisUp:connection:)); + +- (int)muteLocalAudioStream:(BOOL)mute NS_SWIFT_NAME(muteLocalAudioStream(_:)); + +- (int)muteAllRemoteAudioStreams:(BOOL)mute NS_SWIFT_NAME(muteAllRemoteAudioStreams(_:)); + +- (int)setZones:(NSArray * _Nullable)zones NS_SWIFT_NAME(setZones(_:)); + +- (int)setPlayerAttenuation:(double)attenuation playerId:(NSUInteger)playerId forceSet:(BOOL)forceSet NS_SWIFT_NAME(setPlayerAttenuation(_:playerId:forceSet:)); + +- (int)muteRemoteAudioStream:(NSUInteger)uid mute:(BOOL)mute NS_SWIFT_NAME(muteRemoteAudioStream(_:mute:)); + +@end +__attribute__((visibility("default"))) @interface AgoraLocalSpatialAudioKit : AgoraBaseSpatialAudioKit + ++ (instancetype _Nonnull)sharedLocalSpatialAudioWithConfig:(AgoraLocalSpatialAudioConfig* _Nonnull)config NS_SWIFT_NAME(sharedLocalSpatialAudio(with:)); + ++ (void)destroy NS_SWIFT_NAME(destroy()); + +- (int)updateRemotePosition:(NSUInteger)uid positionInfo:(AgoraRemoteVoicePositionInfo* _Nonnull)posInfo NS_SWIFT_NAME(updateRemotePosition(_:positionInfo:)); + +- (int)updateRemotePositionEx:(NSUInteger)uid positionInfo:(AgoraRemoteVoicePositionInfo* _Nonnull)posInfo connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(updateRemotePositionEx(_:positionInfo:connection:)); + +- (int)removeRemotePosition:(NSUInteger)uid NS_SWIFT_NAME(removeRemotePosition(_:)); + +- (int)removeRemotePositionEx:(NSUInteger)uid connection:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(removeRemotePositionEx(_:connection:)); + +- (int)clearRemotePositions NS_SWIFT_NAME(clearRemotePositions()); + +- (int)clearRemotePositionsEx:(AgoraRtcConnection * _Nonnull)connection NS_SWIFT_NAME(clearRemotePositionsEx(_:)); + +- (int)setRemoteAudioAttenuation:(double)attenuation userId:(NSUInteger)uid forceSet:(BOOL)forceSet NS_SWIFT_NAME(setRemoteAudioAttenuation(_:userId:forceSet:)); + +@end + +#endif /* AgoraSpatialAudioKit_h */ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraFileUploader.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraFileUploader.h new file mode 100644 index 0000000..1ccd367 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraFileUploader.h @@ -0,0 +1,44 @@ + +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +struct ImagePayloadData { + ImagePayloadData(int seq, uint8_t* pixel, int fileSize, int w, int h, int64_t ts) + : seqid(seq), + size(fileSize), + width(w), + height(h), + timestamp(ts){ + } + + int seqid; + int size; + int width; + int height; + int64_t timestamp; + uint8_t* buffer; + void* privdata; + int privsize; +}; +/** + * The IFileUploadService class, which enables upload file service. + */ +class IFileUploaderService : public RefCountInterface { + public: + virtual ~IFileUploaderService() {} + virtual int startImageUpload(const ImagePayloadData* imgData) = 0; + virtual int stopImageUpload() = 0; +}; +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraLog.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraLog.h new file mode 100644 index 0000000..f395216 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraLog.h @@ -0,0 +1,98 @@ +// +// Agora Media SDK +// +// Copyright (c) 2015 Agora IO. All rights reserved. +// +#pragma once + +#include +#include + +#ifndef OPTIONAL_ENUM_CLASS +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_CLASS enum class +#else +#define OPTIONAL_ENUM_CLASS enum +#endif +#endif + +#ifndef OPTIONAL_LOG_LEVEL_SPECIFIER +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_LOG_LEVEL_SPECIFIER LOG_LEVEL:: +#else +#define OPTIONAL_LOG_LEVEL_SPECIFIER +#endif +#endif + +namespace agora { +namespace commons { + +/** + * Supported logging severities of SDK + */ +OPTIONAL_ENUM_CLASS LOG_LEVEL { + LOG_LEVEL_NONE = 0x0000, + LOG_LEVEL_INFO = 0x0001, + LOG_LEVEL_WARN = 0x0002, + LOG_LEVEL_ERROR = 0x0004, + LOG_LEVEL_FATAL = 0x0008, + LOG_LEVEL_API_CALL = 0x0010, +}; + +/* +The SDK uses ILogWriter class Write interface to write logs as application +The application inherits the methods Write() to implentation their own log writ + +Write has default implementation, it writes logs to files. +Application can use setLogFile() to change file location, see description of set +*/ +class ILogWriter { + public: + /** user defined log Write function + @param level log level + @param message log message content + @param length log message length + @return + - 0: success + - <0: failure + */ + virtual int32_t writeLog(LOG_LEVEL level, const char* message, uint16_t length) = 0; + + virtual ~ILogWriter() {} +}; + +enum LOG_FILTER_TYPE { + LOG_FILTER_OFF = 0, + LOG_FILTER_DEBUG = 0x080f, + LOG_FILTER_INFO = 0x000f, + LOG_FILTER_WARN = 0x000e, + LOG_FILTER_ERROR = 0x000c, + LOG_FILTER_CRITICAL = 0x0008, + LOG_FILTER_MASK = 0x80f, +}; + +const uint32_t MAX_LOG_SIZE = 20 * 1024 * 1024; // 20MB +const uint32_t MIN_LOG_SIZE = 128 * 1024; // 128KB +/** The default log size in kb + */ +const uint32_t DEFAULT_LOG_SIZE_IN_KB = 1024; + +/** Definition of LogConfiguration + */ +struct LogConfig { + /**The log file path, default is NULL for default log path + */ + const char* filePath; + /** The log file size, KB , set 1024KB to use default log size + */ + uint32_t fileSizeInKB; + /** The log level, set LOG_LEVEL_INFO to use default log level + */ + LOG_LEVEL level; + + LogConfig() : filePath(NULL), fileSizeInKB(DEFAULT_LOG_SIZE_IN_KB), level(OPTIONAL_LOG_LEVEL_SPECIFIER LOG_LEVEL_INFO) {} +}; +} // namespace commons +} // namespace agora + +#undef OPTIONAL_LOG_LEVEL_SPECIFIER diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaComponentFactory.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaComponentFactory.h new file mode 100644 index 0000000..28de53f --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaComponentFactory.h @@ -0,0 +1,41 @@ +// +// Agora SDK +// +// Copyright (c) 2021 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +class IMediaPlayer; + +class IMediaComponentFactory { +public: + /** This method creates media player. + */ + virtual agora_refptr createMediaPlayer( + agora::media::base::MEDIA_PLAYER_SOURCE_TYPE type = agora::media::base::MEDIA_PLAYER_SOURCE_DEFAULT) = 0; + +protected: + virtual ~IMediaComponentFactory() {} +}; + +} //namespace rtc +} // namespace agora + +/** \addtogroup createMediaComponentFactory + @{ + */ +/** + * Creates an \ref agora::rtc::IMediaComponentFactory "IMediaComponentFactory" object and returns the pointer. + * + * @return + * - The pointer to \ref agora::rtc::IMediaComponentFactory "IMediaComponentFactory": Success. + * - A null pointer: Failure. + */ +AGORA_API agora::rtc::IMediaComponentFactory* AGORA_CALL createAgoraMediaComponentFactory(); +/** @} */ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaEngine.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaEngine.h new file mode 100644 index 0000000..057b4cc --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaEngine.h @@ -0,0 +1,267 @@ +// +// Agora Media SDK +// +// Copyright (c) 2015 Agora IO. All rights reserved. +// +#pragma once + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace media { + +/** dual-mono music output mode + */ +enum AUDIO_MIXING_DUAL_MONO_MODE { + /* 0: Original mode */ + AUDIO_MIXING_DUAL_MONO_AUTO = 0, + /* 1: Left channel mode */ + AUDIO_MIXING_DUAL_MONO_L = 1, + /* 2: Right channel mode */ + AUDIO_MIXING_DUAL_MONO_R = 2, + /* 3: Mixed channel mode */ + AUDIO_MIXING_DUAL_MONO_MIX = 3 +}; + + +/** + * The IMediaEngine class. + */ +class IMediaEngine { + public: + /** + * Registers an audio frame observer object. + * + * @note + * Ensure that you call this method before \ref IRtcEngine::joinChannel "joinChannel". + * + * @param observer A pointer to the audio frame observer object: IAudioFrameObserver, + * nullptr means unregistering observer instead. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(IAudioFrameObserver* observer) = 0; + /** + * Registers a video frame observer object. + * + * @note + * - Ensure that you call this method before joining the channel. + * - If you register an observer for video raw video data, you cannot register an IVideoEncodedFrameObserver + * object. + * + * @param observer A pointer to the video frame observer: IVideoFrameObserver. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoFrameObserver(IVideoFrameObserver* observer) = 0; + + /** + * Registers a receiver object for the encoded video image. + * + * @note + * - Ensure that you call this method before joining the channel. + * + * @param observer A pointer to the observer of the encoded video image: \ref IVideoEncodedFrameObserver + * "IVideoEncodedFrameObserver". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoEncodedFrameObserver(IVideoEncodedFrameObserver* observer) = 0; + + /** + * Pushes the external audio data to the app. + * + * @param frame The audio buffer data. + * @param trackId The audio track ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pushAudioFrame(IAudioFrameObserver::AudioFrame* frame, rtc::track_id_t trackId = 0) = 0; + + virtual int pushCaptureAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0; + + virtual int pushReverseAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0; + + /** + * Pulls the remote audio data. + * + * After a successful method call, the app pulls the decoded and mixed audio data for playback. + * + * The difference between this method and the \ref onPlaybackAudioFrame "onPlaybackAudioFrame" is as follows: + * - `onPlaybackAudioFrame`: The SDK sends the audio data to the app once every 10 ms. Any delay in processing + * the audio frames may result in audio jitter. + * - `pullAudioFrame`: The app pulls the remote audio data. After setting the audio data parameters, the + * SDK adjusts the frame buffer and avoids problems caused by jitter in the external audio playback. + * + * @param frame The pointer to the audio frame: AudioFrame. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pullAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0; + + /** + * Sets the external video source. + * + * Once the external video source is enabled, the SDK prepares to accept the external video frame. + * + * @param enabled Determines whether to enable the external video source. + * - true: Enable the external video source. Once set, the SDK creates the external source and prepares + * video data from `pushVideoFrame` or `pushEncodedVideoImage`. + * - false: Disable the external video source. + * @param useTexture Determines whether to use textured video data. + * - true: Use texture, which is not supported now. + * - False: Do not use texture. + * @param sourceType Determines the type of external video source frame. + * - ENCODED_VIDEO_FRAME: The external video source is encoded. + * - VIDEO_FRAME: The external video source is not encoded. + * @param encodedVideoOption Video encoded track option, which is only used for ENCODED_VIDEO_FRAME. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExternalVideoSource( + bool enabled, bool useTexture, EXTERNAL_VIDEO_SOURCE_TYPE sourceType = VIDEO_FRAME, + rtc::SenderOptions encodedVideoOption = rtc::SenderOptions()) = 0; + + /** + * Sets the external audio source. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @deprecated This method is deprecated. Use createCustomAudioTrack(rtc::AUDIO_TRACK_TYPE trackType, const rtc::AudioTrackConfig& config) instead. + * + * @param enabled Determines whether to enable the external audio source: + * - true: Enable the external audio source. + * - false: (default) Disable the external audio source. + * @param sampleRate The Sample rate (Hz) of the external audio source, which can set be as + * 8000, 16000, 32000, 44100, or 48000. + * @param channels The number of channels of the external audio source, which can be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param localPlayback Enable/Disables the local playback of external audio track: + * - true: Enable local playback + * - false: (Default) Do not enable local playback + * @param publish Determines whether to publish the external audio track: + * - true: (Default) Publish the external audio track. + * - false: Don`t publish the external audio track. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExternalAudioSource(bool enabled, int sampleRate, int channels, bool localPlayback = false, bool publish = true) = 0; + + /** + * Create a custom audio track and get the audio track id. + * + * @note Ensure that you call this method before calling `joinChannel`. + * + * @param trackType The type of custom audio track + * See AUDIO_TRACK_TYPE. + * + * @param config The config of custom audio track + * See AudioTrackConfig. + * + * @return + * - If the call is successful, SDK returns audio track id. + * - If the call fails, SDK returns 0xffffffff. + */ + virtual rtc::track_id_t createCustomAudioTrack(rtc::AUDIO_TRACK_TYPE trackType, const rtc::AudioTrackConfig& config) = 0; + + /** + * Destroy custom audio track by trackId + * + * @param trackId The custom audio track id. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int destroyCustomAudioTrack(rtc::track_id_t trackId) = 0; + + /** + * Sets the external audio sink. + * + * This method applies to scenarios where you want to use external audio + * data for playback. After calling the \ref IRtcEngine::initialize "initialize" + * method and pass value of false in the `enableAudioDevice` member in the RtcEngineContext struct, you can call + * the \ref agora::media::IMediaEngine::pullAudioFrame "pullAudioFrame" method to pull the remote audio data, process + * it, and play it with the audio effects that you want. + * + * @note + * Once you call the \ref IRtcEngine::initialize "initialize" method and pass value of false in the `enableAudioDevice` + * member in the RtcEngineContext struct, the app will not retrieve any audio data from the + * \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback. + * + * @param enabled Sets whether or not to the external audio sink + * - true: Enables the external audio sink. + * - false: Disables the external audio sink. + * @param sampleRate Sets the sample rate (Hz) of the external audio sink, which can be set as 16000, 32000, 44100 or 48000. + * @param channels Sets the number of audio channels of the external + * audio sink: + * - 1: Mono. + * - 2: Stereo. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExternalAudioSink(bool enabled, int sampleRate, int channels) = 0; + + /** + * Sets the external audio track. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @param trackId The custom audio track id. + * @param enabled Enable/Disables the local playback of external audio track: + * - true: Enable local playback + * - false: Do not enable local playback + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableCustomAudioLocalPlayback(rtc::track_id_t trackId, bool enabled) = 0; + + /** + * Pushes the external video frame to the app. + * + * @param frame The external video frame: ExternalVideoFrame. + * @param videoTrackId The id of the video track. + * - 0: Success. + * - < 0: Failure. + */ + virtual int pushVideoFrame(base::ExternalVideoFrame* frame, unsigned int videoTrackId = 0) = 0; + + /** + * Pushes the encoded video image to the app. + * @param imageBuffer A pointer to the video image. + * @param length The data length. + * @param videoEncodedFrameInfo The reference to the information of the encoded video frame: + * \ref agora::rtc::EncodedVideoFrameInfo "EncodedVideoFrameInfo". + * @param videoTrackId The id of the video track. + * - 0: Success. + * - < 0: Failure. + */ + virtual int pushEncodedVideoImage(const uint8_t* imageBuffer, size_t length, + const agora::rtc::EncodedVideoFrameInfo& videoEncodedFrameInfo, + unsigned int videoTrackId = 0) = 0; + + virtual void release() = 0; + + protected: + virtual ~IMediaEngine() {} +}; + +} // namespace media + +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaPlayer.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaPlayer.h new file mode 100644 index 0000000..4ec36ca --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaPlayer.h @@ -0,0 +1,654 @@ +// +// Agora SDK +// +// Copyright (c) 2020 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraMediaPlayerTypes.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace base { +class IAgoraService; +} +namespace rtc { + +class ILocalAudioTrack; +class ILocalVideoTrack; +class IMediaPlayerSourceObserver; +class IMediaPlayerCustomDataProvider; + +/** + * The IMediaPlayerEntity class provides access to a media player entity. If yout want to playout + * multiple media sources simultaneously, create multiple media player source objects. + */ +class IMediaPlayer : public RefCountInterface { +protected: + virtual ~IMediaPlayer() {} + +public: + virtual int initialize(base::IAgoraService* agora_service) = 0; + + /** + * Get unique media player id of the media player entity. + * @return + * - >= 0: The source id of this media player entity. + * - < 0: Failure. + */ + virtual int getMediaPlayerId() const = 0; + + /** + * Opens a media file with a specified URL. + * @param url The URL of the media file that you want to play. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int open(const char* url, int64_t startPos) = 0; + + /** + * @deprecated + * @brief Open media file or stream with custom soucrce. + * @param startPos Set the starting position for playback, in seconds + * @param observer dataProvider object + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithCustomSource(int64_t startPos, media::base::IMediaPlayerCustomDataProvider* provider) = 0; + + /** + * @brief Open a media file with a media file source. + * @param source Media file source that you want to play, see `MediaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithMediaSource(const media::base::MediaSource &source) = 0; + + /** + * Plays the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int play() = 0; + + /** + * Pauses playing the media file. + */ + virtual int pause() = 0; + + /** + * Stops playing the current media file. + */ + virtual int stop() = 0; + + /** + * Resumes playing the media file. + */ + virtual int resume() = 0; + + /** + * Sets the current playback position of the media file. + * @param newPos The new playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int seek(int64_t newPos) = 0; + + /** Sets the pitch of the current media file. + * @param pitch Sets the pitch of the local music file by chromatic scale. The default value is 0, + * which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between + * consecutive values is a chromatic value. The greater the absolute value of this parameter, the + * higher or lower the pitch of the local music file. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioPitch(int pitch) = 0; + + /** + * Gets the duration of the media file. + * @param duration A reference to the duration of the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDuration(int64_t& duration) = 0; + + /** + * Gets the current playback position of the media file. + * @param currentPosition A reference to the current playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlayPosition(int64_t& pos) = 0; + + virtual int getStreamCount(int64_t& count) = 0; + + virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* info) = 0; + + /** + * Sets whether to loop the media file for playback. + * @param loopCount the number of times looping the media file. + * - 0: Play the audio effect once. + * - 1: Play the audio effect twice. + * - -1: Play the audio effect in a loop indefinitely, until stopEffect() or stop() is called. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLoopCount(int loopCount) = 0; + + /** + * Change playback speed + * @param speed the value of playback speed ref [50-400] + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackSpeed(int speed) = 0; + + /** + * Slect playback audio track of the media file + * @param index the index of the audio track in media file + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int selectAudioTrack(int index) = 0; + + /** + * Selects multi audio track of the media file for playback or publish to channel. + * @param playoutTrackIndex The index of the audio track in media file for local playback. + * @param publishTrackIndex The index of the audio track in the media file published to the remote. + * + * @note + * You can obtain the streamIndex of the audio track by calling getStreamInfo.. + * If you want to use selectMultiAudioTrack, you need to open the media file with openWithMediaSource and set enableMultiAudioTrack to true. + * + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - -2: Invalid argument. Argument must be greater than or equal to zero. + * - -8: Invalid State.You must open the media file with openWithMediaSource and set enableMultiAudioTrack to true + */ + virtual int selectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex) = 0; + + /** + * change player option before play a file + * @param key the key of the option param + * @param value the value of option param + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlayerOption(const char* key, int value) = 0; + + /** + * change player option before play a file + * @param key the key of the option param + * @param value the value of option param + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlayerOption(const char* key, const char* value) = 0; + /** + * take screenshot while playing video + * @param filename the filename of screenshot file + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int takeScreenshot(const char* filename) = 0; + + /** + * select internal subtitles in video + * @param index the index of the internal subtitles + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int selectInternalSubtitle(int index) = 0; + + /** + * set an external subtitle for video + * @param url The URL of the subtitle file that you want to load. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExternalSubtitle(const char* url) = 0; + + virtual media::base::MEDIA_PLAYER_STATE getState() = 0; + + /** + * @brief Turn mute on or off + * + * @param muted Whether to mute on + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int mute(bool muted) = 0; + + /** + * @brief Get mute state + * + * @param[out] muted Whether is mute on + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int getMute(bool& muted) = 0; + + /** + * @brief Adjust playback volume + * + * @param volume The volume value to be adjusted + * The volume can be adjusted from 0 to 400: + * 0: mute; + * 100: original volume; + * 400: Up to 4 times the original volume (with built-in overflow protection). + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int adjustPlayoutVolume(int volume) = 0; + + /** + * @brief Get the current playback volume + * + * @param[out] volume + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int getPlayoutVolume(int& volume) = 0; + + /** + * @brief adjust publish signal volume + * + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int adjustPublishSignalVolume(int volume) = 0; + + /** + * @brief get publish signal volume + * + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int getPublishSignalVolume(int& volume) = 0; + + /** + * @brief Set video rendering view + * + * @param view view object, windows platform is HWND + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int setView(media::base::view_t view) = 0; + + /** + * @brief Set video display mode + * + * @param renderMode Video display mode + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int setRenderMode(media::base::RENDER_MODE_TYPE renderMode) = 0; + + /** + * Registers a media player source observer. + * + * Once the media player source observer is registered, you can use the observer to monitor the state change of the media player. + * @param observer The pointer to the IMediaPlayerSourceObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; + + /** + * Releases the media player source observer. + * @param observer The pointer to the IMediaPlayerSourceObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; + + /** + * Register the audio frame observer. + * + * @param observer The pointer to the IAudioFrameObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Registers an audio observer. + * + * @param observer The audio observer, reporting the reception of each audio + * frame. See + * \ref media::base::IAudioFrameObserver "IAudioFrameObserver" for + * details. + * @param mode Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode) = 0; + + /** + * Releases the audio frame observer. + * @param observer The pointer to the IAudioFrameObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * @brief Register the player video observer + * + * @param observer observer object + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int registerVideoFrameObserver(media::base::IVideoFrameObserver* observer) = 0; + + /** + * @brief UnRegister the player video observer + * + * @param observer observer object + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_ERROR + */ + virtual int unregisterVideoFrameObserver(agora::media::base::IVideoFrameObserver* observer) = 0; + + /** + * Registers the audio frame spectrum observer. + * + * @param observer The pointer to the {@link media::base::IAudioSpectrumObserver IAudioSpectrumObserver} object. + * @param intervalInMS Sets the time interval(ms) between two consecutive audio spectrum callback. + * The default value is 100. This param should be larger than 10. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerMediaPlayerAudioSpectrumObserver(media::IAudioSpectrumObserver* observer, int intervalInMS) = 0; + + /** + * Releases the audio frame spectrum observer. + * @param observer The pointer to the {@link media::base::IAudioSpectrumObserver IAudioSpectrumObserver} object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterMediaPlayerAudioSpectrumObserver(media::IAudioSpectrumObserver* observer) = 0; + + /** + * @brief Set dual-mono output mode of the music file. + * + * @param mode dual mono mode. See #agora::media::AUDIO_DUAL_MONO_MODE + */ + virtual int setAudioDualMonoMode(agora::media::base::AUDIO_DUAL_MONO_MODE mode) = 0; + + /** + * get sdk version and build number of player SDK. + * @return String of the SDK version. + */ + virtual const char* getPlayerSdkVersion() = 0; + + /** + * Get the current play src. + * @return + * - current play src of raw bytes. + */ + virtual const char* getPlaySrc() = 0; + + + /** + * Open the Agora CDN media source. + * @param src The src of the media file that you want to play. + * @param startPos The playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithAgoraCDNSrc(const char* src, int64_t startPos) = 0; + + /** + * Gets the number of Agora CDN lines. + * @return + * - > 0: number of CDN. + * - <= 0: Failure. + */ + virtual int getAgoraCDNLineCount() = 0; + + /** + * Switch Agora CDN lines. + * @param index Specific CDN line index. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchAgoraCDNLineByIndex(int index) = 0; + + /** + * Gets the line of the current CDN. + * @return + * - >= 0: Specific line. + * - < 0: Failure. + */ + virtual int getCurrentAgoraCDNIndex() = 0; + + /** + * Enable automatic CDN line switching. + * @param enable Whether enable. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAutoSwitchAgoraCDN(bool enable) = 0; + + /** + * Update the CDN source token and timestamp. + * @param token token. + * @param ts ts. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int renewAgoraCDNSrcToken(const char* token, int64_t ts) = 0; + + /** + * Switch the CDN source when open a media through "openWithAgoraCDNSrc" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchAgoraCDNSrc(const char* src, bool syncPts = false) = 0; + + /** + * Switch the media source when open a media through "open" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchSrc(const char* src, bool syncPts = true) = 0; + + /** + * Preload a media source + * @param src Specific src. + * @param startPos The starting position (ms) for playback. Default value is 0. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preloadSrc(const char* src, int64_t startPos) = 0; + + /** + * Play a pre-loaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int playPreloadedSrc(const char* src) = 0; + + /** + * Unload a preloaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unloadSrc(const char* src) = 0; + + /** + * Set spatial audio params for the music file. It can be called after the media player + * was created. + * + * @param params See #agora::SpatialAudioParams. If it's + * not set, then the spatial audio will be disabled; or it will be enabled. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSpatialAudioParams(const SpatialAudioParams& params) = 0; + + /** + * Set sound position params for the music file. It can be called after the media player + * was created. + * + *@param pan The sound position of the music file. The value ranges from -1.0 to 1.0: + *- 0.0: the music sound comes from the front. + *- -1.0: the music sound comes from the left. + *- 1.0: the music sound comes from the right. + *@param gain Gain of the music. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the music). The smaller the value, the less the gain. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSoundPositionParams(float pan, float gain) = 0; + + /** + * Set delay of playback to local device. + * + *@param delay_ms The delay_ms for playback to local device: + * - for default, the pipeline default is 160ms, 16 buffer before pipeline start consuming + * - for playeffect, it need to play as soon as possible for short file, sugguest to used 50ms + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioPlaybackDelay(int delay_ms) = 0; + +}; + +/** + * This class is used to set and manage the player cache, implemented in the + * form of a singleton, independent of the player. + */ +class IMediaPlayerCacheManager { +public: + /** + * Delete the longest used cache file in order to release some of the cache file disk usage. + * (usually used when the cache quota notification is received) + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeAllCaches() = 0; + /** + * Remove the latest media resource cache file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeOldCache() = 0; + /** + * Remove the cache file by uri, setting by MediaSource. + * @param uri URI,identify the uniqueness of the property, Set from `MeidaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeCacheByUri(const char *uri) = 0; + /** + * Set cache file path that files will be saved to. + * @param path file path. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCacheDir(const char *path) = 0; + /** + * Set the maximum number of cached files. + * @param count maximum number of cached files. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMaxCacheFileCount(int count) = 0; + /** + * Set the maximum size of cache file disk usage. + * @param cacheSize total size of the largest cache file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMaxCacheFileSize(int64_t cacheSize) = 0; + /** + * Whether to automatically delete old cache files when the cache file usage reaches the limit. + * @param enable enable the player to automatically clear the cache. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAutoRemoveCache(bool enable) = 0; + /** + * Get the cache directory. + * @param path cache path, recieve a pointer to be copied to. + * @param length the length to be copied. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getCacheDir(char* path, int length) = 0; + /** + * Get the maximum number of cached files. + * @return + * > 0: file count. + * - < 0: Failure. + */ + virtual int getMaxCacheFileCount() = 0; + /** + * Get the total size of the largest cache file + * @return + * > 0: file size. + * - < 0: Failure. + */ + virtual int64_t getMaxCacheFileSize() = 0; + /** + * Get the number of all cache files. + * @return + * > 0: file count. + * - < 0: Failure. + */ + virtual int getCacheFileCount() = 0; + + virtual ~IMediaPlayerCacheManager(){}; +}; + +} //namespace rtc +} // namespace agora + +AGORA_API agora::rtc::IMediaPlayerCacheManager* AGORA_CALL getMediaPlayerCacheManager(); \ No newline at end of file diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaPlayerSource.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaPlayerSource.h new file mode 100644 index 0000000..8e27e12 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaPlayerSource.h @@ -0,0 +1,486 @@ +// +// Agora SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraMediaPlayerTypes.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +class IMediaPlayerSourceObserver; + +/** + * The IMediaPlayerSource class provides access to a media player source. To playout multiple media sources simultaneously, + * create multiple media player source objects. + */ +class IMediaPlayerSource : public RefCountInterface { +protected: + virtual ~IMediaPlayerSource() {} + +public: + + /** + * Gets the unique source ID of the media player source. + * @return + * - >=0: The source ID of this media player source. + * - < 0: Failure. + */ + virtual int getSourceId() const = 0; + + /** + * Opens a media file with a specified URL. + * @param url The path of the media file. Both the local path and online path are supported. + * @param startPos The starting position (ms) for playback. Default value is 0. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int open(const char* url, int64_t startPos) = 0; + + /** + * @deprecated + * @brief Open media file or stream with custom soucrce. + * @param startPos Set the starting position for playback, in seconds + * @param observer dataProvider object + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithCustomSource(int64_t startPos, media::base::IMediaPlayerCustomDataProvider* provider) = 0; + + /** + * Opens a media file with a media file source. + * @param source Media file source that you want to play, see `MediaSource` + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithMediaSource(const media::base::MediaSource &source) = 0; + + /** + * Plays the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int play() = 0; + + /** + * Pauses the playback. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pause() = 0; + + /** + * Stops the playback. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stop() = 0; + + /** + * Resumes the playback. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resume() = 0; + + /** + * Sets the playback position of the media file. + * @param newPos The new playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int seek(int64_t newPos) = 0; + + /** + * Gets the duration of the media file. + * @param [out] duration A reference to the duration of the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDuration(int64_t& duration) = 0; + + /** + * Gets the current playback position of the media file. + * @param [out] pos A reference to the current playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int getPlayPosition(int64_t& pos) = 0; + + /** + * Gets the number of the media streams in the media source. + * @param [out] count The number of the media streams in the media source. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int getStreamCount(int64_t& count) = 0; + + /** + * Gets the detailed information of a media stream. + * @param index The index of the media stream. + * @param [out] info The detailed information of the media stream. See \ref media::base::PlayerStreamInfo "PlayerStreamInfo" for details. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* info) = 0; + + /** + * Sets whether to loop the media file for playback. + * @param loopCount The number of times of looping the media file. + * - 0: Play the media file once. + * - 1: Play the media file twice. + * - -1: Play the media file in a loop indefinitely, until {@link stop} is called. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setLoopCount(int64_t loopCount) = 0; + + /** + * Changes the playback speed. + * @param speed The playback speed ref [50-400]. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setPlaybackSpeed(int speed) = 0; + + /** + * Selects an audio track of the media file for playback. + * @param index The index of the audio track in media file. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int selectAudioTrack(int64_t index) = 0; + + /** + * Selects multi audio track of the media file for playback or publish to channel. + * @param playoutTrackIndex The index of the audio track in media file for local playback. + * @param publishTrackIndex The index of the audio track in the media file published to the remote. + * + * @note + * You can obtain the streamIndex of the audio track by calling getStreamInfo.. + * If you want to use selectMultiAudioTrack, you need to open the media file with openWithMediaSource and set enableMultiAudioTrack to true. + * + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - -2: Invalid argument. Argument must be greater than or equal to zero. + * - -8: Invalid State.You must open the media file with openWithMediaSource and set enableMultiAudioTrack to true + */ + virtual int selectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex) = 0; + + /** + * Changes the player option before playing a file. + * @param key The key of the option paramemter. + * @param value The value of option parameter. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setPlayerOption(const char* key, int64_t value) = 0; + + /** + * Changes the player option before playing a file. + * @param key The key of the option paramemter. + * @param value The value of option parameter. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setPlayerOption(const char* key, const char* value) = 0; + + /** + * Takes a screenshot when playing a video file. + * @param filename The filename of the screenshot file. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int takeScreenshot(const char* filename) = 0; + + /** + * Selects internal subtitles for a video file. + * @param index The index of the internal subtitles. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int selectInternalSubtitle(int64_t index) = 0; + + /** + * Sets an external subtitle file for a video file. + * @param url The URL of the subtitle file. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int setExternalSubtitle(const char* url) = 0; + + /** + * Gets the playback state. + * @return The current playback state. See {@link media::base::MEDIA_PLAYER_STATE MEDIA_PLAYER_STATE} for details. + */ + virtual media::base::MEDIA_PLAYER_STATE getState() = 0; + + /** + * Registers a media player source observer. + * + * Once the media player source observer is registered, you can use the observer to monitor the state change of the media player. + * @param observer The pointer to the IMediaPlayerSourceObserver object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; + + /** + * Releases the media player source observer. + * @param observer The pointer to the IMediaPlayerSourceObserver object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; + + /** + * Registers the audio frame observer. + * + * @param observer The pointer to the {@link media::base::IAudioFrameObserver IAudioFrameObserver} object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Releases the audio frame observer. + * @param observer The pointer to the {@link media::base::IAudioFrameObserver IAudioFrameObserver} object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual int unregisterAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Open the Agora CDN media source. + * @param src The src of the media file that you want to play. + * @param startPos The playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int openWithAgoraCDNSrc(const char* src, int64_t startPos) = 0; + + /** + * Gets the number of Agora CDN lines. + * @return + * - > 0: number of CDN. + * - <= 0: Failure. + */ + virtual int getAgoraCDNLineCount() = 0; + + + /** + * Switch Agora CDN lines. + * @param index Specific CDN line index. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchAgoraCDNLineByIndex(int index) = 0; + + /** + * Gets the line of the current CDN. + * @return + * - >= 0: Specific line. + * - < 0: Failure. + */ + virtual int getCurrentAgoraCDNIndex() = 0; + + /** + * Enable automatic CDN line switching. + * @param enable Whether enable. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAutoSwitchAgoraCDN(bool enable) = 0; + + /** + * Update the CDN source token and timestamp. + * @param token token. + * @param ts ts. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int renewAgoraCDNSrcToken(const char* token, int64_t ts) = 0; + + /** + * Switch the CDN source when open a media through "openWithAgoraCDNSrc" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchAgoraCDNSrc(const char* src, bool syncPts = false) = 0; + + /** + * Switch the media source when open a media through "open" API + * @param src Specific src. + * @param syncPts Live streaming must be set to false. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchSrc(const char* src, bool syncPts) = 0; + + /** + * Preload a media source + * @param src Specific src. + * @param startPos The starting position (ms) for playback. Default value is 0. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preloadSrc(const char* src, int64_t startPos) = 0; + + /** + * Unload a preloaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unloadSrc(const char* src) = 0; + + /** + * Play a pre-loaded media source + * @param src Specific src. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int playPreloadedSrc(const char* src) = 0; + +}; + +/** + * This class class reports runtime events to the applications. + */ +class IMediaPlayerSourceObserver { + public: + virtual ~IMediaPlayerSourceObserver() {} + + /** + * @brief Reports the playback state change. + * + * When the state of the playback changes, the SDK triggers this callback to report the new playback state and the reason or error for the change. + * @param state The new playback state after change. See {@link media::base::MEDIA_PLAYER_STATE MEDIA_PLAYER_STATE}. + * @param ec The player's error code. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + */ + virtual void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, + media::base::MEDIA_PLAYER_ERROR ec) = 0; + + /** + * @brief Reports current playback progress. + * + * The callback occurs once every one second during the playback and reports the current playback progress. + * @param positionMs Current playback progress (milisecond). + * @param timestampMs Current NTP(Network Time Protocol) time (milisecond). + */ + virtual void onPositionChanged(int64_t positionMs, int64_t timestampMs) = 0; + + /** + * @brief Reports the playback event. + * + * - After calling the `seek` method, the SDK triggers the callback to report the results of the seek operation. + * - After calling the `selectAudioTrack` method, the SDK triggers the callback to report that the audio track changes. + * + * @param eventCode The playback event. See {@link media::base::MEDIA_PLAYER_EVENT MEDIA_PLAYER_EVENT}. + * @param elapsedTime The playback elapsed time. + * @param message The playback message. + */ + virtual void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) = 0; + + /** + * @brief Occurs when the metadata is received. + * + * The callback occurs when the player receives the media metadata and reports the detailed information of the media metadata. + * @param data The detailed data of the media metadata. + * @param length The data length (bytes). + */ + virtual void onMetaData(const void* data, int length) = 0; + + + /** + * @brief Triggered when play buffer updated, once every 1 second + * + * @param int cached buffer during playing, in milliseconds + */ + virtual void onPlayBufferUpdated(int64_t playCachedBuffer) = 0; + + + /** + * @brief Triggered when the player preloadSrc + * + * @param event + */ + virtual void onPreloadEvent(const char* src, media::base::PLAYER_PRELOAD_EVENT event) = 0; + + /** + * @brief Occurs when one playback of the media file is completed. + */ + virtual void onCompleted() = 0; + + /** + * @brief AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken(const char* src). + */ + virtual void onAgoraCDNTokenWillExpire() = 0; + + /** + * @brief Reports current playback source bitrate changed. + * @brief Reports current playback source info changed. + * + * @param from Streaming media information before the change. + * @param to Streaming media information after the change. + */ + virtual void onPlayerSrcInfoChanged(const media::base::SrcInfo& from, const media::base::SrcInfo& to) = 0; + + /** + * @brief Triggered when media player information updated. + * + * @param info Include information of media player. + */ + virtual void onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo& info) = 0; + + /** + * @brief Triggered every 200 millisecond ,update player current volume range [0,255] + * + * @param volume volume of current player. + */ + virtual void onAudioVolumeIndication(int volume) = 0; +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaRecorder.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaRecorder.h new file mode 100644 index 0000000..e805f28 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaRecorder.h @@ -0,0 +1,26 @@ +// +// Agora SDK +// +// Copyright (c) 2022 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "IAgoraRtcEngineEx.h" + +namespace agora { +namespace rtc { + +class IMediaRecorder { + protected: + virtual ~IMediaRecorder() {} + public: + virtual int setMediaRecorderObserver(const RtcConnection& connection, media::IMediaRecorderObserver* callback) = 0; + virtual int startRecording(const RtcConnection& connection, const media::MediaRecorderConfiguration& config) = 0; + virtual int stopRecording(const RtcConnection& connection) = 0; + virtual void release() = 0; +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaStreamingSource.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaStreamingSource.h new file mode 100644 index 0000000..e1267b6 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMediaStreamingSource.h @@ -0,0 +1,332 @@ +// +// Agora SDK +// Copyright (c) 2019 Agora.io. All rights reserved. +// +// Created by xiaohua.lu in 2020-03. +// CodeStyle: Google C++ +// + +#pragma once // NOLINT(build/header_guard) + + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraMediaPlayerTypes.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + + +class IMediaStreamingSourceObserver; + + +/** + * @brief The error code of streaming source + * + */ +enum STREAMING_SRC_ERR { + STREAMING_SRC_ERR_NONE = 0, ///< no error + STREAMING_SRC_ERR_UNKNOWN = 1, ///< unknown error + STREAMING_SRC_ERR_INVALID_PARAM = 2, ///< invalid parameter + STREAMING_SRC_ERR_BAD_STATE = 3, ///< bad status + STREAMING_SRC_ERR_NO_MEM = 4, ///< not enough memory + STREAMING_SRC_ERR_BUFFER_OVERFLOW = 5, ///< buffer overflow + STREAMING_SRC_ERR_BUFFER_UNDERFLOW = 6, ///< buffer underflow + STREAMING_SRC_ERR_NOT_FOUND = 7, ///< buffer underflow + STREAMING_SRC_ERR_TIMEOUT = 8, ///< buffer underflow + STREAMING_SRC_ERR_EXPIRED = 9, ///< expired + STREAMING_SRC_ERR_UNSUPPORTED = 10, ///< unsupported + STREAMING_SRC_ERR_NOT_EXIST = 11, ///< component not exist + STREAMING_SRC_ERR_EXIST = 12, ///< component already exist + STREAMING_SRC_ERR_OPEN = 13, ///< fail to IO open + STREAMING_SRC_ERR_CLOSE = 14, ///< fail to IO close + STREAMING_SRC_ERR_READ = 15, ///< fail to IO read + STREAMING_SRC_ERR_WRITE = 16, ///< fail to IO write + STREAMING_SRC_ERR_SEEK = 17, ///< fail to IO seek + STREAMING_SRC_ERR_EOF = 18, ///< reach to IO EOF, can do nothing + STREAMING_SRC_ERR_CODECOPEN = 19, ///< fail to codec open + STREAMING_SRC_ERR_CODECCLOSE = 20, ///< fail to codec close + STREAMING_SRC_ERR_CODECPROC = 21, ///< fail to codec process +}; + + + +/** + * @brief The state machine of Streaming Source + * + */ +enum STREAMING_SRC_STATE { + STREAMING_SRC_STATE_CLOSED = 0, ///< streaming source still closed, can do nothing + STREAMING_SRC_STATE_OPENING = 1, ///< after call open() method and start parsing streaming source + STREAMING_SRC_STATE_IDLE = 2, ///< streaming source is ready waiting for play + STREAMING_SRC_STATE_PLAYING = 3, ///< after call play() method, playing & pushing the AV data + STREAMING_SRC_STATE_SEEKING = 4, ///< after call seek() method, start seeking poisition + STREAMING_SRC_STATE_EOF = 5, ///< The position is located at end, can NOT playing + STREAMING_SRC_STATE_ERROR = 6, ///< The error status and can do nothing except close +}; + + +/** + * @brief The input SEI data + * + */ +struct InputSeiData { + int32_t type; ///< SEI type + int64_t timestamp; ///< the frame timestamp which be attached + int64_t frame_index; ///< the frame index which be attached + uint8_t* private_data; ///< SEI really data + int32_t data_size; ///< size of really data +}; + + + +/** + * @brief The IMediaStreamingSource class provides access to a media streaming source demuxer. + * To playout multiple stream sources simultaneously, + * create multiple media stream source objects. + */ +class IMediaStreamingSource : public RefCountInterface { +public: + virtual ~IMediaStreamingSource() {}; + + + /** + * @brief Opens a media streaming source with a specified URL. + * @param url The path of the media file. Both the local path and online path are supported. + * @param startPos The starting position (ms) for pushing. Default value is 0. + * @param auto_play whether start playing after opened + * @return + * - 0: Success. + * - < 0: Failure + */ + virtual int open(const char* url, int64_t start_pos, bool auto_play = true) = 0; + + /** + * @brief Close current media streaming source + * @return + * - 0: Success. + * - < 0: Failure + */ + virtual int close() = 0; + + /** + * @brief Gets the unique source ID of the streaming source. + * @return + * - ≧ 0: The source ID of this media player source. + * - < 0: Failure. + */ + virtual int getSourceId() const = 0; + + /** + * @brief Retrieve whether video stream is valid + * @return: valid or invalid + */ + virtual bool isVideoValid() = 0; + + /** + * @brief Retrieve whether audio stream is valid + * @return: valid or invalid + */ + virtual bool isAudioValid() = 0; + + /** + * @brief Gets the duration of the streaming source. + * @param [out] duration A reference to the duration of the media file. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int getDuration(int64_t& duration) = 0; + + /** + * @brief Gets the number of the streming source + * @param [out] count The number of the media streams in the media source. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int getStreamCount(int64_t& count) = 0; + + /** + * @brief Gets the detailed information of a media stream. + * @param index The index of the media stream. + * @param [out] out_info The detailed information of the media stream. See \ref media::base::PlayerStreamInfo "PlayerStreamInfo" for details. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* out_info) = 0; + + /** + * @brief Sets whether to loop the streaming source for playback. + * @param loop_count The number of times of looping the media file. + * - 1: Play the media file once. + * - 2: Play the media file twice. + * - <= 0: Play the media file in a loop indefinitely, until {@link stop} is called. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int setLoopCount(int64_t loop_count) = 0; + + /** + * @brief Play & push the streaming source. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int play() = 0; + + /** + * @brief Pauses the playing & pushing of the streaming source, Keep current position. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int pause() = 0; + + /** + * @brief Stop the playing & pushing of the streaming source, set the position to 0. + * @return + * - 0: Success. + * - < 0: Failure.See {@link STREAMINGSRC_ERR}. + */ + virtual int stop() = 0; + + /** + * @brief Sets the playback position of the streaming source. + * After seek done, it will return to previous status + * @param newPos The new playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int seek(int64_t new_pos) = 0; + + /** + * @brief Gets the current playback position of the media file. + * @param [out] pos A reference to the current playback position (ms). + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int getCurrPosition(int64_t& pos) = 0; + + /** + * @breif Gets the status of current streaming source. + * @return The current state machine + */ + virtual STREAMING_SRC_STATE getCurrState() = 0; + + /** + * @brief append the SEI data which can be sent attached to video packet + * @param type SEI type + * @param timestamp the video frame timestamp which attached to + * @param frame_index the video frame timestamp which attached to + * + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int appendSeiData(const InputSeiData& inSeiData) = 0; + + /** + * Registers a media player source observer. + * + * Once the media player source observer is registered, you can use the observer to monitor the state change of the media player. + * @param observer The pointer to the IMediaStreamingSource object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int registerObserver(IMediaStreamingSourceObserver* observer) = 0; + + /** + * Releases the media player source observer. + * @param observer The pointer to the IMediaStreamingSource object. + * @return + * - 0: Success. + * - < 0: Failure. See {@link STREAMINGSRC_ERR}. + */ + virtual int unregisterObserver(IMediaStreamingSourceObserver* observer) = 0; + + /** + * @brief Parse a media information with a specified URL. + * @param url : The path of the media file. Both the local path and online path are supported. + * @param video_info : The output video information, It means no video track while video_info.streamIndex less than 0 + * @param audio_info : The output audio information, It means no audio track while audio_info.streamIndex less than 0 + * @return + * - 0: Success. + * - < 0: Failure + */ + virtual int parseMediaInfo(const char* url, + media::base::PlayerStreamInfo& video_info, + media::base::PlayerStreamInfo& audio_info) = 0; + +}; + + + +/** + * @brief This observer interface of media streaming source + */ +class IMediaStreamingSourceObserver { + public: + virtual ~IMediaStreamingSourceObserver() {}; + + + /** + * @brief Reports the playback state change. + * When the state of the playback changes, + * the SDK triggers this callback to report the new playback state + * and the reason or error for the change. + * @param state The new playback state after change. See {@link STREAMING_SRC_STATE}. + * @param ec The player's error code. See {@link STREAMINGSRC_ERR}. + */ + virtual void onStateChanged(STREAMING_SRC_STATE state, STREAMING_SRC_ERR err_code) = 0; + + /** + * @brief Triggered when file is opened + * @param err_code The error code + * @return None + */ + virtual void onOpenDone(STREAMING_SRC_ERR err_code) = 0; + + /** + * @brief Triggered when seeking is done + * @param err_code The error code + * @return None + */ + virtual void onSeekDone(STREAMING_SRC_ERR err_code) = 0; + + /** + * @brief Triggered when playing is EOF + * @param progress_ms the progress position + * @param repeat_count means repeated count of playing + */ + virtual void onEofOnce(int64_t progress_ms, int64_t repeat_count) = 0; + + /** + * @brief Reports current playback progress. + * The callback triggered once every one second during the playing status + * @param position_ms Current playback progress (millisecond). + */ + virtual void onProgress(int64_t position_ms) = 0; + + /** + * @brief Occurs when the metadata is received. + * The callback occurs when the player receives the media metadata + * and reports the detailed information of the media metadata. + * @param data The detailed data of the media metadata. + * @param length The data length (bytes). + */ + virtual void onMetaData(const void* data, int length) = 0; + +}; + + + +} //namespace rtc +} // namespace agora + diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMusicContentCenter.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMusicContentCenter.h new file mode 100644 index 0000000..2de2a76 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraMusicContentCenter.h @@ -0,0 +1,539 @@ +// +// Agora Media SDK +// +// Created by FanYuanYuan in 2022-05. +// Copyright (c) 2022 Agora IO. All rights reserved. +// + +#pragma once + +#include "AgoraRefPtr.h" +#include "IAgoraMediaPlayer.h" + +namespace agora { +namespace rtc { + +typedef enum +{ + /** + * 0: No error occurs and preload succeeds. + */ + kPreloadStatusCompleted = 0, + + /** + * 1: A general error occurs. + */ + kPreloadStatusFailed = 1, + + /** + * 2: The media file is preloading. + */ + kPreloadStatusPreloading = 2, + /** + * 3: The media file is removed. + */ + kPreloadStatusRemoved = 3, +} PreloadStatusCode; + +typedef enum +{ + /** + * 0: No error occurs and request succeeds. + */ + kMusicContentCenterStatusOk = 0, + /** + * 1: A general error occurs. + */ + kMusicContentCenterStatusErr = 1, + /** + * 2: The gateway error. There are several possible reasons: + * - Token is expired. Check if your token is expired. + * - Token is invalid. Check the type of token you passed in. + * - Network error. Check your network. + */ + kMusicContentCenterStatusErrGateway = 2, + /** + * 3: Permission and resource error. There are several possible reasons: + * - Your appid may not have the mcc permission. Please contact technical support + * - The resource may not exist. Please contact technical support + */ + kMusicContentCenterStatusErrPermissionAndResource = 3, + /** + * 4: Internal data parse error. Please contact technical support + */ + kMusicContentCenterStatusErrInternalDataParse = 4, + /** + * 5: Music loading error. Please contact technical support + */ + kMusicContentCenterStatusErrMusicLoading = 5, + /** + * 6: Music decryption error. Please contact technical support + */ + kMusicContentCenterStatusErrMusicDecryption = 6, + /** + * 7: Http internal error. suggest retry later. + */ + kMusicContentCenterStatusErHttpInternalError = 7, +} MusicContentCenterStatusCode; + +typedef struct +{ + /** + * Name of the music chart + */ + const char* chartName; + /** + * Id of the music chart, which is used to get music list + */ + int32_t id; +} MusicChartInfo; + +enum MUSIC_CACHE_STATUS_TYPE { + /** + * 0: Music is already cached. + */ + MUSIC_CACHE_STATUS_TYPE_CACHED = 0, + /** + * 1: Music is being cached. + */ + MUSIC_CACHE_STATUS_TYPE_CACHING = 1 +}; + +struct MusicCacheInfo { + /** + * The songCode of music. + */ + int64_t songCode; + /** + * The cache status of the music. + */ + MUSIC_CACHE_STATUS_TYPE status; + MusicCacheInfo():songCode(0), status(MUSIC_CACHE_STATUS_TYPE_CACHED) {} +}; + +class MusicChartCollection : public RefCountInterface { +public: + virtual int getCount() = 0; + virtual MusicChartInfo* get(int index) = 0; +protected: + virtual ~MusicChartCollection() = default; +}; + +struct MvProperty +{ + /** + * The resolution of the mv + */ + const char* resolution; + /** + * The bandwidth of the mv + */ + const char* bandwidth; +}; + +struct ClimaxSegment +{ + /** + * The start time of climax segment + */ + int32_t startTimeMs; + /** + * The end time of climax segment + */ + int32_t endTimeMs; +}; + +struct Music +{ + /** + * The songCode of music + */ + int64_t songCode; + /** + * The name of music + */ + const char* name; + /** + * The singer of music + */ + const char* singer; + /** + * The poster url of music + */ + const char* poster; + /** + * The release time of music + */ + const char* releaseTime; + /** + * The duration (in seconds) of music + */ + int32_t durationS; + /** + * The type of music + * 1, mp3 with instrumental accompaniment and original + * 2, mp3 only with instrumental accompaniment + * 3, mp3 only with original + * 4, mp4 with instrumental accompaniment and original + * 5, mv only + * 6, new type mp4 with instrumental accompaniment and original + * detail at document of music media center + */ + int32_t type; + /** + * The pitch type of music. + * 1, xml lyric has pitch + * 2, lyric has no pitch + */ + int32_t pitchType; + /** + * The number of lyrics available for the music + */ + int32_t lyricCount; + /** + * The lyric list of music + * 0, xml + * 1, lrc + */ + int32_t* lyricList; + /** + * The number of climax segments of the music + */ + int32_t climaxSegmentCount; + /** + * The climax segment list of music + */ + ClimaxSegment* climaxSegmentList; + /** + * The number of mv of the music + * If this value is greater than zero, it means the current music has MV resource + */ + int32_t mvPropertyCount; + /** + * The mv property list of music + */ + MvProperty* mvPropertyList; +}; + +class MusicCollection : public RefCountInterface { +public: + virtual int getCount() = 0; + virtual int getTotal() = 0; + virtual int getPage() = 0; + virtual int getPageSize() = 0; + virtual Music* getMusic(int32_t index) = 0; +protected: + virtual ~MusicCollection() = default; +}; + + +class IMusicContentCenterEventHandler { +public: + /** + * The music chart result callback; occurs when getMusicCharts method is called. + * + * @param requestId The request id is same as that returned by getMusicCharts. + * @param result The result of music chart collection + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onMusicChartsResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode errorCode) = 0; + + /** + * Music collection, occurs when getMusicCollectionByMusicChartId or searchMusic method is called. + * + * @param requestId The request id is same as that returned by getMusicCollectionByMusicChartId or searchMusic + * @param result The result of music collection + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onMusicCollectionResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode errorCode) = 0; + + /** + * Lyric url callback of getLyric, occurs when getLyric is called + * + * @param requestId The request id is same as that returned by getLyric + * @param songCode Song code + * @param lyricUrl The lyric url of this music + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onLyricResult(const char* requestId, int64_t songCode, const char* lyricUrl, MusicContentCenterStatusCode errorCode) = 0; + + /** + * Simple info callback of getSongSimpleInfo, occurs when getSongSimpleInfo is called + * + * @param requestId The request id is same as that returned by getSongSimpleInfo. + * @param songCode Song code + * @param simpleinfo The metadata of the music. + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onSongSimpleInfoResult(const char* requestId, int64_t songCode, const char* simpleInfo, MusicContentCenterStatusCode errorCode) = 0; + + /** + * Preload process callback, occurs when preload is called + * + * @param requestId The request id is same as that returned by preload. + * @param songCode Song code + * @param percent Preload progress (0 ~ 100) + * @param lyricUrl The lyric url of this music + * @param status Preload status; see PreloadStatusCode. + * @param errorCode The status of the request. See MusicContentCenterStatusCode + */ + virtual void onPreLoadEvent(const char* requestId, int64_t songCode, int percent, const char* lyricUrl, PreloadStatusCode status, MusicContentCenterStatusCode errorCode) = 0; + + virtual ~IMusicContentCenterEventHandler() {}; +}; + +struct MusicContentCenterConfiguration { + /** + * The app ID of the project that has enabled the music content center + */ + const char *appId; + /** + * Music content center need token to connect with server + */ + const char *token; + /** + * The user ID when using music content center. It can be different from that of the rtc product. + */ + int64_t mccUid; + /** + * The max number which the music content center caches cannot exceed 50. + */ + int32_t maxCacheSize; + /** + * The mccdomain, used to control the domain name of music content center, usually developer do not need to set it. Only under Tech supporter's help, can set the value. + * @technical preview + */ + const char* mccDomain; + /** + * Event handler to get callback result. + */ + IMusicContentCenterEventHandler* eventHandler; + MusicContentCenterConfiguration():appId(nullptr),token(nullptr),eventHandler(nullptr),mccUid(0),maxCacheSize(10), mccDomain(nullptr){} + MusicContentCenterConfiguration(const char*appid,const char* token,int64_t id,IMusicContentCenterEventHandler* handler,int32_t maxSize = 10, const char* apiurl = nullptr): + appId(appid),token(token),mccUid(id),eventHandler(handler),maxCacheSize(maxSize), mccDomain(apiurl){} +}; + +class IMusicPlayer : public IMediaPlayer { +protected: + virtual ~IMusicPlayer() {}; + +public: + IMusicPlayer() {}; + using IMediaPlayer::open; + /** + * Open a media file with specified parameters. + * + * @param songCode The identifier of the media file that you want to play. + * @param startPos The playback position (ms) of the music file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int open(int64_t songCode, int64_t startPos = 0) = 0; +}; + +class IMusicContentCenter +{ +protected: + virtual ~IMusicContentCenter(){}; +public: + IMusicContentCenter() {}; + + /** + * Initializes the IMusicContentCenter + * Set token of music content center and other params + * + * @param configuration + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initialize(const MusicContentCenterConfiguration & configuration) = 0; + + /** + * Renew token of music content center + * + * @param token The new token. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int renewToken(const char* token) = 0; + + /** + * release music content center resource. + * + */ + virtual void release() = 0; + + /** + * register event handler. + */ + virtual int registerEventHandler(IMusicContentCenterEventHandler* eventHandler) = 0; + + /** + * unregister event handler. + */ + virtual int unregisterEventHandler() = 0; + + /** + * Creates a music player source object and return its pointer. + * @return + * - The pointer to \ref rtc::IMusicPlayer "IMusicPlayer", + * if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ + virtual agora_refptr createMusicPlayer() = 0; + + /** + * Get music chart collection of music. + * If the method call succeeds, get result from the + * \ref agora::rtc::IMusicContentCenterEventHandler::onMusicChartsResult + * "onMusicChartsResult" callback + * @param requestId The request id you will get of this query, format is uuid. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMusicCharts(agora::util::AString& requestId) = 0; + + /** + * Get music collection of the music chart by musicChartId and page info. + * If the method call success, get result from the + * \ref agora::rtc::IMusicContentCenterEventHandler::onMusicCollectionResult + * "onMusicCollectionResult" callback + * @param requestId The request id you will get of this query, format is uuid. + * @param musicChartId The music chart id obtained from getMusicCharts. + * @param page The page of the music chart, starting from 1 + * @param pageSize The page size, max is 50. + * @param jsonOption The ext param, default is null. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMusicCollectionByMusicChartId(agora::util::AString& requestId, int32_t musicChartId, int32_t page, int32_t pageSize, const char* jsonOption = nullptr) = 0; + + /** + * Search music by keyword and page info. + * If the method call success, get result from the + * \ref agora::rtc::IMusicContentCenterEventHandler::onMusicCollectionResult + * "onMusicCollectionResult" callback + * @param requestId The request id you will get of this query, format is uuid. + * @param keyWord The key word to search. + * @param page The page of music search result , start from 1. + * @param pageSize The page size, max is 50. + * @param jsonOption The ext param, default is null. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int searchMusic(agora::util::AString& requestId, const char* keyWord, int32_t page, int32_t pageSize, const char* jsonOption = nullptr) = 0; + + /** + * Preload a media file with specified parameters. + * + * @deprecated This method is deprecated. Use preload(int64_t songCode) instead. + * + * @param songCode The identifier of the media file that you want to play. + * @param jsonOption The ext param, default is null. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preload(int64_t songCode, const char* jsonOption) __deprecated = 0; + + /** + * Preload a media file with specified parameters. + * + * @param requestId The request id you will get of this query, format is uuid. + * @param songCode The identifier of the media file that you want to play. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preload(agora::util::AString& requestId, int64_t songCode) = 0; + + /** + * Remove a media file cache + * + * @param songCode The identifier of the media file that you want to play. + * @return + * - 0: Success; the cached media file is removed. + * - < 0: Failure. + */ + virtual int removeCache(int64_t songCode) = 0; + + /** + * Get cached media files. + * Before calling this API, you should allocate a memory buffer that stores the cached media file information, and pass the pointer of the buffer as the input parameter cacheInfo, and set the size of the memory buffer to cacheInfoSize. + * The sample code below illustrates how to request the cached media file information: + * + * cacheInfoSize = 10 // Allocate a memory buffer of 10 MusicCacheInfo size + * agora::rtc::MusicCacheInfo *infos = new agora::rtc::MusicCacheInfo[cacheInfoSize]; + * int ret = self.imcc->getCaches(infos, cacheInfoSize); + * if (ret < 0) { // error occurred! + * return; + * } + * std::cout << "the cache size:" << cacheInfoSize << std::endl; // The cache size: 5 + * + * + * @param cacheInfo An output parameter; A pointer to the memory buffer that stores the cached media file information. The memory buffer pointed to by cacheInfo should be allocated by yourself before calling this API. + * @param cacheInfoSize + * - Input: The number of MusicCacheInfo's size that you get from the memory. + * - Output: The actual number of MusicCacheInfo struct that is returned. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getCaches(MusicCacheInfo *cacheInfo, int32_t* cacheInfoSize) = 0; + + /** + * Check if the media file is preloaded + * + * @param songCode The identifier of the media file that you want to play. + * @return + * - 0: Success, file is preloaded. + * - < 0: Failure. + */ + virtual int isPreloaded(int64_t songCode) = 0; + + /** + * Get lyric of the music. + * + * @param requestId The request id you will get of this query, format is uuid. + * @param songCode The identifier of the media file that you want to play. + * @param LyricType The type of the lyric file. 0:xml or 1:lrc. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getLyric(agora::util::AString& requestId, int64_t songCode, int32_t LyricType = 0) = 0; + + /** + * Gets the metadata of a specific music. Once this method is called, the SDK triggers the onSongSimpleInfoResult callback to report the metadata of the music. + * + * @param requestId The request id you will get of this query, format is uuid. + * @param songCode The identifier of the media file. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getSongSimpleInfo(agora::util::AString& requestId, int64_t songCode) = 0; + + /** + * Get internal songCodeKey from songCode and jsonOption + * + * @param songCode The identifier of the media file. + * @param jsonOption An extention parameter. The default value is null. it’s a json-format string and the `key` and `value` can be customized according to your scenarios. + * @param internalSongCode The identifier of internal + * @return + * - 0: Success. + * - < 0: Failure. + */ + + virtual int getInternalSongCode(int64_t songCode, const char* jsonOption, int64_t& internalSongCode) = 0; + +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraParameter.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraParameter.h new file mode 100644 index 0000000..70ea593 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraParameter.h @@ -0,0 +1,307 @@ +// +// Agora Engine SDK +// +// Created by minbo in 2019-10. +// Copyright (c) 2019 Agora.io. All rights reserved. + +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#pragma once // NOLINT(build/header_guard) + +// external key +/** + * set the range of ports available for connection + * @example "{\"rtc.udp_port_range\":[4500, 5000]}" + */ +#define KEY_RTC_UDP_PORT_RANGE "rtc.udp_port_range" +/** + * set the list of ports available for connection + * @example "{\"rtc.udp_port_list\":[4501, 4502, 4503, 4504, 4505, 4506]}" + */ +#define KEY_RTC_UDP_PORT_LIST "rtc.udp_port_list" + +/** + * get the fd of sending socket available for connection + * note: set method is not supported. + */ +#define KEY_RTC_UDP_SEND_FD "rtc.udp_send_fd" + + /** + * set the video encoder mode (hardware or software) + */ +#define KEY_RTC_VIDEO_ENABLED_HW_ENCODER "engine.video.enable_hw_encoder" +#define KEY_RTC_VIDEO_HARDWARE_ENCODEING "che.hardware_encoding" +#define KEY_RTC_VIDEO_H264_HWENC "che.video.h264.hwenc" + /** + * set the hardware video encoder provider (nv for nvidia or qsv for intel) + */ +#define KEY_RTC_VIDEO_HW_ENCODER_PROVIDER "engine.video.hw_encoder_provider" + + /** + * set the video decoder mode (hardware or software) + */ +#define KEY_RTC_VIDEO_ENABLED_HW_DECODER "engine.video.enable_hw_decoder" +#define KEY_RTC_VIDEO_HARDWARE_DECODING "che.hardware_decoding" + + /** + * set the hardware video decoder provider (h264_cuvid(default) or h264_qsv) + */ +#define KEY_RTC_VIDEO_HW_DECODER_PROVIDER "engine.video.hw_decoder_provider" + + /** + * override the lua policy + */ +#define KEY_RTC_VIDEO_OVERRIDE_SMALLVIDEO_NOT_USE_HWENC_POLICY "engine.video.override_smallvideo_not_use_hwenc_policy" + +/** + * enable/disable video packet retransmission, enabled by default + */ +#define KEY_RTC_VIDEO_RESEND "rtc.video_resend" + +/** + * enable/disable audio packet retransmission, enabled by default +*/ +#define KEY_RTC_AUDIO_RESEND "rtc.audio_resend" + +/** + * set the bitrate ratio for video +*/ +#define KEY_RTC_VIDEO_BITRATE_ADJUST_RATIO "rtc.video.bitrate_adjust_ratio" + +/** + * set the minbitrate / bitrate ratio for video +*/ +#define KEY_RTC_VIDEO_MINBITRATE_RATIO "rtc.video.minbitrate_ratio" + +/** + * set the degradation preference +*/ +#define KEY_RTC_VIDEO_DEGRADATION_PREFERENCE "rtc.video.degradation_preference" + +/** + * set the degradation fps down step +*/ + +#define KEY_RTC_VIDEO_DEGRADATION_FPS_DOWN_STEP "rtc.video.degradation_fps_down_step" +/** + * set the degradation fps up step +*/ +#define KEY_RTC_VIDEO_DEGRADATION_FPS_UP_STEP "rtc.video.degradation_fps_up_step" + +/** + * set the duration ms for connection lost callback +*/ +#define KEY_RTC_CONNECTION_LOST_PERIOD "rtc.connection_lost_period" + +/** + * set the local ip +*/ +#define KEY_RTC_LOCAL_IP "rtc.local.ip" + +/** + * set the network interface +*/ +#define KEY_RTC_NETWORK_INTERFACE "rtc.network.interface" + +/** + * set the video codec type, such as "H264", "JPEG" + */ +#define KEY_RTC_VIDEO_CODEC_TYPE "engine.video.codec_type" +#define KEY_RTC_VIDEO_CODEC_INDEX "che.video.videoCodecIndex" +/** + * only use average QP for quality scaling +*/ +#define KEY_RTC_VIDEO_QUALITY_SCALE_ONLY_ON_AVERAGE_QP "engine.video.quality_scale_only_on_average_qp" + +/** + * low bound for quality scaling +*/ +#define KEY_RTC_VIDEO_H264_QP_THRESHOLD_LOW "engine.video.h264_qp_thresholds_low" + +/** + * high bound for quality scaling +*/ +#define KEY_RTC_VIDEO_H264_QP_THRESHOLD_HIGH "engine.video.h264_qp_thresholds_high" + + +namespace agora { + +namespace util { +template +class CopyableAutoPtr; + +class IString; +typedef CopyableAutoPtr AString; +} // namespace util + +namespace base { + +class IAgoraParameter { + public: + /** + * release the resource + */ + virtual void release() = 0; + + /** + * set bool value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setBool(const char* key, bool value) = 0; + + /** + * set int value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setInt(const char* key, int value) = 0; + + /** + * set unsigned int value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setUInt(const char* key, unsigned int value) = 0; + + /** + * set double value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setNumber(const char* key, double value) = 0; + + /** + * set string value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setString(const char* key, const char* value) = 0; + + /** + * set object value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setObject(const char* key, const char* value) = 0; + + /** + * set array value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setArray(const char* key, const char* value) = 0; + /** + * get bool value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getBool(const char* key, bool& value) = 0; + + /** + * get int value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getInt(const char* key, int& value) = 0; + + /** + * get unsigned int value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getUInt(const char* key, unsigned int& value) = 0; + + /** + * get double value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getNumber(const char* key, double& value) = 0; + + /** + * get string value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getString(const char* key, agora::util::AString& value) = 0; + + /** + * get a child object value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getObject(const char* key, agora::util::AString& value) = 0; + + /** + * get array value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getArray(const char* key, const char* args, agora::util::AString& value) = 0; + + /** + * set parameters of the sdk or engine + * @param [in] parameters + * the parameters + * @return return 0 if success or an error code + */ + virtual int setParameters(const char* parameters) = 0; + + virtual int convertPath(const char* filePath, agora::util::AString& value) = 0; + + virtual ~IAgoraParameter() {} +}; + +} // namespace base +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRhythmPlayer.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRhythmPlayer.h new file mode 100644 index 0000000..b39322a --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRhythmPlayer.h @@ -0,0 +1,92 @@ +// +// Agora SDK +// +// Copyright (c) 2021 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace base { +class IAgoraService; +} + +namespace rtc { +class ILocalAudioTrack; +class IRtcEngineEventHandler; + +/** + The states of the rhythm player. + */ +enum RHYTHM_PLAYER_STATE_TYPE { + /** 810: The rhythm player is idle. */ + RHYTHM_PLAYER_STATE_IDLE = 810, + /** 811: The rhythm player is opening files. */ + RHYTHM_PLAYER_STATE_OPENING, + /** 812: Files opened successfully, the rhythm player starts decoding files. */ + RHYTHM_PLAYER_STATE_DECODING, + /** 813: Files decoded successfully, the rhythm player starts mixing the two files and playing back them locally. */ + RHYTHM_PLAYER_STATE_PLAYING, + /** 814: The rhythm player is starting to fail, and you need to check the error code for detailed failure reasons. */ + RHYTHM_PLAYER_STATE_FAILED, +}; + +/** + The error codes of the rhythm player. + */ +enum RHYTHM_PLAYER_ERROR_TYPE { + /** 0: The rhythm player works well. */ + RHYTHM_PLAYER_ERROR_OK = 0, + /** 1: The rhythm player occurs a internal error. */ + RHYTHM_PLAYER_ERROR_FAILED = 1, + /** 801: The rhythm player can not open the file. */ + RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN = 801, + /** 802: The rhythm player can not play the file. */ + RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY, + /** 803: The file duration over the limit. The file duration limit is 1.2 seconds */ + RHYTHM_PLAYER_ERROR_FILE_OVER_DURATION_LIMIT, +}; + +/** + * The configuration of rhythm player, + * which is set in startRhythmPlayer or configRhythmPlayer. + */ +struct AgoraRhythmPlayerConfig { + /** + * The number of beats per measure. The range is 1 to 9. + * The default value is 4, + * which means that each measure contains one downbeat and three upbeats. + */ + int beatsPerMeasure; + /* + * The range is 60 to 360. + * The default value is 60, + * which means that the rhythm player plays 60 beats in one minute. + */ + int beatsPerMinute; + + AgoraRhythmPlayerConfig() : beatsPerMeasure(4), beatsPerMinute(60) {} +}; + +/** + * The IRhythmPlayer class provides access to a rhythm player entity. + * A rhythm player synthesizes beats, plays them locally, and pushes them remotely. + */ +class IRhythmPlayer : public RefCountInterface { +protected: + virtual ~IRhythmPlayer() {} + +public: + static agora_refptr Create(); + virtual int initialize(base::IAgoraService* agora_service, IRtcEngineEventHandler* event_handler, bool is_pass_thru_mode) = 0; + virtual int playRhythm(const char* sound1, const char* sound2, const AgoraRhythmPlayerConfig& config) = 0; + virtual int stopRhythm() = 0; + virtual int configRhythmPlayer(const AgoraRhythmPlayerConfig& config) = 0; + virtual agora_refptr getRhythmPlayerTrack() = 0; +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtcEngine.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtcEngine.h new file mode 100644 index 0000000..b5a0903 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtcEngine.h @@ -0,0 +1,8581 @@ +// +// Agora Rtc Engine SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// +#pragma once + +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "IAgoraLog.h" +#include "AgoraOptional.h" +#include "IAudioDeviceManager.h" +#include "IAgoraRhythmPlayer.h" +#include "IAgoraMediaEngine.h" + +namespace agora { +namespace rtc { + +template +static void SetFrom(Optional* s, const Optional& o) { + if (o) { + *s = o; + } +} + +template +static void ReplaceBy(Optional* s, const Optional& o) { + *s = o; +} + +//class IAudioDeviceManager; + +/** + * The media device types. + */ +enum MEDIA_DEVICE_TYPE { + /** + * -1: Unknown device type. + */ + UNKNOWN_AUDIO_DEVICE = -1, + /** + * 0: The audio playback device. + */ + AUDIO_PLAYOUT_DEVICE = 0, + /** + * 1: The audio recording device. + */ + AUDIO_RECORDING_DEVICE = 1, + /** + * 2: The video renderer. + */ + VIDEO_RENDER_DEVICE = 2, + /** + * 3: The video capturer. + */ + VIDEO_CAPTURE_DEVICE = 3, + /** + * 4: The audio playback device of the app. + */ + AUDIO_APPLICATION_PLAYOUT_DEVICE = 4, +}; + +/** + The playback state of the music file. + */ +enum AUDIO_MIXING_STATE_TYPE { + /** 710: The music file is playing. */ + AUDIO_MIXING_STATE_PLAYING = 710, + /** 711: The music file pauses playing. */ + AUDIO_MIXING_STATE_PAUSED = 711, + /** 713: The music file stops playing. */ + AUDIO_MIXING_STATE_STOPPED = 713, + /** 714: An error occurs during the playback of the audio mixing file. + */ + AUDIO_MIXING_STATE_FAILED = 714, +}; + +/** + The reson codes of the local user's audio mixing file. + */ +enum AUDIO_MIXING_REASON_TYPE { + /** 701: The SDK cannot open the audio mixing file. */ + AUDIO_MIXING_REASON_CAN_NOT_OPEN = 701, + /** 702: The SDK opens the audio mixing file too frequently. */ + AUDIO_MIXING_REASON_TOO_FREQUENT_CALL = 702, + /** 703: The audio mixing file playback is interrupted. */ + AUDIO_MIXING_REASON_INTERRUPTED_EOF = 703, + /** 715: The audio mixing file is played once. */ + AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED = 721, + /** 716: The audio mixing file is all played out. */ + AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED = 723, + /** 716: The audio mixing file stopped by user */ + AUDIO_MIXING_REASON_STOPPED_BY_USER = 724, + /** 0: The SDK can open the audio mixing file. */ + AUDIO_MIXING_REASON_OK = 0, +}; + +/** + * The status of importing an external video stream in a live broadcast. + */ +enum INJECT_STREAM_STATUS { + /** + * 0: The media stream is injected successfully. + */ + INJECT_STREAM_STATUS_START_SUCCESS = 0, + /** + * 1: The media stream already exists. + */ + INJECT_STREAM_STATUS_START_ALREADY_EXISTS = 1, + /** + * 2: The media stream injection is unauthorized. + */ + INJECT_STREAM_STATUS_START_UNAUTHORIZED = 2, + /** + * 3: Timeout occurs when injecting a media stream. + */ + INJECT_STREAM_STATUS_START_TIMEDOUT = 3, + /** + * 4: The media stream injection fails. + */ + INJECT_STREAM_STATUS_START_FAILED = 4, + /** + * 5: The media stream stops being injected successfully. + */ + INJECT_STREAM_STATUS_STOP_SUCCESS = 5, + /** + * 6: The media stream injection that you want to stop is found. + */ + INJECT_STREAM_STATUS_STOP_NOT_FOUND = 6, + /** + * 7: You are not authorized to stop the media stream injection. + */ + INJECT_STREAM_STATUS_STOP_UNAUTHORIZED = 7, + /** + * 8: Timeout occurs when you stop injecting the media stream. + */ + INJECT_STREAM_STATUS_STOP_TIMEDOUT = 8, + /** + * 9: Stopping injecting the media stream fails. + */ + INJECT_STREAM_STATUS_STOP_FAILED = 9, + /** + * 10: The media stream is broken. + */ + INJECT_STREAM_STATUS_BROKEN = 10, +}; + +/** + * The audio equalization band frequency. + */ +enum AUDIO_EQUALIZATION_BAND_FREQUENCY { + /** + * 0: 31 Hz. + */ + AUDIO_EQUALIZATION_BAND_31 = 0, + /** + * 1: 62 Hz. + */ + AUDIO_EQUALIZATION_BAND_62 = 1, + /** + * 2: 125 Hz. + */ + AUDIO_EQUALIZATION_BAND_125 = 2, + /** + * 3: 250 Hz. + */ + AUDIO_EQUALIZATION_BAND_250 = 3, + /** + * 4: 500 Hz. + */ + AUDIO_EQUALIZATION_BAND_500 = 4, + /** + * 5: 1 KHz. + */ + AUDIO_EQUALIZATION_BAND_1K = 5, + /** + * 6: 2 KHz. + */ + AUDIO_EQUALIZATION_BAND_2K = 6, + /** + * 7: 4 KHz. + */ + AUDIO_EQUALIZATION_BAND_4K = 7, + /** + * 8: 8 KHz. + */ + AUDIO_EQUALIZATION_BAND_8K = 8, + /** + * 9: 16 KHz. + */ + AUDIO_EQUALIZATION_BAND_16K = 9, +}; + +/** + * The audio reverberation type. + */ +enum AUDIO_REVERB_TYPE { + /** + * 0: (-20 to 10 dB), the level of the dry signal. + */ + AUDIO_REVERB_DRY_LEVEL = 0, + /** + * 1: (-20 to 10 dB), the level of the early reflection signal (wet signal). + */ + AUDIO_REVERB_WET_LEVEL = 1, + /** + * 2: (0 to 100 dB), the room size of the reflection. + */ + AUDIO_REVERB_ROOM_SIZE = 2, + /** + * 3: (0 to 200 ms), the length of the initial delay of the wet signal in ms. + */ + AUDIO_REVERB_WET_DELAY = 3, + /** + * 4: (0 to 100), the strength of the late reverberation. + */ + AUDIO_REVERB_STRENGTH = 4, +}; + +enum STREAM_FALLBACK_OPTIONS { + /** 0: No fallback operation for the stream when the network + condition is poor. The stream quality cannot be guaranteed. */ + + STREAM_FALLBACK_OPTION_DISABLED = 0, + /** 1: (Default) Under poor network conditions, the SDK will send or receive + agora::rtc::VIDEO_STREAM_LOW. You can only set this option in + RtcEngineParameters::setRemoteSubscribeFallbackOption. Nothing happens when + you set this in RtcEngineParameters::setLocalPublishFallbackOption. */ + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW = 1, + /** 2: Under poor network conditions, the SDK may receive + agora::rtc::VIDEO_STREAM_LOW first, but if the network still does + not allow displaying the video, the SDK will send or receive audio only. */ + STREAM_FALLBACK_OPTION_AUDIO_ONLY = 2, +}; + +enum PRIORITY_TYPE { + /** 50: High priority. + */ + PRIORITY_HIGH = 50, + /** 100: (Default) normal priority. + */ + PRIORITY_NORMAL = 100, +}; + +/** Statistics of the local video stream. + */ +struct LocalVideoStats +{ + /** + * ID of the local user. + */ + uid_t uid; + /** The actual bitrate (Kbps) while sending the local video stream. + * @note This value does not include the bitrate for resending the video after packet loss. + */ + int sentBitrate; + /** The actual frame rate (fps) while sending the local video stream. + * @note This value does not include the frame rate for resending the video after packet loss. + */ + int sentFrameRate; + /** The capture frame rate (fps) of the local video. + */ + int captureFrameRate; + /** The width of the capture frame (px). + */ + int captureFrameWidth; + /** The height of the capture frame (px). + */ + int captureFrameHeight; + /** + * The regulated frame rate of capture frame rate according to video encoder configuration. + */ + int regulatedCaptureFrameRate; + /** + * The regulated frame width (pixel) of capture frame width according to video encoder configuration. + */ + int regulatedCaptureFrameWidth; + /** + * The regulated frame height (pixel) of capture frame height according to video encoder configuration. + */ + int regulatedCaptureFrameHeight; + /** The output frame rate (fps) of the local video encoder. + */ + int encoderOutputFrameRate; + /** The width of the encoding frame (px). + */ + int encodedFrameWidth; + /** The height of the encoding frame (px). + */ + int encodedFrameHeight; + /** The output frame rate (fps) of the local video renderer. + */ + int rendererOutputFrameRate; + /** The target bitrate (Kbps) of the current encoder. This is an estimate made by the SDK based on the current network conditions. + */ + int targetBitrate; + /** The target frame rate (fps) of the current encoder. + */ + int targetFrameRate; + /** Quality adaption of the local video stream in the reported interval (based on the target frame + * rate and target bitrate). See #QUALITY_ADAPT_INDICATION. + */ + QUALITY_ADAPT_INDICATION qualityAdaptIndication; + /** The bitrate (Kbps) while encoding the local video stream. + * @note This value does not include the bitrate for resending the video after packet loss. + */ + int encodedBitrate; + /** The number of the sent video frames, represented by an aggregate value. + */ + int encodedFrameCount; + /** The codec type of the local video. See #VIDEO_CODEC_TYPE. + */ + VIDEO_CODEC_TYPE codecType; + /** + * The video packet loss rate (%) from the local client to the Agora server before applying the anti-packet loss strategies. + */ + unsigned short txPacketLossRate; + /** The brightness level of the video image captured by the local camera. See #CAPTURE_BRIGHTNESS_LEVEL_TYPE. + */ + CAPTURE_BRIGHTNESS_LEVEL_TYPE captureBrightnessLevel; + /** + * Whether we send dual stream now. + */ + bool dualStreamEnabled; + /** The hwEncoderAccelerating of the local video: + * - software = 0. + * - hardware = 1. + */ + int hwEncoderAccelerating; +}; + + +/** + * Audio statistics of the remote user. + */ +struct RemoteAudioStats +{ + /** + * User ID of the remote user sending the audio stream. + */ + uid_t uid; + /** + * The quality of the remote audio: #QUALITY_TYPE. + */ + int quality; + /** + * The network delay (ms) from the sender to the receiver. + */ + int networkTransportDelay; + /** + * The network delay (ms) from the receiver to the jitter buffer. + * @note When the receiving end is an audience member and `audienceLatencyLevel` of `ClientRoleOptions` + * is 1, this parameter does not take effect. + */ + int jitterBufferDelay; + /** + * The audio frame loss rate in the reported interval. + */ + int audioLossRate; + /** + * The number of channels. + */ + int numChannels; + /** + * The sample rate (Hz) of the remote audio stream in the reported interval. + */ + int receivedSampleRate; + /** + * The average bitrate (Kbps) of the remote audio stream in the reported + * interval. + */ + int receivedBitrate; + /** + * The total freeze time (ms) of the remote audio stream after the remote + * user joins the channel. + * + * In a session, audio freeze occurs when the audio frame loss rate reaches 4%. + */ + int totalFrozenTime; + /** + * The total audio freeze time as a percentage (%) of the total time when the + * audio is available. + */ + int frozenRate; + /** + * The quality of the remote audio stream as determined by the Agora + * real-time audio MOS (Mean Opinion Score) measurement method in the + * reported interval. The return value ranges from 0 to 500. Dividing the + * return value by 100 gets the MOS score, which ranges from 0 to 5. The + * higher the score, the better the audio quality. + * + * | MOS score | Perception of audio quality | + * |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | Greater than 4 | Excellent. The audio sounds clear and smooth. | + * | From 3.5 to 4 | Good. The audio has some perceptible impairment, but still sounds clear. | + * | From 3 to 3.5 | Fair. The audio freezes occasionally and requires attentive listening. | + * | From 2.5 to 3 | Poor. The audio sounds choppy and requires considerable effort to understand. | + * | From 2 to 2.5 | Bad. The audio has occasional noise. Consecutive audio dropouts occur, resulting in some information loss. The users can communicate only with difficulty. | + * | Less than 2 | Very bad. The audio has persistent noise. Consecutive audio dropouts are frequent, resulting in severe information loss. Communication is nearly impossible. | + */ + int mosValue; + /** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ + int totalActiveTime; + /** + * The total publish duration (ms) of the remote audio stream. + */ + int publishDuration; + /** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. See #EXPERIENCE_QUALITY_TYPE. + */ + int qoeQuality; + /** + * The reason for poor QoE of the local user when receiving a remote audio stream. See #EXPERIENCE_POOR_REASON. + */ + int qualityChangedReason; + /** + * The total number of audio bytes received (bytes), inluding the FEC bytes, represented by an aggregate value. + */ + unsigned int rxAudioBytes; + /** + * The end-to-end delay (ms) from the sender to the receiver. + */ + int e2eDelay; + + RemoteAudioStats() : + uid(0), + quality(0), + networkTransportDelay(0), + jitterBufferDelay(0), + audioLossRate(0), + numChannels(0), + receivedSampleRate(0), + receivedBitrate(0), + totalFrozenTime(0), + frozenRate(0), + mosValue(0), + totalActiveTime(0), + publishDuration(0), + qoeQuality(0), + qualityChangedReason(0), + rxAudioBytes(0), + e2eDelay(0) {} +}; + +/** + * The statistics of the remote video stream. + */ +struct RemoteVideoStats { + /** + * ID of the remote user sending the video stream. + */ + uid_t uid; + /** + * @deprecated Time delay (ms). + * + * In scenarios where audio and video is synchronized, you can use the + * value of `networkTransportDelay` and `jitterBufferDelay` in `RemoteAudioStats` + * to know the delay statistics of the remote video. + */ + int delay __deprecated; + /** + * The width (pixels) of the video stream. + */ + int width; + /** + * The height (pixels) of the video stream. + */ + int height; + /** + * Bitrate (Kbps) received since the last count. + */ + int receivedBitrate; + /** The decoder output frame rate (fps) of the remote video. + */ + int decoderOutputFrameRate; + /** The render output frame rate (fps) of the remote video. + */ + int rendererOutputFrameRate; + /** The video frame loss rate (%) of the remote video stream in the reported interval. + */ + int frameLossRate; + /** Packet loss rate (%) of the remote video stream after using the anti-packet-loss method. + */ + int packetLossRate; + /** + * The type of the remote video stream: #VIDEO_STREAM_TYPE. + */ + VIDEO_STREAM_TYPE rxStreamType; + /** + The total freeze time (ms) of the remote video stream after the remote user joins the channel. + In a video session where the frame rate is set to no less than 5 fps, video freeze occurs when + the time interval between two adjacent renderable video frames is more than 500 ms. + */ + int totalFrozenTime; + /** + The total video freeze time as a percentage (%) of the total time when the video is available. + */ + int frozenRate; + /** + The offset (ms) between audio and video stream. A positive value indicates the audio leads the + video, and a negative value indicates the audio lags the video. + */ + int avSyncTimeMs; + /** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ + int totalActiveTime; + /** + * The total publish duration (ms) of the remote audio stream. + */ + int publishDuration; + /** + * The quality of the remote video stream in the reported interval. + * The quality is determined by the Agora real-time video MOS (Mean Opinion Score) measurement method. + * The return value range is [0, 500]. + * Dividing the return value by 100 gets the MOS score, which ranges from 0 to 5. The higher the score, the better the video quality. + * @note For textured video data, this parameter always returns 0. + */ + int mosValue; + /** + * The total number of video bytes received (bytes), inluding the FEC bytes, represented by an aggregate value. + */ + unsigned int rxVideoBytes; +}; + +struct VideoCompositingLayout { + struct Region { + /** User ID of the user whose video is to be displayed in the region. + */ + uid_t uid; + /** Horizontal position of the region on the screen. + */ + double x; // [0,1] + /** Vertical position of the region on the screen. + */ + double y; // [0,1] + /** + Actual width of the region. + */ + double width; // [0,1] + /** Actual height of the region. */ + double height; // [0,1] + /** 0 means the region is at the bottom, and 100 means the region is at the + * top. + */ + int zOrder; // optional, [0, 100] //0 (default): bottom most, 100: top most + + /** 0 means the region is transparent, and 1 means the region is opaque. The + * default value is 1.0. + */ + double alpha; + + media::base::RENDER_MODE_TYPE + renderMode; // RENDER_MODE_HIDDEN: Crop, RENDER_MODE_FIT: Zoom to fit + + Region() + : uid(0), + x(0), + y(0), + width(0), + height(0), + zOrder(0), + alpha(1.0), + renderMode(media::base::RENDER_MODE_HIDDEN) {} + }; + + /** Ignore this parameter. The width of the canvas is set by + agora::rtc::IRtcEngine::configPublisher, and not by + agora::rtc::VideoCompositingLayout::canvasWidth. + */ + int canvasWidth; + /** Ignore this parameter. The height of the canvas is set by + agora::rtc::IRtcEngine::configPublisher, and not by + agora::rtc::VideoCompositingLayout::canvasHeight. + */ + int canvasHeight; + /** Enter any of the 6-digit symbols defined in RGB. + */ + const char* backgroundColor; // e.g. "#C0C0C0" in RGB + /** Region array. Each host in the channel can have a region to display the + * video on the screen. + */ + const Region* regions; + /** Number of users in the channel. + */ + int regionCount; + /** User-defined data. + */ + const char* appData; + /** Length of the user-defined data. + */ + int appDataLength; + + VideoCompositingLayout() + : canvasWidth(0), + canvasHeight(0), + backgroundColor(NULL), + regions(NULL), + regionCount(0), + appData(NULL), + appDataLength(0) {} +}; + +/** The definition of InjectStreamConfig. + */ +struct InjectStreamConfig { + /** Width of the stream to be added into the broadcast. The default value is + 0; same width as the original stream. + */ + int width; + /** Height of the stream to be added into the broadcast. The default value is + 0; same height as the original stream. + */ + int height; + /** Video GOP of the stream to be added into the broadcast. The default value + is 30. + */ + int videoGop; + /** Video frame rate of the stream to be added into the broadcast. The + default value is 15 fps. + */ + int videoFramerate; + /** Video bitrate of the stream to be added into the broadcast. The default + value is 400 Kbps. + */ + int videoBitrate; + /** Audio-sampling rate of the stream to be added into the broadcast: + #AUDIO_SAMPLE_RATE_TYPE. The default value is 48000. + */ + AUDIO_SAMPLE_RATE_TYPE audioSampleRate; + /** Audio bitrate of the stream to be added into the broadcast. The default + value is 48. + */ + int audioBitrate; + /** Audio channels to be added into the broadcast. The default value is 1. + */ + int audioChannels; + + // width / height default set to 0 means pull the stream with its original + // resolution + InjectStreamConfig() + : width(0), + height(0), + videoGop(30), + videoFramerate(15), + videoBitrate(400), + audioSampleRate(AUDIO_SAMPLE_RATE_48000), + audioBitrate(48), + audioChannels(1) {} +}; + +/** The video stream lifecycle of CDN Live. + */ +enum RTMP_STREAM_LIFE_CYCLE_TYPE { + /** Bound to the channel lifecycle. + */ + RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL = 1, + /** Bound to the owner identity of the RTMP stream. + */ + RTMP_STREAM_LIFE_CYCLE_BIND2OWNER = 2, +}; + +/** The definition of PublisherConfiguration. +*/ +struct PublisherConfiguration { + /** Width of the output data stream set for CDN Live. The default value is + 360. + */ + int width; + /** Height of the output data stream set for CDN Live. The default value is + 640. + */ + int height; + /** Frame rate of the output data stream set for CDN Live. The default value + is 15 fps. + */ + int framerate; + /** Bitrate of the output data stream set for CDN Live. The default value is + 500 Kbps. + */ + int bitrate; + /** The default layout: + - 0: Tile horizontally + - 1: Layered windows + - 2: Tile vertically + */ + int defaultLayout; + /** The video stream lifecycle of CDN Live: RTMP_STREAM_LIFE_CYCLE_TYPE + */ + int lifecycle; + /** Whether the current user is the owner of the RTMP stream: + - True: Yes (default). The push-stream configuration takes effect. + - False: No. The push-stream configuration will not work. + */ + bool owner; + /** Width of the stream to be injected. Set it as 0. + */ + int injectStreamWidth; + /** Height of the stream to be injected. Set it as 0. + */ + int injectStreamHeight; + /** URL address of the stream to be injected to the channel. + */ + const char* injectStreamUrl; + /** Push-stream URL address for the picture-in-picture layouts. The default + value is NULL. + */ + const char* publishUrl; + /** Push-stream URL address of the original stream which does not require + picture-blending. The default value is NULL. + */ + const char* rawStreamUrl; + /** Reserved field. The default value is NULL. + */ + const char* extraInfo; + + PublisherConfiguration() + : width(640), + height(360), + framerate(15), + bitrate(500), + defaultLayout(1), + lifecycle(RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL), + owner(true), + injectStreamWidth(0), + injectStreamHeight(0), + injectStreamUrl(NULL), + publishUrl(NULL), + rawStreamUrl(NULL), + extraInfo(NULL) {} +}; + +/** + * The camera direction. + */ +enum CAMERA_DIRECTION { + /** The rear camera. */ + CAMERA_REAR = 0, + /** The front camera. */ + CAMERA_FRONT = 1, +}; + +/** The cloud proxy type. + * + * @since v3.3.0 + */ +enum CLOUD_PROXY_TYPE { + /** 0: Do not use the cloud proxy. + */ + NONE_PROXY = 0, + /** 1: The cloud proxy for the UDP protocol. + */ + UDP_PROXY = 1, + /// @cond + /** 2: The cloud proxy for the TCP (encrypted) protocol. + */ + TCP_PROXY = 2, + /// @endcond +}; + +/** Camera capturer configuration.*/ +struct CameraCapturerConfiguration { + /** Camera direction settings (for Android/iOS only). See: #CAMERA_DIRECTION. */ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + /** + * The camera direction. + */ + CAMERA_DIRECTION cameraDirection; +#else + /** For windows. The device ID of the playback device. The maximum length is #MAX_DEVICE_ID_LENGTH. */ + char deviceId[MAX_DEVICE_ID_LENGTH]; +#endif + /** The video format. See VideoFormat. */ + VideoFormat format; + bool followEncodeDimensionRatio; + CameraCapturerConfiguration() : followEncodeDimensionRatio(true) { +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + cameraDirection = CAMERA_REAR; +#else + memset(deviceId, 0, sizeof(deviceId)); +#endif + } +}; +/** + * The configuration of the captured screen. + */ +struct ScreenCaptureConfiguration { + /** + * Whether to capture the window on the screen: + * - `true`: Capture the window. + * - `false`: (Default) Capture the screen, not the window. + */ + bool isCaptureWindow; // true - capture window, false - capture display + /** + * (macOS only) The display ID of the screen. + */ + uint32_t displayId; + /** + * (Windows only) The relative position of the shared screen to the virtual screen. + * @note This parameter takes effect only when you want to capture the screen on Windows. + */ + Rectangle screenRect; //Windows only + /** + * (For Windows and macOS only) The window ID. + * @note This parameter takes effect only when you want to capture the window. + */ + view_t windowId; + /** + * (For Windows and macOS only) The screen capture configuration. For details, see ScreenCaptureParameters. + */ + ScreenCaptureParameters params; + /** + * (For Windows and macOS only) The relative position of the shared region to the whole screen. For details, see Rectangle. + * + * If you do not set this parameter, the SDK shares the whole screen. If the region you set exceeds the boundary of the + * screen, only the region within in the screen is shared. If you set width or height in Rectangle as 0, the whole + * screen is shared. + */ + Rectangle regionRect; + + ScreenCaptureConfiguration() : isCaptureWindow(false), displayId(0), windowId(0) {} +}; + +#if (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) +/** The size of the screen shot to the screen or window. + */ +struct SIZE { + /** The width of the screen shot. + */ + int width; + /** The width of the screen shot. + */ + int height; + + SIZE() : width(0), height(0) {} + SIZE(int ww, int hh) : width(ww), height(hh) {} +}; +#endif + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) +/** + * The image content of the thumbnail or icon. + * @note The default image is in the RGBA format. If you need to use another format, you need to convert the image on + * your own. + */ +struct ThumbImageBuffer { + /** + * The buffer of the thumbnail ot icon. + */ + const char* buffer; + /** + * The buffer length of the thumbnail or icon, in bytes. + */ + unsigned int length; + /** + * The actual width (px) of the thumbnail or icon. + */ + unsigned int width; + /** + * The actual height (px) of the thumbnail or icon. + */ + unsigned int height; + ThumbImageBuffer() : buffer(nullptr), length(0), width(0), height(0) {} +}; +/** + * The type of the shared target. Set in ScreenCaptureSourceInfo. + */ +enum ScreenCaptureSourceType { + /** -1: Unknown type. */ + ScreenCaptureSourceType_Unknown = -1, + /** 0: The shared target is a window.*/ + ScreenCaptureSourceType_Window = 0, + /** 1: The shared target is a screen of a particular monitor.*/ + ScreenCaptureSourceType_Screen = 1, + /** 2: Reserved parameter.*/ + ScreenCaptureSourceType_Custom = 2, +}; +/** The information about the specified shareable window or screen. It is returned in IScreenCaptureSourceList. */ +struct ScreenCaptureSourceInfo { + /** + * The type of the shared target. See \ref agora::rtc::ScreenCaptureSourceType "ScreenCaptureSourceType". + */ + ScreenCaptureSourceType type; + /** + * The window ID for a window or the display ID for a screen. + */ + view_t sourceId; + /** + * The name of the window or screen. UTF-8 encoding. + */ + const char* sourceName; + /** + * The image content of the thumbnail. See ThumbImageBuffer. + */ + ThumbImageBuffer thumbImage; + /** + * The image content of the icon. See ThumbImageBuffer. + */ + ThumbImageBuffer iconImage; + /** + * The process to which the window belongs. UTF-8 encoding. + */ + const char* processPath; + /** + * The title of the window. UTF-8 encoding. + */ + const char* sourceTitle; + /** + * Determines whether the screen is the primary display: + * - true: The screen is the primary display. + * - false: The screen is not the primary display. + */ + bool primaryMonitor; + bool isOccluded; + /** + * The relative position of the shared region to the screen space (A virtual space include all the screens). See Rectangle. + */ + Rectangle position; +#if defined(_WIN32) + /** + * Determines whether the window is minimized. + */ + bool minimizeWindow; + /** + * The display ID to the window of interest. + * If the window intersects one or more display monitor rectangles, the return value is an valid + * ID to the display monitor that has the largest area of intersection with the window, Otherwise + * the return value is -2. + */ + view_t sourceDisplayId; + ScreenCaptureSourceInfo() : type(ScreenCaptureSourceType_Unknown), sourceId(nullptr), sourceName(nullptr), + processPath(nullptr), sourceTitle(nullptr), primaryMonitor(false), isOccluded(false), minimizeWindow(false), sourceDisplayId((view_t)-2) {} +#else + ScreenCaptureSourceInfo() : type(ScreenCaptureSourceType_Unknown), sourceId(nullptr), sourceName(nullptr), processPath(nullptr), sourceTitle(nullptr), primaryMonitor(false), isOccluded(false) {} +#endif +}; +/** + * The IScreenCaptureSourceList class. This class is returned in the getScreenCaptureSources method. + */ +class IScreenCaptureSourceList { + protected: + virtual ~IScreenCaptureSourceList(){}; + + public: + /** + * Gets the number of shareable cpp and screens. + * + * @return The number of shareable cpp and screens. + */ + virtual unsigned int getCount() = 0; + /** + * Gets information about the specified shareable window or screen. + * + * After you get IScreenCaptureSourceList, you can pass in the index value of the specified shareable window or + * screen to get information about that window or screen from ScreenCaptureSourceInfo. + * + * @param index The index of the specified shareable window or screen. The value range is [0, getCount()). + * @return ScreenCaptureSourceInfo The information of the specified window or screen. + */ + virtual ScreenCaptureSourceInfo getSourceInfo(unsigned int index) = 0; + /** + * Releases IScreenCaptureSourceList. + * + * After you get the list of shareable cpp and screens, to avoid memory leaks, call this method to release + * IScreenCaptureSourceList instead of deleting IScreenCaptureSourceList directly. + */ + virtual void release() = 0; +}; +#endif // _WIN32 || (__APPLE__ && !TARGET_OS_IPHONE && TARGET_OS_MAC) +/** + * The advanced options for audio. + */ +struct AdvancedAudioOptions { + /** + * Audio processing channels, only support 1 or 2. + */ + Optional audioProcessingChannels; + + AdvancedAudioOptions() {} + ~AdvancedAudioOptions() {} +}; + +struct ImageTrackOptions { + const char* imageUrl; + int fps; + VIDEO_MIRROR_MODE_TYPE mirrorMode; + ImageTrackOptions() : imageUrl(NULL), fps(1), mirrorMode(VIDEO_MIRROR_MODE_DISABLED) {} +}; + +/** + * The channel media options. + * + * Agora supports publishing multiple audio streams and one video stream at the same time and in the same RtcConnection. + * For example, `publishAudioTrack`, `publishCustomAudioTrack` and `publishMediaPlayerAudioTrack` can be true at the same time; + * but only one of `publishCameraTrack`, `publishScreenTrack`, `publishCustomVideoTrack`, and `publishEncodedVideoTrack` can be + * true at the same time. + */ +struct ChannelMediaOptions { + /** + * Whether to publish the video of the camera track. + * - `true`: (Default) Publish the video track of the camera capturer. + * - `false`: Do not publish the video track of the camera capturer. + */ + Optional publishCameraTrack; + /** + * Whether to publish the video of the secondary camera track. + * - `true`: Publish the video track of the secondary camera capturer. + * - `false`: (Default) Do not publish the video track of the secondary camera capturer. + */ + Optional publishSecondaryCameraTrack; + /** + * Whether to publish the video of the third camera track. + * - `true`: Publish the video track of the third camera capturer. + * - `false`: (Default) Do not publish the video track of the third camera capturer. + */ + Optional publishThirdCameraTrack; + /** + * Whether to publish the video of the fourth camera track. + * - `true`: Publish the video track of the fourth camera capturer. + * - `false`: (Default) Do not publish the video track of the fourth camera capturer. + */ + Optional publishFourthCameraTrack; + /** + * Whether to publish the recorded audio. + * - `true`: (Default) Publish the recorded audio. + * - `false`: Do not publish the recorded audio. + */ + Optional publishMicrophoneTrack; + + #if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + /** + * Whether to publish the video track of the screen capturer: + * - `true`: Publish the video track of the screen capture. + * - `false`: (Default) Do not publish the video track of the screen capture. + */ + Optional publishScreenCaptureVideo; + /** + * Whether to publish the audio track of the screen capturer: + * - `true`: Publish the video audio of the screen capturer. + * - `false`: (Default) Do not publish the audio track of the screen capturer. + */ + Optional publishScreenCaptureAudio; + #else + /** + * Whether to publish the captured video from the screen: + * - `true`: PPublish the captured video from the screen. + * - `false`: (Default) Do not publish the captured video from the screen. + */ + Optional publishScreenTrack; + /** + * Whether to publish the captured video from the secondary screen: + * - true: Publish the captured video from the secondary screen. + * - false: (Default) Do not publish the captured video from the secondary screen. + */ + Optional publishSecondaryScreenTrack; + /** + * Whether to publish the captured video from the third screen: + * - true: Publish the captured video from the third screen. + * - false: (Default) Do not publish the captured video from the third screen. + */ + Optional publishThirdScreenTrack; + /** + * Whether to publish the captured video from the fourth screen: + * - true: Publish the captured video from the fourth screen. + * - false: (Default) Do not publish the captured video from the fourth screen. + */ + Optional publishFourthScreenTrack; + #endif + + /** + * Whether to publish the captured audio from a custom source: + * - true: Publish the captured audio from a custom source. + * - false: (Default) Do not publish the captured audio from the custom source. + */ + Optional publishCustomAudioTrack; + /** + * The custom audio track id. The default value is 0. + */ + Optional publishCustomAudioTrackId; + /** + * Whether to publish AEC custom audio track. + * - `true`: Publish AEC track. + * - `false`: (Default) Do not publish AEC track. + */ + Optional publishCustomAudioTrackAec; + /** + * Whether to publish the captured video from a custom source: + * - `true`: Publish the captured video from a custom source. + * - `false`: (Default) Do not publish the captured video from the custom source. + */ + Optional publishCustomVideoTrack; + /** + * Whether to publish the encoded video: + * - `true`: Publish the encoded video. + * - `false`: (Default) Do not publish the encoded video. + */ + Optional publishEncodedVideoTrack; + /** + * Whether to publish the audio from the media player: + * - `true`: Publish the audio from the media player. + * - `false`: (Default) Do not publish the audio from the media player. + */ + Optional publishMediaPlayerAudioTrack; + /** + * Whether to publish the video from the media player: + * - `true`: Publish the video from the media player. + * - `false`: (Default) Do not publish the video from the media player. + */ + Optional publishMediaPlayerVideoTrack; + /** + * Whether to publish the local transcoded video track. + * - `true`: Publish the video track of local transcoded video track. + * - `false`: (Default) Do not publish the local transcoded video track. + */ + Optional publishTrancodedVideoTrack; + /** + * Whether to publish the local mixed track. + * - `true`: Publish the audio track of local mixed track. + * - `false`: (Default) Do not publish the local mixed track. + */ + Optional publishMixedAudioTrack; + /** + * Whether to automatically subscribe to all remote audio streams when the user joins a channel: + * - `true`: (Default) Subscribe to all remote audio streams. + * - `false`: Do not subscribe to any remote audio stream. + */ + Optional autoSubscribeAudio; + /** + * Whether to subscribe to all remote video streams when the user joins the channel: + * - `true`: (Default) Subscribe to all remote video streams. + * - `false`: Do not subscribe to any remote video stream. + */ + Optional autoSubscribeVideo; + /** + * Whether to enable audio capturing or playback. + * - `true`: (Default) Enable audio capturing and playback. + * - `false`: Do not enable audio capturing or playback. + */ + Optional enableAudioRecordingOrPlayout; + /** + * The ID of the media player to be published. The default value is 0. + */ + Optional publishMediaPlayerId; + /** + * The client role type. See \ref CLIENT_ROLE_TYPE. + * Default is CLIENT_ROLE_AUDIENCE. + */ + Optional clientRoleType; + /** + * The audience latency level type. See #AUDIENCE_LATENCY_LEVEL_TYPE. + */ + Optional audienceLatencyLevel; + /** + * The default video stream type. See \ref VIDEO_STREAM_TYPE. + * Default is VIDEO_STREAM_HIGH. + */ + Optional defaultVideoStreamType; + /** + * The channel profile. See \ref CHANNEL_PROFILE_TYPE. + * Default is CHANNEL_PROFILE_LIVE_BROADCASTING. + */ + Optional channelProfile; + /** + * The delay in ms for sending audio frames. This is used for explicit control of A/V sync. + * To switch off the delay, set the value to zero. + */ + Optional audioDelayMs; + /** + * The delay in ms for sending media player audio frames. This is used for explicit control of A/V sync. + * To switch off the delay, set the value to zero. + */ + Optional mediaPlayerAudioDelayMs; + /** + * (Optional) The token generated on your server for authentication. + * @note + * - This parameter takes effect only when calling `updateChannelMediaOptions` or `updateChannelMediaOptionsEx`. + * - Ensure that the App ID, channel name, and user name used for creating the token are the same ones as those + * used by the initialize method for initializing the RTC engine, and those used by the `joinChannel [2/2]` + * and `joinChannelEx` methods for joining the channel. + */ + Optional token; + /** + * Whether to enable media packet encryption: + * - `true`: Yes. + * - `false`: (Default) No. + * + * @note This parameter is ignored when calling `updateChannelMediaOptions`. + */ + Optional enableBuiltInMediaEncryption; + /** + * Whether to publish the sound of the rhythm player to remote users: + * - `true`: (Default) Publish the sound of the rhythm player. + * - `false`: Do not publish the sound of the rhythm player. + */ + Optional publishRhythmPlayerTrack; + /** + * Whether the user is an interactive audience member in the channel. + * - `true`: Enable low lentancy and smooth video when joining as an audience. + * - `false`: (Default) Use default settings for audience role. + * @note This mode is only used for audience. In PK mode, client might join one channel as broadcaster, and join + * another channel as interactive audience to achieve low lentancy and smooth video from remote user. + */ + Optional isInteractiveAudience; + /** + * The custom video track id which will used to publish or preview. + * You can get the VideoTrackId after calling createCustomVideoTrack() of IRtcEngine. + */ + Optional customVideoTrackId; + /** + * Whether local audio stream can be filtered. + * - `true`: (Default) Can be filtered when audio level is low. + * - `false`: Do not Filter this audio stream. + */ + Optional isAudioFilterable; + + /** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + Pointer to the set parameters in a JSON string. + */ + Optional parameters; + + ChannelMediaOptions() {} + ~ChannelMediaOptions() {} + + void SetAll(const ChannelMediaOptions& change) { +#define SET_FROM(X) SetFrom(&X, change.X) + + SET_FROM(publishCameraTrack); + SET_FROM(publishSecondaryCameraTrack); + SET_FROM(publishThirdCameraTrack); + SET_FROM(publishFourthCameraTrack); + SET_FROM(publishMicrophoneTrack); +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + SET_FROM(publishScreenCaptureVideo); + SET_FROM(publishScreenCaptureAudio); +#else + SET_FROM(publishScreenTrack); + SET_FROM(publishSecondaryScreenTrack); + SET_FROM(publishThirdScreenTrack); + SET_FROM(publishFourthScreenTrack); +#endif + SET_FROM(publishTrancodedVideoTrack); + SET_FROM(publishMixedAudioTrack); + SET_FROM(publishCustomAudioTrack); + SET_FROM(publishCustomAudioTrackId); + SET_FROM(publishCustomAudioTrackAec); + SET_FROM(publishCustomVideoTrack); + SET_FROM(publishEncodedVideoTrack); + SET_FROM(publishMediaPlayerAudioTrack); + SET_FROM(publishMediaPlayerVideoTrack); + SET_FROM(autoSubscribeAudio); + SET_FROM(autoSubscribeVideo); + SET_FROM(publishMediaPlayerId); + SET_FROM(enableAudioRecordingOrPlayout); + SET_FROM(clientRoleType); + SET_FROM(audienceLatencyLevel); + SET_FROM(defaultVideoStreamType); + SET_FROM(channelProfile); + SET_FROM(audioDelayMs); + SET_FROM(mediaPlayerAudioDelayMs); + SET_FROM(token); + SET_FROM(enableBuiltInMediaEncryption); + SET_FROM(publishRhythmPlayerTrack); + SET_FROM(customVideoTrackId); + SET_FROM(isAudioFilterable); + SET_FROM(isInteractiveAudience); + SET_FROM(parameters); +#undef SET_FROM + } + + bool operator==(const ChannelMediaOptions& o) const { +#define BEGIN_COMPARE() bool b = true +#define ADD_COMPARE(X) b = (b && (X == o.X)) +#define END_COMPARE() + + BEGIN_COMPARE(); + ADD_COMPARE(publishCameraTrack); + ADD_COMPARE(publishSecondaryCameraTrack); + ADD_COMPARE(publishThirdCameraTrack); + ADD_COMPARE(publishFourthCameraTrack); + ADD_COMPARE(publishMicrophoneTrack); +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + ADD_COMPARE(publishScreenCaptureVideo); + ADD_COMPARE(publishScreenCaptureAudio); +#else + ADD_COMPARE(publishScreenTrack); + ADD_COMPARE(publishSecondaryScreenTrack); + ADD_COMPARE(publishThirdScreenTrack); + ADD_COMPARE(publishFourthScreenTrack); +#endif + ADD_COMPARE(publishTrancodedVideoTrack); + ADD_COMPARE(publishMixedAudioTrack); + ADD_COMPARE(publishCustomAudioTrack); + ADD_COMPARE(publishCustomAudioTrackId); + ADD_COMPARE(publishCustomAudioTrackAec); + ADD_COMPARE(publishCustomVideoTrack); + ADD_COMPARE(publishEncodedVideoTrack); + ADD_COMPARE(publishMediaPlayerAudioTrack); + ADD_COMPARE(publishMediaPlayerVideoTrack); + ADD_COMPARE(autoSubscribeAudio); + ADD_COMPARE(autoSubscribeVideo); + ADD_COMPARE(publishMediaPlayerId); + ADD_COMPARE(enableAudioRecordingOrPlayout); + ADD_COMPARE(clientRoleType); + ADD_COMPARE(audienceLatencyLevel); + ADD_COMPARE(defaultVideoStreamType); + ADD_COMPARE(channelProfile); + ADD_COMPARE(audioDelayMs); + ADD_COMPARE(mediaPlayerAudioDelayMs); + ADD_COMPARE(token); + ADD_COMPARE(enableBuiltInMediaEncryption); + ADD_COMPARE(publishRhythmPlayerTrack); + ADD_COMPARE(customVideoTrackId); + ADD_COMPARE(isAudioFilterable); + ADD_COMPARE(isInteractiveAudience); + ADD_COMPARE(parameters); + END_COMPARE(); + +#undef BEGIN_COMPARE +#undef ADD_COMPARE +#undef END_COMPARE + return b; + } + + ChannelMediaOptions& operator=(const ChannelMediaOptions& replace) { + if (this != &replace) { +#define REPLACE_BY(X) ReplaceBy(&X, replace.X) + + REPLACE_BY(publishCameraTrack); + REPLACE_BY(publishSecondaryCameraTrack); + REPLACE_BY(publishThirdCameraTrack); + REPLACE_BY(publishFourthCameraTrack); + REPLACE_BY(publishMicrophoneTrack); +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + REPLACE_BY(publishScreenCaptureVideo); + REPLACE_BY(publishScreenCaptureAudio); +#else + REPLACE_BY(publishScreenTrack); + REPLACE_BY(publishSecondaryScreenTrack); + REPLACE_BY(publishThirdScreenTrack); + REPLACE_BY(publishFourthScreenTrack); +#endif + REPLACE_BY(publishTrancodedVideoTrack); + REPLACE_BY(publishMixedAudioTrack); + REPLACE_BY(publishCustomAudioTrack); + REPLACE_BY(publishCustomAudioTrackId); + REPLACE_BY(publishCustomAudioTrackAec); + REPLACE_BY(publishCustomVideoTrack); + REPLACE_BY(publishEncodedVideoTrack); + REPLACE_BY(publishMediaPlayerAudioTrack); + REPLACE_BY(publishMediaPlayerVideoTrack); + REPLACE_BY(autoSubscribeAudio); + REPLACE_BY(autoSubscribeVideo); + REPLACE_BY(publishMediaPlayerId); + REPLACE_BY(enableAudioRecordingOrPlayout); + REPLACE_BY(clientRoleType); + REPLACE_BY(audienceLatencyLevel); + REPLACE_BY(defaultVideoStreamType); + REPLACE_BY(channelProfile); + REPLACE_BY(audioDelayMs); + REPLACE_BY(mediaPlayerAudioDelayMs); + REPLACE_BY(token); + REPLACE_BY(enableBuiltInMediaEncryption); + REPLACE_BY(publishRhythmPlayerTrack); + REPLACE_BY(customVideoTrackId); + REPLACE_BY(isAudioFilterable); + REPLACE_BY(isInteractiveAudience); + REPLACE_BY(parameters); +#undef REPLACE_BY + } + return *this; + } +}; + +/** The local proxy mode type. */ +enum LOCAL_PROXY_MODE { + /** 0: Connect local proxy with high priority, if not connected to local proxy, fallback to sdrtn. + */ + ConnectivityFirst = 0, + /** 1: Only connect local proxy + */ + LocalOnly = 1, +}; + +enum PROXY_TYPE { + /** 0: Do not use the cloud proxy. + */ + NONE_PROXY_TYPE = 0, + /** 1: The cloud proxy for the UDP protocol. + */ + UDP_PROXY_TYPE = 1, + /** 2: The cloud proxy for the TCP (encrypted) protocol. + */ + TCP_PROXY_TYPE = 2, + /** 3: The local proxy. + */ + LOCAL_PROXY_TYPE = 3, + /** 4: auto fallback to tcp cloud proxy + */ + TCP_PROXY_AUTO_FALLBACK_TYPE = 4, +}; + +enum FeatureType { + VIDEO_VIRTUAL_BACKGROUND = 1, + VIDEO_BEAUTY_EFFECT = 2, +}; + +struct LogUploadServerInfo { + /** Log upload server domain + */ + const char* serverDomain; + /** Log upload server path + */ + const char* serverPath; + /** Log upload server port + */ + int serverPort; + /** Whether to use HTTPS request: + - true: Use HTTPS request + - fasle: Use HTTP request + */ + bool serverHttps; + + LogUploadServerInfo() : serverDomain(NULL), serverPath(NULL), serverPort(0), serverHttps(true) {} + + LogUploadServerInfo(const char* domain, const char* path, int port, bool https) : serverDomain(domain), serverPath(path), serverPort(port), serverHttps(https) {} +}; + +struct AdvancedConfigInfo { + /** Log upload server + */ + LogUploadServerInfo logUploadServer; +}; + +struct LocalAccessPointConfiguration { + /** Local access point IP address list. + */ + const char** ipList; + /** The number of local access point IP address. + */ + int ipListSize; + /** Local access point domain list. + */ + const char** domainList; + /** The number of local access point domain. + */ + int domainListSize; + /** Certificate domain name installed on specific local access point. pass "" means using sni domain on specific local access point + * SNI(Server Name Indication) is an extension to the TLS protocol. + */ + const char* verifyDomainName; + /** Local proxy connection mode, connectivity first or local only. + */ + LOCAL_PROXY_MODE mode; + /** Local proxy connection, advanced Config info. + */ + AdvancedConfigInfo advancedConfig; + LocalAccessPointConfiguration() : ipList(NULL), ipListSize(0), domainList(NULL), domainListSize(0), verifyDomainName(NULL), mode(ConnectivityFirst) {} +}; + +/** + * The options for leaving a channel. + */ +struct LeaveChannelOptions { + /** + * Whether to stop playing and mixing the music file when a user leaves the channel. + * - `true`: (Default) Stop playing and mixing the music file. + * - `false`: Do not stop playing and mixing the music file. + */ + bool stopAudioMixing; + /** + * Whether to stop playing all audio effects when a user leaves the channel. + * - `true`: (Default) Stop playing all audio effects. + * - `false`: Do not stop playing any audio effect. + */ + bool stopAllEffect; + /** + * Whether to stop microphone recording when a user leaves the channel. + * - `true`: (Default) Stop microphone recording. + * - `false`: Do not stop microphone recording. + */ + bool stopMicrophoneRecording; + + LeaveChannelOptions() : stopAudioMixing(true), stopAllEffect(true), stopMicrophoneRecording(true) {} +}; + +/** + * The IRtcEngineEventHandler class. + * + * The SDK uses this class to send callback event notifications to the app, and the app inherits + * the methods in this class to retrieve these event notifications. + * + * All methods in this class have their default (empty) implementations, and the app can inherit + * only some of the required events instead of all. In the callback methods, the app should avoid + * time-consuming tasks or calling blocking APIs, otherwise the SDK may not work properly. + */ +class IRtcEngineEventHandler { + public: + virtual ~IRtcEngineEventHandler() {} + + virtual const char* eventHandlerType() const { return "event_handler"; } + + /** + * Occurs when a user joins a channel. + * + * This callback notifies the application that a user joins a specified channel. + * + * @param channel The channel name. + * @param uid The ID of the user who joins the channel. + * @param elapsed The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback. + */ + virtual void onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed) { + (void)channel; + (void)uid; + (void)elapsed; + } + + /** + * Occurs when a user rejoins the channel. + * + * When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect + * and triggers this callback upon reconnection. + * + * @param channel The channel name. + * @param uid The ID of the user who rejoins the channel. + * @param elapsed Time elapsed (ms) from the local user calling the joinChannel method until this callback is triggered. + */ + virtual void onRejoinChannelSuccess(const char* channel, uid_t uid, int elapsed) { + (void)channel; + (void)uid; + (void)elapsed; + } + + /** Occurs when join success after calling \ref IRtcEngine::setLocalAccessPoint "setLocalAccessPoint" or \ref IRtcEngine::setCloudProxy "setCloudProxy" + @param channel Channel name. + @param uid User ID of the user joining the channel. + @param proxyType type of proxy agora sdk connected, proxyType will be NONE_PROXY_TYPE if not connected to proxy(fallback). + @param localProxyIp local proxy ip. if not join local proxy, it will be "". + @param elapsed Time elapsed (ms) from the user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback. + */ + virtual void onProxyConnected(const char* channel, uid_t uid, PROXY_TYPE proxyType, const char* localProxyIp, int elapsed) { + (void)channel; + (void)uid; + (void)proxyType; + (void)localProxyIp; + (void)elapsed; + } + + /** An error occurs during the SDK runtime. + + @param err The error code: #ERROR_CODE_TYPE. + @param msg The detailed error message. + */ + virtual void onError(int err, const char* msg) { + (void)err; + (void)msg; + } + + /** Reports the statistics of the audio stream from each remote + user/broadcaster. + + @deprecated This callback is deprecated. Use onRemoteAudioStats instead. + + The SDK triggers this callback once every two seconds to report the audio + quality of each remote user/host sending an audio stream. If a channel has + multiple remote users/hosts sending audio streams, the SDK triggers this + callback as many times. + + @param uid The user ID of the remote user sending the audio stream. + @param quality The audio quality of the user: #QUALITY_TYPE + @param delay The network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering. + @param lost The audio packet loss rate (%) from the sender to the receiver. + */ + virtual void onAudioQuality(uid_t uid, int quality, unsigned short delay, + unsigned short lost) { + (void)uid; + (void)quality; + (void)delay; + (void)lost; + } + + /** Reports the result of the last-mile network probe result. + * + * The SDK triggers this callback within 30 seconds after the app calls the `startLastmileProbeTest` method. + * @param result The uplink and downlink last-mile network probe test result: LastmileProbeResult. + */ + virtual void onLastmileProbeResult(const LastmileProbeResult& result) { + (void)result; + } + + /** + * Reports the volume information of users. + * + * By default, this callback is disabled. You can enable it by calling `enableAudioVolumeIndication`. Once this + * callback is enabled and users send streams in the channel, the SDK triggers the `onAudioVolumeIndication` + * callback at the time interval set in `enableAudioVolumeIndication`. The SDK triggers two independent + * `onAudioVolumeIndication` callbacks simultaneously, which separately report the volume information of the + * local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest. + * + * @note After you enable this callback, calling muteLocalAudioStream affects the SDK's behavior as follows: + * - If the local user stops publishing the audio stream, the SDK stops triggering the local user's callback. + * - 20 seconds after a remote user whose volume is one of the three highest stops publishing the audio stream, + * the callback excludes this user's information; 20 seconds after all remote users stop publishing audio streams, + * the SDK stops triggering the callback for remote users. + * + * @param speakers The volume information of the users, see AudioVolumeInfo. An empty `speakers` array in the + * callback indicates that no remote user is in the channel or sending a stream at the moment. + * @param speakerNumber The total number of speakers. + * - In the local user's callback, when the local user sends a stream, `speakerNumber` is 1. + * - In the callback for remote users, the value range of speakerNumber is [0,3]. If the number of remote users who + * send streams is greater than or equal to three, the value of `speakerNumber` is 3. + * @param totalVolume The volume of the speaker. The value ranges between 0 (lowest volume) and 255 (highest volume). + * - In the local user's callback, `totalVolume` is the volume of the local user who sends a stream. + * - In the remote users' callback, `totalVolume` is the sum of all remote users (up to three) whose instantaneous + * volume is the highest. If the user calls `startAudioMixing`, `totalVolume` is the volume after audio mixing. + */ + virtual void onAudioVolumeIndication(const AudioVolumeInfo* speakers, unsigned int speakerNumber, + int totalVolume) { + (void)speakers; + (void)speakerNumber; + (void)totalVolume; + } + + /** + * Occurs when a user leaves a channel. + * + * This callback notifies the app that the user leaves the channel by calling `leaveChannel`. From this callback, + * the app can get information such as the call duration and quality statistics. + * + * @param stats The statistics on the call: RtcStats. + */ + virtual void onLeaveChannel(const RtcStats& stats) { (void)stats; } + + /** + * Reports the statistics of the current call. + * + * The SDK triggers this callback once every two seconds after the user joins the channel. + * + * @param stats The statistics of the current call: RtcStats. + */ + virtual void onRtcStats(const RtcStats& stats) { (void)stats; } + + /** Occurs when the audio device state changes. + + This callback notifies the application that the system's audio device state + is changed. For example, a headset is unplugged from the device. + + @param deviceId The device ID. + @param deviceType The device type: #MEDIA_DEVICE_TYPE. + @param deviceState The device state: + - On macOS: + - 0: The device is ready for use. + - 8: The device is not connected. + - On Windows: #MEDIA_DEVICE_STATE_TYPE. + */ + virtual void onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) { + (void)deviceId; + (void)deviceType; + (void)deviceState; + } + + /** + * @brief Reports current AudioMixing progress. + * + * The callback occurs once every one second during the playback and reports the current playback progress. + * @param position Current AudioMixing progress (millisecond). + */ + virtual void onAudioMixingPositionChanged(int64_t position) {} + + /** Occurs when the audio mixing file playback finishes. + @deprecated This method is deprecated, use onAudioMixingStateChanged instead. + + After you call startAudioMixing to play a local music file, this callback occurs when the playback finishes. + If the startAudioMixing method call fails, the SDK returns the error code 701. + */ + virtual void onAudioMixingFinished() __deprecated {} + /** + * Occurs when the playback of the local audio effect file finishes. + * + * This callback occurs when the local audio effect file finishes playing. + * + * @param soundId The audio effect ID. The ID of each audio effect file is unique. + */ + virtual void onAudioEffectFinished(int soundId) {} + + /** Occurs when the video device state changes. + + This callback notifies the application that the system's video device state + is changed. + + @param deviceId Pointer to the device ID. + @param deviceType Device type: #MEDIA_DEVICE_TYPE. + @param deviceState Device state: #MEDIA_DEVICE_STATE_TYPE. + */ + virtual void onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) { + (void)deviceId; + (void)deviceType; + (void)deviceState; + } + + /** + * Reports the last mile network quality of each user in the channel. + * + * This callback reports the last mile network conditions of each user in the channel. Last mile refers to the + * connection between the local device and Agora's edge server. + * + * The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers + * this callback as many times. + * + * @note `txQuality` is UNKNOWN when the user is not sending a stream; `rxQuality` is UNKNOWN when the user is not + * receiving a stream. + * + * @param uid The user ID. The network quality of the user with this user ID is reported. + * @param txQuality Uplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, + * average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you + * understand how well the current uplink network conditions can support the selected video encoder configuration. + * For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame + * rate of 15 fps in the LIVE_BROADCASTING profile, but may be inadequate for resolutions higher than 1280 × 720. + * See #QUALITY_TYPE. + * @param rxQuality Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter + * of the downlink network. See #QUALITY_TYPE. + */ + virtual void onNetworkQuality(uid_t uid, int txQuality, int rxQuality) { + (void)uid; + (void)txQuality; + (void)rxQuality; + } + + /** + * Occurs when intra request from remote user is received. + * + * This callback is triggered once remote user needs one Key frame. + * + */ + virtual void onIntraRequestReceived() {} + + /** + * Occurs when uplink network info is updated. + * + * The SDK triggers this callback when the uplink network information changes. + * + * @note This callback only applies to scenarios where you push externally encoded + * video data in H.264 format to the SDK. + * + * @param info The uplink network information. See UplinkNetworkInfo. + */ + virtual void onUplinkNetworkInfoUpdated(const UplinkNetworkInfo& info) { + (void)info; + } + + /** + * Occurs when downlink network info is updated. + * + * This callback is used for notifying user to switch major/minor stream if needed. + * + * @param info The downlink network info collections. + */ + virtual void onDownlinkNetworkInfoUpdated(const DownlinkNetworkInfo& info) { + (void)info; + } + + /** + * Reports the last-mile network quality of the local user. + * + * This callback reports the last-mile network conditions of the local user before the user joins + * the channel. Last mile refers to the connection between the local device and Agora's edge server. + * + * When the user is not in a channel and the last-mile network test is enabled + * (by calling `startLastmileProbeTest`), this callback function is triggered + * to update the app on the network connection quality of the local user. + * + * @param quality The last mile network quality. See #QUALITY_TYPE. + */ + virtual void onLastmileQuality(int quality) { (void)quality; } + + /** Occurs when the first local video frame is rendered on the local video view. + * + * @param source The video source: #VIDEO_SOURCE_TYPE. + * @param width The width (px) of the first local video frame. + * @param height The height (px) of the first local video frame. + * @param elapsed Time elapsed (ms) from the local user calling the `joinChannel` + * method until the SDK triggers this callback. If you call the `startPreview` method before calling + * the `joinChannel` method, then `elapsed` is the time elapsed from calling the + * `startPreview` method until the SDK triggers this callback. + */ + virtual void onFirstLocalVideoFrame(VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) { + (void)source; + (void)width; + (void)height; + (void)elapsed; + } + + /** Occurs when the first local video frame is published. + * The SDK triggers this callback under one of the following circumstances: + * - The local client enables the video module and calls `joinChannel` successfully. + * - The local client calls `muteLocalVideoStream(true)` and muteLocalVideoStream(false) in sequence. + * - The local client calls `disableVideo` and `enableVideo` in sequence. + * - The local client calls `pushVideoFrame` to successfully push the video frame to the SDK. + * @param source The video source type. + * @param elapsed The time elapsed (ms) from the local user calling joinChannel` to the SDK triggers + * this callback. + */ + virtual void onFirstLocalVideoFramePublished(VIDEO_SOURCE_TYPE source, int elapsed) { + (void)source; + (void)elapsed; + } + + /** Occurs when the first remote video frame is received and decoded. + + The SDK triggers this callback under one of the following circumstances: + - The remote user joins the channel and sends the video stream. + - The remote user stops sending the video stream and re-sends it after 15 seconds. Reasons for such an interruption include: + - The remote user leaves the channel. + - The remote user drops offline. + - The remote user calls `muteLocalVideoStream` to stop sending the video stream. + - The remote user calls `disableVideo` to disable video. + + @param uid The user ID of the remote user sending the video stream. + @param width The width (pixels) of the video stream. + @param height The height (pixels) of the video stream. + @param elapsed The time elapsed (ms) from the local user calling `joinChannel` + until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoDecoded(uid_t uid, int width, int height, int elapsed) __deprecated { + (void)uid; + (void)width; + (void)height; + (void)elapsed; + } + + /** + * Occurs when the local or remote video size or rotation has changed. + * @param sourceType The video source type: #VIDEO_SOURCE_TYPE. + * @param uid The user ID. 0 indicates the local user. + * @param width The new width (pixels) of the video. + * @param height The new height (pixels) of the video. + * @param rotation The rotation information of the video. + */ + virtual void onVideoSizeChanged(VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) { + (void)uid; + (void)width; + (void)height; + (void)rotation; + } + + /** Occurs when the local video stream state changes. + * + * When the state of the local video stream changes (including the state of the video capture and + * encoding), the SDK triggers this callback to report the current state. This callback indicates + * the state of the local video stream, including camera capturing and video encoding, and allows + * you to troubleshoot issues when exceptions occur. + * + * The SDK triggers the onLocalVideoStateChanged callback with the state code of `LOCAL_VIDEO_STREAM_STATE_FAILED` + * and error code of `LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE` in the following situations: + * - The app switches to the background, and the system gets the camera resource. + * - The camera starts normally, but does not output video for four consecutive seconds. + * + * When the camera outputs the captured video frames, if the video frames are the same for 15 + * consecutive frames, the SDK triggers the `onLocalVideoStateChanged` callback with the state code + * of `LOCAL_VIDEO_STREAM_STATE_CAPTURING` and error code of `LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE`. + * Note that the video frame duplication detection is only available for video frames with a resolution + * greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps. + * + * @note For some device models, the SDK does not trigger this callback when the state of the local + * video changes while the local video capturing device is in use, so you have to make your own + * timeout judgment. + * + * @param source The video source type: #VIDEO_SOURCE_TYPE. + * @param state The state of the local video. See #LOCAL_VIDEO_STREAM_STATE. + * @param error The detailed error information. See #LOCAL_VIDEO_STREAM_ERROR. + */ + virtual void onLocalVideoStateChanged(VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_ERROR error) { + (void)source; + (void)state; + (void)error; + } + + /** + * Occurs when the remote video state changes. + * + * @note This callback does not work properly when the number of users (in the voice/video call + * channel) or hosts (in the live streaming channel) in the channel exceeds 17. + * + * @param uid The ID of the user whose video state has changed. + * @param state The remote video state: #REMOTE_VIDEO_STATE. + * @param reason The reason of the remote video state change: #REMOTE_VIDEO_STATE_REASON. + * @param elapsed The time elapsed (ms) from the local client calling `joinChannel` until this callback is triggered. + */ + virtual void onRemoteVideoStateChanged(uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) { + (void)uid; + (void)state; + (void)reason; + (void)elapsed; + } + + /** Occurs when the renderer receives the first frame of the remote video. + * + * @param userId The user ID of the remote user sending the video stream. + * @param width The width (px) of the video frame. + * @param height The height (px) of the video stream. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoFrame(uid_t userId, int width, int height, int elapsed) { + (void)userId; + (void)width; + (void)height; + (void)elapsed; + } + + /** + * Occurs when a remote user or broadcaster joins the channel. + * + * - In the COMMUNICATION channel profile, this callback indicates that a remote user joins the channel. + * The SDK also triggers this callback to report the existing users in the channel when a user joins the + * channel. + * In the LIVE_BROADCASTING channel profile, this callback indicates that a host joins the channel. The + * SDK also triggers this callback to report the existing hosts in the channel when a host joins the + * channel. Agora recommends limiting the number of hosts to 17. + * + * The SDK triggers this callback under one of the following circumstances: + * - A remote user/host joins the channel by calling the `joinChannel` method. + * - A remote user switches the user role to the host after joining the channel. + * - A remote user/host rejoins the channel after a network interruption. + * + * @param uid The ID of the remote user or broadcaster joining the channel. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` or `setClientRole` + * until this callback is triggered. + */ + virtual void onUserJoined(uid_t uid, int elapsed) { + (void)uid; + (void)elapsed; + } + + /** + * Occurs when a remote user or broadcaster goes offline. + * + * There are two reasons for a user to go offline: + * - Leave the channel: When the user leaves the channel, the user sends a goodbye message. When this + * message is received, the SDK determines that the user leaves the channel. + * - Drop offline: When no data packet of the user is received for a certain period of time, the SDK assumes + * that the user drops offline. A poor network connection may lead to false detection, so we recommend using + * the RTM SDK for reliable offline detection. + * - The user switches the user role from a broadcaster to an audience. + * + * @param uid The ID of the remote user or broadcaster who leaves the channel or drops offline. + * @param reason The reason why the remote user goes offline: #USER_OFFLINE_REASON_TYPE. + */ + virtual void onUserOffline(uid_t uid, USER_OFFLINE_REASON_TYPE reason) { + (void)uid; + (void)reason; + } + + /** Occurs when a remote user's audio stream playback pauses/resumes. + + The SDK triggers this callback when the remote user stops or resumes sending the audio stream by + calling the `muteLocalAudioStream` method. + + @note This callback can be inaccurate when the number of users (in the `COMMUNICATION` profile) or hosts (in the `LIVE_BROADCASTING` profile) in the channel exceeds 17. + + @param uid The user ID. + @param muted Whether the remote user's audio stream is muted/unmuted: + - true: Muted. + - false: Unmuted. + */ + virtual void onUserMuteAudio(uid_t uid, bool muted) { + (void)uid; + (void)muted; + } + + /** Occurs when a remote user pauses or resumes sending the video stream. + * + * When a remote user calls `muteLocalVideoStream` to stop or resume publishing the video stream, the + * SDK triggers this callback to report the state of the remote user's publishing stream to the local + * user. + + @note This callback is invalid when the number of users or broadacasters in a + channel exceeds 20. + + @param userId ID of the remote user. + @param muted Whether the remote user stops publishing the video stream: + - true: The remote user has paused sending the video stream. + - false: The remote user has resumed sending the video stream. + */ + virtual void onUserMuteVideo(uid_t userId, bool muted) { + (void)userId; + (void)muted; + } + + /** Occurs when a remote user enables or disables the video module. + + Once the video function is disabled, the users cannot see any video. + + The SDK triggers this callback when a remote user enables or disables the video module by calling the + `enableVideo` or `disableVideo` method. + + @param uid The ID of the remote user. + @param enabled Whether the video of the remote user is enabled: + - true: The remote user has enabled video. + - false: The remote user has disabled video. + */ + virtual void onUserEnableVideo(uid_t uid, bool enabled) __deprecated { + (void)uid; + (void)enabled; + } + + /** + * Occurs when the remote user state is updated. + * @param uid The uid of the remote user. + * @param state The remote user state: #REMOTE_USER_STATE. + */ + virtual void onUserStateChanged(uid_t uid, uint32_t state) { + (void)uid; + (void)state; + } + + /** Occurs when a remote user enables or disables local video capturing. + + The SDK triggers this callback when the remote user resumes or stops capturing the video stream by + calling the `enableLocalVideo` method. + + @param uid The ID of the remote user. + @param enabled Whether the specified remote user enables/disables local video: + - `true`: The remote user has enabled local video capturing. + - `false`: The remote user has disabled local video capturing. + */ + virtual void onUserEnableLocalVideo(uid_t uid, bool enabled) __deprecated { + (void)uid; + (void)enabled; + } + + /** + * Occurs when a method is executed by the SDK. + * @deprecated This callback is deprecated. Use other specific event callbacks instead. + * + * @param api The method executed by the SDK. + * @param err The error code returned by the SDK when the method call fails. If the SDK returns 0, + * then the method call is successful. + * @param result The result of the method call. + */ + virtual void onApiCallExecuted(int err, const char* api, const char* result) __deprecated { + (void)err; + (void)api; + (void)result; + } + + /** Reports the statistics of the local audio stream. + * + * The SDK triggers this callback once every two seconds. + * + * @param stats The statistics of the local audio stream. + * See LocalAudioStats. + */ + virtual void onLocalAudioStats(const LocalAudioStats& stats) { + (void)stats; + } + + /** Reports the statistics of the audio stream from each remote user/host. + + The SDK triggers this callback once every two seconds for each remote user who is sending audio + streams. If a channel includes multiple remote users, the SDK triggers this callback as many times. + + @param stats Statistics of the received remote audio streams. See RemoteAudioStats. + */ + virtual void onRemoteAudioStats(const RemoteAudioStats& stats) { + (void)stats; + } + + /** Reports the statistics of the local video stream. + * + * The SDK triggers this callback once every two seconds for each + * user/host. If there are multiple users/hosts in the channel, the SDK + * triggers this callback as many times. + * + * @note If you have called the `enableDualStreamMode` + * method, this callback reports the statistics of the high-video + * stream (high bitrate, and high-resolution video stream). + * + * @param source The video source type. See #VIDEO_SOURCE_TYPE. + * @param stats Statistics of the local video stream. See LocalVideoStats. + */ + virtual void onLocalVideoStats(VIDEO_SOURCE_TYPE source, const LocalVideoStats& stats) { + (void)source; + (void)stats; + } + + /** Reports the statistics of the video stream from each remote user/host. + * + * The SDK triggers this callback once every two seconds for each remote user. If a channel has + * multiple users/hosts sending video streams, the SDK triggers this callback as many times. + * + * @param stats Statistics of the remote video stream. See + * RemoteVideoStats. + */ + virtual void onRemoteVideoStats(const RemoteVideoStats& stats) { + (void)stats; + } + /** + * Occurs when the camera turns on and is ready to capture the video. + * @deprecated Use `LOCAL_VIDEO_STREAM_STATE_CAPTURING(1)` in onLocalVideoStateChanged instead. + * This callback indicates that the camera has been successfully turned on and you can start to capture video. + */ + virtual void onCameraReady() {} + /** + * Occurs when the camera focus area changes. + * + * @note This method is for Andriod and iOS only. + * + * @param x The x coordinate of the changed camera focus area. + * @param y The y coordinate of the changed camera focus area. + * @param width The width of the changed camera focus area. + * @param height The height of the changed camera focus area. + */ + virtual void onCameraFocusAreaChanged(int x, int y, int width, int height) { + (void)x; + (void)y; + (void)width; + (void)height; + } + /** + * Occurs when the camera exposure area changes. + * + * @param x The x coordinate of the changed camera exposure area. + * @param y The y coordinate of the changed camera exposure area. + * @param width The width of the changed camera exposure area. + * @param height The height of the changed exposure area. + */ + virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) { + (void)x; + (void)y; + (void)width; + (void)height; + } +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + /** + * Reports the face detection result of the local user. + * + * Once you enable face detection by calling enableFaceDetection(true), you can get the following + * information on the local user in real-time: + * - The width and height of the local video. + * - The position of the human face in the local view. + * - The distance between the human face and the screen. + * + * This value is based on the fitting calculation of the local video size and the position of the human face. + * + * @note + * - This callback is for Android and iOS only. + * - When it is detected that the face in front of the camera disappears, the callback will be + * triggered immediately. In the state of no face, the trigger frequency of the callback will be + * reduced to save power consumption on the local device. + * - The SDK stops triggering this callback when a human face is in close proximity to the screen. + * On Android, the value of `distance` reported in this callback may be slightly different from the + * actual distance. Therefore, Agora does not recommend using it for accurate calculation. + * + * @param imageWidth The width (px) of the video image captured by the local camera. + * @param imageHeight The height (px) of the video image captured by the local camera. + * @param vecRectangle The information of the detected human face: + * - x: The x-coordinate (px) of the human face in the local view. Taking the top left corner of the view as the origin, the x-coordinate represents the horizontal position of the human face relative to the origin. + * - y: The y-coordinate (px) of the human face in the local view. Taking the top left corner of the view as the origin, the y-coordinate represents the vertical position of the human face relative to the origin. + * - width: The width (px) of the human face in the captured view. + * - height: The height (px) of the human face in the captured view. + * @param vecDistance The distance between the human face and the device screen (cm). + * @param numFaces The number of faces detected. If the value is 0, it means that no human face is detected. + */ + virtual void onFacePositionChanged(int imageWidth, int imageHeight, + const Rectangle* vecRectangle, const int* vecDistance, + int numFaces) { + (void) imageWidth; + (void) imageHeight; + (void) vecRectangle; + (void) vecDistance; + (void) numFaces; + } +#endif + /** + * Occurs when the video stops playing. + * @deprecated Use `LOCAL_VIDEO_STREAM_STATE_STOPPED(0)` in the onLocalVideoStateChanged callback instead. + * + * The app can use this callback to change the configuration of the view (for example, displaying + * other pictures in the view) after the video stops playing. + */ + virtual void onVideoStopped() {} + + /** Occurs when the playback state of the music file changes. + * + * This callback occurs when the playback state of the music file changes, and reports the current state and error code. + + @param state The playback state of the music file. See #AUDIO_MIXING_STATE_TYPE. + @param reason The reason for the change of the music file playback state. See #AUDIO_MIXING_REASON_TYPE. + */ + virtual void onAudioMixingStateChanged(AUDIO_MIXING_STATE_TYPE state, AUDIO_MIXING_REASON_TYPE reason) { + (void)state; + (void)reason; + } + + /** Occurs when the state of the rhythm player changes. + When you call the \ref IRtcEngine::startRhythmPlayer "startRhythmPlayer" + method and the state of rhythm player changes, the SDK triggers this + callback. + + @param state The state code. See #RHYTHM_PLAYER_STATE_TYPE. + @param errorCode The error code. See #RHYTHM_PLAYER_ERROR_TYPE. + */ + virtual void onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_ERROR_TYPE errorCode) { + (void)state; + (void)errorCode; + } + + /** + * Occurs when the SDK cannot reconnect to the server 10 seconds after its connection to the server is + * interrupted. + * + * The SDK triggers this callback when it cannot connect to the server 10 seconds after calling + * `joinChannel`, regardless of whether it is in the channel or not. If the SDK fails to rejoin + * the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel. + */ + virtual void onConnectionLost() {} + + /** Occurs when the connection between the SDK and the server is interrupted. + * @deprecated Use `onConnectionStateChanged` instead. + + The SDK triggers this callback when it loses connection with the serer for more + than 4 seconds after the connection is established. After triggering this + callback, the SDK tries to reconnect to the server. If the reconnection fails + within a certain period (10 seconds by default), the onConnectionLost() + callback is triggered. If the SDK fails to rejoin the channel 20 minutes after + being disconnected from Agora's edge server, the SDK stops rejoining the channel. + + */ + virtual void onConnectionInterrupted() {} + + /** Occurs when your connection is banned by the Agora Server. + * @deprecated Use `onConnectionStateChanged` instead. + */ + virtual void onConnectionBanned() {} + + /** Occurs when the local user receives the data stream from the remote user. + * + * The SDK triggers this callback when the user receives the data stream that another user sends + * by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method. + * + * @param userId ID of the user who sends the data stream. + * @param streamId The ID of the stream data. + * @param data The data stream. + * @param length The length (byte) of the data stream. + * @param sentTs The time when the data stream sent. + */ + virtual void onStreamMessage(uid_t userId, int streamId, const char* data, size_t length, uint64_t sentTs) { + (void)userId; + (void)streamId; + (void)data; + (void)length; + (void)sentTs; + } + + /** Occurs when the local user does not receive the data stream from the remote user. + * + * The SDK triggers this callback when the user fails to receive the data stream that another user sends + * by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method. + * + * @param userId ID of the user who sends the data stream. + * @param streamId The ID of the stream data. + * @param code The error code. + * @param missed The number of lost messages. + * @param cached The number of incoming cached messages when the data stream is + * interrupted. + */ + virtual void onStreamMessageError(uid_t userId, int streamId, int code, int missed, int cached) { + (void)userId; + (void)streamId; + (void)code; + (void)missed; + (void)cached; + } + + /** + * Occurs when the token expires. + * + * When the token expires during a call, the SDK triggers this callback to remind the app to renew the token. + * + * Upon receiving this callback, generate a new token at your app server and call + * `joinChannel` to pass the new token to the SDK. + * + */ + virtual void onRequestToken() {} + + /** + * Occurs when the token will expire in 30 seconds. + * + * When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token. + + * Upon receiving this callback, generate a new token at your app server and call + * \ref IRtcEngine::renewToken "renewToken" to pass the new Token to the SDK. + * + * + * @param token The token that will expire in 30 seconds. + */ + virtual void onTokenPrivilegeWillExpire(const char* token) { + (void)token; + } + + /** + * Occurs when connection license verification fails. + * + * You can know the reason accordding to error code + */ + virtual void onLicenseValidationFailure(LICENSE_ERROR_TYPE error) { + (void)error; + } + + /** Occurs when the first local audio frame is published. + * + * The SDK triggers this callback under one of the following circumstances: + * - The local client enables the audio module and calls `joinChannel` successfully. + * - The local client calls `muteLocalAudioStream(true)` and `muteLocalAudioStream(false)` in sequence. + * - The local client calls `disableAudio` and `enableAudio` in sequence. + * - The local client calls `pushAudioFrame` to successfully push the audio frame to the SDK. + * + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` to the SDK triggers this callback. + */ + virtual void onFirstLocalAudioFramePublished(int elapsed) { + (void)elapsed; + } + + /** Occurs when the SDK receives the first audio frame from a specific remote user. + * @deprecated Use `onRemoteAudioStateChanged` instead. + * + * @param uid ID of the remote user. + * @param elapsed The time elapsed (ms) from the loca user calling `joinChannel` + * until this callback is triggered. + */ + virtual void onFirstRemoteAudioFrame(uid_t uid, int elapsed) { + (void)uid; + (void)elapsed; + } + + /** + * Occurs when the SDK decodes the first remote audio frame for playback. + * + * @deprecated Use `onRemoteAudioStateChanged` instead. + * The SDK triggers this callback under one of the following circumstances: + * - The remote user joins the channel and sends the audio stream for the first time. + * - The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot + * receive audio in 15 seconds. Reasons for such an interruption include: + * - The remote user leaves channel. + * - The remote user drops offline. + * - The remote user calls muteLocalAudioStream to stop sending the audio stream. + * - The remote user calls disableAudio to disable audio. + * @param uid User ID of the remote user sending the audio stream. + * @param elapsed The time elapsed (ms) from the loca user calling `joinChannel` + * until this callback is triggered. + */ + virtual void onFirstRemoteAudioDecoded(uid_t uid, int elapsed) { + (void)uid; + (void)elapsed; + } + + /** Occurs when the local audio state changes. + * + * When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK + * triggers this callback to report the current state. This callback indicates the state of the local audio stream, + * and allows you to troubleshoot issues when audio exceptions occur. + * + * @note + * When the state is `LOCAL_AUDIO_STREAM_STATE_FAILED(3)`, see the `error` + * parameter for details. + * + * @param state State of the local audio. See #LOCAL_AUDIO_STREAM_STATE. + * @param error The error information of the local audio. + * See #LOCAL_AUDIO_STREAM_ERROR. + */ + virtual void onLocalAudioStateChanged(LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error) { + (void)state; + (void)error; + } + + /** Occurs when the remote audio state changes. + * + * When the audio state of a remote user (in the voice/video call channel) or host (in the live streaming channel) + * changes, the SDK triggers this callback to report the current state of the remote audio stream. + * + * @note This callback does not work properly when the number of users (in the voice/video call channel) or hosts + * (in the live streaming channel) in the channel exceeds 17. + * + * @param uid ID of the remote user whose audio state changes. + * @param state State of the remote audio. See #REMOTE_AUDIO_STATE. + * @param reason The reason of the remote audio state change. + * See #REMOTE_AUDIO_STATE_REASON. + * @param elapsed Time elapsed (ms) from the local user calling the + * `joinChannel` method until the SDK + * triggers this callback. + */ + virtual void onRemoteAudioStateChanged(uid_t uid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) { + (void)uid; + (void)state; + (void)reason; + (void)elapsed; + } + + /** + * Occurs when an active speaker is detected. + * + * After a successful call of `enableAudioVolumeIndication`, the SDK continuously detects which remote user has the + * loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, + * is the most active user. + * + * When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker. + * - If the most active remote speaker is always the same user, the SDK triggers the `onActiveSpeaker` callback only once. + * - If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker. + * + * @param userId The ID of the active speaker. A `uid` of 0 means the local user. + */ + virtual void onActiveSpeaker(uid_t userId) { (void)userId; } + /** Reports result of content inspection. + * + * @param result The result of content inspection: #CONTENT_INSPECT_RESULT. + */ + virtual void onContentInspectResult(media::CONTENT_INSPECT_RESULT result) { (void)result; } + /** Reports the result of taking a video snapshot. + * + * After a successful `takeSnapshot` method call, the SDK triggers this callback to report whether the snapshot is + * successfully taken, as well as the details for that snapshot. + * + * @param uid The user ID. A `uid` of 0 indicates the local user. + * @param filePath The local path of the snapshot. + * @param width The width (px) of the snapshot. + * @param height The height (px) of the snapshot. + * @param errCode The message that confirms success or gives the reason why the snapshot is not successfully taken: + * - 0: Success. + * - < 0: Failure. + * - -1: The SDK fails to write data to a file or encode a JPEG image. + * - -2: The SDK does not find the video stream of the specified user within one second after the `takeSnapshot` method call succeeds. + * - -3: Calling the `takeSnapshot` method too frequently. Call the `takeSnapshot` method after receiving the `onSnapshotTaken` + * callback from the previous call. + */ + virtual void onSnapshotTaken(uid_t uid, const char* filePath, int width, int height, int errCode) { + (void)uid; + (void)filePath; + (void)width; + (void)height; + (void)errCode; + } + /** + * Occurs when the user role switches in the interactive live streaming. + * + * @param oldRole The old role of the user: #CLIENT_ROLE_TYPE. + * @param newRole The new role of the user: #CLIENT_ROLE_TYPE. + * @param newRoleOptions The client role options of the new role: #ClientRoleOptions. + */ + virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) { + (void)oldRole; + (void)newRole; + (void)newRoleOptions; + } + /** + * Occurs when the user role in a Live-Broadcast channel fails to switch, for example, from a broadcaster + * to an audience or vice versa. + * + * @param reason The reason for failing to change the client role: #CLIENT_ROLE_CHANGE_FAILED_REASON. + * @param currentRole The current role of the user: #CLIENT_ROLE_TYPE. + */ + virtual void onClientRoleChangeFailed(CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) { + (void)reason; + (void)currentRole; + } + /** Occurs when the audio device volume changes. + @param deviceType The device type, see #MEDIA_DEVICE_TYPE + @param volume The volume of the audio device. + @param muted Whether the audio device is muted: + - true: The audio device is muted. + - false: The audio device is not muted. + */ + virtual void onAudioDeviceVolumeChanged(MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) { + (void)deviceType; + (void)volume; + (void)muted; + } + + /** + * Occurs when the state of the RTMP streaming changes. + * + * When the media push state changes, the SDK triggers this callback and reports the URL address and the current state + * of the media push. This callback indicates the state of the media push. When exceptions occur, you can troubleshoot + * issues by referring to the detailed error descriptions in the error code. + * + * @param url The URL address where the state of the media push changes. + * @param state The current state of the media push: #RTMP_STREAM_PUBLISH_STATE. + * @param errCode The detailed error information for the media push: #RTMP_STREAM_PUBLISH_ERROR_TYPE. + */ + virtual void onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, + RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) { + (void)url; + (void)state; + (void)errCode; + } + + /** Reports events during the media push. + * + * @param url The URL for media push. + * @param eventCode The event code of media push. See RTMP_STREAMING_EVENT for details. + */ + virtual void onRtmpStreamingEvent(const char* url, RTMP_STREAMING_EVENT eventCode) { + (void)url; + (void)eventCode; + } + + /** + * Occurs when the publisher's transcoding settings are updated. + * + * When the `LiveTranscoding` class in \ref IRtcEngine::setLiveTranscoding "setLiveTranscoding" + * updates, the SDK triggers this callback to report the update information. + * + * @note + * If you call the `setLiveTranscoding` method to set the `LiveTranscoding` class for the first time, the SDK + * does not trigger this callback. + */ + virtual void onTranscodingUpdated() {} + + /** Occurs when the local audio route changes (for Android, iOS, and macOS only). + + The SDK triggers this callback when the local audio route switches to an + earpiece, speakerphone, headset, or Bluetooth device. + @param routing The current audio output routing: + - -1: Default. + - 0: Headset. + - 1: Earpiece. + - 2: Headset with no microphone. + - 3: Speakerphone. + - 4: Loudspeaker. + - 5: Bluetooth headset. + */ + virtual void onAudioRoutingChanged(int routing) { (void)routing; } + + + /** + * Occurs when the state of the media stream relay changes. + * + * The SDK reports the state of the current media relay and possible error messages in this + * callback. + * + * @param state The state code: + * - `RELAY_STATE_IDLE(0)`: The SDK is initializing. + * - `RELAY_STATE_CONNECTING(1)`: The SDK tries to relay the media stream to the destination + * channel. + * - `RELAY_STATE_RUNNING(2)`: The SDK successfully relays the media stream to the destination + * channel. + * - `RELAY_STATE_FAILURE(3)`: A failure occurs. See the details in `code`. + * @param code The error code: + * - `RELAY_OK(0)`: The state is normal. + * - `RELAY_ERROR_SERVER_ERROR_RESPONSE(1)`: An error occurs in the server response. + * - `RELAY_ERROR_SERVER_NO_RESPONSE(2)`: No server response. You can call the leaveChannel method + * to leave the channel. + * - `RELAY_ERROR_NO_RESOURCE_AVAILABLE(3)`: The SDK fails to access the service, probably due to + * limited resources of the server. + * - `RELAY_ERROR_FAILED_JOIN_SRC(4)`: Fails to send the relay request. + * - `RELAY_ERROR_FAILED_JOIN_DEST(5)`: Fails to accept the relay request. + * - `RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC(6)`: The server fails to receive the media + * stream. + * - `RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST(7)`: The server fails to send the media stream. + * - `RELAY_ERROR_SERVER_CONNECTION_LOST(8)`: The SDK disconnects from the server due to poor + * network connections. You can call the leaveChannel method to leave the channel. + * - `RELAY_ERROR_INTERNAL_ERROR(9)`: An internal error occurs in the server. + * - `RELAY_ERROR_SRC_TOKEN_EXPIRED(10)`: The token of the source channel has expired. + * - `RELAY_ERROR_DEST_TOKEN_EXPIRED(11)`: The token of the destination channel has expired. + */ + virtual void onChannelMediaRelayStateChanged(int state, int code) { + (void)state; + (void)code; + } + + /** + * Reports events during the media stream relay. + * + * @param code The event code for media stream relay: + * - `RELAY_EVENT_NETWORK_DISCONNECTED(0)`: The user disconnects from the server due to poor + * network connections. + * - `RELAY_EVENT_NETWORK_CONNECTED(1)`: The network reconnects. + * - `RELAY_EVENT_PACKET_JOINED_SRC_CHANNEL(2)`: The user joins the source channel. + * - `RELAY_EVENT_PACKET_JOINED_DEST_CHANNEL(3)`: The user joins the destination channel. + * - `RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL(4)`: The SDK starts relaying the media stream to the + * destination channel. + * - `RELAY_EVENT_PACKET_RECEIVED_VIDEO_FROM_SRC(5)`: The server receives the video stream from + * the source channel. + * - `RELAY_EVENT_PACKET_RECEIVED_AUDIO_FROM_SRC(6)`: The server receives the audio stream from + * the source channel. + * - `RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL(7)`: The destination channel is updated. + * - `RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_REFUSED(8)`: The destination channel update fails due + * to internal reasons. Deprecated from 4.1.0 + * - `RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE(9)`: The destination channel does not + * change, which means that the destination channel fails to be updated. + * - `RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL(10)`: The destination channel name is NULL. + * - `RELAY_EVENT_VIDEO_PROFILE_UPDATE(11)`: The video profile is sent to the server. + */ + virtual void onChannelMediaRelayEvent(int code) { + (void)code; + } + /** + * Occurs when the published media stream falls back to an audio-only stream due to poor network conditions or + * switches back to video stream after the network conditions improve. + * + * If you call `setLocalPublishFallbackOption` and set `option` as `STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)`, this + * callback is triggered when the locally published stream falls back to audio-only mode due to poor uplink + * conditions, or when the audio stream switches back to the video after the uplink network condition improves. + * Once the published stream falls back to audio only, the remote app receives the `onRemoteVideoStateChanged` callback. + * + * @param isFallbackOrRecover Whether the published stream fell back to audio-only or switched back to the video: + * - `true`: The published stream fell back to audio-only due to poor network conditions. + * - `false`: The published stream switched back to the video after the network conditions improved. + */ + virtual void onLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover) { + (void)isFallbackOrRecover; + } + /** + * Occurs when the remote media stream falls back to audio-only stream due to poor network conditions or + * switches back to video stream after the network conditions improve. + * + * If you call `setRemoteSubscribeFallbackOption` and set `option` as `STREAM_FALLBACK_OPTION_AUDIO_ONLY(2)`, this + * callback is triggered when the remotely subscribed media stream falls back to audio-only mode due to poor downlink + * conditions, or when the remotely subscribed media stream switches back to the video after the downlink network + * condition improves. + * + * @note Once the remote media stream is switched to the low stream due to poor network conditions, you can monitor + * the stream switch between a high and low stream in the `onRemoteVideoStats` callback. + * + * @param uid ID of the remote user sending the stream. + * @param isFallbackOrRecover Whether the remote media stream fell back to audio-only or switched back to the video: + * - `true`: The remote media stream fell back to audio-only due to poor network conditions. + * - `false`: The remote media stream switched back to the video stream after the network conditions improved. + */ + virtual void onRemoteSubscribeFallbackToAudioOnly(uid_t uid, bool isFallbackOrRecover) { + (void)uid; + (void)isFallbackOrRecover; + } + + /** Reports the transport-layer statistics of each remote audio stream. + * @deprecated Use `onRemoteAudioStats` instead. + + This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every + two seconds after the local user receives an audio packet from a remote user. During a call, when the user receives + the audio packet sent by the remote user/host, the callback is triggered every 2 seconds. + + @param uid ID of the remote user whose audio data packet is received. + @param delay The network time delay (ms) from the sender to the receiver. + @param lost The Packet loss rate (%) of the audio packet sent from the remote + user. + @param rxKBitRate Received bitrate (Kbps) of the audio packet sent from the + remote user. + */ + virtual void onRemoteAudioTransportStats(uid_t uid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) { + (void)uid; + (void)delay; + (void)lost; + (void)rxKBitRate; + } + + /** Reports the transport-layer statistics of each remote video stream. + * @deprecated Use `onRemoteVideoStats` instead. + + This callback reports the transport-layer statistics, such as the packet loss rate and network time + delay, once every two seconds after the local user receives a video packet from a remote user. + + During a call, when the user receives the video packet sent by the remote user/host, the callback is + triggered every 2 seconds. + + @param uid ID of the remote user whose video packet is received. + @param delay The network time delay (ms) from the remote user sending the + video packet to the local user. + @param lost The packet loss rate (%) of the video packet sent from the remote + user. + @param rxKBitRate The bitrate (Kbps) of the video packet sent from + the remote user. + */ + virtual void onRemoteVideoTransportStats(uid_t uid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) { + (void)uid; + (void)delay; + (void)lost; + (void)rxKBitRate; + } + + /** Occurs when the network connection state changes. + * + * When the network connection state changes, the SDK triggers this callback and reports the current + * connection state and the reason for the change. + + @param state The current connection state. See #CONNECTION_STATE_TYPE. + @param reason The reason for a connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnectionStateChanged( + CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason) { + (void)state; + (void)reason; + } + + /** Occurs when the WIFI message need be sent to the user. + * + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ + virtual void onWlAccMessage(WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) { + (void)reason; + (void)action; + (void)wlAccMsg; + } + + /** Occurs when SDK statistics wifi acceleration optimization effect. + * + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ + virtual void onWlAccStats(WlAccStats currentStats, WlAccStats averageStats) { + (void)currentStats; + (void)averageStats; + } + + /** Occurs when the local network type changes. + * + * This callback occurs when the connection state of the local user changes. You can get the + * connection state and reason for the state change in this callback. When the network connection + * is interrupted, this callback indicates whether the interruption is caused by a network type + * change or poor network conditions. + + @param type The type of the local network connection. See #NETWORK_TYPE. + */ + virtual void onNetworkTypeChanged(NETWORK_TYPE type) { + (void)type; + } + + /** Reports the built-in encryption errors. + * + * When encryption is enabled by calling `enableEncryption`, the SDK triggers this callback if an + * error occurs in encryption or decryption on the sender or the receiver side. + + @param errorType The error type. See #ENCRYPTION_ERROR_TYPE. + */ + virtual void onEncryptionError(ENCRYPTION_ERROR_TYPE errorType) { + (void)errorType; + } + + /** Occurs when the SDK cannot get the device permission. + * + * When the SDK fails to get the device permission, the SDK triggers this callback to report which + * device permission cannot be got. + * + * @note This method is for Android and iOS only. + + @param permissionType The type of the device permission. See #PERMISSION_TYPE. + */ + virtual void onPermissionError(PERMISSION_TYPE permissionType) { + (void)permissionType; + } + + /** Occurs when the local user registers a user account. + * + * After the local user successfully calls `registerLocalUserAccount` to register the user account + * or calls `joinChannelWithUserAccount` to join a channel, the SDK triggers the callback and + * informs the local user's UID and User Account. + + @param uid The ID of the local user. + @param userAccount The user account of the local user. + */ + virtual void onLocalUserRegistered(uid_t uid, const char* userAccount) { + (void)uid; + (void)userAccount; + } + + /** Occurs when the SDK gets the user ID and user account of the remote user. + + After a remote user joins the channel, the SDK gets the UID and user account of the remote user, + caches them in a mapping table object (`userInfo`), and triggers this callback on the local client. + + @param uid The ID of the remote user. + @param info The `UserInfo` object that contains the user ID and user account of the remote user. + */ + virtual void onUserInfoUpdated(uid_t uid, const UserInfo& info) { + (void)uid; + (void)info; + } + /** + * Reports the user log upload result + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ + virtual void onUploadLogResult(const char* requestId, bool success, UPLOAD_ERROR_REASON reason) { + (void)requestId; + (void)success; + (void)reason; + } + + /** + * Occurs when the audio subscribing state changes. + * + * @param channel The name of the channel. + * @param uid The ID of the remote user. + * @param oldState The previous subscribing status: #STREAM_SUBSCRIBE_STATE. + * @param newState The current subscribing status: #STREAM_SUBSCRIBE_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the previous state to the current state. + */ + virtual void onAudioSubscribeStateChanged(const char* channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) { + (void)channel; + (void)uid; + (void)oldState; + (void)newState; + (void)elapseSinceLastState; + } + + /** + * Occurs when the video subscribing state changes. + * + * @param channel The name of the channel. + * @param uid The ID of the remote user. + * @param oldState The previous subscribing status: #STREAM_SUBSCRIBE_STATE. + * @param newState The current subscribing status: #STREAM_SUBSCRIBE_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the previous state to the current state. + */ + virtual void onVideoSubscribeStateChanged(const char* channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) { + (void)channel; + (void)uid; + (void)oldState; + (void)newState; + (void)elapseSinceLastState; + } + + /** + * Occurs when the audio publishing state changes. + * + * @param channel The name of the channel. + * @param oldState The previous publishing state: #STREAM_PUBLISH_STATE. + * @param newState The current publishing state: #STREAM_PUBLISH_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the previous state to the current state. + */ + virtual void onAudioPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) { + (void)channel; + (void)oldState; + (void)newState; + (void)elapseSinceLastState; + } + + /** + * Occurs when the video publishing state changes. + * + * @param source The video source type. + * @param channel The name of the channel. + * @param oldState The previous publishing state: #STREAM_PUBLISH_STATE. + * @param newState The current publishing state: #STREAM_PUBLISH_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the previous state to the current state. + */ + virtual void onVideoPublishStateChanged(VIDEO_SOURCE_TYPE source, const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) { + (void)source; + (void)channel; + (void)oldState; + (void)newState; + (void)elapseSinceLastState; + } + /** + * The event callback of the extension. + * + * To listen for events while the extension is running, you need to register this callback. + * + * @deprecated This method is deprecated. override needExtensionContext method + * and use onEventWithContext instead + * + * @param provider The name of the extension provider. + * @param extension The name of the extension. + * @param key The key of the extension. + * @param value The value of the extension key. + */ + virtual void onExtensionEvent(const char* provider, const char* extension, const char* key, const char* value) __deprecated { + (void)provider; + (void)extension; + (void)key; + (void)value; + } + /** + * Occurs when the extension is enabled. + * + * After a successful create of filter, the extension triggers this callback. + * + * @deprecated This method is deprecated. override needExtensionContext method + * and use onExtensionStartedWithContext instead + * + * @param provider The name of the extension provider. + * @param extension The name of the extension. + */ + virtual void onExtensionStarted(const char* provider, const char* extension) __deprecated { + (void)provider; + (void)extension; + } + /** + * Occurs when the extension is disabled. + * + * After a successful create of filter, the extension triggers this callback. + * + * @deprecated This method is deprecated. override needExtensionContext method + * and use onExtensionStoppedWithContext instead + * + * @param provider The name of the extension provider. + * @param extension The name of the extension. + */ + virtual void onExtensionStopped(const char* provider, const char* extension) __deprecated { + (void)provider; + (void)extension; + } + /** + * Occurs when the extension runs incorrectly. + * + * When the extension runs in error, the extension triggers + * this callback and reports the error code and reason. + * + * @deprecated This method is deprecated. override needExtensionContext method + * and use onExtensionErrorWithContext instead + * + * @param provider The name of the extension provider. + * @param extension The name of the extension. + * @param error The error code. For details, see the extension documentation provided by the extension provider. + * @param message The error message. For details, see the extension documentation provided by the extension provider. + */ + virtual void onExtensionError(const char* provider, const char* extension, int error, const char* message) __deprecated { + (void)provider; + (void)extension; + (void)error; + (void)message; + } + /** + * Occurs when the user account is updated. + * + * @param uid The user ID. + * @param userAccount The user account. + */ + virtual void onUserAccountUpdated(uid_t uid, const char* userAccount){ + (void)uid; + (void)userAccount; + } + + /** Whether need ExtensionContext \ref agoro::rtc::ExtensionContext + * + * recommend override for true + * return false, then callback interface with onExtensionEvent、onExtensionStarted、onExtensionStopped、onExtensionError + * return true, then callback interface conterpart with *WithContext interface + */ + virtual bool needExtensionContext() {return false;} + + /** + * The event callback of the extension. + * + * To listen for events while the extension is running, you need to register this callback. + * + * @param context The context of the extension. + * @param key The key of the extension. + * @param value The value of the extension key. + */ + virtual void onExtensionEventWithContext(const ExtensionContext &context, const char* key, const char* value) { + (void)context; + (void)key; + (void)value; + } + + /** + * Occurs when the extension is enabled. + * + * After a successful create of filter , the extension triggers this callback. + * + * @param context The context of the extension. + */ + virtual void onExtensionStartedWithContext(const ExtensionContext &context) { + (void)context; + } + + /** + * Occurs when the extension is disabled. + * + * After a successful create of filter, the extension triggers this callback. + * + * @param context The context of the extension. + */ + virtual void onExtensionStoppedWithContext(const ExtensionContext &context) { + (void)context; + } + + /** + * Occurs when the extension runs incorrectly. + * + * When the extension runs in error, the extension triggers + * this callback and reports the error code and reason. + * + * @param context The context of the extension. + * @param error The error code. For details, see the extension documentation provided by the extension provider. + * @param message The error message. For details, see the extension documentation provided by the extension provider. + */ + virtual void onExtensionErrorWithContext(const ExtensionContext &context, int error, const char* message) { + (void)context; + (void)error; + (void)message; + } + + /** + * Reports the tracing result of video rendering event of the user. + * + * @param uid The user ID. + * @param currentEvent The current event of the tracing result: #MEDIA_TRACE_EVENT. + * @param tracingInfo The tracing result: #VideoRenderingTracingInfo. + */ + virtual void onVideoRenderingTracingResult(uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) { + (void)uid; + (void)currentEvent; + (void)tracingInfo; + } + + /** + * Occurs when local video transcoder stream has an error. + * + * @param stream Stream type of TranscodingVideoStream. + * @param error Error code of VIDEO_TRANSCODER_ERROR. + */ + virtual void onLocalVideoTranscoderError(const TranscodingVideoStream& stream, VIDEO_TRANSCODER_ERROR error){ + (void)stream; + (void)error; + } + + virtual void onTranscodedStreamLayoutInfo(uid_t uid, int width, int height, int layoutCount,const VideoLayout* layoutlist) { + (void)uid; + (void)width; + (void)height; + (void)layoutCount; + (void)layoutlist; + } + + /** + * @technical preview + */ + virtual void onAudioMetadataReceived(uid_t uid, const char* metadata, size_t length) { + (void)uid; + (void)metadata; + (void)length; + } +}; + +/** + * The IVideoDeviceCollection class. You can get information related to video devices through this interface. + */ +class IVideoDeviceCollection { + public: + virtual ~IVideoDeviceCollection() {} + + /** + * Gets the total number of the indexed video capture devices in the system. + * + * @return The total number of the indexed video capture devices. + */ + virtual int getCount() = 0; + + /** + * Specifies a device with the device ID. + * + * @param deviceIdUTF8 The device ID. The maximum length is #MAX_DEVICE_ID_LENGTH_TYPE. Plugging or + * unplugging the audio device does not change the value of deviceId. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDevice(const char deviceIdUTF8[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets a specified piece of information about an indexed video device. + * + * @param index The index value of the video device. The value of this parameter must be less than the value returned in `getCount`. + * @param deviceNameUTF8 The name of the device. The maximum length is #MAX_DEVICE_ID_LENGTH. + * @param deviceIdUTF8 The device ID of the video device. The maximum length is #MAX_DEVICE_ID_LENGTH. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDevice(int index, char deviceNameUTF8[MAX_DEVICE_ID_LENGTH], + char deviceIdUTF8[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Releases all the resources occupied by the IVideoDeviceCollection object. + */ + virtual void release() = 0; +}; + +/** + * The IVideoDeviceManager class. + */ +class IVideoDeviceManager { + public: + virtual ~IVideoDeviceManager() {} + /** + * Enumerates the video devices. + * + * This method returns an `IVideoDeviceCollection` object including all video devices in the system. + * With the `IVideoDeviceCollection` object, the application can enumerate video devices. The + * application must call the release method to release the returned object after using it. + * + * @return + * - Success: An `IVideoDeviceCollection` object including all video devices in the system. + * - Failure: NULL. + */ + virtual IVideoDeviceCollection* enumerateVideoDevices() = 0; + + /** + * Specifies the video capture device with the device ID. + * + * @param deviceIdUTF8 he device ID. You can get the device ID by calling `enumerateVideoDevices`. + * The maximum length is #MAX_DEVICE_ID_LENGTH. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDevice(const char deviceIdUTF8[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Retrieves the current video capture device. + * @param deviceIdUTF8 Output parameter. The device ID. The maximum length is #MAX_DEVICE_ID_LENGTH_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDevice(char deviceIdUTF8[MAX_DEVICE_ID_LENGTH]) = 0; + +#if defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \ + (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + /** + * Gets the number of video formats supported by the specified video capture device. + * + * Video capture devices may support multiple video formats, and each format supports different + * combinations of video frame width, video frame height, and frame rate. + * + * You can call this method to get how many video formats the specified video capture device can + * support, and then call `getCapability` to get the specific video frame information in the + * specified video format. + * + * @param deviceIdUTF8 The ID of the video capture device. + * + * @return + * - 0: Success. Returns the number of video formats supported by this device. For example: If the + * specified camera supports 10 different video formats, the return value is 10. + * - < 0: Failure. + */ + virtual int numberOfCapabilities(const char* deviceIdUTF8) = 0; + + /** + * Gets the detailed video frame information of the video capture device in the specified video format. + * + * After calling `numberOfCapabilities` to get the number of video formats supported by the video capture + * device, you can call this method to get the specific video frame information supported by the + * specified index number. + * + * @param deviceIdUTF8 ID of the video capture device. + * @param deviceCapabilityNumber The index number of the video format. If the return value of `numberOfCapabilities` + * is i, the value range of this parameter is [0,i). + * @param capability Output parameter. Indicates the specific information of the specified video format, + * including width (px), height (px), and frame rate (fps). See VideoFormat. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getCapability(const char* deviceIdUTF8, const uint32_t deviceCapabilityNumber, VideoFormat& capability) = 0; +#endif + /** + * Starts the video capture device test. + * + * This method tests whether the video capture device works properly. + * Before calling this method, ensure that you have already called + * \ref IRtcEngine::enableVideo "enableVideo", and the HWND window handle of + * the incoming parameter is valid. + * + * @param hwnd An Output parameter that specifies the window handle to display the video. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startDeviceTest(view_t hwnd) = 0; + + /** + * Stops the video capture device test. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopDeviceTest() = 0; + + /** + * Releases all the resources occupied by the `IVideoDeviceManager` object. + */ + virtual void release() = 0; +}; + + +class IRtcEngineEventHandlerEx; +/** + * The context of IRtcEngine. + */ +struct RtcEngineContext { + /** + * The event handler for IRtcEngine. + */ + IRtcEngineEventHandler* eventHandler; + /** + * The App ID issued by Agora for your project. Only users in apps with the same App ID can join the + * same channel and communicate with each other. An App ID can only be used to create one `IRtcEngine` + * instance. To change your App ID, call release to destroy the current IRtcEngine instance, and then + * create a new one. + */ + const char* appId; + /** + * - For Android, it is the context of Activity or Application. + * - For Windows, it is the window handle of app. Once set, this parameter enables you to plug + * or unplug the video devices while they are powered. + */ + void* context; + /** + * The channel profile. See #CHANNEL_PROFILE_TYPE. + */ + CHANNEL_PROFILE_TYPE channelProfile; + + /** + * The license used for verification when connectting channel. Charge according to the license + */ + const char* license; + + /** + * The audio application scenario. See #AUDIO_SCENARIO_TYPE. + * + * @note Agora recommends the following scenarios: + * - `AUDIO_SCENARIO_DEFAULT(0)` + * - `AUDIO_SCENARIO_GAME_STREAMING(3)` + */ + AUDIO_SCENARIO_TYPE audioScenario; + /** + * The region for connection. This is an advanced feature and applies to scenarios that have regional restrictions. + * + * For the regions that Agora supports, see #AREA_CODE. The area codes support bitwise operation. + * + * After specifying the region, the app integrated with the Agora SDK connects to the Agora servers + * within that region. + */ + unsigned int areaCode; + + /** + * The log files that the SDK outputs. See LogConfig. + * + * By default, the SDK generates five SDK log files and five API call log files with the following rules: + * - The SDK log files are: `agorasdk.log`, `agorasdk.1.log`, `agorasdk.2.log`, `agorasdk.3.log`, and `agorasdk.4.log`. + * - The API call log files are: `agoraapi.log`, `agoraapi.1.log`, `agoraapi.2.log`, `agoraapi.3.log`, and `agoraapi.4.log`. + * - The default size for each SDK log file is 1,024 KB; the default size for each API call log file is 2,048 KB. These log files are encoded in UTF-8. + * - The SDK writes the latest logs in `agorasdk.log` or `agoraapi.log`. + * - When `agorasdk.log` is full, the SDK processes the log files in the following order: + * - Delete the `agorasdk.4.log` file (if any). + * - Rename `agorasdk.3.log` to `agorasdk.4.log`. + * - Rename `agorasdk.2.log` to `agorasdk.3.log`. + * - Rename `agorasdk.1.log` to `agorasdk.2.log`. + * - Create a new `agorasdk.log` file. + */ + commons::LogConfig logConfig; + + /** + * Thread priority for SDK common threads + */ + Optional threadPriority; + + /** + * Whether to use egl context in the current thread as sdk‘s root egl context, + * which is shared by all egl related modules. eg. camera capture, video renderer. + * + * @note + * This property applies to Android only. + */ + bool useExternalEglContext; + + /** + * Determines whether to enable domain limit + * -true: only connect to servers which already parsed by DNS + * -false: (Default) connect to servers with no limit + */ + bool domainLimit; + + /** + * Whether to automatically register Agora extensions when initializing RtcEngine. + * -true: (Default) Automatically register Agora extensions. + * -false: Do not automatically register Agora extensions. The user calls EnableExtension to manually register an Agora extension. + */ + bool autoRegisterAgoraExtensions; + + RtcEngineContext() + : eventHandler(NULL), appId(NULL), context(NULL), + channelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING), + license(NULL), + audioScenario(AUDIO_SCENARIO_DEFAULT), + areaCode(AREA_CODE_GLOB), + logConfig(), useExternalEglContext(false), domainLimit(false), autoRegisterAgoraExtensions(true) {} +}; + +/** Definition of IMetadataObserver +*/ +class IMetadataObserver { +public: + /** The metadata type. + * + * @note We only support video metadata for now. + */ + enum METADATA_TYPE + { + /** -1: (Not supported) Unknown. + */ + UNKNOWN_METADATA = -1, + /** 0: (Supported) Video metadata. + */ + VIDEO_METADATA = 0, + }; + /** + * The maximum metadata size. + */ + enum MAX_METADATA_SIZE_TYPE + { + INVALID_METADATA_SIZE_IN_BYTE = -1, + DEFAULT_METADATA_SIZE_IN_BYTE = 512, + MAX_METADATA_SIZE_IN_BYTE = 1024 + }; + + /** Metadata. + */ + struct Metadata + { + /** The User ID that sent the metadata. + * - For the receiver: The user ID of the user who sent the `metadata`. + * - For the sender: Ignore this value. + */ + unsigned int uid; + /** The buffer size of the sent or received `metadata`. + */ + unsigned int size; + /** The buffer address of the sent or received `metadata`. + */ + unsigned char *buffer; + /** The timestamp (ms) of the `metadata`. + * + */ + long long timeStampMs; + }; + + virtual ~IMetadataObserver() {} + + /** Occurs when the SDK requests the maximum size of the metadata. + * + * + * After successfully complete the registration by calling `registerMediaMetadataObserver`, the SDK + * triggers this callback once every video frame is sent. You need to specify the maximum size of + * the metadata in the return value of this callback. + * + * @return The maximum size of the buffer of the metadata that you want to use. The highest value is + * 1024 bytes. Ensure that you set the return value. + */ + virtual int getMaxMetadataSize() { return DEFAULT_METADATA_SIZE_IN_BYTE; } + + /** Occurs when the local user receives the metadata. + + @note Ensure that the size of the metadata does not exceed the value set in the `getMaxMetadataSize` callback. + + @param metadataThe metadata that the user wants to send. For details, see Metadata. + @param source_type The video data type: #VIDEO_SOURCE_TYPE. + @return + - true: Send. + - false: Do not send. + */ + virtual bool onReadyToSendMetadata(Metadata &metadata, VIDEO_SOURCE_TYPE source_type) = 0; + + /** Occurs when the local user receives the metadata. + * + * @param metadata The metadata received. See Metadata. + * + * @note If the receiver is audience, the receiver cannot get the NTP timestamp (ms) + * that the metadata sends. + */ + virtual void onMetadataReceived(const Metadata &metadata) = 0; +}; + +// The error codes for media streaming +// GENERATED_JAVA_ENUM_PACKAGE: io.agora.streaming +enum DIRECT_CDN_STREAMING_ERROR { + // No error occurs. + DIRECT_CDN_STREAMING_ERROR_OK = 0, + // A general error occurs (no specified reason). + DIRECT_CDN_STREAMING_ERROR_FAILED = 1, + // Audio publication error. + DIRECT_CDN_STREAMING_ERROR_AUDIO_PUBLICATION = 2, + // Video publication error. + DIRECT_CDN_STREAMING_ERROR_VIDEO_PUBLICATION = 3, + + DIRECT_CDN_STREAMING_ERROR_NET_CONNECT = 4, + // Already exist stream name. + DIRECT_CDN_STREAMING_ERROR_BAD_NAME = 5, +}; + +// The connection state of media streaming +// GENERATED_JAVA_ENUM_PACKAGE: io.agora.streaming +enum DIRECT_CDN_STREAMING_STATE { + + DIRECT_CDN_STREAMING_STATE_IDLE = 0, + + DIRECT_CDN_STREAMING_STATE_RUNNING = 1, + + DIRECT_CDN_STREAMING_STATE_STOPPED = 2, + + DIRECT_CDN_STREAMING_STATE_FAILED = 3, + + DIRECT_CDN_STREAMING_STATE_RECOVERING = 4, +}; + +/** + * The statistics of the Direct Cdn Streams. + */ +struct DirectCdnStreamingStats { + /** + * Width of the video pushed by rtmp. + */ + int videoWidth; + + /** + * Height of the video pushed by rtmp. + */ + int videoHeight; + + /** + * The frame rate of the video pushed by rtmp. + */ + int fps; + + /** + * Real-time bit rate of the video streamed by rtmp. + */ + int videoBitrate; + + /** + * Real-time bit rate of the audio pushed by rtmp. + */ + int audioBitrate; +}; + +/** + * The event handler for direct cdn streaming + * + */ +class IDirectCdnStreamingEventHandler { + public: + virtual ~IDirectCdnStreamingEventHandler() {} + + /** + * Event callback of direct cdn streaming + * @param state Current status + * @param error Error Code + * @param message Message + */ + virtual void onDirectCdnStreamingStateChanged(DIRECT_CDN_STREAMING_STATE state, DIRECT_CDN_STREAMING_ERROR error, const char* message) { + (void)state; + (void)error; + (void)message; + }; + + virtual void onDirectCdnStreamingStats(const DirectCdnStreamingStats& stats) { + (void)stats; + }; +}; + +/** + * The channel media options. + */ +struct DirectCdnStreamingMediaOptions { + /** + * Determines whether to publish the video of the camera track. + * - true: Publish the video track of the camera capturer. + * - false: (Default) Do not publish the video track of the camera capturer. + */ + Optional publishCameraTrack; + /** + * Determines whether to publish the recorded audio. + * - true: Publish the recorded audio. + * - false: (Default) Do not publish the recorded audio. + */ + Optional publishMicrophoneTrack; + /** + * Determines whether to publish the audio of the custom audio track. + * - true: Publish the audio of the custom audio track. + * - false: (Default) Do not publish the audio of the custom audio track. + */ + Optional publishCustomAudioTrack; + /** + * Determines whether to publish the video of the custom video track. + * - true: Publish the video of the custom video track. + * - false: (Default) Do not publish the video of the custom video track. + */ + Optional publishCustomVideoTrack; + /** + * Determines whether to publish the audio track of media player source. + * - true: Publish the audio track of media player source. + * - false: (Default) Do not publish the audio track of media player source. + */ + Optional publishMediaPlayerAudioTrack; + /** + * Determines which media player source should be published. + * You can get the MediaPlayerId after calling getMediaPlayerId() of AgoraMediaPlayer. + */ + Optional publishMediaPlayerId; + /** + * The custom video track id which will used to publish. + * You can get the VideoTrackId after calling createCustomVideoTrack() of IRtcEngine. + */ + Optional customVideoTrackId; + + DirectCdnStreamingMediaOptions() {} + ~DirectCdnStreamingMediaOptions() {} + + void SetAll(const DirectCdnStreamingMediaOptions& change) { +#define SET_FROM(X) SetFrom(&X, change.X) + SET_FROM(publishCameraTrack); + SET_FROM(publishMicrophoneTrack); + SET_FROM(publishCustomAudioTrack); + SET_FROM(publishCustomVideoTrack); + SET_FROM(publishMediaPlayerAudioTrack); + SET_FROM(publishMediaPlayerId); + SET_FROM(customVideoTrackId); +#undef SET_FROM + } + + bool operator==(const DirectCdnStreamingMediaOptions& o) const { +#define BEGIN_COMPARE() bool b = true +#define ADD_COMPARE(X) b = (b && (X == o.X)) +#define END_COMPARE() + + BEGIN_COMPARE(); + ADD_COMPARE(publishCameraTrack); + ADD_COMPARE(publishMicrophoneTrack); + ADD_COMPARE(publishCustomAudioTrack); + ADD_COMPARE(publishCustomVideoTrack); + ADD_COMPARE(publishMediaPlayerAudioTrack); + ADD_COMPARE(customVideoTrackId); + ADD_COMPARE(publishMediaPlayerId); + END_COMPARE(); + +#undef BEGIN_COMPARE +#undef ADD_COMPARE +#undef END_COMPARE + return b; + } + + DirectCdnStreamingMediaOptions& operator=(const DirectCdnStreamingMediaOptions& replace) { + if (this != &replace) { +#define REPLACE_BY(X) ReplaceBy(&X, replace.X) + + REPLACE_BY(publishCameraTrack); + REPLACE_BY(publishMicrophoneTrack); + REPLACE_BY(publishCustomAudioTrack); + REPLACE_BY(publishCustomVideoTrack); + REPLACE_BY(publishMediaPlayerAudioTrack); + REPLACE_BY(customVideoTrackId); + REPLACE_BY(publishMediaPlayerId); +#undef REPLACE_BY + } + return *this; + } +}; + +/** + * The information for extension. + */ +struct ExtensionInfo { + /** + * The type of media device. + */ + agora::media::MEDIA_SOURCE_TYPE mediaSourceType; + + /** + * The id of the remote user on which the extension works. + * + * @note remoteUid = 0 means that the extension works on all remote streams. + */ + uid_t remoteUid; + + /** + * The unique channel name for the AgoraRTC session in the string format. The string + * length must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", + * "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + */ + const char* channelId; + + /** + * User ID: A 32-bit unsigned integer ranging from 1 to (2^32-1). It must be unique. + */ + uid_t localUid; + + ExtensionInfo() + : mediaSourceType(agora::media::UNKNOWN_MEDIA_SOURCE), + remoteUid(0), + channelId(NULL), + localUid(0) {} +}; + +class IMediaPlayer; + +/** + * The IRtcEngine class, which is the basic interface of the Agora SDK that implements the core functions of real-time communication. + * + * `IRtcEngine` provides the main methods that your app can call. + * + * Before calling other APIs, you must call createAgoraRtcEngine to create an `IRtcEngine` object. + */ +class IRtcEngine : public agora::base::IEngineBase { + public: + /** + * Releases the IRtcEngine object. + * + * This method releases all resources used by the Agora SDK. Use this method for apps in which users + * occasionally make voice or video calls. When users do not make calls, you can free up resources for + * other operations. + * + * After a successful method call, you can no longer use any method or callback in the SDK anymore. + * If you want to use the real-time communication functions again, you must call `createAgoraRtcEngine` + * and `initialize` to create a new `IRtcEngine` instance. + * + * @note If you want to create a new `IRtcEngine` instance after destroying the current one, ensure + * that you wait till the `release` method execution to complete. + * + * @param sync Determines whether this method is a synchronous call. + * - `true`: This method is a synchronous call, which means that the result of this method call + * returns after the IRtcEngine object resources are released. Do not call this method + * in any callback generated by the SDK, or it may result in a deadlock. The SDK automatically + * detects the deadlock and turns this method into an asynchronous call, but the test itself takes + * extra time. + * - `false`: This method is an asynchronous call. The result returns immediately even when the + * IRtcEngine object resources are not released. + * + */ + virtual void release(bool sync = false) = 0; + + /** + * Initializes `IRtcEngine`. + * + * All called methods provided by the `IRtcEngine` class are executed asynchronously. Agora + * recommends calling these methods in the same thread. + * + * @note + * - Before calling other APIs, you must call `createAgoraRtcEngine` and `initialize `to create and + * initialize the `IRtcEngine` object. + * - The SDK supports creating only one `IRtcEngine` instance for an app. + * + * @param context The RtcEngineContext object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initialize(const RtcEngineContext& context) = 0; + + /** + * Gets the pointer to the specified interface. + * + * @param iid The ID of the interface. See #INTERFACE_ID_TYPE for details. + * @param inter Output parameter. The pointer to the specified interface. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int queryInterface(INTERFACE_ID_TYPE iid, void** inter) = 0; + + + /** + * Gets the SDK version. + * @param build The build number. + * @return The version of the current SDK in the string format. + */ + virtual const char* getVersion(int* build) = 0; + + /** + * Gets the warning or error description. + * @param code The error code or warning code reported by the SDK. + * @return The specific error or warning description. + */ + virtual const char* getErrorDescription(int code) = 0; + + /** + * Queries the capacity of the current device codec. + * + * @param codec_info An array of the codec cap information: CodecCapInfo. + * @param size The array size. + * @return + * 0: Success. + * < 0: Failure. + */ + virtual int queryCodecCapability(CodecCapInfo* codec_info, int& size) = 0; + + /** + * Queries the score of the current device. + * + * @return + * > 0: If the value is greater than 0, it means that the device score has been retrieved and represents the score value. + * Most devices score between 60-100, with higher scores indicating better performance. + * + * < 0: Failure. + */ + virtual int queryDeviceScore() = 0; + + /** + * Preload a channel. + * + * This method enables users to preload a channel. + * + * A successful call of this method will reduce the time of joining the same channel. + * + * Note: + * 1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available. + * 2. Renew the token of the preloaded channel by calling this method with the same 'channelId' and 'uid'. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid The user ID. This parameter is used to identify the user in the channel for real-time + * audio and video interaction. You need to set and manage user IDs yourself, and ensure that each + * user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value + * range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user + * ID and returns it in the onJoinChannelSuccess callback. Your application must record and maintain + * the returned user ID, because the SDK does not do so. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * preload the channel again. + */ + virtual int preloadChannel(const char* token, const char* channelId, uid_t uid) = 0; + + /** + * Preload a channel. + * + * This method enables users to preload a channel. + * + * A successful call of this method will reduce the time of joining the same channel. + * + * Note: + * 1. The SDK supports preloading up to 20 channels. Once the preloaded channels exceed the limit, the SDK will keep the latest 20 available. + * 2. Renew the token of the preloaded channel by calling this method with the same 'channelId' and 'userAccount'. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the userAccount parameter is empty. + * You need to pass in a valid parameter and preload the channel again. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * preload the channel again. + */ + virtual int preloadChannel(const char* token, const char* channelId, const char* userAccount) = 0; + + /** + * Update token of the preloaded channels. + * + * An easy way to update all preloaded channels' tokens, if all preloaded channels use the same token. + * + * If preloaded channels use different tokens, we need to call the 'preloadChannel' method with the same 'channelId' + * and 'uid' or 'userAccount' to update the corresponding token. + * + * @param token The token generated on your server for authentication. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The token is invalid. You need to pass in a valid token and update the token again. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + */ + virtual int updatePreloadChannelToken(const char* token) = 0; + + /** + * Joins a channel. + * + * This method enables users to join a channel. Users in the same channel can talk to each other, + * and multiple users in the same channel can start a group chat. Users with different App IDs + * cannot call each other. + * + * A successful call of this method triggers the following callbacks: + * - The local client: The `onJoinChannelSuccess` and `onConnectionStateChanged` callbacks. + * - The remote client: `onUserJoined`, if the user joining the channel is in the Communication + * profile or is a host in the Live-broadcasting profile. + * + * When the connection between the client and Agora's server is interrupted due to poor network + * conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins + * the channel, the SDK triggers the `onRejoinChannelSuccess` callback on the local client. + * + * @note Once a user joins the channel, the user subscribes to the audio and video streams of all + * the other users in the channel by default, giving rise to usage and billing calculation. To + * stop subscribing to a specified stream or all remote streams, call the corresponding `mute` methods. + * + * @param token The token generated on your server for authentication. + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param info (Optional) Reserved for future use. + * @param uid The user ID. This parameter is used to identify the user in the channel for real-time + * audio and video interaction. You need to set and manage user IDs yourself, and ensure that each + * user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value + * range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user + * ID and returns it in the onJoinChannelSuccess callback. Your application must record and maintain + * the returned user ID, because the SDK does not do so. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set + * to an integer, or the value of a member in the `ChannelMediaOptions` structure is invalid. You need + * to pass in a valid parameter and join the channel again. + * - -3: Failes to initialize the `IRtcEngine` object. You need to reinitialize the IRtcEngine object. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -8: The internal state of the IRtcEngine object is wrong. The typical cause is that you call + * this method to join the channel without calling `stopEchoTest` to stop the test after calling + * `startEchoTest` to start a call loop test. You need to call `stopEchoTest` before calling this method. + * - -17: The request to join the channel is rejected. The typical cause is that the user is in the + * channel. Agora recommends using the `onConnectionStateChanged` callback to get whether the user is + * in the channel. Do not call this method to join the channel unless you receive the + * `CONNECTION_STATE_DISCONNECTED(1)` state. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * rejoin the channel. + * - -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel. + */ + virtual int joinChannel(const char* token, const char* channelId, const char* info, + uid_t uid) = 0; + + /** + * Joins a channel with media options. + * + * This method enables users to join a channel. Users in the same channel can talk to each other, + * and multiple users in the same channel can start a group chat. Users with different App IDs + * cannot call each other. + * + * A successful call of this method triggers the following callbacks: + * - The local client: The `onJoinChannelSuccess` and `onConnectionStateChanged` callbacks. + * - The remote client: `onUserJoined`, if the user joining the channel is in the Communication + * profile or is a host in the Live-broadcasting profile. + * + * When the connection between the client and Agora's server is interrupted due to poor network + * conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins + * the channel, the SDK triggers the `onRejoinChannelSuccess` callback on the local client. + * + * Compared to `joinChannel`, this method adds the options parameter to configure whether to + * automatically subscribe to all remote audio and video streams in the channel when the user + * joins the channel. By default, the user subscribes to the audio and video streams of all + * the other users in the channel, giving rise to usage and billings. To unsubscribe, set the + * `options` parameter or call the `mute` methods accordingly. + * + * @note + * - This method allows users to join only one channel at a time. + * - Ensure that the app ID you use to generate the token is the same app ID that you pass in the + * `initialize` method; otherwise, you may fail to join the channel by token. + * + * @param token The token generated on your server for authentication. + * + * @param channelId The channel name. This parameter signifies the channel in which users engage in + * real-time audio and video interaction. Under the premise of the same App ID, users who fill in + * the same channel ID enter the same channel for audio and video interaction. The string length + * must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param uid The user ID. This parameter is used to identify the user in the channel for real-time + * audio and video interaction. You need to set and manage user IDs yourself, and ensure that each + * user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value + * range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user + * ID and returns it in the `onJoinChannelSuccess` callback. Your application must record and maintain + * the returned user ID, because the SDK does not do so. + * @param options The channel media options: ChannelMediaOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set + * to an integer, or the value of a member in the `ChannelMediaOptions` structure is invalid. You need + * to pass in a valid parameter and join the channel again. + * - -3: Failes to initialize the `IRtcEngine` object. You need to reinitialize the IRtcEngine object. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -8: The internal state of the IRtcEngine object is wrong. The typical cause is that you call + * this method to join the channel without calling `stopEchoTest` to stop the test after calling + * `startEchoTest` to start a call loop test. You need to call `stopEchoTest` before calling this method. + * - -17: The request to join the channel is rejected. The typical cause is that the user is in the + * channel. Agora recommends using the `onConnectionStateChanged` callback to get whether the user is + * in the channel. Do not call this method to join the channel unless you receive the + * `CONNECTION_STATE_DISCONNECTED(1)` state. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * rejoin the channel. + * - -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel. + */ + virtual int joinChannel(const char* token, const char* channelId, uid_t uid, + const ChannelMediaOptions& options) = 0; + + /** + * Updates the channel media options after joining the channel. + * + * @param options The channel media options: ChannelMediaOptions. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateChannelMediaOptions(const ChannelMediaOptions& options) = 0; + + /** + * Leaves the channel. + * + * This method allows a user to leave the channel, for example, by hanging up or exiting a call. + * + * This method is an asynchronous call, which means that the result of this method returns even before + * the user has not actually left the channel. Once the user successfully leaves the channel, the + * SDK triggers the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel" callback. + * + * @note + * If you call \ref release "release" immediately after this method, the leaveChannel process will be + * interrupted, and the SDK will not trigger the `onLeaveChannel` callback. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int leaveChannel() = 0; + + /** + * Leaves the channel. + * + * @param options The leave channel options. + * + * This method allows a user to leave the channel, for example, by hanging up or exiting a call. + * + * This method is an asynchronous call, which means that the result of this method returns even before + * the user has not actually left the channel. Once the user successfully leaves the channel, the + * SDK triggers the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel" callback. + * + * @note + * If you call \ref release "release" immediately after this method, the leaveChannel process will be + * interrupted, and the SDK will not trigger the `onLeaveChannel` callback. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int leaveChannel(const LeaveChannelOptions& options) = 0; + + /** + * Renews the token. + * + * Once a token is enabled and used, it expires after a certain period of time. + * + * Under the following circumstances, generate a new token on your server, and then call this method to + * renew it. Failure to do so results in the SDK disconnecting from the server. + * - The \ref IRtcEngineEventHandler onTokenPrivilegeWillExpire "onTokenPrivilegeWillExpire" callback is triggered; + * - The \ref IRtcEngineEventHandler::onRequestToken "onRequestToken" callback is triggered; + * - The `ERR_TOKEN_EXPIRED(-109)` error is reported. + * + * @param token The new token. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int renewToken(const char* token) = 0; + + /** + * Sets the channel profile. + * + * The IRtcEngine differentiates channel profiles and applies different optimization algorithms accordingly. + * For example, it prioritizes smoothness and low latency for a video call, and prioritizes video quality + * for a video broadcast. + * + * @note + * - To ensure the quality of real-time communication, we recommend that all users in a channel use the + * same channel profile. + * - Call this method before calling `joinChannel`. You cannot set the channel profile + * once you have joined the channel. + * + * @param profile The channel profile: #CHANNEL_PROFILE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setChannelProfile(CHANNEL_PROFILE_TYPE profile) = 0; + + /** + * Sets the role of a user. + * + * This method sets the user role as either BROADCASTER or AUDIENCE (default). + * - The broadcaster sends and receives streams. + * - The audience receives streams only. + * + * By default, all users are audience regardless of the channel profile. + * Call this method to change the user role to BROADCASTER so that the user can + * send a stream. + * + * @note + * After calling the setClientRole() method to CLIENT_ROLE_AUDIENCE, the SDK stops audio recording. + * However, CLIENT_ROLE_AUDIENCE will keep audio recording with AUDIO_SCENARIO_CHATROOM(5). + * Normally, app developer can also use mute api to achieve the same result, and we implement + * this 'non-orthogonal' behavior only to make API backward compatible. + * + * @param role The role of the client: #CLIENT_ROLE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setClientRole(CLIENT_ROLE_TYPE role) = 0; + + /** Sets the role of the user, such as a host or an audience (default), before joining a channel in the live interactive streaming. + * + * This method can be used to switch the user role in the live interactive streaming after the user joins a channel. + * + * In the `LIVE_BROADCASTING` profile, when a user switches user roles after joining a channel, a successful \ref agora::rtc::IRtcEngine::setClientRole "setClientRole" method call triggers the following callbacks: + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onClientRoleChanged "onClientRoleChanged" + * - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" or \ref agora::rtc::IRtcEngineEventHandler::onUserOffline "onUserOffline" (BECOME_AUDIENCE) + * + * @note + * This method applies only to the `LIVE_BROADCASTING` profile. + * + * @param role Sets the role of the user. See #CLIENT_ROLE_TYPE. + * @param options Sets the audience latency level of the user. See #ClientRoleOptions. + * + * @return + * - 0(ERR_OK): Success. + * - < 0: Failure. + * - -1(ERR_FAILED): A general error occurs (no specified reason). + * - -2(ERR_INALID_ARGUMENT): The parameter is invalid. + * - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. + */ + virtual int setClientRole(CLIENT_ROLE_TYPE role, const ClientRoleOptions& options) = 0; + + /** Starts an audio call test. + + This method launches an audio call test to determine whether the audio devices + (for example, headset and speaker) and the network connection are working + properly. + + In the test, the user first speaks, and the recording is played back + in 10 seconds. If the user can hear the recording in 10 seconds, it indicates + that the audio devices and network connection work properly. + + @note + After calling the startEchoTest() method, always call stopEchoTest() to end + the test. Otherwise, the app cannot run the next echo test, nor can + it call the joinChannel() method. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startEchoTest() = 0; + + /** Starts an audio call test. + + This method starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly. + + In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly. + + @note + - Call this method before joining a channel. + - After calling this method, call the \ref IRtcEngine::stopEchoTest "stopEchoTest" method to end the test. Otherwise, the app cannot run the next echo test, or call the \ref IRtcEngine::joinChannel "joinChannel" method. + - In the `LIVE_BROADCASTING` profile, only a host can call this method. + @param intervalInSeconds The time interval (s) between when you speak and when the recording plays back. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startEchoTest(int intervalInSeconds) = 0; + + /** Starts a video call test. + * + * @param config: configuration for video call test. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startEchoTest(const EchoTestConfiguration& config) = 0; + + /** Stops the audio call test. + @return int + + - 0: Success. + - < 0: Failure. + */ + virtual int stopEchoTest() = 0; + +#if defined(__APPLE__) && TARGET_OS_IOS + /** Enables the SDK use AVCaptureMultiCamSession or AVCaptureSession. Applies to iOS 13.0+ only. + * @param enabled Whether to enable multi-camera when capturing video: + * - true: Enable multi-camera, and the SDK uses AVCaptureMultiCamSession. + * - false: Disable multi-camera, and the SDK uses AVCaptureSession. + * @param config The config for secondary camera capture session. See #CameraCapturerConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableMultiCamera(bool enabled, const CameraCapturerConfiguration& config) = 0; +#endif + /** + * Enables the video. + * + * You can call this method either before joining a channel or during a call. + * If you call this method before entering a channel, the service starts the video; if you call it + * during a call, the audio call switches to a video call. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves the channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableVideo() = 0; + + /** + * Disables the video. + * + * This method stops capturing the local video and receiving any remote video. + * To enable the local preview function, call \ref enableLocalVideo "enableLocalVideo" (true). + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableVideo() = 0; + + /** + * Starts the local video preview before joining a channel. + * + * Once you call this method to start the local video preview, if you leave + * the channel by calling \ref leaveChannel "leaveChannel", the local video preview remains until + * you call \ref stopPreview "stopPreview" to disable it. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startPreview() = 0; + + /** + * Starts the local video preview for specific source type. + * @param sourceType - The video source type. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startPreview(VIDEO_SOURCE_TYPE sourceType) = 0; + + /** + * Stops the local video preview and the video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopPreview() = 0; + + /** + * Stops the local video preview for specific source type. + * @param sourceType - The video source type. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopPreview(VIDEO_SOURCE_TYPE sourceType) = 0; + + /** Starts the last-mile network probe test. + + This method starts the last-mile network probe test before joining a channel + to get the uplink and downlink last-mile network statistics, including the + bandwidth, packet loss, jitter, and round-trip time (RTT). + + Call this method to check the uplink network quality before users join a + channel or before an audience switches to a host. Once this method is + enabled, the SDK returns the following callbacks: + - \ref IRtcEngineEventHandler::onLastmileQuality "onLastmileQuality": the + SDK triggers this callback depending on the network + conditions. This callback rates the network conditions and is more closely + linked to the user experience. + - \ref IRtcEngineEventHandler::onLastmileProbeResult "onLastmileProbeResult": + the SDK triggers this callback within 30 seconds depending on the network + conditions. This callback returns the real-time statistics of the network + conditions and is more objective. + + @note + - Do not call other methods before receiving the + \ref IRtcEngineEventHandler::onLastmileQuality "onLastmileQuality" and + \ref IRtcEngineEventHandler::onLastmileProbeResult "onLastmileProbeResult" + callbacks. Otherwise, the callbacks may be interrupted. + - In the Live-broadcast profile, a host should not call this method after + joining a channel. + + @param config Sets the configurations of the last-mile network probe test. See + LastmileProbeConfig. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startLastmileProbeTest(const LastmileProbeConfig& config) = 0; + + /** Stops the last-mile network probe test. */ + virtual int stopLastmileProbeTest() = 0; + + /** + * Sets the video encoder configuration. + * + * Each configuration profile corresponds to a set of video parameters, including + * the resolution, frame rate, and bitrate. + * + * The parameters specified in this method are the maximum values under ideal network conditions. + * If the video engine cannot render the video using the specified parameters due + * to poor network conditions, the parameters further down the list are considered + * until a successful configuration is found. + * + * @param config The local video encoder configuration: VideoEncoderConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVideoEncoderConfiguration(const VideoEncoderConfiguration& config) = 0; + + /** Enables/Disables image enhancement and sets the options. + * + * @note Call this method after calling the \ref IRtcEngine::enableVideo "enableVideo" method. + * + * @param enabled Sets whether or not to enable image enhancement: + * - true: enables image enhancement. + * - false: disables image enhancement. + * @param options Sets the image enhancement option. See BeautyOptions. + */ + virtual int setBeautyEffectOptions(bool enabled, const BeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + /** + * Sets low-light enhancement. + * + * @since v4.0.0 + * + * The low-light enhancement feature can adaptively adjust the brightness value of the video captured in situations with low or uneven lighting, such as backlit, cloudy, or dark scenes. It restores or highlights the image details and improves the overall visual effect of the video. + * + * You can call this method to enable the low-light enhancement feature and set the options of the low-light enhancement effect. + * + * @note + * - Before calling this method, ensure that you have integrated the following dynamic library into your project: + * - Android: `libagora_segmentation_extension.so` + * - iOS/macOS: `AgoraVideoSegmentationExtension.xcframework` + * - Windows: `libagora_segmentation_extension.dll` + * - Call this method after \ref IRtcEngine::enableVideo "enableVideo". + * - The low-light enhancement feature has certain performance requirements on devices. If your device overheats after you enable low-light enhancement, Agora recommends modifying the low-light enhancement options to a less performance-consuming level or disabling low-light enhancement entirely. + * + * @param enabled Sets whether to enable low-light enhancement: + * - `true`: Enable. + * - `false`: (Default) Disable. + * @param options The low-light enhancement options. See LowlightEnhanceOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLowlightEnhanceOptions(bool enabled, const LowlightEnhanceOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + /** + * Sets video noise reduction. + * + * @since v4.0.0 + * + * Underlit environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding. + * + * You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect. + * + * @note + * - Before calling this method, ensure that you have integrated the following dynamic library into your project: + * - Android: `libagora_segmentation_extension.so` + * - iOS/macOS: `AgoraVideoSegmentationExtension.xcframework` + * - Windows: `libagora_segmentation_extension.dll` + * - Call this method after \ref IRtcEngine::enableVideo "enableVideo". + * - The video noise reduction feature has certain performance requirements on devices. If your device overheats after you enable video noise reduction, Agora recommends modifying the video noise reduction options to a less performance-consuming level or disabling video noise reduction entirely. + * + * @param enabled Sets whether to enable video noise reduction: + * - `true`: Enable. + * - `false`: (Default) Disable. + * @param options The video noise reduction options. See VideoDenoiserOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVideoDenoiserOptions(bool enabled, const VideoDenoiserOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + /** + * Sets color enhancement. + * + * @since v4.0.0 + * + * The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid. + * + * You can call this method to enable the color enhancement feature and set the options of the color enhancement effect. + * + * @note + * - Before calling this method, ensure that you have integrated the following dynamic library into your project: + * - Android: `libagora_segmentation_extension.so` + * - iOS/macOS: `AgoraVideoSegmentationExtension.xcframework` + * - Windows: `libagora_segmentation_extension.dll` + * - Call this method after \ref IRtcEngine::enableVideo "enableVideo". + * - The color enhancement feature has certain performance requirements on devices. If your device overheats after you enable color enhancement, Agora recommends modifying the color enhancement options to a less performance-consuming level or disabling color enhancement entirely. + * + * @param enabled Sets whether to enable color enhancement: + * - `true`: Enable. + * - `false`: (Default) Disable. + * @param options The color enhancement options. See ColorEnhanceOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setColorEnhanceOptions(bool enabled, const ColorEnhanceOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + + /** + * Enables/Disables the virtual background. (beta function) + * + * @since v3.7.200 + * + * After enabling the virtual background function, you can replace the original background image of the local user + * with a custom background image. After the replacement, all users in the channel can see the custom background + * image. + * + * @note + * - Before calling this method, ensure that you have integrated the + * `libagora_segmentation_extension.dll` (Windows)/`AgoraVideoSegmentationExtension.framework` (macOS) dynamic + * library into the project folder. + * - Call this method after \ref IRtcEngine::enableVideo "enableVideo". + * - This function requires a high-performance device. Agora recommends that you use this function on devices with + * an i5 CPU and better. + * - Agora recommends that you use this function in scenarios that meet the following conditions: + * - A high-definition camera device is used, and the environment is uniformly lit. + * - The captured video image is uncluttered, the user's portrait is half-length and largely unobstructed, and the + * background is a single color that differs from the color of the user's clothing. + * + * @param enabled Sets whether to enable the virtual background: + * - true: Enable. + * - false: Disable. + * @param backgroundSource The custom background image. See VirtualBackgroundSource. **Note**: To adapt the + * resolution of the custom background image to the resolution of the SDK capturing video, the SDK scales and crops + * the custom background image while ensuring that the content of the custom background image is not distorted. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableVirtualBackground(bool enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + + /** + * Initializes the video view of a remote user. + * + * This method initializes the video view of a remote stream on the local device. It affects only the + * video view that the local user sees. + * + * Usually the app should specify the `uid` of the remote video in the method call before the + * remote user joins the channel. If the remote `uid` is unknown to the app, set it later when the + * app receives the \ref IRtcEngineEventHandler::onUserJoined "onUserJoined" callback. + * + * To unbind the remote user from the view, set `view` in VideoCanvas as `null`. + * + * @note + * Ensure that you call this method in the UI thread. + * + * @param canvas The remote video view settings: VideoCanvas. + * @return int + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_SUCCESS = 0, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_IMAGE_NOT_EXIST = -1, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_COLOR_FORMAT_NOT_SUPPORTED = -2, + * VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_DEVICE_NOT_SUPPORTED = -3, + */ + virtual int setupRemoteVideo(const VideoCanvas& canvas) = 0; + + /** + * Initializes the local video view. + * + * This method initializes the video view of the local stream on the local device. It affects only + * the video view that the local user sees, not the published local video stream. + * + * To unbind the local video from the view, set `view` in VideoCanvas as `null`. + * + * @note + * Call this method before joining a channel. + * + * @param canvas The local video view setting: VideoCanvas. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setupLocalVideo(const VideoCanvas& canvas) = 0; + + /** + * Enables the audio. + * + * The audio is enabled by default. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudio() = 0; + + /** + * Disables the audio. + * + * @note + * This method controls the underlying states of the Engine. It is still + * valid after one leaves channel. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableAudio() = 0; + + /** + * Sets the audio parameters and application scenarios. + * + * @deprecated This method is deprecated. You can use the + * \ref IRtcEngine::setAudioProfile(AUDIO_PROFILE_TYPE) "setAudioProfile" + * method instead. To set the audio scenario, call the \ref IRtcEngine::initialize "initialize" + * method and pass value in the `audioScenario` member in the RtcEngineContext struct. + * + * @note + * - Call this method before calling the `joinChannel` method. + * - In scenarios requiring high-quality audio, we recommend setting `profile` as `MUSIC_HIGH_QUALITY`(4) + * and `scenario` as `AUDIO_SCENARIO_GAME_STREAMING`(3). + * + * @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels: + * #AUDIO_PROFILE_TYPE. + * @param scenario Sets the audio application scenarios: #AUDIO_SCENARIO_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) __deprecated = 0; + + /** + * Sets the audio profile. + * + * @note + * - Call this method before calling the `joinChannel` method. + * - In scenarios requiring high-quality audio, Agora recommends setting `profile` as `MUSIC_HIGH_QUALITY`(4). + * - To set the audio scenario, call the \ref IRtcEngine::initialize "initialize" + * method and pass value in the `audioScenario` member in the RtcEngineContext struct. + * + * @param profile The audio profile, such as the sample rate, bitrate and codec type: #AUDIO_PROFILE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile) = 0; + /** + * Set the audio scenario. + * + * @param scenario The audio scenario: #AUDIO_SCENARIO_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioScenario(AUDIO_SCENARIO_TYPE scenario) = 0; + /** + * Enables or disables the local audio capture. + * + * The audio function is enabled by default. This method disables or re-enables the + * local audio function, that is, to stop or restart local audio capture and + * processing. + * + * This method does not affect receiving or playing the remote audio streams, + * and `enableLocalAudio` (false) is applicable to scenarios where the user wants + * to receive remote audio streams without sending any audio stream to other users + * in the channel. + * + * @param enabled Determines whether to disable or re-enable the local audio function: + * - true: (Default) Re-enable the local audio function, that is, to start local + * audio capture and processing. + * - false: Disable the local audio function, that is, to stop local audio + * capture and processing. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLocalAudio(bool enabled) = 0; + + /** + Stops or resumes sending the local audio stream. + + After calling this method successfully, the SDK triggers the + \ref IRtcEngineEventHandler::onRemoteAudioStateChanged "onRemoteAudioStateChanged" + callback with the following parameters: + - REMOTE_AUDIO_STATE_STOPPED(0) and REMOTE_AUDIO_REASON_REMOTE_MUTED(5). + - REMOTE_AUDIO_STATE_DECODING(2) and REMOTE_AUDIO_REASON_REMOTE_UNMUTED(6). + + @note + - When `mute` is set as `true`, this method does not disable the + microphone, which does not affect any ongoing recording. + - If you call \ref IRtcEngine::setChannelProfile "setChannelProfile" after + this method, the SDK resets whether or not to mute the local audio + according to the channel profile and user role. Therefore, we recommend + calling this method after the `setChannelProfile` method. + + @param mute Determines whether to send or stop sending the local audio stream: + - true: Stop sending the local audio stream. + - false: (Default) Send the local audio stream. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int muteLocalAudioStream(bool mute) = 0; + + /** + Stops or resumes receiving all remote audio stream. + + This method works for all remote users that join or will join a channel + using the `joinChannel` method. It is + equivalent to the `autoSubscribeAudio` member in the ChannelMediaOptions + class. + - Ensure that you call this method after joining a channel. + - If you call muteAllRemoteAudioStreams(true) after joining a channel, the + local use stops receiving any audio stream from any user in the channel, + including any user who joins the channel after you call this method. + - If you call muteAllRemoteAudioStreams(true) after leaving a channel, the + local user does not receive any audio stream the next time the user joins a + channel. + + After you successfully call muteAllRemoteAudioStreams(true), you can take + the following actions: + - To resume receiving all remote audio streams, call + muteAllRemoteAudioStreams(false). + - To resume receiving the audio stream of a specified user, call + muteRemoteAudioStream(uid, false), where uid is the ID of the user whose + audio stream you want to resume receiving. + + @note + - The result of calling this method is affected by calling + \ref IRtcEngine::enableAudio "enableAudio" and + \ref IRtcEngine::disableAudio "disableAudio". Settings in + muteAllRemoteAudioStreams stop taking effect if either of the following occurs: + - Calling `enableAudio` after muteAllRemoteAudioStreams(true). + - Calling `disableAudio` after muteAllRemoteAudioStreams(false). + - This method only works for the channel created by calling + `joinChannel`. To set whether to receive remote + audio streams for a specific channel, Agora recommends using + `autoSubscribeAudio` in the ChannelMediaOptions class. + @param mute Whether to stop receiving remote audio streams: + - true: Stop receiving any remote audio stream. + - false: (Default) Resume receiving all remote audio streams. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int muteAllRemoteAudioStreams(bool mute) = 0; + + /** + * Determines whether to receive all remote audio streams by default. + * + * @deprecated This method is deprecated. To set whether to receive remote + * audio streams by default, call + * \ref IRtcEngine::muteAllRemoteAudioStreams "muteAllRemoteAudioStreams" + * before calling `joinChannel` + * + * Use this method to set whether to receive audio streams of subsequent peer + * users. Agora recommends calling it before joining a channel. + * + * A successful call of setDefaultMuteAllRemoteAudioStreams(true) results in + * that the local user not receiving any audio stream after joining a channel. + * @param mute Whether to receive remote audio streams by default: + * - true: Do not receive any remote audio stream by default. + * - false: (Default) Receive remote audio streams by default. + * + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDefaultMuteAllRemoteAudioStreams(bool mute) __deprecated = 0; + + /** + * Stops or resumes receiving the audio stream of a specified user. + * + * @note + * You can call this method before or after joining a channel. If a user + * leaves a channel, the settings in this method become invalid. + * + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the audio stream of the specified user: + * - true: Stop receiving the audio stream of the specified user. + * - false: (Default) Resume receiving the audio stream of the specified user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRemoteAudioStream(uid_t uid, bool mute) = 0; + + /** + * Stops or resumes sending the local video stream. + * + * @param mute Determines whether to send or stop sending the local video stream: + * - true: Stop sending the local video stream. + * - false: (Default) Send the local video stream. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteLocalVideoStream(bool mute) = 0; + + /** + * Disables or re-enables the local video capture. + * + * Once you enable the video using \ref enableVideo "enableVideo", the local video is enabled + * by default. This method disables or re-enables the local video capture. + * + * `enableLocalVideo(false)` applies to scenarios when the user wants to watch the remote video + * without sending any video stream to the other user. + * + * @note + * Call this method after `enableVideo`. Otherwise, this method may not work properly. + * + * @param enabled Determines whether to disable or re-enable the local video, including + * the capturer, renderer, and sender: + * - true: (Default) Re-enable the local video. + * - false: Disable the local video. Once the local video is disabled, the remote + * users can no longer receive the video stream of this user, while this user + * can still receive the video streams of other remote users. When you set + * `enabled` as `false`, this method does not require a local camera. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLocalVideo(bool enabled) = 0; + + /** Stops or resumes receiving all remote video streams. + + This method works for all remote users that join or will join a channel + using the `joinChannel` method. It is + equivalent to the `autoSubscribeVideo` member in the ChannelMediaOptions + class. + - Ensure that you call this method after joining a channel. + - If you call muteAllRemoteVideoStreams(true) after joining a channel, the + local use stops receiving any video stream from any user in the channel, + including any user who joins the channel after you call this method. + - If you call muteAllRemoteVideoStreams(true) after leaving a channel, + the local user does not receive any video stream the next time the user + joins a channel. + + After you successfully call muteAllRemoteVideoStreams(true), you can take + the following actions: + - To resume receiving all remote video streams, call + muteAllRemoteVideoStreams(false). + - To resume receiving the video stream of a specified user, call + muteRemoteVideoStream(uid, false), where uid is the ID of the user whose + video stream you want to resume receiving. + + @note + - The result of calling this method is affected by calling + \ref IRtcEngine::enableVideo "enableVideo" and + \ref IRtcEngine::disableVideo "disableVideo". Settings in + muteAllRemoteVideoStreams stop taking effect if either of the following occurs: + - Calling `enableVideo` after muteAllRemoteVideoStreams(true). + - Calling `disableVideo` after muteAllRemoteVideoStreams(false). + - This method only works for the channel created by calling `joinChannel`. + To set whether to receive remote audio streams for a specific channel, Agora + recommends using `autoSubscribeVideo` in the ChannelMediaOptions class. + @param mute Whether to stop receiving remote video streams: + - true: Stop receiving any remote video stream. + - false: (Default) Resume receiving all remote video streams. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int muteAllRemoteVideoStreams(bool mute) = 0; + + /** + Determines whether to receive all remote video streams by default. + + @deprecated This method is deprecated. To set whether to receive remote + video streams by default, call + \ref IRtcEngine::muteAllRemoteVideoStreams "muteAllRemoteVideoStreams" + before calling `joinChannel`. + + Use this method to set whether to receive video streams of subsequent peer + users. Agora recommends calling it before joining a channel. + + A successful call of setDefaultMuteAllRemoteVideoStreams(true) results in + that the local user not receiving any video stream after joining a channel. + + @param mute Whether to receive remote video streams by default: + - true: Do not receive any remote video stream by default. + - false: (Default) Receive remote video streams by default. + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int setDefaultMuteAllRemoteVideoStreams(bool mute) __deprecated = 0; + + /** + * Stops or resumes receiving the video stream of a specified user. + * + * @note + * You can call this method before or after joining a channel. If a user + * leaves a channel, the settings in this method become invalid. + * + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the video stream of the specified user: + * - true: Stop receiving the video stream of the specified user. + * - false: (Default) Resume receiving the video stream of the specified user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRemoteVideoStream(uid_t uid, bool mute) = 0; + + /** + * Sets the remote video stream type. + * + * If the remote user has enabled the dual-stream mode, by default the SDK receives the high-stream video by + * Call this method to switch to the low-stream video. + * + * @note + * This method applies to scenarios where the remote user has enabled the dual-stream mode using + * \ref enableDualStreamMode "enableDualStreamMode"(true) before joining the channel. + * + * @param uid ID of the remote user sending the video stream. + * @param streamType Sets the video stream type: #VIDEO_STREAM_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteVideoStreamType(uid_t uid, VIDEO_STREAM_TYPE streamType) = 0; + + /** + * Sets the remote video subscription options + * + * + * @param uid ID of the remote user sending the video stream. + * @param options Sets the video subscription options. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteVideoSubscriptionOptions(uid_t uid, const VideoSubscriptionOptions &options) = 0; + + /** + * Sets the default stream type of the remote video if the remote user has enabled dual-stream. + * + * @param streamType Sets the default video stream type: #VIDEO_STREAM_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteDefaultVideoStreamType(VIDEO_STREAM_TYPE streamType) = 0; + + /** + * Sets the blocklist of subscribe remote stream audio. + * + * @param uidList The id list of users whose audio you do not want to subscribe to. + * @param uidNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's audio will not be subscribed, + * even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioBlocklist(uid_t* uidList, int uidNumber) = 0; + + /** + * Sets the allowlist of subscribe remote stream audio. + * + * @param uidList The id list of users whose audio you want to subscribe to. + * @param uidNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's audio will be subscribed, + * even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, only the blocklist takes effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioAllowlist(uid_t* uidList, int uidNumber) = 0; + + /** + * Sets the blocklist of subscribe remote stream video. + * + * @param uidList The id list of users whose video you do not want to subscribe to. + * @param uidNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's video will not be subscribed, + * even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoBlocklist(uid_t* uidList, int uidNumber) = 0; + + /** + * Sets the allowlist of subscribe remote stream video. + * + * @param uidList The id list of users whose video you want to subscribe to. + * @param uidNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's video will be subscribed, + * even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, only the blocklist takes effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoAllowlist(uid_t* uidList, int uidNumber) = 0; + + /** + * Enables the `onAudioVolumeIndication` callback to report on which users are speaking + * and the speakers' volume. + * + * Once the \ref IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback is enabled, the SDK returns the volume indication in the at the time interval set + * in `enableAudioVolumeIndication`, regardless of whether any user is speaking in the channel. + * + * @param interval Sets the time interval between two consecutive volume indications: + * - <= 0: Disables the volume indication. + * - > 0: Time interval (ms) between two consecutive volume indications, + * and should be integral multiple of 200 (less than 200 will be set to 200). + * @param smooth The smoothing factor that sets the sensitivity of the audio volume + * indicator. The value range is [0, 10]. The greater the value, the more sensitive the + * indicator. The recommended value is 3. + * @param reportVad + * - `true`: Enable the voice activity detection of the local user. Once it is enabled, the `vad` parameter of the + * `onAudioVolumeIndication` callback reports the voice activity status of the local user. + * - `false`: (Default) Disable the voice activity detection of the local user. Once it is disabled, the `vad` parameter + * of the `onAudioVolumeIndication` callback does not report the voice activity status of the local user, except for + * the scenario where the engine automatically detects the voice activity of the local user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudioVolumeIndication(int interval, int smooth, bool reportVad) = 0; + + /** Starts an audio recording. + + The SDK allows recording during a call, which supports either one of the + following two formats: + + - .wav: Large file size with high sound fidelity + - .aac: Small file size with low sound fidelity + + Ensure that the directory to save the recording file exists and is writable. + This method is usually called after the joinChannel() method. + The recording automatically stops when the leaveChannel() method is + called. + + @param filePath Full file path of the recording file. The string of the file + name is in UTF-8 code. + @param quality Sets the audio recording quality: #AUDIO_RECORDING_QUALITY_TYPE. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioRecording(const char* filePath, + AUDIO_RECORDING_QUALITY_TYPE quality) = 0; + /** Starts an audio recording. + + The SDK allows recording during a call, which supports either one of the + following two formats: + + - .wav: Large file size with high sound fidelity + - .aac: Small file size with low sound fidelity + + Ensure that the directory to save the recording file exists and is writable. + This method is usually called after the joinChannel() method. + The recording automatically stops when the leaveChannel() method is + called. + + @param filePath Full file path of the recording file. The string of the file + name is in UTF-8 code. + @param sampleRate Sample rate, value should be 16000, 32000, 44100, or 48000. + @param quality Sets the audio recording quality: #AUDIO_RECORDING_QUALITY_TYPE. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioRecording(const char* filePath, + int sampleRate, + AUDIO_RECORDING_QUALITY_TYPE quality) = 0; + + /** Starts an audio recording. + + The SDK allows recording during a call, which supports either one of the + following two formats: + + - .wav: Large file size with high sound fidelity + - .aac: Small file size with low sound fidelity + + Ensure that the directory to save the recording file exists and is writable. + This method is usually called after the joinChannel() method. + The recording automatically stops when the leaveChannel() method is + called. + + @param config Audio recording config. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioRecording(const AudioRecordingConfiguration& config) = 0; + + /** register encoded audio frame observer + @return + - 0: Success. + - < 0: Failure.p + */ + virtual int registerAudioEncodedFrameObserver(const AudioEncodedFrameObserverConfig& config, IAudioEncodedFrameObserver *observer) = 0; + + /** Stops the audio recording on the client. + + The recording automatically stops when the leaveChannel() method is called. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int stopAudioRecording() = 0; + + /** + * Creates a media player source object and return its pointer. If full featured + * media player source is supported, it will create it, or it will create a simple + * media player. + * + * @return + * - The pointer to \ref rtc::IMediaPlayerSource "IMediaPlayerSource", + * if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ + virtual agora_refptr createMediaPlayer() = 0; + + /** + * Destroy a media player source instance. + * If a media player source instance is destroyed, the video and audio of it cannot + * be published. + * + * @param media_player The pointer to \ref rtc::IMediaPlayerSource. + * + * @return + * - >0: The id of media player source instance. + * - < 0: Failure. + */ + virtual int destroyMediaPlayer(agora_refptr media_player) = 0; + + /** Starts playing and mixing the music file. + + This method mixes the specified local audio file with the audio stream from + the microphone. You can choose whether the other user can hear the local + audio playback and specify the number of playback loops. This method also + supports online music playback. + + After calling this method successfully, the SDK triggers the + + \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (PLAY) + callback on the local client. + When the audio mixing file playback finishes after calling this method, the + SDK triggers the + \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (STOPPED) + callback on the local client. + + @note + - Call this method after joining a channel, otherwise issues may occur. + - If the local audio mixing file does not exist, or if the SDK does not + support the file format or cannot access the music file URL, the SDK returns + #WARN_AUDIO_MIXING_OPEN_ERROR (701). + - If you want to play an online music file, ensure that the time interval + between calling this method is more than 100 ms, or the + `AUDIO_MIXING_ERROR_TOO_FREQUENT_CALL(702)` error code occurs. + + @param filePath Pointer to the absolute path (including the suffixes of the + filename) of the local or online audio file to mix, for example, c:/music/au + dio.mp4. Supported audio formats: 3GP, ASF, ADTS, AVI, MP3, MP4, MPEG-4, + SAMI, and WAVE. + @param loopback Sets which user can hear the audio mixing: + - true: Only the local user can hear the audio mixing. + - false: Both users can hear the audio mixing. + + @param cycle Sets the number of playback loops: + - Positive integer: Number of playback loops. + - `-1`: Infinite playback loops. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioMixing(const char* filePath, bool loopback, int cycle) = 0; + + /** Starts playing and mixing the music file. + + This method mixes the specified local audio file with the audio stream from + the microphone. You can choose whether the other user can hear the local + audio playback and specify the number of playback loops. This method also + supports online music playback. + + After calling this method successfully, the SDK triggers the + + \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (PLAY) + callback on the local client. + When the audio mixing file playback finishes after calling this method, the + SDK triggers the + \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (STOPPED) + callback on the local client. + + @note + - Call this method after joining a channel, otherwise issues may occur. + - If the local audio mixing file does not exist, or if the SDK does not + support the file format or cannot access the music file URL, the SDK returns + #WARN_AUDIO_MIXING_OPEN_ERROR (701). + - If you want to play an online music file, ensure that the time interval + between calling this method is more than 100 ms, or the + `AUDIO_MIXING_ERROR_TOO_FREQUENT_CALL(702)` error code occurs. + + @param filePath Pointer to the absolute path (including the suffixes of the + filename) of the local or online audio file to mix, for example, c:/music/au + dio.mp4. Supported audio formats: 3GP, ASF, ADTS, AVI, MP3, MP4, MPEG-4, + SAMI, and WAVE. + @param loopback Sets which user can hear the audio mixing: + - true: Only the local user can hear the audio mixing. + - false: Both users can hear the audio mixing. + + @param cycle Sets the number of playback loops: + - Positive integer: Number of playback loops. + - `-1`: Infinite playback loops. + + @param startPos The playback position (ms) of the music file. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int startAudioMixing(const char* filePath, bool loopback, int cycle, int startPos) = 0; + + /** Stops playing and mixing the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int stopAudioMixing() = 0; + + /** Pauses playing and mixing the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int pauseAudioMixing() = 0; + + /** Resumes playing and mixing the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int resumeAudioMixing() = 0; + + /** Select audio track for the music file. + + Call this method when you are in a channel. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int selectAudioTrack(int index) = 0; + /** Get audio track count of the music file. + + Call this method when you are in a channel. + + @return + - ≥ 0: Audio track count of the music file, if the method call is successful. + - < 0: Failure. + */ + virtual int getAudioTrackCount() = 0; + + /** Adjusts the volume during audio mixing. + + Call this method when you are in a channel. + + @note This method does not affect the volume of audio effect file playback + invoked by the \ref IRtcEngine::playEffect "playEffect" method. + + @param volume The audio mixing volume. The value ranges between 0 and 100 + (default). + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustAudioMixingVolume(int volume) = 0; + + /** Adjusts the audio mixing volume for publishing (for remote users). + @note Call this method when you are in a channel. + @param volume Audio mixing volume for publishing. The value ranges between 0 and 100 (default). + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustAudioMixingPublishVolume(int volume) = 0; + + /** Retrieves the audio mixing volume for publishing. + This method helps troubleshoot audio volume related issues. + @note Call this method when you are in a channel. + @return + - ≥ 0: The audio mixing volume for publishing, if this method call succeeds. The value range is [0,100]. + - < 0: Failure. + */ + virtual int getAudioMixingPublishVolume() = 0; + + /** Adjusts the audio mixing volume for local playback. + @note Call this method when you are in a channel. + @param volume Audio mixing volume for local playback. The value ranges between 0 and 100 (default). + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustAudioMixingPlayoutVolume(int volume) = 0; + + /** Retrieves the audio mixing volume for local playback. + This method helps troubleshoot audio volume related issues. + @note Call this method when you are in a channel. + @return + - ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100]. + - < 0: Failure. + */ + virtual int getAudioMixingPlayoutVolume() = 0; + + /** Gets the duration (ms) of the music file. + + Call this API when you are in a channel. + + @return + - Returns the audio mixing duration, if the method call is successful. + - < 0: Failure. + */ + virtual int getAudioMixingDuration() = 0; + + /** Gets the playback position (ms) of the music file. + + Call this method when you are in a channel. + + @return + - ≥ 0: The current playback position of the audio mixing, if this method + call succeeds. + - < 0: Failure. + */ + virtual int getAudioMixingCurrentPosition() = 0; + + /** Sets the playback position of the music file to a different starting + position (the default plays from the beginning). + + @param pos The playback starting position (ms) of the audio mixing file. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setAudioMixingPosition(int pos /*in ms*/) = 0; + + /** In dual-channel music files, different audio data can be stored on the left and right channels. + * According to actual needs, you can set the channel mode as the original mode, + * the left channel mode, the right channel mode or the mixed mode + + @param mode The mode of channel mode + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setAudioMixingDualMonoMode(media::AUDIO_MIXING_DUAL_MONO_MODE mode) = 0; + + /** Sets the pitch of the local music file. + * + * When a local music file is mixed with a local human voice, call this method to set the pitch of the local music file only. + * + * @note Call this method after calling \ref IRtcEngine::startAudioMixing "startAudioMixing" and + * receiving the \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (AUDIO_MIXING_STATE_PLAYING) callback. + * + * @param pitch Sets the pitch of the local music file by chromatic scale. The default value is 0, + * which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between + * consecutive values is a chromatic value. The greater the absolute value of this parameter, the + * higher or lower the pitch of the local music file. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioMixingPitch(int pitch) = 0; + /** + * Gets the volume of audio effects. + * + * @return + * - ≥ 0: The volume of audio effects. The value ranges between 0 and 100 (original volume). + * - < 0: Failure. + */ + virtual int getEffectsVolume() = 0; + /** Sets the volume of audio effects. + * + * @param volume The volume of audio effects. The value ranges between 0 + * and 100 (original volume). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEffectsVolume(int volume) = 0; + /** Preloads a specified audio effect. + * + * This method preloads only one specified audio effect into the memory each time + * it is called. To preload multiple audio effects, call this method multiple times. + * + * After preloading, you can call \ref IRtcEngine::playEffect "playEffect" + * to play the preloaded audio effect or call + * \ref IRtcEngine::playAllEffects "playAllEffects" to play all the preloaded + * audio effects. + * + * @note + * - To ensure smooth communication, limit the size of the audio effect file. + * - Agora recommends calling this method before joining the channel. + * + * @param soundId The ID of the audio effect. + * @param filePath The absolute path of the local audio effect file or the URL + * of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, + * 3gp, mkv, and wav. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int preloadEffect(int soundId, const char* filePath, int startPos = 0) = 0; + /** Plays a specified audio effect. + * + * After calling \ref IRtcEngine::preloadEffect "preloadEffect", you can call + * this method to play the specified audio effect for all users in + * the channel. + * + * This method plays only one specified audio effect each time it is called. + * To play multiple audio effects, call this method multiple times. + * + * @note + * - Agora recommends playing no more than three audio effects at the same time. + * - The ID and file path of the audio effect in this method must be the same + * as that in the \ref IRtcEngine::preloadEffect "preloadEffect" method. + * + * @param soundId The ID of the audio effect. + * @param filePath The absolute path of the local audio effect file or the URL + * of the online audio effect file. Supported audio formats: mp3, mp4, m4a, aac, + * 3gp, mkv, and wav. + * @param loopCount The number of times the audio effect loops: + * - `-1`: Play the audio effect in an indefinite loop until + * \ref IRtcEngine::stopEffect "stopEffect" or + * \ref IRtcEngine::stopAllEffects "stopAllEffects" + * - `0`: Play the audio effect once. + * - `1`: Play the audio effect twice. + * @param pitch The pitch of the audio effect. The value ranges between 0.5 and 2.0. + * The default value is `1.0` (original pitch). The lower the value, the lower the pitch. + * @param pan The spatial position of the audio effect. The value ranges between -1.0 and 1.0: + * - `-1.0`: The audio effect displays to the left. + * - `0.0`: The audio effect displays ahead. + * - `1.0`: The audio effect displays to the right. + * @param gain The volume of the audio effect. The value ranges between 0 and 100. + * The default value is `100` (original volume). The lower the value, the lower + * the volume of the audio effect. + * @param publish Sets whether to publish the audio effect to the remote: + * - true: Publish the audio effect to the remote. + * - false: (Default) Do not publish the audio effect to the remote. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int playEffect(int soundId, const char* filePath, int loopCount, double pitch, double pan, int gain, bool publish = false, int startPos = 0) = 0; + /** Plays all audio effects. + * + * After calling \ref IRtcEngine::preloadEffect "preloadEffect" multiple times + * to preload multiple audio effects into the memory, you can call this + * method to play all the specified audio effects for all users in + * the channel. + * + * @param loopCount The number of times the audio effect loops: + * - `-1`: Play the audio effect in an indefinite loop until + * \ref IRtcEngine::stopEffect "stopEffect" or + * \ref IRtcEngine::stopAllEffects "stopAllEffects" + * - `0`: Play the audio effect once. + * - `1`: Play the audio effect twice. + * @param pitch The pitch of the audio effect. The value ranges between 0.5 and 2.0. + * The default value is `1.0` (original pitch). The lower the value, the lower the pitch. + * @param pan The spatial position of the audio effect. The value ranges between -1.0 and 1.0: + * - `-1.0`: The audio effect displays to the left. + * - `0.0`: The audio effect displays ahead. + * - `1.0`: The audio effect displays to the right. + * @param gain The volume of the audio effect. The value ranges between 0 and 100. + * The default value is `100` (original volume). The lower the value, the lower + * the volume of the audio effect. + * @param publish Sets whether to publish the audio effect to the remote: + * - true: Publish the audio effect to the remote. + * - false: (Default) Do not publish the audio effect to the remote. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int playAllEffects(int loopCount, double pitch, double pan, int gain, bool publish = false) = 0; + + /** Gets the volume of the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - ≥ 0: The volume of the specified audio effect. The value ranges + * between 0 and 100 (original volume). + * - < 0: Failure. + */ + virtual int getVolumeOfEffect(int soundId) = 0; + + /** Sets the volume of the specified audio effect. + * + * @param soundId The ID of the audio effect. + * @param volume The volume of the specified audio effect. The value ranges + * between 0 and 100 (original volume). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVolumeOfEffect(int soundId, int volume) = 0; + /** Pauses playing the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pauseEffect(int soundId) = 0; + /** Pauses playing audio effects. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pauseAllEffects() = 0; + /** Resumes playing the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resumeEffect(int soundId) = 0; + /** Resumes playing audio effects. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resumeAllEffects() = 0; + /** Stops playing the specified audio effect. + * + * @param soundId The ID of the audio effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopEffect(int soundId) = 0; + /** Stops playing audio effects. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopAllEffects() = 0; + /** Releases the specified preloaded audio effect from the memory. + * + * @param soundId The ID of the audio effect. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unloadEffect(int soundId) = 0; + /** Releases preloaded audio effects from the memory. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unloadAllEffects() = 0; + /** + * Gets the duration of the audio effect file. + * @note + * - Call this method after joining a channel. + * - For the audio file formats supported by this method, see [What formats of audio files does the Agora RTC SDK support](https://docs.agora.io/en/faq/audio_format). + * + * @param filePath The absolute path or URL address (including the filename extensions) + * of the music file. For example: `C:\music\audio.mp4`. + * When you access a local file on Android, Agora recommends passing a URI address or the path starts + * with `/assets/` in this parameter. + * + * @return + * - ≥ 0: A successful method call. Returns the total duration (ms) of + * the specified audio effect file. + * - < 0: Failure. + * - `-22(ERR_RESOURCE_LIMITED)`: Cannot find the audio effect file. Please + * set a correct `filePath`. + */ + virtual int getEffectDuration(const char* filePath) = 0; + /** + * Sets the playback position of an audio effect file. + * After a successful setting, the local audio effect file starts playing at the specified position. + * + * @note Call this method after \ref IRtcEngine::playEffect(int,const char*,int,double,double,int,bool,int) "playEffect" . + * + * @param soundId Audio effect ID. Ensure that this parameter is set to the + * same value as in \ref IRtcEngine::playEffect(int,const char*,int,double,double,int,bool,int) "playEffect" . + * @param pos The playback position (ms) of the audio effect file. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - `-22(ERR_RESOURCE_LIMITED)`: Cannot find the audio effect file. Please + * set a correct `soundId`. + */ + virtual int setEffectPosition(int soundId, int pos) = 0; + /** + * Gets the playback position of the audio effect file. + * @note Call this method after \ref IRtcEngine::playEffect(int,const char*,int,double,double,int,bool,int) "playEffect" . + * + * @param soundId Audio effect ID. Ensure that this parameter is set to the + * same value as in \ref IRtcEngine::playEffect(int,const char*,int,double,double,int,bool,int) "playEffect" . + * + * @return + * - ≥ 0: A successful method call. Returns the playback position (ms) of + * the specified audio effect file. + * - < 0: Failure. + * - `-22(ERR_RESOURCE_LIMITED)`: Cannot find the audio effect file. Please + * set a correct `soundId`. + */ + virtual int getEffectCurrentPosition(int soundId) = 0; + /** Enables/Disables stereo panning for remote users. + + Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling \ref agora::rtc::IRtcEngine::setRemoteVoicePosition "setRemoteVoicePosition". + + @param enabled Sets whether or not to enable stereo panning for remote users: + - true: enables stereo panning. + - false: disables stereo panning. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSoundPositionIndication(bool enabled) = 0; + /** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + + @note + - For this method to work, enable stereo panning for remote users by calling the \ref agora::rtc::IRtcEngine::enableSoundPositionIndication "enableSoundPositionIndication" method before joining a channel. + - This method requires hardware support. For the best sound positioning, we recommend using a wired headset. + - Ensure that you call this method after joining a channel. + + @param uid The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + - 0.0: the remote sound comes from the front. + - -1.0: the remote sound comes from the left. + - 1.0: the remote sound comes from the right. + @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. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteVoicePosition(uid_t uid, double pan, double gain) = 0; + + /** enable spatial audio + + @param enabled enable/disable spatial audio: + - true: enable spatial audio. + - false: disable spatial audio. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSpatialAudio(bool enabled) = 0; + + /** Sets remote user parameters for spatial audio + + @param uid The ID of the remote user. + @param param spatial audio parameters: SpatialAudioParams. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteUserSpatialAudioParams(uid_t uid, const agora::SpatialAudioParams& params) = 0; + + /** Sets an SDK preset voice beautifier effect. + * + * Call this method to set an SDK preset voice beautifier effect for the local user who sends an + * audio stream. After setting a voice beautifier effect, all users in the channel can hear the + * effect. + * + * You can set different voice beautifier effects for different scenarios. See *Set the Voice + * Beautifier and Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" to + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call + * fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters": + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset voice beautifier effects: #VOICE_BEAUTIFIER_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET preset) = 0; + + /** Sets an SDK preset audio effect. + * + * Call this method to set an SDK preset audio effect for the local user who sends an audio + * stream. This audio effect does not change the gender characteristics of the original voice. + * After setting an audio effect, all users in the channel can hear the effect. + * + * You can set different audio effects for different scenarios. See *Set the Voice Beautifier and + * Audio Effects*. + * + * To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the profile `parameter` of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)` + * or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - If you call this method and set the `preset` parameter to enumerators except + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION`, do not call \ref + * IRtcEngine::setAudioEffectParameters "setAudioEffectParameters"; otherwise, + * `setAudioEffectParameters` overrides this method. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectPreset`: + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * + * @param preset The options for SDK preset audio effects. See #AUDIO_EFFECT_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioEffectPreset(AUDIO_EFFECT_PRESET preset) = 0; + + /** Sets an SDK preset voice conversion. + * + * Call this method to set an SDK preset voice conversion for the local user who sends an audio + * stream. After setting an voice conversion, all users in the channel can hear the effect. + * + * You can set different voice conversion for different scenarios. See *Set the Voice Beautifier and + * Audio Effects*. + * + * To achieve better voice conversion quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the profile `parameter` of `setAudioProfile` to `AUDIO_PROFILE_SPEECH_STANDARD(1)` + * or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - If you call this method and set the `preset` parameter to enumerators, + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setVoiceConversionPreset`: + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * - \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" + * + * @param preset The options for SDK preset voice conversion. See #VOICE_CONVERSION_PRESET. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVoiceConversionPreset(VOICE_CONVERSION_PRESET preset) = 0; + + /** Sets parameters for SDK preset audio effects. + * + * Call this method to set the following parameters for the local user who send an audio stream: + * - 3D voice effect: Sets the cycle period of the 3D voice effect. + * - Pitch correction effect: Sets the basic mode and tonic pitch of the pitch correction effect. + * Different songs have different modes and tonic pitches. Agora recommends bounding this method + * with interface elements to enable users to adjust the pitch correction interactively. + * + * After setting parameters, all users in the channel can hear the relevant effect. + * + * You can call this method directly or after \ref IRtcEngine::setAudioEffectPreset + * "setAudioEffectPreset". If you call this method after \ref IRtcEngine::setAudioEffectPreset + * "setAudioEffectPreset", ensure that you set the preset parameter of `setAudioEffectPreset` to + * `ROOM_ACOUSTICS_3D_VOICE` or `PITCH_CORRECTION` and then call this method to set the same + * enumerator; otherwise, this method overrides `setAudioEffectPreset`. + * + * @note + * - You can call this method either before or after joining a channel. + * - To achieve better audio effect quality, Agora recommends calling \ref + * IRtcEngine::setAudioProfile "setAudioProfile" and setting the `scenario` parameter to + * `AUDIO_SCENARIO_GAME_STREAMING(3)` before calling this method. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" to + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call + * fails. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After calling this method, Agora recommends not calling the following methods, because they + * can override `setAudioEffectParameters`: + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * - \ref IRtcEngine::setVoiceBeautifierParameters "setVoiceBeautifierParameters" + * @param preset The options for SDK preset audio effects: + * - 3D voice effect: `ROOM_ACOUSTICS_3D_VOICE`. + * - Call \ref IRtcEngine::setAudioProfile "setAudioProfile" and set the `profile` parameter to + * `AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before + * setting this enumerator; otherwise, the enumerator setting does not take effect. + * - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear + * the anticipated voice effect. + * - Pitch correction effect: `PITCH_CORRECTION`. To achieve better audio effect quality, Agora + * recommends calling \ref IRtcEngine::setAudioProfile "setAudioProfile" and setting the `profile` + * parameter to `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)` before setting this enumerator. + * @param param1 + * - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, the `param1` sets the cycle period of the + * 3D voice effect. The value range is [1,60] and the unit is a second. The default value is 10 + * seconds, indicating that the voice moves around you every 10 seconds. + * - If you set `preset` to `PITCH_CORRECTION`, `param1` sets the basic mode of the pitch + * correction effect: + * - `1`: (Default) Natural major scale. + * - `2`: Natural minor scale. + * - `3`: Japanese pentatonic scale. + * @param param2 + * - If you set `preset` to `ROOM_ACOUSTICS_3D_VOICE`, you need to set `param2` to `0`. + * - If you set `preset` to `PITCH_CORRECTION`, `param2` sets the tonic pitch of the pitch + * correction effect: + * - `1`: A + * - `2`: A# + * - `3`: B + * - `4`: (Default) C + * - `5`: C# + * - `6`: D + * - `7`: D# + * - `8`: E + * - `9`: F + * - `10`: F# + * - `11`: G + * - `12`: G# + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioEffectParameters(AUDIO_EFFECT_PRESET preset, int param1, int param2) = 0; + + /** Sets parameters for SDK preset voice beautifier effects. + * + * Call this method to set a gender characteristic and a reverberation effect for the singing + * beautifier effect. This method sets parameters for the local user who sends an audio stream. + * + * After you call this method successfully, all users in the channel can hear the relevant effect. + * + * To achieve better audio effect quality, before you call this method, Agora recommends calling + * \ref IRtcEngine::setAudioProfile "setAudioProfile", and setting the `scenario` parameter as + * `AUDIO_SCENARIO_GAME_STREAMING(3)` and the `profile` parameter as + * `AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4)` or `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5)`. + * + * @note + * - You can call this method either before or after joining a channel. + * - Do not set the `profile` parameter of \ref IRtcEngine::setAudioProfile "setAudioProfile" as + * `AUDIO_PROFILE_SPEECH_STANDARD(1)` or `AUDIO_PROFILE_IOT(6)`; otherwise, this method call does + * not take effect. + * - This method works best with the human voice. Agora does not recommend using this method for + * audio containing music. + * - After you call this method, Agora recommends not calling the following methods, because they + * can override `setVoiceBeautifierParameters`: + * - \ref IRtcEngine::setAudioEffectPreset "setAudioEffectPreset" + * - \ref IRtcEngine::setAudioEffectParameters "setAudioEffectParameters" + * - \ref IRtcEngine::setVoiceBeautifierPreset "setVoiceBeautifierPreset" + * - \ref IRtcEngine::setLocalVoicePitch "setLocalVoicePitch" + * - \ref IRtcEngine::setLocalVoiceEqualization "setLocalVoiceEqualization" + * - \ref IRtcEngine::setLocalVoiceReverb "setLocalVoiceReverb" + * + * @param preset The options for SDK preset voice beautifier effects: + * - `SINGING_BEAUTIFIER`: Singing beautifier effect. + * @param param1 The gender characteristics options for the singing voice: + * - `1`: A male-sounding voice. + * - `2`: A female-sounding voice. + * @param param2 The reverberation effects options: + * - `1`: The reverberation effect sounds like singing in a small room. + * - `2`: The reverberation effect sounds like singing in a large room. + * - `3`: The reverberation effect sounds like singing in a hall. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVoiceBeautifierParameters(VOICE_BEAUTIFIER_PRESET preset, + int param1, int param2) = 0; + + /** Set parameters for SDK preset voice conversion. + * + * @note + * - reserved interface + * + * @param preset The options for SDK preset audio effects. See #VOICE_CONVERSION_PRESET. + * @param param1 reserved. + * @param param2 reserved. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVoiceConversionParameters(VOICE_CONVERSION_PRESET preset, + int param1, int param2) = 0; + + /** Changes the voice pitch of the local speaker. + + @param pitch The voice pitch. The value ranges between 0.5 and 2.0. The lower + the value, the lower the voice pitch. The default value is 1.0 (no change to + the local voice pitch). + + @return + - 0: Success. + - -1: Failure. + */ + virtual int setLocalVoicePitch(double pitch) = 0; + + /** Sets the local voice equalization effect. + + @param bandFrequency The band frequency ranging from 0 to 9, representing the + respective 10-band center frequencies of the voice effects, including 31, 62, + 125, 500, 1k, 2k, 4k, 8k, and 16k Hz. + @param bandGain Gain of each band in dB. The value ranges from -15 to 15. The + default value is 0. + @return + - 0: Success. + - -1: Failure. + */ + virtual int setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, + int bandGain) = 0; + + /** Sets the local voice reverberation. + + @param reverbKey The reverberation key: #AUDIO_REVERB_TYPE. + @param value The value of the reverberation key: #AUDIO_REVERB_TYPE. + @return + - 0: Success. + - -1: Failure. + */ + virtual int setLocalVoiceReverb(AUDIO_REVERB_TYPE reverbKey, int value) = 0; + /** Sets preset audio playback effect for remote headphones after remote audio is mixed. + + @param preset The preset key: #HEADPHONE_EQUALIZER_PRESET. + - HEADPHONE_EQUALIZER_OFF = 0x00000000 : Turn off the eualizer effect for headphones. + - HEADPHONE_EQUALIZER_OVEREAR = 0x04000001 : For over-ear headphones only. + - HEADPHONE_EQUALIZER_INEAR = 0x04000002 : For in-ear headphones only. + @return + - 0: Success. + - < 0: Failure. + - -1(ERR_FAILED): A general error occurs (no specified reason). + */ + virtual int setHeadphoneEQPreset(HEADPHONE_EQUALIZER_PRESET preset) = 0; + /** Sets the parameters of audio playback effect for remote headphones after remote audio is mixed. + + @param lowGain The higher the parameter value, the deeper the sound. The value range is [-10,10]. + @param highGain The higher the parameter value, the sharper the sound. The value range is [-10,10]. + @return + - 0: Success. + - < 0: Failure. + - -1(ERR_FAILED): A general error occurs (no specified reason). + */ + virtual int setHeadphoneEQParameters(int lowGain, int highGain) = 0; + + /** **DEPRECATED** Specifies an SDK output log file. + * + * The log file records all log data for the SDK’s operation. Ensure that the + * directory for the log file exists and is writable. + * + * @note + * Ensure that you call this method immediately after \ref initialize "initialize", + * or the output log may not be complete. + * + * @param filePath File path of the log file. The string of the log file is in UTF-8. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFile(const char* filePath) = 0; + + /** + * Sets the output log filter level of the SDK. + * + * You can use one or a combination of the filters. The log filter level follows the + * sequence of `OFF`, `CRITICAL`, `ERROR`, `WARNING`, `INFO`, and `DEBUG`. Choose a filter level + * and you will see logs preceding that filter level. For example, if you set the log filter level to + * `WARNING`, you see the logs within levels `CRITICAL`, `ERROR`, and `WARNING`. + * + * @param filter The log filter level: + * - `LOG_FILTER_DEBUG(0x80f)`: Output all API logs. Set your log filter as DEBUG + * if you want to get the most complete log file. + * - `LOG_FILTER_INFO(0x0f)`: Output logs of the CRITICAL, ERROR, WARNING, and INFO + * level. We recommend setting your log filter as this level. + * - `LOG_FILTER_WARNING(0x0e)`: Output logs of the CRITICAL, ERROR, and WARNING level. + * - `LOG_FILTER_ERROR(0x0c)`: Output logs of the CRITICAL and ERROR level. + * - `LOG_FILTER_CRITICAL(0x08)`: Output logs of the CRITICAL level. + * - `LOG_FILTER_OFF(0)`: Do not output any log. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFilter(unsigned int filter) = 0; + + /** + * Sets the output log level of the SDK. + * + * You can set the SDK to ouput the log files of the specified level. + * + * @param level The log level: + * - `LOG_LEVEL_NONE (0x0000)`: Do not output any log file. + * - `LOG_LEVEL_INFO (0x0001)`: (Recommended) Output log files of the INFO level. + * - `LOG_LEVEL_WARN (0x0002)`: Output log files of the WARN level. + * - `LOG_LEVEL_ERROR (0x0004)`: Output log files of the ERROR level. + * - `LOG_LEVEL_FATAL (0x0008)`: Output log files of the FATAL level. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogLevel(commons::LOG_LEVEL level) = 0; + + /** + * Sets the log file size (KB). + * + * The SDK has two log files, each with a default size of 512 KB. If you set + * `fileSizeInBytes` as 1024 KB, the SDK outputs log files with a total + * maximum size of 2 MB. + * If the total size of the log files exceed the set value, + * the new output log files overwrite the old output log files. + * + * @param fileSizeInKBytes The SDK log file size (KB). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFileSize(unsigned int fileSizeInKBytes) = 0; + + /** Upload current log file immediately to server. + * only use this when an error occurs + * block before log file upload success or timeout. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int uploadLogFile(agora::util::AString& requestId) = 0; + + /** * Write the log to SDK . @technical preview + * + * You can Write the log to SDK log files of the specified level. + * + * @param level The log level: + * - `LOG_LEVEL_NONE (0x0000)`: Do not output any log file. + * - `LOG_LEVEL_INFO (0x0001)`: (Recommended) Output log files of the INFO level. + * - `LOG_LEVEL_WARN (0x0002)`: Output log files of the WARN level. + * - `LOG_LEVEL_ERROR (0x0004)`: Output log files of the ERROR level. + * - `LOG_LEVEL_FATAL (0x0008)`: Output log files of the FATAL level. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int writeLog(commons::LOG_LEVEL level, const char* fmt, ...) = 0; + + /** + * Updates the display mode of the local video view. + * + * After initializing the local video view, you can call this method to update its rendering mode. + * It affects only the video view that the local user sees, not the published local video stream. + * + * @note + * - Ensure that you have called \ref setupLocalVideo "setupLocalVideo" to initialize the local video + * view before this method. + * - During a call, you can call this method as many times as necessary to update the local video view. + * + * @param renderMode Sets the local display mode. See #RENDER_MODE_TYPE. + * @param mirrorMode Sets the local mirror mode. See #VIDEO_MIRROR_MODE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode, VIDEO_MIRROR_MODE_TYPE mirrorMode) = 0; + /** + * Updates the display mode of the video view of a remote user. + * + * After initializing the video view of a remote user, you can call this method to update its + * rendering and mirror modes. This method affects only the video view that the local user sees. + * + * @note + * - Ensure that you have called \ref setupRemoteVideo "setupRemoteVideo" to initialize the remote video + * view before calling this method. + * - During a call, you can call this method as many times as necessary to update the display mode + * of the video view of a remote user. + * + * @param uid ID of the remote user. + * @param renderMode Sets the remote display mode. See #RENDER_MODE_TYPE. + * @param mirrorMode Sets the mirror type. See #VIDEO_MIRROR_MODE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteRenderMode(uid_t uid, media::base::RENDER_MODE_TYPE renderMode, + VIDEO_MIRROR_MODE_TYPE mirrorMode) = 0; + + // The following APIs are either deprecated and going to deleted. + + /** + * Updates the display mode of the local video view. + * + * After initializing the local video view, you can call this method to update its rendering mode. + * It affects only the video view that the local user sees, not the published local video stream. + * + * @note + * - Ensure that you have called \ref setupLocalVideo "setupLocalVideo" to initialize the local video + * view before this method. + * - During a call, you can call this method as many times as necessary to update the local video view. + * + * @param renderMode Sets the local display mode. See #RENDER_MODE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode) = 0; + + /** + * Sets the local video mirror mode. + * + * Use this method before calling the \ref startPreview "startPreview" method, or the mirror mode + * does not take effect until you call the `startPreview` method again. + * @param mirrorMode Sets the local video mirror mode. See #VIDEO_MIRROR_MODE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) = 0; + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableDualStreamMode(bool enabled) = 0; + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @param streamConfig + * - The minor stream config + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) = 0; + + + /** + * Enables, disables or auto enable the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param mode + * - The dual stream mode + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode) = 0; + + /** + * Enables, disables or auto enable the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video stream) + * video using \ref setRemoteVideoStreamType "setRemoteVideoStreamType". + * + * @param mode Dual stream mode: #SIMULCAST_STREAM_MODE. + * @param streamConfig Configurations of the low stream: SimulcastStreamConfig. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode, + const SimulcastStreamConfig& streamConfig) = 0; + + /** + * Sets the external audio track. + * + * @note + * Ensure that you call this method before joining the channel. + * + * @param trackId custom audio track id. + * @param enabled Determines whether to local playback the external audio track: + * - true: Local playback the external audio track. + * - false: Local don`t playback the external audio track. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableCustomAudioLocalPlayback(track_id_t trackId, bool enabled) = 0; + + /** + * Enables or disables echo cancellation. + * + * @param enabled Whether to enable echo cancellation. + * @param audioSourceDelay The delayed time for capturing the audio source. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableEchoCancellationExternal(bool enabled, int audioSourceDelay) = 0; + + /** + * Sets the audio recording format for the + * \ref agora::media::IAudioFrameObserver::onRecordAudioFrame "onRecordAudioFrame" callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in the `onRecordAudioFrame` callback, which can set be + * as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of audio channels of the audio data returned in the `onRecordAudioFrame` callback, which can + * be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param mode This mode is deprecated. + * @param samplesPerCall not support. Sampling points in the called data returned in + * onRecordAudioFrame(). For example, it is usually set as 1024 for stream + * pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingAudioFrameParameters(int sampleRate, int channel, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode, + int samplesPerCall) = 0; + + /** + * Sets the audio recording format for the + * \ref agora::media::IAudioFrameObserver::onPublishAudioFrame "onPublishAudioFrame" callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in the `onPublishAudioFrame` callback, which can set be + * as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of audio channels of the audio data returned in the `onPublishAudioFrame` callback, which can + * be set as 1 or 2: + * - 1: Mono. + * - 2: Stereo. + * @param mode This mode is deprecated. + * @param samplesPerCall not support. Sampling points in the called data returned in + * onPublishAudioFrame(). For example, it is usually set as 1024 for stream + * pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPublishAudioFrameParameters(int sampleRate, int channel, + int samplesPerCall) = 0; + + /** + * Sets the audio playback format for the + * \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame "onPlaybackAudioFrame" callback. + * + * @param sampleRate Sets the sample rate (Hz) of the audio data returned in the `onPlaybackAudioFrame` callback, + * which can set be as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of channels of the audio data returned in the `onPlaybackAudioFrame` callback, which + * can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the onPlaybackAudioFrame() callback: + * agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall not support. Sampling points in the called data returned in + * onPlaybackAudioFrame(). For example, it is usually set as 1024 for stream + * pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackAudioFrameParameters(int sampleRate, int channel, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode, + int samplesPerCall) = 0; + + /** + * Sets the mixed audio format for the + * \ref agora::media::IAudioFrameObserver::onMixedAudioFrame "onMixedAudioFrame" callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in the `onMixedAudioFrame` callback, which can set + * be as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of channels of the audio data in `onMixedAudioFrame` callback, which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param samplesPerCall not support. Sampling points in the called data returned in + * `onMixedAudioFrame`. For example, it is usually set as 1024 for stream pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall) = 0; + + /** + * Sets the audio ear monitoring format for the + * \ref agora::media::IAudioFrameObserver::onEarMonitoringAudioFrame "onEarMonitoringAudioFrame" callback. + * + * @param sampleRate Sets the sample rate (Hz) of the audio data returned in the `onEarMonitoringAudioFrame` callback, + * which can set be as 8000, 16000, 32000, 44100, or 48000. + * @param channel The number of channels of the audio data returned in the `onEarMonitoringAudioFrame` callback, which + * can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @param mode Deprecated. The use mode of the onEarMonitoringAudioFrame() callback: + * agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall not support. Sampling points in the called data returned in + * onEarMonitoringAudioFrame(). For example, it is usually set as 1024 for stream + * pushing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEarMonitoringAudioFrameParameters(int sampleRate, int channel, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode, + int samplesPerCall) = 0; + + /** + * Sets the audio playback format before mixing in the + * \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing "onPlaybackAudioFrameBeforeMixing" + * callback. + * + * @param sampleRate The sample rate (Hz) of the audio data returned in + * `onPlaybackAudioFrameBeforeMixing`, which can set be as 8000, 16000, 32000, 44100, or 48000. + * @param channel Number of channels of the audio data returned in `onPlaybackAudioFrameBeforeMixing`, + * which can be set as 1 or 2: + * - 1: Mono + * - 2: Stereo + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel) = 0; + + /** + * Enable the audio spectrum monitor. + * + * @param intervalInMS Sets the time interval(ms) between two consecutive audio spectrum callback. + * The default value is 100. This param should be larger than 10. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudioSpectrumMonitor(int intervalInMS = 100) = 0; + /** + * Disalbe the audio spectrum monitor. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableAudioSpectrumMonitor() = 0; + + /** + * Registers an audio spectrum observer. + * + * You need to implement the `IAudioSpectrumObserver` class in this method, and register the following callbacks + * according to your scenario: + * - \ref agora::media::IAudioSpectrumObserver::onAudioSpectrumComputed "onAudioSpectrumComputed": Occurs when + * the SDK receives the audio data and at set intervals. + * + * @param observer A pointer to the audio spectrum observer: \ref agora::media::IAudioSpectrumObserver + * "IAudioSpectrumObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioSpectrumObserver(agora::media::IAudioSpectrumObserver * observer) = 0; + /** + * Releases the audio spectrum observer. + * + * @param observer The pointer to the audio spectrum observer: \ref agora::media::IAudioSpectrumObserver + * "IAudioSpectrumObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioSpectrumObserver(agora::media::IAudioSpectrumObserver * observer) = 0; + + /** Adjusts the recording volume. + + @param volume The recording volume, which ranges from 0 to 400: + + - 0: Mute the recording volume. + - 100: The Original volume. + - 400: (Maximum) Four times the original volume with signal clipping + protection. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustRecordingSignalVolume(int volume) = 0; + + /** + * Mute or resume recording signal volume. + * + * @param mute Determines whether to mute or resume the recording signal volume. + * - true: Mute the recording signal volume. + * - false: (Default) Resume the recording signal volume. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRecordingSignal(bool mute) = 0; + + /** Adjusts the playback volume. + + @param volume The playback volume, which ranges from 0 to 400: + + - 0: Mute the recoridng volume. + - 100: The Original volume. + - 400: (Maximum) Four times the original volume with signal clipping + protection. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustPlaybackSignalVolume(int volume) = 0; + + /* + * Adjust the playback volume of the user specified by uid. + * + * You can call this method to adjust the playback volume of the user specified by uid + * in call. If you want to adjust playback volume of the multi user, you can call this + * this method multi times. + * + * @note + * Please call this method after join channel. + * This method adjust the playback volume of specified user. + * + * @param uid Remote user ID. + * @param volume The playback volume of the specified remote user. The value ranges between 0 and 400, including the following: + * 0: Mute. + * 100: (Default) Original volume. + * 400: Four times the original volume with signal-clipping protection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustUserPlaybackSignalVolume(unsigned int uid, int volume) = 0; + + /** Sets the fallback option for the published video stream based on the network conditions. + + If `option` is set as #STREAM_FALLBACK_OPTION_AUDIO_ONLY (2), the SDK will: + + - Disable the upstream video but enable audio only when the network conditions deteriorate and cannot support both video and audio. + - Re-enable the video when the network conditions improve. + + When the published video stream falls back to audio only or when the audio-only stream switches back to the video, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalPublishFallbackToAudioOnly "onLocalPublishFallbackToAudioOnly" callback. + + @note + - Agora does not recommend using this method for CDN live streaming, because the remote CDN live user will have a noticeable lag when the published video stream falls back to audio only. + - Ensure that you call this method before joining a channel. + + @param option Sets the fallback option for the published video stream: + - #STREAM_FALLBACK_OPTION_DISABLED (0): (Default) No fallback behavior for the published video stream when the uplink network condition is poor. The stream quality is not guaranteed. + - #STREAM_FALLBACK_OPTION_AUDIO_ONLY (2): The published video stream falls back to audio only when the uplink network condition is poor. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setLocalPublishFallbackOption(STREAM_FALLBACK_OPTIONS option) = 0; + + /** Sets the fallback option for the remotely subscribed video stream based on the network conditions. + + The default setting for `option` is #STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW (1), where the remotely subscribed video stream falls back to the low-stream video (low resolution and low bitrate) under poor downlink network conditions. + + If `option` is set as #STREAM_FALLBACK_OPTION_AUDIO_ONLY (2), the SDK automatically switches the video from a high-stream to a low-stream, or disables the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. The SDK monitors the network quality and restores the video stream when the network conditions improve. + + When the remotely subscribed video stream falls back to audio only or when the audio-only stream switches back to the video stream, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onRemoteSubscribeFallbackToAudioOnly "onRemoteSubscribeFallbackToAudioOnly" callback. + + @note Ensure that you call this method before joining a channel. + + @param option Sets the fallback option for the remotely subscribed video stream. See #STREAM_FALLBACK_OPTIONS. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteSubscribeFallbackOption(STREAM_FALLBACK_OPTIONS option) = 0; + + /** Enables loopback recording. + * + * If you enable loopback recording, the output of the default sound card is mixed into + * the audio stream sent to the other end. + * + * @note This method is for Windows only. + * + * @param enabled Sets whether to enable/disable loopback recording. + * - true: Enable loopback recording. + * - false: (Default) Disable loopback recording. + * @param deviceName Pointer to the device name of the sound card. The default value is NULL (the default sound card). + * - This method is for macOS and Windows only. + * - macOS does not support loopback capturing of the default sound card. If you need to use this method, + * please use a virtual sound card and pass its name to the deviceName parameter. Agora has tested and recommends using soundflower. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLoopbackRecording(bool enabled, const char* deviceName = NULL) = 0; + + + /** Adjusts the loopback recording volume. + + @param volume The loopback volume, which ranges from 0 to 100: + + - 0: Mute the recoridng volume. + - 100: The Original volume. + protection. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int adjustLoopbackSignalVolume(int volume) = 0; + + /** Retrieves the audio volume for recording loopback. + @note Call this method when you are in a channel. + @return + - ≥ 0: The audio volume for loopback, if this method call succeeds. The value range is [0,100]. + - < 0: Failure. + */ + virtual int getLoopbackRecordingVolume() = 0; + + /** + * Enables in-ear monitoring. + * + * @param enabled Determines whether to enable in-ear monitoring. + * - true: Enable. + * - false: (Default) Disable. + * @param includeAudioFilters The type of the ear monitoring: #EAR_MONITORING_FILTER_TYPE + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableInEarMonitoring(bool enabled, int includeAudioFilters) = 0; + + /** + * Sets the volume of the in-ear monitor. + * + * @param volume Sets the volume of the in-ear monitor. The value ranges + * between 0 and 100 (default). + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setInEarMonitoringVolume(int volume) = 0; + +#if defined (_WIN32) || defined(__linux__) || defined(__ANDROID__) + virtual int loadExtensionProvider(const char* path, bool unload_after_use = false) = 0; +#endif + + /** + * Sets the provider property of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExtensionProviderProperty( + const char* provider, const char* key, const char* value) = 0; + + /** + * Registers an extension. Normally you should call this function immediately after engine initialization. + * Once an extension is registered, SDK will create and add extension to pipeline automatically. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param type The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. The default is UNKNOWN_MEDIA_SOURCE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerExtension(const char* provider, const char* extension, + agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; + + /** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtension, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtension explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param enable Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * @param type The source type of the extension, e.g. PRIMARY_CAMERA_SOURCE. The default is UNKNOWN_MEDIA_SOURCE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableExtension( + const char* provider, const char* extension, bool enable=true, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; + + /** + * Enable/Disable an extension. + * By calling this function, you can dynamically enable/disable the extension without changing the pipeline. + * For example, enabling/disabling Extension_A means the data will be adapted/bypassed by Extension_A. + * + * NOTE: For compatible reason, if you haven't call registerExtension, + * enableExtension will automatically register the specified extension. + * We suggest you call registerExtension explicitly. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. + * @param enable Whether to enable the extension extension: + * - true: (Default) Enable the extension. + * - false: Disable the extension. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableExtension(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, bool enable = true) = 0; + + /** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExtensionProperty( + const char* provider, const char* extension, + const char* key, const char* value, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; + + /** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param key The key of the extension. + * @param value The value of the extension key. + * @param buf_len Maximum length of the JSON string indicating the extension property. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getExtensionProperty( + const char* provider, const char* extension, + const char* key, char* value, int buf_len, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; + + /** + * Sets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. + * @param key The key of the extension. + * @param value The json formatted value of the extension key. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, const char* value) = 0; + + /** + * Gets the properties of an extension. + * + * @param provider The name of the extension provider, e.g. agora.io. + * @param extension The name of the extension, e.g. agora.beauty. + * @param extensionInfo The information for extension. + * @param key The key of the extension. + * @param value The value of the extension key. + * @param buf_len Maximum length of the JSON string indicating the extension property. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, char* value, int buf_len) = 0; + + /** Sets the camera capture configuration. + * @note Call this method before enabling the local camera. + * That said, you can call this method before calling \ref IRtcEngine::joinChannel "joinChannel", + * \ref IRtcEngine::enableVideo "enableVideo", or \ref IRtcEngine::enableLocalVideo "enableLocalVideo", + * depending on which method you use to turn on your local camera. + * + * @param config Sets the camera capturer configuration. See CameraCapturerConfiguration. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraCapturerConfiguration(const CameraCapturerConfiguration& config) = 0; + + + /** + * Get an custom video track id created by internal,which could used to publish or preview + * + * @return + * - > 0: the useable video track id. + * - < 0: Failure. + */ + virtual video_track_id_t createCustomVideoTrack() = 0; + + /** + * Get an custom encoded video track id created by internal,which could used to publish or preview + * + * @return + * - > 0: the useable video track id. + * - < 0: Failure. + */ + virtual video_track_id_t createCustomEncodedVideoTrack(const SenderOptions& sender_option) = 0; + + /** + * destroy a created custom video track id + * + * @param video_track_id The video track id which was created by createCustomVideoTrack + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int destroyCustomVideoTrack(video_track_id_t video_track_id) = 0; + + /** + * destroy a created custom encoded video track id + * + * @param video_track_id The video track id which was created by createCustomEncodedVideoTrack + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int destroyCustomEncodedVideoTrack(video_track_id_t video_track_id) = 0; + + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + + /** + * Switches between front and rear cameras. + * + * @note This method applies to Android and iOS only. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int switchCamera() = 0; + + /** + * Checks whether the camera zoom function is supported. + * + * @return + * - true: The camera zoom function is supported. + * - false: The camera zoom function is not supported. + */ + virtual bool isCameraZoomSupported() = 0; + + /** + * Checks whether the camera face detect is supported. + * + * @return + * - true: The camera face detect is supported. + * - false: The camera face detect is not supported. + */ + virtual bool isCameraFaceDetectSupported() = 0; + + /** + * Checks whether the camera flash function is supported. + * + * @return + * - true: The camera flash function is supported. + * - false: The camera flash function is not supported. + */ + virtual bool isCameraTorchSupported() = 0; + + /** + * Checks whether the camera manual focus function is supported. + * + * @return + * - true: The camera manual focus function is supported. + * - false: The camera manual focus function is not supported. + */ + virtual bool isCameraFocusSupported() = 0; + + /** + * Checks whether the camera auto focus function is supported. + * + * @return + * - true: The camera auto focus function is supported. + * - false: The camera auto focus function is not supported. + */ + virtual bool isCameraAutoFocusFaceModeSupported() = 0; + + /** + * Sets the camera zoom ratio. + * + * @param factor The camera zoom factor. It ranges from 1.0 to the maximum zoom + * supported by the camera. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraZoomFactor(float factor) = 0; + + /** + * Sets the camera face detection. + * + * @param enabled The camera face detection enabled. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableFaceDetection(bool enabled) = 0; + + /** + * Gets the maximum zoom ratio supported by the camera. + * @return The maximum zoom ratio supported by the camera. + */ + virtual float getCameraMaxZoomFactor() = 0; + + /** + * Sets the manual focus position. + * + * @param positionX The horizontal coordinate of the touch point in the view. + * @param positionY The vertical coordinate of the touch point in the view. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraFocusPositionInPreview(float positionX, float positionY) = 0; + + /** + * Enables the camera flash. + * + * @param isOn Determines whether to enable the camera flash. + * - true: Enable the flash. + * - false: Do not enable the flash. + */ + virtual int setCameraTorchOn(bool isOn) = 0; + + /** + * Enables the camera auto focus face function. + * + * @param enabled Determines whether to enable the camera auto focus face mode. + * - true: Enable the auto focus face function. + * - false: Do not enable the auto focus face function. + */ + virtual int setCameraAutoFocusFaceModeEnabled(bool enabled) = 0; + + /** Checks whether the camera exposure function is supported. + * + * Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`. + * + * @since v2.3.2. + * @return + *
      + *
    • true: The device supports the camera exposure function.
    • + *
    • false: The device does not support the camera exposure function.
    • + *
    + */ + virtual bool isCameraExposurePositionSupported() = 0; + + /** Sets the camera exposure position. + * + * Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`. + * + * A successful setCameraExposurePosition method call triggers the {@link IRtcEngineEventHandler#onCameraExposureAreaChanged onCameraExposureAreaChanged} callback on the local client. + * @since v2.3.2. + * @param positionXinView The horizontal coordinate of the touch point in the view. + * @param positionYinView The vertical coordinate of the touch point in the view. + * + * @return + *
      + *
    • 0: Success.
    • + *
    • < 0: Failure.
    • + *
    + */ + virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0; + + /** + * Checks whether the camera exposure function is supported. + * + * @return + * - true: The camera exposure function is supported. + * - false: The camera exposure function is not supported. + */ + virtual bool isCameraExposureSupported() = 0; + + /** + * Sets the camera exposure bias. + * + * @param factor The camera exposure factor. The recommended camera exposure factor ranging from -8.0 to 8.0. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraExposureFactor(float factor) = 0; + +#if defined(__APPLE__) + /** + * Checks whether the camera auto exposure function is supported. + * + * @return + * - true: The camera auto exposure function is supported. + * - false: The camera auto exposure function is not supported. + */ + virtual bool isCameraAutoExposureFaceModeSupported() = 0; + + + /** + * Enables the camera auto exposure face function. + * + * @param enabled Determines whether to enable the camera auto exposure face mode. + * - true: Enable the auto exposure face function. + * - false: Do not enable the auto exposure face function. + */ + virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0; +#endif + + /** Sets the default audio route (for Android and iOS only). + + Most mobile phones have two audio routes: an earpiece at the top, and a + speakerphone at the bottom. The earpiece plays at a lower volume, and the + speakerphone at a higher volume. + + When setting the default audio route, you determine whether audio playback + comes through the earpiece or speakerphone when no external audio device is + connected. + + Depending on the scenario, Agora uses different default audio routes: + - Voice call: Earpiece + - Audio broadcast: Speakerphone + - Video call: Speakerphone + - Video broadcast: Speakerphone + + Call this method before, during, or after a call, to change the default + audio route. When the audio route changes, the SDK triggers the + \ref IRtcEngineEventHandler::onAudioRoutingChanged "onAudioRoutingChanged" + callback. + + @note The system audio route changes when an external audio device, such as + a headphone or a Bluetooth audio device, is connected. See *Principles for changing the audio route*. + + @param defaultToSpeaker Whether to set the speakerphone as the default audio + route: + - true: Set the speakerphone as the default audio route. + - false: Do not set the speakerphone as the default audio route. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker) = 0; + + /** Enables/Disables the speakerphone temporarily (for Android and iOS only). + + When the audio route changes, the SDK triggers the + \ref IRtcEngineEventHandler::onAudioRoutingChanged "onAudioRoutingChanged" + callback. + + You can call this method before, during, or after a call. However, Agora + recommends calling this method only when you are in a channel to change + the audio route temporarily. + + @note This method sets the audio route temporarily. Plugging in or + unplugging a headphone, or the SDK re-enabling the audio device module + (ADM) to adjust the media volume in some scenarios relating to audio, leads + to a change in the audio route. See *Principles for changing the audio + route*. + + @param speakerOn Whether to set the speakerphone as the temporary audio + route: + - true: Set the speakerphone as the audio route temporarily. (For iOS only: + calling setEnableSpeakerphone(true) does not change the audio route to the + speakerphone if a headphone or a Bluetooth audio device is connected.) + - false: Do not set the speakerphone as the audio route. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setEnableSpeakerphone(bool speakerOn) = 0; + + /** Checks whether the speakerphone is enabled (for Android and iOS only). + + @return + - true: The speakerphone is enabled, and the audio plays from the speakerphone. + - false: The speakerphone is not enabled, and the audio plays from devices + other than the speakerphone. For example, the headset or earpiece. + */ + virtual bool isSpeakerphoneEnabled() = 0; + +#endif // __ANDROID__ || (__APPLE__ && TARGET_OS_IOS) + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + /** Get \ref ScreenCaptureSourceInfo list including available windows and screens. + * + * @param thumbSize Set expected size for thumb, image will be scaled accordingly. For windows, SIZE is defined in windef.h. + * @param iconSize Set expected size for icon, image will be scaled accordingly. For windows, SIZE is defined in windef.h. + * @param includeScreen Determines whether to include screens info. + * - true: sources will have screens info + * - false: source will only have windows info + * @return + * - IScreenCaptureSourceList* a pointer to an instance of IScreenCaptureSourceList + */ + virtual IScreenCaptureSourceList* getScreenCaptureSources(const SIZE& thumbSize, const SIZE& iconSize, const bool includeScreen) = 0; +#endif // _WIN32 || (__APPLE__ && !TARGET_OS_IPHONE && TARGET_OS_MAC) +#if (defined(__APPLE__) && TARGET_OS_IOS) + /** Sets the operational permission of the SDK on the audio session. + * + * The SDK and the app can both configure the audio session by default. If + * you need to only use the app to configure the audio session, this method + * restricts the operational permission of the SDK on the audio session. + * + * You can call this method either before or after joining a channel. Once + * you call this method to restrict the operational permission of the SDK + * on the audio session, the restriction takes effect when the SDK needs to + * change the audio session. + * + * @note + * - This method is for iOS only. + * - This method does not restrict the operational permission of the app on + * the audio session. + * + * @param restriction The operational permission of the SDK on the audio session. + * See #AUDIO_SESSION_OPERATION_RESTRICTION. This parameter is in bit mask + * format, and each bit corresponds to a permission. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioSessionOperationRestriction(AUDIO_SESSION_OPERATION_RESTRICTION restriction) = 0; +#endif // __APPLE__ && TARGET_OS_IOS + +#if defined(_WIN32) || (defined(__APPLE__) && !TARGET_OS_IPHONE && TARGET_OS_MAC) + + /** Shares the whole or part of a screen by specifying the display ID. + + @note This method applies to macOS only. + + @param displayId The display ID of the screen to be shared. This parameter + specifies which screen you want to share. For information on how to get the + displayId, see the advanced guide: Share the Screen. + @param regionRect (Optional) Sets the relative location of the region to the + screen. NIL means sharing the whole screen. See Rectangle. + If the specified region overruns the screen, the SDK shares only the region + within it; if you set width or height as 0, the SDK shares the whole screen. + @param captureParams Sets the screen sharing encoding parameters. See + ScreenCaptureParameters. + + @return + - 0: Success. + - < 0: Failure: + - ERR_INVALID_ARGUMENT (2): The argument is invalid. + - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when try to start screen capture. + */ + virtual int startScreenCaptureByDisplayId(uint32_t displayId, const Rectangle& regionRect, + const ScreenCaptureParameters& captureParams) = 0; + +#endif // __APPLE__ && TARGET_OS_MAC && !TARGET_OS_IPHONE + +#if defined(_WIN32) + + /** + * Shares the whole or part of a screen by specifying the screen rect. + * + * @deprecated This method is deprecated, use \ref IRtcEngine::startScreenCaptureByDisplayId "startScreenCaptureByDisplayId" instead. Agora strongly recommends using `startScreenCaptureByDisplayId` if you need to start screen sharing on a device connected to another display. + * + * @note This method applies to Windows only. + * + * @param screenRect Sets the relative location of the screen to the virtual + * screen. For information on how to get screenRect, see the advanced guide: + * Share the Screen. + * @param regionRect (Optional) Sets the relative location of the region to the + * screen. NULL means sharing the whole screen. See Rectangle. + * If the specified region overruns the screen, the SDK shares only the region + * within it; if you set width or height as 0, the SDK shares the whole screen. + * @param captureParams Sets the screen sharing encoding parameters. See + * ScreenCaptureParameters. + * + * @return + * - 0: Success. + * - < 0: Failure: + * - ERR_INVALID_ARGUMENT (2): The argument is invalid. + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when try to start screen capture. + */ + virtual int startScreenCaptureByScreenRect(const Rectangle& screenRect, + const Rectangle& regionRect, + const ScreenCaptureParameters& captureParams) = 0; + +#endif // _WIN32 + +#if defined(__ANDROID__) + /** + * Gets the the Audio device Info + * @return + * - 0: Success. + * - < 0: Failure.. + */ + virtual int getAudioDeviceInfo(DeviceInfo& deviceInfo) = 0; + +#endif // __ANDROID__ + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + + /** Shares the whole or part of a window by specifying the window ID. + * + * @param windowId The ID of the window to be shared. For information on how to + * get the windowId, see the advanced guide *Share Screen*. + * @param regionRect (Optional) The relative location of the region to the + * window. NULL means sharing the whole window. See Rectangle. If the + * specified region overruns the window, the SDK shares only the region within + * it; if you set width or height as 0, the SDK shares the whole window. + * @param captureParams The window sharing encoding parameters. See + * ScreenCaptureParameters. + * + * @return + * - 0: Success. + * - < 0: Failure: + * - ERR_INVALID_ARGUMENT (2): The argument is invalid. + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when try to start screen capture. + */ + virtual int startScreenCaptureByWindowId(view_t windowId, const Rectangle& regionRect, + const ScreenCaptureParameters& captureParams) = 0; + + /** + * Sets the content hint for screen sharing. + * + * A content hint suggests the type of the content being shared, so that the SDK applies different + * optimization algorithm to different types of content. + * + * @param contentHint Sets the content hint for screen sharing: #VIDEO_CONTENT_HINT. + * + * @return + * - 0: Success. + * - < 0: Failure: + * - ERR_NOT_SUPPORTED (4): unable to set screencapture content hint + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when set screen capture content hint. + */ + virtual int setScreenCaptureContentHint(VIDEO_CONTENT_HINT contentHint) = 0; + + /** + * Updates the screen sharing region. + * + * @param regionRect Sets the relative location of the region to the screen or + * window. NULL means sharing the whole screen or window. See Rectangle. + * If the specified region overruns the screen or window, the SDK shares only + * the region within it; if you set width or height as 0, the SDK shares the + * whole screen or window. + * + * @return + * - 0: Success. + * - < 0: Failure: + * - ERR_NOT_SUPPORTED (4): unable to update screen capture region + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when update screen capture regoin. + */ + virtual int updateScreenCaptureRegion(const Rectangle& regionRect) = 0; + + /** + * Updates the screen sharing parameters. + * + * @param captureParams Sets the screen sharing encoding parameters: ScreenCaptureParameters. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_NOT_SUPPORTED (4): unable to update screen capture parameters + * - ERR_INVALID_ARGUMENT (2): The argument is invalid. + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when update screen capture parameters. + */ + virtual int updateScreenCaptureParameters(const ScreenCaptureParameters& captureParams) = 0; +#endif // _WIN32 || (__APPLE__ && !TARGET_OS_IPHONE && TARGET_OS_MAC) + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + /** + * Starts screen sharing. + * + * @param captureParams The configuration of the screen sharing. See {@link + * ScreenCaptureParameters ScreenCaptureParameters}. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startScreenCapture(const ScreenCaptureParameters2& captureParams) = 0; + + /** + * Updates the screen sharing configuration. + * + * @param captureParams The configuration of the screen sharing. See {@link + * ScreenCaptureParameters ScreenCaptureParameters}. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateScreenCapture(const ScreenCaptureParameters2& captureParams) = 0; + + /** + * Queries the ability of screen sharing to support the minimum frame rate. + * + * @since v4.2.0 + * + * @return + * - 0: support 15 fps, Low devices. + * - 1: support 30 fps, Usually low - to mid-range devices. + * - 2: support 60 fps, Advanced devices. + * - < 0: Failure. + */ + virtual int queryScreenCaptureCapability() = 0; +#endif + +#if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) + /** + * Sets the screen sharing scenario. + * + * + * When you start screen sharing or window sharing, you can call this method to set the screen sharing scenario. The SDK adjusts the video quality and experience of the sharing according to the scenario. + * + * + * @param screenScenario The screen sharing scenario. See #SCREEN_SCENARIO_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_NOT_SUPPORTED (4): unable to set screencapture scenario + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_INITIALIZED (7): You have not initialized IRtcEngine when set screencapture scenario. + */ + virtual int setScreenCaptureScenario(SCREEN_SCENARIO_TYPE screenScenario) = 0; + + /** + * Stops the screen sharing. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopScreenCapture() = 0; +#endif // _WIN32 || (__APPLE__ && !TARGET_OS_IPHONE && TARGET_OS_MAC) || __ANDROID__ + + /** + * Gets the current call ID. + * + * When a user joins a channel on a client, a `callId` is generated to identify + * the call. + * + * After a call ends, you can call `rate` or `complain` to gather feedback from the customer. + * These methods require a `callId` parameter. To use these feedback methods, call the this + * method first to retrieve the `callId` during the call, and then pass the value as an + * argument in the `rate` or `complain` method after the call ends. + * + * @param callId The reference to the call ID. + * @return + * - The call ID if the method call is successful. + * - < 0: Failure. + */ + virtual int getCallId(agora::util::AString& callId) = 0; + + /** + * Allows a user to rate the call. + * + * It is usually called after the call ends. + * + * @param callId The call ID retrieved from the \ref getCallId "getCallId" method. + * @param rating The rating of the call between 1 (the lowest score) to 5 (the highest score). + * @param description (Optional) The description of the rating. The string length must be less than + * 800 bytes. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int rate(const char* callId, int rating, + const char* description) = 0; // 0~10 + + /** + * Allows a user to complain about the call quality. + * + * This method is usually called after the call ends. + * + * @param callId The call ID retrieved from the `getCallId` method. + * @param description (Optional) The description of the complaint. The string length must be less than + * 800 bytes. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int complain(const char* callId, const char* description) = 0; + + /** Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.) + + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback. + + * The \ref agora::rtc::IRtcEngine::startRtmpStreamWithoutTranscoding "startRtmpStreamWithoutTranscoding" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN. + * @note + * - Ensure that the user joins the channel before calling this method. + * - This method adds only one stream RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ + virtual int startRtmpStreamWithoutTranscoding(const char* url) = 0; + + /** Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.) + + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback. + + * The \ref agora::rtc::IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN. + * @note + * - Ensure that the user joins the channel before calling this method. + * - This method adds only one stream RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ + virtual int startRtmpStreamWithTranscoding(const char* url, const LiveTranscoding& transcoding) = 0; + + /** Update the video layout and audio settings for CDN live. (CDN live only.) + * @note This method applies to Live Broadcast only. + + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateRtmpTranscoding(const LiveTranscoding& transcoding) = 0; + /** Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.) + + * This method removes the RTMP URL address (added by the \ref IRtcEngine::startRtmpStreamWithoutTranscoding "startRtmpStreamWithoutTranscoding" method + * or IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method) from a CDN live stream. + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamUnpublished "onStreamUnpublished" callback. + + * The \ref agora::rtc::IRtcEngine::stopRtmpStream "stopRtmpStream" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of removing an RTMP stream from the CDN. + * @note + * - This method removes only one RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRtmpStream(const char* url) = 0; + + + virtual int startLocalVideoTranscoder(const LocalTranscoderConfiguration& config) = 0; + virtual int updateLocalTranscoderConfiguration(const LocalTranscoderConfiguration& config) = 0; + virtual int stopLocalVideoTranscoder() = 0; + /** + * Starts video capture with a camera. + * + * @param config The configuration of the video capture with a primary camera. For details, see CameraCaptureConfiguration. + * @param type Source type of camera. See #VIDEO_SOURCE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startCameraCapture(VIDEO_SOURCE_TYPE type, const CameraCapturerConfiguration& config) = 0; + + /** + * Stops capturing video through camera. + * + * You can call this method to stop capturing video through the first camera after calling `startCameraCapture`. + * + * @param type Source type of camera. See #VIDEO_SOURCE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopCameraCapture(VIDEO_SOURCE_TYPE type) = 0; + /** + * Sets the rotation angle of the video captured by the camera. + * + * When the video capture device does not have the gravity sensing function, you can call this method to manually adjust the rotation angle of the captured video. + * + * @param type The video source type. See #VIDEO_SOURCE_TYPE. + * @param orientation The clockwise rotation angle. See #VIDEO_ORIENTATION. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraDeviceOrientation(VIDEO_SOURCE_TYPE type, VIDEO_ORIENTATION orientation) = 0; + /** + * Sets the rotation angle of the video captured by the screen. + * + * When the screen capture device does not have the gravity sensing function, you can call this method to manually adjust the rotation angle of the captured video. + * + * @param type The video source type. See #VIDEO_SOURCE_TYPE. + * @param orientation The clockwise rotation angle. See #VIDEO_ORIENTATION. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setScreenCaptureOrientation(VIDEO_SOURCE_TYPE type, VIDEO_ORIENTATION orientation) = 0; + + /** + * Starts sharing a screen. + * + * @param config The configuration of the captured screen. For details, see ScreenCaptureConfiguration. + * @param type source type of screen. See #VIDEO_SOURCE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startScreenCapture(VIDEO_SOURCE_TYPE type, const ScreenCaptureConfiguration& config) = 0; + + /** + * Stop sharing the screen. + * + * After calling `startScreenCapture`, you can call this method to stop sharing the first screen. + * + * @param type source type of screen. See #VIDEO_SOURCE_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopScreenCapture(VIDEO_SOURCE_TYPE type) = 0; + + /** Gets the current connection state of the SDK. + + @return #CONNECTION_STATE_TYPE. + */ + virtual CONNECTION_STATE_TYPE getConnectionState() = 0; + + // The following APIs are not implemented yet. + virtual bool registerEventHandler(IRtcEngineEventHandler* eventHandler) = 0; + virtual bool unregisterEventHandler(IRtcEngineEventHandler* eventHandler) = 0; + virtual int setRemoteUserPriority(uid_t uid, PRIORITY_TYPE userPriority) = 0; + + /** + * Registers a packet observer. + * + * The Agora Native SDK allows your app to register a packet observer to + * receive events whenever a voice or video packet is transmitting. + * + * @param observer The IPacketObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerPacketObserver(IPacketObserver* observer) = 0; + + /** + * Sets the built-in encryption mode. + * + * @deprecated This method is deprecated. Use enableEncryption(bool enabled, const EncryptionConfig&) instead. + * + * The Agora Native SDK supports built-in encryption. + * Call this API to set the encryption mode. + * + * All users in the same channel must use the same encryption mode and password. + * Refer to information related to the encryption algorithm on the differences + * between encryption modes. + * + * @note + * Call \ref setEncryptionSecret "setEncryptionSecret" to enable the built-in encryption function + * before calling this API. + * @param encryptionMode Encryption mode: + * - "sm4-128-ecb": 128-bit SM4 encryption, ECB mode. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEncryptionMode(const char* encryptionMode) __deprecated = 0; + + /** + * Enables built-in encryption. + * + * @deprecated This method is deprecated. Use enableEncryption(bool enabled, const EncryptionConfig&) instead. + * + * Use this method to specify an encryption password to enable built-in + * encryption before joining a channel. All users in a channel must set the same + * encryption password. The encryption password is automatically cleared once a + * user has left the channel. If the encryption password is not specified or set to + * empty, the encryption function will be disabled. + * + * @param secret The encryption password. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEncryptionSecret(const char* secret) __deprecated = 0; + + /** Enables/Disables the built-in encryption. + * + * In scenarios requiring high security, Agora recommends calling this method to enable the built-in encryption before joining a channel. + * + * All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + * + * @note + * - If you enable the built-in encryption, you cannot use the RTMP streaming function. + * + * @param enabled Whether to enable the built-in encryption: + * - true: Enable the built-in encryption. + * - false: Disable the built-in encryption. + * @param config Configurations of built-in encryption schemas. See EncryptionConfig. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT): An invalid parameter is used. Set the parameter with a valid value. + * - -4(ERR_NOT_SUPPORTED): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. + * - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int enableEncryption(bool enabled, const EncryptionConfig& config) = 0; + + /** Creates a data stream. + * + * You can call this method to create a data stream and improve the + * reliability and ordering of data tranmission. + * + * @note + * - Ensure that you set the same value for `reliable` and `ordered`. + * - Each user can only create a maximum of 5 data streams during a RtcEngine + * lifecycle. + * - The data channel allows a data delay of up to 5 seconds. If the receiver + * does not receive the data stream within 5 seconds, the data channel reports + * an error. + * + * @param[out] streamId The ID of the stream data. + * @param reliable Sets whether the recipients are guaranteed to receive + * the data stream from the sender within five seconds: + * - true: The recipients receive the data stream from the sender within + * five seconds. If the recipient does not receive the data stream within + * five seconds, an error is reported to the application. + * - false: There is no guarantee that the recipients receive the data stream + * within five seconds and no error message is reported for any delay or + * missing data stream. + * @param ordered Sets whether the recipients receive the data stream + * in the sent order: + * - true: The recipients receive the data stream in the sent order. + * - false: The recipients do not receive the data stream in the sent order. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int createDataStream(int* streamId, bool reliable, bool ordered) = 0; + + /** Creates a data stream. + * + * Each user can create up to five data streams during the lifecycle of the IChannel. + * @param streamId The ID of the created data stream. + * @param config The config of data stream. + * @return int + * - Returns 0: Success. + * - < 0: Failure. + */ + virtual int createDataStream(int* streamId, DataStreamConfig& config) = 0; + + /** Sends a data stream. + * + * After calling \ref IRtcEngine::createDataStream "createDataStream", you can call + * this method to send a data stream to all users in the channel. + * + * The SDK has the following restrictions on this method: + * - Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB. + * - Each client can send up to 30 KB of data per second. + * - Each user can have up to five data streams simultaneously. + * + * After the remote user receives the data stream within 5 seconds, the SDK triggers the + * \ref IRtcEngineEventHandler::onStreamMessage "onStreamMessage" callback on + * the remote client. After the remote user does not receive the data stream within 5 seconds, + * the SDK triggers the \ref IRtcEngineEventHandler::onStreamMessageError "onStreamMessageError" + * callback on the remote client. + * + * @note + * - Call this method after calling \ref IRtcEngine::createDataStream "createDataStream". + * - This method applies only to the `COMMUNICATION` profile or to + * the hosts in the `LIVE_BROADCASTING` profile. If an audience in the + * `LIVE_BROADCASTING` profile calls this method, the audience may be switched to a host. + * + * @param streamId The ID of the stream data. + * @param data The data stream. + * @param length The length (byte) of the data stream. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendStreamMessage(int streamId, const char* data, size_t length) = 0; + + /** **DEPRECATED** Adds a watermark image to the local video or CDN live stream. + + This method is not recommend, Use \ref agora::rtc::IRtcEngine::addVideoWatermark(const char* watermarkUrl, const WatermarkOptions& options) "addVideoWatermark"2 instead. + + This method adds a PNG watermark image to the local video stream for the recording device, channel audience, and CDN live audience to view and capture. + + To add the PNG file to the CDN live publishing stream, see the \ref IRtcEngine::setLiveTranscoding "setLiveTranscoding" method. + + @param watermark Pointer to the watermark image to be added to the local video stream. See RtcImage. + + @note + - The URL descriptions are different for the local video and CDN live streams: + - In a local video stream, `url` in RtcImage refers to the absolute path of the added watermark image file in the local video stream. + - In a CDN live stream, `url` in RtcImage refers to the URL address of the added watermark image in the CDN live broadcast. + - The source file of the watermark image must be in the PNG file format. If the width and height of the PNG file differ from your settings in this method, the PNG file will be cropped to conform to your settings. + - The Agora SDK supports adding only one watermark image onto a local video or CDN live stream. The newly added watermark image replaces the previous one. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int addVideoWatermark(const RtcImage& watermark) = 0; + + /** Adds a watermark image to the local video. + + This method adds a PNG watermark image to the local video in a live broadcast. Once the watermark image is added, all the audience in the channel (CDN audience included), + and the recording device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one. + + The watermark position depends on the settings in the \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration" method: + - If the orientation mode of the encoding video is #ORIENTATION_MODE_FIXED_LANDSCAPE, or the landscape mode in #ORIENTATION_MODE_ADAPTIVE, the watermark uses the landscape orientation. + - If the orientation mode of the encoding video is #ORIENTATION_MODE_FIXED_PORTRAIT, or the portrait mode in #ORIENTATION_MODE_ADAPTIVE, the watermark uses the portrait orientation. + - When setting the watermark position, the region must be less than the dimensions set in the `setVideoEncoderConfiguration` method. Otherwise, the watermark image will be cropped. + + @note + - Ensure that you have called the \ref agora::rtc::IRtcEngine::enableVideo "enableVideo" method to enable the video module before calling this method. + - If you only want to add a watermark image to the local video for the audience in the CDN live broadcast channel to see and capture, you can call this method or the \ref agora::rtc::IRtcEngine::setLiveTranscoding "setLiveTranscoding" method. + - This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray. + - If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings. + - If you have enabled the local video preview by calling the \ref agora::rtc::IRtcEngine::startPreview "startPreview" method, you can use the `visibleInPreview` member in the WatermarkOptions class to set whether or not the watermark is visible in preview. + - If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. + + @param watermarkUrl The local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path. + @param options Pointer to the watermark's options to be added. See WatermarkOptions for more infomation. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int addVideoWatermark(const char* watermarkUrl, const WatermarkOptions& options) = 0; + + /** Removes the watermark image on the video stream added by + addVideoWatermark(). + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int clearVideoWatermarks() = 0; + + // The following APIs are either deprecated and going to deleted. + + /** @deprecated Use disableAudio() instead. + + Disables the audio function in the channel. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int pauseAudio() __deprecated = 0; + /** @deprecated Use enableAudio() instead. + + Resumes the audio function in the channel. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int resumeAudio() __deprecated = 0; + + /** + * Enables interoperability with the Agora Web SDK (Live Broadcast only). + * + * @deprecated The Agora NG SDK enables the interoperablity with the Web SDK. + * + * Use this method when the channel profile is Live Broadcast. Interoperability + * with the Agora Web SDK is enabled by default when the channel profile is + * Communication. + * + * @param enabled Determines whether to enable interoperability with the Agora Web SDK. + * - true: (Default) Enable interoperability with the Agora Native SDK. + * - false: Disable interoperability with the Agora Native SDK. + * + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableWebSdkInteroperability(bool enabled) __deprecated = 0; + + /** Agora supports reporting and analyzing customized messages. + * + * This function is in the beta stage with a free trial. The ability provided + * in its beta test version is reporting a maximum of 10 message pieces within + * 6 seconds, with each message piece not exceeding 256 bytes. + * + * To try out this function, contact [support@agora.io](mailto:support@agora.io) + * and discuss the format of customized messages with us. + */ + virtual int sendCustomReportMessage( + const char* id, const char* category, const char* event, const char* label, int value) = 0; + + /** Registers the metadata observer. + + You need to implement the IMetadataObserver class and specify the metadata type + in this method. This method enables you to add synchronized metadata in the video + stream for more diversified live interactive streaming, such as sending + shopping links, digital coupons, and online quizzes. + + A successful call of this method triggers + the \ref agora::rtc::IMetadataObserver::getMaxMetadataSize "getMaxMetadataSize" callback. + + @note + - Call this method before the `joinChannel` method. + - This method applies to the `LIVE_BROADCASTING` channel profile. + + @param observer IMetadataObserver. + @param type The metadata type. See \ref IMetadataObserver::METADATA_TYPE "METADATA_TYPE". The SDK supports VIDEO_METADATA (0) only for now. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int registerMediaMetadataObserver(IMetadataObserver *observer, IMetadataObserver::METADATA_TYPE type) = 0; + + /** Unregisters the metadata observer. + @param observer IMetadataObserver. + @param type The metadata type. See \ref IMetadataObserver::METADATA_TYPE "METADATA_TYPE". The SDK supports VIDEO_METADATA (0) only for now. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int unregisterMediaMetadataObserver(IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) = 0; + + /** Start audio frame dump. + + Optional `location` is: "pre_apm_proc", "apm", "pre_send_proc", "filter", "enc", "tx_mixer", + "at_record", "atw_record" for audio sending. + "dec", "mixed", "play", "rx_mixer", "playback_mixer", "pcm_source_playback_mixer", + "pre_play_proc", "at_playout", "atw_playout" for audio receiving. + + */ + + virtual int startAudioFrameDump(const char* channel_id, uid_t user_id, const char* location, + const char* uuid, const char* passwd, long duration_ms, bool auto_upload) = 0; + /** + * Stops the audio frame dump. + */ + virtual int stopAudioFrameDump(const char* channel_id, uid_t user_id, const char* location) = 0; + + /** Registers a user account. + * + * Once registered, the user account can be used to identify the local user when the user joins the channel. + * After the user successfully registers a user account, the SDK triggers the \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" callback on the local client, + * reporting the user ID and user account of the local user. + * + * To join a channel with a user account, you can choose either of the following: + * + * - Call the \ref agora::rtc::IRtcEngine::registerLocalUserAccount "registerLocalUserAccount" method to create a user account, and then the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method to join the channel. + * - Call the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method to join the channel. + * + * The difference between the two is that for the former, the time elapsed between calling the \ref agora::rtc::IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method + * and joining the channel is shorter than the latter. + * + * @note + * - Ensure that you set the `userAccount` parameter. Otherwise, this method does not take effect. + * - Ensure that the value of the `userAccount` parameter is unique in the channel. + * - To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param appId The App ID of your project. + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerLocalUserAccount(const char* appId, const char* userAccount) = 0; + + /** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int joinChannelWithUserAccount(const char* token, const char* channelId, + const char* userAccount) = 0; + + /** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param options The channel media options: \ref agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions" + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int joinChannelWithUserAccount(const char* token, const char* channelId, + const char* userAccount, const ChannelMediaOptions& options) = 0; + + /** Joins the channel with a user account. + * + * After the user successfully joins the channel, the SDK triggers the following callbacks: + * + * - The local client: \ref agora::rtc::IRtcEngineEventHandler::onLocalUserRegistered "onLocalUserRegistered" and \ref agora::rtc::IRtcEngineEventHandler::onJoinChannelSuccess "onJoinChannelSuccess" . + * - The remote client: \ref agora::rtc::IRtcEngineEventHandler::onUserJoined "onUserJoined" and \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" , if the user joining the channel is in the `COMMUNICATION` profile, or is a host in the `LIVE_BROADCASTING` profile. + * + * @note To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a user ID, then ensure all the other users use the user ID too. The same applies to the user account. + * If a user joins the channel with the Agora Web SDK, ensure that the uid of the user is set to the same parameter type. + * + * @param token The token generated at your server: + * - For low-security requirements: You can use the temporary token generated at Console. For details, see [Get a temporary toke](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-temporary-token). + * - For high-security requirements: Set it as the token generated at your server. For details, see [Get a token](https://docs.agora.io/en/Voice/token?platform=All%20Platforms#get-a-token). + * @param channelId The channel name. The maximum length of this parameter is 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param userAccount The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + * @param options The channel media options: \ref agora::rtc::ChannelMediaOptions::ChannelMediaOptions "ChannelMediaOptions" + * @param eventHandler The pointer to the IRtcEngine event handler: IRtcEngineEventHandler. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int joinChannelWithUserAccountEx(const char* token, const char* channelId, + const char* userAccount, const ChannelMediaOptions& options, + IRtcEngineEventHandler* eventHandler) = 0; + + /** Gets the user information by passing in the user account. + * + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, caches them + * in a mapping table object (`userInfo`), and triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback on the local client. + * + * After receiving the o\ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback, you can call this method to get the user ID of the + * remote user from the `userInfo` object by passing in the user account. + * + * @param userAccount The user account of the user. Ensure that you set this parameter. + * @param [in,out] userInfo A userInfo object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUserAccount(const char* userAccount, rtc::UserInfo* userInfo) = 0; + + /** Gets the user information by passing in the user ID. + * + * After a remote user joins the channel, the SDK gets the user ID and user account of the remote user, + * caches them in a mapping table object (`userInfo`), and triggers the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback on the local client. + * + * After receiving the \ref agora::rtc::IRtcEngineEventHandler::onUserInfoUpdated "onUserInfoUpdated" callback, you can call this method to get the user account of the remote user + * from the `userInfo` object by passing in the user ID. + * + * @param uid The user ID of the remote user. Ensure that you set this parameter. + * @param[in,out] userInfo A userInfo object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUid(uid_t uid, rtc::UserInfo* userInfo) = 0; + /** Starts to relay media streams across channels. + * + * After a successful method call, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" and + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayEvent + * "onChannelMediaRelayEvent" callbacks, and these callbacks return the + * state and events of the media stream relay. + * - If the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback returns + * #RELAY_STATE_RUNNING (2) and #RELAY_OK (0), and the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayEvent + * "onChannelMediaRelayEvent" callback returns + * #RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL (4), the host starts + * sending data to the destination channel. + * - If the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback returns + * #RELAY_STATE_FAILURE (3), an exception occurs during the media stream + * relay. + * + * @note + * - Call this method after the \ref joinChannel() "joinChannel" method. + * - This method takes effect only when you are a host in a + * `LIVE_BROADCASTING` channel. + * - After a successful method call, if you want to call this method + * again, ensure that you call the + * \ref stopChannelMediaRelay() "stopChannelMediaRelay" method to quit the + * current relay. + * - Contact sales-us@agora.io before implementing this function. + * - We do not support string user accounts in this API. + * + * @param configuration The configuration of the media stream relay: + * ChannelMediaRelayConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) = 0; + + /** Updates the channels for media stream relay. After a successful + * \ref startChannelMediaRelay() "startChannelMediaRelay" method call, if + * you want to relay the media stream to more channels, or leave the + * current relay channel, you can call the + * \ref updateChannelMediaRelay() "updateChannelMediaRelay" method. + * + * After a successful method call, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayEvent + * "onChannelMediaRelayEvent" callback with the + * #RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL (7) state code. + * + * @note + * Call this method after the + * \ref startChannelMediaRelay() "startChannelMediaRelay" method to update + * the destination channel. + * + * @param configuration The media stream relay configuration: + * ChannelMediaRelayConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) = 0; + + /** Stops the media stream relay. + * + * Once the relay stops, the host quits all the destination + * channels. + * + * After a successful method call, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback. If the callback returns + * #RELAY_STATE_IDLE (0) and #RELAY_OK (0), the host successfully + * stops the relay. + * + * @note + * If the method call fails, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback with the + * #RELAY_ERROR_SERVER_NO_RESPONSE (2) or + * #RELAY_ERROR_SERVER_CONNECTION_LOST (8) state code. You can leave the + * channel by calling the \ref leaveChannel() "leaveChannel" method, and + * the media stream relay automatically stops. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopChannelMediaRelay() = 0; + + + /** pause the channels for media stream relay. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pauseAllChannelMediaRelay() = 0; + + /** resume the channels for media stream relay. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resumeAllChannelMediaRelay() = 0; + + /** Set audio parameters for direct streaming to CDN + * + * @note + * Must call this api before "startDirectCdnStreaming" + * + * @param profile Sets the sample rate, bitrate, encoding mode, and the number of channels: + * #AUDIO_PROFILE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDirectCdnStreamingAudioConfiguration(AUDIO_PROFILE_TYPE profile) = 0; + + /** Set video parameters for direct streaming to CDN + * + * Each configuration profile corresponds to a set of video parameters, including + * the resolution, frame rate, and bitrate. + * + * @note + * Must call this api before "startDirectCdnStreaming" + * + * @param config The local video encoder configuration: VideoEncoderConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDirectCdnStreamingVideoConfiguration(const VideoEncoderConfiguration& config) = 0; + + /** Start direct cdn streaming + * + * @param eventHandler A pointer to the direct cdn streaming event handler: \ref agora::rtc::IDirectCdnStreamingEventHandler + * "IDirectCdnStreamingEventHandler". + * @param publishUrl The url of the cdn used to publish the stream. + * @param options The direct cdn streaming media options: DirectCdnStreamingMediaOptions. + * This API must pass an audio-related option, and temporarily cannot pass more than one. + * Video-related options may not be passed, or one, but not multiple. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startDirectCdnStreaming(IDirectCdnStreamingEventHandler* eventHandler, + const char* publishUrl, const DirectCdnStreamingMediaOptions& options) = 0; + + /** Stop direct cdn streaming + * + * @note + * This method is synchronous. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopDirectCdnStreaming() = 0; + + /** Change the media source during the pushing + * + * @note + * This method is temporarily not supported. + * + * @param options The direct cdn streaming media options: DirectCdnStreamingMediaOptions. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateDirectCdnStreamingMediaOptions(const DirectCdnStreamingMediaOptions& options) = 0; + + /** Enables the rhythm player. + * + * @param sound1 The absolute path or URL address (including the filename extensions) of the file for the downbeat. + * @param sound2 The absolute path or URL address (including the filename extensions) of the file for the upbeats. + * @param config The configuration of rhythm player. + * + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRhythmPlayer(const char* sound1, const char* sound2, const AgoraRhythmPlayerConfig& config) = 0; + + /** Disables the rhythm player. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRhythmPlayer() = 0; + + /** Configures the rhythm player. + * + * @param config The configuration of rhythm player. + * + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int configRhythmPlayer(const AgoraRhythmPlayerConfig& config) = 0; + /** + * Takes a snapshot of a video stream. + * + * This method takes a snapshot of a video stream from the specified user, generates a JPG + * image, and saves it to the specified path. + * + * The method is asynchronous, and the SDK has not taken the snapshot when the method call + * returns. After a successful method call, the SDK triggers the `onSnapshotTaken` callback + * to report whether the snapshot is successfully taken, as well as the details for that + * snapshot. + * + * @note + * - Call this method after joining a channel. + * - This method takes a snapshot of the published video stream specified in `ChannelMediaOptions`. + * - If the user's video has been preprocessed, for example, watermarked or beautified, the resulting + * snapshot includes the pre-processing effect. + * + * @param uid The user ID. Set uid as 0 if you want to take a snapshot of the local user's video. + * @param filePath The local path (including filename extensions) of the snapshot. For example: + * - Windows: `C:\Users\\AppData\Local\Agora\\example.jpg` + * - iOS: `/App Sandbox/Library/Caches/example.jpg` + * - macOS: `~/Library/Logs/example.jpg` + * - Android: `/storage/emulated/0/Android/data//files/example.jpg` + * + * Ensure that the path you specify exists and is writable. + * @return + * - 0 : Success. + * - < 0 : Failure. + */ + virtual int takeSnapshot(uid_t uid, const char* filePath) = 0; + /** Enables the content inspect. + @param enabled Whether to enable content inspect: + - `true`: Yes. + - `false`: No. + @param config The configuration for the content inspection. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableContentInspect(bool enabled, const media::ContentInspectConfig &config) = 0; + /* + * Adjust the custom audio publish volume by track id. + * @param trackId custom audio track id. + * @param volume The volume, range is [0,100]: + * 0: mute, 100: The original volume + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustCustomAudioPublishVolume(track_id_t trackId, int volume) = 0; + + /* + * Adjust the custom audio playout volume by track id. + * @param trackId custom audio track id. + * @param volume The volume, range is [0,100]: + * 0: mute, 100: The original volume + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustCustomAudioPlayoutVolume(track_id_t trackId, int volume) = 0; + + /** Sets the Agora cloud proxy service. + * + * @since v3.3.0 + * + * When the user's firewall restricts the IP address and port, refer to *Use Cloud Proxy* to add the specific + * IP addresses and ports to the firewall allowlist; then, call this method to enable the cloud proxy and set + * the `proxyType` parameter as `UDP_PROXY(1)`, which is the cloud proxy for the UDP protocol. + * + * After a successfully cloud proxy connection, the SDK triggers + * the \ref IRtcEngineEventHandler::onConnectionStateChanged "onConnectionStateChanged" (CONNECTION_STATE_CONNECTING, CONNECTION_CHANGED_SETTING_PROXY_SERVER) callback. + * + * To disable the cloud proxy that has been set, call `setCloudProxy(NONE_PROXY)`. To change the cloud proxy type that has been set, + * call `setCloudProxy(NONE_PROXY)` first, and then call `setCloudProxy`, and pass the value that you expect in `proxyType`. + * + * @note + * - Agora recommends that you call this method before joining the channel or after leaving the channel. + * - For the SDK v3.3.x, the services for pushing streams to CDN and co-hosting across channels are not available + * when you use the cloud proxy for the UDP protocol. For the SDK v3.4.0 and later, the services for pushing streams + * to CDN and co-hosting across channels are not available when the user is in a network environment with a firewall + * and uses the cloud proxy for the UDP protocol. + * + * @param proxyType The cloud proxy type, see #CLOUD_PROXY_TYPE. This parameter is required, and the SDK reports an error if you do not pass in a value. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - `-2(ERR_INVALID_ARGUMENT)`: The parameter is invalid. + * - `-7(ERR_NOT_INITIALIZED)`: The SDK is not initialized. + */ + virtual int setCloudProxy(CLOUD_PROXY_TYPE proxyType) = 0; + /** set local access point addresses in local proxy mode. use this method before join channel. + + @param config The LocalAccessPointConfiguration class, See the definition of LocalAccessPointConfiguration for details. + + @return + - 0: Success + - < 0: Failure + */ + virtual int setLocalAccessPoint(const LocalAccessPointConfiguration& config) = 0; + + /** set advanced audio options. + @param options The AdvancedAudioOptions class, See the definition of AdvancedAudioOptions for details. + + @return + - 0: Success + - < 0: Failure + */ + virtual int setAdvancedAudioOptions(AdvancedAudioOptions &options, int sourceType = 0) = 0; + + /** Bind local user and a remote user as an audio&video sync group. The remote user is defined by cid and uid. + * There’s a usage limit that local user must be a video stream sender. On the receiver side, media streams from same sync group will be time-synced + * + * @param channelId The channel id + * @param uid The user ID of the remote user to be bound with (local user) + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAVSyncSource(const char* channelId, uid_t uid) = 0; + + /** + * @brief enable or disable video image source to replace the current video source published or resume it + * + * @param enable true for enable, false for disable + * @param options options for image track + */ + virtual int enableVideoImageSource(bool enable, const ImageTrackOptions& options) = 0; + + /* + * Get monotonic time in ms which can be used by capture time, + * typical scenario is as follows: + * + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * | // custom audio/video base capture time, e.g. the first audio/video capture time. | + * | int64_t custom_capture_time_base; | + * | | + * | int64_t agora_monotonic_time = getCurrentMonotonicTimeInMs(); | + * | | + * | // offset is fixed once calculated in the begining. | + * | const int64_t offset = agora_monotonic_time - custom_capture_time_base; | + * | | + * | // realtime_custom_audio/video_capture_time is the origin capture time that customer provided.| + * | // actual_audio/video_capture_time is the actual capture time transfered to sdk. | + * | int64_t actual_audio_capture_time = realtime_custom_audio_capture_time + offset; | + * | int64_t actual_video_capture_time = realtime_custom_video_capture_time + offset; | + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * + * @return + * - >= 0: Success. + * - < 0: Failure. + */ + virtual int64_t getCurrentMonotonicTimeInMs() = 0; + + /** + * Turns WIFI acceleration on or off. + * + * @note + * - This method is called before and after joining a channel. + * - Users check the WIFI router app for information about acceleration. Therefore, if this interface is invoked, the caller accepts that the caller's name will be displayed to the user in the WIFI router application on behalf of the caller. + * + * @param enabled + * - true:Turn WIFI acceleration on. + * - false:Turn WIFI acceleration off. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableWirelessAccelerate(bool enabled) = 0; + + /** + * get network type value + * + * @return + * - 0: DISCONNECTED. + * - 1: LAN. + * - 2: WIFI. + * - 3: MOBILE_2G. + * - 4: MOBILE_3G. + * - 5: MOBILE_4G. + * - 6: MOBILE_5G. + * - -1: UNKNOWN. + */ + + virtual int getNetworkType() = 0; + + /** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + + @param parameters Pointer to the set parameters in a JSON string. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setParameters(const char* parameters) = 0; + + /** + @brief Start tracing media rendering events. + @since v4.1.1 + @discussion + - SDK will trace media rendering events when this API is called. + - The tracing result can be obtained through callback `IRtcEngineEventHandler::onVideoRenderingTracingResult` + @note + - By default, SDK will trace media rendering events when `IRtcEngine::joinChannel` is called. + - The start point of event tracing will be reset after leaving channel. + @return + - 0: Success. + - < 0: Failure. + - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int startMediaRenderingTracing() = 0; + + /** + @brief Enable instant media rendering. + @since v4.1.1 + @discussion + - This method enable SDK to render video or playout audio faster. + @note + - Once enable this mode, we should destroy rtc engine to disable it. + - Enable this mode, will sacrifice some part of experience. + @return + - 0: Success. + - < 0: Failure. + - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int enableInstantMediaRendering() = 0; + + /** + * Return current NTP(unix timestamp) time in milliseconds. + */ + virtual uint64_t getNtpWallTimeInMs() = 0; + + /** + * @brief Whether the device support target feautre. + * @since v4.1.0 + * @param type The feature type. See FeatureType. + * @return + * - true: support. + * - false: not support. + */ + virtual bool isFeatureAvailableOnDevice(FeatureType type) = 0; + + /** + * @technical preview + */ + virtual int sendAudioMetadata(const char* metadata, size_t length) = 0; +}; + +class AAudioDeviceManager : public agora::util::AutoPtr { + public: + AAudioDeviceManager(IRtcEngine* engine) { + queryInterface(engine, AGORA_IID_AUDIO_DEVICE_MANAGER); + } +}; + +class AVideoDeviceManager : public agora::util::AutoPtr { + public: + AVideoDeviceManager(IRtcEngine* engine) { + queryInterface(engine, AGORA_IID_VIDEO_DEVICE_MANAGER); + } +}; + +// The following types are either deprecated or not implmented yet. +enum QUALITY_REPORT_FORMAT_TYPE { + /** 0: The quality report in JSON format, + */ + QUALITY_REPORT_JSON = 0, + /** 1: The quality report in HTML format. + */ + QUALITY_REPORT_HTML = 1, +}; + +/** Media device states. */ +enum MEDIA_DEVICE_STATE_TYPE { + /** 0: The device is ready for use. + */ + MEDIA_DEVICE_STATE_IDLE = 0, + /** 1: The device is active. + */ + MEDIA_DEVICE_STATE_ACTIVE = 1, + /** 2: The device is disabled. + */ + MEDIA_DEVICE_STATE_DISABLED = 2, + /** 4: The device is not present. + */ + MEDIA_DEVICE_STATE_NOT_PRESENT = 4, + /** 8: The device is unplugged. + */ + MEDIA_DEVICE_STATE_UNPLUGGED = 8 +}; + +enum VIDEO_PROFILE_TYPE { + /** 0: 160 x 120 @ 15 fps */ // res fps + VIDEO_PROFILE_LANDSCAPE_120P = 0, // 160x120 15 + /** 2: 120 x 120 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_120P_3 = 2, // 120x120 15 + /** 10: 320 x 180 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_180P = 10, // 320x180 15 + /** 12: 180 x 180 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_180P_3 = 12, // 180x180 15 + /** 13: 240 x 180 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_180P_4 = 13, // 240x180 15 + /** 20: 320 x 240 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_240P = 20, // 320x240 15 + /** 22: 240 x 240 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_240P_3 = 22, // 240x240 15 + /** 23: 424 x 240 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_240P_4 = 23, // 424x240 15 + /** 30: 640 x 360 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_360P = 30, // 640x360 15 + /** 32: 360 x 360 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_3 = 32, // 360x360 15 + /** 33: 640 x 360 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_4 = 33, // 640x360 30 + /** 35: 360 x 360 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_6 = 35, // 360x360 30 + /** 36: 480 x 360 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_7 = 36, // 480x360 15 + /** 37: 480 x 360 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_8 = 37, // 480x360 30 + /** 38: 640 x 360 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_9 = 38, // 640x360 15 + /** 39: 640 x 360 @ 24 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_10 = 39, // 640x360 24 + /** 100: 640 x 360 @ 24 fps */ + VIDEO_PROFILE_LANDSCAPE_360P_11 = 100, // 640x360 24 + /** 40: 640 x 480 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_480P = 40, // 640x480 15 + /** 42: 480 x 480 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_3 = 42, // 480x480 15 + /** 43: 640 x 480 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_4 = 43, // 640x480 30 + /** 45: 480 x 480 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_6 = 45, // 480x480 30 + /** 47: 848 x 480 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_8 = 47, // 848x480 15 + /** 48: 848 x 480 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_9 = 48, // 848x480 30 + /** 49: 640 x 480 @ 10 fps */ + VIDEO_PROFILE_LANDSCAPE_480P_10 = 49, // 640x480 10 + /** 50: 1280 x 720 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_720P = 50, // 1280x720 15 + /** 52: 1280 x 720 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_720P_3 = 52, // 1280x720 30 + /** 54: 960 x 720 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_720P_5 = 54, // 960x720 15 + /** 55: 960 x 720 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_720P_6 = 55, // 960x720 30 + /** 60: 1920 x 1080 @ 15 fps */ + VIDEO_PROFILE_LANDSCAPE_1080P = 60, // 1920x1080 15 + /** 62: 1920 x 1080 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_1080P_3 = 62, // 1920x1080 30 + /** 64: 1920 x 1080 @ 60 fps */ + VIDEO_PROFILE_LANDSCAPE_1080P_5 = 64, // 1920x1080 60 + /** 66: 2560 x 1440 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_1440P = 66, // 2560x1440 30 + /** 67: 2560 x 1440 @ 60 fps */ + VIDEO_PROFILE_LANDSCAPE_1440P_2 = 67, // 2560x1440 60 + /** 70: 3840 x 2160 @ 30 fps */ + VIDEO_PROFILE_LANDSCAPE_4K = 70, // 3840x2160 30 + /** 72: 3840 x 2160 @ 60 fps */ + VIDEO_PROFILE_LANDSCAPE_4K_3 = 72, // 3840x2160 60 + /** 1000: 120 x 160 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_120P = 1000, // 120x160 15 + /** 1002: 120 x 120 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_120P_3 = 1002, // 120x120 15 + /** 1010: 180 x 320 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_180P = 1010, // 180x320 15 + /** 1012: 180 x 180 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_180P_3 = 1012, // 180x180 15 + /** 1013: 180 x 240 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_180P_4 = 1013, // 180x240 15 + /** 1020: 240 x 320 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_240P = 1020, // 240x320 15 + /** 1022: 240 x 240 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_240P_3 = 1022, // 240x240 15 + /** 1023: 240 x 424 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_240P_4 = 1023, // 240x424 15 + /** 1030: 360 x 640 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_360P = 1030, // 360x640 15 + /** 1032: 360 x 360 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_360P_3 = 1032, // 360x360 15 + /** 1033: 360 x 640 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_360P_4 = 1033, // 360x640 30 + /** 1035: 360 x 360 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_360P_6 = 1035, // 360x360 30 + /** 1036: 360 x 480 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_360P_7 = 1036, // 360x480 15 + /** 1037: 360 x 480 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_360P_8 = 1037, // 360x480 30 + /** 1038: 360 x 640 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_360P_9 = 1038, // 360x640 15 + /** 1039: 360 x 640 @ 24 fps */ + VIDEO_PROFILE_PORTRAIT_360P_10 = 1039, // 360x640 24 + /** 1100: 360 x 640 @ 24 fps */ + VIDEO_PROFILE_PORTRAIT_360P_11 = 1100, // 360x640 24 + /** 1040: 480 x 640 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_480P = 1040, // 480x640 15 + /** 1042: 480 x 480 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_480P_3 = 1042, // 480x480 15 + /** 1043: 480 x 640 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_480P_4 = 1043, // 480x640 30 + /** 1045: 480 x 480 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_480P_6 = 1045, // 480x480 30 + /** 1047: 480 x 848 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_480P_8 = 1047, // 480x848 15 + /** 1048: 480 x 848 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_480P_9 = 1048, // 480x848 30 + /** 1049: 480 x 640 @ 10 fps */ + VIDEO_PROFILE_PORTRAIT_480P_10 = 1049, // 480x640 10 + /** 1050: 720 x 1280 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_720P = 1050, // 720x1280 15 + /** 1052: 720 x 1280 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_720P_3 = 1052, // 720x1280 30 + /** 1054: 720 x 960 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_720P_5 = 1054, // 720x960 15 + /** 1055: 720 x 960 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_720P_6 = 1055, // 720x960 30 + /** 1060: 1080 x 1920 @ 15 fps */ + VIDEO_PROFILE_PORTRAIT_1080P = 1060, // 1080x1920 15 + /** 1062: 1080 x 1920 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_1080P_3 = 1062, // 1080x1920 30 + /** 1064: 1080 x 1920 @ 60 fps */ + VIDEO_PROFILE_PORTRAIT_1080P_5 = 1064, // 1080x1920 60 + /** 1066: 1440 x 2560 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_1440P = 1066, // 1440x2560 30 + /** 1067: 1440 x 2560 @ 60 fps */ + VIDEO_PROFILE_PORTRAIT_1440P_2 = 1067, // 1440x2560 60 + /** 1070: 2160 x 3840 @ 30 fps */ + VIDEO_PROFILE_PORTRAIT_4K = 1070, // 2160x3840 30 + /** 1072: 2160 x 3840 @ 60 fps */ + VIDEO_PROFILE_PORTRAIT_4K_3 = 1072, // 2160x3840 60 + /** Default 640 x 360 @ 15 fps */ + VIDEO_PROFILE_DEFAULT = VIDEO_PROFILE_LANDSCAPE_360P, +}; + +} // namespace rtc +} // namespace agora + +/** Gets the SDK version number. + +@param build Build number of Agora the SDK. +* @return String of the SDK version. +*/ +#define getAgoraRtcEngineVersion getAgoraSdkVersion + +//////////////////////////////////////////////////////// +/** \addtogroup createAgoraRtcEngine + @{ + */ +//////////////////////////////////////////////////////// + +/** Creates the RTC engine object and returns the pointer. + +* @return Pointer of the RTC engine object. +*/ +AGORA_API agora::rtc::IRtcEngine* AGORA_CALL createAgoraRtcEngine(); + +//////////////////////////////////////////////////////// +/** @} */ +//////////////////////////////////////////////////////// + +/** Creates the RTC engine object and returns the pointer. + + @param err Error Code. +* @return Description of the Error Code: agora::ERROR_CODE_TYPE +*/ +#define getAgoraRtcEngineErrorDescription getAgoraSdkErrorDescription +#define setAgoraRtcEngineExternalSymbolLoader setAgoraSdkExternalSymbolLoader diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtcEngineEx.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtcEngineEx.h new file mode 100644 index 0000000..555239d --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtcEngineEx.h @@ -0,0 +1,1976 @@ +// +// Agora Media SDK +// +// Created by Sting Feng in 2015-05. +// Updated by Tommy Miao in 2020-11. +// Copyright (c) 2015 Agora IO. All rights reserved. +// +#pragma once + +#include "IAgoraRtcEngine.h" + +namespace agora { +namespace rtc { + +// OPTIONAL_ENUM_CLASS RTC_EVENT; + +/** + * Rtc Connection. + */ +struct RtcConnection { + /** + * The unique channel name for the AgoraRTC session in the string format. The string + * length must be less than 64 bytes. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", + * ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",". + */ + const char* channelId; + /** + * User ID: A 32-bit unsigned integer ranging from 1 to (2^32-1). It must be unique. + */ + uid_t localUid; + + RtcConnection() : channelId(NULL), localUid(0) {} + RtcConnection(const char* channel_id, uid_t local_uid) + : channelId(channel_id), localUid(local_uid) {} +}; + +class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { + public: + using IRtcEngineEventHandler::eventHandlerType; + using IRtcEngineEventHandler::onJoinChannelSuccess; + using IRtcEngineEventHandler::onRejoinChannelSuccess; + using IRtcEngineEventHandler::onAudioQuality; + using IRtcEngineEventHandler::onAudioVolumeIndication; + using IRtcEngineEventHandler::onLeaveChannel; + using IRtcEngineEventHandler::onRtcStats; + using IRtcEngineEventHandler::onNetworkQuality; + using IRtcEngineEventHandler::onIntraRequestReceived; + using IRtcEngineEventHandler::onFirstLocalVideoFrame; + using IRtcEngineEventHandler::onFirstLocalVideoFramePublished; + using IRtcEngineEventHandler::onFirstRemoteVideoDecoded; + using IRtcEngineEventHandler::onVideoSizeChanged; + using IRtcEngineEventHandler::onLocalVideoStateChanged; + using IRtcEngineEventHandler::onRemoteVideoStateChanged; + using IRtcEngineEventHandler::onFirstRemoteVideoFrame; + using IRtcEngineEventHandler::onUserJoined; + using IRtcEngineEventHandler::onUserOffline; + using IRtcEngineEventHandler::onUserMuteAudio; + using IRtcEngineEventHandler::onUserMuteVideo; + using IRtcEngineEventHandler::onUserEnableVideo; + using IRtcEngineEventHandler::onUserEnableLocalVideo; + using IRtcEngineEventHandler::onUserStateChanged; + using IRtcEngineEventHandler::onLocalAudioStats; + using IRtcEngineEventHandler::onRemoteAudioStats; + using IRtcEngineEventHandler::onLocalVideoStats; + using IRtcEngineEventHandler::onRemoteVideoStats; + using IRtcEngineEventHandler::onConnectionLost; + using IRtcEngineEventHandler::onConnectionInterrupted; + using IRtcEngineEventHandler::onConnectionBanned; + using IRtcEngineEventHandler::onStreamMessage; + using IRtcEngineEventHandler::onStreamMessageError; + using IRtcEngineEventHandler::onRequestToken; + using IRtcEngineEventHandler::onTokenPrivilegeWillExpire; + using IRtcEngineEventHandler::onLicenseValidationFailure; + using IRtcEngineEventHandler::onFirstLocalAudioFramePublished; + using IRtcEngineEventHandler::onFirstRemoteAudioFrame; + using IRtcEngineEventHandler::onFirstRemoteAudioDecoded; + using IRtcEngineEventHandler::onLocalAudioStateChanged; + using IRtcEngineEventHandler::onRemoteAudioStateChanged; + using IRtcEngineEventHandler::onActiveSpeaker; + using IRtcEngineEventHandler::onClientRoleChanged; + using IRtcEngineEventHandler::onClientRoleChangeFailed; + using IRtcEngineEventHandler::onRemoteAudioTransportStats; + using IRtcEngineEventHandler::onRemoteVideoTransportStats; + using IRtcEngineEventHandler::onConnectionStateChanged; + using IRtcEngineEventHandler::onWlAccMessage; + using IRtcEngineEventHandler::onWlAccStats; + using IRtcEngineEventHandler::onNetworkTypeChanged; + using IRtcEngineEventHandler::onEncryptionError; + using IRtcEngineEventHandler::onUploadLogResult; + using IRtcEngineEventHandler::onUserAccountUpdated; + using IRtcEngineEventHandler::onAudioSubscribeStateChanged; + using IRtcEngineEventHandler::onVideoSubscribeStateChanged; + using IRtcEngineEventHandler::onAudioPublishStateChanged; + using IRtcEngineEventHandler::onVideoPublishStateChanged; + using IRtcEngineEventHandler::onSnapshotTaken; + using IRtcEngineEventHandler::onVideoRenderingTracingResult; + using IRtcEngineEventHandler::onTranscodedStreamLayoutInfo; + using IRtcEngineEventHandler::onAudioMetadataReceived; + + virtual const char* eventHandlerType() const { return "event_handler_ex"; } + + /** + * Occurs when a user joins a channel. + * + * This callback notifies the application that a user joins a specified channel. + * + * @param connection The RtcConnection object. + * @param elapsed The time elapsed (ms) from the local user calling joinChannel until the SDK triggers this callback. + */ + virtual void onJoinChannelSuccess(const RtcConnection& connection, int elapsed) { + (void)connection; + (void)elapsed; + } + + /** + * Occurs when a user rejoins the channel. + * + * When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect + * and triggers this callback upon reconnection. + * + * @param connection The RtcConnection object. + * @param elapsed Time elapsed (ms) from the local user calling the joinChannel method until this callback is triggered. + */ + virtual void onRejoinChannelSuccess(const RtcConnection& connection, int elapsed) { + (void)connection; + (void)elapsed; + } + + /** Reports the statistics of the audio stream from each remote + user/broadcaster. + + @deprecated This callback is deprecated. Use onRemoteAudioStats instead. + + The SDK triggers this callback once every two seconds to report the audio + quality of each remote user/host sending an audio stream. If a channel has + multiple remote users/hosts sending audio streams, the SDK triggers this + callback as many times. + + @param connection The RtcConnection object. + @param remoteUid The user ID of the remote user sending the audio stream. + @param quality The audio quality of the user: #QUALITY_TYPE + @param delay The network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering. + @param lost The audio packet loss rate (%) from the sender to the receiver. + */ + virtual void onAudioQuality(const RtcConnection& connection, uid_t remoteUid, int quality, unsigned short delay, unsigned short lost) { + (void)connection; + (void)remoteUid; + (void)quality; + (void)delay; + (void)lost; + } + /** + * Reports the volume information of users. + * + * By default, this callback is disabled. You can enable it by calling `enableAudioVolumeIndication`. Once this + * callback is enabled and users send streams in the channel, the SDK triggers the `onAudioVolumeIndication` + * callback at the time interval set in `enableAudioVolumeIndication`. The SDK triggers two independent + * `onAudioVolumeIndication` callbacks simultaneously, which separately report the volume information of the + * local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest. + * + * @note After you enable this callback, calling muteLocalAudioStream affects the SDK's behavior as follows: + * - If the local user stops publishing the audio stream, the SDK stops triggering the local user's callback. + * - 20 seconds after a remote user whose volume is one of the three highest stops publishing the audio stream, + * the callback excludes this user's information; 20 seconds after all remote users stop publishing audio streams, + * the SDK stops triggering the callback for remote users. + * + * @param connection The RtcConnection object. + * @param speakers The volume information of the users, see AudioVolumeInfo. An empty `speakers` array in the + * callback indicates that no remote user is in the channel or sending a stream at the moment. + * @param speakerNumber The total number of speakers. + * - In the local user's callback, when the local user sends a stream, `speakerNumber` is 1. + * - In the callback for remote users, the value range of speakerNumber is [0,3]. If the number of remote users who + * send streams is greater than or equal to three, the value of `speakerNumber` is 3. + * @param totalVolume The volume of the speaker. The value ranges between 0 (lowest volume) and 255 (highest volume). + * - In the local user's callback, `totalVolume` is the volume of the local user who sends a stream. + * - In the remote users' callback, `totalVolume` is the sum of all remote users (up to three) whose instantaneous + * volume is the highest. If the user calls `startAudioMixing`, `totalVolume` is the volume after audio mixing. + */ + virtual void onAudioVolumeIndication(const RtcConnection& connection, const AudioVolumeInfo* speakers, + unsigned int speakerNumber, int totalVolume) { + (void)connection; + (void)speakers; + (void)speakerNumber; + (void)totalVolume; + } + + /** + * Occurs when a user leaves a channel. + * + * This callback notifies the app that the user leaves the channel by calling `leaveChannel`. From this callback, + * the app can get information such as the call duration and quality statistics. + * + * @param connection The RtcConnection object. + * @param stats The statistics on the call: RtcStats. + */ + virtual void onLeaveChannel(const RtcConnection& connection, const RtcStats& stats) { + (void)connection; + (void)stats; + } + + /** + * Reports the statistics of the current call. + * + * The SDK triggers this callback once every two seconds after the user joins the channel. + * + * @param connection The RtcConnection object. + * @param stats The statistics of the current call: RtcStats. + */ + virtual void onRtcStats(const RtcConnection& connection, const RtcStats& stats) { + (void)connection; + (void)stats; + } + + /** + * Reports the last mile network quality of each user in the channel. + * + * This callback reports the last mile network conditions of each user in the channel. Last mile refers to the + * connection between the local device and Agora's edge server. + * + * The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers + * this callback as many times. + * + * @note `txQuality` is UNKNOWN when the user is not sending a stream; `rxQuality` is UNKNOWN when the user is not + * receiving a stream. + * + * @param connection The RtcConnection object. + * @param remoteUid The user ID. The network quality of the user with this user ID is reported. + * @param txQuality Uplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, + * average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you + * understand how well the current uplink network conditions can support the selected video encoder configuration. + * For example, a 1000 Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame + * rate of 15 fps in the LIVE_BROADCASTING profile, but may be inadequate for resolutions higher than 1280 × 720. + * See #QUALITY_TYPE. + * @param rxQuality Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter + * of the downlink network. See #QUALITY_TYPE. + */ + virtual void onNetworkQuality(const RtcConnection& connection, uid_t remoteUid, int txQuality, int rxQuality) { + (void)connection; + (void)remoteUid; + (void)txQuality; + (void)rxQuality; + } + + /** + * Occurs when intra request from remote user is received. + * + * This callback is triggered once remote user needs one Key frame. + * + * @param connection The RtcConnection object. + */ + virtual void onIntraRequestReceived(const RtcConnection& connection) { + (void)connection; + } + + /** + * Occurs when the first local video frame is displayed on the video window. + * + * @deprecated 4.0.0 This callback is deprecated, use void onFirstLocalVideoFrame(VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) instead. + * + * @param connection The RtcConnection object. + * @param width The width (pixels) of the video stream. + * @param height The height (pixels) of the video stream. + * @param elapsed The time elapsed (ms) from the local user calling \ref IRtcEngine::joinChannel "joinChannel" until this callback is triggered. + */ + virtual void onFirstLocalVideoFrame(const RtcConnection& connection, int width, int height, int elapsed) { + (void)connection; + (void)width; + (void)height; + (void)elapsed; + } + + /** Occurs when the first local video frame is published. + * The SDK triggers this callback under one of the following circumstances: + * - The local client enables the video module and calls `joinChannel` successfully. + * - The local client calls `muteLocalVideoStream(true)` and muteLocalVideoStream(false) in sequence. + * - The local client calls `disableVideo` and `enableVideo` in sequence. + * - The local client calls `pushVideoFrame` to successfully push the video frame to the SDK. + * + * @param connection The RtcConnection object. + * @param elapsed The time elapsed (ms) from the local user calling joinChannel` to the SDK triggers + * this callback. + */ + virtual void onFirstLocalVideoFramePublished(const RtcConnection& connection, int elapsed) { + (void)connection; + (void)elapsed; + } + + /** Occurs when the first remote video frame is received and decoded. + + The SDK triggers this callback under one of the following circumstances: + - The remote user joins the channel and sends the video stream. + - The remote user stops sending the video stream and re-sends it after 15 seconds. Reasons for such an interruption include: + - The remote user leaves the channel. + - The remote user drops offline. + - The remote user calls `muteLocalVideoStream` to stop sending the video stream. + - The remote user calls `disableVideo` to disable video. + + @param connection The RtcConnection object. + @param remoteUid The user ID of the remote user sending the video stream. + @param width The width (pixels) of the video stream. + @param height The height (pixels) of the video stream. + @param elapsed The time elapsed (ms) from the local user calling `joinChannel` + until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoDecoded(const RtcConnection& connection, uid_t remoteUid, int width, int height, int elapsed) { + (void)connection; + (void)remoteUid; + (void)width; + (void)height; + (void)elapsed; + } + + /** + * Occurs when the local or remote video size or rotation has changed. + * + * @param connection The RtcConnection object. + * @param sourceType The video source type: #VIDEO_SOURCE_TYPE. + * @param uid The user ID. 0 indicates the local user. + * @param width The new width (pixels) of the video. + * @param height The new height (pixels) of the video. + * @param rotation The rotation information of the video. + */ + virtual void onVideoSizeChanged(const RtcConnection& connection, VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) { + (void)connection; + (void)uid; + (void)width; + (void)height; + (void)rotation; + } + /** Occurs when the local video stream state changes. + * + * When the state of the local video stream changes (including the state of the video capture and + * encoding), the SDK triggers this callback to report the current state. This callback indicates + * the state of the local video stream, including camera capturing and video encoding, and allows + * you to troubleshoot issues when exceptions occur. + * + * The SDK triggers the onLocalVideoStateChanged callback with the state code of `LOCAL_VIDEO_STREAM_STATE_FAILED` + * and error code of `LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE` in the following situations: + * - The app switches to the background, and the system gets the camera resource. + * - The camera starts normally, but does not output video for four consecutive seconds. + * + * When the camera outputs the captured video frames, if the video frames are the same for 15 + * consecutive frames, the SDK triggers the `onLocalVideoStateChanged` callback with the state code + * of `LOCAL_VIDEO_STREAM_STATE_CAPTURING` and error code of `LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE`. + * Note that the video frame duplication detection is only available for video frames with a resolution + * greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps. + * + * @note For some device models, the SDK does not trigger this callback when the state of the local + * video changes while the local video capturing device is in use, so you have to make your own + * timeout judgment. + * + * @param connection The RtcConnection object. + * @param state The state of the local video. See #LOCAL_VIDEO_STREAM_STATE. + * @param error The detailed error information. See #LOCAL_VIDEO_STREAM_ERROR. + */ + virtual void onLocalVideoStateChanged(const RtcConnection& connection, + LOCAL_VIDEO_STREAM_STATE state, + LOCAL_VIDEO_STREAM_ERROR errorCode) { + (void)connection; + (void)state; + (void)errorCode; + } + + /** + * Occurs when the remote video state changes. + * + * @note This callback does not work properly when the number of users (in the voice/video call + * channel) or hosts (in the live streaming channel) in the channel exceeds 17. + * + * @param connection The RtcConnection object. + * @param remoteUid The ID of the user whose video state has changed. + * @param state The remote video state: #REMOTE_VIDEO_STATE. + * @param reason The reason of the remote video state change: #REMOTE_VIDEO_STATE_REASON. + * @param elapsed The time elapsed (ms) from the local client calling `joinChannel` until this callback is triggered. + */ + virtual void onRemoteVideoStateChanged(const RtcConnection& connection, uid_t remoteUid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) { + (void)connection; + (void)remoteUid; + (void)state; + (void)reason; + (void)elapsed; + } + + /** Occurs when the renderer receives the first frame of the remote video. + * + * @param connection The RtcConnection object. + * @param remoteUid The user ID of the remote user sending the video stream. + * @param width The width (px) of the video frame. + * @param height The height (px) of the video stream. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoFrame(const RtcConnection& connection, uid_t remoteUid, int width, int height, int elapsed) { + (void)connection; + (void)remoteUid; + (void)width; + (void)height; + (void)elapsed; + } + + /** + * Occurs when a remote user or broadcaster joins the channel. + * + * - In the COMMUNICATION channel profile, this callback indicates that a remote user joins the channel. + * The SDK also triggers this callback to report the existing users in the channel when a user joins the + * channel. + * In the LIVE_BROADCASTING channel profile, this callback indicates that a host joins the channel. The + * SDK also triggers this callback to report the existing hosts in the channel when a host joins the + * channel. Agora recommends limiting the number of hosts to 17. + * + * The SDK triggers this callback under one of the following circumstances: + * - A remote user/host joins the channel by calling the `joinChannel` method. + * - A remote user switches the user role to the host after joining the channel. + * - A remote user/host rejoins the channel after a network interruption. + * + * @param connection The RtcConnection object. + * @param remoteUid The ID of the remote user or broadcaster joining the channel. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` or `setClientRole` + * until this callback is triggered. + */ + virtual void onUserJoined(const RtcConnection& connection, uid_t remoteUid, int elapsed) { + (void)connection; + (void)remoteUid; + (void)elapsed; + } + + /** + * Occurs when a remote user or broadcaster goes offline. + * + * There are two reasons for a user to go offline: + * - Leave the channel: When the user leaves the channel, the user sends a goodbye message. When this + * message is received, the SDK determines that the user leaves the channel. + * - Drop offline: When no data packet of the user is received for a certain period of time, the SDK assumes + * that the user drops offline. A poor network connection may lead to false detection, so we recommend using + * the RTM SDK for reliable offline detection. + * - The user switches the user role from a broadcaster to an audience. + * + * @param connection The RtcConnection object. + * @param remoteUid The ID of the remote user or broadcaster who leaves the channel or drops offline. + * @param reason The reason why the remote user goes offline: #USER_OFFLINE_REASON_TYPE. + */ + virtual void onUserOffline(const RtcConnection& connection, uid_t remoteUid, USER_OFFLINE_REASON_TYPE reason) { + (void)connection; + (void)remoteUid; + (void)reason; + } + + /** Occurs when a remote user's audio stream playback pauses/resumes. + * The SDK triggers this callback when the remote user stops or resumes sending the audio stream by + * calling the `muteLocalAudioStream` method. + * @note This callback can be inaccurate when the number of users (in the `COMMUNICATION` profile) or hosts (in the `LIVE_BROADCASTING` profile) in the channel exceeds 17. + * + * @param connection The RtcConnection object. + * @param remoteUid The user ID. + * @param muted Whether the remote user's audio stream is muted/unmuted: + * - true: Muted. + * - false: Unmuted. + */ + virtual void onUserMuteAudio(const RtcConnection& connection, uid_t remoteUid, bool muted) __deprecated { + (void)connection; + (void)remoteUid; + (void)muted; + } + + /** Occurs when a remote user pauses or resumes sending the video stream. + * + * When a remote user calls `muteLocalVideoStream` to stop or resume publishing the video stream, the + * SDK triggers this callback to report the state of the remote user's publishing stream to the local + * user. + * + * @note This callback can be inaccurate when the number of users or broadacasters in a + * channel exceeds 20. + * + * @param connection The RtcConnection object. + * @param remoteUid ID of the remote user. + * @param muted Whether the remote user stops publishing the video stream: + * - true: The remote user has paused sending the video stream. + * - false: The remote user has resumed sending the video stream. + */ + virtual void onUserMuteVideo(const RtcConnection& connection, uid_t remoteUid, bool muted) { + (void)connection; + (void)remoteUid; + (void)muted; + } + + /** Occurs when a remote user enables or disables the video module. + + Once the video function is disabled, the users cannot see any video. + + The SDK triggers this callback when a remote user enables or disables the video module by calling the + `enableVideo` or `disableVideo` method. + + @param connection The RtcConnection object. + @param remoteUid The ID of the remote user. + @param enabled Whether the video of the remote user is enabled: + - true: The remote user has enabled video. + - false: The remote user has disabled video. + */ + virtual void onUserEnableVideo(const RtcConnection& connection, uid_t remoteUid, bool enabled) __deprecated { + (void)connection; + (void)remoteUid; + (void)enabled; + } + + /** Occurs when a remote user enables or disables local video capturing. + + The SDK triggers this callback when the remote user resumes or stops capturing the video stream by + calling the `enableLocalVideo` method. + + @param connection The RtcConnection object. + @param remoteUid The ID of the remote user. + @param enabled Whether the specified remote user enables/disables local video: + - `true`: The remote user has enabled local video capturing. + - `false`: The remote user has disabled local video capturing. + */ + virtual void onUserEnableLocalVideo(const RtcConnection& connection, uid_t remoteUid, bool enabled) __deprecated { + (void)connection; + (void)remoteUid; + (void)enabled; + } + + /** + * Occurs when the remote user state is updated. + * + * @param connection The RtcConnection object. + * @param remoteUid The uid of the remote user. + * @param state The remote user state: #REMOTE_USER_STATE. + */ + virtual void onUserStateChanged(const RtcConnection& connection, uid_t remoteUid, uint32_t state) { + (void)connection; + (void)remoteUid; + (void)state; + } + + /** Reports the statistics of the local audio stream. + * + * The SDK triggers this callback once every two seconds. + * + * @param connection The RtcConnection object. + * @param stats The statistics of the local audio stream. + * See LocalAudioStats. + */ + virtual void onLocalAudioStats(const RtcConnection& connection, const LocalAudioStats& stats) { + (void)connection; + (void)stats; + } + + /** Reports the statistics of the audio stream from each remote user/host. + + The SDK triggers this callback once every two seconds for each remote user who is sending audio + streams. If a channel includes multiple remote users, the SDK triggers this callback as many times. + @param connection The RtcConnection object. + @param stats Statistics of the received remote audio streams. See RemoteAudioStats. + */ + virtual void onRemoteAudioStats(const RtcConnection& connection, const RemoteAudioStats& stats) { + (void)connection; + (void)stats; + } + + /** Reports the statistics of the local video stream. + * + * The SDK triggers this callback once every two seconds for each + * user/host. If there are multiple users/hosts in the channel, the SDK + * triggers this callback as many times. + * + * @note If you have called the `enableDualStreamMode` + * method, this callback reports the statistics of the high-video + * stream (high bitrate, and high-resolution video stream). + * + * @param connection The RtcConnection object. + * @param stats Statistics of the local video stream. See LocalVideoStats. + */ + virtual void onLocalVideoStats(const RtcConnection& connection, const LocalVideoStats& stats) { + (void)connection; + (void)stats; + } + + /** Reports the statistics of the video stream from each remote user/host. + * + * The SDK triggers this callback once every two seconds for each remote user. If a channel has + * multiple users/hosts sending video streams, the SDK triggers this callback as many times. + * + * @param connection The RtcConnection object. + * @param stats Statistics of the remote video stream. See + * RemoteVideoStats. + */ + virtual void onRemoteVideoStats(const RtcConnection& connection, const RemoteVideoStats& stats) { + (void)connection; + (void)stats; + } + + /** + * Occurs when the SDK cannot reconnect to the server 10 seconds after its connection to the server is + * interrupted. + * + * The SDK triggers this callback when it cannot connect to the server 10 seconds after calling + * `joinChannel`, regardless of whether it is in the channel or not. If the SDK fails to rejoin + * the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel. + * + * @param connection The RtcConnection object. + */ + virtual void onConnectionLost(const RtcConnection& connection) { + (void)connection; + } + + /** Occurs when the connection between the SDK and the server is interrupted. + * @deprecated Use `onConnectionStateChanged` instead. + + The SDK triggers this callback when it loses connection with the serer for more + than 4 seconds after the connection is established. After triggering this + callback, the SDK tries to reconnect to the server. If the reconnection fails + within a certain period (10 seconds by default), the onConnectionLost() + callback is triggered. If the SDK fails to rejoin the channel 20 minutes after + being disconnected from Agora's edge server, the SDK stops rejoining the channel. + + @param connection The RtcConnection object. + + */ + virtual void onConnectionInterrupted(const RtcConnection& connection) { + (void)connection; + } + + /** Occurs when your connection is banned by the Agora Server. + * + * @param connection The RtcConnection object. + */ + virtual void onConnectionBanned(const RtcConnection& connection) { + (void)connection; + } + + /** Occurs when the local user receives the data stream from the remote user. + * + * The SDK triggers this callback when the user receives the data stream that another user sends + * by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method. + * + * @param connection The RtcConnection object. + * @param remoteUid ID of the user who sends the data stream. + * @param streamId The ID of the stream data. + * @param data The data stream. + * @param length The length (byte) of the data stream. + * @param sentTs The time when the data stream sent. + */ + virtual void onStreamMessage(const RtcConnection& connection, uid_t remoteUid, int streamId, const char* data, size_t length, uint64_t sentTs) { + (void)connection; + (void)remoteUid; + (void)streamId; + (void)data; + (void)length; + (void)sentTs; + } + + /** Occurs when the local user does not receive the data stream from the remote user. + * + * The SDK triggers this callback when the user fails to receive the data stream that another user sends + * by calling the \ref agora::rtc::IRtcEngine::sendStreamMessage "sendStreamMessage" method. + * + * @param connection The RtcConnection object. + * @param remoteUid ID of the user who sends the data stream. + * @param streamId The ID of the stream data. + * @param code The error code. + * @param missed The number of lost messages. + * @param cached The number of incoming cached messages when the data stream is + * interrupted. + */ + virtual void onStreamMessageError(const RtcConnection& connection, uid_t remoteUid, int streamId, int code, int missed, int cached) { + (void)connection; + (void)remoteUid; + (void)streamId; + (void)code; + (void)missed; + (void)cached; + } + + /** + * Occurs when the token expires. + * + * When the token expires during a call, the SDK triggers this callback to remind the app to renew the token. + * + * Upon receiving this callback, generate a new token at your app server and call + * `joinChannel` to pass the new token to the SDK. + * + * @param connection The RtcConnection object. + */ + virtual void onRequestToken(const RtcConnection& connection) { + (void)connection; + } + + /** + * Occurs when connection license verification fails. + * + * You can know the reason accordding to error code + */ + virtual void onLicenseValidationFailure(const RtcConnection& connection, LICENSE_ERROR_TYPE reason) { + (void)connection; + (void)reason; + } + + /** + * Occurs when the token will expire in 30 seconds. + * + * When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token. + + * Upon receiving this callback, generate a new token at your app server and call + * \ref IRtcEngine::renewToken "renewToken" to pass the new Token to the SDK. + * + * @param connection The RtcConnection object. + * @param token The token that will expire in 30 seconds. + */ + virtual void onTokenPrivilegeWillExpire(const RtcConnection& connection, const char* token) { + (void)connection; + (void)token; + } + + /** Occurs when the first local audio frame is published. + * + * The SDK triggers this callback under one of the following circumstances: + * - The local client enables the audio module and calls `joinChannel` successfully. + * - The local client calls `muteLocalAudioStream(true)` and `muteLocalAudioStream(false)` in sequence. + * - The local client calls `disableAudio` and `enableAudio` in sequence. + * - The local client calls `pushAudioFrame` to successfully push the audio frame to the SDK. + * + * @param connection The RtcConnection object. + * @param elapsed The time elapsed (ms) from the local user calling `joinChannel` to the SDK triggers this callback. + */ + virtual void onFirstLocalAudioFramePublished(const RtcConnection& connection, int elapsed) { + (void)connection; + (void)elapsed; + } + + /** Occurs when the SDK receives the first audio frame from a specific remote user. + * @deprecated Use `onRemoteAudioStateChanged` instead. + * + * @param connection The RtcConnection object. + * @param userId ID of the remote user. + * @param elapsed The time elapsed (ms) from the loca user calling `joinChannel` + * until this callback is triggered. + */ + virtual void onFirstRemoteAudioFrame(const RtcConnection& connection, uid_t userId, int elapsed) { + (void)connection; + (void)userId; + (void)elapsed; + } + + /** + * Occurs when the SDK decodes the first remote audio frame for playback. + * + * @deprecated Use `onRemoteAudioStateChanged` instead. + * The SDK triggers this callback under one of the following circumstances: + * - The remote user joins the channel and sends the audio stream for the first time. + * - The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot + * receive audio in 15 seconds. Reasons for such an interruption include: + * - The remote user leaves channel. + * - The remote user drops offline. + * - The remote user calls muteLocalAudioStream to stop sending the audio stream. + * - The remote user calls disableAudio to disable audio. + * @param connection The RtcConnection object. + * @param uid User ID of the remote user sending the audio stream. + * @param elapsed The time elapsed (ms) from the loca user calling `joinChannel` + * until this callback is triggered. + */ + virtual void onFirstRemoteAudioDecoded(const RtcConnection& connection, uid_t uid, int elapsed) { + (void)connection; + (void)uid; + (void)elapsed; + } + + /** Occurs when the local audio state changes. + * + * When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK + * triggers this callback to report the current state. This callback indicates the state of the local audio stream, + * and allows you to troubleshoot issues when audio exceptions occur. + * + * @note + * When the state is `LOCAL_AUDIO_STREAM_STATE_FAILED(3)`, see the `error` + * parameter for details. + * + * @param connection The RtcConnection object. + * @param state State of the local audio. See #LOCAL_AUDIO_STREAM_STATE. + * @param error The error information of the local audio. + * See #LOCAL_AUDIO_STREAM_ERROR. + */ + virtual void onLocalAudioStateChanged(const RtcConnection& connection, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error) { + (void)connection; + (void)state; + (void)error; + } + + /** Occurs when the remote audio state changes. + * + * When the audio state of a remote user (in the voice/video call channel) or host (in the live streaming channel) + * changes, the SDK triggers this callback to report the current state of the remote audio stream. + * + * @note This callback does not work properly when the number of users (in the voice/video call channel) or hosts + * (in the live streaming channel) in the channel exceeds 17. + * + * @param connection The RtcConnection object. + * @param remoteUid ID of the remote user whose audio state changes. + * @param state State of the remote audio. See #REMOTE_AUDIO_STATE. + * @param reason The reason of the remote audio state change. + * See #REMOTE_AUDIO_STATE_REASON. + * @param elapsed Time elapsed (ms) from the local user calling the + * `joinChannel` method until the SDK + * triggers this callback. + */ + virtual void onRemoteAudioStateChanged(const RtcConnection& connection, uid_t remoteUid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) { + (void)connection; + (void)remoteUid; + (void)state; + (void)reason; + (void)elapsed; + } + + /** + * Occurs when an active speaker is detected. + * + * After a successful call of `enableAudioVolumeIndication`, the SDK continuously detects which remote user has the + * loudest volume. During the current period, the remote user, who is detected as the loudest for the most times, + * is the most active user. + * + * When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker. + * - If the most active remote speaker is always the same user, the SDK triggers the `onActiveSpeaker` callback only once. + * - If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker. + * + * @param connection The RtcConnection object. + * @param uid The ID of the active speaker. A `uid` of 0 means the local user. + */ + virtual void onActiveSpeaker(const RtcConnection& connection, uid_t uid) { + (void)connection; + (void)uid; + } + + /** + * Occurs when the user role switches in the interactive live streaming. + * + * @param connection The RtcConnection of the local user: #RtcConnection + * @param oldRole The old role of the user: #CLIENT_ROLE_TYPE + * @param newRole The new role of the user: #CLIENT_ROLE_TYPE + * @param newRoleOptions The client role options of the new role: #ClientRoleOptions. + */ + virtual void onClientRoleChanged(const RtcConnection& connection, CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) { + (void)connection; + (void)oldRole; + (void)newRole; + (void)newRoleOptions; + } + + /** + * Occurs when the user role in a Live-Broadcast channel fails to switch, for example, from a broadcaster + * to an audience or vice versa. + * + * @param connection The RtcConnection object. + * @param reason The reason for failing to change the client role: #CLIENT_ROLE_CHANGE_FAILED_REASON. + * @param currentRole The current role of the user: #CLIENT_ROLE_TYPE. + */ + virtual void onClientRoleChangeFailed(const RtcConnection& connection, CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) { + (void)connection; + (void)reason; + (void)currentRole; + } + + /** Reports the transport-layer statistics of each remote audio stream. + * @deprecated Use `onRemoteAudioStats` instead. + + This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every + two seconds after the local user receives an audio packet from a remote user. During a call, when the user receives + the audio packet sent by the remote user/host, the callback is triggered every 2 seconds. + + @param connection The RtcConnection object. + @param remoteUid ID of the remote user whose audio data packet is received. + @param delay The network time delay (ms) from the sender to the receiver. + @param lost The Packet loss rate (%) of the audio packet sent from the remote + user. + @param rxKBitRate Received bitrate (Kbps) of the audio packet sent from the + remote user. + */ + virtual void onRemoteAudioTransportStats(const RtcConnection& connection, uid_t remoteUid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) { + (void)connection; + (void)remoteUid; + (void)delay; + (void)lost; + (void)rxKBitRate; + } + + /** Reports the transport-layer statistics of each remote video stream. + * @deprecated Use `onRemoteVideoStats` instead. + + This callback reports the transport-layer statistics, such as the packet loss rate and network time + delay, once every two seconds after the local user receives a video packet from a remote user. + + During a call, when the user receives the video packet sent by the remote user/host, the callback is + triggered every 2 seconds. + + @param connection The RtcConnection object. + @param remoteUid ID of the remote user whose video packet is received. + @param delay The network time delay (ms) from the remote user sending the + video packet to the local user. + @param lost The packet loss rate (%) of the video packet sent from the remote + user. + @param rxKBitRate The bitrate (Kbps) of the video packet sent from + the remote user. + */ + virtual void onRemoteVideoTransportStats(const RtcConnection& connection, uid_t remoteUid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) { + (void)connection; + (void)remoteUid; + (void)delay; + (void)lost; + (void)rxKBitRate; + } + + /** Occurs when the network connection state changes. + * + * When the network connection state changes, the SDK triggers this callback and reports the current + * connection state and the reason for the change. + * + * @param connection The RtcConnection object. + * @param state The current connection state. See #CONNECTION_STATE_TYPE. + * @param reason The reason for a connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnectionStateChanged(const RtcConnection& connection, + CONNECTION_STATE_TYPE state, + CONNECTION_CHANGED_REASON_TYPE reason) { + (void)connection; + (void)state; + (void)reason; + } + + /** Occurs when the WIFI message need be sent to the user. + * + * @param connection The RtcConnection object. + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ + virtual void onWlAccMessage(const RtcConnection& connection, WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) { + (void)connection; + (void)reason; + (void)action; + (void)wlAccMsg; + } + + /** Occurs when SDK statistics wifi acceleration optimization effect. + * + * @param connection The RtcConnection object. + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ + virtual void onWlAccStats(const RtcConnection& connection, WlAccStats currentStats, WlAccStats averageStats) { + (void)connection; + (void)currentStats; + (void)averageStats; + } + + /** Occurs when the local network type changes. + * + * This callback occurs when the connection state of the local user changes. You can get the + * connection state and reason for the state change in this callback. When the network connection + * is interrupted, this callback indicates whether the interruption is caused by a network type + * change or poor network conditions. + * @param connection The RtcConnection object. + * @param type The type of the local network connection. See #NETWORK_TYPE. + */ + virtual void onNetworkTypeChanged(const RtcConnection& connection, NETWORK_TYPE type) { + (void)connection; + (void)type; + } + + /** Reports the built-in encryption errors. + * + * When encryption is enabled by calling `enableEncryption`, the SDK triggers this callback if an + * error occurs in encryption or decryption on the sender or the receiver side. + * @param connection The RtcConnection object. + * @param errorType The error type. See #ENCRYPTION_ERROR_TYPE. + */ + virtual void onEncryptionError(const RtcConnection& connection, ENCRYPTION_ERROR_TYPE errorType) { + (void)connection; + (void)errorType; + } + /** + * Reports the user log upload result + * @param connection The RtcConnection object. + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ + virtual void onUploadLogResult(const RtcConnection& connection, const char* requestId, bool success, UPLOAD_ERROR_REASON reason) { + (void)connection; + (void)requestId; + (void)success; + (void)reason; + } + /** + * Occurs when the user account is updated. + * + * @param connection The RtcConnection object. + * @param remoteUid The user ID. + * @param userAccount The user account. + */ + virtual void onUserAccountUpdated(const RtcConnection& connection, uid_t remoteUid, const char* userAccount){ + (void)connection; + (void)remoteUid; + (void)userAccount; + } + + /** Reports the result of taking a video snapshot. + * + * After a successful `takeSnapshot` method call, the SDK triggers this callback to report whether the snapshot is + * successfully taken, as well as the details for that snapshot. + * @param connection The RtcConnection object. + * @param uid The user ID. A `uid` of 0 indicates the local user. + * @param filePath The local path of the snapshot. + * @param width The width (px) of the snapshot. + * @param height The height (px) of the snapshot. + * @param errCode The message that confirms success or gives the reason why the snapshot is not successfully taken: + * - 0: Success. + * - < 0: Failure. + * - -1: The SDK fails to write data to a file or encode a JPEG image. + * - -2: The SDK does not find the video stream of the specified user within one second after the `takeSnapshot` method call succeeds. + * - -3: Calling the `takeSnapshot` method too frequently. Call the `takeSnapshot` method after receiving the `onSnapshotTaken` + * callback from the previous call. + */ + virtual void onSnapshotTaken(const RtcConnection& connection, uid_t uid, const char* filePath, int width, int height, int errCode) { + (void)uid; + (void)filePath; + (void)width; + (void)height; + (void)errCode; + } + + /** + * Reports the tracing result of video rendering event of the user. + * + * @param connection The RtcConnection object. + * @param uid The user ID. + * @param currentEvent The current event of the tracing result: #MEDIA_TRACE_EVENT. + * @param tracingInfo The tracing result: #VideoRenderingTracingInfo. + */ + virtual void onVideoRenderingTracingResult(const RtcConnection& connection, uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) { + (void)uid; + (void)currentEvent; + (void)tracingInfo; + } + + /** + * @technical preview + */ + virtual void onAudioMetadataReceived(const RtcConnection& connection, uid_t uid, const char* metadata, size_t length) { + (void)metadata; + (void)length; + } + + virtual void onTranscodedStreamLayoutInfo(const RtcConnection& connection, uid_t uid, int width, int height, int layoutCount,const VideoLayout* layoutlist) { + (void)uid; + (void)width; + (void)height; + (void)layoutCount; + (void)layoutlist; + } +}; + +class IRtcEngineEx : public IRtcEngine { +public: + /** + * Joins a channel with media options. + * + * This method enables users to join a channel. Users in the same channel can talk to each other, + * and multiple users in the same channel can start a group chat. Users with different App IDs + * cannot call each other. + * + * A successful call of this method triggers the following callbacks: + * - The local client: The `onJoinChannelSuccess` and `onConnectionStateChanged` callbacks. + * - The remote client: `onUserJoined`, if the user joining the channel is in the Communication + * profile or is a host in the Live-broadcasting profile. + * + * When the connection between the client and Agora's server is interrupted due to poor network + * conditions, the SDK tries reconnecting to the server. When the local client successfully rejoins + * the channel, the SDK triggers the `onRejoinChannelSuccess` callback on the local client. + * + * Compared to `joinChannel`, this method adds the options parameter to configure whether to + * automatically subscribe to all remote audio and video streams in the channel when the user + * joins the channel. By default, the user subscribes to the audio and video streams of all + * the other users in the channel, giving rise to usage and billings. To unsubscribe, set the + * `options` parameter or call the `mute` methods accordingly. + * + * @note + * - This method allows users to join only one channel at a time. + * - Ensure that the app ID you use to generate the token is the same app ID that you pass in the + * `initialize` method; otherwise, you may fail to join the channel by token. + * + * @param connection The RtcConnection object. + * @param token The token generated on your server for authentication. + * @param options The channel media options: ChannelMediaOptions. + * @param eventHandler The event handler: IRtcEngineEventHandler. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set + * to an integer, or the value of a member in the `ChannelMediaOptions` structure is invalid. You need + * to pass in a valid parameter and join the channel again. + * - -3: Failes to initialize the `IRtcEngine` object. You need to reinitialize the IRtcEngine object. + * - -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine + * object before calling this method. + * - -8: The internal state of the IRtcEngine object is wrong. The typical cause is that you call + * this method to join the channel without calling `stopEchoTest` to stop the test after calling + * `startEchoTest` to start a call loop test. You need to call `stopEchoTest` before calling this method. + * - -17: The request to join the channel is rejected. The typical cause is that the user is in the + * channel. Agora recommends using the `onConnectionStateChanged` callback to get whether the user is + * in the channel. Do not call this method to join the channel unless you receive the + * `CONNECTION_STATE_DISCONNECTED(1)` state. + * - -102: The channel name is invalid. You need to pass in a valid channel name in channelId to + * rejoin the channel. + * - -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel. + */ + virtual int joinChannelEx(const char* token, const RtcConnection& connection, + const ChannelMediaOptions& options, + IRtcEngineEventHandler* eventHandler) = 0; + + /** + * Leaves the channel. + * + * This method allows a user to leave the channel, for example, by hanging up or exiting a call. + * + * This method is an asynchronous call, which means that the result of this method returns even before + * the user has not actually left the channel. Once the user successfully leaves the channel, the + * SDK triggers the \ref IRtcEngineEventHandler::onLeaveChannel "onLeaveChannel" callback. + * + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int leaveChannelEx(const RtcConnection& connection) = 0; + + /** + * Leaves the channel with the connection ID. + * + * @param connection connection. + * @param options The options for leaving the channel. See #LeaveChannelOptions. + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int leaveChannelEx(const RtcConnection& connection, const LeaveChannelOptions& options) = 0; + + /** + * Updates the channel media options after joining the channel. + * + * @param options The channel media options: ChannelMediaOptions. + * @param connection The RtcConnection object. + * @return int + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateChannelMediaOptionsEx(const ChannelMediaOptions& options, const RtcConnection& connection) = 0; + /** + * Sets the video encoder configuration. + * + * Each configuration profile corresponds to a set of video parameters, including + * the resolution, frame rate, and bitrate. + * + * The parameters specified in this method are the maximum values under ideal network conditions. + * If the video engine cannot render the video using the specified parameters due + * to poor network conditions, the parameters further down the list are considered + * until a successful configuration is found. + * + * @param config The local video encoder configuration: VideoEncoderConfiguration. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVideoEncoderConfigurationEx(const VideoEncoderConfiguration& config, const RtcConnection& connection) = 0; + /** + * Initializes the video view of a remote user. + * + * This method initializes the video view of a remote stream on the local device. It affects only the + * video view that the local user sees. + * + * Usually the app should specify the `uid` of the remote video in the method call before the + * remote user joins the channel. If the remote `uid` is unknown to the app, set it later when the + * app receives the \ref IRtcEngineEventHandler::onUserJoined "onUserJoined" callback. + * + * To unbind the remote user from the view, set `view` in VideoCanvas as `null`. + * + * @note + * Ensure that you call this method in the UI thread. + * + * @param canvas The remote video view settings: VideoCanvas. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setupRemoteVideoEx(const VideoCanvas& canvas, const RtcConnection& connection) = 0; + /** + * Stops or resumes receiving the audio stream of a specified user. + * + * @note + * You can call this method before or after joining a channel. If a user + * leaves a channel, the settings in this method become invalid. + * + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the audio stream of the specified user: + * - true: Stop receiving the audio stream of the specified user. + * - false: (Default) Resume receiving the audio stream of the specified user. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRemoteAudioStreamEx(uid_t uid, bool mute, const RtcConnection& connection) = 0; + /** + * Stops or resumes receiving the video stream of a specified user. + * + * @note + * You can call this method before or after joining a channel. If a user + * leaves a channel, the settings in this method become invalid. + * + * @param uid The ID of the specified user. + * @param mute Whether to stop receiving the video stream of the specified user: + * - true: Stop receiving the video stream of the specified user. + * - false: (Default) Resume receiving the video stream of the specified user. + * @param connection The RtcConnetion object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int muteRemoteVideoStreamEx(uid_t uid, bool mute, const RtcConnection& connection) = 0; + /** + * Sets the remote video stream type. + * + * If the remote user has enabled the dual-stream mode, by default the SDK receives the high-stream video by + * Call this method to switch to the low-stream video. + * + * @note + * This method applies to scenarios where the remote user has enabled the dual-stream mode using + * \ref enableDualStreamMode "enableDualStreamMode"(true) before joining the channel. + * + * @param uid ID of the remote user sending the video stream. + * @param streamType Sets the video stream type: #VIDEO_STREAM_TYPE. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteVideoStreamTypeEx(uid_t uid, VIDEO_STREAM_TYPE streamType, const RtcConnection& connection) = 0; + /** + *Stops or resumes sending the local audio stream with connection. + * + *@param mute Determines whether to send or stop sending the local audio stream: + *- true: Stop sending the local audio stream. + *- false: Send the local audio stream. + * + *@param connection The connection of the user ID. + * + *@return + *- 0: Success. + *- < 0: Failure. + */ + virtual int muteLocalAudioStreamEx(bool mute, const RtcConnection& connection) = 0; + + /** + *Stops or resumes sending the local video stream with connection. + * + *@param mute Determines whether to send or stop sending the local video stream: + *- true: Stop sending the local video stream. + *- false: Send the local video stream. + * + *@param connection The connection of the user ID. + * + *@return + *- 0: Success. + *- < 0: Failure. + */ + virtual int muteLocalVideoStreamEx(bool mute, const RtcConnection& connection) = 0; + + /** + *Stops or resumes receiving all remote audio stream with connection. + * + *@param mute Whether to stop receiving remote audio streams: + *- true: Stop receiving any remote audio stream. + *- false: Resume receiving all remote audio streams. + * + *@param connection The connection of the user ID. + * + *@return + *- 0: Success. + *- < 0: Failure. + */ + virtual int muteAllRemoteAudioStreamsEx(bool mute, const RtcConnection& connection) = 0; + + /** + *Stops or resumes receiving all remote video stream with connection. + * + *@param mute Whether to stop receiving remote audio streams: + *- true: Stop receiving any remote audio stream. + *- false: Resume receiving all remote audio streams. + * + *@param connection The connection of the user ID. + * + *@return + *- 0: Success. + *- < 0: Failure. + */ + virtual int muteAllRemoteVideoStreamsEx(bool mute, const RtcConnection& connection) = 0; + + + /** + * Sets the blocklist of subscribe remote stream audio. + * + * @note + * If uid is in uidList, the remote user's audio will not be subscribed, + * even if muteRemoteAudioStream(uid, false) and muteAllRemoteAudioStreams(false) are operated. + * + * @param uidList The id list of users who do not subscribe to audio. + * @param uidNumber The number of uid in uidList. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0; + + /** + * Sets the allowlist of subscribe remote stream audio. + * + * @note + * - If uid is in uidList, the remote user's audio will be subscribed, + * even if muteRemoteAudioStream(uid, true) and muteAllRemoteAudioStreams(true) are operated. + * - If a user is in the blacklist and whitelist at the same time, the user will not subscribe to audio. + * + * @param uidList The id list of users who do subscribe to audio. + * @param uidNumber The number of uid in uidList. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0; + + /** + * Sets the blocklist of subscribe remote stream video. + * + * @note + * If uid is in uidList, the remote user's video will not be subscribed, + * even if muteRemoteVideoStream(uid, false) and muteAllRemoteVideoStreams(false) are operated. + * + * @param uidList The id list of users who do not subscribe to video. + * @param uidNumber The number of uid in uidList. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0; + + /** + * Sets the allowlist of subscribe remote stream video. + * + * @note + * - If uid is in uidList, the remote user's video will be subscribed, + * even if muteRemoteVideoStream(uid, true) and muteAllRemoteVideoStreams(true) are operated. + * - If a user is in the blacklist and whitelist at the same time, the user will not subscribe to video. + * + * @param uidList The id list of users who do subscribe to video. + * @param uidNumber The number of uid in uidList. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) = 0; + /** + * Sets the remote video subscription options + * + * + * @param uid ID of the remote user sending the video stream. + * @param options Sets the video subscription options: VideoSubscriptionOptions. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteVideoSubscriptionOptionsEx(uid_t uid, const VideoSubscriptionOptions& options, const RtcConnection& connection) = 0; + /** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + + @note + - For this method to work, enable stereo panning for remote users by calling the \ref agora::rtc::IRtcEngine::enableSoundPositionIndication "enableSoundPositionIndication" method before joining a channel. + - This method requires hardware support. For the best sound positioning, we recommend using a wired headset. + - Ensure that you call this method after joining a channel. + + @param uid The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + - 0.0: the remote sound comes from the front. + - -1.0: the remote sound comes from the left. + - 1.0: the remote sound comes from the right. + @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. + @param connection The RtcConnection object. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteVoicePositionEx(uid_t uid, double pan, double gain, const RtcConnection& connection) = 0; + /** Sets remote user parameters for spatial audio + + @param uid The ID of the remote user. + @param param spatial audio parameters: SpatialAudioParams. + @param connection The RtcConnection object. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteUserSpatialAudioParamsEx(uid_t uid, const agora::SpatialAudioParams& params, const RtcConnection& connection) = 0; + /** + * Updates the display mode of the video view of a remote user. + * + * After initializing the video view of a remote user, you can call this method to update its + * rendering and mirror modes. This method affects only the video view that the local user sees. + * + * @note + * - Ensure that you have called \ref setupRemoteVideo "setupRemoteVideo" to initialize the remote video + * view before calling this method. + * - During a call, you can call this method as many times as necessary to update the display mode + * of the video view of a remote user. + * + * @param uid ID of the remote user. + * @param renderMode Sets the remote display mode. See #RENDER_MODE_TYPE. + * @param mirrorMode Sets the mirror type. See #VIDEO_MIRROR_MODE_TYPE. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRemoteRenderModeEx(uid_t uid, media::base::RENDER_MODE_TYPE renderMode, + VIDEO_MIRROR_MODE_TYPE mirrorMode, const RtcConnection& connection) = 0; + /** Enables loopback recording. + * + * If you enable loopback recording, the output of the default sound card is mixed into + * the audio stream sent to the other end. + * + * @note This method is for Windows only. + * + * @param connection The RtcConnection object. + * @param enabled Sets whether to enable/disable loopback recording. + * - true: Enable loopback recording. + * - false: (Default) Disable loopback recording. + * @param deviceName Pointer to the device name of the sound card. The default value is NULL (the default sound card). + * - This method is for macOS and Windows only. + * - macOS does not support loopback capturing of the default sound card. If you need to use this method, + * please use a virtual sound card and pass its name to the deviceName parameter. Agora has tested and recommends using soundflower. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLoopbackRecordingEx(const RtcConnection& connection, bool enabled, const char* deviceName = NULL) = 0; + + /** + * Adjusts the recording volume. + * + * @param volume The recording volume, which ranges from 0 to 400: + * - 0 : Mute the recording volume. + * - 100: The original volume. + * - 400: (Maximum) Four times the original volume with signal clipping protection. + * + * @param connection The RtcConnection object. + * + * @return + * - 0 : Success. + * - < 0: Failure. + */ + virtual int adjustRecordingSignalVolumeEx(int volume, const RtcConnection& connection) = 0; + + /** + * Mute or resume recording signal volume. + * + * @param mute Determines whether to mute or resume the recording signal volume. + * - true: Mute the recording signal volume. + * - false: (Default) Resume the recording signal volume. + * + * @param connection The RtcConnection object. + * + * @return + * - 0 : Success. + * - < 0: Failure. + */ + virtual int muteRecordingSignalEx(bool mute, const RtcConnection& connection) = 0; + + /** + * Adjust the playback signal volume of a specified remote user. + * You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user. + * + * @note + * The playback volume here refers to the mixed volume of a specified remote user. + * This method can only adjust the playback volume of one specified remote user at a time. To adjust the playback volume of different remote users, call the method as many times, once for each remote user. + * + * @param uid The ID of the remote user. + * @param volume The playback volume of the specified remote user. The value ranges between 0 and 400, including the following: + * + * - 0: Mute. + * - 100: (Default) Original volume. + * @param connection RtcConnection + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustUserPlaybackSignalVolumeEx(unsigned int uid, int volume, const RtcConnection& connection) = 0; + + /** Gets the current connection state of the SDK. + @param connection The RtcConnection object. + @return #CONNECTION_STATE_TYPE. + */ + virtual CONNECTION_STATE_TYPE getConnectionStateEx(const RtcConnection& connection) = 0; + /** Enables/Disables the built-in encryption. + * + * In scenarios requiring high security, Agora recommends calling this method to enable the built-in encryption before joining a channel. + * + * All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + * + * @note + * - If you enable the built-in encryption, you cannot use the RTMP streaming function. + * + * @param connection The RtcConnection object. + * @param enabled Whether to enable the built-in encryption: + * - true: Enable the built-in encryption. + * - false: Disable the built-in encryption. + * @param config Configurations of built-in encryption schemas. See EncryptionConfig. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT): An invalid parameter is used. Set the parameter with a valid value. + * - -4(ERR_NOT_SUPPORTED): The encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library. + * - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int enableEncryptionEx(const RtcConnection& connection, bool enabled, const EncryptionConfig& config) = 0; + /** Creates a data stream. + * + * You can call this method to create a data stream and improve the + * reliability and ordering of data tranmission. + * + * @note + * - Ensure that you set the same value for `reliable` and `ordered`. + * - Each user can only create a maximum of 5 data streams during a RtcEngine + * lifecycle. + * - The data channel allows a data delay of up to 5 seconds. If the receiver + * does not receive the data stream within 5 seconds, the data channel reports + * an error. + * + * @param[out] streamId The ID of the stream data. + * @param reliable Sets whether the recipients are guaranteed to receive + * the data stream from the sender within five seconds: + * - true: The recipients receive the data stream from the sender within + * five seconds. If the recipient does not receive the data stream within + * five seconds, an error is reported to the application. + * - false: There is no guarantee that the recipients receive the data stream + * within five seconds and no error message is reported for any delay or + * missing data stream. + * @param ordered Sets whether the recipients receive the data stream + * in the sent order: + * - true: The recipients receive the data stream in the sent order. + * - false: The recipients do not receive the data stream in the sent order. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int createDataStreamEx(int* streamId, bool reliable, bool ordered, const RtcConnection& connection) = 0; + /** Creates a data stream. + * + * Each user can create up to five data streams during the lifecycle of the IChannel. + * @param streamId The ID of the created data stream. + * @param config The config of data stream. + * @param connection The RtcConnection object. + * @return int + * - Returns 0: Success. + * - < 0: Failure. + */ + virtual int createDataStreamEx(int* streamId, DataStreamConfig& config, const RtcConnection& connection) = 0; + /** Sends a data stream. + * + * After calling \ref IRtcEngine::createDataStream "createDataStream", you can call + * this method to send a data stream to all users in the channel. + * + * The SDK has the following restrictions on this method: + * - Up to 60 packets can be sent per second in a channel with each packet having a maximum size of 1 KB. + * - Each client can send up to 30 KB of data per second. + * - Each user can have up to five data streams simultaneously. + * + * After the remote user receives the data stream within 5 seconds, the SDK triggers the + * \ref IRtcEngineEventHandler::onStreamMessage "onStreamMessage" callback on + * the remote client. After the remote user does not receive the data stream within 5 seconds, + * the SDK triggers the \ref IRtcEngineEventHandler::onStreamMessageError "onStreamMessageError" + * callback on the remote client. + * + * @note + * - Call this method after calling \ref IRtcEngine::createDataStream "createDataStream". + * - This method applies only to the `COMMUNICATION` profile or to + * the hosts in the `LIVE_BROADCASTING` profile. If an audience in the + * `LIVE_BROADCASTING` profile calls this method, the audience may be switched to a host. + * + * @param streamId The ID of the stream data. + * @param data The data stream. + * @param length The length (byte) of the data stream. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendStreamMessageEx(int streamId, const char* data, size_t length, const RtcConnection& connection) = 0; + /** Adds a watermark image to the local video. + + This method adds a PNG watermark image to the local video in a live broadcast. Once the watermark image is added, all the audience in the channel (CDN audience included), + and the recording device can see and capture it. Agora supports adding only one watermark image onto the local video, and the newly watermark image replaces the previous one. + + The watermark position depends on the settings in the \ref IRtcEngine::setVideoEncoderConfiguration "setVideoEncoderConfiguration" method: + - If the orientation mode of the encoding video is #ORIENTATION_MODE_FIXED_LANDSCAPE, or the landscape mode in #ORIENTATION_MODE_ADAPTIVE, the watermark uses the landscape orientation. + - If the orientation mode of the encoding video is #ORIENTATION_MODE_FIXED_PORTRAIT, or the portrait mode in #ORIENTATION_MODE_ADAPTIVE, the watermark uses the portrait orientation. + - When setting the watermark position, the region must be less than the dimensions set in the `setVideoEncoderConfiguration` method. Otherwise, the watermark image will be cropped. + + @note + - Ensure that you have called the \ref agora::rtc::IRtcEngine::enableVideo "enableVideo" method to enable the video module before calling this method. + - If you only want to add a watermark image to the local video for the audience in the CDN live broadcast channel to see and capture, you can call this method or the \ref agora::rtc::IRtcEngine::setLiveTranscoding "setLiveTranscoding" method. + - This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray. + - If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings. + - If you have enabled the local video preview by calling the \ref agora::rtc::IRtcEngine::startPreview "startPreview" method, you can use the `visibleInPreview` member in the WatermarkOptions class to set whether or not the watermark is visible in preview. + - If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer. + + @param watermarkUrl The local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path. + @param options Pointer to the watermark's options to be added. See WatermarkOptions for more infomation. + @param connection The RtcConnection object. + + @return int + - 0: Success. + - < 0: Failure. + */ + virtual int addVideoWatermarkEx(const char* watermarkUrl, const WatermarkOptions& options, const RtcConnection& connection) = 0; + /** Removes the watermark image on the video stream added by + addVideoWatermark(). + + @param connection The RtcConnection object. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int clearVideoWatermarkEx(const RtcConnection& connection) = 0; + /** Agora supports reporting and analyzing customized messages. + * + * This function is in the beta stage with a free trial. The ability provided + * in its beta test version is reporting a maximum of 10 message pieces within + * 6 seconds, with each message piece not exceeding 256 bytes. + * + * To try out this function, contact [support@agora.io](mailto:support@agora.io) + * and discuss the format of customized messages with us. + */ + virtual int sendCustomReportMessageEx(const char* id, const char* category, const char* event, const char* label, + int value, const RtcConnection& connection) = 0; + + /** + * Enables the `onAudioVolumeIndication` callback to report on which users are speaking + * and the speakers' volume. + * + * Once the \ref IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback is enabled, the SDK returns the volume indication in the at the time interval set + * in `enableAudioVolumeIndication`, regardless of whether any user is speaking in the channel. + * + * @param interval Sets the time interval between two consecutive volume indications: + * - <= 0: Disables the volume indication. + * - > 0: Time interval (ms) between two consecutive volume indications, + * and should be integral multiple of 200 (less than 200 will be set to 200). + * @param smooth The smoothing factor that sets the sensitivity of the audio volume + * indicator. The value range is [0, 10]. The greater the value, the more sensitive the + * indicator. The recommended value is 3. + * @param reportVad + * - `true`: Enable the voice activity detection of the local user. Once it is enabled, the `vad` parameter of the + * `onAudioVolumeIndication` callback reports the voice activity status of the local user. + * - `false`: (Default) Disable the voice activity detection of the local user. Once it is disabled, the `vad` parameter + * of the `onAudioVolumeIndication` callback does not report the voice activity status of the local user, except for + * the scenario where the engine automatically detects the voice activity of the local user. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudioVolumeIndicationEx(int interval, int smooth, bool reportVad, const RtcConnection& connection) = 0; + + /** Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.) + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param connection RtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRtmpStreamWithoutTranscodingEx(const char* url, const RtcConnection& connection) = 0; + + /** Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.) + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + * @param connection RtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRtmpStreamWithTranscodingEx(const char* url, const LiveTranscoding& transcoding, const RtcConnection& connection) = 0; + + /** Update the video layout and audio settings for CDN live. (CDN live only.) + * @note This method applies to Live Broadcast only. + * + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + * @param connection RtcConnection. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateRtmpTranscodingEx(const LiveTranscoding& transcoding, const RtcConnection& connection) = 0; + + /** Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.) + * @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRtmpStreamEx(const char* url, const RtcConnection& connection) = 0; + + /** Starts to relay media streams across channels. + * + * @param configuration The configuration of the media stream relay:ChannelMediaRelayConfiguration. + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) = 0; + + /** Updates the channels for media stream relay + * @param configuration The media stream relay configuration: ChannelMediaRelayConfiguration. + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) = 0; + + /** Stops the media stream relay. + * + * Once the relay stops, the host quits all the destination + * channels. + * + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopChannelMediaRelayEx(const RtcConnection& connection) = 0; + + /** pause the channels for media stream relay. + * + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int pauseAllChannelMediaRelayEx(const RtcConnection& connection) = 0; + + /** resume the channels for media stream relay. + * + * @param connection RtcConnection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int resumeAllChannelMediaRelayEx(const RtcConnection& connection) = 0; + + /** Gets the user information by passing in the user account. + * It is same as agora::rtc::IRtcEngine::getUserInfoByUserAccount. + * + * @param userAccount The user account of the user. Ensure that you set this parameter. + * @param [in,out] userInfo A userInfo object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUserAccountEx(const char* userAccount, rtc::UserInfo* userInfo, const RtcConnection& connection) = 0; + + /** Gets the user information by passing in the user ID. + * It is same as agora::rtc::IRtcEngine::getUserInfoByUid. + * + * @param uid The user ID of the remote user. Ensure that you set this parameter. + * @param[in,out] userInfo A userInfo object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * @param connection The RtcConnection object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUidEx(uid_t uid, rtc::UserInfo* userInfo, const RtcConnection& connection) = 0; + + /** + * Specify video stream parameters based on video profile + * @param [in] width + * width of video resolution in pixel + * @param [in] height + * height of video resolution in pixel + * @param [in] frameRate + * frame rate in fps + * @param [in] bitrate + * bit rate in kbps + * @return return 0 if success or an error code + */ + virtual int setVideoProfileEx(int width, int height, int frameRate, int bitrate) = 0; + + /** + * Enables or disables the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video + * stream) video using {@link setRemoteVideoStreamType setRemoteVideoStreamType}. + * + * @param enabled + * - true: Enable the dual-stream mode. + * - false: (default) Disable the dual-stream mode. + * @param streamConfig The minor stream config + * @param connection The RtcConnection object. + */ + virtual int enableDualStreamModeEx(bool enabled, const SimulcastStreamConfig& streamConfig, + const RtcConnection& connection) = 0; + /** + * Enables, disables or auto enable the dual video stream mode. + * + * If dual-stream mode is enabled, the subscriber can choose to receive the high-stream + * (high-resolution high-bitrate video stream) or low-stream (low-resolution low-bitrate video + * stream) video using {@link setRemoteVideoStreamType setRemoteVideoStreamType}. + * + * @param mode The dual stream mode: #SIMULCAST_STREAM_MODE. + * @param streamConfig The configuration of the low stream: SimulcastStreamConfig. + * @param connection The RtcConnection object. + */ + virtual int setDualStreamModeEx(SIMULCAST_STREAM_MODE mode, + const SimulcastStreamConfig& streamConfig, + const RtcConnection& connection) = 0; + + /** + * Turns WIFI acceleration on or off. + * + * @note + * - This method is called before and after joining a channel. + * - Users check the WIFI router app for information about acceleration. Therefore, if this interface is invoked, the caller accepts that the caller's name will be displayed to the user in the WIFI router application on behalf of the caller. + * + * @param enabled + * - true:Turn WIFI acceleration on. + * - false:Turn WIFI acceleration off. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableWirelessAccelerate(bool enabled) = 0; + /** + * Takes a snapshot of a video stream. + * + * This method takes a snapshot of a video stream from the specified user, generates a JPG + * image, and saves it to the specified path. + * + * The method is asynchronous, and the SDK has not taken the snapshot when the method call + * returns. After a successful method call, the SDK triggers the `onSnapshotTaken` callback + * to report whether the snapshot is successfully taken, as well as the details for that + * snapshot. + * + * @note + * - Call this method after joining a channel. + * - This method takes a snapshot of the published video stream specified in `ChannelMediaOptions`. + * - If the user's video has been preprocessed, for example, watermarked or beautified, the resulting + * snapshot includes the pre-processing effect. + * @param connection The RtcConnection object. + * @param uid The user ID. Set uid as 0 if you want to take a snapshot of the local user's video. + * @param filePath The local path (including filename extensions) of the snapshot. For example: + * - Windows: `C:\Users\\AppData\Local\Agora\\example.jpg` + * - iOS: `/App Sandbox/Library/Caches/example.jpg` + * - macOS: `~/Library/Logs/example.jpg` + * - Android: `/storage/emulated/0/Android/data//files/example.jpg` + * + * Ensure that the path you specify exists and is writable. + * @return + * - 0 : Success. + * - < 0 : Failure. + */ + virtual int takeSnapshotEx(const RtcConnection& connection, uid_t uid, const char* filePath) = 0; + + /** Enables the content inspect. + @param enabled Whether to enable content inspect: + - `true`: Yes. + - `false`: No. + @param config The configuration for the content inspection. + @param connection The RtcConnection object. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableContentInspectEx(bool enabled, const media::ContentInspectConfig &config, const RtcConnection& connection) = 0; + + /** + @brief Start tracing media rendering events. + @since v4.1.1 + @discussion + - SDK will trace media rendering events when this API is called. + - The tracing result can be obtained through callback `IRtcEngineEventHandler(Ex)::onVideoRenderingTracingResult` + @param connection The RtcConnection object. + @note + - By default, SDK will trace media rendering events when `IRtcEngineEx::joinChannelEx` is called. + - The start point of event tracing will be reset after leaving channel. + @return + - 0: Success. + - < 0: Failure. + - -2(ERR_INVALID_ARGUMENT): The parameter is invalid. Check the channel ID and local uid set by parameter `connection`. + - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. + */ + virtual int startMediaRenderingTracingEx(const RtcConnection& connection) = 0; + + /** + * @technical preview + */ + virtual int sendAudioMetadataEx(const RtcConnection& connection, const char* metadata, size_t length) = 0; + /** + * Gets the current call ID. + * + * When a user joins a channel on a client, a `callId` is generated to identify + * the call. + * + * After a call ends, you can call `rate` or `complain` to gather feedback from the customer. + * These methods require a `callId` parameter. To use these feedback methods, call the this + * method first to retrieve the `callId` during the call, and then pass the value as an + * argument in the `rate` or `complain` method after the call ends. + * + * @param callId The reference to the call ID. + * @param connection The RtcConnection object. + * @return + * - The call ID if the method call is successful. + * - < 0: Failure. + */ + virtual int getCallIdEx(agora::util::AString& callId, const RtcConnection& connection) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtmService.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtmService.h new file mode 100644 index 0000000..70dbbf1 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtmService.h @@ -0,0 +1,715 @@ +// +// Agora Rtm SDK +// +// Created by junhao Wang in 2018-05. +// Copyright (c) 2018 Agora IO. All rights reserved. +// +#pragma once + +#include + +namespace agora { + +namespace rtm { + +enum PEER_MESSAGE_STATE { + PEER_MESSAGE_INIT = 0, + PEER_MESSAGE_FAILURE = 1, + PEER_MESSAGE_PEER_UNREACHABLE = 2, + PEER_MESSAGE_RECEIVED_BY_PEER = 3, + PEER_MESSAGE_SENT_TIMEOUT = 4, +}; +/** + * The login error code. + */ +enum LOGIN_ERR_CODE { + /** + * 0: Login succeeds. No error occurs. + */ + LOGIN_ERR_OK = 0, + /** + * 1: Login fails for reasons unknown. + */ + LOGIN_ERR_UNKNOWN = 1, + /** + * 2: The server rejects the login, either because the user has already logged in, or because + * the RTM service is not initialized. + */ + LOGIN_ERR_REJECTED = 2, // ALREADY LOGIN OR NOT INITIALIZED, SERVER REJECT + /** + * 3: Invalid login arguments. + */ + LOGIN_ERR_INVALID_ARGUMENT = 3, + /** + * 4: The App ID is invalid. + */ + LOGIN_ERR_INVALID_APP_ID = 4, + /** + * 5: The token is invalid. + */ + LOGIN_ERR_INVALID_TOKEN = 5, + /** + * 6: The login is rejected because the token has expired. + */ + LOGIN_ERR_TOKEN_EXPIRED = 6, + /** + * 7: Authentication of the RTMP token fails. + */ + LOGIN_ERR_NOT_AUTHORIZED = 7, + /** + * 8: The login times out. The current timeout is set as six seconds. + */ + LOGIN_ERR_TIMEOUT = 8, +}; +/** + * The logout error code. + */ +enum LOGOUT_ERR_CODE { + /** + * 0: Logout succeeds. No error occurs. + */ + LOGOUT_ERR_OK = 0, + /** + * 1: Logout fails. + */ + LOGOUT_ERR_REJECTED = 1, +}; +/** + * The connection state. + */ +enum CONNECTION_STATE { + /** + * 1: The SDK has logged in the RTM service. + */ + CONNECTION_STATE_CONNECTED = 1, + /** + * 2: The initial state. The SDK is disconnected from the RTM service. + */ + CONNECTION_STATE_DISCONNECTED = 2, + /** + * 3: The SDK gives up logging in the RTM service, mainly because another instance has logged in the RTM + * service with the same user ID. + * + * Call the logout() method before calling login to log in the RTM service again. + */ + CONNECTION_STATE_ABORTED = 3, +}; + +/** + * The state of the channel message. + */ +enum CHANNEL_MESSAGE_STATE { + /** + * 1: The channel message is received by the server. + */ + CHANNEL_MESSAGE_RECEIVED_BY_SERVER = 1, + /** + * 3: The SDK has not received a response from the server in five seconds. The current timeout is set as + * five seconds. + */ + CHANNEL_MESSAGE_SENT_TIMEOUT = 3, +}; +/** + * The join channel error. + */ +enum JOIN_CHANNEL_ERR { + /** + 0: The method call succeeds, or the user joins the channel successfully. + */ + JOIN_CHANNEL_ERR_OK = 0, + + /** + 1: Common failure. The user fails to join the channel. + */ + JOIN_CHANNEL_ERR_FAILURE = 1, + + /** + 2: **RESERVED FOR FUTURE USE** + */ + JOIN_CHANNEL_ERR_REJECTED = 2, // Usually occurs when the user is already in the channel + + /** + 3: The user fails to join the channel because the argument is invalid. + */ + JOIN_CHANNEL_ERR_INVALID_ARGUMENT = 3, + + /** + 4: A timeout occurs when joining the channel. The current timeout is set as five seconds. Possible reasons: The user is in the \ref agora::rtm::CONNECTION_STATE_ABORTED "CONNECTION_STATE_ABORTED" state. + */ + JOIN_CHANNEL_TIMEOUT = 4, + + /** + 5: The number of the RTM channels you are in exceeds the limit of 20. + */ + JOIN_CHANNEL_ERR_EXCEED_LIMIT = 5, + + /** + 6: The user is joining or has joined the channel. + */ + JOIN_CHANNEL_ERR_ALREADY_JOINED = 6, + + /** + 7: The method call frequency exceeds 50 queries every three seconds. + */ + JOIN_CHANNEL_ERR_TOO_OFTEN = 7, + + /** + 8: The frequency of joining the same channel exceeds two times every five seconds. + */ + JOIN_CHANNEL_ERR_JOIN_SAME_CHANNEL_TOO_OFTEN = 8, + + /** + 101: \ref agora::rtm::IRtmService "IRtmService" is not initialized. + */ + JOIN_CHANNEL_ERR_NOT_INITIALIZED = 101, + + /** + 102: The user does not call the \ref agora::rtm::IRtmService::login "login" method, or the method call of \ref agora::rtm::IRtmService::login "login" does not succeed before joining the channel. + */ + JOIN_CHANNEL_ERR_USER_NOT_LOGGED_IN = 102, +}; +/** + @brief Error codes related to leaving a channel. + */ +enum LEAVE_CHANNEL_ERR { + + /** + 0: The method call succeeds, or the user leaves the channel successfully. + */ + LEAVE_CHANNEL_ERR_OK = 0, + + /** + 1: Common failure. The user fails to leave the channel. + */ + LEAVE_CHANNEL_ERR_FAILURE = 1, + + /** + 2: **RESERVED FOR FUTURE USE** + */ + LEAVE_CHANNEL_ERR_REJECTED = 2, + + /** + 3: The user is not in the channel. + */ + LEAVE_CHANNEL_ERR_NOT_IN_CHANNEL = 3, + + /** + 101: \ref agora::rtm::IRtmService "IRtmService" is not initialized. + */ + LEAVE_CHANNEL_ERR_NOT_INITIALIZED = 101, + + /** + 102: The user does not call the \ref agora::rtm::IRtmService::login "login" method, or the method call of \ref agora::rtm::IRtmService::login "login" does not succeed before calling the \ref agora::rtm::IChannel::leave "leave" method. + */ + LEAVE_CHANNEL_ERR_USER_NOT_LOGGED_IN = 102, +}; + +/** + * The reason for a user to leave the channel. + */ +enum LEAVE_CHANNEL_REASON { + /** + * 1: The user quits the channel. + */ + LEAVE_CHANNEL_REASON_QUIT = 1, + /** + * 2: The user is kicked off the channel. + */ + LEAVE_CHANNEL_REASON_KICKED = 2, +}; +/** + @brief Error codes related to sending a channel message. + */ +enum CHANNEL_MESSAGE_ERR_CODE { + + /** + 0: The method call succeeds, or the server receives the channel message. + */ + CHANNEL_MESSAGE_ERR_OK = 0, + + /** + 1: Common failure. The user fails to send the channel message. + */ + CHANNEL_MESSAGE_ERR_FAILURE = 1, + + /** + 2: The SDK does not receive a response from the server in 10 seconds. The current timeout is set as 10 seconds. Possible reasons: The user is in the \ref agora::rtm::CONNECTION_STATE_ABORTED "CONNECTION_STATE_ABORTED" state. + */ + CHANNEL_MESSAGE_ERR_SENT_TIMEOUT = 2, + + /** + 3: The method call frequency exceeds the limit of (RTM SDK for Windows C++) 180 calls every three seconds or (RTM SDK for Linux C++) 1500 calls every three seconds, with channel and peer messages taken together.. + */ + CHANNEL_MESSAGE_ERR_TOO_OFTEN = 3, + + /** + 4: The message is null or exceeds 32 KB in length. + */ + CHANNEL_MESSAGE_ERR_INVALID_MESSAGE = 4, + + /** + 101: \ref agora::rtm::IRtmService "IRtmService" is not initialized. + */ + CHANNEL_MESSAGE_ERR_NOT_INITIALIZED = 101, + + /** + 102: The user does not call the \ref agora::rtm::IRtmService::login "login" method, or the method call of \ref agora::rtm::IRtmService::login "login" does not succeed before sending out a channel message. + */ + CHANNEL_MESSAGE_ERR_USER_NOT_LOGGED_IN = 102, +}; + +/** + * The response code. + */ +enum RESPONSE_CODE { + /** + * 1: The response + */ + RESPONSE_CODE_SUCCESS = 1, + RESPONSE_CODE_FAILURE = 2, +}; +/** + * The message type. + */ +enum MESSAGE_TYPE { + /** + * 0: The message type is undefined. + */ + MESSAGE_TYPE_UNDEFINED = 0, + /** + * 1: A text message. + */ + MESSAGE_TYPE_TEXT = 1, + /** + * 2: A raw message in binary, for example, audio data, or video data. + */ + MESSAGE_TYPE_BINARY = 2, + /** + * 4: A converge message. + */ + MESSAGE_TYPE_CONVERGE = 4, +}; +/** + * The IMessage class. + */ +class IMessage { + public: + /** + * Creates an IMessage instance. + * + * The created IMessage instance can be either for a channel message or for a peer-to-peer message. + * + * You can set the content of the text message later using the setText() method. + * @return + * - An empty text IMessage instance, if the method call succeeds. + */ + static IMessage *createMessage(); + virtual ~IMessage() {} + /** + * Gets the ID of the message. + * @return The ID of the current IMessage instance. + */ + virtual int64_t getMessageId() const = 0; + /** + * Gets the message type. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMessageType() const = 0; + /** + * Sets the content of the text message, or the text description of the raw message. + * @param str The content of the text message, or the text description of the raw message. The maximum length + * is 32 KB. + */ + virtual void setText(const char *str) = 0; + /** + * Gets the content of the text messsage, or the text description of the raw message. + * @return + * - The content of the text message or the text description of the raw message. + */ + virtual const char *getText() const = 0; + /** + * Get pointer of custom raw message + * @return + * - The content of binary raw message + */ + virtual const unsigned char *getRawMessageData() const = 0; + /** + * Get length of custom raw message + * @return + * - The length of binary raw message in bytes + */ + virtual int getRawMessageLength() const = 0; + /** + * Set message type + */ + virtual void setMessageType(int32_t type) = 0; + /** + * Set raw binary message + */ + virtual void setRawMessage(const uint8_t* data, int length) = 0; + /** + * Releases the IMessage instance. + */ + virtual void release() = 0; +}; + +/** + * The IChannelMember class. + */ +class IChannelMember { + public: + virtual ~IChannelMember() {} + /** + * Gets the ID of the channel member. + * @return The ID of the channel member. + */ + virtual const char *getMemberId() const = 0; + /** + * Gets the ID of the channel. + * @return The ID of the channel. + */ + virtual const char *getChannelId() const = 0; + /** + * Releases the IChannelMember class. + */ + virtual void release() = 0; +}; +/** + * The IChannelAttributes class. + */ +class IChannelAttributes { + public: + /** + * Creates an IChannelAttributes instance. + * @return + * - An IChannelAttributes instance, if the method call succeeds. + */ + static IChannelAttributes *createChannelAttributes(); + /** + * Adds an attribute to a specified channel. + * + * @param key The pointer to the attribute key. + * @param value The pointer to the attribute value. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int addAttribute(const char *key, const char *value) = 0; + /** + * Removes an attribute from the channel. + * @param key The pointer to the attribute key. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeAttribute(const char *key) = 0; + /** + * Gets the size of the attributes. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getAttributesSize() const = 0; + /** + * Gets the channel attributes. + * @param size The size of the channel attributes. + * @param key The pointer to the key of each channel attribute. + * @param value The pointer to the value of each channel attribute. + */ + virtual void getAttributes(int size, char **key, + char **value) const = 0; // todo: discussion, how to traveral + /** + * Gets the value of a channel attribute using the attribute key. + * @param key The pointer to the key of the channel attribute that you want to get. + */ + virtual const char *getAttributeValue(const char *key) const = 0; + /** + * Releases the IChannelAttributes instance. + * @param + * - 0: Success. + * - < 0: Failure. + */ + virtual int release() = 0; +}; +/** + * The IChannelEventHandler class. + */ +class IChannelEventHandler { + public: + virtual ~IChannelEventHandler() {} + /** + * Occurs when the local user successfully joins a channel. + */ + virtual void onJoinSuccess() {} + /** + * Occurs when the local user fails to join a channel. + * @param errorCode The error code: #JOIN_CHANNEL_ERR. + */ + virtual void onJoinFailure(JOIN_CHANNEL_ERR errorCode) {} + /** + * Occurs when the local user leaves a channel. + * @param errorCode The error code. See #LEAVE_CHANNEL_ERR. + */ + virtual void onLeave(LEAVE_CHANNEL_ERR errorCode) {} + /** + * Occurs when the local user receives a channel message. + * @param message The pointer to the messsage: IMessage. + */ + virtual void onMessageReceived(const char *userId, const IMessage *message) {} + /** + * Reports the state of the message sent by the local user. + * @param messageId ID of the message. + * @param state The state of the message: #CHANNEL_MESSAGE_STATE. + */ + virtual void onSendMessageState(int64_t messageId, CHANNEL_MESSAGE_STATE state) {} + /** + Returns the result of the \ref agora::rtm::IChannel::sendMessage "sendMessage" method call. + + @param messageId The ID of the sent channel message. + @param state The error codes. See #CHANNEL_MESSAGE_ERR_CODE. + */ + virtual void onSendMessageResult(long long messageId, CHANNEL_MESSAGE_ERR_CODE state) {} + /** + * Occurs when another member joins the channel. + * @param member The pointer to the member who joins the channel: IChannelMember. + */ + virtual void onMemberJoined(IChannelMember *member) {} + /** + * Occurs when the other member leaves the channel. + * @param member The pointer to the member who leaves the channel: IChannelMember. + */ + virtual void onMemberLeft(IChannelMember *member) {} + /** + * Reports all the members in the channel. + * @param members The pointer to each member in the channel: IChannelMember. + * @param userCount The number of users in the channel. + */ + virtual void onMembersGotten(IChannelMember **members, int userCount) {} + /** + * Occurs when the channel attributes are updated. + * @param attributes The pointer to the current channel attributes: IChannelAttributes. + */ + virtual void onAttributesUpdated(const IChannelAttributes *attributes) {} + /** + * Occurs when the local user calls updateAttributes(). + * @param requestId ID of the current attribute update request. + * @param resCode The response code: #RESPONSE_CODE. + */ + virtual void onUpdateAttributesResponse(int64_t requestId, RESPONSE_CODE resCode) {} + /** + * Occurs when the channel attributes are deleted. + * @param attributes The pointer to the channel attributes that you want to remove: IChannelAttributes. + */ + virtual void onAttributesDeleted(const IChannelAttributes *attributes) {} + /** + * Occurs when the local user calls deleteAttributes(). + * @param requestId ID of the current attribute delete request. + * @param resCode The response code: #RESPONSE_CODE. + */ + virtual void onDeleteAttributesResponse(int64_t requestId, RESPONSE_CODE resCode) {} +}; +/** + * The IChannel class. + */ +class IChannel { + public: + /** + * Sets an event handler for IChannel. + * @param eventHandler The pointer to the event handler of IChannel: IChannelEventHandler. + */ + virtual void setEventHandler(IChannelEventHandler *eventHandler) = 0; + /** + * Joins the current channel. + * + * A successful method call triggers either onJoinSuccess() or onJoinFailure() on the local client, to report + * the state of joining the channel. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int join() = 0; + /** + * Leaves the current channel. + * + * After the local user successfully leaves the channel, the SDK triggers the onLeave() on the local client. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int leave() = 0; + /** + * Sends a channel message. + * + * After you successfully send a channel message, all members in the channel receive the message in the + * onMessageReceived() callback. + * @param message The pointer to the channel message that you want to send: IMessage. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendMessage(const IMessage *message) = 0; + /** + * Updates the channel attributes. + * + * A successful method call triggers the onUpdateAttributesResponse() callback on the local client. + * @param attributes The pointer to the channel attributes that you want to update: IChannelAttributes. + * @param requestId ID of the current update request. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateAttributes(IChannelAttributes *attributes, int64_t &requestId) = 0; + /** + * Removes the channel attributes. + * + * A successful method call triggers the onDeleteAttributesResponse() callback on the local client. + * @param attributes The pointer to the channel attributes that you want to remove: IChannelAttributes. + * @param requestId ID of the current delete request. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int deleteAttributes(IChannelAttributes *attributes, int64_t &requestId) = 0; + /** + * Gets the current request ID. + * @return + * - The pointer to the request ID, if the method call succeeds. + * - An empty pointer NULL, if the method call fails. + */ + virtual const char *getId() const = 0; + + // sync_call + /** + * Releases the IChannel instance. + * + * This is a synchronous method call, which means that the SDK reports the result of this method call + * after the IChannel instance is successfully released. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int release() = 0; +}; +/** + * The IRtmServiceEventHandler class. + */ +class IRtmServiceEventHandler { + public: + virtual ~IRtmServiceEventHandler() {} + + /** + * Occurs when the user successfully logs in the RTM service. + */ + virtual void onLoginSuccess() {} + /** + * Occurs when the user fails to log in the RTM service. + * @param errorCode The reason for the login failure: #LOGIN_ERR_CODE. + */ + virtual void onLoginFailure(LOGIN_ERR_CODE errorCode) {} + /** + * Occurs when the user successfully logs out of the RTM service. + */ + virtual void onLogout() {} + /** + * Occurs when the connection state of the local user has changed. + * @param state The current connection state: #CONNECTION_STATE. + */ + virtual void onConnectionStateChanged(CONNECTION_STATE state) {} + /** + * Reports the state of sending a message. + * @param messageId ID of the message. + * @param state The current state of the message: #PEER_MESSAGE_STATE. + */ + virtual void onSendMessageState(int64_t messageId, PEER_MESSAGE_STATE state) {} + /** + * Occurs when the local user receives a message from a remote user. + * @param peerId ID of the remote user that sends the message. + * @param message The pointer to the message: IMessage. + */ + virtual void onMessageReceivedFromPeer(const char *peerId, const IMessage *message) {} +}; +/** + * The IRtmService class. + */ +class IRtmService { + public: + virtual ~IRtmService() {} + /** + * Creates and gets an IRtmService instance. + * @param appId The pointer to the app ID. + * @param eventHandler The pointer to the IRtmServiceEventHandler object. + * @param eventSpace The connection specific ID, used during report to argus. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initialize(const char *appId, IRtmServiceEventHandler *eventHandler) = 0; + /** + * Releases the IRtmServiceEventHandler object. + * @param eventHandler The pointer to the IRtmServiceEventHandler object. + */ + virtual void unregisterObserver(IRtmServiceEventHandler *eventHandler) = 0; + /** + * Releases the IRtmService instance. + * @param sync Determines whether to report the result of this method call synchronously. + * - true: Report the result of this method call after the IRtmService instance is released. + * - false: (Default) Report the result of this method call immediately, even when the IRtmService is not + * released. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int release(bool sync = false) = 0; + /** + * Logs in the RTM service. + * + * @note + * - If you login with the same user ID from a different instance, your previous login will be kicked. + * - The call frequency limit of this method is 2 queries per second. + * @param token The token used to log in the RTM service. + * @param userId ID of the user logging in the RTM service. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int login(const char *token, const char *userId) = 0; + /** + * Logs out of the RTM service. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int logout() = 0; + /** + * Sends a peer message to a specified remote user. + * + * @param peerId The pointer to the ID of the remote user. + * @param message The pointer to message: IMessage. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendMessageToPeer(const char *peerId, const IMessage *message) = 0; + /** + * Creates an RTM channel. + * + * @param channelId The unique channel name for an RTM session. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", + * ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", "," + * + * @param eventHandler The pointer to IChannelEventHandler. + * @return + * - The pointer to an IChannel instance, if the method call succeeds. + * - An empty pointer NULL, if the method call fails. + */ + virtual IChannel *createChannel(const char *channelId, IChannelEventHandler *eventHandler) = 0; +}; + +} // namespace rtm +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtmpStreamingService.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtmpStreamingService.h new file mode 100644 index 0000000..59736d4 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraRtmpStreamingService.h @@ -0,0 +1,192 @@ + +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" +#include "IAgoraService.h" +#include "NGIAgoraRtcConnection.h" + +namespace agora { +namespace rtc { + +/** + * The events in the RTMP channel. +*/ +enum RTMP_CHANNEL_EVENT +{ + /** + * 0: The live stream service is disconnected. + */ + RTMP_CHANNEL_EVENT_DISCONNECT = 0, + /** + * 1: The live stream service has left the channel. + */ + RTMP_CHANNEL_EVENT_LEAVE_CHANNEL = 1, + /** + * 2: The live stream service is banned by the server. + */ + RTMP_CHANNEL_EVENT_BANNED_BY_SERVER = 2 +}; +/** + * The IRtmpStreamingObserver class, which monitors events in of the live streaming service. + */ +class IRtmpStreamingObserver { +public: + /** + * Occurs when the state of the RTMP streaming changes. + * + * The SDK triggers this callback to report the result of the local user calling + * `addPublishStreamUrl` or `removePublishStreamUrl`. + * + * This callback also reports the streaming URL and its current streaming state. When exceptions + * occur, you can troubleshoot issues by referring to the detailed error description in the `errCode` + * parameter. + * + * @param url The RTMP URL address. + * @param state The RTMP streaming state: #RTMP_STREAM_PUBLISH_STATE. + * @param errCode The detailed error information for streaming: #RTMP_STREAM_PUBLISH_ERROR_TYPE. + */ + virtual void onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, + RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) { + (void)url; + (void)state; + (void)errCode; + } + + /** Reports events during the RTMP or RTMPS streaming. + * + * @since v3.1.0 + * + * @param url The RTMP or RTMPS streaming URL. + * @param eventCode The event code. See #RTMP_STREAMING_EVENT + */ + virtual void onRtmpStreamingEvent(const char* url, RTMP_STREAMING_EVENT eventCode) { + (void)url; + (void)eventCode; + } + /** + * Occurs when the publisher's transcoding settings are updated. + * + * When the `LiveTranscoding` class in the `setLiveTransocding` method updates, the SDK triggers this callback + * to report the update information. + * + * @note + * If you call the `setLiveTranscoding` method to set the `LiveTranscoding` class for the first time, the SDK + * does not trigger this callback. + */ + virtual void onTranscodingUpdated() {} +}; +/** + * The IRtmpStreamingService class, which enables the live stream service. + */ +class IRtmpStreamingService : public RefCountInterface { + public: + + /** Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.) + + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback. + + * The \ref agora::rtc::IRtcEngine::startRtmpStreamWithoutTranscoding "startRtmpStreamWithoutTranscoding" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN. + * @note + * - Ensure that the user joins the channel before calling this method. + * - This method adds only one stream RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ + virtual int startRtmpStreamWithoutTranscoding(const char* url) = 0; + + /** Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.) + + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamPublished "onStreamPublished" callback. + + * The \ref agora::rtc::IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of adding a local stream to the CDN. + * @note + * - Ensure that the user joins the channel before calling this method. + * - This method adds only one stream RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + + * @return + * - 0: Success. + * - < 0: Failure. + * - #ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0. + * - #ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream. + * - #ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming. + */ + virtual int startRtmpStreamWithTranscoding(const char* url, const LiveTranscoding& transcoding) = 0; + + /** Update the video layout and audio settings for CDN live. (CDN live only.) + * @note This method applies to Live Broadcast only. + + * @param transcoding Sets the CDN live audio/video transcoding settings. See LiveTranscoding. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int updateRtmpTranscoding(const LiveTranscoding& transcoding) = 0; + /** Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.) + + * This method removes the RTMP URL address (added by the \ref IRtcEngine::startRtmpStreamWithoutTranscoding "startRtmpStreamWithoutTranscoding" method + * or IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method) from a CDN live stream. + * The SDK returns the result of this method call in the \ref IRtcEngineEventHandler::onStreamUnpublished "onStreamUnpublished" callback. + + * The \ref agora::rtc::IRtcEngine::stopRtmpStream "stopRtmpStream" method call triggers the \ref agora::rtc::IRtcEngineEventHandler::onRtmpStreamingStateChanged "onRtmpStreamingStateChanged" callback on the local client to report the state of removing an RTMP stream from the CDN. + * @note + * - This method removes only one RTMP URL address each time it is called. + * - The RTMP URL address must not contain special characters, such as Chinese language characters. + * - This method applies to Live Broadcast only. + + * @param url The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes. + + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRtmpStream(const char* url) = 0; + + /** + * Registers an RTMP streaming observer. + * @param observer The pointer to an RTMP streaming observer. See \ref agora::rtc::IRtmpStreamingObserver "IRtmpStreamingObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerObserver(IRtmpStreamingObserver* observer) = 0; + /** + * Releases the RTMP streaming observer created by registerObserver(). + * @param observer The pointer to the RTMP streaming observer that you want to release. See \ref agora::rtc::IRtmpStreamingObserver "IRtmpStreamingObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterObserver(IRtmpStreamingObserver* observer) = 0; + + protected: + ~IRtmpStreamingService() {} +}; + + + + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraService.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraService.h new file mode 100644 index 0000000..6873eaf --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraService.h @@ -0,0 +1,968 @@ +// Agora SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "IAgoraLog.h" +#include "AgoraBase.h" +#include "AgoraOptional.h" + +namespace agora { +namespace rtc { +class IRtcConnection; +class IRtmpConnection; +class ILocalUser; +class IMediaDeviceManager; +class INGAudioDeviceManager; +struct TConnectionInfo; +struct RtcConnectionConfiguration; +struct RtmpConnectionConfiguration; +class ILocalAudioTrack; +class IMediaPlayerSource; +class IMediaStreamingSource; +class ICameraCapturer; +class IScreenCapturer; +class IScreenCapturer2; +class IAudioPcmDataSender; +class IAudioEncodedFrameSender; +class IVideoFrameSender; +class IVideoEncodedImageSender; +class IVideoSourceNode; +class IVideoMixerSource; +class IVideoFrameTransceiver; +class ILocalVideoTrack; +class IMediaNodeFactory; +class IRecordingDeviceSource; +class IRemoteAudioMixerSource; +class IRtmpStreamingService; +class IMediaPacketSender; +class IMediaRelayService; +class IAudioDeviceManager; +class IAudioDeviceManagerObserver; + +class IMediaExtensionObserver; +class IExtensionProvider; +class IFileUploaderService; +/** + * The audio encoder configuration. + */ +struct AudioEncoderConfiguration { + /** + * The audio profile: #AUDIO_PROFILE_TYPE + */ + AUDIO_PROFILE_TYPE audioProfile; + + AudioEncoderConfiguration() : audioProfile(AUDIO_PROFILE_DEFAULT) {} +}; + +} // namespace rtc + +namespace rtm { +class IRtmService; +} + +namespace base { +class IServiceObserver; + +/** + * The global configurations for \ref agora::base::IAgoraService "AgoraService". + * + * Set these configurations when calling \ref agora::base::IAgoraService::initialize "initialize". + */ +struct AgoraServiceConfiguration { + /** + * Whether to enable the audio processing module. + * - `true`: (Default) Enable the audio processing module. + * - `false`: Disable the audio processing module. If you disable the audio processing module, you cannot create audio tracks. + */ + bool enableAudioProcessor; + /** + * Whether to enable the audio device module. The function of the audio device module is to manage audio devices, + * such as recording and playing audio. + * - `true`: (Default) Enable the audio device module. Audio recording and playback is available. + * - `false`: Disable the audio device module. Audio recording and playback is unavailable. + * + * @note + * If you set `enableAudioDevice` as `false` and set `enableAudioProcessor` as `true`, you cannot use audio devices, + * but you can push PCM audio data. + */ + bool enableAudioDevice; + /** + * Whether to enable video. + * - `true`: Enable video. + * - `false`: (Default) Disable video. + */ + bool enableVideo; + /** + * The user context. + * - For Windows, it is the handle of the window that loads the video. Specify this value to support plugging or unplugging the video devices while the host is powered on. + * - For Android, it is the context of activity. + */ + void* context; + /** + * The App ID of your project. + */ + const char* appId; + + /** + * The supported area code, default is AREA_CODE_GLOB + */ + unsigned int areaCode; + + /** The channel profile. For details, see \ref agora::CHANNEL_PROFILE_TYPE "CHANNEL_PROFILE_TYPE". The default channel profile is `CHANNEL_PROFILE_LIVE_BROADCASTING`. + */ + agora::CHANNEL_PROFILE_TYPE channelProfile; + + /** + * The license used for verification when connectting channel. Charge according to the license + */ + const char* license; + + /** + * The audio scenario. See \ref agora::rtc::AUDIO_SCENARIO_TYPE "AUDIO_SCENARIO_TYPE". The default value is `AUDIO_SCENARIO_DEFAULT`. + */ + rtc::AUDIO_SCENARIO_TYPE audioScenario; + /** + * The config for custumer set log path, log size and log level. + */ + commons::LogConfig logConfig; + /** + * Whether to enable string uid. + */ + bool useStringUid; + /** + * The service observer. + */ + IServiceObserver* serviceObserver; + + /** + * Thread priority for SDK common threads + */ + Optional threadPriority; + /** + * Whether use egl context in current thread as sdk‘s root egl context + * which shared by all egl related modules. eg. camera capture, video renderer. + * @note + * This property applies to Android only. + */ + bool useExternalEglContext; + + /** + * Determines whether to enable domain limit. + * - `true`: only connect to servers that already parsed by DNS + * - `false`: (Default) connect to servers with no limit + */ + bool domainLimit; + + AgoraServiceConfiguration() : enableAudioProcessor(true), + enableAudioDevice(true), + enableVideo(false), + context(NULL), + appId(NULL), + areaCode(rtc::AREA_CODE_GLOB), + channelProfile(agora::CHANNEL_PROFILE_LIVE_BROADCASTING), + license(NULL), + audioScenario(rtc::AUDIO_SCENARIO_DEFAULT), + useStringUid(false), + serviceObserver(NULL), + useExternalEglContext(false), + domainLimit(false){} +}; +/** + * The audio session configurations. + * + * Set these configurations when calling \ref agora::base::IAgoraService::setAudioSessionConfiguration "setAudioSessionConfiguration". + */ +struct AudioSessionConfiguration { + /** + * Whether to enable audio input (recording) and audio output (playback): + * - `true`: Enable audio recording and playback. + * - `false`: Disable audio recording and playback, which prevents audio input + * and output. + * + * @note + * - For the recording function to work, the user must grant permission for audio recording. + * - By default, the audio of your app is nonmixable, which means + * activating audio sessions in your app interrupts other nonmixable audio sessions. + * Set `allowMixWithOthers` as `true` to allow audio mixing. + */ + Optional playbackAndRecord; + /** + * Whether to enable chat mode: + * - `true`: Enable chat mode. This mode is for apps that are engaged in two-way + * real-time communication, such as a voice or video chat. + * - `false`: Disable chat mode. + * + * For a video chat, set this member as `true` and set the audio route to the speaker. + */ + Optional chatMode; + /** + * Whether the audio defaults to the built-in speaker: + * - `true`: The audio defaults to the built-in speaker. + * - `false`: The audio does not default to the built-in speaker. + * + * @note + * This member is available only when `playbackAndRecord` is set as `true`. + */ + Optional defaultToSpeaker; + /** + * Whether to temporarily change the current audio route to the built-in speaker: + * - `true`: Set the current audio route to the built-in speaker. + * - `false`: Do not set the current audio route to the built-in speaker. + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional overrideSpeaker; + /** + * Whether to mix the audio from this session with the audio from active audio sessions in other apps. + * - `true`: Mix the audio sessions. + * - `false`: Do not mix the audio session. + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional allowMixWithOthers; + /** + * Whether to duck the audio from this session with the audio from active audio sessions in other apps. + * - `true`: Duck the audio sessions. + * - `false`: Do not duck the audio session. + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional allowDuckOthers; + /** + * Whether to allow Bluetooth handsfree devices to appear as available audio input + * devices: + * - `true`: Allow Bluetooth handsfree devices to appear as available audio input routes. + * - `false`: Do not allow Bluetooth handsfree devices to appear as available audio input + * routes. + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional allowBluetooth; + /** + * Whether to allow the audio from this session to be routed to Bluetooth + * devices that support the Advanced Audio Distribution Profile (A2DP). + * - `true`: Allow the audio from this session to be routed to Bluetooth devices that + * support the Advanced Audio Distribution Profile (A2DP). + * - `false`: Do not allow the audio from this session to be routed to Bluetooth devices that + * support the Advanced Audio Distribution Profile (A2DP). + * + * @note + * This member is available only when the `playbackAndRecord` member is set as `true`. + */ + Optional allowBluetoothA2DP; + /** + * The expected audio sample rate (kHz) of this session. + * + * The value range is [8,48]. The actual sample rate may differ based on the audio sampling + * device in use. + */ + Optional sampleRate; + /** + * The expected input and output buffer duration (ms) of this session. + * + * The value range is [0,93]. The actual I/O buffer duration might be lower + * than the set value based on the hardware in use. + */ + Optional ioBufferDuration; + /** + * The expected number of input audio channels of this session. + */ + Optional inputNumberOfChannels; + /** + * The expected number of output audio channels of this session. + */ + Optional outputNumberOfChannels; + /** + * Initialize the AudioSession with the value for category. (iOS only) + */ + Optional category; + + void SetAll(const AudioSessionConfiguration& change) { + SetFrom(&playbackAndRecord, change.playbackAndRecord); + SetFrom(&chatMode, change.chatMode); + SetFrom(&defaultToSpeaker, change.defaultToSpeaker); + SetFrom(&overrideSpeaker, change.overrideSpeaker); + SetFrom(&allowMixWithOthers, change.allowMixWithOthers); + SetFrom(&allowDuckOthers, change.allowDuckOthers); + SetFrom(&allowBluetooth, change.allowBluetooth); + SetFrom(&allowBluetoothA2DP, change.allowBluetoothA2DP); + SetFrom(&sampleRate, change.sampleRate); + SetFrom(&ioBufferDuration, change.ioBufferDuration); + SetFrom(&inputNumberOfChannels, change.inputNumberOfChannels); + SetFrom(&outputNumberOfChannels, change.outputNumberOfChannels); + SetFrom(&category, change.category); + } + + bool operator==(const AudioSessionConfiguration& o) const { + return playbackAndRecord == o.playbackAndRecord && chatMode == o.chatMode && + defaultToSpeaker == o.defaultToSpeaker && overrideSpeaker == o.overrideSpeaker && + allowMixWithOthers == o.allowMixWithOthers && allowDuckOthers == o.allowDuckOthers && + allowBluetooth == o.allowBluetooth && allowBluetoothA2DP == o.allowBluetoothA2DP && sampleRate == o.sampleRate && + ioBufferDuration == o.ioBufferDuration && + inputNumberOfChannels == o.inputNumberOfChannels && + outputNumberOfChannels == o.outputNumberOfChannels && + category == o.category; + } + bool operator!=(const AudioSessionConfiguration& o) const { return !(*this == o); } + + private: + template + static void SetFrom(Optional* s, const Optional& o) { + if (o) { + *s = o; + } + } +}; +/** + * The audio mixing mode. + */ +enum TMixMode { + /** + * Mix all the local audio tracks in the channel. + */ + MIX_ENABLED, + /** + * Do not mix the local audio tracks in the channel. + */ + MIX_DISABLED, +}; + +/** + * The IServiceObserver class. + */ +class IServiceObserver { +public: + virtual ~IServiceObserver() {} + + /** + * Reports the permission error. + * @param permission {@link PERMISSION} + */ + virtual void onPermissionError(agora::rtc::PERMISSION_TYPE permissionType) {} + /** + * Reports the audio device error. + * @param error {@link ERROR_CODE_TYPE} + */ + virtual void onAudioDeviceError(ERROR_CODE_TYPE error, const char* description) {} +}; + +/** + * The IAgoraService class. + * + * `IAgoraService` is the entry point of Agora low-level APIs. Use this interface to + * create access points to Agora interfaces, including RTC connections and media tracks. + * + * You can create an `IAgoraService` object by calling \ref agora::base::IAgoraService::createAgoraService "createAgoraService". + * + * You can configure the `IAgoraService` object for different user scenarios on the global level by using `AgoraServiceConfiguration`. + */ +class IAgoraService { + public: + /** + * Initializes the \ref agora::base::IAgoraService "AgoraService" object. + * + * @param config The configuration of the initialization. For details, see \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + * @return + * - 0: Success. + * - < 0: Failure. + * - `ERR_INVALID_ARGUMENT`, if `context` in `AgoraServiceConfiguration` is not provided for + * Android. + * - `ERR_INIT_NET_ENGINE`, if the network engine cannot be initialized. On Windows, the error occurs mostly because the connection to the local port is disabled by the firewall. In this case, turn off the firewall and then turn it on again. + */ + virtual int initialize(const AgoraServiceConfiguration& config) = 0; + + /** + * Flush log & cache before exit + */ + virtual void atExit() = 0; + + /** + * Releases the \ref agora::base::IAgoraService "AgoraService" object. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int release() = 0; + + /** + * Configures the preset audio scenario. + * + * @param scenario The preset audio scenario: \ref agora::rtc::AUDIO_SCENARIO_TYPE + * "AUDIO_SCENARIO_TYPE". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioSessionPreset(agora::rtc::AUDIO_SCENARIO_TYPE scenario) = 0; + + /** + * Customizes the audio session configuration. + * + * @param config The reference to the audio session configuration: \ref agora::base::AudioSessionConfiguration "AudioSessionConfiguration". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioSessionConfiguration(const AudioSessionConfiguration& config) = 0; + + /** + * Gets the audio session configuration. + * + * @param [out] config The pointer to the audio session configuration: \ref agora::base::AudioSessionConfiguration "AudioSessionConfiguration". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getAudioSessionConfiguration(AudioSessionConfiguration* config) = 0; + + /** + * Sets the path and size of the SDK log files. + * + * The SDK records all the log data during the SDK runtime in two log files, + * each with a default size of 512 KB. If you set `fileSize` as 1024 KB, + * the SDK outputs log files with a maximum size of 2 MB. If the total size + * of the log files exceeds the set value, the new output log + * overwrites the old output log. + * + * @note + * To ensure that the output log is complete, call this method immediately after calling + * \ref agora::base::IAgoraService::initialize "initialize". + * + * @param filePath The pointer to the log file. Ensure that the directory of the log file exists and is writable. + * @param fileSize The size of the SDK log file size (KB). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFile(const char* filePath, unsigned int fileSize) = 0; + /** + * Sets the SDK log output filter. + * + * The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. + * + * Select a level to output the logs in and above the selected level. + * For example, if you set the log level to WARNING, you can see the logs in the levels of CRITICAL, ERROR, and WARNING. + * + * @param filters The log output filter. + * - `LOG_LEVEL_NONE (0x0000)`: Do not output any log file. + * - `LOG_LEVEL_INFO (0x0001)`: (Recommended) Output log files of the INFO level. + * - `LOG_LEVEL_WARN (0x0002)`: Output log files of the WARN level. + * - `LOG_LEVEL_ERROR (0x0004)`: Output log files of the ERROR level. + * - `LOG_LEVEL_FATAL (0x0008)`: Output log files of the FATAL level. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLogFilter(unsigned int filters) = 0; + + /** + * Creates an \ref agora::rtc::IRtcConnection "RtcConnection" object and returns the pointer. + * + * @param cfg The reference to the RTC connection configuration: \ref agora::rtc::RtcConnectionConfiguration "RtcConnectionConfiguration". + * @return + * - The pointer to \ref rtc::IRtcConnection "IRtcConnection": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createRtcConnection( + const rtc::RtcConnectionConfiguration& cfg) = 0; + + virtual agora_refptr createRtmpConnection( + const rtc::RtmpConnectionConfiguration& cfg) = 0; + + /** + * Creates a local audio track object and returns the pointer. + * + * By default, the audio track is created from the selected audio input device, such as + * the built-in microphone on a mobile device. + * + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createLocalAudioTrack() = 0; + + /** + * Creates a local mixed audio track object and returns the pointer. + * + * By default, the audio track is created from mix source, which could mixed target track. + * + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createLocalMixedAudioTrack() = 0; + + /** + * Creates a local audio track object with a PCM data sender and returns the pointer. + * + * Once created, this track can be used to send PCM audio data. + * + * @param audioSource The pointer to the PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr audioSource) = 0; + + /** + * Creates a local audio track object with a PCM data sender and returns the pointer. + * The source is not intended to be mixed with other source. + * + * Once created, this track can be used to send PCM audio data. + * + * @param audioSource The pointer to the PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createDirectCustomAudioTrack( + agora_refptr audioSource) = 0; + + /** + * Creates a local audio track object with a PCM data sender and returns the pointer. + * + * Once created, this track can be used to send PCM audio data. + * + * @param audioSource The pointer to the PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @param enableAec Whether enable audio echo cancellation for PCM audio data. + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr audioSource, bool enableAec) = 0; + + /** + * Creates a local audio track object with two PCM data sender and returns the pointer. + * + * Once created, this track can be used to send PCM audio data with echo cancellation. + * + * @param audioSource The pointer to the recording PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @param audioReverseSource The pointer to the playout PCM audio data sender: \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender". + * @param audioSourceDelay The delay of recording pcm data when do echo cancellation. + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration" is set as `false`. + */ + virtual agora_refptr createCustomAudioTrack(agora_refptr audioSource, + agora_refptr audioReverseSource, + int audioSourceDelay) = 0; + + /** + * Creates a local audio track object with a audio mixer source and returns the pointer. + * + * Once created, this track can be used to send PCM audio data. + * + * @param audioSource The pointer to the audio mixer source : \ref agora::rtc::IRemoteAudioMixerSource "IRemoteAudioMixerSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack", if the method call succeeds. + * - A null pointer, if the method call fails. + * - `INVALID_STATE`, if `enableAudioProcessor` in `AgoraServiceConfiguration` is set as `false`. + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr audioSource) = 0; + + /** + * Creates a local audio track object with an encoded audio frame sender and returns the pointer. + * + * Once created, this track can be used to send encoded audio frames, such as Opus frames. + * + * @param audioSource The pointer to the encoded audio frame sender: \ref agora::rtc::IAudioEncodedFrameSender "IAudioEncoderFrameSender". + * @param mixMode The mixing mode of the encoded audio in the channel: #TMixMode. + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr audioSource, TMixMode mixMode) = 0; +/// @cond (!Linux) + /** + * Creates a local audio track object with a media packet sender and returns the pointer. + * + * Once created, this track can be used to send audio packets, such as customized UDP/RTP packets. + * + * @param source The pointer to the media packet sender: \ref agora::rtc::IMediaPacketSender "IMediaPacketSender". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + */ + virtual agora_refptr createCustomAudioTrack( + agora_refptr source) = 0; + /// @endcond + /** + * Creates a local audio track object with an IMediaPlayerSource object and returns the pointer. + * + * Once created, this track can be used to send PCM audio data decoded from a media player. + * + * @param audioSource The pointer to the player source. See \ref agora::rtc::IMediaPlayerSource "IMediaPlayerSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + */ + virtual agora_refptr createMediaPlayerAudioTrack( + agora_refptr audioSource) = 0; + + /** + * Creates a local audio track object with an IMediaStreamingSource object and returns the pointer. + * + * Once created, this track can be used to send encoded audio data which demuxed from a media streaming. + * + * @param streamingSource The pointer to the streaming source. See \ref agora::rtc::IMediaStreamingSource "IMediaStreamingSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + * - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in \ref agora::base::AgoraServiceConfiguration "AgoraServiceConfiguration". + */ + virtual agora_refptr createMediaStreamingAudioTrack( + agora_refptr streamingSource) = 0; + + /** + * Creates a local audio track object with the recording device source and returns the pointer. + * + * Once created, this track can be used to send audio data got from a recording device. + * @param audioSource The pointer to the recording device source. See \ref agora::rtc::IRecordingDeviceSource "IRecordingDeviceSource". + * @param enableAec Whether enable audio echo cancellation for loopback recording. If loopback + * recording device is a virtual sound card, it should be false, or it should be true. + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createRecordingDeviceAudioTrack( + agora_refptr audioSource, bool enableAec) = 0; + + /** + * Creates an audio device manager object and returns the pointer. + * + * @return + * - The pointer to \ref rtc::INGAudioDeviceManager "INGAudioDeviceManager": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioDeviceManager() = 0; + + /** + * Creates a media node factory object and returns the pointer. + * + * @return + * - The pointer to \ref rtc::IMediaNodeFactory "IMediaNodeFactory": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaNodeFactory() = 0; + + /** + * Creates a local video track object with a camera capturer and returns the pointer. + * + * Once created, this track can be used to send video data captured by the camera. + * + * @param videoSource The pointer to the camera capturer: \ref agora::rtc::ICameraCapturer "ICameraCapturer". + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCameraVideoTrack( + agora_refptr videoSource, const char* id = OPTIONAL_NULLPTR) = 0; + + /** + * Creates a local video track object with a screen capturer and returns the pointer. + * + * Once created, this track can be used to send video data for screen sharing. + * + * @param videoSource The pointer to the screen capturer: \ref agora::rtc::IScreenCapturer "IScreenCapturer". + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenVideoTrack( + agora_refptr videoSource, const char* id = OPTIONAL_NULLPTR) = 0; + + /** + * Creates a local video track object with a video mixer and returns the pointer. + * + * Once created, this track can be used to send video data processed by the video mixer. + * + * @param videoSource The pointer to the video mixer. See \ref agora::rtc::IVideoMixerSource "IVideoMixerSource". + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createMixedVideoTrack(agora_refptr videoSource, + const char* id = OPTIONAL_NULLPTR) = 0; + + /** + * Creates a local video track object with a video frame transceiver and returns the pointer. + * + * Once created, this track can be used to send video data processed by the transceiver. + * + * @param transceiver The pointer to the video transceiver. See \ref agora::rtc::IVideoFrameTransceiver "IVideoFrameTransceiver". + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createTranscodedVideoTrack(agora_refptr transceiver, + const char* id = OPTIONAL_NULLPTR) = 0; + +/// @cond (!RTSA) + /** + * Creates a local video track object with a customized video source and returns the pointer. + * + * Once created, this track can be used to send video data from a customized source. + * + * @param videoSource The pointer to the customized video frame sender: \ref agora::rtc::IVideoFrameSender "IVideoFrameSender". + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCustomVideoTrack( + agora_refptr videoSource, const char* id = OPTIONAL_NULLPTR) = 0; +/// @endcond + + /** + * Creates a local video track object with an encoded video image sender and returns the pointer. + * + * Once created, this track can be used to send encoded video images, such as H.264 or VP8 frames. + * + * @param videoSource The pointer to the encoded video frame sender. See \ref agora::rtc::IVideoEncodedImageSender "IVideoEncodedImageSender". + * @param options The configuration for creating video encoded image track. + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCustomVideoTrack( + agora_refptr videoSource, + const rtc::SenderOptions& options, + const char* id = OPTIONAL_NULLPTR) = 0; + +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + /** + * Creates a local video track object with a screen capture source extension and returns the pointer. + * + * Once created, this track can be used to work with the screen capture extension. + * + * @param screen The pointer to the screen capture source. + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCaptureVideoTrack( + agora_refptr screen) = 0; + +/** + * Creates a local audio track object with a screen capture source extension and returns the pointer. + * + * Once created, this track can be used to work with the screen capture extension. + * + * @param screen The pointer to the screen capture source. + * + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCaptureAudioTrack( + agora_refptr screen) = 0; +#else + /** + * Creates a local video track object with a screen capture source extension and returns the pointer. + * + * Once created, this track can be used to work with the screen capture extension. + * + * @param screen The pointer to the screen capture source. + * + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCaptureVideoTrack( + agora_refptr screen, const char* id = OPTIONAL_NULLPTR) = 0; +#endif + +/// @cond (!Linux) + /** + * Creates a local video track object with a media packet sender and returns the pointer. + * + * Once created, this track can be used to send video packets, such as customized UDP/RTP packets. + * + * @param source The pointer to the media packet sender: \ref agora::rtc::IMediaPacketSender "IMediaPacketSender". + * @return + * - The pointer to \ref rtc::ILocalVideoTrack "ILocalVideoTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCustomVideoTrack( + agora_refptr source, const char* id = OPTIONAL_NULLPTR) = 0; +/// @endcond + /** + * Creates a local video track object with an IMediaPlayerSource object and returns the pointer. + * + * Once created, this track can be used to send YUV frames decoded from a player. + * + * @param videoSource The pointer to the player source. See \ref agora::rtc::IMediaPlayerSource "IMediaPlayerSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaPlayerVideoTrack( + agora_refptr videoSource, const char* id = OPTIONAL_NULLPTR) = 0; + + /** + * Creates a local video track object with an IMediaStreamingSource object and returns the pointer. + * + * Once created, this track can be used to send H264 frames which demuxed from a streaming. + * + * @param streamingSource The pointer to the player source. See \ref agora::rtc::IMediaStreamingSource "IMediaStreamingSource". + * @return + * - The pointer to \ref rtc::ILocalAudioTrack "ILocalAudioTrack": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaStreamingVideoTrack( + agora_refptr streamingSource, const char* id = OPTIONAL_NULLPTR) = 0; + + + /** + * Creates an RTMP streaming service object and returns the pointer. + * + * @param rtcConnection The pointer to \ref rtc::IRtcConnection "IRtcConnection". + * @param appId The App ID of the live streaming service. + * @return + * - The pointer to \ref rtc::IRtmpStreamingService "IRtmpStreamingService": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createRtmpStreamingService( + agora_refptr rtcConnection, const char* appId) = 0; + + /** + * Creates an Media Relay service object and returns the pointer. + * + * @param rtcConnection The pointer to \ref rtc::IRtcConnection "IRtcConnection". + * @param appId The App ID of the media relay service. + * @return + * - The pointer to \ref rtc::IMediaRelayService "IMediaRelayService", if the method call + * succeeds. + * - A null pointer, if the method call fails. + */ + virtual agora_refptr createMediaRelayService( + agora_refptr rtcConnection, const char* appId) = 0; + + /** + * Creates an file upload object and returns the pointer. + * + * @param rtcConnection The pointer to \ref rtc::IRtcConnection "IRtcConnection". + * @param appId The App ID of the media relay service. + * @return + * - The pointer to \ref rtc::IFileUploaderService "IFileUploaderService", if the method call + * succeeds. + * - A null pointer, if the method call fails. + */ + virtual agora_refptr createFileUploadService( + agora_refptr rtcConnection, const char* appId) = 0; + + /** + * Creates an RTM servive object and returns the pointer. + * + * @return + * - The pointer to \ref rtm::IRtmService "IRtmService": Success. + * - A null pointer: Failure. + */ + virtual rtm::IRtmService* createRtmService() = 0; + + virtual int addExtensionObserver(agora::agora_refptr observer) = 0; + + virtual int removeExtensionObserver(agora::agora_refptr observer) = 0; + + /** + * Creates an audio device manager and returns the pointer. + * + * @return + * - The pointer to \ref rtc::IAudioDeviceManager "IAudioDeviceManager": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioDeviceManagerComponent( + rtc::IAudioDeviceManagerObserver *observer) = 0; + /** + * @brief Get the ID of the registered extension + * + * @param provider_name The pointer to provider name string (null-terminated) + * @param extension_name The pointer to extension name string (null-terminated) + * @return + * - Pointer to the extension id string (null-terminated). The pointer will be valid during service's lifetime + */ + virtual const char* getExtensionId(const char* provider_name, const char* extension_name) = 0; + +#if defined (_WIN32) || defined(__linux__) || defined(__ANDROID__) + /** + * @brief load the dynamic library of the extension + * + * @param path path of the extension library + * @param unload_after_use unload the library when engine release + * @return int + */ + virtual int loadExtensionProvider(const char* path, bool unload_after_use = false) = 0; +#endif + /** + * Enable extension. + * If the extension is enabled, the track loads the extension automatically. + * + * @param provider_name name for provider, e.g. agora.io. + * @param extension_name name for extension, e.g. agora.beauty. + * @param track_id id for the track, OPTIONAL_NULLPTR means effective on all tracks + * @param auto_enable_on_track if the extension is automatically open on track. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableExtension( + const char* provider_name, const char* extension_name, const char* track_id = NULL, + bool auto_enable_on_track = false) = 0; + /** + * Disable extension. + * + * @param provider_name name for provider, e.g. agora.io. + * @param extension_name name for extension, e.g. agora.beauty. + * @param track_id id for the track, OPTIONAL_NULLPTR means effective on all tracks + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableExtension( + const char* provider_name, const char* extension_name, const char* track_id = NULL) = 0; + + protected: + virtual ~IAgoraService() {} +}; + +} // namespace base +} // namespace agora + +/** \addtogroup createAgoraService + @{ + */ +/** + * Creates an \ref agora::base::IAgoraService "IAgoraService" object and returns the pointer. + * + * @return + * - The pointer to \ref agora::base::IAgoraService "IAgoraService": Success. + * - A null pointer: Failure. + */ +AGORA_API agora::base::IAgoraService* AGORA_CALL createAgoraService(); +/** @} */ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraSpatialAudio.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraSpatialAudio.h new file mode 100644 index 0000000..51b3825 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAgoraSpatialAudio.h @@ -0,0 +1,314 @@ +// +// AgoraRtcEngine SDK +// +// Copyright (c) 2019 Agora.io. All rights reserved. +// + +#ifndef AGORA_SPATIAL_AUDIO_H +#define AGORA_SPATIAL_AUDIO_H + +#include +#include "AgoraBase.h" +#include "AgoraMediaBase.h" +#include "AgoraRefPtr.h" +#include "IAgoraRtcEngineEx.h" + +namespace agora { +namespace rtc { + +// The information of remote voice position +struct RemoteVoicePositionInfo { + // The coordnate of remote voice source, (x, y, z) + float position[3]; + // The forward vector of remote voice, (x, y, z). When it's not set, the vector is forward to listner. + float forward[3]; + RemoteVoicePositionInfo() = default; +}; + +struct SpatialAudioZone { + //the zone id + int zoneSetId; + //zone center point + float position[3]; + //forward direction + float forward[3]; + //right direction + float right[3]; + //up direction + float up[3]; + //the forward side length of the zone + float forwardLength; + //tehe right side length of the zone + float rightLength; + //the up side length of the zone + float upLength; + //the audio attenuation of zone + float audioAttenuation; + SpatialAudioZone() = default; +}; + +/** The definition of LocalSpatialAudioConfig + */ +struct LocalSpatialAudioConfig { + /*The reference to \ref IRtcEngine, which is the base interface class of the Agora RTC SDK and provides + * the real-time audio and video communication functionality. + */ + agora::rtc::IRtcEngine* rtcEngine; + + LocalSpatialAudioConfig() : rtcEngine(NULL) {} +}; + +/** The IBaseSpatialAudioEngine class provides the common methods of ICloudSpatialAudioEngine and ILocalSpatialAudioEngine. + */ +class IBaseSpatialAudioEngine: public RefCountInterface { + protected: + virtual ~IBaseSpatialAudioEngine() {} + + public: + /** + * Releases all the resources occupied by spatial audio engine. + */ + virtual void release() = 0; + /** + * This method sets the maximum number of streams that a player can receive in a + * specified audio reception range. + * + * @note You can call this method either before or after calling enterRoom: + * - Calling this method before enterRoom affects the maximum number of received streams + * the next time the player enters a room. + * - Calling this method after entering a room changes the current maximum number of + * received streams of the player. + * + * @param maxCount The maximum number of streams that a player can receive within + * a specified audio reception range. If the number of receivable streams exceeds + * the set value, the SDK receives the set number of streams closest to the player. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setMaxAudioRecvCount(int maxCount) = 0; + /** + * This method sets the audio reception range. The unit of the audio reception range + * is the same as the unit of distance in the game engine. + * + * @note You can call this method either before or after calling enterRoom. + * During the game, you can call it multiple times to update the audio reception range. + * + * @param range The maximum audio reception range, in the unit of game engine distance. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setAudioRecvRange(float range) = 0; + + /** + * This method sets distance unit of game engine. The smaller the unit is, the sound fades slower + * with distance. + * + * @note You can call this method either before or after calling enterRoom. + * During the game, you can call it multiple times to update the distance unit. + * + * @param unit The number of meters that the game engine distance per unit is equal to. For example, setting unit as 2 means the game engine distance per unit equals 2 meters. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setDistanceUnit(float unit) = 0; + /** + * Updates the position of local user. + * When calling it in ICloudSpatialAudioEngine, it triggers the SDK to update the user position to the Agora spatial audio server. The Agora spatial audio server uses the users' world coordinates and audio reception range to determine whether they are within each other's specified audio reception range. + * When calling it in ILocalSpatialAudioEngine, it triggers the SDK to calculate the relative position between the local and remote users and updates spatial audio parameters. + * + * when calling it in ICloudSpatialAudioEngine, you should notice: + * @note + * - Call the method after calling enterRoom. + * - The call frequency is determined by the app. Agora recommends calling this method every + * 120 to 7000 ms. Otherwise, the SDK may lose synchronization with the server. + * + * @param position The sound position of the user. The coordinate order is forward, right, and up. + * @param axisForward The vector in the direction of the forward axis in the coordinate system. + * @param axisRight The vector in the direction of the right axis in the coordinate system. + * @param axisUp The vector in the direction of the up axis in the coordinate system. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updateSelfPosition(float position[3], float axisForward[3], float axisRight[3], float axisUp[3]) = 0; + /** + * Updates the position of local user. This method is used in scene with multi RtcConnection. + * + * @note + * - This method is only effective in ILocalSpatialAudioEngine currently. + * + * @param position The sound position of the user. The coordinate order is forward, right, and up. + * @param axisForward The vector in the direction of the forward axis in the coordinate system. + * @param axisRight The vector in the direction of the right axis in the coordinate system. + * @param axisUp The vector in the direction of the up axis in the coordinate system. + * @param connection The RTC connection whose spatial audio effect you want to update. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updateSelfPositionEx(float position[3], float axisForward[3], float axisRight[3], float axisUp[3], const RtcConnection& connection) = 0; + + /** + * Updates the position of a media player in scene. This method has same behavior both in ICloudSpatialAudioEngine and ILocalSpatialAudioEngine. + * + * @note + * - This method is suggested to be called once if you don't move media player in the virtual space. + * + * @param playerId The ID of the media player. You can get it by IMediaPlayer::getMediaPlayerId. + * @param positionInfo The position information of media player in the virtual space. For details inforamtion, see the declaration of RemoteVoicePositionInfo. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updatePlayerPositionInfo(int playerId, const RemoteVoicePositionInfo& positionInfo) = 0; + + /** + * Set parameters for spatial audio engine. It's deprecated for using. + * + * @param params The parameter string. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setParameters(const char* params) = 0; + + /** + * Mute or unmute local audio stream. + * + * @param mute When it's false, it will send local audio stream, otherwise it will not send local audio stream. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int muteLocalAudioStream(bool mute) = 0; + /** + * Mute all remote audio streams. It determines wether SDK receves remote audio streams or not. + * + * @param mute When it's false, SDK will receive remote audio streams, otherwise SDK will not receive remote audio streams. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int muteAllRemoteAudioStreams(bool mute) = 0; + + + /** + * Setting up sound Space + * + * @param zones The Sound space array + * @param zoneCount the sound Space count of array + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setZones(const SpatialAudioZone *zones, unsigned int zoneCount) = 0; + /** + * Set the audio attenuation coefficient of the player + * @param playerId The ID of the media player. You can get it by IMediaPlayer::getMediaPlayerId. + * @param attenuation The audio attenuation of the media player. + * @param forceSet Whether to force the setting of audio attenuation coefficient. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int setPlayerAttenuation(int playerId, double attenuation, bool forceSet) = 0; + /** + * Mute or unmute remote user audio stream. + * + * @param uid The ID of the remote user. + * @param mute When it's false, SDK will receive remote user audio streams, otherwise SDK will not receive remote user audio streams. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int muteRemoteAudioStream(uid_t uid, bool mute) = 0; +}; + +class ILocalSpatialAudioEngine : public IBaseSpatialAudioEngine { +protected: + virtual ~ILocalSpatialAudioEngine() {} + +public: + /** + * Initializes the ILocalSpatialAudioEngine object and allocates the internal resources. + * + * @note Ensure that you call IRtcEngine::queryInterface and initialize before calling any other ILocalSpatialAudioEngine APIs. + * + * @param config The pointer to the LocalSpatialAudioConfig. See #LocalSpatialAudioConfig. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int initialize(const LocalSpatialAudioConfig& config) = 0; + /** + * Updates the position information of remote user. You should call it when remote user whose role is broadcaster moves. + * + * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @param posInfo The position information of remote user. See #RemoteVoicePositionInfo. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updateRemotePosition(uid_t uid, const RemoteVoicePositionInfo &posInfo) = 0; + /** + * Updates the position of remote user. It's supposed to use with IRtcEngineEx::joinChannelEx. + * + * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @param posInfo The position information of remote user. See #RemoteVoicePositionInfo. + * @param connection The RTC connection whose spatial audio effect you want to update. See #RtcConnection. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int updateRemotePositionEx(uid_t uid, const RemoteVoicePositionInfo &posInfo, const RtcConnection& connection) = 0; + /** + * Remove the position information of remote user. You should call it when remote user called IRtcEngine::leaveChannel. + * + * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int removeRemotePosition(uid_t uid) = 0; + /** + * Remove the position information of remote user. It's supposed to use with IRtcEngineEx::joinChannelEx. + * + * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @param connection The RTC connection whose spatial audio effect you want to update. See #RtcConnection. + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int removeRemotePositionEx(uid_t uid, const RtcConnection& connection) = 0; + /** + * Clear the position informations of remote users. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int clearRemotePositions() = 0; + /** + * Clear the position informations of remote users. It's supposed to use with IRtcEngineEx::joinChannelEx. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int clearRemotePositionsEx(const RtcConnection& connection) = 0; + + + virtual int setRemoteAudioAttenuation(uid_t uid, double attenuation, bool forceSet) = 0; +}; + +} // namespace rtc +} // namespace agora + +#endif diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAudioDeviceManager.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAudioDeviceManager.h new file mode 100644 index 0000000..77667b8 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/IAudioDeviceManager.h @@ -0,0 +1,482 @@ +// +// Agora SDK +// +// Copyright (c) 2021 Agora.io. All rights reserved. +// +#pragma once // NOLINT(build/header_guard) + +namespace agora { +namespace rtc { + +/** + * The maximum device ID length. + */ +enum MAX_DEVICE_ID_LENGTH_TYPE { + /** + * The maximum device ID length is 512. + */ + MAX_DEVICE_ID_LENGTH = 512 +}; + +/** + * The IAudioDeviceCollection class. + */ +class IAudioDeviceCollection { +public: + virtual ~IAudioDeviceCollection() {} + + /** + * Gets the total number of the playback or recording devices. + * + * Call \ref IAudioDeviceManager::enumeratePlaybackDevices + * "enumeratePlaybackDevices" first, and then call this method to return the + * number of the audio playback devices. + * + * @return + * - The number of the audio devices, if the method call succeeds. + * - < 0, if the method call fails. + */ + virtual int getCount() = 0; + + /** + * Gets the information of a specified audio device. + * @param index An input parameter that specifies the audio device. + * @param deviceName An output parameter that indicates the device name. + * @param deviceId An output parameter that indicates the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], + char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Specifies a device with the device ID. + * @param deviceId The device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the default audio device of the system (for macOS and Windows only). + * + * @param deviceName The name of the system default audio device. + * @param deviceId The device ID of the the system default audio device. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getDefaultDevice(char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Sets the volume of the app. + * + * @param volume The volume of the app. The value range is [0, 255]. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setApplicationVolume(int volume) = 0; + + /** + * Gets the volume of the app. + * + * @param volume The volume of the app. The value range is [0, 255] + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getApplicationVolume(int &volume) = 0; + + /** Mutes or unmutes the app. + * + * @param mute Determines whether to mute the app: + * - true: Mute the app. + * - false: Unmute the app. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setApplicationMute(bool mute) = 0; + + /** + * Gets the mute state of the app. + * + * @param mute A reference to the mute state of the app: + * - true: The app is muted. + * - false: The app is not muted. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int isApplicationMute(bool &mute) = 0; + + /** + * Releases all IAudioDeviceCollection resources. + */ + virtual void release() = 0; +}; + +/** + * The IAudioDeviceManager class. + */ +class IAudioDeviceManager : public RefCountInterface { +public: + virtual ~IAudioDeviceManager() {} + + /** + * Enumerates the audio playback devices. + * + * This method returns an IAudioDeviceCollection object that includes all the + * audio playback devices in the system. With the IAudioDeviceCollection + * object, the app can enumerate the audio playback devices. The app must call + * the \ref IAudioDeviceCollection::release "IAudioDeviceCollection::release" + * method to release the returned object after using it. + * + * @return + * - A pointer to the IAudioDeviceCollection object that includes all the + * audio playback devices in the system, if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ + virtual IAudioDeviceCollection *enumeratePlaybackDevices() = 0; + + /** + * Enumerates the audio recording devices. + * + * This method returns an IAudioDeviceCollection object that includes all the + * audio recording devices in the system. With the IAudioDeviceCollection + * object, the app can enumerate the audio recording devices. The app needs to + * call the \ref IAudioDeviceCollection::release + * "IAudioDeviceCollection::release" method to release the returned object + * after using it. + * + * @return + * - A pointer to the IAudioDeviceCollection object that includes all the + * audio recording devices in the system, if the method call succeeds. + * - The empty pointer NULL, if the method call fails. + */ + virtual IAudioDeviceCollection *enumerateRecordingDevices() = 0; + + /** + * Specifies an audio playback device with the device ID. + * + * @param deviceId ID of the audio playback device. It can be retrieved by the + * \ref enumeratePlaybackDevices "enumeratePlaybackDevices" method. Plugging + * or unplugging the audio device does not change the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the ID of the audio playback device. + * @param deviceId An output parameter that specifies the ID of the audio + * playback device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the device ID and device name of the audio playback device. + * @param deviceId An output parameter that specifies the ID of the audio + * playback device. + * @param deviceName An output parameter that specifies the name of the audio + * playback device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], + char deviceName[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Sets the volume of the audio playback device. + * @param volume The volume of the audio playing device. The value range is + * [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackDeviceVolume(int volume) = 0; + + /** + * Gets the volume of the audio playback device. + * @param volume The volume of the audio playback device. The value range is + * [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDeviceVolume(int *volume) = 0; + + /** + * Specifies an audio recording device with the device ID. + * + * @param deviceId ID of the audio recording device. It can be retrieved by + * the \ref enumerateRecordingDevices "enumerateRecordingDevices" method. + * Plugging or unplugging the audio device does not change the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the audio recording device by the device ID. + * + * @param deviceId ID of the audio recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the information of the audio recording device by the device ID and + * device name. + * + * @param deviceId ID of the audio recording device. + * @param deviceName The name of the audio recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], + char deviceName[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Sets the volume of the recording device. + * @param volume The volume of the recording device. The value range is [0, + * 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingDeviceVolume(int volume) = 0; + + /** + * Gets the volume of the recording device. + * @param volume The volume of the microphone, ranging from 0 to 255. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDeviceVolume(int *volume) = 0; + + /** + * Specifies an audio loopback recording device with the device ID. + * + * @param deviceId ID of the audio loopback recording device. It can be retrieved by + * the \ref enumeratePlaybackDevices "enumeratePlaybackDevices" method. + * Plugging or unplugging the audio device does not change the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLoopbackDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Gets the audio loopback recording device by the device ID. + * + * @param deviceId ID of the audio loopback recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getLoopbackDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + + /** + * Mutes or unmutes the audio playback device. + * + * @param mute Determines whether to mute the audio playback device. + * - true: Mute the device. + * - false: Unmute the device. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackDeviceMute(bool mute) = 0; + + /** + * Gets the mute state of the playback device. + * + * @param mute A pointer to the mute state of the playback device. + * - true: The playback device is muted. + * - false: The playback device is unmuted. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDeviceMute(bool *mute) = 0; + + /** + * Mutes or unmutes the audio recording device. + * + * @param mute Determines whether to mute the recording device. + * - true: Mute the microphone. + * - false: Unmute the microphone. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingDeviceMute(bool mute) = 0; + + /** + * Gets the mute state of the audio recording device. + * + * @param mute A pointer to the mute state of the recording device. + * - true: The microphone is muted. + * - false: The microphone is unmuted. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDeviceMute(bool *mute) = 0; + + /** + * Starts the audio playback device test. + * + * This method tests if the playback device works properly. In the test, the + * SDK plays an audio file specified by the user. If the user hears the audio, + * the playback device works properly. + * + * @param testAudioFilePath The file path of the audio file for the test, + * which is an absolute path in UTF8: + * - Supported file format: wav, mp3, m4a, and aac. + * - Supported file sampling rate: 8000, 16000, 32000, 44100, and 48000. + * + * @return + * - 0, if the method call succeeds and you can hear the sound of the + * specified audio file. + * - An error code, if the method call fails. + */ + virtual int startPlaybackDeviceTest(const char *testAudioFilePath) = 0; + + /** + * Stops the audio playback device test. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopPlaybackDeviceTest() = 0; + + /** + * Starts the recording device test. + * + * This method tests whether the recording device works properly. Once the + * test starts, the SDK uses the \ref + * IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback to notify the app on the volume information. + * + * @param indicationInterval The time interval (ms) between which the SDK + * triggers the `onAudioVolumeIndication` callback. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRecordingDeviceTest(int indicationInterval) = 0; + + /** + * Stops the recording device test. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRecordingDeviceTest() = 0; + + /** + * Starts the audio device loopback test. + * + * This method tests whether the local audio devices are working properly. + * After calling this method, the microphone captures the local audio and + * plays it through the speaker, and the \ref + * IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback returns the local audio volume information at the set interval. + * + * @note This method tests the local audio devices and does not report the + * network conditions. + * @param indicationInterval The time interval (ms) at which the \ref + * IRtcEngineEventHandler::onAudioVolumeIndication "onAudioVolumeIndication" + * callback returns. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startAudioDeviceLoopbackTest(int indicationInterval) = 0; + + /** + * Stops the audio device loopback test. + * + * @note Ensure that you call this method to stop the loopback test after + * calling the \ref IAudioDeviceManager::startAudioDeviceLoopbackTest + * "startAudioDeviceLoopbackTest" method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopAudioDeviceLoopbackTest() = 0; + + /** The status of following system default playback device. + + @note The status of following system default playback device. + + @param enable Variable to whether the current device follow system default playback device or not. + - true: The current device will change when the system default playback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemPlaybackDevice(bool enable) = 0; + + /** The status of following system default recording device. + + @note The status of following system default recording device. + + @param enable Variable to whether the current device follow system default recording device or not. + - true: The current device will change when the system default recording device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemRecordingDevice(bool enable) = 0; + + /** The status of following system default loopback device. + + @note The status of following system default loopback device. + + @param enable Variable to whether the current device follow system default loopback device or not. + - true: The current device will change when the system default loopback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemLoopbackDevice(bool enable) = 0; + + /** + * Releases all IAudioDeviceManager resources. + */ + virtual void release() = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraAudioDeviceManager.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraAudioDeviceManager.h new file mode 100644 index 0000000..3c68bf0 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraAudioDeviceManager.h @@ -0,0 +1,550 @@ +// +// Agora SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace media { +namespace base { +class IAudioFrameObserver; +} // namespace base +} // namespace media + +namespace rtc { + +static const int kAdmMaxDeviceNameSize = 128; +static const int kAdmMaxGuidSize = 128; +static const int kIntervalInMillseconds = 200; + + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) +/** + * The struct of AudioDeviceInfo. + * + * @note + * This struct applies to Windows and macOS only. + */ +struct AudioDeviceInfo { + /** + * The name of the device. The maximum name size is 128 bytes. The default value is 0. + */ + char deviceName[kAdmMaxDeviceNameSize]; + /** + * The ID of the device. The maximum size is 128 bytes. The default value is 0. + */ + char deviceId[kAdmMaxGuidSize]; + /** + * Determines whether the current device is selected for audio capturing or playback. + * - true: Select the current device for audio capturing or playback. + * - false: (Default) Do not select the current device for audio capturing or playback. + */ + bool isCurrentSelected; + /** + * Determines whether the current device is the audio playout device. + * - true: (Default) The current device is the playout device. + * - false: The current device is not the playout device. + */ + bool isPlayoutDevice; + + AudioDeviceInfo() : isCurrentSelected(false), + isPlayoutDevice(true) { + memset(deviceName, 0, sizeof(deviceName)); + memset(deviceId, 0, sizeof(deviceId)); + } +}; +#endif // _WIN32 || (TARGET_OS_MAC && !TARGET_OS_IPHONE) + +/** + * The struct of LoopbackRecordingOption + * + * @note + */ +struct LoopbackRecordingOption { + /** + * the name of the device. the maximum name size is 128 bytes. the default value is 0. + */ + Optional deviceName; + /** + * allow output device change when enable loopback recording. + */ + Optional allowDeviceChange; +}; + +/** + * The IAudioDeviceManagerObserver class. + */ +class IAudioDeviceManagerObserver +{ +public: + virtual ~IAudioDeviceManagerObserver() {} + + /** + * Occurs when the device state changes, for example, when a device is added or removed. + * + * To get the current information of the connected audio devices, call \ref agora::rtc::INGAudioDeviceManager::getNumberOfPlayoutDevices "getNumberOfPlayoutDevices". + */ + virtual void onDeviceStateChanged() = 0; + + /** + * Occurs when the device state changes, for example, when a device is added or removed or default device change. + * + * @note + * This method applies to Windows only now. + * + * @param deviceId Pointer to the device ID. + * @param deviceType Device type: #MEDIA_DEVICE_TYPE. + * @param deviceState Device state: #MEDIA_DEVICE_STATE_TYPE.. + */ + virtual void onAudioDeviceStateChanged(const char *deviceId, int deviceType, int deviceState) = 0; + + /** Indicates incoming volume. This can be used to test microphone or speaker. + * + * @param deviceType Device type: #MEDIA_DEVICE_TYPE. + * @param volume volume between 0 (lowest volume) to 255 (highest volume). + */ + virtual void onVolumeIndication(int deviceType, int volume) = 0; + + /** + * Occurs when the audio route changes. + * + * @param route The current audio route. See #AudioRoute. + */ + virtual void onRoutingChanged(AudioRoute route) = 0; + + /** + * Occurs when the audio device volume changes. + * + * @param deviceType The device type, see #MEDIA_DEVICE_TYPE. + * @param volume The volume of the audio device. + * @param muted Whether the audio device is muted: + * - true: The audio device is muted. + * - false: The audio device is not muted. + */ + virtual void onAudioDeviceVolumeChanged(int deviceType, int volume, bool muted) = 0; +}; + +class IRecordingDeviceSource : public RefCountInterface { + public: + /** + * Initialize the recording device source. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initRecording(const char* deviceName = NULL) = 0; + + /** + * Start the recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startRecording() = 0; + + /** + * Stop the recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopRecording() = 0; + + /** + * Registers an audio frame observer. + * + * @param observer The pointer to the IAudioFrameObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Releases the registered IAudioFrameObserver object. + * + * @param observer The pointer to the IAudioFrameObserver object created by the `registerAudioPcmDataCallback` method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Set parameter to object loopback device; + * @param option + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLoopbackDeviceParameter(const LoopbackRecordingOption &option) = 0; + + virtual ~IRecordingDeviceSource() {} +}; + +/** + * The INGAudioDeciceManager class. + * + * This class provides access to audio volume and audio route control, as well as device enumeration and + * selection on the PC. + */ +class INGAudioDeviceManager : public RefCountInterface { +public: + /** + * Creates a audio device source object and returns the pointer. + * + * @return + * - The pointer to \ref rtc::IRecordingDeviceSource "IRecordingDeviceSource", if the method call + * succeeds. + * - An empty pointer NULL: Failure. + */ + virtual agora_refptr createRecordingDeviceSource(char deviceId[kAdmMaxDeviceNameSize]) = 0; + + /** + * Sets the volume of the microphone. + * @param volume The volume of the microphone. The value range is [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMicrophoneVolume(unsigned int volume) = 0; + /** + * Gets the volume of the microphone. + * @param volume The volume of the microphone. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMicrophoneVolume(unsigned int& volume) = 0; + /** + * Sets the volume of the speaker. + * @param volume The volume of the speaker. The value range is [2, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSpeakerVolume(unsigned int volume) = 0; + /** + * Gets the volume of the speaker. + * @param volume The volume of the speaker. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getSpeakerVolume(unsigned int& volume) = 0; + /** + * Captures or stops capturing the local audio with the microphone. + * @param mute Determines whether to capture or stop capturing the local audio with the microphone. + * - true: Stop capturing the local audio. + * - false: (Default) Capture the local audio. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMicrophoneMute(bool mute) = 0; + /** + * Gets the mute state of the microphone. + * @param mute The mute state of the microphone. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getMicrophoneMute(bool& mute) = 0; + /** + * Plays or stops playing the remote audio with the speaker. + * @param mute Determines whether to play or stop playing the remote audio. + * - true: Stop playing the remote audio. + * - false: (Default) Play the remote audio. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSpeakerMute(bool mute) = 0; + /** + * Gets the mute state of the speaker. + * @param mute A reference to the mute state of the speaker. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getSpeakerMute(bool& mute) = 0; + + /** + * Get the playout parameters of audio device. + * @param params A point to the struct AudioParameters. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlayoutAudioParameters(AudioParameters* params) const = 0; + + /** + * Get the record parameters of audio device. + * @param params A point to the struct AudioParameters. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordAudioParameters(AudioParameters* params) const = 0; + +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + /** + * Sets the default audio routing. + * + * This method allows apps to change the current audio route for the received audio. + * Noted: In Low Level API, we don't support default audio routing, i.e., + * setDefaultAudioRouteToSpeakerphone. This can be done in RTC engine. + * + * @note + * This method applies to Android and iOS only. + * + * @param route The default audio route. See #AudioRoute. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setDefaultAudioRouting(AudioRoute route) = 0; + /** + * Changes the current audio routing. + * + * @note + * This method applies to Android and iOS only. + * + * @param route The audio route that you want to change to. See #AudioRoute. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int changeAudioRouting(AudioRoute route) = 0; + /** + * Gets the current audio routing. + * + * @note + * This method applies to Android and iOS only. + * + * @param route A reference to the audio route: AudioRoute. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getCurrentRouting(AudioRoute& route) = 0; +#endif // __ANDROID__ || TARGET_OS_IPHONE + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + /** + * Gets the index numbers of all audio playout devices. + * + * @note + * This method applies to Windows or macOS only. + * + * @return + * - The index numbers of the audio playout devices: Success. + * - < 0: Failure. + */ + virtual int getNumberOfPlayoutDevices() = 0; + + /** + * Gets the index numbers of all audio recording devices. + * + * @note + * This method applies to Windows or macOS only. + * + * @return + * - The index numbers of the audio recording devices: Success. + * - < 0: Failure. + */ + virtual int getNumberOfRecordingDevices() = 0; + /** + * Gets the information of the current audio playout device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the current audio playout device. + * @return + * The information of the audio playout device. See \ref agora::rtc::AudioDeviceInfo "AudioDeviceInfo". + */ + virtual AudioDeviceInfo getPlayoutDeviceInfo(int index) = 0; + /** + * Gets the information of the current recording device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the current recording device. + * @return + * The information of the recording device. See \ref agora::rtc::AudioDeviceInfo "AudioDeviceInfo". + */ + virtual AudioDeviceInfo getRecordingDeviceInfo(int index) = 0; + /** + * Sets the audio playback device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the audio playout device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlayoutDevice(int index) = 0; + /** + * Sets the recording device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the recording device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingDevice(int index) = 0; + /** The status of following system default playback device. + + @note The status of following system default playback device. + + @param enable Variable to whether the current device follow system default playback device or not. + - true: The current device will change when the system default playback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemPlaybackDevice(bool enable) = 0; + + /** The status of following system default recording device. + + @note The status of following system default recording device. + + @param enable Variable to whether the current device follow system default recording device or not. + - true: The current device will change when the system default recording device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemRecordingDevice(bool enable) = 0; +#endif // _WIN32 || (TARGET_OS_MAC && !TARGET_OS_IPHONE) + +#if defined(_WIN32) + /** + * Sets the volume of the app. + * + * @note + * This method applies to Windows only. + * + * @param volume The volume of the app. The value range is [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setApplicationVolume(unsigned int volume) = 0; + /** + * Gets the volume of the app. + * + * @note + * This method applies to Windows only. + * + * @param volume The volume of the app. The value range is [0, 255]. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getApplicationVolume(unsigned int& volume) = 0; + /** + * Sets the mute state of the app. + * + * @note + * This method applies to Windows only. + * + * @param mute Determines whether to set the app to the mute state. + * - true: Set the app to the mute state. + * - false: (Default) Do not set the app to the mute state. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setApplicationMuteState(bool mute) = 0; + /** + * Gets the mute state of the app. + * + * @note + * This method applies to Windows only. + * + * @param mute A reference to the mute state of the app. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getApplicationMuteState(bool& mute) = 0; + /** + * Gets the information of the current audio loopback device. + * + * @note + * This method applies to Windows or macOS only. + * + * @param index The index number of the current audio playout device. + * @return + * The information of the audio playout device. See \ref agora::rtc::AudioDeviceInfo "AudioDeviceInfo". + */ + virtual AudioDeviceInfo getLoopbackDeviceInfo(int index) = 0; + /** + * Sets the audio loopback device. + * + * @note + * This method applies to Windows only. + * + * @param index The index number of the audio playout device. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setLoopbackDevice(int index) = 0; + /** The status of following system default loopback device. + + @note The status of following system default loopback device. + + @param enable Variable to whether the current device follow system default loopback device or not. + - true: The current device will change when the system default loopback device changed. + - false: The current device will change only current device is removed. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int followSystemLoopbackDevice(bool enable) = 0; +#endif // _WIN32 + + /** + * Registers an IAudioDeviceManagerObserver object. + * + * You need to implement the IAudioDeviceManageObserver class in this method, and register callbacks + * according to your scenario. + * + * @param observer A pointer to the IAudioDeviceManagerObserver class. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerObserver(IAudioDeviceManagerObserver* observer, void(*safeDeleter)(IAudioDeviceManagerObserver*) = NULL) = 0; + /** + * Releases the IAudioDeviceManagerObserver object. + * @param observer The pointer to the IAudioDeviceManagerObserver class registered using #registerObserver. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterObserver(IAudioDeviceManagerObserver* observer) = 0; + +protected: + ~INGAudioDeviceManager() {} +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraAudioTrack.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraAudioTrack.h new file mode 100644 index 0000000..5889392 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraAudioTrack.h @@ -0,0 +1,724 @@ + +// Copyright (c) 2018 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" + +// FIXME(Ender): use this class instead of AudioSendStream as local track +namespace agora { +namespace rtc { +class IAudioTrackStateObserver; +class IAudioFilter; +class IAudioSinkBase; +class IMediaPacketReceiver; +class IAudioEncodedFrameReceiver; +/** + * Properties of audio frames expected by a sink. + * + * @note The source determines the audio frame to be sent to the sink based on a variety of factors, + * such as other sinks or the capability of the source. + * + */ +struct AudioSinkWants { + /** The sample rate of the audio frame to be sent to the sink. */ + int samplesPerSec; + + /** The number of audio channels of the audio frame to be sent to the sink. */ + size_t channels; + + /** The audio track number of the audio frame to be sent to the sink. */ + int audioTrackNumber; + + AudioSinkWants() : samplesPerSec(0), + channels(0), + audioTrackNumber(-1) {} + AudioSinkWants(int sampleRate, size_t chs) : samplesPerSec(sampleRate), + channels(chs) {audioTrackNumber = -1;} + AudioSinkWants(int sampleRate, size_t chs, int trackNum) : samplesPerSec(sampleRate), channels(chs), audioTrackNumber(trackNum) {} +}; + +/** + * The IAudioTrack class. + */ +class IAudioTrack : public RefCountInterface { + public: + /** + * The position of the audio filter in audio frame. + */ + enum AudioFilterPosition { + /** + * Work on the local playback + */ + RecordingLocalPlayback, + /** + * Work on the post audio processing. + */ + PostAudioProcessing, + /** + * Work on the remote audio before mixing. + */ + RemoteUserPlayback, + /** + * Work on the pcm source. + */ + PcmSource, + /** + * Work on the sending branch of the pcm source. + */ + PcmSourceSending, + /** + * Work on the local playback branch of the pcm source. + */ + PcmSourceLocalPlayback, + /** + * Work on the playback after remote-audio mix. + */ + RemoteMixedPlayback, + }; + + public: + /** + * Adjusts the playback volume. + * @param volume The playback volume. The value ranges between 0 and 100 (default). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustPlayoutVolume(int volume) = 0; + + /** + * Gets the current playback volume. + * @param volume A pointer to the playback volume. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlayoutVolume(int* volume) = 0; + + /** + * Adds an audio filter. + * + * By adding an audio filter, you can apply various audio effects to the audio, for example, voice change. + * @param filter A pointer to the audio filter. See \ref agora::rtc::IAudioFilter "IAudioFilter". + * @param position The position of the audio filter. See \ref agora::rtc::IAudioTrack::AudioFilterPosition "AudioFilterPosition". + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool addAudioFilter(agora_refptr filter, AudioFilterPosition position, ExtensionContext* extContext = NULL) = 0; + /** + * Removes the audio filter added by callling `addAudioFilter`. + * + * @param filter The pointer to the audio filter that you want to remove. See \ref agora::rtc::IAudioFilter "IAudioFilter". + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool removeAudioFilter(agora_refptr filter, AudioFilterPosition position) = 0; + + /** + * Enable / Disable specified audio filter + * @param id id of the filter + * @param enable enable / disable the filter with given id + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - 0: success + * - <0: failure + */ + virtual int enableAudioFilter(const char* id, bool enable, AudioFilterPosition position) { + (void)id; + (void)enable; + (void)position; + return -1; + } + + /** + * set the properties of the specified audio filter + * @param id id of the filter + * @param key key of the property + * @param jsonValue json str value of the property + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - 0: success + * - <0: failure + */ + virtual int setFilterProperty(const char* id, const char* key, const char* jsonValue, AudioFilterPosition position) { + (void)id; + (void)key; + (void)jsonValue; + (void)position; + return -1; + } + + /** + * get the properties of the specified video filter + * @param id id of the filter + * @param key key of the property + * @param jsonValue json str value of the property + * @param bufSize max length of the json value buffer + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - 0: success + * - <0: failure + */ + virtual int getFilterProperty(const char* id, const char* key, char* jsonValue, size_t bufSize, AudioFilterPosition position) { + (void)id; + (void)key; + (void)jsonValue; + (void)bufSize; + (void)position; + return -1; + } + + /** + * Gets the audio filter by its name. + * + * @param name The name of the audio filter. + * @param position The position of the audio filter. See #AudioFilterPosition. + * @return + * - The pointer to the audio filter: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr getAudioFilter(const char *name, AudioFilterPosition position) const = 0; + + /** + * Adds an audio sink to get PCM data from the audio track. + * + * @param sink The pointer to the audio sink. See \ref agora::rtc::IAudioSinkBase "IAudioSinkBase". + * @param wants The properties an audio frame should have when it is delivered to the sink. See \ref agora::rtc::AudioSinkWants "AudioSinkWants". + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool addAudioSink(agora_refptr sink, const AudioSinkWants& wants) = 0; + + /** + * Removes an audio sink. + * + * @param sink The pointer to the audio sink to be removed. See \ref agora::rtc::IAudioSinkBase "IAudioSinkBase". + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool removeAudioSink(agora_refptr sink) = 0; +}; + +/** + * The observer of the local audio track. + */ +class ILocalAudioTrackObserver { + public: + virtual ~ILocalAudioTrackObserver() {} + + /** + * Occurs when the state of a local audio track changes. + * + * @param state The state of the local audio track. + * @param errorCode The error information for a state failure: \ref agora::rtc::LOCAL_AUDIO_STREAM_ERROR "LOCAL_AUDIO_STREAM_ERROR". + */ + virtual void onLocalAudioTrackStateChanged(LOCAL_AUDIO_STREAM_STATE state, + LOCAL_AUDIO_STREAM_ERROR errorCode) = 0; +}; + +/** + * `ILocalAudioTrack` is the basic class for local audio tracks, providing main methods of local audio tracks. + * + * You can create a local audio track by calling one of the following methods: + * - `createLocalAudioTrack` + * - `createCustomAudioTrack` + * - `createMediaPlayerAudioTrack` + * @if (!Linux) + * You can also use the APIs in the \ref agora::rtc::INGAudioDeviceManager "IAudioDeviceManager" class if multiple recording devices are available in the system. + * @endif + * + * After creating local audio tracks, you can publish one or more local audio + * tracks by calling \ref agora::rtc::ILocalUser::publishAudio "publishAudio". + */ +class ILocalAudioTrack : public IAudioTrack { + public: + /** + * Statistics of a local audio track. + */ + struct LocalAudioTrackStats { + /** + * The source ID of the local audio track. + */ + uint32_t source_id; + /** + * The number of audio frames in the buffer. + * + * When sending PCM data, the PCM data is first stored in a buffer area. + * Then a thread gets audio frames from the buffer and sends PCM data. + */ + uint32_t buffered_pcm_data_list_size; + /** + * The number of audio frames missed by the thread that gets PCM data from the buffer. + */ + uint32_t missed_audio_frames; + /** + * The number of audio frames sent by the thread that gets PCM data from the buffer. + */ + uint32_t sent_audio_frames; + /** + * The number of audio frames sent by the user. + */ + uint32_t pushed_audio_frames; + /** + * The number of dropped audio frames caused by insufficient buffer size. + */ + uint32_t dropped_audio_frames; + /** + * The number of playout audio frames. + */ + uint32_t playout_audio_frames; + /** + * The type of audio effect. + */ + uint32_t effect_type; + /** + * Whether the hardware ear monitor is enabled. + */ + uint32_t hw_ear_monitor; + /** + * Whether the local audio track is enabled. + */ + bool enabled; + /** + * The volume that ranges from 0 to 255. + */ + uint32_t audio_volume; // [0,255] + + LocalAudioTrackStats() : source_id(0), + buffered_pcm_data_list_size(0), + missed_audio_frames(0), + sent_audio_frames(0), + pushed_audio_frames(0), + dropped_audio_frames(0), + playout_audio_frames(0), + effect_type(0), + hw_ear_monitor(0), + enabled(false), + audio_volume(0) {} + }; + + public: + /** + * Enables or disables the local audio track. + * + * Once the local audio is enabled, the SDK allows for local audio capturing, processing, and encoding. + * + * @param enable Whether to enable the audio track: + * - `true`: Enable the local audio track. + * - `false`: Disable the local audio track. + */ + virtual void setEnabled(bool enable) = 0; + + /** + * Gets whether the local audio track is enabled. + * @return Whether the local audio track is enabled: + * - `true`: The local track is enabled. + * - `false`: The local track is disabled. + */ + virtual bool isEnabled() const = 0; + + /** + * Gets the state of the local audio. + * @return The state of the local audio: #LOCAL_AUDIO_STREAM_STATE: Success. + */ + virtual LOCAL_AUDIO_STREAM_STATE getState() = 0; + + /** + * Gets the statistics of the local audio track: LocalAudioTrackStats. + * @return The statistics of the local audio: LocalAudioTrackStats: Success. + */ + virtual LocalAudioTrackStats GetStats() = 0; + + /** + * Adjusts the audio volume for publishing. + * + * @param volume The volume for publishing. The value ranges between 0 and 100 (default). + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustPublishVolume(int volume) = 0; + + /** + * Gets the current volume for publishing. + * @param volume A pointer to the publishing volume. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPublishVolume(int* volume) = 0; + + /** + * Enables or disables local playback. + * @param enable Whether to enable local playback: + * - `true`: Enable local playback. + * - `false`: Disable local playback. + * @param sync Whether to destroy local playback synchronously: + * - `true`: Destroy local playback synchronously. + * - `false`: Destroy local playback asynchronously. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableLocalPlayback(bool enable, bool sync = true) = 0; + + /** + * Enables in-ear monitoring (for Android and iOS only). + * + * @param enabled Determines whether to enable in-ear monitoring. + * - true: Enable. + * - false: (Default) Disable. + * @param includeAudioFilters The type of the ear monitoring: #EAR_MONITORING_FILTER_TYPE + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableEarMonitor(bool enable, int includeAudioFilters) = 0; + /** Register an local audio track observer + * + * @param observer A pointer to the local audio track observer: \ref agora::rtc::ILocalAudioTrackObserver + * "ILocalAudioTrackObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerTrackObserver(ILocalAudioTrackObserver* observer) = 0; + /** Releases the local audio track observer + * + * @param observer A pointer to the local audio track observer: \ref agora::rtc::ILocalAudioTrackObserver + * "ILocalAudioTrackObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterTrackObserver(ILocalAudioTrackObserver* observer) = 0; + + protected: + ~ILocalAudioTrack() {} +}; + +/** + * The statistics of a remote audio track. + */ +struct RemoteAudioTrackStats { + /** + * The user ID of the remote user who sends the audio track. + */ + uid_t uid; + /** + * The audio quality of the remote audio track: #QUALITY_TYPE. + */ + int quality; + /** + * The network delay (ms) from the sender to the receiver. + */ + int network_transport_delay; + /** + * The delay (ms) from the receiver to the jitter buffer. + */ + uint32_t jitter_buffer_delay; + /** + * The audio frame loss rate in the reported interval. + */ + int audio_loss_rate; + /** + * The number of audio channels. + */ + int num_channels; + /** + * The sample rate (Hz) of the received audio track in the reported interval. + */ + int received_sample_rate; + /** + * The average bitrate (Kbps) of the received audio track in the reported interval. + * */ + int received_bitrate; + /** + * The total freeze time (ms) of the remote audio track after the remote user joins the channel. + * In a session, audio freeze occurs when the audio frame loss rate reaches 4%. + * The total audio freeze time = The audio freeze number × 2 seconds. + */ + int total_frozen_time; + /** + * The total audio freeze time as a percentage (%) of the total time when the audio is available. + * */ + int frozen_rate; + /** + * The number of audio bytes received. + */ + int64_t received_bytes; + /** + * The average packet waiting time (ms) in the jitter buffer. + */ + int mean_waiting_time; + /** + * The samples of expanded speech. + */ + size_t expanded_speech_samples; + /** + * The samples of expanded noise. + */ + size_t expanded_noise_samples; + /** + * The timestamps since last report. + */ + uint32_t timestamps_since_last_report; + /** + * The minimum sequence number. + */ + uint16_t min_sequence_number; + /** + * The maximum sequence number. + */ + uint16_t max_sequence_number; + /** + * The audio energy. + */ + int32_t audio_level; + /** + * audio downlink average process time + */ + uint32_t downlink_process_time_ms; + /** + * audio neteq loss because of expired + */ + uint32_t packet_expired_loss; + /** + * audio neteq packet arrival expired time ms + */ + uint32_t packet_max_expired_ms; + /** + * audio neteq jitter peak num in two second + */ + uint32_t burst_peak_num; + /** + * audio neteq jitter calc by burst opti feature + */ + uint32_t burst_jitter; + /** + * audio base target level + */ + uint32_t target_level_base_ms; + /** + * audio average target level + */ + uint32_t target_level_prefered_ms; + /** + * audio average accelerate ratio in 2s + */ + uint16_t accelerate_rate; + /** + * audio average preemptive expand ratio in 2s + */ + uint16_t preemptive_expand_rate; + /** + * The count of 80 ms frozen in 2 seconds + */ + uint16_t frozen_count_80_ms; + /** + * The time of 80 ms frozen in 2 seconds + */ + uint16_t frozen_time_80_ms; + /** + * The count of 200 ms frozen in 2 seconds + */ + uint16_t frozen_count_200_ms; + /** + * The time of 200 ms frozen in 2 seconds + */ + uint16_t frozen_time_200_ms; + /** + * The estimate delay + */ + uint32_t delay_estimate_ms; + /** + * The MOS value + */ + uint32_t mos_value; + /** + * Duration of inbandfec + */ + int32_t fec_decode_ms; + /** + * The total time (ms) when the remote user neither stops sending the audio + * stream nor disables the audio module after joining the channel. + */ + uint64_t total_active_time; + /** + * The total publish duration (ms) of the remote audio stream. + */ + uint64_t publish_duration; + + int32_t e2e_delay_ms; + /** + * Quality of experience (QoE) of the local user when receiving a remote audio stream. See #EXPERIENCE_QUALITY_TYPE. + */ + int qoe_quality; + /** + * The reason for poor QoE of the local user when receiving a remote audio stream. See #EXPERIENCE_POOR_REASON. + */ + int32_t quality_changed_reason; + + /** + * The type of downlink audio effect. + */ + int32_t downlink_effect_type; + + RemoteAudioTrackStats() : + uid(0), + quality(0), + network_transport_delay(0), + jitter_buffer_delay(0), + audio_loss_rate(0), + num_channels(0), + received_sample_rate(0), + received_bitrate(0), + total_frozen_time(0), + frozen_rate(0), + received_bytes(0), + mean_waiting_time(0), + expanded_speech_samples(0), + expanded_noise_samples(0), + timestamps_since_last_report(0), + min_sequence_number(0xFFFF), + max_sequence_number(0), + audio_level(0), + downlink_process_time_ms(0), + packet_expired_loss(0), + packet_max_expired_ms(0), + burst_peak_num(0), + burst_jitter(0), + target_level_base_ms(0), + target_level_prefered_ms(0), + accelerate_rate(0), + preemptive_expand_rate(0), + frozen_count_80_ms(0), + frozen_time_80_ms(0), + frozen_count_200_ms(0), + frozen_time_200_ms(0), + delay_estimate_ms(0), + mos_value(0), + fec_decode_ms(-1), + total_active_time(0), + publish_duration(0), + e2e_delay_ms(0), + qoe_quality(0), + quality_changed_reason(0), + downlink_effect_type(0) {} +}; + +/** + * The IRemoteAudioTrack class. + */ +class IRemoteAudioTrack : public IAudioTrack { + public: + /** + * Gets the statistics of the remote audio track. + * @param stats A reference to the statistics of the remote audio track: RemoteAudioTrackStats. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getStatistics(RemoteAudioTrackStats& stats) = 0; + + /** + * Gets the state of the remote audio. + * @return The state of the remote audio: #REMOTE_AUDIO_STATE. + */ + virtual REMOTE_AUDIO_STATE getState() = 0; + + /** + * Registers an `IMediaPacketReceiver` object. + * + * You need to implement the `IMediaPacketReceiver` class in this method. Once you successfully register + * the media packet receiver, the SDK triggers the `onMediaPacketReceived` callback when it receives an + * audio packet. + * + * @param packetReceiver The pointer to the `IMediaPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerMediaPacketReceiver(IMediaPacketReceiver* packetReceiver) = 0; + + /** + * Releases the `IMediaPacketReceiver` object. + * @param packetReceiver The pointer to the `IMediaPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterMediaPacketReceiver(IMediaPacketReceiver* packetReceiver) = 0; + + /** + * Registers an `IAudioEncodedFrameReceiver` object. + * + * You need to implement the `IAudioEncodedFrameReceiver` class in this method. Once you successfully register + * the media packet receiver, the SDK triggers the `onEncodedAudioFrameReceived` callback when it receives an + * audio packet. + * + * @param packetReceiver The pointer to the `IAudioEncodedFrameReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioEncodedFrameReceiver(IAudioEncodedFrameReceiver* packetReceiver) = 0; + + /** + * Releases the `IAudioEncodedFrameReceiver` object. + * @param packetReceiver The pointer to the `IAudioEncodedFrameReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioEncodedFrameReceiver(IAudioEncodedFrameReceiver* packetReceiver) = 0; + + /** Sets the sound position and gain + + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + - 0.0: the remote sound comes from the front. + - -1.0: the remote sound comes from the left. + - 1.0: the remote sound comes from the right. + @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. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteVoicePosition(float pan, float gain) = 0; + + /** enable spatial audio + + @param enabled enable/disable spatial audio: + - true: enable spatial audio. + - false: disable spatial audio. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSpatialAudio(bool enabled) = 0; + + /** Sets remote user parameters for spatial audio + + @param params spatial audio parameters + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteUserSpatialAudioParams(const agora::SpatialAudioParams& params) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraCameraCapturer.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraCameraCapturer.h new file mode 100644 index 0000000..30e2856 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraCameraCapturer.h @@ -0,0 +1,565 @@ +// +// Agora SDK +// +// Copyright (c) 2019 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { +class IVideoSinkBase; +class ICameraCaptureObserver; +/** + * The ICameraCapturer class, which provides access to a camera capturer. + */ +class ICameraCapturer : public RefCountInterface { + + public: + /** + * The camera source. + */ + enum CAMERA_SOURCE { + /** + * The camera source is the rear camera. + */ + CAMERA_BACK, + /** + * The camera source is the front camera. + */ + CAMERA_FRONT, + }; + + /** + * The camera state. + */ + enum CAMERA_STATE { + /** + * The camera source is started. + */ + CAMERA_STARTED, + /** + * The camera source is stopped. + */ + CAMERA_STOPPED, + }; + + // Interface for receiving information about available camera devices. + /** + * The IDeviceInfo class, which manages the information of available cameras. + */ + class IDeviceInfo { + public: + virtual ~IDeviceInfo() {} + + /** + * Releases the device. + */ + virtual void release() = 0; + + /** + * Gets the number of all available cameras. + * @return The number of all available cameras. + */ + virtual uint32_t NumberOfDevices() = 0; + + /** + * Gets the name of a specified camera. + * @param deviceNumber The index number of the device. + * @param deviceNameUTF8 The name of the device. + * @param deviceNameLength The length of the device name. + * @param deviceUniqueIdUTF8 The unique ID of the device. + * @param deviceUniqueIdLength The length of the device ID. + * @param productUniqueIdUTF8 The unique ID of the product. + * @param productUniqueIdLength The length of the product ID. + * @param deviceTypeUTF8 The camera type of the device. + * @param deviceTypeLength The length of the camera type. + * @return + * The name of the device in the UTF8 format: Success. + */ + virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8, + uint32_t deviceNameLength, char* deviceUniqueIdUTF8, + uint32_t deviceUniqueIdLength, char* productUniqueIdUTF8 = 0, + uint32_t productUniqueIdLength = 0, + char* deviceTypeUTF8 = 0, uint32_t deviceTypeLength = 0) = 0; + + /** + * Sets the capability number for a specified device. + * @param deviceUniqueIdUTF8 The pointer to the ID of the device in the UTF8 format. + * @return + * The capability number of the device. + */ + virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) = 0; + + /** + * Gets the capability of a specified device. + * @param deviceUniqueIdUTF8 The pointer to the ID of the device in the UTF8 format. + * @param deviceCapabilityNumber The capability number of the device. + * @param capability The reference to the video capability. See {@link VideoFormat}. + * @return + * The capability number of the device. + */ + virtual int32_t GetCapability(const char* deviceUniqueIdUTF8, + const uint32_t deviceCapabilityNumber, + VideoFormat& capability) = 0; + }; + + public: +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE) + /** + * Sets the camera source. + * + * @note + * This method applies to Android and iOS only. + * + * @param source The camera source that you want to capture. See #CAMERA_SOURCE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraSource(CAMERA_SOURCE source) = 0; + /** + * Gets the camera source. + * + * @note + * This method applies to Android and iOS only. + * + * @return The camera source. See #CAMERA_SOURCE. + */ + virtual CAMERA_SOURCE getCameraSource() = 0; + /** + * Switch the camera source + * + * @note + * This method applies to Android and iOS only. + */ + virtual void switchCamera() = 0; + /** + * Returns whether zooming is supported by the current device. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after the device is initialized. + * + * @return + * - true: zooming is supported. + * - false: zooming is not supported or device is not initialized. + */ + virtual bool isZoomSupported() = 0; + /** + * Sets the zooming factor of the device. + * + * @note + * This method applies to Android and iOS only. + * + * @param zoomValue The zooming factor of the device. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t setCameraZoom(float zoomValue) = 0; + /** + * Gets the max zooming factor of the device. + * + * @note + * This method applies to Android and iOS only. + * + * @return + * - The max zooming factor of the device + */ + virtual float getCameraMaxZoom() = 0; + /** + * Returns whether auto-focus is supported by the current device. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after device is initialized. + * + * @return + * - true: auto-focus is supported. + * - false: auto-focus is not supported or device is not initialized. + */ + virtual bool isFocusSupported() = 0; + /** + * Sets the focus area of the current device. + * @note + * This method applies to Android and iOS only. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t setCameraFocus(float x, float y) = 0; + /** + * Returns whether auto face focus is supported by the current device. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after device is initialized. + * + * @return + * - true: auto-face-focus is supported. + * - false: auto-face-focus is not supported or device is not initialized. + */ + virtual bool isAutoFaceFocusSupported() = 0; + /** + * Enables or disables auto face focus. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after device is initialized. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t setCameraAutoFaceFocus(bool enable) = 0; + /** + * Enables or disables auto face detection. + * @note + * This method applies to Android and iOS only. + * This interface returns valid values only after device is initialized. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t enableFaceDetection(bool enable) = 0; + + /** + * Checks whether the camera face detect is supported. + * + * @return + * - true: The camera face detect is supported. + * - false: The camera face detect is not supported. + */ + virtual bool isCameraFaceDetectSupported() = 0; + + /** + * Checks whether the camera flash function is supported. + * + * The SDK uses the front camera by default, so if you call `isCameraTorchSupported` directly, + * you can find out from the return value whether the device supports enabling the flash + * when using the front camera. If you want to check whether the device supports enabling the + * flash when using the rear camera, call \ref IRtcEngine::switchCamera "switchCamera" + * to switch the camera used by the SDK to the rear camera, and then call `isCameraTorchSupported`. + * + * @note + * - Call this method after the camera is started. + * - This method is for Android and iOS only. + * - On iPads with system version 15, even if `isCameraTorchSupported` returns true, you might + * fail to successfully enable the flash by calling \ref IRtcEngine::setCameraTorchOn "setCameraTorchOn" + * due to system issues. + * + * @return + * - true: The device supports enabling the flash. + * - false: The device does not support enabling the flash. + */ + virtual bool isCameraTorchSupported() = 0; + + /** + * @note + * - Call this method after the camera is started. + * - This method is for Android and iOS only. + * - On iPads with system version 15, even if \ref IRtcEngine::isCameraTorchSupported "isCameraTorchSupported" + * returns true, you might fail to successfully enable the flash by calling `setCameraTorchOn` due to + * system issues. + * + * @param isOn Determines whether to enable the flash: + * - true: Enable the flash. + * - false: Disable the flash. + * + * @return + * - 0: Success + * - < 0: Failure + */ + virtual int setCameraTorchOn(bool isOn) = 0; + + /** Checks whether the camera exposure function is supported. + * + * Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`. + * + * @since v2.3.2. + * @return + *
      + *
    • true: The device supports the camera exposure function.
    • + *
    • false: The device does not support the camera exposure function.
    • + *
    + */ + virtual bool isCameraExposurePositionSupported() = 0; + + /** Sets the camera exposure position. + * + * Ensure that you call this method after the camera starts, for example, by calling `startPreview` or `joinChannel`. + * + * A successful setCameraExposurePosition method call triggers the {@link IRtcEngineEventHandler#onCameraExposureAreaChanged onCameraExposureAreaChanged} callback on the local client. + * @since v2.3.2. + * @param positionXinView The horizontal coordinate of the touch point in the view. + * @param positionYinView The vertical coordinate of the touch point in the view. + * + * @return + *
      + *
    • 0: Success.
    • + *
    • < 0: Failure.
    • + *
    + */ + virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0; + + /** + * @brief Set the camera mirror mode. + * + * This method applies to iOS only. It supports setting the mirror mode within and outside a channel. + * + * @param mirror The desired video mirror mode of the camera. + * + * Key considerations: + * - Call this method before starting the camera. The preferred call sequence is: setCameraMirror -> startPreview -> joinChannel. + * - Supported mirror modes are VIDEO_MIRROR_MODE_AUTO (front camera mirrored), VIDEO_MIRROR_MODE_ENABLED (front and back cameras mirrored), and VIDEO_MIRROR_MODE_DISABLED (no mirroring). + * - To optimize performance by using capture-side mirroring instead of calling setVideoEncoderConfiguration or videoframeobserver's getMirrorApplied method. + * - Use setLocalVideo and setRemoteVideo with the desired mirror settings for local and remote rendering. + Example usage: + Using the front camera, local mirroring and remote non-mirroring. + Using the rear camera, local non-mirroring, remote non-mirroring. + - No stickers.: + local:setLocalVideo:mirrorMode(auto) + remote:setRemoteVideo:mirrorMode(auto) + - With stickers: + local:setCameraMirror(auto) + setLocalVideo:mirrorMode(disable) + remote:setRemoteVideo:mirrorMode(auto) + * The API also supports private parameters: + * - Use parameter "{\"rtc.camera_capture_mirror_mode\":0}" to manually set the mirror mode. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ +virtual int setCameraMirror(VIDEO_MIRROR_MODE_TYPE mirror) = 0; + +/** + * Returns whether exposure value adjusting is supported by the current device. + * @note + * This method applies to iOS only. + * This interface returns valid values only after the device is initialized. + * + * @return + * - true: exposure value adjusting is supported. + * - false: exposure value adjusting is not supported or device is not initialized. + */ + virtual bool isCameraExposureSupported() = 0; + /** + * Sets the exposure factor of the device. + * + * @note + * This method applies to iOS only. + * + * @param exposureValue The exposure value bias factor of the device. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int32_t setCameraExposureFactor(float exposureValue) = 0; + +#if (defined(__APPLE__) && TARGET_OS_IOS) + /** + * Enables or disables the AVCaptureMultiCamSession. + * + * @param enable Determines whether to use the AVCaptureMultiCamSession: + * - true: Enable the AVCaptureMultiCamSession. + * - false: Disable the AVCaptureMultiCamSession. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual bool enableMultiCamera(bool enable) = 0; + /** + * Checks whether the camera auto exposure function is supported. + * + * @return + * - true: The camera auto exposure function is supported. + * - false: The camera auto exposure function is not supported. + */ + virtual bool isCameraAutoExposureFaceModeSupported() = 0; + + + /** + * Enables the camera auto exposure face function. + * + * @param enabled Determines whether to enable the camera auto exposure face mode. + * - true: Enable the auto exposure face function. + * - false: Do not enable the auto exposure face function. + * + * @return + *
      + *
    • 0: Success.
    • + *
    • < 0: Failure.
    • + *
    + */ + virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0; +#endif + +#elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \ + (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + + /** + * Creates a DeviceInfo object. + * + * @note + * This method applies to Windows, macOS, and Linux only. + * @return + * - The pointer to \ref agora::rtc::ICameraCapturer::IDeviceInfo "IDeviceInfo": Success. + * - An empty pointer NULL: Failure. + */ + virtual IDeviceInfo* createDeviceInfo() = 0; + /** + * Initializes the device with the device ID. + * + * @note + * This method applies to Windows, macOS, and Linux only. + * + * @param deviceId The pointer to the device ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithDeviceId(const char* deviceId) = 0; + /** + * Initializes the device with the device name. + * + * @note + * This method applies to Windows, macOS, and Linux only. + * + * @param deviceName The pointer to the device name. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithDeviceName(const char* deviceName) = 0; +#endif + + /** + * Set the device orientation of the capture device + * @param VIDEO_ORIENTATION orientaion of the device 0(by default), 90, 180, 270 + */ + virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation) = 0; + + /** + * Sets the format of the video captured by the camera. + * + * If you do not set the video capturing format, the SDK automatically chooses a proper format according to the video encoder configuration of the video track. + * + * @param capture_format The reference to the video format: VideoFormat. + */ + virtual void setCaptureFormat(const VideoFormat& capture_format) = 0; + /** + * Gets the format of the video captured by the camera. + * @return + * VideoFormat. + */ + virtual VideoFormat getCaptureFormat() = 0; + /** + * Register a camera observer. + * + * @param observer Instance of the capture observer. + */ + virtual int registerCameraObserver(ICameraCaptureObserver* observer) = 0; + /** + * Unregisters the camera observer. + * + * @param observer Instance of the capture observer. + */ + virtual int unregisterCameraObserver(ICameraCaptureObserver* observer) = 0; + + protected: + ~ICameraCapturer() {} +}; +/** + * The ICameraCaptureObserver class, which handles camera capture events. + */ +class ICameraCaptureObserver { + public: + /** + * Occurs when the camera focus area changes. + * + * @note The SDK triggers this callback when the local user changes the camera focus position by + * calling the \ref agora::rtc::ICameraCapturer::setCameraFocus "setCameraFocus" method. + * + * @param imageWidth Width of the changed camera focus area. + * @param imageHeight Height of the changed camera focus area. + * @param x x coordinate of the changed camera focus area. + * @param y y coordinate of the changed camera focus area. + */ + virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) { + (void) imageWidth; + (void) imageHeight; + (void) x; + (void) y; + + } + /** + * Reports the face detection result of the local user. Applies to Android and iOS only. + * + * Once you enable face detection by calling \ref agora::rtc::ICameraCapturer::setCameraFaceDetection "setCameraFaceDetection" (true), + * you can get the following information on the local user in real-time: + * - The width and height of the local video. + * - The position of the human face in the local video. + * - The distance between the human face and the device screen. + * This value is based on the fitting calculation of the local video size and the position of the human face. + * + * @note + * - If the SDK does not detect a face, it reduces the frequency of this callback to reduce power consumption on the local device. + * - The SDK stops triggering this callback when a human face is in close proximity to the screen. + * - On Android, the distance value reported in this callback may be slightly different from the actual distance. + * Therefore, Agora does not recommend using it for accurate calculation. + * + * @param imageWidth The width (px) of the local video. + * @param imageHeight The height (px) of the local video. + * @param vecRectangle The position and size of the human face on the local video: + * - `x`: The x coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, + * the x coordinate represents the relative lateral displacement of the top left corner of the human face to the origin. + * - `y`: The y coordinate (px) of the human face in the local video. Taking the top left corner of the captured video as the origin, + * the y coordinate represents the relative longitudinal displacement of the top left corner of the human face to the origin. + * - `width`: The width (px) of the human face in the captured video. + * - `height`: The height (px) of the human face in the captured video. + * @param vecDistance The distance (cm) between the human face and the screen. + * @param numFaces The number of faces detected. If the value is 0, it means that no human face is detected. + */ + virtual void onFacePositionChanged( + int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) { + (void) imageWidth; + (void) imageHeight; + (void) vecRectangle; + (void) vecDistance; + (void) numFaces; + } + + /** Occurs when the camera exposure area changes. + * + * The SDK triggers this callback when the local user changes the camera exposure position by calling the setCameraExposurePosition method. + * + * @note This callback is for Android and iOS only. + * + * @param x x coordinate of the changed camera exposure area. + * @param y y coordinate of the changed camera exposure area. + * @param width Width of the changed camera exposure area. + * @param height Height of the changed camera exposure area. + */ + virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) { + (void)x; + (void)y; + (void)width; + (void)height; + } + + virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source) { + (void) state; + (void) source; + } + + protected: + virtual ~ICameraCaptureObserver() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraExtensionControl.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraExtensionControl.h new file mode 100644 index 0000000..5b27ffe --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraExtensionControl.h @@ -0,0 +1,100 @@ +// +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) +#include "AgoraBase.h" +#include "AgoraRefPtr.h" +#include "AgoraRefCountedObject.h" +#include "IAgoraLog.h" +#include "NGIAgoraVideoFrame.h" +#include "NGIAgoraExtensionProvider.h" + +namespace agora { +namespace rtc { +class IExtensionProvider; +/** + * Interface for handling agora extensions. + */ +class IExtensionControl { + public: + /** + * Agora Extension Capabilities. + */ + struct Capabilities { + /** + * Whether to support audio extensions. + */ + bool audio; + /** + * Whether to support video extensions. + */ + bool video; + }; + + /** + * Gets the capabilities of agora extensions. + * + * @param capabilities Supported extension capabilities. + */ + virtual void getCapabilities(Capabilities& capabilities) = 0; + + /** + * Recycles internal frame memory with a specified Video frame type. + * + * The SDK automatically recycles deprecated video frames. However, + * you can still call this method to perform an immediate memory recycle. + * @param type Frame type to be recycled. + */ + virtual void recycleVideoCache() = 0; + + /** + * This method dumps the content of the video frame to the specified file. + * + * @return + * - 0: The method call succeeds. + * - <0: The method call fails. + */ + virtual int dumpVideoFrame(agora_refptr frame, const char* file) = 0; + + /** + * Sets log file. + * + * @param level Logging level. See #commons::LOG_LEVEL. + * @param message Message to add to the log file. + * @return + * - 0: The method call succeeds. + * - <0: The method call fails. + */ + virtual int log(commons::LOG_LEVEL level, const char* message) = 0; + + /** + * Post extension events to SDK. + * + * @param provider name of the provider + * @param extension name of the extension + * @param event_key key of the extension event + * @param event_json_str string of the extension event + * @return + * - 0: The method call succeeds. + * - <0: The method call fails. + */ + virtual int fireEvent(const char* provider, const char* extension, const char* event_key, const char* value) = 0; + + /** + * Register provider to the SDK + * @param provider name of the provider + * @param instance instance of the provider + */ + virtual int registerProvider(const char* provider, agora_refptr instance) = 0; + + protected: + virtual ~IExtensionControl() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraExtensionProvider.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraExtensionProvider.h new file mode 100644 index 0000000..9a1a541 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraExtensionProvider.h @@ -0,0 +1,122 @@ +// +// Agora SDK +// +// Copyright (c) 2021 Agora.io. All rights reserved. +// + +#pragma once + +#include "AgoraRefPtr.h" +#include "NGIAgoraMediaNode.h" +#include "AgoraExtensionVersion.h" + +namespace agora { +namespace rtc { +class IExtensionControl; + +/** + * Interfaces for Extension Provider + * User can implement these interfaces for providing their own media node implementations to SDK. + * Please refer to \ref agora::RefCountedObject to wrap your implementation so that it can be + * held by agora::agora_refptr. + * For example: + * class YourExtensionProvide: public IExtensionProvider { + * // Your Concrete implementaion + * }; + * + * // Use agroa::RefCountedObject to provide RefCountInterface implementation for you implementation, + * // intantiate and wrap it with agora_refptr. + * + * agora_refptr provider = new RefCountedObject(Arg1, Arg2, ...); + * + * You can instantiate your AudioFilter/VideoFilter/VideoSink in the same way. + */ + +class IExtensionProvider : public RefCountInterface { + public: + enum EXTENSION_TYPE { + /** + * note: discarded, Don't use it anymore. + */ + AUDIO_FILTER, + VIDEO_PRE_PROCESSING_FILTER, + VIDEO_POST_PROCESSING_FILTER, + AUDIO_SINK, + VIDEO_SINK, + /* + * Used to modify locally captured audio data to play, such as ear monitoring. + */ + AUDIO_RECORDING_LOCAL_PLAYBACK_FILTER = 10000, + /* + * Used to modify audio data after the local APM (3A). + */ + AUDIO_POST_PROCESSING_FILTER = 10001, + /* + * Used to modify received and decoded remote user audio data. + */ + AUDIO_REMOTE_USER_PLAYBACK_FILTER = 10002, + /* + * note: It is used internally by agora and does not support users other than agora. + * + * Used to modify the audio data of the sender's PCM source to take effect for sending and local playback. + */ + AUDIO_PCM_SOURCE_FILTER = 10003, + /* + * note: It is used internally by agora and does not support users other than agora. + * + * Used to Modifying the audio data of the sender's PCM source is only effect for the sending. + */ + AUDIO_PCM_SOURCE_SENDING_FILTER = 10004, + /* + * note: It is used internally by agora and does not support users other than agora. + * + * Used to Modifying the audio data of the sender's PCM source is only effect for the local playback. + */ + AUDIO_PCM_SOURCE_LOCAL_PLAYBACK_FILTER = 10005, + /* + * note: It is used internally by agora and does not support users other than agora. + * + * Used to modify local playback audio data after the remote audio mixed. + */ + AUDIO_REMOTE_MIXED_PLAYBACK_FILTER = 10006, + UNKNOWN = 0xFFFF, + }; + + struct ExtensionMetaInfo { + EXTENSION_TYPE type; + const char* extension_name; + }; + + virtual void setExtensionControl(IExtensionControl* control) {} + + virtual void enumerateExtensions(ExtensionMetaInfo* extension_list, + int& extension_count) { + (void) extension_list; + extension_count = 0; + } + + virtual agora_refptr createAudioFilter(const char* name) { + return NULL; + } + + virtual agora_refptr createVideoFilter(const char* name) { + return NULL; + } + + virtual agora_refptr createVideoSink(const char* name) { + return NULL; + } + + virtual void setProperty(const char* key, const char* value) {} + + protected: + virtual ~IExtensionProvider() {} +}; + +class IExtensionProviderV2 : public IExtensionProvider { + public: + virtual void getExtensionVersion(const char* extension_name, ExtensionVersion& version) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraLocalUser.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraLocalUser.h new file mode 100644 index 0000000..52bdb62 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraLocalUser.h @@ -0,0 +1,1485 @@ +// +// Agora SDK +// +// Created by Zheng Ender in 2018-01. +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include + +#include "AgoraBase.h" +#include "AgoraOptional.h" + +namespace agora { +namespace media { +class IAudioFrameObserver; +} + +namespace rtc { +class IAudioEngineWrapper; + +class ILocalUserObserver; +class ILocalVideoTrack; +class IRemoteVideoTrack; +class IVideoFrameObserver2; + +class IMediaControlPacketSender; +class IMediaControlPacketReceiver; +struct AudioEncoderConfiguration; +struct VideoEncoderConfiguration; + +class ILocalAudioTrack; +struct RemoteAudioTrackStats; +class IRemoteAudioTrack; +struct LocalVideoTrackStats; +struct RemoteVideoTrackStats; +class IMediaPacketReceiver; +class IVideoSinkBase; +/** + * The ILocalUser class defines the behavior and state of a local user. + * + * Each RTC connection has its own local user. Apps can get the local + * user object by calling \ref agora::rtc::IRtcConnection::getLocalUser + * "IRtcConnection::getLocalUser". + * + * Each local user has two user roles: broadcaster (publisher and subscriber) and + * audience (subscriber only). A publisher publishes audio and video tracks, while + * audience receive them. + */ +class ILocalUser { + public: + /** + * The statistics related to audio network adaptation (ANA). + */ + struct ANAStats { + /** + * The number of actions taken by the ANA bitrate controller since the start of the call. + * + * If you do not set this parameter, the ANA bitrate controller is disabled. + */ + agora::Optional bitrate_action_counter; + /** + * The number of actions taken by the ANA channel controller since the start of the call. + * + * If you do not set this parameter, the ANA channel controller is disabled. + */ + agora::Optional channel_action_counter; + /** + * The number of actions taken by the ANA DTX controller since the start of the call. + * + * If you do not set this parameter, the ANA DTX controller is disabled. + */ + agora::Optional dtx_action_counter; + /** + * The number of actions taken by the ANA FEC (Forward Error Correction) controller since the start of the call. + * + * If you do not set this parameter, the ANA FEC controller is disabled. + */ + agora::Optional fec_action_counter; + /** + * The number of times that the ANA frame length controller increases the frame length + * since the start of the call. + * + * If you do not set this parameter, the ANA frame length controller is disabled. + */ + agora::Optional frame_length_increase_counter; + /** + * The number of times that the ANA frame length controller decreases the frame length + * since the start of the call. + * + * If you so not set this parameter, the ANA frame length controller is disabled. + */ + agora::Optional frame_length_decrease_counter; + /** + * The uplink packet loss fractions set by the ANA FEC controller. + * + * If you do not set this parameter, the ANA FEC controller is not active. + */ + agora::Optional uplink_packet_loss_fraction; + }; + + /** + * The statistics related to audio processing. + */ + struct AudioProcessingStats { + /** + * The echo return loss (ERL). + * + * ERL = 10log_10(P_far / P_echo). + * + * ERL measures the signal loss that comes back as an echo. A higher ratio corresponds to a smaller + * amount of echo. The higher the ERL the better. + */ + agora::Optional echo_return_loss; + // + /** + * The echo return loss enhancement (ERLE). + * + * ERLE = 10log_10(P_echo / P_out). + * + * The performance of an echo canceller is measured in echo return loss enhancement, which is the amount + * of additional signal loss applied by the echo canceller. + * + * The total signal loss of the echo is the sum of ERL and ERLE. + */ + agora::Optional echo_return_loss_enhancement; + /** + * The fraction of time that the AEC (Acoustic Echo Cancelling) linear filter is divergent, in a + * 1-second non-overlapped aggregation window. + */ + agora::Optional divergent_filter_fraction; + + /** + * The delay metrics (ms). + * + * It consists of the delay median and standard deviation. It also consists of the + * fraction of delay estimates that can make the echo cancellation perform poorly. The values are + * aggregated until the first call of \ref agora::rtc::IRemoteAudioTrack::getStatistics "getStatistics" and afterwards aggregated and updated every + * second. + * @note + * If there are several clients pulling metrics from + * `getStatistics` during a session, the first call from any of them will change to one second + * aggregation window for all. + */ + agora::Optional delay_median_ms; + /** + * The delay standard deviation(ms). + */ + agora::Optional delay_standard_deviation_ms; + + /** + * The residual echo detector likelihood. + */ + agora::Optional residual_echo_likelihood; + /** + * The maximum residual echo likelihood from the last time period. + */ + agora::Optional residual_echo_likelihood_recent_max; + + /** + * The instantaneous delay estimate produced in the AEC (ms). + * The value is the instantaneous value at the time of calling \ref agora::rtc::IRemoteAudioTrack::getStatistics "getStatistics". + */ + agora::Optional delay_ms; + }; + + /** + * The detailed statistics of the local audio. + */ + struct LocalAudioDetailedStats { + /** + * The synchronization source (SSRC) to identify the stream of RTP packets from the local audio. + */ + uint32_t local_ssrc; + /** + * The number of sent audio bytes. + */ + int64_t bytes_sent; + /** + * The number of sent audio packets. + */ + int32_t packets_sent; + /** + * The number of lost audio packets. + */ + int32_t packets_lost; + /** + * The fraction packet loss reported for this SSRC. + */ + float fraction_lost; + /** + * The codec name. + */ + char codec_name[media::base::kMaxCodecNameLength]; + /** + * The payload type as used in RTP encoding or decoding. + */ + agora::Optional codec_payload_type; + /** + * The ext sequence number. + */ + int32_t ext_seqnum; + /** + * The jitter duration (ms). + */ + int32_t jitter_ms; + /** + * The RTT (Round-Trip Time) duration (ms). + */ + int64_t rtt_ms; + /** + * The audio level (dBov) of the media source. + */ + int32_t audio_level; + /** + * The audio energy of the media source. + */ + double total_input_energy; + /** + * The audio duration of the media source. + */ + double total_input_duration; + /** + * Whether the typing noise is detected. + * - `true`: The typing noise is detected. + * - `false`: The typing noise is not detected. + */ + bool typing_noise_detected; + + /** + * The audio process time from record done to encode done + */ + + ANAStats ana_statistics; + AudioProcessingStats apm_statistics; + + LocalAudioDetailedStats() : local_ssrc(0), bytes_sent(0), packets_sent(0), packets_lost(-1), fraction_lost(-1.0f), + ext_seqnum(-1), jitter_ms(-1), rtt_ms(-1), audio_level(-1), + total_input_energy(0.0), total_input_duration(0.0), typing_noise_detected(false) { + memset(codec_name, 0, sizeof(codec_name)); + } + }; + + enum NS_MODE { + ElderNsStatistical = 0, /* Elder Statistical Noise Suppression.*/ + NsNGStatistical = 1, /* Next Generation Statistical Noise Suppression.*/ + NsNG = 2 /* Next Generation Noise Suppression.*/ + }; + enum NS_LEVEL { + Soft = 0,/* Soft Noise Suppression.*/ + Aggressive = 1 /* Aggressiveness Noise Suppression.*/ + }; + enum NS_DELAY { + HighQuality = 0,/* High Audio Quality with High Delay.*/ + Balance = 1,/* Balanced Audio Quality and Delay.*/ + LowDelay = 2/* Slight Low Audio Quality with Low Delay.*/ + }; + + public: + virtual ~ILocalUser() {} + + /** + * Sets the role of the user. + * + * You can call this method either before or after connecting to an Agora channel: + * - Before connecting: This method sets the user role as publisher or subscriber (default). + * - After connecting: This method allows you to switch the user role between publisher and + * subscriber. + * The \ref IRtcConnectionObserver::onChangeRoleSuccess "onChangeRoleSuccess" and + * \ref IRtcConnectionObserver::onChangeRoleFailure "onChangeRoleFailure" + * callbacks indicate the result of this method call. + * + * @note + * If the token in the \ref IRtcConnection::connect "connect" method does not have the same role + * as `role`, the connection fails with the \ref IRtcConnectionObserver::onConnectionFailure "onConnectionFailure" callback. + * @param role The role of the user. See \ref rtc::CLIENT_ROLE_TYPE "CLIENT_ROLE_TYPE". + */ + virtual void setUserRole(rtc::CLIENT_ROLE_TYPE role) = 0; + + /** + * Gets the role of the user. + * + * @return The role of the user: Success. + */ + virtual CLIENT_ROLE_TYPE getUserRole() = 0; + + + virtual void setAudienceLatencyLevel(AUDIENCE_LATENCY_LEVEL_TYPE level) = 0; + + virtual AUDIENCE_LATENCY_LEVEL_TYPE getAudienceLatencyLevel() = 0; + + /** + * Configures the audio encoder. + * + * The SDK applies the configurations to all the sending audio tracks. + * + * @param config The reference to the audio encoder configurations. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioEncoderConfiguration(const rtc::AudioEncoderConfiguration& config) = 0; + + /** + * Sets the audio parameters and application scenarios. + * + * @param scenario Sets the audio application scenarios: #AUDIO_SCENARIO_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioScenario(AUDIO_SCENARIO_TYPE scenario) = 0; + + /** + * Gets the detailed statistics of the local audio. + * + * @param[out] stats The reference to the detailed statistics of the local audio. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getLocalAudioStatistics(LocalAudioDetailedStats& stats) = 0; + + /** + * Publishes a local audio track to the channel. + * + * By default, all published audio tracks are mixed. + * + * @param audioTrack The local audio track to be published. + * @return + * - 0: Success. + * - < 0: Failure. + * - -5(ERR_REFUSED), if the role of the local user is not broadcaster. + */ + virtual int publishAudio(agora_refptr audioTrack) = 0; + + /** + * Stops publishing the local audio track to the channel. + * + * @param audioTrack The local audio track that you want to stop publishing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishAudio(agora_refptr audioTrack) = 0; + + /** + * Publishes a local video track to the channel. + * + * @param videoTrack The local video track to be published. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int publishVideo(agora_refptr videoTrack) = 0; + + /** + * Stops publishing the local video track to the channel. + * + * @param videoTrack The local video track that you want to stop publishing. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishVideo(agora_refptr videoTrack) = 0; + + /** + * Subscribes to the audio of a specified remote user in channel. + * + * @param userId The ID of the remote user whose audio you want to subscribe to. + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if no such user exists or `userId` is invalid. + */ + virtual int subscribeAudio(user_id_t userId) = 0; + + /** + * Subscribes to the audio of all remote users in the channel. + * + * This method also automatically subscribes to the audio of any subsequent user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int subscribeAllAudio() = 0; + + /** + * Stops subscribing to the audio of a specified remote user in the channel. + * + * @param userId The ID of the user whose audio you want to stop subscribing to. + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if no such user exists or `userId` is invalid. + */ + virtual int unsubscribeAudio(user_id_t userId) = 0; + + /** + * Stops subscribing to the audio of all remote users in the channel. + * + * This method automatically stops subscribing to the audio of any subsequent user, unless you explicitly + * call \ref subscribeAudio "subscribeAudio" or \ref subscribeAllAudio "subscribeAllAudio". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unsubscribeAllAudio() = 0; + + /** + * Adjusts the playback signal volume. + * @param volume The playback volume. The value ranges between 0 and 400, including the following: + * 0: Mute. + * 100: (Default) Original volume. + * 400: Four times the original volume with signal-clipping protection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustPlaybackSignalVolume(int volume) = 0; + + /** + * Gets the current playback signal volume. + * @param volume A pointer to the playback signal volume. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackSignalVolume(int* volume) = 0; + + /* + * Adjust the playback volume of the user specified by uid. + * + * You can call this method to adjust the playback volume of the user specified by uid + * in call. If you want to adjust playback volume of the multi user, you can call this + * this method multi times. + * + * @note + * Please call this method after join channel. + * This method adjust the playback volume of specified user. + * + * @param userId The ID of the Remote user. + * @param volume The playback volume of the specified remote user. The value ranges between 0 and 400, including the following: + * 0: Mute. + * 100: (Default) Original volume. + * 400: Four times the original volume with signal-clipping protection. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int adjustUserPlaybackSignalVolume(user_id_t userId, int volume) = 0; + + /** + * Gets the current playback signal volume of specified user. + * @param userId The ID of the Remote user. + * @param volume A pointer to the playback signal volume. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserPlaybackSignalVolume(user_id_t userId, int* volume) = 0; + + /** Enables/Disables stereo panning for remote users. + + Ensure that you call this method before joinChannel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling \ref agora::rtc::IRtcEngine::setRemoteVoicePosition "setRemoteVoicePosition". + + @param enabled Sets whether or not to enable stereo panning for remote users: + - true: enables stereo panning. + - false: disables stereo panning. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSoundPositionIndication(bool enabled) = 0; + + /** Sets the sound position and gain of a remote user. + + When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games. + + @note + - For this method to work, enable stereo panning for remote users by calling the \ref agora::rtc::IRtcEngine::enableSoundPositionIndication "enableSoundPositionIndication" method before joining a channel. + - This method requires hardware support. For the best sound positioning, we recommend using a wired headset. + - Ensure that you call this method after joining a channel. + + @param userId The ID of the remote user. + @param pan The sound position of the remote user. The value ranges from -1.0 to 1.0: + - 0.0: the remote sound comes from the front. + - -1.0: the remote sound comes from the left. + - 1.0: the remote sound comes from the right. + @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. + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteVoicePosition(user_id_t userId, double pan, double gain) = 0; + + /** enable spatial audio + + @param enabled enable/disable spatial audio: + - true: enable spatial audio. + - false: disable spatial audio. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int enableSpatialAudio(bool enabled) = 0; + + /** Sets remote user parameters for spatial audio + + @param userId The ID of the remote user. + @param param spatial audio parameters + + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setRemoteUserSpatialAudioParams(user_id_t userId, const agora::SpatialAudioParams& param) = 0; + + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrame + * "onPlaybackAudioFrame" callback. + * + * @param numberOfChannels The number of audio channels of the audio frame in the `onPlaybackAudioFrame` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onPlaybackAudioFrame` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * @param mode Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall The number of samples of the audio frame. * + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackAudioFrameParameters(size_t numberOfChannels, + uint32_t sampleRateHz, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode = RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, + int samplesPerCall = 0) = 0; + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onRecordAudioFrame + * "onRecordAudioFrame" callback. + * + * @param numberOfChannels The number of channels of the audio frame in the `onRecordAudioFrame` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onRecordAudioFrame` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * @param mode Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall The number of samples of the audio frame. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRecordingAudioFrameParameters(size_t numberOfChannels, + uint32_t sampleRateHz, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode = RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, + int samplesPerCall = 0) = 0; + + virtual int setPublishAudioFrameParameters(size_t numberOfChannels, + uint32_t sampleRateHz, + int samplesPerCall = 0) = 0; + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onMixedAudioFrame + * "onMixedAudioFrame" callback. + * + * @param numberOfChannels The number of channels of the audio frame in the `onMixedAudioFrame` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onMixedAudioFrame` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMixedAudioFrameParameters(size_t numberOfChannels, + uint32_t sampleRateHz, + int samplesPerCall = 0) = 0; + + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onEarMonitoringAudioFrame + * "onEarMonitoringAudioFrame" callback. + * @param enabled Determines whether to enable ear monitoring audio frame observer. + * - true: Enable ear monitoring audio frame observer. + * - false: Disable ear monitoring audio frame observer. + * @param numberOfChannels The number of audio channels of the audio frame in the `onEarMonitoringAudioFrame` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onEarMonitoringAudioFrame` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * @param mode Use mode of the audio frame. See #RAW_AUDIO_FRAME_OP_MODE_TYPE. + * @param samplesPerCall The number of samples of the audio frame. * + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setEarMonitoringAudioFrameParameters(bool enabled, + size_t numberOfChannels, + uint32_t sampleRateHz, + RAW_AUDIO_FRAME_OP_MODE_TYPE mode = RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, + int samplesPerCall = 0) = 0; + + /** + * Sets the audio frame parameters for the \ref agora::media::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing + * "onPlaybackAudioFrameBeforeMixing" callback. + * + * @param numberOfChannels The number of channels of the audio frame in the `onPlaybackAudioFrameBeforeMixing` callback. + * - 1: Mono. + * - 2: Stereo. + * @param sampleRateHz The sample rate (Hz) of the audio frame in the `onPlaybackAudioFrameBeforeMixing` callback. You can + * set it as 8000, 16000, 32000, 44100, or 48000. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlaybackAudioFrameBeforeMixingParameters(size_t numberOfChannels, + uint32_t sampleRateHz) = 0; + + /** + * Registers an audio frame observer. + * + * You need to implement the `IAudioFrameObserverBase` class in this method, and register the following callbacks + * according to your scenario: + * - \ref agora::media::IAudioFrameObserverBase::onRecordAudioFrame "onRecordAudioFrame": Occurs when the SDK receives the audio data captured by the local recording device. + * - \ref agora::media::IAudioFrameObserverBase::onPlaybackAudioFrame "onPlaybackAudioFrame": Occurs when the SDK receives the remote audio data for playback. + * - \ref agora::media::IAudioFrameObserverBase::onPlaybackAudioFrameBeforeMixing "onPlaybackAudioFrameBeforeMixing": Occurs when the SDK receives the remote audio data of a specified + * remote user before mixing. + * - \ref agora::media::IAudioFrameObserverBase::onMixedAudioFrame "onMixedAudioFrame": Occurs when the SDK receives the mixed data of recorded and playback audio. + * + * @param observer A pointer to the audio frame observer: \ref agora::media::IAudioFrameObserverBase "IAudioFrameObserverBase". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(agora::media::IAudioFrameObserverBase * observer) = 0; + /** + * Releases the audio frame observer. + * + * @param observer The pointer to the audio frame observer: \ref agora::media::IAudioFrameObserverBase "IAudioFrameObserverBase". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioFrameObserver(agora::media::IAudioFrameObserverBase * observer) = 0; + + /** + * Enable the audio spectrum monitor. + * + * @param intervalInMS Sets the time interval(ms) between two consecutive audio spectrum callback. + * The default value is 100. This param should be larger than 10. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableAudioSpectrumMonitor(int intervalInMS = 100) = 0; + /** + * Disalbe the audio spectrum monitor. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disableAudioSpectrumMonitor() = 0; + + /** + * Registers an audio spectrum observer. + * + * You need to implement the `IAudioSpectrumObserver` class in this method, and register the following callbacks + * according to your scenario: + * - \ref agora::media::IAudioSpectrumObserver::onAudioSpectrumComputed "onAudioSpectrumComputed": Occurs when + * the SDK receives the audio data and at set intervals. + * + * @param observer A pointer to the audio spectrum observer: \ref agora::media::IAudioSpectrumObserver + * "IAudioSpectrumObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioSpectrumObserver(agora::media::IAudioSpectrumObserver * observer, void (*safeDeleter)(agora::media::IAudioSpectrumObserver*)) = 0; + /** + * Releases the audio spectrum observer. + * + * @param observer The pointer to the audio spectrum observer: \ref agora::media::IAudioSpectrumObserver + * "IAudioSpectrumObserver". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterAudioSpectrumObserver(agora::media::IAudioSpectrumObserver * observer) = 0; + + /** + * Registers an \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * + * You need to implement the `IVideoEncodedFrameObserver` class in this method. Once you successfully register + * the local encoded frame observer, the SDK triggers the \ref agora::media::IVideoEncodedFrameObserver::onEncodedVideoFrameReceived + * "onEncodedVideoFrameReceived" callback when it receives the encoded video image. + * + * @param observer The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerLocalVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0; + /** + * Releases the \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * @param observer The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterLocalVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0; + /** + * Force trigger to intra-frame the next frame. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int forceNextIntraFrame() = 0; + /** + * Registers an \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * + * You need to implement the `IVideoEncodedFrameObserver` class in this method. Once you successfully register + * the encoded frame observer, the SDK triggers the \ref agora::media::IVideoEncodedFrameObserver::onEncodedVideoFrameReceived + * "onEncodedVideoFrameReceived" callback when it receives the encoded video image. + * + * @param observer The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0; + /** + * Releases the \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * @param observer The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0; + + /** + * Registers an \ref agora::rtc::IVideoFrameObserver2 "IVideoFrameObserver2" object. + * + * You need to implement the `IVideoFrameObserver2` class in this method. Once you successfully register + * the video frame observer, the SDK triggers the \ref agora::media::IVideoFrameObserver2::onFrame + * "onFrame" callback when it receives the video image. + * + * @param observer The pointer to the `IVideoFrameObserver2` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoFrameObserver(IVideoFrameObserver2* observer) = 0; + /** + * Releases the \ref agora::rtc::IVideoFrameObserver2 "IVideoFrameObserver2" object. + * @param observer The pointer to the `IVideoFrameObserver2` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterVideoFrameObserver(IVideoFrameObserver2* observer) = 0; + + virtual int setVideoSubscriptionOptions(user_id_t userId, + const VideoSubscriptionOptions& options) = 0; + + /** + * Sets the blocklist of subscribe remote stream audio. + * + * @param userList The id list of users who do not subscribe to audio. + * @param userNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's audio will not be subscribed, + * even if subscribeAudio(uid) and subscribeAllAudio(true) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioBlocklist(user_id_t* userList, int userNumber) = 0; + + /** + * Sets the allowlist of subscribe remote stream audio. + * + * @param userList The id list of users who do subscribe to audio. + * @param userNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's audio will be subscribed, + * even if unsubscribeAudio(uid) and unsubscribeAllAudio(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to audio. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeAudioAllowlist(user_id_t* userList, int userNumber) = 0; + + /** + * Sets the blocklist of subscribe remote stream video. + * + * @param userList The id list of users who do not subscribe to video. + * @param userNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's video will not be subscribed, + * even if subscribeVideo(uid) and subscribeAllVideo(true) are operated. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoBlocklist(user_id_t* userList, int userNumber) = 0; + + /** + * Sets the allowlist of subscribe remote stream video. + * + * @param userList The id list of users who do subscribe to video. + * @param userNumber The number of uid in uidList. + * + * @note + * If uid is in uidList, the remote user's video will be subscribed, + * even if unsubscribeVideo(uid) and unsubscribeAllVideo(true) are operated. + * + * If a user is in the blocklist and allowlist at the same time, the user will not subscribe to video. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSubscribeVideoAllowlist(user_id_t* userList, int userNumber) = 0; + + /** + * Subscribes to the video of a specified remote user in the channel. + * + * @param userId The ID of the user whose video you want to subscribe to. + * @param subscriptionOptions The reference to the video subscription options: \ref agora::rtc::VideoSubscriptionOptions "VideoSubscriptionOptions". + * For example, subscribing to encoded video data only or subscribing to low-stream video. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if `userId` is invalid. + */ + virtual int subscribeVideo(user_id_t userId, + const VideoSubscriptionOptions &subscriptionOptions) = 0; + + /** + * Subscribes to the video of all remote users in the channel. + * + * This method also automatically subscribes to the video of any subsequent remote user. + * + * @param subscriptionOptions The reference to the video subscription options: \ref agora::rtc::VideoSubscriptionOptions "VideoSubscriptionOptions". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int subscribeAllVideo(const VideoSubscriptionOptions &subscriptionOptions) = 0; + + /** + * Stops subscribing to the video of a specified remote user in the channel. + * + * @param userId The ID of the user whose video you want to stop subscribing to. + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if `userId` is invalid. + */ + virtual int unsubscribeVideo(user_id_t userId) = 0; + + /** + * Stops subscribing to the video of all remote users in the channel. + * + * This method automatically stops subscribing to the video of any subsequent user, unless you explicitly + * call \ref subscribeVideo "subscribeVideo" or \ref subscribeAllVideo "subscribeAllVideo". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unsubscribeAllVideo() = 0; + + /** + * Sets the time interval and the volume smoothing factor of the \ref agora::rtc::ILocalUserObserver::onAudioVolumeIndication "onAudioVolumeIndication" callback. + * + * By default, the SDK triggers the `onAudioVolumeIndication` + * callback once every 500 ms, with a smoothing factor of 3. + * + * @param intervalInMS Sets the time interval(ms) between two consecutive volume indications. The default + * value is 500. + * - ≤ 10: Disables the volume indication. + * - > 10: The time interval (ms) between two consecutive callbacks. + * + * @param smooth The smoothing factor that sets the sensitivity of the audio volume indicator. + * The value range is [0,10]. The greater the value, the more sensitive the indicator.The default value is 3. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT), if `intervalInMS` or `smooth` is out of range. + */ + virtual int setAudioVolumeIndicationParameters(int intervalInMS, int smooth, bool reportVad) = 0; + + /** + * Registers a local user observer object. + * + * You need to implement the \ref agora::rtc::ILocalUserObserver "ILocalUserObserver" class in this method. Once registered, the + * ILocalUserObserver receives events of the \ref agora::rtc::ILocalUser "ILocalUser" object. + * + * @param observer The pointer to the `ILocalUserObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerLocalUserObserver( + ILocalUserObserver* observer, + void(*safeDeleter)(ILocalUserObserver*) = NULL) = 0; + + /** + * Releases the \ref agora::rtc::ILocalUserObserver "ILocalUserObserver" object. + * + * @param observer The pointer to the `ILocalUserObserver` object that you want to release. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterLocalUserObserver(ILocalUserObserver* observer) = 0; + + /** + * Gets the media control packet sender. + * + * @return + * - The pointer to the media control packet sender IMediaControlPacketSender: Success. + * - A null pointer: Failure. + */ + virtual IMediaControlPacketSender* getMediaControlPacketSender() = 0; + + /** + * Registers a media control packet receiver. + * + * You need to implement the `IMediaControlPacketReceiver` class in this method. Once you successfully + * register the media control packet receiver, the SDK triggers the \ref agora::rtc::IMediaControlPacketReceiver::onMediaControlPacketReceived "onMediaControlPacketReceived" + * callback when it receives the media control packet. + * + * @param ctrlPacketReceiver The pointer to the IMediaControlPacketReceiver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerMediaControlPacketReceiver(IMediaControlPacketReceiver* ctrlPacketReceiver) = 0; + + /** + * Releases the media control packet receiver. + * @param ctrlPacketReceiver The pointer to the `IMediaControlPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterMediaControlPacketReceiver(IMediaControlPacketReceiver* ctrlPacketReceiver) = 0; + + /** + * Sends intra-frame request to the broadcaster with a specified uid. + * + * The local user receives the `onIntraRequestReceived` callback when the broadcaster receives the request. + * + * @param userId The user ID of the target broadcaster . + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendIntraRequest(user_id_t userId) = 0; + + /** + * Set local audio filterable by topn + * + * The local user receives the `onIntraRequestReceived` callback when the broadcaster receives the request. + * + * @param userId The user ID of the target broadcaster . + * @return + * - 0: Success. + * - < 0: Failure. + */ + + virtual int setAudioFilterable(bool filterable) = 0; + +/** + * Enable / Disable specified audio filter + * @param userId The ID of the remote user + * @param id id of the filter + * @param enable enable / disable the filter with given id + * @return + * - 0: success + * - <0: failure + */ + virtual int enableRemoteAudioTrackFilter(user_id_t userId, const char* id, bool enable) = 0; + + /** + * set the properties of the specified audio filter + * @param userId The ID of the remote user + * @param id id of the filter + * @param key key of the property + * @param jsonValue json str value of the property + * @return + * - 0: success + * - <0: failure + */ + virtual int setRemoteAudioTrackFilterProperty(user_id_t userId, const char* id, const char* key, const char* jsonValue) = 0; + + /** + * get the properties of the specified audio filter + * @param userId The ID of the remote user + * @param id id of the filter + * @param key key of the property + * @param jsonValue json str value of the property + * @param bufSize max length of the json value buffer + * @return + * - 0: success + * - <0: failure + */ + virtual int getRemoteAudioTrackFilterProperty(user_id_t userId, const char* id, const char* key, char* jsonValue, size_t bufSize) = 0; + /** + * set the profile of audio noise suppression module + * @param NsEnable enable ns or not + * @param NsMode type of ns + * @param NsLevel level of the suppression + * @param NsDelay algorithm delay + * @return + * - 0: success + * - <0: failure + */ + virtual int SetAudioNsMode(bool NsEnable, NS_MODE NsMode, NS_LEVEL NsLevel, + NS_DELAY NsDelay) = 0; + + /** + * enable the mix track that mix special track + * + * @param track The special mixed audio track. + * @param enalble Action of start mixing this user's audio. + * @param MixLocal Mix publish stream. + * @param MixRemote Mix remote stream. + * @return + * - 0: success + * - <0: failure + */ + virtual int EnableLocalMixedAudioTrack(agora_refptr& track, bool enable, bool MixLocal, bool MixRemote) = 0; + + /** + * @technical preview + */ + virtual int sendAudioMetadata(const char* metadata, size_t length) = 0; +}; + + +/** + * The definition of the AudioVolumeInformation struct. + */ +struct AudioVolumeInformation { + /** + * User ID of the speaker. + */ + user_id_t userId; + + /** + * The volume of the speaker that ranges from 0 to 255. + */ + unsigned int volume; + + /* + * The activity status of remote users + */ + unsigned int vad; + + /** + * Voice pitch frequency in Hz + */ + double voicePitch; + + AudioVolumeInformation() : userId(NULL), volume(0), vad(0), voicePitch(0.0) {} +}; + +/** + * The `ILocalUserObserver` class. + */ +class ILocalUserObserver { + public: + virtual ~ILocalUserObserver() {} + + virtual void onAudioTrackPublishStart(agora_refptr audioTrack) = 0; + /** + * Occurs when the first packet of the local audio track is sent, indicating that the local audio track + * is successfully published. + * + * @param audioTrack The pointer to \ref agora::rtc::ILocalAudioTrack "ILocalAudioTrack". + */ + virtual void onAudioTrackPublishSuccess(agora_refptr audioTrack) = 0; + + virtual void onAudioTrackUnpublished(agora_refptr audioTrack) = 0; + + /** + * Occurs when a local audio track fails to be published. + * + * @param audioTrack The pointer to `ILocalAudioTrack`. + * @param error The error information: #ERROR_CODE_TYPE. + */ + virtual void onAudioTrackPublicationFailure(agora_refptr audioTrack, + ERROR_CODE_TYPE error) = 0; + + /** + * Reports the statistics of a local audio track. + * + * @param stats The reference to the statistics of the local audio track. + */ + virtual void onLocalAudioTrackStatistics(const LocalAudioStats& stats) = 0; + /** + * Reports the statistics of a remote audio track. + * + * @param audioTrack The pointer to `IRemoteAudioTrack`. + * @param stats The statistics of the remote audio track. + */ + virtual void onRemoteAudioTrackStatistics(agora_refptr audioTrack, const RemoteAudioTrackStats& stats) = 0; + /** + * Occurs when the first remote audio frame is received. + * + * This callback indicates that the local user has subscribed to a specified remote audio track, and the first + * frame of this audio track has been received. + * + * @param userId The ID of the remote user whose audio frame is received. + * @param audioTrack The pointer to `IRemoteAudioTrack`. + */ + virtual void onUserAudioTrackSubscribed(user_id_t userId, + agora_refptr audioTrack) = 0; + + /** + * Occurs when the state of a remote audio track changes. + * + * @param userId The ID of the remote user whose audio track state has changed. + * @param audioTrack The pointer to `IRemoteAudioTrack`. + * @param state The current state of the audio track. + * @param reason The reason for the state change. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onUserAudioTrackStateChanged(user_id_t userId, + agora_refptr audioTrack, + REMOTE_AUDIO_STATE state, + REMOTE_AUDIO_STATE_REASON reason, + int elapsed) = 0; + + virtual void onVideoTrackPublishStart(agora_refptr videoTrack) = 0; + /** + * Occurs when the first packet of a local video track is sent, indicating that the local video track + * is successfully published. + * @param videoTrack The pointer to `ILocalVideoTrack`. + */ + virtual void onVideoTrackPublishSuccess(agora_refptr videoTrack) = 0; + + /** + * Occurs when a local video track fails to be published. + * + * @param videoTrack The pointer to `ILocalVideoTrack`. + * @param error The error information: #ERROR_CODE_TYPE. + */ + virtual void onVideoTrackPublicationFailure(agora_refptr videoTrack, + ERROR_CODE_TYPE error) = 0; + + virtual void onVideoTrackUnpublished(agora_refptr videoTrack) = 0; + /** + * Occurs when the state of a local video track changes. + * @note + * When you receive error from this callback, the corresponding track is in error state. + * To make the track recover from error state, we highly recommend that you disable the track and + * try re-enabling it again. + * + * @param videoTrack The pointer to `ILocalVideoTrack`. + * @param state The state of the local video track. + * @param errorCode The error information. + */ + virtual void onLocalVideoTrackStateChanged(agora_refptr videoTrack, + LOCAL_VIDEO_STREAM_STATE state, + LOCAL_VIDEO_STREAM_ERROR errorCode) = 0; + + /** + * Reports the statistics of a local video track. + * + * @param videoTrack The pointer to `ILocalVideoTrack`. + * @param stats The statistics of the local video track. + */ + virtual void onLocalVideoTrackStatistics(agora_refptr videoTrack, + const LocalVideoTrackStats& stats) = 0; + + /** + * Occurs when the first remote video frame is received. + * + * This callback indicates that the local user has subscribed to a specified remote video track, and + * the first frame of this video track has been received. + * + * @param userId The ID of the remote user whose video frame is received. + * @param trackInfo The information of the remote video track. + * @param videoTrack The pointer to `IRemoteVideoTrack`. + */ + virtual void onUserVideoTrackSubscribed(user_id_t userId, VideoTrackInfo trackInfo, + agora_refptr videoTrack) = 0; + + /** + * Occurs when the state of a remote video track changes. + * + * @param userId the ID of the remote user whose video track state has changed. + * @param videoTrack The pointer to `IRemoteVideoTrack`. + * @param state The current state of the video track. + * @param reason The reason for the state change. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onUserVideoTrackStateChanged(user_id_t userId, + agora_refptr videoTrack, + REMOTE_VIDEO_STATE state, + REMOTE_VIDEO_STATE_REASON reason, + int elapsed) = 0; + + /** + * Occurs when the first remote video frame is rendered. + * + * @param userId the ID of the remote user. + * @param width Width (px) of the video frame. + * @param height Height (px) of the video stream. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onFirstRemoteVideoFrameRendered(user_id_t userId, int width, + int height, int elapsed) = 0; + + + /** + * Reports the statistics of a remote video track. + * + * @param videoTrack The pointer to `IRemoteVideoTrack`. + * @param stats The statistics of the remote video track. + */ + virtual void onRemoteVideoTrackStatistics(agora_refptr videoTrack, + const RemoteVideoTrackStats& stats) = 0; + + /** + * Reports which users are speaking, the speakers' volumes, and whether the local user is speaking. + * + * This callback reports the IDs and volumes of the loudest speakers at the moment in the channel, + * and whether the local user is speaking. + * + * You can set the time interval of this callback using \ref ILocalUser::setAudioVolumeIndicationParameters "setAudioVolumeIndicationParameters". + * + * The SDK triggers two `onAudioVolumeIndication` callbacks at one time, one reporting the + * volume information of the local user and the other reporting the volume information of all remote users. + * + * @note + * - To detect whether the local user is speaking, set `report_vad` in `enableAudioVolumeIndication` to `true`. + * + * @param speakers The pointer to \ref agora::rtc::AudioVolumeInformation "AudioVolumeInformation", which is an array containing the user ID and volume information for each speaker. + * - In the local user's callback, this array contains the following members: + * - `uid`, which is always `0` + * - `volume`, which reports the sum of the voice volume and the audio-mixing volume of the local user + * - `vad`, which reports whether the local user is speaking + * - In the remote users' callback, this array contains the following members: + * - `uid`, which is the UID of each remote speaker + * - `volume`, which reports the sum of the voice volume and the audio-mixing volume of each remote speaker. + * - `vad`, which is always `0` + * An empty `speakers` array in the callback indicates that no remote user is speaking at the moment. + * @param speakerNumber The total number of the speakers. + * @param totalVolume The total volume after audio mixing. The value ranges between 0 (lowest volume) and 255 (highest volume). + * - In the local user's callback, `totalVolume` is the sum of the voice volume and the audio-mixing volume of the local user. + * - In the remote speakers' callback, `totalVolume` is the sum of the voice volume and the audio-mixing volume of all remote speakers. + */ + virtual void onAudioVolumeIndication(const AudioVolumeInformation* speakers, unsigned int speakerNumber, + int totalVolume) = 0; + + /** + * Occurs when an active speaker is detected. + * + * You can add relative functions on your app, for example, the active speaker, once detected, + * will have the portrait zoomed in. + * + * @note + * - The active speaker means the user ID of the speaker who speaks at the highest volume during a + * certain period of time. + * + * @param userId The ID of the active speaker. A `userId` of `0` means the local user. + */ + virtual void onActiveSpeaker(user_id_t userId) = 0; + + /** + * Occurs when the audio subscribe state changed. + * + * @param channel The channel name of user joined. + * @param userId The remote string user ID that is subscribed to. + * @param oldState The old state of the audio stream subscribe : #STREAM_SUBSCRIBE_STATE. + * @param newState The new state of the audio stream subscribe : #STREAM_SUBSCRIBE_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ + virtual void onAudioSubscribeStateChanged(const char* channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) = 0; + + /** + * Occurs when the video subscribe state changed. + * + * @param channel The channel name of user joined. + * @param userId The remote string user ID that is subscribed to. + * @param oldState The old state of the video stream subscribe : #STREAM_SUBSCRIBE_STATE. + * @param newState The new state of the video stream subscribe : #STREAM_SUBSCRIBE_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ + virtual void onVideoSubscribeStateChanged(const char* channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) = 0; + + /** + * Occurs when the audio publish state changed. + * + * @param channel The channel name of user joined. + * @param oldState The old state of the audio stream publish : #STREAM_PUBLISH_STATE. + * @param newState The new state of the audio stream publish : #STREAM_PUBLISH_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ + virtual void onAudioPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) = 0; + + /** + * Occurs when the video publish state changed. + * + * @param channel The channel name of user joined. + * @param oldState The old state of the video stream publish : #STREAM_PUBLISH_STATE. + * @param newState The new state of the video stream publish : #STREAM_PUBLISH_STATE. + * @param elapseSinceLastState The time elapsed (ms) from the old state to the new state. + */ + virtual void onVideoPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) = 0; + + /** Occurs when the first remote audio frame is received. + * + * @param userId ID of the remote user. + * @param isFallbackOrRecover Whether the remotely subscribed media stream + * falls back to audio-only or switches back to the video: + * - true: The remotely subscribed media stream falls back to audio-only + * due to poor network conditions. + * - false: The remotely subscribed media stream switches back to the + * video stream after the network conditions improved. + **/ + virtual void onRemoteSubscribeFallbackToAudioOnly(user_id_t userId, bool isFallbackOrRecover) { + (void)userId; + (void)isFallbackOrRecover; + } + + /** Occurs when the first remote audio frame is received. + * + * @param userId ID of the remote user. + * @param elapsed The time (ms) since the user connects to an Agora channel. + **/ + virtual void onFirstRemoteAudioFrame(user_id_t userId, int elapsed) = 0; + + /** + * Occurs when the SDK decodes the first remote audio frame for playback. + * + * @param uid User ID of the remote user sending the audio stream. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onFirstRemoteAudioDecoded(user_id_t userId, int elapsed) = 0; + + /** + * Occurs when the first remote video frame is rendered. + * The SDK triggers this callback when the first frame of the remote video is displayed in the user's video window. The application can get the time elapsed from a user joining the channel until the first video frame is displayed. + * + * @param userId ID of the remote user. + * @param width Width (px) of the video frame. + * @param height Height (px) of the video stream. + * @param elapsed Time elapsed (ms) from the local user calling the \ref IRtcEngine::joinChannel "joinChannel" method until the SDK triggers this callback. + */ + virtual void onFirstRemoteVideoFrame(user_id_t userId, int width, int height, int elapsed) = 0; + + /** + * Occurs when the SDK decodes the first remote video frame for playback. + * + * @param userId ID of the remote user. + * @param width Width (px) of the video stream. + * @param height Height (px) of the video stream. + * @param elapsed The time (ms) since the user connects to an Agora channel. + */ + virtual void onFirstRemoteVideoDecoded(user_id_t userId, int width, int height, int elapsed) = 0; + + /** + * The local or remote video size or rotation changed. + * + * @param uid User ID of the user whose video size or rotation has changed. + * @param width Width (pixels) of the video stream. + * @param height Height (pixels) of the video stream. + * @param rotation Rotation [0 to 360). + */ + virtual void onVideoSizeChanged(user_id_t userId, int width, int height, int rotation) = 0; + + /** + * @technical preview + */ + virtual void onAudioMetadataReceived(user_id_t userId, const char* metadata, size_t length) { + (void)userId; + (void)metadata; + (void)length; + } + + /** + * The media information of a specified user. + */ + enum USER_MEDIA_INFO { + /** + * 0: The user has muted the audio. + */ + USER_MEDIA_INFO_MUTE_AUDIO = 0, + /** + * 1: The user has muted the video. + */ + USER_MEDIA_INFO_MUTE_VIDEO = 1, + /** + * 4: The user has enabled the video, which includes video capturing and encoding. + */ + USER_MEDIA_INFO_ENABLE_VIDEO = 4, + /** + * 8: The user has enabled the local video capturing. + */ + USER_MEDIA_INFO_ENABLE_LOCAL_VIDEO = 8, + }; + + /** + * Occurs when the user media information is updated. + * + * + * @param userId The ID of the user. + * @param msg The media information of the user. See #USER_MEDIA_INFO. + * @param val Whether the user is muted. + */ + virtual void onUserInfoUpdated(user_id_t userId, USER_MEDIA_INFO msg, bool val) { + (void)userId; + (void)msg; + (void)val; + } + + /** + * Occurs when the intra request is received from a remote user. + * + * The method notifies the local user to encode a key frame. + * + */ + virtual void onIntraRequestReceived() {} + + /** + * datastream from this connection. + */ + virtual void onStreamMessage(user_id_t userId, int streamId, const char* data, size_t length) {} + + /** + * Occurs when the remote user state is updated. + * @param uid The uid of the remote user. + * @param state The remote user state.Just & #REMOTE_USER_STATE + */ + virtual void onUserStateChanged(user_id_t userId, uint32_t state){} + + virtual void onVideoRenderingTracingResult(user_id_t user_id, MEDIA_TRACE_EVENT currentState, VideoRenderingTracingInfo tracingInfo) {} +}; + +class IVideoFrameObserver2 { + public: + /** + * Occurs each time the player receives a video frame. + * + * After registering the video frame observer, + * the callback occurs each time receives a video frame to report the detailed information of the video frame. + * @param channelId The channel name + * @param remoteUid ID of the remote user. + * @param frame The detailed information of the video frame. See {@link VideoFrame}. + */ + virtual void onFrame(const char* channelId, user_id_t remoteUid, const media::base::VideoFrame* frame) = 0; + + virtual ~IVideoFrameObserver2() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraMediaNode.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraMediaNode.h new file mode 100644 index 0000000..30a3e6a --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraMediaNode.h @@ -0,0 +1,893 @@ +#pragma once +#include "AgoraRefPtr.h" +#include "AgoraBase.h" +#include "IAgoraLog.h" +#include "NGIAgoraVideoFrame.h" +#include "AgoraExtensionVersion.h" + +#ifndef OPTIONAL_PROCESSRESULT_SPECIFIER +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_PROCESSRESULT_SPECIFIER ProcessResult:: +#else +#define OPTIONAL_PROCESSRESULT_SPECIFIER +#endif +#endif + +namespace webrtc { +struct AudioFrameHandleInfo; +} // namespace webrtc + +namespace agora { +namespace rtc { +/** + * The `IAudioFilterBase` class is the base class for audio filters. You can use this class to implement your own filter + * and add it to an audio track. + */ +class IAudioFilterBase : public RefCountInterface { + public: + // Return false if filter decide to drop the frame. + // Implementation should not change samples_per_channel_/sample_rate_hz_/num_channels_ + // Implementation should just adapt data of audio frame. + /** + * Adapts the audio frame. + * @param inAudioFrame The reference to the audio frame that you want to adapt. + * @param adaptedFrame The reference to the adapted audio frame. + * @return + * - `true`: Success. + * - `false`: Failure. For example, the IAudiofilter object drops the audio frame. + */ + virtual bool adaptAudioFrame(const media::base::AudioPcmFrame& inAudioFrame, + media::base::AudioPcmFrame& adaptedFrame) = 0; + + /** + * Get the sample rate supported by the audio filter, the framework will resample + * the audio data and then pass it to the audio filter. + * @return + * - 0: Audio data will not be resampled. + * - > 0: Audio data will be resampled to this sample rate. + */ + virtual int getPreferredSampleRate() = 0; + + /** + * Get the channel number supported by the audio filter, the framework will resample + * the audio data and then pass it to the audio filter. If the user does not + * overwrite, resampling will not be done by default. + * @return + * - 0: Audio data will not be resampled. + * - > 0: Audio data will be resampled to this sample rate. + */ + virtual int getPreferredChannelNumbers() = 0; + + protected: + ~IAudioFilterBase() {} +}; + +/** + * The `IAudioFilter` class. + * + * This class is the intermediate node for audio, which reads audio frames from the underlying + * pipeline and writes audio frames back after adaptation. + */ +class IAudioFilter : public IAudioFilterBase { + public: + /** + * Enables or disables the audio filter. + * @param enable Whether to enable the audio filter: + * - `true`: Enable the audio filter. + * - `false`: Do not enable the audio filter. + */ + virtual void setEnabled(bool enable) = 0; + /** + * Checks whether the audio filter is enabled. + * @return + * - `true`: The audio filter is enabled. + * - `false`: The audio filter is not enabled. + */ + virtual bool isEnabled() const = 0; + /** + * Sets a private property in the `IAudioFilter` class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int setProperty(const char* key, const void* buf, int buf_size) = 0; + /** + * Gets a private property in the `IAudioFilter` class. + * + * @param name The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int getProperty(const char* key, void* buf, int buf_size) const = 0; + /** + * Gets the name of the `IAudioFilter` class. + * + * @return + * - The name of the audio filter, if the method call succeeds. + * - An empty string, if the method call fails. + */ + virtual const char * getName() const = 0; + + /** + * Get the sample rate supported by the audio filter, the framework will resample + * the audio data and then pass it to the audio filter. If the user does not + * overwrite, resampling will not be done by default. + * @return + * - 0: Audio data will not be resampled. + * - > 0: Audio data will be resampled to this sample rate. + */ + virtual int getPreferredSampleRate() { return 0; }; + + /** + * Get the channel number supported by the audio filter, the framework will resample + * the audio data and then pass it to the audio filter. If the user does not + * overwrite, resampling will not be done by default. + * @return + * - 0: Audio data will not be resampled. + * - > 0: Audio data will be resampled to this sample rate. + */ + virtual int getPreferredChannelNumbers() { return 0; }; + + protected: + ~IAudioFilter() {} +}; + +class IAudioFilterV2 : public IAudioFilter { +public: + class Control : public RefCountInterface { + public: + /** + * @brief Post an event and notify the end users. + * @param key '\0' ended string that describes the key of the event + * @param value '\0' ended string that describes the value of the event + */ + virtual int postEvent(const char* key, const char* value) = 0; + /** + * @brief print log to the SDK. + * @param level Log level @ref agora::commons::LOG_LEVEL + * @param format log formatter string + * @param ... variadic arguments + */ + virtual void printLog(commons::LOG_LEVEL level, const char* format, ...) = 0; + }; +public: + /** + * @brief AgoraSDK set IAudioFilterV2::Control to filter + * @param control IAudioFilterV2::Control + */ + virtual void setExtensionControl(agora::agora_refptr control) = 0; +}; + +/** + * The `IVideoFilterBase` class is the base class for video filters. You can use this class to implement your own filter + * and add the filter to a video track. + */ +class IVideoFilterBase : public RefCountInterface { + public: + /** + * Adapts the video frame. + * + * @param capturedFrame The reference to the captured video frame that you want to adapt. + * @param adaptedFrame The reference to the adapted video frame. + * + * @return + * - `true`: Success. + * - `false`: Failure, if, for example, the `IVideofilter` object drops the video frame. + */ + virtual bool adaptVideoFrame(const media::base::VideoFrame& capturedFrame, + media::base::VideoFrame& adaptedFrame) = 0; +}; + +// TODO(Bob): private inherit? +/** + * The IVideoFilter class. + * + * This class is the intermediate node for video, which contains both the video source and the video + * sink. It reads video frames from the underlying video pipeline and writes video frames back after + * adaptation. + */ +class IVideoFilter : public IVideoFilterBase { + public: + /** + * Enables or disables the video filter. + * @param enable Whether to enable the video filter: + * - `true`: (Default) Enable the video filter. + * - `false`: Do not enable the video filter. If the filter is disabled, frames will be passed without + * adaption. + */ + virtual void setEnabled(bool enable) {} + /** + * Checks whether the video filter is enabled. + * @return + * - `true`: The video filter is enabled. + * - `false`: The video filter is not enabled. + */ + virtual bool isEnabled() { return true; } + /** + * Sets a private property in the `IVideoFilter` class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int setProperty(const char* key, const void* buf, size_t buf_size) { return -1; } + /** + * Gets a private property in the IVideoFilter class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int getProperty(const char* key, void* buf, size_t buf_size) { return -1; } + /** + * This function is invoked right before data stream starts. + * Custom filter can override this function for initialization. + * @return + * - `true`: The initialization succeeds. + * - `false`: The initialization fails. + */ + virtual bool onDataStreamWillStart() { return true; } + /** + * This function is invoked right before data stream stops. + * Custom filter can override this function for deinitialization. + */ + virtual void onDataStreamWillStop() { } + /** + * This function indicates if the filter is for internal use. + * @note Do not override this function. + * @return + * - `true`: The filter is implemented by external users. + * - `false`: The filter is implemented by internal users. + */ + virtual bool isExternal() { return true; } + /** + * This function indicates if the filter is implemented by third-party providers. + * @note Do not override this function. + * @return + * - `true`: The filter is implemented by third-party providers. + * - `false`: otherwise. + */ + virtual bool isExtensionFilter() { return false; } +}; + +/** + * The IExtensionVideoFilter class. + * + * This class defines the interfaces that a external video extension provider can implement + * so as to be loaded by SDK as an "3rd party extension" for video pre- or post- processing. + */ +class IExtensionVideoFilter : public IVideoFilter { + public: + enum ProcessMode { + kSync, // Indicates that video frame data will be exchanged via "adaptVideoFrame" + kAsync, // Indicates that video frame data will be exchanged via "pendVideoFrame" & "deliverVideoFrame" + }; + + enum ProcessResult { + kSuccess, // Video frame data is successfully processed + kBypass, // Video frame data should bypass the current filter and flow to its successsors + kDrop, // Video Frame data should be discarded + }; + + /** + * The IExtensionVideoFilter::Control class. + * + * This class defines the interfaces that the extension filter can leverage to interact with the SDK. + * The "IExtensionVideoFilter::Control" object will be passed to the filter when SDK invoke the filter's + * "start" interface. + */ + class Control : public RefCountInterface { + public: + /** + * @brief Filter can invoke this function to deliver the processed frame to SDK if the Process Mode is + * designated as "kAsync" by the filter via "getProcessMode". + * @param frame the processed video frame + * @return see @ref ProcessResult + */ + virtual ProcessResult deliverVideoFrame(agora::agora_refptr frame) = 0; + /** + * @brief Filter can invoke this function to get the IVideoFrameMemoryPool object if a new IVideoFrame + * data object is needed. + */ + virtual agora::agora_refptr getMemoryPool() = 0; + /** + * @brief Post an event and notify the end users. + * @param key '\0' ended string that describes the key of the event + * @param value '\0' ended string that describes the value of the event + */ + virtual int postEvent(const char* key, const char* value) = 0; + /** + * @brief print log to the SDK. + * @param level Log level @ref agora::commons::LOG_LEVEL + * @param format log formatter string + * @param ... variadic arguments + */ + virtual void printLog(commons::LOG_LEVEL level, const char* format, ...) = 0; + /** + * @brief Ask SDK to disable the current filter if a fatal error is detected + * @param error error code + * @param msg error message + */ + virtual void disableMe(int error, const char* msg) = 0; + }; + + /** + * @brief SDK will invoke this API first to get the filter's requested process mode @ref ProcessMode and threading model + * @param mode [out] filter assign its desired the process mode @ref ProcessMode + * @param independent_thread [out] filter assign its desired threading model. When this boolean is set "true", an + * indepent thread will be assigned to the current filter and all invocations from SDK afterwards are ensured to + * happen on that fixed thread. If this boolean flag is set "false", the filter will re-use the thread of the SDK's + * data path. All invocations from SDK afterwards are also ensured to be on the same thread, however that thread is shared. + * @note If the filter implementation is not thread sensitive, we recommend to set the boolean to "false" to reduce thread context + * switching. + */ + virtual void getProcessMode(ProcessMode& mode, bool& independent_thread) = 0; + /** + * @brief SDK will invoke this API before feeding video frame data to the filter. Filter can perform its initialization/preparation job + * in this step. + * + * @param control object to @ref IExtensionFilter::Control that pass to the filter which can be used for future interaction with the SDK + * @return error code + */ + virtual int start(agora::agora_refptr control) = 0; + /** + * @brief SDK will invoke this API when the data stream is about to stop. Filter can perform cleanup jobs in this step + * + * @return error code + */ + virtual int stop() = 0; + /** + * @brief SDK will invoke this API every time before sending data to the filter. Filter can desigante the type @ref VideoFrameInfo::Type + * and format @ref MemPixelBuffer::Format of the next frame. SDK will then try to perform type / format conversion before sending data to + * the filter. + * + * @param type requested type of the next frame + * @param format requested formant of the next frame + */ + virtual void getVideoFormatWanted(VideoFrameData::Type& type, RawPixelBuffer::Format& format) = 0; + /** + * @brief SDK will invoke this API to send video frame to the filter if process mode is "Async". Filter invokes control's "deliverFrame" + * to send back the frame after processing. + * + * @param frame frame pending for processing + */ + virtual ProcessResult pendVideoFrame(agora::agora_refptr frame) { + return OPTIONAL_PROCESSRESULT_SPECIFIER kBypass; + } + /** + * @brief SDK will invoke this API to send video frame to the filter if process mode is "Sync". + * + * @param frame frame pending for processing + */ + virtual ProcessResult adaptVideoFrame(agora::agora_refptr in, agora::agora_refptr& out) { + return OPTIONAL_PROCESSRESULT_SPECIFIER kBypass; + } + /* Occurs each time needs to get rotation apply. + * + * @return Determines whether to rotate. + * - true: need to rotate. + * - false: no rotate. + */ + virtual bool getRotationApplied() { return false; } + + // NOTE: The following two interfaces should never be overriden! + virtual bool isExtensionFilter() { return true; } + virtual bool adaptVideoFrame( + const media::base::VideoFrame& capturedFrame, + media::base::VideoFrame& adaptedFrame) { + return -ERR_NOT_SUPPORTED; + } +}; + +/** + * The `IVideoSinkBase` class is the base class for the custom video sink. + */ +class IVideoSinkBase : public RefCountInterface { + public: + /** + * Sets a private property in the `IVideoFilter` class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int setProperty(const char* key, const void* buf, int buf_size) { return -1; } + /** + * Gets a private property in the `IVideoFilter` class. + * + * @param key The pointer to the property name. + * @param buf The pointer to the buffer of this private property. + * @param buf_size The buffer size of this private property. + * @return + * - The actual size of the private property, if the method call succeeds. + * - -1, if the method call fails. + */ + virtual int getProperty(const char* key, void* buf, int buf_size) { return -1; } + /** + * Occurs when the `IVideoSinkBase` object receives the video frame. + * @param videoFrame The reference to the video frame. + */ + virtual int onFrame(const media::base::VideoFrame& videoFrame) = 0; + /** + * Used internally to distinguish between external and internal sinks. + * External application should not override this interface. + */ + virtual bool isExternalSink() { return true; } + /** + * This function is invoked right before data stream starts. + * Custom sink can override this function for initialization. + * @return + * - `true`, if initialization succeeds. + * - `false`, if initialization fails. + */ + virtual bool onDataStreamWillStart() { return true; } + /** + * This function is invoked right before data stream stops. + * Custom sink can override this function for deinitialization. + */ + virtual void onDataStreamWillStop() { } + /** + * Whether to mirror the video frame. + * @return + * - true: mirror the video frame. + * - false: do not mirror the video frame. + */ + virtual bool applyMirror() { return false; } + /** + * Whether to rotate the video frame. + * @return + * - true: rotate the video frame. + * - false: do not rotate the video frame. + */ + virtual bool applyRotation() { return false; } +}; + +class IMediaExtensionObserver : public RefCountInterface { +public: + virtual ~IMediaExtensionObserver() {} + virtual void onEvent(const char* provider, const char* extension, const char* key, const char* json_value) __deprecated {} + virtual void onExtensionStopped(const char* provider, const char* extension) __deprecated {} + virtual void onExtensionStarted(const char* provider, const char* extension) __deprecated {} + virtual void onExtensionError(const char* provider, const char* extension, int error, const char* message) __deprecated {} + + virtual bool needExtensionContext() {return false;} // callback with conetxt interface if true + virtual void onEventWithContext(const ExtensionContext& context, const char* key, const char* json_value) {} + virtual void onExtensionStoppedWithContext(const ExtensionContext& context) {} + virtual void onExtensionStartedWithContext(const ExtensionContext& context) {} + virtual void onExtensionErrorWithContext(const ExtensionContext& context, int error, const char* message) {} +}; + +/** + * The IAudioPcmDataSender class. + * + * In scenarios involving custom audio source, you can use the `IAudioPcmDataSender` class to send PCM audio data directly to the audio track. If the audio track is disabled, the sent audio data is automatically discarded. + */ +class IAudioPcmDataSender : public RefCountInterface { + public: + /** + * Sends the PCM audio data to the local audio track. + * + * @param audio_data The PCM audio data to be sent. + * @param samples_per_channel The number of audio samples in 10 ms for each audio channel. + * @param bytes_per_sample The number of bytes in each sample. + * @param number_of_channels The number of audio channels. + * @param sample_rate The sample rate (Hz). The minimum value is 8000. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendAudioPcmData( + const void* audio_data, uint32_t capture_timestamp, + const size_t samples_per_channel, // for 10ms Data, number_of_samples * 100 = sample_rate + const agora::rtc::BYTES_PER_SAMPLE bytes_per_sample, // 2 + const size_t number_of_channels, + const uint32_t sample_rate) = 0; // sample_rate > 8000) + + protected: + ~IAudioPcmDataSender() {} +}; + +/** + * The `IAudioEncodedFrameSender` class. + * + * In scenarios involving custom audio source, you can use the `IAudioEncodedFrameSender` class to + * send encoded audio data directly to the audio track. If the track is disabled, the sent audio + * data will be automatically discarded. + */ +class IAudioEncodedFrameSender : public RefCountInterface { + public: + /** + * Sends the encoded audio frame to the local audio track. + * + * @param payload_data The pointer to the payload data. + * @param payload_size The payload size. + * @param audioFrameInfo The reference to the information of the audio frame: + * \ref agora::rtc::EncodedAudioFrameInfo "EncodedAudioFrameInfo". + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool sendEncodedAudioFrame(const uint8_t* payload_data, size_t payload_size, + const EncodedAudioFrameInfo& audioFrameInfo) = 0; + + protected: + ~IAudioEncodedFrameSender() {} +}; + +class IAudioEncodedFrameReceiver { + public: + /** + * Occurs when the track receives an audio encodeed frame packet. + * + * @param packet The pointer to the audio packet. + * @param length The length of the packet. + * @param info The packet info. + * + */ + virtual bool onEncodedAudioFrameReceived ( + const uint8_t *packet, size_t length, const media::base::AudioEncodedFrameInfo& info) = 0; + + virtual ~IAudioEncodedFrameReceiver() {} +}; + +/** + * The IMediaPacketReceiver class. You can register a receiver in remote audio or video tracks to trigger + * callbacks when RTP/UDP packets are received. + */ +class IMediaPacketReceiver { + public: + /** + * Occurs when the track receives a media packet. + * + * @param packet The pointer to the media packet. + * @param length The length of the packet. + * @param options The packet info. + * + */ + virtual bool onMediaPacketReceived( + const uint8_t *packet, size_t length, const agora::media::base::PacketOptions& options) = 0; + + virtual ~IMediaPacketReceiver() {} +}; + +/** + * The IMediaControlPacketReceiver class. + * + * You can register a receiver in audio or video tracks to trigger callbacks + * when RTCP/UDP packets are received. + */ +class IMediaControlPacketReceiver { + public: + /** + * Occurs when the track receives media control packet. + * + * @param packet The pointer to the media packet. + * @param length The length of the packet. + * + */ + virtual bool onMediaControlPacketReceived(uid_t uid, const uint8_t *packet, size_t length) = 0; + + virtual ~IMediaControlPacketReceiver() {} +}; + +/** + * The `IMediaPacketSender` class. + * + * You can use the `IMediaPacketSender` class to create a LocalVideoTrack or LocalAudioTrack, + * and then send media packets directly to the track. The media packets are RTP/UDP packets that contain + * media payload. If the track is disabled, the packets will be automatically discarded. + */ +class IMediaPacketSender : public RefCountInterface { + public: + /** + * Sends the frame packet to the local track. + * + * @param packet The pointer to the packet. + * @param length The packet size. + * @param options The packet information: {@link media::base::PacketOptions PacketOptions}. + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual int sendMediaPacket(const uint8_t *packet, size_t length, + const media::base::PacketOptions &options) = 0; + protected: + ~IMediaPacketSender() {} +}; + +/** + * The `IMediaControlPacketSender` class. + * + * You can get the `IMediaControlPacketSender` class object from a video track or audio track, + * and then send media control packets directly. The media control packets are RTCP/UDP packets that contain + * media control payload. If the track is disabled, the packets will be automatically discarded. + */ +class IMediaControlPacketSender { + public: + /** + * Sends the media control packet to a specified user. + * Currently, we only support sending packets through video tracks. + * + * @param userId ID of the user to send the packet to. + * @param packet The pointer to the packet. + * @param length The packet size. + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual int sendPeerMediaControlPacket(media::base::user_id_t userId, + const uint8_t *packet, + size_t length) = 0; + + /** + * Sends the media transport control packet to all users. + * Currently, we only support sending packets through video tracks. + * @param packet The pointer to the packet. + * @param length The packet size. + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual int sendBroadcastMediaControlPacket(const uint8_t *packet, size_t length) = 0; + + virtual ~IMediaControlPacketSender() {} +}; + +/** + * The `IAudioSinkBase` class is the base class for the audio sink. You can use this class to implement your own sink + * and add the sink to an audio track. + */ +class IAudioSinkBase : public RefCountInterface { + public: + /** Gets the audio frame. + * + * @param audioframe {@link media::base::AudioPcmFrame AudioPcmFrame} + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool onAudioFrame(const media::base::AudioPcmFrame& audioFrame) = 0; + + protected: + ~IAudioSinkBase() {} +}; + +/** + * The `IVideoFrameSender` class. + * + * In scenarios involving custom video sources, you can use this class to send the video + * data directly to a video track. If the video track is disabled, the sent data will + * be automatically discarded. + */ +class IVideoFrameSender : public RefCountInterface { + public: + /** + * Sends the video frame to the video track. + * + * @param videoFrame The reference to the video frame to send. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendVideoFrame(const media::base::ExternalVideoFrame& videoFrame) = 0; + + protected: + ~IVideoFrameSender() {} +}; + +/** + * The `IVideoEncodedImageSender` class. + * + * In scenarios involving custom video sources, you can use this class to send the encoded video data + * directly to the video track. If the video track is disabled, the sent video image will be + * automatically discarded. + */ +class IVideoEncodedImageSender : public RefCountInterface { + public: + /** + * Sends the encoded video image to the video track. + * @param imageBuffer The video buffer. + * @param length The data length of the video data. + * @param videoEncodedFrameInfo The reference to the information of the encoded video frame: + * {@link EncodedVideoFrameInfo}. + * + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool sendEncodedVideoImage(const uint8_t* imageBuffer, size_t length, + const EncodedVideoFrameInfo& videoEncodedFrameInfo) = 0; + + protected: + ~IVideoEncodedImageSender() {} +}; + +/** + * The IVideoBeautyFilter class. + */ +class IVideoBeautyFilter : public IVideoFilter { + public: + /** + * The video image enhancement options. + */ + struct BeautyOptions { + /** + * The lightening contrast level. + */ + enum LIGHTENING_CONTRAST_LEVEL { + /** + * 0: Low contrast level. + */ + LIGHTENING_CONTRAST_LOW = 0, + /** + * (Default) Normal contrast level. + */ + LIGHTENING_CONTRAST_NORMAL, + /** + * High contrast level. + */ + LIGHTENING_CONTRAST_HIGH + }; + + /** + * The contrast level, usually used with {@link lighteningLevel} to brighten the video: + * #LIGHTENING_CONTRAST_LEVEL. + */ + LIGHTENING_CONTRAST_LEVEL lighteningContrastLevel; + + /** + * The brightness level. The value ranges from 0.0 (original) to 1.0. + */ + float lighteningLevel; + + /** + * The sharpness level. The value ranges from 0.0 (original) to 1.0. This parameter is usually + * used to remove blemishes. + */ + float smoothnessLevel; + + /** + * The redness level. The value ranges from 0.0 (original) to 1.0. This parameter adjusts the + * red saturation level. + */ + float rednessLevel; + + BeautyOptions(LIGHTENING_CONTRAST_LEVEL contrastLevel, float lightening, float smoothness, + float redness) + : lighteningContrastLevel(contrastLevel), + lighteningLevel(lightening), + smoothnessLevel(smoothness), + rednessLevel(redness) {} + + BeautyOptions() + : lighteningContrastLevel(LIGHTENING_CONTRAST_NORMAL), + lighteningLevel(0), + smoothnessLevel(0), + rednessLevel(0) {} + }; + /** + * Sets the image enhancement options. + * @param enabled Whether to enable image enhancement. + * - `true`: Enable image enhancement. + * - `false`: Do not enable image enhancement. + * @param options The image enhancement options: BeautyOptions. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setBeautyEffectOptions(bool enabled, BeautyOptions options) = 0; +}; + +/** + * The `IVideoRenderer` class. + */ +class IVideoRenderer : public IVideoSinkBase { + public: + /** + * Sets the render mode. + * @param renderMode The video render mode. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRenderMode(media::base::RENDER_MODE_TYPE renderMode) = 0; + /** + * Sets the render mode of the view. + * @param view the view to set render mode. + * @param renderMode The video render mode. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setRenderMode(void* view, media::base::RENDER_MODE_TYPE renderMode) = 0; + /** + * Sets whether to mirror the video. + * @param mirror Whether to mirror the video: + * - `true`: Mirror the video. + * - `false`: Do not mirror the video. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMirror(bool mirror) = 0; + /** + * Sets whether to mirror the video. + * @param view the view to set mirror mode. + * @param mirror Whether to mirror the video: + * - `true`: Mirror the video. + * - `false`: Do not mirror the video. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setMirror(void* view, bool mirror) = 0; + /** + * Sets the video display window. + * @param view The pointer to the video display window. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setView(void* view) = 0; + /** + * Sets the video display window. + * @param view The pointer to the video display window. + * @param cropArea (Optional) Sets the relative location of the region to show. See Rectangle. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int addView(void* view, const Rectangle& cropArea) = 0; + /** + * Stops rendering the video view on the window. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unsetView() = 0; + /** + * remove rendering the video view on the window. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int removeView(void* view) = 0; +}; + +static const int kDeviceIdSize = 128; + +class IVideoTrack; +/** + * The `IVideoFrameTransceiver` class. + */ +class IVideoFrameTransceiver : public RefCountInterface { + public: + virtual int getTranscodingDelayMs() = 0; + virtual int addVideoTrack(agora_refptr track) = 0; + virtual int removeVideoTrack(agora_refptr track) = 0; +}; + +} +} diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraMediaNodeFactory.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraMediaNodeFactory.h new file mode 100644 index 0000000..5a53ce5 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraMediaNodeFactory.h @@ -0,0 +1,256 @@ +// +// Agora SDK +// +// Copyright (c) 2019 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" + +namespace agora { +namespace rtc { + +class IAudioPcmDataSender; +class IAudioEncodedFrameSender; +class IRemoteAudioMixerSource; +class ICameraCapturer; +class IScreenCapturer; +class IVideoMixerSource; +class IVideoFrameTransceiver; +class IVideoFrameSender; +class IVideoRenderer; +class IVideoFilter; +class IAudioFilter; +class IVideoSinkBase; +class IVideoEncodedImageSender; +class IMediaPlayerSource; +class IMediaPacketSender; +class IMediaStreamingSource; +class IScreenCapturer2; + + +/** + * The `IMediaNodeFactory` class. + */ +class IMediaNodeFactory : public RefCountInterface { + public: + /** + * Creates a PCM audio data sender. + * + * This method creates an `IAudioPcmDataSender` object, which can be used by \ref agora::base::IAgoraService::createCustomAudioTrack(agora_refptr< rtc::IAudioPcmDataSender > audioSource) "createCustomAudioTrack" to send PCM audio data. + * + * @return + * - The pointer to \ref agora::rtc::IAudioPcmDataSender "IAudioPcmDataSender": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioPcmDataSender() = 0; + + /** + * Creates an encoded audio data sender. + * + * This method creates an IAudioEncodedFrameSender object, which can be used by \ref agora::base::IAgoraService::createCustomAudioTrack(agora_refptr< rtc::IAudioEncodedFrameSender > audioSource, TMixMode mixMode) "createCustomAudioTrack" to send encoded audio data. + * + * @return + * - The pointer to IAudioEncodedFrameSender: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioEncodedFrameSender() = 0; + + /** + * Creates a remote audio mixer source object and returns the pointer. + * + * @param type The type of audio mixer source you want to create. + * + * @return + * - The pointer to \ref rtc::IRemoteAudioMixerSource "IRemoteAudioMixerSource", if the method call succeeds. + * - A null pointer, if the method call fails. + */ + virtual agora_refptr createRemoteAudioMixerSource() = 0; + + /** + * Creates a camera capturer. + * + * Once a camera capturer object is created, you can use the video data captured by the camera as + * the custom video source. + * + * @return + * - The pointer to ICameraCapturer: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createCameraCapturer() = 0; + + /** + * Creates a screen capturer. + * + * Once a screen capturer object is created, you can use the screen video data as the custom video + * source. + * + * @return + * - The pointer to IScreenCapturer: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCapturer() = 0; + + /** + * Creates a video mixer. + * + * Once a video mixer object is created, you can use the video mixer data as the custom video + * source. + * + * @return + * - The pointer to IVideoMixerSource: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoMixer() = 0; + + /** + * Creates a video transceiver. + * + * Once a video transceiver object is created, you can use the video transceiver data as the custom video + * source. + * + * @return + * - The pointer to IVideoFrameTransceiver: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoFrameTransceiver() = 0; + + /** + * Creates a video frame sender. + * + * This method creates an `IVideoFrameSender` object, which can be used by \ref agora::base::IAgoraService::createCustomVideoTrack(agora_refptr videoSource) "createCustomVideoTrack" to + * send the custom video data. + * + * @return + * - The pointer to \ref agora::rtc::IVideoFrameSender "IVideoFrameSender": Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoFrameSender() = 0; + + /** + * Creates an encoded video image sender. + * + * This method creates an `IVideoEncodedImageSender` object, which can be used by \ref agora::base::IAgoraService::createCustomVideoTrack(agora_refptr videoSource, SenderOptions& options) "createCustomVideoTrack" to send the encoded video data. + * + * @return + * - The pointer to `IVideoEncodedImageSender`: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoEncodedImageSender() = 0; + + /** + * Creates a built-in video renderer. + * + * @param view The video window view. + * @return + * - The pointer to `IVideoRenderer`: Success. + * - A null pointer: Failure. + * + */ + virtual agora_refptr createVideoRenderer() = 0; + + /** + * Creates an audio filter for the extension. + * + * This method creates an `IAudioFilter` object, which can be used to filter the audio data from the + * inside extension. + * + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IAudioFilter: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createAudioFilter(const char* provider_name, const char* extension_name) = 0; + + /** + * Creates a video filter for the extension. + * + * This method creates an `IVideoFilter` object, which can be used to filter the video from inside + * extension. + * + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IVideoFilter: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoFilter(const char* provider_name, const char* extension_name) = 0; + + /** + * Creates a video sink for the extension. + * + * This method creates an IVideoSinkBase object, which can be used to receive the video from the + * inside extension. + * + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IVideoSinkBase: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createVideoSink(const char* provider_name, const char* extension_name) = 0; + + /** + * Creates a media player source object and returns the pointer. + * + * @param type The type of media player source you want to create. + * + * @return + * - The pointer to \ref rtc::IMediaPlayerSource "IMediaPlayerSource", if the method call + * succeeds. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaPlayerSource(media::base::MEDIA_PLAYER_SOURCE_TYPE type = agora::media::base::MEDIA_PLAYER_SOURCE_DEFAULT) = 0; + + /** + * @brief Creates a media streaming source object and returns the pointer. + * + * @param type The type of media streaming source you want to create. + * + * @return + * - The pointer to \ref rtc::IMediaStreamingSource "IMediaStreamingSource", if the method call + * succeeds. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaStreamingSource() = 0; + + /** + * Creates a media packet sender object and returns the pointer. + * + * @return + * - The pointer to \ref rtc::IMediaPacketSender "IMediaPacketSender", if the method call + * succeeds. + * - A null pointer: Failure. + */ + virtual agora_refptr createMediaPacketSender() = 0; + +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + /** + * Creates screen capture source extension with given provider&extension names + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IScreenCapturer: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCapturer2(const char* provider_name, const char* extension_name) = 0; +#else + /** + * Creates screen capture source extension with given provider&extension names + * @param provider_name provider name string. + * @param extension_name extension name string. + * @return + * - The pointer to IScreenCapturer: Success. + * - A null pointer: Failure. + */ + virtual agora_refptr createScreenCapturer(const char* provider_name, const char* extension_name) = 0; +#endif + + protected: + ~IMediaNodeFactory() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRemoteAudioMixerSource.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRemoteAudioMixerSource.h new file mode 100644 index 0000000..e471071 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRemoteAudioMixerSource.h @@ -0,0 +1,44 @@ +// +// Agora SDK +// +// Copyright (c) 2020 Agora.io. All rights reserved. +// + +#pragma once + +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +class IRemoteAudioTrack; + +/** + * The IRemoteAudioMixerSource class abstracts a multi-in-single-out audio source which receives audio + * streams from multiple remote audio tracks and generate mixed audio stream in user defined output + * format. + */ +class IRemoteAudioMixerSource : public RefCountInterface { + public: + virtual ~IRemoteAudioMixerSource() {} + + /** + * Add a audio track for mixing. Automatically starts mixing if add audio track + * @param track The instance of the audio track that you want mixer to receive its audio stream. + */ + virtual int addAudioTrack(agora_refptr track) = 0; + + /** + * Remove a audio track for mixing. Automatically stops the mixed stream if all audio tracks are removed + * @param track The instance of the audio track that you want to remove from the mixer. + */ + virtual int removeAudioTrack(agora_refptr track) = 0; + + /** + * Gets the delay time for mix. + */ + virtual int getMixDelay() const = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtcConnection.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtcConnection.h new file mode 100644 index 0000000..bbb5de0 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtcConnection.h @@ -0,0 +1,857 @@ +// +// Agora SDK +// +// Created by Sting Feng in 2018-01. +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "time_utils.h" + +namespace agora { +namespace rtc { +class IAudioEncodedFrameSender; +class IRtcConnectionObserver; +class INetworkObserver; +class IRtcConnection; +class IVideoEncodedImageSender; +class ILocalUser; + +/** + * The information of an RTC Connection. + */ +struct TConnectionInfo { + /** + * The ID of the RTC Connection. + */ + conn_id_t id; + /** + * The ID of the channel. If you have not called \ref agora::rtc::IRtcConnection::connect "connect", this member is `NULL`. + */ + util::AString channelId; + /** + * The connection state: #CONNECTION_STATE_TYPE. + */ + CONNECTION_STATE_TYPE state; + /** + * The ID of the local user. + */ + util::AString localUserId; + /** + * Internal use only. + */ + uid_t internalUid; + + int proxyType; + + util::AString connectionIp; + + TConnectionInfo() : id(-1), state(CONNECTION_STATE_DISCONNECTED), internalUid(0), proxyType(0) {} +}; + +struct TConnectSettings { + /** + * The app ID. + */ + const char* token; + /** + The channel name. It must be in the string format and not exceed 64 bytes in length. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", + * "-", ":", ";", "<", "=", + * ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", "," + */ + const char* channelId; + /** + The ID of the local user. If you do not specify a user ID or set `userId` as `null`, + * the SDK returns a user ID in the \ref IRtcConnectionObserver::onConnected "onConnected" + * callback. Your app must record and maintain the `userId` since the SDK does not do so. + */ + user_id_t userId; + + /* + App can provide a app defined start time to trace some events like connect cost , first video, etc. + */ + agora::Optional appDefinedStartTimeMs; +}; + +/** + * Configurations for an RTC connection. + * + * Set these configurations when calling \ref agora::base::IAgoraService::createRtcConnection "createRtcConnection". + */ +struct RtcConnectionConfiguration { + /** + * Whether to subscribe to all audio tracks automatically. + * - `true`: (Default) Subscribe to all audio tracks automatically. + * - `false`: Do not subscribe to any audio track automatically. + */ + bool autoSubscribeAudio; + /** + * Whether to subscribe to all video tracks automatically. + * - `true`: (Default) Subscribe to all video tracks automatically. + * - `false`: Do not subscribe to any video track automatically. + */ + bool autoSubscribeVideo; + /** + * Whether to enable audio recording or playout. + * - `true`: Enables audio recording or playout. Use this option when you publish and mix audio tracks, or subscribe to one or multiple audio tracks and play audio. + * - `false`: Disables audio recording or playout. Use this option when you publish external audio frames without audio mixing, or you do not need audio devices to play audio. + */ + bool enableAudioRecordingOrPlayout; + /** + * The maximum sending bitrate. + */ + int maxSendBitrate; + /** + * The minimum port. + */ + int minPort; + /** + * The maximum port. + */ + int maxPort; + /** + * The user role. For details, see #CLIENT_ROLE_TYPE. The default user role is `CLIENT_ROLE_AUDIENCE`. + */ + CLIENT_ROLE_TYPE clientRoleType; + /** The channel profile. For details, see #CHANNEL_PROFILE_TYPE. The default channel profile is `CHANNEL_PROFILE_LIVE_BROADCASTING`. + */ + CHANNEL_PROFILE_TYPE channelProfile; + + /** + * Determines whether to receive audio encoded frame or not. + */ + bool audioRecvEncodedFrame; + + /** + * Determines whether to receive audio media packet or not. + */ + bool audioRecvMediaPacket; + + /** + * Determines whether to receive video media packet or not. + */ + bool videoRecvMediaPacket; + + /** + * This mode is only used for audience. In PK mode, client might join one + * channel as broadcaster, and join another channel as interactive audience to + * achieve low lentancy and smooth video from remote user. + * - true: Enable low lentancy and smooth video when joining as an audience. + * - false: (Default) Use default settings for audience role. + */ + bool isInteractiveAudience; + + RtcConnectionConfiguration() + : autoSubscribeAudio(true), + autoSubscribeVideo(true), + enableAudioRecordingOrPlayout(true), + maxSendBitrate(-1), + minPort(0), + maxPort(0), + clientRoleType(CLIENT_ROLE_AUDIENCE), + channelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING), + audioRecvEncodedFrame(false), + audioRecvMediaPacket(false), + videoRecvMediaPacket(false), + isInteractiveAudience(false) {} +}; + +/** + * The `IRtcConnection` class. + * + * You can use this class for managing the connection between your app and an Agora Channel. + * + * Once connected, your app gets an `AgoraLocalUser` object for publishing and subscribing to media streams in the Agora Channel. + * + * Connecting to a channel is done asynchronously, and your app can listen for the connection states or events through `IRtcConnectionObserver`. + * `IRtcConnection` also monitors remote users in the channel. The SDK notifies your app when a remote user joins or leaves the channel. + */ +class IRtcConnection : public RefCountInterface { + protected: + ~IRtcConnection() {} + + public: + /** + * Connects to an Agora channel. + * + * When the method call succeeds, the connection state changes from `CONNECTION_STATE_DISCONNECTED(1)` to + * `CONNECTION_STATE_CONNECTING(2)`. + * + * Depending on the whether the connection succeeds or not, the + * connection state changes to either `CONNECTION_STATE_CONNECTED(3)` or `CONNECTION_STATE_FAILED(5)`. The SDK also triggers `onConnected` or `onDisconnected` to notify you of the state change. + * + * @param token The app ID. + * @param channelId The channel name. It must be in the string format and not exceed 64 bytes in length. Supported character scopes are: + * - All lowercase English letters: a to z. + * - All uppercase English letters: A to Z. + * - All numeric characters: 0 to 9. + * - The space character. + * - Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", + * "-", ":", ";", "<", "=", + * ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", "," + * @param userId The ID of the local user. If you do not specify a user ID or set `userId` as `null`, + * the SDK returns a user ID in the \ref IRtcConnectionObserver::onConnected "onConnected" + * callback. Your app must record and maintain the `userId` since the SDK does not do so. + * @return + * - 0: Success. + * - < 0: Failure. + * - -2(ERR_INVALID_ARGUMENT): The argument that you pass is invalid. + * - -8(ERR_INVALID_STATE): The current connection state is not CONNECTION_STATE_DISCONNECTED(1). + */ + virtual int connect(const char* token, const char* channelId, user_id_t userId) = 0; + + /** + * Connects to an Agora channel. + * + * When the method call succeeds, the connection state changes from `CONNECTION_STATE_DISCONNECTED(1)` to + * `CONNECTION_STATE_CONNECTING(2)`. + * + * Depending on the whether the connection succeeds or not, the + * connection state changes to either `CONNECTION_STATE_CONNECTED(3)` or `CONNECTION_STATE_FAILED(5)`. + * The SDK also triggers `onConnected` or `onDisconnected` to notify you of the state change. + * @param settings The settings of connecting. + */ + virtual int connect(const TConnectSettings& settings) = 0; + + /** + * Disconnects from the Agora channel. + * + * Once your app successful disconnects from the channel, the connection state changes to + * `CONNECTION_STATE_DISCONNECTED(1)`. You are also notified with the callback + * \ref IRtcConnectionObserver::onDisconnected "onDisconnected". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int disconnect() = 0; + + /** + * Starts the last-mile network probe test. + * + * Call this method before connecting to the channel to get the uplink and + * downlink last-mile network statistics, including the bandwidth, packet loss, jitter, and + * round-trip time (RTT). + * + * After you enable the last-mile network probe test, the SDK triggers the following callbacks: + * - \ref IRtcConnectionObserver::onLastmileQuality "onLastmileQuality": The SDK triggers this + * callback within two seconds depending on the network conditions. This callback rates the network + * conditions and is more closely linked to the user experience. + * - \ref IRtcConnectionObserver::onLastmileProbeResult "onLastmileProbeResult": The SDK triggers + * this callback within 30 seconds depending on the network conditions. This callback reports the + * real-time statistics of the network conditions and is more objective. + * + * @note + * - Do not call any other method before receiving the \ref IRtcConnectionObserver::onLastmileQuality + * "onLastmileQuality" and \ref IRtcConnectionObserver::onLastmileProbeResult "onLastmileProbeResult" + * callbacks. Otherwise, the callbacks may be interrupted. + * - In the live-broadcast profile, a host should not call this method after connecting to a channel. + * + * @param config The configurations of the last-mile network probe test. See \ref agora::rtc::LastmileProbeConfig "LastmileProbeConfig". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int startLastmileProbeTest(const LastmileProbeConfig& config) = 0; + + /** + * Stops the last-mile network probe test. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int stopLastmileProbeTest() = 0; + + /** + * Renews the token. + * + * The token expires after a certain period of time. + * When the \ref IRtcConnectionObserver::onError "onError" callback reports `ERR_TOKEN_EXPIRED(109)`, you must generate a new token from the server + * and then call this method to renew it. Otherwise, the SDK disconnects from the Agora channel. + * + * @param token The pointer to the new token. + */ + virtual int renewToken(const char* token) = 0; + + /** + * Gets the connection information. + * + * @return + * - The pointer to the \ref agora::rtc::TConnectionInfo "TConnectionInfo" object: Success. + * - A null pointer: Failure. + */ + virtual TConnectionInfo getConnectionInfo() = 0; + + /** + * Gets the \ref agora::rtc::ILocalUser "ILocalUser" object. + * + * @return + * - The pointer to the \ref agora::rtc::ILocalUser "ILocalUser" object: Success. + * - A null pointer: Failure. + */ + virtual ILocalUser* getLocalUser() = 0; + + /** + * Gets the information of all the remote users in the channel. + * + * After a user successfully connects to the channel, you can also get the information of this remote user + * with the \ref IRtcConnectionObserver::onUserJoined "onUserJoined" callback. + * + * @param [out] users The reference to the \ref agora::UserList "UserList" object, which contains the information of all users + * in the channel. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRemoteUsers(UserList& users) = 0; + + /** + * Gets the information of a specified remote user in the channel. + * + * @param [in] userId ID of the user whose information you want to get. + * @param [out] userInfo The reference to the \ref agora::UserInfo "UserInfo" object, which contains the information of the + * specified user. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfo(user_id_t userId, agora::UserInfo& userInfo) = 0; + + /** + * Registers an RTC connection observer. You can call this method only after creating an `IRtcConnection` object. + * + * @param observer The pointer to the IRtcConnectionObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerObserver(IRtcConnectionObserver* observer, void(*safeDeleter)(IRtcConnectionObserver*) = NULL) = 0; + + /** + * Releases the registered IRtcConnectionObserver object. + * + * @param observer The pointer to the IRtcConnectionObserver object created by the \ref registerObserver + * "registerObserver" method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterObserver(IRtcConnectionObserver* observer) = 0; + + /** + * Registers an network observer object. + * + * @param observer The pointer to the INetworkObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerNetworkObserver(INetworkObserver* observer, void(*safeDeleter)(INetworkObserver*) = NULL) = 0; + + /** + * Releases the registered INetworkObserver object. + * + * @param observer The pointer to the INetworkObserver object created by the \ref registerNetworkObserver + * "registerNetworkObserver" method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterNetworkObserver(INetworkObserver* observer) = 0; + + /** + * Gets the ID of the connection. + * + * @return + * - The connection ID: Success. + * - A null pointer: Failure. + */ + virtual conn_id_t getConnId() = 0; + + /** + * Gets the transportation statistics of the RTC connection. + * + * @return + * - The pointer to \ref agora::rtc::RtcStats "RtcStats": Success. + * - A null pointer: Failure. + */ + virtual RtcStats getTransportStats() = 0; + + /** + * Gets the IAgoraParameter object. + * + * @return + * - The pointer to the \ref agora::base::IAgoraParameter "IAgoraParameter" object. + * - A null pointer: Failure. + */ + virtual agora::base::IAgoraParameter* getAgoraParameter() = 0; + + /** + * Creates a data stream. + * + * Each user can create up to five data streams during the lifecycle of an RTC connection. + * + * @note Set both the `reliable` and `ordered` parameters as `true` or `false`. Do not set one as `true` and the other as `false`. + * + * @param streamId The pointer to the ID of the data stream. + * @param reliable Whether to guarantee the receivers receive the data stream within five seconds: + * - `true`: Guarantee that the receivers receive the data stream within five seconds. If the receivers do not receive the data stream within five seconds, the SDK reports an error to the application. + * - `false`: Do not guarantee that the receivers receive the data stream within five seconds and the SDK does not report any error message for data stream delay or missing. + * @param ordered Whether the receivers receive the data stream in the order of sending: + * - `true`: The receivers receive the data stream in the order of sending. + * - `false`: The receivers do not receive the data stream in the order of sending. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int createDataStream(int* streamId, bool reliable, bool ordered, bool sync) = 0; + + /** Sends data stream messages to all users in a channel. + * + * @note This method has the following restrictions: + * - Up to 30 packets can be sent per second in a channel with a maximum size of 1 kB for each packet. + * - Each client can send up to 6 kB of data per second. + * - Each user can have up to five data streams simultaneously. + * + * @param streamId The ID of the sent data stream, returned in the \ref agora::rtc::IRtcConnection::createDataStream "createDataStream" method. + * @param data The pointer to the sent data. + * @param length The length of the sent data. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendStreamMessage(int streamId, const char* data, size_t length) = 0; + + /** Enables/Disables the built-in encryption. + * + * In scenarios requiring high security, Agora recommends calling this method to enable the built-in encryption before joining a channel. + * + * All users in the same channel must use the same encryption mode and encryption key. Once all users leave the channel, the encryption key of this channel is automatically cleared. + * + * @note + * - If you enable the built-in encryption, you cannot use the RTMP streaming function. + * + * @param enabled Whether to enable the built-in encryption: + * - true: Enable the built-in encryption. + * - false: Disable the built-in encryption. + * @param config Configurations of built-in encryption schemas. See \ref agora::rtc::EncryptionConfig "EncryptionConfig". + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableEncryption(bool enabled, const EncryptionConfig& config) = 0; + + /** + * Reports a custom event to Agora. + * + * @param id The custom event ID. + * @param category The category of the custom event. + * @param event The custom event to report. + * @param label The label of the custom event. + * @param value The value of the custom event. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int sendCustomReportMessage(const char* id, const char* category, const char* event, const char* label, int value) = 0; + /** Gets the user information by user account, which is in string format. + * + * @param userAccount The user account of the user. + * @param [in,out] userInfo A \ref rtc::UserInfo "UserInfo" object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUserAccount(const char* userAccount, rtc::UserInfo* userInfo) = 0; + /** Gets the user information by user ID, which is in integer format. + * + * @param uid The ID of the remote user. + * @param [in,out] userInfo A \ref rtc::UserInfo "UserInfo" object that identifies the user: + * - Input: A userInfo object. + * - Output: A userInfo object that contains the user account and user ID of the user. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getUserInfoByUid(uid_t uid, rtc::UserInfo* userInfo) = 0; +}; + +/** + * The IRtcConnectionObserver class, which observes the connection state of the SDK. + */ +class IRtcConnectionObserver { + public: + virtual ~IRtcConnectionObserver() {} + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_CONNECTED(3)`. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + * @param reason The reason of the connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnected(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_DISCONNECTED(1)`. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + * @param reason The reason of the connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onDisconnected(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_CONNECTING(2)`. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + * @param reason The reason of the connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnecting(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_RECONNECTING(4)`. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + * @param reason The reason of the connection state change. See #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onReconnecting(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + // This should be deleted. onConnected is enough. + virtual void onReconnected(const TConnectionInfo& connectionInfo, CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when the SDK loses connection with the Agora channel. + * + * @param connectionInfo The information of the connection. See \ref agora::rtc::TConnectionInfo "TConnectionInfo". + */ + virtual void onConnectionLost(const TConnectionInfo& connectionInfo) = 0; + + /** + * Reports the quality of the last-mile network. + * + * The SDK triggers this callback within two seconds after the app calls \ref IRtcConnection::startLastmileProbeTest "startLastmileProbeTest". + * + * @param quality Quality of the last-mile network: #QUALITY_TYPE. + */ + virtual void onLastmileQuality(const QUALITY_TYPE quality) = 0; + + /** + * Reports the result of the last-mile network probe test. + * + * The SDK triggers this callback within 30 seconds after the app calls \ref IRtcConnection::startLastmileProbeTest "startLastmileProbeTest". + * + * @param result The result of the last-mile network probe test: \ref agora::rtc::LastmileProbeResult "LastmileProbeResult". + */ + virtual void onLastmileProbeResult(const LastmileProbeResult& result) = 0; + + /** + * Occurs when the token expires in 30 seconds. + * + * The SDK triggers this callback to remind the app to get a new token before the token privilege expires. + * + * Upon receiving this callback, you must generate a new token on your server and call \ref IRtcConnection::renewToken + * "renewToken" to pass the new token to the SDK. + * + * @param token The pointer to the token that expires in 30 seconds. + */ + virtual void onTokenPrivilegeWillExpire(const char* token) = 0; + + /** + * Occurs when the token has expired. + * + * Upon receiving this callback, you must generate a new token on your server and call \ref IRtcConnection::renewToken + * "renewToken" to pass the new token to the SDK. + */ + virtual void onTokenPrivilegeDidExpire() = 0; + + /** + * Occurs when the connection state between the SDK and the Agora channel changes to `CONNECTION_STATE_FAILED(5)`. + * + * @param connectionInfo The connection information: TConnectionInfo. + * @param reason The reason of the connection state change: #CONNECTION_CHANGED_REASON_TYPE. + */ + virtual void onConnectionFailure(const TConnectionInfo& connectionInfo, + CONNECTION_CHANGED_REASON_TYPE reason) = 0; + + /** + * Occurs when a remote user joins the channel. + * + * You can get the ID of the remote user in this callback. + * + * @param userId The ID of the remote user who joins the channel. + */ + virtual void onUserJoined(user_id_t userId) = 0; + + /** + * Occurs when a remote user leaves the channel. + * + * You can know why the user leaves the channel through the `reason` parameter. + * + * @param userId The ID of the user who leaves the channel. + * @param reason The reason why the remote user leaves the channel: #USER_OFFLINE_REASON_TYPE. + */ + virtual void onUserLeft(user_id_t userId, USER_OFFLINE_REASON_TYPE reason) = 0; + + /** + * Reports the transport statistics of the connection. + * + * The SDK triggers this callback once every two seconds when the connection state is `CONNECTION_STATE_CONNECTED`. + * + * @param stats The pointer to \ref rtc::RtcStats "RtcStats". + */ + virtual void onTransportStats(const RtcStats& stats) = 0; + + /** + * Occurs when the role of the local user changes. + * + * @param oldRole The previous role of the local user: \ref rtc::CLIENT_ROLE_TYPE "CLIENT_ROLE_TYPE". + * @param newRole The current role of the local user: \ref rtc::CLIENT_ROLE_TYPE "CLIENT_ROLE_TYPE". + * @param newRoleOptions The client role options of the current role of the local user: \ref rtc::ClientRoleOptions "ClientRoleOptions". + */ + virtual void onChangeRoleSuccess(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) { + (void)oldRole; + (void)newRole; + (void)newRoleOptions; + } + + /** + * Occurs when the local user fails to change the user role. + */ + virtual void onChangeRoleFailure(CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) { + (void)reason; + (void)currentRole; + } + + /** + * Occurs when connection license verification fails + * + * You can know the reason accordding to error code + * @param error verify fail reason + */ + virtual void onLicenseValidationFailure(LICENSE_ERROR_TYPE error) { + (void)error; + } + + /** + * Reports the network quality of each user. + * + * The SDK triggers this callback once every two seconds to report the uplink and downlink network conditions + * of each user in the channel, including the local user. + * + * @param userId The ID of the user. If `userId` is empty, this callback reports the network quality of the local user. + * @param txQuality The uplink network quality: #QUALITY_TYPE. + * @param rxQuality The downlink network quality: #QUALITY_TYPE. + */ + virtual void onUserNetworkQuality(user_id_t userId, QUALITY_TYPE txQuality, + QUALITY_TYPE rxQuality) { + (void)userId; + (void)txQuality; + (void)rxQuality; + } + + /** Occurs when the network type is changed. + * @param type The current network type. See #NETWORK_TYPE. + */ + virtual void onNetworkTypeChanged(NETWORK_TYPE type) { + (void)type; + } + + /** + * Occurs when an API method is executed. + * @deprecated This callback is deprecated. Use other specific event callbacks instead. + * + * @param err The error code that the SDK reports when the method call fails. If the SDK reports 0, + * the method call succeeds. + * @param api The API method that is executed. + * @param result The result of the method call. + */ + virtual void onApiCallExecuted(int err, const char* api, const char* result) __deprecated { + (void)err; + (void)api; + (void)result; + } + + /** Reports result of Content Inspect*/ + virtual void onContentInspectResult(media::CONTENT_INSPECT_RESULT result) { (void)result; } + /** Occurs when takeSnapshot API result is obtained + * + * + * @brief snapshot taken callback + * + * @param channel channel name + * @param uid user id + * @param filePath image is saveed file path + * @param width image width + * @param height image height + * @param errCode 0 is ok negative is error + */ + virtual void onSnapshotTaken(uid_t uid, const char* filePath, int width, int height, int errCode) { + (void)uid; + (void)filePath; + (void)width; + (void)height; + (void)errCode; + } + /** + * Reports the error code and error message. + * @param error The error code: #ERROR_CODE_TYPE. + * @param msg The error message. + */ + virtual void onError(ERROR_CODE_TYPE error, const char* msg) { + (void)error; + (void)msg; + } + + /** + * Occurs when the state of the channel media relay changes. + * + * + * @param state The state code: + * - `RELAY_STATE_IDLE(0)`: The SDK is initializing. + * - `RELAY_STATE_CONNECTING(1)`: The SDK tries to relay the media stream to the destination + * channel. + * - `RELAY_STATE_RUNNING(2)`: The SDK successfully relays the media stream to the destination + * channel. + * - `RELAY_STATE_FAILURE(3)`: A failure occurs. See the details in `code`. + * @param code The error code: + * - `RELAY_OK(0)`: The state is normal. + * - `RELAY_ERROR_SERVER_ERROR_RESPONSE(1)`: An error occurs in the server response. + * - `RELAY_ERROR_SERVER_NO_RESPONSE(2)`: No server response. You can call the leaveChannel method + * to leave the channel. + * - `RELAY_ERROR_NO_RESOURCE_AVAILABLE(3)`: The SDK fails to access the service, probably due to + * limited resources of the server. + * - `RELAY_ERROR_FAILED_JOIN_SRC(4)`: Fails to send the relay request. + * - `RELAY_ERROR_FAILED_JOIN_DEST(5)`: Fails to accept the relay request. + * - `RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC(6)`: The server fails to receive the media + * stream. + * - `RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST(7)`: The server fails to send the media stream. + * - `RELAY_ERROR_SERVER_CONNECTION_LOST(8)`: The SDK disconnects from the server due to poor + * network connections. You can call the leaveChannel method to leave the channel. + * - `RELAY_ERROR_INTERNAL_ERROR(9)`: An internal error occurs in the server. + * - `RELAY_ERROR_SRC_TOKEN_EXPIRED(10)`: The token of the source channel has expired. + * - `RELAY_ERROR_DEST_TOKEN_EXPIRED(11)`: The token of the destination channel has expired. + */ + virtual void onChannelMediaRelayStateChanged(int state, int code) = 0; + + /** Occurs when the local user successfully registers a user account by calling the \ref IRtcEngine::joinChannelWithUserAccount "joinChannelWithUserAccount" method.This callback reports the user ID and user account of the local user. + * + * @param uid The ID of the local user. + * @param userAccount The user account of the local user. + */ + virtual void onLocalUserRegistered(uid_t uid, const char* userAccount) { + (void)uid; + (void)userAccount; + } + + /** Technical Preview, please do not depend on this event. */ + virtual void onUserAccountUpdated(uid_t uid, const char* userAccount) { + (void)uid; + (void)userAccount; + } + + /** + * Reports the error that occurs when receiving data stream messages. + * + * @param userId The ID of the user sending the data stream. + * @param streamId the ID of the sent data stream, returned in the \ref agora::rtc::IRtcConnection::createDataStream "createDataStream" method. + * @param code The error code. + * @param missed The number of lost messages. + * @param cached The number of incoming cached messages when the data stream is interrupted. + */ + virtual void onStreamMessageError(user_id_t userId, int streamId, int code, int missed, + int cached) { + (void)userId; + (void)streamId; + (void)code; + (void)missed; + (void)cached; + } + + /** + * Reports the error type of encryption. + * @param type See #ENCRYPTION_ERROR_TYPE. + */ + virtual void onEncryptionError(ENCRYPTION_ERROR_TYPE errorType) { + (void)errorType; + } + /** + * Reports the user log upload result + * @param requestId RequestId of the upload + * @param success Is upload success + * @param reason Reason of the upload, 0: OK, 1 Network Error, 2 Server Error. + */ + virtual void onUploadLogResult(const char* requestId, bool success, UPLOAD_ERROR_REASON reason) { + (void)requestId; + (void)success; + (void)reason; + } + + /** Occurs when the WIFI message need be sent to the user. + * + * @param reason The reason of notifying the user of a message. + * @param action Suggest an action for the user. + * @param wlAccMsg The message content of notifying the user. + */ + virtual void onWlAccMessage(WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) { + (void)reason; + (void)action; + (void)wlAccMsg; + } + + /** Occurs when SDK statistics wifi acceleration optimization effect. + * + * @param currentStats Instantaneous value of optimization effect. + * @param averageStats Average value of cumulative optimization effect. + */ + virtual void onWlAccStats(WlAccStats currentStats, WlAccStats averageStats) { + (void)currentStats; + (void)averageStats; + } +}; + +class INetworkObserver { + public: + virtual ~INetworkObserver() {} + + public: + /** + * Occurs when downlink network info is updated. + * + * This callback is used for notifying user to adjust the send pace based + * on the target bitrate. + * + * @param info The uplink network info collections. + */ + virtual void onUplinkNetworkInfoUpdated(const UplinkNetworkInfo& info) { + (void)info; + } + + /** + * Occurs when downlink network info is updated. + * + * This callback is used for notifying user to switch major/minor stream if needed. + * + * @param info The downlink network info collections. + */ + virtual void onDownlinkNetworkInfoUpdated(const DownlinkNetworkInfo& info) { + (void)info; + } +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtmpConnection.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtmpConnection.h new file mode 100644 index 0000000..98bdfad --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtmpConnection.h @@ -0,0 +1,393 @@ +// +// Agora RTMP connection +// +// Created by Haonong Yu in 2020-02. +// Copyright (c) 2020 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +class IRtmpLocalUser; + +/** + * Configurations for the RTMP audio stream. + */ +struct RtmpStreamingAudioConfiguration { + /** + * Sampling rate (Hz). The default value is 44100 (i.e. 44.1kHz). + */ + int sampleRateHz; + + /** + * Number of bytes per sample. The default value is 2 (i.e. 16-bit PCM). + */ + int bytesPerSample; + + /** + * Number of channels. The default value is 1 (i.e. mono). + */ + int numberOfChannels; + + /** + * The target bitrate (Kbps) of the output audio stream to be published. + * The default value is 48 Kbps. + */ + int bitrate; + + RtmpStreamingAudioConfiguration(): sampleRateHz(44100), bytesPerSample(2), + numberOfChannels(1), bitrate(48000) {} +}; + +/** + * Configurations for the RTMP video stream. + */ +struct RtmpStreamingVideoConfiguration { + /** + * The width (in pixels) of the video. The default value is 640. + * + * @note + * - The value of the dimension (with the |height| below) does not indicate the orientation mode + * of the output ratio. For how to set the video orientation, + * see {@link OrientationMode OrientationMode}. + */ + int width; + + /** + * The height (in pixels) of the video. The default value is 360. + * + * @note + * - The value of the dimension (with the |width| above) does not indicate the orientation mode + * of the output ratio. For how to set the video orientation, + * see {@link OrientationMode OrientationMode}. + */ + int height; + + /** + * Frame rate (fps) of the output video stream to be published. The default + * value is 15 fps. + */ + int framerate; + + /** + * The target bitrate (Kbps) of the output video stream to be published. + * The default value is 800 Kbps. + */ + int bitrate; + + /** + * (For future use) The maximum bitrate (Kbps) for video. + * The default value is 960 Kbps. + */ + int maxBitrate; + + /** + * (For future use) The minimum bitrate (Kbps) for video. + * The default value is 600 Kbps. + */ + int minBitrate; + + /** + * The interval between two keyframes. + * The default value is 2000ms. + */ + unsigned int gopInMs; + + /** + * Whether the encoder enables hard coding or soft coding. + * The default value is 0. + * 0: default + * 1: hardware encoder + * 2: software encoder + */ + int encoderHwSwMode; + + /** + * Whether the encoder enables CBR coding or VBR coding. + * The default value is 0. + * 0: CBR + * 1: VBR + */ + int encoderBitrateControlMode; + + /** + * The orientation mode. + * See {@link ORIENTATION_MODE ORIENTATION_MODE}. + */ + ORIENTATION_MODE orientationMode; + + RtmpStreamingVideoConfiguration(): width(640), height(360), framerate(15), + bitrate(800), maxBitrate(960), minBitrate(600), gopInMs(2000), encoderHwSwMode(0),encoderBitrateControlMode(0), + orientationMode(ORIENTATION_MODE_ADAPTIVE) {} +}; + + +/** + * The RTMP Connection error codes. + */ +enum RTMP_CONNECTION_ERROR { + /** + * 0: No error occurs. + */ + RTMP_CONNECTION_ERR_OK = 0, + + /** + * 1: A general error occurs (no specified reason). + */ + RTMP_CONNECTION_ERR_FAILED = 1, + + /** + * 2: The rtmp url is invalid. + */ + RTMP_CONNECTION_ERR_INVALID_URL = 2, + + /** + * 3: Already exist stream name. + */ + RTMP_CONNECTION_ERR_BAD_NAME = 3, +}; + +/** + * The connection state between the SDK and the RTMP server. + */ +enum RTMP_CONNECTION_STATE { + /** + * 1: The SDK is disconnected from the RTMP server. + * + * This is the initial state when an RTMP Connetion is created by + * the \ref IAgoraService::createRtmoConnection "createRtmpConnection" method. + * + * The RTMP Connection also enters this state if you call the + * \ref disconnect "disconnect" method when the SDK is in the + * STATE_CONNECTING(2), STATE_CONNECTED(3), STATE_RECONNECTING(4) or + * STATE_FAILED(5) state. + */ + STATE_DISCONNECTED = 1, + + /** + * 2: The SDK is connecting to the RTMP server. + * + * The SDK goes to this state after you call the \ref connect "connect" method, + * indicating that the SDK is in the process of establishing a connection + * to the RTMP server. + * + * Once successfully connected, it enters the STATE_CONNECTED(3) state. + * + * If the SDK fails to connect to RTMP server, the SDK goes to STATE_FAILED(5). + */ + STATE_CONNECTING = 2, + + /** + * 3: The SDK is connected to the RTMP server. + * + * This state indicates that the SDK has established a connection to the + * RTMP server, and you can publish media streams through this connection. + * + * Once the connection is interrupted, for example, due to network deterioration or + * network type change, the SDK tries to reconnect to the RTMP server + * and enters the STATE_RECONNECTING(4) state. + */ + STATE_CONNECTED = 3, + + /** + * 4: The SDK is reconnecting to the RTMP server. + * + * This state indicates that the connection is interrupted by + * some network issue. The SDK keeps trying connecting to the + * server. If the SDK fails to reconnect, the SDK goes to + * STATE_FAILED(5). + */ + STATE_RECONNECTING = 4, + + /** + * 5: The SDK fails to connect to the RTMP server. + * + * In this state, SDK stops connecting to the server. Call the + * - \ref IRtmpConnection::disconnect "disconnect" method to leave this state and the + * - \ref IRtmpConnection::connect "connect" method to reconnect. + */ + STATE_FAILED = 5, + + /** + * 6: The SDK is reconnected to the RTMP server. + * + * This state indicates that the connection is interrupted by + * some network issue. The SDK keeps trying connecting to the + * server. If the SDK reconnected to server, the SDK goes to + * STATE_RECONNECTED(6). + */ + STATE_RECONNECTED = 6 +}; + +/** + * Configurations for the RTMP connection. + */ +struct RtmpConnectionConfiguration { + RtmpStreamingAudioConfiguration audioConfig; + RtmpStreamingVideoConfiguration videoConfig; + bool enableWriteFlvFile; + bool audioOnly; + RtmpConnectionConfiguration() : enableWriteFlvFile(false), + audioOnly(false) {} +}; + +/** + * The information on the RTMP Connection. + */ +struct RtmpConnectionInfo { + /** + * The state of the current connection: #RTMP_CONNECTION_STATE. + */ + RTMP_CONNECTION_STATE state; + + RtmpConnectionInfo() : state(STATE_DISCONNECTED) {} +}; + + +/** + * The IRtmpConnectionObserver class, which observes the RTMP connection state of the SDK. + */ +class IRtmpConnectionObserver { + public: + /** + * Occurs when the connection state between the SDK and the RTMP server changes to STATE_CONNECTED(3). + * + * @param connectionInfo The information of the current connection: RtmpConnectionInfo. + */ + virtual void onConnected(const RtmpConnectionInfo& connectionInfo) = 0; + + /** + * Occurs when the connection state between the SDK and the RTMP server changes to STATE_DISCONNECTED(1). + * + * @param connectionInfo The information of the current connection: RtmpConnectionInfo. + */ + virtual void onDisconnected(const RtmpConnectionInfo& connectionInfo) = 0; + + /** + * Occurs when the connection state between the SDK and RTMP server changes to STATE_RECONNECTING(4). + * + * @param connectionInfo The information of the current connection: RtmpConnectionInfo. + */ + virtual void onReconnecting(const RtmpConnectionInfo& connectionInfo) = 0; + + /** + * Occurs when the connection state between the SDK and RTMP server changes to STATE_RECONNECTED(6). + * + * @param connectionInfo The information of the current connection: RtmpConnectionInfo. + */ + virtual void onReconnected(const RtmpConnectionInfo& connectionInfo) = 0; + + /** + * Occurs when the connection state between the SDK and the RTMP server changes to STATE_FAILED(5). + * + * @param connectionInfo The connection information: RtmpConnectionInfo. + * @param errCode The error code for the connection failure. + */ + virtual void onConnectionFailure(const RtmpConnectionInfo& connectionInfo, + RTMP_CONNECTION_ERROR errCode) = 0; + + /** + * Occurs every 1s when the connection transmits data, report the current video bitrate, audio bitrate and video framerate. + * + * @param video_width The width of the video frame actually pushed out + * @param video_height The height of the video frame actually pushed out + * @param video_bitrate The actual bitrate of the video stream being pushed out + * @param audio_bitrate The actual bitrate of the audio stream being pushed out + * @param video_frame_rate The frame rate of the video stream actually pushed out + */ + virtual void onTransferStatistics(uint64_t video_width, uint64_t video_height, uint64_t video_bitrate, uint64_t audio_bitrate, uint64_t video_frame_rate, uint64_t push_video_frame_cnt, uint64_t pop_video_frame_cnt) = 0; + + virtual ~IRtmpConnectionObserver() {} +}; + +/** + * The IRtmpConnection class. + * + * With this class, an app can establish a connection to a RTMP server. + * Once connected, the app gets an RtmpUser object, which + * can publish media streams to the RTMP server. + * + * Connecting to the server is done asynchronous, and apps can listen for the + * connection states or events with IRtmpConnectionObserver. + */ +class IRtmpConnection : public RefCountInterface { + public: + ~IRtmpConnection() {} + + /** + * Connects to a RTMP server. + * + * When the method call succeeds, the RTMP connection state changes to + * STATE_CONNECTING(2). + * + * Depending on the success or failure of the connection establishment, the RTMP + * connection will make a second state transition to either + * STATE_CONNECTED(3) or STATE_FAILED(5). You will also be notified with the either + * onConnected() or onDisconnected(). + * + * @param url The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 + * bytes. The URL address must not contain special characters, such as Chinese language characters. + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_INVALID_ARGUMENT: The passed in argument is invalid. + * - ERR_INVALID_STATE: The current connection state is not STATE_DISCONNECTED(3). + */ + virtual int connect(const char* url) = 0; + + /** + * Disconnects from the RTMP server. + * + * A successful call of this method changes the connection state to + * STATE_DISCONNECTED(4). You will be notified with the callback + * \ref onDisconnected "onDisconnected". + */ + virtual int disconnect() = 0; + + /** + * Gets the current connection information. + * + * @return + * - A pointer to the RtmpConnectionInfo object, if the method call succeeds. + * - An empty pointer NULL, if the method call fails. + */ + virtual RtmpConnectionInfo getConnectionInfo() = 0; + + /** + * Gets the IRtmpUser object. + * + * @return + * - A pointer to the IRtmpUser object, if the method call succeeds. + * - An empty pointer NULL, if the method call fails. + */ + virtual IRtmpLocalUser* getRtmpLocalUser() = 0; + + /** + * Registers an IRtmpConnectionObserver object. + * + * @param observer A pointer to the IRtmpConnectionObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerObserver(IRtmpConnectionObserver* observer, void(*safeDeleter)(IRtmpConnectionObserver*) = NULL) = 0; + + /** + * Releases the registered IRtmpConnectionObserver object. + * + * @param observer The pointer to the IRtmpConnectionObserver object created by the \ref registerObserver + * "registerObserver" method. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterObserver(IRtmpConnectionObserver* observer) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtmpLocalUser.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtmpLocalUser.h new file mode 100644 index 0000000..aedc927 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraRtmpLocalUser.h @@ -0,0 +1,247 @@ +// +// Agora RTMP connection +// +// Created by Haonong Yu in 2020-02. +// Copyright (c) 2020 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "NGIAgoraAudioTrack.h" +#include "NGIAgoraVideoTrack.h" + +namespace agora { +namespace rtc { + +struct RtmpStreamingAudioConfiguration; +struct RtmpStreamingVideoConfiguration; + +/** + * The error occurs while publising audio stream. + */ +enum PublishAudioError { + /** + * 0: No error occurs. + */ + PUBLISH_AUDIO_ERR_OK = 0, + + /** + * 1: A general error occurs (no specified reason). + */ + PUBLISH_AUDIO_ERR_FAILED = 1, +}; + +/** + * The error occurs while publising video stream. + */ +enum PublishVideoError { + /** + * 0: No error occurs. + */ + PUBLISH_VIDEO_ERR_OK = 0, + + /** + * 1: A general error occurs (no specified reason). + */ + PUBLISH_VIDEO_ERR_FAILED = 1, +}; + +/** + * The IRtmpLocalUserObserver class. + */ +class IRtmpLocalUserObserver { + public: + virtual ~IRtmpLocalUserObserver() {} + + /** + * Occurs when the first packet of the local audio track is sent, indicating that the local audio track + * is successfully published. + * + * @param audioTrack The pointer to ILocalAudioTrack. + */ + virtual void onAudioTrackPublishSuccess(agora_refptr audioTrack) = 0; + virtual void onAudioTrackPublishStart(agora_refptr audioTrack) = 0; + virtual void onAudioTrackUnpublished(agora_refptr audioTrack) = 0; + + /** + * Occurs when the local audio track fails to be published. + * + * @param audioTrack The pointer to ILocalAudioTrack. + * @param error The error information: #RtmpAudioStreamError. + */ + virtual void onAudioTrackPublicationFailure(agora_refptr audioTrack, + PublishAudioError error) = 0; + + /** + * Occurs when the first packet of the local video track is sent, indicating that the local video track + * is successfully published. + * @param videoTrack The pointer to ILocalVideoTrack. + */ + virtual void onVideoTrackPublishSuccess(agora_refptr videoTrack) = 0; + virtual void onVideoTrackPublishStart(agora_refptr videoTrack) = 0; + virtual void onVideoTrackUnpublished(agora_refptr videoTrack) = 0; + + /** + * Occurs when the local video track fails to be published. + * + * @param videoTrack The pointer to ILocalVideoTrack. + * @param error The error information: #RtmpVideoStreamError. + */ + virtual void onVideoTrackPublicationFailure(agora_refptr videoTrack, + PublishVideoError error) = 0; +}; + +/** + * The IRtmpLocalUser class defines the behavior and state of the RTMP user. + * + * Once connected, a RTMP connection has its own user. Apps can get the + * user object using \ref agora::rtmp::IRtmpConnection::getUser + * "IRtmpConnection::getUser". + */ +class IRtmpLocalUser { + public: + + enum VideoBitrateAdjustType { + None = 0, + Increasing = 1, // The buffer is in good declining state to increase bitrate + Decreasing = 2, // The buffer is in bad increasing state to decrease bitrate + }; + + virtual ~IRtmpLocalUser() {} + + virtual int setAudioStreamConfiguration(const RtmpStreamingAudioConfiguration& config) = 0; + + virtual int setVideoStreamConfiguration(const RtmpStreamingVideoConfiguration& config) = 0; + + virtual int adjustRecordingSignalVolume(int volume) = 0; + + virtual int getRecordingSignalVolume(int32_t* volume) = 0; + + virtual int setAudioEnabled(bool enabled) = 0; + + virtual void adjustVideoBitrate(VideoBitrateAdjustType type) = 0; + + virtual int setVideoEnabled(bool enabled) = 0; + + /** + * Publishes a local audio track to the RTMP connection. + * + * @param audioTrack The local audio track to be published: ILocalAudioTrack. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int publishAudio(agora_refptr audioTrack) = 0; + + /** + * Stops publishing the local audio track to the RTMP connection. + * + * @param audioTrack The local audio track that you want to stop publishing: ILocalAudioTrack. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishAudio(agora_refptr audioTrack) = 0; + + /** + * Publishes a media player local audio track to the RTMP connection. + * + * @param audioTrack The local audio track to be published: ILocalAudioTrack. + * @param playerId The player source ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int publishMediaPlayerAudio(agora_refptr audioTrack, int32_t playerId=0) = 0; + + /** + * Stops publishing the media player local audio track to the RTMP connection. + * + * @param audioTrack The local audio track that you want to stop publishing: ILocalAudioTrack. + * @param playerId The player source ID. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishMediaPlayerAudio(agora_refptr audioTrack, int32_t playerId=0) = 0; + + /** + * Publishes a local video track to the RTMP connection. + * + * @param videoTrack The local video track to be published: ILocalVideoTrack. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int publishVideo(agora_refptr videoTrack) = 0; + + /** + * Stops publishing the local video track to the RTMP connection. + * + * @param videoTrack The local video track that you want to stop publishing: ILocalVideoTrack. + * - 0: Success. + * - < 0: Failure. + */ + virtual int unpublishVideo(agora_refptr videoTrack) = 0; + + /** + * Registers a RTMP user observer object. + * + * You need to implement the IRtmpLocalUserObserver class in this method. Once registered, the + * IRtmpLocalUserObserver receives events sent by the IRtmpLocalUser object. + * + * @param observer The pointer to the IRtmpLocalUserObserver object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerRtmpUserObserver(IRtmpLocalUserObserver* observer, void(*safeDeleter)(IRtmpLocalUserObserver*) = NULL) = 0; + + /** + * Releases the IRtmpLocalUserObserver object previously registered using registerRtmpUserObserver(). + * + * @param observer The pointer to the IRtmpLocalUserObserver object that you want to release. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisteRtmpUserObserver(IRtmpLocalUserObserver* observer) = 0; + /** + * Registers an audio frame observer object. + * + * @param observer A pointer to the audio frame observer object: IAudioFrameObserver. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Unregisters an audio frame observer object. + * + * @param observer A pointer to the audio frame observer object: IAudioFrameObserver. + */ + virtual void unregisterAudioFrameObserver(media::base::IAudioFrameObserver* observer) = 0; + + /** + * Registers a video frame observer object. + * + * @param observer A pointer to the video frame observer: IVideoFrameObserver. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoFrameObserver(media::base::IVideoFrameObserver* observer) = 0; + + /** + * Unregisters a video frame observer object. + * + * @param observer A pointer to the video frame observer: IVideoFrameObserver. + */ + virtual void unregisterVideoFrameObserver(media::base::IVideoFrameObserver* observer) = 0; +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraScreenCapturer.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraScreenCapturer.h new file mode 100644 index 0000000..a5e5e16 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraScreenCapturer.h @@ -0,0 +1,202 @@ +// +// Agora SDK +// +// Copyright (c) 2019 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" + +namespace agora { +namespace rtc { + +/** + * The IScreenCapturer class, which provides access to the screen capturer. + */ +class IScreenCapturer : public RefCountInterface { + public: +#if defined (_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + /** + * Initializes the screen capturer by specifying a display ID. + * + * @note + * This method applies to macOS only. + * + * This method shares a whole or part of a screen specified by the display ID. + * @param displayId The display ID of the screen to be shared. This parameter specifies which screen you want + * to share. + * @param regionRect The reference to the relative location of the region to the screen: Rectangle. + * - If the specified region overruns the screen, only the region within the screen will be captured. + * - If you set `width` or `height` as 0, the whole screen will be captured. + * Note that the coordinates of rectangle are relative to the window and follows system specifications. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithDisplayId(uint32_t displayId, const Rectangle& regionRect) = 0; +#endif + +#if defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) + /** + * Initializes the screen capturer by specifying a screen Rect. + * + * @note + * This method applies to Windows only. + * + * This method shares a whole or part of a screen specified by the screen Rect. + * @param screenRect The reference to the Rect of the screen to be shared. This parameter specifies which screen you want + * to share. + * @param regionRect The reference to the relative location of the region to the screen. See \ref agora::rtc::Rectangle ®ionRect "regionRect". + * - If the specified region overruns the screen, only the region within the screen will be captured. + * - If you set `width` or `height` as 0, the whole screen will be captured. + * Note that the coordinates of rectangle are relative to the window and follows system specifications. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithScreenRect(const Rectangle& screenRect, + const Rectangle& regionRect) = 0; +#endif // TARGET_OS_MAC && !TARGET_OS_IPHONE + + /** + * Initializes the screen capturer by specifying a window ID. + * + * This method shares a whole or part of a window specified by the window ID. + * + * @note + * This method applies to Windows and macOS only. + * @param windowId The ID of the window to be shared. This parameter specifies which window you want + * to share. + * @param regionRect The reference to the relative location of the region to the window. See \ref agora::rtc::Rectangle ®ionRect "regionRect". + * - If the specified region overruns the window, only the region within the screen will be captured. + * - If you set `width` or `height` as 0, the whole window will be captured. + * Note that the coordinates of rectangle are relative to the window and follows system specifications. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int initWithWindowId(view_t windowId, const Rectangle& regionRect) = 0; + + /** + * Sets the content hint for screen sharing. + * + * A content hint suggests the type of the content being shared, so that the SDK applies different + * optimization algorithms to different types of content. + * @param contentHint The content hint for screen capture: \ref rtc::VIDEO_CONTENT_HINT "VIDEO_CONTENT_HINT". + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_NOT_READY: No screen or window is being shared. + */ + virtual int setContentHint(VIDEO_CONTENT_HINT contentHint) = 0; + + /** + * Updates the screen capture region. + * @param regionRect The reference to the relative location of the region to the screen or window. See \ref agora::rtc::Rectangle "Rectangle". + * - If the specified region overruns the screen or window, the screen capturer captures only the region within it. + * - If you set `width` or `height` as 0, the SDK shares the whole screen or window. + * @return + * - 0: Success. + * - < 0: Failure. + * - No screen or window is being shared. + */ + virtual int updateScreenCaptureRegion(const Rectangle& regionRect) = 0; + + /** + * Set orientation of the captured screen image + * @param VIDEO_ORIENTATION orientaion of the device 0(by default), 90, 180, 270 + */ + virtual void setScreenOrientation(VIDEO_ORIENTATION orientation) = 0; + + /** + * Set frame rate of the screen capture source + * @param rate frame rate (in fps) + */ + virtual void setFrameRate(int rate) = 0; + +#if defined(__ANDROID__) + /** + * Initializes the screen capturer by specifying the Intent data obtained from MediaProjection. + * + * This method shares the whole screen. + * + * @note + * This method applies to Android only. + * @param data The Intent data from `onActivityResult (int requestCode, int resultCode, Intent data)` after you create + * an Intent from `MediaProjection` and sends the Intent to `startActivityForResult`. + * @param dimensions The reference to the captured screen's resolution in terms of width × height. + * - If you set `width` or `height` as 0, the dimensions will be the screen's width × height. + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_INVALID_ARGUMENT if data is null. + */ + virtual int initWithMediaProjectionPermissionResultData(void* data, + const VideoDimensions& dimensions) = 0; +#endif // __ANDROID__ + + protected: + ~IScreenCapturer() {} +}; + +#if defined(__ANDROID__) || TARGET_OS_IPHONE +class IScreenCapturer2 : public RefCountInterface { + public: + /** + * Screen capture's resolution. + * + * @param dimensions The reference to the captured screen's resolution in terms of width × height. + * - If you set `width` or `height` as 0, the dimensions will be the screen's width × height. + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_INVALID_ARGUMENT if data is null. + */ + virtual int setScreenCaptureDimensions(const VideoDimensions& dimensions) = 0; + + /** + * Updates the screen capture region. + * @param regionRect The reference to the relative location of the region to the screen or window. See \ref agora::rtc::Rectangle "Rectangle". + * - If the specified region overruns the screen or window, the screen capturer captures only the region within it. + * - If you set `width` or `height` as 0, the SDK shares the whole screen or window. + * @return + * - 0: Success. + * - < 0: Failure. + * - No screen or window is being shared. + */ + virtual int updateScreenCaptureRegion(const Rectangle& regionRect) = 0; + + /** + * Set frame rate of the screen capture source + * @param rate frame rate (in fps) + */ + virtual int setFrameRate(int rate) = 0; + + /** + * Set channels and sample rate of screen audio capturing + * @param channels: channels of system audio capture + * @param sampleRate: sample rate of system audio capture + * @return + * - 0: Sucess. + * - < 0: Failure + */ + virtual int setAudioRecordConfig(int channels, int sampleRate) = 0; + + /** + * Set volume of screen audio capturing + * @param volume: volume of system audio capture + * @return + * - 0: Sucess. + * - < 0: Failure + */ + virtual int setAudioVolume(uint32_t volume) = 0; + + protected: + virtual ~IScreenCapturer2() {} +}; +#endif + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoFrame.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoFrame.h new file mode 100644 index 0000000..ab12ff5 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoFrame.h @@ -0,0 +1,265 @@ + +// Copyright (c) 2020 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" + +#ifndef OPTIONAL_ENUM_CLASS +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_ENUM_CLASS enum class +#else +#define OPTIONAL_ENUM_CLASS enum +#endif +#endif + +namespace agora { +namespace rtc { + +/** + * This structure defines the video frame of texture type on Android + * @note For technical preview, not supported for the moment. Use RawPixelBuffer instead. + * + */ +struct TextureInfo { + OPTIONAL_ENUM_CLASS TextureType { + kGlTextureOes, + kGlTexture2D, + }; + OPTIONAL_ENUM_CLASS EglContextType { + kEglContext10, + kEglContext14, + }; + + TextureType texture_type; + EglContextType context_type; + void* shared_context; + int texture_id; + int64_t fence_object; + float transform_matrix[16]; +}; + +/** + * This structure defines the raw video frame data in memory + * + */ +struct RawPixelBuffer { + OPTIONAL_ENUM_CLASS Format { + kUnknown, + kI420, + kI422, + kNV21, + kNV12, + kRGBA, + kARGB, + kBGRA + }; + Format format; + uint8_t* data; + int size; +}; + +struct PaddedRawPixelBuffer { + RawPixelBuffer::Format format; + uint8_t* data; + int size; + int stride; + PaddedRawPixelBuffer() + : data(NULL), size(0), stride(0) {} +}; + +struct ColorSpace { + enum PrimaryID { + // The indices are equal to the values specified in T-REC H.273 Table 2. + PRIMARYID_BT709 = 1, + PRIMARYID_UNSPECIFIED = 2, + PRIMARYID_BT470M = 4, + PRIMARYID_BT470BG = 5, + PRIMARYID_SMPTE170M = 6, // Identical to BT601 + PRIMARYID_SMPTE240M = 7, + PRIMARYID_FILM = 8, + PRIMARYID_BT2020 = 9, + PRIMARYID_SMPTEST428 = 10, + PRIMARYID_SMPTEST431 = 11, + PRIMARYID_SMPTEST432 = 12, + PRIMARYID_JEDECP22 = 22, // Identical to EBU3213-E + }; + + enum RangeID { + // The indices are equal to the values specified at + // https://www.webmproject.org/docs/container/#colour for the element Range. + RANGEID_INVALID = 0, + // Limited Rec. 709 color range with RGB values ranging from 16 to 235. + RANGEID_LIMITED = 1, + // Full RGB color range with RGB valees from 0 to 255. + RANGEID_FULL = 2, + // Range is defined by MatrixCoefficients/TransferCharacteristics. + RANGEID_DERIVED = 3, + }; + + enum MatrixID { + // The indices are equal to the values specified in T-REC H.273 Table 4. + MATRIXID_RGB = 0, + MATRIXID_BT709 = 1, + MATRIXID_UNSPECIFIED = 2, + MATRIXID_FCC = 4, + MATRIXID_BT470BG = 5, + MATRIXID_SMPTE170M = 6, + MATRIXID_SMPTE240M = 7, + MATRIXID_YCOCG = 8, + MATRIXID_BT2020_NCL = 9, + MATRIXID_BT2020_CL = 10, + MATRIXID_SMPTE2085 = 11, + MATRIXID_CDNCLS = 12, + MATRIXID_CDCLS = 13, + MATRIXID_BT2100_ICTCP = 14, + }; + + enum TransferID { + // The indices are equal to the values specified in T-REC H.273 Table 3. + TRANSFERID_BT709 = 1, + TRANSFERID_UNSPECIFIED = 2, + TRANSFERID_GAMMA22 = 4, + TRANSFERID_GAMMA28 = 5, + TRANSFERID_SMPTE170M = 6, + TRANSFERID_SMPTE240M = 7, + TRANSFERID_LINEAR = 8, + TRANSFERID_LOG = 9, + TRANSFERID_LOG_SQRT = 10, + TRANSFERID_IEC61966_2_4 = 11, + TRANSFERID_BT1361_ECG = 12, + TRANSFERID_IEC61966_2_1 = 13, + TRANSFERID_BT2020_10 = 14, + TRANSFERID_BT2020_12 = 15, + TRANSFERID_SMPTEST2084 = 16, + TRANSFERID_SMPTEST428 = 17, + TRANSFERID_ARIB_STD_B67 = 18, + }; + + PrimaryID primaries; + TransferID transfer; + MatrixID matrix; + RangeID range; + + ColorSpace() + : primaries(PRIMARYID_UNSPECIFIED), transfer(TRANSFERID_UNSPECIFIED), + matrix(MATRIXID_UNSPECIFIED), range(RANGEID_INVALID) {} +}; + +/** + * This structure defines underlying detailed video frame data of @ref agora::rtc::IVideoFrame + * + */ +struct VideoFrameData { + OPTIONAL_ENUM_CLASS Type { + kRawPixels, // Raw pixels in memory + kTexture, // Deprecated Android: GL_TEXTURE_2D/GL_TEXTURE_OES + kCVPixelBuffer, // iOS: CVPixelBufferRef + kPaddedRawPixels, // Raw pixels with paddings + kTextureOES,// Android: GL_TEXTURE_OES + kTexture2D, // Android: GL_TEXTURE_2D + }; + Type type; + union { + TextureInfo texture; // Android (To be supported) + RawPixelBuffer pixels; // All platform + void* cvpixelbuffer; // iOS (To be supported) + }; + int width; + int height; + int rotation; + ColorSpace color_space; + int64_t timestamp_ms; // Capture time in milli-seconds +}; + +struct VideoFrameDataV2 : public VideoFrameData { + PaddedRawPixelBuffer padded_pixels; // All platform +}; + +OPTIONAL_ENUM_CLASS VideoFrameMetaDataType { + kAlphaChannel, + kScreenMetaInfo, + kVideoSourceType, + kFaceInfo, + // Add other types afterwards +}; + +struct AlphaChannel { + uint8_t* data; + int size; +}; + +typedef int32_t VideoSourceType; + +/** + * The IVideoFrame class defines the interface to + * send video frame data to the SDK or get video frame data from the SDK. + */ +class IVideoFrame : public RefCountInterface { + public: + /** + * Get the concrete video frame data of the underlying buffer. + * @param data [out] The video frame data. + * @return + * - int: error code. 0 for success. + */ + virtual int getVideoFrameData(VideoFrameData& data) const = 0; + + /** + * Fill the underlying buffer with source buffer info contained in VideoFrameInfo + * For frames of type "Type::kMemPixels", This function first tries to fill in-place with no copy and reallocation. + * When it fails, a copy or copy-plus-reallocation may happen + * @param data [in] Data to be filled in. + * @return + * - 0: if succeeds + * - <0: failure + */ + virtual int fillVideoFrameData(const VideoFrameData& data) = 0; + + /** + * Get the underlying meta data of the given type. + * e.g. If type is VideoFrameMetaDataType::kAlphaChannel, then data value can be casted to AlphaChannel; + * @param type @ref VideoFrameMetaDataType type of the meta data wanted + * @param data [out] pointer to the the meta data object of the given type + * @return + * - 0: if succeeds + * - <0: failure + */ + virtual int getVideoFrameMetaData(VideoFrameMetaDataType type, void* data) = 0; + + /** + * Fill the underlying meta data of the given type. + * e.g. If type is VideoFrameMetaDataType::kAlphaChannel, then data should point to AlphaChannel object; + * @param type @ref VideoFrameMetaDataType type of the meta data to fill + * @param data [in] pointer to the the meta data object of the given type + * @return + * - 0: if succeeds + * - <0: failure + */ + virtual int fillVideoFrameMetaData(VideoFrameMetaDataType type, const void* data) = 0; + + protected: + ~IVideoFrame() {} +}; + +class IVideoFrameMemoryPool : public RefCountInterface { + public: + /** + * Create IVideoFrame + * @param data video frame data of the new video frame + * @param metatypes pointer to the array of meta types + * @param count number of the meta types in the array + */ + virtual agora::agora_refptr createVideoFrame( + const VideoFrameData& data, const VideoFrameMetaDataType* metatypes = NULL, int count = 0) = 0; + protected: + virtual ~IVideoFrameMemoryPool() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoMixerSource.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoMixerSource.h new file mode 100644 index 0000000..f179cda --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoMixerSource.h @@ -0,0 +1,159 @@ +// +// Agora SDK +// +// Copyright (c) 2018 Agora.io. All rights reserved. +// + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" +#include "AgoraRefPtr.h" +#include "IAgoraService.h" + +namespace agora { +namespace rtc { + +class IVideoTrack; + +struct MixerLayoutConfig { + int32_t x; + int32_t y; + int32_t width; + int32_t height; + int32_t zOrder; // larger zOrder prioritizes smaller ones + float alpha; + bool mirror; + const char* image_path; // url of the place holder picture + + MixerLayoutConfig() : x(0), y(0), width(0), height(0), zOrder(0), alpha(1.0), mirror(false), image_path(NULL) {} + MixerLayoutConfig(int ox, int oy, int w, int h, int order) : x(ox), y(oy), width(w), height(h), zOrder(order), alpha(1.0), mirror(false), image_path(NULL) {} +}; + +enum ImageType { + kPng, + kJpeg, + kGif +}; + +/** + * The IVideoMixerSource class abstracts a multi-in-multi-out video source which receives video + * streams from multiple local or remote video tracks and generate mixed video stream in user defined output + * format. When only one video track is added to the mixer, it simply forwards the incoming video frames + * to its sinks. + */ +class IVideoMixerSource : public RefCountInterface { +public: + /** + * Add a video track for mixing. + * @param id The unique id of the stream. + * @param track The instance of the video track that you want mixer to receive its video stream. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int addVideoTrack(const char* id, agora_refptr track) = 0; + /** + * Remove the video track. + * @param id The unique id of the stream. + * @param track The instance of the video track that you want to remove from the mixer. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int removeVideoTrack(const char* id, agora_refptr track) = 0; + /** + * Configures the layout of video frames comming from a specific track (indicated by uid) + * on the mixer canvas. + * @param id The unique id of the stream. + * @param config The layout configuration + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setStreamLayout(const char* id, const MixerLayoutConfig& config) = 0; + /** + * Remove the user layout on the mixer canvas + * @param id The unique id of the stream. + * @param uid The uid of the stream. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int delStreamLayout(const char* id) = 0; + /** + * Add a image source to the mixer with its layout configuration on the mixer canvas. + * @param id The unique id of the image. + * @param config The layout configuration + * @return + * 0 - Success + * <0 - Failure + */ + virtual int addImageSource(const char* id, const MixerLayoutConfig& config, ImageType type = kPng) = 0; + /** + * Delete a image source to the mixer. + * @param id The unique id of the image. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int delImageSource(const char* id) = 0; + /** + * Clear all the layout settings set previously + */ + virtual void clearLayout() = 0; + /** + * Refresh the user layout on the mixer canvas + * @return + * 0 - Success + * <0 - Failure + */ + virtual int refresh() = 0; + /** + * Set the mixer canvas background to override the default configuration + * @param width width of the canvas + * @param height height of the canvas + * @param fps fps of the mixed video stream + * @param color_argb mixer canvas background color in argb + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setBackground(uint32_t width, uint32_t height, int fps, uint32_t color_argb = 0) = 0; + /** + * Set the mixer canvas background to override the default configuration + * @param width width of the canvas + * @param height height of the canvas + * @param fps fps of the mixed video stream + * @param url URL of the canvas background image + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setBackground(uint32_t width, uint32_t height, int fps, const char* url) = 0; + /** + * Set the rotation of the mixed video stream + * @param rotation:0:none, 1:90°, 2:180°, 3:270° + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setRotation(uint8_t rotation) = 0; + /** + * Get the average delay in ms introduced by the mixer module, which includes the average + * mixing delay plus the encoder delay. + * @return + * delay in ms + */ + virtual int getAvgMixerDelay() = 0; + /** + * Set the master clock source for mixed video frame. The master clock source serves as the + * reference clock for audio/video synchronization after mixing. + * @return + * 0 - Success + * <0 - Failure + */ + virtual int setMasterClockSource(const char* id = NULL) = 0; +}; + +} //namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoTrack.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoTrack.h new file mode 100644 index 0000000..3ac6eda --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/NGIAgoraVideoTrack.h @@ -0,0 +1,531 @@ + +// Copyright (c) 2019 Agora.io. All rights reserved + +// This program is confidential and proprietary to Agora.io. +// And may not be copied, reproduced, modified, disclosed to others, published +// or used, in whole or in part, without the express prior written permission +// of Agora.io. + +#pragma once // NOLINT(build/header_guard) + +#include "AgoraBase.h" + +#ifndef OPTIONAL_OVERRIDE +#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) +#define OPTIONAL_OVERRIDE override +#else +#define OPTIONAL_OVERRIDE +#endif +#endif + +namespace agora { +namespace rtc { +class IVideoFilter; +class IVideoEncodedFrameObserver; +class IMediaPacketReceiver; +class IVideoSinkBase; + +enum VideoTrackType { + LOCAL_VIDEO_TRACK, + REMOTE_VIDEO_TRACK, + REMOTE_VIDEO_IMAGE_TRACK, +}; + +/** + * The `IVideoTrack` class defines the behavior and status of a video track. + */ +class IVideoTrack : public RefCountInterface { + public: + /** + * Adds a video filter to the video track. + * + * Add a video filter in either of the following ways: + * - Use the \ref agora::rtc::IMediaNodeFactory "IMediaNodeFactory" object to create a built-in video filter. + * - Use a custom video filter by implementing the \ref agora::rtc::IVideoFilter "IVideoFilter" class. + * + * To add multiple filters, call this method multiple times. The order of the added filters depends on when + * the app successfully adds the filter. + * + * @param filter The video filter that you want to add to the video track. + * @param position The position where the filter is added. + * @param id id of the filter + * @return + * - `true`: The video filter is added successfully. + * - `false`: The video filter fails to be added. + */ + virtual bool addVideoFilter( + agora_refptr filter, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER, + const char* id = NULL) = 0; + + /** + * Removes the video filter added by `addVideoFilter` from the video track. + * + * @param filter The video filter that you want to remove: `IVideoFilter`. + * @param position The position of the filter. + * @id id of the filter + * @return + * - `true`: The video filter is removed successfully. + * - `false`: The video filter fails to be removed. + */ + virtual bool removeVideoFilter( + agora_refptr filter, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER, + const char* id = NULL) = 0; + + /** + * Whether a video filter exists + * @param id id of the filter + * @return + * - true: exist + * - false: not exist + */ + virtual bool hasVideoFilter(const char* id, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER) = 0; + + /** + * Adds a video renderer to the video track. + * + * Add a video renderer in either of the following ways: + * - Use the built-in video renderer by implementing the `IVideoRenderer` in the `IMediaNodeFactory` class. + * - Use a custom video renderer by implementing the `IVideoSinkBase` class. + * + * @param videoRenderer The video renderer that you want to add: IVideoSinkBase. + * @param position The position where the renderer is added. + * + * @return + * - `true`: The video renderer is added successfully. + * - `false`: The video renderer fails to be added. + */ + virtual bool addRenderer(agora_refptr videoRenderer, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_PRE_RENDERER) = 0; + /** + * Removes the video renderer added by `addRenderer` from the video track. + * + * @param videoRenderer The video renderer that you want to remove: IVideoSinkBase. + * @param position The position where the renderer is removed: \ref media::base::VIDEO_MODULE_POSITION "VIDEO_MODULE_POSITION". + * @return + * - `true`: The video renderer is removed successfully. + * - `false`: The video renderer fails to be removed. + */ + virtual bool removeRenderer(agora_refptr videoRenderer, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_PRE_RENDERER) = 0; + /** + * Get the track type of the video track + * @return + * - VideoTrackType + */ + virtual VideoTrackType getType() = 0; + + /** + * Enable / Disable specified video filter + * @param id id of the filter + * @param enable enable / disable the filter with given id + * @return + * - 0: success + * - <0: failure + */ + virtual int enableVideoFilter(const char* id, bool enable) { return -1; } + + /** + * set the properties of the specified video filter + * @param id id of the filter + * @param key key of the property + * @param json_value json str value of the property + * @return + * - 0: success + * - <0: failure + */ + virtual int setFilterProperty(const char* id, const char* key, const char* json_value) { return -1; } + + /** + * get the properties of the specified video filter + * @param id id of the filter + * @param key key of the property + * @param json_value json str value of the property + * @return + * - 0: success + * - <0: failure + */ + virtual int getFilterProperty(const char* id, const char* key, char* json_value, size_t buf_size) { return -1; } + + protected: + ~IVideoTrack() {} +}; + +/** + * The statistics of the local video track. + */ +struct LocalVideoTrackStats { + /** + * The number of streams. + */ + uint64_t number_of_streams; + /** + * The number of bytes of the major stream. + */ + uint64_t bytes_major_stream; + /** + * The number of bytes of the minor stream. + */ + uint64_t bytes_minor_stream; + /** + * The number of encoded frames. + */ + uint32_t frames_encoded; + /** + * The SSRC (synchronization source) of the major stream. + */ + uint32_t ssrc_major_stream; + /** + * The SSRC (synchronization source) of the minor stream. + */ + uint32_t ssrc_minor_stream; + /** + * The capture frame rate of the video. + */ + int capture_frame_rate; + /** + * The regulated frame rate of capture frame rate according to video encoder configuration. + */ + int regulated_capture_frame_rate; + /** + * The input frame rate of the encoder. + */ + int input_frame_rate; + /** + * The output frame rate of the encoder. + */ + int encode_frame_rate; + /** + * The rendering frame rate. + */ + int render_frame_rate; + /** + * The target bitrate (bps). + */ + int target_media_bitrate_bps; + /** + * The frame rate excluding FEC. + */ + int media_bitrate_bps; + /** + * The total frame rate including FEC. + */ + int total_bitrate_bps; // Include FEC + /** + * The capture frame width (pixel). + */ + int capture_width; + /** + * The capture frame height (pixel). + */ + int capture_height; + /** + * The regulated frame width (pixel) of capture frame width according to video encoder configuration. + */ + int regulated_capture_width; + /** + * The regulated frame height (pixel) of capture frame height according to video encoder configuration. + */ + int regulated_capture_height; + /** + * The frame width (pixel). + */ + int width; + /** + * The frame height (pixel). + */ + int height; + uint32_t encoder_type; + uint32_t hw_encoder_accelerating; + /** + * The average time diff between frame captured and framed encoded. + */ + uint32_t uplink_cost_time_ms; + /** Quality change of the local video in terms of target frame rate and + * target bit rate in this reported interval. See #QUALITY_ADAPT_INDICATION. + */ + QUALITY_ADAPT_INDICATION quality_adapt_indication; + /** + * The video packet loss rate (%) from the local client to the Agora edge server before applying the anti-packet loss strategies. + */ + unsigned short txPacketLossRate; + + /** The brightness level of the video image captured by the local camera. See #CAPTURE_BRIGHTNESS_LEVEL_TYPE. + */ + CAPTURE_BRIGHTNESS_LEVEL_TYPE capture_brightness_level; + + LocalVideoTrackStats() : number_of_streams(0), + bytes_major_stream(0), + bytes_minor_stream(0), + frames_encoded(0), + ssrc_major_stream(0), + ssrc_minor_stream(0), + capture_frame_rate(0), + regulated_capture_frame_rate(0), + input_frame_rate(0), + encode_frame_rate(0), + render_frame_rate(0), + target_media_bitrate_bps(0), + media_bitrate_bps(0), + total_bitrate_bps(0), + capture_width(0), + capture_height(0), + regulated_capture_width(0), + regulated_capture_height(0), + width(0), + height(0), + encoder_type(0), + uplink_cost_time_ms(0), + quality_adapt_indication(ADAPT_NONE), + txPacketLossRate(0), + capture_brightness_level(CAPTURE_BRIGHTNESS_LEVEL_INVALID) {} +}; + +/** + * `ILocalVideoTrack` is the basic class for local video tracks, providing the main methods of local video tracks. + * You can create a local video track by calling one of the following methods: + * - `createCameraVideoTrack` + * - `createScreenVideoTrack` + * - `createMixedVideoTrack` + * - `createCustomVideoTrack` + * - `createMediaPlayerVideoTrack` + * + * After creating local video tracks, you can publish one or more local video tracks by calling \ref agora::rtc::ILocalUser::publishVideo "publishVideo". + */ +class ILocalVideoTrack : public IVideoTrack { + public: + /** + * Enables or disables the local video track. + * + * Once the local video track is enabled, the SDK allows for local video capturing, processing, and encoding. + * + * @param enable Determines whether to enable the local video track. + * - `true`: Enable the local video track. + * - `false`: Disable the local video track. + */ + virtual void setEnabled(bool enable) = 0; + + /** + * Sets the video encoder configuration. + * + * Each video encoder configuration corresponds to a set of video parameters, including the + * resolution, frame rate, bitrate, and video orientation. + * + * The configurations specified in this method are the maximum values under ideal network conditions. If + * the video engine cannot render the video using the specified parameters due to poor network + * conditions, the configurations further down the list are considered until a successful configuration + * is found. + * + * @param config The reference to the video encoder configuration. See \ref agora::rtc::VideoEncoderConfiguration "VideoEncoderConfiguration". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setVideoEncoderConfiguration(const VideoEncoderConfiguration& config) = 0; + + /** + * Set simulcast stream mode, enable, disable or auto enable + * + * @param mode Determines simulcast stream mode. See \ref agora::rtc::SIMULCAST_STREAM_MODE "SIMULCAST_STREAM_MODE". + * @param config The reference to the configurations for the simulcast stream mode. See \ref agora::rtc::SimulcastStreamConfig "SimulcastStreamConfig". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setSimulcastStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& config) = 0; + + /** + * Gets the state of the local video stream. + * + * @return The current state of the local video stream. + */ + virtual LOCAL_VIDEO_STREAM_STATE getState() = 0; + + /** + * Gets the statistics of the local video track. + * + * @param[out] stats The reference to the statistics of the local video track. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getStatistics(LocalVideoTrackStats& stats) = 0; + + virtual VideoTrackType getType() OPTIONAL_OVERRIDE { return LOCAL_VIDEO_TRACK; } + + protected: + ~ILocalVideoTrack() {} +}; +/** + * The struct of RemoteVideoTrackStats. + */ +struct RemoteVideoTrackStats { + /** + The ID of the remote user. + */ + uid_t uid; + /** + * The overall delay (ms) of the video frames. + */ + int delay; + /** + * The width (pixel) of the remote video track. + */ + int width; + /** + * The height (pixel) of the remote video track. + */ + int height; + /** + * The bitrate (Kbps) received in the reported interval. + */ + int receivedBitrate; + /** The decoder output frame rate (fps) of the remote video track. + */ + int decoderOutputFrameRate; + /** The render output frame rate (fps) of the remote video track. + */ + int rendererOutputFrameRate; + /** The video frame loss rate (%) of the remote video stream in the reported interval. + */ + int frameLossRate; + /** The packet loss rate (%) of the remote video track after using the anti-packet-loss method. + */ + int packetLossRate; + /** + * The remote video stream type: #VIDEO_STREAM_TYPE. + */ + VIDEO_STREAM_TYPE rxStreamType; + /** + The total freeze time (ms) of the remote video track after the remote user joins the channel. + In a video session where the frame rate is set to no less than 5 fps, video freeze occurs when + the time interval between two adjacent renderable video frames is more than 500 ms. + */ + int totalFrozenTime; + /** + The total video freeze time as a percentage (%) of the total time when the video is available. + */ + int frozenRate; + /** + * The number of video bytes received. + */ + uint32_t received_bytes; + /** + The total number of decoded video frames. + */ + uint32_t totalDecodedFrames; + /** + The offset (ms) between audio and video stream. A positive value indicates the audio leads the + video, and a negative value indicates the audio lags the video. + */ + int avSyncTimeMs; + /** + The average offset(ms) between receive first packet which composite the frame and the frame + ready to render. + */ + uint32_t downlink_process_time_ms; + /** + The average time cost in renderer. + */ + uint32_t frame_render_delay_ms; + /** + The total time (ms) when the remote user neither stops sending the video + stream nor disables the video module after joining the channel. + */ + uint64_t totalActiveTime; + /** + The total publish duration (ms) of the remote video stream. + */ + uint64_t publishDuration; + /** + decoded frame vqa mos value after all filter. + */ + int vqa_mos; + /** + vqa avg cost ms + */ + int vqa_avg_cost_ms; + + RemoteVideoTrackStats() : uid(0), delay(0), width(0), height(0), + receivedBitrate(0), decoderOutputFrameRate(0), rendererOutputFrameRate(0), + frameLossRate(0), packetLossRate(0), rxStreamType(VIDEO_STREAM_HIGH), + totalFrozenTime(0), frozenRate(0), received_bytes(0), totalDecodedFrames(0), avSyncTimeMs(0), + downlink_process_time_ms(0), frame_render_delay_ms(0), totalActiveTime(0), + publishDuration(0), vqa_mos(0), vqa_avg_cost_ms(0) {} +}; + +/** + * The IRemoteVideoTrack class. + */ +class IRemoteVideoTrack : public IVideoTrack { + public: + /** + * Gets the statistics of the remote video track. + * @param[out] stats The reference to the statistics of the remote video track. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getStatistics(RemoteVideoTrackStats& stats) = 0; + /** + * Gets the state of the remote video track. + * @return The state of the remote video track. + */ + virtual REMOTE_VIDEO_STATE getState() = 0; + /** + * Gets the information of the remote video track. + * @param[out] info The reference to the information of the remote video track. + * @return + * - `true`: Success. + * - `false`: Failure. + */ + virtual bool getTrackInfo(VideoTrackInfo& info) = 0; + /** + * Registers an \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * + * You need to implement the `IVideoEncodedFrameObserver` class in this method. Once you successfully register + * the encoded image receiver, the SDK triggers the \ref agora::rtc::IVideoEncodedFrameObserver::onEncodedVideoFrameReceived "onEncodedVideoFrameReceived" callback when it receives the + * encoded video image. + * + * @param encodedObserver The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* encodedObserver) = 0; + /** + * Releases the \ref agora::media::IVideoEncodedFrameObserver "IVideoEncodedFrameObserver" object. + * @param encodedObserver The pointer to the `IVideoEncodedFrameObserver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* encodedObserver) = 0; + + /** + * Registers an \ref agora::rtc::IMediaPacketReceiver "IMediaPacketReceiver" object. + * + * You need to implement the `IMediaPacketReceiver` class in this method. Once you successfully register + * the media packet receiver, the SDK triggers the \ref agora::rtc::IMediaPacketReceiver::onMediaPacketReceived "onMediaPacketReceived" callback when it receives the + * video packet. + * + * @param videoReceiver The pointer to the `IMediaPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerMediaPacketReceiver(IMediaPacketReceiver* videoReceiver) = 0; + /** + * Releases the \ref agora::rtc::IMediaPacketReceiver "IMediaPacketReceiver" object. + * @param videoReceiver The pointer to the `IMediaPacketReceiver` object. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int unregisterMediaPacketReceiver(IMediaPacketReceiver* videoReceiver) = 0; + + virtual VideoTrackType getType() OPTIONAL_OVERRIDE { return REMOTE_VIDEO_TRACK; } + + protected: + ~IRemoteVideoTrack() {} +}; + +} // namespace rtc +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/time_utils.h b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/time_utils.h new file mode 100644 index 0000000..bb4759b --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Headers/time_utils.h @@ -0,0 +1,85 @@ +// +// Agora Media SDK +// +// Copyright (c) 2021 Agora IO. All rights reserved. +// + +#pragma once +#include + +namespace agora { +namespace base { + +class NtpTime { + public: + static const uint64_t ntpFracPerSecond = 4294967296; + + NtpTime() : ms_(0) {} + + NtpTime(uint64_t ms) : ms_(ms) {} + + NtpTime(uint32_t seconds, uint32_t fractions) { + const double fracMs = fractions * 1000.0 / static_cast(ntpFracPerSecond); + ms_ = static_cast(seconds) * 1000 + static_cast(0.5 + fracMs); + } + + operator uint64_t() const { return ms_; } + + /** Gets the NTP time. + * + * @return + * - The wallclock time which is in milliseconds relative to 0h UTC on 1 January 1900. + */ + uint64_t Ms() const { + return ms_; + } + + /** Check that whether the NtpTime object is valid + * + * - `true`: the NtpTime object is valid. + * - `false`: the NtpTime object is invalid. + */ + bool Valid() const { return ms_ != 0; } + + /** Gets the integer part of the NTP timestamp. + * + * @return + * - An uint32_t value. + */ + uint32_t ToSeconds() const { + return static_cast(ms_ / 1000); + } + + /** Gets the fractional part of the NTP timestamp. + * + * @return + * - An uint32_t value. + */ + uint32_t ToFractions() const { + return static_cast((ms_ % 1000) * static_cast(ntpFracPerSecond) / 1000.0); + } + + /** Gets the NTP timestamp. + * + * @note + * - The full resolution NTP timestamp is a 64-bit unsigned fixed-point number with the integer part in the first 32 bits and the fractional part in the last 32 bits. + * + * @return + * - An uint64_t value. + */ + uint64_t ToTimestamp() const { + return ToSeconds() * ntpFracPerSecond + ToFractions(); + } + + private: + uint64_t ms_; +}; + +inline bool operator==(const NtpTime& n1, const NtpTime& n2) { + return static_cast(n1) == static_cast(n2); +} + +inline bool operator!=(const NtpTime& n1, const NtpTime& n2) { return !(n1 == n2); } + +} // namespace base +} // namespace agora diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Info.plist b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Info.plist new file mode 100644 index 0000000..6d39ba1 Binary files /dev/null and b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Info.plist differ diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Modules/module.modulemap b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Modules/module.modulemap new file mode 100644 index 0000000..937fbd4 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/Modules/module.modulemap @@ -0,0 +1,16 @@ +framework module AgoraRtcKit { + header "AgoraRtcKit.h" + header "AgoraRtcEngineKit.h" + header "AgoraRtcEngineKitEx.h" + header "AgoraBaseDelegate.h" + header "AgoraRtcAudioSpectrumDelegate.h" + header "AgoraMediaFilterEventDelegate.h" + header "AgoraConstants.h" + header "AgoraEnumerates.h" + header "AgoraObjects.h" + header "AgoraRtcEngineDelegate2.h" + header "AgoraRtcMediaPlayerProtocol.h" + header "AgoraSpatialAudioKit.h" + header "AgoraMusicContentCenter.h" + export * +} diff --git a/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/PrivacyInfo.xcprivacy b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..88a9660 --- /dev/null +++ b/Sources/AgoraRtcKit.xcframework/ios-arm64_x86_64-simulator/AgoraRtcKit.framework/PrivacyInfo.xcprivacy @@ -0,0 +1,37 @@ + + + + + NSPrivacyTracking + + NSPrivacyCollectedDataTypes + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + DDA9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + + diff --git a/Sources/AgoraSoundTouch.xcframework/Info.plist b/Sources/AgoraSoundTouch.xcframework/Info.plist new file mode 100644 index 0000000..445f3ac --- /dev/null +++ b/Sources/AgoraSoundTouch.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraSoundTouch.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraSoundTouch.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraSoundTouch.xcframework/ios-arm64_armv7/AgoraSoundTouch.framework/AgoraSoundTouch b/Sources/AgoraSoundTouch.xcframework/ios-arm64_armv7/AgoraSoundTouch.framework/AgoraSoundTouch new file mode 100755 index 0000000..7d1f822 Binary files /dev/null and b/Sources/AgoraSoundTouch.xcframework/ios-arm64_armv7/AgoraSoundTouch.framework/AgoraSoundTouch differ diff --git a/Sources/AgoraSoundTouch.xcframework/ios-arm64_armv7/AgoraSoundTouch.framework/Info.plist b/Sources/AgoraSoundTouch.xcframework/ios-arm64_armv7/AgoraSoundTouch.framework/Info.plist new file mode 100644 index 0000000..ae61260 Binary files /dev/null and b/Sources/AgoraSoundTouch.xcframework/ios-arm64_armv7/AgoraSoundTouch.framework/Info.plist differ diff --git a/Sources/AgoraSoundTouch.xcframework/ios-arm64_x86_64-simulator/AgoraSoundTouch.framework/AgoraSoundTouch b/Sources/AgoraSoundTouch.xcframework/ios-arm64_x86_64-simulator/AgoraSoundTouch.framework/AgoraSoundTouch new file mode 100755 index 0000000..484d943 Binary files /dev/null and b/Sources/AgoraSoundTouch.xcframework/ios-arm64_x86_64-simulator/AgoraSoundTouch.framework/AgoraSoundTouch differ diff --git a/Sources/AgoraSoundTouch.xcframework/ios-arm64_x86_64-simulator/AgoraSoundTouch.framework/Info.plist b/Sources/AgoraSoundTouch.xcframework/ios-arm64_x86_64-simulator/AgoraSoundTouch.framework/Info.plist new file mode 100644 index 0000000..ae61260 Binary files /dev/null and b/Sources/AgoraSoundTouch.xcframework/ios-arm64_x86_64-simulator/AgoraSoundTouch.framework/Info.plist differ diff --git a/Sources/AgoraSpatialAudioExtension.xcframework/Info.plist b/Sources/AgoraSpatialAudioExtension.xcframework/Info.plist new file mode 100644 index 0000000..51b51d4 --- /dev/null +++ b/Sources/AgoraSpatialAudioExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraSpatialAudioExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraSpatialAudioExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_armv7/AgoraSpatialAudioExtension.framework/AgoraSpatialAudioExtension b/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_armv7/AgoraSpatialAudioExtension.framework/AgoraSpatialAudioExtension new file mode 100755 index 0000000..4aa1836 Binary files /dev/null and b/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_armv7/AgoraSpatialAudioExtension.framework/AgoraSpatialAudioExtension differ diff --git a/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_armv7/AgoraSpatialAudioExtension.framework/Info.plist b/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_armv7/AgoraSpatialAudioExtension.framework/Info.plist new file mode 100644 index 0000000..4c83e10 Binary files /dev/null and b/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_armv7/AgoraSpatialAudioExtension.framework/Info.plist differ diff --git a/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_x86_64-simulator/AgoraSpatialAudioExtension.framework/AgoraSpatialAudioExtension b/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_x86_64-simulator/AgoraSpatialAudioExtension.framework/AgoraSpatialAudioExtension new file mode 100755 index 0000000..ef1a450 Binary files /dev/null and b/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_x86_64-simulator/AgoraSpatialAudioExtension.framework/AgoraSpatialAudioExtension differ diff --git a/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_x86_64-simulator/AgoraSpatialAudioExtension.framework/Info.plist b/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_x86_64-simulator/AgoraSpatialAudioExtension.framework/Info.plist new file mode 100644 index 0000000..4c83e10 Binary files /dev/null and b/Sources/AgoraSpatialAudioExtension.xcframework/ios-arm64_x86_64-simulator/AgoraSpatialAudioExtension.framework/Info.plist differ diff --git a/Sources/AgoraVideoDecoderExtension.xcframework/Info.plist b/Sources/AgoraVideoDecoderExtension.xcframework/Info.plist new file mode 100644 index 0000000..dab8a9d --- /dev/null +++ b/Sources/AgoraVideoDecoderExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraVideoDecoderExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraVideoDecoderExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_armv7/AgoraVideoDecoderExtension.framework/AgoraVideoDecoderExtension b/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_armv7/AgoraVideoDecoderExtension.framework/AgoraVideoDecoderExtension new file mode 100755 index 0000000..e44a31f Binary files /dev/null and b/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_armv7/AgoraVideoDecoderExtension.framework/AgoraVideoDecoderExtension differ diff --git a/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_armv7/AgoraVideoDecoderExtension.framework/Info.plist b/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_armv7/AgoraVideoDecoderExtension.framework/Info.plist new file mode 100644 index 0000000..4a2f94d Binary files /dev/null and b/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_armv7/AgoraVideoDecoderExtension.framework/Info.plist differ diff --git a/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoDecoderExtension.framework/AgoraVideoDecoderExtension b/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoDecoderExtension.framework/AgoraVideoDecoderExtension new file mode 100755 index 0000000..b8bf77b Binary files /dev/null and b/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoDecoderExtension.framework/AgoraVideoDecoderExtension differ diff --git a/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoDecoderExtension.framework/Info.plist b/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoDecoderExtension.framework/Info.plist new file mode 100644 index 0000000..4a2f94d Binary files /dev/null and b/Sources/AgoraVideoDecoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoDecoderExtension.framework/Info.plist differ diff --git a/Sources/AgoraVideoEncoderExtension.xcframework/Info.plist b/Sources/AgoraVideoEncoderExtension.xcframework/Info.plist new file mode 100644 index 0000000..fdf7c3a --- /dev/null +++ b/Sources/AgoraVideoEncoderExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraVideoEncoderExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraVideoEncoderExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_armv7/AgoraVideoEncoderExtension.framework/AgoraVideoEncoderExtension b/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_armv7/AgoraVideoEncoderExtension.framework/AgoraVideoEncoderExtension new file mode 100755 index 0000000..aed22bf Binary files /dev/null and b/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_armv7/AgoraVideoEncoderExtension.framework/AgoraVideoEncoderExtension differ diff --git a/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_armv7/AgoraVideoEncoderExtension.framework/Info.plist b/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_armv7/AgoraVideoEncoderExtension.framework/Info.plist new file mode 100644 index 0000000..96849c4 Binary files /dev/null and b/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_armv7/AgoraVideoEncoderExtension.framework/Info.plist differ diff --git a/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoEncoderExtension.framework/AgoraVideoEncoderExtension b/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoEncoderExtension.framework/AgoraVideoEncoderExtension new file mode 100755 index 0000000..4062415 Binary files /dev/null and b/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoEncoderExtension.framework/AgoraVideoEncoderExtension differ diff --git a/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoEncoderExtension.framework/Info.plist b/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoEncoderExtension.framework/Info.plist new file mode 100644 index 0000000..96849c4 Binary files /dev/null and b/Sources/AgoraVideoEncoderExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoEncoderExtension.framework/Info.plist differ diff --git a/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/Info.plist b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/Info.plist new file mode 100644 index 0000000..84404ae --- /dev/null +++ b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraVideoQualityAnalyzerExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraVideoQualityAnalyzerExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_armv7/AgoraVideoQualityAnalyzerExtension.framework/AgoraVideoQualityAnalyzerExtension b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_armv7/AgoraVideoQualityAnalyzerExtension.framework/AgoraVideoQualityAnalyzerExtension new file mode 100755 index 0000000..d062a77 Binary files /dev/null and b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_armv7/AgoraVideoQualityAnalyzerExtension.framework/AgoraVideoQualityAnalyzerExtension differ diff --git a/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_armv7/AgoraVideoQualityAnalyzerExtension.framework/Info.plist b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_armv7/AgoraVideoQualityAnalyzerExtension.framework/Info.plist new file mode 100644 index 0000000..7b4cedc Binary files /dev/null and b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_armv7/AgoraVideoQualityAnalyzerExtension.framework/Info.plist differ diff --git a/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoQualityAnalyzerExtension.framework/AgoraVideoQualityAnalyzerExtension b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoQualityAnalyzerExtension.framework/AgoraVideoQualityAnalyzerExtension new file mode 100755 index 0000000..e38d623 Binary files /dev/null and b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoQualityAnalyzerExtension.framework/AgoraVideoQualityAnalyzerExtension differ diff --git a/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoQualityAnalyzerExtension.framework/Info.plist b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoQualityAnalyzerExtension.framework/Info.plist new file mode 100644 index 0000000..7b4cedc Binary files /dev/null and b/Sources/AgoraVideoQualityAnalyzerExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoQualityAnalyzerExtension.framework/Info.plist differ diff --git a/Sources/AgoraVideoSegmentationExtension.xcframework/Info.plist b/Sources/AgoraVideoSegmentationExtension.xcframework/Info.plist new file mode 100644 index 0000000..b0c93fb --- /dev/null +++ b/Sources/AgoraVideoSegmentationExtension.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + AgoraVideoSegmentationExtension.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + AgoraVideoSegmentationExtension.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_armv7/AgoraVideoSegmentationExtension.framework/AgoraVideoSegmentationExtension b/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_armv7/AgoraVideoSegmentationExtension.framework/AgoraVideoSegmentationExtension new file mode 100755 index 0000000..af4960f Binary files /dev/null and b/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_armv7/AgoraVideoSegmentationExtension.framework/AgoraVideoSegmentationExtension differ diff --git a/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_armv7/AgoraVideoSegmentationExtension.framework/Info.plist b/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_armv7/AgoraVideoSegmentationExtension.framework/Info.plist new file mode 100644 index 0000000..4b728ad Binary files /dev/null and b/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_armv7/AgoraVideoSegmentationExtension.framework/Info.plist differ diff --git a/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoSegmentationExtension.framework/AgoraVideoSegmentationExtension b/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoSegmentationExtension.framework/AgoraVideoSegmentationExtension new file mode 100755 index 0000000..2185b65 Binary files /dev/null and b/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoSegmentationExtension.framework/AgoraVideoSegmentationExtension differ diff --git a/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoSegmentationExtension.framework/Info.plist b/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoSegmentationExtension.framework/Info.plist new file mode 100644 index 0000000..4b728ad Binary files /dev/null and b/Sources/AgoraVideoSegmentationExtension.xcframework/ios-arm64_x86_64-simulator/AgoraVideoSegmentationExtension.framework/Info.plist differ diff --git a/Sources/Agorafdkaac.xcframework/Info.plist b/Sources/Agorafdkaac.xcframework/Info.plist new file mode 100644 index 0000000..e4843ae --- /dev/null +++ b/Sources/Agorafdkaac.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + Agorafdkaac.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + Agorafdkaac.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/Agorafdkaac.xcframework/ios-arm64_armv7/Agorafdkaac.framework/Agorafdkaac b/Sources/Agorafdkaac.xcframework/ios-arm64_armv7/Agorafdkaac.framework/Agorafdkaac new file mode 100755 index 0000000..13cacc7 Binary files /dev/null and b/Sources/Agorafdkaac.xcframework/ios-arm64_armv7/Agorafdkaac.framework/Agorafdkaac differ diff --git a/Sources/Agorafdkaac.xcframework/ios-arm64_armv7/Agorafdkaac.framework/Info.plist b/Sources/Agorafdkaac.xcframework/ios-arm64_armv7/Agorafdkaac.framework/Info.plist new file mode 100644 index 0000000..46d2a43 Binary files /dev/null and b/Sources/Agorafdkaac.xcframework/ios-arm64_armv7/Agorafdkaac.framework/Info.plist differ diff --git a/Sources/Agorafdkaac.xcframework/ios-arm64_x86_64-simulator/Agorafdkaac.framework/Agorafdkaac b/Sources/Agorafdkaac.xcframework/ios-arm64_x86_64-simulator/Agorafdkaac.framework/Agorafdkaac new file mode 100755 index 0000000..cfc243a Binary files /dev/null and b/Sources/Agorafdkaac.xcframework/ios-arm64_x86_64-simulator/Agorafdkaac.framework/Agorafdkaac differ diff --git a/Sources/Agorafdkaac.xcframework/ios-arm64_x86_64-simulator/Agorafdkaac.framework/Info.plist b/Sources/Agorafdkaac.xcframework/ios-arm64_x86_64-simulator/Agorafdkaac.framework/Info.plist new file mode 100644 index 0000000..46d2a43 Binary files /dev/null and b/Sources/Agorafdkaac.xcframework/ios-arm64_x86_64-simulator/Agorafdkaac.framework/Info.plist differ diff --git a/Sources/Agoraffmpeg.xcframework/Info.plist b/Sources/Agoraffmpeg.xcframework/Info.plist new file mode 100644 index 0000000..0435547 --- /dev/null +++ b/Sources/Agoraffmpeg.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + Agoraffmpeg.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + Agoraffmpeg.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/Agoraffmpeg.xcframework/ios-arm64_armv7/Agoraffmpeg.framework/Agoraffmpeg b/Sources/Agoraffmpeg.xcframework/ios-arm64_armv7/Agoraffmpeg.framework/Agoraffmpeg new file mode 100755 index 0000000..cef9e53 Binary files /dev/null and b/Sources/Agoraffmpeg.xcframework/ios-arm64_armv7/Agoraffmpeg.framework/Agoraffmpeg differ diff --git a/Sources/Agoraffmpeg.xcframework/ios-arm64_armv7/Agoraffmpeg.framework/Info.plist b/Sources/Agoraffmpeg.xcframework/ios-arm64_armv7/Agoraffmpeg.framework/Info.plist new file mode 100644 index 0000000..b638c6c Binary files /dev/null and b/Sources/Agoraffmpeg.xcframework/ios-arm64_armv7/Agoraffmpeg.framework/Info.plist differ diff --git a/Sources/Agoraffmpeg.xcframework/ios-arm64_x86_64-simulator/Agoraffmpeg.framework/Agoraffmpeg b/Sources/Agoraffmpeg.xcframework/ios-arm64_x86_64-simulator/Agoraffmpeg.framework/Agoraffmpeg new file mode 100755 index 0000000..7049f5f Binary files /dev/null and b/Sources/Agoraffmpeg.xcframework/ios-arm64_x86_64-simulator/Agoraffmpeg.framework/Agoraffmpeg differ diff --git a/Sources/Agoraffmpeg.xcframework/ios-arm64_x86_64-simulator/Agoraffmpeg.framework/Info.plist b/Sources/Agoraffmpeg.xcframework/ios-arm64_x86_64-simulator/Agoraffmpeg.framework/Info.plist new file mode 100644 index 0000000..b638c6c Binary files /dev/null and b/Sources/Agoraffmpeg.xcframework/ios-arm64_x86_64-simulator/Agoraffmpeg.framework/Info.plist differ diff --git a/Sources/video_dec.xcframework/Info.plist b/Sources/video_dec.xcframework/Info.plist new file mode 100644 index 0000000..c090d40 --- /dev/null +++ b/Sources/video_dec.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + video_dec.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + video_dec.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Headers/wz265dec.h b/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Headers/wz265dec.h new file mode 100644 index 0000000..e9b43db --- /dev/null +++ b/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Headers/wz265dec.h @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////// +// +// visionular H265 Codec Library +// +// Copyright(c) visionular Inc. +// https://www.visionular.com/ +// +/////////////////////////////////////////////////// +#ifndef _WZ265_DECODER_INTERFACE_H_ +#define _WZ265_DECODER_INTERFACE_H_ + +#include "wz265def.h" + +// config parameters for Decoder +typedef struct WZ265DecConfig { + void *pAuth; // WZAuth, invalid if don't need aksk auth + int threads; // number of threads used in decoding (0: auto) + int disableFPP; // whether disable frame parallel, default 0; 1 indicates synchronization for + // RTC case + // default 0: FPP start from the very start: first frame. + // > 0: FPP will start with a delay of frames + int fppStartFrame; + int parallelledFrames; // default 0: auto + int bEnableOutputRecToFile; // For debug: write reconstruct YUV to File + char *strRecYuvFileName; // For debug: file name of YUV + // when bEnableOutputRecToFile = 1 + int bEnableDumpBsToFile; // For debug: write input bs to File + char *strDumpBsFileName; // for debug: file name of bs + int logLevel; // For debug: log level + int calcMD5; // For debug: calculate md5. 0, disabled;1.plane seperated; 2. yuv whole + int checkMD5Sei; // For debug: check md5 with md5 in sei + int parseOnly; +} WZ265DecConfig; + +// information of decoded frame +typedef struct WZ265FrameInfo { + int nWidth; // frame width + int nHeight; // frame height + int chroma_format_idc; // 0: Monochrome 1: 420 2: 422 3: 444 + int bitDepth; // 8 or 10 + long long pts; // time stamp + int poc; +} WZ265FrameInfo; + +// decoded frame with data and information +typedef struct WZ265Frame { + int bValid; // if == 0, no more valid output frame + unsigned char *pData[3]; // Y U V + short iStride[3]; // stride for each component + WZ265FrameInfo frameinfo; + double fAvgQp; +} WZ265Frame; + +#if defined(__cplusplus) +extern "C" { +#endif //__cplusplus + +/************************************************************************************ + * I/F for all usrs + ************************************************************************************/ +// create decoder, return handle of decoder +_h_dll_export void *wz265_decoder_create(WZ265DecConfig *pDecConfig, int *pStat); +// destroy decoder with specific handle +_h_dll_export void wz265_decoder_destroy(void *pDecoder); +// set config to specific decoder +_h_dll_export void wz265_decoder_config(void *pDecoder, WZ265DecConfig *pDecConfig, int *pStat); +// the input of this function should be one or more NALs; +// if only one wz265NAL, with or without start bytes are both OK +_h_dll_export void wz265_decode_frame(void *pDecoder, const unsigned char *pData, int iLen, + int *pStat, const long long pts); +// bSkip = WZ_FALSE : same as wz265_decode_frame +// bSkip = WZ_TRUE : only decode slice headers in pData, slice data skipped +_h_dll_export void wz265_decode_frame_skip(void *pDecoder, const unsigned char *pData, int iLen, + int *pStat, const long long pts, int bSkip); +// flush decoding, called at end +_h_dll_export void wz265_decode_flush(void *pDecoder, int bClearCachedPics, int *pStat); +// retrieve the output, the function are used for synchronized output, this function need to call +// several time until get NULL +_h_dll_export void wz265_decoder_get_frame(void *pDecoder, WZ265Frame *pFrame, int *pStat); +// return the frame buffer which WZ265DecoderGetOutput get from decoder, each valid +// WZ265DecoderGetOutput should match with a ReturnFrame +_h_dll_export void wz265_decoder_return_frame(void *pDecoder, WZ265Frame *pFrame); + +/** + * dump latest decoded VUI parameters + * @param pDecoder : decoder instance + * @param vui : fill with decoded vui parameters + * @param bValid : =0 if no valid vui parameters decoded, + * otherwise =1 + */ +_h_dll_export void wz265_dump_vui_parameters(void *pDecoder, vui_parameters *vui, int *bValid); + +#if defined(__cplusplus) +} +#endif //__cplusplus + +#endif // header diff --git a/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Headers/wz265def.h b/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Headers/wz265def.h new file mode 100644 index 0000000..de6d67f --- /dev/null +++ b/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Headers/wz265def.h @@ -0,0 +1,311 @@ +#ifndef _WZ265_DEF_H_ +#define _WZ265_DEF_H_ + +// **************************************** +// error code +// error code < 0, means fatal error +// error code > 0, means warning or event +// **************************************** +enum { + WZ_OK = (0x00000000), // Success codes + WZ_FAIL = (0x80000001), // Unspecified error + WZ_OUTOFMEMORY = (0x80000002), // Out of memory + WZ_POINTER = (0x80000004), // Invalid pointer + WZ_NOTSUPPORTED = (0x80000008), // NOT support feature encountered + WZ_AUTH_INVALID = (0x80000010), // Authentication invalid + WZ_AUTH_FAIL_APP_ID = (0x80000011), // Auth failed use app id + WZ_AUTH_FAIL_EXPIRE_TIME = (0x80000012), // Auth failed use expire time + WZ_AUTH_FAIL_MTOOL = (0x80000014), // Auth failed use mtool + WZ265_PARAM_BAD_NAME = (0x80000018), // Bad name pass to WZ265ConfigParse + WZ265_PARAM_BAD_VALUE = (0x80000020), // Bad value pass to WZ265ConfigParse + + WZ_SEARCHING_ACCESS_POINT = (0x00010000), // In process of searching first access point + WZ_REF_PIC_NOT_FOUND = (0x00020000), // Reference picture not found, can be ignored + WZ_NEED_MORE_DATA = (0x00040000), // need push more data + WZ_BITSTREAM_ERROR = (0x00080000), // detecting bit stream error, can be ignored + WZ_SKIPPING_LP_PIC = (0x00100000), // leading pic skipped, can be ignored + WZ_SKIPPING_PIC = (0x00110000), // skippable picture skipped, can be ignored + WZ_CTU_REENCODE = (0x81000000), // CTU re-encode +}; + +typedef enum NAL_UNIT_TYPE { + NAL_UNIT_TYPE_TRAIL_N = 0, + NAL_UNIT_TYPE_TRAIL_R = 1, + + NAL_UNIT_TYPE_TSA_N = 2, + NAL_UNIT_TYPE_TSA_R = 3, + + NAL_UNIT_TYPE_STSA_N = 4, + NAL_UNIT_TYPE_STSA_R = 5, + + NAL_UNIT_TYPE_RADL_N = 6, + NAL_UNIT_TYPE_RADL_R = 7, + + NAL_UNIT_TYPE_RASL_N = 8, + NAL_UNIT_TYPE_RASL_R = 9, + + // reserved + NAL_UNIT_TYPE_RSV_VCL_N10 = 10, + NAL_UNIT_TYPE_RSV_VCL_N12 = 12, + NAL_UNIT_TYPE_RSV_VCL_N14 = 13, + NAL_UNIT_TYPE_RSV_VCL_R11 = 11, + NAL_UNIT_TYPE_RSV_VCL_R13 = 13, + NAL_UNIT_TYPE_RSV_VCL_R15 = 15, + + NAL_UNIT_TYPE_BLA_W_LP = 16, + NAL_UNIT_TYPE_BLA_W_RADL = 17, + NAL_UNIT_TYPE_BLA_N_LP = 18, + + NAL_UNIT_TYPE_IDR_W_RADL = 19, + NAL_UNIT_TYPE_IDR_N_LP = 20, + + NAL_UNIT_TYPE_CRA_NUT = 21, + + NAL_UNIT_TYPE_RSV_IRAP_VCL22 = 22, + NAL_UNIT_TYPE_RSV_IRAP_VCL23 = 23, + + NAL_UNIT_TYPE_RSV_VCL24 = 24, + NAL_UNIT_TYPE_RSV_VCL25 = 25, + NAL_UNIT_TYPE_RSV_VCL26 = 26, + NAL_UNIT_TYPE_RSV_VCL27 = 27, + NAL_UNIT_TYPE_RSV_VCL28 = 28, + NAL_UNIT_TYPE_RSV_VCL29 = 29, + NAL_UNIT_TYPE_RSV_VCL30 = 30, + NAL_UNIT_TYPE_RSV_VCL31 = 31, + + NAL_UNIT_TYPE_VPS_NUT = 32, + NAL_UNIT_TYPE_SPS_NUT = 33, + NAL_UNIT_TYPE_PPS_NUT = 34, + NAL_UNIT_TYPE_AUD_NUT = 35, + NAL_UNIT_TYPE_EOS_NUT = 36, + NAL_UNIT_TYPE_EOB_NUT = 37, + NAL_UNIT_TYPE_FD_NUT = 38, + + NAL_UNIT_TYPE_PREFIX_SEI_NUT = 39, + NAL_UNIT_TYPE_SUFFIX_SEI_NUT = 40, + + NAL_UNIT_TYPE_RSV_NVCL41 = 41, + NAL_UNIT_TYPE_RSV_NVCL42 = 42, + NAL_UNIT_TYPE_RSV_NVCL43 = 43, + NAL_UNIT_TYPE_RSV_NVCL44 = 44, + NAL_UNIT_TYPE_RSV_NVCL45 = 45, + NAL_UNIT_TYPE_RSV_NVCL46 = 46, + NAL_UNIT_TYPE_RSV_NVCL47 = 47, + + NAL_UNIT_TYPE_UNSPEC48 = 48, + NAL_UNIT_TYPE_UNSPEC49 = 49, + NAL_UNIT_TYPE_UNSPEC50 = 50, + NAL_UNIT_TYPE_UNSPEC51 = 51, + NAL_UNIT_TYPE_UNSPEC52 = 52, + NAL_UNIT_TYPE_UNSPEC53 = 53, + NAL_UNIT_TYPE_UNSPEC54 = 54, + NAL_UNIT_TYPE_UNSPEC55 = 55, + NAL_UNIT_TYPE_UNSPEC56 = 56, + NAL_UNIT_TYPE_UNSPEC57 = 57, + NAL_UNIT_TYPE_UNSPEC58 = 58, + NAL_UNIT_TYPE_UNSPEC59 = 59, + NAL_UNIT_TYPE_UNSPEC60 = 60, + NAL_UNIT_TYPE_UNSPEC61 = 61, + NAL_UNIT_TYPE_UNSPEC62 = 62, + NAL_UNIT_TYPE_UNSPEC63 = 63, +} NAL_UNIT_TYPE; + +typedef enum SEI_PAYLOAD_TYPE { + BUFFERING_PERIOD = 0, + PICTURE_TIMING = 1, + PAN_SCAN_RECT = 2, + FILLER_PAYLOAD = 3, + USER_DATA_REGISTERED_ITU_T_T35 = 4, + USER_DATA_UNREGISTERED = 5, + RECOVERY_POINT = 6, + SCENE_INFO = 9, + FULL_FRAME_SNAPSHOT = 15, + PROGRESSIVE_REFINEMENT_SEGMENT_START = 16, + PROGRESSIVE_REFINEMENT_SEGMENT_END = 17, + FILM_GRAIN_CHARACTERISTICS = 19, + POST_FILTER_HINT = 22, + TONE_MAPPING_INFO = 23, + FRAME_PACKING = 45, + DISPLAY_ORIENTATION = 47, + SOP_DESCRIPTION = 128, + ACTIVE_PARAMETER_SETS = 129, + DECODING_UNIT_INFO = 130, + TEMPORAL_LEVEL0_INDEX = 131, + DECODED_PICTURE_HASH = 132, + SCALABLE_NESTING = 133, + REGION_REFRESH_INFO = 134, + MASTERING_DISPLAY_INFO = 137, + CONTENT_LIGHT_LEVEL_INFO = 144, + ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147, + AMBIENT_VIEWING_ENVIRONMENT = 148, +} SEIPayloadType; + +typedef struct WZ265SEIPayload { + int payloadSize; // actual bytes in payload + int payloadBufferSize; // bytes malloc for payload + SEIPayloadType payloadType; + unsigned char *payload; +} WZ265SEIPayload; + +typedef struct WZ265SEI { + int numPayloads; // number of payloads has valid data + WZ265SEIPayload *payloads; +} WZ265SEI; + +// dobly vision rpu +typedef struct WZ265DoviRpu { + int payloadSize; + unsigned char *payloads; +} WZ265DoviRpu; + +// **************************************** +// HRD +// **************************************** +typedef struct hrd_parameters { + int bit_rate_scale; + int cpb_size_scale; + int initial_cpb_removal_delay_length; + int cpb_removal_delay_length; + int dpb_output_delay_length; + int bit_rate_value; + int cpb_size_value; + int cbr_flag; +} hrd_parameters; + +// **************************************** +// VUI +// **************************************** +typedef struct vui_parameters { + // --- sample aspect ratio (SAR) --- + unsigned char aspect_ratio_info_present_flag; + unsigned char aspect_ratio_idc; + unsigned short sar_width; // sar_width and sar_height are zero if unspecified + unsigned short sar_height; + + // --- overscan --- + unsigned char overscan_info_present_flag; + unsigned char overscan_appropriate_flag; + + // --- video signal type --- + unsigned char video_signal_type_present_flag; + unsigned char video_format; + unsigned char video_full_range_flag; + unsigned char colour_description_present_flag; + unsigned char colour_primaries; + unsigned char transfer_characteristics; + unsigned char matrix_coeffs; + + // --- chroma / interlaced --- + unsigned char chroma_loc_info_present_flag; + unsigned char chroma_sample_loc_type_top_field; + unsigned char chroma_sample_loc_type_bottom_field; + unsigned char neutral_chroma_indication_flag; + unsigned char field_seq_flag; + unsigned char frame_field_info_present_flag; + + // --- default display window --- + unsigned char default_display_window_flag; + unsigned int def_disp_win_left_offset; + unsigned int def_disp_win_right_offset; + unsigned int def_disp_win_top_offset; + unsigned int def_disp_win_bottom_offset; + + // --- timing --- + unsigned char vui_timing_info_present_flag; + unsigned int vui_num_units_in_tick; + unsigned int vui_time_scale; + + unsigned char vui_poc_proportional_to_timing_flag; + unsigned int vui_num_ticks_poc_diff_one; + + // --- hrd parameters --- + unsigned char vui_hrd_parameters_present_flag; + hrd_parameters vui_hrd_parameters; + + // --- bitstream restriction --- + unsigned char bitstream_restriction_flag; + unsigned char tiles_fixed_structure_flag; + unsigned char motion_vectors_over_pic_boundaries_flag; + unsigned char restricted_ref_pic_lists_flag; + unsigned short min_spatial_segmentation_idc; + unsigned char max_bytes_per_pic_denom; + unsigned char max_bits_per_mincu_denom; + unsigned char log2_max_mv_length_horizontal; + unsigned char log2_max_mv_length_vertical; +} vui_parameters; + +typedef struct mastering_display_colour_volume_sei { + unsigned short display_primaries_x[3]; + unsigned short display_primaries_y[3]; + unsigned short white_point_x; + unsigned short white_point_y; + unsigned int max_display_mastering_luminance; + unsigned int min_display_mastering_luminance; +} mastering_display_colour_volume_sei; + +typedef struct content_light_level_info_sei { + unsigned short max_content_light_level; + unsigned short max_pic_average_light_level; +} content_light_level_info_sei; + +// ambient viewing environment SEI +typedef struct ambient_viewing_environment_sei { + unsigned int ambient_illuminance; + unsigned int ambient_light_x; + unsigned int ambient_light_y; +} ambient_viewing_environment_sei; + +typedef struct buffering_period_sei { + unsigned int m_cpbDelayOffset; + unsigned int m_dpbDelayOffset; + unsigned int m_concatenationFlag; + unsigned int m_initialCpbRemovalDelay; + unsigned int m_initialCpbRemovalDelayOffset; + unsigned int m_auCpbRemovalDelayDelta; +} buffering_period_sei; + +typedef struct picture_timing_sei { + unsigned int m_picStruct; + unsigned int m_sourceScanType; + unsigned int m_duplicateFlag; + unsigned int m_auCpbRemovalDelay; + unsigned int m_picDpbOutputDelay; +} picture_timing_sei; + +#ifdef WIN32 +#define _h_dll_export __declspec(dllexport) +#else // for GCC +#define _h_dll_export __attribute__((visibility("default"))) +#endif + +typedef void (*WZAuthWarning)(void); +typedef void (*WZLogPrintf)(const char *msg); + +#if defined(__cplusplus) +extern "C" { +#endif //__cplusplus + +// @OBFUSAPI@ + +// log output callback function pointer +// if pFuncCB == NULL, use the default printf +_h_dll_export void wz265_set_log_printf(WZLogPrintf pFuncCB); + +// auth trouble warning callback function pointer +_h_dll_export void wz265_set_auth_warning(WZAuthWarning pFuncCB); + +// auth info +// return auth_ok means auth ok, otherwize means auth fail +_h_dll_export int wz265_get_auth_info(void); + +// libwz265 version number string +_h_dll_export extern const char strLibWZ265Version[]; + +// Get libwz265 version string +_h_dll_export const char *wz265_version_str(void); + +#if defined(__cplusplus) +} +#endif //__cplusplus + +#endif diff --git a/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Info.plist b/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Info.plist new file mode 100644 index 0000000..2abd0ff --- /dev/null +++ b/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + video_dec + CFBundleIdentifier + com.videodec + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + video_dec + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.3.82 + CFBundleVersion + 1.3.82 + MinimumOSVersion + 9.0 + + diff --git a/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/video_dec b/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/video_dec new file mode 100644 index 0000000..82237d8 Binary files /dev/null and b/Sources/video_dec.xcframework/ios-arm64_armv7/video_dec.framework/video_dec differ diff --git a/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Headers/wz265dec.h b/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Headers/wz265dec.h new file mode 100644 index 0000000..e9b43db --- /dev/null +++ b/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Headers/wz265dec.h @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////// +// +// visionular H265 Codec Library +// +// Copyright(c) visionular Inc. +// https://www.visionular.com/ +// +/////////////////////////////////////////////////// +#ifndef _WZ265_DECODER_INTERFACE_H_ +#define _WZ265_DECODER_INTERFACE_H_ + +#include "wz265def.h" + +// config parameters for Decoder +typedef struct WZ265DecConfig { + void *pAuth; // WZAuth, invalid if don't need aksk auth + int threads; // number of threads used in decoding (0: auto) + int disableFPP; // whether disable frame parallel, default 0; 1 indicates synchronization for + // RTC case + // default 0: FPP start from the very start: first frame. + // > 0: FPP will start with a delay of frames + int fppStartFrame; + int parallelledFrames; // default 0: auto + int bEnableOutputRecToFile; // For debug: write reconstruct YUV to File + char *strRecYuvFileName; // For debug: file name of YUV + // when bEnableOutputRecToFile = 1 + int bEnableDumpBsToFile; // For debug: write input bs to File + char *strDumpBsFileName; // for debug: file name of bs + int logLevel; // For debug: log level + int calcMD5; // For debug: calculate md5. 0, disabled;1.plane seperated; 2. yuv whole + int checkMD5Sei; // For debug: check md5 with md5 in sei + int parseOnly; +} WZ265DecConfig; + +// information of decoded frame +typedef struct WZ265FrameInfo { + int nWidth; // frame width + int nHeight; // frame height + int chroma_format_idc; // 0: Monochrome 1: 420 2: 422 3: 444 + int bitDepth; // 8 or 10 + long long pts; // time stamp + int poc; +} WZ265FrameInfo; + +// decoded frame with data and information +typedef struct WZ265Frame { + int bValid; // if == 0, no more valid output frame + unsigned char *pData[3]; // Y U V + short iStride[3]; // stride for each component + WZ265FrameInfo frameinfo; + double fAvgQp; +} WZ265Frame; + +#if defined(__cplusplus) +extern "C" { +#endif //__cplusplus + +/************************************************************************************ + * I/F for all usrs + ************************************************************************************/ +// create decoder, return handle of decoder +_h_dll_export void *wz265_decoder_create(WZ265DecConfig *pDecConfig, int *pStat); +// destroy decoder with specific handle +_h_dll_export void wz265_decoder_destroy(void *pDecoder); +// set config to specific decoder +_h_dll_export void wz265_decoder_config(void *pDecoder, WZ265DecConfig *pDecConfig, int *pStat); +// the input of this function should be one or more NALs; +// if only one wz265NAL, with or without start bytes are both OK +_h_dll_export void wz265_decode_frame(void *pDecoder, const unsigned char *pData, int iLen, + int *pStat, const long long pts); +// bSkip = WZ_FALSE : same as wz265_decode_frame +// bSkip = WZ_TRUE : only decode slice headers in pData, slice data skipped +_h_dll_export void wz265_decode_frame_skip(void *pDecoder, const unsigned char *pData, int iLen, + int *pStat, const long long pts, int bSkip); +// flush decoding, called at end +_h_dll_export void wz265_decode_flush(void *pDecoder, int bClearCachedPics, int *pStat); +// retrieve the output, the function are used for synchronized output, this function need to call +// several time until get NULL +_h_dll_export void wz265_decoder_get_frame(void *pDecoder, WZ265Frame *pFrame, int *pStat); +// return the frame buffer which WZ265DecoderGetOutput get from decoder, each valid +// WZ265DecoderGetOutput should match with a ReturnFrame +_h_dll_export void wz265_decoder_return_frame(void *pDecoder, WZ265Frame *pFrame); + +/** + * dump latest decoded VUI parameters + * @param pDecoder : decoder instance + * @param vui : fill with decoded vui parameters + * @param bValid : =0 if no valid vui parameters decoded, + * otherwise =1 + */ +_h_dll_export void wz265_dump_vui_parameters(void *pDecoder, vui_parameters *vui, int *bValid); + +#if defined(__cplusplus) +} +#endif //__cplusplus + +#endif // header diff --git a/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Headers/wz265def.h b/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Headers/wz265def.h new file mode 100644 index 0000000..de6d67f --- /dev/null +++ b/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Headers/wz265def.h @@ -0,0 +1,311 @@ +#ifndef _WZ265_DEF_H_ +#define _WZ265_DEF_H_ + +// **************************************** +// error code +// error code < 0, means fatal error +// error code > 0, means warning or event +// **************************************** +enum { + WZ_OK = (0x00000000), // Success codes + WZ_FAIL = (0x80000001), // Unspecified error + WZ_OUTOFMEMORY = (0x80000002), // Out of memory + WZ_POINTER = (0x80000004), // Invalid pointer + WZ_NOTSUPPORTED = (0x80000008), // NOT support feature encountered + WZ_AUTH_INVALID = (0x80000010), // Authentication invalid + WZ_AUTH_FAIL_APP_ID = (0x80000011), // Auth failed use app id + WZ_AUTH_FAIL_EXPIRE_TIME = (0x80000012), // Auth failed use expire time + WZ_AUTH_FAIL_MTOOL = (0x80000014), // Auth failed use mtool + WZ265_PARAM_BAD_NAME = (0x80000018), // Bad name pass to WZ265ConfigParse + WZ265_PARAM_BAD_VALUE = (0x80000020), // Bad value pass to WZ265ConfigParse + + WZ_SEARCHING_ACCESS_POINT = (0x00010000), // In process of searching first access point + WZ_REF_PIC_NOT_FOUND = (0x00020000), // Reference picture not found, can be ignored + WZ_NEED_MORE_DATA = (0x00040000), // need push more data + WZ_BITSTREAM_ERROR = (0x00080000), // detecting bit stream error, can be ignored + WZ_SKIPPING_LP_PIC = (0x00100000), // leading pic skipped, can be ignored + WZ_SKIPPING_PIC = (0x00110000), // skippable picture skipped, can be ignored + WZ_CTU_REENCODE = (0x81000000), // CTU re-encode +}; + +typedef enum NAL_UNIT_TYPE { + NAL_UNIT_TYPE_TRAIL_N = 0, + NAL_UNIT_TYPE_TRAIL_R = 1, + + NAL_UNIT_TYPE_TSA_N = 2, + NAL_UNIT_TYPE_TSA_R = 3, + + NAL_UNIT_TYPE_STSA_N = 4, + NAL_UNIT_TYPE_STSA_R = 5, + + NAL_UNIT_TYPE_RADL_N = 6, + NAL_UNIT_TYPE_RADL_R = 7, + + NAL_UNIT_TYPE_RASL_N = 8, + NAL_UNIT_TYPE_RASL_R = 9, + + // reserved + NAL_UNIT_TYPE_RSV_VCL_N10 = 10, + NAL_UNIT_TYPE_RSV_VCL_N12 = 12, + NAL_UNIT_TYPE_RSV_VCL_N14 = 13, + NAL_UNIT_TYPE_RSV_VCL_R11 = 11, + NAL_UNIT_TYPE_RSV_VCL_R13 = 13, + NAL_UNIT_TYPE_RSV_VCL_R15 = 15, + + NAL_UNIT_TYPE_BLA_W_LP = 16, + NAL_UNIT_TYPE_BLA_W_RADL = 17, + NAL_UNIT_TYPE_BLA_N_LP = 18, + + NAL_UNIT_TYPE_IDR_W_RADL = 19, + NAL_UNIT_TYPE_IDR_N_LP = 20, + + NAL_UNIT_TYPE_CRA_NUT = 21, + + NAL_UNIT_TYPE_RSV_IRAP_VCL22 = 22, + NAL_UNIT_TYPE_RSV_IRAP_VCL23 = 23, + + NAL_UNIT_TYPE_RSV_VCL24 = 24, + NAL_UNIT_TYPE_RSV_VCL25 = 25, + NAL_UNIT_TYPE_RSV_VCL26 = 26, + NAL_UNIT_TYPE_RSV_VCL27 = 27, + NAL_UNIT_TYPE_RSV_VCL28 = 28, + NAL_UNIT_TYPE_RSV_VCL29 = 29, + NAL_UNIT_TYPE_RSV_VCL30 = 30, + NAL_UNIT_TYPE_RSV_VCL31 = 31, + + NAL_UNIT_TYPE_VPS_NUT = 32, + NAL_UNIT_TYPE_SPS_NUT = 33, + NAL_UNIT_TYPE_PPS_NUT = 34, + NAL_UNIT_TYPE_AUD_NUT = 35, + NAL_UNIT_TYPE_EOS_NUT = 36, + NAL_UNIT_TYPE_EOB_NUT = 37, + NAL_UNIT_TYPE_FD_NUT = 38, + + NAL_UNIT_TYPE_PREFIX_SEI_NUT = 39, + NAL_UNIT_TYPE_SUFFIX_SEI_NUT = 40, + + NAL_UNIT_TYPE_RSV_NVCL41 = 41, + NAL_UNIT_TYPE_RSV_NVCL42 = 42, + NAL_UNIT_TYPE_RSV_NVCL43 = 43, + NAL_UNIT_TYPE_RSV_NVCL44 = 44, + NAL_UNIT_TYPE_RSV_NVCL45 = 45, + NAL_UNIT_TYPE_RSV_NVCL46 = 46, + NAL_UNIT_TYPE_RSV_NVCL47 = 47, + + NAL_UNIT_TYPE_UNSPEC48 = 48, + NAL_UNIT_TYPE_UNSPEC49 = 49, + NAL_UNIT_TYPE_UNSPEC50 = 50, + NAL_UNIT_TYPE_UNSPEC51 = 51, + NAL_UNIT_TYPE_UNSPEC52 = 52, + NAL_UNIT_TYPE_UNSPEC53 = 53, + NAL_UNIT_TYPE_UNSPEC54 = 54, + NAL_UNIT_TYPE_UNSPEC55 = 55, + NAL_UNIT_TYPE_UNSPEC56 = 56, + NAL_UNIT_TYPE_UNSPEC57 = 57, + NAL_UNIT_TYPE_UNSPEC58 = 58, + NAL_UNIT_TYPE_UNSPEC59 = 59, + NAL_UNIT_TYPE_UNSPEC60 = 60, + NAL_UNIT_TYPE_UNSPEC61 = 61, + NAL_UNIT_TYPE_UNSPEC62 = 62, + NAL_UNIT_TYPE_UNSPEC63 = 63, +} NAL_UNIT_TYPE; + +typedef enum SEI_PAYLOAD_TYPE { + BUFFERING_PERIOD = 0, + PICTURE_TIMING = 1, + PAN_SCAN_RECT = 2, + FILLER_PAYLOAD = 3, + USER_DATA_REGISTERED_ITU_T_T35 = 4, + USER_DATA_UNREGISTERED = 5, + RECOVERY_POINT = 6, + SCENE_INFO = 9, + FULL_FRAME_SNAPSHOT = 15, + PROGRESSIVE_REFINEMENT_SEGMENT_START = 16, + PROGRESSIVE_REFINEMENT_SEGMENT_END = 17, + FILM_GRAIN_CHARACTERISTICS = 19, + POST_FILTER_HINT = 22, + TONE_MAPPING_INFO = 23, + FRAME_PACKING = 45, + DISPLAY_ORIENTATION = 47, + SOP_DESCRIPTION = 128, + ACTIVE_PARAMETER_SETS = 129, + DECODING_UNIT_INFO = 130, + TEMPORAL_LEVEL0_INDEX = 131, + DECODED_PICTURE_HASH = 132, + SCALABLE_NESTING = 133, + REGION_REFRESH_INFO = 134, + MASTERING_DISPLAY_INFO = 137, + CONTENT_LIGHT_LEVEL_INFO = 144, + ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147, + AMBIENT_VIEWING_ENVIRONMENT = 148, +} SEIPayloadType; + +typedef struct WZ265SEIPayload { + int payloadSize; // actual bytes in payload + int payloadBufferSize; // bytes malloc for payload + SEIPayloadType payloadType; + unsigned char *payload; +} WZ265SEIPayload; + +typedef struct WZ265SEI { + int numPayloads; // number of payloads has valid data + WZ265SEIPayload *payloads; +} WZ265SEI; + +// dobly vision rpu +typedef struct WZ265DoviRpu { + int payloadSize; + unsigned char *payloads; +} WZ265DoviRpu; + +// **************************************** +// HRD +// **************************************** +typedef struct hrd_parameters { + int bit_rate_scale; + int cpb_size_scale; + int initial_cpb_removal_delay_length; + int cpb_removal_delay_length; + int dpb_output_delay_length; + int bit_rate_value; + int cpb_size_value; + int cbr_flag; +} hrd_parameters; + +// **************************************** +// VUI +// **************************************** +typedef struct vui_parameters { + // --- sample aspect ratio (SAR) --- + unsigned char aspect_ratio_info_present_flag; + unsigned char aspect_ratio_idc; + unsigned short sar_width; // sar_width and sar_height are zero if unspecified + unsigned short sar_height; + + // --- overscan --- + unsigned char overscan_info_present_flag; + unsigned char overscan_appropriate_flag; + + // --- video signal type --- + unsigned char video_signal_type_present_flag; + unsigned char video_format; + unsigned char video_full_range_flag; + unsigned char colour_description_present_flag; + unsigned char colour_primaries; + unsigned char transfer_characteristics; + unsigned char matrix_coeffs; + + // --- chroma / interlaced --- + unsigned char chroma_loc_info_present_flag; + unsigned char chroma_sample_loc_type_top_field; + unsigned char chroma_sample_loc_type_bottom_field; + unsigned char neutral_chroma_indication_flag; + unsigned char field_seq_flag; + unsigned char frame_field_info_present_flag; + + // --- default display window --- + unsigned char default_display_window_flag; + unsigned int def_disp_win_left_offset; + unsigned int def_disp_win_right_offset; + unsigned int def_disp_win_top_offset; + unsigned int def_disp_win_bottom_offset; + + // --- timing --- + unsigned char vui_timing_info_present_flag; + unsigned int vui_num_units_in_tick; + unsigned int vui_time_scale; + + unsigned char vui_poc_proportional_to_timing_flag; + unsigned int vui_num_ticks_poc_diff_one; + + // --- hrd parameters --- + unsigned char vui_hrd_parameters_present_flag; + hrd_parameters vui_hrd_parameters; + + // --- bitstream restriction --- + unsigned char bitstream_restriction_flag; + unsigned char tiles_fixed_structure_flag; + unsigned char motion_vectors_over_pic_boundaries_flag; + unsigned char restricted_ref_pic_lists_flag; + unsigned short min_spatial_segmentation_idc; + unsigned char max_bytes_per_pic_denom; + unsigned char max_bits_per_mincu_denom; + unsigned char log2_max_mv_length_horizontal; + unsigned char log2_max_mv_length_vertical; +} vui_parameters; + +typedef struct mastering_display_colour_volume_sei { + unsigned short display_primaries_x[3]; + unsigned short display_primaries_y[3]; + unsigned short white_point_x; + unsigned short white_point_y; + unsigned int max_display_mastering_luminance; + unsigned int min_display_mastering_luminance; +} mastering_display_colour_volume_sei; + +typedef struct content_light_level_info_sei { + unsigned short max_content_light_level; + unsigned short max_pic_average_light_level; +} content_light_level_info_sei; + +// ambient viewing environment SEI +typedef struct ambient_viewing_environment_sei { + unsigned int ambient_illuminance; + unsigned int ambient_light_x; + unsigned int ambient_light_y; +} ambient_viewing_environment_sei; + +typedef struct buffering_period_sei { + unsigned int m_cpbDelayOffset; + unsigned int m_dpbDelayOffset; + unsigned int m_concatenationFlag; + unsigned int m_initialCpbRemovalDelay; + unsigned int m_initialCpbRemovalDelayOffset; + unsigned int m_auCpbRemovalDelayDelta; +} buffering_period_sei; + +typedef struct picture_timing_sei { + unsigned int m_picStruct; + unsigned int m_sourceScanType; + unsigned int m_duplicateFlag; + unsigned int m_auCpbRemovalDelay; + unsigned int m_picDpbOutputDelay; +} picture_timing_sei; + +#ifdef WIN32 +#define _h_dll_export __declspec(dllexport) +#else // for GCC +#define _h_dll_export __attribute__((visibility("default"))) +#endif + +typedef void (*WZAuthWarning)(void); +typedef void (*WZLogPrintf)(const char *msg); + +#if defined(__cplusplus) +extern "C" { +#endif //__cplusplus + +// @OBFUSAPI@ + +// log output callback function pointer +// if pFuncCB == NULL, use the default printf +_h_dll_export void wz265_set_log_printf(WZLogPrintf pFuncCB); + +// auth trouble warning callback function pointer +_h_dll_export void wz265_set_auth_warning(WZAuthWarning pFuncCB); + +// auth info +// return auth_ok means auth ok, otherwize means auth fail +_h_dll_export int wz265_get_auth_info(void); + +// libwz265 version number string +_h_dll_export extern const char strLibWZ265Version[]; + +// Get libwz265 version string +_h_dll_export const char *wz265_version_str(void); + +#if defined(__cplusplus) +} +#endif //__cplusplus + +#endif diff --git a/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Info.plist b/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Info.plist new file mode 100644 index 0000000..2abd0ff --- /dev/null +++ b/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + video_dec + CFBundleIdentifier + com.videodec + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + video_dec + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.3.82 + CFBundleVersion + 1.3.82 + MinimumOSVersion + 9.0 + + diff --git a/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/video_dec b/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/video_dec new file mode 100644 index 0000000..baca048 Binary files /dev/null and b/Sources/video_dec.xcframework/ios-arm64_x86_64-simulator/video_dec.framework/video_dec differ diff --git a/Sources/video_enc.xcframework/Info.plist b/Sources/video_enc.xcframework/Info.plist new file mode 100644 index 0000000..634f3f0 --- /dev/null +++ b/Sources/video_enc.xcframework/Info.plist @@ -0,0 +1,41 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + video_enc.framework + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + video_enc.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Headers/wz265def.h b/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Headers/wz265def.h new file mode 100644 index 0000000..fc38094 --- /dev/null +++ b/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Headers/wz265def.h @@ -0,0 +1,309 @@ +#ifndef _WZ265_DEF_H_ +#define _WZ265_DEF_H_ + +// **************************************** +// error code +// error code < 0, means fatal error +// error code > 0, means warning or event +// **************************************** +enum { + WZ_OK = (0x00000000), // Success codes + WZ_FAIL = (0x80000001), // Unspecified error + WZ_OUTOFMEMORY = (0x80000002), // Out of memory + WZ_POINTER = (0x80000003), // Invalid pointer + WZ_NOTSUPPORTED = (0x80000004), // NOT support feature encountered + WZ_AUTH_INVALID = (0x80000005), // Authentication invalid + WZ_AUTH_FAIL_APP_ID = (0x80000008), // Auth failed use app id + WZ_AUTH_FAIL_EXPIRE_TIME = (0x80000009), // Auth failed use expire time + WZ_AUTH_FAIL_MTOOL = (0x8000000a), // Auth failed use mtool + WZ265_PARAM_BAD_NAME = (0x80000006), // Bad name pass to WZ265ConfigParse + WZ265_PARAM_BAD_VALUE = (0x80000007), // Bad value pass to WZ265ConfigParse + + WZ_SEARCHING_ACCESS_POINT = (0x00000001), // In process of searching first access point + WZ_REF_PIC_NOT_FOUND = (0x00000007), // Reference picture not found, can be ignored + WZ_NEED_MORE_DATA = (0x00000008), // need push more data + WZ_BITSTREAM_ERROR = (0x00000009), // detecting bit stream error, can be ignored + WZ_SKIPPING_LP_PIC = (0x0000000A), // leading pic skipped, can be ignored + WZ_SKIPPING_PIC = (0x0000000B), // skippable picture skipped, can be ignored + WZ_CTU_REENCODE = (0x81000000), // CTU re-encode +}; + +typedef enum NAL_UNIT_TYPE { + NAL_UNIT_TYPE_TRAIL_N = 0, + NAL_UNIT_TYPE_TRAIL_R = 1, + + NAL_UNIT_TYPE_TSA_N = 2, + NAL_UNIT_TYPE_TSA_R = 3, + + NAL_UNIT_TYPE_STSA_N = 4, + NAL_UNIT_TYPE_STSA_R = 5, + + NAL_UNIT_TYPE_RADL_N = 6, + NAL_UNIT_TYPE_RADL_R = 7, + + NAL_UNIT_TYPE_RASL_N = 8, + NAL_UNIT_TYPE_RASL_R = 9, + + // reserved + NAL_UNIT_TYPE_RSV_VCL_N10 = 10, + NAL_UNIT_TYPE_RSV_VCL_N12 = 12, + NAL_UNIT_TYPE_RSV_VCL_N14 = 13, + NAL_UNIT_TYPE_RSV_VCL_R11 = 11, + NAL_UNIT_TYPE_RSV_VCL_R13 = 13, + NAL_UNIT_TYPE_RSV_VCL_R15 = 15, + + NAL_UNIT_TYPE_BLA_W_LP = 16, + NAL_UNIT_TYPE_BLA_W_RADL = 17, + NAL_UNIT_TYPE_BLA_N_LP = 18, + + NAL_UNIT_TYPE_IDR_W_RADL = 19, + NAL_UNIT_TYPE_IDR_N_LP = 20, + + NAL_UNIT_TYPE_CRA_NUT = 21, + + NAL_UNIT_TYPE_RSV_IRAP_VCL22 = 22, + NAL_UNIT_TYPE_RSV_IRAP_VCL23 = 23, + + NAL_UNIT_TYPE_RSV_VCL24 = 24, + NAL_UNIT_TYPE_RSV_VCL25 = 25, + NAL_UNIT_TYPE_RSV_VCL26 = 26, + NAL_UNIT_TYPE_RSV_VCL27 = 27, + NAL_UNIT_TYPE_RSV_VCL28 = 28, + NAL_UNIT_TYPE_RSV_VCL29 = 29, + NAL_UNIT_TYPE_RSV_VCL30 = 30, + NAL_UNIT_TYPE_RSV_VCL31 = 31, + + NAL_UNIT_TYPE_VPS_NUT = 32, + NAL_UNIT_TYPE_SPS_NUT = 33, + NAL_UNIT_TYPE_PPS_NUT = 34, + NAL_UNIT_TYPE_AUD_NUT = 35, + NAL_UNIT_TYPE_EOS_NUT = 36, + NAL_UNIT_TYPE_EOB_NUT = 37, + NAL_UNIT_TYPE_FD_NUT = 38, + + NAL_UNIT_TYPE_PREFIX_SEI_NUT = 39, + NAL_UNIT_TYPE_SUFFIX_SEI_NUT = 40, + + NAL_UNIT_TYPE_RSV_NVCL41 = 41, + NAL_UNIT_TYPE_RSV_NVCL42 = 42, + NAL_UNIT_TYPE_RSV_NVCL43 = 43, + NAL_UNIT_TYPE_RSV_NVCL44 = 44, + NAL_UNIT_TYPE_RSV_NVCL45 = 45, + NAL_UNIT_TYPE_RSV_NVCL46 = 46, + NAL_UNIT_TYPE_RSV_NVCL47 = 47, + + NAL_UNIT_TYPE_UNSPEC48 = 48, + NAL_UNIT_TYPE_UNSPEC49 = 49, + NAL_UNIT_TYPE_UNSPEC50 = 50, + NAL_UNIT_TYPE_UNSPEC51 = 51, + NAL_UNIT_TYPE_UNSPEC52 = 52, + NAL_UNIT_TYPE_UNSPEC53 = 53, + NAL_UNIT_TYPE_UNSPEC54 = 54, + NAL_UNIT_TYPE_UNSPEC55 = 55, + NAL_UNIT_TYPE_UNSPEC56 = 56, + NAL_UNIT_TYPE_UNSPEC57 = 57, + NAL_UNIT_TYPE_UNSPEC58 = 58, + NAL_UNIT_TYPE_UNSPEC59 = 59, + NAL_UNIT_TYPE_UNSPEC60 = 60, + NAL_UNIT_TYPE_UNSPEC61 = 61, + NAL_UNIT_TYPE_UNSPEC62 = 62, + NAL_UNIT_TYPE_UNSPEC63 = 63, +} NAL_UNIT_TYPE; + +typedef enum SEI_PAYLOAD_TYPE { + BUFFERING_PERIOD = 0, + PICTURE_TIMING = 1, + PAN_SCAN_RECT = 2, + FILLER_PAYLOAD = 3, + USER_DATA_REGISTERED_ITU_T_T35 = 4, + USER_DATA_UNREGISTERED = 5, + RECOVERY_POINT = 6, + SCENE_INFO = 9, + FULL_FRAME_SNAPSHOT = 15, + PROGRESSIVE_REFINEMENT_SEGMENT_START = 16, + PROGRESSIVE_REFINEMENT_SEGMENT_END = 17, + FILM_GRAIN_CHARACTERISTICS = 19, + POST_FILTER_HINT = 22, + TONE_MAPPING_INFO = 23, + FRAME_PACKING = 45, + DISPLAY_ORIENTATION = 47, + SOP_DESCRIPTION = 128, + ACTIVE_PARAMETER_SETS = 129, + DECODING_UNIT_INFO = 130, + TEMPORAL_LEVEL0_INDEX = 131, + DECODED_PICTURE_HASH = 132, + SCALABLE_NESTING = 133, + REGION_REFRESH_INFO = 134, + MASTERING_DISPLAY_INFO = 137, + CONTENT_LIGHT_LEVEL_INFO = 144, + ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147, + AMBIENT_VIEWING_ENVIRONMENT = 148, +} SEIPayloadType; + +typedef struct WZ265SEIPayload { + int payloadSize; // actual bytes in payload + int payloadBufferSize; // bytes malloc for payload + SEIPayloadType payloadType; + unsigned char *payload; +} WZ265SEIPayload; + +typedef struct WZ265SEI { + int numPayloads; // number of payloads has valid data + WZ265SEIPayload *payloads; +} WZ265SEI; + +// dobly vision rpu +typedef struct WZ265DoviRpu { + int payloadSize; + unsigned char *payloads; +} WZ265DoviRpu; + +// **************************************** +// HRD +// **************************************** +typedef struct hrd_parameters { + int bit_rate_scale; + int cpb_size_scale; + int initial_cpb_removal_delay_length; + int cpb_removal_delay_length; + int dpb_output_delay_length; + int bit_rate_value; + int cpb_size_value; + int cbr_flag; +} hrd_parameters; + +// **************************************** +// VUI +// **************************************** +typedef struct vui_parameters { + // --- sample aspect ratio (SAR) --- + unsigned char aspect_ratio_info_present_flag; + unsigned char aspect_ratio_idc; + unsigned short sar_width; // sar_width and sar_height are zero if unspecified + unsigned short sar_height; + + // --- overscan --- + unsigned char overscan_info_present_flag; + unsigned char overscan_appropriate_flag; + + // --- video signal type --- + unsigned char video_signal_type_present_flag; + unsigned char video_format; + unsigned char video_full_range_flag; + unsigned char colour_description_present_flag; + unsigned char colour_primaries; + unsigned char transfer_characteristics; + unsigned char matrix_coeffs; + + // --- chroma / interlaced --- + unsigned char chroma_loc_info_present_flag; + unsigned char chroma_sample_loc_type_top_field; + unsigned char chroma_sample_loc_type_bottom_field; + unsigned char neutral_chroma_indication_flag; + unsigned char field_seq_flag; + unsigned char frame_field_info_present_flag; + + // --- default display window --- + unsigned char default_display_window_flag; + unsigned int def_disp_win_left_offset; + unsigned int def_disp_win_right_offset; + unsigned int def_disp_win_top_offset; + unsigned int def_disp_win_bottom_offset; + + // --- timing --- + unsigned char vui_timing_info_present_flag; + unsigned int vui_num_units_in_tick; + unsigned int vui_time_scale; + + unsigned char vui_poc_proportional_to_timing_flag; + unsigned int vui_num_ticks_poc_diff_one; + + // --- hrd parameters --- + unsigned char vui_hrd_parameters_present_flag; + hrd_parameters vui_hrd_parameters; + + // --- bitstream restriction --- + unsigned char bitstream_restriction_flag; + unsigned char tiles_fixed_structure_flag; + unsigned char motion_vectors_over_pic_boundaries_flag; + unsigned char restricted_ref_pic_lists_flag; + unsigned short min_spatial_segmentation_idc; + unsigned char max_bytes_per_pic_denom; + unsigned char max_bits_per_mincu_denom; + unsigned char log2_max_mv_length_horizontal; + unsigned char log2_max_mv_length_vertical; +} vui_parameters; + +typedef struct mastering_display_colour_volume_sei { + unsigned short display_primaries_x[3]; + unsigned short display_primaries_y[3]; + unsigned short white_point_x; + unsigned short white_point_y; + unsigned int max_display_mastering_luminance; + unsigned int min_display_mastering_luminance; +} mastering_display_colour_volume_sei; + +typedef struct content_light_level_info_sei { + unsigned short max_content_light_level; + unsigned short max_pic_average_light_level; +} content_light_level_info_sei; + +// ambient viewing environment SEI +typedef struct ambient_viewing_environment_sei { + unsigned int ambient_illuminance; + unsigned int ambient_light_x; + unsigned int ambient_light_y; +} ambient_viewing_environment_sei; + +typedef struct buffering_period_sei { + unsigned int m_cpbDelayOffset; + unsigned int m_dpbDelayOffset; + unsigned int m_concatenationFlag; + unsigned int m_initialCpbRemovalDelay; + unsigned int m_initialCpbRemovalDelayOffset; + unsigned int m_auCpbRemovalDelayDelta; +} buffering_period_sei; + +typedef struct picture_timing_sei { + unsigned int m_picStruct; + unsigned int m_sourceScanType; + unsigned int m_duplicateFlag; + unsigned int m_auCpbRemovalDelay; + unsigned int m_picDpbOutputDelay; +} picture_timing_sei; + +#ifdef WIN32 +#define _h_dll_export __declspec(dllexport) +#else // for GCC +#define _h_dll_export __attribute__((visibility("default"))) +#endif + +typedef void (*WZAuthWarning)(void); +typedef void (*WZLogPrintf)(const char *msg); + +#if defined(__cplusplus) +extern "C" { +#endif //__cplusplus + +// log output callback function pointer +// if pFuncCB == NULL, use the default printf +_h_dll_export void wz265_set_log_printf(WZLogPrintf pFuncCB); + +// auth trouble warning callback function pointer +_h_dll_export void wz265_set_auth_warning(WZAuthWarning pFuncCB); + +// auth info +// return auth_ok means auth ok, otherwize means auth fail +_h_dll_export int wz265_get_auth_info(void); + +// libwz265 version number string +_h_dll_export extern const char strLibWZ265Version[]; + +// Get libwz265 version string +_h_dll_export const char *wz265_version_str(void); + +#if defined(__cplusplus) +} +#endif //__cplusplus + +#endif diff --git a/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Headers/wz265enc.h b/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Headers/wz265enc.h new file mode 100644 index 0000000..e40da72 --- /dev/null +++ b/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Headers/wz265enc.h @@ -0,0 +1,413 @@ +/////////////////////////////////////////////////// +// +// Visionular H265 Codec Library +// +// Copyright(c) visionular Inc. +// https://www.visionular.com/ +// +/////////////////////////////////////////////////// +#ifndef _WZ265_ENCODER_INTERFACE_H_ +#define _WZ265_ENCODER_INTERFACE_H_ + +#include "wz265def.h" +// **************************************** +// base configuration +// **************************************** +#define WZ265PRESET_ULTRAFAST 0 +#define WZ265PRESET_SUPERFAST 1 +#define WZ265PRESET_VERYFAST 2 +#define WZ265PRESET_FASTER 3 +#define WZ265PRESET_FAST 4 +#define WZ265PRESET_MEDIUM 5 +#define WZ265PRESET_SLOW 6 +#define WZ265PRESET_SLOWER 7 +#define WZ265PRESET_VERYSLOW 8 +#define WZ265PRESET_SUPERSLOW 9 +#define WZ265PRESET_PLACEBO 10 + +/* WZ265 tuning types: Multiple tunings can be combined by "|" + e.g., WZ265_TUNE_SSIM | WZ265_TUNE_SCREEN */ +#define WZ265_TUNE_DEFAULT 0x0000 +#define WZ265_TUNE_SSIM 0x0001 +#define WZ265_TUNE_VMAF 0x0002 +#define WZ265_TUNE_SCREEN 0x0004 +#define WZ265_TUNE_MOVIE 0x0008 +#define WZ265_TUNE_GAME 0x0010 +#define WZ265_TUNE_ZEROLATENCY 0x0020 +#define WZ265_TUNE_UNIVERSE 0x0080 + +typedef enum WZ265_RC_TYPE { + WZ265_RC_QUALITY = -1, + WZ265_RC_CQP = 0, + WZ265_RC_CRF = 1, + WZ265_RC_ABR = 2, + WZ265_RC_CBR = 3, + WZ265_RC_MAX = WZ265_RC_CBR +} WZ265_RC_TYPE; + +typedef enum WZ265_WAVEFRONT_TYPE { + WZ265_WPP_DISABLE = 0, + WZ265_WPP_ALL = 1, + WZ265_WPP_RDO_ONLY = 2, +} WZ265_WAVEFRONT_TYPE; + +typedef enum WZ265_INPUT_CSP { + WZ265_CSP_DEFAULT, /*read from input file , otherwise use WZ265_CSP_I420 */ + WZ265_CSP_I420, /* yuv 4:2:0 planar */ + WZ265_CSP_YV12, /* yvu 4:2:0 planar */ + WZ265_CSP_NV12, /* yuv 4:2:0, with one y plane and one packed u+v per pixel */ + WZ265_CSP_NV21, /* yuv 4:2:0, with one y plane and one packed v+u per pixel */ + WZ265_CSP_ANDROID420, /* yuv 4:2:0, with one y plane and packed u+v per line */ + WZ265_CSP_YUY2, /* yuv 4:2:2, packed Y0 U0 Y1 V1*/ + WZ265_CSP_P010, /* yuv 4:2:0, planar , 10bit */ + WZ265_CSP_P012, /* yuv 4:2:0, planar , 12bit */ + WZ265_CSP_P016, /* yuv 4:2:0, planar, 16bit */ + WZ265_CSP_P210, /* yuv 4:2:2, planar, 10 bit */ + WZ265_CSP_P212, /* yuv 4:2:2, planar, 12 bit */ + WZ265_CSP_Y210, /* yuv 4:2:2, packed, 10 bit */ + WZ265_CSP_Y212, /* yuv 4:2:2, packed, 12 bit */ + WZ265_CSP_P216, /* yuv 4:2:2, planar, 16bit */ + WZ265_CSP_Y216, /* yuv 4:2:2, packed, 16bit */ + WZ265_CSP_MAX = WZ265_CSP_Y216, + WZ265_CSP_YUYV = WZ265_CSP_YUY2, /* yuv 4:2:2, packed Y0 U0 Y1 V1*/ +} WZ265_INPUT_CSP; + +typedef enum WZ265_REF_MODE { + WZ265_REF_NORMOL = 0, + WZ265_REF_DIST = 1, // prefer short distance reference + WZ265_REF_QUALITY = 2 // prefer high quality reference +} WZ265_REF_MODE; + +static const char *const wz265_video_format_names[] = { "component", "pal", "ntsc", "secam", + "mac", "unknown", 0 }; +static const char *const wz265_fullrange_names[] = { "limited", "full", 0 }; +static const char *const wz265_colourprimaries_names[] = { + "reserved", "bt709", "unknown", "reserved", "bt470m", "bt470bg", "smpte170m", + "smpte240m", "film", "bt2020", "smpte428", "smpte431", "smpte432", 0 +}; +static const char *const wz265_transfer_names[] = { + "reserved", "bt709", "unknown", "reserved", "bt470m", "bt470bg", "smpte170m", + "smpte240m", "linear", "log100", "log316", "iec61966-2-4", "bt1361e", "iec61966-2-1", + "bt2020-10", "bt2020-12", "smpte2084", "smpte428", "arib-std-b67", 0 +}; +static const char *const wz265_colourmatrix_names[] = { + "gbr", "bt709", "unknown", "", "fcc", "bt470bg", "smpte170m", + "smpte240m", "ycgco", "bt2020nc", "bt2020c", "smpte2085", "chroma-derived-nc", "chroma-derived-c", + "ictcp", 0 +}; + +#define WZ265_MAX_PATH_LEN 1024 +#define WZ265_CFG_AUTO_VALUE -1000 +#define WZ265_RTC_MAX_TLAYER_ID 2 +// Base configuration +typedef struct WZ265EncConfig { + void *pAuth; // WZAuth, invalid if don't need aksk auth + int preset; // [7:4] preset-strength, 0-9; [3:0] preset, ultrafast ~ superslow + int tune; // tuning type, combined value + WZ265_INPUT_CSP inputCsp; + int inputBitDepth; // input bit depth + int profileId; // support main profile(1) and main still profile(3) + int levelIdc; // according to resolution + int picWidth; // input frame width + int picHeight; // input frame height + double frameRate; // input frame rate + int internalBitDepth; // internal bit depth + int bHeaderBeforeKeyframe; // output vps,sps,pps before key frame, default 1 + //************************************************************************** + // int type start from here + // These configures = WZ265_CFG_AUTO_VALUE means set by encoder default, otherwise means set by + // users for most configs, < 0 also means auto, but WZ265_CFG_AUTO_VALUE is more secure + //************************************************************************** + int rc; // rc type 0 disable,1 crf,2 abr,3 cbr, default 1 + int b_vfr_input; // VFR(Variable frame rate) input + int bframes; // num of bi-pred frames, -1: using default + int bframesAdapt; + int single_pps; // limit pps to be only one + int rps_prediction; // rps prediction from sps + int temporalLayer; // works with zerolatency, separate P frames into temporal layers, 0 ~ 2 + int bitrateInkbps; // target bit rate in kbps, valid when rctype is cbr abd vbr + int vbv_buffer_size; // buf size of vbv + int vbv_max_rate; // max rate of vbv + int vbv_buffer_debt_frames; // underflow vbvbuffer for rd gian + int qp; // valid when rctype is disable, default 30 + int chroma_qp_offset; // valid range -12..12, default 0, equals to + // pps_cb_qp_offset=pps_cr_qp_offset + int QPDeltaMinAdapt; + int rc_rf_by_fps; // + int rc_sync_dist; // rc sync distance + int keyint_max; // Key-Frame period, 0 = only first, -1 = auto + int keyint_min; // Minimum Period of Key-Frame + int scenecut; // how aggressively to insert extra I frames, 0 - 100 + int qpmin; // minimal qp, valid when rc != 0, 0~51 + int qpmax; // maximal qp, valid when rc != 0, 1~51, qpmax = 0 means 51 + int qpmax_i; // maximal qp for I frames + int rcFrameSkip; // frame skip for rate control. 0: not allowed; > 0: continuious skipped frame + // number + int enable_temporal_filter; + int golden_frame_interval; + int tf_frame_interval; + + //* Execute Properties + int enWavefront; // enable wave front parallel + int enFrameParallel; // enable frame parallel + int ParallelledFrames; // 0 means auto + int enTileParallel; // enable tile parallel, currently, tile parallel CAN'T work together with + // wpp or fpp + int tile_rows; // 0: auto + int tile_columns; // 0: auto + int threads; // number of threads used in encoding ( for wavefront, frame parallel, or both) + int preanalyze_threads; // pre-analyze threads + int log2MaxCtuSize; // log2_min_luma_coding_block_size: 4 ~ 6, default 6 + int lookahead; // lookahead settings + int calcPsnr; // 0:not calc psnr; 1: print total psnr; 2: print each frame + int calcSsim; // calc ssim (0: don't 1: only summary 2: print each frame and summary + int calcVmaf; // 0: don't calc vmaf; 1: print summary; 2: print each frame + int calcTime; // 0: do not print; 1: print maximum ; 2: print each frame + int rdoq; // 1:enabling rdoq + int scalingLists; // 0: off; 1: default + int me; // 0: DIA, 1: HEX, 2: UMH, 3:EPZS, + int part; // 0: 2NX2N 1: NX2N 2NXN NXN + int partchecklevel; + int do64; // 1:enabling 64x64 cu + int tuInter; // inter RQT tu depth, 0~3, -1 means auto + int tuIntra; // intra RQT tu depth, 0~3, -1 means auto + int checkZero; + int smooth; // 1: enabling strong intra smoothing + int transskip; // 1: enabling transform skip + int subme; // 0 : disable; 1 ~ 5: subme levels, default 3,4,5 + int satdInter; // 1:enabling hardmad sad + int satdIntra; // 1:enabling hardmad sad + int searchrange; // search range + int refmode; // defined by WZ265_REF_MODE + int refnum; // reference number + int pRefNum; // pref number + int goldenFrameAsRefFirst; // if 1 first nearest ref, second golden frame. if 0,do not handle + // golden frame special + int sao; // sao enabling, 0: disable; 1:faster; 2: faster; 3: usual; 4:complex + int longTermRef; // 0:disabling longterm reference 1:enable; + int intra32; // 0:disable intra32 + int noiseReduction; // inter noise reduction strength + int weightp; // Enable weighted prediction in P slices + int weightb; // Enable weighted prediction in B slices + int iAqMode; // adaptive quantization 0~6, 0: disable, 1: variance; 4: fine variance (default), 6 + // - activity equal to max var of subblocks + int log2AqBlockSize; // adaptive quantization block size, 4-6 + int log2QGroupSize; // quantization group size (4-6, must less than maxcusize) + int psyRdType; // 0: default, 1: optional + int crfAdaptByQuality; // CRF adapt by quality, 0: auto; 1: adapt by PSNR; 2: adapt by Vmaf + // without motion + int head_thr; // the threshold of duration (s) to set crf of front frames + int head_ratio; // 1/head_ratio is the proportion of front frames + int opengop; // enable RASL for CRA, default 1; If opengop = 0, CRA acts like IDR + int extra_opts; // extra speedup optimization for huya original painting scenario + int reduceCplxByTool; // level of reduce complexity burst by tools + int cplxFrameSkip; // frame skip to reduce complexity + //* vui_parameters + // vui_parameters_present_flag set to 1 specifies that the vui_parameters() syntax in struct vui + // must be set by usr + int vui_parameters_present_flag; + int accessUnitDelimitersPresent; + int doviProfile; // dolby vision profile 50, 81, 82, 84, + int visual_opt; // enable visual-opt, default 1, 0 ~ 2 + //===================================== + //====== int type end ======= + //===================================== + + //*************************************************************************** + // double type start from here + // These configures = WZ265_CFG_AUTO_VALUE means set by encoder default, otherwise means set by + // users + //*************************************************************************** + double crf; // valid when rctype is crf, default 30 + double quality; // valid when rctype is quality, default -1 + double keyint_t; // I-Frame period by time (s), -1 = not work, default -1 + double keyint_first; // first GOP period by time (s), -1 = not work, default -1 + double ipratio; + double iboost; + double qcompCutree; + double shortLoadingForPlayer; // reduce b frames after I frame, for shorting the loading time of + // VOD for some players + double fRateTolerance; // default 2.0f,0.5 is suitable to reduce the largest bitrate, and 0.1 is + // to make the bitrate stable + double fAqStrength; // strength of adaptive quantizaiton, 0~3.0, default 0.7 + double fAqSmooth; // strength of adaptive quantizaiton for smooth area, 0~3.0, default 0.7 + double fAqWeight; // weight of aq-mode 1 and 4; or aq-mode 2 and 4 + double roiDeltaQp; // roi region delta qp ratio, default 1.0 + double intra32pen; // penalty on intra32x32 when intra32 is set + double psyRd; // psy-rd strength, 0 ~ 1.0 + double psyRdUV; + double psyIframe; // psy limit for I frame + double qualityLevel; // for PSNR(dB); for Vmaf(score) + double qualityRange; // adapt when quality > qualityLevel + qualityRange, for PSNR(dB); + double head_crf; // set crf of front frames when video is long + double qualitySmooth; + double reduceCplxByQP; // reduce complexity burst by QP, default 0. It's for special case + double duration; // the duration (s) of the video + //===================================== + //====== double type end ======= + //===================================== + + // VUI and SEI metadata (HDR releated) + vui_parameters vui; + /* SMPTE ST 2086 mastering display color volume SEI info, + * A string with format "master-display=Y(%hu,%hu)U(%hu,%hu)V(%hu,%hu)WP(%hu,%hu)L(%u,%u)" + * where %hu are unsigned 16bit integers and %u are unsigned 32bit integers, + * can be parsed by WZ265ConfigParse */ + mastering_display_colour_volume_sei masteringDisplayColorVolume; + int masteringDisplayPresent; // 1: masteringDisplayColorVolume will be write to SEI nal + /* CEA 861.3, Content light level information SEI info, + * A string with format "max-cll=%hu,%hu" , can be parsed by WZ265ConfigParse*/ + content_light_level_info_sei contentLightLevel; + int contentLightLevelPresent; // 1: contentLightLevel will be write to SEI nal + + ambient_viewing_environment_sei ambientViewEnvironment; + int ambientViewEnvironmentPresent; + + buffering_period_sei bufferingPeriod; + + // For Multi pass + int iPass; // Multi pass rate control, 0:disable(default); 1: first pass; 2: second pass + char statFileInName[256]; // log file produced from first pass, set by user + char statFileOutName[256]; // log file produced from first pass, set by user + // For debug + char dumpYuvFile[WZ265_MAX_PATH_LEN]; + char dumpSrcFile[WZ265_MAX_PATH_LEN]; + char dumpBsFile[WZ265_MAX_PATH_LEN]; + int logLevel; // log level (-1: dbg; 0: info; 1:warn; 2:err; 3:fatal) +} WZ265EncConfig; + +// input frame data and info +typedef struct WZ265YUV { + int iWidth; // input frame width + int iHeight; // input frame height + int iBitDepth; // input YUV bit depth (8, 10, 12) + void *pData[3]; // input frame Y U V + int iStride[3]; // stride for Y U V +} WZ265YUV; + +// input frame data and info +typedef struct WZ265Picture { + int iSliceType; // specified by output pictures + int poc; // ignored on input + long long pts; + long long dts; + WZ265YUV *yuv; + // for input, custom decide which ref can be used as reference,if not used, make sure it is + // zero!!! + // if there is no matched poc in DPB ,encoder will ignore this!! + // if this setting is valid, other reference in DPB will be cleaned + int forceRefNum; + int forceRefPoc[8]; + /* User defined SEI */ + WZ265SEI userSEI; + /* Dobly Vision Rpu metadata */ + WZ265DoviRpu doviRpu; + + // for output, + double psnr[3]; // Out: PSNR of Y, U, and V (if calcPsnr is set) + double frameAvgQp; + // preset current DPB picture poc + int curDPBRefNum; + int dpbRefPoc[8]; + void *roi; +} WZ265Picture; + +typedef struct WZ265Nal { + int naltype; + int tid; + int iSize; + long long pts; + unsigned char *pPayload; +} WZ265Nal; + +#if defined(__cplusplus) +extern "C" { +#endif //__cplusplus +/** + * Create encoder + * + * @param pCfg : base config of encoder + * @param errorCode : error code + * @return encoder handle + */ +_h_dll_export void *wz265_encoder_open(WZ265EncConfig *pCfg, int *errorCode); + +/** + * Close and destroy encoder + * + * @param pEncoder : encoder handle + */ +_h_dll_export void wz265_encoder_close(void *pEncoder); + +/** + * Reconfig encoder + * + * @param pEncoder encoder handle + * @param pCfg new base config + */ +_h_dll_export void wz265_encoder_reconfig(void *pEncoder, WZ265EncConfig *pCfg); + +/** + * Produce video header nals(VPS,SPS,PPS) + * + * @param pEncoder encoder handle + * @param pNals header nals that will be used for the following stream + * @param iNalCount number of nals + * @return if succeed, return 0; if failed, return the error code + */ +_h_dll_export int wz265_encode_headers(void *pEncoder, WZ265Nal **pNals, int *iNalCount); + +/** + * Encode one frame + * + * @param pEncoder handle of encoder + * @param pNals pointer array of output wz265NAL units + * @param iNalCount output wz265NAL unit count + * @param pInpic input frame + * @param pOutpic output frame + * @return if succeed, return 0; if failed, return the error code + */ +_h_dll_export int wz265_encoder_frame(void *pEncoder, WZ265Nal **pNals, int *iNalCount, + WZ265Picture *pInpic, WZ265Picture *pOutpic); + +/** + * Request encoder to encode next frame as Key Frame + * + * @param pEncoder encoder handle + */ +_h_dll_export void wz265_keyframe_request(void *pEncoder); + +/** + * Query buffered frames in encoder + * + * @param pEncoder encoder handle + @return Number of buffered frames in encoder + */ +_h_dll_export int wz265_encoder_delayed_frames(void *pEncoder); +/* clang-format off */ + +/* preset can be further set by preset-strength by a delimiter in ",./-+", + e.g, "veryfast-5" or "medium-0", + valid preset-strength ranged in 0-9, "medium-0" is same to "medium", + larger preset-strength means speed down for better RD quality. +*/ +static const char *const wz265_preset_names[] = { "ultrafast", "superfast", 0 }; +/* Multiple tunings can be used if separated by a delimiter in ",./-+", + e.g., "ssim,screen" or "ssim/screen" */ +static const char *const wz265_tunes_names[] = { "default", "ssim", "vmaf", + "screen", "movie", "game", + "zerolatency", "universe", 0 }; +/* clang-format on */ +// Get default config values by preset, tune and latency. enum format +_h_dll_export int wz265_param_default(WZ265EncConfig *pConfig, int preset, int tune); + +// Get default config values by preset, tune and latency. string format +_h_dll_export int wz265_param_default_preset(WZ265EncConfig *pConfig, const char *preset, + const char *tune); +// Parse name,value paire and set into WZ265EncConfig +_h_dll_export int WZ265ConfigParse(WZ265EncConfig *p, const char *name, const char *value); +#if defined(__cplusplus) +} +#endif //__cplusplus + +#endif diff --git a/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Info.plist b/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Info.plist new file mode 100644 index 0000000..8e27fc5 --- /dev/null +++ b/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + video_enc + CFBundleIdentifier + com.videoenc + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + video_enc + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.3.60 + CFBundleVersion + 1.3.60 + MinimumOSVersion + 9.0 + + diff --git a/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/video_enc b/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/video_enc new file mode 100644 index 0000000..a16cb64 Binary files /dev/null and b/Sources/video_enc.xcframework/ios-arm64_armv7/video_enc.framework/video_enc differ diff --git a/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Headers/wz265def.h b/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Headers/wz265def.h new file mode 100644 index 0000000..fc38094 --- /dev/null +++ b/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Headers/wz265def.h @@ -0,0 +1,309 @@ +#ifndef _WZ265_DEF_H_ +#define _WZ265_DEF_H_ + +// **************************************** +// error code +// error code < 0, means fatal error +// error code > 0, means warning or event +// **************************************** +enum { + WZ_OK = (0x00000000), // Success codes + WZ_FAIL = (0x80000001), // Unspecified error + WZ_OUTOFMEMORY = (0x80000002), // Out of memory + WZ_POINTER = (0x80000003), // Invalid pointer + WZ_NOTSUPPORTED = (0x80000004), // NOT support feature encountered + WZ_AUTH_INVALID = (0x80000005), // Authentication invalid + WZ_AUTH_FAIL_APP_ID = (0x80000008), // Auth failed use app id + WZ_AUTH_FAIL_EXPIRE_TIME = (0x80000009), // Auth failed use expire time + WZ_AUTH_FAIL_MTOOL = (0x8000000a), // Auth failed use mtool + WZ265_PARAM_BAD_NAME = (0x80000006), // Bad name pass to WZ265ConfigParse + WZ265_PARAM_BAD_VALUE = (0x80000007), // Bad value pass to WZ265ConfigParse + + WZ_SEARCHING_ACCESS_POINT = (0x00000001), // In process of searching first access point + WZ_REF_PIC_NOT_FOUND = (0x00000007), // Reference picture not found, can be ignored + WZ_NEED_MORE_DATA = (0x00000008), // need push more data + WZ_BITSTREAM_ERROR = (0x00000009), // detecting bit stream error, can be ignored + WZ_SKIPPING_LP_PIC = (0x0000000A), // leading pic skipped, can be ignored + WZ_SKIPPING_PIC = (0x0000000B), // skippable picture skipped, can be ignored + WZ_CTU_REENCODE = (0x81000000), // CTU re-encode +}; + +typedef enum NAL_UNIT_TYPE { + NAL_UNIT_TYPE_TRAIL_N = 0, + NAL_UNIT_TYPE_TRAIL_R = 1, + + NAL_UNIT_TYPE_TSA_N = 2, + NAL_UNIT_TYPE_TSA_R = 3, + + NAL_UNIT_TYPE_STSA_N = 4, + NAL_UNIT_TYPE_STSA_R = 5, + + NAL_UNIT_TYPE_RADL_N = 6, + NAL_UNIT_TYPE_RADL_R = 7, + + NAL_UNIT_TYPE_RASL_N = 8, + NAL_UNIT_TYPE_RASL_R = 9, + + // reserved + NAL_UNIT_TYPE_RSV_VCL_N10 = 10, + NAL_UNIT_TYPE_RSV_VCL_N12 = 12, + NAL_UNIT_TYPE_RSV_VCL_N14 = 13, + NAL_UNIT_TYPE_RSV_VCL_R11 = 11, + NAL_UNIT_TYPE_RSV_VCL_R13 = 13, + NAL_UNIT_TYPE_RSV_VCL_R15 = 15, + + NAL_UNIT_TYPE_BLA_W_LP = 16, + NAL_UNIT_TYPE_BLA_W_RADL = 17, + NAL_UNIT_TYPE_BLA_N_LP = 18, + + NAL_UNIT_TYPE_IDR_W_RADL = 19, + NAL_UNIT_TYPE_IDR_N_LP = 20, + + NAL_UNIT_TYPE_CRA_NUT = 21, + + NAL_UNIT_TYPE_RSV_IRAP_VCL22 = 22, + NAL_UNIT_TYPE_RSV_IRAP_VCL23 = 23, + + NAL_UNIT_TYPE_RSV_VCL24 = 24, + NAL_UNIT_TYPE_RSV_VCL25 = 25, + NAL_UNIT_TYPE_RSV_VCL26 = 26, + NAL_UNIT_TYPE_RSV_VCL27 = 27, + NAL_UNIT_TYPE_RSV_VCL28 = 28, + NAL_UNIT_TYPE_RSV_VCL29 = 29, + NAL_UNIT_TYPE_RSV_VCL30 = 30, + NAL_UNIT_TYPE_RSV_VCL31 = 31, + + NAL_UNIT_TYPE_VPS_NUT = 32, + NAL_UNIT_TYPE_SPS_NUT = 33, + NAL_UNIT_TYPE_PPS_NUT = 34, + NAL_UNIT_TYPE_AUD_NUT = 35, + NAL_UNIT_TYPE_EOS_NUT = 36, + NAL_UNIT_TYPE_EOB_NUT = 37, + NAL_UNIT_TYPE_FD_NUT = 38, + + NAL_UNIT_TYPE_PREFIX_SEI_NUT = 39, + NAL_UNIT_TYPE_SUFFIX_SEI_NUT = 40, + + NAL_UNIT_TYPE_RSV_NVCL41 = 41, + NAL_UNIT_TYPE_RSV_NVCL42 = 42, + NAL_UNIT_TYPE_RSV_NVCL43 = 43, + NAL_UNIT_TYPE_RSV_NVCL44 = 44, + NAL_UNIT_TYPE_RSV_NVCL45 = 45, + NAL_UNIT_TYPE_RSV_NVCL46 = 46, + NAL_UNIT_TYPE_RSV_NVCL47 = 47, + + NAL_UNIT_TYPE_UNSPEC48 = 48, + NAL_UNIT_TYPE_UNSPEC49 = 49, + NAL_UNIT_TYPE_UNSPEC50 = 50, + NAL_UNIT_TYPE_UNSPEC51 = 51, + NAL_UNIT_TYPE_UNSPEC52 = 52, + NAL_UNIT_TYPE_UNSPEC53 = 53, + NAL_UNIT_TYPE_UNSPEC54 = 54, + NAL_UNIT_TYPE_UNSPEC55 = 55, + NAL_UNIT_TYPE_UNSPEC56 = 56, + NAL_UNIT_TYPE_UNSPEC57 = 57, + NAL_UNIT_TYPE_UNSPEC58 = 58, + NAL_UNIT_TYPE_UNSPEC59 = 59, + NAL_UNIT_TYPE_UNSPEC60 = 60, + NAL_UNIT_TYPE_UNSPEC61 = 61, + NAL_UNIT_TYPE_UNSPEC62 = 62, + NAL_UNIT_TYPE_UNSPEC63 = 63, +} NAL_UNIT_TYPE; + +typedef enum SEI_PAYLOAD_TYPE { + BUFFERING_PERIOD = 0, + PICTURE_TIMING = 1, + PAN_SCAN_RECT = 2, + FILLER_PAYLOAD = 3, + USER_DATA_REGISTERED_ITU_T_T35 = 4, + USER_DATA_UNREGISTERED = 5, + RECOVERY_POINT = 6, + SCENE_INFO = 9, + FULL_FRAME_SNAPSHOT = 15, + PROGRESSIVE_REFINEMENT_SEGMENT_START = 16, + PROGRESSIVE_REFINEMENT_SEGMENT_END = 17, + FILM_GRAIN_CHARACTERISTICS = 19, + POST_FILTER_HINT = 22, + TONE_MAPPING_INFO = 23, + FRAME_PACKING = 45, + DISPLAY_ORIENTATION = 47, + SOP_DESCRIPTION = 128, + ACTIVE_PARAMETER_SETS = 129, + DECODING_UNIT_INFO = 130, + TEMPORAL_LEVEL0_INDEX = 131, + DECODED_PICTURE_HASH = 132, + SCALABLE_NESTING = 133, + REGION_REFRESH_INFO = 134, + MASTERING_DISPLAY_INFO = 137, + CONTENT_LIGHT_LEVEL_INFO = 144, + ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147, + AMBIENT_VIEWING_ENVIRONMENT = 148, +} SEIPayloadType; + +typedef struct WZ265SEIPayload { + int payloadSize; // actual bytes in payload + int payloadBufferSize; // bytes malloc for payload + SEIPayloadType payloadType; + unsigned char *payload; +} WZ265SEIPayload; + +typedef struct WZ265SEI { + int numPayloads; // number of payloads has valid data + WZ265SEIPayload *payloads; +} WZ265SEI; + +// dobly vision rpu +typedef struct WZ265DoviRpu { + int payloadSize; + unsigned char *payloads; +} WZ265DoviRpu; + +// **************************************** +// HRD +// **************************************** +typedef struct hrd_parameters { + int bit_rate_scale; + int cpb_size_scale; + int initial_cpb_removal_delay_length; + int cpb_removal_delay_length; + int dpb_output_delay_length; + int bit_rate_value; + int cpb_size_value; + int cbr_flag; +} hrd_parameters; + +// **************************************** +// VUI +// **************************************** +typedef struct vui_parameters { + // --- sample aspect ratio (SAR) --- + unsigned char aspect_ratio_info_present_flag; + unsigned char aspect_ratio_idc; + unsigned short sar_width; // sar_width and sar_height are zero if unspecified + unsigned short sar_height; + + // --- overscan --- + unsigned char overscan_info_present_flag; + unsigned char overscan_appropriate_flag; + + // --- video signal type --- + unsigned char video_signal_type_present_flag; + unsigned char video_format; + unsigned char video_full_range_flag; + unsigned char colour_description_present_flag; + unsigned char colour_primaries; + unsigned char transfer_characteristics; + unsigned char matrix_coeffs; + + // --- chroma / interlaced --- + unsigned char chroma_loc_info_present_flag; + unsigned char chroma_sample_loc_type_top_field; + unsigned char chroma_sample_loc_type_bottom_field; + unsigned char neutral_chroma_indication_flag; + unsigned char field_seq_flag; + unsigned char frame_field_info_present_flag; + + // --- default display window --- + unsigned char default_display_window_flag; + unsigned int def_disp_win_left_offset; + unsigned int def_disp_win_right_offset; + unsigned int def_disp_win_top_offset; + unsigned int def_disp_win_bottom_offset; + + // --- timing --- + unsigned char vui_timing_info_present_flag; + unsigned int vui_num_units_in_tick; + unsigned int vui_time_scale; + + unsigned char vui_poc_proportional_to_timing_flag; + unsigned int vui_num_ticks_poc_diff_one; + + // --- hrd parameters --- + unsigned char vui_hrd_parameters_present_flag; + hrd_parameters vui_hrd_parameters; + + // --- bitstream restriction --- + unsigned char bitstream_restriction_flag; + unsigned char tiles_fixed_structure_flag; + unsigned char motion_vectors_over_pic_boundaries_flag; + unsigned char restricted_ref_pic_lists_flag; + unsigned short min_spatial_segmentation_idc; + unsigned char max_bytes_per_pic_denom; + unsigned char max_bits_per_mincu_denom; + unsigned char log2_max_mv_length_horizontal; + unsigned char log2_max_mv_length_vertical; +} vui_parameters; + +typedef struct mastering_display_colour_volume_sei { + unsigned short display_primaries_x[3]; + unsigned short display_primaries_y[3]; + unsigned short white_point_x; + unsigned short white_point_y; + unsigned int max_display_mastering_luminance; + unsigned int min_display_mastering_luminance; +} mastering_display_colour_volume_sei; + +typedef struct content_light_level_info_sei { + unsigned short max_content_light_level; + unsigned short max_pic_average_light_level; +} content_light_level_info_sei; + +// ambient viewing environment SEI +typedef struct ambient_viewing_environment_sei { + unsigned int ambient_illuminance; + unsigned int ambient_light_x; + unsigned int ambient_light_y; +} ambient_viewing_environment_sei; + +typedef struct buffering_period_sei { + unsigned int m_cpbDelayOffset; + unsigned int m_dpbDelayOffset; + unsigned int m_concatenationFlag; + unsigned int m_initialCpbRemovalDelay; + unsigned int m_initialCpbRemovalDelayOffset; + unsigned int m_auCpbRemovalDelayDelta; +} buffering_period_sei; + +typedef struct picture_timing_sei { + unsigned int m_picStruct; + unsigned int m_sourceScanType; + unsigned int m_duplicateFlag; + unsigned int m_auCpbRemovalDelay; + unsigned int m_picDpbOutputDelay; +} picture_timing_sei; + +#ifdef WIN32 +#define _h_dll_export __declspec(dllexport) +#else // for GCC +#define _h_dll_export __attribute__((visibility("default"))) +#endif + +typedef void (*WZAuthWarning)(void); +typedef void (*WZLogPrintf)(const char *msg); + +#if defined(__cplusplus) +extern "C" { +#endif //__cplusplus + +// log output callback function pointer +// if pFuncCB == NULL, use the default printf +_h_dll_export void wz265_set_log_printf(WZLogPrintf pFuncCB); + +// auth trouble warning callback function pointer +_h_dll_export void wz265_set_auth_warning(WZAuthWarning pFuncCB); + +// auth info +// return auth_ok means auth ok, otherwize means auth fail +_h_dll_export int wz265_get_auth_info(void); + +// libwz265 version number string +_h_dll_export extern const char strLibWZ265Version[]; + +// Get libwz265 version string +_h_dll_export const char *wz265_version_str(void); + +#if defined(__cplusplus) +} +#endif //__cplusplus + +#endif diff --git a/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Headers/wz265enc.h b/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Headers/wz265enc.h new file mode 100644 index 0000000..e40da72 --- /dev/null +++ b/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Headers/wz265enc.h @@ -0,0 +1,413 @@ +/////////////////////////////////////////////////// +// +// Visionular H265 Codec Library +// +// Copyright(c) visionular Inc. +// https://www.visionular.com/ +// +/////////////////////////////////////////////////// +#ifndef _WZ265_ENCODER_INTERFACE_H_ +#define _WZ265_ENCODER_INTERFACE_H_ + +#include "wz265def.h" +// **************************************** +// base configuration +// **************************************** +#define WZ265PRESET_ULTRAFAST 0 +#define WZ265PRESET_SUPERFAST 1 +#define WZ265PRESET_VERYFAST 2 +#define WZ265PRESET_FASTER 3 +#define WZ265PRESET_FAST 4 +#define WZ265PRESET_MEDIUM 5 +#define WZ265PRESET_SLOW 6 +#define WZ265PRESET_SLOWER 7 +#define WZ265PRESET_VERYSLOW 8 +#define WZ265PRESET_SUPERSLOW 9 +#define WZ265PRESET_PLACEBO 10 + +/* WZ265 tuning types: Multiple tunings can be combined by "|" + e.g., WZ265_TUNE_SSIM | WZ265_TUNE_SCREEN */ +#define WZ265_TUNE_DEFAULT 0x0000 +#define WZ265_TUNE_SSIM 0x0001 +#define WZ265_TUNE_VMAF 0x0002 +#define WZ265_TUNE_SCREEN 0x0004 +#define WZ265_TUNE_MOVIE 0x0008 +#define WZ265_TUNE_GAME 0x0010 +#define WZ265_TUNE_ZEROLATENCY 0x0020 +#define WZ265_TUNE_UNIVERSE 0x0080 + +typedef enum WZ265_RC_TYPE { + WZ265_RC_QUALITY = -1, + WZ265_RC_CQP = 0, + WZ265_RC_CRF = 1, + WZ265_RC_ABR = 2, + WZ265_RC_CBR = 3, + WZ265_RC_MAX = WZ265_RC_CBR +} WZ265_RC_TYPE; + +typedef enum WZ265_WAVEFRONT_TYPE { + WZ265_WPP_DISABLE = 0, + WZ265_WPP_ALL = 1, + WZ265_WPP_RDO_ONLY = 2, +} WZ265_WAVEFRONT_TYPE; + +typedef enum WZ265_INPUT_CSP { + WZ265_CSP_DEFAULT, /*read from input file , otherwise use WZ265_CSP_I420 */ + WZ265_CSP_I420, /* yuv 4:2:0 planar */ + WZ265_CSP_YV12, /* yvu 4:2:0 planar */ + WZ265_CSP_NV12, /* yuv 4:2:0, with one y plane and one packed u+v per pixel */ + WZ265_CSP_NV21, /* yuv 4:2:0, with one y plane and one packed v+u per pixel */ + WZ265_CSP_ANDROID420, /* yuv 4:2:0, with one y plane and packed u+v per line */ + WZ265_CSP_YUY2, /* yuv 4:2:2, packed Y0 U0 Y1 V1*/ + WZ265_CSP_P010, /* yuv 4:2:0, planar , 10bit */ + WZ265_CSP_P012, /* yuv 4:2:0, planar , 12bit */ + WZ265_CSP_P016, /* yuv 4:2:0, planar, 16bit */ + WZ265_CSP_P210, /* yuv 4:2:2, planar, 10 bit */ + WZ265_CSP_P212, /* yuv 4:2:2, planar, 12 bit */ + WZ265_CSP_Y210, /* yuv 4:2:2, packed, 10 bit */ + WZ265_CSP_Y212, /* yuv 4:2:2, packed, 12 bit */ + WZ265_CSP_P216, /* yuv 4:2:2, planar, 16bit */ + WZ265_CSP_Y216, /* yuv 4:2:2, packed, 16bit */ + WZ265_CSP_MAX = WZ265_CSP_Y216, + WZ265_CSP_YUYV = WZ265_CSP_YUY2, /* yuv 4:2:2, packed Y0 U0 Y1 V1*/ +} WZ265_INPUT_CSP; + +typedef enum WZ265_REF_MODE { + WZ265_REF_NORMOL = 0, + WZ265_REF_DIST = 1, // prefer short distance reference + WZ265_REF_QUALITY = 2 // prefer high quality reference +} WZ265_REF_MODE; + +static const char *const wz265_video_format_names[] = { "component", "pal", "ntsc", "secam", + "mac", "unknown", 0 }; +static const char *const wz265_fullrange_names[] = { "limited", "full", 0 }; +static const char *const wz265_colourprimaries_names[] = { + "reserved", "bt709", "unknown", "reserved", "bt470m", "bt470bg", "smpte170m", + "smpte240m", "film", "bt2020", "smpte428", "smpte431", "smpte432", 0 +}; +static const char *const wz265_transfer_names[] = { + "reserved", "bt709", "unknown", "reserved", "bt470m", "bt470bg", "smpte170m", + "smpte240m", "linear", "log100", "log316", "iec61966-2-4", "bt1361e", "iec61966-2-1", + "bt2020-10", "bt2020-12", "smpte2084", "smpte428", "arib-std-b67", 0 +}; +static const char *const wz265_colourmatrix_names[] = { + "gbr", "bt709", "unknown", "", "fcc", "bt470bg", "smpte170m", + "smpte240m", "ycgco", "bt2020nc", "bt2020c", "smpte2085", "chroma-derived-nc", "chroma-derived-c", + "ictcp", 0 +}; + +#define WZ265_MAX_PATH_LEN 1024 +#define WZ265_CFG_AUTO_VALUE -1000 +#define WZ265_RTC_MAX_TLAYER_ID 2 +// Base configuration +typedef struct WZ265EncConfig { + void *pAuth; // WZAuth, invalid if don't need aksk auth + int preset; // [7:4] preset-strength, 0-9; [3:0] preset, ultrafast ~ superslow + int tune; // tuning type, combined value + WZ265_INPUT_CSP inputCsp; + int inputBitDepth; // input bit depth + int profileId; // support main profile(1) and main still profile(3) + int levelIdc; // according to resolution + int picWidth; // input frame width + int picHeight; // input frame height + double frameRate; // input frame rate + int internalBitDepth; // internal bit depth + int bHeaderBeforeKeyframe; // output vps,sps,pps before key frame, default 1 + //************************************************************************** + // int type start from here + // These configures = WZ265_CFG_AUTO_VALUE means set by encoder default, otherwise means set by + // users for most configs, < 0 also means auto, but WZ265_CFG_AUTO_VALUE is more secure + //************************************************************************** + int rc; // rc type 0 disable,1 crf,2 abr,3 cbr, default 1 + int b_vfr_input; // VFR(Variable frame rate) input + int bframes; // num of bi-pred frames, -1: using default + int bframesAdapt; + int single_pps; // limit pps to be only one + int rps_prediction; // rps prediction from sps + int temporalLayer; // works with zerolatency, separate P frames into temporal layers, 0 ~ 2 + int bitrateInkbps; // target bit rate in kbps, valid when rctype is cbr abd vbr + int vbv_buffer_size; // buf size of vbv + int vbv_max_rate; // max rate of vbv + int vbv_buffer_debt_frames; // underflow vbvbuffer for rd gian + int qp; // valid when rctype is disable, default 30 + int chroma_qp_offset; // valid range -12..12, default 0, equals to + // pps_cb_qp_offset=pps_cr_qp_offset + int QPDeltaMinAdapt; + int rc_rf_by_fps; // + int rc_sync_dist; // rc sync distance + int keyint_max; // Key-Frame period, 0 = only first, -1 = auto + int keyint_min; // Minimum Period of Key-Frame + int scenecut; // how aggressively to insert extra I frames, 0 - 100 + int qpmin; // minimal qp, valid when rc != 0, 0~51 + int qpmax; // maximal qp, valid when rc != 0, 1~51, qpmax = 0 means 51 + int qpmax_i; // maximal qp for I frames + int rcFrameSkip; // frame skip for rate control. 0: not allowed; > 0: continuious skipped frame + // number + int enable_temporal_filter; + int golden_frame_interval; + int tf_frame_interval; + + //* Execute Properties + int enWavefront; // enable wave front parallel + int enFrameParallel; // enable frame parallel + int ParallelledFrames; // 0 means auto + int enTileParallel; // enable tile parallel, currently, tile parallel CAN'T work together with + // wpp or fpp + int tile_rows; // 0: auto + int tile_columns; // 0: auto + int threads; // number of threads used in encoding ( for wavefront, frame parallel, or both) + int preanalyze_threads; // pre-analyze threads + int log2MaxCtuSize; // log2_min_luma_coding_block_size: 4 ~ 6, default 6 + int lookahead; // lookahead settings + int calcPsnr; // 0:not calc psnr; 1: print total psnr; 2: print each frame + int calcSsim; // calc ssim (0: don't 1: only summary 2: print each frame and summary + int calcVmaf; // 0: don't calc vmaf; 1: print summary; 2: print each frame + int calcTime; // 0: do not print; 1: print maximum ; 2: print each frame + int rdoq; // 1:enabling rdoq + int scalingLists; // 0: off; 1: default + int me; // 0: DIA, 1: HEX, 2: UMH, 3:EPZS, + int part; // 0: 2NX2N 1: NX2N 2NXN NXN + int partchecklevel; + int do64; // 1:enabling 64x64 cu + int tuInter; // inter RQT tu depth, 0~3, -1 means auto + int tuIntra; // intra RQT tu depth, 0~3, -1 means auto + int checkZero; + int smooth; // 1: enabling strong intra smoothing + int transskip; // 1: enabling transform skip + int subme; // 0 : disable; 1 ~ 5: subme levels, default 3,4,5 + int satdInter; // 1:enabling hardmad sad + int satdIntra; // 1:enabling hardmad sad + int searchrange; // search range + int refmode; // defined by WZ265_REF_MODE + int refnum; // reference number + int pRefNum; // pref number + int goldenFrameAsRefFirst; // if 1 first nearest ref, second golden frame. if 0,do not handle + // golden frame special + int sao; // sao enabling, 0: disable; 1:faster; 2: faster; 3: usual; 4:complex + int longTermRef; // 0:disabling longterm reference 1:enable; + int intra32; // 0:disable intra32 + int noiseReduction; // inter noise reduction strength + int weightp; // Enable weighted prediction in P slices + int weightb; // Enable weighted prediction in B slices + int iAqMode; // adaptive quantization 0~6, 0: disable, 1: variance; 4: fine variance (default), 6 + // - activity equal to max var of subblocks + int log2AqBlockSize; // adaptive quantization block size, 4-6 + int log2QGroupSize; // quantization group size (4-6, must less than maxcusize) + int psyRdType; // 0: default, 1: optional + int crfAdaptByQuality; // CRF adapt by quality, 0: auto; 1: adapt by PSNR; 2: adapt by Vmaf + // without motion + int head_thr; // the threshold of duration (s) to set crf of front frames + int head_ratio; // 1/head_ratio is the proportion of front frames + int opengop; // enable RASL for CRA, default 1; If opengop = 0, CRA acts like IDR + int extra_opts; // extra speedup optimization for huya original painting scenario + int reduceCplxByTool; // level of reduce complexity burst by tools + int cplxFrameSkip; // frame skip to reduce complexity + //* vui_parameters + // vui_parameters_present_flag set to 1 specifies that the vui_parameters() syntax in struct vui + // must be set by usr + int vui_parameters_present_flag; + int accessUnitDelimitersPresent; + int doviProfile; // dolby vision profile 50, 81, 82, 84, + int visual_opt; // enable visual-opt, default 1, 0 ~ 2 + //===================================== + //====== int type end ======= + //===================================== + + //*************************************************************************** + // double type start from here + // These configures = WZ265_CFG_AUTO_VALUE means set by encoder default, otherwise means set by + // users + //*************************************************************************** + double crf; // valid when rctype is crf, default 30 + double quality; // valid when rctype is quality, default -1 + double keyint_t; // I-Frame period by time (s), -1 = not work, default -1 + double keyint_first; // first GOP period by time (s), -1 = not work, default -1 + double ipratio; + double iboost; + double qcompCutree; + double shortLoadingForPlayer; // reduce b frames after I frame, for shorting the loading time of + // VOD for some players + double fRateTolerance; // default 2.0f,0.5 is suitable to reduce the largest bitrate, and 0.1 is + // to make the bitrate stable + double fAqStrength; // strength of adaptive quantizaiton, 0~3.0, default 0.7 + double fAqSmooth; // strength of adaptive quantizaiton for smooth area, 0~3.0, default 0.7 + double fAqWeight; // weight of aq-mode 1 and 4; or aq-mode 2 and 4 + double roiDeltaQp; // roi region delta qp ratio, default 1.0 + double intra32pen; // penalty on intra32x32 when intra32 is set + double psyRd; // psy-rd strength, 0 ~ 1.0 + double psyRdUV; + double psyIframe; // psy limit for I frame + double qualityLevel; // for PSNR(dB); for Vmaf(score) + double qualityRange; // adapt when quality > qualityLevel + qualityRange, for PSNR(dB); + double head_crf; // set crf of front frames when video is long + double qualitySmooth; + double reduceCplxByQP; // reduce complexity burst by QP, default 0. It's for special case + double duration; // the duration (s) of the video + //===================================== + //====== double type end ======= + //===================================== + + // VUI and SEI metadata (HDR releated) + vui_parameters vui; + /* SMPTE ST 2086 mastering display color volume SEI info, + * A string with format "master-display=Y(%hu,%hu)U(%hu,%hu)V(%hu,%hu)WP(%hu,%hu)L(%u,%u)" + * where %hu are unsigned 16bit integers and %u are unsigned 32bit integers, + * can be parsed by WZ265ConfigParse */ + mastering_display_colour_volume_sei masteringDisplayColorVolume; + int masteringDisplayPresent; // 1: masteringDisplayColorVolume will be write to SEI nal + /* CEA 861.3, Content light level information SEI info, + * A string with format "max-cll=%hu,%hu" , can be parsed by WZ265ConfigParse*/ + content_light_level_info_sei contentLightLevel; + int contentLightLevelPresent; // 1: contentLightLevel will be write to SEI nal + + ambient_viewing_environment_sei ambientViewEnvironment; + int ambientViewEnvironmentPresent; + + buffering_period_sei bufferingPeriod; + + // For Multi pass + int iPass; // Multi pass rate control, 0:disable(default); 1: first pass; 2: second pass + char statFileInName[256]; // log file produced from first pass, set by user + char statFileOutName[256]; // log file produced from first pass, set by user + // For debug + char dumpYuvFile[WZ265_MAX_PATH_LEN]; + char dumpSrcFile[WZ265_MAX_PATH_LEN]; + char dumpBsFile[WZ265_MAX_PATH_LEN]; + int logLevel; // log level (-1: dbg; 0: info; 1:warn; 2:err; 3:fatal) +} WZ265EncConfig; + +// input frame data and info +typedef struct WZ265YUV { + int iWidth; // input frame width + int iHeight; // input frame height + int iBitDepth; // input YUV bit depth (8, 10, 12) + void *pData[3]; // input frame Y U V + int iStride[3]; // stride for Y U V +} WZ265YUV; + +// input frame data and info +typedef struct WZ265Picture { + int iSliceType; // specified by output pictures + int poc; // ignored on input + long long pts; + long long dts; + WZ265YUV *yuv; + // for input, custom decide which ref can be used as reference,if not used, make sure it is + // zero!!! + // if there is no matched poc in DPB ,encoder will ignore this!! + // if this setting is valid, other reference in DPB will be cleaned + int forceRefNum; + int forceRefPoc[8]; + /* User defined SEI */ + WZ265SEI userSEI; + /* Dobly Vision Rpu metadata */ + WZ265DoviRpu doviRpu; + + // for output, + double psnr[3]; // Out: PSNR of Y, U, and V (if calcPsnr is set) + double frameAvgQp; + // preset current DPB picture poc + int curDPBRefNum; + int dpbRefPoc[8]; + void *roi; +} WZ265Picture; + +typedef struct WZ265Nal { + int naltype; + int tid; + int iSize; + long long pts; + unsigned char *pPayload; +} WZ265Nal; + +#if defined(__cplusplus) +extern "C" { +#endif //__cplusplus +/** + * Create encoder + * + * @param pCfg : base config of encoder + * @param errorCode : error code + * @return encoder handle + */ +_h_dll_export void *wz265_encoder_open(WZ265EncConfig *pCfg, int *errorCode); + +/** + * Close and destroy encoder + * + * @param pEncoder : encoder handle + */ +_h_dll_export void wz265_encoder_close(void *pEncoder); + +/** + * Reconfig encoder + * + * @param pEncoder encoder handle + * @param pCfg new base config + */ +_h_dll_export void wz265_encoder_reconfig(void *pEncoder, WZ265EncConfig *pCfg); + +/** + * Produce video header nals(VPS,SPS,PPS) + * + * @param pEncoder encoder handle + * @param pNals header nals that will be used for the following stream + * @param iNalCount number of nals + * @return if succeed, return 0; if failed, return the error code + */ +_h_dll_export int wz265_encode_headers(void *pEncoder, WZ265Nal **pNals, int *iNalCount); + +/** + * Encode one frame + * + * @param pEncoder handle of encoder + * @param pNals pointer array of output wz265NAL units + * @param iNalCount output wz265NAL unit count + * @param pInpic input frame + * @param pOutpic output frame + * @return if succeed, return 0; if failed, return the error code + */ +_h_dll_export int wz265_encoder_frame(void *pEncoder, WZ265Nal **pNals, int *iNalCount, + WZ265Picture *pInpic, WZ265Picture *pOutpic); + +/** + * Request encoder to encode next frame as Key Frame + * + * @param pEncoder encoder handle + */ +_h_dll_export void wz265_keyframe_request(void *pEncoder); + +/** + * Query buffered frames in encoder + * + * @param pEncoder encoder handle + @return Number of buffered frames in encoder + */ +_h_dll_export int wz265_encoder_delayed_frames(void *pEncoder); +/* clang-format off */ + +/* preset can be further set by preset-strength by a delimiter in ",./-+", + e.g, "veryfast-5" or "medium-0", + valid preset-strength ranged in 0-9, "medium-0" is same to "medium", + larger preset-strength means speed down for better RD quality. +*/ +static const char *const wz265_preset_names[] = { "ultrafast", "superfast", 0 }; +/* Multiple tunings can be used if separated by a delimiter in ",./-+", + e.g., "ssim,screen" or "ssim/screen" */ +static const char *const wz265_tunes_names[] = { "default", "ssim", "vmaf", + "screen", "movie", "game", + "zerolatency", "universe", 0 }; +/* clang-format on */ +// Get default config values by preset, tune and latency. enum format +_h_dll_export int wz265_param_default(WZ265EncConfig *pConfig, int preset, int tune); + +// Get default config values by preset, tune and latency. string format +_h_dll_export int wz265_param_default_preset(WZ265EncConfig *pConfig, const char *preset, + const char *tune); +// Parse name,value paire and set into WZ265EncConfig +_h_dll_export int WZ265ConfigParse(WZ265EncConfig *p, const char *name, const char *value); +#if defined(__cplusplus) +} +#endif //__cplusplus + +#endif diff --git a/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Info.plist b/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Info.plist new file mode 100644 index 0000000..8e27fc5 --- /dev/null +++ b/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + video_enc + CFBundleIdentifier + com.videoenc + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + video_enc + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.3.60 + CFBundleVersion + 1.3.60 + MinimumOSVersion + 9.0 + + diff --git a/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/video_enc b/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/video_enc new file mode 100644 index 0000000..fc03f5a Binary files /dev/null and b/Sources/video_enc.xcframework/ios-arm64_x86_64-simulator/video_enc.framework/video_enc differ