diff --git a/Agora-Unreal-SDK-Blueprint-Example/Config/DefaultEngine.ini b/Agora-Unreal-SDK-Blueprint-Example/Config/DefaultEngine.ini index 74aa117e..5368cf4d 100644 --- a/Agora-Unreal-SDK-Blueprint-Example/Config/DefaultEngine.ini +++ b/Agora-Unreal-SDK-Blueprint-Example/Config/DefaultEngine.ini @@ -1,9 +1,5 @@ -[/Script/EngineSettings.GameMapsSettings] -GameDefaultMap=/Game/API-Example/MainLevel.MainLevel -EditorStartupMap=/Game/API-Example/MainLevel.MainLevel - [/Script/HardwareTargeting.HardwareTargetingSettings] TargetedHardwareClass=Desktop AppliedTargetedHardwareClass=Desktop @@ -11,14 +7,28 @@ DefaultGraphicsPerformance=Maximum AppliedDefaultGraphicsPerformance=Maximum [/Script/Engine.Engine] -+ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/AgoraExample") -+ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/AgoraExample") -+ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="AgoraExampleGameModeBase") ++ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/AgoraBPExample") ++ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/AgoraBPExample") ++ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="AgoraBPExampleGameModeBase") + +[/Script/EngineSettings.GameMapsSettings] +EditorStartupMap=/Game/API-Example/MainLevel.MainLevel +GameDefaultMap=/Game/API-Example/MainLevel.MainLevel + +[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings] +MinSDKVersion=24 +bBuildForArmV7=True +bBuildForArm64=True +bPackageDataInsideApk=True + +[/Script/IOSRuntimeSettings.IOSRuntimeSettings] +AdditionalPlistData=NSCameraUsageDescriptionAgoraVideoCallNSMicrophoneUsageDescriptionAgoraVideoCall +bEnableBackgroundFetch=True [/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings] bEnablePlugin=True bAllowNetworkConnection=True -SecurityToken=990A8E7B43F2575DE5F30FB114408D3D +SecurityToken=4E62204D4FB335FC140092A4A916430C bIncludeInShipping=False bAllowExternalStartInShipping=False bCompileAFSProject=False @@ -29,127 +39,3 @@ ConnectionType=USBOnly bUseManualIPAddress=False ManualIPAddress= -[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings] -PackageName=com.agora.example -StoreVersion=1 -StoreVersionOffsetArmV7=0 -StoreVersionOffsetArm64=0 -StoreVersionOffsetX8664=0 -ApplicationDisplayName= -VersionDisplayName=1.0 -MinSDKVersion=21 -TargetSDKVersion=30 -InstallLocation=InternalOnly -bEnableGradle=True -bEnableLint=False -bPackageDataInsideApk=True -bCreateAllPlatformsInstall=False -bDisableVerifyOBBOnStartUp=False -bForceSmallOBBFiles=False -bAllowLargeOBBFiles=False -bAllowPatchOBBFile=False -bAllowOverflowOBBFiles=False -bUseExternalFilesDir=False -bPublicLogFiles=True -Orientation=SensorLandscape -MaxAspectRatio=2.100000 -bUseDisplayCutout=False -bRestoreNotificationsOnReboot=False -bFullScreen=True -bEnableNewKeyboard=True -DepthBufferPreference=Default -bValidateTextureFormats=True -bEnableBundle=False -bEnableUniversalAPK=True -bBundleABISplit=True -bBundleLanguageSplit=True -bBundleDensitySplit=True -ExtraApplicationSettings= -ExtraActivitySettings= -+ExtraPermissions=android.permission.WRITE_EXTERNAL_STORAGE -+ExtraPermissions=android.permission.READ_EXTERNAL_STORAGE -+ExtraPermissions=android.permission.QUERY_ALL_PACKAGES -bAndroidVoiceEnabled=False -bRemoveOSIG=False -+GoogleVRCaps=Daydream33 -bGoogleVRSustainedPerformance=False -KeyStore= -KeyAlias= -KeyStorePassword= -KeyPassword= -bBuildForArmV7=False -bBuildForArm64=True -bBuildForX8664=False -bBuildForES31=True -bSupportsVulkan=False -bSupportsVulkanSM5=False -ClangSanitizer=None -bAndroidOpenGLSupportsBackbufferSampling=False -bDetectVulkanByDefault=True -bBuildWithHiddenSymbolVisibility=False -bSaveSymbols=True -bForceLDLinker=False -bEnableGooglePlaySupport=False -bUseGetAccounts=False -GamesAppID= -bEnableSnapshots=False -bSupportAdMob=True -AdMobAdUnitID= -GooglePlayLicenseKey= -GCMClientSenderID= -bShowLaunchImage=True -bAllowIMU=False -bAllowControllers=True -bBlockAndroidKeysOnControllers=False -bControllersBlockDeviceFeedback=False -AndroidAudio=Default -AudioSampleRate=44100 -AudioCallbackBufferFrameSize=1024 -AudioNumBuffersToEnqueue=4 -AudioMaxChannels=0 -AudioNumSourceWorkers=0 -SpatializationPlugin= -ReverbPlugin= -OcclusionPlugin= -CompressionOverrides=(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0) -bUseAudioStreamCaching=False -CacheSizeKB=0 -MaxChunkSizeOverrideKB=0 -bResampleForDevice=False -SoundCueCookQualityIndex=-1 -MaxSampleRate=0.000000 -HighSampleRate=0.000000 -MedSampleRate=0.000000 -LowSampleRate=0.000000 -MinSampleRate=0.000000 -CompressionQualityModifier=0.000000 -AutoStreamingThreshold=0.000000 -AndroidGraphicsDebugger=None -MaliGraphicsDebuggerPath=(Path="") -bEnableMaliPerfCounters=False -bMultiTargetFormat_ETC2=True -bMultiTargetFormat_DXT=True -bMultiTargetFormat_ASTC=True -TextureFormatPriority_ETC2=0.200000 -TextureFormatPriority_DXT=0.600000 -TextureFormatPriority_ASTC=0.900000 -SDKAPILevelOverride= -NDKAPILevelOverride= -bStreamLandscapeMeshLODs=False -bEnableDomStorage=False - -[/Script/LuminRuntimeSettings.LuminRuntimeSettings] -IconModelPath=(Path="") -IconPortalPath=(Path="") - -[/Script/UnrealEd.CookerSettings] -bCookOnTheFlyForLaunchOn=False - -[/Script/Engine.UserInterfaceSettings] -UIScaleRule=ScaleToFit -bAllowHighDPIInGameMode=True - -[/Script/IOSRuntimeSettings.IOSRuntimeSettings] -AdditionalPlistData=NSCameraUsageDescriptionAgoraVideoCallNSMicrophoneUsageDescriptionAgoraVideoCall -bEnableBackgroundFetch=True - diff --git a/Agora-Unreal-SDK-Blueprint-Example/Config/DefaultGame.ini b/Agora-Unreal-SDK-Blueprint-Example/Config/DefaultGame.ini index c27deddf..b83b2250 100644 --- a/Agora-Unreal-SDK-Blueprint-Example/Config/DefaultGame.ini +++ b/Agora-Unreal-SDK-Blueprint-Example/Config/DefaultGame.ini @@ -1,115 +1,3 @@ - [/Script/EngineSettings.GeneralProjectSettings] -CompanyName=Agora.IO -CompanyDistinguishedName= -CopyrightNotice=Fill out your copyright notice in the Description page of Project Settings. -Description= -Homepage= -LicensingTerms= -PrivacyPolicy= -ProjectID=F28DD96CA944005A448A628C8CED523A -ProjectName= -ProjectVersion=1.0.0.0 -SupportContact= -ProjectDisplayedTitle= -ProjectDebugTitleInfo= -bShouldWindowPreserveAspectRatio=True -bUseBorderlessWindow=False -bStartInVR=False -bAllowWindowResize=False -bAllowClose=True -bAllowMaximize=True -bAllowMinimize=True - -[/Script/MoviePlayer.MoviePlayerSettings] -bWaitForMoviesToComplete=False -bMoviesAreSkippable=False - -[/Script/UnrealEd.ProjectPackagingSettings] -Build=IfProjectHasCode -BuildConfiguration=PPBC_Development -BuildTarget= -StagingDirectory=(Path="D:/Build/UEbuild/9.8.22") -FullRebuild=False -ForDistribution=False -IncludeDebugFiles=False -BlueprintNativizationMethod=Disabled -bIncludeNativizedAssetsInProjectGeneration=False -bExcludeMonolithicEngineHeadersInNativizedCode=False -UsePakFile=True -bUseIoStore=False -bMakeBinaryConfig=False -bGenerateChunks=False -bGenerateNoChunks=False -bChunkHardReferencesOnly=False -bForceOneChunkPerFile=False -MaxChunkSize=0 -bBuildHttpChunkInstallData=False -HttpChunkInstallDataDirectory=(Path="") -bCompressed=True -PakFileCompressionFormats=Oodle -bForceUseProjectCompressionFormatIgnoreHardwareOverride=False -PakFileAdditionalCompressionOptions=-compressionblocksize=256KB -PakFileCompressionMethod=Kraken -PakFileCompressionLevel_DebugDevelopment=3 -PakFileCompressionLevel_TestShipping=5 -PakFileCompressionLevel_Distribution=7 -HttpChunkInstallDataVersion= -IncludePrerequisites=True -IncludeAppLocalPrerequisites=False -bShareMaterialShaderCode=True -bDeterministicShaderCodeOrder=False -bSharedMaterialNativeLibraries=True -ApplocalPrerequisitesDirectory=(Path="") -IncludeCrashReporter=False -InternationalizationPreset=English --CulturesToStage=en -+CulturesToStage=en -LocalizationTargetCatchAllChunkId=0 -bCookAll=False -bCookMapsOnly=False -bSkipEditorContent=False -bSkipMovies=False --IniKeyBlacklist=KeyStorePassword --IniKeyBlacklist=KeyPassword --IniKeyBlacklist=rsa.privateexp --IniKeyBlacklist=rsa.modulus --IniKeyBlacklist=rsa.publicexp --IniKeyBlacklist=aes.key --IniKeyBlacklist=SigningPublicExponent --IniKeyBlacklist=SigningModulus --IniKeyBlacklist=SigningPrivateExponent --IniKeyBlacklist=EncryptionKey --IniKeyBlacklist=IniKeyBlacklist --IniKeyBlacklist=IniSectionBlacklist -+IniKeyBlacklist=KeyStorePassword -+IniKeyBlacklist=KeyPassword -+IniKeyBlacklist=rsa.privateexp -+IniKeyBlacklist=rsa.modulus -+IniKeyBlacklist=rsa.publicexp -+IniKeyBlacklist=aes.key -+IniKeyBlacklist=SigningPublicExponent -+IniKeyBlacklist=SigningModulus -+IniKeyBlacklist=SigningPrivateExponent -+IniKeyBlacklist=EncryptionKey -+IniKeyBlacklist=IniKeyBlacklist -+IniKeyBlacklist=IniSectionBlacklist -+DirectoriesToAlwaysStageAsUFS=(Path="Movies") -+DirectoriesToAlwaysStageAsUFS=(Path="Audio") -+DirectoriesToAlwaysStageAsUFS=(Path="Image") -+DirectoriesToAlwaysStageAsNonUFS=(Path="Movies") -+DirectoriesToAlwaysStageAsNonUFS=(Path="Audio") -+DirectoriesToAlwaysStageAsNonUFS=(Path="Image") - -[/Script/Engine.AssetManagerSettings] --PrimaryAssetTypesToScan=(PrimaryAssetType="Map",AssetBaseClass=/Script/Engine.World,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game/Maps")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown)) --PrimaryAssetTypesToScan=(PrimaryAssetType="PrimaryAssetLabel",AssetBaseClass=/Script/Engine.PrimaryAssetLabel,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown)) -+PrimaryAssetTypesToScan=(PrimaryAssetType="Map",AssetBaseClass=/Script/Engine.World,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game/Maps")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown)) -+PrimaryAssetTypesToScan=(PrimaryAssetType="PrimaryAssetLabel",AssetBaseClass=/Script/Engine.PrimaryAssetLabel,bHasBlueprintClasses=False,bIsEditorOnly=True,Directories=((Path="/Game")),SpecificAssets=,Rules=(Priority=-1,ChunkId=-1,bApplyRecursively=True,CookRule=Unknown)) -bOnlyCookProductionAssets=False -bShouldManagerDetermineTypeAndName=False -bShouldGuessTypeAndNameInEditor=True -bShouldAcquireMissingChunksOnLoad=False -MetaDataTagsForAssetRegistry=() - +ProjectID=7F03214342F10C46757B378800C62811 diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/DeviceManager/DeviceManager.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/DeviceManager/DeviceManager.umap new file mode 100644 index 00000000..fd395cdc Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/DeviceManager/DeviceManager.umap differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/DeviceManager/WBP_DeviceManager.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/DeviceManager/WBP_DeviceManager.uasset new file mode 100644 index 00000000..b691e225 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/DeviceManager/WBP_DeviceManager.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaObserverCBExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaObserverCBExecutor.uasset new file mode 100644 index 00000000..31b128c4 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaObserverCBExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaPlayerCBExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaPlayerCBExecutor.uasset new file mode 100644 index 00000000..489574a6 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaPlayerCBExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaPlayerRTCCBExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaPlayerRTCCBExecutor.uasset new file mode 100644 index 00000000..60175575 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/BP_MediaPlayerRTCCBExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/MediaPlayer.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/MediaPlayer.umap new file mode 100644 index 00000000..26088b8e Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/MediaPlayer.umap differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/WBP_MediaPlayer.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/WBP_MediaPlayer.uasset new file mode 100644 index 00000000..cb71db79 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/MediaPlayer/WBP_MediaPlayer.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/BP_ScreenShare.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/BP_ScreenShare.uasset deleted file mode 100644 index 0cc32bd9..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/BP_ScreenShare.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/BP_ScreenShareVideoCBExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/BP_ScreenShareVideoCBExecutor.uasset new file mode 100644 index 00000000..d9259bb1 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/BP_ScreenShareVideoCBExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/ScreenShare.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/ScreenShare.umap index a238b9bf..15d30862 100644 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/ScreenShare.umap and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/ScreenShare.umap differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/WBP_ScreenShare.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/WBP_ScreenShare.uasset new file mode 100644 index 00000000..8deb6acf Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShare/WBP_ScreenShare.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/BP_ScreenShareWhileVideoCall.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/BP_ScreenShareWhileVideoCall.uasset deleted file mode 100644 index a3cf81e6..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/BP_ScreenShareWhileVideoCall.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/BP_ScreenShareWhileVideoCallVideoCBExExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/BP_ScreenShareWhileVideoCallVideoCBExExecutor.uasset new file mode 100644 index 00000000..28c53f16 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/BP_ScreenShareWhileVideoCallVideoCBExExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/ScreenShareWhileVideoCall.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/ScreenShareWhileVideoCall.umap index 8361e329..e2b5b488 100644 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/ScreenShareWhileVideoCall.umap and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/ScreenShareWhileVideoCall.umap differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/WBP_ScreenShareWhileVideoCall.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/WBP_ScreenShareWhileVideoCall.uasset new file mode 100644 index 00000000..d2d380e4 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/ScreenShareWhileVideoCall/WBP_ScreenShareWhileVideoCall.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/BP_EncryptionCBExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/BP_EncryptionCBExecutor.uasset new file mode 100644 index 00000000..a751fe9b Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/BP_EncryptionCBExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/EncyptionSample.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/EncyptionSample.umap new file mode 100644 index 00000000..75471b99 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/EncyptionSample.umap differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/WBP_EncrptionWidget.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/WBP_EncrptionWidget.uasset new file mode 100644 index 00000000..aae26acd Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Advance/SetEncryption/WBP_EncrptionWidget.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/AgoraConfig.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/AgoraConfig.uasset deleted file mode 100644 index 38407734..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/AgoraConfig.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/AgoraSaveData.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/AgoraSaveData.uasset new file mode 100644 index 00000000..200b1c8c Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/AgoraSaveData.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/BP_AgoraEntry.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/BP_AgoraEntry.uasset deleted file mode 100644 index 2e37f565..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/BP_AgoraEntry.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/BP_MainWidget.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/BP_MainWidget.uasset deleted file mode 100644 index 58da29cb..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/BP_MainWidget.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/AgoraConfig.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/AgoraConfig.uasset deleted file mode 100644 index b353823f..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/AgoraConfig.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioCBExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioCBExecutor.uasset new file mode 100644 index 00000000..9e6fa9ed Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioCBExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioWidget.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioWidget.uasset deleted file mode 100644 index 6b757043..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioWidget.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_CBExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_CBExecutor.uasset new file mode 100644 index 00000000..30b96213 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BP_CBExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BasicAudioCallScene.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BasicAudioCallScene.umap index 54f5486d..02b68619 100644 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BasicAudioCallScene.umap and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/BasicAudioCallScene.umap differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/WBP_AudioWidget.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/WBP_AudioWidget.uasset new file mode 100644 index 00000000..8244398b Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio/WBP_AudioWidget.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BP_VideoCBExecutor.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BP_VideoCBExecutor.uasset new file mode 100644 index 00000000..e2bd069a Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BP_VideoCBExecutor.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BP_VideoWidget.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BP_VideoWidget.uasset deleted file mode 100644 index 4b88787a..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BP_VideoWidget.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BasicVideoCallScene.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BasicVideoCallScene.umap index 9cf5a799..23a003b6 100644 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BasicVideoCallScene.umap and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/BasicVideoCallScene.umap differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/WBP_VideoWidget.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/WBP_VideoWidget.uasset new file mode 100644 index 00000000..829aeea4 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelVideo/WBP_VideoWidget.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/MainLevel.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/MainLevel.umap deleted file mode 100644 index 3469e037..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/MainLevel.umap and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/HelperFunctionLibrary/BFL_SaveGameHelper.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/HelperFunctionLibrary/BFL_SaveGameHelper.uasset new file mode 100644 index 00000000..c592f3b3 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/HelperFunctionLibrary/BFL_SaveGameHelper.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/HelperFunctionLibrary/BFL_Utility.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/HelperFunctionLibrary/BFL_Utility.uasset new file mode 100644 index 00000000..6f7dba65 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/HelperFunctionLibrary/BFL_Utility.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/LevelSwitchItem.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/LevelSwitchItem.uasset deleted file mode 100644 index 1711d6fa..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/LevelSwitchItem.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/MainLevel.umap b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/MainLevel.umap index 4c774552..35ba1f31 100644 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/MainLevel.umap and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/MainLevel.umap differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/MainWidget.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/MainWidget.uasset deleted file mode 100644 index 2f026524..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/MainWidget.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Material/M_Background.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Material/M_Background.uasset deleted file mode 100644 index c8a70418..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Material/M_Background.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Materials/M_Background.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Materials/M_Background.uasset new file mode 100644 index 00000000..bd05124b Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Materials/M_Background.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Materials/M_GeneralButton_Normal.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Materials/M_GeneralButton_Normal.uasset new file mode 100644 index 00000000..36f3e03a Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Materials/M_GeneralButton_Normal.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/OneExampleEntryItemData.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/OneExampleEntryItemData.uasset new file mode 100644 index 00000000..79dc8ced Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/OneExampleEntryItemData.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BFL_Logger.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BFL_Logger.uasset deleted file mode 100644 index cfe10fc1..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BFL_Logger.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BFL_VideoViewManager.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BFL_VideoViewManager.uasset deleted file mode 100644 index 22a59376..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BFL_VideoViewManager.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BP_DraggableImage.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BP_DraggableImage.uasset deleted file mode 100644 index 6ab25c20..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BP_DraggableImage.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BP_WidgetDragOP.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BP_WidgetDragOP.uasset deleted file mode 100644 index c126267a..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/BP_WidgetDragOP.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/FVideoViewIdentity.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/FVideoViewIdentity.uasset deleted file mode 100644 index 395d1e5f..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/FVideoViewIdentity.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/WBP_DraggableVideoView.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/WBP_DraggableVideoView.uasset deleted file mode 100644 index b7f157f2..00000000 Binary files a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Utility/WBP_DraggableVideoView.uasset and /dev/null differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/BFL_VideoManager.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/BFL_VideoManager.uasset new file mode 100644 index 00000000..4077cc77 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/BFL_VideoManager.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/BP_WidgetDragOp.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/BP_WidgetDragOp.uasset new file mode 100644 index 00000000..23174cfe Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/BP_WidgetDragOp.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/VideoFrameId.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/VideoFrameId.uasset new file mode 100644 index 00000000..5477c312 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/VideoFrameId.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/WBP_DraggableVideoView.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/WBP_DraggableVideoView.uasset new file mode 100644 index 00000000..a82436b7 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/VideoUtilityFunctionLibrary/WBP_DraggableVideoView.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/WBP_MainWidget.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/WBP_MainWidget.uasset new file mode 100644 index 00000000..1f436fe7 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/WBP_MainWidget.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/WBP_OneExampleEntry.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/WBP_OneExampleEntry.uasset new file mode 100644 index 00000000..3219e80a Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/WBP_OneExampleEntry.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/Agora.io-Interactions.wav b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/Agora.io-Interactions.wav new file mode 100644 index 00000000..e28f48b3 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/Agora.io-Interactions.wav differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/Agora_io-Interactions.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/Agora_io-Interactions.uasset new file mode 100644 index 00000000..a7b442f4 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/Agora_io-Interactions.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/SC_File.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/SC_File.uasset new file mode 100644 index 00000000..95e05dd0 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/SC_File.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/ding.mp3 b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/ding.mp3 new file mode 100644 index 00000000..1e309e18 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/ding.mp3 differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/dong.mp3 b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/dong.mp3 new file mode 100644 index 00000000..777246ef Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Audio/dong.mp3 differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Image/gif.gif b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/gif.gif new file mode 100644 index 00000000..a7176045 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/gif.gif differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Image/jpg.jpg b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/jpg.jpg new file mode 100644 index 00000000..8bb8f461 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/jpg.jpg differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Image/jpg.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/jpg.uasset new file mode 100644 index 00000000..16aa1af6 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/jpg.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Image/png.png b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/png.png new file mode 100644 index 00000000..b4058948 Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/png.png differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Content/Image/png.uasset b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/png.uasset new file mode 100644 index 00000000..e0ab35bf Binary files /dev/null and b/Agora-Unreal-SDK-Blueprint-Example/Content/Image/png.uasset differ diff --git a/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample.Target.cs b/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample.Target.cs index 4f9d1a76..72b110e6 100644 --- a/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample.Target.cs +++ b/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample.Target.cs @@ -8,7 +8,7 @@ public class AgoraBPExampleTarget : TargetRules public AgoraBPExampleTarget( TargetInfo Target) : base(Target) { Type = TargetType.Game; - DefaultBuildSettings = BuildSettingsVersion.V2; + DefaultBuildSettings = BuildSettingsVersion.Latest; if (Target.Platform == UnrealTargetPlatform.IOS) { bOverrideBuildEnvironment = true; diff --git a/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample/AgoraBPExample.Build.cs b/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample/AgoraBPExample.Build.cs index d18152d7..cd598eb0 100644 --- a/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample/AgoraBPExample.Build.cs +++ b/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample/AgoraBPExample.Build.cs @@ -10,7 +10,7 @@ public AgoraBPExample(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore","UMG"}); PrivateDependencyModuleNames.AddRange(new string[] { }); diff --git a/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample/BFL_UtilityTool.cpp b/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample/BFL_UtilityTool.cpp index ed24624c..88474300 100644 --- a/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample/BFL_UtilityTool.cpp +++ b/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample/BFL_UtilityTool.cpp @@ -7,6 +7,8 @@ bool UBFL_UtilityTool::IsAgoraAudioOnlySDK() { #if AGORA_UESDK_AUDIO_ONLY return true; -#endif +#else return false; +#endif + } diff --git a/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExampleEditor.Target.cs b/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExampleEditor.Target.cs index ec7fb2ea..27cf6812 100644 --- a/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExampleEditor.Target.cs +++ b/Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExampleEditor.Target.cs @@ -8,7 +8,7 @@ public class AgoraBPExampleEditorTarget : TargetRules public AgoraBPExampleEditorTarget( TargetInfo Target) : base(Target) { Type = TargetType.Editor; - DefaultBuildSettings = BuildSettingsVersion.V2; + DefaultBuildSettings = BuildSettingsVersion.Latest; ExtraModuleNames.AddRange( new string[] { "AgoraBPExample" } ); if (Target.Platform == UnrealTargetPlatform.IOS || Target.Platform == UnrealTargetPlatform.Mac) diff --git a/Agora-Unreal-SDK-CPP-Example/Config/DefaultEngine.ini b/Agora-Unreal-SDK-CPP-Example/Config/DefaultEngine.ini index fadc793d..2546f6bf 100644 --- a/Agora-Unreal-SDK-CPP-Example/Config/DefaultEngine.ini +++ b/Agora-Unreal-SDK-CPP-Example/Config/DefaultEngine.ini @@ -40,7 +40,7 @@ StoreVersionOffsetArm64=0 StoreVersionOffsetX8664=0 ApplicationDisplayName= VersionDisplayName=1.0 -MinSDKVersion=21 +MinSDKVersion=24 TargetSDKVersion=30 InstallLocation=InternalOnly bEnableGradle=True diff --git a/Agora-Unreal-SDK-CPP-Example/Config/DefaultGame.ini b/Agora-Unreal-SDK-CPP-Example/Config/DefaultGame.ini index 1fdb40f9..54b9b567 100644 --- a/Agora-Unreal-SDK-CPP-Example/Config/DefaultGame.ini +++ b/Agora-Unreal-SDK-CPP-Example/Config/DefaultGame.ini @@ -71,30 +71,6 @@ bCookAll=False bCookMapsOnly=False bSkipEditorContent=False bSkipMovies=False --IniKeyBlacklist=KeyStorePassword --IniKeyBlacklist=KeyPassword --IniKeyBlacklist=rsa.privateexp --IniKeyBlacklist=rsa.modulus --IniKeyBlacklist=rsa.publicexp --IniKeyBlacklist=aes.key --IniKeyBlacklist=SigningPublicExponent --IniKeyBlacklist=SigningModulus --IniKeyBlacklist=SigningPrivateExponent --IniKeyBlacklist=EncryptionKey --IniKeyBlacklist=IniKeyBlacklist --IniKeyBlacklist=IniSectionBlacklist -+IniKeyBlacklist=KeyStorePassword -+IniKeyBlacklist=KeyPassword -+IniKeyBlacklist=rsa.privateexp -+IniKeyBlacklist=rsa.modulus -+IniKeyBlacklist=rsa.publicexp -+IniKeyBlacklist=aes.key -+IniKeyBlacklist=SigningPublicExponent -+IniKeyBlacklist=SigningModulus -+IniKeyBlacklist=SigningPrivateExponent -+IniKeyBlacklist=EncryptionKey -+IniKeyBlacklist=IniKeyBlacklist -+IniKeyBlacklist=IniSectionBlacklist +DirectoriesToAlwaysStageAsNonUFS=(Path="Movies") +DirectoriesToAlwaysStageAsNonUFS=(Path="Audio") +DirectoriesToAlwaysStageAsNonUFS=(Path="Image") diff --git a/Agora-Unreal-SDK-CPP-Example/Config/DefaultInput.ini b/Agora-Unreal-SDK-CPP-Example/Config/DefaultInput.ini deleted file mode 100644 index 79ea69f6..00000000 --- a/Agora-Unreal-SDK-CPP-Example/Config/DefaultInput.ini +++ /dev/null @@ -1,8 +0,0 @@ - - -[/Script/Engine.InputSettings] -DefaultTouchInterface=/Engine/MobileResources/HUD/LeftVirtualJoystickOnly.LeftVirtualJoystickOnly -bUseMouseForTouch=False -DefaultViewportMouseLockMode=LockOnCapture -bEnableMouseSmoothing=True - diff --git a/Agora-Unreal-SDK-CPP-Example/Content/API-Example/BP_MainWidget.uasset b/Agora-Unreal-SDK-CPP-Example/Content/API-Example/BP_MainWidget.uasset index 8d48e269..b8a02da5 100644 Binary files a/Agora-Unreal-SDK-CPP-Example/Content/API-Example/BP_MainWidget.uasset and b/Agora-Unreal-SDK-CPP-Example/Content/API-Example/BP_MainWidget.uasset differ diff --git a/Agora-Unreal-SDK-CPP-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioWidget.uasset b/Agora-Unreal-SDK-CPP-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioWidget.uasset index 1450ad44..2177a937 100644 Binary files a/Agora-Unreal-SDK-CPP-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioWidget.uasset and b/Agora-Unreal-SDK-CPP-Example/Content/API-Example/Basic/JoinChannelAudio/BP_AudioWidget.uasset differ diff --git a/Agora-Unreal-SDK-CPP-Example/Content/API-Example/MainLevel.umap b/Agora-Unreal-SDK-CPP-Example/Content/API-Example/MainLevel.umap index 3f32d11a..492ab47c 100644 Binary files a/Agora-Unreal-SDK-CPP-Example/Content/API-Example/MainLevel.umap and b/Agora-Unreal-SDK-CPP-Example/Content/API-Example/MainLevel.umap differ diff --git a/Agora-Unreal-SDK-CPP-Example/Content/API-Example/Utility/WBP_DraggableVideoView.uasset b/Agora-Unreal-SDK-CPP-Example/Content/API-Example/Utility/WBP_DraggableVideoView.uasset index 306ac1c5..33c1e8c5 100644 Binary files a/Agora-Unreal-SDK-CPP-Example/Content/API-Example/Utility/WBP_DraggableVideoView.uasset and b/Agora-Unreal-SDK-CPP-Example/Content/API-Example/Utility/WBP_DraggableVideoView.uasset differ diff --git a/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame.h264 b/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame.h264 new file mode 100644 index 00000000..725a63ae Binary files /dev/null and b/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame.h264 differ diff --git a/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame_original.jpg b/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame_original.jpg new file mode 100644 index 00000000..1c0ccade Binary files /dev/null and b/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame_original.jpg differ diff --git a/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame_original.uasset b/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame_original.uasset new file mode 100644 index 00000000..a045d9aa Binary files /dev/null and b/Agora-Unreal-SDK-CPP-Example/Content/Image/output_frame_original.uasset differ diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraExample.Build.cs b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraExample.Build.cs index 273005cc..2dcaf2b5 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraExample.Build.cs +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraExample.Build.cs @@ -20,6 +20,7 @@ public AgoraExample(ReadOnlyTargetRules Target) : base(Target) "RHI", "HTTP", "AudioMixer", + //"MyShaderLibrary", // For JoinChannelWithToken "HTTP", diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraGameInstanceWithConsoleFunc.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraGameInstanceWithConsoleFunc.cpp index 9287fa33..6da9fa3d 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraGameInstanceWithConsoleFunc.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraGameInstanceWithConsoleFunc.cpp @@ -5,9 +5,7 @@ void UAgoraGameInstanceWithConsoleFunc::SetRtcEngineParam(FString Param) { - agora::rtc::IRtcEngine* RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); - - int ret = RtcEngineProxy->setParameters(TCHAR_TO_UTF8(*Param)); + int ret = AgoraUERtcEngine::Get()->setParameters(TCHAR_TO_UTF8(*Param)); UE_LOG(LogTemp, Warning, TEXT("--- Cmd:%s exec:%d"), *FString(FUNCTION_MACRO), (int32)ret); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraGameInstanceWithConsoleFunc.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraGameInstanceWithConsoleFunc.h index 93084f45..fc77145e 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraGameInstanceWithConsoleFunc.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/AgoraGameInstanceWithConsoleFunc.h @@ -7,7 +7,6 @@ #include "AgoraPluginInterface.h" #include "Utility/BFL_Logger.h" #include "AgoraGameInstanceWithConsoleFunc.generated.h" - /** * */ diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioMixing/AudioMixingWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioMixing/AudioMixingWidget.cpp index 48da844e..3c8805bb 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioMixing/AudioMixingWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioMixing/AudioMixingWidget.cpp @@ -29,14 +29,13 @@ void UAudioMixingWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -56,9 +55,9 @@ void UAudioMixingWidget::ShowUserGuide() void UAudioMixingWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -73,13 +72,13 @@ void UAudioMixingWidget::OnStartMixingClicked() { FString Path = FPaths::Combine(FPaths::ProjectContentDir(), TEXT("Audio"), TEXT("Agora.io-Interactions.wav")); - if (CB_URL->CheckedState == ECheckBoxState::Checked && ET_URL->GetText().ToString() == "") + if (CB_URL->GetCheckedState() == ECheckBoxState::Checked && ET_URL->GetText().ToString() == "") { UBFL_Logger::Print(FString::Printf(TEXT("%s URL Is Empty"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); return; } - if (CB_URL->CheckedState == ECheckBoxState::Checked) { + if (CB_URL->GetCheckedState() == ECheckBoxState::Checked) { Path = ET_URL->GetText().ToString(); } @@ -101,14 +100,14 @@ void UAudioMixingWidget::OnStartMixingClicked() #endif } - int ParamLoop = CB_Loop->CheckedState == ECheckBoxState::Checked ? -1 : 1; - int ret = RtcEngineProxy->startAudioMixing(TCHAR_TO_UTF8(*Path), CB_LocalOnly->CheckedState == ECheckBoxState::Checked, ParamLoop); + int ParamLoop = CB_Loop->GetCheckedState() == ECheckBoxState::Checked ? -1 : 1; + int ret = AgoraUERtcEngine::Get()->startAudioMixing(TCHAR_TO_UTF8(*Path), CB_LocalOnly->GetCheckedState() == ECheckBoxState::Checked, ParamLoop); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UAudioMixingWidget::OnStopMixingClicked() { - int ret = RtcEngineProxy->stopAudioMixing(); + int ret = AgoraUERtcEngine::Get()->stopAudioMixing(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -116,13 +115,13 @@ void UAudioMixingWidget::OnStartEffectClicked() { FString Path = FPaths::Combine(FPaths::ProjectContentDir(), TEXT("Audio"), TEXT("Agora.io-Interactions.wav")); - if (CB_URL->CheckedState == ECheckBoxState::Checked && ET_URL->GetText().ToString() == "") + if (CB_URL->GetCheckedState() == ECheckBoxState::Checked && ET_URL->GetText().ToString() == "") { UBFL_Logger::Print(FString::Printf(TEXT("%s URL Is Empty"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); return; } - if (CB_URL->CheckedState == ECheckBoxState::Checked) { + if (CB_URL->GetCheckedState() == ECheckBoxState::Checked) { Path = ET_URL->GetText().ToString(); } @@ -144,14 +143,14 @@ void UAudioMixingWidget::OnStartEffectClicked() #endif } - int ParamLoop = CB_Loop->CheckedState == ECheckBoxState::Checked ? -1 : 1; - int ret = RtcEngineProxy->playEffect(1, TCHAR_TO_UTF8(*Path), ParamLoop, 0.5, 1, 80, CB_LocalOnly->CheckedState != ECheckBoxState::Checked, 0); + int ParamLoop = CB_Loop->GetCheckedState() == ECheckBoxState::Checked ? -1 : 1; + int ret = AgoraUERtcEngine::Get()->playEffect(1, TCHAR_TO_UTF8(*Path), ParamLoop, 0.5, 1, 80, CB_LocalOnly->GetCheckedState() != ECheckBoxState::Checked, 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UAudioMixingWidget::OnStopEffectClicked() { - int ret = RtcEngineProxy->stopAllEffects(); + int ret = AgoraUERtcEngine::Get()->stopAllEffects(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -166,12 +165,11 @@ void UAudioMixingWidget::NativeDestruct() void UAudioMixingWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioMixing/AudioMixingWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioMixing/AudioMixingWidget.h index 9f52fea1..fd055bfd 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioMixing/AudioMixingWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioMixing/AudioMixingWidget.h @@ -130,7 +130,6 @@ class AGORAEXAMPLE_API UAudioMixingWidget : public UBaseAgoraUserWidget FString Token; FString ChannelName; - IRtcEngine* RtcEngineProxy; TSharedPtr UserRtcEventHandlerEx; }; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioSpectrum/AudioSpectrumWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioSpectrum/AudioSpectrumWidget.cpp index 8441fd6d..03ae9a61 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioSpectrum/AudioSpectrumWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioSpectrum/AudioSpectrumWidget.cpp @@ -60,14 +60,13 @@ void UAudioSpectrumWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FStrin Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -86,7 +85,7 @@ void UAudioSpectrumWidget::ShowUserGuide() void UAudioSpectrumWidget::InitAgoraMediaPlayer() { - MediaPlayer = RtcEngineProxy->createMediaPlayer(); + MediaPlayer = AgoraUERtcEngine::Get()->createMediaPlayer(); UserIMediaPlayerSourceObserver = MakeShared(this); MediaPlayer->registerPlayerSourceObserver(UserIMediaPlayerSourceObserver.Get()); UBFL_Logger::Print(FString::Printf(TEXT("%s PlayerID=%d"), *FString(FUNCTION_MACRO), MediaPlayer->getMediaPlayerId()), LogMsgViewPtr); @@ -98,9 +97,9 @@ void UAudioSpectrumWidget::InitAgoraMediaPlayer() void UAudioSpectrumWidget::JoinChannelWithMPK() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); ChannelMediaOptions Options; Options.autoSubscribeAudio = true; @@ -113,7 +112,7 @@ void UAudioSpectrumWidget::JoinChannelWithMPK() Options.enableAudioRecordingOrPlayout = true; Options.clientRoleType = CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER; - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -232,7 +231,7 @@ void UAudioSpectrumWidget::OnBtnOpenClicked() void UAudioSpectrumWidget::OnBtnPlayClicked() { - if (CB_Loop->CheckedState == ECheckBoxState::Checked) { + if (CB_Loop->GetCheckedState() == ECheckBoxState::Checked) { MediaPlayer->setLoopCount(-1); } else @@ -272,7 +271,7 @@ void UAudioSpectrumWidget::NativeDestruct() void UAudioSpectrumWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { if (MediaPlayer) { @@ -280,12 +279,11 @@ void UAudioSpectrumWidget::UnInitAgoraEngine() MediaPlayer->unregisterPlayerSourceObserver(UserIMediaPlayerSourceObserver.Get()); } - RtcEngineProxy->destroyMediaPlayer(MediaPlayer); + AgoraUERtcEngine::Get()->destroyMediaPlayer(MediaPlayer); - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -305,10 +303,8 @@ int UAudioSpectrumWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -317,7 +313,7 @@ int UAudioSpectrumWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -326,13 +322,13 @@ int UAudioSpectrumWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -341,10 +337,8 @@ int UAudioSpectrumWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP int UAudioSpectrumWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -354,20 +348,20 @@ int UAudioSpectrumWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_ if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -469,7 +463,7 @@ void UAudioSpectrumWidget::FUserRtcEventHandler::onLeaveChannel(const agora::rtc #pragma region AgoraCallback - IMediaPlayerSourceObserver -void UAudioSpectrumWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) +void UAudioSpectrumWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason) { if (!IsWidgetValid()) return; @@ -502,7 +496,7 @@ void UAudioSpectrumWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateC }); } -void UAudioSpectrumWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms) +void UAudioSpectrumWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms, int64_t timestampMs) { } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioSpectrum/AudioSpectrumWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioSpectrum/AudioSpectrumWidget.h index 5cf92662..10fa892a 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioSpectrum/AudioSpectrumWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/AudioSpectrum/AudioSpectrumWidget.h @@ -82,10 +82,10 @@ class AGORAEXAMPLE_API UAudioSpectrumWidget : public UBaseAgoraUserWidget FUserIMediaPlayerSourceObserver(UAudioSpectrumWidget* Widget) : WidgetPtr(Widget) {} - void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) override; + void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason) override; - void onPositionChanged(int64_t position_ms) override; + void onPositionChanged(int64_t position_ms, int64_t timestampMs) override; void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override; @@ -259,7 +259,6 @@ class AGORAEXAMPLE_API UAudioSpectrumWidget : public UBaseAgoraUserWidget const char* MPK_URL = "https://agora-adc-artifacts.oss-cn-beijing.aliyuncs.com/video/meta_live_mpk.mov"; - IRtcEngine* RtcEngineProxy; agora::agora_refptr MediaPlayer; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelayWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelayWidget.cpp index b7ed725b..237e4c18 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelayWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelayWidget.cpp @@ -48,14 +48,12 @@ void UChannelMediaRelayWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FS Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -73,10 +71,10 @@ void UChannelMediaRelayWidget::ShowUserGuide() void UChannelMediaRelayWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -114,7 +112,7 @@ void UChannelMediaRelayWidget::OnBtnStartClicked() Config.destInfos = DstChannelMediaInfoList.GetData(); Config.destCount = 1; - int ret = RtcEngineProxy->startOrUpdateChannelMediaRelay(Config); + int ret = AgoraUERtcEngine::Get()->startOrUpdateChannelMediaRelay(Config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -144,26 +142,26 @@ void UChannelMediaRelayWidget::OnBtnUpdateClicked() Config.destInfos = DstChannelMediaInfoList.GetData(); Config.destCount = 1; - int ret = RtcEngineProxy->startOrUpdateChannelMediaRelay(Config); + int ret = AgoraUERtcEngine::Get()->startOrUpdateChannelMediaRelay(Config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UChannelMediaRelayWidget::OnBtnStopClicked() { - int ret = RtcEngineProxy->stopChannelMediaRelay(); + int ret = AgoraUERtcEngine::Get()->stopChannelMediaRelay(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UChannelMediaRelayWidget::OnBtnPauseAllClicked() { - int ret = RtcEngineProxy->pauseAllChannelMediaRelay(); + int ret = AgoraUERtcEngine::Get()->pauseAllChannelMediaRelay(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UChannelMediaRelayWidget::OnBtnResumeAllClicked() { - int ret = RtcEngineProxy->resumeAllChannelMediaRelay(); + int ret = AgoraUERtcEngine::Get()->resumeAllChannelMediaRelay(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -187,12 +185,11 @@ void UChannelMediaRelayWidget::NativeDestruct() void UChannelMediaRelayWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -213,10 +210,8 @@ int UChannelMediaRelayWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -225,7 +220,7 @@ int UChannelMediaRelayWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -234,13 +229,13 @@ int UChannelMediaRelayWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -249,10 +244,8 @@ int UChannelMediaRelayWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE int UChannelMediaRelayWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -262,20 +255,20 @@ int UChannelMediaRelayWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOU if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelayWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelayWidget.h index f1d5275f..c1ddb4ba 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelayWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelayWidget.h @@ -157,7 +157,5 @@ class AGORAEXAMPLE_API UChannelMediaRelayWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; - TSharedPtr UserRtcEventHandlerEx; }; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ContentInspect/ContentInspectWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ContentInspect/ContentInspectWidget.cpp index f5ac3ffa..c2705537 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ContentInspect/ContentInspectWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ContentInspect/ContentInspectWidget.cpp @@ -48,14 +48,12 @@ void UContentInspectWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FStri Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -72,10 +70,10 @@ void UContentInspectWidget::ShowUserGuide() void UContentInspectWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -90,7 +88,7 @@ void UContentInspectWidget::OnBtnStartClicked() Config.moduleCount = 1; // Enables or disables video screenshot and upload, check if there is any inappropriate content. - int ret = RtcEngineProxy->enableContentInspect(true, Config); + int ret = AgoraUERtcEngine::Get()->enableContentInspect(true, Config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -103,7 +101,7 @@ void UContentInspectWidget::OnBtnStopClicked() Config.modules[0] = OneModule; Config.moduleCount = 1; // Enables or disables video screenshot and upload, check if there is any inappropriate content. - int ret = RtcEngineProxy->enableContentInspect(false, Config); + int ret = AgoraUERtcEngine::Get()->enableContentInspect(false, Config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -125,12 +123,11 @@ void UContentInspectWidget::NativeDestruct() void UContentInspectWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -151,10 +148,8 @@ int UContentInspectWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TY channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -163,7 +158,7 @@ int UContentInspectWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TY if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -172,13 +167,13 @@ int UContentInspectWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TY videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -187,10 +182,8 @@ int UContentInspectWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TY int UContentInspectWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -200,20 +193,20 @@ int UContentInspectWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ContentInspect/ContentInspectWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ContentInspect/ContentInspectWidget.h index 767bf67f..4f7d495a 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ContentInspect/ContentInspectWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ContentInspect/ContentInspectWidget.h @@ -147,7 +147,7 @@ class AGORAEXAMPLE_API UContentInspectWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + TSharedPtr UserRtcEventHandlerEx; }; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureAudio/CustomCaptureAudioWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureAudio/CustomCaptureAudioWidget.cpp index c4addc33..336f23fc 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureAudio/CustomCaptureAudioWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureAudio/CustomCaptureAudioWidget.cpp @@ -51,17 +51,15 @@ void UCustomCaptureAudioWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, F Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - RtcEngineProxy->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); } void UCustomCaptureAudioWidget::ShowUserGuide() @@ -83,9 +81,9 @@ void UCustomCaptureAudioWidget::SetExternalAudioSource() void UCustomCaptureAudioWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -122,12 +120,11 @@ void UCustomCaptureAudioWidget::UnInitAgoraEngine() Runnable = nullptr; } - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureAudio/CustomCaptureAudioWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureAudio/CustomCaptureAudioWidget.h index ce1f68e0..2d916a7d 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureAudio/CustomCaptureAudioWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureAudio/CustomCaptureAudioWidget.h @@ -121,7 +121,7 @@ class AGORAEXAMPLE_API UCustomCaptureAudioWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + agora::media::IMediaEngine* MediaEngine; TSharedPtr UserRtcEventHandler; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureVideo/CustomCaptureVideoScene.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureVideo/CustomCaptureVideoScene.cpp index 8ec82820..5c3198c7 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureVideo/CustomCaptureVideoScene.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureVideo/CustomCaptureVideoScene.cpp @@ -65,14 +65,12 @@ void UCustomCaptureVideoScene::InitAgoraEngine(FString APP_ID, FString TOKEN, FS Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -89,7 +87,7 @@ void UCustomCaptureVideoScene::ShowUserGuide() void UCustomCaptureVideoScene::SetExternalVideoSource() { - int ret = RtcEngineProxy->queryInterface(INTERFACE_ID_TYPE::AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngineManager); + int ret = AgoraUERtcEngine::Get()->queryInterface(INTERFACE_ID_TYPE::AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngineManager); UBFL_Logger::Print(FString::Printf(TEXT("%s queryInterface ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); @@ -103,10 +101,10 @@ void UCustomCaptureVideoScene::SetExternalVideoSource() void UCustomCaptureVideoScene::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -176,12 +174,11 @@ void UCustomCaptureVideoScene::NativeDestruct() void UCustomCaptureVideoScene::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); MediaEngineManager = nullptr; UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureVideo/CustomCaptureVideoScene.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureVideo/CustomCaptureVideoScene.h index d64b4261..42878b27 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureVideo/CustomCaptureVideoScene.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomCaptureVideo/CustomCaptureVideoScene.h @@ -111,7 +111,6 @@ class AGORAEXAMPLE_API UCustomCaptureVideoScene : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngine* RtcEngineProxy; agora::media::IMediaEngine* MediaEngineManager; FDelegateHandle eventId; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomRenderAudio/CustomRenderAudioWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomRenderAudio/CustomRenderAudioWidget.cpp index 18c115db..fe578cbb 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomRenderAudio/CustomRenderAudioWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomRenderAudio/CustomRenderAudioWidget.cpp @@ -55,17 +55,15 @@ void UCustomRenderAudioWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FS Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - RtcEngineProxy->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); } void UCustomRenderAudioWidget::ShowUserGuide() @@ -85,7 +83,7 @@ void UCustomRenderAudioWidget::ShowUserGuide() void UCustomRenderAudioWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); + AgoraUERtcEngine::Get()->enableAudio(); #if PLATFORM_IOS @@ -95,10 +93,10 @@ void UCustomRenderAudioWidget::JoinChannel() // [Tmp Solution] // It would disable SDK's ADM, therefore, it would disable the functionality of Recording and Playout. // You could get the sample effect with ChannelMediaOptions.enableAudioRecordingOrPlayout to false - // int ret00 = RtcEngineProxy->enableLocalAudio(false); + // int ret00 = AgoraUERtcEngine::Get()->enableLocalAudio(false); // [Solution] - int ret00 = RtcEngineProxy->setParameters("{\"che.audio.keep.audiosession\": true}"); + int ret00 = AgoraUERtcEngine::Get()->setParameters("{\"che.audio.keep.audiosession\": true}"); UBFL_Logger::Print(FString::Printf(TEXT("%s setParameters ret %d"), *FString(FUNCTION_MACRO), ret00), LogMsgViewPtr); #endif @@ -106,8 +104,8 @@ void UCustomRenderAudioWidget::JoinChannel() int ret0 = MediaEngine->setExternalAudioSink(true, SAMPLE_RATE, CHANNEL); UBFL_Logger::Print(FString::Printf(TEXT("%s setExternalAudioSink ret %d"), *FString(FUNCTION_MACRO), ret0), LogMsgViewPtr); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s joinChannel ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -156,12 +154,11 @@ void UCustomRenderAudioWidget::UnInitAgoraEngine() Runnable = nullptr; } - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomRenderAudio/CustomRenderAudioWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomRenderAudio/CustomRenderAudioWidget.h index 9aea2fc0..eae136e1 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomRenderAudio/CustomRenderAudioWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/CustomRenderAudio/CustomRenderAudioWidget.h @@ -124,7 +124,7 @@ class AGORAEXAMPLE_API UCustomRenderAudioWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + agora::media::IMediaEngine* MediaEngine; TSharedPtr UserRtcEventHandler; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DeviceManager/DeviceManagerUserWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DeviceManager/DeviceManagerUserWidget.cpp index 8cc30be7..749c4940 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DeviceManager/DeviceManagerUserWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DeviceManager/DeviceManagerUserWidget.cpp @@ -30,19 +30,17 @@ void UDeviceManagerUserWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FS Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - RtcEngineProxy->queryInterface(AGORA_IID_AUDIO_DEVICE_MANAGER, (void**)&AudioDeviceManager); - RtcEngineProxy->queryInterface(AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_AUDIO_DEVICE_MANAGER, (void**)&AudioDeviceManager); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); } void UDeviceManagerUserWidget::ShowUserGuide() @@ -109,7 +107,7 @@ void UDeviceManagerUserWidget::GetAudioPlaybackDevice() void UDeviceManagerUserWidget::GetVideoDeviceManager() { - int ret = RtcEngineProxy->startPreview(); + int ret = AgoraUERtcEngine::Get()->startPreview(); UBFL_Logger::Print(FString::Printf(TEXT("%s startPreview ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); @@ -197,17 +195,36 @@ void UDeviceManagerUserWidget::NativeDestruct() void UDeviceManagerUserWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - AudioRecordingDeviceInfos->release(); - AudioPlaybackDeviceInfos->release(); - VideoDeviceInfos->release(); - AudioDeviceManager->release(); - VideoDeviceManager->release(); - RtcEngineProxy->stopPreview(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + if(AudioRecordingDeviceInfos){ + AudioRecordingDeviceInfos->release(); + AudioRecordingDeviceInfos = nullptr; + } + + if (AudioPlaybackDeviceInfos) { + AudioPlaybackDeviceInfos->release(); + AudioPlaybackDeviceInfos = nullptr; + } + + if (VideoDeviceInfos) { + VideoDeviceInfos->release(); + VideoDeviceInfos = nullptr; + } + + if (AudioDeviceManager) { + AudioDeviceManager->release(); + AudioDeviceManager = nullptr; + } + + if (VideoDeviceManager) { + VideoDeviceManager->release(); + VideoDeviceManager = nullptr; + } + + AgoraUERtcEngine::Get()->stopPreview(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DeviceManager/DeviceManagerUserWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DeviceManager/DeviceManagerUserWidget.h index ef17a32f..84e5682d 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DeviceManager/DeviceManagerUserWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DeviceManager/DeviceManagerUserWidget.h @@ -108,17 +108,17 @@ class AGORAEXAMPLE_API UDeviceManagerUserWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; - TSharedPtr UserRtcEventHandler; - IAudioDeviceManager* AudioDeviceManager; + TSharedPtr UserRtcEventHandler = nullptr; - IVideoDeviceManager* VideoDeviceManager; + IAudioDeviceManager* AudioDeviceManager = nullptr; - IAudioDeviceCollection* AudioRecordingDeviceInfos; + IVideoDeviceManager* VideoDeviceManager = nullptr; - IAudioDeviceCollection* AudioPlaybackDeviceInfos; + IAudioDeviceCollection* AudioRecordingDeviceInfos = nullptr; - IVideoDeviceCollection* VideoDeviceInfos; + IAudioDeviceCollection* AudioPlaybackDeviceInfos = nullptr; + + IVideoDeviceCollection* VideoDeviceInfos = nullptr; }; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DualCamera/DualCameraWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DualCamera/DualCameraWidget.cpp index 5de86fe1..2999f07b 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DualCamera/DualCameraWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DualCamera/DualCameraWidget.cpp @@ -65,14 +65,12 @@ void UDualCameraWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString C Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -98,23 +96,19 @@ void UDualCameraWidget::GetVideoDeviceManager() // Windows || Mac agora::rtc::IVideoDeviceManager* VideoDeviceManager = nullptr; - RtcEngineProxy->queryInterface(AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); IVideoDeviceCollection* VideoDeviceInfos = VideoDeviceManager->enumerateVideoDevices(); if (VideoDeviceInfos->getCount() >= 1) { - char deviceId[512] = { 0 }; - char deviceName[512] = { 0 }; // Get camera information - VideoDeviceInfos->getDevice(0, deviceName, deviceId); - FMemory::Memcpy(MainCameraConfig.deviceId, deviceId, 512); + VideoDeviceInfos->getDevice(0, MainCameraDeviceName, MainCameraDeviceId); + MainCameraConfig.deviceId = MainCameraDeviceId; } if (VideoDeviceInfos->getCount() >= 2) { - char deviceId[512] = { 0 }; - char deviceName[512] = { 0 }; // Get camera information - VideoDeviceInfos->getDevice(1, deviceName, deviceId); - FMemory::Memcpy(SecondCameraConfig.deviceId, deviceId, 512); + VideoDeviceInfos->getDevice(1, SecondCameraDeviceName, SecondCameraDeviceId); + SecondCameraConfig.deviceId = SecondCameraDeviceId; } #endif @@ -131,13 +125,13 @@ void UDualCameraWidget::OnBtnBackToHomeClicked() void UDualCameraWidget::OnBtn_MainCameraJoinClicked() { - RtcEngineProxy->startPreview(); - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->startPreview(); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->startCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY, MainCameraConfig); + int ret = AgoraUERtcEngine::Get()->startCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY, MainCameraConfig); UBFL_Logger::Print(FString::Printf(TEXT("%s startCameraCapture ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); agora::rtc::ChannelMediaOptions options1; options1.publishCameraTrack = true; @@ -154,16 +148,16 @@ void UDualCameraWidget::OnBtn_MainCameraJoinClicked() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); agora::rtc::RtcConnection connection(StdStrChannelName.c_str(), UID1); - int ret2 = RtcEngineProxy->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, options1, nullptr); + int ret2 = AgoraUERtcEngine::Get()->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, options1, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s joinChannel ret %d"), *FString(FUNCTION_MACRO), ret2), LogMsgViewPtr); } void UDualCameraWidget::OnBtn_MainCameraLeaveClicked() { - RtcEngineProxy->stopCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY); + AgoraUERtcEngine::Get()->stopCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY); std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); agora::rtc::RtcConnection connection(StdStrChannelName.c_str(), UID1); - int ret = RtcEngineProxy->leaveChannelEx(connection); + int ret = AgoraUERtcEngine::Get()->leaveChannelEx(connection); UBFL_Logger::Print(FString::Printf(TEXT("%s leaveChannel ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -173,12 +167,12 @@ void UDualCameraWidget::OnBtn_SecondCameraJoinClicked() // iPhone is only support in iPhone XR or better. iOS version is support in 13.0 or better CameraCapturerConfiguration CameraCaptureConfig; CameraCaptureConfig.cameraDirection = CAMERA_DIRECTION::CAMERA_REAR; - int ret0 = RtcEngineProxy->enableMultiCamera(true, CameraCaptureConfig); + int ret0 = AgoraUERtcEngine::Get()->enableMultiCamera(true, CameraCaptureConfig); UBFL_Logger::Print(FString::Printf(TEXT("%s enableMultiCamera ret0 %d"), *FString(FUNCTION_MACRO), ret0), LogMsgViewPtr); #endif - int ret = RtcEngineProxy->startCameraCapture(VIDEO_SOURCE_CAMERA_SECONDARY, SecondCameraConfig); + int ret = AgoraUERtcEngine::Get()->startCameraCapture(VIDEO_SOURCE_CAMERA_SECONDARY, SecondCameraConfig); UBFL_Logger::Print(FString::Printf(TEXT("%s startCameraCapture ret1 %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); agora::rtc::ChannelMediaOptions options2; /* @@ -195,16 +189,16 @@ void UDualCameraWidget::OnBtn_SecondCameraJoinClicked() options2.clientRoleType = CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER; std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); agora::rtc::RtcConnection connection(StdStrChannelName.c_str(), UID2); - int ret2 = RtcEngineProxy->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, options2, nullptr); + int ret2 = AgoraUERtcEngine::Get()->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, options2, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s joinChannelEx ret2 %d"), *FString(FUNCTION_MACRO), ret2), LogMsgViewPtr); } void UDualCameraWidget::OnBtn_SecondCameraLeaveClicked() { - RtcEngineProxy->stopCameraCapture(VIDEO_SOURCE_CAMERA_SECONDARY); + AgoraUERtcEngine::Get()->stopCameraCapture(VIDEO_SOURCE_CAMERA_SECONDARY); std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); agora::rtc::RtcConnection connection(StdStrChannelName.c_str(), UID2); - int ret = RtcEngineProxy->leaveChannelEx(connection); + int ret = AgoraUERtcEngine::Get()->leaveChannelEx(connection); UE_LOG(LogTemp, Warning, TEXT(" UDualCameraWidget::OnBtn_SecondCameraLeaveClicked ret: %u"), ret); } @@ -217,7 +211,7 @@ void UDualCameraWidget::OnBtn_PublishMainCameraClicked() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); connection.channelId = StdStrChannelName.c_str(); connection.localUid = UID1; - int ret = RtcEngineProxy->updateChannelMediaOptionsEx(options1, connection); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(options1, connection); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -230,7 +224,7 @@ void UDualCameraWidget::OnBtn_UnPublishMainCamClicked() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); connection.channelId = StdStrChannelName.c_str(); connection.localUid = UID1; - int ret = RtcEngineProxy->updateChannelMediaOptionsEx(options1, connection); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(options1, connection); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -243,7 +237,7 @@ void UDualCameraWidget::OnBtn_PublishSecondCamClicked() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); connection.channelId = StdStrChannelName.c_str(); connection.localUid = UID2; - int ret = RtcEngineProxy->updateChannelMediaOptionsEx(options2, connection); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(options2, connection); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -256,7 +250,7 @@ void UDualCameraWidget::OnBtn_UnPublishSecondCamClicked() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); connection.channelId = StdStrChannelName.c_str(); connection.localUid = UID2; - int ret = RtcEngineProxy->updateChannelMediaOptionsEx(options2, connection); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(options2, connection); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -270,13 +264,12 @@ void UDualCameraWidget::NativeDestruct() void UDualCameraWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->leaveChannelEx(RtcConnection(TCHAR_TO_UTF8(*ChannelName), UID2)); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->leaveChannelEx(RtcConnection(TCHAR_TO_UTF8(*ChannelName), UID2)); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -296,10 +289,8 @@ int UDualCameraWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE s channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -308,7 +299,7 @@ int UDualCameraWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE s if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -317,13 +308,13 @@ int UDualCameraWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE s videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -332,10 +323,8 @@ int UDualCameraWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE s int UDualCameraWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -345,20 +334,20 @@ int UDualCameraWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DualCamera/DualCameraWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DualCamera/DualCameraWidget.h index 3ebd3c8d..17f96d4f 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DualCamera/DualCameraWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/DualCamera/DualCameraWidget.h @@ -174,7 +174,11 @@ class AGORAEXAMPLE_API UDualCameraWidget : public UBaseAgoraUserWidget uint32 UID1 = 123; uint32 UID2 = 456; - IRtcEngineEx* RtcEngineProxy; + char MainCameraDeviceName[MAX_DEVICE_ID_LENGTH] = {}; + char MainCameraDeviceId[MAX_DEVICE_ID_LENGTH] = {}; + char SecondCameraDeviceId[MAX_DEVICE_ID_LENGTH] = {}; + char SecondCameraDeviceName[MAX_DEVICE_ID_LENGTH] = {}; + CameraCapturerConfiguration MainCameraConfig; CameraCapturerConfiguration SecondCameraConfig; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelVideoToken/JoinChannelWithTokenWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelVideoToken/JoinChannelWithTokenWidget.cpp index f94050cc..33e66751 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelVideoToken/JoinChannelWithTokenWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelVideoToken/JoinChannelWithTokenWidget.cpp @@ -55,14 +55,12 @@ void UJoinChannelWithTokenWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -81,7 +79,7 @@ void UJoinChannelWithTokenWidget::ShowUserGuide() void UJoinChannelWithTokenWidget::OnBtnJoinOrRenewTokenlicked() { - if (CB_UseURL->CheckedState == ECheckBoxState::Checked) { + if (CB_UseURL->GetCheckedState() == ECheckBoxState::Checked) { if (ET_URL->GetText().ToString() == "") { UBFL_Logger::PrintWarn(FString::Printf(TEXT("%s === URL is Empty === "), *FString(FUNCTION_MACRO)), LogMsgViewPtr); @@ -150,17 +148,17 @@ void UJoinChannelWithTokenWidget::CallbackForRequestToken(FString NewToken) void UJoinChannelWithTokenWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d Token = %s"), *FString(FUNCTION_MACRO), ret, *Token), LogMsgViewPtr); } void UJoinChannelWithTokenWidget::UpdateToken() { - int ret = RtcEngineProxy->renewToken(TCHAR_TO_UTF8(*Token)); + int ret = AgoraUERtcEngine::Get()->renewToken(TCHAR_TO_UTF8(*Token)); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d Token = %s"), *FString(FUNCTION_MACRO), ret, *Token), LogMsgViewPtr); } @@ -181,14 +179,13 @@ void UJoinChannelWithTokenWidget::NativeDestruct() void UJoinChannelWithTokenWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { StopRequestToken(); - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -209,10 +206,8 @@ int UJoinChannelWithTokenWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOU channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -221,7 +216,7 @@ int UJoinChannelWithTokenWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOU if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -230,13 +225,13 @@ int UJoinChannelWithTokenWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOU videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -245,10 +240,8 @@ int UJoinChannelWithTokenWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOU int UJoinChannelWithTokenWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -258,20 +251,20 @@ int UJoinChannelWithTokenWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_ if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelVideoToken/JoinChannelWithTokenWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelVideoToken/JoinChannelWithTokenWidget.h index 2689629b..61333bb1 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelVideoToken/JoinChannelWithTokenWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelVideoToken/JoinChannelWithTokenWidget.h @@ -174,7 +174,7 @@ class AGORAEXAMPLE_API UJoinChannelWithTokenWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + CONNECTION_STATE_TYPE ConnectionState = CONNECTION_STATE_TYPE::CONNECTION_STATE_DISCONNECTED; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelWithUserAccount/JoinChannelWithUserAccountWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelWithUserAccount/JoinChannelWithUserAccountWidget.cpp index 664a262b..fae6d978 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelWithUserAccount/JoinChannelWithUserAccountWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelWithUserAccount/JoinChannelWithUserAccountWidget.cpp @@ -51,14 +51,12 @@ void UJoinChannelWithUserAccountWidget::InitAgoraEngine(FString APP_ID, FString Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -75,10 +73,10 @@ void UJoinChannelWithUserAccountWidget::ShowUserGuide() void UJoinChannelWithUserAccountWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannelWithUserAccount(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), TCHAR_TO_UTF8(*ValUserAccount)); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannelWithUserAccount(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), TCHAR_TO_UTF8(*ValUserAccount)); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -92,7 +90,7 @@ void UJoinChannelWithUserAccountWidget::OnBtnBackToHomeClicked() void UJoinChannelWithUserAccountWidget::OnBtnGetUserInfoClicked() { agora::rtc::UserInfo userInfo; - int ret = RtcEngineProxy->getUserInfoByUserAccount(TCHAR_TO_UTF8(*ValUserAccount), &userInfo); + int ret = AgoraUERtcEngine::Get()->getUserInfoByUserAccount(TCHAR_TO_UTF8(*ValUserAccount), &userInfo); UBFL_Logger::Print(FString::Printf(TEXT("%s ret=%d UserAccount=%s UserName=%d"), *FString(FUNCTION_MACRO), ret, *FString(userInfo.userAccount), userInfo.uid), LogMsgViewPtr); } @@ -108,12 +106,11 @@ void UJoinChannelWithUserAccountWidget::NativeDestruct() void UJoinChannelWithUserAccountWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -134,10 +131,8 @@ int UJoinChannelWithUserAccountWidget::MakeVideoView(uint32 uid, agora::rtc::VID channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -146,7 +141,7 @@ int UJoinChannelWithUserAccountWidget::MakeVideoView(uint32 uid, agora::rtc::VID if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -155,13 +150,13 @@ int UJoinChannelWithUserAccountWidget::MakeVideoView(uint32 uid, agora::rtc::VID videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -170,10 +165,8 @@ int UJoinChannelWithUserAccountWidget::MakeVideoView(uint32 uid, agora::rtc::VID int UJoinChannelWithUserAccountWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -183,20 +176,20 @@ int UJoinChannelWithUserAccountWidget::ReleaseVideoView(uint32 uid, agora::rtc:: if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelWithUserAccount/JoinChannelWithUserAccountWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelWithUserAccount/JoinChannelWithUserAccountWidget.h index fbcd37b6..29a9faf1 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelWithUserAccount/JoinChannelWithUserAccountWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinChannelWithUserAccount/JoinChannelWithUserAccountWidget.h @@ -140,7 +140,7 @@ class AGORAEXAMPLE_API UJoinChannelWithUserAccountWidget : public UBaseAgoraUser FString Token = ""; FString ChannelName = ""; FString ValUserAccount = "UnrealAccount"; - IRtcEngineEx* RtcEngineProxy; + TSharedPtr UserRtcEventHandlerEx; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinMultipleChannels/JoinMultipleChannelsWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinMultipleChannels/JoinMultipleChannelsWidget.cpp index 4055199a..57a59cba 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinMultipleChannels/JoinMultipleChannelsWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinMultipleChannels/JoinMultipleChannelsWidget.cpp @@ -55,14 +55,12 @@ void UJoinMultipleChannelsWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, ChannelName1 = CHANNEL_NAME; ChannelName2 = CHANNEL_NAME + "2"; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -96,8 +94,8 @@ void UJoinMultipleChannelsWidget::ShowUserGuide() void UJoinMultipleChannelsWidget::JoinChannel1() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); agora::rtc::ChannelMediaOptions ChannelMediaOptions; ChannelMediaOptions.autoSubscribeAudio = true; @@ -113,7 +111,7 @@ void UJoinMultipleChannelsWidget::JoinChannel1() connection.channelId = StdStrChannelName.c_str(); connection.localUid = UIDChannel1; - int ret = RtcEngineProxy->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, ChannelMediaOptions, nullptr); + int ret = AgoraUERtcEngine::Get()->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, ChannelMediaOptions, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s ChannelName=%s ret %d"), *FString(FUNCTION_MACRO), *ChannelName1, ret), LogMsgViewPtr); } @@ -134,7 +132,7 @@ void UJoinMultipleChannelsWidget::JoinChannel2() connection.channelId = StdStrChannelName.c_str(); connection.localUid = UIDChannel2; - int ret = RtcEngineProxy->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, ChannelMediaOptions, nullptr); + int ret = AgoraUERtcEngine::Get()->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, ChannelMediaOptions, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s ChannelName=%s ret %d"), *FString(FUNCTION_MACRO), *ChannelName2, ret), LogMsgViewPtr); } @@ -154,7 +152,7 @@ void UJoinMultipleChannelsWidget::OnBtnPublishChannel1() Connection2.channelId = StdStrChannelName2.c_str(); Connection2.localUid = UIDChannel2; - int ret2 = RtcEngineProxy->updateChannelMediaOptionsEx(Options2, Connection2); + int ret2 = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(Options2, Connection2); UBFL_Logger::Print(FString::Printf(TEXT("%s ChannelName=%s ret %d"), *FString(FUNCTION_MACRO), *ChannelName2, ret2), LogMsgViewPtr); @@ -168,7 +166,7 @@ void UJoinMultipleChannelsWidget::OnBtnPublishChannel1() Connection1.channelId = StdStrChannelName1.c_str(); Connection1.localUid = UIDChannel1; - int ret1 = RtcEngineProxy->updateChannelMediaOptionsEx(Options1, Connection1); + int ret1 = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(Options1, Connection1); UBFL_Logger::Print(FString::Printf(TEXT("%s ChannelName=%s ret %d"), *FString(FUNCTION_MACRO), *ChannelName1, ret1), LogMsgViewPtr); } @@ -185,7 +183,7 @@ void UJoinMultipleChannelsWidget::OnBtnPublishChannel2() Connection1.channelId = StdStrChannelName1.c_str(); Connection1.localUid = UIDChannel1; - int ret1 = RtcEngineProxy->updateChannelMediaOptionsEx(Options1, Connection1); + int ret1 = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(Options1, Connection1); UBFL_Logger::Print(FString::Printf(TEXT("%s ChannelName=%s ret %d"), *FString(FUNCTION_MACRO), *ChannelName1, ret1), LogMsgViewPtr); @@ -199,7 +197,7 @@ void UJoinMultipleChannelsWidget::OnBtnPublishChannel2() Connection2.channelId = StdStrChannelName2.c_str(); Connection2.localUid = UIDChannel2; - int ret2 = RtcEngineProxy->updateChannelMediaOptionsEx(Options2, Connection2); + int ret2 = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(Options2, Connection2); UBFL_Logger::Print(FString::Printf(TEXT("%s ChannelName=%s ret %d"), *FString(FUNCTION_MACRO), *ChannelName2, ret2), LogMsgViewPtr); } @@ -225,12 +223,11 @@ void UJoinMultipleChannelsWidget::NativeDestruct() void UJoinMultipleChannelsWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -251,10 +248,8 @@ int UJoinMultipleChannelsWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOU channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -263,7 +258,7 @@ int UJoinMultipleChannelsWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOU if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -272,13 +267,13 @@ int UJoinMultipleChannelsWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOU videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -287,10 +282,8 @@ int UJoinMultipleChannelsWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOU int UJoinMultipleChannelsWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -300,20 +293,20 @@ int UJoinMultipleChannelsWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_ if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinMultipleChannels/JoinMultipleChannelsWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinMultipleChannels/JoinMultipleChannelsWidget.h index 5bcc41c5..a40275d6 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinMultipleChannels/JoinMultipleChannelsWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/JoinMultipleChannels/JoinMultipleChannelsWidget.h @@ -149,7 +149,7 @@ class AGORAEXAMPLE_API UJoinMultipleChannelsWidget : public UBaseAgoraUserWidget uint32 UIDChannel1 = 123; uint32 UIDChannel2 = 456; - IRtcEngineEx* RtcEngineProxy; + TSharedPtr UserRtcEventHandlerEx; }; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayer/MediaplayerWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayer/MediaplayerWidget.cpp index c430325e..b7c2a4ee 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayer/MediaplayerWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayer/MediaplayerWidget.cpp @@ -59,14 +59,13 @@ void UMediaplayerWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -84,7 +83,7 @@ void UMediaplayerWidget::ShowUserGuide() void UMediaplayerWidget::InitAgoraMediaPlayer() { - MediaPlayer = RtcEngineProxy->createMediaPlayer(); + MediaPlayer = AgoraUERtcEngine::Get()->createMediaPlayer(); UserIMediaPlayerSourceObserver = MakeShared(this); MediaPlayer->registerPlayerSourceObserver(UserIMediaPlayerSourceObserver.Get()); UBFL_Logger::Print(FString::Printf(TEXT("%s PlayerID=%d"), *FString(FUNCTION_MACRO), MediaPlayer->getMediaPlayerId()), LogMsgViewPtr); @@ -93,9 +92,9 @@ void UMediaplayerWidget::InitAgoraMediaPlayer() void UMediaplayerWidget::JoinChannelWithMPK() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); ChannelMediaOptions Options; Options.autoSubscribeAudio = true; @@ -108,7 +107,7 @@ void UMediaplayerWidget::JoinChannelWithMPK() Options.enableAudioRecordingOrPlayout = true; Options.clientRoleType = CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER; - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -154,7 +153,7 @@ void UMediaplayerWidget::OnBtnOpenClicked() void UMediaplayerWidget::OnBtnPlayClicked() { - if (CB_Loop->CheckedState == ECheckBoxState::Checked) { + if (CB_Loop->GetCheckedState() == ECheckBoxState::Checked) { MediaPlayer->setLoopCount(-1); } else @@ -194,7 +193,7 @@ void UMediaplayerWidget::NativeDestruct() void UMediaplayerWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { if (MediaPlayer) { @@ -202,12 +201,11 @@ void UMediaplayerWidget::UnInitAgoraEngine() MediaPlayer->unregisterPlayerSourceObserver(UserIMediaPlayerSourceObserver.Get()); } - RtcEngineProxy->destroyMediaPlayer(MediaPlayer); + AgoraUERtcEngine::Get()->destroyMediaPlayer(MediaPlayer); - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -227,10 +225,8 @@ int UMediaplayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -239,7 +235,7 @@ int UMediaplayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -248,13 +244,13 @@ int UMediaplayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -263,10 +259,8 @@ int UMediaplayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE int UMediaplayerWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -276,20 +270,20 @@ int UMediaplayerWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TY if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -391,7 +385,7 @@ void UMediaplayerWidget::FUserRtcEventHandler::onLeaveChannel(const agora::rtc:: #pragma region AgoraCallback - IMediaPlayerSourceObserver -void UMediaplayerWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) +void UMediaplayerWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason) { if (!IsWidgetValid()) return; @@ -424,7 +418,7 @@ void UMediaplayerWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateCha }); } -void UMediaplayerWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms) +void UMediaplayerWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t positionMs, int64_t timestampMs) { } @@ -475,5 +469,7 @@ void UMediaplayerWidget::FUserIMediaPlayerSourceObserver::onAudioVolumeIndicatio } + + #pragma endregion diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayer/MediaplayerWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayer/MediaplayerWidget.h index 0fa6df9f..e7118b79 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayer/MediaplayerWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayer/MediaplayerWidget.h @@ -81,10 +81,11 @@ class AGORAEXAMPLE_API UMediaplayerWidget : public UBaseAgoraUserWidget FUserIMediaPlayerSourceObserver(UMediaplayerWidget* Widget) : WidgetPtr(Widget) {} - void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) override; + void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, + media::base::MEDIA_PLAYER_REASON reason) override; - void onPositionChanged(int64_t position_ms) override; + void onPositionChanged(int64_t positionMs, int64_t timestampMs) override; void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override; @@ -226,7 +227,6 @@ class AGORAEXAMPLE_API UMediaplayerWidget : public UBaseAgoraUserWidget const char* MPK_URL = "https://agora-adc-artifacts.oss-cn-beijing.aliyuncs.com/video/meta_live_mpk.mov"; - IRtcEngine* RtcEngineProxy; agora::agora_refptr MediaPlayer; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayerWithCustomDataProvide/MediaPlayerWithCustomDataWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayerWithCustomDataProvide/MediaPlayerWithCustomDataWidget.cpp index bb32e88c..80e5f79c 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayerWithCustomDataProvide/MediaPlayerWithCustomDataWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayerWithCustomDataProvide/MediaPlayerWithCustomDataWidget.cpp @@ -51,14 +51,12 @@ void UMediaPlayerWithCustomDataWidget::InitAgoraEngine(FString APP_ID, FString T Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -75,7 +73,7 @@ void UMediaPlayerWithCustomDataWidget::ShowUserGuide() void UMediaPlayerWithCustomDataWidget::InitAgoraMediaPlayer() { - MediaPlayer = RtcEngineProxy->createMediaPlayer(); + MediaPlayer = AgoraUERtcEngine::Get()->createMediaPlayer(); UserIMediaPlayerSourceObserver = MakeShared(this); MediaPlayer->registerPlayerSourceObserver(UserIMediaPlayerSourceObserver.Get()); UBFL_Logger::Print(FString::Printf(TEXT("%s PlayerID=%d"), *FString(FUNCTION_MACRO), MediaPlayer->getMediaPlayerId()), LogMsgViewPtr); @@ -84,9 +82,9 @@ void UMediaPlayerWithCustomDataWidget::InitAgoraMediaPlayer() void UMediaPlayerWithCustomDataWidget::JoinChannelWithMPK() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); ChannelMediaOptions Options; Options.autoSubscribeAudio = true; @@ -99,7 +97,7 @@ void UMediaPlayerWithCustomDataWidget::JoinChannelWithMPK() Options.enableAudioRecordingOrPlayout = true; Options.clientRoleType = CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER; - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -174,7 +172,7 @@ void UMediaPlayerWithCustomDataWidget::NativeDestruct() void UMediaPlayerWithCustomDataWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { if (UserIMediaPlayerCustomDataProvider != nullptr) UserIMediaPlayerCustomDataProvider->Release(); @@ -182,12 +180,11 @@ void UMediaPlayerWithCustomDataWidget::UnInitAgoraEngine() if (MediaPlayer) MediaPlayer->stop(); - RtcEngineProxy->destroyMediaPlayer(MediaPlayer); + AgoraUERtcEngine::Get()->destroyMediaPlayer(MediaPlayer); - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -207,10 +204,8 @@ int UMediaPlayerWithCustomDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -219,7 +214,7 @@ int UMediaPlayerWithCustomDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -228,13 +223,13 @@ int UMediaPlayerWithCustomDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -243,10 +238,8 @@ int UMediaPlayerWithCustomDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE int UMediaPlayerWithCustomDataWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -256,20 +249,20 @@ int UMediaPlayerWithCustomDataWidget::ReleaseVideoView(uint32 uid, agora::rtc::V if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -374,7 +367,7 @@ void UMediaPlayerWithCustomDataWidget::FUserRtcEventHandlerEx::onUserOffline(con #pragma region AgoraCallback - IMediaPlayerSourceObserver -void UMediaPlayerWithCustomDataWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) +void UMediaPlayerWithCustomDataWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason) { if (!IsWidgetValid()) return; @@ -403,7 +396,7 @@ void UMediaPlayerWithCustomDataWidget::FUserIMediaPlayerSourceObserver::onPlayer }); } -void UMediaPlayerWithCustomDataWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms) +void UMediaPlayerWithCustomDataWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t positionMs, int64_t timestampMs) { } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayerWithCustomDataProvide/MediaPlayerWithCustomDataWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayerWithCustomDataProvide/MediaPlayerWithCustomDataWidget.h index c05077de..60c85166 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayerWithCustomDataProvide/MediaPlayerWithCustomDataWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaPlayerWithCustomDataProvide/MediaPlayerWithCustomDataWidget.h @@ -77,10 +77,11 @@ class AGORAEXAMPLE_API UMediaPlayerWithCustomDataWidget : public UBaseAgoraUserW FUserIMediaPlayerSourceObserver(UMediaPlayerWithCustomDataWidget* Widget) : WidgetPtr(Widget) {} - void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) override; + void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, + media::base::MEDIA_PLAYER_REASON reason) override; - void onPositionChanged(int64_t position_ms) override; + void onPositionChanged(int64_t positionMs, int64_t timestampMs) override; void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override; @@ -249,7 +250,7 @@ class AGORAEXAMPLE_API UMediaPlayerWithCustomDataWidget : public UBaseAgoraUserW FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + agora::agora_refptr MediaPlayer; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaRecorder/MediaRecorderWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaRecorder/MediaRecorderWidget.cpp index 10aab650..1fc813d7 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaRecorder/MediaRecorderWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaRecorder/MediaRecorderWidget.cpp @@ -48,14 +48,12 @@ void UMediaRecorderWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FStrin Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -73,9 +71,9 @@ void UMediaRecorderWidget::ShowUserGuide() void UMediaRecorderWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); ChannelMediaOptions Options; Options.publishMicrophoneTrack = true; @@ -85,7 +83,7 @@ void UMediaRecorderWidget::JoinChannel() Options.enableAudioRecordingOrPlayout = true; Options.clientRoleType = CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER; - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -134,12 +132,11 @@ void UMediaRecorderWidget::NativeDestruct() void UMediaRecorderWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -160,10 +157,8 @@ int UMediaRecorderWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -172,7 +167,7 @@ int UMediaRecorderWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -181,13 +176,13 @@ int UMediaRecorderWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -196,10 +191,8 @@ int UMediaRecorderWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP int UMediaRecorderWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -209,20 +202,20 @@ int UMediaRecorderWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_ if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -331,7 +324,7 @@ void UMediaRecorderWidget::FUserRtcEventHandlerEx::onUserOffline(const agora::rt #pragma region AgoraCallback - IMediaRecorderObserver -void UMediaRecorderWidget::FUserMediaRecorderObserver::onRecorderStateChanged(const char* channelId, agora::rtc::uid_t uid, agora::media::RecorderState state, agora::media::RecorderErrorCode error) +void UMediaRecorderWidget::FUserMediaRecorderObserver::onRecorderStateChanged(const char* channelId, rtc::uid_t uid, RecorderState state, RecorderReasonCode reason) { if (!IsWidgetValid()) return; @@ -347,15 +340,18 @@ void UMediaRecorderWidget::FUserMediaRecorderObserver::onRecorderStateChanged(co UBFL_Logger::Print(FString::Printf(TEXT("%s bIsDestruct "), *FString(FUNCTION_MACRO))); return; } - UBFL_Logger::Print(FString::Printf(TEXT("%s channelId=%s uid=%u state=%d error=%d"), *FString(FUNCTION_MACRO), UTF8_TO_TCHAR(channelId), uid, (int)state, (int)error), WidgetPtr->GetLogMsgViewPtr()); + UBFL_Logger::Print(FString::Printf(TEXT("%s channelId=%s uid=%u state=%d error=%d"), *FString(FUNCTION_MACRO), UTF8_TO_TCHAR(channelId), uid, (int)state, (int)reason), WidgetPtr->GetLogMsgViewPtr()); }); } -void UMediaRecorderWidget::FUserMediaRecorderObserver::onRecorderInfoUpdated(const char* channelId, agora::rtc::uid_t uid, const agora::media::RecorderInfo& info) + +void UMediaRecorderWidget::FUserMediaRecorderObserver::onRecorderInfoUpdated(const char* channelId, rtc::uid_t uid, const RecorderInfo& info) { if (!IsWidgetValid()) return; + FString ChannelID = UTF8_TO_TCHAR(channelId); + #if ((__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) AsyncTask(ENamedThreads::GameThread, [=, this]() #else @@ -367,9 +363,10 @@ void UMediaRecorderWidget::FUserMediaRecorderObserver::onRecorderInfoUpdated(con UBFL_Logger::Print(FString::Printf(TEXT("%s bIsDestruct "), *FString(FUNCTION_MACRO))); return; } - UBFL_Logger::Print(FString::Printf(TEXT("%s channelId=%s uid=%u"), *FString(FUNCTION_MACRO), UTF8_TO_TCHAR(channelId), uid), WidgetPtr->GetLogMsgViewPtr()); + UBFL_Logger::Print(FString::Printf(TEXT("%s channelId=%s uid=%u"), *FString(FUNCTION_MACRO),*ChannelID, uid), WidgetPtr->GetLogMsgViewPtr()); }); } + #pragma endregion diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaRecorder/MediaRecorderWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaRecorder/MediaRecorderWidget.h index e92161f3..57e59229 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaRecorder/MediaRecorderWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MediaRecorder/MediaRecorderWidget.h @@ -22,6 +22,8 @@ #include "MediaRecorderWidget.generated.h" using namespace agora::rtc; +using namespace agora::media; +using namespace agora; /** * @@ -71,11 +73,10 @@ class AGORAEXAMPLE_API UMediaRecorderWidget : public UBaseAgoraUserWidget #pragma region AgoraCallback - IMediaRecorderObserver + void onRecorderStateChanged(const char* channelId, rtc::uid_t uid, RecorderState state, RecorderReasonCode reason) override; - void onRecorderStateChanged(const char* channelId, agora::rtc::uid_t uid, agora::media::RecorderState state, agora::media::RecorderErrorCode error) override; - - void onRecorderInfoUpdated(const char* channelId, agora::rtc::uid_t uid, const agora::media::RecorderInfo& info) override; + void onRecorderInfoUpdated(const char* channelId, rtc::uid_t uid, const RecorderInfo& info) override; #pragma endregion @@ -162,7 +163,7 @@ class AGORAEXAMPLE_API UMediaRecorderWidget : public UBaseAgoraUserWidget std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); Info.channelId = StdStrChannelName.c_str(); Info.uid = uid; - LocalRecorder = RtcEngineProxy->createMediaRecorder(Info); + LocalRecorder = AgoraUERtcEngine::Get()->createMediaRecorder(Info); UserMediaRecorderObserver = MakeShared(this); LocalRecorder->setMediaRecorderObserver(UserMediaRecorderObserver.Get()); @@ -181,7 +182,7 @@ class AGORAEXAMPLE_API UMediaRecorderWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + TSharedPtr UserRtcEventHandlerEx; TSharedPtr UserMediaRecorderObserver; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/Metadata/MetadataWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/Metadata/MetadataWidget.cpp index 54b75fc1..e8d856b0 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/Metadata/MetadataWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/Metadata/MetadataWidget.cpp @@ -50,18 +50,17 @@ void UMetadataWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString CHA Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s initialize ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); MetadataObserver = MakeShareable(new FUserMetadataObserver(this)); - int ret2 = RtcEngineProxy->registerMediaMetadataObserver(MetadataObserver.Get(), IMetadataObserver::METADATA_TYPE::VIDEO_METADATA); + int ret2 = AgoraUERtcEngine::Get()->registerMediaMetadataObserver(MetadataObserver.Get(), IMetadataObserver::METADATA_TYPE::VIDEO_METADATA); UBFL_Logger::Print(FString::Printf(TEXT("%s registerMediaMetadataObserver ret %d"), *FString(FUNCTION_MACRO), ret2), LogMsgViewPtr); } @@ -77,10 +76,10 @@ void UMetadataWidget::ShowUserGuide() void UMetadataWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -115,13 +114,12 @@ void UMetadataWidget::NativeDestruct() void UMetadataWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->unregisterMediaMetadataObserver(MetadataObserver.Get(), IMetadataObserver::METADATA_TYPE::VIDEO_METADATA); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Get()->unregisterMediaMetadataObserver(MetadataObserver.Get(), IMetadataObserver::METADATA_TYPE::VIDEO_METADATA); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -142,10 +140,8 @@ int UMetadataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sou channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -154,7 +150,7 @@ int UMetadataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sou if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -163,13 +159,13 @@ int UMetadataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sou videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -178,10 +174,8 @@ int UMetadataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sou int UMetadataWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -191,20 +185,20 @@ int UMetadataWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/Metadata/MetadataWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/Metadata/MetadataWidget.h index f19eb577..ac5b5d2c 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/Metadata/MetadataWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/Metadata/MetadataWidget.h @@ -172,7 +172,6 @@ class AGORAEXAMPLE_API UMetadataWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngine* RtcEngineProxy; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MusicPlayer/MusicPlayerWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MusicPlayer/MusicPlayerWidget.cpp index b881fa6b..a2d1c2f8 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MusicPlayer/MusicPlayerWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MusicPlayer/MusicPlayerWidget.cpp @@ -27,14 +27,12 @@ void UMusicPlayerWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -64,8 +62,8 @@ void UMusicPlayerWidget::OnBtnJoinChannelClicked() return; } - RtcEngineProxy->enableAudio(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); agora::rtc::MusicContentCenterConfiguration Config; std::string StdStrAppID = TCHAR_TO_UTF8(*ET_RTMAPPID->GetText().ToString()); @@ -75,7 +73,7 @@ void UMusicPlayerWidget::OnBtnJoinChannelClicked() Config.mccUid = FCString::Atoi64(*ET_RTMUID->GetText().ToString()); Config.maxCacheSize = 10; - RtcEngineProxy->queryInterface(AGORA_IID_MUSIC_CONTENT_CENTER, (void**)&MusicContentCenterPtr); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_MUSIC_CONTENT_CENTER, (void**)&MusicContentCenterPtr); int ret = MusicContentCenterPtr->initialize(Config); UBFL_Logger::Print(FString::Printf(TEXT("%s MusicContentCenterPtr initialize ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); if (ret != 0) @@ -101,7 +99,7 @@ void UMusicPlayerWidget::OnBtnJoinChannelClicked() UBFL_Logger::Print(FString::Printf(TEXT("%s MediaPlayer ID = %d"), *FString(FUNCTION_MACRO), MediaPlayerID), LogMsgViewPtr); } - int ret2 = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); + int ret2 = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, Options); UBFL_Logger::Print(FString::Printf(TEXT("%s JoinChannel ret %d"), *FString(FUNCTION_MACRO), ret2), LogMsgViewPtr); } @@ -254,11 +252,11 @@ void UMusicPlayerWidget::NativeDestruct() void UMusicPlayerWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { if (MusicPlayer) { MusicPlayer->unregisterPlayerSourceObserver(UserIMediaPlayerSourceObserver.Get()); - RtcEngineProxy->destroyMediaPlayer(MusicPlayer); + AgoraUERtcEngine::Get()->destroyMediaPlayer(MusicPlayer); } if (MusicContentCenterPtr != nullptr) { @@ -267,11 +265,10 @@ void UMusicPlayerWidget::UnInitAgoraEngine() MusicContentCenterPtr = nullptr; } - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -387,10 +384,8 @@ int UMusicPlayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -399,7 +394,7 @@ int UMusicPlayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -408,13 +403,13 @@ int UMusicPlayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -423,10 +418,8 @@ int UMusicPlayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE int UMusicPlayerWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -436,20 +429,20 @@ int UMusicPlayerWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TY if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -556,13 +549,13 @@ void UMusicPlayerWidget::FUserRtcEventHandlerEx::onUserOffline(const agora::rtc: #pragma region AgoraCallback - IMediaPlayerSourceObserver -void UMusicPlayerWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) +void UMusicPlayerWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason) { if (state == media::base::MEDIA_PLAYER_STATE::PLAYER_STATE_OPEN_COMPLETED) WidgetPtr->GetMusicPlayer()->play(); } -void UMusicPlayerWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms) +void UMusicPlayerWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t positionMs, int64_t timestampMs) { } @@ -617,7 +610,7 @@ void UMusicPlayerWidget::FUserIMediaPlayerSourceObserver::onAudioVolumeIndicatio #pragma region AgoraCallback - IMusicContentCenterEventHandler -void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onMusicChartsResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode error_code) +void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onMusicChartsResult(const char* requestId, agora_refptr result, MusicContentCenterStateReason reason) { if (!IsWidgetValid()) return; @@ -643,7 +636,7 @@ void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onMusicChartsResul }); } -void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onMusicCollectionResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode error_code) +void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onMusicCollectionResult(const char* requestId, agora_refptr result, MusicContentCenterStateReason reason) { if (!IsWidgetValid()) return; @@ -670,9 +663,8 @@ void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onMusicCollectionR }); } -void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onLyricResult(const char* requestId, const char* lyricUrl, MusicContentCenterStatusCode error_code) +void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onLyricResult(const char* requestId, int64_t songCode, const char* lyricUrl, MusicContentCenterStateReason reason) { - if (!IsWidgetValid()) return; @@ -692,12 +684,42 @@ void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onLyricResult(cons UBFL_Logger::Print(FString::Printf(TEXT("%s bIsDestruct "), *FString(FUNCTION_MACRO))); return; } - UBFL_Logger::Print(FString::Printf(TEXT("%s LyricURL=%s RequestId=%s error_code=%d"), *FString(FUNCTION_MACRO), *URLLyric, *RequestId, error_code), WidgetPtr->GetLogMsgViewPtr()); + UBFL_Logger::Print(FString::Printf(TEXT("%s LyricURL=%s RequestId=%s error_code=%d"), *FString(FUNCTION_MACRO), *URLLyric, *RequestId, reason), WidgetPtr->GetLogMsgViewPtr()); + }); +} + + +void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onSongSimpleInfoResult(const char* requestId, int64_t songCode, const char* simpleInfo, MusicContentCenterStateReason reason) +{ + + if (!IsWidgetValid()) + return; + + + FString RequestId = UTF8_TO_TCHAR(requestId); + FString SimpleInfo = UTF8_TO_TCHAR(simpleInfo); + + +#if ((__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!IsWidgetValid()) + { + UBFL_Logger::Print(FString::Printf(TEXT("%s bIsDestruct "), *FString(FUNCTION_MACRO))); + return; + } + UBFL_Logger::Print(FString::Printf(TEXT("%s RequestId=%s SongCode=%lld SimpleInfo=%s error_code=%d"), *FString(FUNCTION_MACRO), *RequestId,songCode, *SimpleInfo, reason), WidgetPtr->GetLogMsgViewPtr()); }); } -void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onPreLoadEvent(int64_t songCode, int percent, const char* lyricUrl, PreloadStatusCode status, MusicContentCenterStatusCode error_code) + +void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onPreLoadEvent(const char* requestId, int64_t songCode, int percent, const char* lyricUrl, PreloadState state, MusicContentCenterStateReason reason) { + + if (!IsWidgetValid()) return; @@ -714,10 +736,11 @@ void UMusicPlayerWidget::FUserMusicContentCenterEventHandler::onPreLoadEvent(int UBFL_Logger::Print(FString::Printf(TEXT("%s bIsDestruct "), *FString(FUNCTION_MACRO))); return; } - UBFL_Logger::Print(FString::Printf(TEXT("%s songcode=%d percent=%d LyricURL=%s status=%d errorcode=%d "), *FString(FUNCTION_MACRO), songCode, percent, *URLLyric, status, error_code), WidgetPtr->GetLogMsgViewPtr()); + UBFL_Logger::Print(FString::Printf(TEXT("%s songcode=%d percent=%d LyricURL=%s status=%d errorcode=%d "), *FString(FUNCTION_MACRO), songCode, percent, *URLLyric, state, reason), WidgetPtr->GetLogMsgViewPtr()); }); } + #pragma endregion diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MusicPlayer/MusicPlayerWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MusicPlayer/MusicPlayerWidget.h index e353c099..1e629239 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MusicPlayer/MusicPlayerWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/MusicPlayer/MusicPlayerWidget.h @@ -73,10 +73,11 @@ class AGORAEXAMPLE_API UMusicPlayerWidget : public UBaseAgoraUserWidget FUserIMediaPlayerSourceObserver(UMusicPlayerWidget* Widget) : WidgetPtr(Widget) {} - void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) override; + void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, + media::base::MEDIA_PLAYER_REASON reason) override; - void onPositionChanged(int64_t position_ms) override; + void onPositionChanged(int64_t positionMs, int64_t timestampMs) override; void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override; @@ -122,16 +123,18 @@ class AGORAEXAMPLE_API UMusicPlayerWidget : public UBaseAgoraUserWidget #pragma region AgoraCallback - IMusicContentCenterEventHandler - void onMusicChartsResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode error_code) override; + void onMusicChartsResult(const char* requestId, agora_refptr result, MusicContentCenterStateReason reason) override; - void onMusicCollectionResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode error_code) override; + void onMusicCollectionResult(const char* requestId, agora_refptr result, MusicContentCenterStateReason reason) override; - void onLyricResult(const char* requestId, const char* lyricUrl, MusicContentCenterStatusCode error_code) override; + void onLyricResult(const char* requestId, int64_t songCode, const char* lyricUrl, MusicContentCenterStateReason reason) override; - void onPreLoadEvent(int64_t songCode, int percent, const char* lyricUrl, PreloadStatusCode status, MusicContentCenterStatusCode error_code) override; + void onSongSimpleInfoResult(const char* requestId, int64_t songCode, const char* simpleInfo, MusicContentCenterStateReason reason) override; + + void onPreLoadEvent(const char* requestId, int64_t songCode, int percent, const char* lyricUrl, PreloadState state, MusicContentCenterStateReason reason) override; #pragma endregion inline bool IsWidgetValid() { return WidgetPtr.IsValid(); } @@ -286,7 +289,6 @@ class AGORAEXAMPLE_API UMusicPlayerWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngine* RtcEngineProxy; agora::media::IMediaEngine* MusicContentCenter; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessAudioRawData/ProcessAudioRawDataWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessAudioRawData/ProcessAudioRawDataWidget.cpp index 0e05340a..3460a817 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessAudioRawData/ProcessAudioRawDataWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessAudioRawData/ProcessAudioRawDataWidget.cpp @@ -78,17 +78,15 @@ void UProcessAudioRawDataWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - RtcEngineProxy->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); UserAudioFrameObserver = MakeShared(this); MediaEngine->registerAudioFrameObserver(UserAudioFrameObserver.Get()); } @@ -112,18 +110,18 @@ void UProcessAudioRawDataWidget::OnBtnJoinChannelClicked() { // Mute the playback volume of SDK (not UE). - RtcEngineProxy->adjustPlaybackSignalVolume(0); + AgoraUERtcEngine::Get()->adjustPlaybackSignalVolume(0); - RtcEngineProxy->enableAudio(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UProcessAudioRawDataWidget::OnBtnLeaveChannelClicked() { - int ret = RtcEngineProxy->leaveChannel(); + int ret = AgoraUERtcEngine::Get()->leaveChannel(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -153,16 +151,15 @@ void UProcessAudioRawDataWidget::NativeDestruct() void UProcessAudioRawDataWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); + AgoraUERtcEngine::Get()->leaveChannel(); if (MediaEngine != nullptr) { MediaEngine->registerAudioFrameObserver(nullptr); } - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessAudioRawData/ProcessAudioRawDataWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessAudioRawData/ProcessAudioRawDataWidget.h index 77e4232b..196e7449 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessAudioRawData/ProcessAudioRawDataWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessAudioRawData/ProcessAudioRawDataWidget.h @@ -193,7 +193,7 @@ class AGORAEXAMPLE_API UProcessAudioRawDataWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + agora::media::IMediaEngine* MediaEngine; agora::rtc::uid_t FirstRemoteUID = 0; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessVideoRawData/ProcessVideoRawDataWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessVideoRawData/ProcessVideoRawDataWidget.cpp index 50748dfc..db3e98f8 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessVideoRawData/ProcessVideoRawDataWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessVideoRawData/ProcessVideoRawDataWidget.cpp @@ -50,18 +50,16 @@ void UProcessVideoRawDataWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - RtcEngineProxy->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); UserVideoFrameObserver = MakeShared(this); MediaEngine->registerVideoFrameObserver(UserVideoFrameObserver.Get()); } @@ -85,10 +83,10 @@ void UProcessVideoRawDataWidget::OnBtnBackToHomeClicked() void UProcessVideoRawDataWidget::OnBtnJoinChannelClicked() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); MakeVideoViewForRawData(); @@ -97,7 +95,7 @@ void UProcessVideoRawDataWidget::OnBtnJoinChannelClicked() void UProcessVideoRawDataWidget::OnBtnLeaveChannelClicked() { - int ret = RtcEngineProxy->leaveChannel(); + int ret = AgoraUERtcEngine::Get()->leaveChannel(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); ReleaseVideoViewForRawData(); } @@ -116,9 +114,9 @@ void UProcessVideoRawDataWidget::NativeDestruct() void UProcessVideoRawDataWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); + AgoraUERtcEngine::Get()->leaveChannel(); ReleaseVideoViewForRawData(); if (MediaEngine != nullptr) @@ -126,9 +124,8 @@ void UProcessVideoRawDataWidget::UnInitAgoraEngine() MediaEngine->registerVideoFrameObserver(nullptr); } - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -136,57 +133,57 @@ void UProcessVideoRawDataWidget::UnInitAgoraEngine() void UProcessVideoRawDataWidget::RenderRawData(agora::media::base::VideoFrame& videoFrame) { - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - - int Width = videoFrame.width; - int Height = videoFrame.height; - uint8* rawdata = new uint8[Width * Height * 4]; - memcpy(rawdata, videoFrame.yBuffer, Width * Height * 4); - - -#if ((__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - TWeakObjectPtr VideoRenderViewWeakPtr(VideoRenderView); - if (!VideoRenderViewWeakPtr.IsValid()) - return; - - if (RenderTexture == nullptr || !RenderTexture->IsValidLowLevel() || RenderTexture->GetSizeX() != Width || RenderTexture->GetSizeY() != Height) - RenderTexture = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8); - - uint8* raw = (uint8*)RenderTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); - memcpy(raw, rawdata, Width * Height * 4); - delete[] rawdata; - RenderTexture->PlatformData->Mips[0].BulkData.Unlock(); - -#ifdef UpdateResource -#undef UpdateResource - - // For PLATFORM Windows - RenderTexture->UpdateResource(); - -#define UpdateResource UpdateResourceW - -#else - RenderTexture->UpdateResource(); -#endif - RenderBrush.SetResourceObject(RenderTexture); - RenderBrush.SetImageSize(FVector2D(Width, Height)); - - VideoRenderViewWeakPtr->View->SetBrush(RenderBrush); - - UCanvasPanelSlot* CanvasPanelSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot(VideoRenderViewWeakPtr.Get()); - CanvasPanelSlot->SetSize(FVector2D(Width, Height)); - - }); +// TWeakObjectPtr SelfWeakPtr(this); +// if (!SelfWeakPtr.IsValid()) +// return; +// +// int Width = videoFrame.width; +// int Height = videoFrame.height; +// uint8* rawdata = new uint8[Width * Height * 4]; +// memcpy(rawdata, videoFrame.yBuffer, Width * Height * 4); +// +// +//#if ((__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) +// AsyncTask(ENamedThreads::GameThread, [=, this]() +//#else +// AsyncTask(ENamedThreads::GameThread, [=]() +//#endif +// { +// if (!SelfWeakPtr.IsValid()) +// return; +// +// TWeakObjectPtr VideoRenderViewWeakPtr(VideoRenderView); +// if (!VideoRenderViewWeakPtr.IsValid()) +// return; +// +// if (RenderTexture == nullptr || !RenderTexture->IsValidLowLevel() || RenderTexture->GetSizeX() != Width || RenderTexture->GetSizeY() != Height) +// RenderTexture = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8); +// +// uint8* raw = (uint8*)RenderTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); +// memcpy(raw, rawdata, Width * Height * 4); +// delete[] rawdata; +// RenderTexture->PlatformData->Mips[0].BulkData.Unlock(); +// +//#ifdef UpdateResource +//#undef UpdateResource +// +// // For PLATFORM Windows +// RenderTexture->UpdateResource(); +// +//#define UpdateResource UpdateResourceW +// +//#else +// RenderTexture->UpdateResource(); +//#endif +// RenderBrush.SetResourceObject(RenderTexture); +// RenderBrush.SetImageSize(FVector2D(Width, Height)); +// +// VideoRenderViewWeakPtr->View->SetBrush(RenderBrush); +// +// UCanvasPanelSlot* CanvasPanelSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot(VideoRenderViewWeakPtr.Get()); +// CanvasPanelSlot->SetSize(FVector2D(Width, Height)); +// +// }); } @@ -228,10 +225,8 @@ int UProcessVideoRawDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOUR channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -240,7 +235,7 @@ int UProcessVideoRawDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOUR if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -249,13 +244,13 @@ int UProcessVideoRawDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOUR videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -264,10 +259,8 @@ int UProcessVideoRawDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOUR int UProcessVideoRawDataWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -277,20 +270,20 @@ int UProcessVideoRawDataWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_S if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessVideoRawData/ProcessVideoRawDataWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessVideoRawData/ProcessVideoRawDataWidget.h index 9ef24f29..f8c1f24a 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessVideoRawData/ProcessVideoRawDataWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ProcessVideoRawData/ProcessVideoRawDataWidget.h @@ -183,7 +183,7 @@ class AGORAEXAMPLE_API UProcessVideoRawDataWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + agora::media::IMediaEngine* MediaEngine; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/PushEncodedVideoImage/PushEncodedVideoImageWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/PushEncodedVideoImage/PushEncodedVideoImageWidget.cpp index 77b67700..6343ef9e 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/PushEncodedVideoImage/PushEncodedVideoImageWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/PushEncodedVideoImage/PushEncodedVideoImageWidget.cpp @@ -53,10 +53,8 @@ void UPushEncodedVideoImageWidget::InitAgoraEngine(FString APP_ID, FString TOKEN Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - - RtcEngineProxy->initialize(RtcEngineContext); - RtcEngineProxy->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + AgoraUERtcEngine::Get()->initialize(RtcEngineContext); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); VideoObserver = MakeShareable(new FUserIVideoEncodedFrameObserver(this)); int ret = MediaEngine->registerVideoEncodedFrameObserver(VideoObserver.Get()); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); @@ -80,9 +78,9 @@ void UPushEncodedVideoImageWidget::ShowUserGuide() { FString Guide = "Case: [PushEncodedVideoImage]\n" - "1. You can use 2 PushEncodedVideoImage examples to connect with each other. One handles the image pushing job, and the other one receives the images.\n" - "2. It will launch a timer to send data continuously.\n" - "3. Currently, the example case only prints logs.\n" + "1. In this example, we send 1 H.264 frame's data to demo the usage of API PushEncodedVideoImage.\n" + "2. We join channel twice: UID1 receives the encoded image, and UID2 handles the encoded image pushing job.\n" + "3. It will launch a timer to send data continuously.\n" ""; UBFL_Logger::DisplayUserGuide(Guide, LogMsgViewPtr); @@ -90,8 +88,8 @@ void UPushEncodedVideoImageWidget::ShowUserGuide() void UPushEncodedVideoImageWidget::JoinChannel() { - RtcEngineProxy->setClientRole(CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); - RtcEngineProxy->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableVideo(); ChannelMediaOptions option; option.autoSubscribeVideo = true; @@ -107,14 +105,14 @@ void UPushEncodedVideoImageWidget::JoinChannel() connection.channelId = StdStrChannelName.c_str(); connection.localUid = UID1; - int ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, option, nullptr); + int ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, option, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UPushEncodedVideoImageWidget::JoinChannel2() { - RtcEngineProxy->setClientRole(CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); - RtcEngineProxy->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableVideo(); SenderOptions SenderOptions; @@ -143,7 +141,7 @@ void UPushEncodedVideoImageWidget::JoinChannel2() connection.channelId = StdStrChannelName.c_str(); connection.localUid = UID2; - int ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, option, nullptr); + int ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, option, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -164,12 +162,11 @@ void UPushEncodedVideoImageWidget::NativeDestruct() void UPushEncodedVideoImageWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -191,16 +188,22 @@ void UPushEncodedVideoImageWidget::UpdateForPushEncodeVideoImage() UE_LOG(LogTemp, Warning, TEXT("UpdateForPushEncodeVideoImage")); // you can send any data, not only video image. agora::rtc::EncodedVideoFrameInfo ValEncodedVideoFrameInfo; - ValEncodedVideoFrameInfo.framesPerSecond = 60; - ValEncodedVideoFrameInfo.codecType = VIDEO_CODEC_TYPE::VIDEO_CODEC_GENERIC; + ValEncodedVideoFrameInfo.framesPerSecond = 10; + ValEncodedVideoFrameInfo.codecType = VIDEO_CODEC_TYPE::VIDEO_CODEC_H264; ValEncodedVideoFrameInfo.frameType = VIDEO_FRAME_TYPE::VIDEO_FRAME_TYPE_KEY_FRAME; - RtcEngineProxy->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + ValEncodedVideoFrameInfo.rotation = agora::rtc::VIDEO_ORIENTATION::VIDEO_ORIENTATION_0; + ValEncodedVideoFrameInfo.streamType = agora::rtc::VIDEO_STREAM_HIGH; + // hard-coded + ValEncodedVideoFrameInfo.width = 800; + ValEncodedVideoFrameInfo.height = 600; + ValEncodedVideoFrameInfo.captureTimeMs = AgoraUERtcEngine::Get()->getCurrentMonotonicTimeInMs(); //UTexture2D* Texture2D = NewObject(this,TEXT("EncodedData")); - FString Path = FPaths::ProjectContentDir() / TEXT("Image/jpg.jpg"); + FString Path = FPaths::ProjectContentDir() / TEXT("Image/output_frame.h264"); TArray FileData; if (!FFileHelper::LoadFileToArray(FileData, *Path)) { @@ -227,10 +230,8 @@ int UPushEncodedVideoImageWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SO channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -239,7 +240,7 @@ int UPushEncodedVideoImageWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SO if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -248,13 +249,13 @@ int UPushEncodedVideoImageWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SO videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -263,10 +264,8 @@ int UPushEncodedVideoImageWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SO int UPushEncodedVideoImageWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -276,20 +275,20 @@ int UPushEncodedVideoImageWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -320,13 +319,13 @@ void UPushEncodedVideoImageWidget::FUserRtcEventHandlerEx::onJoinChannelSuccess( UBFL_Logger::Print(FString::Printf(TEXT("%s"), *FString(FUNCTION_MACRO)), WidgetPtr->GetLogMsgViewPtr()); - if (connection.localUid > 1000) { + if (connection.localUid == WidgetPtr->GetUID2()) { UBFL_Logger::Print(FString::Printf(TEXT("%s In [UID2]"), *FString(FUNCTION_MACRO)), WidgetPtr->GetLogMsgViewPtr()); WidgetPtr->StartPushEncodeVideoImage(); } else { UBFL_Logger::Print(FString::Printf(TEXT("%s In [UID1]"), *FString(FUNCTION_MACRO)), WidgetPtr->GetLogMsgViewPtr()); - WidgetPtr->MakeVideoView(0, agora::rtc::VIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA); + //WidgetPtr->MakeVideoView(0, agora::rtc::VIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA); } }); @@ -352,13 +351,13 @@ void UPushEncodedVideoImageWidget::FUserRtcEventHandlerEx::onLeaveChannel(const - if (connection.localUid >= 1000) + if (connection.localUid == WidgetPtr->GetUID2()) { WidgetPtr->StopPushEncodeVideoImage(); } else { - WidgetPtr->ReleaseVideoView(0, agora::rtc::VIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA); + //WidgetPtr->ReleaseVideoView(0, agora::rtc::VIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA); } }); @@ -369,8 +368,8 @@ void UPushEncodedVideoImageWidget::FUserRtcEventHandlerEx::onUserJoined(const ag if (!IsWidgetValid()) return; - if (remoteUid == WidgetPtr->GetUID1() || remoteUid == WidgetPtr->GetUID2()) - return; + //if (remoteUid == WidgetPtr->GetUID1() || remoteUid == WidgetPtr->GetUID2()) + // return; #if ((__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) AsyncTask(ENamedThreads::GameThread, [=, this]() @@ -386,20 +385,15 @@ void UPushEncodedVideoImageWidget::FUserRtcEventHandlerEx::onUserJoined(const ag UBFL_Logger::Print(FString::Printf(TEXT("%s remote uid=%u"), *FString(FUNCTION_MACRO), remoteUid), WidgetPtr->GetLogMsgViewPtr()); - if (remoteUid > 1000) { - - WidgetPtr->StartPushEncodeVideoImage(); - VideoSubscriptionOptions options; - options.encodedFrameOnly = true; - int ret = WidgetPtr->GetRtcEngine()->setRemoteVideoSubscriptionOptionsEx(remoteUid, options, connection); - UBFL_Logger::Print(FString::Printf(TEXT("%s rUPushEncodedVideoImageWidget::onUserJoined In [UID2] %d ret %d"), *FString(FUNCTION_MACRO), remoteUid, ret), WidgetPtr->GetLogMsgViewPtr()); + if(connection.localUid == WidgetPtr->GetUID1() && remoteUid == WidgetPtr->GetUID2()){ + + // For UID1's connection to Remote UID2 - } - else { UBFL_Logger::Print(FString::Printf(TEXT("%s In [UID1] "), *FString(FUNCTION_MACRO)), WidgetPtr->GetLogMsgViewPtr()); WidgetPtr->MakeVideoView(remoteUid, agora::rtc::VIDEO_SOURCE_TYPE::VIDEO_SOURCE_REMOTE, WidgetPtr->GetChannelName()); } + }); } @@ -408,8 +402,8 @@ void UPushEncodedVideoImageWidget::FUserRtcEventHandlerEx::onUserOffline(const a if (!IsWidgetValid()) return; - if (remoteUid == WidgetPtr->GetUID1() || remoteUid == WidgetPtr->GetUID2()) - return; + //if (remoteUid == WidgetPtr->GetUID1() || remoteUid == WidgetPtr->GetUID2()) + // return; #if ((__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) AsyncTask(ENamedThreads::GameThread, [=, this]() @@ -425,12 +419,12 @@ void UPushEncodedVideoImageWidget::FUserRtcEventHandlerEx::onUserOffline(const a UBFL_Logger::Print(FString::Printf(TEXT("%s remote uid=%u"), *FString(FUNCTION_MACRO), remoteUid), WidgetPtr->GetLogMsgViewPtr()); - if (remoteUid >= 1000) - { - } - else - { + + if (connection.localUid == WidgetPtr->GetUID1() && remoteUid == WidgetPtr->GetUID2()) { + + // For UID1's connection to Remote UID2 + WidgetPtr->ReleaseVideoView(remoteUid, agora::rtc::VIDEO_SOURCE_TYPE::VIDEO_SOURCE_REMOTE, WidgetPtr->GetChannelName()); } @@ -467,10 +461,9 @@ bool UPushEncodedVideoImageWidget::FUserIVideoEncodedFrameObserver::onEncodedVid if (IsWidgetValid()) { // filter out the type only you wanted. - // Otherwise, you will also receive the video data. - if (videoEncodedFrameInfo.codecType == VIDEO_CODEC_GENERIC) + if (videoEncodedFrameInfo.codecType == VIDEO_CODEC_H264) { - UBFL_Logger::Print(FString::Printf(TEXT("%s uid=%u"), *FString(FUNCTION_MACRO), uid), WidgetPtr->GetLogMsgViewPtr()); + UBFL_Logger::Print(FString::Printf(TEXT("%s uid=%u buffer length %d"), *FString(FUNCTION_MACRO), uid, length), WidgetPtr->GetLogMsgViewPtr()); } } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/PushEncodedVideoImage/PushEncodedVideoImageWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/PushEncodedVideoImage/PushEncodedVideoImageWidget.h index 388adb5c..cfa68619 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/PushEncodedVideoImage/PushEncodedVideoImageWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/PushEncodedVideoImage/PushEncodedVideoImageWidget.h @@ -5,7 +5,7 @@ #include "CoreMinimal.h" #include "../../BaseAgoraUserWidget.h" #include "AgoraPluginInterface.h" -#include "AgoraPlugin/Private/AgoraCppPlugin/include/VideoObserverInternal.h" +//#include "AgoraPlugin/Private/AgoraCppPlugin/include/AgoraUEVideoFrameObserver.h" // UI #include "Components/Button.h" @@ -147,7 +147,7 @@ class AGORAEXAMPLE_API UPushEncodedVideoImageWidget : public UBaseAgoraUserWidge public: inline FString GetAppId() { return AppId; }; inline FString GetToken() { return Token; }; - inline IRtcEngineEx* GetRtcEngine() { return RtcEngineProxy; }; + inline IRtcEngineEx* GetRtcEngine() { return AgoraUERtcEngine::Get(); }; inline FString GetChannelName() { return ChannelName; }; inline uint32 GetUID1() { return UID1; }; @@ -177,7 +177,7 @@ class AGORAEXAMPLE_API UPushEncodedVideoImageWidget : public UBaseAgoraUserWidge FString Token; FString ChannelName; - IRtcEngineEx* RtcEngineProxy; + agora::media::IMediaEngine* MediaEngine; TSharedPtr VideoObserver; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShare/ScreenShareWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShare/ScreenShareWidget.cpp index d4bec50f..3f9ca488 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShare/ScreenShareWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShare/ScreenShareWidget.cpp @@ -65,14 +65,12 @@ void UScreenShareWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -105,7 +103,7 @@ void UScreenShareWidget::PrepareScreenShare() size.height = 240; #endif - infos = RtcEngineProxy->getScreenCaptureSources(size, size, true); + infos = AgoraUERtcEngine::Get()->getScreenCaptureSources(size, size, true); if (infos == nullptr) { @@ -127,15 +125,15 @@ void UScreenShareWidget::PrepareScreenShare() #endif - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); #if PLATFORM_WINDOWS || PLATFORM_MAC // Share PC's Audio - RtcEngineProxy->enableLoopbackRecording(true); - RtcEngineProxy->adjustLoopbackSignalVolume(100); + AgoraUERtcEngine::Get()->enableLoopbackRecording(true); + AgoraUERtcEngine::Get()->adjustLoopbackSignalVolume(100); // On mobile platforms, we can use publishScreenCaptureAudio in ChannelMediaOptions #endif @@ -145,12 +143,12 @@ void UScreenShareWidget::PrepareScreenShare() void UScreenShareWidget::OnBtnStartScreenShareClicked() { - RtcEngineProxy->stopScreenCapture(); + AgoraUERtcEngine::Get()->stopScreenCapture(); #if PLATFORM_ANDROID || PLATFORM_IOS ScreenCaptureParameters2 parameters2; parameters2.captureAudio = true; parameters2.captureVideo = true; - auto ret = RtcEngineProxy->startScreenCapture(parameters2); + auto ret = AgoraUERtcEngine::Get()->startScreenCapture(parameters2); UE_LOG(LogTemp, Warning, TEXT("StartScreenShrareClick JoinChannel ====== %d"), ret); #else agora::rtc::ScreenCaptureParameters capParam; @@ -180,11 +178,11 @@ void UScreenShareWidget::OnBtnStartScreenShareClicked() int ret = -1; if (info.type == agora::rtc::ScreenCaptureSourceType_Screen) { - ret = RtcEngineProxy->startScreenCaptureByDisplayId((uint64)(info.sourceId), regionRect, capParam); + ret = AgoraUERtcEngine::Get()->startScreenCaptureByDisplayId((uint64)(info.sourceId), regionRect, capParam); } else if (info.type == agora::rtc::ScreenCaptureSourceType_Window) { - ret = RtcEngineProxy->startScreenCaptureByWindowId(info.sourceId, regionRect, capParam); + ret = AgoraUERtcEngine::Get()->startScreenCaptureByWindowId(info.sourceId, regionRect, capParam); } #endif @@ -210,10 +208,10 @@ void UScreenShareWidget::JoinChannel_ScreenShare() connection.channelId = StdStrChannelName.c_str(); connection.localUid = UID_Screen; - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, options); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, options); // [joinChannelEx] will unpublish your loopback audio stream in this version, it will be fixed in the next version. - //int ret = RtcEngineProxy->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, options, nullptr); + //int ret = AgoraUERtcEngine::Get()->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, options, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s uid=%u ret %d"), *FString(FUNCTION_MACRO), UID_Screen, ret), LogMsgViewPtr); } @@ -227,9 +225,9 @@ void UScreenShareWidget::OnBtnStopScreenShareClicked() connection.channelId = StdStrChannelName.c_str(); connection.localUid = UID_Screen; - int ret0 = RtcEngineProxy->stopScreenCapture(); - //int ret = RtcEngineProxy->leaveChannelEx(connection); - int ret = RtcEngineProxy->leaveChannel(); + int ret0 = AgoraUERtcEngine::Get()->stopScreenCapture(); + //int ret = AgoraUERtcEngine::Get()->leaveChannelEx(connection); + int ret = AgoraUERtcEngine::Get()->leaveChannel(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -245,12 +243,11 @@ void UScreenShareWidget::OnCBSDisplayIDSelectedValueChanged(FString SelectedItem void UScreenShareWidget::OnBtnBackToHomeClicked() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { UE_LOG(LogTemp, Warning, TEXT("UJoinChannelVideoTokenWidget::NativeDestruct")); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); } UGameplayStatics::OpenLevel(UGameplayStatics::GetPlayerController(GWorld, 0)->GetWorld(), FName("MainLevel")); } @@ -266,13 +263,12 @@ void UScreenShareWidget::NativeDestruct() void UScreenShareWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->stopScreenCapture(); - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->stopScreenCapture(); + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -294,10 +290,8 @@ int UScreenShareWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -306,7 +300,7 @@ int UScreenShareWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -315,13 +309,13 @@ int UScreenShareWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -330,10 +324,8 @@ int UScreenShareWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE int UScreenShareWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -343,20 +335,20 @@ int UScreenShareWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TY if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShare/ScreenShareWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShare/ScreenShareWidget.h index 7e00b97a..8476527d 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShare/ScreenShareWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShare/ScreenShareWidget.h @@ -166,7 +166,7 @@ class AGORAEXAMPLE_API UScreenShareWidget : public UBaseAgoraUserWidget #endif - IRtcEngineEx* RtcEngineProxy; + diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShareWhileVideoCall/ScreenShareWhileVideoCallWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShareWhileVideoCall/ScreenShareWhileVideoCallWidget.cpp index 6fe2d49b..14b73580 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShareWhileVideoCall/ScreenShareWhileVideoCallWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShareWhileVideoCall/ScreenShareWhileVideoCallWidget.cpp @@ -69,14 +69,12 @@ void UScreenShareWhileVideoCallWidget::InitAgoraEngine(FString APP_ID, FString T Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -122,7 +120,7 @@ void UScreenShareWhileVideoCallWidget::PrepareScreenShare() size.height = 240; #endif - infos = RtcEngineProxy->getScreenCaptureSources(size, size, true); + infos = AgoraUERtcEngine::Get()->getScreenCaptureSources(size, size, true); if (infos == nullptr) { @@ -146,9 +144,9 @@ void UScreenShareWhileVideoCallWidget::PrepareScreenShare() void UScreenShareWhileVideoCallWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); agora::rtc::ChannelMediaOptions ChannelMediaOptions; ChannelMediaOptions.autoSubscribeAudio = true; @@ -165,7 +163,7 @@ void UScreenShareWhileVideoCallWidget::JoinChannel() ChannelMediaOptions.enableAudioRecordingOrPlayout = true; ChannelMediaOptions.clientRoleType = CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER; - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), UID1_Camera, ChannelMediaOptions); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), UID1_Camera, ChannelMediaOptions); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -177,10 +175,10 @@ void UScreenShareWhileVideoCallWidget::OnBtnStartScreenShare() ScreenCaptureParameters2 parameters2; parameters2.captureAudio = true; parameters2.captureVideo = true; - auto ret = RtcEngineProxy->startScreenCapture(parameters2); + auto ret = AgoraUERtcEngine::Get()->startScreenCapture(parameters2); UE_LOG(LogTemp, Warning, TEXT("StartScreenShrareClick JoinChannel ====== %d"), ret); #else - RtcEngineProxy->stopScreenCapture(); + AgoraUERtcEngine::Get()->stopScreenCapture(); agora::rtc::ScreenCaptureParameters capParam; VideoDimensions dimensions(640, 360); capParam.dimensions = dimensions; @@ -208,11 +206,11 @@ void UScreenShareWhileVideoCallWidget::OnBtnStartScreenShare() int ret = -1; if (info.type == agora::rtc::ScreenCaptureSourceType_Screen) { - ret = RtcEngineProxy->startScreenCaptureByDisplayId((uint64)(info.sourceId), regionRect, capParam); + ret = AgoraUERtcEngine::Get()->startScreenCaptureByDisplayId((uint64)(info.sourceId), regionRect, capParam); } else if (info.type == agora::rtc::ScreenCaptureSourceType_Window) { - ret = RtcEngineProxy->startScreenCaptureByWindowId(info.sourceId, regionRect, capParam); + ret = AgoraUERtcEngine::Get()->startScreenCaptureByWindowId(info.sourceId, regionRect, capParam); } #endif @@ -239,7 +237,7 @@ void UScreenShareWhileVideoCallWidget::JoinChannel_ScreenShare() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); Connection.channelId = StdStrChannelName.c_str(); Connection.localUid = UID2_Screen; - int ret = RtcEngineProxy->joinChannelEx(TCHAR_TO_UTF8(*Token), Connection, ValChannelMediaOptions, nullptr); + int ret = AgoraUERtcEngine::Get()->joinChannelEx(TCHAR_TO_UTF8(*Token), Connection, ValChannelMediaOptions, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -249,8 +247,8 @@ void UScreenShareWhileVideoCallWidget::OnBtnStopScreenShare() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); Connection.channelId = StdStrChannelName.c_str(); Connection.localUid = UID2_Screen; - int ret0 = RtcEngineProxy->stopScreenCapture(); - int ret = RtcEngineProxy->leaveChannelEx(Connection); + int ret0 = AgoraUERtcEngine::Get()->stopScreenCapture(); + int ret = AgoraUERtcEngine::Get()->leaveChannelEx(Connection); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -281,13 +279,12 @@ void UScreenShareWhileVideoCallWidget::NativeDestruct() void UScreenShareWhileVideoCallWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->stopScreenCapture(); - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->stopScreenCapture(); + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -308,10 +305,8 @@ int UScreenShareWhileVideoCallWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -320,7 +315,7 @@ int UScreenShareWhileVideoCallWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -329,13 +324,13 @@ int UScreenShareWhileVideoCallWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -344,10 +339,8 @@ int UScreenShareWhileVideoCallWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE int UScreenShareWhileVideoCallWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -357,20 +350,20 @@ int UScreenShareWhileVideoCallWidget::ReleaseVideoView(uint32 uid, agora::rtc::V if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShareWhileVideoCall/ScreenShareWhileVideoCallWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShareWhileVideoCall/ScreenShareWhileVideoCallWidget.h index 0e0c1e5a..7e038967 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShareWhileVideoCall/ScreenShareWhileVideoCallWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/ScreenShareWhileVideoCall/ScreenShareWhileVideoCallWidget.h @@ -171,7 +171,7 @@ class AGORAEXAMPLE_API UScreenShareWhileVideoCallWidget : public UBaseAgoraUserW #endif - IRtcEngineEx* RtcEngineProxy; + diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetBeautyEffectOptions/SetBeautyEffectOptionsWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetBeautyEffectOptions/SetBeautyEffectOptionsWidget.cpp index 105888ab..8fe28cb4 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetBeautyEffectOptions/SetBeautyEffectOptionsWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetBeautyEffectOptions/SetBeautyEffectOptionsWidget.cpp @@ -47,17 +47,15 @@ void USetBeautyEffectOptionsWidget::InitAgoraEngine(FString APP_ID, FString TOKE Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - int Ret2 = RtcEngineProxy->enableExtension("agora_video_filters_clear_vision", "clear_vision"); + int Ret2 = AgoraUERtcEngine::Get()->enableExtension("agora_video_filters_clear_vision", "clear_vision"); UBFL_Logger::Print(FString::Printf(TEXT("%s ret2 %d"), *FString(FUNCTION_MACRO), Ret2), LogMsgViewPtr); } @@ -74,10 +72,10 @@ void USetBeautyEffectOptionsWidget::ShowUserGuide() void USetBeautyEffectOptionsWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -90,7 +88,7 @@ void USetBeautyEffectOptionsWidget::OnBtnApplyClicked() Options.smoothnessLevel = Slider_SmoothnessLevel->GetValue(); Options.rednessLevel = Slider_RednessLevel->GetValue(); Options.sharpnessLevel = Slider_SharpnessLevel->GetValue(); - int ret = RtcEngineProxy->setBeautyEffectOptions(true, Options /*PRIMARY_CAMERA_SOURCE*/); + int ret = AgoraUERtcEngine::Get()->setBeautyEffectOptions(true, Options /*PRIMARY_CAMERA_SOURCE*/); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -102,7 +100,7 @@ void USetBeautyEffectOptionsWidget::OnBtnStopClicked() Options.smoothnessLevel = Slider_SmoothnessLevel->GetValue(); Options.rednessLevel = Slider_RednessLevel->GetValue(); Options.sharpnessLevel = Slider_SharpnessLevel->GetValue(); - int ret = RtcEngineProxy->setBeautyEffectOptions(false, Options /*PRIMARY_CAMERA_SOURCE*/); + int ret = AgoraUERtcEngine::Get()->setBeautyEffectOptions(false, Options /*PRIMARY_CAMERA_SOURCE*/); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -146,12 +144,11 @@ void USetBeautyEffectOptionsWidget::NativeDestruct() void USetBeautyEffectOptionsWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -172,10 +169,8 @@ int USetBeautyEffectOptionsWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_S channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -184,7 +179,7 @@ int USetBeautyEffectOptionsWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_S if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -193,13 +188,13 @@ int USetBeautyEffectOptionsWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_S videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -208,10 +203,8 @@ int USetBeautyEffectOptionsWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_S int USetBeautyEffectOptionsWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -221,20 +214,20 @@ int USetBeautyEffectOptionsWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetBeautyEffectOptions/SetBeautyEffectOptionsWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetBeautyEffectOptions/SetBeautyEffectOptionsWidget.h index b7197d58..6d387e34 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetBeautyEffectOptions/SetBeautyEffectOptionsWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetBeautyEffectOptions/SetBeautyEffectOptionsWidget.h @@ -172,7 +172,7 @@ class AGORAEXAMPLE_API USetBeautyEffectOptionsWidget : public UBaseAgoraUserWidg FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + TSharedPtr UserRtcEventHandlerEx; }; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetEncryption/EncryptionSampleWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetEncryption/EncryptionSampleWidget.cpp index 5a05e8a0..c4456474 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetEncryption/EncryptionSampleWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetEncryption/EncryptionSampleWidget.cpp @@ -48,14 +48,12 @@ void UEncryptionSampleWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FSt Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -74,10 +72,10 @@ void UEncryptionSampleWidget::ShowUserGuide() void UEncryptionSampleWidget::OnBtnJoinChannelClicked() { SetEncryption(); - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -97,14 +95,14 @@ void UEncryptionSampleWidget::SetEncryption() config.encryptionKey = StdStrKey.c_str(); FMemory::Memcpy(config.encryptionKdfSalt, ValEncryptionKdfSalt, 32); - int ret = RtcEngineProxy->enableEncryption(true, config); + int ret = AgoraUERtcEngine::Get()->enableEncryption(true, config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UEncryptionSampleWidget::OnBtnLeaveChannelClicked() { - int ret = RtcEngineProxy->leaveChannel(); + int ret = AgoraUERtcEngine::Get()->leaveChannel(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -129,12 +127,11 @@ void UEncryptionSampleWidget::NativeDestruct() void UEncryptionSampleWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -155,10 +152,8 @@ int UEncryptionSampleWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_ channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -167,7 +162,7 @@ int UEncryptionSampleWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_ if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -176,13 +171,13 @@ int UEncryptionSampleWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_ videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -191,10 +186,8 @@ int UEncryptionSampleWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_ int UEncryptionSampleWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -204,20 +197,20 @@ int UEncryptionSampleWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOUR if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetEncryption/EncryptionSampleWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetEncryption/EncryptionSampleWidget.h index 9e8779a8..d61124b5 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetEncryption/EncryptionSampleWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SetEncryption/EncryptionSampleWidget.h @@ -148,7 +148,7 @@ class AGORAEXAMPLE_API UEncryptionSampleWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudio/SpatialAudioWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudio/SpatialAudioWidget.cpp index 46ff5598..1a28def6 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudio/SpatialAudioWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudio/SpatialAudioWidget.cpp @@ -15,7 +15,7 @@ void USpatialAudioWidget::InitAgoraWidget(FString APP_ID, FString TOKEN, FString ShowUserGuide(); - InitSpatialAudioEngine(RtcEngineProxy); + InitSpatialAudioEngine(AgoraUERtcEngine::Get()); } void USpatialAudioWidget::CheckPermission() @@ -56,14 +56,12 @@ void USpatialAudioWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -85,7 +83,7 @@ void USpatialAudioWidget::InitSpatialAudioEngine(IRtcEngine* engine) if (LocalSpatialAudioEngine == nullptr) { engine->queryInterface(AGORA_IID_LOCAL_SPATIAL_AUDIO, (void**)&LocalSpatialAudioEngine); - } + } if (LocalSpatialAudioEngine != nullptr) { @@ -112,24 +110,25 @@ void USpatialAudioWidget::InitSpatialAudioEngine(IRtcEngine* engine) int USpatialAudioWidget::UpdateRemotePositionWithCurrentDistanceVal() { + int ret = -1; float Val = Slider_Distance->GetValue(); RemoteVoicePositionInfo ValRemotePositionInfo{ { 0.0f , Val, 0.0f },{ 0.0f ,0.0f , 0.0f } }; - int ret = LocalSpatialAudioEngine->updateRemotePosition(RemoteUID, ValRemotePositionInfo); + ret = LocalSpatialAudioEngine->updateRemotePosition(RemoteUID, ValRemotePositionInfo); return ret; } void USpatialAudioWidget::OnBtnJoinChannelClicked() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void USpatialAudioWidget::OnBtnLeaveChannelClicked() { - int ret = RtcEngineProxy->leaveChannel(); + int ret = AgoraUERtcEngine::Get()->leaveChannel(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -161,7 +160,7 @@ void USpatialAudioWidget::NativeDestruct() void USpatialAudioWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { if (LocalSpatialAudioEngine != nullptr) @@ -170,10 +169,9 @@ void USpatialAudioWidget::UnInitAgoraEngine() LocalSpatialAudioEngine = nullptr; } - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudio/SpatialAudioWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudio/SpatialAudioWidget.h index c3536006..402953af 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudio/SpatialAudioWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudio/SpatialAudioWidget.h @@ -139,7 +139,7 @@ class AGORAEXAMPLE_API USpatialAudioWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + ILocalSpatialAudioEngine* LocalSpatialAudioEngine = nullptr; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudioWithMediaPlayer/SpatialAudioWithMPWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudioWithMediaPlayer/SpatialAudioWithMPWidget.cpp index 2fe92a69..84e47722 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudioWithMediaPlayer/SpatialAudioWithMPWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudioWithMediaPlayer/SpatialAudioWithMPWidget.cpp @@ -60,14 +60,12 @@ void USpatialAudioWithMPWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, F Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -98,7 +96,7 @@ void USpatialAudioWithMPWidget::ShowUserGuide() void USpatialAudioWithMPWidget::InitAgoraMediaPlayer() { - MediaPlayer = RtcEngineProxy->createMediaPlayer(); + MediaPlayer = AgoraUERtcEngine::Get()->createMediaPlayer(); MediaPlayerSourceObserverWarpper = MakeShared(this); int ret = MediaPlayer->registerPlayerSourceObserver(MediaPlayerSourceObserverWarpper.Get()); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); @@ -108,14 +106,14 @@ void USpatialAudioWithMPWidget::InitAgoraSpatialAudioEngine() { if (LocalSpatialAudioEngine == nullptr) { - RtcEngineProxy->queryInterface(AGORA_IID_LOCAL_SPATIAL_AUDIO, (void**)&LocalSpatialAudioEngine); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_LOCAL_SPATIAL_AUDIO, (void**)&LocalSpatialAudioEngine); } if (LocalSpatialAudioEngine != nullptr) { LocalSpatialAudioConfig AudioConfig; - AudioConfig.rtcEngine = RtcEngineProxy; + AudioConfig.rtcEngine = AgoraUERtcEngine::Get(); auto ret = LocalSpatialAudioEngine->initialize(AudioConfig); @@ -128,10 +126,10 @@ void USpatialAudioWithMPWidget::InitAgoraSpatialAudioEngine() void USpatialAudioWithMPWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->enableSpatialAudio(true); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->enableSpatialAudio(true); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); agora::rtc::ChannelMediaOptions ChannelMediaOptions; ChannelMediaOptions.autoSubscribeAudio = true; @@ -144,7 +142,7 @@ void USpatialAudioWithMPWidget::JoinChannel() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); agora::rtc::RtcConnection connection(StdStrChannelName.c_str(), UID); - int ret = RtcEngineProxy->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, ChannelMediaOptions, nullptr); + int ret = AgoraUERtcEngine::Get()->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, ChannelMediaOptions, nullptr); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -170,8 +168,8 @@ void USpatialAudioWithMPWidget::JoinChannelWithMPK() std::string StdStrChannelName = TCHAR_TO_UTF8(*ChannelName); agora::rtc::RtcConnection connection(StdStrChannelName.c_str(), UID_UsedInMPK); - int ret = RtcEngineProxy->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, ChannelMediaOptions, nullptr); - RtcEngineProxy->updateChannelMediaOptionsEx(ChannelMediaOptions, connection); + int ret = AgoraUERtcEngine::Get()->joinChannelEx(TCHAR_TO_UTF8(*Token), connection, ChannelMediaOptions, nullptr); + AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(ChannelMediaOptions, connection); UBFL_Logger::Print(FString::Printf(TEXT("%s joinChannelEx ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -224,7 +222,7 @@ void USpatialAudioWithMPWidget::NativeDestruct() void USpatialAudioWithMPWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { if (MediaPlayer) { @@ -232,10 +230,9 @@ void USpatialAudioWithMPWidget::UnInitAgoraEngine() MediaPlayer->unregisterPlayerSourceObserver(MediaPlayerSourceObserverWarpper.Get()); } - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -256,10 +253,8 @@ int USpatialAudioWithMPWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURC channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -268,7 +263,7 @@ int USpatialAudioWithMPWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURC if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -277,13 +272,13 @@ int USpatialAudioWithMPWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURC videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -292,10 +287,8 @@ int USpatialAudioWithMPWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURC int USpatialAudioWithMPWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -305,20 +298,20 @@ int USpatialAudioWithMPWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SO if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -442,7 +435,7 @@ void USpatialAudioWithMPWidget::FUserRtcEventHandlerEx::onUserOffline(const agor #pragma region AgoraCallback - IMediaPlayerSourceObserver -void USpatialAudioWithMPWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) +void USpatialAudioWithMPWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason) { if (state != media::base::MEDIA_PLAYER_STATE::PLAYER_STATE_OPEN_COMPLETED) return; @@ -475,7 +468,7 @@ void USpatialAudioWithMPWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceS }); } -void USpatialAudioWithMPWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms) +void USpatialAudioWithMPWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t positionMs, int64_t timestampMs) { } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudioWithMediaPlayer/SpatialAudioWithMPWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudioWithMediaPlayer/SpatialAudioWithMPWidget.h index 31d961ae..3143a75e 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudioWithMediaPlayer/SpatialAudioWithMPWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/SpatialAudioWithMediaPlayer/SpatialAudioWithMPWidget.h @@ -75,10 +75,11 @@ class AGORAEXAMPLE_API USpatialAudioWithMPWidget : public UBaseAgoraUserWidget FUserIMediaPlayerSourceObserver(USpatialAudioWithMPWidget* Widget) : WidgetPtr(Widget) {} - void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) override; + void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, + media::base::MEDIA_PLAYER_REASON reason) override; - void onPositionChanged(int64_t position_ms) override; + void onPositionChanged(int64_t positionMs, int64_t timestampMs) override; void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override; @@ -182,7 +183,7 @@ class AGORAEXAMPLE_API USpatialAudioWithMPWidget : public UBaseAgoraUserWidget public: - inline IRtcEngineEx* GetRtcEngine() { return RtcEngineProxy; } + inline IRtcEngineEx* GetRtcEngine() { return AgoraUERtcEngine::Get(); } inline agora::agora_refptr GetMediaPlayer() { return MediaPlayer; } inline FString GetChannelName() { return ChannelName; } inline ILocalSpatialAudioEngine* GetLocalSpatialAudioEngine() { return LocalSpatialAudioEngine; } @@ -207,7 +208,7 @@ class AGORAEXAMPLE_API USpatialAudioWithMPWidget : public UBaseAgoraUserWidget uint32 UID = 123; uint32 UID_UsedInMPK = 67890; - IRtcEngineEx* RtcEngineProxy; + agora::agora_refptr MediaPlayer; ILocalSpatialAudioEngine* LocalSpatialAudioEngine; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartDirectCdnStreaming/StartDirectCdnStreamingWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartDirectCdnStreaming/StartDirectCdnStreamingWidget.cpp index b0e418d3..1f205045 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartDirectCdnStreaming/StartDirectCdnStreamingWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartDirectCdnStreaming/StartDirectCdnStreamingWidget.cpp @@ -50,14 +50,13 @@ void UStartDirectCdnStreamingWidget::InitAgoraEngine(FString APP_ID, FString TOK Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -74,10 +73,10 @@ void UStartDirectCdnStreamingWidget::ShowUserGuide() void UStartDirectCdnStreamingWidget::SetProfile() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setChannelProfile(agora::CHANNEL_PROFILE_TYPE::CHANNEL_PROFILE_LIVE_BROADCASTING); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setChannelProfile(agora::CHANNEL_PROFILE_TYPE::CHANNEL_PROFILE_LIVE_BROADCASTING); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); } @@ -104,19 +103,23 @@ void UStartDirectCdnStreamingWidget::OnBtnStartClicked() videoEncoderConfiguration.codecType = VIDEO_CODEC_TYPE::VIDEO_CODEC_H264; videoEncoderConfiguration.mirrorMode = VIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_DISABLED; videoEncoderConfiguration.orientationMode = ORIENTATION_MODE_FIXED_LANDSCAPE; // important to be set - int ret0 = RtcEngineProxy->setDirectCdnStreamingVideoConfiguration(videoEncoderConfiguration); + int ret0 = AgoraUERtcEngine::Get()->setDirectCdnStreamingVideoConfiguration(videoEncoderConfiguration); UBFL_Logger::Print(FString::Printf(TEXT("%s setDirectCdnStreamingVideoConfiguration ret %d"), *FString(FUNCTION_MACRO), ret0), LogMsgViewPtr); - DirectCdnStreamingEventHandlerWarper = MakeShared(this); - int ret = RtcEngineProxy->startDirectCdnStreaming(DirectCdnStreamingEventHandlerWarper.Get(), TCHAR_TO_UTF8(*URL), options); + if (DirectCdnStreamingEventHandlerWarper == nullptr) + { + DirectCdnStreamingEventHandlerWarper = MakeShared(this); + } + + int ret = AgoraUERtcEngine::Get()->startDirectCdnStreaming(DirectCdnStreamingEventHandlerWarper.Get(), TCHAR_TO_UTF8(*URL), options); UBFL_Logger::Print(FString::Printf(TEXT("%s startDirectCdnStreaming ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - RtcEngineProxy->startPreview(); + AgoraUERtcEngine::Get()->startPreview(); MakeVideoView(0, agora::rtc::VIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA); } void UStartDirectCdnStreamingWidget::OnBtnBtnStopClicked() { - int ret = RtcEngineProxy->stopDirectCdnStreaming(); + int ret = AgoraUERtcEngine::Get()->stopDirectCdnStreaming(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -137,13 +140,12 @@ void UStartDirectCdnStreamingWidget::NativeDestruct() void UStartDirectCdnStreamingWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->stopPreview(); - RtcEngineProxy->stopDirectCdnStreaming(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->stopPreview(); + AgoraUERtcEngine::Get()->stopDirectCdnStreaming(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -164,10 +166,8 @@ int UStartDirectCdnStreamingWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_ channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -176,7 +176,7 @@ int UStartDirectCdnStreamingWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_ if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -185,13 +185,13 @@ int UStartDirectCdnStreamingWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_ videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -200,10 +200,8 @@ int UStartDirectCdnStreamingWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_ int UStartDirectCdnStreamingWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -213,20 +211,20 @@ int UStartDirectCdnStreamingWidget::ReleaseVideoView(uint32 uid, agora::rtc::VID if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -331,8 +329,7 @@ void UStartDirectCdnStreamingWidget::FUserRtcEventHandlerEx::onUserOffline(const #pragma region AgoraCallback - IDirectCdnStreamingEventHandler - -void UStartDirectCdnStreamingWidget::FUserIDirectCdnStreamingEventHandler::onDirectCdnStreamingStateChanged(DIRECT_CDN_STREAMING_STATE state, DIRECT_CDN_STREAMING_ERROR error, const char* message) +void UStartDirectCdnStreamingWidget::FUserIDirectCdnStreamingEventHandler::onDirectCdnStreamingStateChanged(DIRECT_CDN_STREAMING_STATE state, DIRECT_CDN_STREAMING_REASON reason, const char* message) { } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartDirectCdnStreaming/StartDirectCdnStreamingWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartDirectCdnStreaming/StartDirectCdnStreamingWidget.h index 90ebc7b4..b33d3931 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartDirectCdnStreaming/StartDirectCdnStreamingWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartDirectCdnStreaming/StartDirectCdnStreamingWidget.h @@ -70,7 +70,7 @@ class AGORAEXAMPLE_API UStartDirectCdnStreamingWidget : public UBaseAgoraUserWid #pragma region AgoraCallback - IDirectCdnStreamingEventHandler - void onDirectCdnStreamingStateChanged(DIRECT_CDN_STREAMING_STATE state, DIRECT_CDN_STREAMING_ERROR error, const char* message) override; + void onDirectCdnStreamingStateChanged(DIRECT_CDN_STREAMING_STATE state, DIRECT_CDN_STREAMING_REASON reason, const char* message) override; void onDirectCdnStreamingStats(const DirectCdnStreamingStats& stats) override; @@ -169,12 +169,11 @@ class AGORAEXAMPLE_API UStartDirectCdnStreamingWidget : public UBaseAgoraUserWid FString Token; FString ChannelName; - IRtcEngine* RtcEngineProxy; - TSharedPtr DirectCdnStreamingEventHandlerWarper; + TSharedPtr DirectCdnStreamingEventHandlerWarper = nullptr; TSharedPtr UserRtcEventHandlerEx; }; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartLocalVideoTranscoder/StartLocalVideoTranscoderWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartLocalVideoTranscoder/StartLocalVideoTranscoderWidget.cpp index 28d7d340..9ccc906b 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartLocalVideoTranscoder/StartLocalVideoTranscoderWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartLocalVideoTranscoder/StartLocalVideoTranscoderWidget.cpp @@ -54,14 +54,13 @@ void UStartLocalVideoTranscoderWidget::InitAgoraEngine(FString APP_ID, FString T Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -77,7 +76,7 @@ void UStartLocalVideoTranscoderWidget::ShowUserGuide() void UStartLocalVideoTranscoderWidget::InitAgoraMediaPlayer() { - MediaPlayer = RtcEngineProxy->createMediaPlayer(); + MediaPlayer = AgoraUERtcEngine::Get()->createMediaPlayer(); MediaPlayerSourceObserverWarpper = MakeShared(this); MediaPlayer->registerPlayerSourceObserver(MediaPlayerSourceObserverWarpper.Get()); UBFL_Logger::Print(FString::Printf(TEXT("%s PlayerID=%d"), *FString(FUNCTION_MACRO), MediaPlayer->getMediaPlayerId()), LogMsgViewPtr); @@ -86,16 +85,16 @@ void UStartLocalVideoTranscoderWidget::InitAgoraMediaPlayer() void UStartLocalVideoTranscoderWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); MakeVideoView(0, VIDEO_SOURCE_TYPE::VIDEO_SOURCE_TRANSCODED, ""); agora::rtc::ChannelMediaOptions ChannelMediaOptions; ChannelMediaOptions.publishCameraTrack = false; ChannelMediaOptions.publishSecondaryCameraTrack = false; ChannelMediaOptions.publishTranscodedVideoTrack = true; - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, ChannelMediaOptions); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), 0, ChannelMediaOptions); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -104,14 +103,14 @@ void UStartLocalVideoTranscoderWidget::JoinChannel() void UStartLocalVideoTranscoderWidget::OnBtnStartClicked() { LocalTranscoderConfiguration Config = GenerateLocalTranscoderConfiguration(); - int ret = RtcEngineProxy->startLocalVideoTranscoder(Config); + int ret = AgoraUERtcEngine::Get()->startLocalVideoTranscoder(Config); ReleaseLocalTranscoderConfiguration(Config); UBFL_Logger::Print(FString::Printf(TEXT("%s startLocalVideoTranscoder ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); agora::rtc::ChannelMediaOptions options; options.publishCameraTrack = false; options.publishSecondaryCameraTrack = false; options.publishTranscodedVideoTrack = true; - RtcEngineProxy->updateChannelMediaOptions(options); + AgoraUERtcEngine::Get()->updateChannelMediaOptions(options); return; @@ -120,7 +119,7 @@ void UStartLocalVideoTranscoderWidget::OnBtnStartClicked() void UStartLocalVideoTranscoderWidget::OnBtnUpdateClicked() { LocalTranscoderConfiguration Config = GenerateLocalTranscoderConfiguration(); - int ret = RtcEngineProxy->updateLocalTranscoderConfiguration(Config); + int ret = AgoraUERtcEngine::Get()->updateLocalTranscoderConfiguration(Config); ReleaseLocalTranscoderConfiguration(Config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -128,7 +127,11 @@ void UStartLocalVideoTranscoderWidget::OnBtnUpdateClicked() void UStartLocalVideoTranscoderWidget::OnBtnStopClicked() { - int ret = RtcEngineProxy->stopLocalVideoTranscoder(); + if (CB_MediaPlay->GetCheckedState() == ECheckBoxState::Checked) { + MediaPlayer->stop(); + } + + int ret = AgoraUERtcEngine::Get()->stopLocalVideoTranscoder(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -137,7 +140,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener { TArray List; - if (CB_PrimaryCamera->CheckedState == ECheckBoxState::Checked) + if (CB_PrimaryCamera->GetCheckedState() == ECheckBoxState::Checked) { CameraCapturerConfiguration Configuration; @@ -147,17 +150,15 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener Configuration.cameraDirection = CAMERA_DIRECTION::CAMERA_FRONT; #else agora::rtc::IVideoDeviceManager* VideoDeviceManager = nullptr; - RtcEngineProxy->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); + AgoraUERtcEngine::Get()->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); IVideoDeviceCollection* VideoDeviceInfos = VideoDeviceManager->enumerateVideoDevices(); if (VideoDeviceInfos->getCount() >= 1) { Configuration.format = VideoFormat(640, 320, 30); - char deviceId[512] = { 0 }; - char deviceName[512] = { 0 }; // Get camera information - VideoDeviceInfos->getDevice(0, deviceName, deviceId); - FMemory::Memcpy(Configuration.deviceId, deviceId, 512); + VideoDeviceInfos->getDevice(0, MainCameraDeviceName, MainCameraDeviceId); + Configuration.deviceId = MainCameraDeviceId; } else { @@ -168,7 +169,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener #endif if (bSuccess) { - int ret = RtcEngineProxy->startCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY, Configuration); + int ret = AgoraUERtcEngine::Get()->startCameraCapture(VIDEO_SOURCE_CAMERA_PRIMARY, Configuration); UBFL_Logger::Print(FString::Printf(TEXT("%s startCameraCapture ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); TranscodingVideoStream TranscodingVideoStreamConfig; TranscodingVideoStreamConfig.sourceType = VIDEO_SOURCE_CAMERA; @@ -183,7 +184,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener } - if (CB_SecondaryCamera->CheckedState == ECheckBoxState::Checked) + if (CB_SecondaryCamera->GetCheckedState() == ECheckBoxState::Checked) { CameraCapturerConfiguration Configuration; @@ -194,18 +195,17 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener #else agora::rtc::IVideoDeviceManager* VideoDeviceManager = nullptr; - RtcEngineProxy->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); + AgoraUERtcEngine::Get()->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); IVideoDeviceCollection* VideoDeviceInfos = VideoDeviceManager->enumerateVideoDevices(); if (VideoDeviceInfos->getCount() >= 2) { Configuration.format = VideoFormat(640, 320, 30); - char deviceId[512] = { 0 }; - char deviceName[512] = { 0 }; // Get camera information - VideoDeviceInfos->getDevice(1, deviceName, deviceId); - FMemory::Memcpy(Configuration.deviceId, deviceId, 512); + VideoDeviceInfos->getDevice(1, SecondCameraDeviceName, SecondCameraDeviceId); + Configuration.deviceId = SecondCameraDeviceId; + } else { @@ -217,7 +217,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener if (bSuccess) { - int ret = RtcEngineProxy->startCameraCapture(VIDEO_SOURCE_CAMERA_SECONDARY, Configuration); + int ret = AgoraUERtcEngine::Get()->startCameraCapture(VIDEO_SOURCE_CAMERA_SECONDARY, Configuration); UBFL_Logger::Print(FString::Printf(TEXT("%s startCameraCapture VIDEO_SOURCE_CAMERA_SECONDARY ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); TranscodingVideoStream TranscodingVideoStreamConfig; TranscodingVideoStreamConfig.sourceType = VIDEO_SOURCE_CAMERA_SECONDARY; @@ -232,7 +232,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener } - if (CB_PNG->CheckedState == ECheckBoxState::Checked) + if (CB_PNG->GetCheckedState() == ECheckBoxState::Checked) { FString Path = FPaths::ProjectContentDir() / TEXT("Image/png.png"); @@ -270,7 +270,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener List.Add(TranscodingVideoStreamConfig); } - if (CB_JPG->CheckedState == ECheckBoxState::Checked) + if (CB_JPG->GetCheckedState() == ECheckBoxState::Checked) { FString Path = FPaths::ProjectContentDir() / TEXT("Image/jpg.jpg"); @@ -309,7 +309,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener } - if (CB_GIF->CheckedState == ECheckBoxState::Checked) + if (CB_GIF->GetCheckedState() == ECheckBoxState::Checked) { FString Path = FPaths::ProjectContentDir() / TEXT("Image/gif.gif"); @@ -346,7 +346,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener TranscodingVideoStreamConfig.zOrder = 1; List.Add(TranscodingVideoStreamConfig); } - if (CB_ScreenShare->CheckedState == ECheckBoxState::Checked) { + if (CB_ScreenShare->GetCheckedState() == ECheckBoxState::Checked) { StartScreenShare(); TranscodingVideoStream TranscodingVideoStreamConfig; @@ -359,7 +359,7 @@ agora::rtc::LocalTranscoderConfiguration UStartLocalVideoTranscoderWidget::Gener List.Add(TranscodingVideoStreamConfig); } - if (CB_MediaPlay->CheckedState == ECheckBoxState::Checked) { + if (CB_MediaPlay->GetCheckedState() == ECheckBoxState::Checked) { MediaPlayer->stop(); int ret = MediaPlayer->open("https://big-class-test.oss-cn-hangzhou.aliyuncs.com/61102.1592987815092.mp4", 0); int PlayerID = MediaPlayer->getMediaPlayerId(); @@ -405,10 +405,10 @@ int UStartLocalVideoTranscoderWidget::StartScreenShare() ScreenCaptureParameters2 parameters2; parameters2.captureAudio = true; parameters2.captureVideo = true; - auto ret = RtcEngineProxy->startScreenCapture(parameters2); + auto ret = AgoraUERtcEngine::Get()->startScreenCapture(parameters2); UE_LOG(LogTemp, Warning, TEXT("StartScreenShrareClick JoinChannel ====== %d"), ret); #else - RtcEngineProxy->stopScreenCapture(); + AgoraUERtcEngine::Get()->stopScreenCapture(); agora::rtc::ScreenCaptureParameters capParam; VideoDimensions dimensions(640, 360); capParam.dimensions = dimensions; @@ -427,7 +427,7 @@ int UStartLocalVideoTranscoderWidget::StartScreenShare() size.width = 360; size.height = 240; #endif - agora::rtc::IScreenCaptureSourceList* infos = RtcEngineProxy->getScreenCaptureSources(size, size, true); + agora::rtc::IScreenCaptureSourceList* infos = AgoraUERtcEngine::Get()->getScreenCaptureSources(size, size, true); if (infos == nullptr) { UE_LOG(LogTemp, Warning, TEXT("GetScreenDisplay is null")); @@ -437,11 +437,11 @@ int UStartLocalVideoTranscoderWidget::StartScreenShare() int ret = -1; if (info.type == agora::rtc::ScreenCaptureSourceType_Screen) { - ret = RtcEngineProxy->startScreenCaptureByDisplayId((uint64)(info.sourceId), regionRect, capParam); + ret = AgoraUERtcEngine::Get()->startScreenCaptureByDisplayId((uint64)(info.sourceId), regionRect, capParam); } else if (info.type == agora::rtc::ScreenCaptureSourceType_Window) { - ret = RtcEngineProxy->startScreenCaptureByWindowId(info.sourceId, regionRect, capParam); + ret = AgoraUERtcEngine::Get()->startScreenCaptureByWindowId(info.sourceId, regionRect, capParam); } #endif UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); @@ -466,7 +466,7 @@ void UStartLocalVideoTranscoderWidget::NativeDestruct() void UStartLocalVideoTranscoderWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { if (MediaPlayer) { @@ -474,10 +474,9 @@ void UStartLocalVideoTranscoderWidget::UnInitAgoraEngine() MediaPlayer->unregisterPlayerSourceObserver(MediaPlayerSourceObserverWarpper.Get()); } - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -499,10 +498,8 @@ int UStartLocalVideoTranscoderWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -511,7 +508,7 @@ int UStartLocalVideoTranscoderWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -520,13 +517,13 @@ int UStartLocalVideoTranscoderWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -535,10 +532,8 @@ int UStartLocalVideoTranscoderWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE int UStartLocalVideoTranscoderWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -548,20 +543,20 @@ int UStartLocalVideoTranscoderWidget::ReleaseVideoView(uint32 uid, agora::rtc::V if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -666,7 +661,7 @@ void UStartLocalVideoTranscoderWidget::FUserRtcEventHandlerEx::onUserOffline(con #pragma region AgoraCallback - IMediaPlayerSourceObserver -void UStartLocalVideoTranscoderWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) +void UStartLocalVideoTranscoderWidget::FUserIMediaPlayerSourceObserver::onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_REASON reason) { if (state != media::base::MEDIA_PLAYER_STATE::PLAYER_STATE_OPEN_COMPLETED) return; @@ -699,7 +694,7 @@ void UStartLocalVideoTranscoderWidget::FUserIMediaPlayerSourceObserver::onPlayer }); } -void UStartLocalVideoTranscoderWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms) +void UStartLocalVideoTranscoderWidget::FUserIMediaPlayerSourceObserver::onPositionChanged(int64_t positionMs, int64_t timestampMs) { } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartLocalVideoTranscoder/StartLocalVideoTranscoderWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartLocalVideoTranscoder/StartLocalVideoTranscoderWidget.h index 5cae6a15..188c4d94 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartLocalVideoTranscoder/StartLocalVideoTranscoderWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartLocalVideoTranscoder/StartLocalVideoTranscoderWidget.h @@ -75,10 +75,11 @@ class AGORAEXAMPLE_API UStartLocalVideoTranscoderWidget : public UBaseAgoraUserW FUserIMediaPlayerSourceObserver(UStartLocalVideoTranscoderWidget* Widget) : WidgetPtr(Widget) {} - void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, media::base::MEDIA_PLAYER_ERROR ec) override; + void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, + media::base::MEDIA_PLAYER_REASON reason) override; - void onPositionChanged(int64_t position_ms) override; + void onPositionChanged(int64_t positionMs, int64_t timestampMs) override; void onPlayerEvent(media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override; @@ -203,7 +204,7 @@ class AGORAEXAMPLE_API UStartLocalVideoTranscoderWidget : public UBaseAgoraUserW inline FString GetAppId() { return AppId; }; inline FString GetToken() { return Token; }; inline FString GetChannelName() { return ChannelName; }; - inline IRtcEngine* GetRtcEngine() { return RtcEngineProxy; } + inline IRtcEngine* GetRtcEngine() { return AgoraUERtcEngine::Get(); } inline agora::agora_refptr GetMediaPlayer() { return MediaPlayer; } @@ -226,10 +227,14 @@ class AGORAEXAMPLE_API UStartLocalVideoTranscoderWidget : public UBaseAgoraUserW FString Token; FString ChannelName; - IRtcEngine* RtcEngineProxy; agora::agora_refptr MediaPlayer; + char MainCameraDeviceName[MAX_DEVICE_ID_LENGTH] = {}; + char MainCameraDeviceId[MAX_DEVICE_ID_LENGTH] = {}; + char SecondCameraDeviceId[MAX_DEVICE_ID_LENGTH] = {}; + char SecondCameraDeviceName[MAX_DEVICE_ID_LENGTH] = {}; + TSharedPtr MediaPlayerSourceObserverWarpper; TSharedPtr UserRtcEventHandlerEx; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRhythmPlayer/StartRhythmPlayerWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRhythmPlayer/StartRhythmPlayerWidget.cpp index a57093ba..b425ff5b 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRhythmPlayer/StartRhythmPlayerWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRhythmPlayer/StartRhythmPlayerWidget.cpp @@ -49,14 +49,12 @@ void UStartRhythmPlayerWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FS Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngineEx(); - int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -73,10 +71,10 @@ void UStartRhythmPlayerWidget::ShowUserGuide() void UStartRhythmPlayerWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -120,14 +118,14 @@ void UStartRhythmPlayerWidget::OnBtnStartClicked() AgoraRhythmPlayerConfig Config; Config.beatsPerMeasure = 4; Config.beatsPerMinute = 120; - int ret = RtcEngineProxy->startRhythmPlayer(TCHAR_TO_UTF8(*PathSound1), TCHAR_TO_UTF8(*PathSound2), Config); + int ret = AgoraUERtcEngine::Get()->startRhythmPlayer(TCHAR_TO_UTF8(*PathSound1), TCHAR_TO_UTF8(*PathSound2), Config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UStartRhythmPlayerWidget::OnBtnStopClicked() { - int ret = RtcEngineProxy->stopRhythmPlayer(); + int ret = AgoraUERtcEngine::Get()->stopRhythmPlayer(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -136,7 +134,7 @@ void UStartRhythmPlayerWidget::OnBtnChangeConfigClicked() AgoraRhythmPlayerConfig Config; Config.beatsPerMeasure = 6; Config.beatsPerMinute = 60; - int ret = RtcEngineProxy->configRhythmPlayer(Config); + int ret = AgoraUERtcEngine::Get()->configRhythmPlayer(Config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); UBFL_Logger::Print(FString::Printf(TEXT("%s Beat Config is from 4 to 6 "), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); @@ -146,7 +144,7 @@ void UStartRhythmPlayerWidget::OnBtnPublishClicked() { ChannelMediaOptions Options; Options.publishRhythmPlayerTrack = true; - int ret = RtcEngineProxy->updateChannelMediaOptions(Options); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptions(Options); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -154,7 +152,7 @@ void UStartRhythmPlayerWidget::OnBtnUnPublishClicked() { ChannelMediaOptions Options; Options.publishRhythmPlayerTrack = false; - int ret = RtcEngineProxy->updateChannelMediaOptions(Options); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptions(Options); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -178,12 +176,11 @@ void UStartRhythmPlayerWidget::NativeDestruct() void UStartRhythmPlayerWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -204,10 +201,8 @@ int UStartRhythmPlayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -216,7 +211,7 @@ int UStartRhythmPlayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -225,13 +220,13 @@ int UStartRhythmPlayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -240,10 +235,8 @@ int UStartRhythmPlayerWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE int UStartRhythmPlayerWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -253,20 +246,20 @@ int UStartRhythmPlayerWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOU if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -365,7 +358,8 @@ void UStartRhythmPlayerWidget::FUserRtcEventHandlerEx::onUserOffline(const agora }); } -void UStartRhythmPlayerWidget::FUserRtcEventHandlerEx::onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_ERROR_TYPE errorCode) + +void UStartRhythmPlayerWidget::FUserRtcEventHandlerEx::onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_REASON reason) { if (!IsWidgetValid()) return; @@ -381,8 +375,9 @@ void UStartRhythmPlayerWidget::FUserRtcEventHandlerEx::onRhythmPlayerStateChange UBFL_Logger::Print(FString::Printf(TEXT("%s bIsDestruct "), *FString(FUNCTION_MACRO))); return; } - UBFL_Logger::Print(FString::Printf(TEXT("%s state=%d errorcode=%d"), *FString(FUNCTION_MACRO), (int)state, (int)errorCode), WidgetPtr->GetLogMsgViewPtr()); + UBFL_Logger::Print(FString::Printf(TEXT("%s state=%d errorcode=%d"), *FString(FUNCTION_MACRO), (int)state, (int)reason), WidgetPtr->GetLogMsgViewPtr()); }); } + #pragma endregion \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRhythmPlayer/StartRhythmPlayerWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRhythmPlayer/StartRhythmPlayerWidget.h index f136bef7..52584231 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRhythmPlayer/StartRhythmPlayerWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRhythmPlayer/StartRhythmPlayerWidget.h @@ -52,7 +52,7 @@ class AGORAEXAMPLE_API UStartRhythmPlayerWidget : public UBaseAgoraUserWidget void onUserOffline(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) override; - void onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_ERROR_TYPE errorCode) override; + void onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_REASON reason) override; #pragma endregion @@ -160,7 +160,7 @@ class AGORAEXAMPLE_API UStartRhythmPlayerWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngineEx* RtcEngineProxy; + TSharedPtr UserRtcEventHandlerEx; }; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRtmpStreamWithTranscoding/RtmpStreamWithTranscodingWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRtmpStreamWithTranscoding/RtmpStreamWithTranscodingWidget.cpp index ed4a7d48..c1cf81a0 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRtmpStreamWithTranscoding/RtmpStreamWithTranscodingWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRtmpStreamWithTranscoding/RtmpStreamWithTranscodingWidget.cpp @@ -50,14 +50,13 @@ void URtmpStreamWithTranscodingWidget::InitAgoraEngine(FString APP_ID, FString T Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -75,10 +74,10 @@ void URtmpStreamWithTranscodingWidget::ShowUserGuide() void URtmpStreamWithTranscodingWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -114,7 +113,7 @@ void URtmpStreamWithTranscodingWidget::OnBtnStartClicked() return; } - auto ret = RtcEngineProxy->startRtmpStreamWithTranscoding(TCHAR_TO_UTF8(*URL), ValLiveTranscoding); + auto ret = AgoraUERtcEngine::Get()->startRtmpStreamWithTranscoding(TCHAR_TO_UTF8(*URL), ValLiveTranscoding); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); @@ -147,7 +146,7 @@ void URtmpStreamWithTranscodingWidget::OnBtnUpdateClicked() ValTranscodingUsers->audioChannel = 0; ValLiveTranscoding.transcodingUsers = ValTranscodingUsers.Get(); - int ret = RtcEngineProxy->updateRtmpTranscoding(ValLiveTranscoding); + int ret = AgoraUERtcEngine::Get()->updateRtmpTranscoding(ValLiveTranscoding); UBFL_Logger::Print(FString::Printf(TEXT("%s updateRtmpTranscoding ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -160,7 +159,7 @@ void URtmpStreamWithTranscodingWidget::OnBtnStopClicked() UBFL_Logger::Print(FString::Printf(TEXT("%s You must input your rtmpUrl in Inspector of videocanvas first "), *FString(FUNCTION_MACRO)), LogMsgViewPtr); return; } - int ret = RtcEngineProxy->stopRtmpStream(TCHAR_TO_UTF8(*url)); + int ret = AgoraUERtcEngine::Get()->stopRtmpStream(TCHAR_TO_UTF8(*url)); UBFL_Logger::Print(FString::Printf(TEXT("%s stopRtmpStream ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -184,12 +183,11 @@ void URtmpStreamWithTranscodingWidget::NativeDestruct() void URtmpStreamWithTranscodingWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -210,10 +208,8 @@ int URtmpStreamWithTranscodingWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -222,7 +218,7 @@ int URtmpStreamWithTranscodingWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -231,13 +227,13 @@ int URtmpStreamWithTranscodingWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -246,10 +242,8 @@ int URtmpStreamWithTranscodingWidget::MakeVideoView(uint32 uid, agora::rtc::VIDE int URtmpStreamWithTranscodingWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -259,20 +253,20 @@ int URtmpStreamWithTranscodingWidget::ReleaseVideoView(uint32 uid, agora::rtc::V if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -393,7 +387,7 @@ void URtmpStreamWithTranscodingWidget::FUserRtcEventHandler::onTranscodingUpdate }); } -void URtmpStreamWithTranscodingWidget::FUserRtcEventHandler::onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) +void URtmpStreamWithTranscodingWidget::FUserRtcEventHandler::onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_REASON reason) { if (!IsWidgetValid()) return; @@ -410,7 +404,7 @@ void URtmpStreamWithTranscodingWidget::FUserRtcEventHandler::onRtmpStreamingStat return; } - UBFL_Logger::Print(FString::Printf(TEXT("%s url:%s,state:%d ,errCode:%d "), *FString(FUNCTION_MACRO), UTF8_TO_TCHAR(url), state, errCode), WidgetPtr->GetLogMsgViewPtr()); + UBFL_Logger::Print(FString::Printf(TEXT("%s url:%s,state:%d ,errCode:%d "), *FString(FUNCTION_MACRO), UTF8_TO_TCHAR(url), state, reason), WidgetPtr->GetLogMsgViewPtr()); }); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRtmpStreamWithTranscoding/RtmpStreamWithTranscodingWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRtmpStreamWithTranscoding/RtmpStreamWithTranscodingWidget.h index 02df89cd..db21ccdd 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRtmpStreamWithTranscoding/RtmpStreamWithTranscodingWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StartRtmpStreamWithTranscoding/RtmpStreamWithTranscodingWidget.h @@ -54,7 +54,7 @@ class AGORAEXAMPLE_API URtmpStreamWithTranscodingWidget : public UBaseAgoraUserW void onTranscodingUpdated() override; - void onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) override; + void onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_REASON reason) override; #pragma endregion @@ -157,7 +157,6 @@ class AGORAEXAMPLE_API URtmpStreamWithTranscodingWidget : public UBaseAgoraUserW uint32 UID = 0; - IRtcEngine* RtcEngineProxy; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StreamMessage/StreamMessageWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StreamMessage/StreamMessageWidget.cpp index 1fcc3150..e32162cd 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StreamMessage/StreamMessageWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StreamMessage/StreamMessageWidget.cpp @@ -48,14 +48,13 @@ void UStreamMessageWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FStrin Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -72,10 +71,10 @@ void UStreamMessageWidget::ShowUserGuide() void UStreamMessageWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -118,7 +117,7 @@ int UStreamMessageWidget::CreateDataStreamId() DataStreamConfig config; config.syncWithAudio = false; config.ordered = true; - int ret = RtcEngineProxy->createDataStream(&StreamId, config); + int ret = AgoraUERtcEngine::Get()->createDataStream(&StreamId, config); UBFL_Logger::Print(FString::Printf(TEXT("%s createDataStream ret %d, streamId %d"), *FString(FUNCTION_MACRO), ret, StreamId), LogMsgViewPtr); } return StreamId; @@ -128,7 +127,7 @@ void UStreamMessageWidget::SendStreamMessage(int StreamID, FString Msg) { std::string StdStrMsg = TCHAR_TO_UTF8(*Msg); int Size = strlen(StdStrMsg.c_str()) + 1; - int ret = RtcEngineProxy->sendStreamMessage(StreamID, TCHAR_TO_UTF8(*Msg), Size); + int ret = AgoraUERtcEngine::Get()->sendStreamMessage(StreamID, TCHAR_TO_UTF8(*Msg), Size); UBFL_Logger::Print(FString::Printf(TEXT("%s sendStreamMessage ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); UBFL_Logger::Print(FString::Printf(TEXT("%s sendStreamMessage message %s,length %d"), *FString(FUNCTION_MACRO), *Msg, Msg.Len()), LogMsgViewPtr); } @@ -147,12 +146,11 @@ void UStreamMessageWidget::NativeDestruct() void UStreamMessageWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StreamMessage/StreamMessageWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StreamMessage/StreamMessageWidget.h index f0c97cc8..58ae96db 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StreamMessage/StreamMessageWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/StreamMessage/StreamMessageWidget.h @@ -132,7 +132,6 @@ class AGORAEXAMPLE_API UStreamMessageWidget : public UBaseAgoraUserWidget int StreamId = -1; - IRtcEngine* RtcEngineProxy; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/TakeSnapshot/TakeSnapshotWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/TakeSnapshot/TakeSnapshotWidget.cpp index da868a68..8cf18a0b 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/TakeSnapshot/TakeSnapshotWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/TakeSnapshot/TakeSnapshotWidget.cpp @@ -50,14 +50,13 @@ void UTakeSnapshotWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -74,10 +73,10 @@ void UTakeSnapshotWidget::ShowUserGuide() void UTakeSnapshotWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -90,7 +89,7 @@ void UTakeSnapshotWidget::OnBtnTakeOneSnapshotClicked() FilePath = UBFL_UtilityTool::ConvertToAbsolutePath(FilePath); #endif - int ret = RtcEngineProxy->takeSnapshot(0, TCHAR_TO_UTF8(*FilePath)); + int ret = AgoraUERtcEngine::Get()->takeSnapshot(0, TCHAR_TO_UTF8(*FilePath)); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); UBFL_Logger::Print(FString::Printf(TEXT("%s Takesnap Shot in path [%s] "), *FString(FUNCTION_MACRO), *FilePath), LogMsgViewPtr); @@ -115,12 +114,11 @@ void UTakeSnapshotWidget::NativeDestruct() void UTakeSnapshotWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -140,10 +138,8 @@ int UTakeSnapshotWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -152,7 +148,7 @@ int UTakeSnapshotWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -161,13 +157,13 @@ int UTakeSnapshotWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -176,10 +172,8 @@ int UTakeSnapshotWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE int UTakeSnapshotWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -189,20 +183,20 @@ int UTakeSnapshotWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_T if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/TakeSnapshot/TakeSnapshotWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/TakeSnapshot/TakeSnapshotWidget.h index 71e66f72..375d93e5 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/TakeSnapshot/TakeSnapshotWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/TakeSnapshot/TakeSnapshotWidget.h @@ -144,7 +144,6 @@ class AGORAEXAMPLE_API UTakeSnapshotWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngine* RtcEngineProxy; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VirtualBackground/VirtualBackgroundWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VirtualBackground/VirtualBackgroundWidget.cpp index a3590e3b..db7e83b3 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VirtualBackground/VirtualBackgroundWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VirtualBackground/VirtualBackgroundWidget.cpp @@ -50,14 +50,13 @@ void UVirtualBackgroundWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FS Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -74,10 +73,10 @@ void UVirtualBackgroundWidget::ShowUserGuide() void UVirtualBackgroundWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -88,7 +87,7 @@ void UVirtualBackgroundWidget::OnBtnEnableVirtualBackgroundColorClicked() backgroundSource.background_source_type = agora::rtc::VirtualBackgroundSource::BACKGROUND_SOURCE_TYPE::BACKGROUND_COLOR; backgroundSource.color = 0x6de3ff; SegmentationProperty valSegmentationProperty; - int ret = RtcEngineProxy->enableVirtualBackground(true, backgroundSource, valSegmentationProperty, agora::media::MEDIA_SOURCE_TYPE::PRIMARY_CAMERA_SOURCE); + int ret = AgoraUERtcEngine::Get()->enableVirtualBackground(true, backgroundSource, valSegmentationProperty, agora::media::MEDIA_SOURCE_TYPE::PRIMARY_CAMERA_SOURCE); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -112,7 +111,7 @@ void UVirtualBackgroundWidget::OnBtnEnableVirtualBackgroundImageClicked() backgroundSource.source = StdStrPath.c_str(); backgroundSource.background_source_type = agora::rtc::VirtualBackgroundSource::BACKGROUND_SOURCE_TYPE::BACKGROUND_IMG; agora::rtc::SegmentationProperty valSegmentationProperty; - int ret = RtcEngineProxy->enableVirtualBackground(true, backgroundSource, valSegmentationProperty, agora::media::MEDIA_SOURCE_TYPE::PRIMARY_CAMERA_SOURCE); + int ret = AgoraUERtcEngine::Get()->enableVirtualBackground(true, backgroundSource, valSegmentationProperty, agora::media::MEDIA_SOURCE_TYPE::PRIMARY_CAMERA_SOURCE); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -121,7 +120,7 @@ void UVirtualBackgroundWidget::OnBtnDisableVirtualBackgroundClicked() { agora::rtc::VirtualBackgroundSource backgroundSource; agora::rtc::SegmentationProperty valSegmentationProperty; - int ret = RtcEngineProxy->enableVirtualBackground(false, backgroundSource, valSegmentationProperty, agora::media::MEDIA_SOURCE_TYPE::PRIMARY_CAMERA_SOURCE); + int ret = AgoraUERtcEngine::Get()->enableVirtualBackground(false, backgroundSource, valSegmentationProperty, agora::media::MEDIA_SOURCE_TYPE::PRIMARY_CAMERA_SOURCE); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -142,12 +141,11 @@ void UVirtualBackgroundWidget::NativeDestruct() void UVirtualBackgroundWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -167,10 +165,8 @@ int UVirtualBackgroundWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -179,7 +175,7 @@ int UVirtualBackgroundWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -188,13 +184,13 @@ int UVirtualBackgroundWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -203,10 +199,8 @@ int UVirtualBackgroundWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE int UVirtualBackgroundWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -216,20 +210,20 @@ int UVirtualBackgroundWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOU if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VirtualBackground/VirtualBackgroundWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VirtualBackground/VirtualBackgroundWidget.h index 718eeae5..e32cbee0 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VirtualBackground/VirtualBackgroundWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VirtualBackground/VirtualBackgroundWidget.h @@ -147,7 +147,6 @@ class AGORAEXAMPLE_API UVirtualBackgroundWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngine* RtcEngineProxy; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VoiceChanger/VoiceChangerWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VoiceChanger/VoiceChangerWidget.cpp index a412907b..be49f4a2 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VoiceChanger/VoiceChangerWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VoiceChanger/VoiceChangerWidget.cpp @@ -37,14 +37,13 @@ void UVoiceChangerWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -60,9 +59,9 @@ void UVoiceChangerWidget::ShowUserGuide() void UVoiceChangerWidget::JoinChannel() { - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - RtcEngineProxy->enableAudio(); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -70,29 +69,29 @@ void UVoiceChangerWidget::JoinChannel() void UVoiceChangerWidget::OnBtn_ChatBeautifierClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setVoiceBeautifierPreset(CHAT_BEAUTIFIER_MAGNETIC); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setVoiceBeautifierPreset(CHAT_BEAUTIFIER_MAGNETIC); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UVoiceChangerWidget::OnBtn_SingingBeautifierClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setVoiceBeautifierPreset(SINGING_BEAUTIFIER); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setVoiceBeautifierPreset(SINGING_BEAUTIFIER); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UVoiceChangerWidget::OnBtn_TimbreTransformationClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setVoiceBeautifierPreset(TIMBRE_TRANSFORMATION_VIGOROUS); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setVoiceBeautifierPreset(TIMBRE_TRANSFORMATION_VIGOROUS); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UVoiceChangerWidget::OnBtn_TurnOffVoiceBeautifierClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setVoiceBeautifierPreset(VOICE_BEAUTIFIER_OFF); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setVoiceBeautifierPreset(VOICE_BEAUTIFIER_OFF); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -103,29 +102,29 @@ void UVoiceChangerWidget::OnBtn_TurnOffVoiceBeautifierClicked() void UVoiceChangerWidget::OnBtn_StyleTransformationClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setAudioEffectPreset(STYLE_TRANSFORMATION_POPULAR); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setAudioEffectPreset(STYLE_TRANSFORMATION_POPULAR); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UVoiceChangerWidget::OnBtn_RoomAcoustuicsClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setAudioEffectPreset(ROOM_ACOUSTICS_KTV); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setAudioEffectPreset(ROOM_ACOUSTICS_KTV); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UVoiceChangerWidget::OnBtn_PitchClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setAudioEffectPreset(PITCH_CORRECTION); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setAudioEffectPreset(PITCH_CORRECTION); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UVoiceChangerWidget::OnBtn_TurnOffAudioEffectClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setAudioEffectPreset(AUDIO_EFFECT_OFF); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setAudioEffectPreset(AUDIO_EFFECT_OFF); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -137,15 +136,15 @@ void UVoiceChangerWidget::OnBtn_TurnOffAudioEffectClicked() void UVoiceChangerWidget::OnBtn_VoiceChangerClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setVoiceConversionPreset(VOICE_CHANGER_NEUTRAL); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setVoiceConversionPreset(VOICE_CHANGER_NEUTRAL); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UVoiceChangerWidget::OnBtn_TurnOffVoiceChangerClicked() { - RtcEngineProxy->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); - int ret = RtcEngineProxy->setVoiceConversionPreset(VOICE_CONVERSION_OFF); + AgoraUERtcEngine::Get()->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_GAME_STREAMING); + int ret = AgoraUERtcEngine::Get()->setVoiceConversionPreset(VOICE_CONVERSION_OFF); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -156,26 +155,26 @@ void UVoiceChangerWidget::OnBtn_TurnOffVoiceChangerClicked() void UVoiceChangerWidget::OnBtn_CustomVocalEffectsClicked() { - int ret = RtcEngineProxy->setLocalVoicePitch(0.5); + int ret = AgoraUERtcEngine::Get()->setLocalVoicePitch(0.5); UBFL_Logger::Print(FString::Printf(TEXT("%s SetLocalVoicePitch ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - ret = RtcEngineProxy->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_31, -15); + ret = AgoraUERtcEngine::Get()->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_31, -15); UBFL_Logger::Print(FString::Printf(TEXT("%s SetLocalVoiceEqualization ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - ret = RtcEngineProxy->setLocalVoiceReverb(AUDIO_REVERB_DRY_LEVEL, 10); + ret = AgoraUERtcEngine::Get()->setLocalVoiceReverb(AUDIO_REVERB_DRY_LEVEL, 10); UBFL_Logger::Print(FString::Printf(TEXT("%s SetLocalVoiceReverb AUDIO_REVERB_DRY_LEVEL ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - ret = RtcEngineProxy->setLocalVoiceReverb(AUDIO_REVERB_WET_LEVEL, 7); + ret = AgoraUERtcEngine::Get()->setLocalVoiceReverb(AUDIO_REVERB_WET_LEVEL, 7); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); UE_LOG(LogTemp, Warning, TEXT("%s SetLocalVoiceReverb AUDIO_REVERB_WET_LEVEL %d"), *FString(__FUNCTION__), ret); - ret = RtcEngineProxy->setLocalVoiceReverb(AUDIO_REVERB_ROOM_SIZE, 6); + ret = AgoraUERtcEngine::Get()->setLocalVoiceReverb(AUDIO_REVERB_ROOM_SIZE, 6); UBFL_Logger::Print(FString::Printf(TEXT("%s SetLocalVoiceReverb AUDIO_REVERB_ROOM_SIZE ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - ret = RtcEngineProxy->setLocalVoiceReverb(AUDIO_REVERB_WET_DELAY, 124); + ret = AgoraUERtcEngine::Get()->setLocalVoiceReverb(AUDIO_REVERB_WET_DELAY, 124); UBFL_Logger::Print(FString::Printf(TEXT("%s SetLocalVoiceReverb AUDIO_REVERB_WET_DELAY ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - ret = RtcEngineProxy->setLocalVoiceReverb(AUDIO_REVERB_STRENGTH, 78); + ret = AgoraUERtcEngine::Get()->setLocalVoiceReverb(AUDIO_REVERB_STRENGTH, 78); UBFL_Logger::Print(FString::Printf(TEXT("%s SetLocalVoiceReverb AUDIO_REVERB_STRENGTH ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -201,12 +200,11 @@ void UVoiceChangerWidget::NativeDestruct() void UVoiceChangerWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VoiceChanger/VoiceChangerWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VoiceChanger/VoiceChangerWidget.h index 4928211a..8437e3f3 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VoiceChanger/VoiceChangerWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/VoiceChanger/VoiceChangerWidget.h @@ -186,7 +186,6 @@ class AGORAEXAMPLE_API UVoiceChangerWidget : public UBaseAgoraUserWidget FString Token = ""; FString ChannelName = ""; - IRtcEngine* RtcEngineProxy; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/WriteBackVideoRawData/WriteBackVideoRawDataWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/WriteBackVideoRawData/WriteBackVideoRawDataWidget.cpp index 390ec15d..7bca301d 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/WriteBackVideoRawData/WriteBackVideoRawDataWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/WriteBackVideoRawData/WriteBackVideoRawDataWidget.cpp @@ -53,17 +53,16 @@ void UWriteBackVideoRawDataWidget::InitAgoraEngine(FString APP_ID, FString TOKEN Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); - RtcEngineProxy->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + AgoraUERtcEngine::Get()->queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); UserVideoFrameObserver = MakeShared(this); MediaEngine->registerVideoFrameObserver(UserVideoFrameObserver.Get()); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); @@ -84,17 +83,17 @@ void UWriteBackVideoRawDataWidget::ShowUserGuide() void UWriteBackVideoRawDataWidget::JoinChannel() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); VideoEncoderConfiguration config; config.dimensions = VideoDimensions(640, 360); config.frameRate = 15; config.bitrate = 0; - RtcEngineProxy->setVideoEncoderConfiguration(config); - RtcEngineProxy->setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING); - RtcEngineProxy->setClientRole(CLIENT_ROLE_BROADCASTER); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->setVideoEncoderConfiguration(config); + AgoraUERtcEngine::Get()->setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING); + AgoraUERtcEngine::Get()->setClientRole(CLIENT_ROLE_BROADCASTER); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -116,12 +115,11 @@ void UWriteBackVideoRawDataWidget::NativeDestruct() void UWriteBackVideoRawDataWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandlerEx.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandlerEx.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } @@ -141,10 +139,8 @@ int UWriteBackVideoRawDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SO channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -153,7 +149,7 @@ int UWriteBackVideoRawDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SO if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { @@ -162,13 +158,13 @@ int UWriteBackVideoRawDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SO videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -177,10 +173,8 @@ int UWriteBackVideoRawDataWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SO int UWriteBackVideoRawDataWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = 0; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -190,20 +184,20 @@ int UWriteBackVideoRawDataWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } return ret; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/WriteBackVideoRawData/WriteBackVideoRawDataWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/WriteBackVideoRawData/WriteBackVideoRawDataWidget.h index 64c07d84..f302a73c 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/WriteBackVideoRawData/WriteBackVideoRawDataWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Advanced/WriteBackVideoRawData/WriteBackVideoRawDataWidget.h @@ -173,7 +173,6 @@ class AGORAEXAMPLE_API UWriteBackVideoRawDataWidget : public UBaseAgoraUserWidge FString Token = ""; FString ChannelName = ""; - IRtcEngine* RtcEngineProxy; agora::media::IMediaEngine* MediaEngine; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelAudio/AgoraAudioWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelAudio/AgoraAudioWidget.cpp index 2316ab9d..012865fd 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelAudio/AgoraAudioWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelAudio/AgoraAudioWidget.cpp @@ -55,14 +55,13 @@ void UAgoraAudioWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString C Token = TOKEN; ChannelName = CHANNEL_NAME; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -78,12 +77,11 @@ void UAgoraAudioWidget::ShowUserGuide() void UAgoraAudioWidget::UnInitAgoraEngine() { - if (RtcEngineProxy != nullptr) + if (AgoraUERtcEngine::Get() != nullptr) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } } @@ -96,27 +94,29 @@ void UAgoraAudioWidget::OnBtnBackToHomeClicked() void UAgoraAudioWidget::OnBtnStartEchoTestClicked() { - int ret = RtcEngineProxy->startEchoTest(10); + agora::rtc::EchoTestConfiguration Config; + Config.intervalInSeconds = 10; + int ret = AgoraUERtcEngine::Get()->startEchoTest(Config); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UAgoraAudioWidget::OnBtnStopEchoTestClicked() { - int ret = RtcEngineProxy->stopEchoTest(); + int ret = AgoraUERtcEngine::Get()->stopEchoTest(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UAgoraAudioWidget::OnBtnJoinChannelClicked() { - RtcEngineProxy->enableAudio(); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); - RtcEngineProxy->setClientRole(agora::rtc::CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->enableAudio(); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->setClientRole(agora::rtc::CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UAgoraAudioWidget::OnBtnLeaveChannelClicked() { - int ret = RtcEngineProxy->leaveChannel(); + int ret = AgoraUERtcEngine::Get()->leaveChannel(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -124,7 +124,7 @@ void UAgoraAudioWidget::OnBtnStartPublishClicked() { ChannelMediaOptions options; options.publishMicrophoneTrack = true; - int ret = RtcEngineProxy->updateChannelMediaOptions(options); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptions(options); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -132,27 +132,27 @@ void UAgoraAudioWidget::OnBtnStopPublishClicked() { ChannelMediaOptions options; options.publishMicrophoneTrack = false; - int ret = RtcEngineProxy->updateChannelMediaOptions(options); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptions(options); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UAgoraAudioWidget::OnSliderPlaybackSignalVolumeValChanged(float val) { Txt_PlaybackSignalVolume->SetText(FText::FromString(FString::FromInt(FMath::RoundToInt(val)))); - int ret = RtcEngineProxy->adjustPlaybackSignalVolume(val); + int ret = AgoraUERtcEngine::Get()->adjustPlaybackSignalVolume(val); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UAgoraAudioWidget::OnSliderRecordingSignalVolumeValChanged(float val) { Txt_RecordingSignalVolume->SetText(FText::FromString(FString::FromInt(FMath::RoundToInt(val)))); - int ret = RtcEngineProxy->adjustRecordingSignalVolume(val); + int ret = AgoraUERtcEngine::Get()->adjustRecordingSignalVolume(val); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } void UAgoraAudioWidget::OnBtnEnableAudioIndicationClicked() { - int ret = RtcEngineProxy->enableAudioVolumeIndication(200, 3, false); + int ret = AgoraUERtcEngine::Get()->enableAudioVolumeIndication(200, 3, false); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -176,7 +176,7 @@ void UAgoraAudioWidget::OnCBSAudioProfileSelectionChanged(FString SelectedItem, else if (SelectedOption == "AUDIO_PROFILE_IOT") audioProfile = AUDIO_PROFILE_IOT; - int ret = RtcEngineProxy->setAudioProfile(audioProfile); + int ret = AgoraUERtcEngine::Get()->setAudioProfile(audioProfile); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d AudioProfile=%s"), *FString(FUNCTION_MACRO), ret, *SelectedOption), LogMsgViewPtr); } @@ -196,7 +196,7 @@ void UAgoraAudioWidget::OnCBSAudioSenarioSelectionChanged(FString SelectedItem, else if (SelectedOption == "AUDIO_SCENARIO_MEETING") scenario = AUDIO_SCENARIO_MEETING; - int ret = RtcEngineProxy->setAudioScenario(scenario); + int ret = AgoraUERtcEngine::Get()->setAudioScenario(scenario); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d AudioScenario=%s"), *FString(FUNCTION_MACRO), ret, *SelectedOption), LogMsgViewPtr); } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelVideo/AgoraVideoWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelVideo/AgoraVideoWidget.cpp index 04e1b166..16901fd3 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelVideo/AgoraVideoWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelVideo/AgoraVideoWidget.cpp @@ -3,6 +3,9 @@ #include "AgoraVideoWidget.h" +#include "Components/CanvasPanelSlot.h" +#include "Blueprint/WidgetLayoutLibrary.h" + void UAgoraVideoWidget::InitAgoraWidget(FString APP_ID, FString TOKEN, FString CHANNEL_NAME) { LogMsgViewPtr = UBFL_Logger::CreateLogView(CanvasPanel_LogMsgView, DraggableLogMsgViewTemplate); @@ -14,6 +17,7 @@ void UAgoraVideoWidget::InitAgoraWidget(FString APP_ID, FString TOKEN, FString C ShowUserGuide(); } + void UAgoraVideoWidget::CheckPermission() { #if PLATFORM_ANDROID FString TargetPlatformName = UGameplayStatics::GetPlatformName(); @@ -44,13 +48,13 @@ void UAgoraVideoWidget::InitAgoraEngine(FString APP_ID, FString TOKEN, FString C RtcEngineContext.eventHandler = UserRtcEventHandler.Get(); RtcEngineContext.channelProfile = CHANNEL_PROFILE_TYPE::CHANNEL_PROFILE_LIVE_BROADCASTING; - RtcEngineProxy = agora::rtc::ue::createAgoraRtcEngine(); + int SDKBuild = 0; - const char* SDKVersionInfo = RtcEngineProxy->getVersion(&SDKBuild); + const char* SDKVersionInfo = AgoraUERtcEngine::Get()->getVersion(&SDKBuild); FString SDKInfo = FString::Printf(TEXT("SDK Version: %s Build: %d"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild); UBFL_Logger::Print(FString::Printf(TEXT("SDK Info: %s"), *SDKInfo), LogMsgViewPtr); - int ret = RtcEngineProxy->initialize(RtcEngineContext); + int ret = AgoraUERtcEngine::Get()->initialize(RtcEngineContext); UBFL_Logger::Print(FString::Printf(TEXT("%s initialize ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -60,6 +64,7 @@ void UAgoraVideoWidget::ShowUserGuide() FString Guide = "Case: [BasicVideoScene]\n" "1. This is a basic video scene.\n" + "2. Notice: we set [CreateOneVideoViewToCanvasPanel] param 'bAutoSize' to be true to make the image view auto size with its brush size.\n" ""; UBFL_Logger::DisplayUserGuide(Guide, LogMsgViewPtr); @@ -67,28 +72,27 @@ void UAgoraVideoWidget::ShowUserGuide() void UAgoraVideoWidget::UnInitAgoraEngine() { - if (RtcEngineProxy) + if (AgoraUERtcEngine::Get()) { - RtcEngineProxy->leaveChannel(); - RtcEngineProxy->unregisterEventHandler(UserRtcEventHandler.Get()); - RtcEngineProxy->release(); - RtcEngineProxy = nullptr; + AgoraUERtcEngine::Get()->leaveChannel(); + AgoraUERtcEngine::Get()->unregisterEventHandler(UserRtcEventHandler.Get()); + AgoraUERtcEngine::Release(); UBFL_Logger::Print(FString::Printf(TEXT("%s release agora engine"), *FString(FUNCTION_MACRO)), LogMsgViewPtr); } } void UAgoraVideoWidget::OnBtnJoinChannelClicked() { - RtcEngineProxy->enableAudio(); - RtcEngineProxy->enableVideo(); - int ret = RtcEngineProxy->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); + AgoraUERtcEngine::Get()->enableAudio(); + AgoraUERtcEngine::Get()->enableVideo(); + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*Token), TCHAR_TO_UTF8(*ChannelName), "", 0); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); - RtcEngineProxy->setClientRole(agora::rtc::CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); + AgoraUERtcEngine::Get()->setClientRole(agora::rtc::CLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); } void UAgoraVideoWidget::OnBtnLeaveChannelClicked() { - int ret = RtcEngineProxy->leaveChannel(); + int ret = AgoraUERtcEngine::Get()->leaveChannel(); UBFL_Logger::Print(FString::Printf(TEXT("%s ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -97,7 +101,7 @@ void UAgoraVideoWidget::OnBtnStartPublishClicked() ChannelMediaOptions options; options.publishMicrophoneTrack = true; options.publishCameraTrack = true; - int ret = RtcEngineProxy->updateChannelMediaOptions(options); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptions(options); } void UAgoraVideoWidget::OnBtnStopPublishClicked() @@ -105,7 +109,7 @@ void UAgoraVideoWidget::OnBtnStopPublishClicked() ChannelMediaOptions options; options.publishMicrophoneTrack = false; options.publishCameraTrack = false; - int ret = RtcEngineProxy->updateChannelMediaOptions(options); + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptions(options); UBFL_Logger::Print(FString::Printf(TEXT("%s updateChannelMediaOptions ret %d"), *FString(FUNCTION_MACRO), ret), LogMsgViewPtr); } @@ -131,7 +135,7 @@ void UAgoraVideoWidget::OnBtnVideoConfigConfirmClicked() UBFL_Logger::Print(FString::Printf(TEXT("%s Width=%d Height=%d"), *FString(FUNCTION_MACRO), ValWidth, ValHeight), LogMsgViewPtr); UBFL_Logger::Print(FString::Printf(TEXT("%s Bitrate=%d"), *FString(FUNCTION_MACRO), ValBitRate), LogMsgViewPtr); - int ret = RtcEngineProxy->setVideoEncoderConfiguration(videoEncoderConfiguration); + int ret = AgoraUERtcEngine::Get()->setVideoEncoderConfiguration(videoEncoderConfiguration); FVideoViewIdentity LocalVideoFrameIdentity(VIDEO_SOURCE_CAMERA); UBFL_VideoViewManager::ChangeSizeForOneVideoView(LocalVideoFrameIdentity, ValWidth, ValHeight, VideoViewMap); @@ -156,6 +160,11 @@ void UAgoraVideoWidget::NativeDestruct() { } +//void UAgoraVideoWidget::NativeTick(const FGeometry& MyGeometry, float DeltaTime) +//{ +// Super::NativeTick(MyGeometry, DeltaTime); +//} + #pragma region UI Utility @@ -171,10 +180,8 @@ int UAgoraVideoWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE s channelId will be set in [setupLocalVideo] / [setupRemoteVideo] */ - int ret = -ERROR_NULLPTR; + int ret = -1; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.uid = uid; @@ -182,23 +189,23 @@ int UAgoraVideoWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE s if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); - videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate,true); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); - videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate); + videoCanvas.view = UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(VideoViewIdentity, CanvasPanel_VideoView, VideoViewMap, DraggableVideoViewTemplate,true); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = ((agora::rtc::IRtcEngineEx*)AgoraUERtcEngine::Get())->setupRemoteVideoEx(videoCanvas, connection); } } @@ -207,10 +214,8 @@ int UAgoraVideoWidget::MakeVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE s int UAgoraVideoWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYPE sourceType /*= VIDEO_SOURCE_CAMERA_PRIMARY*/, FString channelId /*= ""*/) { - int ret = -ERROR_NULLPTR; + int ret = -1; - if (RtcEngineProxy == nullptr) - return ret; agora::rtc::VideoCanvas videoCanvas; videoCanvas.view = nullptr; @@ -220,20 +225,20 @@ int UAgoraVideoWidget::ReleaseVideoView(uint32 uid, agora::rtc::VIDEO_SOURCE_TYP if (uid == 0) { FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); - ret = RtcEngineProxy->setupLocalVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); } else { FVideoViewIdentity VideoViewIdentity(uid, sourceType, channelId); UBFL_VideoViewManager::ReleaseOneVideoView(VideoViewIdentity, VideoViewMap); if (channelId == "") { - ret = RtcEngineProxy->setupRemoteVideo(videoCanvas); + ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); } else { agora::rtc::RtcConnection connection; std::string StdStrChannelId = TCHAR_TO_UTF8(*channelId); connection.channelId = StdStrChannelId.c_str(); - ret = ((agora::rtc::IRtcEngineEx*)RtcEngineProxy)->setupRemoteVideoEx(videoCanvas, connection); + ret = AgoraUERtcEngine::Get()->setupRemoteVideoEx(videoCanvas, connection); } } return ret; @@ -332,38 +337,46 @@ void UAgoraVideoWidget::FUserRtcEventHandler::onUserOffline(agora::rtc::uid_t ui }); } -void UAgoraVideoWidget::FUserRtcEventHandler::onVideoSizeChanged(VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) -{ - if (!IsWidgetValid()) - return; - -#if ((__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!IsWidgetValid()) - { - UBFL_Logger::PrintError(FString::Printf(TEXT("%s bIsDestruct "), *FString(FUNCTION_MACRO))); - return; - } - UBFL_Logger::Print(FString::Printf(TEXT("%s uid=%u width=%d height=%d rotation=%d"), *FString(FUNCTION_MACRO), uid, width, height, rotation), WidgetPtr->GetLogMsgViewPtr()); - - FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); +// No need to use this callback function +//void UAgoraVideoWidget::FUserRtcEventHandler::onVideoSizeChanged(VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) +//{ +// if (!IsWidgetValid()) +// return; +// +//#if ((__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)) +// AsyncTask(ENamedThreads::GameThread, [=, this]() +//#else +// AsyncTask(ENamedThreads::GameThread, [=]() +//#endif +// { +// if (!IsWidgetValid()) +// { +// UBFL_Logger::PrintError(FString::Printf(TEXT("%s bIsDestruct "), *FString(FUNCTION_MACRO))); +// return; +// } +// UBFL_Logger::Print(FString::Printf(TEXT("%s uid=%u width=%d height=%d rotation=%d"), *FString(FUNCTION_MACRO), uid, width, height, rotation), WidgetPtr->GetLogMsgViewPtr()); +// +// FVideoViewIdentity VideoViewIdentity(uid, sourceType, ""); +// +// //if(rotation == 0){ +// // // no need to consider the rotation. +// // UBFL_VideoViewManager::ChangeSizeForOneVideoView(VideoViewIdentity, width, height, WidgetPtr->VideoViewMap); +// //} +// //else{ +// // UBFL_VideoViewManager::ResizeTheRotationAppliedImage(VideoViewIdentity, width, height, rotation, WidgetPtr->VideoViewMap); +// //} +// +// // Because [getRotationApplied] in [VideoObserverInternal.h] is set to True, we just change the size. +// +// UBFL_VideoViewManager::ResizeTheRotationAppliedImage(VideoViewIdentity, width, height, rotation, WidgetPtr->VideoViewMap); +// }); +//} + + + +void UAgoraVideoWidget::FUserRtcEventHandler::onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState){ - //if(rotation == 0){ - // // no need to consider the rotation. - // UBFL_VideoViewManager::ChangeSizeForOneVideoView(VideoViewIdentity, width, height, WidgetPtr->VideoViewMap); - //} - //else{ - // UBFL_VideoViewManager::ResizeTheRotationAppliedImage(VideoViewIdentity, width, height, rotation, WidgetPtr->VideoViewMap); - //} - // Because [getRotationApplied] in [VideoObserverInternal.h] is set to True, we just change the size. - UBFL_VideoViewManager::ResizeTheRotationAppliedImage(VideoViewIdentity, width, height, rotation, WidgetPtr->VideoViewMap); - }); } - #pragma endregion diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelVideo/AgoraVideoWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelVideo/AgoraVideoWidget.h index 71d4bf80..f992a331 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelVideo/AgoraVideoWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/Basic/JoinChannelVideo/AgoraVideoWidget.h @@ -24,6 +24,7 @@ #include "AgoraVideoWidget.generated.h" + using namespace agora::rtc; using namespace agora; @@ -55,7 +56,9 @@ class AGORAEXAMPLE_API UAgoraVideoWidget : public UBaseAgoraUserWidget void onUserOffline(agora::rtc::uid_t uid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) override; - void onVideoSizeChanged(VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) override; + //void onVideoSizeChanged(VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) override; + + void onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) override; #pragma endregion @@ -128,7 +131,7 @@ class AGORAEXAMPLE_API UAgoraVideoWidget : public UBaseAgoraUserWidget void InitAgoraWidget(FString APP_ID, FString TOKEN, FString CHANNEL_NAME) override; - + //virtual void NativeTick(const FGeometry& MyGeometry, float DeltaTime) override; #pragma region UI Utility - Log Msg View public: @@ -170,8 +173,6 @@ class AGORAEXAMPLE_API UAgoraVideoWidget : public UBaseAgoraUserWidget protected: - IRtcEngine* RtcEngineProxy; - FString AppId; FString Token; FString ChannelName; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/MainAgoraUserWidget.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/MainAgoraUserWidget.cpp index 4042380b..bab7f7d1 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/MainAgoraUserWidget.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/MainAgoraUserWidget.cpp @@ -2,6 +2,7 @@ #include "MainAgoraUserWidget.h" +#include "AgoraPluginInterface.h" #include "GameFramework/GameUserSettings.h" #pragma region CustomTileView @@ -57,6 +58,9 @@ void UMainAgoraUserWidget::NativeConstruct() LevelTileView->AddItem(temp); } + if(Txt_SDKVer){ + Txt_SDKVer->SetText(FText::FromString(AgoraUERtcEngine::GetSDKVersion())); + } } void UMainAgoraUserWidget::NativeDestruct() @@ -146,7 +150,7 @@ void UMainAgoraUserWidget::InitLevelArray() LevelArray.Add(FString("VirtualBackground")); LevelArray.Add(FString("VoiceChanger")); LevelArray.Add(FString("MusicPlayer")); - LevelArray.Add(FString("RenderWithYUV")); + //LevelArray.Add(FString("RenderWithYUV")); LevelArray.Add(FString("MediaPlayerWithCustomDataProvide")); LevelArray.Add(FString("WriteBackVideoRawData")); diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/MainAgoraUserWidget.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/MainAgoraUserWidget.h index 651eebe4..2c78563c 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/MainAgoraUserWidget.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Examples/MainAgoraUserWidget.h @@ -7,6 +7,7 @@ #include "Components/Button.h" #include "Components/TileView.h" #include "Components/EditableTextBox.h" +#include "Components/TextBlock.h" #include "Kismet/GameplayStatics.h" #include "../Config/AgoraConfig.h" #include "LevelSwitchItem.h" @@ -92,6 +93,9 @@ class AGORAEXAMPLE_API UMainAgoraUserWidget : public UBaseAgoraUserWidget FString CHANNEL_NAME; + UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) + UTextBlock* Txt_SDKVer; + protected: void NativeConstruct() override; diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Utility/BFL_VideoViewManager.cpp b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Utility/BFL_VideoViewManager.cpp index 8a9b293c..b9d4338a 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Utility/BFL_VideoViewManager.cpp +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Utility/BFL_VideoViewManager.cpp @@ -5,7 +5,7 @@ #include "Components/CanvasPanelSlot.h" #include "Blueprint/WidgetLayoutLibrary.h" -UImage* UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(int64 uid, UCanvasPanel* CanvasPanel, TMap& VideoViewMap, UImage* VideoView, TSubclassOf Template) +UImage* UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(int64 uid, UCanvasPanel* CanvasPanel, TMap& VideoViewMap, UImage* VideoView, TSubclassOf Template, bool bAutoSize /* = false */) { if (VideoViewMap.Contains(uid)) { @@ -18,14 +18,21 @@ UImage* UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(int64 uid, UCanva UDraggableVideoViewWidget* VideoViewWidget = CreateWidget(world, Template); VideoViewMap.Add(uid, VideoViewWidget); UPanelSlot* PanelSlot = CanvasPanel->AddChild(VideoViewWidget); + + // set the whole UDraggableVideoViewWidget widget size UCanvasPanelSlot* CanvasPanelSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot(VideoViewWidget); CanvasPanelSlot->SetSize(FVector2D(640, 360)); + + // make the image auto-sized, the same as its brush size + UCanvasPanelSlot* ViewCanvasPanelSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot(VideoViewWidget->View); + ViewCanvasPanelSlot->SetAutoSize(bAutoSize); + return VideoViewWidget->View; } } -UImage* UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(const FVideoViewIdentity& Key, UCanvasPanel* CanvasPanel, TMap& VideoViewMap, TSubclassOf Template) +UImage* UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(const FVideoViewIdentity& Key, UCanvasPanel* CanvasPanel, TMap& VideoViewMap, TSubclassOf Template, bool bAutoSize /* = false */) { if (VideoViewMap.Contains(Key)) { @@ -48,8 +55,14 @@ UImage* UBFL_VideoViewManager::CreateOneVideoViewToCanvasPanel(const FVideoViewI VideoViewMap.Add(Key, VideoViewWidget); UPanelSlot* PanelSlot = CanvasPanel->AddChild(VideoViewWidget); + + // set the whole UDraggableVideoViewWidget widget size UCanvasPanelSlot* CanvasPanelSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot(VideoViewWidget); CanvasPanelSlot->SetSize(FVector2D(640, 360)); + + // make the image auto-sized, the same as its brush size + UCanvasPanelSlot* ViewCanvasPanelSlot = UWidgetLayoutLibrary::SlotAsCanvasSlot(VideoViewWidget->View); + ViewCanvasPanelSlot->SetAutoSize(bAutoSize); return VideoViewWidget->View; } } diff --git a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Utility/BFL_VideoViewManager.h b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Utility/BFL_VideoViewManager.h index c20545f0..dde18897 100644 --- a/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Utility/BFL_VideoViewManager.h +++ b/Agora-Unreal-SDK-CPP-Example/Source/AgoraExample/Utility/BFL_VideoViewManager.h @@ -65,7 +65,8 @@ class AGORAEXAMPLE_API UBFL_VideoViewManager : public UBlueprintFunctionLibrary UCanvasPanel* CanvasPanel, TMap& VideoViewMap, UImage* VideoView, - TSubclassOf Template + TSubclassOf Template, + bool bAutoSize = false ); static void ReleaseOneVideoView(int64 uid, TMap& VideoViewMap); @@ -78,7 +79,8 @@ class AGORAEXAMPLE_API UBFL_VideoViewManager : public UBlueprintFunctionLibrary const FVideoViewIdentity& Key, UCanvasPanel* CanvasPanel, TMap& VideoViewMap, - TSubclassOf Template + TSubclassOf Template, + bool bAutoSize = false ); static void ReleaseOneVideoView(const FVideoViewIdentity& Key, TMap& VideoViewMap); diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/AgoraPlugin.Build.cs b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/AgoraPlugin.Build.cs index 7516233a..14e8626c 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/AgoraPlugin.Build.cs +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/AgoraPlugin.Build.cs @@ -1,7 +1,8 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. +// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Linq; +using System.IO; using UnrealBuildTool; using System.Reflection; @@ -18,6 +19,11 @@ public AgoraPlugin(ReadOnlyTargetRules Target) : base(Target) // Notice: for now, the audio-only plugin is only available for Android and iOS. The [Windows/Mac] version still remains the FULL version, even if you have downloaded the voice version SDK. PublicDefinitions.Add(String.Format("AGORA_UESDK_AUDIO_ONLY={0}", (bIsAudioOnlySDK ? 1 : 0))); + + // if need to set callbacks during agora sdk lifetime + bool bWithAgoraCallbacks = true; + PublicDefinitions.Add(String.Format("WITH_AGORA_CALLBACKS={0}", (bWithAgoraCallbacks ? 1 : 0))); + // Whether to compile video-related code or not. if (!bIsAudioOnlySDK || (!(Target.Platform == UnrealTargetPlatform.Android || Target.Platform == UnrealTargetPlatform.IOS))) { @@ -31,14 +37,34 @@ public AgoraPlugin(ReadOnlyTargetRules Target) : base(Target) PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... - } + Path.Combine(ModuleDirectory,"Public","AgoraCppPlugin"), + Path.Combine(ModuleDirectory,"Public","AgoraCppPlugin","include"), + // "AgoraPlugin/Public/AgoraCppPlugin/include", + Path.Combine(ModuleDirectory,"Public","AgoraBlueprintPlugin"), + } ); + bool bUseBlueprintModule = true; + + if(bUseBlueprintModule) + { + PublicDependencyModuleNames.AddRange( + new string[] + { + "MediaAssets", + "AgoraUtilityHelper", + } + ); + } + + PrivateIncludePaths.AddRange( new string[] { // ... add other private include paths required here ... - } + Path.Combine(ModuleDirectory,"Private","AgoraCppPlugin","PrivateInclude"), + Path.Combine(ModuleDirectory,"Private","AgoraCppPlugin","PrivateInclude","VideoRender"), + } ); if (Target.Platform == UnrealTargetPlatform.Android) @@ -54,9 +80,9 @@ public AgoraPlugin(ReadOnlyTargetRules Target) : base(Target) new string[] { "Core", - "AgoraPluginLibrary", "Projects", - "Eigen" + "AgoraPluginLibrary", + // ... add other public dependencies that you statically link with here ... } ); @@ -83,28 +109,34 @@ public AgoraPlugin(ReadOnlyTargetRules Target) : base(Target) ); - // Add Compile Options - if (Target.Platform == UnrealTargetPlatform.Mac || Target.Platform == UnrealTargetPlatform.IOS) + + + //// Add Compile Options + //if (Target.Platform == UnrealTargetPlatform.Mac || Target.Platform == UnrealTargetPlatform.IOS) + //{ + // // -Wno-gcc-compat: gcc does not allow an atrribute in this position on a function declaration + // // -Wno-reorder-ctor: fix error "field 'eventHandler' will be initialized after field 'mccUid'" + // // -Wno-nonportable-include-path: In some cases, path would be changed from to . + // Type TargetType = Target.GetType(); + // FieldInfo InnerField = TargetType.GetField("Inner", BindingFlags.Instance | BindingFlags.NonPublic); + // TargetRules Inner = (TargetRules)InnerField.GetValue(Target); + // Inner.AdditionalCompilerArguments += " -Wno-gcc-compat -Wno-reorder-ctor -Wno-nonportable-include-path "; + //} + + + + if (Target.GlobalDefinitions.Contains("FORCE_ANSI_ALLOCATOR=1")) { - // -Wno-gcc-compat: gcc does not allow an atrribute in this position on a function declaration - // -Wno-reorder-ctor: fix error "field 'eventHandler' will be initialized after field 'mccUid'" - // -Wno-nonportable-include-path: In some cases, path would be changed from to . - Type TargetType = Target.GetType(); - FieldInfo InnerField = TargetType.GetField("Inner", BindingFlags.Instance | BindingFlags.NonPublic); - TargetRules Inner = (TargetRules)InnerField.GetValue(Target); - Inner.AdditionalCompilerArguments += " -Wno-gcc-compat -Wno-reorder-ctor -Wno-nonportable-include-path "; - } - - - if(Target.GlobalDefinitions.Contains("FORCE_ANSI_ALLOCATOR=1")){ - + PublicDefinitions.Add(string.Format("USE_ANSI_ALLOCATOR=1")); Console.WriteLine("[Agora Allocator] Use ANSI Allocator"); + + PublicDependencyModuleNames.AddRange(new string[] { "Eigen" }); } - else{ + else + { PublicDefinitions.Add(string.Format("USE_ANSI_ALLOCATOR=0")); Console.WriteLine("[Agora Allocator] Use UE Allocator"); } - } } diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraAudioDeviceManager.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraAudioDeviceManager.cpp deleted file mode 100644 index daf1e656..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraAudioDeviceManager.cpp +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/AgoraAudioDeviceManager.h" -#include - -int UIAudioDeviceCollection::GetCount() -{ - if (AudioDeviceCollection != nullptr) - { - return AudioDeviceCollection->getCount(); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceCollection::GetDevice(int index, FString& deviceName, FString& deviceId) -{ - if (AudioDeviceCollection != nullptr) - { - char tempDeviceName[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - int ret = AudioDeviceCollection->getDevice(index, tempDeviceName, tempDeviceId); - - deviceName = UTF8_TO_TCHAR(tempDeviceName); - - deviceId = UTF8_TO_TCHAR(tempDeviceId); - - return ret; - - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceCollection::SetDevice(FString deviceId) -{ - if (AudioDeviceCollection != nullptr) - { - int ret = AudioDeviceCollection->setDevice(TCHAR_TO_UTF8(*deviceId)); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceCollection::GetDefaultDevice(FString& deviceName, FString& deviceId) -{ - if (AudioDeviceCollection != nullptr) - { - char tempDeviceName[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - int ret = AudioDeviceCollection->getDefaultDevice(tempDeviceName, tempDeviceId); - - std::string StdStrDeviceName = tempDeviceName; - std::string StdStrDeviceId = tempDeviceId; - - deviceName = StdStrDeviceName.c_str(); - deviceId = StdStrDeviceId.c_str(); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceCollection::SetApplicationVolume(int volume) -{ - if (AudioDeviceCollection != nullptr) - { - return AudioDeviceCollection->setApplicationVolume(volume); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceCollection::GetApplicationVolume(int & volume) -{ - if (AudioDeviceCollection != nullptr) - { - return AudioDeviceCollection->getApplicationVolume(volume); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceCollection::SetApplicationMute(bool mute) -{ - if (AudioDeviceCollection != nullptr) - { - return AudioDeviceCollection->setApplicationMute(mute); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceCollection::IsApplicationMute(bool mute) -{ - if (AudioDeviceCollection != nullptr) - { - return AudioDeviceCollection->isApplicationMute(mute); - } - return -ERROR_NULLPTR; -} -void UIAudioDeviceCollection::Release() -{ - if (AudioDeviceCollection != nullptr) - { - return AudioDeviceCollection->release(); - } -} -void UIAudioDeviceCollection::SetAudioDeviceCollection(agora::rtc::IAudioDeviceCollection* audioDeviceCollection) -{ - this->AudioDeviceCollection = audioDeviceCollection; -} -UIAudioDeviceCollection* UIAudioDeviceManager::EnumeratePlaybackDevices() -{ - if (AudioDeviceManager != nullptr) - { - if (playbackDevice == nullptr) - { - playbackDevice = NewObject(); - } - - playbackDevice->SetAudioDeviceCollection(AudioDeviceManager->enumeratePlaybackDevices()); - - return playbackDevice; - } - return nullptr; -} -UIAudioDeviceCollection* UIAudioDeviceManager::EnumerateRecordingDevices() -{ - if (AudioDeviceManager != nullptr) - { - if (recordDevice == nullptr) - { - recordDevice = NewObject(); - } - - recordDevice->SetAudioDeviceCollection(AudioDeviceManager->enumerateRecordingDevices()); - - return recordDevice; - } - return nullptr; -} -int UIAudioDeviceManager::SetPlaybackDevice(FString deviceId) -{ - if (AudioDeviceManager != nullptr) - { - int ret = AudioDeviceManager->setPlaybackDevice(TCHAR_TO_UTF8(*deviceId)); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::GetPlaybackDevice(FString& deviceId) -{ - if (AudioDeviceManager != nullptr) - { - char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - int ret = AudioDeviceManager->getPlaybackDevice(tempDeviceId); - - deviceId = UTF8_TO_TCHAR(tempDeviceId); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::GetPlaybackDeviceInfo(FString& deviceId, FString& deviceName) -{ - if (AudioDeviceManager != nullptr) - { - - char tempDeviceName[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - int ret = AudioDeviceManager->getPlaybackDeviceInfo(tempDeviceId, tempDeviceName); - - deviceName = UTF8_TO_TCHAR(tempDeviceName); - - deviceId = UTF8_TO_TCHAR(tempDeviceId); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::SetPlaybackDeviceVolume(int volume) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->setPlaybackDeviceVolume(volume); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::GetPlaybackDeviceVolume(int& volume) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->getPlaybackDeviceVolume(&volume); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::SetRecordingDevice(FString deviceId) -{ - if (AudioDeviceManager != nullptr) - { - int ret = AudioDeviceManager->setRecordingDevice(TCHAR_TO_UTF8(*deviceId)); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::GetRecordingDevice(FString& deviceId) -{ - if (AudioDeviceManager != nullptr) - { - char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - int ret = AudioDeviceManager->getRecordingDevice(tempDeviceId); - - deviceId = UTF8_TO_TCHAR(tempDeviceId); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::GetRecordingDeviceInfo(FString& deviceId, FString& deviceName) -{ - if (AudioDeviceManager != nullptr) - { - char tempDeviceName[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - int ret = AudioDeviceManager->getRecordingDeviceInfo(tempDeviceId, tempDeviceName); - - deviceName = UTF8_TO_TCHAR(tempDeviceName); - - deviceId = UTF8_TO_TCHAR(tempDeviceId); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::SetRecordingDeviceVolume(int volume) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->setRecordingDeviceVolume(volume); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::GetRecordingDeviceVolume(int& volume) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->getRecordingDeviceVolume(&volume); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::SetPlaybackDeviceMute(bool mute) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->setPlaybackDeviceMute(mute); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::GetPlaybackDeviceMute(bool& mute) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->getPlaybackDeviceMute(&mute); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::SetRecordingDeviceMute(bool mute) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->setRecordingDeviceMute(mute); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::GetRecordingDeviceMute(bool& mute) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->getRecordingDeviceMute(&mute); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::StartPlaybackDeviceTest(FString testAudioFilePath) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->startPlaybackDeviceTest(TCHAR_TO_UTF8(*testAudioFilePath)); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::StopPlaybackDeviceTest() -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->stopPlaybackDeviceTest(); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::StartRecordingDeviceTest(int indicationInterval) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->startRecordingDeviceTest(indicationInterval); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::StopRecordingDeviceTest() -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->stopRecordingDeviceTest(); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::StartAudioDeviceLoopbackTest(int indicationInterval) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->startAudioDeviceLoopbackTest(indicationInterval); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::StopAudioDeviceLoopbackTest() -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->stopAudioDeviceLoopbackTest(); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::FollowSystemPlaybackDevice(bool enable) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->followSystemPlaybackDevice(enable); - } - return -ERROR_NULLPTR; -} -int UIAudioDeviceManager::FollowSystemRecordingDevice(bool enable) -{ - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->followSystemRecordingDevice(enable); - } - return -ERROR_NULLPTR; -} -void UIAudioDeviceManager::Release() -{ - playbackDevice = nullptr; - recordDevice = nullptr; - - if (AudioDeviceManager != nullptr) - { - return AudioDeviceManager->release(); - } -} -void UIAudioDeviceManager::SetAudioDeviceManager(agora::rtc::IAudioDeviceManager* audioDeviceManager) -{ - this->AudioDeviceManager = audioDeviceManager; -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuDeviceManager.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuDeviceManager.cpp new file mode 100644 index 00000000..fdb3fc4b --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuDeviceManager.cpp @@ -0,0 +1,337 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. + +#include "AgoraBPuDeviceManager.h" +#include "AgoraHeaderBase.h" +#include "UtilityAgoraBPuLogger.h" + + +UAgoraBPuVideoDeviceManager* UAgoraBPuVideoDeviceManager::Instance = nullptr; + +UAgoraBPuAudioDeviceManager* UAgoraBPuAudioDeviceManager::Instance = nullptr; + + +UAgoraBPuVideoDeviceManager* UAgoraBPuVideoDeviceManager::GetAgoraVideoDeviceManager() +{ + if (Instance == nullptr) + { + Instance = NewObject(); + Instance->AddToRoot(); + AgoraUERtcEngine::Get()->queryInterface(agora::rtc::AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&Instance->VideoDeviceManager); + + if (Instance->VideoDeviceManager == nullptr) { + + UAgoraBPuLogger::PrintError("VideoDeviceManager is nullptr." + AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED]); + + Instance->VideoDeviceCollection = nullptr; + } + else{ + + Instance->VideoDeviceCollection = NewObject(); + + } + } + return Instance; +} + +void UAgoraBPuVideoDeviceManager::Release() +{ + if (Instance) + { + if(Instance->VideoDeviceCollection){ + Instance->VideoDeviceCollection->Release(); + Instance->VideoDeviceCollection = nullptr; + } + Instance->RemoveFromRoot(); + Instance = nullptr; + } +} + + +UVideoDeviceCollection* UAgoraBPuVideoDeviceManager::EnumerateVideoDevices() +{ + if (VideoDeviceManager == nullptr) { + + UAgoraBPuLogger::PrintError("VideoDeviceManager is nullptr." + AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED]); + + return nullptr; + } + + if (VideoDeviceCollection != nullptr) { + VideoDeviceCollection->Release(); + } + + agora::rtc::IVideoDeviceCollection* VideoCollection = VideoDeviceManager->enumerateVideoDevices(); + if (VideoCollection == nullptr) { + + UAgoraBPuLogger::PrintError("VideoCollection is nullptr." + AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED]); + + return nullptr; + } + + VideoDeviceCollection->Init(VideoCollection); + + return VideoDeviceCollection; +} + +UAgoraBPuAudioDeviceManager* UAgoraBPuAudioDeviceManager::GetAgoraAudioDeviceManager() +{ + if (Instance == nullptr) + { + Instance = NewObject(); + Instance->AddToRoot(); + AgoraUERtcEngine::Get()->queryInterface(agora::rtc::AGORA_IID_AUDIO_DEVICE_MANAGER, (void**)&Instance->AudioDeviceManager); + + if(Instance->AudioDeviceManager == nullptr){ + + UAgoraBPuLogger::PrintError("AudioDeviceManager is nullptr." + AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED]); + + } + + + Instance->PlaybackDeviceCollection = NewObject(); + + Instance->RecordDeviceCollection = NewObject(); + } + return Instance; +} + +void UAgoraBPuAudioDeviceManager::Release() +{ + if (Instance) + { + if (Instance->PlaybackDeviceCollection) { + Instance->PlaybackDeviceCollection->Release(); + Instance->PlaybackDeviceCollection = nullptr; + } + + if (Instance->RecordDeviceCollection) { + Instance->RecordDeviceCollection->Release(); + Instance->RecordDeviceCollection = nullptr; + } + + Instance->RemoveFromRoot(); + Instance = nullptr; + } +} + +UAudioDeviceCollection* UAgoraBPuAudioDeviceManager::EnumeratePlaybackDevices() +{ + if (AudioDeviceManager == nullptr) { + UAgoraBPuLogger::PrintError("AudioDeviceManager is nullptr." + AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED]); + return nullptr; + } + + if(PlaybackDeviceCollection != nullptr){ + PlaybackDeviceCollection->Release(); + } + + + agora::rtc::IAudioDeviceCollection* AudioCollection = AudioDeviceManager->enumeratePlaybackDevices(); + if (AudioCollection == nullptr) { + + UAgoraBPuLogger::PrintError("AudioCollection is nullptr." + AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED]); + + return nullptr; + } + + PlaybackDeviceCollection->Init(AudioCollection); + + return PlaybackDeviceCollection; +} + +UAudioDeviceCollection* UAgoraBPuAudioDeviceManager::EnumerateRecordingDevices() +{ + if (AudioDeviceManager == nullptr) { + + UAgoraBPuLogger::PrintError("AudioDeviceManager is nullptr." + AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED]); + + return nullptr; + } + + if (RecordDeviceCollection != nullptr) { + RecordDeviceCollection->Release(); + } + + + + agora::rtc::IAudioDeviceCollection* AudioCollection = AudioDeviceManager->enumerateRecordingDevices(); + if (AudioCollection == nullptr) { + + UAgoraBPuLogger::PrintError("AudioCollection is nullptr." + AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED]); + + return nullptr; + } + + RecordDeviceCollection->Init(AudioCollection); + + return RecordDeviceCollection; +} + +void UVideoDeviceCollection::Init(agora::rtc::IVideoDeviceCollection* VideoCollectionPtr) +{ + VideoDeviceCollection = VideoCollectionPtr; +} + +int UVideoDeviceCollection::GetCount() +{ + if (VideoDeviceCollection != nullptr) + { + + return VideoDeviceCollection->getCount(); + + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UVideoDeviceCollection::SetDevice(const FString& deviceId) +{ + if (VideoDeviceCollection != nullptr) + { + std::string DeviceIdStr = TCHAR_TO_UTF8(*deviceId); + return VideoDeviceCollection->setDevice(DeviceIdStr.c_str()); + + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UVideoDeviceCollection::GetDevice(int index, FString& deviceName, FString& deviceId) +{ + if (VideoDeviceCollection != nullptr) + { + char tempDeviceName[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; + + char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; + + int ret = VideoDeviceCollection->getDevice(index, tempDeviceName, tempDeviceId); + + std::string StdStrDeviceName = tempDeviceName; + std::string StdStrDeviceId = tempDeviceId; + + deviceName = StdStrDeviceName.c_str(); + deviceId = StdStrDeviceId.c_str(); + + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +void UVideoDeviceCollection::Release() +{ + if (VideoDeviceCollection != nullptr) + { + return VideoDeviceCollection->release(); + } +} + +void UAudioDeviceCollection::Init(agora::rtc::IAudioDeviceCollection* AudioCollectionPtr) +{ + AudioDeviceCollection = AudioCollectionPtr; +} + +int UAudioDeviceCollection::GetCount() +{ + if (AudioDeviceCollection != nullptr) + { + return AudioDeviceCollection->getCount(); + } + + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAudioDeviceCollection::GetDevice(int index, FString& deviceName, FString& deviceId) +{ + if (AudioDeviceCollection != nullptr) + { + char tempDeviceName[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; + + char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; + + int ret = AudioDeviceCollection->getDevice(index, tempDeviceName, tempDeviceId); + + + deviceName = UTF8_TO_TCHAR(tempDeviceName); + deviceId = UTF8_TO_TCHAR(tempDeviceId); + + return ret; + } + + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAudioDeviceCollection::SetDevice(const FString& deviceId) +{ + if (AudioDeviceCollection != nullptr) + { + std::string DeviceIdStr = TCHAR_TO_UTF8(*deviceId); + return AudioDeviceCollection->setDevice(DeviceIdStr.c_str()); + } + + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAudioDeviceCollection::GetDefaultDevice(FString& deviceName, FString& deviceId) +{ + if (AudioDeviceCollection != nullptr) + { + char tempDeviceName[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; + + char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; + + int ret = AudioDeviceCollection->getDefaultDevice(tempDeviceName, tempDeviceId); + + deviceName = UTF8_TO_TCHAR(tempDeviceName); + deviceId = UTF8_TO_TCHAR(tempDeviceId); + + return ret; + } + + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAudioDeviceCollection::SetApplicationVolume(int volume) +{ + if (AudioDeviceCollection != nullptr) + { + return AudioDeviceCollection->setApplicationVolume(volume); + } + + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAudioDeviceCollection::GetApplicationVolume(int & volume) +{ + if (AudioDeviceCollection != nullptr) + { + return AudioDeviceCollection->getApplicationVolume(volume); + } + + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAudioDeviceCollection::SetApplicationMute(bool mute) +{ + if (AudioDeviceCollection != nullptr) + { + return AudioDeviceCollection->setApplicationMute(mute); + } + + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAudioDeviceCollection::IsApplicationMute(bool mute) +{ + if (AudioDeviceCollection != nullptr) + { + return AudioDeviceCollection->isApplicationMute(mute); + } + + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +void UAudioDeviceCollection::Release() +{ + if (AudioDeviceCollection != nullptr) + { + return AudioDeviceCollection->release(); + } +} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIMediaPlayerSourceObserver.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIMediaPlayerSourceObserver.cpp new file mode 100644 index 00000000..ab1137ca --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIMediaPlayerSourceObserver.cpp @@ -0,0 +1,397 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. + +#include "AgoraBPuIMediaPlayerSourceObserver.h" + +#pragma region IMediaPlayerSourceObserver + +void UAgoraBPuIMediaPlayerSourceObserver::AddBlueprintCallbackExecutor(UAgoraBPuIMediaPlayerSourceObserverCBExecutor* Executor) +{ + if (Executor == nullptr) + { + UAgoraBPuLogger::PrintWarn(FString::Printf(TEXT("%s Null Callback Executor"), *FString(AG_FUNCTION_MACRO))); + return; + } + + OnPlayerSourceStateChanged.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerSourceStateChanged); + + OnPositionChanged.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPositionChanged); + + OnPlayerEvent.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerEvent); + + OnMetaData.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnMetaData); + + OnPlayBufferUpdated.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayBufferUpdated); + + OnPreloadEvent.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPreloadEvent); + + OnCompleted.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnCompleted); + + OnAgoraCDNTokenWillExpire.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnAgoraCDNTokenWillExpire); + + OnPlayerSrcInfoChanged.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerSrcInfoChanged); + + OnPlayerInfoUpdated.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerInfoUpdated); + + OnPlayerCacheStats.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerCacheStats); + + OnPlayerPlaybackStats.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerPlaybackStats); + + OnAudioVolumeIndication.AddDynamic(Executor, &UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnAudioVolumeIndication); +} + + + +void UAgoraBPuIMediaPlayerSourceObserver::RemoveAllBlueprintCallbackExecutors() +{ + OnPlayerSourceStateChanged.Clear(); + OnPositionChanged.Clear(); + OnPlayerEvent.Clear(); + OnMetaData.Clear(); + OnPlayBufferUpdated.Clear(); + OnPreloadEvent.Clear(); + OnCompleted.Clear(); + OnAgoraCDNTokenWillExpire.Clear(); + OnPlayerSrcInfoChanged.Clear(); + OnPlayerInfoUpdated.Clear(); + OnPlayerCacheStats.Clear(); + OnPlayerPlaybackStats.Clear(); + OnAudioVolumeIndication.Clear(); +} + +void UAgoraBPuIMediaPlayerSourceObserver::onPlayerSourceStateChanged(agora::media::base::MEDIA_PLAYER_STATE state, agora::media::base::MEDIA_PLAYER_REASON ec) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPlayerSourceStateChanged.Broadcast((EMEDIA_PLAYER_STATE)state, FENUMWRAP_MEDIA_PLAYER_REASON(ec)); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms, int64_t timestampMs) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPositionChanged.Broadcast(position_ms, timestampMs); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onPlayerEvent(agora::media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) +{ + FString UEMessage = UTF8_TO_TCHAR(message); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPlayerEvent.Broadcast((EMEDIA_PLAYER_EVENT)eventCode, elapsedTime, UEMessage); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onMetaData(const void* data, int length) +{ + FString UEStr = UTF8_TO_TCHAR((char*)data); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnMetaData.Broadcast(UEStr); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onPlayBufferUpdated(int64_t playCachedBuffer) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPlayBufferUpdated.Broadcast(playCachedBuffer); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onPreloadEvent(const char* src, agora::media::base::PLAYER_PRELOAD_EVENT event) +{ + FString UEStr = UTF8_TO_TCHAR(src); + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPreloadEvent.Broadcast(UEStr, (EPLAYER_PRELOAD_EVENT)event); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onCompleted() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnCompleted.Broadcast(); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onAgoraCDNTokenWillExpire() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAgoraCDNTokenWillExpire.Broadcast(); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onPlayerSrcInfoChanged(const agora::media::base::SrcInfo& from, const agora::media::base::SrcInfo& to) +{ + + FSrcInfo UESrcInfoFrom = from; + FSrcInfo UESrcInfoTo = to; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPlayerSrcInfoChanged.Broadcast(UESrcInfoFrom, UESrcInfoTo); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onPlayerInfoUpdated(const agora::media::base::PlayerUpdatedInfo& info) +{ + FPlayerUpdatedInfo UEPlayerUpdatedInfo = info; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPlayerInfoUpdated.Broadcast(UEPlayerUpdatedInfo); + }); +} +void UAgoraBPuIMediaPlayerSourceObserver::onAudioVolumeIndication(int volume) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioVolumeIndication.Broadcast(volume); + }); +} + + + + +void UAgoraBPuIMediaPlayerSourceObserver::onPlayerCacheStats(const agora::media::base::CacheStatistics& stats) +{ + FCacheStatistics UEStats = stats; + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPlayerCacheStats.Broadcast(UEStats); + }); +} + + + +void UAgoraBPuIMediaPlayerSourceObserver::onPlayerPlaybackStats(const agora::media::base::PlayerPlaybackStats& stats) +{ + + + FPlayerPlaybackStats UEStats = stats; + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPlayerPlaybackStats.Broadcast(UEStats); + }); +} + + +#pragma endregion IMediaPlayerSourceObserver + + +#pragma region IMediaPlayerSourceObserverCBExecutor + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerSourceStateChanged_Implementation(EMEDIA_PLAYER_STATE state, FENUMWRAP_MEDIA_PLAYER_REASON ec) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPositionChanged_Implementation(int64 position_ms, int64 timestampMs) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerEvent_Implementation(EMEDIA_PLAYER_EVENT eventCode, int64 elapsedTime, const FString& message) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnMetaData_Implementation(const FString& data) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayBufferUpdated_Implementation(int64 playCachedBuffer) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPreloadEvent_Implementation(const FString& src, EPLAYER_PRELOAD_EVENT event) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnCompleted_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnAgoraCDNTokenWillExpire_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerSrcInfoChanged_Implementation(const FSrcInfo& from, const FSrcInfo& to) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerInfoUpdated_Implementation(const FPlayerUpdatedInfo& info) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerCacheStats_Implementation(const FCacheStatistics& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnPlayerPlaybackStats_Implementation(const FPlayerPlaybackStats& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +void UAgoraBPuIMediaPlayerSourceObserverCBExecutor::OnAudioVolumeIndication_Implementation(int volume) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +#pragma endregion IMediaPlayerSourceObserverCBExecutor diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandler.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandler.cpp new file mode 100644 index 00000000..1748ab54 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandler.cpp @@ -0,0 +1,2572 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. + +#include "AgoraBPuIRtcEngineEventHandler.h" + + + +void UAgoraBPuIRtcEngineEventHandler::AddBlueprintCallbackExecutor(UAgoraBPuIRtcEngineEventHandlerCBExecutor* Executor) +{ + + if (Executor == nullptr) + { + UAgoraBPuLogger::PrintWarn(FString::Printf(TEXT("%s Null Callback Executor"), *FString(AG_FUNCTION_MACRO))); + return; + } + + + //FScriptDelegate Delegate; + //Delegate.BindUFunction(Executor, "OnJoinChannelSuccessCB"); + //OnJoinChannelSuccess.Add(Delegate); + + OnJoinChannelSuccess.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnJoinChannelSuccess); + OnLeaveChannel.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLeaveChannel); + OnUserJoined.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserJoined); + OnUserOffline.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserOffline); + OnRejoinChannelSuccess.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRejoinChannelSuccess); + OnProxyConnected.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnProxyConnected); + OnError.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnError); + OnAudioQuality.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioQuality); + OnLastmileProbeResult.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLastmileProbeResult); + OnAudioVolumeIndication.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioVolumeIndication); + OnRtcStats.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRtcStats); + OnAudioDeviceStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioDeviceStateChanged); + OnAudioMixingPositionChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioMixingPositionChanged); + OnAudioMixingFinished.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioMixingFinished); + OnAudioEffectFinished.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioEffectFinished); + OnVideoDeviceStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoDeviceStateChanged); + OnNetworkQuality.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnNetworkQuality); + OnIntraRequestReceived.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnIntraRequestReceived); + OnUplinkNetworkInfoUpdated.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUplinkNetworkInfoUpdated); + OnDownlinkNetworkInfoUpdated.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnDownlinkNetworkInfoUpdated); + OnLastmileQuality.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLastmileQuality); + OnFirstLocalVideoFrame.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstLocalVideoFrame); + OnFirstLocalVideoFramePublished.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstLocalVideoFramePublished); + OnFirstRemoteVideoDecoded.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstRemoteVideoDecoded); + OnVideoSizeChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoSizeChanged); + OnLocalVideoStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalVideoStateChanged); + OnRemoteVideoStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteVideoStateChanged); + OnFirstRemoteVideoFrame.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstRemoteVideoFrame); + OnUserMuteAudio.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserMuteAudio); + OnUserMuteVideo.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserMuteVideo); + OnUserEnableVideo.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserEnableVideo); + OnUserStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserStateChanged); + OnUserEnableLocalVideo.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserEnableLocalVideo); + OnLocalAudioStats.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalAudioStats); + OnRemoteAudioStats.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteAudioStats); + OnLocalVideoStats.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalVideoStats); + OnRemoteVideoStats.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteVideoStats); + OnCameraReady.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnCameraReady); + OnCameraFocusAreaChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnCameraFocusAreaChanged); + OnCameraExposureAreaChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnCameraExposureAreaChanged); + OnFacePositionChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFacePositionChanged); + OnVideoStopped.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoStopped); + OnAudioMixingStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioMixingStateChanged); + OnRhythmPlayerStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRhythmPlayerStateChanged); + OnConnectionLost.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnConnectionLost); + OnConnectionInterrupted.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnConnectionInterrupted); + OnConnectionBanned.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnConnectionBanned); + OnStreamMessage.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnStreamMessage); + OnStreamMessageError.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnStreamMessageError); + OnRequestToken.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRequestToken); + OnTokenPrivilegeWillExpire.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnTokenPrivilegeWillExpire); + OnLicenseValidationFailure.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLicenseValidationFailure); + OnFirstLocalAudioFramePublished.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstLocalAudioFramePublished); + OnFirstRemoteAudioDecoded.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstRemoteAudioDecoded); + OnFirstRemoteAudioFrame.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstRemoteAudioFrame); + OnLocalAudioStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalAudioStateChanged); + OnRemoteAudioStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteAudioStateChanged); + OnActiveSpeaker.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnActiveSpeaker); + OnContentInspectResult.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnContentInspectResult); + OnSnapshotTaken.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnSnapshotTaken); + OnClientRoleChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnClientRoleChanged); + OnClientRoleChangeFailed.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnClientRoleChangeFailed); + OnAudioDeviceVolumeChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioDeviceVolumeChanged); + OnRtmpStreamingStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRtmpStreamingStateChanged); + OnRtmpStreamingEvent.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRtmpStreamingEvent); + OnTranscodingUpdated.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnTranscodingUpdated); + OnAudioRoutingChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioRoutingChanged); + OnChannelMediaRelayStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnChannelMediaRelayStateChanged); + OnLocalPublishFallbackToAudioOnly.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalPublishFallbackToAudioOnly); + OnRemoteSubscribeFallbackToAudioOnly.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteSubscribeFallbackToAudioOnly); + OnRemoteAudioTransportStats.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteAudioTransportStats); + OnRemoteVideoTransportStats.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteVideoTransportStats); + OnConnectionStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnConnectionStateChanged); + OnWlAccMessage.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnWlAccMessage); + OnWlAccStats.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnWlAccStats); + OnNetworkTypeChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnNetworkTypeChanged); + OnEncryptionError.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnEncryptionError); + OnPermissionError.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnPermissionError); + OnLocalUserRegistered.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalUserRegistered); + OnUserInfoUpdated.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserInfoUpdated); + OnUserAccountUpdated.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserAccountUpdated); + OnVideoRenderingTracingResult.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoRenderingTracingResult); + OnLocalVideoTranscoderError.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalVideoTranscoderError); + OnUploadLogResult.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUploadLogResult); + OnAudioSubscribeStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioSubscribeStateChanged); + OnVideoSubscribeStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoSubscribeStateChanged); + OnAudioPublishStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioPublishStateChanged); + OnVideoPublishStateChanged.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoPublishStateChanged); + OnTranscodedStreamLayoutInfo.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnTranscodedStreamLayoutInfo); + OnAudioMetadataReceived.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioMetadataReceived); + OnExtensionEventWithContext.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnExtensionEventWithContext); + OnExtensionStartedWithContext.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnExtensionStartedWithContext); + OnExtensionStoppedWithContext.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnExtensionStoppedWithContext); + OnExtensionErrorWithContext.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnExtensionErrorWithContext); + OnSetRtmFlagResult.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnSetRtmFlagResult); +} + + +void UAgoraBPuIRtcEngineEventHandler::RemoveAllBlueprintCallbackExecutors() +{ + OnJoinChannelSuccess.Clear(); + OnLeaveChannel.Clear(); + OnUserJoined.Clear(); + OnUserOffline.Clear(); + OnRejoinChannelSuccess.Clear(); + OnProxyConnected.Clear(); + OnError.Clear(); + OnAudioQuality.Clear(); + OnLastmileProbeResult.Clear(); + OnAudioVolumeIndication.Clear(); + OnRtcStats.Clear(); + OnAudioDeviceStateChanged.Clear(); + OnAudioMixingPositionChanged.Clear(); + OnAudioMixingFinished.Clear(); + OnAudioEffectFinished.Clear(); + OnVideoDeviceStateChanged.Clear(); + OnNetworkQuality.Clear(); + OnIntraRequestReceived.Clear(); + OnUplinkNetworkInfoUpdated.Clear(); + OnDownlinkNetworkInfoUpdated.Clear(); + OnLastmileQuality.Clear(); + OnFirstLocalVideoFrame.Clear(); + OnFirstLocalVideoFramePublished.Clear(); + OnFirstRemoteVideoDecoded.Clear(); + OnVideoSizeChanged.Clear(); + OnLocalVideoStateChanged.Clear(); + OnRemoteVideoStateChanged.Clear(); + OnFirstRemoteVideoFrame.Clear(); + OnUserMuteAudio.Clear(); + OnUserMuteVideo.Clear(); + OnUserEnableVideo.Clear(); + OnUserStateChanged.Clear(); + OnUserEnableLocalVideo.Clear(); + OnLocalAudioStats.Clear(); + OnRemoteAudioStats.Clear(); + OnLocalVideoStats.Clear(); + OnRemoteVideoStats.Clear(); + OnCameraReady.Clear(); + OnCameraFocusAreaChanged.Clear(); + OnCameraExposureAreaChanged.Clear(); + OnFacePositionChanged.Clear(); + OnVideoStopped.Clear(); + OnAudioMixingStateChanged.Clear(); + OnRhythmPlayerStateChanged.Clear(); + OnConnectionLost.Clear(); + OnConnectionInterrupted.Clear(); + OnConnectionBanned.Clear(); + OnStreamMessage.Clear(); + OnStreamMessageError.Clear(); + OnRequestToken.Clear(); + OnTokenPrivilegeWillExpire.Clear(); + OnLicenseValidationFailure.Clear(); + OnFirstLocalAudioFramePublished.Clear(); + OnFirstRemoteAudioDecoded.Clear(); + OnFirstRemoteAudioFrame.Clear(); + OnLocalAudioStateChanged.Clear(); + OnRemoteAudioStateChanged.Clear(); + OnActiveSpeaker.Clear(); + OnContentInspectResult.Clear(); + OnSnapshotTaken.Clear(); + OnClientRoleChanged.Clear(); + OnClientRoleChangeFailed.Clear(); + OnAudioDeviceVolumeChanged.Clear(); + OnRtmpStreamingStateChanged.Clear(); + OnRtmpStreamingEvent.Clear(); + OnTranscodingUpdated.Clear(); + OnAudioRoutingChanged.Clear(); + OnChannelMediaRelayStateChanged.Clear(); + OnLocalPublishFallbackToAudioOnly.Clear(); + OnRemoteSubscribeFallbackToAudioOnly.Clear(); + OnRemoteAudioTransportStats.Clear(); + OnRemoteVideoTransportStats.Clear(); + OnConnectionStateChanged.Clear(); + OnWlAccMessage.Clear(); + OnWlAccStats.Clear(); + OnNetworkTypeChanged.Clear(); + OnEncryptionError.Clear(); + OnPermissionError.Clear(); + OnLocalUserRegistered.Clear(); + OnUserInfoUpdated.Clear(); + OnUserAccountUpdated.Clear(); + OnVideoRenderingTracingResult.Clear(); + OnLocalVideoTranscoderError.Clear(); + OnUploadLogResult.Clear(); + OnAudioSubscribeStateChanged.Clear(); + OnVideoSubscribeStateChanged.Clear(); + OnAudioPublishStateChanged.Clear(); + OnVideoPublishStateChanged.Clear(); + OnTranscodedStreamLayoutInfo.Clear(); + OnAudioMetadataReceived.Clear(); + OnExtensionEventWithContext.Clear(); + OnExtensionStartedWithContext.Clear(); + OnExtensionStoppedWithContext.Clear(); + OnExtensionErrorWithContext.Clear(); + OnSetRtmFlagResult.Clear(); + +} + +#pragma region Native Callback Functions + +void UAgoraBPuIRtcEngineEventHandler::onJoinChannelSuccess(const char* channel, agora::rtc::uid_t uid, int elapsed) +{ + FString UEChannelName = UTF8_TO_TCHAR(channel); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnJoinChannelSuccess.Broadcast(UEChannelName, (int64)uid, elapsed); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onLeaveChannel(const agora::rtc::RtcStats& stats) +{ + + FRtcStats UERtcStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + OnLeaveChannel.Broadcast(UERtcStats); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onUserJoined(agora::rtc::uid_t uid, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserJoined.Broadcast((int64)uid, elapsed); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onUserOffline(agora::rtc::uid_t uid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) +{ + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserOffline.Broadcast((int64)uid, (EUSER_OFFLINE_REASON_TYPE)reason); + }); +} + + +void UAgoraBPuIRtcEngineEventHandler::onRejoinChannelSuccess(const char* channel, agora::rtc::uid_t uid, int elapsed) +{ + FString UEChannelName = UTF8_TO_TCHAR(channel); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRejoinChannelSuccess.Broadcast(UEChannelName, (int64)uid, elapsed); + }); +} + + + + +void UAgoraBPuIRtcEngineEventHandler::onProxyConnected(const char* channel, agora::rtc::uid_t uid, agora::rtc::PROXY_TYPE proxyType, const char* localProxyIp, int elapsed) +{ + FString UEChannel = UTF8_TO_TCHAR(channel); + FString UELocalProxyIp = UTF8_TO_TCHAR(localProxyIp); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnProxyConnected.Broadcast(UEChannel, (int64)uid, (EPROXY_TYPE)proxyType, UELocalProxyIp, elapsed); + }); + +} + + + +void UAgoraBPuIRtcEngineEventHandler::onError(int err, const char* msg) +{ + FString UEErrorMsg = UTF8_TO_TCHAR(msg); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnError.Broadcast(err, UEErrorMsg); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onAudioQuality(uid_t uid, int quality, unsigned short delay, unsigned short lost) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioQuality.Broadcast((int64)uid, quality, delay, lost); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onLastmileProbeResult(const LastmileProbeResult& result) +{ + FLastmileProbeResult UEProbeResult = result; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLastmileProbeResult.Broadcast(UEProbeResult); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onAudioVolumeIndication(const AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) +{ + TArray audioVolumeInfo; + + for (unsigned int i = 0; i < speakerNumber; i++) + { + audioVolumeInfo.Add(speakers[i]); + } + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioVolumeIndication.Broadcast(audioVolumeInfo, totalVolume); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onRtcStats(const RtcStats& stats) +{ + FRtcStats UEStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRtcStats.Broadcast(UEStats); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) +{ + + FString UEDeviceId = UTF8_TO_TCHAR(deviceId); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioDeviceStateChanged.Broadcast(UEDeviceId, deviceType, deviceState); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onAudioMixingPositionChanged(int64_t position) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioMixingPositionChanged.Broadcast(position); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onAudioMixingFinished() __deprecated +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioMixingFinished.Broadcast(); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onAudioEffectFinished(int soundId) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioEffectFinished.Broadcast(soundId); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) +{ + FString UEDeviceId = UTF8_TO_TCHAR(deviceId); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnVideoDeviceStateChanged.Broadcast(UEDeviceId, deviceType, deviceState); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onNetworkQuality(uid_t uid, int txQuality, int rxQuality) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnNetworkQuality.Broadcast((int64)uid, txQuality, rxQuality); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onIntraRequestReceived() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnIntraRequestReceived.Broadcast(); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onUplinkNetworkInfoUpdated(const UplinkNetworkInfo& info) +{ + FUplinkNetworkInfo UEUplinkNetworkInfo = info; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUplinkNetworkInfoUpdated.Broadcast(UEUplinkNetworkInfo); + }); +} + + +void UAgoraBPuIRtcEngineEventHandler::onDownlinkNetworkInfoUpdated(const DownlinkNetworkInfo& info) +{ + FDownlinkNetworkInfo UEDownlinkNetworkInfo = info; + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnDownlinkNetworkInfoUpdated.Broadcast(UEDownlinkNetworkInfo); + }); +} + + + +void UAgoraBPuIRtcEngineEventHandler::onLastmileQuality(int quality) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLastmileQuality.Broadcast(quality); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onFirstLocalVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstLocalVideoFrame.Broadcast((EVIDEO_SOURCE_TYPE)source, width, height, elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onFirstLocalVideoFramePublished(agora::rtc::VIDEO_SOURCE_TYPE source, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstLocalVideoFramePublished.Broadcast((EVIDEO_SOURCE_TYPE)source, elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onFirstRemoteVideoDecoded(agora::rtc::uid_t uid, int width, int height, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstRemoteVideoDecoded.Broadcast((int64)uid, width, height, elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onVideoSizeChanged(agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::rtc::uid_t uid, int width, int height, int rotation) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnVideoSizeChanged.Broadcast((EVIDEO_SOURCE_TYPE)sourceType, (int64)uid, width, height, rotation); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onLocalVideoStateChanged(agora::rtc::VIDEO_SOURCE_TYPE source, agora::rtc::LOCAL_VIDEO_STREAM_STATE state, agora::rtc::LOCAL_VIDEO_STREAM_REASON reason) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalVideoStateChanged.Broadcast((EVIDEO_SOURCE_TYPE)source, (ELOCAL_VIDEO_STREAM_STATE)state, (ELOCAL_VIDEO_STREAM_REASON)reason); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRemoteVideoStateChanged(agora::rtc::uid_t uid, agora::rtc::REMOTE_VIDEO_STATE state, agora::rtc::REMOTE_VIDEO_STATE_REASON reason, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteVideoStateChanged.Broadcast((int64)uid, (EREMOTE_VIDEO_STATE)state, (EREMOTE_VIDEO_STATE_REASON)reason, elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onFirstRemoteVideoFrame(agora::rtc::uid_t uid, int width, int height, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstRemoteVideoFrame.Broadcast((int64)uid, width, height, elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onUserMuteAudio(agora::rtc::uid_t uid, bool muted) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserMuteAudio.Broadcast((int64)uid, muted); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onUserMuteVideo(agora::rtc::uid_t uid, bool muted) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserMuteVideo.Broadcast((int64)uid, muted); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onUserEnableVideo(agora::rtc::uid_t uid, bool enabled) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserEnableVideo.Broadcast((int64)uid, enabled); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onUserStateChanged(agora::rtc::uid_t uid, agora::rtc::REMOTE_USER_STATE state) +{ + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserStateChanged.Broadcast((int64)uid, FENUMWRAP_REMOTE_USER_STATE(state)); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onUserEnableLocalVideo(agora::rtc::uid_t uid, bool enabled) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserEnableLocalVideo.Broadcast((int64)uid, enabled); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onLocalAudioStats(const agora::rtc::LocalAudioStats& stats) +{ + FLocalAudioStats UELocalAudioStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalAudioStats.Broadcast(UELocalAudioStats); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRemoteAudioStats(const agora::rtc::RemoteAudioStats& stats) +{ + FRemoteAudioStats UERemoteAudioStats = stats; + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteAudioStats.Broadcast(UERemoteAudioStats); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onLocalVideoStats(agora::rtc::VIDEO_SOURCE_TYPE source, const agora::rtc::LocalVideoStats& stats) +{ + FLocalVideoStats UELocalVideoStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalVideoStats.Broadcast((EVIDEO_SOURCE_TYPE)source, UELocalVideoStats); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRemoteVideoStats(const agora::rtc::RemoteVideoStats& stats) +{ + FRemoteVideoStats UERemoteVBideoStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteVideoStats.Broadcast(UERemoteVBideoStats); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onCameraReady() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnCameraReady.Broadcast(); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onCameraFocusAreaChanged(int x, int y, int width, int height) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnCameraFocusAreaChanged.Broadcast(x, y, width, height); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onCameraExposureAreaChanged(int x, int y, int width, int height) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnCameraExposureAreaChanged.Broadcast(x, y, width, height); + }); +} + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) +void UAgoraBPuIRtcEngineEventHandler::onFacePositionChanged(int imageWidth, int imageHeight, const agora::rtc::Rectangle* vecRectangle, const int* vecDistance, int numFaces) +{ + TArray UEVecRectangle; + for (int i = 0; i < numFaces; i++) { + UEVecRectangle.Add(vecRectangle[i]); + } + TArray UEVecDistance; + FMemory::Memcpy(UEVecDistance.GetData(), vecDistance, numFaces * sizeof(int)); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + + OnFacePositionChanged.Broadcast(imageWidth, imageHeight, UEVecRectangle, UEVecDistance, numFaces); + }); +} +#endif + + +void UAgoraBPuIRtcEngineEventHandler::onVideoStopped() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnVideoStopped.Broadcast(); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onAudioMixingStateChanged(agora::rtc::AUDIO_MIXING_STATE_TYPE state, agora::rtc::AUDIO_MIXING_REASON_TYPE reason) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioMixingStateChanged.Broadcast(state, reason); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRhythmPlayerStateChanged(agora::rtc::RHYTHM_PLAYER_STATE_TYPE state, agora::rtc::RHYTHM_PLAYER_REASON reason) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRhythmPlayerStateChanged.Broadcast(state, reason); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onConnectionLost() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnConnectionLost.Broadcast(); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onConnectionInterrupted() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnConnectionInterrupted.Broadcast(); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onConnectionBanned() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnConnectionBanned.Broadcast(); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onStreamMessage(agora::rtc::uid_t uid, int streamId, const char* data, size_t length, uint64_t sentTs) +{ + + FString UEErrorMsg = UTF8_TO_TCHAR(data); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnStreamMessage.Broadcast((int64)uid, streamId, UEErrorMsg, length, sentTs); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onStreamMessageError(agora::rtc::uid_t uid, int streamId, int code, int missed, int cached) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnStreamMessageError.Broadcast((int64)uid, streamId, code, missed, cached); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRequestToken() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRequestToken.Broadcast(); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onTokenPrivilegeWillExpire(const char* token) +{ + FString UEToken = UTF8_TO_TCHAR(token); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnTokenPrivilegeWillExpire.Broadcast(UEToken); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onLicenseValidationFailure(agora::LICENSE_ERROR_TYPE error) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLicenseValidationFailure.Broadcast((ELICENSE_ERROR_TYPE)error); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onFirstLocalAudioFramePublished(int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstLocalAudioFramePublished.Broadcast(elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onFirstRemoteAudioFrame(agora::rtc::uid_t uid, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstRemoteAudioFrame.Broadcast((int64)uid, elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onFirstRemoteAudioDecoded(agora::rtc::uid_t uid, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstRemoteAudioDecoded.Broadcast((int64)uid, elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onLocalAudioStateChanged(agora::rtc::LOCAL_AUDIO_STREAM_STATE state, agora::rtc::LOCAL_AUDIO_STREAM_REASON reason) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalAudioStateChanged.Broadcast((ELOCAL_AUDIO_STREAM_STATE)state, (ELOCAL_AUDIO_STREAM_REASON)reason); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRemoteAudioStateChanged(agora::rtc::uid_t uid, agora::rtc::REMOTE_AUDIO_STATE state, agora::rtc::REMOTE_AUDIO_STATE_REASON reason, int elapsed) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteAudioStateChanged.Broadcast((int64)uid, (EREMOTE_AUDIO_STATE)state, (EREMOTE_AUDIO_STATE_REASON)reason, elapsed); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onActiveSpeaker(agora::rtc::uid_t uid) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnActiveSpeaker.Broadcast((int64)uid); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onContentInspectResult(agora::media::CONTENT_INSPECT_RESULT result) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnContentInspectResult.Broadcast((ECONTENT_INSPECT_RESULT)result); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onSnapshotTaken(agora::rtc::uid_t uid, const char* filePath, int width, int height, int errCode) +{ + FString UEFilePath = UTF8_TO_TCHAR(filePath); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnSnapshotTaken.Broadcast((int64)uid, UEFilePath, width, height, errCode); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onClientRoleChanged(agora::rtc::CLIENT_ROLE_TYPE oldRole, agora::rtc::CLIENT_ROLE_TYPE newRole, const agora::rtc::ClientRoleOptions& newRoleOptions) +{ + FClientRoleOptions UEClientRoleOptions = newRoleOptions; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnClientRoleChanged.Broadcast((ECLIENT_ROLE_TYPE)oldRole, (ECLIENT_ROLE_TYPE)newRole, UEClientRoleOptions); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onClientRoleChangeFailed(agora::rtc::CLIENT_ROLE_CHANGE_FAILED_REASON reason, agora::rtc::CLIENT_ROLE_TYPE currentRole) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnClientRoleChangeFailed.Broadcast((ECLIENT_ROLE_CHANGE_FAILED_REASON)reason, (ECLIENT_ROLE_TYPE)currentRole); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onAudioDeviceVolumeChanged(agora::rtc::MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioDeviceVolumeChanged.Broadcast(deviceType, volume, muted); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRtmpStreamingStateChanged(const char* url, agora::rtc::RTMP_STREAM_PUBLISH_STATE state, agora::rtc::RTMP_STREAM_PUBLISH_REASON reason) +{ + FString UEUrl = UTF8_TO_TCHAR(url); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRtmpStreamingStateChanged.Broadcast(UEUrl, (ERTMP_STREAM_PUBLISH_STATE)state, (ERTMP_STREAM_PUBLISH_REASON)reason); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRtmpStreamingEvent(const char* url, agora::rtc::RTMP_STREAMING_EVENT eventCode) +{ + FString UEUrl = UTF8_TO_TCHAR(url); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRtmpStreamingEvent.Broadcast(UEUrl, (ERTMP_STREAMING_EVENT)eventCode); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onTranscodingUpdated() +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnTranscodingUpdated.Broadcast(); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onAudioRoutingChanged(int routing) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioRoutingChanged.Broadcast(routing); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onChannelMediaRelayStateChanged(int state, int code) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnChannelMediaRelayStateChanged.Broadcast(state, code); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalPublishFallbackToAudioOnly.Broadcast(isFallbackOrRecover); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRemoteSubscribeFallbackToAudioOnly(agora::rtc::uid_t uid, bool isFallbackOrRecover) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteSubscribeFallbackToAudioOnly.Broadcast((int64)uid, isFallbackOrRecover); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRemoteAudioTransportStats(agora::rtc::uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteAudioTransportStats.Broadcast((int64)uid, delay, lost, rxKBitRate); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onRemoteVideoTransportStats(agora::rtc::uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteVideoTransportStats.Broadcast((int64)uid, delay, lost, rxKBitRate); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onConnectionStateChanged(agora::rtc::CONNECTION_STATE_TYPE state, agora::rtc::CONNECTION_CHANGED_REASON_TYPE reason) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnConnectionStateChanged.Broadcast((ECONNECTION_STATE_TYPE)state, (ECONNECTION_CHANGED_REASON_TYPE)reason); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onWlAccMessage(agora::rtc::WLACC_MESSAGE_REASON reason, agora::rtc::WLACC_SUGGEST_ACTION action, const char* wlAccMsg) +{ + FString UEWlAccMsg = UTF8_TO_TCHAR(wlAccMsg); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnWlAccMessage.Broadcast((EWLACC_MESSAGE_REASON)reason, (EWLACC_SUGGEST_ACTION)action, UEWlAccMsg); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onWlAccStats(const agora::rtc::WlAccStats& currentStats, const agora::rtc::WlAccStats& averageStats) +{ + FWlAccStats UECurrentStats = currentStats; + FWlAccStats UEAverageStats = averageStats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnWlAccStats.Broadcast(UECurrentStats, UEAverageStats); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onNetworkTypeChanged(agora::rtc::NETWORK_TYPE type) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnNetworkTypeChanged.Broadcast(type); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onEncryptionError(agora::rtc::ENCRYPTION_ERROR_TYPE errorType) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnEncryptionError.Broadcast((EENCRYPTION_ERROR_TYPE)errorType); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onPermissionError(agora::rtc::PERMISSION_TYPE permissionType) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnPermissionError.Broadcast((EPERMISSION_TYPE)permissionType); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onLocalUserRegistered(agora::rtc::uid_t uid, const char* userAccount) +{ + FString UEUserAccount = UTF8_TO_TCHAR(userAccount); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalUserRegistered.Broadcast((int64)uid, UEUserAccount); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onUserInfoUpdated(agora::rtc::uid_t uid, const agora::rtc::UserInfo& info) +{ + FUserInfo UEInfo = info; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserInfoUpdated.Broadcast((int64)uid, UEInfo); + }); +} + + +void UAgoraBPuIRtcEngineEventHandler::onUserAccountUpdated(agora::rtc::uid_t uid, const char* userAccount) +{ + FString UEUserAccount = UTF8_TO_TCHAR(userAccount); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserAccountUpdated.Broadcast((int64)uid, UEUserAccount); + }); +} + + +void UAgoraBPuIRtcEngineEventHandler::onVideoRenderingTracingResult(agora::rtc::uid_t uid, agora::rtc::MEDIA_TRACE_EVENT currentEvent, agora::rtc::VideoRenderingTracingInfo tracingInfo) +{ + + FVideoRenderingTracingInfo UETracingInfo = tracingInfo; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + + OnVideoRenderingTracingResult.Broadcast((int64)uid, (EMEDIA_TRACE_EVENT)currentEvent, UETracingInfo); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onLocalVideoTranscoderError(const agora::rtc::TranscodingVideoStream& stream, agora::rtc::VIDEO_TRANSCODER_ERROR error) +{ + FTranscodingVideoStream UEStream = stream; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalVideoTranscoderError.Broadcast(UEStream, (EVIDEO_TRANSCODER_ERROR)error); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onUploadLogResult(const char* requestId, bool success, agora::rtc::UPLOAD_ERROR_REASON reason) +{ + FString UERequestId = UTF8_TO_TCHAR(requestId); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUploadLogResult.Broadcast(UERequestId, success, (EUPLOAD_ERROR_REASON)reason); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onAudioSubscribeStateChanged(const char* channel, agora::rtc::uid_t uid, agora::rtc::STREAM_SUBSCRIBE_STATE oldState, agora::rtc::STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) +{ + FString UEChannel = UTF8_TO_TCHAR(channel); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioSubscribeStateChanged.Broadcast(UEChannel, (int64)uid, (ESTREAM_SUBSCRIBE_STATE)oldState, (ESTREAM_SUBSCRIBE_STATE)newState, elapseSinceLastState); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onVideoSubscribeStateChanged(const char* channel, agora::rtc::uid_t uid, agora::rtc::STREAM_SUBSCRIBE_STATE oldState, agora::rtc::STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) +{ + FString UEChannel = UTF8_TO_TCHAR(channel); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnVideoSubscribeStateChanged.Broadcast(UEChannel, (int64)uid, (ESTREAM_SUBSCRIBE_STATE)oldState, (ESTREAM_SUBSCRIBE_STATE)newState, elapseSinceLastState); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onAudioPublishStateChanged(const char* channel, agora::rtc::STREAM_PUBLISH_STATE oldState, agora::rtc::STREAM_PUBLISH_STATE newState, int elapseSinceLastState) +{ + FString UEChannel = UTF8_TO_TCHAR(channel); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioPublishStateChanged.Broadcast(UEChannel, (ESTREAM_PUBLISH_STATE)oldState, (ESTREAM_PUBLISH_STATE)newState, elapseSinceLastState); + }); +} +void UAgoraBPuIRtcEngineEventHandler::onVideoPublishStateChanged(agora::rtc::VIDEO_SOURCE_TYPE source, const char* channel, agora::rtc::STREAM_PUBLISH_STATE oldState, agora::rtc::STREAM_PUBLISH_STATE newState, int elapseSinceLastState) +{ + FString UEChannel = UTF8_TO_TCHAR(channel); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnVideoPublishStateChanged.Broadcast((EVIDEO_SOURCE_TYPE)source, UEChannel, (ESTREAM_PUBLISH_STATE)oldState, (ESTREAM_PUBLISH_STATE)newState, elapseSinceLastState); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onTranscodedStreamLayoutInfo(agora::rtc::uid_t uid, int width, int height, int layoutCount, const agora::VideoLayout* layoutlist) +{ + TArray UELayoutlist; + for (int i = 0; i < layoutCount; i++) { + UELayoutlist.Add(layoutlist[i]); + } + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnTranscodedStreamLayoutInfo.Broadcast((int64)uid, width, height, layoutCount, UELayoutlist); + }); +} + + + +void UAgoraBPuIRtcEngineEventHandler::onAudioMetadataReceived(agora::rtc::uid_t uid, const char* metadata, size_t length) +{ + FString UEMetadata = UTF8_TO_TCHAR(metadata); + FString UELength = FString::Printf(TEXT("%llu"), length); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioMetadataReceived.Broadcast((int64)uid, UEMetadata, UELength); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onExtensionEventWithContext(const ExtensionContext& context, const char* key, const char* value) +{ + FString UEKey = UTF8_TO_TCHAR(key); + FString UEValue = UTF8_TO_TCHAR(value); + FExtensionContext UEContext = context; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnExtensionEventWithContext.Broadcast(UEContext, UEKey,UEValue); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onExtensionStartedWithContext(const ExtensionContext& context) +{ + FExtensionContext UEContext = context; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnExtensionStartedWithContext.Broadcast(UEContext); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onExtensionStoppedWithContext(const ExtensionContext& context) +{ + FExtensionContext UEContext = context; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnExtensionStoppedWithContext.Broadcast(UEContext); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onExtensionErrorWithContext(const ExtensionContext& context, int error, const char* message) +{ + FString UEMessage = UTF8_TO_TCHAR(message); + FExtensionContext UEContext = context; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnExtensionErrorWithContext.Broadcast(UEContext, error, UEMessage); + }); +} + +void UAgoraBPuIRtcEngineEventHandler::onSetRtmFlagResult(int code) +{ + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnSetRtmFlagResult.Broadcast(code); + }); +} + +#pragma endregion Native Callback Functions + + +#pragma region BP Executor + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnJoinChannelSuccess_Implementation(const FString& Channel, int64 Uid, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"),*FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLeaveChannel_Implementation(const FRtcStats& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserJoined_Implementation(int64 uid, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserOffline_Implementation(int64 uid, EUSER_OFFLINE_REASON_TYPE reason ) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRejoinChannelSuccess_Implementation(const FString& channel, int64 uid, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnProxyConnected_Implementation(const FString& channel, int64 uid, EPROXY_TYPE proxyType, const FString& localProxyIp, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnError_Implementation(int error, const FString& msg) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioQuality_Implementation(int64 uid, int quality, int delay, int lost) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLastmileProbeResult_Implementation(const FLastmileProbeResult& result) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioVolumeIndication_Implementation(const TArray& speakers, int totalVolume) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRtcStats_Implementation(const FRtcStats& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioDeviceStateChanged_Implementation(const FString& deviceId, int deviceType, int deviceState) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioMixingPositionChanged_Implementation(int64 position) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioMixingFinished_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioEffectFinished_Implementation(int soundId) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoDeviceStateChanged_Implementation(const FString& deviceId, int deviceType, int deviceState) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnNetworkQuality_Implementation(int64 uid, int txQuality, int rxQuality) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnIntraRequestReceived_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUplinkNetworkInfoUpdated_Implementation(const FUplinkNetworkInfo& info) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnDownlinkNetworkInfoUpdated_Implementation(const FDownlinkNetworkInfo& info) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLastmileQuality_Implementation(int quality) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstLocalVideoFrame_Implementation(EVIDEO_SOURCE_TYPE source, int width, int height, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstLocalVideoFramePublished_Implementation(EVIDEO_SOURCE_TYPE source, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstRemoteVideoDecoded_Implementation(int64 uid, int width, int height, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoSizeChanged_Implementation(EVIDEO_SOURCE_TYPE sourceType, int64 uid, int width, int height, int rotation) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalVideoStateChanged_Implementation(EVIDEO_SOURCE_TYPE source, ELOCAL_VIDEO_STREAM_STATE state, ELOCAL_VIDEO_STREAM_REASON reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteVideoStateChanged_Implementation(int64 uid, EREMOTE_VIDEO_STATE state, EREMOTE_VIDEO_STATE_REASON reason, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstRemoteVideoFrame_Implementation(int64 uid, int width, int height, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserMuteAudio_Implementation(int64 uid, bool muted) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserMuteVideo_Implementation(int64 uid, bool muted) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserEnableVideo_Implementation(int64 uid, bool enabled) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserStateChanged_Implementation(int64 uid, FENUMWRAP_REMOTE_USER_STATE state) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserEnableLocalVideo_Implementation(int64 uid, bool enabled) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteAudioStats_Implementation(const FRemoteAudioStats& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalAudioStats_Implementation(const FLocalAudioStats& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalVideoStats_Implementation(EVIDEO_SOURCE_TYPE source, const FLocalVideoStats& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteVideoStats_Implementation(const FRemoteVideoStats& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnCameraReady_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnCameraFocusAreaChanged_Implementation(int x, int y, int width, int height) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnCameraExposureAreaChanged_Implementation(int x, int y, int width, int height) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFacePositionChanged_Implementation(int imageWidth, int imageHeight, const TArray& vecRectangle, const TArray& vecDistance, int numFaces) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoStopped_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioMixingStateChanged_Implementation(FENUMWRAP_AUDIO_MIXING_STATE_TYPE state, FENUMWRAP_AUDIO_MIXING_REASON_TYPE reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRhythmPlayerStateChanged_Implementation(FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE state, FENUMWRAP_RHYTHM_PLAYER_REASON reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnConnectionLost_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnConnectionInterrupted_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnConnectionBanned_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnStreamMessage_Implementation(int64 uid, int streamId, const FString& data, int length, int64 sentTs) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnStreamMessageError_Implementation(int64 uid, int streamId, int code, int missed, int cached) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRequestToken_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnTokenPrivilegeWillExpire_Implementation(const FString& token) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLicenseValidationFailure_Implementation(ELICENSE_ERROR_TYPE error) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstLocalAudioFramePublished_Implementation(int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstRemoteAudioDecoded_Implementation(int64 uid, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnFirstRemoteAudioFrame_Implementation(int64 uid, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalAudioStateChanged_Implementation(ELOCAL_AUDIO_STREAM_STATE state, ELOCAL_AUDIO_STREAM_REASON reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteAudioStateChanged_Implementation(int64 uid, EREMOTE_AUDIO_STATE state, EREMOTE_AUDIO_STATE_REASON reason, int elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnActiveSpeaker_Implementation(int64 uid) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnContentInspectResult_Implementation(ECONTENT_INSPECT_RESULT result) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnSnapshotTaken_Implementation(int64 uid, const FString& filePath, int width, int height, int errCode) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnClientRoleChanged_Implementation(ECLIENT_ROLE_TYPE oldRole, ECLIENT_ROLE_TYPE newRole, const FClientRoleOptions& newRoleOptions) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnClientRoleChangeFailed_Implementation(ECLIENT_ROLE_CHANGE_FAILED_REASON reason, ECLIENT_ROLE_TYPE currentRole) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioDeviceVolumeChanged_Implementation(FENUMWRAP_MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRtmpStreamingStateChanged_Implementation(const FString& url, ERTMP_STREAM_PUBLISH_STATE state, ERTMP_STREAM_PUBLISH_REASON reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRtmpStreamingEvent_Implementation(const FString& url, ERTMP_STREAMING_EVENT eventCode) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnTranscodingUpdated_Implementation() +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioRoutingChanged_Implementation(int routing) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnChannelMediaRelayStateChanged_Implementation(int state, int code) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalPublishFallbackToAudioOnly_Implementation(bool isFallbackOrRecover) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteSubscribeFallbackToAudioOnly_Implementation(int64 uid, bool isFallbackOrRecover) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteAudioTransportStats_Implementation(int64 uid, int delay, int lost, int rxKBitRate) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnRemoteVideoTransportStats_Implementation(int64 uid, int delay, int lost, int rxKBitRate) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnConnectionStateChanged_Implementation(ECONNECTION_STATE_TYPE state, ECONNECTION_CHANGED_REASON_TYPE reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnWlAccMessage_Implementation(EWLACC_MESSAGE_REASON reason, EWLACC_SUGGEST_ACTION action, const FString& wlAccMsg) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnWlAccStats_Implementation(const FWlAccStats& currentStats, const FWlAccStats& averageStats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnNetworkTypeChanged_Implementation(FENUMWRAP_NETWORK_TYPE type) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnEncryptionError_Implementation(EENCRYPTION_ERROR_TYPE errorType) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnPermissionError_Implementation(EPERMISSION_TYPE permissionType) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalUserRegistered_Implementation(int64 uid, const FString& userAccount) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserInfoUpdated_Implementation(int64 uid, const FUserInfo& info) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUserAccountUpdated_Implementation(int64 uid, const FString& userAccount) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoRenderingTracingResult_Implementation(int64 uid, EMEDIA_TRACE_EVENT currentEvent, const FVideoRenderingTracingInfo& tracingInfo) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnLocalVideoTranscoderError_Implementation(const FTranscodingVideoStream& stream, EVIDEO_TRANSCODER_ERROR error) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnUploadLogResult_Implementation(const FString& requestId, bool success, EUPLOAD_ERROR_REASON reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioSubscribeStateChanged_Implementation(const FString& channel, int64 uid, ESTREAM_SUBSCRIBE_STATE oldState, ESTREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoSubscribeStateChanged_Implementation(const FString& channel, int64 uid, ESTREAM_SUBSCRIBE_STATE oldState, ESTREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioPublishStateChanged_Implementation(const FString& channel, ESTREAM_PUBLISH_STATE oldState, ESTREAM_PUBLISH_STATE newState, int elapseSinceLastState) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnVideoPublishStateChanged_Implementation(EVIDEO_SOURCE_TYPE source, const FString& channel, ESTREAM_PUBLISH_STATE oldState, ESTREAM_PUBLISH_STATE newState, int elapseSinceLastState) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnTranscodedStreamLayoutInfo_Implementation(int64 uid, int width, int height, int layoutCount, const TArray& layoutlist) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnAudioMetadataReceived_Implementation(int64 uid, const FString& metadata, const FString& length) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnExtensionEventWithContext_Implementation(const FExtensionContext& context, const FString& key, const FString& value) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnExtensionStartedWithContext_Implementation(const FExtensionContext& context) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnExtensionStoppedWithContext_Implementation(const FExtensionContext& context) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnExtensionErrorWithContext_Implementation(const FExtensionContext& context, int error, const FString& message) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerCBExecutor::OnSetRtmFlagResult_Implementation(int code) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +#pragma endregion BP Executor diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandlerEx.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandlerEx.cpp new file mode 100644 index 00000000..5a1f432e --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandlerEx.cpp @@ -0,0 +1,1676 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. +#include "AgoraBPuIRtcEngineEventHandlerEx.h" + +void UAgoraBPuIRtcEngineEventHandlerEx::AddBlueprintCallbackExecutorEx(UAgoraBPuIRtcEngineEventHandlerExCBExecutor* Executor) +{ + if(Executor == nullptr) + { + UAgoraBPuLogger::PrintWarn(FString::Printf(TEXT("%s Null Callback Executor"), *FString(AG_FUNCTION_MACRO))); + return; + } + + OnJoinChannelSuccessEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnJoinChannelSuccess); + OnLeaveChannelEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLeaveChannel); + OnUserJoinedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserJoined); + OnUserOfflineEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserOffline); + OnRejoinChannelSuccessEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRejoinChannelSuccess); + OnAudioQualityEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnAudioQuality); + OnAudioVolumeIndicationEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnAudioVolumeIndication); + OnRtcStatsEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRtcStats); + OnNetworkQualityEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnNetworkQuality); + OnIntraRequestReceivedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnIntraRequestReceived); + OnFirstLocalVideoFramePublishedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstLocalVideoFramePublished); + OnFirstRemoteVideoDecodedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstRemoteVideoDecoded); + OnVideoSizeChangedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnVideoSizeChanged); + OnRemoteVideoStateChangedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteVideoStateChanged); + OnFirstRemoteVideoFrameEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstRemoteVideoFrame); + OnUserMuteAudioEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserMuteAudio); + OnUserMuteVideoEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserMuteVideo); + OnUserEnableVideoEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserEnableVideo); + OnUserEnableLocalVideoEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserEnableLocalVideo); + OnUserStateChangedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserStateChanged); + OnLocalAudioStatsEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLocalAudioStats); + OnRemoteAudioStatsEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteAudioStats); + OnLocalVideoStatsEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLocalVideoStats); + OnRemoteVideoStatsEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteVideoStats); + OnConnectionLostEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnConnectionLost); + OnConnectionInterruptedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnConnectionInterrupted); + OnConnectionBannedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnConnectionBanned); + OnStreamMessageEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnStreamMessage); + OnStreamMessageErrorEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnStreamMessageError); + OnRequestTokenEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRequestToken); + OnTokenPrivilegeWillExpireEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnTokenPrivilegeWillExpire); + OnLicenseValidationFailureEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLicenseValidationFailure); + OnFirstLocalAudioFramePublishedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstLocalAudioFramePublished); + OnFirstRemoteAudioFrameEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstRemoteAudioFrame); + OnFirstRemoteAudioDecodedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstRemoteAudioDecoded); + OnLocalAudioStateChangedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLocalAudioStateChanged); + OnRemoteAudioStateChangedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteAudioStateChanged); + OnActiveSpeakerEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnActiveSpeaker); + OnClientRoleChangedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnClientRoleChanged); + OnClientRoleChangeFailedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnClientRoleChangeFailed); + OnRemoteAudioTransportStatsEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteAudioTransportStats); + OnRemoteVideoTransportStatsEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteVideoTransportStats); + OnConnectionStateChangedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnConnectionStateChanged); + OnWlAccMessageEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnWlAccMessage); + OnWlAccStatsEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnWlAccStats); + OnNetworkTypeChangedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnNetworkTypeChanged); + OnEncryptionErrorEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnEncryptionError); + OnUploadLogResultEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUploadLogResult); + OnUserAccountUpdatedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserAccountUpdated); + OnSnapshotTakenEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnSnapshotTaken); + OnVideoRenderingTracingResultEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnVideoRenderingTracingResult); + OnSetRtmFlagResultEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnSetRtmFlagResult); + OnTranscodedStreamLayoutInfoEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnTranscodedStreamLayoutInfo); + OnAudioMetadataReceivedEx.AddDynamic(Executor, &UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnAudioMetadataReceived); + + +} + +void UAgoraBPuIRtcEngineEventHandlerEx::RemoveAllBlueprintCallbackExecutorExs() +{ + OnJoinChannelSuccessEx.Clear(); + OnLeaveChannelEx.Clear(); + OnUserJoinedEx.Clear(); + OnUserOfflineEx.Clear(); + OnRejoinChannelSuccessEx.Clear(); + OnAudioQualityEx.Clear(); + OnAudioVolumeIndicationEx.Clear(); + OnRtcStatsEx.Clear(); + OnNetworkQualityEx.Clear(); + OnIntraRequestReceivedEx.Clear(); + OnFirstLocalVideoFramePublishedEx.Clear(); + OnFirstRemoteVideoDecodedEx.Clear(); + OnVideoSizeChangedEx.Clear(); + OnRemoteVideoStateChangedEx.Clear(); + OnFirstRemoteVideoFrameEx.Clear(); + OnUserMuteAudioEx.Clear(); + OnUserMuteVideoEx.Clear(); + OnUserEnableVideoEx.Clear(); + OnUserEnableLocalVideoEx.Clear(); + OnUserStateChangedEx.Clear(); + OnLocalAudioStatsEx.Clear(); + OnRemoteAudioStatsEx.Clear(); + OnLocalVideoStatsEx.Clear(); + OnRemoteVideoStatsEx.Clear(); + OnConnectionLostEx.Clear(); + OnConnectionInterruptedEx.Clear(); + OnConnectionBannedEx.Clear(); + OnStreamMessageEx.Clear(); + OnStreamMessageErrorEx.Clear(); + OnRequestTokenEx.Clear(); + OnTokenPrivilegeWillExpireEx.Clear(); + OnLicenseValidationFailureEx.Clear(); + OnFirstLocalAudioFramePublishedEx.Clear(); + OnFirstRemoteAudioFrameEx.Clear(); + OnFirstRemoteAudioDecodedEx.Clear(); + OnLocalAudioStateChangedEx.Clear(); + OnRemoteAudioStateChangedEx.Clear(); + OnActiveSpeakerEx.Clear(); + OnClientRoleChangedEx.Clear(); + OnClientRoleChangeFailedEx.Clear(); + OnRemoteAudioTransportStatsEx.Clear(); + OnRemoteVideoTransportStatsEx.Clear(); + OnConnectionStateChangedEx.Clear(); + OnWlAccMessageEx.Clear(); + OnWlAccStatsEx.Clear(); + OnNetworkTypeChangedEx.Clear(); + OnEncryptionErrorEx.Clear(); + OnUploadLogResultEx.Clear(); + OnUserAccountUpdatedEx.Clear(); + OnSnapshotTakenEx.Clear(); + OnVideoRenderingTracingResultEx.Clear(); + OnSetRtmFlagResultEx.Clear(); + OnTranscodedStreamLayoutInfoEx.Clear(); + OnAudioMetadataReceivedEx.Clear(); +} + +#pragma region Native Callback Functions + +void UAgoraBPuIRtcEngineEventHandlerEx::onJoinChannelSuccess(const agora::rtc::RtcConnection& connection, int elapsed) +{ + + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnJoinChannelSuccessEx.Broadcast(UERtcConnection, elapsed); + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onLeaveChannel(const agora::rtc::RtcConnection& connection, const agora::rtc::RtcStats& stats) +{ + FRtcConnection UERtcConnection = connection; + + FRtcStats UERtcStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLeaveChannelEx.Broadcast(UERtcConnection, UERtcStats); + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUserJoined(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int elapsed) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserJoinedEx.Broadcast(UERtcConnection, (int64)remoteUid, elapsed); + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUserOffline(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) +{ + + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserOfflineEx.Broadcast(UERtcConnection, (int64)remoteUid, (EUSER_OFFLINE_REASON_TYPE) reason); + }); +} + + +void UAgoraBPuIRtcEngineEventHandlerEx::onRejoinChannelSuccess(const RtcConnection& connection, int elapsed) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRejoinChannelSuccessEx.Broadcast(UERtcConnection, elapsed); + }); +} + + + +void UAgoraBPuIRtcEngineEventHandlerEx::onAudioQuality(const RtcConnection& connection, uid_t remoteUid, int quality, unsigned short delay, unsigned short lost) __deprecated +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioQualityEx.Broadcast(UERtcConnection, (int64)remoteUid, quality, delay, lost); + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onAudioVolumeIndication(const RtcConnection& connection, const AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) +{ + FRtcConnection UERtcConnection = connection; + + TArray UESpeakers; + for (unsigned int i = 0; i < speakerNumber; i++) + { + UESpeakers.Add(speakers[i]); + } + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioVolumeIndicationEx.Broadcast(UERtcConnection, UESpeakers, totalVolume); + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onRtcStats(const RtcConnection& connection, const RtcStats& stats) +{ + FRtcConnection UERtcConnection = connection; + + FRtcStats UERtcStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRtcStatsEx.Broadcast(UERtcConnection, UERtcStats); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onNetworkQuality(const RtcConnection& connection, uid_t remoteUid, int txQuality, int rxQuality) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnNetworkQualityEx.Broadcast(UERtcConnection, (int64)remoteUid, txQuality, rxQuality); + + }); + + +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onIntraRequestReceived(const RtcConnection& connection) +{ + + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnIntraRequestReceivedEx.Broadcast(UERtcConnection); + + }); + +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onFirstLocalVideoFramePublished(const RtcConnection& connection, int elapsed) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstLocalVideoFramePublishedEx.Broadcast(UERtcConnection, elapsed); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onFirstRemoteVideoDecoded(const RtcConnection& connection, uid_t remoteUid, int width, int height, int elapsed) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstRemoteVideoDecodedEx.Broadcast(UERtcConnection, (int64)remoteUid, width, height, elapsed); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onVideoSizeChanged(const RtcConnection& connection, VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) +{ + FRtcConnection UERtcConnection = connection; + + EVIDEO_SOURCE_TYPE UEVideoSourceType = (EVIDEO_SOURCE_TYPE)sourceType; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnVideoSizeChangedEx.Broadcast(UERtcConnection, UEVideoSourceType, (int64)uid, width, height, rotation); + + }); +} + + +void UAgoraBPuIRtcEngineEventHandlerEx::onRemoteVideoStateChanged(const RtcConnection& connection, uid_t remoteUid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) +{ + FRtcConnection UERtcConnection = connection; + + EREMOTE_VIDEO_STATE UERemoteVideoState = (EREMOTE_VIDEO_STATE)state; + EREMOTE_VIDEO_STATE_REASON UERemoteVideoStateReason = (EREMOTE_VIDEO_STATE_REASON)reason; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteVideoStateChangedEx.Broadcast(UERtcConnection, (int64)remoteUid, UERemoteVideoState, UERemoteVideoStateReason, elapsed); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onFirstRemoteVideoFrame(const RtcConnection& connection, uid_t remoteUid, int width, int height, int elapsed) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstRemoteVideoFrameEx.Broadcast(UERtcConnection, (int64)remoteUid, width, height, elapsed); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUserMuteAudio(const RtcConnection& connection, uid_t remoteUid, bool muted) __deprecated +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserMuteAudioEx.Broadcast(UERtcConnection, (int64)remoteUid, muted); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUserMuteVideo(const RtcConnection& connection, uid_t remoteUid, bool muted) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserMuteVideoEx.Broadcast(UERtcConnection, (int64)remoteUid, muted); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUserEnableVideo(const RtcConnection& connection, uid_t remoteUid, bool enabled) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserEnableVideoEx.Broadcast(UERtcConnection, (int64)remoteUid, enabled); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUserEnableLocalVideo(const RtcConnection& connection, uid_t remoteUid, bool enabled) __deprecated +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserEnableLocalVideoEx.Broadcast(UERtcConnection, (int64)remoteUid, enabled); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUserStateChanged(const RtcConnection& connection, uid_t remoteUid, uint32_t state) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserStateChangedEx.Broadcast(UERtcConnection, (int64)remoteUid, state); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onLocalAudioStats(const RtcConnection& connection, const LocalAudioStats& stats) +{ + FRtcConnection UERtcConnection = connection; + + FLocalAudioStats UELocalAudioStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalAudioStatsEx.Broadcast(UERtcConnection, UELocalAudioStats); + }); + +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onRemoteAudioStats(const RtcConnection& connection, const RemoteAudioStats& stats) +{ + + FRtcConnection UERtcConnection = connection; + + FRemoteAudioStats UERemoteAudioStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteAudioStatsEx.Broadcast(UERtcConnection, UERemoteAudioStats); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onLocalVideoStats(const RtcConnection& connection, const LocalVideoStats& stats) +{ + FRtcConnection UERtcConnection = connection; + + FLocalVideoStats UELocalVideoStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalVideoStatsEx.Broadcast(UERtcConnection, UELocalVideoStats); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onRemoteVideoStats(const RtcConnection& connection, const RemoteVideoStats& stats) +{ + FRtcConnection UERtcConnection = connection; + + FRemoteVideoStats UERemoteVideoStats = stats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteVideoStatsEx.Broadcast(UERtcConnection, UERemoteVideoStats); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onConnectionLost(const RtcConnection& connection) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnConnectionLostEx.Broadcast(UERtcConnection); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onConnectionInterrupted(const RtcConnection& connection) __deprecated +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnConnectionInterruptedEx.Broadcast(UERtcConnection); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onConnectionBanned(const RtcConnection& connection) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnConnectionBannedEx.Broadcast(UERtcConnection); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onStreamMessage(const RtcConnection& connection, uid_t remoteUid, int streamId, const char* data, size_t length, uint64_t sentTs) +{ + FRtcConnection UERtcConnection = connection; + + FString UEData = FString(UTF8_TO_TCHAR(data)); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnStreamMessageEx.Broadcast(UERtcConnection, (int64)remoteUid, streamId, UEData, length, sentTs); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onStreamMessageError(const RtcConnection& connection, uid_t remoteUid, int streamId, int code, int missed, int cached) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnStreamMessageErrorEx.Broadcast(UERtcConnection, (int64)remoteUid, streamId, code, missed, cached); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onRequestToken(const RtcConnection& connection) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRequestTokenEx.Broadcast(UERtcConnection); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onLicenseValidationFailure(const RtcConnection& connection, LICENSE_ERROR_TYPE reason) +{ + FRtcConnection UERtcConnection = connection; + + ELICENSE_ERROR_TYPE UELicenseErrorType = (ELICENSE_ERROR_TYPE)reason; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLicenseValidationFailureEx.Broadcast(UERtcConnection, UELicenseErrorType); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onTokenPrivilegeWillExpire(const RtcConnection& connection, const char* token) +{ + FRtcConnection UERtcConnection = connection; + + FString UEToken = FString(UTF8_TO_TCHAR(token)); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnTokenPrivilegeWillExpireEx.Broadcast(UERtcConnection, UEToken); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onFirstLocalAudioFramePublished(const RtcConnection& connection, int elapsed) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstLocalAudioFramePublishedEx.Broadcast(UERtcConnection, elapsed); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onFirstRemoteAudioFrame(const RtcConnection& connection, uid_t userId, int elapsed) __deprecated +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstRemoteAudioFrameEx.Broadcast(UERtcConnection, (int64)userId, elapsed); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onFirstRemoteAudioDecoded(const RtcConnection& connection, uid_t uid, int elapsed) __deprecated +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnFirstRemoteAudioDecodedEx.Broadcast(UERtcConnection, (int64)uid, elapsed); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onLocalAudioStateChanged(const RtcConnection& connection, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_REASON reason) +{ + FRtcConnection UERtcConnection = connection; + + ELOCAL_AUDIO_STREAM_STATE UEState = (ELOCAL_AUDIO_STREAM_STATE)state; + ELOCAL_AUDIO_STREAM_REASON UEReason = (ELOCAL_AUDIO_STREAM_REASON)reason; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnLocalAudioStateChangedEx.Broadcast(UERtcConnection, UEState, UEReason); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onRemoteAudioStateChanged(const RtcConnection& connection, uid_t remoteUid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) +{ + FRtcConnection UERtcConnection = connection; + + EREMOTE_AUDIO_STATE UERemoteAudioState = (EREMOTE_AUDIO_STATE)state; + EREMOTE_AUDIO_STATE_REASON UERemoteAudioStateReason = (EREMOTE_AUDIO_STATE_REASON)reason; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteAudioStateChangedEx.Broadcast(UERtcConnection, (int64)remoteUid, UERemoteAudioState, UERemoteAudioStateReason, elapsed); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onActiveSpeaker(const RtcConnection& connection, uid_t uid) +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnActiveSpeakerEx.Broadcast(UERtcConnection, (int64)uid); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onClientRoleChanged(const RtcConnection& connection, CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) +{ + FRtcConnection UERtcConnection = connection; + + ECLIENT_ROLE_TYPE UEOldRole = (ECLIENT_ROLE_TYPE)oldRole; + ECLIENT_ROLE_TYPE UENewRole = (ECLIENT_ROLE_TYPE)newRole; + FClientRoleOptions UEClientRoleOptions = newRoleOptions; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnClientRoleChangedEx.Broadcast(UERtcConnection, UEOldRole, UENewRole, UEClientRoleOptions); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onClientRoleChangeFailed(const RtcConnection& connection, CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) +{ + FRtcConnection UERtcConnection = connection; + + ECLIENT_ROLE_CHANGE_FAILED_REASON UEClientRoleChangeFailedReason = (ECLIENT_ROLE_CHANGE_FAILED_REASON)reason; + ECLIENT_ROLE_TYPE UECurrentRole = (ECLIENT_ROLE_TYPE)currentRole; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnClientRoleChangeFailedEx.Broadcast(UERtcConnection, UEClientRoleChangeFailedReason, UECurrentRole); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onRemoteAudioTransportStats(const RtcConnection& connection, uid_t remoteUid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) __deprecated +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteAudioTransportStatsEx.Broadcast(UERtcConnection, (int64)remoteUid, delay, lost, rxKBitRate); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onRemoteVideoTransportStats(const RtcConnection& connection, uid_t remoteUid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) __deprecated +{ + FRtcConnection UERtcConnection = connection; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnRemoteVideoTransportStatsEx.Broadcast(UERtcConnection, (int64)remoteUid, delay, lost, rxKBitRate); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onConnectionStateChanged(const RtcConnection& connection, CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason) +{ + FRtcConnection UERtcConnection = connection; + + ECONNECTION_STATE_TYPE UEConnectionStateType = (ECONNECTION_STATE_TYPE)state; + ECONNECTION_CHANGED_REASON_TYPE UEConnectionChangedReasonType = (ECONNECTION_CHANGED_REASON_TYPE)reason; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnConnectionStateChangedEx.Broadcast(UERtcConnection, UEConnectionStateType, UEConnectionChangedReasonType); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onWlAccMessage(const RtcConnection& connection, WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) +{ + FRtcConnection UERtcConnection = connection; + + EWLACC_MESSAGE_REASON UEWlAccMessageReason = (EWLACC_MESSAGE_REASON)reason; + EWLACC_SUGGEST_ACTION UEWlAccSuggestAction = (EWLACC_SUGGEST_ACTION)action; + FString UEWlAccMsg = FString(UTF8_TO_TCHAR(wlAccMsg)); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnWlAccMessageEx.Broadcast(UERtcConnection, UEWlAccMessageReason, UEWlAccSuggestAction, UEWlAccMsg); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onWlAccStats(const RtcConnection& connection, WlAccStats currentStats, WlAccStats averageStats) +{ + FRtcConnection UERtcConnection = connection; + + FWlAccStats UECurrentStats = currentStats; + FWlAccStats UEAverageStats = averageStats; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnWlAccStatsEx.Broadcast(UERtcConnection, UECurrentStats, UEAverageStats); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onNetworkTypeChanged(const RtcConnection& connection, NETWORK_TYPE type) +{ + FRtcConnection UERtcConnection = connection; + + FENUMWRAP_NETWORK_TYPE UENetworkType = type; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnNetworkTypeChangedEx.Broadcast(UERtcConnection, UENetworkType); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onEncryptionError(const RtcConnection& connection, ENCRYPTION_ERROR_TYPE errorType) +{ + FRtcConnection UERtcConnection = connection; + + EENCRYPTION_ERROR_TYPE UEErrorType = (EENCRYPTION_ERROR_TYPE)errorType; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnEncryptionErrorEx.Broadcast(UERtcConnection, UEErrorType); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUploadLogResult(const RtcConnection& connection, const char* requestId, bool success, UPLOAD_ERROR_REASON reason) +{ + FRtcConnection UERtcConnection = connection; + + FString UERequestId = FString(UTF8_TO_TCHAR(requestId)); + EUPLOAD_ERROR_REASON UEUploadErrorReason = (EUPLOAD_ERROR_REASON)reason; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUploadLogResultEx.Broadcast(UERtcConnection, UERequestId, success, UEUploadErrorReason); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onUserAccountUpdated(const RtcConnection& connection, uid_t remoteUid, const char* remoteUserAccount) +{ + FRtcConnection UERtcConnection = connection; + + FString UERemoteUserAccount = FString(UTF8_TO_TCHAR(remoteUserAccount)); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnUserAccountUpdatedEx.Broadcast(UERtcConnection, (int64)remoteUid, UERemoteUserAccount); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onSnapshotTaken(const RtcConnection& connection, uid_t uid, const char* filePath, int width, int height, int errCode) +{ + FRtcConnection UERtcConnection = connection; + + FString UEFilePath = FString(UTF8_TO_TCHAR(filePath)); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnSnapshotTakenEx.Broadcast(UERtcConnection, (int64)uid, UEFilePath, width, height, errCode); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onVideoRenderingTracingResult(const RtcConnection& connection, uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) +{ + FRtcConnection UERtcConnection = connection; + + EMEDIA_TRACE_EVENT UEMediaTraceEvent = (EMEDIA_TRACE_EVENT)currentEvent; + FVideoRenderingTracingInfo UETracingInfo = tracingInfo; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnVideoRenderingTracingResultEx.Broadcast(UERtcConnection, (int64)uid, UEMediaTraceEvent, UETracingInfo); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onSetRtmFlagResult(const RtcConnection& connection, int code) +{ + FRtcConnection UERtcConnection = connection; + + int32 UECode = code; + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnSetRtmFlagResultEx.Broadcast(UERtcConnection, UECode); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onTranscodedStreamLayoutInfo(const RtcConnection& connection, uid_t uid, int width, int height, int layoutCount, const VideoLayout* layoutlist) +{ + FRtcConnection UERtcConnection = connection; + + TArray UELayoutList; + for (int i = 0; i < layoutCount; i++) + { + FVideoLayout UEVideoLayout = layoutlist[i]; + UELayoutList.Add(UEVideoLayout); + } + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnTranscodedStreamLayoutInfoEx.Broadcast(UERtcConnection, uid, width, height, UELayoutList); + + }); +} + +void UAgoraBPuIRtcEngineEventHandlerEx::onAudioMetadataReceived(const RtcConnection& connection, uid_t uid, const char* metadata, size_t length) +{ + FRtcConnection UERtcConnection = connection; + + FString UEMetadata = FString(UTF8_TO_TCHAR(metadata)); + + TWeakObjectPtr SelfWeakPtr(this); + if (!SelfWeakPtr.IsValid()) + return; + +#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + AsyncTask(ENamedThreads::GameThread, [=, this]() +#else + AsyncTask(ENamedThreads::GameThread, [=]() +#endif + { + if (!SelfWeakPtr.IsValid()) + return; + + OnAudioMetadataReceivedEx.Broadcast(UERtcConnection, (int64)uid, UEMetadata); + + }); +} + +#pragma endregion Native Callback Functions + + +#pragma region BP Executor + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnJoinChannelSuccess_Implementation(const FRtcConnection& Connection, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLeaveChannel_Implementation(const FRtcConnection& connection, const FRtcStats& stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserJoined_Implementation(const FRtcConnection& connection, int64 RemoteUid, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserOffline_Implementation(const FRtcConnection& connection, int64 RemoteUid, EUSER_OFFLINE_REASON_TYPE Reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRejoinChannelSuccess_Implementation(const FRtcConnection& connection, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnAudioQuality_Implementation(const FRtcConnection& connection, int64 RemoteUid, int Quality, int Delay, int Lost) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnAudioVolumeIndication_Implementation(const FRtcConnection& connection, const TArray& Speakers, int TotalVolume) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRtcStats_Implementation(const FRtcConnection& connection, const FRtcStats& Stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnNetworkQuality_Implementation(const FRtcConnection& connection, int64 RemoteUid, int TxQuality, int RxQuality) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnIntraRequestReceived_Implementation(const FRtcConnection& connection) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstLocalVideoFramePublished_Implementation(const FRtcConnection& connection, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstRemoteVideoDecoded_Implementation(const FRtcConnection& connection, int64 RemoteUid, int Width, int Height, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnVideoSizeChanged_Implementation(const FRtcConnection& connection, EVIDEO_SOURCE_TYPE SourceType, int64 Uid, int Width, int Height, int Rotation) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteVideoStateChanged_Implementation(const FRtcConnection& connection, int64 RemoteUid, EREMOTE_VIDEO_STATE State, EREMOTE_VIDEO_STATE_REASON Reason, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstRemoteVideoFrame_Implementation(const FRtcConnection& connection, int64 RemoteUid, int Width, int Height, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserMuteAudio_Implementation(const FRtcConnection& connection, int64 RemoteUid, bool Muted) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserMuteVideo_Implementation(const FRtcConnection& connection, int64 RemoteUid, bool Muted) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserEnableVideo_Implementation(const FRtcConnection& connection, int64 RemoteUid, bool Enabled) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserEnableLocalVideo_Implementation(const FRtcConnection& connection, int64 RemoteUid, bool Enabled) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserStateChanged_Implementation(const FRtcConnection& connection, int64 RemoteUid, int State) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLocalAudioStats_Implementation(const FRtcConnection& connection, const FLocalAudioStats& Stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteAudioStats_Implementation(const FRtcConnection& connection, const FRemoteAudioStats& Stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLocalVideoStats_Implementation(const FRtcConnection& connection, const FLocalVideoStats& Stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteVideoStats_Implementation(const FRtcConnection& connection, const FRemoteVideoStats& Stats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnConnectionLost_Implementation(const FRtcConnection& connection) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnConnectionInterrupted_Implementation(const FRtcConnection& connection) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnConnectionBanned_Implementation(const FRtcConnection& connection) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnStreamMessage_Implementation(const FRtcConnection& connection, int64 RemoteUid, int StreamId, const FString& Data, int64 Length, int64 SentTs) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnStreamMessageError_Implementation(const FRtcConnection& connection, int64 RemoteUid, int StreamId, int Code, int Missed, int Cached) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRequestToken_Implementation(const FRtcConnection& connection) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLicenseValidationFailure_Implementation(const FRtcConnection& connection, ELICENSE_ERROR_TYPE Reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnTokenPrivilegeWillExpire_Implementation(const FRtcConnection& connection, const FString& Token) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstLocalAudioFramePublished_Implementation(const FRtcConnection& connection, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstRemoteAudioFrame_Implementation(const FRtcConnection& connection, int64 UserId, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnFirstRemoteAudioDecoded_Implementation(const FRtcConnection& connection, int64 Uid, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnLocalAudioStateChanged_Implementation(const FRtcConnection& connection, ELOCAL_AUDIO_STREAM_STATE State, ELOCAL_AUDIO_STREAM_REASON Reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteAudioStateChanged_Implementation(const FRtcConnection& connection, int64 RemoteUid, EREMOTE_AUDIO_STATE State, EREMOTE_AUDIO_STATE_REASON Reason, int Elapsed) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnActiveSpeaker_Implementation(const FRtcConnection& connection, int64 Uid) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnClientRoleChanged_Implementation(const FRtcConnection& connection, ECLIENT_ROLE_TYPE OldRole, ECLIENT_ROLE_TYPE NewRole, const FClientRoleOptions& NewRoleOptions) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnClientRoleChangeFailed_Implementation(const FRtcConnection& connection, ECLIENT_ROLE_CHANGE_FAILED_REASON Reason, ECLIENT_ROLE_TYPE CurrentRole) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteAudioTransportStats_Implementation(const FRtcConnection& connection, int64 RemoteUid, int Delay, int Lost, int RxKBitRate) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnRemoteVideoTransportStats_Implementation(const FRtcConnection& connection, int64 RemoteUid, int Delay, int Lost, int RxKBitRate) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnConnectionStateChanged_Implementation(const FRtcConnection& connection, ECONNECTION_STATE_TYPE State, ECONNECTION_CHANGED_REASON_TYPE Reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnWlAccMessage_Implementation(const FRtcConnection& connection, EWLACC_MESSAGE_REASON Reason, EWLACC_SUGGEST_ACTION Action, const FString& WlAccMsg) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnWlAccStats_Implementation(const FRtcConnection& connection, const FWlAccStats& CurrentStats, const FWlAccStats& AverageStats) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnNetworkTypeChanged_Implementation(const FRtcConnection& connection, FENUMWRAP_NETWORK_TYPE Type) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnEncryptionError_Implementation(const FRtcConnection& connection, EENCRYPTION_ERROR_TYPE ErrorType) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUploadLogResult_Implementation(const FRtcConnection& connection, const FString& RequestId, bool Success, EUPLOAD_ERROR_REASON Reason) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnUserAccountUpdated_Implementation(const FRtcConnection& connection, int64 RemoteUid, const FString& RemoteUserAccount) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnSnapshotTaken_Implementation(const FRtcConnection& connection, int64 Uid, const FString& FilePath, int Width, int Height, int ErrCode) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnVideoRenderingTracingResult_Implementation(const FRtcConnection& connection, int64 Uid, EMEDIA_TRACE_EVENT CurrentEvent, const FVideoRenderingTracingInfo& TracingInfo) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnSetRtmFlagResult_Implementation(const FRtcConnection& connection, int Code) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnTranscodedStreamLayoutInfo_Implementation(const FRtcConnection& connection, int64 Uid, int Width, int Height, const TArray& Layoutlist) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +void UAgoraBPuIRtcEngineEventHandlerExCBExecutor::OnAudioMetadataReceived_Implementation(const FRtcConnection& connection, int64 Uid, const FString& Metadata) +{ + UE_LOG(LogAgora, Warning, TEXT("%s"), *FString(AG_FUNCTION_MACRO)); +} + +#pragma endregion BP Executor + diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuMediaPlayer.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuMediaPlayer.cpp new file mode 100644 index 00000000..df6b1d3e --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuMediaPlayer.cpp @@ -0,0 +1,429 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "AgoraBPuMediaPlayer.h" +#include "AgoraHeaderBase.h" + + +UAgoraBPuMediaPlayer* UAgoraBPuMediaPlayer::Instance = nullptr; + +UAgoraBPuMediaPlayer* UAgoraBPuMediaPlayer::GetAgoraMediaPlayer() +{ + if (!Instance) + { + Instance = NewObject(); + Instance->AddToRoot(); + + Instance->MediaPlayer = AgoraUERtcEngine::Get()->createMediaPlayer(); + + // register player source observer + Instance->UserMediaPlayerSourceObserver =TStrongObjectPtr(NewObject()); + + Instance->MediaPlayer->registerPlayerSourceObserver(Instance->UserMediaPlayerSourceObserver.Get()); + + } + return Instance; +} + +void UAgoraBPuMediaPlayer::Release() +{ + if (Instance) + { + if (Instance->MediaPlayer.get() != nullptr) { + //MediaPlayer->stop(); + //MediaPlayer->unregisterPlayerSourceObserver(UserIMediaPlayerSourceObserver.Get()); + Instance->UserMediaPlayerSourceObserver->RemoveAllBlueprintCallbackExecutors(); + Instance->MediaPlayer->unregisterPlayerSourceObserver(Instance->UserMediaPlayerSourceObserver.Get()); + Instance->UserMediaPlayerSourceObserver.Reset(); + AgoraUERtcEngine::Get()->destroyMediaPlayer(MediaPlayer); + Instance->MediaPlayer= nullptr; + } + Instance->RemoveFromRoot(); + Instance = nullptr; + } +} + + +UAgoraBPuIMediaPlayerSourceObserver* UAgoraBPuMediaPlayer::GetMediaPlayerSourceObserver() +{ + if (UserMediaPlayerSourceObserver.IsValid()) { + return UserMediaPlayerSourceObserver.Get(); + } + return nullptr; +} + +#pragma region Media Player + +int UAgoraBPuMediaPlayer::GetMediaPlayerId() +{ + if(MediaPlayer){ + return MediaPlayer->getMediaPlayerId(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::Open(const FString & url, int64 startPos) +{ + if (MediaPlayer) { + return MediaPlayer->open(TCHAR_TO_UTF8(*url), startPos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAgoraBPuMediaPlayer::OpenWithMediaSource(const FAgoraMediaSource& source) +{ + if (MediaPlayer) { + agora::media::base::MediaSource mediaSource = source.CreateAgoraData(); + int ret = MediaPlayer->openWithMediaSource(mediaSource); + source.FreeAgoraData(mediaSource); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::Play() +{ + if (MediaPlayer) { + return MediaPlayer->play(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::Pause() +{ + if (MediaPlayer) { + return MediaPlayer->pause(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::Stop() +{ + if (MediaPlayer) { + return MediaPlayer->stop(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::Resume() +{ + if (MediaPlayer) { + return MediaPlayer->resume(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::Seek(int64 newPos) +{ + if (MediaPlayer) { + return MediaPlayer->seek(newPos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SetAudioPitch(int pitch) +{ + if (MediaPlayer) { + return MediaPlayer->setAudioPitch(pitch); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetDuration(int64& duration) +{ + if (MediaPlayer) { + int64_t val; + int ret = MediaPlayer->getDuration(val); + duration = val; + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetPlayPosition(int64& pos) +{ + if (MediaPlayer) { + int64_t val; + int ret = MediaPlayer->getPlayPosition(val); + pos = val; + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetStreamCount(int64& count) +{ + if (MediaPlayer) { + int64_t val; + int ret = MediaPlayer->getStreamCount(val); + count = val; + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetStreamInfo(int64 index, FPlayerStreamInfo& info) +{ + if (MediaPlayer) { + agora::media::base::PlayerStreamInfo* playerStreamInfo = nullptr; + int ret = MediaPlayer->getStreamInfo(index, playerStreamInfo); + info = *playerStreamInfo; + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SetLoopCount(int loopCount) +{ + if (MediaPlayer) { + int ret = MediaPlayer->setLoopCount(loopCount); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SetPlaybackSpeed(int speed) +{ + if (MediaPlayer) { + int ret = MediaPlayer->setPlaybackSpeed(speed); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SelectAudioTrack(int index) +{ + if (MediaPlayer) { + int ret = MediaPlayer->selectAudioTrack(index); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAgoraBPuMediaPlayer::SelectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex) +{ + if (MediaPlayer) { + int ret = MediaPlayer->selectMultiAudioTrack(playoutTrackIndex, publishTrackIndex); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAgoraBPuMediaPlayer::SetPlayerOptionWithInt(const FString & key, int value) +{ + if (MediaPlayer) { + int ret = MediaPlayer->setPlayerOption(TCHAR_TO_UTF8(*key), value); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAgoraBPuMediaPlayer::SetPlayerOptionWithString(const FString& key, const FString& value) +{ + if (MediaPlayer) { + int ret = MediaPlayer->setPlayerOption(TCHAR_TO_UTF8(*key), TCHAR_TO_UTF8(*value)); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAgoraBPuMediaPlayer::TakeScreenshot(const FString& filename) +{ + if (MediaPlayer) { + int ret = MediaPlayer->takeScreenshot(TCHAR_TO_UTF8(*filename)); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SelectInternalSubtitle(int index) +{ + if (MediaPlayer) { + int ret = MediaPlayer->selectInternalSubtitle(index); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SetExternalSubtitle(const FString& url) +{ + if (MediaPlayer) { + int ret = MediaPlayer->setExternalSubtitle(TCHAR_TO_UTF8(*url)); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +EMEDIA_PLAYER_STATE UAgoraBPuMediaPlayer::GetState() +{ + if (MediaPlayer) { + return (EMEDIA_PLAYER_STATE)MediaPlayer->getState(); + } + return EMEDIA_PLAYER_STATE::PLAYER_STATE_FAILED; +} +int UAgoraBPuMediaPlayer::Mute(bool muted) +{ + if (MediaPlayer) { + int ret = MediaPlayer->mute(muted); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetMute(bool & muted) +{ + if (MediaPlayer) { + int ret = MediaPlayer->getMute(muted); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::AdjustPlayoutVolume(int volume) +{ + if (MediaPlayer) { + int ret = MediaPlayer->adjustPlayoutVolume(volume); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetPlayoutVolume(int & volume) +{ + if (MediaPlayer) { + int ret = MediaPlayer->getPlayoutVolume(volume); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::AdjustPublishSignalVolume(int volume) +{ + if (MediaPlayer) { + int ret = MediaPlayer->adjustPublishSignalVolume(volume); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetPublishSignalVolume(int & volume) +{ + if (MediaPlayer) { + int ret = MediaPlayer->getPublishSignalVolume(volume); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SetView(int64 view) +{ + if (MediaPlayer) { + int ret = MediaPlayer->setView(UABT::ToView(view)); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SetRenderMode(ERENDER_MODE_TYPE renderMode) +{ + if (MediaPlayer) { + int ret = MediaPlayer->setRenderMode((agora::media::base::RENDER_MODE_TYPE)renderMode); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +int UAgoraBPuMediaPlayer::SetAudioDualMonoMode(EAUDIO_DUAL_MONO_MODE mode) +{ + if (MediaPlayer) { + int ret = MediaPlayer->setAudioDualMonoMode((agora::media::base::AUDIO_DUAL_MONO_MODE)mode); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +FString UAgoraBPuMediaPlayer::GetPlayerSdkVersion() +{ + if (MediaPlayer) { + return MediaPlayer->getPlayerSdkVersion(); + } + return AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_NULLPTR]; +} +FString UAgoraBPuMediaPlayer::GetPlaySrc() +{ + if (MediaPlayer) { + return MediaPlayer->getPlaySrc(); + } + return AGORA_UEBP_ERR_STR[AGORA_UE_ERROR_CODE::ERROR_NULLPTR]; +} +int UAgoraBPuMediaPlayer::OpenWithAgoraCDNSrc(const FString& src, int64 startPos) +{ + if (MediaPlayer) { + return MediaPlayer->openWithAgoraCDNSrc(TCHAR_TO_UTF8(*src), startPos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetAgoraCDNLineCount() +{ + if (MediaPlayer) { + return MediaPlayer->getAgoraCDNLineCount(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SwitchAgoraCDNLineByIndex(int index) +{ + if (MediaPlayer) { + return MediaPlayer->switchAgoraCDNLineByIndex(index); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::GetCurrentAgoraCDNIndex() +{ + if (MediaPlayer) { + return MediaPlayer->getCurrentAgoraCDNIndex(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::EnableAutoSwitchAgoraCDN(bool enable) +{ + if (MediaPlayer) { + return MediaPlayer->enableAutoSwitchAgoraCDN(enable); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::RenewAgoraCDNSrcToken(const FString& token, int64 ts) +{ + if (MediaPlayer) { + return MediaPlayer->renewAgoraCDNSrcToken(TCHAR_TO_UTF8(*token), ts); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SwitchAgoraCDNSrc(const FString& src, bool syncPts) +{ + if (MediaPlayer) { + return MediaPlayer->switchAgoraCDNSrc(TCHAR_TO_UTF8(*src), syncPts); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SwitchSrc(const FString& src, bool syncPts) +{ + if (MediaPlayer) { + return MediaPlayer->switchSrc(TCHAR_TO_UTF8(*src), syncPts); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::PreloadSrc(const FString& src, int64 startPos) +{ + if (MediaPlayer) { + return MediaPlayer->preloadSrc(TCHAR_TO_UTF8(*src), startPos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::PlayPreloadedSrc(const FString& src) +{ + if (MediaPlayer) { + return MediaPlayer->playPreloadedSrc(TCHAR_TO_UTF8(*src)); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::UnloadSrc(const FString& src) +{ + if (MediaPlayer) { + return MediaPlayer->unloadSrc(TCHAR_TO_UTF8(*src)); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SetSpatialAudioParams(const FSpatialAudioParams& params) +{ + if (MediaPlayer) { + agora::SpatialAudioParams spatialAudioParams = params.CreateAgoraData(); + int ret = MediaPlayer->setSpatialAudioParams(spatialAudioParams); + params.FreeAgoraData(spatialAudioParams); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} +int UAgoraBPuMediaPlayer::SetSoundPositionParams(float pan, float gain) +{ + if (MediaPlayer) { + return MediaPlayer->setSoundPositionParams(pan, gain); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +} + +#pragma endregion Media Player \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuRtcEngine.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuRtcEngine.cpp new file mode 100644 index 00000000..b1be9db6 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraBPuRtcEngine.cpp @@ -0,0 +1,2497 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "AgoraBPuRtcEngine.h" +#include "AgoraHeaderBase.h" + +UAgoraBPuRtcEngine* UAgoraBPuRtcEngine::Instance = nullptr; + +void UAgoraBPuRtcEngine::InitInstance() +{ + UserRtcEventHandler.Reset(); + UserRtcEventHandlerEx.Reset(); + UserScreenCaptureSourceList.Reset(); +} + +void UAgoraBPuRtcEngine::UninitInstance() +{ + UserRtcEventHandler.Reset(); + UserRtcEventHandlerEx.Reset(); + UserScreenCaptureSourceList.Reset(); +} + +UAgoraBPuRtcEngine* UAgoraBPuRtcEngine::GetAgoraRtcEngine() +{ + if (Instance == nullptr) + { + Instance = NewObject(); + Instance->AddToRoot(); + Instance->InitInstance(); + } + return Instance; +} + +void UAgoraBPuRtcEngine::GetEventHandler(EAgoraBPuEventHandlerType& HandlerType, UAgoraBPuIRtcEngineEventHandler*& EventHandler, UAgoraBPuIRtcEngineEventHandlerEx*& EventHandlerEx) +{ + HandlerType = EventHandlerType; + + if(HandlerType == EAgoraBPuEventHandlerType::EventHandler){ + EventHandler = UserRtcEventHandler.Get(); + EventHandlerEx = nullptr; + } + else if (HandlerType == EAgoraBPuEventHandlerType::EventHandlerEx) { + EventHandler = nullptr; + EventHandlerEx = UserRtcEventHandlerEx.Get(); + } + else { + EventHandler = nullptr; + EventHandlerEx = nullptr; + } +} + +int UAgoraBPuRtcEngine::Initialize(const FRtcEngineContext& context) +{ + //Instance->AddToRoot(); + UserRtcEventHandler.Reset(); + UserRtcEventHandlerEx.Reset(); + EventHandlerType = EAgoraBPuEventHandlerType::None; + + + AgoraUERtcEngine::RtcEngineAppType = AgoraAppType::kAppTypeUnrealBlueprint; + agora::rtc::RtcEngineContext AgoraData_Context = context.CreateAgoraData(); + + bool bCreateExHandler = true; + + EventHandlerType = context.EventHandlerCreationType; + if (EventHandlerType == EAgoraBPuEventHandlerType::EventHandler) { + UserRtcEventHandler = TStrongObjectPtr(NewObject()); + AgoraData_Context.eventHandler = UserRtcEventHandler.Get(); + } + else if (EventHandlerType == EAgoraBPuEventHandlerType::EventHandlerEx) { + UserRtcEventHandlerEx = TStrongObjectPtr(NewObject()); + AgoraData_Context.eventHandler = UserRtcEventHandlerEx.Get(); + } + + + int ret = AgoraUERtcEngine::Get()->initialize(AgoraData_Context); + context.FreeAgoraData(AgoraData_Context); + + return ret; +} + +FString UAgoraBPuRtcEngine::GetVersion() +{ + return AgoraUERtcEngine::GetSDKVersion(); +} + +void UAgoraBPuRtcEngine::Release(bool sync /*= false*/) +{ + ClearAllEventHandlerCBExecutors(); + UninitInstance(); + RemoveFromRoot(); + + AgoraUERtcEngine::Release(sync); + Instance = nullptr; + +} + +int UAgoraBPuRtcEngine::JoinChannel(const FString& token, const FString& channelId, int64 uid) +{ + return AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*token), TCHAR_TO_UTF8(*channelId),"", UABT::ToUID(uid)); +} + +int UAgoraBPuRtcEngine::JoinChannelWithOptions(const FString& token, const FString& channelId, int64 uid, const FChannelMediaOptions& options) +{ + agora::rtc::ChannelMediaOptions channelMediaOptions = options.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->joinChannel(TCHAR_TO_UTF8(*token), TCHAR_TO_UTF8(*channelId), UABT::ToUID(uid), channelMediaOptions); + + options.FreeAgoraData(channelMediaOptions); + + return ret; +} + +int UAgoraBPuRtcEngine::LeaveChannel() +{ + return AgoraUERtcEngine::Get()->leaveChannel(); +} + +int UAgoraBPuRtcEngine::LeaveChannelWithOptions(const FLeaveChannelOptions& options) +{ + agora::rtc::LeaveChannelOptions leaveChannelOptions = options.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->leaveChannel(leaveChannelOptions); + + options.FreeAgoraData(leaveChannelOptions); + + return ret; + +} + +int UAgoraBPuRtcEngine::EnableVideo() +{ + return AgoraUERtcEngine::Get()->enableVideo(); +} + +int UAgoraBPuRtcEngine::DisableVideo() +{ + return AgoraUERtcEngine::Get()->disableVideo(); +} + +int UAgoraBPuRtcEngine::EnableAudio() +{ + return AgoraUERtcEngine::Get()->enableAudio(); +} + +int UAgoraBPuRtcEngine::DisableAudio() +{ + return AgoraUERtcEngine::Get()->disableAudio(); +} + +int UAgoraBPuRtcEngine::SetClientRole(FClientRoleOptions options, ECLIENT_ROLE_TYPE clientroletype) +{ + agora::rtc::ClientRoleOptions clientRoleOptions; + clientRoleOptions.audienceLatencyLevel = (agora::rtc::AUDIENCE_LATENCY_LEVEL_TYPE)options.audienceLatencyLevel; + agora::rtc::CLIENT_ROLE_TYPE roleType = (agora::rtc::CLIENT_ROLE_TYPE)clientroletype; + auto ret = AgoraUERtcEngine::Get()->setClientRole(roleType, clientRoleOptions); + return ret; +} + +int UAgoraBPuRtcEngine::SetupLocalVideo(const FVideoCanvas& canvas) +{ + agora::rtc::VideoCanvas videoCanvas; + videoCanvas.view = (agora::view_t)canvas.view; + videoCanvas.uid = canvas.uid; + videoCanvas.sourceType = (agora::rtc::VIDEO_SOURCE_TYPE)canvas.sourceType; + auto ret = AgoraUERtcEngine::Get()->setupLocalVideo(videoCanvas); + return ret; +} + +int UAgoraBPuRtcEngine::SetupRemoteVideo(const FVideoCanvas& canvas) +{ + agora::rtc::VideoCanvas videoCanvas; + videoCanvas.view = (agora::view_t)canvas.view; + videoCanvas.renderMode = (agora::media::base::RENDER_MODE_TYPE)canvas.renderMode; + videoCanvas.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)canvas.mirrorMode; + videoCanvas.uid = canvas.uid; + //videoCanvas.priv = canvas.priv; + videoCanvas.sourceType = (agora::rtc::VIDEO_SOURCE_TYPE)canvas.sourceType; + //videoCanvas.cropArea = canvas.cropArea; + videoCanvas.setupMode = (agora::rtc::VIDEO_VIEW_SETUP_MODE)canvas.setupMode; + auto ret = AgoraUERtcEngine::Get()->setupRemoteVideo(videoCanvas); + return ret; +} + +int UAgoraBPuRtcEngine::SetupRemoteVideoEx(const FVideoCanvas& canvas, const FRtcConnection& connection) +{ + agora::rtc::VideoCanvas videoCanvas; + videoCanvas.view = (agora::view_t)canvas.view; + videoCanvas.renderMode = (agora::media::base::RENDER_MODE_TYPE)canvas.renderMode; + videoCanvas.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)canvas.mirrorMode; + videoCanvas.uid = canvas.uid; + //videoCanvas.priv = canvas.priv; + videoCanvas.sourceType = (agora::rtc::VIDEO_SOURCE_TYPE)canvas.sourceType; + //videoCanvas.cropArea = canvas.cropArea; + videoCanvas.setupMode = (agora::rtc::VIDEO_VIEW_SETUP_MODE)canvas.setupMode; + agora::rtc::RtcConnection rtcConnection; + std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); + rtcConnection.channelId = ChannelId.c_str(); + //rtcConnection.localUid = connection.localUid; + auto ret = AgoraUERtcEngine::Get()->setupRemoteVideoEx(videoCanvas, rtcConnection); + return ret; +} + + +void UAgoraBPuRtcEngine::ClearAllEventHandlerCBExecutors() +{ + if (UserRtcEventHandler.IsValid()) + { + UserRtcEventHandler->RemoveAllBlueprintCallbackExecutors(); + } + if (UserRtcEventHandlerEx.IsValid()) + { + UserRtcEventHandlerEx->RemoveAllBlueprintCallbackExecutorExs(); + } +} + + +#pragma region RtcEngine2 + +FString UAgoraBPuRtcEngine::GetErrorDescription(int code) +{ + return AgoraUERtcEngine::Get()->getErrorDescription(code); +} + +int UAgoraBPuRtcEngine::QueryCodecCapability(TArray& codecInfo, int QuerySize /*= 10*/) +{ + agora::rtc::CodecCapInfo* codecCapInfo = new agora::rtc::CodecCapInfo[QuerySize]; + int ret = AgoraUERtcEngine::Get()->queryCodecCapability(codecCapInfo, QuerySize); + + for (int i = 0; i < QuerySize; i++) { + + codecInfo.Add(codecCapInfo[i]); + } + + delete[] codecCapInfo; + + return ret; +} + +int UAgoraBPuRtcEngine::QueryDeviceScore() +{ + return AgoraUERtcEngine::Get()->queryDeviceScore(); +} + +int UAgoraBPuRtcEngine::PreloadChannel(const FString& token, const FString& channelId, int64 uid) +{ + return AgoraUERtcEngine::Get()->preloadChannel(TCHAR_TO_UTF8(*token), TCHAR_TO_UTF8(*channelId), UABT::ToUID(uid)); +} + +int UAgoraBPuRtcEngine::PreloadChannelWithUserAccount(const FString& token, const FString& channelId, const FString& userAccount) +{ + return AgoraUERtcEngine::Get()->preloadChannelWithUserAccount(TCHAR_TO_UTF8(*token), TCHAR_TO_UTF8(*channelId), TCHAR_TO_UTF8(*userAccount)); +} + +int UAgoraBPuRtcEngine::UpdatePreloadChannelToken(const FString& token) +{ + return AgoraUERtcEngine::Get()->updatePreloadChannelToken(TCHAR_TO_UTF8(*token)); +} + +int UAgoraBPuRtcEngine::UpdateChannelMediaOptions(const FChannelMediaOptions& options) +{ + agora::rtc::ChannelMediaOptions channelMediaOptions = options.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->updateChannelMediaOptions(channelMediaOptions); + + options.FreeAgoraData(channelMediaOptions); + + return ret; +} + +int UAgoraBPuRtcEngine::RenewToken(const FString& token) +{ + return AgoraUERtcEngine::Get()->renewToken(TCHAR_TO_UTF8(*token)); +} + +int UAgoraBPuRtcEngine::SetChannelProfile(ECHANNEL_PROFILE_TYPE profile) +{ + return AgoraUERtcEngine::Get()->setChannelProfile((agora::CHANNEL_PROFILE_TYPE)profile); +} + +int UAgoraBPuRtcEngine::StartEchoTest(const FEchoTestConfiguration& config) +{ + agora::rtc::EchoTestConfiguration echoTestConfiguration = config.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->startEchoTest(echoTestConfiguration); + + config.FreeAgoraData(echoTestConfiguration); + + return ret; +} + +int UAgoraBPuRtcEngine::StopEchoTest() +{ + return AgoraUERtcEngine::Get()->stopEchoTest(); +} + +int UAgoraBPuRtcEngine::EnableMultiCamera(bool enabled, const FCameraCapturerConfiguration& config) +{ + int ret = AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); + +#if defined(__APPLE__) && TARGET_OS_IOS + agora::rtc::CameraCapturerConfiguration cameraCapturerConfiguration = config.CreateAgoraData(); + + ret = AgoraUERtcEngine::Get()->enableMultiCamera(enabled, cameraCapturerConfiguration); + + config.FreeAgoraData(cameraCapturerConfiguration); + +#endif + + return ret; +} + +int UAgoraBPuRtcEngine::StartPreview(EVIDEO_SOURCE_TYPE sourceType /*= EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY*/) +{ + return AgoraUERtcEngine::Get()->startPreview((agora::rtc::VIDEO_SOURCE_TYPE)sourceType); +} + +int UAgoraBPuRtcEngine::StopPreview(EVIDEO_SOURCE_TYPE sourceType /*= EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY*/) +{ + return AgoraUERtcEngine::Get()->stopPreview((agora::rtc::VIDEO_SOURCE_TYPE)sourceType); +} + +int UAgoraBPuRtcEngine::StartLastmileProbeTest(const FLastmileProbeConfig& config) +{ + agora::rtc::LastmileProbeConfig lastmileProbeConfig = config.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->startLastmileProbeTest(lastmileProbeConfig); + + config.FreeAgoraData(lastmileProbeConfig); + + return ret; +} + +int UAgoraBPuRtcEngine::StopLastmileProbeTest() +{ + return AgoraUERtcEngine::Get()->stopLastmileProbeTest(); +} + +int UAgoraBPuRtcEngine::SetVideoEncoderConfiguration(const FVideoEncoderConfiguration& config) +{ + agora::rtc::VideoEncoderConfiguration videoEncoderConfiguration = config.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setVideoEncoderConfiguration(videoEncoderConfiguration); + + config.FreeAgoraData(videoEncoderConfiguration); + + return ret; +} + +int UAgoraBPuRtcEngine::SetBeautyEffectOptions(bool enabled, const FBeautyOptions& options, EMEDIA_SOURCE_TYPE type) +{ + agora::rtc::BeautyOptions beautyOptions = options.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setBeautyEffectOptions(enabled, beautyOptions, (agora::media::MEDIA_SOURCE_TYPE)type); + + options.FreeAgoraData(beautyOptions); + + return ret; +} + +int UAgoraBPuRtcEngine::SetLowlightEnhanceOptions(bool enabled, const FLowlightEnhanceOptions& options, EMEDIA_SOURCE_TYPE type) +{ + agora::rtc::LowlightEnhanceOptions lowlightEnhanceOptions = options.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setLowlightEnhanceOptions(enabled, lowlightEnhanceOptions, (agora::media::MEDIA_SOURCE_TYPE)type); + + options.FreeAgoraData(lowlightEnhanceOptions); + + return ret; +} + +int UAgoraBPuRtcEngine::SetVideoDenoiserOptions(bool enabled, const FVideoDenoiserOptions& options, EMEDIA_SOURCE_TYPE type) +{ + agora::rtc::VideoDenoiserOptions videoDenoiserOptions = options.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setVideoDenoiserOptions(enabled, videoDenoiserOptions, (agora::media::MEDIA_SOURCE_TYPE)type); + + options.FreeAgoraData(videoDenoiserOptions); + + return ret; +} + +int UAgoraBPuRtcEngine::SetColorEnhanceOptions(bool enabled, const FColorEnhanceOptions& options, EMEDIA_SOURCE_TYPE type) +{ + agora::rtc::ColorEnhanceOptions colorEnhanceOptions = options.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setColorEnhanceOptions(enabled, colorEnhanceOptions, (agora::media::MEDIA_SOURCE_TYPE)type); + + options.FreeAgoraData(colorEnhanceOptions); + + return ret; +} + +int UAgoraBPuRtcEngine::EnableVirtualBackground(bool enabled, FVirtualBackgroundSource backgroundSource, FSegmentationProperty segproperty, EMEDIA_SOURCE_TYPE type) +{ + agora::rtc::VirtualBackgroundSource virtualBackgroundSource = backgroundSource.CreateAgoraData(); + agora::rtc::SegmentationProperty segmentationProperty = segproperty.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->enableVirtualBackground(enabled, virtualBackgroundSource, segmentationProperty, (agora::media::MEDIA_SOURCE_TYPE)type); + + backgroundSource.FreeAgoraData(virtualBackgroundSource); + segproperty.FreeAgoraData(segmentationProperty); + + return ret; +} + +int UAgoraBPuRtcEngine::SetVideoScenario(EVIDEO_APPLICATION_SCENARIO_TYPE scenarioType) +{ + return AgoraUERtcEngine::Get()->setVideoScenario((agora::rtc::VIDEO_APPLICATION_SCENARIO_TYPE)scenarioType); +} + +int UAgoraBPuRtcEngine::SetVideoQoEPreference(EVIDEO_QOE_PREFERENCE_TYPE qoePreference) +{ + return AgoraUERtcEngine::Get()->setVideoQoEPreference((agora::rtc::VIDEO_QOE_PREFERENCE_TYPE)qoePreference); +} + +int UAgoraBPuRtcEngine::SetAudioProfileAndScenario(EAUDIO_PROFILE_TYPE profile /*= EAUDIO_PROFILE_TYPE::AUDIO_PROFILE_DEFAULT*/, EAUDIO_SCENARIO_TYPE scenario /*= EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT*/) +{ + return AgoraUERtcEngine::Get()->setAudioProfile((agora::rtc::AUDIO_PROFILE_TYPE)profile, (agora::rtc::AUDIO_SCENARIO_TYPE)scenario); +} + +int UAgoraBPuRtcEngine::SetAudioProfile(EAUDIO_PROFILE_TYPE profile /*= EAUDIO_PROFILE_TYPE::AUDIO_PROFILE_DEFAULT*/) +{ + return AgoraUERtcEngine::Get()->setAudioProfile((agora::rtc::AUDIO_PROFILE_TYPE)profile); +} + +int UAgoraBPuRtcEngine::SetAudioScenario(EAUDIO_SCENARIO_TYPE scenario /*= EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT*/) +{ + return AgoraUERtcEngine::Get()->setAudioScenario((agora::rtc::AUDIO_SCENARIO_TYPE)scenario); +} + +int UAgoraBPuRtcEngine::EnableLocalAudio(bool enabled) +{ + return AgoraUERtcEngine::Get()->enableLocalAudio(enabled); +} + +int UAgoraBPuRtcEngine::MuteLocalAudioStream(bool mute) +{ + return AgoraUERtcEngine::Get()->muteLocalAudioStream(mute); +} + +int UAgoraBPuRtcEngine::MuteAllRemoteAudioStreams(bool mute) +{ + return AgoraUERtcEngine::Get()->muteAllRemoteAudioStreams(mute); +} + +int UAgoraBPuRtcEngine::SetRemoteDefaultVideoStreamType(EVIDEO_STREAM_TYPE streamType) +{ + return AgoraUERtcEngine::Get()->setRemoteDefaultVideoStreamType((agora::rtc::VIDEO_STREAM_TYPE)streamType); +} + +int UAgoraBPuRtcEngine::MuteRemoteAudioStream(int64 uid, bool mute) +{ + return AgoraUERtcEngine::Get()->muteRemoteAudioStream(UABT::ToUID(uid), mute); +} + +int UAgoraBPuRtcEngine::MuteLocalVideoStream(bool mute) +{ + return AgoraUERtcEngine::Get()->muteLocalVideoStream(mute); +} + +int UAgoraBPuRtcEngine::EnableLocalVideo(bool enabled) +{ + return AgoraUERtcEngine::Get()->enableLocalVideo(enabled); +} + +int UAgoraBPuRtcEngine::MuteAllRemoteVideoStreams(bool mute) +{ + return AgoraUERtcEngine::Get()->muteAllRemoteVideoStreams(mute); +} + +int UAgoraBPuRtcEngine::MuteRemoteVideoStream(int64 uid, bool mute) +{ + return AgoraUERtcEngine::Get()->muteRemoteVideoStream(UABT::ToUID(uid), mute); +} + +int UAgoraBPuRtcEngine::SetRemoteVideoStreamType(int64 uid, EVIDEO_STREAM_TYPE streamType) +{ + return AgoraUERtcEngine::Get()->setRemoteVideoStreamType(UABT::ToUID(uid), (agora::rtc::VIDEO_STREAM_TYPE)streamType); +} + +int UAgoraBPuRtcEngine::SetRemoteVideoSubscriptionOptions(int64 uid, const FVideoSubscriptionOptions& options) +{ + agora::rtc::VideoSubscriptionOptions videoSubscriptionOptions = options.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setRemoteVideoSubscriptionOptions(UABT::ToUID(uid), videoSubscriptionOptions); + + options.FreeAgoraData(videoSubscriptionOptions); + + return ret; +} + +int UAgoraBPuRtcEngine::EnableAudioVolumeIndication(int interval, int smooth, bool reportVad) +{ + return AgoraUERtcEngine::Get()->enableAudioVolumeIndication(interval, smooth, reportVad); +} + +int UAgoraBPuRtcEngine::StartAudioRecording(const FAudioRecordingConfiguration& config) +{ + agora::rtc::AudioRecordingConfiguration audioRecordingConfiguration = config.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->startAudioRecording(audioRecordingConfiguration); + + config.FreeAgoraData(audioRecordingConfiguration); + + return ret; +} + +int UAgoraBPuRtcEngine::StopAudioRecording() +{ + return AgoraUERtcEngine::Get()->stopAudioRecording(); +} + +int UAgoraBPuRtcEngine::StartAudioMixing(const FString& filePath, bool loopback, int cycle, int startPos /*= 0*/) +{ + return AgoraUERtcEngine::Get()->startAudioMixing(TCHAR_TO_UTF8(*filePath), loopback, cycle, startPos); +} + +int UAgoraBPuRtcEngine::StopAudioMixing() +{ + return AgoraUERtcEngine::Get()->stopAudioMixing(); +} + +int UAgoraBPuRtcEngine::PauseAudioMixing() +{ + return AgoraUERtcEngine::Get()->pauseAudioMixing(); +} + +int UAgoraBPuRtcEngine::ResumeAudioMixing() +{ + return AgoraUERtcEngine::Get()->resumeAudioMixing(); +} + +int UAgoraBPuRtcEngine::SelectAudioTrack(int index) +{ + return AgoraUERtcEngine::Get()->selectAudioTrack(index); +} + +int UAgoraBPuRtcEngine::GetAudioTrackCount() +{ + return AgoraUERtcEngine::Get()->getAudioTrackCount(); +} + +int UAgoraBPuRtcEngine::AdjustAudioMixingVolume(int volume) +{ + return AgoraUERtcEngine::Get()->adjustAudioMixingVolume(volume); +} + +int UAgoraBPuRtcEngine::AdjustAudioMixingPublishVolume(int volume) +{ + return AgoraUERtcEngine::Get()->adjustAudioMixingPublishVolume(volume); +} + +int UAgoraBPuRtcEngine::GetAudioMixingPublishVolume() +{ + return AgoraUERtcEngine::Get()->getAudioMixingPublishVolume(); +} + +int UAgoraBPuRtcEngine::AdjustAudioMixingPlayoutVolume(int volume) +{ + return AgoraUERtcEngine::Get()->adjustAudioMixingPlayoutVolume(volume); +} + +int UAgoraBPuRtcEngine::GetAudioMixingPlayoutVolume() +{ + return AgoraUERtcEngine::Get()->getAudioMixingPlayoutVolume(); +} + +int UAgoraBPuRtcEngine::GetAudioMixingDuration() +{ + return AgoraUERtcEngine::Get()->getAudioMixingDuration(); +} + +int UAgoraBPuRtcEngine::GetAudioMixingCurrentPosition() +{ + return AgoraUERtcEngine::Get()->getAudioMixingCurrentPosition(); +} + +int UAgoraBPuRtcEngine::SetAudioMixingPosition(int pos) +{ + return AgoraUERtcEngine::Get()->setAudioMixingPosition(pos); +} + +int UAgoraBPuRtcEngine::SetAudioMixingDualMonoMode(EAUDIO_MIXING_DUAL_MONO_MODE mode) +{ + return AgoraUERtcEngine::Get()->setAudioMixingDualMonoMode((agora::media::AUDIO_MIXING_DUAL_MONO_MODE)mode); +} + +int UAgoraBPuRtcEngine::SetAudioMixingPitch(int pitch) +{ + return AgoraUERtcEngine::Get()->setAudioMixingPitch(pitch); +} + +int UAgoraBPuRtcEngine::SetAudioMixingPlaybackSpeed(int speed) +{ + return AgoraUERtcEngine::Get()->setAudioMixingPlaybackSpeed(speed); +} + +int UAgoraBPuRtcEngine::GetEffectsVolume() +{ + return AgoraUERtcEngine::Get()->getEffectsVolume(); +} + +int UAgoraBPuRtcEngine::SetEffectsVolume(int volume) +{ + return AgoraUERtcEngine::Get()->setEffectsVolume(volume); +} + +int UAgoraBPuRtcEngine::PreloadEffect(int soundId, const FString& filePath, int startPos) +{ + return AgoraUERtcEngine::Get()->preloadEffect(soundId, TCHAR_TO_UTF8(*filePath), startPos); +} + +int UAgoraBPuRtcEngine::PlayEffect(int soundId, const FString& filePath, int loopCount, float pitch, float pan, int gain, bool publish, int startPos) +{ + return AgoraUERtcEngine::Get()->playEffect(soundId, TCHAR_TO_UTF8(*filePath), loopCount, pitch, pan, gain, publish, startPos); +} + +int UAgoraBPuRtcEngine::PlayAllEffects(int loopCount, float pitch, float pan, int gain, bool publish) +{ + return AgoraUERtcEngine::Get()->playAllEffects(loopCount, pitch, pan, gain, publish); +} + +int UAgoraBPuRtcEngine::GetVolumeOfEffect(int soundId) +{ + return AgoraUERtcEngine::Get()->getVolumeOfEffect(soundId); +} + +int UAgoraBPuRtcEngine::SetVolumeOfEffect(int soundId, int volume) +{ + return AgoraUERtcEngine::Get()->setVolumeOfEffect(soundId, volume); +} + +int UAgoraBPuRtcEngine::PauseEffect(int soundId) +{ + return AgoraUERtcEngine::Get()->pauseEffect(soundId); +} + +int UAgoraBPuRtcEngine::PauseAllEffects() +{ + return AgoraUERtcEngine::Get()->pauseAllEffects(); +} + +int UAgoraBPuRtcEngine::ResumeEffect(int soundId) +{ + return AgoraUERtcEngine::Get()->resumeEffect(soundId); +} + +int UAgoraBPuRtcEngine::ResumeAllEffects() +{ + return AgoraUERtcEngine::Get()->resumeAllEffects(); +} + +int UAgoraBPuRtcEngine::StopEffect(int soundId) +{ + return AgoraUERtcEngine::Get()->stopEffect(soundId); +} + +int UAgoraBPuRtcEngine::StopAllEffects() +{ + return AgoraUERtcEngine::Get()->stopAllEffects(); +} + +int UAgoraBPuRtcEngine::UnloadEffect(int soundId) +{ + return AgoraUERtcEngine::Get()->unloadEffect(soundId); +} + +int UAgoraBPuRtcEngine::UnloadAllEffects() +{ + return AgoraUERtcEngine::Get()->unloadAllEffects(); +} + +int UAgoraBPuRtcEngine::GetEffectDuration(const FString& filePath) +{ + return AgoraUERtcEngine::Get()->getEffectDuration(TCHAR_TO_UTF8(*filePath)); +} + +int UAgoraBPuRtcEngine::SetEffectPosition(int soundId, int pos) +{ + return AgoraUERtcEngine::Get()->setEffectPosition(soundId, pos); +} + +int UAgoraBPuRtcEngine::GetEffectCurrentPosition(int soundId) +{ + return AgoraUERtcEngine::Get()->getEffectCurrentPosition(soundId); +} + +int UAgoraBPuRtcEngine::EnableSoundPositionIndication(bool enabled) +{ + return AgoraUERtcEngine::Get()->enableSoundPositionIndication(enabled); +} + +int UAgoraBPuRtcEngine::SetRemoteVoicePosition(int64 uid, float pan, float gain) +{ + return AgoraUERtcEngine::Get()->setRemoteVoicePosition(UABT::ToUID(uid), pan, gain); +} + +int UAgoraBPuRtcEngine::EnableSpatialAudio(bool enabled) +{ + return AgoraUERtcEngine::Get()->enableSpatialAudio(enabled); +} + +int UAgoraBPuRtcEngine::SetRemoteUserSpatialAudioParams(int64 uid, const FSpatialAudioParams& params) +{ + agora::SpatialAudioParams spatialAudioParams = params.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setRemoteUserSpatialAudioParams(UABT::ToUID(uid), spatialAudioParams); + + params.FreeAgoraData(spatialAudioParams); + + return ret; +} + +int UAgoraBPuRtcEngine::SetVoiceBeautifierPreset(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset) +{ + return AgoraUERtcEngine::Get()->setVoiceBeautifierPreset(preset.GetRawValue()); +} + +int UAgoraBPuRtcEngine::SetAudioEffectPreset(FENUMWRAP_AUDIO_EFFECT_PRESET preset) +{ + return AgoraUERtcEngine::Get()->setAudioEffectPreset(preset.GetRawValue()); +} + +int UAgoraBPuRtcEngine::SetVoiceConversionPreset(FENUMWRAP_VOICE_CONVERSION_PRESET preset) +{ + return AgoraUERtcEngine::Get()->setVoiceConversionPreset(preset.GetRawValue()); +} + +int UAgoraBPuRtcEngine::SetAudioEffectParameters(FENUMWRAP_AUDIO_EFFECT_PRESET preset, int param1, int param2) +{ + return AgoraUERtcEngine::Get()->setAudioEffectParameters(preset.GetRawValue(), param1, param2); +} + +int UAgoraBPuRtcEngine::SetVoiceBeautifierParameters(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset, int param1, int param2) +{ + return AgoraUERtcEngine::Get()->setVoiceBeautifierParameters(preset.GetRawValue(), param1, param2); +} + +int UAgoraBPuRtcEngine::SetVoiceConversionParameters(FENUMWRAP_VOICE_CONVERSION_PRESET preset, int param1, int param2) +{ + return AgoraUERtcEngine::Get()->setVoiceConversionParameters(preset.GetRawValue(), param1, param2); +} + +int UAgoraBPuRtcEngine::SetLocalVoicePitch(float pitch) +{ + return AgoraUERtcEngine::Get()->setLocalVoicePitch(pitch); +} + +int UAgoraBPuRtcEngine::SetLocalVoiceFormant(const FString& formantRatio /*= "0.0"*/) +{ + return AgoraUERtcEngine::Get()->setLocalVoiceFormant(UABT::ToDouble(formantRatio)); +} + +int UAgoraBPuRtcEngine::SetLocalVoiceEqualization(EAUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) +{ + return AgoraUERtcEngine::Get()->setLocalVoiceEqualization((agora::rtc::AUDIO_EQUALIZATION_BAND_FREQUENCY)bandFrequency, bandGain); +} + +int UAgoraBPuRtcEngine::SetLocalVoiceReverb(EAUDIO_REVERB_TYPE reverbKey, int value) +{ + return AgoraUERtcEngine::Get()->setLocalVoiceReverb((agora::rtc::AUDIO_REVERB_TYPE)reverbKey, value); +} + +int UAgoraBPuRtcEngine::SetLogFile(const FString& filePath) +{ + return AgoraUERtcEngine::Get()->setLogFile(TCHAR_TO_UTF8(*filePath)); +} + +int UAgoraBPuRtcEngine::SetLogFilter(int filter) +{ + return AgoraUERtcEngine::Get()->setLogFilter(filter); +} + +int UAgoraBPuRtcEngine::SetLogLevel(ELOG_LEVEL level) +{ + return AgoraUERtcEngine::Get()->setLogLevel((agora::commons::LOG_LEVEL)level); +} + +int UAgoraBPuRtcEngine::SetLogFileSize(int fileSizeInKBytes) +{ + return AgoraUERtcEngine::Get()->setLogFileSize(fileSizeInKBytes); +} + +int UAgoraBPuRtcEngine::UploadLogFile(FString& requestId) +{ + agora::util::AString _requestId; + auto ret = AgoraUERtcEngine::Get()->uploadLogFile(_requestId); + requestId = UTF8_TO_TCHAR(_requestId->c_str()); + return ret; +} + +int UAgoraBPuRtcEngine::WriteLog(ELOG_LEVEL level, const FString& Content) +{ + return AgoraUERtcEngine::Get()->writeLog((agora::commons::LOG_LEVEL)level, TCHAR_TO_UTF8(*Content)); +} + +int UAgoraBPuRtcEngine::SetLocalRenderMode(ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode /*= EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_AUTO*/) +{ + return AgoraUERtcEngine::Get()->setLocalRenderMode((agora::media::base::RENDER_MODE_TYPE)renderMode, (agora::rtc::VIDEO_MIRROR_MODE_TYPE)mirrorMode); +} + +int UAgoraBPuRtcEngine::SetRemoteRenderMode(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode) +{ + return AgoraUERtcEngine::Get()->setRemoteRenderMode(UABT::ToUID(uid), (agora::media::base::RENDER_MODE_TYPE)renderMode, (agora::rtc::VIDEO_MIRROR_MODE_TYPE)mirrorMode); +} + +int UAgoraBPuRtcEngine::SetLocalVideoMirrorMode(EVIDEO_MIRROR_MODE_TYPE mirrorMode) +{ + return AgoraUERtcEngine::Get()->setLocalVideoMirrorMode((agora::rtc::VIDEO_MIRROR_MODE_TYPE)mirrorMode); +} + +int UAgoraBPuRtcEngine::EnableDualStreamMode(bool enabled, const FSimulcastStreamConfig& streamConfig) +{ + agora::rtc::SimulcastStreamConfig simulcastStreamConfig = streamConfig.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->enableDualStreamMode(enabled, simulcastStreamConfig); + + streamConfig.FreeAgoraData(simulcastStreamConfig); + + return ret; +} + +int UAgoraBPuRtcEngine::SetDualStreamMode(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig) +{ + agora::rtc::SimulcastStreamConfig simulcastStreamConfig = streamConfig.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setDualStreamMode(mode.GetRawValue(), simulcastStreamConfig); + + streamConfig.FreeAgoraData(simulcastStreamConfig); + + return ret; +} + +int UAgoraBPuRtcEngine::EnableCustomAudioLocalPlayback(int64 trackId, bool enabled) +{ + return AgoraUERtcEngine::Get()->enableCustomAudioLocalPlayback(UABT::ToUID(trackId), enabled); +} + +int UAgoraBPuRtcEngine::SetRecordingAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) +{ + return AgoraUERtcEngine::Get()->setRecordingAudioFrameParameters(sampleRate, channel, (agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE)mode, samplesPerCall); +} + +int UAgoraBPuRtcEngine::SetPlaybackAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) +{ + return AgoraUERtcEngine::Get()->setPlaybackAudioFrameParameters(sampleRate, channel, (agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE)mode, samplesPerCall); +} + +int UAgoraBPuRtcEngine::SetMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall) +{ + return AgoraUERtcEngine::Get()->setMixedAudioFrameParameters(sampleRate, channel, samplesPerCall); +} + +int UAgoraBPuRtcEngine::SetPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel) +{ + return AgoraUERtcEngine::Get()->setPlaybackAudioFrameBeforeMixingParameters(sampleRate, channel); +} + +int UAgoraBPuRtcEngine::EnableAudioSpectrumMonitor(int intervalInMS) +{ + return AgoraUERtcEngine::Get()->enableAudioSpectrumMonitor(intervalInMS); +} + +int UAgoraBPuRtcEngine::DisableAudioSpectrumMonitor() +{ + return AgoraUERtcEngine::Get()->disableAudioSpectrumMonitor(); +} + +int UAgoraBPuRtcEngine::AdjustRecordingSignalVolume(int volume) +{ + return AgoraUERtcEngine::Get()->adjustRecordingSignalVolume(volume); +} + +int UAgoraBPuRtcEngine::MuteRecordingSignal(bool mute) +{ + return AgoraUERtcEngine::Get()->muteRecordingSignal(mute); +} + +int UAgoraBPuRtcEngine::AdjustPlaybackSignalVolume(int volume) +{ + return AgoraUERtcEngine::Get()->adjustPlaybackSignalVolume(volume); +} + +int UAgoraBPuRtcEngine::AdjustUserPlaybackSignalVolume(int64 uid, int volume) +{ + return AgoraUERtcEngine::Get()->adjustUserPlaybackSignalVolume(UABT::ToUID(uid), volume); +} + +int UAgoraBPuRtcEngine::SetLocalPublishFallbackOption(ESTREAM_FALLBACK_OPTIONS option) +{ + return AgoraUERtcEngine::Get()->setLocalPublishFallbackOption((agora::rtc::STREAM_FALLBACK_OPTIONS)option); +} + +int UAgoraBPuRtcEngine::SetRemoteSubscribeFallbackOption(ESTREAM_FALLBACK_OPTIONS option) +{ + return AgoraUERtcEngine::Get()->setRemoteSubscribeFallbackOption((agora::rtc::STREAM_FALLBACK_OPTIONS)option); +} + +int UAgoraBPuRtcEngine::SetHighPriorityUserList(const TArray& uidList, ESTREAM_FALLBACK_OPTIONS option) +{ + int vNum = uidList.Num(); + agora::rtc::uid_t* uidListVec = new agora::rtc::uid_t[vNum]; + for (int i = 0; i < vNum; i++) { + uidListVec[i] = UABT::ToUID(uidList[i]); + } + + int ret = AgoraUERtcEngine::Get()->setHighPriorityUserList(uidListVec, vNum,(agora::rtc::STREAM_FALLBACK_OPTIONS)option); + + delete[] uidListVec; + + return ret; +} + +int UAgoraBPuRtcEngine::EnableLoopbackRecording(bool enabled, const FString& deviceName) +{ + return AgoraUERtcEngine::Get()->enableLoopbackRecording(enabled, TCHAR_TO_UTF8(*deviceName)); +} + +int UAgoraBPuRtcEngine::AdjustLoopbackSignalVolume(int volume) +{ + return AgoraUERtcEngine::Get()->adjustLoopbackSignalVolume(volume); +} + +int UAgoraBPuRtcEngine::GetLoopbackRecordingVolume() +{ + return AgoraUERtcEngine::Get()->getLoopbackRecordingVolume(); +} + +int UAgoraBPuRtcEngine::EnableInEarMonitoring(bool enabled, int includeAudioFilters) +{ + return AgoraUERtcEngine::Get()->enableInEarMonitoring(enabled, includeAudioFilters); +} + +int UAgoraBPuRtcEngine::SetInEarMonitoringVolume(int volume) +{ + return AgoraUERtcEngine::Get()->setInEarMonitoringVolume(volume); +} + +int UAgoraBPuRtcEngine::LoadExtensionProvider(const FString& path, bool unload_after_use) +{ + int ret = AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); + +#if defined (_WIN32) || defined(__linux__) || defined(__ANDROID__) + ret = AgoraUERtcEngine::Get()->loadExtensionProvider(TCHAR_TO_UTF8(*path), unload_after_use); +#endif + return ret; +} + +int UAgoraBPuRtcEngine::SetExtensionProviderProperty(const FString& provider, const FString& key, const FString& value) +{ + std::string Provider = TCHAR_TO_UTF8(*provider); + std::string Key = TCHAR_TO_UTF8(*key); + std::string Value = TCHAR_TO_UTF8(*value); + auto ret = AgoraUERtcEngine::Get()->setExtensionProviderProperty(Provider.c_str(), Key.c_str(), Value.c_str()); + return ret; +} + +int UAgoraBPuRtcEngine::EnableExtension(const FString& provider, const FString& extension, bool enable /*= true*/, EMEDIA_SOURCE_TYPE type /*= EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE*/) +{ + std::string Provider = TCHAR_TO_UTF8(*provider); + std::string Extension = TCHAR_TO_UTF8(*extension); + auto ret = AgoraUERtcEngine::Get()->enableExtension(Provider.c_str(), Extension.c_str(), enable, (agora::media::MEDIA_SOURCE_TYPE)type); + return ret; +} + +int UAgoraBPuRtcEngine::SetExtensionProperty(const FString& provider, const FString& extension, const FString& key, const FString& value, EMEDIA_SOURCE_TYPE type /*= EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE*/) +{ + std::string Provider = TCHAR_TO_UTF8(*provider); + std::string Extension = TCHAR_TO_UTF8(*extension); + std::string Key = TCHAR_TO_UTF8(*key); + std::string Value = TCHAR_TO_UTF8(*value); + auto ret = AgoraUERtcEngine::Get()->setExtensionProperty(Provider.c_str(), Extension.c_str(), Key.c_str(), Value.c_str(), (agora::media::MEDIA_SOURCE_TYPE)type); + return ret; +} + +int UAgoraBPuRtcEngine::GetExtensionProperty(const FString& provider, const FString& extension, const FExtensionInfo& ExtensionInfo, const FString& key, FString& value) +{ + std::string Provider = TCHAR_TO_UTF8(*provider); + std::string Extension = TCHAR_TO_UTF8(*extension); + std::string Key = TCHAR_TO_UTF8(*key); + + agora::rtc::ExtensionInfo vextensionInfo = ExtensionInfo.CreateAgoraData(); + + int BufLen = 512; + char* ValPtr = new char[BufLen]; + + auto ret = AgoraUERtcEngine::Get()->getExtensionProperty(Provider.c_str(), Extension.c_str(), vextensionInfo, Key.c_str(), ValPtr, BufLen); + + value = UTF8_TO_TCHAR(ValPtr); + delete[] ValPtr; + + ExtensionInfo.FreeAgoraData(vextensionInfo); + + return ret; +} + +int UAgoraBPuRtcEngine::SetCameraCapturerConfiguration(const FCameraCapturerConfiguration& config) +{ + agora::rtc::CameraCapturerConfiguration cameraCapturerConfiguration = config.CreateAgoraData(); + + int ret = AgoraUERtcEngine::Get()->setCameraCapturerConfiguration(cameraCapturerConfiguration); + + config.FreeAgoraData(cameraCapturerConfiguration); + + return ret; +} + +int64 UAgoraBPuRtcEngine::CreateCustomVideoTrack() +{ + return AgoraUERtcEngine::Get()->createCustomVideoTrack(); +} + +int64 UAgoraBPuRtcEngine::CreateCustomEncodedVideoTrack(const FSenderOptions& sender_option) +{ + agora::rtc::SenderOptions senderOptions = sender_option.CreateAgoraData(); + + int64 ret = AgoraUERtcEngine::Get()->createCustomEncodedVideoTrack(senderOptions); + + sender_option.FreeAgoraData(senderOptions); + + return ret; +} + +int UAgoraBPuRtcEngine::DestroyCustomVideoTrack(int64 video_track_id) +{ + auto ret = AgoraUERtcEngine::Get()->destroyCustomVideoTrack(UABT::ToVTID(video_track_id)); + + return ret; +} + +int UAgoraBPuRtcEngine::DestroyCustomEncodedVideoTrack(int64 video_track_id) +{ + auto ret = AgoraUERtcEngine::Get()->destroyCustomEncodedVideoTrack(UABT::ToVTID(video_track_id)); + + return ret; +} + +int UAgoraBPuRtcEngine::SwitchCamera() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->switchCamera(); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +bool UAgoraBPuRtcEngine::IsCameraZoomSupported() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->isCameraZoomSupported(); + return ret; +#else + return false; +#endif +} +bool UAgoraBPuRtcEngine::IsCameraFaceDetectSupported() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->isCameraFaceDetectSupported(); + return ret; +#else + return false; +#endif +} +bool UAgoraBPuRtcEngine::IsCameraTorchSupported() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->isCameraTorchSupported(); + return ret; +#else + return false; +#endif +} +bool UAgoraBPuRtcEngine::IsCameraFocusSupported() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->isCameraFocusSupported(); + return ret; +#else + return false; +#endif +} +bool UAgoraBPuRtcEngine::IsCameraAutoFocusFaceModeSupported() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->isCameraAutoFocusFaceModeSupported(); + return ret; +#else + return false; +#endif +} +int UAgoraBPuRtcEngine::SetCameraZoomFactor(float factor) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->setCameraZoomFactor(factor); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +int UAgoraBPuRtcEngine::EnableFaceDetection(bool enabled) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->enableFaceDetection(enabled); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +float UAgoraBPuRtcEngine::GetCameraMaxZoomFactor() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->getCameraMaxZoomFactor(); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +int UAgoraBPuRtcEngine::SetCameraFocusPositionInPreview(float positionX, float positionY) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->setCameraFocusPositionInPreview(positionX, positionY); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +int UAgoraBPuRtcEngine::SetCameraTorchOn(bool isOn) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->setCameraTorchOn(isOn); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +int UAgoraBPuRtcEngine::SetCameraAutoFocusFaceModeEnabled(bool enabled) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->setCameraAutoFocusFaceModeEnabled(enabled); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +bool UAgoraBPuRtcEngine::IsCameraExposurePositionSupported() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->isCameraExposurePositionSupported(); + return ret; +#else + return false; +#endif +} +int UAgoraBPuRtcEngine::SetCameraExposurePosition(float positionXinView, float positionYinView) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->setCameraExposurePosition(positionXinView, positionYinView); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + + +bool UAgoraBPuRtcEngine::IsCameraExposureSupported() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->isCameraExposureSupported(); + return ret; +#else + return false; +#endif +} + + +int UAgoraBPuRtcEngine::SetCameraExposureFactor(float factor) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->setCameraExposureFactor(factor); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +bool UAgoraBPuRtcEngine::IsCameraAutoExposureFaceModeSupported() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) +#if defined(__APPLE__) + auto ret= AgoraUERtcEngine::Get()->isCameraAutoExposureFaceModeSupported(); + return ret; +#else + return false; +#endif +#endif + return false; +} +int UAgoraBPuRtcEngine::SetCameraAutoExposureFaceModeEnabled(bool enabled) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) +#if defined(__APPLE__) + auto ret = AgoraUERtcEngine::Get()->setCameraAutoExposureFaceModeEnabled(enabled); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +#endif + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +} + +int UAgoraBPuRtcEngine::SetCameraStabilizationMode(FENUMWRAP_CAMERA_STABILIZATION_MODE mode) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) +#if defined(__APPLE__) + auto ret = AgoraUERtcEngine::Get()->setCameraStabilizationMode(mode.GetRawValue()); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +#endif + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +} + +int UAgoraBPuRtcEngine::SetDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker) +{ +#if defined(__ANDROID__) + auto ret = AgoraUERtcEngine::Get()->setDefaultAudioRouteToSpeakerphone(defaultToSpeaker); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +int UAgoraBPuRtcEngine::SetEnableSpeakerphone(bool speakerOn) +{ +#if defined(__ANDROID__) + auto ret = AgoraUERtcEngine::Get()->setEnableSpeakerphone(speakerOn); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +bool UAgoraBPuRtcEngine::IsSpeakerphoneEnabled() +{ +#if defined(__ANDROID__) + auto ret = AgoraUERtcEngine::Get()->isSpeakerphoneEnabled(); + return ret; +#else + return false; +#endif +} + + +int UAgoraBPuRtcEngine::SetRouteInCommunicationMode(int route) +{ +#if defined(__ANDROID__) + auto ret = AgoraUERtcEngine::Get()->setRouteInCommunicationMode(route); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::QueryCameraFocalLengthCapability(const TArray& focalLengthInfos) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + + int TotalSize = focalLengthInfos.Num(); + agora::rtc::FocalLengthInfo* focalLengthInfo = nullptr; + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(focalLengthInfo, agora::rtc::FocalLengthInfo, TotalSize, focalLengthInfos) + auto ret = AgoraUERtcEngine::Get()->queryCameraFocalLengthCapability(focalLengthInfo, TotalSize); + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(focalLengthInfo, TotalSize, FFocalLengthInfo) + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::SetScreenCaptureScenario(ESCREEN_SCENARIO_TYPE screenScenario) +{ +#if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) + auto ret = AgoraUERtcEngine::Get()->setScreenCaptureScenario((agora::rtc::SCREEN_SCENARIO_TYPE)screenScenario); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::UpdateScreenCapture(const FScreenCaptureParameters2& captureParams) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + agora::rtc::ScreenCaptureParameters2 screenCaptureParameters2 = captureParams.CreateAgoraData(); + int ret = AgoraUERtcEngine::Get()->updateScreenCapture(screenCaptureParameters2); + captureParams.FreeAgoraData(screenCaptureParameters2); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +int UAgoraBPuRtcEngine::StopScreenCapture() +{ +#if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) + auto ret = AgoraUERtcEngine::Get()->stopScreenCapture(); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::GetCallId(FString& callId) +{ + agora::util::AString agoraStr; + + auto ret = AgoraUERtcEngine::Get()->getCallId(agoraStr); + + callId = UTF8_TO_TCHAR(agoraStr->c_str()); + + return ret; +} +int UAgoraBPuRtcEngine::Rate(const FString& callId, int rating, const FString& description) +{ + std::string CallId = TCHAR_TO_UTF8(*callId); + auto ret = AgoraUERtcEngine::Get()->rate(CallId.c_str(), rating, TCHAR_TO_UTF8(*description)); + return ret; +} +int UAgoraBPuRtcEngine::Complain(const FString& callId, const FString& description) +{ + std::string CallId = TCHAR_TO_UTF8(*callId); + std::string Description = TCHAR_TO_UTF8(*description); + auto ret = AgoraUERtcEngine::Get()->complain(CallId.c_str(), Description.c_str()); + return ret; +} +int UAgoraBPuRtcEngine::StartRtmpStreamWithoutTranscoding(const FString& url) +{ + std::string Url = TCHAR_TO_UTF8(*url); + + auto ret = AgoraUERtcEngine::Get()->startRtmpStreamWithoutTranscoding(Url.c_str()); + return ret; +} +int UAgoraBPuRtcEngine::StartRtmpStreamWithTranscoding(const FString& url, const FLiveTranscoding& transcoding) +{ + agora::rtc::LiveTranscoding liveTranscoding = transcoding.CreateAgoraData(); + std::string TempUrl = TCHAR_TO_UTF8(*url); + auto ret = AgoraUERtcEngine::Get()->startRtmpStreamWithTranscoding(TempUrl.c_str(), liveTranscoding); + transcoding.FreeAgoraData(liveTranscoding); + return ret; +} +int UAgoraBPuRtcEngine::UpdateRtmpTranscoding(const FLiveTranscoding& transcoding) +{ + agora::rtc::LiveTranscoding liveTranscoding = transcoding.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->updateRtmpTranscoding(liveTranscoding); + transcoding.FreeAgoraData(liveTranscoding); + + return ret; +} +int UAgoraBPuRtcEngine::StopRtmpStream(const FString& url) +{ + auto ret = AgoraUERtcEngine::Get()->stopRtmpStream(TCHAR_TO_UTF8(*url)); + return ret; +} + +int UAgoraBPuRtcEngine::StartCameraCapture(EVIDEO_SOURCE_TYPE sourceType, const FCameraCapturerConfiguration& config) +{ + agora::rtc::CameraCapturerConfiguration cameraCapturerConfiguration = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startCameraCapture((agora::rtc::VIDEO_SOURCE_TYPE)sourceType, cameraCapturerConfiguration); + + config.FreeAgoraData(cameraCapturerConfiguration); + return ret; +} + + +int UAgoraBPuRtcEngine::StopCameraCapture(EVIDEO_SOURCE_TYPE sourceType) +{ + auto ret = AgoraUERtcEngine::Get()->stopCameraCapture((agora::rtc::VIDEO_SOURCE_TYPE)sourceType); + return ret; +} + +int UAgoraBPuRtcEngine::StartLocalVideoTranscoder(const FLocalTranscoderConfiguration& config) +{ + agora::rtc::LocalTranscoderConfiguration AgoraLocalTranscoderConfiguration = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startLocalVideoTranscoder(AgoraLocalTranscoderConfiguration); + config.FreeAgoraData(AgoraLocalTranscoderConfiguration); + return ret; +} +int UAgoraBPuRtcEngine::UpdateLocalTranscoderConfiguration(const FLocalTranscoderConfiguration& config) +{ + agora::rtc::LocalTranscoderConfiguration AgoraLocalTranscoderConfiguration = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->updateLocalTranscoderConfiguration(AgoraLocalTranscoderConfiguration); + config.FreeAgoraData(AgoraLocalTranscoderConfiguration); + return ret; +} +int UAgoraBPuRtcEngine::StopLocalVideoTranscoder() +{ + auto ret = AgoraUERtcEngine::Get()->stopLocalVideoTranscoder(); + return ret; +} + +int UAgoraBPuRtcEngine::SetCameraDeviceOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation) +{ + auto ret = AgoraUERtcEngine::Get()->setCameraDeviceOrientation((agora::rtc::VIDEO_SOURCE_TYPE)type, orientation.GetRawValue()); + return ret; +} +int UAgoraBPuRtcEngine::SetScreenCaptureOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation) +{ + auto ret = AgoraUERtcEngine::Get()->setScreenCaptureOrientation((agora::rtc::VIDEO_SOURCE_TYPE)type, orientation.GetRawValue()); + return ret; +} + +ECONNECTION_STATE_TYPE UAgoraBPuRtcEngine::GetConnectionState() +{ + return (ECONNECTION_STATE_TYPE)AgoraUERtcEngine::Get()->getConnectionState(); +} + + +int UAgoraBPuRtcEngine::SetRemoteUserPriority(int64 uid, EPRIORITY_TYPE userPriority) +{ + auto ret = AgoraUERtcEngine::Get()->setRemoteUserPriority(uid, (agora::rtc::PRIORITY_TYPE)userPriority); + return ret; +} + +int UAgoraBPuRtcEngine::EnableEncryption(bool enabled, const FEncryptionConfig& config) +{ + agora::rtc::EncryptionConfig AgoraEncryptionConfig = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->enableEncryption(enabled, AgoraEncryptionConfig); + config.FreeAgoraData(AgoraEncryptionConfig); + return ret; +} +int UAgoraBPuRtcEngine::CreateDataStream(int& streamId, const FDataStreamConfig& config) +{ + agora::rtc::DataStreamConfig dataStreamConfig = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->createDataStream(&streamId, dataStreamConfig); + config.FreeAgoraData(dataStreamConfig); + return ret; +} +int UAgoraBPuRtcEngine::SendStreamMessage(int streamId, const FString& data) +{ + std::string StdStrData = TCHAR_TO_UTF8(*data); + const char* Data = StdStrData.c_str(); + + auto ret = AgoraUERtcEngine::Get()->sendStreamMessage(streamId, Data, strlen(Data) + 1); + return ret; +} +int UAgoraBPuRtcEngine::AddVideoWatermark(const FString& watermarkUrl, const FWatermarkOptions& options) +{ + std::string STDWatermarkUrl = TCHAR_TO_UTF8(*watermarkUrl); + agora::rtc::WatermarkOptions watermarkOptions = options.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->addVideoWatermark(STDWatermarkUrl.c_str(), watermarkOptions); + options.FreeAgoraData(watermarkOptions); + return ret; +} + +int UAgoraBPuRtcEngine::ClearVideoWatermarks() +{ + auto ret = AgoraUERtcEngine::Get()->clearVideoWatermarks(); + return ret; +} + +int UAgoraBPuRtcEngine::PauseAudio() +{ + auto ret = AgoraUERtcEngine::Get()->pauseAudio(); + return ret; +} +int UAgoraBPuRtcEngine::ResumeAudio() +{ + auto ret = AgoraUERtcEngine::Get()->resumeAudio(); + return ret; +} +int UAgoraBPuRtcEngine::EnableWebSdkInteroperability(bool enabled) +{ + auto ret = AgoraUERtcEngine::Get()->enableWebSdkInteroperability(enabled); + return ret; +} +int UAgoraBPuRtcEngine::SendCustomReportMessage(const FString& id, const FString& category, const FString& event, const FString& label, int value) +{ + std::string Id = TCHAR_TO_UTF8(*id); + std::string Category = TCHAR_TO_UTF8(*category); + std::string Event = TCHAR_TO_UTF8(*event); + std::string Label = TCHAR_TO_UTF8(*label); + auto ret = AgoraUERtcEngine::Get()->sendCustomReportMessage(Id.c_str(), Category.c_str(), Event.c_str(), Label.c_str(), value); + return ret; +} + +int UAgoraBPuRtcEngine::StartAudioFrameDump(const FString& channel_id, int64 uid, const FString& location, const FString& uuid, const FString& passwd, int64 duration_ms, bool auto_upload) +{ + std::string Channel_id = TCHAR_TO_UTF8(*channel_id); + std::string Location = TCHAR_TO_UTF8(*location); + std::string Uuid = TCHAR_TO_UTF8(*uuid); + std::string Passwd = TCHAR_TO_UTF8(*passwd); + auto ret = AgoraUERtcEngine::Get()->startAudioFrameDump(Channel_id.c_str(), uid, Location.c_str(), Uuid.c_str(), Passwd.c_str(), duration_ms, auto_upload); + return ret; +} + + +int UAgoraBPuRtcEngine::StopAudioFrameDump(const FString& channel_id, int64 uid, const FString& location) +{ + std::string Channel_id = TCHAR_TO_UTF8(*channel_id); + std::string Location = TCHAR_TO_UTF8(*location); + auto ret = AgoraUERtcEngine::Get()->stopAudioFrameDump(Channel_id.c_str(), uid, Location.c_str()); + return ret; +} + +int UAgoraBPuRtcEngine::SetAINSMode(bool enabled, EAUDIO_AINS_MODE mode) +{ + auto ret = AgoraUERtcEngine::Get()->setAINSMode(enabled, (agora::rtc::AUDIO_AINS_MODE)mode); + return ret; +} + +int UAgoraBPuRtcEngine::RegisterLocalUserAccount(const FString& appId, const FString& userAccount) +{ + std::string AppId = TCHAR_TO_UTF8(*appId); + std::string UserAccount = TCHAR_TO_UTF8(*userAccount); + auto ret = AgoraUERtcEngine::Get()->registerLocalUserAccount(AppId.c_str(), UserAccount.c_str()); + return ret; +} +int UAgoraBPuRtcEngine::JoinChannelWithUserAccount(const FString& token, const FString& channelId, const FString& userAccount, const FChannelMediaOptions& options) +{ + agora::rtc::ChannelMediaOptions channelMediaOptions = options.CreateAgoraData(); + std::string Token = TCHAR_TO_UTF8(*token); + std::string ChannelId = TCHAR_TO_UTF8(*channelId); + std::string UserAccount = TCHAR_TO_UTF8(*userAccount); + auto ret = AgoraUERtcEngine::Get()->joinChannelWithUserAccount(Token.c_str(), ChannelId.c_str(), UserAccount.c_str(), channelMediaOptions); + options.FreeAgoraData(channelMediaOptions); + return ret; +} + +int UAgoraBPuRtcEngine::JoinChannelWithUserAccountEx(const FString& token, const FString& channelId, const FString& userAccount, const FChannelMediaOptions& options) +{ + agora::rtc::ChannelMediaOptions channelMediaOptions = options.CreateAgoraData(); + std::string Token = TCHAR_TO_UTF8(*token); + std::string ChannelId = TCHAR_TO_UTF8(*channelId); + std::string UserAccount = TCHAR_TO_UTF8(*userAccount); + auto ret = AgoraUERtcEngine::Get()->joinChannelWithUserAccountEx(Token.c_str(), ChannelId.c_str(), UserAccount.c_str(), channelMediaOptions, nullptr); + options.FreeAgoraData(channelMediaOptions); + return ret; +} +int UAgoraBPuRtcEngine::GetUserInfoByUserAccount(const FString& userAccount,FUserInfo& userInfo) +{ + agora::rtc::UserInfo info; + std::string UserAccount = TCHAR_TO_UTF8(*userAccount); + auto ret = AgoraUERtcEngine::Get()->getUserInfoByUserAccount(UserAccount.c_str(), &info); + userInfo = info; + return ret; +} +int UAgoraBPuRtcEngine::GetUserInfoByUid(int64 uid, FUserInfo& userInfo) +{ + agora::rtc::UserInfo info; + auto ret = AgoraUERtcEngine::Get()->getUserInfoByUid(uid, &info); + userInfo = info; + return ret; +} + + +int UAgoraBPuRtcEngine::StartOrUpdateChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration) +{ + agora::rtc::ChannelMediaRelayConfiguration channelMediaRelayConfiguration = configuration.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startOrUpdateChannelMediaRelay(channelMediaRelayConfiguration); + configuration.FreeAgoraData(channelMediaRelayConfiguration); + return ret; +} + + +int UAgoraBPuRtcEngine::StartOrUpdateChannelMediaRelayEx(const FChannelMediaRelayConfiguration& configuration, const FRtcConnection& connection) +{ + agora::rtc::ChannelMediaRelayConfiguration channelMediaRelayConfiguration = configuration.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startOrUpdateChannelMediaRelayEx(channelMediaRelayConfiguration, rtcConnection); + configuration.FreeAgoraData(channelMediaRelayConfiguration); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::StopChannelMediaRelay() +{ + auto ret = AgoraUERtcEngine::Get()->stopChannelMediaRelay(); + return ret; +} +int UAgoraBPuRtcEngine::PauseAllChannelMediaRelay() +{ + auto ret = AgoraUERtcEngine::Get()->pauseAllChannelMediaRelay(); + return ret; +} +int UAgoraBPuRtcEngine::ResumeAllChannelMediaRelay() +{ + auto ret = AgoraUERtcEngine::Get()->resumeAllChannelMediaRelay(); + return ret; +} +int UAgoraBPuRtcEngine::SetDirectCdnStreamingAudioConfiguration(EAUDIO_PROFILE_TYPE profile) +{ + auto ret = AgoraUERtcEngine::Get()->setDirectCdnStreamingAudioConfiguration((agora::rtc::AUDIO_PROFILE_TYPE)profile); + return ret; +} +int UAgoraBPuRtcEngine::SetDirectCdnStreamingVideoConfiguration(const FVideoEncoderConfiguration& config) +{ + agora::rtc::VideoEncoderConfiguration videoEncoderConfiguration = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setDirectCdnStreamingVideoConfiguration(videoEncoderConfiguration); + config.FreeAgoraData(videoEncoderConfiguration); + return ret; +} + +int UAgoraBPuRtcEngine::StartRhythmPlayer(const FString& sound1, const FString& sound2, const FAgoraRhythmPlayerConfig& config) +{ + agora::rtc::AgoraRhythmPlayerConfig agoraRhythmPlayerConfig = config.CreateAgoraData(); + std::string Sound1 = TCHAR_TO_UTF8(*sound1); + std::string Sound2 = TCHAR_TO_UTF8(*sound2); + auto ret = AgoraUERtcEngine::Get()->startRhythmPlayer(Sound1.c_str(), Sound1.c_str(), agoraRhythmPlayerConfig); + config.FreeAgoraData(agoraRhythmPlayerConfig); + return ret; +} +int UAgoraBPuRtcEngine::StopRhythmPlayer() +{ + auto ret = AgoraUERtcEngine::Get()->stopRhythmPlayer(); + return ret; +} +int UAgoraBPuRtcEngine::ConfigRhythmPlayer(const FAgoraRhythmPlayerConfig& config) +{ + agora::rtc::AgoraRhythmPlayerConfig agoraRhythmPlayerConfig = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->configRhythmPlayer(agoraRhythmPlayerConfig); + config.FreeAgoraData(agoraRhythmPlayerConfig); + return ret; +} +int UAgoraBPuRtcEngine::TakeSnapshot(int64 uid, const FString& filePath) +{ + std::string Filepath = TCHAR_TO_UTF8(*filePath); + + auto ret = AgoraUERtcEngine::Get()->takeSnapshot(uid, Filepath.c_str()); + return ret; +} +int UAgoraBPuRtcEngine::EnableContentInspect(bool enabled, const FContentInspectConfig& config) +{ + agora::media::ContentInspectConfig contentInspectConfig = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->enableContentInspect(enabled, contentInspectConfig); + config.FreeAgoraData(contentInspectConfig); + return ret; +} + +int UAgoraBPuRtcEngine::AdjustCustomAudioPublishVolume(int64 trackId, int volume) +{ + auto ret = AgoraUERtcEngine::Get()->adjustCustomAudioPublishVolume(trackId, volume); + return ret; +} + + +int UAgoraBPuRtcEngine::AdjustCustomAudioPlayoutVolume(int64 trackId, int volume) +{ + auto ret = AgoraUERtcEngine::Get()->adjustCustomAudioPlayoutVolume(trackId, volume); + return ret; +} + +int UAgoraBPuRtcEngine::SetCloudProxy(ECLOUD_PROXY_TYPE proxyType) +{ + auto ret = AgoraUERtcEngine::Get()->setCloudProxy((agora::rtc::CLOUD_PROXY_TYPE)proxyType); + return ret; +} +int UAgoraBPuRtcEngine::SetLocalAccessPoint(const FLocalAccessPointConfiguration& config) +{ + agora::rtc::LocalAccessPointConfiguration AgoraLocalAccessPointConfiguration = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setLocalAccessPoint(AgoraLocalAccessPointConfiguration); + config.FreeAgoraData(AgoraLocalAccessPointConfiguration); + return ret; +} +int UAgoraBPuRtcEngine::SetAdvancedAudioOptions(const FAdvancedAudioOptions& options) +{ + agora::rtc::AdvancedAudioOptions advancedAudioOptions = options.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setAdvancedAudioOptions(advancedAudioOptions); + options.FreeAgoraData(advancedAudioOptions); + return ret; +} +int UAgoraBPuRtcEngine::SetAVSyncSource(const FString& channelId, int64 uid) +{ + std::string ChannelId = TCHAR_TO_UTF8(*channelId); + auto ret = AgoraUERtcEngine::Get()->setAVSyncSource(ChannelId.c_str(), uid); + return ret; +} +int UAgoraBPuRtcEngine::EnableVideoImageSource(bool enable, const FImageTrackOptions& options) +{ + agora::rtc::ImageTrackOptions imageTrackOptions = options.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->enableVideoImageSource(enable, imageTrackOptions); + options.FreeAgoraData(imageTrackOptions); + return ret; +} +int UAgoraBPuRtcEngine::JoinChannelEx(const FString& token, const FRtcConnection& connection, const FChannelMediaOptions& options) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + agora::rtc::ChannelMediaOptions channelMediaOptions = options.CreateAgoraData(); + std::string Token = TCHAR_TO_UTF8(*token); + + auto ret = AgoraUERtcEngine::Get()->joinChannelEx(Token.c_str(), rtcConnection, channelMediaOptions, nullptr); + + connection.FreeAgoraData(rtcConnection); + options.FreeAgoraData(channelMediaOptions); + return ret; +} + + +int UAgoraBPuRtcEngine::LeaveChannelEx(const FRtcConnection& connection, const FLeaveChannelOptions& options) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + + agora::rtc::LeaveChannelOptions AgoraLeaveChannelOptions = options.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->leaveChannelEx(rtcConnection, AgoraLeaveChannelOptions); + connection.FreeAgoraData(rtcConnection); + options.FreeAgoraData(AgoraLeaveChannelOptions); + return ret; +} + +int UAgoraBPuRtcEngine::UpdateChannelMediaOptionsEx(const FChannelMediaOptions& options, const FRtcConnection& connection) +{ + agora::rtc::ChannelMediaOptions channelMediaOptions = options.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->updateChannelMediaOptionsEx(channelMediaOptions, rtcConnection); + + options.FreeAgoraData(channelMediaOptions); + connection.FreeAgoraData(rtcConnection); + + return ret; +} +int UAgoraBPuRtcEngine::SetVideoEncoderConfigurationEx(const FVideoEncoderConfiguration& config, const FRtcConnection& connection) +{ + agora::rtc::VideoEncoderConfiguration videoEncoderConfiguration = config.CreateAgoraData(); + + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setVideoEncoderConfigurationEx(videoEncoderConfiguration, rtcConnection); + + config.FreeAgoraData(videoEncoderConfiguration); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::MuteRemoteAudioStreamEx(int64 uid, bool mute, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->muteRemoteAudioStreamEx(uid, mute, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::MuteRemoteVideoStreamEx(int64 uid, bool mute, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->muteRemoteVideoStreamEx(uid, mute, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::SetRemoteVideoStreamTypeEx(int64 uid, EVIDEO_STREAM_TYPE streamType, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setRemoteVideoStreamTypeEx(uid, (agora::rtc::VIDEO_STREAM_TYPE)streamType, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::SetRemoteVideoSubscriptionOptionsEx(int64 uid, const FVideoSubscriptionOptions& options, const FRtcConnection& connection) +{ + agora::rtc::VideoSubscriptionOptions videoSubscriptionOptions = options.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setRemoteVideoSubscriptionOptionsEx(uid, videoSubscriptionOptions, rtcConnection); + options.FreeAgoraData(videoSubscriptionOptions); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::SetRemoteVoicePositionEx(int64 uid, float pan, float gain, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setRemoteVoicePositionEx(uid, pan, gain, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::SetRemoteUserSpatialAudioParamsEx(int64 uid, const FSpatialAudioParams& params, const FRtcConnection& connection) +{ + agora::SpatialAudioParams spatialAudioParams = params.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setRemoteUserSpatialAudioParamsEx(uid, spatialAudioParams, rtcConnection); + params.FreeAgoraData(spatialAudioParams); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::SetRemoteRenderModeEx(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setRemoteRenderModeEx(uid, (agora::media::base::RENDER_MODE_TYPE)renderMode, (agora::rtc::VIDEO_MIRROR_MODE_TYPE)mirrorMode, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::EnableLoopbackRecordingEx(const FRtcConnection& connection, bool enabled, const FString& deviceName) +{ + std::string STDDeviceName = TCHAR_TO_UTF8(*deviceName); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->enableLoopbackRecordingEx(rtcConnection, enabled, STDDeviceName.c_str()); + connection.FreeAgoraData(rtcConnection); + return ret; +} +ECONNECTION_STATE_TYPE UAgoraBPuRtcEngine::GetConnectionStateEx(const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = (ECONNECTION_STATE_TYPE)AgoraUERtcEngine::Get()->getConnectionStateEx(rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::EnableEncryptionEx(const FRtcConnection& connection, bool enabled, const FEncryptionConfig& config) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + agora::rtc::EncryptionConfig AgoraEncryptionConfig = config.CreateAgoraData(); + + auto ret = AgoraUERtcEngine::Get()->enableEncryptionEx(rtcConnection, enabled, AgoraEncryptionConfig); + + connection.FreeAgoraData(rtcConnection); + config.FreeAgoraData(AgoraEncryptionConfig); + + return ret; +} + +int UAgoraBPuRtcEngine::CreateDataStreamEx(int& streamId, const FDataStreamConfig& config, const FRtcConnection& connection) +{ + agora::rtc::DataStreamConfig dataStreamConfig = config.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->createDataStreamEx(&streamId, dataStreamConfig, rtcConnection); + config.FreeAgoraData(dataStreamConfig); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::SendStreamMessageEx(int streamId, const FString& data, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string StdStrData = TCHAR_TO_UTF8(*data); + auto ret = AgoraUERtcEngine::Get()->sendStreamMessageEx(streamId, StdStrData.c_str(), StdStrData.size(), rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::AddVideoWatermarkEx(const FString& watermarkUrl, const FWatermarkOptions& options, const FRtcConnection& connection) +{ + agora::rtc::WatermarkOptions watermarkOptions = options.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string STDSWatermarkUrl = TCHAR_TO_UTF8(*watermarkUrl); + auto ret = AgoraUERtcEngine::Get()->addVideoWatermarkEx(STDSWatermarkUrl.c_str(), watermarkOptions, rtcConnection); + options.FreeAgoraData(watermarkOptions); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::ClearVideoWatermarkEx(const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->clearVideoWatermarkEx(rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::SendCustomReportMessageEx(const FString& id, const FString& category, const FString& event, const FString& label, int value, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string STDID = TCHAR_TO_UTF8(*id); + std::string STDCategory = TCHAR_TO_UTF8(*category); + std::string STDEvent = TCHAR_TO_UTF8(*event); + std::string STDLabel = TCHAR_TO_UTF8(*label); + auto ret = AgoraUERtcEngine::Get()->sendCustomReportMessageEx(STDID.c_str(), STDCategory.c_str(), STDEvent.c_str(), STDLabel.c_str(), value, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::EnableAudioVolumeIndicationEx(int interval, int smooth, bool reportVad, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->enableAudioVolumeIndicationEx(interval, smooth, reportVad, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::GetUserInfoByUserAccountEx(const FString& userAccount, FUserInfo& userInfo, const FRtcConnection& connection) +{ + agora::rtc::UserInfo info; + + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->getUserInfoByUserAccountEx(TCHAR_TO_UTF8(*userAccount), &info, rtcConnection); + + userInfo = info; + + connection.FreeAgoraData(rtcConnection); + + return ret; +} +int UAgoraBPuRtcEngine::GetUserInfoByUidEx(int64 uid, FUserInfo& userInfo, const FRtcConnection& connection) +{ + agora::rtc::UserInfo info; + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + + auto ret = AgoraUERtcEngine::Get()->getUserInfoByUidEx(uid, &info, rtcConnection); + + userInfo = info; + connection.FreeAgoraData(rtcConnection); + + return ret; +} + +int UAgoraBPuRtcEngine::EnableDualStreamModeEx(bool enabled, const FSimulcastStreamConfig& streamConfig, const FRtcConnection& connection) +{ + agora::rtc::SimulcastStreamConfig simulcastStreamConfig = streamConfig.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->enableDualStreamModeEx(enabled, simulcastStreamConfig, rtcConnection); + streamConfig.FreeAgoraData(simulcastStreamConfig); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::SetDualStreamModeEx(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig, const FRtcConnection& connection) +{ + agora::rtc::SimulcastStreamConfig AgoraSimulcastStreamConfig = streamConfig.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->setDualStreamModeEx(mode.GetRawValue(), AgoraSimulcastStreamConfig, rtcConnection); + streamConfig.FreeAgoraData(AgoraSimulcastStreamConfig); + connection.FreeAgoraData(rtcConnection); + return ret; +} +int UAgoraBPuRtcEngine::EnableWirelessAccelerate(bool enabled) +{ + auto ret = AgoraUERtcEngine::Get()->enableWirelessAccelerate(enabled); + return ret; +} +int UAgoraBPuRtcEngine::TakeSnapshotEx(const FRtcConnection& connection, int64 uid, const FString& filePath) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string FilePath = TCHAR_TO_UTF8(*filePath); + auto ret = AgoraUERtcEngine::Get()->takeSnapshotEx(rtcConnection, uid, FilePath.c_str()); + connection.FreeAgoraData(rtcConnection); + return ret; +} + + +int UAgoraBPuRtcEngine::EnableContentInspectEx(bool enabled, const FContentInspectConfig& config, const FRtcConnection& connection) +{ + agora::media::ContentInspectConfig contentInspectConfig = config.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->enableContentInspectEx(enabled, contentInspectConfig, rtcConnection); + config.FreeAgoraData(contentInspectConfig); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::MuteLocalAudioStreamEx(bool mute, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->muteLocalAudioStreamEx(mute, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::MuteLocalVideoStreamEx(bool mute, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->muteLocalVideoStreamEx(mute, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::MuteAllRemoteAudioStreamsEx(bool mute, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->muteAllRemoteAudioStreamsEx(mute, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::MuteAllRemoteVideoStreamsEx(bool mute, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->muteAllRemoteVideoStreamsEx(mute, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + + +int UAgoraBPuRtcEngine::SetSubscribeAudioBlocklist(TArray uidList, int uidNumber) +{ + int UEuidNumber = uidList.Num(); + agora::rtc::uid_t* data = nullptr; + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(data, agora::rtc::uid_t, UEuidNumber, uidList) + auto ret = AgoraUERtcEngine::Get()->setSubscribeAudioBlocklist(data, UEuidNumber); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(data) + return ret; +} + +int UAgoraBPuRtcEngine::SetSubscribeAudioBlocklistEx(TArray uidList, int uidNumber, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + int UEuidNumber = uidList.Num(); + agora::rtc::uid_t* data = nullptr; + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(data, agora::rtc::uid_t, UEuidNumber, uidList) + auto ret = AgoraUERtcEngine::Get()->setSubscribeAudioBlocklistEx(data, UEuidNumber, rtcConnection); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(data) + connection.FreeAgoraData(rtcConnection); + return ret; +} + + +int UAgoraBPuRtcEngine::SetSubscribeAudioAllowlist(TArray uidList, int uidNumber) +{ + int UEuidNumber = uidList.Num(); + agora::rtc::uid_t* data = nullptr; + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(data, agora::rtc::uid_t, UEuidNumber, uidList) + auto ret = AgoraUERtcEngine::Get()->setSubscribeAudioAllowlist(data, UEuidNumber); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(data) + return ret; +} + +int UAgoraBPuRtcEngine::SetSubscribeAudioAllowlistEx(TArray uidList, int uidNumber, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + int UEuidNumber = uidList.Num(); + agora::rtc::uid_t* data = nullptr; + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(data, agora::rtc::uid_t, UEuidNumber, uidList) + auto ret = AgoraUERtcEngine::Get()->setSubscribeAudioAllowlistEx(data, UEuidNumber, rtcConnection); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(data) + connection.FreeAgoraData(rtcConnection); + return ret; +} + + +int UAgoraBPuRtcEngine::SetSubscribeVideoBlocklist(TArray uidList, int uidNumber) +{ + int UEuidNumber = uidList.Num(); + agora::rtc::uid_t* data = nullptr; + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(data, agora::rtc::uid_t, UEuidNumber, uidList) + auto ret = AgoraUERtcEngine::Get()->setSubscribeVideoBlocklist(data, UEuidNumber); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(data) + return ret; +} + +int UAgoraBPuRtcEngine::SetSubscribeVideoBlocklistEx(TArray uidList, int uidNumber, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + agora::rtc::uid_t* data = nullptr; + int UEuidNumber = uidList.Num(); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(data, agora::rtc::uid_t, UEuidNumber, uidList) + auto ret = AgoraUERtcEngine::Get()->setSubscribeVideoBlocklistEx(data, UEuidNumber, rtcConnection); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(data) + connection.FreeAgoraData(rtcConnection); + return ret; +} + + +int UAgoraBPuRtcEngine::SetSubscribeVideoAllowlist(TArray uidList, int uidNumber) +{ + agora::rtc::uid_t* data = nullptr; + int UEuidNumber = uidList.Num(); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(data, agora::rtc::uid_t, UEuidNumber, uidList) + auto ret = AgoraUERtcEngine::Get()->setSubscribeVideoAllowlist(data, UEuidNumber); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(data) + return ret; +} + +int UAgoraBPuRtcEngine::SetSubscribeVideoAllowlistEx(TArray uidList, int uidNumber, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + agora::rtc::uid_t* data = nullptr; + int UEuidNumber = uidList.Num(); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(data, agora::rtc::uid_t, UEuidNumber, uidList) + auto ret = AgoraUERtcEngine::Get()->setSubscribeVideoAllowlistEx(data, UEuidNumber, rtcConnection); + SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(data) + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::AdjustUserPlaybackSignalVolumeEx(int64 uid, int volume, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->adjustUserPlaybackSignalVolumeEx(uid, volume, rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::StartRtmpStreamWithoutTranscodingEx(const FString& url, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string Url = TCHAR_TO_UTF8(*url); + int ret = AgoraUERtcEngine::Get()->startRtmpStreamWithoutTranscodingEx(Url.c_str(), rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::StartRtmpStreamWithTranscodingEx(const FString& url, const FLiveTranscoding& transcoding, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string streamUrl = TCHAR_TO_UTF8(*url); + + agora::rtc::LiveTranscoding liveTranscoding = transcoding.CreateAgoraData(); + + auto ret = AgoraUERtcEngine::Get()->startRtmpStreamWithTranscodingEx(streamUrl.c_str(), liveTranscoding, rtcConnection); + + connection.FreeAgoraData(rtcConnection); + transcoding.FreeAgoraData(liveTranscoding); + + return ret; +} + +int UAgoraBPuRtcEngine::UpdateRtmpTranscodingEx(const FLiveTranscoding& transcoding, const FRtcConnection& connection) +{ + agora::rtc::LiveTranscoding liveTranscoding = transcoding.CreateAgoraData(); + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + + auto ret = AgoraUERtcEngine::Get()->updateRtmpTranscodingEx(liveTranscoding, rtcConnection); + + transcoding.FreeAgoraData(liveTranscoding); + connection.FreeAgoraData(rtcConnection); + + return ret; +} + +int UAgoraBPuRtcEngine::StopRtmpStreamEx(const FString& url, const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string Url = TCHAR_TO_UTF8(*url); + auto ret = AgoraUERtcEngine::Get()->startRtmpStreamWithoutTranscodingEx(Url.c_str(), rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::StopChannelMediaRelayEx(const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->stopChannelMediaRelayEx(rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::PauseAllChannelMediaRelayEx(const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->pauseAllChannelMediaRelayEx(rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::ResumeAllChannelMediaRelayEx(const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->resumeAllChannelMediaRelayEx(rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::SetParameters(const FString& parameters) +{ + std::string parameterstr = TCHAR_TO_UTF8(*parameters); + + auto ret = AgoraUERtcEngine::Get()->setParameters(parameterstr.c_str()); + return ret; +} + + +int UAgoraBPuRtcEngine::SetParametersEx(const FRtcConnection& connection, const FString& parameters) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string STDParameters = TCHAR_TO_UTF8(*parameters); + auto ret = AgoraUERtcEngine::Get()->setParametersEx(rtcConnection, STDParameters.c_str()); + connection.FreeAgoraData(rtcConnection); + return ret; +} + + +int UAgoraBPuRtcEngine::GetCallIdEx(FString& callId, const FRtcConnection& connection) +{ + agora::util::AString CallId; + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->getCallIdEx(CallId, rtcConnection); + connection.FreeAgoraData(rtcConnection); + + callId = UTF8_TO_TCHAR(CallId->c_str()); + return ret; +} + + +int UAgoraBPuRtcEngine::SendAudioMetadata(const FString& metadata, const FString& length) +{ + std::string AMetadata = TCHAR_TO_UTF8(*metadata); + size_t ALength = FCString::Strtoui64(*length, NULL, 10); + auto ret = AgoraUERtcEngine::Get()->sendAudioMetadata(AMetadata.c_str(), ALength); + return ret; +} + +int UAgoraBPuRtcEngine::SendAudioMetadataEx(const FRtcConnection& connection, const FString& metadata, const FString& length) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + std::string AgoraMetadata = TCHAR_TO_UTF8(*metadata); + size_t AgoraLength = FCString::Strtoui64(*length, NULL, 10); + auto ret = AgoraUERtcEngine::Get()->sendAudioMetadataEx(rtcConnection, AgoraMetadata.c_str(), AgoraLength); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::StartMediaRenderingTracing() +{ + auto ret = AgoraUERtcEngine::Get()->startMediaRenderingTracing(); + return ret; +} + + +int UAgoraBPuRtcEngine::StartMediaRenderingTracingEx(const FRtcConnection& connection) +{ + agora::rtc::RtcConnection rtcConnection = connection.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startMediaRenderingTracingEx(rtcConnection); + connection.FreeAgoraData(rtcConnection); + return ret; +} + +int UAgoraBPuRtcEngine::EnableInstantMediaRendering() +{ + auto ret = AgoraUERtcEngine::Get()->enableInstantMediaRendering(); + return ret; +} + + +FString UAgoraBPuRtcEngine::GetNtpWallTimeInMs() +{ + FString ret = FString::Printf(TEXT("%llu"), AgoraUERtcEngine::Get()->getNtpWallTimeInMs()); + return ret; +} + + +int UAgoraBPuRtcEngine::SetHeadphoneEQPreset(FENUMWRAP_HEADPHONE_EQUALIZER_PRESET preset) +{ + auto ret = AgoraUERtcEngine::Get()->setHeadphoneEQPreset(preset.GetRawValue()); + return ret; +} + + +int UAgoraBPuRtcEngine::SetHeadphoneEQParameters(int lowGain, int highGain) +{ + auto ret = AgoraUERtcEngine::Get()->setHeadphoneEQParameters(lowGain, highGain); + return ret; +} + + +int UAgoraBPuRtcEngine::SetEarMonitoringAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) +{ + auto ret = AgoraUERtcEngine::Get()->setEarMonitoringAudioFrameParameters(sampleRate, channel, (agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE)((int)mode), samplesPerCall); + return ret; +} + + +int64 UAgoraBPuRtcEngine::GetCurrentMonotonicTimeInMs() +{ + auto ret = AgoraUERtcEngine::Get()->getCurrentMonotonicTimeInMs(); + return ret; +} + + + +int UAgoraBPuRtcEngine::RegisterExtension(const FString& provider, const FString& extension, EMEDIA_SOURCE_TYPE type) +{ + std::string Provider = TCHAR_TO_UTF8(*provider); + std::string Extension = TCHAR_TO_UTF8(*extension); + auto ret = AgoraUERtcEngine::Get()->registerExtension(Provider.c_str(), Extension.c_str(), (agora::media::MEDIA_SOURCE_TYPE)type); + return ret; +} + + +int UAgoraBPuRtcEngine::GetNetworkType() +{ + auto ret = AgoraUERtcEngine::Get()->getNetworkType(); + return ret; +} + + +bool UAgoraBPuRtcEngine::IsFeatureAvailableOnDevice(EFeatureType type) +{ + auto ret = AgoraUERtcEngine::Get()->isFeatureAvailableOnDevice(static_cast(type)); + return ret; +} + +#pragma endregion RtcEngine2 + + +#pragma region Screen Share + + +int UIScreenCaptureSourceList::GetCount() +{ +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + if (sourceListNative != nullptr) + { + return sourceListNative->getCount(); + } +#endif + return 0; +} + +FScreenCaptureSourceInfo UIScreenCaptureSourceList::GetSourceInfo(int index) +{ + FScreenCaptureSourceInfo sourceInfo; +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + if (sourceListNative != nullptr) + { + agora::rtc::ScreenCaptureSourceInfo info = sourceListNative->getSourceInfo(index); + sourceInfo = info; + UE_LOG(LogTemp, Warning, TEXT("ScreenCaptureSourceType %d"), (int)info.type) + } +#endif + return sourceInfo; +} + +void UIScreenCaptureSourceList::Release() +{ +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + if (sourceListNative != nullptr) + { + sourceListNative->release(); + sourceListNative = nullptr; + } +#endif +} + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) +void UIScreenCaptureSourceList::SetScreenCaptureList(agora::rtc::IScreenCaptureSourceList* sourcelist) +{ + sourceListNative = sourcelist; +} +#endif + + +UIScreenCaptureSourceList* UAgoraBPuRtcEngine::GetScreenCaptureSources(const FSIZE& thumbSize, const FSIZE& iconSize, bool includeScreen) +{ + if (!UserScreenCaptureSourceList.IsValid()) { + UserScreenCaptureSourceList = TStrongObjectPtr(NewObject()); + } + +#if PLATFORM_WINDOWS + SIZE thumb; + thumb.cx = thumbSize.width; + thumb.cy = thumbSize.height; + + SIZE icon; + icon.cx = iconSize.width; + icon.cy = iconSize.height; + +#elif (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + agora::rtc::SIZE thumb; + thumb.width = thumbSize.width; + thumb.height = thumbSize.width; + + agora::rtc::SIZE icon; + icon.width = iconSize.width; + icon.height = iconSize.height; +#endif + + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + agora::rtc::IScreenCaptureSourceList* screenCaptureNative = AgoraUERtcEngine::Get()->getScreenCaptureSources(thumb, icon, includeScreen); + + if (screenCaptureNative != nullptr) + { + UserScreenCaptureSourceList->SetScreenCaptureList(screenCaptureNative); + return UserScreenCaptureSourceList.Get(); + } + +#endif + + return nullptr; +} + + +int UAgoraBPuRtcEngine::SetAudioSessionOperationRestriction(EAUDIO_SESSION_OPERATION_RESTRICTION restriction) +{ +#if (defined(__APPLE__) && TARGET_OS_IOS) + return AgoraUERtcEngine::Get()->setAudioSessionOperationRestriction((agora::AUDIO_SESSION_OPERATION_RESTRICTION)restriction); +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::StartScreenCaptureByDisplayId(int64 displayId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) +{ +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + agora::rtc::Rectangle region = regionRect.CreateAgoraData(); + + agora::rtc::ScreenCaptureParameters params = captureParams.CreateAgoraData(); + + auto ret = AgoraUERtcEngine::Get()->startScreenCaptureByDisplayId(displayId, region, params); + + regionRect.FreeAgoraData(region); + captureParams.FreeAgoraData(params); + + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::StartScreenCaptureByScreenRect(const FRectangle& screenRect, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) __deprecated +{ +#if defined(_WIN32) + agora::rtc::Rectangle AgoraScreenRect = screenRect.CreateAgoraData(); + agora::rtc::Rectangle AgoraRegionRect = regionRect.CreateAgoraData(); + agora::rtc::ScreenCaptureParameters AgoraScreenCaptureParameters = captureParams.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startScreenCaptureByScreenRect(AgoraScreenRect, AgoraRegionRect, AgoraScreenCaptureParameters); + screenRect.FreeAgoraData(AgoraScreenRect); + regionRect.FreeAgoraData(AgoraRegionRect); + captureParams.FreeAgoraData(AgoraScreenCaptureParameters); + + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::GetAudioDeviceInfo(FDeviceInfo& deviceInfo) +{ +#if defined(__ANDROID__) + agora::rtc::DeviceInfo Info; + auto ret = AgoraUERtcEngine::Get()->getAudioDeviceInfo(Info); + deviceInfo = Info; + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::StartScreenCaptureByWindowId(int64 windowId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) +{ +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + agora::rtc::Rectangle rectangle = regionRect.CreateAgoraData(); + agora::rtc::ScreenCaptureParameters screenCaptureParameters = captureParams.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startScreenCaptureByWindowId(UABT::ToView(windowId), rectangle, screenCaptureParameters); + regionRect.FreeAgoraData(rectangle); + captureParams.FreeAgoraData(screenCaptureParameters); + + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::SetScreenCaptureContentHint(EVIDEO_CONTENT_HINT contentHint) +{ +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + auto ret = AgoraUERtcEngine::Get()->setScreenCaptureContentHint((agora::rtc::VIDEO_CONTENT_HINT)contentHint); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} + +int UAgoraBPuRtcEngine::UpdateScreenCaptureRegion(const FRectangle& regionRect) +{ +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + agora::rtc::Rectangle rectangle = regionRect.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->updateScreenCaptureRegion(rectangle); + regionRect.FreeAgoraData(rectangle); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +int UAgoraBPuRtcEngine::UpdateScreenCaptureParameters(const FScreenCaptureParameters& captureParams) +{ +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + agora::rtc::ScreenCaptureParameters screenCaptureParameters = captureParams.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->updateScreenCaptureParameters(screenCaptureParameters); + captureParams.FreeAgoraData(screenCaptureParameters); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +int UAgoraBPuRtcEngine::StartScreenCapture(const FScreenCaptureParameters2& captureParams) +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + agora::rtc::ScreenCaptureParameters2 screenCaptureParameters2 = captureParams.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startScreenCapture(screenCaptureParameters2); + captureParams.FreeAgoraData(screenCaptureParameters2); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif + +} + + +int UAgoraBPuRtcEngine::StartScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType, const FScreenCaptureConfiguration& config) +{ + + agora::rtc::ScreenCaptureConfiguration screenCaptureConfiguration = config.CreateAgoraData(); + auto ret = AgoraUERtcEngine::Get()->startScreenCapture((agora::rtc::VIDEO_SOURCE_TYPE)sourceType, screenCaptureConfiguration); + config.FreeAgoraData(screenCaptureConfiguration); + return ret; +} + +int UAgoraBPuRtcEngine::StopScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType) +{ + auto ret = AgoraUERtcEngine::Get()->stopScreenCapture((agora::rtc::VIDEO_SOURCE_TYPE)sourceType); + return ret; +} + +int UAgoraBPuRtcEngine::QueryScreenCaptureCapability() +{ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + auto ret = AgoraUERtcEngine::Get()->queryScreenCaptureCapability(); + return ret; +#else + return AGORA_UE_ERR_CODE(ERROR_NOT_SUPPORT_PLATFORM); +#endif +} +#pragma endregion Screen Share + diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIMediaPlayerSourceObserver.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIMediaPlayerSourceObserver.cpp deleted file mode 100644 index 15250d93..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIMediaPlayerSourceObserver.cpp +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/AgoraIMediaPlayerSourceObserver.h" - -void UIMediaPlayerSourceObserver::onPlayerSourceStateChanged(agora::media::base::MEDIA_PLAYER_STATE state, agora::media::base::MEDIA_PLAYER_ERROR ec) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnPlayerSourceStateChanged.Broadcast((EMEDIA_PLAYER_STATE)state, FENUMWRAP_MEDIA_PLAYER_ERROR(ec)); - }); -} -void UIMediaPlayerSourceObserver::onPositionChanged(int64_t position_ms) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnPositionChanged.Broadcast(position_ms); - }); -} -void UIMediaPlayerSourceObserver::onPlayerEvent(agora::media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnPlayerEvent.Broadcast((EMEDIA_PLAYER_EVENT)eventCode, elapsedTime, FString(message)); - }); -} -void UIMediaPlayerSourceObserver::onMetaData(const void* data, int length) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnMetaData.Broadcast((int64)data, length); - }); -} -void UIMediaPlayerSourceObserver::onPlayBufferUpdated(int64_t playCachedBuffer) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnPlayBufferUpdated.Broadcast(playCachedBuffer); - }); -} -void UIMediaPlayerSourceObserver::onPreloadEvent(const char* src, agora::media::base::PLAYER_PRELOAD_EVENT event) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnPreloadEvent.Broadcast(FString(src), (EPLAYER_PRELOAD_EVENT)event); - }); -} -void UIMediaPlayerSourceObserver::onCompleted() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnCompleted.Broadcast(); - }); -} -void UIMediaPlayerSourceObserver::onAgoraCDNTokenWillExpire() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAgoraCDNTokenWillExpire.Broadcast(); - }); -} -void UIMediaPlayerSourceObserver::onPlayerSrcInfoChanged(const agora::media::base::SrcInfo& from, const agora::media::base::SrcInfo& to) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FSrcInfo fromInfo; - fromInfo.bitrateInKbps = from.bitrateInKbps; - fromInfo.name = FString(from.name); - FSrcInfo toInfo; - toInfo.bitrateInKbps = to.bitrateInKbps; - toInfo.name = FString(to.name); - OnPlayerSrcInfoChanged.Broadcast(fromInfo, toInfo); - }); -} -void UIMediaPlayerSourceObserver::onPlayerInfoUpdated(const agora::media::base::PlayerUpdatedInfo& info) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FPlayerUpdatedInfo playerUpdatedInfo; - playerUpdatedInfo.playerId_SetValue = info.playerId.has_value(); - playerUpdatedInfo.deviceId_SetValue = info.deviceId.has_value(); - playerUpdatedInfo.cacheStatistics_SetValue = info.cacheStatistics.has_value(); - if (info.playerId.has_value()) { - playerUpdatedInfo.playerId = FString(*info.playerId); - } - if (info.deviceId.has_value()) { - playerUpdatedInfo.deviceId = FString(*info.deviceId); - } - if (info.deviceId.has_value()) - { - FCacheStatistics Statistics; - Statistics.cacheSize = info.cacheStatistics->cacheSize; - Statistics.downloadSize = info.cacheStatistics->downloadSize; - Statistics.fileSize = info.cacheStatistics->fileSize; - playerUpdatedInfo.cacheStatistics = Statistics; - } - OnPlayerInfoUpdated.Broadcast(playerUpdatedInfo); - }); -} -void UIMediaPlayerSourceObserver::onAudioVolumeIndication(int volume) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioVolumeIndication.Broadcast(volume); - }); -} - - -int UIMediaPlayerCustomDataProvider::onReadData(unsigned char* buffer, int bufferSize) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return bufferSize; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - unsigned char* tempdata = new unsigned char[bufferSize]; - FMemory::Memcpy((void*)tempdata, buffer, bufferSize); - TArray callBackdata; - for (int i = 0; i < bufferSize; i++) - { - callBackdata.Add(tempdata[i]); - } - delete[] tempdata; - - OnReadData.Broadcast(callBackdata, bufferSize); - }); - return bufferSize; -} - -int64_t UIMediaPlayerCustomDataProvider::onSeek(int64_t offset, int whence) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return offset; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnSeek.Broadcast(offset, whence); - }); - return offset; -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.cpp deleted file mode 100644 index 11af16ea..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.cpp +++ /dev/null @@ -1,2036 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.h" - -void UIRtcEngineEventHandler::onJoinChannelSuccess(const char* channel, agora::rtc::uid_t uid, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnJoinChannelSuccess.Broadcast(FString(channel), (int64)uid, elapsed); - }); - -} -void UIRtcEngineEventHandler::onRejoinChannelSuccess(const char* channel, agora::rtc::uid_t uid, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRejoinChannelSuccess.Broadcast(FString(channel), (int64)uid, elapsed); - }); - -} -void UIRtcEngineEventHandler::onProxyConnected(const char* channel, agora::rtc::uid_t uid, agora::rtc::PROXY_TYPE proxyType, const char* localProxyIp, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnProxyConnected.Broadcast(FString(channel), (int64)uid, (EPROXY_TYPE)proxyType, FString(localProxyIp), elapsed); - }); -} -void UIRtcEngineEventHandler::onError(int err, const char* msg) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnError.Broadcast(err, FString(msg)); - }); -} -void UIRtcEngineEventHandler::onAudioQuality(agora::rtc::uid_t uid, int quality, unsigned short delay, unsigned short lost) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioQuality.Broadcast((int64)uid, quality, delay, lost); - }); -} -void UIRtcEngineEventHandler::onLastmileProbeResult(const agora::rtc::LastmileProbeResult& result) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FLastmileProbeResult lastmileProbeResult; - lastmileProbeResult.state = (ELASTMILE_PROBE_RESULT_STATE)result.state; - FLastmileProbeOneWayResult uplinkReport; - uplinkReport.availableBandwidth = result.uplinkReport.availableBandwidth; - uplinkReport.jitter = result.uplinkReport.jitter; - uplinkReport.packetLossRate = result.uplinkReport.packetLossRate; - lastmileProbeResult.uplinkReport = uplinkReport; - FLastmileProbeOneWayResult downlinkReport; - downlinkReport.availableBandwidth = result.downlinkReport.availableBandwidth; - downlinkReport.jitter = result.downlinkReport.jitter; - downlinkReport.packetLossRate = result.downlinkReport.packetLossRate; - lastmileProbeResult.downlinkReport = downlinkReport; - lastmileProbeResult.rtt = result.rtt; - OnLastmileProbeResult.Broadcast(lastmileProbeResult); - }); -} -void UIRtcEngineEventHandler::onAudioVolumeIndication(const agora::rtc::AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - TArray audioVolumeInfo; - - for (unsigned int i = 0; i < speakerNumber; i++) - { - FAudioVolumeInfo info; - info.uid = speakers[i].uid; - info.vad = speakers[i].vad; - info.voicePitch = speakers[i].voicePitch; - info.volume = speakers[i].volume; - audioVolumeInfo.Add(info); - } - OnAudioVolumeIndication.Broadcast(audioVolumeInfo, totalVolume); - }); -} -void UIRtcEngineEventHandler::onLeaveChannel(const agora::rtc::RtcStats& stats) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FRtcStats rtcStats; - rtcStats.duration = stats.duration; - rtcStats.txBytes = stats.txBytes; - rtcStats.rxBytes = stats.rxBytes; - rtcStats.txAudioBytes = stats.txAudioBytes; - rtcStats.txVideoBytes = stats.txVideoBytes; - rtcStats.rxAudioBytes = stats.rxAudioBytes; - rtcStats.rxVideoBytes = stats.rxVideoBytes; - rtcStats.txKBitRate = stats.txKBitRate; - rtcStats.rxKBitRate = stats.rxKBitRate; - rtcStats.rxAudioKBitRate = stats.rxAudioKBitRate; - rtcStats.txAudioKBitRate = stats.txAudioKBitRate; - rtcStats.rxVideoKBitRate = stats.rxVideoKBitRate; - rtcStats.txVideoKBitRate = stats.txVideoKBitRate; - rtcStats.lastmileDelay = stats.lastmileDelay; - rtcStats.userCount = stats.userCount; - rtcStats.cpuAppUsage = stats.cpuAppUsage; - rtcStats.cpuTotalUsage = stats.cpuTotalUsage; - rtcStats.gatewayRtt = stats.gatewayRtt; - rtcStats.memoryAppUsageRatio = stats.memoryAppUsageRatio; - rtcStats.memoryTotalUsageRatio = stats.memoryTotalUsageRatio; - rtcStats.memoryAppUsageInKbytes = stats.memoryAppUsageInKbytes; - rtcStats.connectTimeMs = stats.connectTimeMs; - rtcStats.firstAudioPacketDuration = stats.firstAudioPacketDuration; - rtcStats.firstVideoPacketDuration = stats.firstVideoPacketDuration; - rtcStats.firstVideoKeyFramePacketDuration = stats.firstVideoKeyFramePacketDuration; - rtcStats.packetsBeforeFirstKeyFramePacket = stats.packetsBeforeFirstKeyFramePacket; - rtcStats.firstAudioPacketDurationAfterUnmute = stats.firstAudioPacketDurationAfterUnmute; - rtcStats.firstVideoPacketDurationAfterUnmute = stats.firstVideoPacketDurationAfterUnmute; - rtcStats.firstVideoKeyFramePacketDurationAfterUnmute = stats.firstVideoKeyFramePacketDurationAfterUnmute; - rtcStats.firstVideoKeyFrameDecodedDurationAfterUnmute = stats.firstVideoKeyFrameDecodedDurationAfterUnmute; - rtcStats.firstVideoKeyFrameRenderedDurationAfterUnmute = stats.firstVideoKeyFrameRenderedDurationAfterUnmute; - rtcStats.txPacketLossRate = stats.txPacketLossRate; - rtcStats.rxPacketLossRate = stats.rxPacketLossRate; - OnLeaveChannel.Broadcast(rtcStats); - }); -} -void UIRtcEngineEventHandler::onRtcStats(const agora::rtc::RtcStats& stats) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FRtcStats rtcStats; - rtcStats.duration = stats.duration; - rtcStats.txBytes = stats.txBytes; - rtcStats.rxBytes = stats.rxBytes; - rtcStats.txAudioBytes = stats.txAudioBytes; - rtcStats.txVideoBytes = stats.txVideoBytes; - rtcStats.rxAudioBytes = stats.rxAudioBytes; - rtcStats.rxVideoBytes = stats.rxVideoBytes; - rtcStats.txKBitRate = stats.txKBitRate; - rtcStats.rxKBitRate = stats.rxKBitRate; - rtcStats.rxAudioKBitRate = stats.rxAudioKBitRate; - rtcStats.txAudioKBitRate = stats.txAudioKBitRate; - rtcStats.rxVideoKBitRate = stats.rxVideoKBitRate; - rtcStats.txVideoKBitRate = stats.txVideoKBitRate; - rtcStats.lastmileDelay = stats.lastmileDelay; - rtcStats.userCount = stats.userCount; - rtcStats.cpuAppUsage = stats.cpuAppUsage; - rtcStats.cpuTotalUsage = stats.cpuTotalUsage; - rtcStats.gatewayRtt = stats.gatewayRtt; - rtcStats.memoryAppUsageRatio = stats.memoryAppUsageRatio; - rtcStats.memoryTotalUsageRatio = stats.memoryTotalUsageRatio; - rtcStats.memoryAppUsageInKbytes = stats.memoryAppUsageInKbytes; - rtcStats.connectTimeMs = stats.connectTimeMs; - rtcStats.firstAudioPacketDuration = stats.firstAudioPacketDuration; - rtcStats.firstVideoPacketDuration = stats.firstVideoPacketDuration; - rtcStats.firstVideoKeyFramePacketDuration = stats.firstVideoKeyFramePacketDuration; - rtcStats.packetsBeforeFirstKeyFramePacket = stats.packetsBeforeFirstKeyFramePacket; - rtcStats.firstAudioPacketDurationAfterUnmute = stats.firstAudioPacketDurationAfterUnmute; - rtcStats.firstVideoPacketDurationAfterUnmute = stats.firstVideoPacketDurationAfterUnmute; - rtcStats.firstVideoKeyFramePacketDurationAfterUnmute = stats.firstVideoKeyFramePacketDurationAfterUnmute; - rtcStats.firstVideoKeyFrameDecodedDurationAfterUnmute = stats.firstVideoKeyFrameDecodedDurationAfterUnmute; - rtcStats.firstVideoKeyFrameRenderedDurationAfterUnmute = stats.firstVideoKeyFrameRenderedDurationAfterUnmute; - rtcStats.txPacketLossRate = stats.txPacketLossRate; - rtcStats.rxPacketLossRate = stats.rxPacketLossRate; - OnRtcStats.Broadcast(rtcStats); - }); -} -void UIRtcEngineEventHandler::onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioDeviceStateChanged.Broadcast(FString(deviceId), deviceType, deviceState); - }); -} - -void UIRtcEngineEventHandler::onAudioMixingPositionChanged(int64_t position) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioMixingPositionChanged.Broadcast(position); - }); -} - -void UIRtcEngineEventHandler::onAudioMixingFinished() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioMixingFinished.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onAudioEffectFinished(int soundId) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioEffectFinished.Broadcast(soundId); - }); -} -void UIRtcEngineEventHandler::onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnVideoDeviceStateChanged.Broadcast(FString(deviceId), deviceType, deviceState); - }); -} - -void UIRtcEngineEventHandler::onNetworkQuality(agora::rtc::uid_t uid, int txQuality, int rxQuality) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnNetworkQuality.Broadcast((int64)uid, txQuality, rxQuality); - }); -} -void UIRtcEngineEventHandler::onIntraRequestReceived() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnIntraRequestReceived.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onUplinkNetworkInfoUpdated(const agora::rtc::UplinkNetworkInfo& info) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FUplinkNetworkInfo uplinkNetworkInfo; - uplinkNetworkInfo.video_encoder_target_bitrate_bps = info.video_encoder_target_bitrate_bps; - OnUplinkNetworkInfoUpdated.Broadcast(uplinkNetworkInfo); - }); -} -void UIRtcEngineEventHandler::onDownlinkNetworkInfoUpdated(const agora::rtc::DownlinkNetworkInfo& info) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FDownlinkNetworkInfo downlinkNetworkInfo; - downlinkNetworkInfo.lastmile_buffer_delay_time_ms = info.lastmile_buffer_delay_time_ms; - downlinkNetworkInfo.bandwidth_estimation_bps = info.bandwidth_estimation_bps; - downlinkNetworkInfo.total_downscale_level_count = info.total_downscale_level_count; - FPeerDownlinkInfo peer_downlink_info; - if (info.peer_downlink_info != nullptr) - { - peer_downlink_info.current_downscale_level = (EREMOTE_VIDEO_DOWNSCALE_LEVEL)info.peer_downlink_info->current_downscale_level; - peer_downlink_info.expected_bitrate_bps = info.peer_downlink_info->expected_bitrate_bps; - peer_downlink_info.stream_type = (EVIDEO_STREAM_TYPE)info.peer_downlink_info->stream_type; - peer_downlink_info.uid = info.peer_downlink_info->uid; - } - downlinkNetworkInfo.peer_downlink_info = peer_downlink_info; - downlinkNetworkInfo.total_received_video_count = info.total_received_video_count; - OnDownlinkNetworkInfoUpdated.Broadcast(downlinkNetworkInfo); - }); -} -void UIRtcEngineEventHandler::onLastmileQuality(int quality) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLastmileQuality.Broadcast(quality); - }); -} -void UIRtcEngineEventHandler::onFirstLocalVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstLocalVideoFrame.Broadcast((EVIDEO_SOURCE_TYPE)source, width, height, elapsed); - }); -} -void UIRtcEngineEventHandler::onFirstLocalVideoFramePublished(agora::rtc::VIDEO_SOURCE_TYPE source, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstLocalVideoFramePublished.Broadcast((EVIDEO_SOURCE_TYPE)source, elapsed); - }); -} -void UIRtcEngineEventHandler::onFirstRemoteVideoDecoded(agora::rtc::uid_t uid, int width, int height, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstRemoteVideoDecoded.Broadcast((int64)uid, width, height, elapsed); - }); -} -void UIRtcEngineEventHandler::onVideoSizeChanged(agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::rtc::uid_t uid, int width, int height, int rotation) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnVideoSizeChanged.Broadcast((EVIDEO_SOURCE_TYPE)sourceType, (int64)uid, width, height, rotation); - }); -} -void UIRtcEngineEventHandler::onLocalVideoStateChanged(agora::rtc::VIDEO_SOURCE_TYPE source, agora::rtc::LOCAL_VIDEO_STREAM_STATE state, agora::rtc::LOCAL_VIDEO_STREAM_ERROR error) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLocalVideoStateChanged.Broadcast((EVIDEO_SOURCE_TYPE)source, (ELOCAL_VIDEO_STREAM_STATE)state, (ELOCAL_VIDEO_STREAM_ERROR)error); - }); -} -void UIRtcEngineEventHandler::onRemoteVideoStateChanged(agora::rtc::uid_t uid, agora::rtc::REMOTE_VIDEO_STATE state, agora::rtc::REMOTE_VIDEO_STATE_REASON reason, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteVideoStateChanged.Broadcast((int64)uid, (EREMOTE_VIDEO_STATE)state, (EREMOTE_VIDEO_STATE_REASON)reason, elapsed); - }); -} -void UIRtcEngineEventHandler::onFirstRemoteVideoFrame(agora::rtc::uid_t userId, int width, int height, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstRemoteVideoFrame.Broadcast((int64)userId, width, height, elapsed); - }); -} -void UIRtcEngineEventHandler::onUserJoined(agora::rtc::uid_t uid, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserJoined.Broadcast((int64)uid, elapsed); - }); -} -void UIRtcEngineEventHandler::onUserOffline(agora::rtc::uid_t uid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserOffline.Broadcast((int64)uid, (EUSER_OFFLINE_REASON_TYPE)reason); - }); -} -void UIRtcEngineEventHandler::onUserMuteAudio(agora::rtc::uid_t uid, bool muted) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserMuteAudio.Broadcast((int64)uid, muted); - }); -} -void UIRtcEngineEventHandler::onUserMuteVideo(agora::rtc::uid_t userId, bool muted) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserMuteVideo.Broadcast((int64)userId, muted); - }); -} -void UIRtcEngineEventHandler::onUserEnableVideo(agora::rtc::uid_t uid, bool enabled) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserEnableVideo.Broadcast((int64)uid, enabled); - }); -} -void UIRtcEngineEventHandler::onUserStateChanged(agora::rtc::uid_t uid, uint32_t state) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserStateChanged.Broadcast((int64)uid, state); - }); -} -void UIRtcEngineEventHandler::onUserEnableLocalVideo(agora::rtc::uid_t uid, bool enabled) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserEnableLocalVideo.Broadcast((int64)uid, enabled); - }); -} -void UIRtcEngineEventHandler::onLocalAudioStats(const agora::rtc::LocalAudioStats& stats) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FLocalAudioStats localAudioStats; - localAudioStats.numChannels = stats.numChannels; - localAudioStats.sentSampleRate = stats.sentSampleRate; - localAudioStats.sentBitrate = stats.sentBitrate; - localAudioStats.internalCodec = stats.internalCodec; - localAudioStats.txPacketLossRate = stats.txPacketLossRate; - localAudioStats.audioDeviceDelay = stats.audioDeviceDelay; - OnLocalAudioStats.Broadcast(localAudioStats); - }); -} -void UIRtcEngineEventHandler::onRemoteAudioStats(const agora::rtc::RemoteAudioStats& stats) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FRemoteAudioStats remoteAudioStats; - remoteAudioStats.uid = stats.uid; - remoteAudioStats.quality = stats.quality; - remoteAudioStats.networkTransportDelay = stats.networkTransportDelay; - remoteAudioStats.jitterBufferDelay = stats.jitterBufferDelay; - remoteAudioStats.audioLossRate = stats.audioLossRate; - remoteAudioStats.numChannels = stats.numChannels; - remoteAudioStats.receivedSampleRate = stats.receivedSampleRate; - remoteAudioStats.receivedBitrate = stats.receivedBitrate; - remoteAudioStats.totalFrozenTime = stats.totalFrozenTime; - remoteAudioStats.frozenRate = stats.frozenRate; - remoteAudioStats.mosValue = stats.mosValue; - remoteAudioStats.totalActiveTime = stats.totalActiveTime; - remoteAudioStats.publishDuration = stats.publishDuration; - remoteAudioStats.qoeQuality = stats.qoeQuality; - remoteAudioStats.qualityChangedReason = stats.qualityChangedReason; - OnRemoteAudioStats.Broadcast(remoteAudioStats); -}); -} -void UIRtcEngineEventHandler::onLocalVideoStats(agora::rtc::VIDEO_SOURCE_TYPE source, const agora::rtc::LocalVideoStats& stats) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FLocalVideoStats localVideoStats; - localVideoStats.uid = stats.uid; - localVideoStats.sentBitrate = stats.sentBitrate; - localVideoStats.sentFrameRate = stats.sentFrameRate; - localVideoStats.captureFrameRate = stats.captureFrameRate; - localVideoStats.captureFrameWidth = stats.captureFrameWidth; - localVideoStats.captureFrameHeight = stats.captureFrameHeight; - localVideoStats.regulatedCaptureFrameRate = stats.regulatedCaptureFrameRate; - localVideoStats.regulatedCaptureFrameWidth = stats.regulatedCaptureFrameWidth; - localVideoStats.regulatedCaptureFrameHeight = stats.regulatedCaptureFrameHeight; - localVideoStats.encoderOutputFrameRate = stats.encoderOutputFrameRate; - localVideoStats.encodedFrameWidth = stats.encodedFrameWidth; - localVideoStats.encodedFrameHeight = stats.encodedFrameHeight; - localVideoStats.rendererOutputFrameRate = stats.rendererOutputFrameRate; - localVideoStats.targetBitrate = stats.targetBitrate; - localVideoStats.targetFrameRate = stats.targetFrameRate; - localVideoStats.qualityAdaptIndication = (EQUALITY_ADAPT_INDICATION)stats.qualityAdaptIndication; - localVideoStats.encodedBitrate = stats.encodedBitrate; - localVideoStats.encodedFrameCount = stats.encodedFrameCount; - localVideoStats.codecType = (EVIDEO_CODEC_TYPE)stats.codecType; - localVideoStats.txPacketLossRate = stats.txPacketLossRate; - localVideoStats.captureBrightnessLevel = stats.captureBrightnessLevel; - localVideoStats.dualStreamEnabled = stats.dualStreamEnabled; - OnLocalVideoStats.Broadcast((EVIDEO_SOURCE_TYPE)source, localVideoStats); - }); -} -void UIRtcEngineEventHandler::onRemoteVideoStats(const agora::rtc::RemoteVideoStats& stats) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FRemoteVideoStats remoteVideoStats; - remoteVideoStats.uid = stats.uid; - remoteVideoStats.e2eDelay = stats.e2eDelay; - remoteVideoStats.width = stats.width; - remoteVideoStats.height = stats.height; - remoteVideoStats.receivedBitrate = stats.receivedBitrate; - remoteVideoStats.decoderOutputFrameRate = stats.decoderOutputFrameRate; - remoteVideoStats.rendererOutputFrameRate = stats.rendererOutputFrameRate; - remoteVideoStats.frameLossRate = stats.frameLossRate; - remoteVideoStats.packetLossRate = stats.packetLossRate; - remoteVideoStats.rxStreamType = (EVIDEO_STREAM_TYPE)stats.rxStreamType; - remoteVideoStats.totalFrozenTime = stats.totalFrozenTime; - remoteVideoStats.frozenRate = stats.frozenRate; - remoteVideoStats.avSyncTimeMs = stats.avSyncTimeMs; - remoteVideoStats.totalActiveTime = stats.totalActiveTime; - remoteVideoStats.publishDuration = stats.publishDuration; - OnRemoteVideoStats.Broadcast(remoteVideoStats); - }); -} -void UIRtcEngineEventHandler::onCameraReady() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnCameraReady.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onCameraFocusAreaChanged(int x, int y, int width, int height) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnCameraFocusAreaChanged.Broadcast(x, y, width, height); - }); -} -void UIRtcEngineEventHandler::onCameraExposureAreaChanged(int x, int y, int width, int height) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnCameraExposureAreaChanged.Broadcast(x, y, width, height); - }); -} -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) -void UIRtcEngineEventHandler::onFacePositionChanged(int imageWidth, int imageHeight, const agora::rtc::Rectangle* vecRectangle, const int* vecDistance, int numFaces) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FRectangle rectangle; - rectangle.x = vecRectangle->x; - rectangle.y = vecRectangle->y; - rectangle.width = vecRectangle->width; - rectangle.height = vecRectangle->height; - TArray vecDis; - int* tempdata = new int[numFaces]; - FMemory::Memcpy(tempdata, vecDistance, numFaces * sizeof(int)); - for (int i = 0; i < numFaces; i++) - { - vecDis[i] = tempdata[i]; - } - delete[] tempdata; - - OnFacePositionChanged.Broadcast(imageWidth, imageHeight, rectangle, vecDis, numFaces); - }); -} -#endif -void UIRtcEngineEventHandler::onVideoStopped() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnVideoStopped.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onAudioMixingStateChanged(agora::rtc::AUDIO_MIXING_STATE_TYPE state, agora::rtc::AUDIO_MIXING_REASON_TYPE reason) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioMixingStateChanged.Broadcast(state, reason); - }); -} -void UIRtcEngineEventHandler::onRhythmPlayerStateChanged(agora::rtc::RHYTHM_PLAYER_STATE_TYPE state, agora::rtc::RHYTHM_PLAYER_ERROR_TYPE errorCode) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRhythmPlayerStateChanged.Broadcast(state, errorCode); - }); -} -void UIRtcEngineEventHandler::onConnectionLost() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnConnectionLost.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onConnectionInterrupted() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnConnectionInterrupted.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onConnectionBanned() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnConnectionBanned.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onStreamMessage(agora::rtc::uid_t userId, int streamId, const char* data, size_t length, uint64_t sentTs) -{ - char* tempdata = new char[length]; - FMemory::Memcpy(tempdata, data, length); - std::string temp(tempdata); - delete[] tempdata; - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnStreamMessage.Broadcast((int64)userId, streamId, FString(UTF8_TO_TCHAR(temp.c_str())), length, sentTs); - }); -} -void UIRtcEngineEventHandler::onStreamMessageError(agora::rtc::uid_t userId, int streamId, int code, int missed, int cached) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnStreamMessageError.Broadcast((int64)userId, streamId, code, missed, cached); - }); -} -void UIRtcEngineEventHandler::onRequestToken() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRequestToken.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onTokenPrivilegeWillExpire(const char* token) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnTokenPrivilegeWillExpire.Broadcast(FString(token)); - }); -} - -void UIRtcEngineEventHandler::onLicenseValidationFailure(agora::LICENSE_ERROR_TYPE error) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLicenseValidationFailure.Broadcast((ELICENSE_ERROR_TYPE)error); - }); -} - -void UIRtcEngineEventHandler::onFirstLocalAudioFramePublished(int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstLocalAudioFramePublished.Broadcast(elapsed); - }); -} -void UIRtcEngineEventHandler::onFirstRemoteAudioFrame(agora::rtc::uid_t uid, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstRemoteAudioFrame.Broadcast((int64)uid, elapsed); - }); -} -void UIRtcEngineEventHandler::onFirstRemoteAudioDecoded(agora::rtc::uid_t uid, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstRemoteAudioDecoded.Broadcast((int64)uid, elapsed); - }); -} -void UIRtcEngineEventHandler::onLocalAudioStateChanged(agora::rtc::LOCAL_AUDIO_STREAM_STATE state, agora::rtc::LOCAL_AUDIO_STREAM_ERROR error) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLocalAudioStateChanged.Broadcast((ELOCAL_AUDIO_STREAM_STATE)state, (ELOCAL_AUDIO_STREAM_ERROR)error); - }); -} -void UIRtcEngineEventHandler::onRemoteAudioStateChanged(agora::rtc::uid_t uid, agora::rtc::REMOTE_AUDIO_STATE state, agora::rtc::REMOTE_AUDIO_STATE_REASON reason, int elapsed) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteAudioStateChanged.Broadcast((int64)uid, (EREMOTE_AUDIO_STATE)state, (EREMOTE_AUDIO_STATE_REASON)reason, elapsed); - }); -} -void UIRtcEngineEventHandler::onActiveSpeaker(agora::rtc::uid_t userId) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnActiveSpeaker.Broadcast((int64)userId); - }); -} -void UIRtcEngineEventHandler::onContentInspectResult(agora::media::CONTENT_INSPECT_RESULT result) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnContentInspectResult.Broadcast((ECONTENT_INSPECT_RESULT)result); - }); -} -void UIRtcEngineEventHandler::onSnapshotTaken(agora::rtc::uid_t uid, const char* filePath, int width, int height, int errCode) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnSnapshotTaken.Broadcast((int64)uid, FString(filePath), width, height, errCode); - }); -} -void UIRtcEngineEventHandler::onClientRoleChanged(agora::rtc::CLIENT_ROLE_TYPE oldRole, agora::rtc::CLIENT_ROLE_TYPE newRole, const agora::rtc::ClientRoleOptions& newRoleOptions) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FClientRoleOptions roleoptions; - roleoptions.audienceLatencyLevel = (EAUDIENCE_LATENCY_LEVEL_TYPE)newRoleOptions.audienceLatencyLevel; - OnClientRoleChanged.Broadcast((ECLIENT_ROLE_TYPE)oldRole, (ECLIENT_ROLE_TYPE)newRole, roleoptions); - }); -} -void UIRtcEngineEventHandler::onClientRoleChangeFailed(agora::rtc::CLIENT_ROLE_CHANGE_FAILED_REASON reason, agora::rtc::CLIENT_ROLE_TYPE currentRole) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnClientRoleChangeFailed.Broadcast((ECLIENT_ROLE_CHANGE_FAILED_REASON)reason, (ECLIENT_ROLE_TYPE)currentRole); - }); -} -void UIRtcEngineEventHandler::onAudioDeviceVolumeChanged(agora::rtc::MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioDeviceVolumeChanged.Broadcast(deviceType, volume, muted); - }); -} -void UIRtcEngineEventHandler::onRtmpStreamingStateChanged(const char* url, agora::rtc::RTMP_STREAM_PUBLISH_STATE state, agora::rtc::RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRtmpStreamingStateChanged.Broadcast(FString(url), (ERTMP_STREAM_PUBLISH_STATE)state, (ERTMP_STREAM_PUBLISH_ERROR_TYPE)errCode); - }); -} -void UIRtcEngineEventHandler::onRtmpStreamingEvent(const char* url, agora::rtc::RTMP_STREAMING_EVENT eventCode) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRtmpStreamingEvent.Broadcast(FString(url), (ERTMP_STREAMING_EVENT)eventCode); - }); -} -void UIRtcEngineEventHandler::onTranscodingUpdated() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnTranscodingUpdated.Broadcast(); - }); -} -void UIRtcEngineEventHandler::onAudioRoutingChanged(int routing) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioRoutingChanged.Broadcast(routing); - }); -} -void UIRtcEngineEventHandler::onChannelMediaRelayStateChanged(int state, int code) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnChannelMediaRelayStateChanged.Broadcast(state, code); - }); -} -void UIRtcEngineEventHandler::onChannelMediaRelayEvent(int code) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnChannelMediaRelayEvent.Broadcast(code); - }); -} -void UIRtcEngineEventHandler::onLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLocalPublishFallbackToAudioOnly.Broadcast(isFallbackOrRecover); - }); -} -void UIRtcEngineEventHandler::onRemoteSubscribeFallbackToAudioOnly(agora::rtc::uid_t uid, bool isFallbackOrRecover) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteSubscribeFallbackToAudioOnly.Broadcast((int64)uid, isFallbackOrRecover); - }); -} -void UIRtcEngineEventHandler::onRemoteAudioTransportStats(agora::rtc::uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteAudioTransportStats.Broadcast((int64)uid, delay, lost, rxKBitRate); - }); -} -void UIRtcEngineEventHandler::onRemoteVideoTransportStats(agora::rtc::uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteVideoTransportStats.Broadcast((int64)uid, delay, lost, rxKBitRate); - }); -} -void UIRtcEngineEventHandler::onConnectionStateChanged(agora::rtc::CONNECTION_STATE_TYPE state, agora::rtc::CONNECTION_CHANGED_REASON_TYPE reason) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnConnectionStateChanged.Broadcast((ECONNECTION_STATE_TYPE)state, (ECONNECTION_CHANGED_REASON_TYPE)reason); - }); -} -void UIRtcEngineEventHandler::onWlAccMessage(agora::rtc::WLACC_MESSAGE_REASON reason, agora::rtc::WLACC_SUGGEST_ACTION action, const char* wlAccMsg) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnWlAccMessage.Broadcast((EWLACC_MESSAGE_REASON)reason, (EWLACC_SUGGEST_ACTION)action, FString(wlAccMsg)); - }); -} -void UIRtcEngineEventHandler::onWlAccStats(agora::rtc::WlAccStats currentStats, agora::rtc::WlAccStats averageStats) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FWlAccStats current; - current.e2eDelayPercent = currentStats.e2eDelayPercent; - current.frozenRatioPercent = currentStats.frozenRatioPercent; - current.lossRatePercent = currentStats.lossRatePercent; - FWlAccStats average; - average.e2eDelayPercent = averageStats.e2eDelayPercent; - average.frozenRatioPercent = averageStats.frozenRatioPercent; - average.lossRatePercent = averageStats.lossRatePercent; - OnWlAccStats.Broadcast(current, average); - }); -} -void UIRtcEngineEventHandler::onNetworkTypeChanged(agora::rtc::NETWORK_TYPE type) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnNetworkTypeChanged.Broadcast(type); - }); -} -void UIRtcEngineEventHandler::onEncryptionError(agora::rtc::ENCRYPTION_ERROR_TYPE errorType) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnEncryptionError.Broadcast((EENCRYPTION_ERROR_TYPE)errorType); - }); -} -void UIRtcEngineEventHandler::onPermissionError(agora::rtc::PERMISSION_TYPE permissionType) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnPermissionError.Broadcast((EPERMISSION_TYPE)permissionType); - }); -} -void UIRtcEngineEventHandler::onLocalUserRegistered(agora::rtc::uid_t uid, const char* userAccount) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLocalUserRegistered.Broadcast((int64)uid, FString(userAccount)); - }); -} -void UIRtcEngineEventHandler::onUserInfoUpdated(agora::rtc::uid_t uid, const agora::rtc::UserInfo& info) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FUserInfo userInfo; - userInfo.uid = info.uid; - FString userAccount(info.userAccount); - OnUserInfoUpdated.Broadcast((int64)uid, userInfo); - }); -} -void UIRtcEngineEventHandler::onUploadLogResult(const char* requestId, bool success, agora::rtc::UPLOAD_ERROR_REASON reason) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUploadLogResult.Broadcast(FString(requestId), success, (EUPLOAD_ERROR_REASON)reason); - }); -} -void UIRtcEngineEventHandler::onAudioSubscribeStateChanged(const char* channel, agora::rtc::uid_t uid, agora::rtc::STREAM_SUBSCRIBE_STATE oldState, agora::rtc::STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioSubscribeStateChanged.Broadcast(FString(channel), (int64)uid, (ESTREAM_SUBSCRIBE_STATE)oldState, (ESTREAM_SUBSCRIBE_STATE)newState, elapseSinceLastState); - }); -} -void UIRtcEngineEventHandler::onVideoSubscribeStateChanged(const char* channel, agora::rtc::uid_t uid, agora::rtc::STREAM_SUBSCRIBE_STATE oldState, agora::rtc::STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnVideoSubscribeStateChanged.Broadcast(FString(channel), (int64)uid, (ESTREAM_SUBSCRIBE_STATE)oldState, (ESTREAM_SUBSCRIBE_STATE)newState, elapseSinceLastState); - }); -} -void UIRtcEngineEventHandler::onAudioPublishStateChanged(const char* channel, agora::rtc::STREAM_PUBLISH_STATE oldState, agora::rtc::STREAM_PUBLISH_STATE newState, int elapseSinceLastState) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioPublishStateChanged.Broadcast(FString(channel), (ESTREAM_PUBLISH_STATE)oldState, (ESTREAM_PUBLISH_STATE)newState, elapseSinceLastState); - }); -} -void UIRtcEngineEventHandler::onVideoPublishStateChanged(agora::rtc::VIDEO_SOURCE_TYPE source, const char* channel, agora::rtc::STREAM_PUBLISH_STATE oldState, agora::rtc::STREAM_PUBLISH_STATE newState, int elapseSinceLastState) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnVideoPublishStateChanged.Broadcast((EVIDEO_SOURCE_TYPE)source, FString(channel), (ESTREAM_PUBLISH_STATE)oldState, (ESTREAM_PUBLISH_STATE)newState, elapseSinceLastState); - }); -} -void UIRtcEngineEventHandler::onExtensionEvent(const char* provider, const char* extension, const char* key, const char* value) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnExtensionEvent.Broadcast(FString(provider), FString(extension), FString(key), FString(value)); - }); -} -void UIRtcEngineEventHandler::onExtensionStarted(const char* provider, const char* extension) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnExtensionStarted.Broadcast(FString(provider), FString(extension)); - }); -} -void UIRtcEngineEventHandler::onExtensionStopped(const char* provider, const char* extension) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnExtensionStopped.Broadcast(FString(provider), FString(extension)); - }); -} -void UIRtcEngineEventHandler::onExtensionError(const char* provider, const char* extension, int error, const char* message) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnExtensionError.Broadcast(FString(provider), FString(extension), error, FString(message)); - }); -} -void UIRtcEngineEventHandler::onUserAccountUpdated(agora::rtc::uid_t uid, const char* userAccount) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserAccountUpdated.Broadcast((int64)uid, FString(userAccount)); - }); -} - - -void UIRtcEngineEventHandler::onLocalVideoTranscoderError(const agora::rtc::TranscodingVideoStream& stream, agora::rtc::VIDEO_TRANSCODER_ERROR error) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FTranscodingVideoStream videoStream; - videoStream.sourceType = (EMEDIA_SOURCE_TYPE)stream.sourceType; - videoStream.remoteUserUid = stream.remoteUserUid; - videoStream.imageUrl = FString(stream.imageUrl); - videoStream.x = stream.x; - videoStream.y = stream.y; - videoStream.width = stream.width; - videoStream.height = stream.height; - videoStream.zOrder = stream.zOrder; - videoStream.alpha = stream.alpha; - videoStream.mirror = stream.mirror; - OnLocalVideoTranscoderError.Broadcast(videoStream, (EVIDEO_TRANSCODER_ERROR)error); - }); -} - - -void UIRtcEngineEventHandler::onVideoRenderingTracingResult(agora::rtc::uid_t uid, agora::rtc::MEDIA_TRACE_EVENT currentEvent, agora::rtc::VideoRenderingTracingInfo tracingInfo) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FVideoRenderingTracingInfo videoRenderingTracingInfo; - videoRenderingTracingInfo.elapsedTime = tracingInfo.elapsedTime; - videoRenderingTracingInfo.start2JoinChannel = tracingInfo.start2JoinChannel; - videoRenderingTracingInfo.join2JoinSuccess = tracingInfo.join2JoinSuccess; - videoRenderingTracingInfo.joinSuccess2RemoteJoined = tracingInfo.joinSuccess2RemoteJoined; - videoRenderingTracingInfo.remoteJoined2SetView = tracingInfo.remoteJoined2SetView; - videoRenderingTracingInfo.remoteJoined2UnmuteVideo = tracingInfo.remoteJoined2UnmuteVideo; - videoRenderingTracingInfo.remoteJoined2PacketReceived = tracingInfo.remoteJoined2PacketReceived; - OnVideoRenderingTracingResult.Broadcast((int64)uid, (EMEDIA_TRACE_EVENT)currentEvent, videoRenderingTracingInfo); - }); -} - -int UIMetadataObserver::getMaxMetadataSize() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return DEFAULT_METADATA_SIZE_IN_BYTE; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetMaxMetadataSize.Broadcast(); - }); - return DEFAULT_METADATA_SIZE_IN_BYTE; -} -bool UIMetadataObserver::onReadyToSendMetadata(agora::rtc::IMetadataObserver::Metadata& metadata, agora::rtc::VIDEO_SOURCE_TYPE source_type) -{ - FAgoraMetadata data; - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnReadyToSendMetadata.Broadcast(data, (EVIDEO_SOURCE_TYPE)source_type); - }); - metadata.uid = data.uid; - metadata.size = data.size; - unsigned char* tempdata = new unsigned char[data.size]; - for (int i = 0; i < data.size; i++) - { - tempdata[i] = data.buffer[i]; - } - FMemory::Memcpy(metadata.buffer, tempdata, data.size); - delete[] tempdata; - metadata.timeStampMs = data.timeStampMs; - return true; -} -void UIMetadataObserver::onMetadataReceived(const agora::rtc::IMetadataObserver::Metadata& metadata) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FAgoraMetadata data; - data.uid = metadata.uid; - data.size = metadata.size; - unsigned char* tempdata = new unsigned char[data.size]; - FMemory::Memcpy((void*)tempdata, metadata.buffer, metadata.size); - TArray callBackdata; - for (int i = 0; i < data.size; i++) - { - callBackdata.Add(tempdata[i]); - } - delete[] tempdata; - data.buffer = callBackdata; - data.timeStampMs = metadata.timeStampMs; - OnMetadataReceived.Broadcast(data); - }); -} -void UIDirectCdnStreamingEventHandler::onDirectCdnStreamingStateChanged(agora::rtc::DIRECT_CDN_STREAMING_STATE state, agora::rtc::DIRECT_CDN_STREAMING_ERROR error, const char* message) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnDirectCdnStreamingStateChanged.Broadcast((EDIRECT_CDN_STREAMING_STATE)state, (EDIRECT_CDN_STREAMING_ERROR)error, FString(message)); - }); -} -void UIDirectCdnStreamingEventHandler::onDirectCdnStreamingStats(const agora::rtc::DirectCdnStreamingStats& stats) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FDirectCdnStreamingStats directCdnStreamingStats; - directCdnStreamingStats.videoWidth = stats.videoWidth; - directCdnStreamingStats.videoHeight = stats.videoHeight; - directCdnStreamingStats.fps = stats.fps; - directCdnStreamingStats.videoBitrate = stats.videoBitrate; - directCdnStreamingStats.audioBitrate = stats.audioBitrate; - OnDirectCdnStreamingStats.Broadcast(directCdnStreamingStats); - }); -} - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandlerEx.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandlerEx.cpp deleted file mode 100644 index af38af01..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandlerEx.cpp +++ /dev/null @@ -1,1340 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/AgoraIRtcEngineEventHandlerEx.h" - -void UIRtcEngineEventHandlerEx::onJoinChannelSuccess(const agora::rtc::RtcConnection& connection, int elapsed) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnJoinChannelSuccessEx.Broadcast(rtcConnection, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onRejoinChannelSuccess(const agora::rtc::RtcConnection& connection, int elapsed) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRejoinChannelSuccessEx.Broadcast(rtcConnection, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onAudioQuality(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int quality, unsigned short delay, unsigned short lost) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioQualityEx.Broadcast(rtcConnection, (int64)remoteUid, quality, delay, lost); - }); -} -void UIRtcEngineEventHandlerEx::onAudioVolumeIndication(const agora::rtc::RtcConnection& connection, const agora::rtc::AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - TArray audioVolumeInfo; - for (unsigned int i = 0; i < speakerNumber; i++) - { - FAudioVolumeInfo info; - info.uid = speakers[i].uid; - info.vad = speakers[i].vad; - info.voicePitch = speakers[i].voicePitch; - info.volume = speakers[i].volume; - audioVolumeInfo.Add(info); - } - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnAudioVolumeIndicationEx.Broadcast(rtcConnection, audioVolumeInfo, totalVolume); - }); -} -void UIRtcEngineEventHandlerEx::onLeaveChannel(const agora::rtc::RtcConnection& connection, const agora::rtc::RtcStats& stats) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - FRtcStats rtcStats; - rtcStats.duration = stats.duration; - rtcStats.txBytes = stats.txBytes; - rtcStats.rxBytes = stats.rxBytes; - rtcStats.txAudioBytes = stats.txAudioBytes; - rtcStats.txVideoBytes = stats.txVideoBytes; - rtcStats.rxAudioBytes = stats.rxAudioBytes; - rtcStats.rxVideoBytes = stats.rxVideoBytes; - rtcStats.txKBitRate = stats.txKBitRate; - rtcStats.rxKBitRate = stats.rxKBitRate; - rtcStats.rxAudioKBitRate = stats.rxAudioKBitRate; - rtcStats.txAudioKBitRate = stats.txAudioKBitRate; - rtcStats.rxVideoKBitRate = stats.rxVideoKBitRate; - rtcStats.txVideoKBitRate = stats.txVideoKBitRate; - rtcStats.lastmileDelay = stats.lastmileDelay; - rtcStats.userCount = stats.userCount; - rtcStats.cpuAppUsage = stats.cpuAppUsage; - rtcStats.cpuTotalUsage = stats.cpuTotalUsage; - rtcStats.gatewayRtt = stats.gatewayRtt; - rtcStats.memoryAppUsageRatio = stats.memoryAppUsageRatio; - rtcStats.memoryTotalUsageRatio = stats.memoryTotalUsageRatio; - rtcStats.memoryAppUsageInKbytes = stats.memoryAppUsageInKbytes; - rtcStats.connectTimeMs = stats.connectTimeMs; - rtcStats.firstAudioPacketDuration = stats.firstAudioPacketDuration; - rtcStats.firstVideoPacketDuration = stats.firstVideoPacketDuration; - rtcStats.firstVideoKeyFramePacketDuration = stats.firstVideoKeyFramePacketDuration; - rtcStats.packetsBeforeFirstKeyFramePacket = stats.packetsBeforeFirstKeyFramePacket; - rtcStats.firstAudioPacketDurationAfterUnmute = stats.firstAudioPacketDurationAfterUnmute; - rtcStats.firstVideoPacketDurationAfterUnmute = stats.firstVideoPacketDurationAfterUnmute; - rtcStats.firstVideoKeyFramePacketDurationAfterUnmute = stats.firstVideoKeyFramePacketDurationAfterUnmute; - rtcStats.firstVideoKeyFrameDecodedDurationAfterUnmute = stats.firstVideoKeyFrameDecodedDurationAfterUnmute; - rtcStats.firstVideoKeyFrameRenderedDurationAfterUnmute = stats.firstVideoKeyFrameRenderedDurationAfterUnmute; - rtcStats.txPacketLossRate = stats.txPacketLossRate; - rtcStats.rxPacketLossRate = stats.rxPacketLossRate; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLeaveChannelEx.Broadcast(rtcConnection, rtcStats); - }); -} -void UIRtcEngineEventHandlerEx::onRtcStats(const agora::rtc::RtcConnection& connection, const agora::rtc::RtcStats& stats) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - FRtcStats rtcStats; - rtcStats.duration = stats.duration; - rtcStats.txBytes = stats.txBytes; - rtcStats.rxBytes = stats.rxBytes; - rtcStats.txAudioBytes = stats.txAudioBytes; - rtcStats.txVideoBytes = stats.txVideoBytes; - rtcStats.rxAudioBytes = stats.rxAudioBytes; - rtcStats.rxVideoBytes = stats.rxVideoBytes; - rtcStats.txKBitRate = stats.txKBitRate; - rtcStats.rxKBitRate = stats.rxKBitRate; - rtcStats.rxAudioKBitRate = stats.rxAudioKBitRate; - rtcStats.txAudioKBitRate = stats.txAudioKBitRate; - rtcStats.rxVideoKBitRate = stats.rxVideoKBitRate; - rtcStats.txVideoKBitRate = stats.txVideoKBitRate; - rtcStats.lastmileDelay = stats.lastmileDelay; - rtcStats.userCount = stats.userCount; - rtcStats.cpuAppUsage = stats.cpuAppUsage; - rtcStats.cpuTotalUsage = stats.cpuTotalUsage; - rtcStats.gatewayRtt = stats.gatewayRtt; - rtcStats.memoryAppUsageRatio = stats.memoryAppUsageRatio; - rtcStats.memoryTotalUsageRatio = stats.memoryTotalUsageRatio; - rtcStats.memoryAppUsageInKbytes = stats.memoryAppUsageInKbytes; - rtcStats.connectTimeMs = stats.connectTimeMs; - rtcStats.firstAudioPacketDuration = stats.firstAudioPacketDuration; - rtcStats.firstVideoPacketDuration = stats.firstVideoPacketDuration; - rtcStats.firstVideoKeyFramePacketDuration = stats.firstVideoKeyFramePacketDuration; - rtcStats.packetsBeforeFirstKeyFramePacket = stats.packetsBeforeFirstKeyFramePacket; - rtcStats.firstAudioPacketDurationAfterUnmute = stats.firstAudioPacketDurationAfterUnmute; - rtcStats.firstVideoPacketDurationAfterUnmute = stats.firstVideoPacketDurationAfterUnmute; - rtcStats.firstVideoKeyFramePacketDurationAfterUnmute = stats.firstVideoKeyFramePacketDurationAfterUnmute; - rtcStats.firstVideoKeyFrameDecodedDurationAfterUnmute = stats.firstVideoKeyFrameDecodedDurationAfterUnmute; - rtcStats.firstVideoKeyFrameRenderedDurationAfterUnmute = stats.firstVideoKeyFrameRenderedDurationAfterUnmute; - rtcStats.txPacketLossRate = stats.txPacketLossRate; - rtcStats.rxPacketLossRate = stats.rxPacketLossRate; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRtcStatsEx.Broadcast(rtcConnection, rtcStats); - }); -} -void UIRtcEngineEventHandlerEx::onNetworkQuality(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int txQuality, int rxQuality) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnNetworkQualityEx.Broadcast(rtcConnection, (int64)remoteUid, txQuality, rxQuality); - }); -} -void UIRtcEngineEventHandlerEx::onIntraRequestReceived(const agora::rtc::RtcConnection& connection) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnIntraRequestReceivedEx.Broadcast(rtcConnection); - }); -} - -void UIRtcEngineEventHandlerEx::onFirstLocalVideoFramePublished(const agora::rtc::RtcConnection& connection, int elapsed) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstLocalVideoFramePublishedEx.Broadcast(rtcConnection, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onFirstRemoteVideoDecoded(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int width, int height, int elapsed) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstRemoteVideoDecodedEx.Broadcast(rtcConnection, (int64)remoteUid, width, height, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onVideoSizeChanged(const agora::rtc::RtcConnection& connection, agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::rtc::uid_t uid, int width, int height, int rotation) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnVideoSizeChangedEx.Broadcast(rtcConnection, (EVIDEO_SOURCE_TYPE)sourceType, (int64)uid, width, height, rotation); - }); -} -void UIRtcEngineEventHandlerEx::onLocalVideoStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::LOCAL_VIDEO_STREAM_STATE state, agora::rtc::LOCAL_VIDEO_STREAM_ERROR errorCode) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLocalVideoStateChangedEx.Broadcast(rtcConnection, (ELOCAL_VIDEO_STREAM_STATE)state, (ELOCAL_VIDEO_STREAM_ERROR)errorCode); - }); -} -void UIRtcEngineEventHandlerEx::onRemoteVideoStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::REMOTE_VIDEO_STATE state, agora::rtc::REMOTE_VIDEO_STATE_REASON reason, int elapsed) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteVideoStateChangedEx.Broadcast(rtcConnection, (int64)remoteUid, (EREMOTE_VIDEO_STATE)state, (EREMOTE_VIDEO_STATE_REASON)reason, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onFirstRemoteVideoFrame(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int width, int height, int elapsed) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstRemoteVideoFrameEx.Broadcast(rtcConnection, (int64)remoteUid, width, height, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onUserJoined(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int elapsed) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserJoinedEx.Broadcast(rtcConnection, (int64)remoteUid, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onUserOffline(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserOfflineEx.Broadcast(rtcConnection, (int64)remoteUid, (EUSER_OFFLINE_REASON_TYPE)reason); - }); -} -void UIRtcEngineEventHandlerEx::onUserMuteAudio(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, bool muted) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserMuteAudioEx.Broadcast(rtcConnection, (int64)remoteUid, muted); - }); -} -void UIRtcEngineEventHandlerEx::onUserMuteVideo(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, bool muted) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserMuteVideoEx.Broadcast(rtcConnection, (int64)remoteUid, muted); - }); -} -void UIRtcEngineEventHandlerEx::onUserEnableVideo(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, bool enabled) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserEnableVideoEx.Broadcast(rtcConnection, (int64)remoteUid, enabled); - }); -} -void UIRtcEngineEventHandlerEx::onUserEnableLocalVideo(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, bool enabled) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserEnableLocalVideoEx.Broadcast(rtcConnection, (int64)remoteUid, enabled); - }); -} -void UIRtcEngineEventHandlerEx::onUserStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, uint32_t state) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserStateChangedEx.Broadcast(rtcConnection, (int64)remoteUid, state); - }); -} -void UIRtcEngineEventHandlerEx::onLocalAudioStats(const agora::rtc::RtcConnection& connection, const agora::rtc::LocalAudioStats& stats) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - FLocalAudioStats localAudioStats; - localAudioStats.numChannels = stats.numChannels; - localAudioStats.sentSampleRate = stats.sentSampleRate; - localAudioStats.sentBitrate = stats.sentBitrate; - localAudioStats.internalCodec = stats.internalCodec; - localAudioStats.txPacketLossRate = stats.txPacketLossRate; - localAudioStats.audioDeviceDelay = stats.audioDeviceDelay; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLocalAudioStatsEx.Broadcast(rtcConnection, localAudioStats); - }); -} -void UIRtcEngineEventHandlerEx::onRemoteAudioStats(const agora::rtc::RtcConnection& connection, const agora::rtc::RemoteAudioStats& stats) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - FRemoteAudioStats remoteAudioStats; - remoteAudioStats.uid = stats.uid; - remoteAudioStats.quality = stats.quality; - remoteAudioStats.networkTransportDelay = stats.networkTransportDelay; - remoteAudioStats.jitterBufferDelay = stats.jitterBufferDelay; - remoteAudioStats.audioLossRate = stats.audioLossRate; - remoteAudioStats.numChannels = stats.numChannels; - remoteAudioStats.receivedSampleRate = stats.receivedSampleRate; - remoteAudioStats.receivedBitrate = stats.receivedBitrate; - remoteAudioStats.totalFrozenTime = stats.totalFrozenTime; - remoteAudioStats.frozenRate = stats.frozenRate; - remoteAudioStats.mosValue = stats.mosValue; - remoteAudioStats.totalActiveTime = stats.totalActiveTime; - remoteAudioStats.publishDuration = stats.publishDuration; - remoteAudioStats.qoeQuality = stats.qoeQuality; - remoteAudioStats.qualityChangedReason = stats.qualityChangedReason; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteAudioStatsEx.Broadcast(rtcConnection, remoteAudioStats); - }); -} -void UIRtcEngineEventHandlerEx::onLocalVideoStats(const agora::rtc::RtcConnection& connection, const agora::rtc::LocalVideoStats& stats) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - FLocalVideoStats localVideoStats; - localVideoStats.uid = stats.uid; - localVideoStats.sentBitrate = stats.sentBitrate; - localVideoStats.sentFrameRate = stats.sentFrameRate; - localVideoStats.captureFrameRate = stats.captureFrameRate; - localVideoStats.captureFrameWidth = stats.captureFrameWidth; - localVideoStats.captureFrameHeight = stats.captureFrameHeight; - localVideoStats.regulatedCaptureFrameRate = stats.regulatedCaptureFrameRate; - localVideoStats.regulatedCaptureFrameWidth = stats.regulatedCaptureFrameWidth; - localVideoStats.regulatedCaptureFrameHeight = stats.regulatedCaptureFrameHeight; - localVideoStats.encoderOutputFrameRate = stats.encoderOutputFrameRate; - localVideoStats.encodedFrameWidth = stats.encodedFrameWidth; - localVideoStats.encodedFrameHeight = stats.encodedFrameHeight; - localVideoStats.rendererOutputFrameRate = stats.rendererOutputFrameRate; - localVideoStats.targetBitrate = stats.targetBitrate; - localVideoStats.targetFrameRate = stats.targetFrameRate; - localVideoStats.qualityAdaptIndication = (EQUALITY_ADAPT_INDICATION)stats.qualityAdaptIndication; - localVideoStats.encodedBitrate = stats.encodedBitrate; - localVideoStats.encodedFrameCount = stats.encodedFrameCount; - localVideoStats.codecType = (EVIDEO_CODEC_TYPE)stats.codecType; - localVideoStats.txPacketLossRate = stats.txPacketLossRate; - localVideoStats.captureBrightnessLevel = stats.captureBrightnessLevel; - localVideoStats.dualStreamEnabled = stats.dualStreamEnabled; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLocalVideoStatsEx.Broadcast(rtcConnection, localVideoStats); - }); -} -void UIRtcEngineEventHandlerEx::onRemoteVideoStats(const agora::rtc::RtcConnection& connection, const agora::rtc::RemoteVideoStats& stats) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - FRemoteVideoStats remoteVideoStats; - remoteVideoStats.uid = stats.uid; - remoteVideoStats.e2eDelay = stats.e2eDelay; - remoteVideoStats.width = stats.width; - remoteVideoStats.height = stats.height; - remoteVideoStats.receivedBitrate = stats.receivedBitrate; - remoteVideoStats.decoderOutputFrameRate = stats.decoderOutputFrameRate; - remoteVideoStats.rendererOutputFrameRate = stats.rendererOutputFrameRate; - remoteVideoStats.frameLossRate = stats.frameLossRate; - remoteVideoStats.packetLossRate = stats.packetLossRate; - remoteVideoStats.rxStreamType = (EVIDEO_STREAM_TYPE)stats.rxStreamType; - remoteVideoStats.totalFrozenTime = stats.totalFrozenTime; - remoteVideoStats.frozenRate = stats.frozenRate; - remoteVideoStats.avSyncTimeMs = stats.avSyncTimeMs; - remoteVideoStats.totalActiveTime = stats.totalActiveTime; - remoteVideoStats.publishDuration = stats.publishDuration; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteVideoStatsEx.Broadcast(rtcConnection, remoteVideoStats); - }); -} -void UIRtcEngineEventHandlerEx::onConnectionLost(const agora::rtc::RtcConnection& connection) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnConnectionLostEx.Broadcast(rtcConnection); - }); -} -void UIRtcEngineEventHandlerEx::onConnectionInterrupted(const agora::rtc::RtcConnection& connection) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnConnectionInterruptedEx.Broadcast(rtcConnection); - }); -} -void UIRtcEngineEventHandlerEx::onConnectionBanned(const agora::rtc::RtcConnection& connection) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnConnectionBannedEx.Broadcast(rtcConnection); - }); -} -void UIRtcEngineEventHandlerEx::onStreamMessage(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int streamId, const char* data, size_t length, uint64_t sentTs) -{ - - char* tempdata = new char[length]; - FMemory::Memcpy(tempdata, data, length); - std::string temp(tempdata); - delete[] tempdata; - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnStreamMessageEx.Broadcast(rtcConnection, (int64)remoteUid, streamId, FString(UTF8_TO_TCHAR(temp.c_str())), length, sentTs); - }); -} -void UIRtcEngineEventHandlerEx::onStreamMessageError(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int streamId, int code, int missed, int cached) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnStreamMessageErrorEx.Broadcast(rtcConnection, (int64)remoteUid, streamId, code, missed, cached); - }); -} -void UIRtcEngineEventHandlerEx::onRequestToken(const agora::rtc::RtcConnection& connection) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRequestTokenEx.Broadcast(rtcConnection); - }); -} - - - -void UIRtcEngineEventHandlerEx::onLicenseValidationFailure(const agora::rtc::RtcConnection& connection, agora::LICENSE_ERROR_TYPE reason) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - ELICENSE_ERROR_TYPE licenseErrorType = (ELICENSE_ERROR_TYPE)reason; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLicenseValidationFailureEx.Broadcast(rtcConnection, licenseErrorType); - }); -} - -void UIRtcEngineEventHandlerEx::onTokenPrivilegeWillExpire(const agora::rtc::RtcConnection& connection, const char* token) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnTokenPrivilegeWillExpireEx.Broadcast(rtcConnection, FString(token)); - }); -} -void UIRtcEngineEventHandlerEx::onFirstLocalAudioFramePublished(const agora::rtc::RtcConnection& connection, int elapsed) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstLocalAudioFramePublishedEx.Broadcast(rtcConnection, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onFirstRemoteAudioFrame(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t userId, int elapsed) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstRemoteAudioFrameEx.Broadcast(rtcConnection, userId, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onFirstRemoteAudioDecoded(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t uid, int elapsed) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnFirstRemoteAudioDecodedEx.Broadcast(rtcConnection, (int64)uid, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onLocalAudioStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::LOCAL_AUDIO_STREAM_STATE state, agora::rtc::LOCAL_AUDIO_STREAM_ERROR error) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnLocalAudioStateChangedEx.Broadcast(rtcConnection, (ELOCAL_AUDIO_STREAM_STATE)state, (ELOCAL_AUDIO_STREAM_ERROR)error); - }); -} -void UIRtcEngineEventHandlerEx::onRemoteAudioStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::REMOTE_AUDIO_STATE state, agora::rtc::REMOTE_AUDIO_STATE_REASON reason, int elapsed) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteAudioStateChangedEx.Broadcast(rtcConnection, remoteUid, (EREMOTE_AUDIO_STATE)state, (EREMOTE_AUDIO_STATE_REASON)reason, elapsed); - }); -} -void UIRtcEngineEventHandlerEx::onActiveSpeaker(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t uid) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnActiveSpeakerEx.Broadcast(rtcConnection, (int64)uid); - }); -} -void UIRtcEngineEventHandlerEx::onClientRoleChanged(const agora::rtc::RtcConnection& connection, agora::rtc::CLIENT_ROLE_TYPE oldRole, agora::rtc::CLIENT_ROLE_TYPE newRole, const agora::rtc::ClientRoleOptions& newRoleOptions) -{ - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - FClientRoleOptions options; - options.audienceLatencyLevel = (EAUDIENCE_LATENCY_LEVEL_TYPE)newRoleOptions.audienceLatencyLevel; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnClientRoleChangedEx.Broadcast(rtcConnection, (ECLIENT_ROLE_TYPE)oldRole, (ECLIENT_ROLE_TYPE)newRole, options); - }); -} -void UIRtcEngineEventHandlerEx::onClientRoleChangeFailed(const agora::rtc::RtcConnection& connection, agora::rtc::CLIENT_ROLE_CHANGE_FAILED_REASON reason, agora::rtc::CLIENT_ROLE_TYPE currentRole) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnClientRoleChangeFailedEx.Broadcast(rtcConnection, (ECLIENT_ROLE_CHANGE_FAILED_REASON)reason, (ECLIENT_ROLE_TYPE)currentRole); - }); -} -void UIRtcEngineEventHandlerEx::onRemoteAudioTransportStats(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteAudioTransportStatsEx.Broadcast(rtcConnection, remoteUid, delay, lost, rxKBitRate); - }); -} -void UIRtcEngineEventHandlerEx::onRemoteVideoTransportStats(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRemoteVideoTransportStatsEx.Broadcast(rtcConnection, (int64)remoteUid, delay, lost, rxKBitRate); - }); -} -void UIRtcEngineEventHandlerEx::onConnectionStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::CONNECTION_STATE_TYPE state, agora::rtc::CONNECTION_CHANGED_REASON_TYPE reason) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnConnectionStateChangedEx.Broadcast(rtcConnection, (ECONNECTION_STATE_TYPE)state, (ECONNECTION_CHANGED_REASON_TYPE)reason); - }); -} -void UIRtcEngineEventHandlerEx::onWlAccMessage(const agora::rtc::RtcConnection& connection, agora::rtc::WLACC_MESSAGE_REASON reason, agora::rtc::WLACC_SUGGEST_ACTION action, const char* wlAccMsg) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnWlAccMessageEx.Broadcast(rtcConnection, (EWLACC_MESSAGE_REASON)reason, (EWLACC_SUGGEST_ACTION)action, FString(wlAccMsg)); - }); -} -void UIRtcEngineEventHandlerEx::onWlAccStats(const agora::rtc::RtcConnection& connection, agora::rtc::WlAccStats currentStats, agora::rtc::WlAccStats averageStats) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - FWlAccStats current; - current.e2eDelayPercent = currentStats.e2eDelayPercent; - current.frozenRatioPercent = currentStats.frozenRatioPercent; - current.lossRatePercent = currentStats.lossRatePercent; - FWlAccStats average; - average.e2eDelayPercent = averageStats.e2eDelayPercent; - average.frozenRatioPercent = averageStats.frozenRatioPercent; - average.lossRatePercent = averageStats.lossRatePercent; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnWlAccStatsEx.Broadcast(rtcConnection, current, average); - }); -} -void UIRtcEngineEventHandlerEx::onNetworkTypeChanged(const agora::rtc::RtcConnection& connection, agora::rtc::NETWORK_TYPE type) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnNetworkTypeChangedEx.Broadcast(rtcConnection, type); - }); -} -void UIRtcEngineEventHandlerEx::onEncryptionError(const agora::rtc::RtcConnection& connection, agora::rtc::ENCRYPTION_ERROR_TYPE errorType) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnEncryptionErrorEx.Broadcast(rtcConnection, (EENCRYPTION_ERROR_TYPE)errorType); - }); -} -void UIRtcEngineEventHandlerEx::onUploadLogResult(const agora::rtc::RtcConnection& connection, const char* requestId, bool success, agora::rtc::UPLOAD_ERROR_REASON reason) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUploadLogResultEx.Broadcast(rtcConnection, FString(requestId), success, (EUPLOAD_ERROR_REASON)reason); - }); -} -void UIRtcEngineEventHandlerEx::onUserAccountUpdated(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, const char* userAccount) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnUserAccountUpdatedEx.Broadcast(rtcConnection, remoteUid, FString(userAccount)); - }); -} -void UIRtcEngineEventHandlerEx::onSnapshotTaken(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t uid, const char* filePath, int width, int height, int errCode) -{ - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnSnapshotTakenEx.Broadcast(rtcConnection, (int64)uid, FString(filePath), width, height, errCode); - }); -} - -void UIRtcEngineEventHandlerEx::onVideoRenderingTracingResult(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t uid, agora::rtc::MEDIA_TRACE_EVENT currentEvent, agora::rtc::VideoRenderingTracingInfo tracingInfo) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FRtcConnection rtcConnection; - rtcConnection.channelId = FString(connection.channelId); - rtcConnection.localUid = connection.localUid; - - FVideoRenderingTracingInfo videoRenderingTracingInfo; - videoRenderingTracingInfo.elapsedTime = tracingInfo.elapsedTime; - videoRenderingTracingInfo.start2JoinChannel = tracingInfo.start2JoinChannel; - videoRenderingTracingInfo.join2JoinSuccess = tracingInfo.join2JoinSuccess; - videoRenderingTracingInfo.joinSuccess2RemoteJoined = tracingInfo.joinSuccess2RemoteJoined; - videoRenderingTracingInfo.remoteJoined2SetView = tracingInfo.remoteJoined2SetView; - videoRenderingTracingInfo.remoteJoined2UnmuteVideo = tracingInfo.remoteJoined2UnmuteVideo; - videoRenderingTracingInfo.remoteJoined2PacketReceived = tracingInfo.remoteJoined2PacketReceived; - - OnVideoRenderingTracingResultEx.Broadcast(rtcConnection, (int64)uid, (EMEDIA_TRACE_EVENT)currentEvent, videoRenderingTracingInfo); - }); - -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraMediaPlayer.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraMediaPlayer.cpp deleted file mode 100644 index dd30c2e2..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraMediaPlayer.cpp +++ /dev/null @@ -1,343 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/AgoraMediaPlayer.h" -#include "AgoraCppPlugin/IAgoraMediaPlayer.h" -#include - - -int UIMediaPlayer::GetMediaPlayerId() -{ - return MediaPlayer->getMediaPlayerId(); -} -int UIMediaPlayer::Open(FString url, int64 startPos) -{ - return MediaPlayer->open(TCHAR_TO_UTF8(*url), startPos); -} - -int UIMediaPlayer::OpenWithCustomSource(int64 startPos, UIMediaPlayerCustomDataProvider* provider) -{ - return MediaPlayer->openWithCustomSource(startPos, provider); -} -int UIMediaPlayer::OpenWithMediaSource(const FAgoraMediaSource& source) -{ - agora::media::base::MediaSource mediaSource; - std::string StdStringURL = TCHAR_TO_UTF8(*source.url); - std::string StdStringURI = TCHAR_TO_UTF8(*source.uri); - mediaSource.url = StdStringURL.c_str(); - mediaSource.uri = StdStringURI.c_str(); - mediaSource.startPos = source.startPos; - mediaSource.autoPlay = source.autoPlay; - mediaSource.enableCache = source.enableCache; - if (source.isAgoraSource != AGORAOPTIONAL::AGORA_NULL_VALUE) - { - mediaSource.isAgoraSource = source.isAgoraSource == AGORAOPTIONAL::AGORA_TRUE_VALUE; - } - if (source.isLiveSource != AGORAOPTIONAL::AGORA_NULL_VALUE) - { - mediaSource.isLiveSource = source.isLiveSource == AGORAOPTIONAL::AGORA_TRUE_VALUE; - } - mediaSource.provider = source.provider; - - return MediaPlayer->openWithMediaSource(mediaSource); -} -int UIMediaPlayer::Play() -{ - return MediaPlayer->play(); -} -int UIMediaPlayer::Pause() -{ - return MediaPlayer->pause(); -} -int UIMediaPlayer::Stop() -{ - return MediaPlayer->stop(); -} -int UIMediaPlayer::Resume() -{ - return MediaPlayer->resume(); -} -int UIMediaPlayer::Seek(int64 newPos) -{ - return MediaPlayer->seek(newPos); -} -int UIMediaPlayer::SetAudioPitch(int pitch) -{ - return MediaPlayer->setAudioPitch(pitch); -} -int UIMediaPlayer::GetDuration(int64& duration) -{ - int64_t dur; - - int ret = MediaPlayer->getDuration(dur); - - duration = dur; - - return ret; -} -int UIMediaPlayer::GetPlayPosition(int64& pos) -{ - int64_t postion; - - int ret = MediaPlayer->getPlayPosition(postion); - - pos = postion; - - return ret; -} -int UIMediaPlayer::GetStreamCount(int64& count) -{ - int64_t con; - - int ret = MediaPlayer->getStreamCount(con); - - count = con; - - return ret; -} -int UIMediaPlayer::GetStreamInfo(int64 index, FPlayerStreamInfo& info) -{ - agora::media::base::PlayerStreamInfo playerStreamInfo; - int ret = MediaPlayer->getStreamInfo(index, &playerStreamInfo); - info.streamIndex = playerStreamInfo.streamIndex; - info.streamType = (EMEDIA_STREAM_TYPE)playerStreamInfo.streamType; - info.codecName = FString(playerStreamInfo.codecName); - info.language = FString(playerStreamInfo.language); - info.videoFrameRate = playerStreamInfo.videoFrameRate; - info.videoBitRate = playerStreamInfo.videoBitRate; - info.videoWidth = playerStreamInfo.videoWidth; - info.videoHeight = playerStreamInfo.videoHeight; - info.videoRotation = playerStreamInfo.videoRotation; - info.audioSampleRate = playerStreamInfo.audioSampleRate; - info.audioChannels = playerStreamInfo.audioChannels; - info.audioBitsPerSample = playerStreamInfo.audioBitsPerSample; - info.duration = playerStreamInfo.duration; - - return -ERROR_NULLPTR; -} -int UIMediaPlayer::SetLoopCount(int loopCount) -{ - return MediaPlayer->setLoopCount(loopCount); -} -int UIMediaPlayer::SetPlaybackSpeed(int speed) -{ - return MediaPlayer->setPlaybackSpeed(speed); -} -int UIMediaPlayer::SelectAudioTrack(int index) -{ - return MediaPlayer->selectAudioTrack(index); -} - -int UIMediaPlayer::SetPlayerOptionInInt(FString key, int value) -{ - auto ret = MediaPlayer->setPlayerOption(TCHAR_TO_UTF8(*key), value); - return ret; -} - -int UIMediaPlayer::SetPlayerOptionInString(FString key, FString value) -{ - auto ret = MediaPlayer->setPlayerOption(TCHAR_TO_UTF8(*key), TCHAR_TO_UTF8(*value)); - return ret; -} - -int UIMediaPlayer::TakeScreenshot(FString filename) -{ - return MediaPlayer->takeScreenshot(TCHAR_TO_UTF8(*filename)); -} -int UIMediaPlayer::SelectInternalSubtitle(int index) -{ - return MediaPlayer->selectInternalSubtitle(index); -} -int UIMediaPlayer::SetExternalSubtitle(FString url) -{ - return MediaPlayer->setExternalSubtitle(TCHAR_TO_UTF8(*url)); -} -EMEDIA_PLAYER_STATE UIMediaPlayer::GetState() -{ - return (EMEDIA_PLAYER_STATE)MediaPlayer->getState(); -} -int UIMediaPlayer::Mute(bool muted) -{ - return MediaPlayer->mute(muted); -} -int UIMediaPlayer::GetMute(bool muted) -{ - return MediaPlayer->getMute(muted); -} -int UIMediaPlayer::AdjustPlayoutVolume(int volume) -{ - return MediaPlayer->adjustPlayoutVolume(volume); -} -int UIMediaPlayer::GetPlayoutVolume(int volume) -{ - return MediaPlayer->getPlayoutVolume(volume); -} -int UIMediaPlayer::AdjustPublishSignalVolume(int volume) -{ - return MediaPlayer->adjustPublishSignalVolume(volume); -} -int UIMediaPlayer::GetPublishSignalVolume(int volume) -{ - return MediaPlayer->getPublishSignalVolume(volume); -} -int UIMediaPlayer::SetView(int64 view) -{ - return MediaPlayer->setView((agora::view_t)view); -} -int UIMediaPlayer::SetRenderMode(ERENDER_MODE_TYPE renderMode) -{ - return MediaPlayer->setRenderMode((agora::media::base::RENDER_MODE_TYPE)renderMode); -} -int UIMediaPlayer::RegisterPlayerSourceObserver(UIMediaPlayerSourceObserver* observer) -{ - return MediaPlayer->registerPlayerSourceObserver(observer); -} -int UIMediaPlayer::UnregisterPlayerSourceObserver(UIMediaPlayerSourceObserver* observer) -{ - return MediaPlayer->unregisterPlayerSourceObserver(observer); -} -int UIMediaPlayer::RegisterAudioFrameObserver(UIAudioPcmFrameSink* observer, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode) -{ - return MediaPlayer->registerAudioFrameObserver((agora::media::IAudioPcmFrameSink*)observer, (agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE)mode); -} -int UIMediaPlayer::UnregisterAudioFrameObserver(UIAudioPcmFrameSink* observer) -{ - return MediaPlayer->unregisterAudioFrameObserver((agora::media::IAudioPcmFrameSink*)observer); -} -int UIMediaPlayer::RegisterVideoFrameObserver(UIVideoFrameObserver* observer) -{ - return MediaPlayer->registerVideoFrameObserver((agora::media::base::IVideoFrameObserver*)observer); -} -int UIMediaPlayer::UnregisterVideoFrameObserver(UIVideoFrameObserver* observer) -{ - return MediaPlayer->unregisterVideoFrameObserver((agora::media::base::IVideoFrameObserver*)observer); -} -int UIMediaPlayer::RegisterMediaPlayerAudioSpectrumObserver(UIAudioSpectrumObserver* observer, int intervalInMS) -{ - return MediaPlayer->registerMediaPlayerAudioSpectrumObserver(observer, intervalInMS); -} -int UIMediaPlayer::UnregisterMediaPlayerAudioSpectrumObserver(UIAudioSpectrumObserver* observer) -{ - return MediaPlayer->unregisterMediaPlayerAudioSpectrumObserver(observer); -} -int UIMediaPlayer::SetAudioDualMonoMode(EAUDIO_DUAL_MONO_MODE mode) -{ - return MediaPlayer->setAudioDualMonoMode((agora::media::base::AUDIO_DUAL_MONO_MODE)mode); -} -FString UIMediaPlayer::GetPlayerSdkVersion() -{ - return MediaPlayer->getPlayerSdkVersion(); -} -FString UIMediaPlayer::GetPlaySrc() -{ - return MediaPlayer->getPlaySrc(); -} -int UIMediaPlayer::OpenWithAgoraCDNSrc(FString src, int64 startPos) -{ - return MediaPlayer->openWithAgoraCDNSrc(TCHAR_TO_UTF8(*src), startPos); -} -int UIMediaPlayer::GetAgoraCDNLineCount() -{ - return MediaPlayer->getAgoraCDNLineCount(); -} -int UIMediaPlayer::SwitchAgoraCDNLineByIndex(int index) -{ - return MediaPlayer->switchAgoraCDNLineByIndex(index); -} -int UIMediaPlayer::GetCurrentAgoraCDNIndex() -{ - return MediaPlayer->getCurrentAgoraCDNIndex(); -} -int UIMediaPlayer::EnableAutoSwitchAgoraCDN(bool enable) -{ - return MediaPlayer->enableAutoSwitchAgoraCDN(enable); -} -int UIMediaPlayer::RenewAgoraCDNSrcToken(FString token, int64 ts) -{ - return MediaPlayer->renewAgoraCDNSrcToken(TCHAR_TO_UTF8(*token), ts); -} -int UIMediaPlayer::SwitchAgoraCDNSrc(FString src, bool syncPts) -{ - return MediaPlayer->switchAgoraCDNSrc(TCHAR_TO_UTF8(*src), syncPts); -} -int UIMediaPlayer::SwitchSrc(FString src, bool syncPts) -{ - return MediaPlayer->switchSrc(TCHAR_TO_UTF8(*src), syncPts); -} -int UIMediaPlayer::PreloadSrc(FString src, int64 startPos) -{ - return MediaPlayer->preloadSrc(TCHAR_TO_UTF8(*src), startPos); -} -int UIMediaPlayer::PlayPreloadedSrc(FString src) -{ - return MediaPlayer->playPreloadedSrc(TCHAR_TO_UTF8(*src)); -} -int UIMediaPlayer::UnloadSrc(FString src) -{ - return MediaPlayer->unloadSrc(TCHAR_TO_UTF8(*src)); -} -int UIMediaPlayer::SetSpatialAudioParams(const FSpatialAudioParams& params) -{ - agora::SpatialAudioParams spatialAudioParams; - SET_AGORA_DATA_SPATIALAUDIOPARAMS(spatialAudioParams, params); - return MediaPlayer->setSpatialAudioParams(spatialAudioParams); -} -int UIMediaPlayer::SetSoundPositionParams(float pan, float gain) -{ - return MediaPlayer->setSoundPositionParams(pan, gain); -} -void UIMediaPlayer::SetMediaPlayer(agora::agora_refptr mediaPlayer) -{ - this->MediaPlayer = mediaPlayer; -} - -agora::agora_refptr UIMediaPlayer::GetMediaPlayer() -{ - return this->MediaPlayer; -} - -int UIMediaPlayerCacheManager::RemoveAllCaches() -{ - return getMediaPlayerCacheManager()->removeAllCaches(); -} -int UIMediaPlayerCacheManager::RemoveOldCache() -{ - return getMediaPlayerCacheManager()->removeOldCache(); -} -int UIMediaPlayerCacheManager::RemoveCacheByUri(FString uri) -{ - return getMediaPlayerCacheManager()->removeCacheByUri(TCHAR_TO_UTF8(*uri)); -} -int UIMediaPlayerCacheManager::SetCacheDir(FString path) -{ - return getMediaPlayerCacheManager()->setCacheDir(TCHAR_TO_UTF8(*path)); -} -int UIMediaPlayerCacheManager::SetMaxCacheFileCount(int count) -{ - return getMediaPlayerCacheManager()->setMaxCacheFileCount(count); -} -int UIMediaPlayerCacheManager::SetMaxCacheFileSize(int64 cacheSize) -{ - return getMediaPlayerCacheManager()->setMaxCacheFileCount(cacheSize); -} -int UIMediaPlayerCacheManager::EnableAutoRemoveCache(bool enable) -{ - return getMediaPlayerCacheManager()->enableAutoRemoveCache(enable); -} -int UIMediaPlayerCacheManager::GetCacheDir(FString path, int length) -{ - return getMediaPlayerCacheManager()->getCacheDir(TCHAR_TO_UTF8(*path), length); -} -int UIMediaPlayerCacheManager::GetMaxCacheFileCount() -{ - return getMediaPlayerCacheManager()->getMaxCacheFileCount(); -} -int64 UIMediaPlayerCacheManager::GetMaxCacheFileSize() -{ - return getMediaPlayerCacheManager()->getMaxCacheFileSize(); -} -int UIMediaPlayerCacheManager::GetCacheFileCount() -{ - return getMediaPlayerCacheManager()->getCacheFileCount(); -} - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraMediaRecorder.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraMediaRecorder.cpp deleted file mode 100644 index 5aba9ae9..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraMediaRecorder.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/AgoraMediaRecorder.h" -#include - -int UIMediaRecorder::SetMediaRecorderObserver(UIMediaRecorderObserver* callback) -{ - if (MediaRecorder != nullptr) - { - return MediaRecorder->setMediaRecorderObserver(callback); - } - return -ERROR_NULLPTR; -} -int UIMediaRecorder::StartRecording(FMediaRecorderConfiguration& config) -{ - agora::media::MediaRecorderConfiguration mediaRecorderConfiguration; - std::string StdStrStoragePath = TCHAR_TO_UTF8(*config.storagePath); - mediaRecorderConfiguration.storagePath = StdStrStoragePath.c_str(); - mediaRecorderConfiguration.containerFormat = (agora::media::MediaRecorderContainerFormat)config.containerFormat; - mediaRecorderConfiguration.streamType = (agora::media::MediaRecorderStreamType)config.streamType; - mediaRecorderConfiguration.maxDurationMs = config.maxDurationMs; - mediaRecorderConfiguration.recorderInfoUpdateInterval = config.recorderInfoUpdateInterval; - if (MediaRecorder != nullptr) - { - return MediaRecorder->startRecording(mediaRecorderConfiguration); - } - return -ERROR_NULLPTR; -} -int UIMediaRecorder::StopRecording() -{ - if (MediaRecorder != nullptr) - { - return MediaRecorder->stopRecording(); - } - return -ERROR_NULLPTR; -} - -void UIMediaRecorder::SetMediaRecorder(agora::rtc::IMediaRecorder* mediaRecorder) -{ - this->MediaRecorder = mediaRecorder; -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraRtcEngine.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraRtcEngine.cpp deleted file mode 100644 index b970f5ff..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraRtcEngine.cpp +++ /dev/null @@ -1,3406 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/AgoraRtcEngine.h" -#include "AgoraBluePrintPlugin/AgoraSpatialAudio.h" -#include "AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.h" -#include "AgoraBluePrintPlugin/AgoraIRtcEngineEventHandlerEx.h" - - -UObject* UAgoraRtcEngine::QueryInterface(EINTERFACE_ID_TYPE iid) -{ - if (iid == EINTERFACE_ID_TYPE::AGORA_IID_VIDEO_DEVICE_MANAGER) - { - agora::rtc::IVideoDeviceManager* VideoDeviceManager = nullptr; - RtcEngineProxyClassWrapper::GetInstance()->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_VIDEO_DEVICE_MANAGER, (void**)&VideoDeviceManager); - - if (videoDeviceManager != nullptr) - { - return videoDeviceManager; - } - - videoDeviceManager = NewObject(); - videoDeviceManager->SetVideoDeviceManager(VideoDeviceManager); - - return videoDeviceManager; - } - else if (iid == EINTERFACE_ID_TYPE::AGORA_IID_AUDIO_DEVICE_MANAGER) - { - agora::rtc::IAudioDeviceManager* AudioDeviceManager = nullptr; - RtcEngineProxyClassWrapper::GetInstance()->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_AUDIO_DEVICE_MANAGER, (void**)&AudioDeviceManager); - - if (audioDeviceManager != nullptr) - { - return audioDeviceManager; - } - audioDeviceManager = NewObject(); - - audioDeviceManager->SetAudioDeviceManager(AudioDeviceManager); - - return audioDeviceManager; - } - else if (iid == EINTERFACE_ID_TYPE::AGORA_IID_LOCAL_SPATIAL_AUDIO) - { - agora::rtc::ILocalSpatialAudioEngine* SpatialAudioEngine = nullptr; - RtcEngineProxyClassWrapper::GetInstance()->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_LOCAL_SPATIAL_AUDIO, (void**)&SpatialAudioEngine); - - if (spatialAudioEngine != nullptr) - { - return spatialAudioEngine; - } - spatialAudioEngine = NewObject(); - - spatialAudioEngine->SetLocalSpatialAudioEngine(SpatialAudioEngine); - - return spatialAudioEngine; - } - //else if (iid == EINTERFACE_ID_TYPE::AGORA_IID_MEDIA_RECORDER) - //{ - // agora::rtc::IMediaRecorder* MediaRecorder = nullptr; - // RtcEngineProxyClassWrapper::GetInstance()->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_MEDIA_RECORDER, (void**)&MediaRecorder); - - // if (mediaRecorder != nullptr) - // { - // return mediaRecorder; - // } - // mediaRecorder = NewObject(); - - // mediaRecorder->SetMediaRecorder(MediaRecorder); - - // return mediaRecorder; - //} - return nullptr; -} -void UAgoraRtcEngine::Release(bool sync) -{ - if (videoDeviceManager != nullptr) - { - videoDeviceManager->Release(); - videoDeviceManager = nullptr; - } - if (audioDeviceManager != nullptr) - { - audioDeviceManager->Release(); - audioDeviceManager = nullptr; - } - if (spatialAudioEngine != nullptr) - { - spatialAudioEngine->Release(); - spatialAudioEngine = nullptr; - } - //if (mediaRecorder != nullptr) - //{ - // mediaRecorder->Release(); - // mediaRecorder = nullptr; - //} - if (mediaPlayer != nullptr) - { - DestroyMediaPlayer(mediaPlayer); - mediaPlayer = nullptr; - } -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - if (screenCaptureSourceList != nullptr) - { - screenCaptureSourceList = nullptr; - } -#endif - return RtcEngineProxyClassWrapper::GetInstance()->release(sync); -} -int UAgoraRtcEngine::Initialize(const FRtcEngineContext& context) -{ - agora::rtc::RtcEngineContext rtcEngineContext; - - if (context.eventHandler != nullptr && std::strcmp(context.eventHandler->eventHandlerType(), "event_handler") == 0) - { - rtcEngineContext.eventHandler = (agora::rtc::IRtcEngineEventHandler*)context.eventHandler; - } - else - { - rtcEngineContext.eventHandler = (agora::rtc::IRtcEngineEventHandlerEx*)context.eventHandler; - } - - std::string appid = TCHAR_TO_UTF8(*context.appId); - - rtcEngineContext.appId = appid.c_str(); - rtcEngineContext.context = (void*)context.context; - rtcEngineContext.channelProfile = (agora::CHANNEL_PROFILE_TYPE)context.channelProfile; - rtcEngineContext.audioScenario = (agora::rtc::AUDIO_SCENARIO_TYPE)context.audioScenario; - rtcEngineContext.areaCode = context.areaCode.GetRawValue(); - agora::commons::LogConfig log; - std::string FilePath = TCHAR_TO_UTF8(*context.logConfig.filePath); - log.filePath = FilePath.c_str(); - log.fileSizeInKB = context.logConfig.fileSizeInKB; - log.level = (agora::commons::LOG_LEVEL)context.logConfig.level; - rtcEngineContext.logConfig = log; - if (context.threadPriority_SetValue) - { - rtcEngineContext.threadPriority = (agora::rtc::THREAD_PRIORITY_TYPE)context.threadPriority; - } - rtcEngineContext.useExternalEglContext = context.useExternalEglContext; - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->initialize(rtcEngineContext); - return ret; -} - -int UAgoraRtcEngine::InitializeEx(const FRtcEngineContextEx& context) -{ - agora::rtc::RtcEngineContext rtcEngineContext; - - if (context.eventHandler != nullptr && std::strcmp(context.eventHandler->eventHandlerType(), "event_handler") == 0) - { - rtcEngineContext.eventHandler = (agora::rtc::IRtcEngineEventHandler*)context.eventHandler; - } - else - { - rtcEngineContext.eventHandler = (agora::rtc::IRtcEngineEventHandlerEx*)context.eventHandler; - } - - std::string appid = TCHAR_TO_UTF8(*context.appId); - - rtcEngineContext.appId = appid.c_str(); - rtcEngineContext.context = (void*)context.context; - rtcEngineContext.channelProfile = (agora::CHANNEL_PROFILE_TYPE)context.channelProfile; - rtcEngineContext.audioScenario = (agora::rtc::AUDIO_SCENARIO_TYPE)context.audioScenario; - rtcEngineContext.areaCode = context.areaCode.GetRawValue(); - - agora::commons::LogConfig log; - std::string FilePath = TCHAR_TO_UTF8(*context.logConfig.filePath); - log.filePath = FilePath.c_str(); - log.fileSizeInKB = context.logConfig.fileSizeInKB; - log.level = (agora::commons::LOG_LEVEL)context.logConfig.level; - rtcEngineContext.logConfig = log; - if (context.threadPriority_SetValue) - { - rtcEngineContext.threadPriority = (agora::rtc::THREAD_PRIORITY_TYPE)context.threadPriority; - } - rtcEngineContext.useExternalEglContext = context.useExternalEglContext; - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->initialize(rtcEngineContext); - return ret; -} - -FString UAgoraRtcEngine::GetVersion(int build) -{ - return RtcEngineProxyClassWrapper::GetInstance()->getVersion(&build); -} -FString UAgoraRtcEngine::GetErrorDescription(int code) -{ - return RtcEngineProxyClassWrapper::GetInstance()->getErrorDescription(code); -} - -int UAgoraRtcEngine::QueryCodecCapability(TArray codecInfo) -{ - int size = codecInfo.Num(); - agora::rtc::CodecCapInfo* codecList = new agora::rtc::CodecCapInfo[size]; - for (int i = 0; i < size; i++) - { - codecList[i].codecType = (agora::rtc::VIDEO_CODEC_TYPE)codecInfo[i].codecType; - codecList[i].codecCapMask = codecInfo[i].codecCapMask; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->queryCodecCapability(codecList, size); - delete[] codecList; - return ret; -} - -int UAgoraRtcEngine::JoinChannel(FString token, FString channelId, int64 uid, const FChannelMediaOptions& options) -{ - agora::rtc::ChannelMediaOptions channelMediaOptions; - -#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_MOBILE(channelMediaOptions, options); -#else - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_NONMOBILE_PLATFORM(channelMediaOptions, options); -#endif - - std::string Token = TCHAR_TO_UTF8(*token); - std::string ChannelId = TCHAR_TO_UTF8(*channelId); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->joinChannel(Token.c_str(), ChannelId.c_str(), uid, channelMediaOptions); - return ret; -} -int UAgoraRtcEngine::UpdateChannelMediaOptions(const FChannelMediaOptions& options) -{ - agora::rtc::ChannelMediaOptions channelMediaOptions; - -#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_MOBILE(channelMediaOptions, options); -#else - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_NONMOBILE_PLATFORM(channelMediaOptions, options); -#endif - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateChannelMediaOptions(channelMediaOptions); - return ret; -} - -int UAgoraRtcEngine::LeaveChannel(const FLeaveChannelOptions& options) -{ - agora::rtc::LeaveChannelOptions leaveChannelOptions; - SET_AGORA_DATA_LEAVECHANNELOPTIONS(leaveChannelOptions, options); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->leaveChannel(leaveChannelOptions); - return ret; -} - -int UAgoraRtcEngine::RenewToken(FString token) -{ - std::string Token = TCHAR_TO_UTF8(*token); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->renewToken(Token.c_str()); - return ret; -} -int UAgoraRtcEngine::SetChannelProfile(ECHANNEL_PROFILE_TYPE profile) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setChannelProfile((agora::CHANNEL_PROFILE_TYPE)profile); - return ret; -} -int UAgoraRtcEngine::SetClientRole(ECLIENT_ROLE_TYPE clientroletype, FClientRoleOptions& options) -{ - agora::rtc::ClientRoleOptions clientRoleOptions; - clientRoleOptions.audienceLatencyLevel = (agora::rtc::AUDIENCE_LATENCY_LEVEL_TYPE)options.audienceLatencyLevel; - agora::rtc::CLIENT_ROLE_TYPE roleType = (agora::rtc::CLIENT_ROLE_TYPE)clientroletype; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setClientRole(roleType, clientRoleOptions); - return ret; -} -int UAgoraRtcEngine::StartEchoTest(const FEchoTestConfiguration& config) -{ - agora::rtc::EchoTestConfiguration echoTestConfiguration; - echoTestConfiguration.view = (agora::view_t)config.view; - echoTestConfiguration.enableAudio = config.enableAudio; - echoTestConfiguration.enableVideo = config.enableVideo; - std::string Token = TCHAR_TO_UTF8(*config.token); - echoTestConfiguration.token = Token.c_str(); - std::string ChannelId = TCHAR_TO_UTF8(*config.channelId); - echoTestConfiguration.channelId = ChannelId.c_str(); - echoTestConfiguration.intervalInSeconds = config.intervalInSeconds; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startEchoTest(echoTestConfiguration); - return ret; -} -int UAgoraRtcEngine::StopEchoTest() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopEchoTest(); - return ret; -} - -int UAgoraRtcEngine::EnableMultiCamera(bool enabled, const FCameraCapturerConfiguration& config) -{ - auto ret = -1; - -#if defined(__APPLE__) && TARGET_OS_IOS - agora::rtc::CameraCapturerConfiguration RtcConfig; - RtcConfig.cameraDirection = (agora::rtc::CAMERA_DIRECTION)((int)config.cameraDirection); - ret = RtcEngineProxyClassWrapper::GetInstance()->enableMultiCamera(enabled, RtcConfig); -#endif - - return ret; -} - -int UAgoraRtcEngine::EnableVideo() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableVideo(); - return ret; -} -int UAgoraRtcEngine::DisableVideo() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->disableVideo(); - return ret; -} -int UAgoraRtcEngine::StartPreview(EVIDEO_SOURCE_TYPE sourceType) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startPreview((agora::rtc::VIDEO_SOURCE_TYPE)sourceType); - return ret; -} -int UAgoraRtcEngine::StopPreview(EVIDEO_SOURCE_TYPE sourceType) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopPreview((agora::rtc::VIDEO_SOURCE_TYPE)sourceType); - return ret; -} -int UAgoraRtcEngine::StartLastmileProbeTest(const FLastmileProbeConfig& config) -{ - agora::rtc::LastmileProbeConfig lastmileProbeConfig; - lastmileProbeConfig.probeUplink = config.probeUplink; - lastmileProbeConfig.probeDownlink = config.probeDownlink; - lastmileProbeConfig.expectedUplinkBitrate = config.expectedUplinkBitrate; - lastmileProbeConfig.expectedDownlinkBitrate = config.expectedDownlinkBitrate; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startLastmileProbeTest(lastmileProbeConfig); - return ret; -} - -int UAgoraRtcEngine::StopLastmileProbeTest() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopLastmileProbeTest(); - return ret; -} - -int UAgoraRtcEngine::SetVideoEncoderConfiguration(const FVideoEncoderConfiguration& config) -{ - agora::rtc::VideoEncoderConfiguration videoEncoderConfiguration; - videoEncoderConfiguration.codecType = (agora::rtc::VIDEO_CODEC_TYPE)config.codecType; - - agora::rtc::VideoDimensions dim; - dim.height = config.dimensions.height; - dim.width = config.dimensions.width; - - videoEncoderConfiguration.dimensions = dim; - videoEncoderConfiguration.frameRate = config.frameRate; - videoEncoderConfiguration.bitrate = config.bitrate; - videoEncoderConfiguration.minBitrate = config.minBitrate; - videoEncoderConfiguration.orientationMode = (agora::rtc::ORIENTATION_MODE)config.orientationMode; - videoEncoderConfiguration.degradationPreference = (agora::rtc::DEGRADATION_PREFERENCE)config.degradationPreference; - videoEncoderConfiguration.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)config.mirrorMode; - - agora::rtc::AdvanceOptions advanceOptions; - advanceOptions.encodingPreference = (agora::rtc::ENCODING_PREFERENCE)config.advanceOptions.encodingPreference.GetRawValue(); - advanceOptions.compressionPreference = (agora::rtc::COMPRESSION_PREFERENCE)config.advanceOptions.compressionPreference; - videoEncoderConfiguration.advanceOptions = advanceOptions; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVideoEncoderConfiguration(videoEncoderConfiguration); - return ret; -} -int UAgoraRtcEngine::SetBeautyEffectOptions(bool enabled, const FBeautyOptions& options, EMEDIA_SOURCE_TYPE type) -{ - agora::rtc::BeautyOptions beautyOptions; - beautyOptions.lighteningContrastLevel = (agora::rtc::BeautyOptions::LIGHTENING_CONTRAST_LEVEL)options.lighteningContrastLevel; - beautyOptions.lighteningLevel = options.lighteningLevel; - beautyOptions.smoothnessLevel = options.smoothnessLevel; - beautyOptions.rednessLevel = options.rednessLevel; - beautyOptions.sharpnessLevel = options.sharpnessLevel; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setBeautyEffectOptions(enabled, beautyOptions, (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} -int UAgoraRtcEngine::SetLowlightEnhanceOptions(bool enabled, const FLowlightEnhanceOptions& options, EMEDIA_SOURCE_TYPE type) -{ - agora::rtc::LowlightEnhanceOptions lowlightEnhanceOptions; - lowlightEnhanceOptions.mode = (agora::rtc::LowlightEnhanceOptions::LOW_LIGHT_ENHANCE_MODE)options.mode; - lowlightEnhanceOptions.level = (agora::rtc::LowlightEnhanceOptions::LOW_LIGHT_ENHANCE_LEVEL)options.level; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLowlightEnhanceOptions(enabled, lowlightEnhanceOptions, (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} -int UAgoraRtcEngine::SetVideoDenoiserOptions(bool enabled, const FVideoDenoiserOptions& options, EMEDIA_SOURCE_TYPE type) -{ - agora::rtc::VideoDenoiserOptions videoDenoiserOptions; - videoDenoiserOptions.mode = (agora::rtc::VideoDenoiserOptions::VIDEO_DENOISER_MODE)options.mode; - videoDenoiserOptions.level = (agora::rtc::VideoDenoiserOptions::VIDEO_DENOISER_LEVEL)options.level; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVideoDenoiserOptions(enabled, videoDenoiserOptions, (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} -int UAgoraRtcEngine::SetColorEnhanceOptions(bool enabled, const FColorEnhanceOptions& options, EMEDIA_SOURCE_TYPE type) -{ - agora::rtc::ColorEnhanceOptions colorEnhanceOptions; - colorEnhanceOptions.strengthLevel = options.strengthLevel; - colorEnhanceOptions.skinProtectLevel = options.skinProtectLevel; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setColorEnhanceOptions(enabled, colorEnhanceOptions, (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} -int UAgoraRtcEngine::EnableVirtualBackground(bool enabled, FVirtualBackgroundSource backgroundSource, FSegmentationProperty segproperty, EMEDIA_SOURCE_TYPE type) -{ - agora::rtc::VirtualBackgroundSource virtualBackgroundSource; - virtualBackgroundSource.background_source_type = (agora::rtc::VirtualBackgroundSource::BACKGROUND_SOURCE_TYPE)backgroundSource.background_source_type; - virtualBackgroundSource.color = backgroundSource.color; - std::string Source = TCHAR_TO_UTF8(*backgroundSource.source); - virtualBackgroundSource.source = Source.c_str(); - virtualBackgroundSource.blur_degree = (agora::rtc::VirtualBackgroundSource::BACKGROUND_BLUR_DEGREE)backgroundSource.blur_degree; - agora::rtc::SegmentationProperty segmentationProperty; - segmentationProperty.modelType = (agora::rtc::SegmentationProperty::SEG_MODEL_TYPE)segproperty.modelType; - segmentationProperty.greenCapacity = segproperty.greenCapacity; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableVirtualBackground(enabled, virtualBackgroundSource, segmentationProperty, (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} - -int UAgoraRtcEngine::SetupRemoteVideo(const FVideoCanvas& canvas) -{ - agora::rtc::VideoCanvas videoCanvas; - videoCanvas.view = (agora::view_t)canvas.view; - videoCanvas.renderMode = (agora::media::base::RENDER_MODE_TYPE)canvas.renderMode; - videoCanvas.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)canvas.mirrorMode; - videoCanvas.uid = canvas.uid; - //videoCanvas.priv = canvas.priv; - videoCanvas.sourceType = (agora::rtc::VIDEO_SOURCE_TYPE)canvas.sourceType; - //videoCanvas.cropArea = canvas.cropArea; - videoCanvas.setupMode = (agora::rtc::VIDEO_VIEW_SETUP_MODE)canvas.setupMode; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setupRemoteVideo(videoCanvas); - return ret; -} -int UAgoraRtcEngine::SetupLocalVideo(const FVideoCanvas& canvas) -{ - agora::rtc::VideoCanvas videoCanvas; - videoCanvas.view = (agora::view_t)canvas.view; - //videoCanvas.renderMode = (agora::media::base::RENDER_MODE_TYPE)canvas.renderMode; - //videoCanvas.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)canvas.mirrorMode; - videoCanvas.uid = canvas.uid; - //videoCanvas.isScreenView = canvas.isScreenView; - //videoCanvas.priv = canvas.priv; - //videoCanvas.priv_size = canvas.priv_size; - videoCanvas.sourceType = (agora::rtc::VIDEO_SOURCE_TYPE)canvas.sourceType; - //videoCanvas.cropArea = canvas.cropArea; - //videoCanvas.setupMode = (agora::rtc::VIDEO_VIEW_SETUP_MODE)canvas.setupMode; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setupLocalVideo(videoCanvas); - return ret; -} - -int UAgoraRtcEngine::SetVideoScenario(EVIDEO_APPLICATION_SCENARIO_TYPE scenarioType) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVideoScenario((agora::rtc::VIDEO_APPLICATION_SCENARIO_TYPE)scenarioType); - return ret; -} - -int UAgoraRtcEngine::EnableAudio() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableAudio(); - return ret; -} -int UAgoraRtcEngine::DisableAudio() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->disableAudio(); - return ret; -} - -int UAgoraRtcEngine::SetAudioProfile(EAUDIO_PROFILE_TYPE profile /*= EAUDIO_PROFILE_TYPE::AUDIO_PROFILE_DEFAULT*/, EAUDIO_SCENARIO_TYPE scenario /*= EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT*/) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAudioProfile((agora::rtc::AUDIO_PROFILE_TYPE)profile, (agora::rtc::AUDIO_SCENARIO_TYPE)scenario); - return ret; -} - -int UAgoraRtcEngine::SetAudioScenario(EAUDIO_SCENARIO_TYPE scenario) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAudioScenario((agora::rtc::AUDIO_SCENARIO_TYPE)scenario); - return ret; -} -int UAgoraRtcEngine::EnableLocalAudio(bool enabled) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableLocalAudio(enabled); - return ret; -} -int UAgoraRtcEngine::MuteLocalAudioStream(bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteLocalAudioStream(mute); - return ret; -} -int UAgoraRtcEngine::MuteAllRemoteAudioStreams(bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteAllRemoteAudioStreams(mute); - return ret; -} -int UAgoraRtcEngine::SetDefaultMuteAllRemoteAudioStreams(bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setDefaultMuteAllRemoteAudioStreams(mute); - return ret; -} -int UAgoraRtcEngine::MuteRemoteAudioStream(int64 uid, bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteRemoteAudioStream(uid, mute); - return ret; -} -int UAgoraRtcEngine::MuteLocalVideoStream(bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteLocalVideoStream(mute); - return ret; -} -int UAgoraRtcEngine::EnableLocalVideo(bool enabled) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableLocalVideo(enabled); - return ret; -} -int UAgoraRtcEngine::MuteAllRemoteVideoStreams(bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteAllRemoteVideoStreams(mute); - return ret; -} -int UAgoraRtcEngine::SetDefaultMuteAllRemoteVideoStreams(bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setDefaultMuteAllRemoteVideoStreams(mute); - return ret; -} -int UAgoraRtcEngine::MuteRemoteVideoStream(int64 uid, bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteRemoteVideoStream(uid, mute); - return ret; -} -int UAgoraRtcEngine::SetRemoteVideoStreamType(int64 uid, EVIDEO_STREAM_TYPE streamType) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteVideoStreamType(uid, (agora::rtc::VIDEO_STREAM_TYPE)streamType); - return ret; -} -int UAgoraRtcEngine::SetRemoteVideoSubscriptionOptions(int64 uid, const FVideoSubscriptionOptions& options) -{ - agora::rtc::VideoSubscriptionOptions videoSubscriptionOptions; - SET_AGORA_DATA_VIDEOSUBSCRIPTIONOPTIONS(videoSubscriptionOptions, options); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteVideoSubscriptionOptions(uid, videoSubscriptionOptions); - return ret; -} -int UAgoraRtcEngine::SetRemoteDefaultVideoStreamType(EVIDEO_STREAM_TYPE streamType) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteDefaultVideoStreamType((agora::rtc::VIDEO_STREAM_TYPE)streamType); - return ret; -} - -int UAgoraRtcEngine::EnableAudioVolumeIndication(int interval, int smooth, bool reportVad) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableAudioVolumeIndication(interval, smooth, reportVad); - return ret; -} -int UAgoraRtcEngine::StartAudioRecording(const FAudioRecordingConfiguration& config) -{ - agora::rtc::AudioRecordingConfiguration audioRecordingConfiguration; - std::string FilePath = TCHAR_TO_UTF8(*config.filePath); - audioRecordingConfiguration.filePath = FilePath.c_str(); - audioRecordingConfiguration.encode = config.encode; - audioRecordingConfiguration.sampleRate = config.sampleRate; - audioRecordingConfiguration.fileRecordingType = (agora::rtc::AUDIO_FILE_RECORDING_TYPE)config.fileRecordingType; - audioRecordingConfiguration.quality = (agora::rtc::AUDIO_RECORDING_QUALITY_TYPE)config.quality; - audioRecordingConfiguration.recordingChannel = config.recordingChannel; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startAudioRecording(audioRecordingConfiguration); - return ret; -} - -int UAgoraRtcEngine::RegisterAudioEncodedFrameObserver(const FAudioEncodedFrameObserverConfig& config, UIAudioEncodedFrameObserver* observer) -{ - agora::rtc::AudioEncodedFrameObserverConfig audioEncodedFrameObserverConfig; - audioEncodedFrameObserverConfig.postionType = (agora::rtc::AUDIO_ENCODED_FRAME_OBSERVER_POSITION)config.postionType; - audioEncodedFrameObserverConfig.encodingType = config.encodingType.GetRawValue(); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->registerAudioEncodedFrameObserver(audioEncodedFrameObserverConfig, observer); - return ret; -} -int UAgoraRtcEngine::StopAudioRecording() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopAudioRecording(); - return ret; -} - -UIMediaPlayer* UAgoraRtcEngine::CreateMediaPlayer() -{ - agora::agora_refptr MediaPlayer = nullptr; - - if (mediaPlayer != nullptr) - { - return mediaPlayer; - } - - mediaPlayer = NewObject(); - - MediaPlayer = RtcEngineProxyClassWrapper::GetInstance()->createMediaPlayer(); - - mediaPlayer->SetMediaPlayer(MediaPlayer); - - return mediaPlayer; -} -int UAgoraRtcEngine::DestroyMediaPlayer(UIMediaPlayer* media_player) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->destroyMediaPlayer(media_player->GetMediaPlayer()); - return ret; -} - -UIMediaRecorder* UAgoraRtcEngine::CreateMediaRecorder(FRecorderStreamInfo info) -{ - agora::rtc::RecorderStreamInfo recorderStreamInfo; - std::string StdStrChannelId = TCHAR_TO_UTF8(*info.channelId); - recorderStreamInfo.channelId = StdStrChannelId.c_str(); - recorderStreamInfo.uid = info.uid; - UIMediaRecorder* ptrMediaRecorder = NewObject(); - ptrMediaRecorder->SetMediaRecorder(RtcEngineProxyClassWrapper::GetInstance()->createMediaRecorder(recorderStreamInfo).get()); - return ptrMediaRecorder; -} - - -int UAgoraRtcEngine::DestroyMediaRecorder(UIMediaRecorder* ptrmediaRecorder) -{ - agora::agora_refptr AgoraMediaRecorder = ptrmediaRecorder->GetMediaRecorder(); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->destroyMediaRecorder(AgoraMediaRecorder); - return ret; -} - -int UAgoraRtcEngine::StartAudioMixing(FString filePath, bool loopback, int cycle, int startPos) -{ - std::string FilePath = TCHAR_TO_UTF8(*filePath); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startAudioMixing(FilePath.c_str(), loopback, cycle, startPos); - return ret; -} - -int UAgoraRtcEngine::StopAudioMixing() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopAudioMixing(); - return ret; -} - -int UAgoraRtcEngine::PauseAudioMixing() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->pauseAudioMixing(); - return ret; -} -int UAgoraRtcEngine::ResumeAudioMixing() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->resumeAudioMixing(); - return ret; -} -int UAgoraRtcEngine::SelectAudioTrack(int index) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->selectAudioTrack(index); - return ret; -} -int UAgoraRtcEngine::GetAudioTrackCount() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getAudioTrackCount(); - return ret; -} -int UAgoraRtcEngine::AdjustAudioMixingVolume(int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustAudioMixingVolume(volume); - return ret; -} -int UAgoraRtcEngine::AdjustAudioMixingPublishVolume(int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustAudioMixingPublishVolume(volume); - return ret; -} -int UAgoraRtcEngine::GetAudioMixingPublishVolume() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getAudioMixingPublishVolume(); - return ret; -} -int UAgoraRtcEngine::AdjustAudioMixingPlayoutVolume(int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustAudioMixingPlayoutVolume(volume); - return ret; -} -int UAgoraRtcEngine::GetAudioMixingPlayoutVolume() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getAudioMixingPlayoutVolume(); - return ret; -} -int UAgoraRtcEngine::GetAudioMixingDuration() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getAudioMixingDuration(); - return ret; -} -int UAgoraRtcEngine::GetAudioMixingCurrentPosition() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getAudioMixingCurrentPosition(); - return ret; -} -int UAgoraRtcEngine::SetAudioMixingPosition(int pos) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAudioMixingPosition(pos); - return ret; -} -int UAgoraRtcEngine::SetAudioMixingDualMonoMode(EAUDIO_MIXING_DUAL_MONO_MODE mode) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAudioMixingDualMonoMode((agora::media::AUDIO_MIXING_DUAL_MONO_MODE)mode); - return ret; -} -int UAgoraRtcEngine::SetAudioMixingPitch(int pitch) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAudioMixingPitch(pitch); - return ret; -} -int UAgoraRtcEngine::GetEffectsVolume() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getEffectsVolume(); - return ret; -} -int UAgoraRtcEngine::SetEffectsVolume(int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setEffectsVolume(volume); - return ret; -} -int UAgoraRtcEngine::PreloadEffect(int soundId, FString filePath, int startPos) -{ - std::string FilePath = TCHAR_TO_UTF8(*filePath); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->preloadEffect(soundId, FilePath.c_str(), startPos); - return ret; -} -int UAgoraRtcEngine::PlayEffect(int soundId, FString filePath, int loopCount, float pitch, float pan, int gain, bool publish, int startPos) -{ - std::string FilePath = TCHAR_TO_UTF8(*filePath); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->playEffect(soundId, FilePath.c_str(), loopCount, pitch, pan, gain, publish, startPos); - return ret; -} -int UAgoraRtcEngine::PlayAllEffects(int loopCount, float pitch, float pan, int gain, bool publish) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->playAllEffects(loopCount, pitch, pan, gain, publish); - return ret; -} -int UAgoraRtcEngine::GetVolumeOfEffect(int soundId) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getVolumeOfEffect(soundId); - return ret; -} -int UAgoraRtcEngine::SetVolumeOfEffect(int soundId, int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVolumeOfEffect(soundId, volume); - return ret; -} -int UAgoraRtcEngine::PauseEffect(int soundId) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->pauseEffect(soundId); - return ret; -} -int UAgoraRtcEngine::PauseAllEffects() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->pauseAllEffects(); - return ret; -} -int UAgoraRtcEngine::ResumeEffect(int soundId) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->resumeEffect(soundId); - return ret; -} -int UAgoraRtcEngine::ResumeAllEffects() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->resumeAllEffects(); - return ret; -} -int UAgoraRtcEngine::StopEffect(int soundId) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopEffect(soundId); - return ret; -} -int UAgoraRtcEngine::StopAllEffects() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopAllEffects(); - return ret; -} -int UAgoraRtcEngine::UnloadEffect(int soundId) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->unloadEffect(soundId); - return ret; -} -int UAgoraRtcEngine::UnloadAllEffects() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->unloadAllEffects(); - return ret; -} -int UAgoraRtcEngine::GetEffectDuration(FString filePath) -{ - std::string FilePath = TCHAR_TO_UTF8(*filePath); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getEffectDuration(FilePath.c_str()); - return ret; -} -int UAgoraRtcEngine::SetEffectPosition(int soundId, int pos) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setEffectPosition(soundId, pos); - return ret; -} -int UAgoraRtcEngine::GetEffectCurrentPosition(int soundId) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getEffectCurrentPosition(soundId); - return ret; -} -int UAgoraRtcEngine::EnableSoundPositionIndication(bool enabled) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableSoundPositionIndication(enabled); - return ret; -} -int UAgoraRtcEngine::SetRemoteVoicePosition(int64 uid, float pan, float gain) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteVoicePosition(uid, pan, gain); - return ret; -} -int UAgoraRtcEngine::EnableSpatialAudio(bool enabled) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableSpatialAudio(enabled); - return ret; -} -int UAgoraRtcEngine::SetRemoteUserSpatialAudioParams(int64 uid, const FSpatialAudioParams& params) -{ - agora::SpatialAudioParams spatialAudioParams; - SET_AGORA_DATA_SPATIALAUDIOPARAMS(spatialAudioParams, params); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteUserSpatialAudioParams(uid, spatialAudioParams); - return ret; -} -int UAgoraRtcEngine::SetVoiceBeautifierPreset(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVoiceBeautifierPreset(preset.GetRawValue()); - return ret; -} -int UAgoraRtcEngine::SetAudioEffectPreset(FENUMWRAP_AUDIO_EFFECT_PRESET preset) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAudioEffectPreset(preset.GetRawValue()); - return ret; -} -int UAgoraRtcEngine::SetVoiceConversionPreset(FENUMWRAP_VOICE_CONVERSION_PRESET preset) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVoiceConversionPreset(preset.GetRawValue()); - return ret; -} -int UAgoraRtcEngine::SetAudioEffectParameters(FENUMWRAP_AUDIO_EFFECT_PRESET preset, int param1, int param2) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAudioEffectParameters(preset.GetRawValue(), param1, param2); - return ret; -} -int UAgoraRtcEngine::SetVoiceBeautifierParameters(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset, int param1, int param2) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVoiceBeautifierParameters(preset.GetRawValue(), param1, param2); - return ret; -} -int UAgoraRtcEngine::SetVoiceConversionParameters(FENUMWRAP_VOICE_CONVERSION_PRESET preset, int param1, int param2) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVoiceConversionParameters(preset.GetRawValue(), param1, param2); - return ret; -} -int UAgoraRtcEngine::SetLocalVoicePitch(float pitch) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLocalVoicePitch(pitch); - return ret; -} - - -int UAgoraRtcEngine::SetLocalVoiceFormant(FString formantRatio) -{ - double ValFormantRatio = FCString::Atod(*formantRatio); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLocalVoiceFormant(ValFormantRatio); - return ret; -} - -int UAgoraRtcEngine::SetLocalVoiceEqualization(EAUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLocalVoiceEqualization((agora::rtc::AUDIO_EQUALIZATION_BAND_FREQUENCY)bandFrequency, bandGain); - return ret; -} -int UAgoraRtcEngine::SetLocalVoiceReverb(EAUDIO_REVERB_TYPE reverbKey, int value) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLocalVoiceReverb((agora::rtc::AUDIO_REVERB_TYPE)reverbKey, value); - return ret; -} -int UAgoraRtcEngine::SetLogFile(FString filePath) -{ - std::string FilePath = TCHAR_TO_UTF8(*filePath); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLogFile(FilePath.c_str()); - return ret; -} -int UAgoraRtcEngine::SetLogFilter(int filter) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLogFilter(filter); - return ret; -} -int UAgoraRtcEngine::SetLogLevel(ELOG_LEVEL level) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLogLevel((agora::commons::LOG_LEVEL)level); - return ret; -} -int UAgoraRtcEngine::SetLogFileSize(int fileSizeInKBytes) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLogFileSize(fileSizeInKBytes); - return ret; -} -int UAgoraRtcEngine::UploadLogFile(FString& requestId) -{ - agora::util::AString _requestId; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->uploadLogFile(_requestId); - requestId = _requestId->c_str(); - return ret; -} -int UAgoraRtcEngine::SetLocalRenderMode(ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLocalRenderMode((agora::media::base::RENDER_MODE_TYPE)renderMode, (agora::rtc::VIDEO_MIRROR_MODE_TYPE)mirrorMode); - return ret; -} -int UAgoraRtcEngine::SetRemoteRenderMode(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteRenderMode(uid, (agora::media::base::RENDER_MODE_TYPE)renderMode, (agora::rtc::VIDEO_MIRROR_MODE_TYPE)mirrorMode); - return ret; -} -int UAgoraRtcEngine::SetLocalVideoMirrorMode(EVIDEO_MIRROR_MODE_TYPE mirrorMode) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLocalVideoMirrorMode((agora::rtc::VIDEO_MIRROR_MODE_TYPE)mirrorMode); - return ret; -} - -int UAgoraRtcEngine::EnableDualStreamMode(bool enabled, const FSimulcastStreamConfig& streamConfig) -{ - agora::rtc::SimulcastStreamConfig simulcastStreamConfig; - agora::rtc::VideoDimensions dim; - dim.height = streamConfig.dimensions.height; - dim.width = streamConfig.dimensions.width; - simulcastStreamConfig.dimensions = dim; - simulcastStreamConfig.kBitrate = streamConfig.bitrate; - simulcastStreamConfig.framerate = streamConfig.framerate; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableDualStreamMode(enabled, simulcastStreamConfig); - return ret; -} -int UAgoraRtcEngine::SetDualStreamMode(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig) -{ - agora::rtc::SimulcastStreamConfig simulcastStreamConfig; - agora::rtc::VideoDimensions dim; - dim.height = streamConfig.dimensions.height; - dim.width = streamConfig.dimensions.width; - simulcastStreamConfig.dimensions = dim; - simulcastStreamConfig.kBitrate = streamConfig.bitrate; - simulcastStreamConfig.framerate = streamConfig.framerate; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setDualStreamMode(mode.GetRawValue(), simulcastStreamConfig); - return ret; -} - -int UAgoraRtcEngine::EnableCustomAudioLocalPlayback(int64 trackId, bool enabled) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableCustomAudioLocalPlayback(trackId, enabled); - return ret; -} - -int UAgoraRtcEngine::SetRecordingAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRecordingAudioFrameParameters(sampleRate, channel, (agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE)mode, samplesPerCall); - return ret; -} -int UAgoraRtcEngine::SetPlaybackAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setPlaybackAudioFrameParameters(sampleRate, channel, (agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE)mode, samplesPerCall); - return ret; -} -int UAgoraRtcEngine::SetMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setMixedAudioFrameParameters(sampleRate, channel, samplesPerCall); - return ret; -} -int UAgoraRtcEngine::SetPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setPlaybackAudioFrameBeforeMixingParameters(sampleRate, channel); - return ret; -} -int UAgoraRtcEngine::EnableAudioSpectrumMonitor(int intervalInMS) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableAudioSpectrumMonitor(intervalInMS); - return ret; -} -int UAgoraRtcEngine::DisableAudioSpectrumMonitor() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->disableAudioSpectrumMonitor(); - return ret; -} - -int UAgoraRtcEngine::RegisterAudioSpectrumObserver(UIAudioSpectrumObserver* observer) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->registerAudioSpectrumObserver(observer); - return ret; -} -int UAgoraRtcEngine::UnregisterAudioSpectrumObserver(UIAudioSpectrumObserver* observer) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->unregisterAudioSpectrumObserver(observer); - return ret; -} -int UAgoraRtcEngine::AdjustRecordingSignalVolume(int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustRecordingSignalVolume(volume); - return ret; -} -int UAgoraRtcEngine::MuteRecordingSignal(bool mute) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteRecordingSignal(mute); - return ret; -} -int UAgoraRtcEngine::AdjustPlaybackSignalVolume(int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustPlaybackSignalVolume(volume); - return ret; -} -int UAgoraRtcEngine::AdjustUserPlaybackSignalVolume(int uid, int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustUserPlaybackSignalVolume(uid, volume); - return ret; -} -int UAgoraRtcEngine::SetLocalPublishFallbackOption(ESTREAM_FALLBACK_OPTIONS option) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLocalPublishFallbackOption((agora::rtc::STREAM_FALLBACK_OPTIONS)option); - return ret; -} -int UAgoraRtcEngine::SetRemoteSubscribeFallbackOption(ESTREAM_FALLBACK_OPTIONS option) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteSubscribeFallbackOption((agora::rtc::STREAM_FALLBACK_OPTIONS)option); - return ret; -} - -int UAgoraRtcEngine::SetHighPriorityUserList(TArray uidList, ESTREAM_FALLBACK_OPTIONS option) -{ - int uidNum = uidList.Num(); - agora::rtc::uid_t* uidList_t = new agora::rtc::uid_t[uidNum]; - for (int i = 0; i < uidNum; i++) - { - uidList_t[i] = uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setHighPriorityUserList(uidList_t, uidNum, (agora::rtc::STREAM_FALLBACK_OPTIONS)option); - return ret; -} - -int UAgoraRtcEngine::EnableLoopbackRecording(bool enabled, FString deviceName) -{ - std::string Device = TCHAR_TO_UTF8(*deviceName); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableLoopbackRecording(enabled, Device.c_str()); - return ret; -} -int UAgoraRtcEngine::AdjustLoopbackSignalVolume(int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustLoopbackSignalVolume(volume); - return ret; -} -int UAgoraRtcEngine::GetLoopbackRecordingVolume() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getLoopbackRecordingVolume(); - return ret; -} -int UAgoraRtcEngine::EnableInEarMonitoring(bool enabled, int includeAudioFilters) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableInEarMonitoring(enabled, includeAudioFilters); - return ret; -} -int UAgoraRtcEngine::SetInEarMonitoringVolume(int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setInEarMonitoringVolume(volume); - return ret; -} -int UAgoraRtcEngine::LoadExtensionProvider(FString path, bool unload_after_use) -{ -#if defined (_WIN32) || defined(__linux__) || defined(__ANDROID__) - std::string Path = TCHAR_TO_UTF8(*path); - - return RtcEngineProxyClassWrapper::GetInstance()->loadExtensionProvider(Path.c_str(), unload_after_use); -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif - -} -int UAgoraRtcEngine::SetExtensionProviderProperty(FString provider, FString key, FString value) -{ - std::string Provider = TCHAR_TO_UTF8(*provider); - std::string Key = TCHAR_TO_UTF8(*key); - std::string Value = TCHAR_TO_UTF8(*value); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setExtensionProviderProperty(Provider.c_str(), Key.c_str(), Value.c_str()); - return ret; -} -int UAgoraRtcEngine::EnableExtension(FString provider, FString extension, bool enable, EMEDIA_SOURCE_TYPE type) -{ - std::string Provider = TCHAR_TO_UTF8(*provider); - std::string Extension = TCHAR_TO_UTF8(*extension); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableExtension(Provider.c_str(), Extension.c_str(), enable, (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} -int UAgoraRtcEngine::SetExtensionProperty(FString provider, FString extension, FString key, FString value, EMEDIA_SOURCE_TYPE type) -{ - std::string Provider = TCHAR_TO_UTF8(*provider); - std::string Extension = TCHAR_TO_UTF8(*extension); - std::string Key = TCHAR_TO_UTF8(*key); - std::string Value = TCHAR_TO_UTF8(*value); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setExtensionProperty(Provider.c_str(), Extension.c_str(), Key.c_str(), Value.c_str(), (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} -int UAgoraRtcEngine::GetExtensionProperty(FString provider, FString extension, FString key, FString value, int buf_len, EMEDIA_SOURCE_TYPE type) -{ - std::string Provider = TCHAR_TO_UTF8(*provider); - std::string Extension = TCHAR_TO_UTF8(*extension); - std::string Key = TCHAR_TO_UTF8(*key); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getExtensionProperty(Provider.c_str(), Extension.c_str(), Key.c_str(), TCHAR_TO_UTF8(*value), buf_len, (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} -int UAgoraRtcEngine::SetCameraCapturerConfiguration(const FCameraCapturerConfiguration& config) -{ - agora::rtc::CameraCapturerConfiguration cameraCapturerConfiguration; - std::string StdStrDeviceId = TCHAR_TO_UTF8(*config.deviceId); -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - cameraCapturerConfiguration.cameraDirection = (agora::rtc::CAMERA_DIRECTION)config.cameraDirection; -#else - FMemory::Memcpy(cameraCapturerConfiguration.deviceId, TCHAR_TO_UTF8(*config.deviceId), agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH); -#endif - agora::rtc::VideoFormat format; - format.width = config.format.width; - format.height = config.format.height; - cameraCapturerConfiguration.format = format; - cameraCapturerConfiguration.followEncodeDimensionRatio = config.followEncodeDimensionRatio; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setCameraCapturerConfiguration(cameraCapturerConfiguration); - return ret; -} -int64 UAgoraRtcEngine::CreateCustomVideoTrack() -{ - return RtcEngineProxyClassWrapper::GetInstance()->createCustomVideoTrack(); -} -int64 UAgoraRtcEngine::CreateCustomEncodedVideoTrack(const FSenderOptions& sender_option) -{ - agora::rtc::SenderOptions senderOptions; - senderOptions.ccMode = (agora::rtc::TCcMode)sender_option.ccMode; - senderOptions.codecType = (agora::rtc::VIDEO_CODEC_TYPE)sender_option.codecType; - senderOptions.targetBitrate = sender_option.targetBitrate; - return RtcEngineProxyClassWrapper::GetInstance()->createCustomEncodedVideoTrack(senderOptions); -} -int UAgoraRtcEngine::DestroyCustomVideoTrack(int64 video_track_id) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->destroyCustomVideoTrack(video_track_id); - return ret; -} -int UAgoraRtcEngine::DestroyCustomEncodedVideoTrack(int64 video_track_id) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->destroyCustomEncodedVideoTrack(video_track_id); - return ret; -} -int UAgoraRtcEngine::SwitchCamera() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->switchCamera(); -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -bool UAgoraRtcEngine::IsCameraZoomSupported() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->isCameraZoomSupported(); -#else - return false; -#endif -} -bool UAgoraRtcEngine::IsCameraFaceDetectSupported() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->isCameraFaceDetectSupported(); -#else - return false; -#endif -} -bool UAgoraRtcEngine::IsCameraTorchSupported() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->isCameraTorchSupported(); -#else - return false; -#endif -} -bool UAgoraRtcEngine::IsCameraFocusSupported() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->isCameraFocusSupported(); -#else - return false; -#endif -} -bool UAgoraRtcEngine::IsCameraAutoFocusFaceModeSupported() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->isCameraAutoFocusFaceModeSupported(); -#else - return false; -#endif -} -int UAgoraRtcEngine::SetCameraZoomFactor(float factor) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setCameraZoomFactor(factor); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::EnableFaceDetection(bool enabled) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableFaceDetection(enabled); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -float UAgoraRtcEngine::GetCameraMaxZoomFactor() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getCameraMaxZoomFactor(); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::SetCameraFocusPositionInPreview(float positionX, float positionY) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setCameraFocusPositionInPreview(positionX, positionY); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::SetCameraTorchOn(bool isOn) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setCameraTorchOn(isOn); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::SetCameraAutoFocusFaceModeEnabled(bool enabled) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->setCameraAutoFocusFaceModeEnabled(enabled); -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -bool UAgoraRtcEngine::IsCameraExposurePositionSupported() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->isCameraExposurePositionSupported(); -#else - return false; -#endif -} -int UAgoraRtcEngine::SetCameraExposurePosition(float positionXinView, float positionYinView) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->setCameraExposurePosition(positionXinView, positionYinView); -#else - return false; -#endif -} - -bool UAgoraRtcEngine::IsCameraAutoExposureFaceModeSupported() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) -#if defined(__APPLE__) - return RtcEngineProxyClassWrapper::GetInstance()->isCameraAutoExposureFaceModeSupported(); -#else - return false; -#endif -#endif - return false; -} -int UAgoraRtcEngine::SetCameraAutoExposureFaceModeEnabled(bool enabled) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) -#if defined(__APPLE__) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setCameraAutoExposureFaceModeEnabled(enabled); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -#endif - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -} -int UAgoraRtcEngine::SetDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker) -{ -#if defined(__ANDROID__) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setDefaultAudioRouteToSpeakerphone(defaultToSpeaker); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::SetEnableSpeakerphone(bool speakerOn) -{ -#if defined(__ANDROID__) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setEnableSpeakerphone(speakerOn); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -bool UAgoraRtcEngine::IsSpeakerphoneEnabled() -{ -#if defined(__ANDROID__) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->isSpeakerphoneEnabled(); - return ret; -#else - return false; -#endif -} - -UIScreenCaptureSourceList* UAgoraRtcEngine::GetScreenCaptureSources(FSIZE thumbSize, FSIZE iconSize, bool includeScreen) -{ - if (screenCaptureSourceList == nullptr) - { - screenCaptureSourceList = NewObject(); - } -#if PLATFORM_WINDOWS - SIZE thumb; - thumb.cx = thumbSize.width; - thumb.cy = thumbSize.height; - - SIZE icon; - icon.cx = iconSize.width; - icon.cy = iconSize.height; -#elif (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - agora::rtc::SIZE thumb; - thumb.width = thumbSize.width; - thumb.height = thumbSize.width; - agora::rtc::SIZE icon; - icon.width = iconSize.width; - icon.height = iconSize.height; -#endif -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - agora::rtc::IScreenCaptureSourceList* screenCaptureNative = RtcEngineProxyClassWrapper::GetInstance()->getScreenCaptureSources(thumb, icon, includeScreen); - if (screenCaptureNative != nullptr) - { - screenCaptureSourceList->SetScreenCaptureList(screenCaptureNative); - return screenCaptureSourceList; - } -#endif - return nullptr; -} -int UAgoraRtcEngine::SetAudioSessionOperationRestriction(EAUDIO_SESSION_OPERATION_RESTRICTION restriction) -{ -#if (defined(__APPLE__) && TARGET_OS_IOS) - return RtcEngineProxyClassWrapper::GetInstance()->setAudioSessionOperationRestriction((agora::AUDIO_SESSION_OPERATION_RESTRICTION)restriction); -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::StartScreenCaptureByDisplayId(int displayId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) -{ -#if defined(_WIN32) || (defined(__APPLE__) && !TARGET_OS_IPHONE && TARGET_OS_MAC) - agora::rtc::Rectangle rectangle; - rectangle.x = regionRect.x; - rectangle.y = regionRect.y; - rectangle.width = regionRect.width; - rectangle.height = regionRect.height; - agora::rtc::ScreenCaptureParameters screenCaptureParameters; - agora::rtc::VideoDimensions dim; - dim.width = captureParams.dimensions.width; - dim.height = captureParams.dimensions.height; - screenCaptureParameters.dimensions = dim; - screenCaptureParameters.frameRate = captureParams.frameRate; - screenCaptureParameters.bitrate = captureParams.bitrate; - screenCaptureParameters.captureMouseCursor = captureParams.captureMouseCursor; - screenCaptureParameters.windowFocus = captureParams.windowFocus; - screenCaptureParameters.excludeWindowList = (agora::view_t*)captureParams.excludeWindowList; - screenCaptureParameters.excludeWindowCount = captureParams.excludeWindowCount; - screenCaptureParameters.highLightWidth = captureParams.highLightWidth; - screenCaptureParameters.highLightColor = captureParams.highLightColor; - screenCaptureParameters.enableHighLight = captureParams.enableHighLight; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startScreenCaptureByDisplayId(displayId, rectangle, screenCaptureParameters); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} - -int UAgoraRtcEngine::StartScreenCaptureByScreenRect(const FRectangle& screenRect, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) __deprecated -{ -#if defined(_WIN32) - agora::rtc::Rectangle rectangle; - rectangle.x = screenRect.x; - rectangle.y = screenRect.y; - rectangle.width = screenRect.width; - rectangle.height = screenRect.height; - agora::rtc::ScreenCaptureParameters screenCaptureParameters; - agora::rtc::VideoDimensions dim; - dim.width = captureParams.dimensions.width; - dim.height = captureParams.dimensions.height; - screenCaptureParameters.dimensions = dim; - screenCaptureParameters.frameRate = captureParams.frameRate; - screenCaptureParameters.bitrate = captureParams.bitrate; - screenCaptureParameters.captureMouseCursor = captureParams.captureMouseCursor; - screenCaptureParameters.windowFocus = captureParams.windowFocus; - screenCaptureParameters.excludeWindowList = (agora::view_t*)captureParams.excludeWindowList; - screenCaptureParameters.excludeWindowCount = captureParams.excludeWindowCount; - screenCaptureParameters.highLightWidth = captureParams.highLightWidth; - screenCaptureParameters.highLightColor = captureParams.highLightColor; - screenCaptureParameters.enableHighLight = captureParams.enableHighLight; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startScreenCaptureByScreenRect(rectangle, rectangle, screenCaptureParameters); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::GetAudioDeviceInfo(FDeviceInfo& deviceInfo) -{ -#if defined(__ANDROID__) - agora::rtc::DeviceInfo Info; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getAudioDeviceInfo(Info); - deviceInfo.isLowLatencyAudioSupported = Info.isLowLatencyAudioSupported; - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} - -int UAgoraRtcEngine::StartScreenCaptureByWindowId(int64 windowId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) -{ -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - agora::rtc::Rectangle rectangle; - rectangle.x = regionRect.x; - rectangle.y = regionRect.y; - rectangle.width = regionRect.width; - rectangle.height = regionRect.height; - agora::rtc::ScreenCaptureParameters screenCaptureParameters; - agora::rtc::VideoDimensions dis; - dis.width = captureParams.dimensions.width; - dis.height = captureParams.dimensions.height; - screenCaptureParameters.dimensions = dis; - screenCaptureParameters.frameRate = captureParams.frameRate; - screenCaptureParameters.bitrate = captureParams.bitrate; - screenCaptureParameters.captureMouseCursor = captureParams.captureMouseCursor; - screenCaptureParameters.windowFocus = captureParams.windowFocus; - screenCaptureParameters.excludeWindowList = (agora::view_t*)captureParams.excludeWindowList; - screenCaptureParameters.excludeWindowCount = captureParams.excludeWindowCount; - screenCaptureParameters.highLightWidth = captureParams.highLightWidth; - screenCaptureParameters.highLightColor = captureParams.highLightColor; - screenCaptureParameters.enableHighLight = captureParams.enableHighLight; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startScreenCaptureByWindowId((agora::view_t)windowId, rectangle, screenCaptureParameters); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::SetScreenCaptureContentHint(EVIDEO_CONTENT_HINT contentHint) -{ -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setScreenCaptureContentHint((agora::rtc::VIDEO_CONTENT_HINT)contentHint); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} - -int UAgoraRtcEngine::UpdateScreenCaptureRegion(const FRectangle& regionRect) -{ -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - agora::rtc::Rectangle rectangle; - rectangle.x = regionRect.x; - rectangle.y = regionRect.y; - rectangle.width = regionRect.width; - rectangle.height = regionRect.height; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateScreenCaptureRegion(rectangle); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::UpdateScreenCaptureParameters(const FScreenCaptureParameters& captureParams) -{ -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - agora::rtc::ScreenCaptureParameters screenCaptureParameters; - agora::rtc::VideoDimensions dim; - dim.width = captureParams.dimensions.width; - dim.height = captureParams.dimensions.height; - screenCaptureParameters.dimensions = dim; - screenCaptureParameters.frameRate = captureParams.frameRate; - screenCaptureParameters.bitrate = captureParams.bitrate; - screenCaptureParameters.captureMouseCursor = captureParams.captureMouseCursor; - screenCaptureParameters.windowFocus = captureParams.windowFocus; - screenCaptureParameters.excludeWindowList = (agora::view_t*)captureParams.excludeWindowList; - screenCaptureParameters.excludeWindowCount = captureParams.excludeWindowCount; - screenCaptureParameters.highLightWidth = captureParams.highLightWidth; - screenCaptureParameters.highLightColor = captureParams.highLightColor; - screenCaptureParameters.enableHighLight = captureParams.enableHighLight; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateScreenCaptureParameters(screenCaptureParameters); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::StartScreenCapture(const FScreenCaptureParameters2& captureParams) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - agora::rtc::ScreenCaptureParameters2 screenCaptureParameters2; - screenCaptureParameters2.captureAudio = captureParams.captureAudio; - screenCaptureParameters2.captureVideo = captureParams.captureVideo; - screenCaptureParameters2.audioParams.sampleRate = captureParams.audioParams.sampleRate; - screenCaptureParameters2.audioParams.channels = captureParams.audioParams.channels; - screenCaptureParameters2.audioParams.captureSignalVolume = captureParams.audioParams.captureSignalVolume; - screenCaptureParameters2.videoParams.bitrate = captureParams.videoParams.bitrate; - screenCaptureParameters2.videoParams.contentHint = (agora::rtc::VIDEO_CONTENT_HINT)captureParams.videoParams.contentHint; - screenCaptureParameters2.videoParams.dimensions.height = captureParams.videoParams.dimensions.height; - screenCaptureParameters2.videoParams.dimensions.width = captureParams.videoParams.dimensions.width; - screenCaptureParameters2.videoParams.frameRate = captureParams.videoParams.frameRate; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startScreenCapture(screenCaptureParameters2); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif - -} - - -int UAgoraRtcEngine::StartScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType, const FScreenCaptureConfiguration& config) -{ - - agora::rtc::ScreenCaptureConfiguration screenCaptureConfiguration; - screenCaptureConfiguration.isCaptureWindow = config.isCaptureWindow; - screenCaptureConfiguration.displayId = config.displayId; - const FRectangle* rect = &(config.screenRect); - screenCaptureConfiguration.screenRect = agora::rtc::Rectangle(rect->x, rect->y, rect->width, rect->height); - screenCaptureConfiguration.windowId = (agora::view_t)config.windowId; - const FScreenCaptureParameters* scpptr = &(config.params); - screenCaptureConfiguration.params = agora::rtc::ScreenCaptureParameters( - scpptr->dimensions.width, - scpptr->dimensions.height, - scpptr->frameRate, - scpptr->bitrate, - scpptr->captureMouseCursor, - scpptr->windowFocus, - (agora::view_t*)scpptr->excludeWindowList, - scpptr->excludeWindowCount); - - const FRectangle* regionRect = &(config.regionRect); - screenCaptureConfiguration.regionRect = agora::rtc::Rectangle(regionRect->x, regionRect->y, regionRect->width, regionRect->height); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startScreenCapture((agora::rtc::VIDEO_SOURCE_TYPE)sourceType, screenCaptureConfiguration); - return ret; -} - -int UAgoraRtcEngine::StopScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopScreenCapture((agora::rtc::VIDEO_SOURCE_TYPE)sourceType); - return ret; -} - -int UAgoraRtcEngine::QueryScreenCaptureCapability() -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->queryScreenCaptureCapability(); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} - - -int UAgoraRtcEngine::SetScreenCaptureScenario(ESCREEN_SCENARIO_TYPE screenScenario) -{ -#if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setScreenCaptureScenario((agora::rtc::SCREEN_SCENARIO_TYPE)screenScenario); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} - -int UAgoraRtcEngine::UpdateScreenCapture(const FScreenCaptureParameters2& captureParams) -{ -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - agora::rtc::ScreenCaptureParameters2 screenCaptureParameters2; - screenCaptureParameters2.captureAudio = captureParams.captureAudio; - screenCaptureParameters2.captureVideo = captureParams.captureVideo; - screenCaptureParameters2.audioParams.sampleRate = captureParams.audioParams.sampleRate; - screenCaptureParameters2.audioParams.channels = captureParams.audioParams.channels; - screenCaptureParameters2.audioParams.captureSignalVolume = captureParams.audioParams.captureSignalVolume; - screenCaptureParameters2.videoParams.bitrate = captureParams.videoParams.bitrate; - screenCaptureParameters2.videoParams.contentHint = (agora::rtc::VIDEO_CONTENT_HINT)captureParams.videoParams.contentHint; - screenCaptureParameters2.videoParams.dimensions.height = captureParams.videoParams.dimensions.height; - screenCaptureParameters2.videoParams.dimensions.width = captureParams.videoParams.dimensions.width; - screenCaptureParameters2.videoParams.frameRate = captureParams.videoParams.frameRate; - return RtcEngineProxyClassWrapper::GetInstance()->updateScreenCapture(screenCaptureParameters2); -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} -int UAgoraRtcEngine::StopScreenCapture() -{ -#if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopScreenCapture(); - return ret; -#else - return -AGORA_UNREAL_PLUGIN_ERROR_CODE::ERROR_NULLPTR; -#endif -} - -int UAgoraRtcEngine::GetCallId(FString& callId) -{ - agora::util::AString agoraStr; - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getCallId(agoraStr); - - callId = agoraStr->c_str(); - - return ret; -} -int UAgoraRtcEngine::Rate(FString callId, int rating, FString description) -{ - std::string CallId = TCHAR_TO_UTF8(*callId); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->rate(CallId.c_str(), rating, TCHAR_TO_UTF8(*description)); - return ret; -} -int UAgoraRtcEngine::Complain(FString callId, FString description) -{ - std::string CallId = TCHAR_TO_UTF8(*callId); - std::string Description = TCHAR_TO_UTF8(*description); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->complain(CallId.c_str(), Description.c_str()); - return ret; -} -int UAgoraRtcEngine::StartRtmpStreamWithoutTranscoding(FString url) -{ - std::string Url = TCHAR_TO_UTF8(*url); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startRtmpStreamWithoutTranscoding(Url.c_str()); - return ret; -} -int UAgoraRtcEngine::StartRtmpStreamWithTranscoding(FString url, FLiveTranscoding& transcoding) -{ - agora::rtc::LiveTranscoding liveTranscoding; - liveTranscoding.width = transcoding.width; - liveTranscoding.height = transcoding.height; - liveTranscoding.videoBitrate = transcoding.videoBitrate; - liveTranscoding.videoFramerate = transcoding.videoFramerate; - liveTranscoding.lowLatency = transcoding.lowLatency; - liveTranscoding.videoGop = transcoding.videoGop; - liveTranscoding.videoCodecProfile = (agora::rtc::VIDEO_CODEC_PROFILE_TYPE)transcoding.videoCodecProfile; - liveTranscoding.backgroundColor = transcoding.backgroundColor; - liveTranscoding.videoCodecType = (agora::rtc::VIDEO_CODEC_TYPE_FOR_STREAM)transcoding.videoCodecType; - liveTranscoding.userCount = transcoding.userCount; - agora::rtc::TranscodingUser* trans = new agora::rtc::TranscodingUser[transcoding.userCount]; - for (int i = 0; i < transcoding.userCount; i++) - { - trans[i].alpha = transcoding.transcodingUsers[i].alpha; - trans[i].audioChannel = transcoding.transcodingUsers[i].audioChannel; - trans[i].height = transcoding.transcodingUsers[i].height; - trans[i].uid = transcoding.transcodingUsers[i].uid; - trans[i].width = transcoding.transcodingUsers[i].width; - trans[i].x = transcoding.transcodingUsers[i].x; - trans[i].y = transcoding.transcodingUsers[i].y; - trans[i].zOrder = transcoding.transcodingUsers[i].zOrder; - } - liveTranscoding.transcodingUsers = trans; - std::string TranscodingExtraInfo = TCHAR_TO_UTF8(*transcoding.transcodingExtraInfo); - liveTranscoding.transcodingExtraInfo = TranscodingExtraInfo.c_str(); - std::string Metadata = TCHAR_TO_UTF8(*transcoding.metadata); - liveTranscoding.metadata = Metadata.c_str(); - agora::rtc::RtcImage* image = new agora::rtc::RtcImage[transcoding.watermarkCount]; - for (int i = 0; i < transcoding.watermarkCount; i++) - { - image[i].alpha = transcoding.watermark[i].alpha; - std::string Url = TCHAR_TO_UTF8(*transcoding.watermark[i].url); - image[i].url = Url.c_str(); - image[i].height = transcoding.watermark[i].height; - image[i].width = transcoding.watermark[i].width; - image[i].x = transcoding.watermark[i].x; - image[i].y = transcoding.watermark[i].y; - image[i].zOrder = transcoding.watermark[i].zOrder; - } - liveTranscoding.watermark = image; - liveTranscoding.watermarkCount = transcoding.watermarkCount; - - agora::rtc::RtcImage* bgImage = new agora::rtc::RtcImage[transcoding.backgroundImageCount]; - for (int i = 0; i < transcoding.backgroundImageCount; i++) - { - bgImage[i].alpha = transcoding.backgroundImage[i].alpha; - std::string Url = TCHAR_TO_UTF8(*transcoding.backgroundImage[i].url); - bgImage[i].url = Url.c_str(); - bgImage[i].height = transcoding.backgroundImage[i].height; - bgImage[i].width = transcoding.backgroundImage[i].width; - bgImage[i].x = transcoding.backgroundImage[i].x; - bgImage[i].y = transcoding.backgroundImage[i].y; - bgImage[i].zOrder = transcoding.backgroundImage[i].zOrder; - } - liveTranscoding.backgroundImage = bgImage; - liveTranscoding.backgroundImageCount = transcoding.backgroundImageCount; - if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_32000) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_32000; - } - else if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_44100) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_44100; - } - else if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000; - } - liveTranscoding.audioBitrate = transcoding.audioBitrate; - liveTranscoding.audioChannels = transcoding.audioChannels; - liveTranscoding.audioCodecProfile = (agora::rtc::AUDIO_CODEC_PROFILE_TYPE)transcoding.audioCodecProfile; - - agora::rtc::LiveStreamAdvancedFeature* feature = new agora::rtc::LiveStreamAdvancedFeature[transcoding.advancedFeatureCount]; - for (int i = 0; i < transcoding.advancedFeatureCount; i++) - { - std::string FeatureName = TCHAR_TO_UTF8(*transcoding.advancedFeatures[i].featureName); - feature[i].featureName = FeatureName.c_str(); - feature[i].opened = transcoding.advancedFeatures[i].opened; - } - liveTranscoding.advancedFeatures = feature; - liveTranscoding.advancedFeatureCount = transcoding.advancedFeatureCount; - std::string TempUrl = TCHAR_TO_UTF8(*url); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startRtmpStreamWithTranscoding(TempUrl.c_str(), liveTranscoding); - delete[] trans; - delete[] image; - delete[] bgImage; - delete[] feature; - return ret; -} -int UAgoraRtcEngine::UpdateRtmpTranscoding(FLiveTranscoding& transcoding) -{ - agora::rtc::LiveTranscoding liveTranscoding; - liveTranscoding.width = transcoding.width; - liveTranscoding.height = transcoding.height; - liveTranscoding.videoBitrate = transcoding.videoBitrate; - liveTranscoding.videoFramerate = transcoding.videoFramerate; - liveTranscoding.lowLatency = transcoding.lowLatency; - liveTranscoding.videoGop = transcoding.videoGop; - liveTranscoding.videoCodecProfile = (agora::rtc::VIDEO_CODEC_PROFILE_TYPE)transcoding.videoCodecProfile; - liveTranscoding.backgroundColor = transcoding.backgroundColor; - liveTranscoding.videoCodecType = (agora::rtc::VIDEO_CODEC_TYPE_FOR_STREAM)transcoding.videoCodecType; - liveTranscoding.userCount = transcoding.userCount; - agora::rtc::TranscodingUser* trans = new agora::rtc::TranscodingUser[transcoding.userCount]; - for (int i = 0; i < transcoding.userCount; i++) - { - trans[i].alpha = transcoding.transcodingUsers[i].alpha; - trans[i].audioChannel = transcoding.transcodingUsers[i].audioChannel; - trans[i].height = transcoding.transcodingUsers[i].height; - trans[i].uid = transcoding.transcodingUsers[i].uid; - trans[i].width = transcoding.transcodingUsers[i].width; - trans[i].x = transcoding.transcodingUsers[i].x; - trans[i].y = transcoding.transcodingUsers[i].y; - trans[i].zOrder = transcoding.transcodingUsers[i].zOrder; - } - liveTranscoding.transcodingUsers = trans; - std::string TranscodingExtraInfo = TCHAR_TO_UTF8(*transcoding.transcodingExtraInfo); - liveTranscoding.transcodingExtraInfo = TranscodingExtraInfo.c_str(); - std::string Metadata = TCHAR_TO_UTF8(*transcoding.metadata); - liveTranscoding.metadata = Metadata.c_str(); - agora::rtc::RtcImage* image = new agora::rtc::RtcImage[transcoding.watermarkCount]; - for (int i = 0; i < transcoding.watermarkCount; i++) - { - image[i].alpha = transcoding.watermark[i].alpha; - std::string Url = TCHAR_TO_UTF8(*transcoding.watermark[i].url); - image[i].url = Url.c_str(); - image[i].height = transcoding.watermark[i].height; - image[i].width = transcoding.watermark[i].width; - image[i].x = transcoding.watermark[i].x; - image[i].y = transcoding.watermark[i].y; - image[i].zOrder = transcoding.watermark[i].zOrder; - } - liveTranscoding.watermark = image; - liveTranscoding.watermarkCount = transcoding.watermarkCount; - - agora::rtc::RtcImage* bgImage = new agora::rtc::RtcImage[transcoding.backgroundImageCount]; - for (int i = 0; i < transcoding.backgroundImageCount; i++) - { - bgImage[i].alpha = transcoding.backgroundImage[i].alpha; - std::string Url = TCHAR_TO_UTF8(*transcoding.backgroundImage[i].url); - bgImage[i].url = Url.c_str(); - bgImage[i].height = transcoding.backgroundImage[i].height; - bgImage[i].width = transcoding.backgroundImage[i].width; - bgImage[i].x = transcoding.backgroundImage[i].x; - bgImage[i].y = transcoding.backgroundImage[i].y; - bgImage[i].zOrder = transcoding.backgroundImage[i].zOrder; - } - liveTranscoding.backgroundImage = bgImage; - liveTranscoding.backgroundImageCount = transcoding.backgroundImageCount; - if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_32000) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_32000; - } - else if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_44100) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_44100; - } - else if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000; - } - liveTranscoding.audioBitrate = transcoding.audioBitrate; - liveTranscoding.audioChannels = transcoding.audioChannels; - liveTranscoding.audioCodecProfile = (agora::rtc::AUDIO_CODEC_PROFILE_TYPE)transcoding.audioCodecProfile; - - agora::rtc::LiveStreamAdvancedFeature* feature = new agora::rtc::LiveStreamAdvancedFeature[transcoding.advancedFeatureCount]; - for (int i = 0; i < transcoding.advancedFeatureCount; i++) - { - std::string FeatureName = TCHAR_TO_UTF8(*transcoding.advancedFeatures[i].featureName); - feature[i].featureName = FeatureName.c_str(); - feature[i].opened = transcoding.advancedFeatures[i].opened; - } - liveTranscoding.advancedFeatures = feature; - liveTranscoding.advancedFeatureCount = transcoding.advancedFeatureCount; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateRtmpTranscoding(liveTranscoding); - delete[] trans; - delete[] image; - delete[] bgImage; - delete[] feature; - - return ret; -} -int UAgoraRtcEngine::StopRtmpStream(FString url) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopRtmpStream(TCHAR_TO_UTF8(*url)); - return ret; -} - -int UAgoraRtcEngine::StartCameraCapture(EVIDEO_SOURCE_TYPE sourceType, const FCameraCapturerConfiguration& config) -{ - agora::rtc::CameraCapturerConfiguration cameraCapturerConfiguration; -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - cameraCapturerConfiguration.cameraDirection = (agora::rtc::CAMERA_DIRECTION)config.cameraDirection; -#else - const TCHAR* str = config.deviceId.GetCharArray().GetData(); - FMemory::Memcpy(cameraCapturerConfiguration.deviceId, str, config.deviceId.Len()); -#endif - agora::rtc::VideoFormat videoFormat(config.format.width, config.format.height, config.format.fps); - cameraCapturerConfiguration.format = videoFormat; - cameraCapturerConfiguration.followEncodeDimensionRatio = config.followEncodeDimensionRatio; - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startCameraCapture((agora::rtc::VIDEO_SOURCE_TYPE)sourceType, cameraCapturerConfiguration); - return ret; -} - - -int UAgoraRtcEngine::StopCameraCapture(EVIDEO_SOURCE_TYPE sourceType) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopCameraCapture((agora::rtc::VIDEO_SOURCE_TYPE)sourceType); - return ret; -} - -int UAgoraRtcEngine::StartLocalVideoTranscoder(const FLocalTranscoderConfiguration& config) -{ - agora::rtc::LocalTranscoderConfiguration localTranscoderConfiguration; - localTranscoderConfiguration.streamCount = config.streamCount; - agora::rtc::TranscodingVideoStream* videoStream = new agora::rtc::TranscodingVideoStream[config.streamCount]; - for (int i = 0; i < config.streamCount; i++) - { - videoStream[i].alpha = config.VideoInputStreams[i].alpha; - videoStream[i].height = config.VideoInputStreams[i].height; - std::string ImageUrl = TCHAR_TO_UTF8(*config.VideoInputStreams[i].imageUrl); - videoStream[i].imageUrl = ImageUrl.c_str(); - videoStream[i].mirror = config.VideoInputStreams[i].mirror; - videoStream[i].remoteUserUid = config.VideoInputStreams[i].remoteUserUid; - videoStream[i].sourceType = (agora::rtc::VIDEO_SOURCE_TYPE)config.VideoInputStreams[i].sourceType; - videoStream[i].width = config.VideoInputStreams[i].width; - videoStream[i].x = config.VideoInputStreams[i].x; - videoStream[i].y = config.VideoInputStreams[i].y; - videoStream[i].zOrder = config.VideoInputStreams[i].zOrder; - } - localTranscoderConfiguration.videoInputStreams = videoStream; - - agora::rtc::VideoEncoderConfiguration Configration; - Configration.bitrate = config.videoOutputConfiguration.bitrate; - Configration.codecType = (agora::rtc::VIDEO_CODEC_TYPE)config.videoOutputConfiguration.codecType; - Configration.degradationPreference = (agora::rtc::DEGRADATION_PREFERENCE)config.videoOutputConfiguration.bitrate; - agora::rtc::VideoDimensions dim; - dim.height = config.videoOutputConfiguration.dimensions.height; - dim.width = config.videoOutputConfiguration.dimensions.width; - - Configration.dimensions = dim; - Configration.frameRate = config.videoOutputConfiguration.frameRate; - Configration.minBitrate = config.videoOutputConfiguration.minBitrate; - Configration.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)config.videoOutputConfiguration.mirrorMode; - Configration.orientationMode = (agora::rtc::ORIENTATION_MODE)config.videoOutputConfiguration.orientationMode; - localTranscoderConfiguration.videoOutputConfiguration = Configration; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startLocalVideoTranscoder(localTranscoderConfiguration); - delete[] videoStream; - return ret; -} -int UAgoraRtcEngine::UpdateLocalTranscoderConfiguration(const FLocalTranscoderConfiguration& config) -{ - agora::rtc::LocalTranscoderConfiguration localTranscoderConfiguration; - localTranscoderConfiguration.streamCount = config.streamCount; - agora::rtc::TranscodingVideoStream* videoStream = new agora::rtc::TranscodingVideoStream[config.streamCount]; - for (int i = 0; i < config.streamCount; i++) - { - videoStream[i].alpha = config.VideoInputStreams[i].alpha; - videoStream[i].height = config.VideoInputStreams[i].height; - std::string ImageUrl = TCHAR_TO_UTF8(*config.VideoInputStreams[i].imageUrl); - videoStream[i].imageUrl = ImageUrl.c_str(); - videoStream[i].mirror = config.VideoInputStreams[i].mirror; - videoStream[i].remoteUserUid = config.VideoInputStreams[i].remoteUserUid; - videoStream[i].sourceType = (agora::rtc::VIDEO_SOURCE_TYPE)config.VideoInputStreams[i].sourceType; - videoStream[i].width = config.VideoInputStreams[i].width; - videoStream[i].x = config.VideoInputStreams[i].x; - videoStream[i].y = config.VideoInputStreams[i].y; - videoStream[i].zOrder = config.VideoInputStreams[i].zOrder; - } - localTranscoderConfiguration.videoInputStreams = videoStream; - - agora::rtc::VideoEncoderConfiguration Configration; - Configration.bitrate = config.videoOutputConfiguration.bitrate; - Configration.codecType = (agora::rtc::VIDEO_CODEC_TYPE)config.videoOutputConfiguration.codecType; - Configration.degradationPreference = (agora::rtc::DEGRADATION_PREFERENCE)config.videoOutputConfiguration.bitrate; - agora::rtc::VideoDimensions dim; - dim.height = config.videoOutputConfiguration.dimensions.height; - dim.width = config.videoOutputConfiguration.dimensions.width; - - Configration.dimensions = dim; - Configration.frameRate = config.videoOutputConfiguration.frameRate; - Configration.minBitrate = config.videoOutputConfiguration.minBitrate; - Configration.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)config.videoOutputConfiguration.mirrorMode; - Configration.orientationMode = (agora::rtc::ORIENTATION_MODE)config.videoOutputConfiguration.orientationMode; - localTranscoderConfiguration.videoOutputConfiguration = Configration; - delete[] videoStream; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateLocalTranscoderConfiguration(localTranscoderConfiguration); - return ret; -} -int UAgoraRtcEngine::StopLocalVideoTranscoder() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopLocalVideoTranscoder(); - return ret; -} - -int UAgoraRtcEngine::SetCameraDeviceOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setCameraDeviceOrientation((agora::rtc::VIDEO_SOURCE_TYPE)type, orientation.GetRawValue()); - return ret; -} -int UAgoraRtcEngine::SetScreenCaptureOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setScreenCaptureOrientation((agora::rtc::VIDEO_SOURCE_TYPE)type, orientation.GetRawValue()); - return ret; -} - -ECONNECTION_STATE_TYPE UAgoraRtcEngine::GetConnectionState() -{ - return (ECONNECTION_STATE_TYPE)RtcEngineProxyClassWrapper::GetInstance()->getConnectionState(); -} -bool UAgoraRtcEngine::RegisterEventHandler(UIRtcEngineEventHandler* eventHandler) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->registerEventHandler(eventHandler); - return ret; -} - -bool UAgoraRtcEngine::RegisterEventHandlerEx(UIRtcEngineEventHandlerEx* eventHandler) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->registerEventHandler(eventHandler); - return ret; -} - -bool UAgoraRtcEngine::UnregisterEventHandler(UIRtcEngineEventHandler* eventHandler) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->unregisterEventHandler(eventHandler); - return ret; -} - -bool UAgoraRtcEngine::UnregisterEventHandlerEx(UIRtcEngineEventHandlerEx* eventHandler) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->unregisterEventHandler(eventHandler); - return ret; -} - -int UAgoraRtcEngine::SetRemoteUserPriority(int64 uid, EPRIORITY_TYPE userPriority) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteUserPriority(uid, (agora::rtc::PRIORITY_TYPE)userPriority); - return ret; -} -int UAgoraRtcEngine::RegisterPacketObserver(UIPacketObserver* observer) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->registerPacketObserver(observer); - return ret; -} -int UAgoraRtcEngine::SetEncryptionMode(FString encryptionMode) -{ - std::string EncryptionMode = TCHAR_TO_UTF8(*encryptionMode); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setEncryptionMode(EncryptionMode.c_str()); - return ret; -} -int UAgoraRtcEngine::SetEncryptionSecret(FString secret) -{ - std::string Secret = TCHAR_TO_UTF8(*secret); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setEncryptionSecret(Secret.c_str()); - return ret; -} -int UAgoraRtcEngine::EnableEncryption(bool enabled, const FEncryptionConfig& config) -{ - agora::rtc::EncryptionConfig encryptionConfig; - encryptionConfig.encryptionMode = (agora::rtc::ENCRYPTION_MODE)config.encryptionMode; - std::string EncryptionKey = TCHAR_TO_UTF8(*config.encryptionKey); - encryptionConfig.encryptionKey = EncryptionKey.c_str(); - std::string encryptionKdfSalt = TCHAR_TO_UTF8(*config.encryptionKdfSalt); - FMemory::Memcpy(encryptionConfig.encryptionKdfSalt, encryptionKdfSalt.c_str(), strlen(encryptionKdfSalt.c_str()) + 1); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableEncryption(enabled, encryptionConfig); - return ret; -} -int UAgoraRtcEngine::CreateDataStream(int& streamId, const FDataStreamConfig& config) -{ - agora::rtc::DataStreamConfig dataStreamConfig; - dataStreamConfig.syncWithAudio = config.syncWithAudio; - dataStreamConfig.ordered = config.ordered; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->createDataStream(&streamId, dataStreamConfig); - return ret; -} -int UAgoraRtcEngine::SendStreamMessage(int streamId, FString data) -{ - std::string StdStrData = TCHAR_TO_UTF8(*data); - const char* Data = StdStrData.c_str(); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->sendStreamMessage(streamId, Data, strlen(Data) + 1); - return ret; -} -int UAgoraRtcEngine::AddVideoWatermark(FString watermarkUrl, const FWatermarkOptions& options) -{ - agora::rtc::WatermarkOptions watermarkOptions; - watermarkOptions.visibleInPreview = options.visibleInPreview; - agora::rtc::Rectangle LandscapeMode; - LandscapeMode.height = options.positionInLandscapeMode.height; - LandscapeMode.width = options.positionInLandscapeMode.width; - watermarkOptions.positionInLandscapeMode = LandscapeMode; - agora::rtc::Rectangle positionInPortraitMode; - positionInPortraitMode.height = options.positionInPortraitMode.height; - positionInPortraitMode.width = options.positionInPortraitMode.width; - watermarkOptions.positionInPortraitMode = positionInPortraitMode; - agora::rtc::WatermarkRatio markradio; - markradio.xRatio = options.watermarkRatio.xRatio; - markradio.yRatio = options.watermarkRatio.xRatio; - markradio.widthRatio = options.watermarkRatio.widthRatio; - watermarkOptions.watermarkRatio = markradio; - watermarkOptions.mode = (agora::rtc::WATERMARK_FIT_MODE)options.mode; - std::string WatermarkUrl = TCHAR_TO_UTF8(*watermarkUrl); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->addVideoWatermark(WatermarkUrl.c_str(), watermarkOptions); - return ret; -} - -int UAgoraRtcEngine::ClearVideoWatermarks() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->clearVideoWatermarks(); - return ret; -} - -int UAgoraRtcEngine::PauseAudio() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->pauseAudio(); - return ret; -} -int UAgoraRtcEngine::ResumeAudio() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->resumeAudio(); - return ret; -} -int UAgoraRtcEngine::EnableWebSdkInteroperability(bool enabled) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableWebSdkInteroperability(enabled); - return ret; -} -int UAgoraRtcEngine::SendCustomReportMessage(FString id, FString category, FString event, FString label, int value) -{ - std::string Id = TCHAR_TO_UTF8(*id); - std::string Category = TCHAR_TO_UTF8(*category); - std::string Event = TCHAR_TO_UTF8(*event); - std::string Label = TCHAR_TO_UTF8(*label); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->sendCustomReportMessage(Id.c_str(), Category.c_str(), Event.c_str(), Label.c_str(), value); - return ret; -} - -int UAgoraRtcEngine::RegisterMediaMetadataObserver(UIMetadataObserver* observer, FENUMWRAP_METADATA_TYPE type) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->registerMediaMetadataObserver(observer, type.GetRawValue()); - return ret; -} -int UAgoraRtcEngine::UnregisterMediaMetadataObserver(UIMetadataObserver* observer, FENUMWRAP_METADATA_TYPE type) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->unregisterMediaMetadataObserver(observer, type.GetRawValue()); - return ret; -} -int UAgoraRtcEngine::StartAudioFrameDump(FString channel_id, int64 user_id, FString location, FString uuid, FString passwd, int64 duration_ms, bool auto_upload) -{ - std::string Channel_id = TCHAR_TO_UTF8(*channel_id); - std::string Location = TCHAR_TO_UTF8(*location); - std::string Uuid = TCHAR_TO_UTF8(*uuid); - std::string Passwd = TCHAR_TO_UTF8(*passwd); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startAudioFrameDump(Channel_id.c_str(), user_id, Location.c_str(), Uuid.c_str(), Passwd.c_str(), duration_ms, auto_upload); - return ret; -} - -int UAgoraRtcEngine::SetAINSMode(bool enabled, EAUDIO_AINS_MODE mode) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAINSMode(enabled, (agora::rtc::AUDIO_AINS_MODE)mode); - return ret; -} - -int UAgoraRtcEngine::RegisterLocalUserAccount(FString appId, FString userAccount) -{ - std::string AppId = TCHAR_TO_UTF8(*appId); - std::string UserAccount = TCHAR_TO_UTF8(*userAccount); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->registerLocalUserAccount(AppId.c_str(), UserAccount.c_str()); - return ret; -} -int UAgoraRtcEngine::JoinChannelWithUserAccount(FString token, FString channelId, FString userAccount, const FChannelMediaOptions& options) -{ - agora::rtc::ChannelMediaOptions channelMediaOptions; - -#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_MOBILE(channelMediaOptions, options); -#else - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_NONMOBILE_PLATFORM(channelMediaOptions, options); -#endif - - std::string Token = TCHAR_TO_UTF8(*token); - std::string ChannelId = TCHAR_TO_UTF8(*channelId); - std::string UserAccount = TCHAR_TO_UTF8(*userAccount); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->joinChannelWithUserAccount(Token.c_str(), ChannelId.c_str(), UserAccount.c_str(), channelMediaOptions); - return ret; -} - -int UAgoraRtcEngine::JoinChannelWithUserAccountEx(FString token, FString channelId, FString userAccount, const FChannelMediaOptions& options, UIRtcEngineEventHandler* eventHandler) -{ - agora::rtc::ChannelMediaOptions channelMediaOptions; - -#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_MOBILE(channelMediaOptions, options); -#else - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_NONMOBILE_PLATFORM(channelMediaOptions, options); -#endif - - std::string Token = TCHAR_TO_UTF8(*token); - std::string ChannelId = TCHAR_TO_UTF8(*channelId); - std::string UserAccount = TCHAR_TO_UTF8(*userAccount); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->joinChannelWithUserAccountEx(Token.c_str(), ChannelId.c_str(), UserAccount.c_str(), channelMediaOptions, eventHandler); - return ret; -} -int UAgoraRtcEngine::GetUserInfoByUserAccount(FString userAccount, FUserInfo& userInfo) -{ - agora::rtc::UserInfo info; - std::string UserAccount = TCHAR_TO_UTF8(*userAccount); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getUserInfoByUserAccount(UserAccount.c_str(), &info); - userInfo.uid = info.uid; - userInfo.userAccount = info.userAccount; - return ret; -} -int UAgoraRtcEngine::GetUserInfoByUid(int64 uid, FUserInfo& userInfo) -{ - agora::rtc::UserInfo info; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getUserInfoByUid(uid, &info); - userInfo.uid = info.uid; - userInfo.userAccount = info.userAccount; - return ret; -} - - -int UAgoraRtcEngine::StartOrUpdateChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration) -{ - agora::rtc::ChannelMediaRelayConfiguration channelMediaRelayConfiguration; - agora::rtc::ChannelMediaInfo* mediaInfo = new agora::rtc::ChannelMediaInfo(); - std::string ChannelName = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfo->channelName = ChannelName.c_str(); - std::string Token = TCHAR_TO_UTF8(*configuration.srcInfo.token); - mediaInfo->token = Token.c_str(); - mediaInfo->uid = configuration.srcInfo.uid; - channelMediaRelayConfiguration.srcInfo = mediaInfo; - agora::rtc::ChannelMediaInfo* mediaInfos = new agora::rtc::ChannelMediaInfo[configuration.destCount]; - for (int i = 0; i < configuration.destCount; i++) - { - std::string ChannelNameTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].channelName = ChannelNameTemp.c_str(); - std::string TokenTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].token = TokenTemp.c_str(); - mediaInfos[i].uid = configuration.destInfos[i].uid; - } - channelMediaRelayConfiguration.destInfos = mediaInfos; - channelMediaRelayConfiguration.destCount = configuration.destCount; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startChannelMediaRelay(channelMediaRelayConfiguration); - delete mediaInfo; - delete[] mediaInfos; - return ret; -} - - -int UAgoraRtcEngine::StartOrUpdateChannelMediaRelayEx(const FChannelMediaRelayConfiguration& configuration, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string channel = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = channel.c_str(); - rtcConnection.localUid = connection.localUid; - - agora::rtc::ChannelMediaRelayConfiguration channelMediaRelayConfiguration; - agora::rtc::ChannelMediaInfo* mediaInfo = new agora::rtc::ChannelMediaInfo(); - std::string ChannelName = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfo->channelName = ChannelName.c_str(); - std::string Token = TCHAR_TO_UTF8(*configuration.srcInfo.token); - mediaInfo->token = Token.c_str(); - mediaInfo->uid = configuration.srcInfo.uid; - channelMediaRelayConfiguration.srcInfo = mediaInfo; - agora::rtc::ChannelMediaInfo* mediaInfos = new agora::rtc::ChannelMediaInfo[configuration.destCount]; - for (int i = 0; i < configuration.destCount; i++) - { - std::string ChannelNameTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].channelName = ChannelNameTemp.c_str(); - std::string TokenTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].token = TokenTemp.c_str(); - mediaInfos[i].uid = configuration.destInfos[i].uid; - } - channelMediaRelayConfiguration.destInfos = mediaInfos; - channelMediaRelayConfiguration.destCount = configuration.destCount; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startChannelMediaRelayEx(channelMediaRelayConfiguration, rtcConnection); - delete mediaInfo; - delete[] mediaInfos; - return ret; -} - -int UAgoraRtcEngine::StartChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration) -{ - agora::rtc::ChannelMediaRelayConfiguration channelMediaRelayConfiguration; - agora::rtc::ChannelMediaInfo* mediaInfo = new agora::rtc::ChannelMediaInfo(); - std::string ChannelName = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfo->channelName = ChannelName.c_str(); - std::string Token = TCHAR_TO_UTF8(*configuration.srcInfo.token); - mediaInfo->token = Token.c_str(); - mediaInfo->uid = configuration.srcInfo.uid; - channelMediaRelayConfiguration.srcInfo = mediaInfo; - agora::rtc::ChannelMediaInfo* mediaInfos = new agora::rtc::ChannelMediaInfo[configuration.destCount]; - for (int i = 0; i < configuration.destCount; i++) - { - std::string ChannelNameTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].channelName = ChannelNameTemp.c_str(); - std::string TokenTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].token = TokenTemp.c_str(); - mediaInfos[i].uid = configuration.destInfos[i].uid; - } - channelMediaRelayConfiguration.destInfos = mediaInfos; - channelMediaRelayConfiguration.destCount = configuration.destCount; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startChannelMediaRelay(channelMediaRelayConfiguration); - delete mediaInfo; - delete[] mediaInfos; - return ret; -} - -// Deprecated -int UAgoraRtcEngine::UpdateChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration) -{ - agora::rtc::ChannelMediaRelayConfiguration channelMediaRelayConfiguration; - agora::rtc::ChannelMediaInfo* mediaInfo = new agora::rtc::ChannelMediaInfo(); - std::string ChannelName = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfo->channelName = ChannelName.c_str(); - std::string Token = TCHAR_TO_UTF8(*configuration.srcInfo.token); - mediaInfo->token = Token.c_str(); - mediaInfo->uid = configuration.srcInfo.uid; - channelMediaRelayConfiguration.srcInfo = mediaInfo; - agora::rtc::ChannelMediaInfo* mediaInfos = new agora::rtc::ChannelMediaInfo[configuration.destCount]; - for (int i = 0; i < configuration.destCount; i++) - { - std::string ChannelNameTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].channelName = ChannelNameTemp.c_str(); - std::string TokenTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].token = TokenTemp.c_str(); - mediaInfos[i].uid = configuration.destInfos[i].uid; - } - channelMediaRelayConfiguration.destInfos = mediaInfos; - channelMediaRelayConfiguration.destCount = configuration.destCount; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateChannelMediaRelay(channelMediaRelayConfiguration); - delete mediaInfo; - delete[] mediaInfos; - return ret; -} -int UAgoraRtcEngine::StopChannelMediaRelay() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopChannelMediaRelay(); - return ret; -} -int UAgoraRtcEngine::PauseAllChannelMediaRelay() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->pauseAllChannelMediaRelay(); - return ret; -} -int UAgoraRtcEngine::ResumeAllChannelMediaRelay() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->resumeAllChannelMediaRelay(); - return ret; -} -int UAgoraRtcEngine::SetDirectCdnStreamingAudioConfiguration(EAUDIO_PROFILE_TYPE profile) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setDirectCdnStreamingAudioConfiguration((agora::rtc::AUDIO_PROFILE_TYPE)profile); - return ret; -} -int UAgoraRtcEngine::SetDirectCdnStreamingVideoConfiguration(const FVideoEncoderConfiguration& config) -{ - agora::rtc::VideoEncoderConfiguration videoEncoderConfiguration; - videoEncoderConfiguration.codecType = (agora::rtc::VIDEO_CODEC_TYPE)config.codecType; - agora::rtc::VideoDimensions dimensions; - dimensions.height = config.dimensions.height; - dimensions.width = config.dimensions.width; - videoEncoderConfiguration.dimensions = dimensions; - videoEncoderConfiguration.frameRate = config.frameRate; - videoEncoderConfiguration.bitrate = config.bitrate; - videoEncoderConfiguration.minBitrate = config.minBitrate; - videoEncoderConfiguration.orientationMode = (agora::rtc::ORIENTATION_MODE)config.orientationMode; - videoEncoderConfiguration.degradationPreference = (agora::rtc::DEGRADATION_PREFERENCE)config.degradationPreference; - videoEncoderConfiguration.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)config.mirrorMode; - agora::rtc::AdvanceOptions advanceOptions; - advanceOptions.encodingPreference = (agora::rtc::ENCODING_PREFERENCE)config.advanceOptions.encodingPreference.GetRawValue(); - advanceOptions.compressionPreference = (agora::rtc::COMPRESSION_PREFERENCE)config.advanceOptions.compressionPreference; - videoEncoderConfiguration.advanceOptions = advanceOptions; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setDirectCdnStreamingVideoConfiguration(videoEncoderConfiguration); - return ret; -} -int UAgoraRtcEngine::StartDirectCdnStreaming(UIDirectCdnStreamingEventHandler* eventHandler, FString publishUrl, FDirectCdnStreamingMediaOptions& options) -{ - agora::rtc::DirectCdnStreamingMediaOptions directCdnStreamingMediaOptions; - SET_AGORA_DATA_DIRECTCDNSTREAMINGMEDIAOPTIONS(directCdnStreamingMediaOptions, options); - std::string PublishUrl = TCHAR_TO_UTF8(*publishUrl); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startDirectCdnStreaming(eventHandler, PublishUrl.c_str(), directCdnStreamingMediaOptions); - return ret; -} -int UAgoraRtcEngine::StopDirectCdnStreaming() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopDirectCdnStreaming(); - return ret; -} -int UAgoraRtcEngine::UpdateDirectCdnStreamingMediaOptions(const FDirectCdnStreamingMediaOptions& options) -{ - agora::rtc::DirectCdnStreamingMediaOptions directCdnStreamingMediaOptions; - SET_AGORA_DATA_DIRECTCDNSTREAMINGMEDIAOPTIONS(directCdnStreamingMediaOptions, options); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateDirectCdnStreamingMediaOptions(directCdnStreamingMediaOptions); - return ret; -} -int UAgoraRtcEngine::StartRhythmPlayer(FString sound1, FString sound2, const FAgoraRhythmPlayerConfig& config) -{ - agora::rtc::AgoraRhythmPlayerConfig agoraRhythmPlayerConfig; - agoraRhythmPlayerConfig.beatsPerMeasure = config.beatsPerMeasure; - agoraRhythmPlayerConfig.beatsPerMinute = config.beatsPerMinute; - std::string Sound1 = TCHAR_TO_UTF8(*sound1); - std::string Sound2 = TCHAR_TO_UTF8(*sound2); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startRhythmPlayer(Sound1.c_str(), Sound1.c_str(), agoraRhythmPlayerConfig); - return ret; -} -int UAgoraRtcEngine::StopRhythmPlayer() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopRhythmPlayer(); - return ret; -} -int UAgoraRtcEngine::ConfigRhythmPlayer(const FAgoraRhythmPlayerConfig& config) -{ - agora::rtc::AgoraRhythmPlayerConfig agoraRhythmPlayerConfig; - agoraRhythmPlayerConfig.beatsPerMeasure = config.beatsPerMeasure; - agoraRhythmPlayerConfig.beatsPerMinute = config.beatsPerMinute; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->configRhythmPlayer(agoraRhythmPlayerConfig); - return ret; -} -int UAgoraRtcEngine::TakeSnapshot(int64 uid, FString filePath) -{ - std::string Filepath = TCHAR_TO_UTF8(*filePath); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->takeSnapshot(uid, Filepath.c_str()); - return ret; -} -int UAgoraRtcEngine::EnableContentInspect(bool enabled, FContentInspectConfig& config) -{ - agora::media::ContentInspectConfig contentInspectConfig; - std::string ExtraInfo = TCHAR_TO_UTF8(*config.extraInfo); - contentInspectConfig.extraInfo = ExtraInfo.c_str(); - agora::media::ContentInspectModule modules[MAX_CONTENT_INSPECT_MODULE_COUNT]; - for (int i = 0; i < config.moduleCount; i++) - { - modules[i].interval = config.modules[i].interval; - modules[i].type = (agora::media::CONTENT_INSPECT_TYPE)config.modules[i].type; - } - FMemory::Memcpy(contentInspectConfig.modules, modules, sizeof(agora::media::ContentInspectModule) * config.moduleCount); - contentInspectConfig.moduleCount = config.moduleCount; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableContentInspect(enabled, contentInspectConfig); - return ret; -} - -int UAgoraRtcEngine::AdjustCustomAudioPublishVolume(int64 trackId, int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustCustomAudioPublishVolume(trackId, volume); - return ret; -} - - -int UAgoraRtcEngine::AdjustCustomAudioPlayoutVolume(int64 trackId, int volume) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustCustomAudioPlayoutVolume(trackId, volume); - return ret; -} - -int UAgoraRtcEngine::SetCloudProxy(ECLOUD_PROXY_TYPE proxyType) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setCloudProxy((agora::rtc::CLOUD_PROXY_TYPE)proxyType); - return ret; -} -int UAgoraRtcEngine::SetLocalAccessPoint(const FLocalAccessPointConfiguration& config) -{ - agora::rtc::LocalAccessPointConfiguration localAccessPointConfiguration; - std::string Iplist = TCHAR_TO_UTF8(*config.ipList); - const char* iplist = Iplist.c_str(); - localAccessPointConfiguration.ipList = &iplist; - localAccessPointConfiguration.ipListSize = config.ipListSize; - std::string DomainList = TCHAR_TO_UTF8(*config.domainList); - const char* domainList = DomainList.c_str(); - localAccessPointConfiguration.domainList = &domainList; - localAccessPointConfiguration.domainListSize = config.domainListSize; - std::string VerifyDomainName = TCHAR_TO_UTF8(*config.domainList); - localAccessPointConfiguration.verifyDomainName = VerifyDomainName.c_str(); - localAccessPointConfiguration.mode = (agora::rtc::LOCAL_PROXY_MODE)config.mode; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setLocalAccessPoint(localAccessPointConfiguration); - return ret; -} -int UAgoraRtcEngine::SetAdvancedAudioOptions(const FAdvancedAudioOptions& options) -{ - agora::rtc::AdvancedAudioOptions advancedAudioOptions; - SET_AGORA_DATA_ADVANCEDAUDIOOPTIONS(advancedAudioOptions, options); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAdvancedAudioOptions(advancedAudioOptions); - return ret; -} -int UAgoraRtcEngine::SetAVSyncSource(FString channelId, int64 uid) -{ - std::string ChannelId = TCHAR_TO_UTF8(*channelId); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setAVSyncSource(ChannelId.c_str(), uid); - return ret; -} -int UAgoraRtcEngine::EnableVideoImageSource(bool enable, const FImageTrackOptions& options) -{ - agora::rtc::ImageTrackOptions imageTrackOptions; - std::string ImageUrl = TCHAR_TO_UTF8(*options.imageUrl); - imageTrackOptions.imageUrl = ImageUrl.c_str(); - imageTrackOptions.fps = options.fps; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableVideoImageSource(enable, imageTrackOptions); - return ret; -} -int UAgoraRtcEngine::JoinChannelEx(FString token, const FRtcConnection& connection, const FChannelMediaOptions& options, UIRtcEngineEventHandler* eventHandler) -{ - agora::rtc::RtcConnection rtcConnection; - std::string channel = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = channel.c_str(); - rtcConnection.localUid = connection.localUid; - agora::rtc::ChannelMediaOptions channelMediaOptions; - -#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_MOBILE(channelMediaOptions, options); -#else - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_NONMOBILE_PLATFORM(channelMediaOptions, options); -#endif - - std::string Token = TCHAR_TO_UTF8(*token); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->joinChannelEx(Token.c_str(), rtcConnection, channelMediaOptions, eventHandler); - return ret; -} - - -int UAgoraRtcEngine::LeaveChannelEx(const FRtcConnection& connection, const FLeaveChannelOptions& options) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - agora::rtc::LeaveChannelOptions leaveChannelOptions; - SET_AGORA_DATA_LEAVECHANNELOPTIONS(leaveChannelOptions, options); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->leaveChannelEx(rtcConnection, leaveChannelOptions); - return ret; -} - -int UAgoraRtcEngine::UpdateChannelMediaOptionsEx(const FChannelMediaOptions& options, const FRtcConnection& connection) -{ - agora::rtc::ChannelMediaOptions channelMediaOptions; - -#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_MOBILE(channelMediaOptions, options); -#else - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_NONMOBILE_PLATFORM(channelMediaOptions, options); -#endif - - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateChannelMediaOptionsEx(channelMediaOptions, rtcConnection); - return ret; -} -int UAgoraRtcEngine::SetVideoEncoderConfigurationEx(const FVideoEncoderConfiguration& config, const FRtcConnection& connection) -{ - agora::rtc::VideoEncoderConfiguration videoEncoderConfiguration; - videoEncoderConfiguration.codecType = (agora::rtc::VIDEO_CODEC_TYPE)config.codecType; - agora::rtc::VideoDimensions dim; - dim.height = config.dimensions.height; - dim.width = config.dimensions.width; - videoEncoderConfiguration.dimensions = dim; - videoEncoderConfiguration.frameRate = config.frameRate; - videoEncoderConfiguration.bitrate = config.bitrate; - videoEncoderConfiguration.minBitrate = config.minBitrate; - videoEncoderConfiguration.orientationMode = (agora::rtc::ORIENTATION_MODE)config.orientationMode; - videoEncoderConfiguration.degradationPreference = (agora::rtc::DEGRADATION_PREFERENCE)config.degradationPreference; - videoEncoderConfiguration.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)config.mirrorMode; - agora::rtc::AdvanceOptions advanceOptions; - advanceOptions.encodingPreference = (agora::rtc::ENCODING_PREFERENCE)config.advanceOptions.encodingPreference.GetRawValue(); - advanceOptions.compressionPreference = (agora::rtc::COMPRESSION_PREFERENCE)config.advanceOptions.compressionPreference; - videoEncoderConfiguration.advanceOptions = advanceOptions; - - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setVideoEncoderConfigurationEx(videoEncoderConfiguration, rtcConnection); - return ret; -} -int UAgoraRtcEngine::SetupRemoteVideoEx(const FVideoCanvas& canvas, const FRtcConnection& connection) -{ - agora::rtc::VideoCanvas videoCanvas; - videoCanvas.view = (agora::view_t)canvas.view; - videoCanvas.renderMode = (agora::media::base::RENDER_MODE_TYPE)canvas.renderMode; - videoCanvas.mirrorMode = (agora::rtc::VIDEO_MIRROR_MODE_TYPE)canvas.mirrorMode; - videoCanvas.uid = canvas.uid; - //videoCanvas.priv = canvas.priv; - videoCanvas.sourceType = (agora::rtc::VIDEO_SOURCE_TYPE)canvas.sourceType; - //videoCanvas.cropArea = canvas.cropArea; - videoCanvas.setupMode = (agora::rtc::VIDEO_VIEW_SETUP_MODE)canvas.setupMode; - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - //rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setupRemoteVideoEx(videoCanvas, rtcConnection); - return ret; -} -int UAgoraRtcEngine::MuteRemoteAudioStreamEx(int64 uid, bool mute, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteRemoteAudioStreamEx(uid, mute, rtcConnection); - return ret; -} -int UAgoraRtcEngine::MuteRemoteVideoStreamEx(int64 uid, bool mute, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteRemoteVideoStreamEx(uid, mute, rtcConnection); - return ret; -} -int UAgoraRtcEngine::SetRemoteVideoStreamTypeEx(int64 uid, EVIDEO_STREAM_TYPE streamType, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteVideoStreamTypeEx(uid, (agora::rtc::VIDEO_STREAM_TYPE)streamType, rtcConnection); - return ret; -} - -int UAgoraRtcEngine::SetRemoteVideoSubscriptionOptionsEx(int64 uid, const FVideoSubscriptionOptions& options, const FRtcConnection& connection) -{ - agora::rtc::VideoSubscriptionOptions videoSubscriptionOptions; - SET_AGORA_DATA_VIDEOSUBSCRIPTIONOPTIONS(videoSubscriptionOptions, options); - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteVideoSubscriptionOptionsEx(uid, videoSubscriptionOptions, rtcConnection); - return ret; -} -int UAgoraRtcEngine::SetRemoteVoicePositionEx(int64 uid, float pan, float gain, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteVoicePositionEx(uid, pan, gain, rtcConnection); - return ret; -} -int UAgoraRtcEngine::SetRemoteUserSpatialAudioParamsEx(int64 uid, const FSpatialAudioParams& params, const FRtcConnection& connection) -{ - agora::SpatialAudioParams spatialAudioParams; - SET_AGORA_DATA_SPATIALAUDIOPARAMS(spatialAudioParams, params); - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteUserSpatialAudioParamsEx(uid, spatialAudioParams, rtcConnection); - return ret; -} -int UAgoraRtcEngine::SetRemoteRenderModeEx(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setRemoteRenderModeEx(uid, (agora::media::base::RENDER_MODE_TYPE)renderMode, (agora::rtc::VIDEO_MIRROR_MODE_TYPE)mirrorMode, rtcConnection); - return ret; -} -int UAgoraRtcEngine::EnableLoopbackRecordingEx(const FRtcConnection& connection, bool enabled, FString deviceName) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableLoopbackRecordingEx(rtcConnection, enabled, TCHAR_TO_UTF8(*deviceName)); - return ret; -} -ECONNECTION_STATE_TYPE UAgoraRtcEngine::GetConnectionStateEx(const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - return (ECONNECTION_STATE_TYPE)RtcEngineProxyClassWrapper::GetInstance()->getConnectionStateEx(rtcConnection); -} -int UAgoraRtcEngine::EnableEncryptionEx(const FRtcConnection& connection, bool enabled, const FEncryptionConfig& config) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - agora::rtc::EncryptionConfig encryptionConfig; - encryptionConfig.encryptionMode = (agora::rtc::ENCRYPTION_MODE)config.encryptionMode; - std::string EncryptionKey = TCHAR_TO_UTF8(*config.encryptionKey); - encryptionConfig.encryptionKey = EncryptionKey.c_str(); - std::string encryptionKdfSalt = TCHAR_TO_UTF8(*config.encryptionKdfSalt); - FMemory::Memcpy(encryptionConfig.encryptionKdfSalt, encryptionKdfSalt.c_str(), 32); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableEncryptionEx(rtcConnection, enabled, encryptionConfig); - return ret; -} - -int UAgoraRtcEngine::CreateDataStreamEx(int& streamId, const FDataStreamConfig& config, const FRtcConnection& connection) -{ - agora::rtc::DataStreamConfig dataStreamConfig; - dataStreamConfig.syncWithAudio = config.syncWithAudio; - dataStreamConfig.ordered = config.ordered; - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->createDataStreamEx(&streamId, dataStreamConfig, rtcConnection); - return ret; -} -int UAgoraRtcEngine::SendStreamMessageEx(int streamId, FString data, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - std::string StdStrData = TCHAR_TO_UTF8(*data); - const char* Data = StdStrData.c_str(); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->sendStreamMessageEx(streamId, Data, strlen(Data), rtcConnection); - return ret; -} -int UAgoraRtcEngine::AddVideoWatermarkEx(FString watermarkUrl, const FWatermarkOptions& options, const FRtcConnection& connection) -{ - agora::rtc::WatermarkOptions watermarkOptions; - watermarkOptions.visibleInPreview = options.visibleInPreview; - - agora::rtc::Rectangle LandscapeMode; - LandscapeMode.height = options.positionInLandscapeMode.height; - LandscapeMode.width = options.positionInLandscapeMode.width; - watermarkOptions.positionInLandscapeMode = LandscapeMode; - agora::rtc::Rectangle positionInPortraitMode; - positionInPortraitMode.height = options.positionInPortraitMode.height; - positionInPortraitMode.width = options.positionInPortraitMode.width; - - watermarkOptions.positionInLandscapeMode = LandscapeMode; - watermarkOptions.positionInPortraitMode = positionInPortraitMode; - agora::rtc::WatermarkRatio markradio; - markradio.xRatio = options.watermarkRatio.xRatio; - markradio.yRatio = options.watermarkRatio.xRatio; - markradio.widthRatio = options.watermarkRatio.widthRatio; - watermarkOptions.watermarkRatio = markradio; - watermarkOptions.mode = (agora::rtc::WATERMARK_FIT_MODE)options.mode; - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->addVideoWatermarkEx(TCHAR_TO_UTF8(*watermarkUrl), watermarkOptions, rtcConnection); - return ret; -} -int UAgoraRtcEngine::ClearVideoWatermarkEx(const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->clearVideoWatermarkEx(rtcConnection); - return ret; -} -int UAgoraRtcEngine::SendCustomReportMessageEx(FString id, FString category, FString event, FString label, int value, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->sendCustomReportMessageEx(TCHAR_TO_UTF8(*id), TCHAR_TO_UTF8(*category), TCHAR_TO_UTF8(*event), TCHAR_TO_UTF8(*label), value, rtcConnection); - return ret; -} -int UAgoraRtcEngine::EnableAudioVolumeIndicationEx(int interval, int smooth, bool reportVad, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableAudioVolumeIndicationEx(interval, smooth, reportVad, rtcConnection); - return ret; -} -int UAgoraRtcEngine::GetUserInfoByUserAccountEx(FString userAccount, FUserInfo& userInfo, const FRtcConnection& connection) -{ - agora::rtc::UserInfo info; - - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getUserInfoByUserAccountEx(TCHAR_TO_UTF8(*userAccount), &info, rtcConnection); - - userInfo.uid = info.uid; - userInfo.userAccount = info.userAccount; - - return ret; -} -int UAgoraRtcEngine::GetUserInfoByUidEx(int64 uid, FUserInfo& userInfo, const FRtcConnection& connection) -{ - agora::rtc::UserInfo info; - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getUserInfoByUidEx(uid, &info, rtcConnection); - userInfo.uid = info.uid; - userInfo.userAccount = info.userAccount; - - return ret; -} - -int UAgoraRtcEngine::EnableDualStreamModeEx(bool enabled, const FSimulcastStreamConfig& streamConfig, const FRtcConnection& connection) -{ - agora::rtc::SimulcastStreamConfig simulcastStreamConfig; - agora::rtc::VideoDimensions dim; - dim.width = streamConfig.dimensions.width; - dim.height = streamConfig.dimensions.height; - simulcastStreamConfig.dimensions = dim; - simulcastStreamConfig.kBitrate = streamConfig.bitrate; - simulcastStreamConfig.framerate = streamConfig.framerate; - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableDualStreamModeEx(enabled, simulcastStreamConfig, rtcConnection); - return ret; -} -int UAgoraRtcEngine::SetDualStreamModeEx(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig, const FRtcConnection& connection) -{ - agora::rtc::SimulcastStreamConfig simulcastStreamConfig; - agora::rtc::VideoDimensions dim; - dim.width = streamConfig.dimensions.width; - dim.height = streamConfig.dimensions.height; - simulcastStreamConfig.dimensions = dim; - simulcastStreamConfig.kBitrate = streamConfig.bitrate; - simulcastStreamConfig.framerate = streamConfig.framerate; - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setDualStreamModeEx(mode.GetRawValue(), simulcastStreamConfig, rtcConnection); - return ret; -} -int UAgoraRtcEngine::EnableWirelessAccelerate(bool enabled) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableWirelessAccelerate(enabled); - return ret; -} -int UAgoraRtcEngine::TakeSnapshotEx(const FRtcConnection& connection, int64 uid, FString filePath) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - std::string FilePath = TCHAR_TO_UTF8(*filePath); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->takeSnapshotEx(rtcConnection, uid, FilePath.c_str()); - return ret; -} - - -int UAgoraRtcEngine::MuteLocalAudioStreamEx(bool mute, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteLocalAudioStreamEx(mute, rtcConnection); - return ret; -} - -int UAgoraRtcEngine::MuteLocalVideoStreamEx(bool mute, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteLocalVideoStreamEx(mute, rtcConnection); - return ret; -} - -int UAgoraRtcEngine::MuteAllRemoteAudioStreamsEx(bool mute, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteAllRemoteAudioStreamsEx(mute, rtcConnection); - return ret; -} - -int UAgoraRtcEngine::MuteAllRemoteVideoStreamsEx(bool mute, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->muteAllRemoteVideoStreamsEx(mute, rtcConnection); - return ret; -} - - -int UAgoraRtcEngine::SetSubscribeAudioBlocklist(TArray uidList, int uidNumber) -{ - agora::rtc::uid_t* data = new agora::rtc::uid_t[uidList.Num()]; - for (int i = 0; i < uidList.Num(); i++) - { - data[i] = (agora::rtc::uid_t)uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setSubscribeAudioBlocklist(data, uidNumber); - return ret; -} - -int UAgoraRtcEngine::SetSubscribeAudioBlocklistEx(TArray uidList, int uidNumber, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - agora::rtc::uid_t* data = new agora::rtc::uid_t[uidList.Num()]; - for (int i = 0; i < uidList.Num(); i++) - { - data[i] = (agora::rtc::uid_t)uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setSubscribeAudioBlocklistEx(data, uidNumber, rtcConnection); - return ret; -} - - -int UAgoraRtcEngine::SetSubscribeAudioAllowlist(TArray uidList, int uidNumber) -{ - agora::rtc::uid_t* data = new agora::rtc::uid_t[uidList.Num()]; - for (int i = 0; i < uidList.Num(); i++) - { - data[i] = (agora::rtc::uid_t)uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setSubscribeAudioAllowlist(data, uidNumber); - return ret; -} - -int UAgoraRtcEngine::SetSubscribeAudioAllowlistEx(TArray uidList, int uidNumber, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - agora::rtc::uid_t* data = new agora::rtc::uid_t[uidList.Num()]; - for (int i = 0; i < uidList.Num(); i++) - { - data[i] = (agora::rtc::uid_t)uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setSubscribeAudioAllowlistEx(data, uidNumber, rtcConnection); - return ret; -} - - -int UAgoraRtcEngine::SetSubscribeVideoBlocklist(TArray uidList, int uidNumber) -{ - agora::rtc::uid_t* data = new agora::rtc::uid_t[uidList.Num()]; - for (int i = 0; i < uidList.Num(); i++) - { - data[i] = (agora::rtc::uid_t)uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setSubscribeVideoBlocklist(data, uidNumber); - return ret; -} - -int UAgoraRtcEngine::SetSubscribeVideoBlocklistEx(TArray uidList, int uidNumber, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - agora::rtc::uid_t* data = new agora::rtc::uid_t[uidList.Num()]; - for (int i = 0; i < uidList.Num(); i++) - { - data[i] = (agora::rtc::uid_t)uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setSubscribeVideoBlocklistEx(data, uidNumber, rtcConnection); - return ret; -} - - -int UAgoraRtcEngine::SetSubscribeVideoAllowlist(TArray uidList, int uidNumber) -{ - agora::rtc::uid_t* data = new agora::rtc::uid_t[uidList.Num()]; - for (int i = 0; i < uidList.Num(); i++) - { - data[i] = (agora::rtc::uid_t)uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setSubscribeVideoAllowlist(data, uidNumber); - return ret; -} - -int UAgoraRtcEngine::SetSubscribeVideoAllowlistEx(TArray uidList, int uidNumber, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - agora::rtc::uid_t* data = new agora::rtc::uid_t[uidList.Num()]; - for (int i = 0; i < uidList.Num(); i++) - { - data[i] = (agora::rtc::uid_t)uidList[i]; - } - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setSubscribeVideoAllowlistEx(data, uidNumber, rtcConnection); - return ret; -} - -int UAgoraRtcEngine::AdjustUserPlaybackSignalVolumeEx(int64 uid, int volume, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->adjustUserPlaybackSignalVolumeEx(uid, volume, rtcConnection); - return ret; -} - -int UAgoraRtcEngine::StartRtmpStreamWithoutTranscodingEx(FString url, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - std::string Url = TCHAR_TO_UTF8(*url); - int ret = RtcEngineProxyClassWrapper::GetInstance()->startRtmpStreamWithoutTranscodingEx(Url.c_str(), rtcConnection); - return ret; -} - -int UAgoraRtcEngine::StartRtmpStreamWithTranscodingEx(FString url, const FLiveTranscoding& transcoding, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - std::string streamUrl = TCHAR_TO_UTF8(*url); - - agora::rtc::LiveTranscoding liveTranscoding; - liveTranscoding.width = transcoding.width; - liveTranscoding.height = transcoding.height; - liveTranscoding.videoBitrate = transcoding.videoBitrate; - liveTranscoding.videoFramerate = transcoding.videoFramerate; - liveTranscoding.lowLatency = transcoding.lowLatency; - liveTranscoding.videoGop = transcoding.videoGop; - liveTranscoding.videoCodecProfile = (agora::rtc::VIDEO_CODEC_PROFILE_TYPE)transcoding.videoCodecProfile; - liveTranscoding.backgroundColor = transcoding.backgroundColor; - liveTranscoding.videoCodecType = (agora::rtc::VIDEO_CODEC_TYPE_FOR_STREAM)transcoding.videoCodecType; - liveTranscoding.userCount = transcoding.userCount; - agora::rtc::TranscodingUser* trans = new agora::rtc::TranscodingUser[transcoding.userCount]; - for (int i = 0; i < transcoding.userCount; i++) - { - trans[i].alpha = transcoding.transcodingUsers[i].alpha; - trans[i].audioChannel = transcoding.transcodingUsers[i].audioChannel; - trans[i].height = transcoding.transcodingUsers[i].height; - trans[i].uid = transcoding.transcodingUsers[i].uid; - trans[i].width = transcoding.transcodingUsers[i].width; - trans[i].x = transcoding.transcodingUsers[i].x; - trans[i].y = transcoding.transcodingUsers[i].y; - trans[i].zOrder = transcoding.transcodingUsers[i].zOrder; - } - liveTranscoding.transcodingUsers = trans; - std::string TranscodingExtraInfo = TCHAR_TO_UTF8(*transcoding.transcodingExtraInfo); - liveTranscoding.transcodingExtraInfo = TranscodingExtraInfo.c_str(); - std::string Metadata = TCHAR_TO_UTF8(*transcoding.metadata); - liveTranscoding.metadata = Metadata.c_str(); - agora::rtc::RtcImage* image = new agora::rtc::RtcImage[transcoding.watermarkCount]; - for (int i = 0; i < transcoding.watermarkCount; i++) - { - image[i].alpha = transcoding.watermark[i].alpha; - std::string Url = TCHAR_TO_UTF8(*transcoding.watermark[i].url); - image[i].url = Url.c_str(); - image[i].height = transcoding.watermark[i].height; - image[i].width = transcoding.watermark[i].width; - image[i].x = transcoding.watermark[i].x; - image[i].y = transcoding.watermark[i].y; - image[i].zOrder = transcoding.watermark[i].zOrder; - } - liveTranscoding.watermark = image; - liveTranscoding.watermarkCount = transcoding.watermarkCount; - - agora::rtc::RtcImage* bgImage = new agora::rtc::RtcImage[transcoding.backgroundImageCount]; - for (int i = 0; i < transcoding.backgroundImageCount; i++) - { - bgImage[i].alpha = transcoding.backgroundImage[i].alpha; - std::string Url = TCHAR_TO_UTF8(*transcoding.backgroundImage[i].url); - bgImage[i].url = Url.c_str(); - bgImage[i].height = transcoding.backgroundImage[i].height; - bgImage[i].width = transcoding.backgroundImage[i].width; - bgImage[i].x = transcoding.backgroundImage[i].x; - bgImage[i].y = transcoding.backgroundImage[i].y; - bgImage[i].zOrder = transcoding.backgroundImage[i].zOrder; - } - liveTranscoding.backgroundImage = bgImage; - liveTranscoding.backgroundImageCount = transcoding.backgroundImageCount; - if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_32000) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_32000; - } - else if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_44100) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_44100; - } - else if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000; - } - liveTranscoding.audioBitrate = transcoding.audioBitrate; - liveTranscoding.audioChannels = transcoding.audioChannels; - liveTranscoding.audioCodecProfile = (agora::rtc::AUDIO_CODEC_PROFILE_TYPE)transcoding.audioCodecProfile; - - agora::rtc::LiveStreamAdvancedFeature* feature = new agora::rtc::LiveStreamAdvancedFeature[transcoding.advancedFeatureCount]; - for (int i = 0; i < transcoding.advancedFeatureCount; i++) - { - std::string FeatureName = TCHAR_TO_UTF8(*transcoding.advancedFeatures[i].featureName); - feature[i].featureName = FeatureName.c_str(); - feature[i].opened = transcoding.advancedFeatures[i].opened; - } - liveTranscoding.advancedFeatures = feature; - liveTranscoding.advancedFeatureCount = transcoding.advancedFeatureCount; - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startRtmpStreamWithTranscodingEx(streamUrl.c_str(), liveTranscoding, rtcConnection); - delete[] trans; - delete[] image; - delete[] bgImage; - delete[] feature; - - return ret; -} - -int UAgoraRtcEngine::UpdateRtmpTranscodingEx(const FLiveTranscoding& transcoding, const FRtcConnection& connection) -{ - agora::rtc::LiveTranscoding liveTranscoding; - liveTranscoding.width = transcoding.width; - liveTranscoding.height = transcoding.height; - liveTranscoding.videoBitrate = transcoding.videoBitrate; - liveTranscoding.videoFramerate = transcoding.videoFramerate; - liveTranscoding.lowLatency = transcoding.lowLatency; - liveTranscoding.videoGop = transcoding.videoGop; - liveTranscoding.videoCodecProfile = (agora::rtc::VIDEO_CODEC_PROFILE_TYPE)transcoding.videoCodecProfile; - liveTranscoding.backgroundColor = transcoding.backgroundColor; - liveTranscoding.videoCodecType = (agora::rtc::VIDEO_CODEC_TYPE_FOR_STREAM)transcoding.videoCodecType; - liveTranscoding.userCount = transcoding.userCount; - agora::rtc::TranscodingUser* trans = new agora::rtc::TranscodingUser[transcoding.userCount]; - for (int i = 0; i < transcoding.userCount; i++) - { - trans[i].alpha = transcoding.transcodingUsers[i].alpha; - trans[i].audioChannel = transcoding.transcodingUsers[i].audioChannel; - trans[i].height = transcoding.transcodingUsers[i].height; - trans[i].uid = transcoding.transcodingUsers[i].uid; - trans[i].width = transcoding.transcodingUsers[i].width; - trans[i].x = transcoding.transcodingUsers[i].x; - trans[i].y = transcoding.transcodingUsers[i].y; - trans[i].zOrder = transcoding.transcodingUsers[i].zOrder; - } - liveTranscoding.transcodingUsers = trans; - std::string TranscodingExtraInfo = TCHAR_TO_UTF8(*transcoding.transcodingExtraInfo); - liveTranscoding.transcodingExtraInfo = TranscodingExtraInfo.c_str(); - std::string Metadata = TCHAR_TO_UTF8(*transcoding.metadata); - liveTranscoding.metadata = Metadata.c_str(); - agora::rtc::RtcImage* image = new agora::rtc::RtcImage[transcoding.watermarkCount]; - for (int i = 0; i < transcoding.watermarkCount; i++) - { - image[i].alpha = transcoding.watermark[i].alpha; - std::string Url = TCHAR_TO_UTF8(*transcoding.watermark[i].url); - image[i].url = Url.c_str(); - image[i].height = transcoding.watermark[i].height; - image[i].width = transcoding.watermark[i].width; - image[i].x = transcoding.watermark[i].x; - image[i].y = transcoding.watermark[i].y; - image[i].zOrder = transcoding.watermark[i].zOrder; - } - liveTranscoding.watermark = image; - liveTranscoding.watermarkCount = transcoding.watermarkCount; - - agora::rtc::RtcImage* bgImage = new agora::rtc::RtcImage[transcoding.backgroundImageCount]; - for (int i = 0; i < transcoding.backgroundImageCount; i++) - { - bgImage[i].alpha = transcoding.backgroundImage[i].alpha; - std::string Url = TCHAR_TO_UTF8(*transcoding.backgroundImage[i].url); - bgImage[i].url = Url.c_str(); - bgImage[i].height = transcoding.backgroundImage[i].height; - bgImage[i].width = transcoding.backgroundImage[i].width; - bgImage[i].x = transcoding.backgroundImage[i].x; - bgImage[i].y = transcoding.backgroundImage[i].y; - bgImage[i].zOrder = transcoding.backgroundImage[i].zOrder; - } - liveTranscoding.backgroundImage = bgImage; - liveTranscoding.backgroundImageCount = transcoding.backgroundImageCount; - if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_32000) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_32000; - } - else if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_44100) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_44100; - } - else if (transcoding.audioSampleRate == EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000) - { - liveTranscoding.audioSampleRate = agora::rtc::AUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000; - } - liveTranscoding.audioBitrate = transcoding.audioBitrate; - liveTranscoding.audioChannels = transcoding.audioChannels; - liveTranscoding.audioCodecProfile = (agora::rtc::AUDIO_CODEC_PROFILE_TYPE)transcoding.audioCodecProfile; - - agora::rtc::LiveStreamAdvancedFeature* feature = new agora::rtc::LiveStreamAdvancedFeature[transcoding.advancedFeatureCount]; - for (int i = 0; i < transcoding.advancedFeatureCount; i++) - { - std::string FeatureName = TCHAR_TO_UTF8(*transcoding.advancedFeatures[i].featureName); - feature[i].featureName = FeatureName.c_str(); - feature[i].opened = transcoding.advancedFeatures[i].opened; - } - liveTranscoding.advancedFeatures = feature; - liveTranscoding.advancedFeatureCount = transcoding.advancedFeatureCount; - - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateRtmpTranscodingEx(liveTranscoding, rtcConnection); - delete[] trans; - delete[] image; - delete[] bgImage; - delete[] feature; - return ret; -} - -int UAgoraRtcEngine::StopRtmpStreamEx(FString url, const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - std::string Url = TCHAR_TO_UTF8(*url); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startRtmpStreamWithoutTranscodingEx(Url.c_str(), rtcConnection); - return ret; -} - -int UAgoraRtcEngine::StartChannelMediaRelayEx(const FChannelMediaRelayConfiguration& configuration, const FRtcConnection& connection) -{ - agora::rtc::ChannelMediaRelayConfiguration channelMediaRelayConfiguration; - agora::rtc::ChannelMediaInfo* mediaInfo = new agora::rtc::ChannelMediaInfo(); - std::string ChannelName = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfo->channelName = ChannelName.c_str(); - std::string Token = TCHAR_TO_UTF8(*configuration.srcInfo.token); - mediaInfo->token = Token.c_str(); - mediaInfo->uid = configuration.srcInfo.uid; - channelMediaRelayConfiguration.srcInfo = mediaInfo; - agora::rtc::ChannelMediaInfo* mediaInfos = new agora::rtc::ChannelMediaInfo[configuration.destCount]; - for (int i = 0; i < configuration.destCount; i++) - { - std::string ChannelNameTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].channelName = ChannelNameTemp.c_str(); - std::string TokenTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].token = TokenTemp.c_str(); - mediaInfos[i].uid = configuration.destInfos[i].uid; - } - channelMediaRelayConfiguration.destInfos = mediaInfos; - channelMediaRelayConfiguration.destCount = configuration.destCount; - - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startChannelMediaRelayEx(channelMediaRelayConfiguration, rtcConnection); - delete mediaInfo; - delete[] mediaInfos; - return ret; -} - -int UAgoraRtcEngine::UpdateChannelMediaRelayEx(const FChannelMediaRelayConfiguration& configuration, const FRtcConnection& connection) -{ - agora::rtc::ChannelMediaRelayConfiguration channelMediaRelayConfiguration; - agora::rtc::ChannelMediaInfo* mediaInfo = new agora::rtc::ChannelMediaInfo(); - std::string ChannelName = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfo->channelName = ChannelName.c_str(); - std::string Token = TCHAR_TO_UTF8(*configuration.srcInfo.token); - mediaInfo->token = Token.c_str(); - mediaInfo->uid = configuration.srcInfo.uid; - channelMediaRelayConfiguration.srcInfo = mediaInfo; - agora::rtc::ChannelMediaInfo* mediaInfos = new agora::rtc::ChannelMediaInfo[configuration.destCount]; - for (int i = 0; i < configuration.destCount; i++) - { - std::string ChannelNameTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].channelName = ChannelNameTemp.c_str(); - std::string TokenTemp = TCHAR_TO_UTF8(*configuration.srcInfo.channelName); - mediaInfos[i].token = TokenTemp.c_str(); - mediaInfos[i].uid = configuration.destInfos[i].uid; - } - channelMediaRelayConfiguration.destInfos = mediaInfos; - channelMediaRelayConfiguration.destCount = configuration.destCount; - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->updateChannelMediaRelayEx(channelMediaRelayConfiguration, rtcConnection); - delete mediaInfo; - delete[] mediaInfos; - return ret; -} - -int UAgoraRtcEngine::StopChannelMediaRelayEx(const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->stopChannelMediaRelayEx(rtcConnection); - return ret; -} - -int UAgoraRtcEngine::PauseAllChannelMediaRelayEx(const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->pauseAllChannelMediaRelayEx(rtcConnection); - return ret; -} - -int UAgoraRtcEngine::ResumeAllChannelMediaRelayEx(const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->resumeAllChannelMediaRelayEx(rtcConnection); - return ret; -} - -int UAgoraRtcEngine::SetParameters(FString parameters) -{ - std::string parameterstr = TCHAR_TO_UTF8(*parameters); - - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setParameters(parameterstr.c_str()); - return ret; -} - - -int UAgoraRtcEngine::StartMediaRenderingTracing() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startMediaRenderingTracing(); - return ret; -} - - -int UAgoraRtcEngine::StartMediaRenderingTracingEx(const FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string ChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = ChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - auto ret = RtcEngineProxyClassWrapper::GetInstance()->startMediaRenderingTracingEx(rtcConnection); - return ret; -} - -int UAgoraRtcEngine::EnableInstantMediaRendering() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->enableInstantMediaRendering(); - return ret; -} - - -FString UAgoraRtcEngine::GetNtpWallTimeInMs() -{ - FString ret = FString::Printf(TEXT("%llu"), RtcEngineProxyClassWrapper::GetInstance()->getNtpWallTimeInMs()); - return ret; -} - - -int UAgoraRtcEngine::SetHeadphoneEQPreset(FENUMWRAP_HEADPHONE_EQUALIZER_PRESET preset) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setHeadphoneEQPreset(preset.GetRawValue()); - return ret; -} - - -int UAgoraRtcEngine::SetHeadphoneEQParameters(int lowGain, int highGain) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setHeadphoneEQParameters(lowGain, highGain); - return ret; -} - - -int UAgoraRtcEngine::SetEarMonitoringAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->setEarMonitoringAudioFrameParameters(sampleRate, channel, (agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE)((int)mode), samplesPerCall); - return ret; -} - - -int64 UAgoraRtcEngine::GetCurrentMonotonicTimeInMs() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getCurrentMonotonicTimeInMs(); - return ret; -} - - - -int UAgoraRtcEngine::RegisterExtension(FString provider, FString extension, EMEDIA_SOURCE_TYPE type) -{ - std::string Provider = TCHAR_TO_UTF8(*provider); - std::string Extension = TCHAR_TO_UTF8(*extension); - auto ret = RtcEngineProxyClassWrapper::GetInstance()->registerExtension(Provider.c_str(), Extension.c_str(), (agora::media::MEDIA_SOURCE_TYPE)type); - return ret; -} - - -int UAgoraRtcEngine::GetNetworkType() -{ - auto ret = RtcEngineProxyClassWrapper::GetInstance()->getNetworkType(); - return ret; -} - -int64 UIScreenCaptureSourceList::GetCount() -{ -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - if (sourceListNative != nullptr) - { - return sourceListNative->getCount(); - } -#endif - return -1; -} - -FScreenCaptureSourceInfo UIScreenCaptureSourceList::GetSourceInfo(int64 index) -{ - FScreenCaptureSourceInfo sourceInfo; -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - if (sourceListNative != nullptr) - { - agora::rtc::ScreenCaptureSourceInfo info = sourceListNative->getSourceInfo(index); - - FThumbImageBuffer iconImagebuffer; - char* icon = new char[info.iconImage.length]; - FMemory::Memcpy(icon, info.iconImage.buffer, info.iconImage.length); - for (unsigned int i = 0; i < info.iconImage.length; i++) - { - iconImagebuffer.buffer.Add(icon[i]); - } - delete[] icon; - iconImagebuffer.height = info.iconImage.height; - iconImagebuffer.width = info.iconImage.width; - iconImagebuffer.length = info.iconImage.length; - - sourceInfo.iconImage = iconImagebuffer; - sourceInfo.isOccluded = info.isOccluded; - sourceInfo.primaryMonitor = info.primaryMonitor; - sourceInfo.processPath = info.processPath; - sourceInfo.sourceId = (int64)info.sourceId; - sourceInfo.sourceName = UTF8_TO_TCHAR(info.sourceName); - sourceInfo.sourceTitle = info.sourceTitle; - - FThumbImageBuffer thumbImagebuffer; - char* icon2 = new char[info.thumbImage.length]; - FMemory::Memcpy(icon2, info.thumbImage.buffer, info.thumbImage.length); - for (unsigned int i = 0; i < info.thumbImage.length; i++) - { - thumbImagebuffer.buffer.Add(icon2[i]); - } - delete[] icon2; - thumbImagebuffer.height = info.thumbImage.height; - thumbImagebuffer.width = info.thumbImage.width; - thumbImagebuffer.length = info.thumbImage.length; - sourceInfo.thumbImage = thumbImagebuffer; - sourceInfo.type = info.type; - UE_LOG(LogTemp, Warning, TEXT("ScreenCaptureSourceType %d"), (int)info.type) - } -#endif - return sourceInfo; -} - -void UIScreenCaptureSourceList::Release() -{ -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - if (sourceListNative != nullptr) - { - sourceListNative->release(); - sourceListNative = nullptr; - } -#endif -} - -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) -void UIScreenCaptureSourceList::SetScreenCaptureList(agora::rtc::IScreenCaptureSourceList* sourcelist) -{ - sourceListNative = sourcelist; -} -#endif - - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraSpatialAudio.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraSpatialAudio.cpp deleted file mode 100644 index f0ec1eea..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/AgoraSpatialAudio.cpp +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/AgoraSpatialAudio.h" - -int UILocalSpatialAudioEngine::Initialize(FLocalSpatialAudioConfig& config) -{ - agora::rtc::LocalSpatialAudioConfig localSpatialAudioConfig; - localSpatialAudioConfig.rtcEngine = config.rtcEngine; - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->initialize(localSpatialAudioConfig); - } - return -ERROR_NULLPTR; -} -int UILocalSpatialAudioEngine::UpdateRemotePosition(int64 uid, FRemoteVoicePositionInfo& posInfo) -{ - agora::rtc::RemoteVoicePositionInfo remoteVoicePositionInfo; - float pos[3]; - - float forward[3]; - - pos[0] = posInfo.position.X; - pos[1] = posInfo.position.Y; - pos[2] = posInfo.position.Z; - - forward[0] = posInfo.forward.X; - forward[1] = posInfo.forward.Y; - forward[2] = posInfo.forward.Z; - - FMemory::Memcpy(remoteVoicePositionInfo.position, pos); - FMemory::Memcpy(remoteVoicePositionInfo.forward, forward); - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->updateRemotePosition(uid, remoteVoicePositionInfo); - } - return -ERROR_NULLPTR; -} -int UILocalSpatialAudioEngine::UpdateRemotePositionEx(int64 uid, FRemoteVoicePositionInfo& posInfo, FRtcConnection& connection) -{ - agora::rtc::RemoteVoicePositionInfo remoteVoicePositionInfo; - - float pos[3]; - - float forward[3]; - - pos[0] = posInfo.position.X; - pos[1] = posInfo.position.Y; - pos[2] = posInfo.position.Z; - - forward[0] = posInfo.forward.X; - forward[1] = posInfo.forward.Y; - forward[2] = posInfo.forward.Z; - - FMemory::Memcpy(remoteVoicePositionInfo.position, pos); - FMemory::Memcpy(remoteVoicePositionInfo.forward, forward); - - agora::rtc::RtcConnection rtcConnection; - std::string StdStrChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = StdStrChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->updateRemotePositionEx(uid, remoteVoicePositionInfo, rtcConnection); - } - return -ERROR_NULLPTR; -} -int UILocalSpatialAudioEngine::RemoveRemotePosition(int64 uid) -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->removeRemotePosition(uid); - } - return -ERROR_NULLPTR; -} -int UILocalSpatialAudioEngine::RemoveRemotePositionEx(int64 uid, FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string StdStrChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = StdStrChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->removeRemotePositionEx(uid, rtcConnection); - } - return -ERROR_NULLPTR; -} -int UILocalSpatialAudioEngine::ClearRemotePositions() -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->clearRemotePositions(); - } - return -ERROR_NULLPTR; -} -int UILocalSpatialAudioEngine::ClearRemotePositionsEx(FRtcConnection& connection) -{ - agora::rtc::RtcConnection rtcConnection; - std::string StdStrChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = StdStrChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->clearRemotePositionsEx(rtcConnection); - } - return -ERROR_NULLPTR; -} - - -int UILocalSpatialAudioEngine::SetRemoteAudioAttenuation(int64 uid, bool forceSet, FString attenuation /*= "0.0"*/) -{ - if (LocalSpatialAudioEngine != nullptr) - { - double ValAttenuation = FCString::Atod(*attenuation); - auto ret = LocalSpatialAudioEngine->setRemoteAudioAttenuation(uid, ValAttenuation, forceSet); - return ret; - } - return -ERROR_NULLPTR; - -} - -void UILocalSpatialAudioEngine::Release() -{ - if (LocalSpatialAudioEngine != nullptr) - { - LocalSpatialAudioEngine->release(); - } -} - -int UILocalSpatialAudioEngine::SetMaxAudioRecvCount(int maxCount) -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->setMaxAudioRecvCount(maxCount); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::SetAudioRecvRange(float range) -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->setAudioRecvRange(range); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::SetDistanceUnit(float unit) -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->setDistanceUnit(unit); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::UpdateSelfPosition(FVector position, FVector axisForward, FVector axisRight, FVector axisUp) -{ - float pos[3]; - - pos[0] = position.X; - pos[1] = position.Y; - pos[2] = position.Z; - - float forward[3]; - - forward[0] = axisForward.X; - forward[1] = axisForward.Y; - forward[2] = axisForward.Z; - - float right[3]; - - right[0] = axisRight.X; - right[1] = axisRight.Y; - right[2] = axisRight.Z; - - float up[3]; - - up[0] = axisUp.X; - up[1] = axisUp.Y; - up[2] = axisUp.Z; - - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->updateSelfPosition(pos, forward, right, up); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::UpdateSelfPositionEx(FVector position, FVector axisForward, FVector axisRight, FVector axisUp, const FRtcConnection& connection) -{ - float pos[3]; - - pos[0] = position.X; - pos[1] = position.Y; - pos[2] = position.Z; - - float forward[3]; - - forward[0] = axisForward.X; - forward[1] = axisForward.Y; - forward[2] = axisForward.Z; - - float right[3]; - - right[0] = axisRight.X; - right[1] = axisRight.Y; - right[2] = axisRight.Z; - - float up[3]; - - up[0] = axisUp.X; - up[1] = axisUp.Y; - up[2] = axisUp.Z; - - agora::rtc::RtcConnection rtcConnection; - std::string StdStrChannelId = TCHAR_TO_UTF8(*connection.channelId); - rtcConnection.channelId = StdStrChannelId.c_str(); - rtcConnection.localUid = connection.localUid; - - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->updateSelfPositionEx(pos, forward, right, up, rtcConnection); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::UpdatePlayerPositionInfo(int playerId, const FRemoteVoicePositionInfo& positionInfo) -{ - agora::rtc::RemoteVoicePositionInfo Info; - - float pos[3]; - - float forward[3]; - - pos[0] = positionInfo.position.X; - pos[1] = positionInfo.position.Y; - pos[2] = positionInfo.position.Z; - - forward[0] = positionInfo.forward.X; - forward[1] = positionInfo.forward.Y; - forward[2] = positionInfo.forward.Z; - - FMemory::Memcpy(Info.position, pos); - - FMemory::Memcpy(Info.forward, forward); - - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->updatePlayerPositionInfo(playerId, Info); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::SetParameters(FString params) -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->setParameters(TCHAR_TO_UTF8(*params)); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::MuteLocalAudioStream(bool mute) -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->muteLocalAudioStream(mute); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::MuteAllRemoteAudioStreams(bool mute) -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->muteAllRemoteAudioStreams(mute); - } - return -ERROR_NULLPTR; -} - - -int UILocalSpatialAudioEngine::SetZones(TArray zones) -{ - int zoneCount = zones.Num(); - if (LocalSpatialAudioEngine != nullptr) - { - agora::rtc::SpatialAudioZone* valZones = new agora::rtc::SpatialAudioZone[zoneCount]; - for (int i = 0; i < zones.Num(); i++) { - valZones[i].zoneSetId = zones[i].zoneSetId; - valZones[i].position[0] = zones[i].position.X; - valZones[i].position[1] = zones[i].position.Y; - valZones[i].position[2] = zones[i].position.Z; - valZones[i].forward[0] = zones[i].forward.X; - valZones[i].forward[1] = zones[i].forward.Y; - valZones[i].forward[2] = zones[i].forward.Z; - valZones[i].right[0] = zones[i].right.X; - valZones[i].right[1] = zones[i].right.Y; - valZones[i].right[2] = zones[i].right.Z; - valZones[i].up[0] = zones[i].up.X; - valZones[i].up[1] = zones[i].up.Y; - valZones[i].up[2] = zones[i].up.Z; - valZones[i].forwardLength = zones[i].forwardLength; - valZones[i].rightLength = zones[i].rightLength; - valZones[i].upLength = zones[i].upLength; - valZones[i].audioAttenuation = zones[i].audioAttenuation; - } - - return LocalSpatialAudioEngine->setZones(valZones, zoneCount); - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::SetPlayerAttenuation(int playerId, bool forceSet, FString attenuation /*= "0.0"*/) -{ - if (LocalSpatialAudioEngine != nullptr) - { - double ValAttenuation = FCString::Atod(*attenuation); - auto ret = LocalSpatialAudioEngine->setPlayerAttenuation(playerId, ValAttenuation, forceSet); - return ret; - } - return -ERROR_NULLPTR; -} - -int UILocalSpatialAudioEngine::muteRemoteAudioStream(int64 uid, bool mute) -{ - if (LocalSpatialAudioEngine != nullptr) - { - return LocalSpatialAudioEngine->muteRemoteAudioStream(uid, mute); - } - return -ERROR_NULLPTR; -} - -void UILocalSpatialAudioEngine::SetLocalSpatialAudioEngine(agora::rtc::ILocalSpatialAudioEngine* localSpatialAudioEngine) -{ - this->LocalSpatialAudioEngine = localSpatialAudioEngine; -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IAudioEncodedFrameObserver.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IAudioEncodedFrameObserver.cpp deleted file mode 100644 index f461443b..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IAudioEncodedFrameObserver.cpp +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/IAudioEncodedFrameObserver.h" - - -bool UIPacketObserver::onSendAudioPacket(agora::rtc::IPacketObserver::Packet& packet) -{ - FPacket pack; -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - OnSendAudioPacket.Broadcast(pack); - }); - unsigned char* tempdata = new unsigned char[pack.size]; - for (int i = 0; i < pack.size; i++) - { - tempdata[i] = pack.buffer[i]; - } - FMemory::Memcpy((void*)packet.buffer, tempdata, pack.size); - delete[] tempdata; - packet.size = pack.size; - - return true; -} -bool UIPacketObserver::onSendVideoPacket(agora::rtc::IPacketObserver::Packet& packet) -{ - FPacket pack; -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - OnSendVideoPacket.Broadcast(pack); - }); - unsigned char* tempdata = new unsigned char[pack.size]; - for (int i = 0; i < pack.size; i++) - { - tempdata[i] = pack.buffer[i]; - } - FMemory::Memcpy((void*)packet.buffer, tempdata, pack.size); - delete[] tempdata; - packet.size = pack.size; - return true; -} -bool UIPacketObserver::onReceiveAudioPacket(agora::rtc::IPacketObserver::Packet& packet) -{ -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - FPacket pack; - unsigned char* tempdata = new unsigned char[packet.size]; - FMemory::Memcpy((void*)tempdata, packet.buffer, packet.size); - TArray callBackdata; - for (unsigned int i = 0; i < packet.size; i++) - { - callBackdata.Add(tempdata[i]); - } - delete[] tempdata; - pack.buffer = callBackdata; - pack.size = packet.size; - OnReceiveAudioPacket.Broadcast(pack); - }); - return true; -} -bool UIPacketObserver::onReceiveVideoPacket(agora::rtc::IPacketObserver::Packet& packet) -{ -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - FPacket pack; - unsigned char* tempdata = new unsigned char[packet.size]; - FMemory::Memcpy((void*)tempdata, packet.buffer, packet.size); - TArray callBackdata; - for (unsigned int i = 0; i < packet.size; i++) - { - callBackdata.Add(tempdata[i]); - } - delete[] tempdata; - pack.buffer = callBackdata; - pack.size = packet.size; - OnReceiveVideoPacket.Broadcast(pack); - }); - return true; -} - -void UIAudioEncodedFrameObserver::onRecordAudioEncodedFrame(const uint8_t* frameBuffer, int length, const agora::rtc::EncodedAudioFrameInfo& audioEncodedFrameInfo) -{ -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - FEncodedAudioFrameInfo encodedAudioFrameInfo; - encodedAudioFrameInfo.codec = (EAUDIO_CODEC_TYPE)audioEncodedFrameInfo.codec; - encodedAudioFrameInfo.sampleRateHz = audioEncodedFrameInfo.sampleRateHz; - encodedAudioFrameInfo.samplesPerChannel = audioEncodedFrameInfo.samplesPerChannel; - encodedAudioFrameInfo.numberOfChannels = audioEncodedFrameInfo.numberOfChannels; - FEncodedAudioFrameAdvancedSettings advancedSettings; - advancedSettings.sendEvenIfEmpty = audioEncodedFrameInfo.advancedSettings.sendEvenIfEmpty; - advancedSettings.speech = audioEncodedFrameInfo.advancedSettings.speech; - encodedAudioFrameInfo.advancedSettings = advancedSettings; - encodedAudioFrameInfo.captureTimeMs = audioEncodedFrameInfo.captureTimeMs; - unsigned char* tempdata = new unsigned char[length]; - FMemory::Memcpy(tempdata, frameBuffer, length); - TArray buffer; - for (int i = 0; i < length; i++) - { - buffer.Add(tempdata[i]); - } - delete[] tempdata; - OnRecordAudioEncoded.Broadcast(buffer, length, encodedAudioFrameInfo); - }); -} - -void UIAudioEncodedFrameObserver::onPlaybackAudioEncodedFrame(const uint8_t* frameBuffer, int length, const agora::rtc::EncodedAudioFrameInfo& audioEncodedFrameInfo) -{ -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - FEncodedAudioFrameInfo encodedAudioFrameInfo; - encodedAudioFrameInfo.codec = (EAUDIO_CODEC_TYPE)audioEncodedFrameInfo.codec; - encodedAudioFrameInfo.sampleRateHz = audioEncodedFrameInfo.sampleRateHz; - encodedAudioFrameInfo.samplesPerChannel = audioEncodedFrameInfo.samplesPerChannel; - encodedAudioFrameInfo.numberOfChannels = audioEncodedFrameInfo.numberOfChannels; - FEncodedAudioFrameAdvancedSettings advancedSettings; - advancedSettings.sendEvenIfEmpty = audioEncodedFrameInfo.advancedSettings.sendEvenIfEmpty; - advancedSettings.speech = audioEncodedFrameInfo.advancedSettings.speech; - encodedAudioFrameInfo.advancedSettings = advancedSettings; - encodedAudioFrameInfo.captureTimeMs = audioEncodedFrameInfo.captureTimeMs; - unsigned char* tempdata = new unsigned char[length]; - FMemory::Memcpy(tempdata, frameBuffer, length); - TArray buffer; - for (int i = 0; i < length; i++) - { - buffer.Add(tempdata[i]); - } - delete[] tempdata; - OnPlaybackAudioEncoded.Broadcast(buffer, length, encodedAudioFrameInfo); - }); -} - - -void UIAudioEncodedFrameObserver::onMixedAudioEncodedFrame(const uint8_t* frameBuffer, int length, const agora::rtc::EncodedAudioFrameInfo& audioEncodedFrameInfo) -{ -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - FEncodedAudioFrameInfo encodedAudioFrameInfo; - encodedAudioFrameInfo.codec = (EAUDIO_CODEC_TYPE)audioEncodedFrameInfo.codec; - encodedAudioFrameInfo.sampleRateHz = audioEncodedFrameInfo.sampleRateHz; - encodedAudioFrameInfo.samplesPerChannel = audioEncodedFrameInfo.samplesPerChannel; - encodedAudioFrameInfo.numberOfChannels = audioEncodedFrameInfo.numberOfChannels; - FEncodedAudioFrameAdvancedSettings advancedSettings; - advancedSettings.sendEvenIfEmpty = audioEncodedFrameInfo.advancedSettings.sendEvenIfEmpty; - advancedSettings.speech = audioEncodedFrameInfo.advancedSettings.speech; - encodedAudioFrameInfo.advancedSettings = advancedSettings; - encodedAudioFrameInfo.captureTimeMs = audioEncodedFrameInfo.captureTimeMs; - unsigned char* tempdata = new unsigned char[length]; - FMemory::Memcpy(tempdata, frameBuffer, length); - TArray buffer; - for (int i = 0; i < length; i++) - { - buffer.Add(tempdata[i]); - } - delete[] tempdata; - OnMixedAudioEncoded.Broadcast(buffer, length, encodedAudioFrameInfo); - }); -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IFrameObserver.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IFrameObserver.cpp deleted file mode 100644 index 589e6047..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IFrameObserver.cpp +++ /dev/null @@ -1,778 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/IFrameObserver.h" - -bool UIAudioFrameObserver::onPlaybackAudioFrameBeforeMixing(const char* channelId, agora::rtc::uid_t uid, agora::media::IAudioFrameObserverBase::AudioFrame& audioFrame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FAudioFrame frame; - frame.type = (EAUDIO_FRAME_TYPE)audioFrame.type; - frame.samplesPerChannel = audioFrame.samplesPerChannel; - frame.bytesPerSample = (EBYTES_PER_SAMPLE)audioFrame.bytesPerSample; - frame.channels = audioFrame.channels; - frame.samplesPerSec = audioFrame.samplesPerSec; - - int ByteSize = audioFrame.bytesPerSample * audioFrame.samplesPerChannel * audioFrame.channels; - frame.buffer.AddZeroed(ByteSize); - FMemory::Memcpy(frame.buffer.GetData(), audioFrame.buffer, ByteSize); - - frame.renderTimeMs = audioFrame.renderTimeMs; - frame.avsync_type = audioFrame.avsync_type; - OnPlaybackAudioFrameBeforeMixing.Broadcast(FString(channelId), uid, frame); - }); - return true; -} - - -bool UIAudioFrameObserver::onEarMonitoringAudioFrame(AudioFrame& audioFrame) -{ - return true; -} - -agora::media::IAudioFrameObserverBase::AudioParams UIAudioFrameObserver::getEarMonitoringAudioParams() -{ - AudioParams params; - - return params; -} - -bool UIAudioSpectrumObserver::onLocalAudioSpectrum(const agora::media::AudioSpectrumData& data) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FAudioSpectrumData audioSpectrumData; - float* audioData = new float[data.dataLength]; - FMemory::Memcpy(audioData, data.audioSpectrumData, data.dataLength); - for (int i = 0; i < data.dataLength; i++) - { - audioSpectrumData.audioSpectrumData.Add(audioData[i]); - } - delete[] audioData; - audioSpectrumData.dataLength = data.dataLength; - OnLocalAudioSpectrum.Broadcast(audioSpectrumData); - }); - return true; -} -bool UIAudioSpectrumObserver::onRemoteAudioSpectrum(const agora::media::UserAudioSpectrumInfo* spectrums, unsigned int spectrumNumber) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FUserAudioSpectrumInfo userAudioSpectrumInfo; - userAudioSpectrumInfo.uid = spectrums->uid; - agora::media::UserAudioSpectrumInfo* audioSpectrumInfo = new agora::media::UserAudioSpectrumInfo[spectrumNumber]; - FMemory::Memcpy(audioSpectrumInfo, spectrums, spectrumNumber); - TArray userAudioInfos; - for (unsigned int i = 0; i < spectrumNumber; i++) - { - FUserAudioSpectrumInfo userAudioInfo; - userAudioInfo.uid = audioSpectrumInfo->uid; - - agora::media::AudioSpectrumData data = audioSpectrumInfo->spectrumData; - FAudioSpectrumData audioSpectrumData; - float* audioData = new float[data.dataLength]; - FMemory::Memcpy(audioData, data.audioSpectrumData, data.dataLength); - for (int j = 0; j < data.dataLength; j++) - { - audioSpectrumData.audioSpectrumData.Add(audioData[j]); - } - delete[] audioData; - audioSpectrumData.dataLength = data.dataLength; - userAudioInfo.spectrumData = audioSpectrumData; - userAudioInfos.Add(userAudioInfo); - } - delete[] audioSpectrumInfo; - OnRemoteAudioSpectrum.Broadcast(userAudioInfos, spectrumNumber); - }); - return true; -} - - -bool UIVideoFrameObserver::onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::media::base::VideoFrame& videoFrame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FVideoFrame frame; - frame.type = (EVIDEO_PIXEL_FORMAT)videoFrame.type; - frame.width = videoFrame.width; - frame.height = videoFrame.height; - frame.yStride = videoFrame.yStride; - frame.uStride = videoFrame.uStride; - frame.vStride = videoFrame.vStride; - unsigned char* y = new unsigned char[videoFrame.yStride]; - FMemory::Memcpy(y, videoFrame.yBuffer, videoFrame.yStride); - for (int i = 0; i < videoFrame.yStride; i++) - { - frame.yBuffer.Add(y[i]); - } - delete[] y; - unsigned char* u = new unsigned char[videoFrame.uStride]; - FMemory::Memcpy(u, videoFrame.uBuffer, videoFrame.uStride); - for (int i = 0; i < videoFrame.uStride; i++) - { - frame.uBuffer.Add(u[i]); - } - delete[] u; - unsigned char* v = new unsigned char[videoFrame.vStride]; - FMemory::Memcpy(v, videoFrame.vBuffer, videoFrame.vStride); - for (int i = 0; i < videoFrame.vStride; i++) - { - frame.vBuffer.Add(v[i]); - } - delete[] v; - frame.rotation = videoFrame.rotation; - frame.renderTimeMs = videoFrame.renderTimeMs; - frame.avsync_type = videoFrame.avsync_type; - unsigned char* metadatabuffer = new unsigned char[videoFrame.metadata_size]; - FMemory::Memcpy(metadatabuffer, videoFrame.metadata_buffer, videoFrame.metadata_size); - for (int i = 0; i < videoFrame.metadata_size; i++) - { - frame.metadata_buffer.Add(metadatabuffer[i]); - } - delete[] metadatabuffer; - frame.metadata_size = videoFrame.metadata_size; - //frame.sharedContext = videoFrame.sharedContext; - frame.textureId = videoFrame.textureId; - for (int i = 0; i < 16; i++) - { - frame.matrix.Add(videoFrame.matrix[i]); - } - OnCaptureVideoFrame.Broadcast((EVIDEO_SOURCE_TYPE)sourceType, frame); - }); - return true; -} -bool UIVideoFrameObserver::onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::media::base::VideoFrame& videoFrame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FVideoFrame frame; - frame.type = (EVIDEO_PIXEL_FORMAT)videoFrame.type; - frame.width = videoFrame.width; - frame.height = videoFrame.height; - frame.yStride = videoFrame.yStride; - frame.uStride = videoFrame.uStride; - frame.vStride = videoFrame.vStride; - unsigned char* y = new unsigned char[videoFrame.yStride]; - FMemory::Memcpy(y, videoFrame.yBuffer, videoFrame.yStride); - for (int i = 0; i < videoFrame.yStride; i++) - { - frame.yBuffer.Add(y[i]); - } - delete[] y; - unsigned char* u = new unsigned char[videoFrame.uStride]; - FMemory::Memcpy(u, videoFrame.uBuffer, videoFrame.uStride); - for (int i = 0; i < videoFrame.uStride; i++) - { - frame.uBuffer.Add(u[i]); - } - delete[] u; - unsigned char* v = new unsigned char[videoFrame.vStride]; - FMemory::Memcpy(v, videoFrame.vBuffer, videoFrame.vStride); - for (int i = 0; i < videoFrame.vStride; i++) - { - frame.vBuffer.Add(v[i]); - } - delete[] v; - frame.rotation = videoFrame.rotation; - frame.renderTimeMs = videoFrame.renderTimeMs; - frame.avsync_type = videoFrame.avsync_type; - unsigned char* metadatabuffer = new unsigned char[videoFrame.metadata_size]; - FMemory::Memcpy(metadatabuffer, videoFrame.metadata_buffer, videoFrame.metadata_size); - for (int i = 0; i < videoFrame.metadata_size; i++) - { - frame.metadata_buffer.Add(metadatabuffer[i]); - } - delete[] metadatabuffer; - frame.metadata_size = videoFrame.metadata_size; - frame.textureId = videoFrame.textureId; - for (int i = 0; i < 16; i++) - { - frame.matrix.Add(videoFrame.matrix[i]); - } - OnPreEncodeVideoFrame.Broadcast((EVIDEO_SOURCE_TYPE)sourceType, frame); - }); - return true; -} - - -bool UIVideoFrameObserver::onMediaPlayerVideoFrame(agora::media::base::VideoFrame& videoFrame, int mediaPlayerId) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FVideoFrame frame; - frame.type = (EVIDEO_PIXEL_FORMAT)videoFrame.type; - frame.width = videoFrame.width; - frame.height = videoFrame.height; - frame.yStride = videoFrame.yStride; - frame.uStride = videoFrame.uStride; - frame.vStride = videoFrame.vStride; - unsigned char* y = new unsigned char[videoFrame.yStride]; - FMemory::Memcpy(y, videoFrame.yBuffer, videoFrame.yStride); - for (int i = 0; i < videoFrame.yStride; i++) - { - frame.yBuffer.Add(y[i]); - } - delete[] y; - unsigned char* u = new unsigned char[videoFrame.uStride]; - FMemory::Memcpy(u, videoFrame.uBuffer, videoFrame.uStride); - for (int i = 0; i < videoFrame.uStride; i++) - { - frame.uBuffer.Add(u[i]); - } - delete[] u; - unsigned char* v = new unsigned char[videoFrame.vStride]; - FMemory::Memcpy(v, videoFrame.vBuffer, videoFrame.vStride); - for (int i = 0; i < videoFrame.vStride; i++) - { - frame.vBuffer.Add(v[i]); - } - delete[] v; - frame.rotation = videoFrame.rotation; - frame.renderTimeMs = videoFrame.renderTimeMs; - frame.avsync_type = videoFrame.avsync_type; - unsigned char* metadatabuffer = new unsigned char[videoFrame.metadata_size]; - FMemory::Memcpy(metadatabuffer, videoFrame.metadata_buffer, videoFrame.metadata_size); - for (int i = 0; i < videoFrame.metadata_size; i++) - { - frame.metadata_buffer.Add(metadatabuffer[i]); - } - delete[] metadatabuffer; - frame.metadata_size = videoFrame.metadata_size; - //frame.sharedContext = videoFrame.sharedContext; - frame.textureId = videoFrame.textureId; - for (int i = 0; i < 16; i++) - { - frame.matrix.Add(videoFrame.matrix[i]); - } - OnMediaPlayerVideoFrame.Broadcast(frame, mediaPlayerId); - }); - return true; -} - -bool UIVideoFrameObserver::onRenderVideoFrame(const char* channelId, agora::rtc::uid_t remoteUid, agora::media::base::VideoFrame& videoFrame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FVideoFrame frame; - frame.type = (EVIDEO_PIXEL_FORMAT)videoFrame.type; - frame.width = videoFrame.width; - frame.height = videoFrame.height; - frame.yStride = videoFrame.yStride; - frame.uStride = videoFrame.uStride; - frame.vStride = videoFrame.vStride; - unsigned char* y = new unsigned char[videoFrame.yStride]; - FMemory::Memcpy(y, videoFrame.yBuffer, videoFrame.yStride); - for (int i = 0; i < videoFrame.yStride; i++) - { - frame.yBuffer.Add(y[i]); - } - delete[] y; - unsigned char* u = new unsigned char[videoFrame.uStride]; - FMemory::Memcpy(u, videoFrame.uBuffer, videoFrame.uStride); - for (int i = 0; i < videoFrame.uStride; i++) - { - frame.uBuffer.Add(u[i]); - } - delete[] u; - unsigned char* v = new unsigned char[videoFrame.vStride]; - FMemory::Memcpy(v, videoFrame.vBuffer, videoFrame.vStride); - for (int i = 0; i < videoFrame.vStride; i++) - { - frame.vBuffer.Add(v[i]); - } - delete[] v; - frame.rotation = videoFrame.rotation; - frame.renderTimeMs = videoFrame.renderTimeMs; - frame.avsync_type = videoFrame.avsync_type; - unsigned char* metadatabuffer = new unsigned char[videoFrame.metadata_size]; - FMemory::Memcpy(metadatabuffer, videoFrame.metadata_buffer, videoFrame.metadata_size); - for (int i = 0; i < videoFrame.metadata_size; i++) - { - frame.metadata_buffer.Add(metadatabuffer[i]); - } - delete[] metadatabuffer; - frame.metadata_size = videoFrame.metadata_size; - //frame.sharedContext = videoFrame.sharedContext; - frame.textureId = videoFrame.textureId; - for (int i = 0; i < 16; i++) - { - frame.matrix.Add(videoFrame.matrix[i]); - } - OnRenderVideoFrame.Broadcast(FString(channelId), remoteUid, frame); - }); - return true; -} -bool UIVideoFrameObserver::onTranscodedVideoFrame(agora::media::base::VideoFrame& videoFrame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FVideoFrame frame; - frame.type = (EVIDEO_PIXEL_FORMAT)videoFrame.type; - frame.width = videoFrame.width; - frame.height = videoFrame.height; - frame.yStride = videoFrame.yStride; - frame.uStride = videoFrame.uStride; - frame.vStride = videoFrame.vStride; - unsigned char* y = new unsigned char[videoFrame.yStride]; - FMemory::Memcpy(y, videoFrame.yBuffer, videoFrame.yStride); - for (int i = 0; i < videoFrame.yStride; i++) - { - frame.yBuffer.Add(y[i]); - } - delete[] y; - unsigned char* u = new unsigned char[videoFrame.uStride]; - FMemory::Memcpy(u, videoFrame.uBuffer, videoFrame.uStride); - for (int i = 0; i < videoFrame.uStride; i++) - { - frame.uBuffer.Add(u[i]); - } - delete[] u; - unsigned char* v = new unsigned char[videoFrame.vStride]; - FMemory::Memcpy(v, videoFrame.vBuffer, videoFrame.vStride); - for (int i = 0; i < videoFrame.vStride; i++) - { - frame.vBuffer.Add(v[i]); - } - delete[] v; - frame.rotation = videoFrame.rotation; - frame.renderTimeMs = videoFrame.renderTimeMs; - frame.avsync_type = videoFrame.avsync_type; - unsigned char* metadatabuffer = new unsigned char[videoFrame.metadata_size]; - FMemory::Memcpy(metadatabuffer, videoFrame.metadata_buffer, videoFrame.metadata_size); - for (int i = 0; i < videoFrame.metadata_size; i++) - { - frame.metadata_buffer.Add(metadatabuffer[i]); - } - delete[] metadatabuffer; - frame.metadata_size = videoFrame.metadata_size; - //frame.sharedContext = videoFrame.sharedContext; - frame.textureId = videoFrame.textureId; - for (int i = 0; i < 16; i++) - { - frame.matrix.Add(videoFrame.matrix[i]); - } - OnTranscodedVideoFrame.Broadcast(frame); - }); - return true; -} -agora::media::IVideoFrameObserver::VIDEO_FRAME_PROCESS_MODE UIVideoFrameObserver::getVideoFrameProcessMode() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return PROCESS_MODE_READ_ONLY; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetVideoFrameProcessMode.Broadcast(); - }); - return PROCESS_MODE_READ_ONLY; -} -agora::media::base::VIDEO_PIXEL_FORMAT UIVideoFrameObserver::getVideoFormatPreference() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return agora::media::base::VIDEO_PIXEL_RGBA; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetVideoFormatPreference.Broadcast(); - }); - return agora::media::base::VIDEO_PIXEL_RGBA; -} - - -bool UIAudioFrameObserver::onRecordAudioFrame(const char* channelId, agora::media::IAudioFrameObserverBase::AudioFrame& audioFrame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FAudioFrame frame; - frame.type = (EAUDIO_FRAME_TYPE)audioFrame.type; - frame.samplesPerChannel = audioFrame.samplesPerChannel; - frame.bytesPerSample = (EBYTES_PER_SAMPLE)audioFrame.bytesPerSample; - frame.channels = audioFrame.channels; - frame.samplesPerSec = audioFrame.samplesPerSec; - - int ByteSize = audioFrame.bytesPerSample * audioFrame.samplesPerChannel * audioFrame.channels; - frame.buffer.AddZeroed(ByteSize); - FMemory::Memcpy(frame.buffer.GetData(), audioFrame.buffer, ByteSize); - - frame.renderTimeMs = audioFrame.renderTimeMs; - frame.avsync_type = audioFrame.avsync_type; - OnRecordAudioFrame.Broadcast(FString(channelId), frame); - }); - return true; -} -bool UIAudioFrameObserver::onPlaybackAudioFrame(const char* channelId, agora::media::IAudioFrameObserverBase::AudioFrame& audioFrame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FAudioFrame frame; - frame.type = (EAUDIO_FRAME_TYPE)audioFrame.type; - frame.samplesPerChannel = audioFrame.samplesPerChannel; - frame.bytesPerSample = (EBYTES_PER_SAMPLE)audioFrame.bytesPerSample; - frame.channels = audioFrame.channels; - frame.samplesPerSec = audioFrame.samplesPerSec; - - int ByteSize = audioFrame.bytesPerSample * audioFrame.samplesPerChannel * audioFrame.channels; - frame.buffer.AddZeroed(ByteSize); - FMemory::Memcpy(frame.buffer.GetData(), audioFrame.buffer, ByteSize); - - frame.renderTimeMs = audioFrame.renderTimeMs; - frame.avsync_type = audioFrame.avsync_type; - OnPlaybackAudioFrame.Broadcast(FString(channelId), frame); - }); - return true; -} -bool UIAudioFrameObserver::onMixedAudioFrame(const char* channelId, agora::media::IAudioFrameObserverBase::AudioFrame& audioFrame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FAudioFrame frame; - frame.type = (EAUDIO_FRAME_TYPE)audioFrame.type; - frame.samplesPerChannel = audioFrame.samplesPerChannel; - frame.bytesPerSample = (EBYTES_PER_SAMPLE)audioFrame.bytesPerSample; - frame.channels = audioFrame.channels; - frame.samplesPerSec = audioFrame.samplesPerSec; - - int ByteSize = audioFrame.bytesPerSample * audioFrame.samplesPerChannel * audioFrame.channels; - frame.buffer.AddZeroed(ByteSize); - FMemory::Memcpy(frame.buffer.GetData(), audioFrame.buffer, ByteSize); - - frame.renderTimeMs = audioFrame.renderTimeMs; - frame.avsync_type = audioFrame.avsync_type; - OnMixedAudioFrame.Broadcast(FString(channelId), frame); - }); - return true; -} - -int UIAudioFrameObserver::getObservedAudioFramePosition() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return 0; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetObservedAudioFramePosition.Broadcast(); - }); - return 0; -} -agora::media::IAudioFrameObserverBase::AudioParams UIAudioFrameObserver::getPlaybackAudioParams() -{ - agora::media::IAudioFrameObserverBase::AudioParams params; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return params; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetPlaybackAudioParams.Broadcast(); - }); - - return params; -} -agora::media::IAudioFrameObserverBase::AudioParams UIAudioFrameObserver::getRecordAudioParams() -{ - agora::media::IAudioFrameObserverBase::AudioParams params; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return params; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetRecordAudioParams.Broadcast(); - }); - - return params; -} -agora::media::IAudioFrameObserverBase::AudioParams UIAudioFrameObserver::getMixedAudioParams() -{ - agora::media::IAudioFrameObserverBase::AudioParams params; - - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return params; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetMixedAudioParams.Broadcast(); - }); - - return params; -} - -bool UIVideoFrameObserver::getRotationApplied() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetRotationApplied.Broadcast(); - }); - return true; -} -bool UIVideoFrameObserver::getMirrorApplied() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetMirrorApplied.Broadcast(); - }); - return false; -} -uint32_t UIVideoFrameObserver::getObservedFramePosition() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return agora::media::base::POSITION_POST_CAPTURER | agora::media::base::POSITION_PRE_RENDERER; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - GetObservedFramePosition.Broadcast(); - }); - return agora::media::base::POSITION_POST_CAPTURER | agora::media::base::POSITION_PRE_RENDERER; -} -bool UIVideoFrameObserver::isExternal() -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return false; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - IsExternal.Broadcast(); - }); - return true; -} - -void UIAudioPcmFrameSink::onFrame(agora::media::base::AudioPcmFrame* frame) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FAudioPcmFrame pcmFrame; - pcmFrame.capture_timestamp = frame->capture_timestamp; - pcmFrame.samples_per_channel_ = frame->samples_per_channel_; - pcmFrame.sample_rate_hz_ = frame->sample_rate_hz_; - pcmFrame.bytes_per_sample = (EBYTES_PER_SAMPLE)((int)frame->bytes_per_sample); - pcmFrame.num_channels_ = frame->num_channels_; - int64 length = frame->samples_per_channel_ * frame->num_channels_; - - // kMaxDataSizeSamples - if (length > 3840) - { - length = 3840; - } - FMemory::Memcpy(pcmFrame.data_.GetData(), frame->data_, length * (sizeof(int16_t))); - OnFrame.Broadcast(pcmFrame); - }); -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IMediaRecorderObserver.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IMediaRecorderObserver.cpp deleted file mode 100644 index fcd11a5f..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IMediaRecorderObserver.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/IMediaRecorderObserver.h" - - -void UIMediaRecorderObserver::onRecorderStateChanged(const char* channelId, agora::rtc::uid_t uid, agora::media::RecorderState state, agora::media::RecorderErrorCode error) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnRecorderStateChanged.Broadcast((FString)(channelId), (int64)(uid), state, (ERecorderErrorCode)error); - }); -} -void UIMediaRecorderObserver::onRecorderInfoUpdated(const char* channelId, agora::rtc::uid_t uid, const agora::media::RecorderInfo& info) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - FRecorderInfo recorderInfo; - recorderInfo.fileName = FString(info.fileName); - recorderInfo.durationMs = info.durationMs; - recorderInfo.fileSize = info.fileSize; - OnRecorderInfoUpdated.Broadcast((FString)(channelId), (int64)(uid), recorderInfo); - }); -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IMediaStreamingSourceObserver.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IMediaStreamingSourceObserver.cpp deleted file mode 100644 index c9dd97b8..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IMediaStreamingSourceObserver.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/IMediaStreamingSourceObserver.h" - - -void UIMediaStreamingSourceObserver::onStateChanged(agora::rtc::STREAMING_SRC_STATE state, agora::rtc::STREAMING_SRC_ERR err_code) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnStateChanged.Broadcast((ESTREAMING_SRC_STATE)state, (ESTREAMING_SRC_ERR)err_code); - }); -} -void UIMediaStreamingSourceObserver::onOpenDone(agora::rtc::STREAMING_SRC_ERR err_code) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnOpenDone.Broadcast((ESTREAMING_SRC_ERR)err_code); - }); -} -void UIMediaStreamingSourceObserver::onSeekDone(agora::rtc::STREAMING_SRC_ERR err_code) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnSeekDone.Broadcast((ESTREAMING_SRC_ERR)err_code); - }); -} -void UIMediaStreamingSourceObserver::onEofOnce(int64_t progress_ms, int64_t repeat_count) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnEofOnce.Broadcast(progress_ms, repeat_count); - }); -} -void UIMediaStreamingSourceObserver::onProgress(int64_t position_ms) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnProgress.Broadcast(position_ms); - }); -} -void UIMediaStreamingSourceObserver::onMetaData(const void* data, int length) -{ - TWeakObjectPtr SelfWeakPtr(this); - if (!SelfWeakPtr.IsValid()) - return; - -#if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) - AsyncTask(ENamedThreads::GameThread, [=, this]() -#else - AsyncTask(ENamedThreads::GameThread, [=]() -#endif - { - if (!SelfWeakPtr.IsValid()) - return; - - OnMetaData.Broadcast((int64)data, length); - }); -} \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IVideoDeviceManager.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IVideoDeviceManager.cpp deleted file mode 100644 index a7a009e5..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/IVideoDeviceManager.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - - -#include "AgoraBluePrintPlugin/IVideoDeviceManager.h" - -int UIVideoDeviceCollection::GetCount() -{ - if (VideoDeviceCollection != nullptr) - { - return VideoDeviceCollection->getCount(); - } - return -ERROR_NULLPTR; -} -int UIVideoDeviceCollection::SetDevice(FString& deviceIdUTF8) -{ - if (VideoDeviceCollection != nullptr) - { - int ret = VideoDeviceCollection->setDevice(TCHAR_TO_UTF8(*deviceIdUTF8)); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIVideoDeviceCollection::GetDevice(int index, FString& deviceNameUTF8, FString& deviceIdUTF8) -{ - if (VideoDeviceCollection != nullptr) - { - char tempDeviceName[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - int ret = VideoDeviceCollection->getDevice(index, tempDeviceName, tempDeviceId); - - deviceNameUTF8 = UTF8_TO_TCHAR(tempDeviceName); - - deviceIdUTF8 = UTF8_TO_TCHAR(tempDeviceId); - - return ret; - } - return -ERROR_NULLPTR; -} -void UIVideoDeviceCollection::Release() -{ - if (VideoDeviceCollection != nullptr) - { - return VideoDeviceCollection->release(); - } -} -void UIVideoDeviceCollection::SetVideoDeviceCollection(agora::rtc::IVideoDeviceCollection* videoDeviceCollection) -{ - this->VideoDeviceCollection = videoDeviceCollection; -} -UIVideoDeviceCollection* UIVideoDeviceManager::EnumerateVideoDevices() -{ - if (VideoDeviceManager != nullptr) - { - if (deviceDevice == nullptr) - { - deviceDevice = NewObject(); - } - - deviceDevice->SetVideoDeviceCollection(VideoDeviceManager->enumerateVideoDevices()); - - return deviceDevice; - } - return nullptr; -} -int UIVideoDeviceManager::SetDevice(FString deviceIdUTF8) -{ - if (VideoDeviceManager != nullptr) - { - int ret = VideoDeviceManager->setDevice(TCHAR_TO_UTF8(*deviceIdUTF8)); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIVideoDeviceManager::GetDevice(FString& deviceIdUTF8) -{ - if (VideoDeviceManager != nullptr) - { - char tempDeviceId[agora::rtc::MAX_DEVICE_ID_LENGTH_TYPE::MAX_DEVICE_ID_LENGTH]; - - int ret = VideoDeviceManager->getDevice(tempDeviceId); - - deviceIdUTF8 = UTF8_TO_TCHAR(tempDeviceId); - - return ret; - } - return -ERROR_NULLPTR; -} -int UIVideoDeviceManager::NumberOfCapabilities(FString deviceIdUTF8) -{ -#if defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - if (VideoDeviceManager != nullptr) - { - return VideoDeviceManager->numberOfCapabilities(TCHAR_TO_UTF8(*deviceIdUTF8)); - } -#endif - return -ERROR_NULLPTR; -} -int UIVideoDeviceManager::GetCapability(FString deviceIdUTF8, int deviceCapabilityNumber, FVideoFormat& capability) -{ -#if defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - agora::rtc::VideoFormat videoFormat; - videoFormat.width = capability.width; - videoFormat.height = capability.height; - videoFormat.fps = capability.fps; - if (VideoDeviceManager != nullptr) - { - return VideoDeviceManager->getCapability(TCHAR_TO_UTF8(*deviceIdUTF8), deviceCapabilityNumber, videoFormat); - } -#endif - return -ERROR_NULLPTR; -} -int UIVideoDeviceManager::StartDeviceTest(int64 hwnd) -{ - if (VideoDeviceManager != nullptr) - { - return VideoDeviceManager->startDeviceTest((agora::view_t)hwnd); - } - return -ERROR_NULLPTR; -} -int UIVideoDeviceManager::StopDeviceTest() -{ - if (VideoDeviceManager != nullptr) - { - return VideoDeviceManager->stopDeviceTest(); - } - return -ERROR_NULLPTR; -} -void UIVideoDeviceManager::Release() -{ - deviceDevice = nullptr; - if (VideoDeviceManager != nullptr) - { - return VideoDeviceManager->release(); - } -} -void UIVideoDeviceManager::SetVideoDeviceManager(agora::rtc::IVideoDeviceManager* videoDeviceManager) -{ - this->VideoDeviceManager = videoDeviceManager; -} - -agora::rtc::IVideoDeviceManager* UIVideoDeviceManager::GetVideoDeviceManager() -{ - return VideoDeviceManager; -} - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/UtilityAgoraBPuLogger.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/UtilityAgoraBPuLogger.cpp new file mode 100644 index 00000000..10dbf3ca --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraBluePrintPlugin/UtilityAgoraBPuLogger.cpp @@ -0,0 +1,47 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. +#include "UtilityAgoraBPuLogger.h" + +bool UAgoraBPuLogger::bDisablePrintToConsole = false; +bool UAgoraBPuLogger::bDisablePrintToLogMsgView = false; +bool UAgoraBPuLogger::bDisablePrintOnScreen = false; +FString UAgoraBPuLogger::ConsolePrefix = "[Agora UE Plugin]"; + +void UAgoraBPuLogger::Print(FString LogMsg, bool bToConsole /*= true*/, bool bOnScreen /*= true*/) +{ + if (bToConsole && !bDisablePrintToConsole) { + // Print Log To Console + UE_LOG(LogAgora, Display, TEXT("%s %s"), *ConsolePrefix, *LogMsg); + } + + if (bOnScreen && !bDisablePrintOnScreen) { + // Print Log To LogMsgView + GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, LogMsg); + } +} + +void UAgoraBPuLogger::PrintWarn(FString LogMsg, bool bToConsole /*= true*/, bool bOnScreen /*= true*/) +{ + if (bToConsole && !bDisablePrintToConsole) { + // Print Log To Console + UE_LOG(LogAgora, Warning, TEXT("%s %s"), *ConsolePrefix, *LogMsg); + } + + if (bOnScreen && !bDisablePrintOnScreen) { + // Print Log To LogMsgView + GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, LogMsg); + } +} + +void UAgoraBPuLogger::PrintError(FString LogMsg, bool bToConsole /*= true*/, bool bOnScreen /*= true*/) +{ + if (bToConsole && !bDisablePrintToConsole) { + // Print Log To Console + UE_LOG(LogTemp, Error, TEXT("%s %s"), *ConsolePrefix, *LogMsg); + } + + if (bOnScreen && !bDisablePrintOnScreen) { + // Print Log To LogMsgView + GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, LogMsg); + } +} + diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/AgoraUERTCEngine.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/AgoraUERTCEngine.cpp new file mode 100644 index 00000000..df817729 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/AgoraUERTCEngine.cpp @@ -0,0 +1,2845 @@ +// Copyright (c) 2023 Agora.io. All rights reserved. + + + +#include "AgoraUERTCEngine.h" + +#if AGORA_UESDK_ENABLE_VIDEO +#include "VideoFrameRenderManager.h" +#include "AgoraUEVideoFrameObserver.h" +using namespace agora::rtc::ue; +#endif + +#if PLATFORM_ANDROID +#include "Android/AndroidApplication.h" +#include "Android/AndroidJni.h" +#endif + + +#if PLATFORM_IOS +#include "IOSAppDelegate.h" +#endif + + +#include + + +namespace agora { + namespace rtc { + namespace ue { + +#pragma region Basics + + + AgoraUERtcEngine* AgoraUERtcEngine::Instance = nullptr; + std::mutex AgoraUERtcEngine::MutexLock; + + AgoraAppType AgoraUERtcEngine::RtcEngineAppType = AgoraAppType::kAppTypeUnreal; + + AgoraUERtcEngine* AgoraUERtcEngine::Get() + { + if (Instance == nullptr) { + std::unique_lock lock(MutexLock); + if (Instance == nullptr) { + Instance = new AgoraUERtcEngine(); + Instance->CreateEngine(); + } + } + + return Instance; + } + + + agora::rtc::IRtcEngine* AgoraUERtcEngine::NativeRtcEnginePtr() + { + if (Instance != nullptr) { + return Instance->RtcEngine; + } + + return nullptr; + } + + FString AgoraUERtcEngine::GetSDKVersion() + { + FString UEVersion = FString::Printf(TEXT("UE %d.%d.%d"), (ENGINE_MAJOR_VERSION), (ENGINE_MINOR_VERSION), (ENGINE_PATCH_VERSION)); + + int SDKBuild = 0; + const char* SDKVersionInfo = Get()->getVersion(&SDKBuild); + FString SDKInfo = FString::Printf(TEXT("Agora SDK Version: %s Build: %d UnrealVersion: %s"), UTF8_TO_TCHAR(SDKVersionInfo), SDKBuild, *UEVersion); + return SDKInfo; + } + + + void AgoraUERtcEngine::EnableIOSAudioSession(bool bEnable) + { +#if PLATFORM_IOS + [[IOSAppDelegate GetDelegate]SetFeature:EAudioFeature::Playback Active : bEnable]; + [[IOSAppDelegate GetDelegate]SetFeature:EAudioFeature::Record Active : bEnable]; + [[IOSAppDelegate GetDelegate]SetFeature:EAudioFeature::BackgroundAudio Active : bEnable]; +#endif + } + + void AgoraUERtcEngine::Release(bool sync /*= false*/) + { + if (Instance != nullptr) { + std::unique_lock lock(MutexLock); + if (Instance != nullptr) { + Instance->DestroyEngine(sync); + delete Instance; + Instance = nullptr; + } + } + + } + + void AgoraUERtcEngine::CreateEngine() + { +#if PLATFORM_ANDROID + if (JNIEnv* Env = FAndroidApplication::GetJavaEnv()) + { + static jmethodID LoadLibrary = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID, "LoadLibrary", "()V", false); + FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, LoadLibrary); + if (LoadLibrary != NULL) + { + FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, LoadLibrary); + } + + //static jmethodID LoadAndroidScreenCaptureSo = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID, "LoadAndroidScreenCaptureSo", "()V", false); + //if (LoadAndroidScreenCaptureSo != NULL) + //{ + // FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, LoadAndroidScreenCaptureSo); + //} + } +#endif + + RtcEngine = ::createAgoraRtcEngine(); + +#if AGORA_UESDK_ENABLE_VIDEO + _VideoFrameRenderManager = MakeShareable(new VideoFrameRenderManager()); +#endif + } + + + void AgoraUERtcEngine::DestroyEngine(bool sync /*= false*/) + { + if (RtcEngine) { + //RtcEngine->release(sync); + agora::rtc::IRtcEngine::release(sync); + RtcEngine = nullptr; +#if AGORA_UESDK_ENABLE_VIDEO + _VideoFrameRenderManager = nullptr; + _VideoObserver = nullptr; +#endif + } + } + + + AgoraUERtcEngine::AgoraUERtcEngine() {} + AgoraUERtcEngine::~AgoraUERtcEngine() {} + + +#pragma endregion Basics + + +#pragma region Agora API Wrapper + + + int AgoraUERtcEngine::initialize(const agora::rtc::RtcEngineContext& context) + { + if (RtcEngine == nullptr) + { + UE_LOG(LogTemp, Warning, TEXT("Agora RTC Engine initialize Failed, Engine Pointer is nullptr")); + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int ret = RtcEngine->initialize(context); + + UE_LOG(LogTemp, Warning, TEXT("Agora RTC Engine initialize %d"), ret); + if (ret == 0) + { + + FString ParamType = FString::Printf(TEXT("{\"rtc.set_app_type\": %d}"), (int)RtcEngineAppType); + agora::base::AParameter apm(RtcEngine); + apm->setParameters(TCHAR_TO_UTF8(*ParamType)); + +#if AGORA_UESDK_ENABLE_VIDEO + +#if PLATFORM_ANDROID + + // The following parameter is the same as "{\"rtc.enable_camera_capture_yuv\":\"true\"}" + // These 2 parameters are used to capture YUV data directly. + // Otherwise, the inconsistent rotation applied to video frame can lead to flickering in the displayed image. + + apm->setParameters("{\"che.video.android_camera_output_type\":0}"); + +#pragma region Load Android So + + int retSo = AgoraUERtcEngine::Get()->loadExtensionProvider("agora_screen_capture_extension"); + + UE_LOG(LogTemp, Warning, TEXT("Initialize loadExtensionProvider [agora_screen_capture_extension] ret %d"), retSo); + +#pragma endregion Load Android So + +#endif + // Our client can also use addVideoFrameRenderer to listen to VideoFrameObserver + + RtcEngine->queryInterface(agora::rtc::INTERFACE_ID_TYPE::AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); + _VideoObserver = MakeShareable(new AgoraUEVideoFrameObserver(nullptr)); + int retOb = MediaEngine->addVideoFrameRenderer(_VideoObserver.Get()); + UE_LOG(LogTemp, Warning, TEXT("Agora RTC Engine addVideoFrameRenderer %d"), retOb); +#endif + + + +#if PLATFORM_IOS + EnableIOSAudioSession(true); +#endif + + } + return ret; + } + + /* + Note: Remote Channel would be ignore for now. + Because Agora doesn't to join support multiple video channels. + */ + int AgoraUERtcEngine::setupRemoteVideo(const agora::rtc::VideoCanvas& canvas) + { +#if AGORA_UESDK_ENABLE_VIDEO + if (RtcEngine != nullptr) { + if (canvas.view != nullptr) { + _VideoFrameRenderManager->AddOneRender((UImage*)canvas.view, canvas.sourceType, "", canvas.uid); + } + else { + _VideoFrameRenderManager->ReleaseOneRender(canvas.sourceType, "", canvas.uid); + } + return AGORA_UE_ERR_CODE(ERROR_OK); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +#else + return AGORA_UE_ERR_CODE(ERROR_VIDEO_NOT_ENABLED); +#endif + } + + + int AgoraUERtcEngine::setupLocalVideo(const agora::rtc::VideoCanvas& canvas) + { +#if AGORA_UESDK_ENABLE_VIDEO + if (RtcEngine != nullptr) { + if (canvas.view != nullptr) { + _VideoFrameRenderManager->AddOneRender((UImage*)canvas.view, canvas.sourceType, "", canvas.uid); + } + else { + _VideoFrameRenderManager->ReleaseOneRender(canvas.sourceType, "", canvas.uid); + } + return AGORA_UE_ERR_CODE(ERROR_OK); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); +#else + return AGORA_UE_ERR_CODE(ERROR_VIDEO_NOT_ENABLED); +#endif + } + + + int AgoraUERtcEngine::setupRemoteVideoEx(const agora::rtc::VideoCanvas& canvas, const agora::rtc::RtcConnection& connection) + { +#if AGORA_UESDK_ENABLE_VIDEO + if (canvas.view != nullptr) { + _VideoFrameRenderManager->AddOneRender((UImage*)canvas.view, canvas.sourceType, connection.channelId, canvas.uid); + } + else { + _VideoFrameRenderManager->ReleaseOneRender(canvas.sourceType, connection.channelId, canvas.uid); + } + return AGORA_UE_ERR_CODE(ERROR_OK); + +#else + return AGORA_UE_ERR_CODE(ERROR_VIDEO_NOT_ENABLED); +#endif + } + +#pragma endregion Agora API Wrapper + + + +#pragma region Other Native APIs + + int AgoraUERtcEngine::queryInterface(rtc::INTERFACE_ID_TYPE iid, void** inter) + { + if (RtcEngine != nullptr) { + return RtcEngine->queryInterface(iid, inter); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + char const* AgoraUERtcEngine::getVersion(int* build) { + if (RtcEngine != nullptr) { + return RtcEngine->getVersion(build); + } + return nullptr; + } + + char const* AgoraUERtcEngine::getErrorDescription(int code) { + if (RtcEngine != nullptr) { + return RtcEngine->getErrorDescription(code); + } + return nullptr; + } + + + int AgoraUERtcEngine::queryCodecCapability(CodecCapInfo* codecInfo, int& size) + { + if (RtcEngine != nullptr) { + return RtcEngine->queryCodecCapability(codecInfo, size); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::queryDeviceScore() + { + if (RtcEngine != nullptr) { + return RtcEngine->queryDeviceScore(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::preloadChannel(const char* token, const char* channelId, uid_t uid) + { + if (RtcEngine != nullptr) { + return RtcEngine->preloadChannel(token, channelId, uid); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::preloadChannelWithUserAccount(const char* token, const char* channelId, const char* userAccount) + { + if (RtcEngine != nullptr) { + return RtcEngine->preloadChannelWithUserAccount(token, channelId, userAccount); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::updatePreloadChannelToken(const char* token) + { + if (RtcEngine != nullptr) { + return RtcEngine->updatePreloadChannelToken(token); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::joinChannel(char const* token, char const* channelId, char const* info, agora::rtc::uid_t uid) { + if (RtcEngine != nullptr) { + return RtcEngine->joinChannel(token, channelId, info, uid); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::joinChannel(char const* token, char const* channelId, agora::rtc::uid_t uid, agora::rtc::ChannelMediaOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->joinChannel(token, channelId, uid, options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateChannelMediaOptions(agora::rtc::ChannelMediaOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->updateChannelMediaOptions(options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::leaveChannel() { + if (RtcEngine != nullptr) { + int ret = RtcEngine->leaveChannel(); + return ret; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::leaveChannel(agora::rtc::LeaveChannelOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->leaveChannel(options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::renewToken(char const* token) { + if (RtcEngine != nullptr) { + return RtcEngine->renewToken(token); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setChannelProfile(agora::CHANNEL_PROFILE_TYPE profile) { + if (RtcEngine != nullptr) { + return RtcEngine->setChannelProfile(profile); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setClientRole(agora::rtc::CLIENT_ROLE_TYPE role) { + if (RtcEngine != nullptr) { + return RtcEngine->setClientRole(role); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setClientRole(agora::rtc::CLIENT_ROLE_TYPE role, agora::rtc::ClientRoleOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->setClientRole(role, options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startEchoTest(agora::rtc::EchoTestConfiguration const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->startEchoTest(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopEchoTest() { + if (RtcEngine != nullptr) { + return RtcEngine->stopEchoTest(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + +#if defined(__APPLE__) && TARGET_OS_IOS + int AgoraUERtcEngine::enableMultiCamera(bool enabled, const CameraCapturerConfiguration& config) + { + if (RtcEngine != nullptr) { + return RtcEngine->enableMultiCamera(enabled, config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#endif + + int AgoraUERtcEngine::enableVideo() { + if (RtcEngine != nullptr) { + return RtcEngine->enableVideo(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::disableVideo() { + if (RtcEngine != nullptr) { + return RtcEngine->disableVideo(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startPreview() { + if (RtcEngine != nullptr) { + return RtcEngine->startPreview(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startPreview(agora::rtc::VIDEO_SOURCE_TYPE sourceType) { + if (RtcEngine != nullptr) { + return RtcEngine->startPreview(sourceType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopPreview() { + if (RtcEngine != nullptr) { + return RtcEngine->stopPreview(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopPreview(agora::rtc::VIDEO_SOURCE_TYPE sourceType) { + if (RtcEngine != nullptr) { + return RtcEngine->stopPreview(sourceType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startLastmileProbeTest(agora::rtc::LastmileProbeConfig const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->startLastmileProbeTest(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopLastmileProbeTest() { + if (RtcEngine != nullptr) { + return RtcEngine->stopLastmileProbeTest(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVideoEncoderConfiguration(agora::rtc::VideoEncoderConfiguration const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->setVideoEncoderConfiguration(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setBeautyEffectOptions(bool enabled, agora::rtc::BeautyOptions const& options, agora::media::MEDIA_SOURCE_TYPE type) { + if (RtcEngine != nullptr) { + return RtcEngine->setBeautyEffectOptions(enabled, options, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setFaceShapeBeautyOptions(bool enabled, const FaceShapeBeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type /*= agora::media::PRIMARY_CAMERA_SOURCE*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->setFaceShapeBeautyOptions(enabled, options, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setFaceShapeAreaOptions(const FaceShapeAreaOptions& options, agora::media::MEDIA_SOURCE_TYPE type /*= agora::media::PRIMARY_CAMERA_SOURCE*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->setFaceShapeAreaOptions(options, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::getFaceShapeBeautyOptions(FaceShapeBeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type /*= agora::media::PRIMARY_CAMERA_SOURCE*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->getFaceShapeBeautyOptions(options, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::getFaceShapeAreaOptions(agora::rtc::FaceShapeAreaOptions::FACE_SHAPE_AREA shapeArea, FaceShapeAreaOptions& options, agora::media::MEDIA_SOURCE_TYPE type /*= agora::media::PRIMARY_CAMERA_SOURCE*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->getFaceShapeAreaOptions(shapeArea, options,type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLowlightEnhanceOptions(bool enabled, agora::rtc::LowlightEnhanceOptions const& options, agora::media::MEDIA_SOURCE_TYPE type) { + if (RtcEngine != nullptr) { + return RtcEngine->setLowlightEnhanceOptions(enabled, options, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVideoDenoiserOptions(bool enabled, agora::rtc::VideoDenoiserOptions const& options, agora::media::MEDIA_SOURCE_TYPE type) { + if (RtcEngine != nullptr) { + return RtcEngine->setVideoDenoiserOptions(enabled, options, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setColorEnhanceOptions(bool enabled, agora::rtc::ColorEnhanceOptions const& options, agora::media::MEDIA_SOURCE_TYPE type) { + if (RtcEngine != nullptr) { + return RtcEngine->setColorEnhanceOptions(enabled, options, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableVirtualBackground(bool enabled, agora::rtc::VirtualBackgroundSource backgroundSource, agora::rtc::SegmentationProperty segproperty, agora::media::MEDIA_SOURCE_TYPE type) { + if (RtcEngine != nullptr) { + return RtcEngine->enableVirtualBackground(enabled, backgroundSource, segproperty, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVideoScenario(VIDEO_APPLICATION_SCENARIO_TYPE scenarioType) + { + if (RtcEngine != nullptr) { + return RtcEngine->setVideoScenario(scenarioType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setVideoQoEPreference(VIDEO_QOE_PREFERENCE_TYPE qoePreference) + { + if (RtcEngine != nullptr) { + return RtcEngine->setVideoQoEPreference(qoePreference); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableAudio() { + if (RtcEngine != nullptr) { + return RtcEngine->enableAudio(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::disableAudio() { + if (RtcEngine != nullptr) { + return RtcEngine->disableAudio(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) + { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioProfile(profile, scenario); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAudioProfile(AUDIO_PROFILE_TYPE profile) + { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioProfile(profile); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAudioScenario(agora::rtc::AUDIO_SCENARIO_TYPE scenario) { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioScenario(scenario); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableLocalAudio(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->enableLocalAudio(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteLocalAudioStream(bool mute) { + if (RtcEngine != nullptr) { + return RtcEngine->muteLocalAudioStream(mute); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteAllRemoteAudioStreams(bool mute) { + if (RtcEngine != nullptr) { + return RtcEngine->muteAllRemoteAudioStreams(mute); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteRemoteAudioStream(agora::rtc::uid_t uid, bool mute) { + if (RtcEngine != nullptr) { + return RtcEngine->muteRemoteAudioStream(uid, mute); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteLocalVideoStream(bool mute) { + if (RtcEngine != nullptr) { + return RtcEngine->muteLocalVideoStream(mute); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableLocalVideo(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->enableLocalVideo(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteAllRemoteVideoStreams(bool mute) { + if (RtcEngine != nullptr) { + return RtcEngine->muteAllRemoteVideoStreams(mute); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteDefaultVideoStreamType(agora::rtc::VIDEO_STREAM_TYPE streamType) { + if (RtcEngine != nullptr) { + return RtcEngine->setRemoteDefaultVideoStreamType(streamType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setSubscribeAudioBlocklist(uid_t* uidList, int uidNumber) + { + if (RtcEngine != nullptr) { + return RtcEngine->setSubscribeAudioBlocklist(uidList, uidNumber); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setSubscribeAudioAllowlist(uid_t* uidList, int uidNumber) + { + if (RtcEngine != nullptr) { + return RtcEngine->setSubscribeAudioAllowlist(uidList, uidNumber); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setSubscribeVideoBlocklist(uid_t* uidList, int uidNumber) + { + if (RtcEngine != nullptr) { + return RtcEngine->setSubscribeVideoBlocklist(uidList, uidNumber); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setSubscribeVideoAllowlist(uid_t* uidList, int uidNumber) + { + if (RtcEngine != nullptr) { + return RtcEngine->setSubscribeVideoAllowlist(uidList, uidNumber); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteRemoteVideoStream(agora::rtc::uid_t uid, bool mute) { + if (RtcEngine != nullptr) { + return RtcEngine->muteRemoteVideoStream(uid, mute); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteVideoStreamType(agora::rtc::uid_t uid, agora::rtc::VIDEO_STREAM_TYPE streamType) { + if (RtcEngine != nullptr) { + return RtcEngine->setRemoteVideoStreamType(uid, streamType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteVideoSubscriptionOptions(agora::rtc::uid_t uid, agora::rtc::VideoSubscriptionOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->setRemoteVideoSubscriptionOptions(uid, options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableAudioVolumeIndication(int interval, int smooth, bool reportVad) { + if (RtcEngine != nullptr) { + return RtcEngine->enableAudioVolumeIndication(interval, smooth, reportVad); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startAudioRecording(char const* filePath, agora::rtc::AUDIO_RECORDING_QUALITY_TYPE quality) { + if (RtcEngine != nullptr) { + return RtcEngine->startAudioRecording(filePath, quality); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startAudioRecording(char const* filePath, int sampleRate, agora::rtc::AUDIO_RECORDING_QUALITY_TYPE quality) { + if (RtcEngine != nullptr) { + return RtcEngine->startAudioRecording(filePath, sampleRate, quality); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startAudioRecording(agora::rtc::AudioRecordingConfiguration const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->startAudioRecording(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::registerAudioEncodedFrameObserver(agora::rtc::AudioEncodedFrameObserverConfig const& config, agora::rtc::IAudioEncodedFrameObserver* observer) { + if (RtcEngine != nullptr) { + return RtcEngine->registerAudioEncodedFrameObserver(config, observer); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopAudioRecording() { + if (RtcEngine != nullptr) { + return RtcEngine->stopAudioRecording(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + agora_refptr AgoraUERtcEngine::createMediaPlayer() { + if (RtcEngine != nullptr) { + return RtcEngine->createMediaPlayer(); + } + return NULL; + } + + int AgoraUERtcEngine::destroyMediaPlayer(agora_refptr media_player) { + if (RtcEngine != nullptr) { + return RtcEngine->destroyMediaPlayer(media_player); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + agora::agora_refptr AgoraUERtcEngine::createMediaRecorder(const RecorderStreamInfo& info) + { + if (RtcEngine != nullptr) { + return RtcEngine->createMediaRecorder(info); + } + return nullptr; + } + + + int AgoraUERtcEngine::destroyMediaRecorder(agora_refptr mediaRecorder) + { + if (RtcEngine != nullptr) { + return RtcEngine->destroyMediaRecorder(mediaRecorder); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startAudioMixing(char const* filePath, bool loopback, int cycle) { + if (RtcEngine != nullptr) { + return RtcEngine->startAudioMixing(filePath, loopback, cycle); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startAudioMixing(char const* filePath, bool loopback, int cycle, int startPos) { + if (RtcEngine != nullptr) { + return RtcEngine->startAudioMixing(filePath, loopback, cycle, startPos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopAudioMixing() { + if (RtcEngine != nullptr) { + return RtcEngine->stopAudioMixing(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::pauseAudioMixing() { + if (RtcEngine != nullptr) { + return RtcEngine->pauseAudioMixing(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::resumeAudioMixing() { + if (RtcEngine != nullptr) { + return RtcEngine->resumeAudioMixing(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::selectAudioTrack(int index) { + if (RtcEngine != nullptr) { + return RtcEngine->selectAudioTrack(index); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getAudioTrackCount() { + if (RtcEngine != nullptr) { + return RtcEngine->getAudioTrackCount(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustAudioMixingVolume(int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->adjustAudioMixingVolume(volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustAudioMixingPublishVolume(int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->adjustAudioMixingPublishVolume(volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getAudioMixingPublishVolume() { + if (RtcEngine != nullptr) { + return RtcEngine->getAudioMixingPublishVolume(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustAudioMixingPlayoutVolume(int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->adjustAudioMixingPlayoutVolume(volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getAudioMixingPlayoutVolume() { + if (RtcEngine != nullptr) { + return RtcEngine->getAudioMixingPlayoutVolume(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getAudioMixingDuration() { + if (RtcEngine != nullptr) { + return RtcEngine->getAudioMixingDuration(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getAudioMixingCurrentPosition() { + if (RtcEngine != nullptr) { + return RtcEngine->getAudioMixingCurrentPosition(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAudioMixingPosition(int pos) { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioMixingPosition(pos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAudioMixingDualMonoMode(media::AUDIO_MIXING_DUAL_MONO_MODE mode) { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioMixingDualMonoMode(mode); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAudioMixingPitch(int pitch) { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioMixingPitch(pitch); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setAudioMixingPlaybackSpeed(int speed) + { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioMixingPlaybackSpeed(speed); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getEffectsVolume() { + if (RtcEngine != nullptr) { + return RtcEngine->getEffectsVolume(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setEffectsVolume(int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->setEffectsVolume(volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::preloadEffect(int soundId, char const* filePath, int startPos) { + if (RtcEngine != nullptr) { + return RtcEngine->preloadEffect(soundId, filePath, startPos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::playEffect(int soundId, char const* filePath, int loopCount, double pitch, double pan, int gain, bool publish, int startPos) { + if (RtcEngine != nullptr) { + return RtcEngine->playEffect(soundId, filePath, loopCount, pitch, pan, gain, publish, startPos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::playAllEffects(int loopCount, double pitch, double pan, int gain, bool publish) { + if (RtcEngine != nullptr) { + return RtcEngine->playAllEffects(loopCount, pitch, pan, gain, publish); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getVolumeOfEffect(int soundId) { + if (RtcEngine != nullptr) { + return RtcEngine->getVolumeOfEffect(soundId); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVolumeOfEffect(int soundId, int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->setVolumeOfEffect(soundId, volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::pauseEffect(int soundId) { + if (RtcEngine != nullptr) { + return RtcEngine->pauseEffect(soundId); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::pauseAllEffects() { + if (RtcEngine != nullptr) { + return RtcEngine->pauseAllEffects(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::resumeEffect(int soundId) { + if (RtcEngine != nullptr) { + return RtcEngine->resumeEffect(soundId); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::resumeAllEffects() { + if (RtcEngine != nullptr) { + return RtcEngine->resumeAllEffects(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopEffect(int soundId) { + if (RtcEngine != nullptr) { + return RtcEngine->stopEffect(soundId); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopAllEffects() { + if (RtcEngine != nullptr) { + return RtcEngine->stopAllEffects(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::unloadEffect(int soundId) { + if (RtcEngine != nullptr) { + return RtcEngine->unloadEffect(soundId); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::unloadAllEffects() { + if (RtcEngine != nullptr) { + return RtcEngine->unloadAllEffects(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getEffectDuration(char const* filePath) { + if (RtcEngine != nullptr) { + return RtcEngine->getEffectDuration(filePath); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setEffectPosition(int soundId, int pos) { + if (RtcEngine != nullptr) { + return RtcEngine->setEffectPosition(soundId, pos); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getEffectCurrentPosition(int soundId) { + if (RtcEngine != nullptr) { + return RtcEngine->getEffectCurrentPosition(soundId); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableSoundPositionIndication(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->enableSoundPositionIndication(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteVoicePosition(agora::rtc::uid_t uid, double pan, double gain) { + if (RtcEngine != nullptr) { + return RtcEngine->setRemoteVoicePosition(uid, pan, gain); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableSpatialAudio(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->enableSpatialAudio(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteUserSpatialAudioParams(agora::rtc::uid_t uid, agora::SpatialAudioParams const& params) { + if (RtcEngine != nullptr) { + return RtcEngine->setRemoteUserSpatialAudioParams(uid, params); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVoiceBeautifierPreset(agora::rtc::VOICE_BEAUTIFIER_PRESET preset) { + if (RtcEngine != nullptr) { + return RtcEngine->setVoiceBeautifierPreset(preset); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAudioEffectPreset(agora::rtc::AUDIO_EFFECT_PRESET preset) { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioEffectPreset(preset); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVoiceConversionPreset(agora::rtc::VOICE_CONVERSION_PRESET preset) { + if (RtcEngine != nullptr) { + return RtcEngine->setVoiceConversionPreset(preset); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAudioEffectParameters(agora::rtc::AUDIO_EFFECT_PRESET preset, int param1, int param2) { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioEffectParameters(preset, param1, param2); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVoiceBeautifierParameters(agora::rtc::VOICE_BEAUTIFIER_PRESET preset, int param1, int param2) { + if (RtcEngine != nullptr) { + return RtcEngine->setVoiceBeautifierParameters(preset, param1, param2); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVoiceConversionParameters(agora::rtc::VOICE_CONVERSION_PRESET preset, int param1, int param2) { + if (RtcEngine != nullptr) { + return RtcEngine->setVoiceConversionParameters(preset, param1, param2); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLocalVoicePitch(double pitch) { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalVoicePitch(pitch); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setLocalVoiceFormant(double formantRatio) + { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalVoiceFormant(formantRatio); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLocalVoiceEqualization(agora::rtc::AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalVoiceEqualization(bandFrequency, bandGain); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLocalVoiceReverb(agora::rtc::AUDIO_REVERB_TYPE reverbKey, int value) { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalVoiceReverb(reverbKey, value); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setHeadphoneEQPreset(HEADPHONE_EQUALIZER_PRESET preset) + { + if (RtcEngine != nullptr) { + return RtcEngine->setHeadphoneEQPreset(preset); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setHeadphoneEQParameters(int lowGain, int highGain) + { + if (RtcEngine != nullptr) { + return RtcEngine->setHeadphoneEQParameters(lowGain, highGain); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::enableVoiceAITuner(bool enabled, VOICE_AI_TUNER_TYPE type) + { + if (RtcEngine != nullptr) { + return RtcEngine->enableVoiceAITuner(enabled, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLogFile(char const* filePath) { + if (RtcEngine != nullptr) { + return RtcEngine->setLogFile(filePath); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLogFilter(unsigned int filter) { + if (RtcEngine != nullptr) { + return RtcEngine->setLogFilter(filter); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLogLevel(commons::LOG_LEVEL level) { + if (RtcEngine != nullptr) { + return RtcEngine->setLogLevel(level); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLogFileSize(unsigned int fileSizeInKBytes) { + if (RtcEngine != nullptr) { + return RtcEngine->setLogFileSize(fileSizeInKBytes); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::uploadLogFile(agora::util::AString& requestId) { + if (RtcEngine != nullptr) { + return RtcEngine->uploadLogFile(requestId); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::writeLog(commons::LOG_LEVEL level, const char* fmt, ...) + { + if (RtcEngine != nullptr) { + + + va_list args; + va_start(args, fmt); + + // to get the length + int length = std::vsnprintf(nullptr, 0, fmt, args); + va_end(args); + + std::vector buffer(length + 1); // +1 for null terminator + buffer.clear(); + + va_start(args, fmt); + std::vsnprintf(buffer.data(), buffer.size(), fmt, args); + va_end(args); + + std::string Content = (buffer.data()); + + int result = RtcEngine->writeLog(level, Content.c_str()); + return result; + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode, agora::rtc::VIDEO_MIRROR_MODE_TYPE mirrorMode) { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalRenderMode(renderMode, mirrorMode); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteRenderMode(agora::rtc::uid_t uid, media::base::RENDER_MODE_TYPE renderMode, agora::rtc::VIDEO_MIRROR_MODE_TYPE mirrorMode) { + if (RtcEngine != nullptr) { + return RtcEngine->setRemoteRenderMode(uid, renderMode, mirrorMode); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode) { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalRenderMode(renderMode); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLocalVideoMirrorMode(agora::rtc::VIDEO_MIRROR_MODE_TYPE mirrorMode) { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalVideoMirrorMode(mirrorMode); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableDualStreamMode(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->enableDualStreamMode(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) + { + if (RtcEngine != nullptr) { + return RtcEngine->enableDualStreamMode(enabled, streamConfig); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setDualStreamMode(agora::rtc::SIMULCAST_STREAM_MODE mode) { + if (RtcEngine != nullptr) { + return RtcEngine->setDualStreamMode(mode); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setSimulcastConfig(const SimulcastConfig& simulcastConfig) + { + if (RtcEngine != nullptr) { + return RtcEngine->setSimulcastConfig(simulcastConfig); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setDualStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig) + { + if (RtcEngine != nullptr) { + return RtcEngine->setDualStreamMode(mode, streamConfig); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setEarMonitoringAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) + { + if (RtcEngine != nullptr) { + return RtcEngine->setEarMonitoringAudioFrameParameters(sampleRate, channel, mode, samplesPerCall); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::registerExtension(const char* provider, const char* extension, agora::media::MEDIA_SOURCE_TYPE type /*= agora::media::UNKNOWN_MEDIA_SOURCE*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->registerExtension(provider, extension, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::enableCustomAudioLocalPlayback(track_id_t trackId, bool enabled) + { + if (RtcEngine != nullptr) { + return RtcEngine->enableCustomAudioLocalPlayback(trackId, enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRecordingAudioFrameParameters(int sampleRate, int channel, agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) { + if (RtcEngine != nullptr) { + return RtcEngine->setRecordingAudioFrameParameters(sampleRate, channel, mode, samplesPerCall); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setPlaybackAudioFrameParameters(int sampleRate, int channel, agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) { + if (RtcEngine != nullptr) { + return RtcEngine->setPlaybackAudioFrameParameters(sampleRate, channel, mode, samplesPerCall); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall) { + if (RtcEngine != nullptr) { + return RtcEngine->setMixedAudioFrameParameters(sampleRate, channel, samplesPerCall); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel) { + if (RtcEngine != nullptr) { + return RtcEngine->setPlaybackAudioFrameBeforeMixingParameters(sampleRate, channel); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableAudioSpectrumMonitor(int intervalInMS) { + if (RtcEngine != nullptr) { + return RtcEngine->enableAudioSpectrumMonitor(intervalInMS); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::disableAudioSpectrumMonitor() { + if (RtcEngine != nullptr) { + return RtcEngine->disableAudioSpectrumMonitor(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::registerAudioSpectrumObserver(agora::media::IAudioSpectrumObserver* observer) { + if (RtcEngine != nullptr) { + return RtcEngine->registerAudioSpectrumObserver(observer); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::unregisterAudioSpectrumObserver(agora::media::IAudioSpectrumObserver* observer) { + if (RtcEngine != nullptr) { + return RtcEngine->unregisterAudioSpectrumObserver(observer); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustRecordingSignalVolume(int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->adjustRecordingSignalVolume(volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteRecordingSignal(bool mute) { + if (RtcEngine != nullptr) { + return RtcEngine->muteRecordingSignal(mute); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustPlaybackSignalVolume(int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->adjustPlaybackSignalVolume(volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustUserPlaybackSignalVolume(uid_t uid, int volume) + { + if (RtcEngine != nullptr) { + return RtcEngine->adjustUserPlaybackSignalVolume(uid, volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLocalPublishFallbackOption(agora::rtc::STREAM_FALLBACK_OPTIONS option) { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalPublishFallbackOption(option); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteSubscribeFallbackOption(agora::rtc::STREAM_FALLBACK_OPTIONS option) { + if (RtcEngine != nullptr) { + return RtcEngine->setRemoteSubscribeFallbackOption(option); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setHighPriorityUserList(uid_t* uidList, int uidNum, STREAM_FALLBACK_OPTIONS option) + { + if (RtcEngine != nullptr) { + return RtcEngine->setHighPriorityUserList(uidList, uidNum, option); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableLoopbackRecording(bool enabled, char const* deviceName) { + if (RtcEngine != nullptr) { + return RtcEngine->enableLoopbackRecording(enabled, deviceName); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustLoopbackSignalVolume(int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->adjustLoopbackSignalVolume(volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getLoopbackRecordingVolume() { + if (RtcEngine != nullptr) { + return RtcEngine->getLoopbackRecordingVolume(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableInEarMonitoring(bool enabled, int includeAudioFilters) { + if (RtcEngine != nullptr) { + return RtcEngine->enableInEarMonitoring(enabled, includeAudioFilters); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setInEarMonitoringVolume(int volume) { + if (RtcEngine != nullptr) { + return RtcEngine->setInEarMonitoringVolume(volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#if defined (_WIN32) || defined(__linux__) || defined(__ANDROID__) + int AgoraUERtcEngine::loadExtensionProvider(char const* path, bool unload_after_use) { + if (RtcEngine != nullptr) { + return RtcEngine->loadExtensionProvider(path, unload_after_use); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#endif + int AgoraUERtcEngine::setExtensionProviderProperty(char const* provider, char const* key, char const* value) { + if (RtcEngine != nullptr) { + return RtcEngine->setExtensionProviderProperty(provider, key, value); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableExtension(char const* provider, char const* extension, bool enable, agora::media::MEDIA_SOURCE_TYPE type) { + if (RtcEngine != nullptr) { + return RtcEngine->enableExtension(provider, extension, enable, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableExtension(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, bool enable /*= true*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->enableExtension(provider, extension, extensionInfo, enable); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + + int AgoraUERtcEngine::setExtensionProperty(const char* provider, const char* extension, const char* key, const char* value, agora::media::MEDIA_SOURCE_TYPE type /*= agora::media::UNKNOWN_MEDIA_SOURCE*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->setExtensionProperty(provider, extension, key, value, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, const char* value) + { + if (RtcEngine != nullptr) { + return RtcEngine->setExtensionProperty(provider, extension, extensionInfo, key, value); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, char* value, int buf_len) + { + if (RtcEngine != nullptr) { + return RtcEngine->getExtensionProperty(provider, extension, extensionInfo, key, value, buf_len); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::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*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->getExtensionProperty(provider, extension, key, value, buf_len, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setCameraCapturerConfiguration(agora::rtc::CameraCapturerConfiguration const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraCapturerConfiguration(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + agora::rtc::video_track_id_t AgoraUERtcEngine::createCustomVideoTrack() { + if (RtcEngine != nullptr) { + return RtcEngine->createCustomVideoTrack(); + } + return 0; + } + + agora::rtc::video_track_id_t AgoraUERtcEngine::createCustomEncodedVideoTrack(agora::rtc::SenderOptions const& sender_option) { + if (RtcEngine != nullptr) { + return RtcEngine->createCustomEncodedVideoTrack(sender_option); + } + return 0; + } + + int AgoraUERtcEngine::destroyCustomVideoTrack(agora::rtc::video_track_id_t video_track_id) { + if (RtcEngine != nullptr) { + return RtcEngine->destroyCustomVideoTrack(video_track_id); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::destroyCustomEncodedVideoTrack(agora::rtc::video_track_id_t video_track_id) { + if (RtcEngine != nullptr) { + return RtcEngine->destroyCustomEncodedVideoTrack(video_track_id); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + int AgoraUERtcEngine::switchCamera() { + if (RtcEngine != nullptr) { + return RtcEngine->switchCamera(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + bool AgoraUERtcEngine::isCameraZoomSupported() { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraZoomSupported(); + } + return true; + } + + bool AgoraUERtcEngine::isCameraFaceDetectSupported() { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraFaceDetectSupported(); + } + return true; + } + + bool AgoraUERtcEngine::isCameraTorchSupported() { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraTorchSupported(); + } + return true; + } + + bool AgoraUERtcEngine::isCameraFocusSupported() { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraFocusSupported(); + } + return true; + } + + bool AgoraUERtcEngine::isCameraAutoFocusFaceModeSupported() { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraAutoFocusFaceModeSupported(); + } + return true; + } + + int AgoraUERtcEngine::setCameraZoomFactor(float factor) { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraZoomFactor(factor); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableFaceDetection(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->enableFaceDetection(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + float AgoraUERtcEngine::getCameraMaxZoomFactor() { + if (RtcEngine != nullptr) { + return RtcEngine->getCameraMaxZoomFactor(); + } + return 0.0; + } + + int AgoraUERtcEngine::setCameraFocusPositionInPreview(float positionX, float positionY) { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraFocusPositionInPreview(positionX, positionY); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setCameraTorchOn(bool isOn) { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraTorchOn(isOn); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setCameraAutoFocusFaceModeEnabled(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraAutoFocusFaceModeEnabled(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + bool AgoraUERtcEngine::isCameraExposurePositionSupported() { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraExposurePositionSupported(); + } + return true; + } + + int AgoraUERtcEngine::setCameraExposurePosition(float positionXinView, float positionYinView) { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraExposurePosition(positionXinView, positionYinView); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + bool AgoraUERtcEngine::isCameraExposureSupported() + { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraExposureSupported(); + } + return true; + } + + + int AgoraUERtcEngine::setCameraExposureFactor(float factor) + { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraExposureFactor(factor); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + +#if defined(__APPLE__) + bool AgoraUERtcEngine::isCameraAutoExposureFaceModeSupported() { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraAutoExposureFaceModeSupported(); + } + return true; + } + + int AgoraUERtcEngine::setCameraAutoExposureFaceModeEnabled(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraAutoExposureFaceModeEnabled(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode) + { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraStabilizationMode(mode); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + +#endif + int AgoraUERtcEngine::setDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker) { + if (RtcEngine != nullptr) { + return RtcEngine->setDefaultAudioRouteToSpeakerphone(defaultToSpeaker); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setEnableSpeakerphone(bool speakerOn) { + if (RtcEngine != nullptr) { + return RtcEngine->setEnableSpeakerphone(speakerOn); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + bool AgoraUERtcEngine::isSpeakerphoneEnabled() { + if (RtcEngine != nullptr) { + return RtcEngine->isSpeakerphoneEnabled(); + } + return true; + } + + int AgoraUERtcEngine::setRouteInCommunicationMode(int route) + { + if (RtcEngine != nullptr) { + return RtcEngine->setRouteInCommunicationMode(route); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + +#endif + +#if defined(__APPLE__) + + bool AgoraUERtcEngine::isCameraCenterStageSupported() + { + if (RtcEngine != nullptr) { + return RtcEngine->isCameraCenterStageSupported(); + } + return true; + } + + + int AgoraUERtcEngine::enableCameraCenterStage(bool enabled) + { + if (RtcEngine != nullptr) { + return RtcEngine->enableCameraCenterStage(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + +#endif +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + agora::rtc::IScreenCaptureSourceList* AgoraUERtcEngine::getScreenCaptureSources(SIZE const& thumbSize, SIZE const& iconSize, bool const includeScreen) { + if (RtcEngine != nullptr) { + return RtcEngine->getScreenCaptureSources(thumbSize, iconSize, includeScreen); + } + return NULL; + } +#endif +#if (defined(__APPLE__) && TARGET_OS_IOS) + int AgoraUERtcEngine::setAudioSessionOperationRestriction(AUDIO_SESSION_OPERATION_RESTRICTION restriction) + { + if (RtcEngine != nullptr) { + return RtcEngine->setAudioSessionOperationRestriction(restriction); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#endif +#if defined(_WIN32) || (defined(__APPLE__) && !TARGET_OS_IPHONE && TARGET_OS_MAC) + int AgoraUERtcEngine::startScreenCaptureByDisplayId(uint32_t displayId, Rectangle const& regionRect, ScreenCaptureParameters const& captureParams) { + if (RtcEngine != nullptr) { + return RtcEngine->startScreenCaptureByDisplayId(displayId, regionRect, captureParams); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#if defined(_WIN32) + int AgoraUERtcEngine::startScreenCaptureByScreenRect(const Rectangle& screenRect, const Rectangle& regionRect, const ScreenCaptureParameters& captureParams) + { + if (RtcEngine != nullptr) { + return RtcEngine->startScreenCaptureByScreenRect(screenRect, regionRect, captureParams); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#endif +#endif +#if defined(__ANDROID__) + int AgoraUERtcEngine::getAudioDeviceInfo(agora::rtc::DeviceInfo& deviceInfo) { + if (RtcEngine != nullptr) { + return RtcEngine->getAudioDeviceInfo(deviceInfo); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#endif +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + int AgoraUERtcEngine::startScreenCaptureByWindowId(agora::view_t windowId, agora::rtc::Rectangle const& regionRect, agora::rtc::ScreenCaptureParameters const& captureParams) { + if (RtcEngine != nullptr) { + return RtcEngine->startScreenCaptureByWindowId(windowId, regionRect, captureParams); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setScreenCaptureContentHint(agora::rtc::VIDEO_CONTENT_HINT contentHint) { + if (RtcEngine != nullptr) { + return RtcEngine->setScreenCaptureContentHint(contentHint); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateScreenCaptureRegion(agora::rtc::Rectangle const& regionRect) { + if (RtcEngine != nullptr) { + return RtcEngine->updateScreenCaptureRegion(regionRect); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateScreenCaptureParameters(agora::rtc::ScreenCaptureParameters const& captureParams) { + if (RtcEngine != nullptr) { + return RtcEngine->updateScreenCaptureParameters(captureParams); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#endif +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + int AgoraUERtcEngine::startScreenCapture(agora::rtc::ScreenCaptureParameters2 const& captureParams) { + if (RtcEngine != nullptr) { + return RtcEngine->startScreenCapture(captureParams); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateScreenCapture(agora::rtc::ScreenCaptureParameters2 const& captureParams) { + if (RtcEngine != nullptr) { + return RtcEngine->updateScreenCapture(captureParams); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::queryScreenCaptureCapability() + { + if (RtcEngine != nullptr) { + return RtcEngine->queryScreenCaptureCapability(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + + int AgoraUERtcEngine::queryCameraFocalLengthCapability(agora::rtc::FocalLengthInfo* focalLengthInfos, int& size) + { + if (RtcEngine != nullptr) { + return RtcEngine->queryCameraFocalLengthCapability(focalLengthInfos, size); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + +#endif +#if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) + + + int AgoraUERtcEngine::setScreenCaptureScenario(SCREEN_SCENARIO_TYPE screenScenario) + { + if (RtcEngine != nullptr) { + return RtcEngine->setScreenCaptureScenario(screenScenario); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + + int AgoraUERtcEngine::stopScreenCapture() { + if (RtcEngine != nullptr) { + return RtcEngine->stopScreenCapture(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startScreenCapture(VIDEO_SOURCE_TYPE sourceType, const ScreenCaptureConfiguration& config) + { + if (RtcEngine != nullptr) { + return RtcEngine->startScreenCapture(sourceType, config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopScreenCapture(VIDEO_SOURCE_TYPE sourceType) + { + if (RtcEngine != nullptr) { + return RtcEngine->stopScreenCapture(sourceType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + +#endif + int AgoraUERtcEngine::getCallId(agora::util::AString& callId) { + if (RtcEngine != nullptr) { + return RtcEngine->getCallId(callId); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::rate(char const* callId, int rating, char const* description) { + if (RtcEngine != nullptr) { + return RtcEngine->rate(callId, rating, description); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::complain(char const* callId, char const* description) { + if (RtcEngine != nullptr) { + return RtcEngine->complain(callId, description); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startRtmpStreamWithoutTranscoding(char const* url) { + if (RtcEngine != nullptr) { + return RtcEngine->startRtmpStreamWithoutTranscoding(url); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startRtmpStreamWithTranscoding(char const* url, agora::rtc::LiveTranscoding const& transcoding) { + if (RtcEngine != nullptr) { + return RtcEngine->startRtmpStreamWithTranscoding(url, transcoding); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateRtmpTranscoding(agora::rtc::LiveTranscoding const& transcoding) { + if (RtcEngine != nullptr) { + return RtcEngine->updateRtmpTranscoding(transcoding); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopRtmpStream(char const* url) { + if (RtcEngine != nullptr) { + return RtcEngine->stopRtmpStream(url); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startLocalVideoTranscoder(agora::rtc::LocalTranscoderConfiguration const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->startLocalVideoTranscoder(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateLocalTranscoderConfiguration(agora::rtc::LocalTranscoderConfiguration const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->updateLocalTranscoderConfiguration(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopLocalVideoTranscoder() { + if (RtcEngine != nullptr) { + return RtcEngine->stopLocalVideoTranscoder(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::startCameraCapture(VIDEO_SOURCE_TYPE sourceType, const CameraCapturerConfiguration& config) + { + if (RtcEngine != nullptr) { + return RtcEngine->startCameraCapture(sourceType, config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::stopCameraCapture(VIDEO_SOURCE_TYPE sourceType) + { + if (RtcEngine != nullptr) { + return RtcEngine->stopCameraCapture(sourceType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setCameraDeviceOrientation(agora::rtc::VIDEO_SOURCE_TYPE type, agora::rtc::VIDEO_ORIENTATION orientation) { + if (RtcEngine != nullptr) { + return RtcEngine->setCameraDeviceOrientation(type, orientation); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setScreenCaptureOrientation(agora::rtc::VIDEO_SOURCE_TYPE type, agora::rtc::VIDEO_ORIENTATION orientation) { + if (RtcEngine != nullptr) { + return RtcEngine->setScreenCaptureOrientation(type, orientation); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + agora::rtc::CONNECTION_STATE_TYPE AgoraUERtcEngine::getConnectionState() { + if (RtcEngine != nullptr) { + return RtcEngine->getConnectionState(); + } + return agora::rtc::CONNECTION_STATE_TYPE::CONNECTION_STATE_FAILED; + } + + bool AgoraUERtcEngine::registerEventHandler(agora::rtc::IRtcEngineEventHandler* eventHandler) { + if (RtcEngine != nullptr) { + return RtcEngine->registerEventHandler(eventHandler); + } + return true; + } + + bool AgoraUERtcEngine::unregisterEventHandler(agora::rtc::IRtcEngineEventHandler* eventHandler) { + if (RtcEngine != nullptr) { + return RtcEngine->unregisterEventHandler(eventHandler); + } + return true; + } + + int AgoraUERtcEngine::setRemoteUserPriority(agora::rtc::uid_t uid, agora::rtc::PRIORITY_TYPE userPriority) { + if (RtcEngine != nullptr) { + return RtcEngine->setRemoteUserPriority(uid, userPriority); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::registerPacketObserver(agora::rtc::IPacketObserver* observer) { + if (RtcEngine != nullptr) { + return RtcEngine->registerPacketObserver(observer); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableEncryption(bool enabled, agora::rtc::EncryptionConfig const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->enableEncryption(enabled, config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::createDataStream(int* streamId, bool reliable, bool ordered) { + if (RtcEngine != nullptr) { + return RtcEngine->createDataStream(streamId, reliable, ordered); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::createDataStream(int* streamId, const agora::rtc::DataStreamConfig& config) { + if (RtcEngine != nullptr) { + return RtcEngine->createDataStream(streamId, config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::sendStreamMessage(int streamId, char const* data, size_t length) { + if (RtcEngine != nullptr) { + return RtcEngine->sendStreamMessage(streamId, data, length); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::addVideoWatermark(agora::rtc::RtcImage const& watermark) { + if (RtcEngine != nullptr) { + return RtcEngine->addVideoWatermark(watermark); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::addVideoWatermark(char const* watermarkUrl, agora::rtc::WatermarkOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->addVideoWatermark(watermarkUrl, options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::clearVideoWatermarks() { + if (RtcEngine != nullptr) { + return RtcEngine->clearVideoWatermarks(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::pauseAudio() { + if (RtcEngine != nullptr) { + return RtcEngine->pauseAudio(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::resumeAudio() { + if (RtcEngine != nullptr) { + return RtcEngine->resumeAudio(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::enableWebSdkInteroperability(bool enabled) { + if (RtcEngine != nullptr) { + return RtcEngine->enableWebSdkInteroperability(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setAdvancedAudioOptions(AdvancedAudioOptions& options, int sourceType /*= 0*/) + { + if (RtcEngine != nullptr) { + return RtcEngine->setAdvancedAudioOptions(options, sourceType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int64_t AgoraUERtcEngine::getCurrentMonotonicTimeInMs() + { + if (RtcEngine != nullptr) { + return RtcEngine->getCurrentMonotonicTimeInMs(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + int AgoraUERtcEngine::enableWirelessAccelerate(bool enabled) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->enableWirelessAccelerate(enabled); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getNetworkType() + { + if (RtcEngine != nullptr) { + return RtcEngine->getNetworkType(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setParameters(const char* parameters) + { + if (RtcEngine != nullptr) { + return RtcEngine->setParameters(parameters); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::startMediaRenderingTracing() + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->startMediaRenderingTracing(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::enableInstantMediaRendering() + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->enableInstantMediaRendering(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + uint64_t AgoraUERtcEngine::getNtpWallTimeInMs() + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->getNtpWallTimeInMs(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + bool AgoraUERtcEngine::isFeatureAvailableOnDevice(FeatureType type) + { + if (RtcEngine != nullptr) { + return RtcEngine->isFeatureAvailableOnDevice(type); + } + return true; + } + + + int AgoraUERtcEngine::sendAudioMetadata(const char* metadata, size_t length) + { + if (RtcEngine != nullptr) { + return RtcEngine->sendAudioMetadata(metadata, length); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::sendCustomReportMessage(char const* id, char const* category, char const* event, char const* label, int value) { + if (RtcEngine != nullptr) { + return RtcEngine->sendCustomReportMessage(id, category, event, label, value); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::registerMediaMetadataObserver(agora::rtc::IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) { + if (RtcEngine != nullptr) { + return RtcEngine->registerMediaMetadataObserver(observer, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::unregisterMediaMetadataObserver(agora::rtc::IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) { + if (RtcEngine != nullptr) { + return RtcEngine->unregisterMediaMetadataObserver(observer, type); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startAudioFrameDump(char const* channel_id, agora::rtc::uid_t user_id, char const* location, char const* uuid, char const* passwd, long duration_ms, bool auto_upload) { + if (RtcEngine != nullptr) { + return RtcEngine->startAudioFrameDump(channel_id, user_id, location, uuid, passwd, duration_ms, auto_upload); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopAudioFrameDump(char const* channel_id, agora::rtc::uid_t user_id, char const* location) { + if (RtcEngine != nullptr) { + return RtcEngine->stopAudioFrameDump(channel_id, user_id, location); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setAINSMode(bool enabled, AUDIO_AINS_MODE mode) + { + if (RtcEngine != nullptr) { + return RtcEngine->setAINSMode(enabled, mode); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::registerLocalUserAccount(char const* appId, char const* userAccount) { + if (RtcEngine != nullptr) { + return RtcEngine->registerLocalUserAccount(appId, userAccount); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::joinChannelWithUserAccount(char const* token, char const* channelId, char const* userAccount) { + if (RtcEngine != nullptr) { + return RtcEngine->joinChannelWithUserAccount(token, channelId, userAccount); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::joinChannelWithUserAccount(char const* token, char const* channelId, char const* userAccount, agora::rtc::ChannelMediaOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->joinChannelWithUserAccount(token, channelId, userAccount, options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::joinChannelWithUserAccountEx(char const* token, char const* channelId, char const* userAccount, agora::rtc::ChannelMediaOptions const& options, agora::rtc::IRtcEngineEventHandler* eventHandler) { + if (RtcEngine != nullptr) { + return RtcEngine->joinChannelWithUserAccountEx(token, channelId, userAccount, options, eventHandler); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getUserInfoByUserAccount(char const* userAccount, rtc::UserInfo* userInfo) { + if (RtcEngine != nullptr) { + return RtcEngine->getUserInfoByUserAccount(userAccount, userInfo); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getUserInfoByUid(agora::rtc::uid_t uid, rtc::UserInfo* userInfo) { + if (RtcEngine != nullptr) { + return RtcEngine->getUserInfoByUid(uid, userInfo); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::startOrUpdateChannelMediaRelay(const ChannelMediaRelayConfiguration& configuration) + { + if (RtcEngine != nullptr) { + return RtcEngine->startOrUpdateChannelMediaRelay(configuration); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopChannelMediaRelay() { + if (RtcEngine != nullptr) { + return RtcEngine->stopChannelMediaRelay(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::pauseAllChannelMediaRelay() { + if (RtcEngine != nullptr) { + return RtcEngine->pauseAllChannelMediaRelay(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::resumeAllChannelMediaRelay() { + if (RtcEngine != nullptr) { + return RtcEngine->resumeAllChannelMediaRelay(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setDirectCdnStreamingAudioConfiguration(agora::rtc::AUDIO_PROFILE_TYPE profile) { + if (RtcEngine != nullptr) { + return RtcEngine->setDirectCdnStreamingAudioConfiguration(profile); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setDirectCdnStreamingVideoConfiguration(agora::rtc::VideoEncoderConfiguration const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->setDirectCdnStreamingVideoConfiguration(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startDirectCdnStreaming(agora::rtc::IDirectCdnStreamingEventHandler* eventHandler, char const* publishUrl, agora::rtc::DirectCdnStreamingMediaOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->startDirectCdnStreaming(eventHandler, publishUrl, options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopDirectCdnStreaming() { + if (RtcEngine != nullptr) { + return RtcEngine->stopDirectCdnStreaming(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateDirectCdnStreamingMediaOptions(agora::rtc::DirectCdnStreamingMediaOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->updateDirectCdnStreamingMediaOptions(options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startRhythmPlayer(char const* sound1, char const* sound2, agora::rtc::AgoraRhythmPlayerConfig const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->startRhythmPlayer(sound1, sound2, config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopRhythmPlayer() { + if (RtcEngine != nullptr) { + return RtcEngine->stopRhythmPlayer(); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::configRhythmPlayer(agora::rtc::AgoraRhythmPlayerConfig const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->configRhythmPlayer(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::takeSnapshot(agora::rtc::uid_t uid, char const* filePath) { + if (RtcEngine != nullptr) { + return RtcEngine->takeSnapshot(uid, filePath); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableContentInspect(bool enabled, media::ContentInspectConfig const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->enableContentInspect(enabled, config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustCustomAudioPublishVolume(track_id_t trackId, int volume) + { + if (RtcEngine != nullptr) { + return RtcEngine->adjustCustomAudioPublishVolume(trackId, volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::adjustCustomAudioPlayoutVolume(track_id_t trackId, int volume) + { + if (RtcEngine != nullptr) { + return RtcEngine->adjustCustomAudioPlayoutVolume(trackId, volume); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setCloudProxy(agora::rtc::CLOUD_PROXY_TYPE proxyType) { + if (RtcEngine != nullptr) { + return RtcEngine->setCloudProxy(proxyType); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setLocalAccessPoint(agora::rtc::LocalAccessPointConfiguration const& config) { + if (RtcEngine != nullptr) { + return RtcEngine->setLocalAccessPoint(config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setAVSyncSource(char const* channelId, agora::rtc::uid_t uid) { + if (RtcEngine != nullptr) { + return RtcEngine->setAVSyncSource(channelId, uid); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableVideoImageSource(bool enable, agora::rtc::ImageTrackOptions const& options) { + if (RtcEngine != nullptr) { + return RtcEngine->enableVideoImageSource(enable, options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::joinChannelEx(char const* token, agora::rtc::RtcConnection const& connection, agora::rtc::ChannelMediaOptions const& options, agora::rtc::IRtcEngineEventHandler* eventHandler) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->joinChannelEx(token, connection, options, eventHandler); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::leaveChannelEx(agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->leaveChannelEx(connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::leaveChannelEx(const RtcConnection& connection, const LeaveChannelOptions& options) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->leaveChannelEx(connection, options); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteLocalAudioStreamEx(bool mute, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->muteLocalAudioStreamEx(mute, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteLocalVideoStreamEx(bool mute, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->muteLocalVideoStreamEx(mute, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteAllRemoteAudioStreamsEx(bool mute, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->muteAllRemoteAudioStreamsEx(mute, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteAllRemoteVideoStreamsEx(bool mute, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->muteAllRemoteVideoStreamsEx(mute, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setSubscribeAudioBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setSubscribeAudioBlocklistEx(uidList, uidNumber, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setSubscribeAudioAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setSubscribeAudioAllowlistEx(uidList, uidNumber, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setSubscribeVideoBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setSubscribeVideoBlocklistEx(uidList, uidNumber, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setSubscribeVideoAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setSubscribeVideoAllowlistEx(uidList, uidNumber, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::adjustUserPlaybackSignalVolumeEx(uid_t uid, int volume, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->adjustUserPlaybackSignalVolumeEx(uid, volume, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startRtmpStreamWithoutTranscodingEx(const char* url, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->startRtmpStreamWithoutTranscodingEx(url, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startRtmpStreamWithTranscodingEx(const char* url, const LiveTranscoding& transcoding, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->startRtmpStreamWithTranscodingEx(url, transcoding, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateRtmpTranscodingEx(const LiveTranscoding& transcoding, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->updateRtmpTranscodingEx(transcoding, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopRtmpStreamEx(const char* url, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->stopRtmpStreamEx(url, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::startOrUpdateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->startOrUpdateChannelMediaRelayEx(configuration, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::stopChannelMediaRelayEx(const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->stopChannelMediaRelayEx(connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::pauseAllChannelMediaRelayEx(const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->stopChannelMediaRelayEx(connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::resumeAllChannelMediaRelayEx(const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->resumeAllChannelMediaRelayEx(connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableDualStreamModeEx(bool enabled, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->enableDualStreamModeEx(enabled, streamConfig, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setDualStreamModeEx(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setDualStreamModeEx(mode, streamConfig, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setSimulcastConfigEx(const SimulcastConfig& simulcastConfig, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setSimulcastConfigEx(simulcastConfig, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + + } + + + int AgoraUERtcEngine::setHighPriorityUserListEx(uid_t* uidList, int uidNum, STREAM_FALLBACK_OPTIONS option, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setHighPriorityUserListEx(uidList, uidNum, option, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::updateChannelMediaOptionsEx(agora::rtc::ChannelMediaOptions const& options, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->updateChannelMediaOptionsEx(options, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setVideoEncoderConfigurationEx(agora::rtc::VideoEncoderConfiguration const& config, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setVideoEncoderConfigurationEx(config, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteRemoteAudioStreamEx(agora::rtc::uid_t uid, bool mute, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->muteRemoteAudioStreamEx(uid, mute, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::muteRemoteVideoStreamEx(agora::rtc::uid_t uid, bool mute, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->muteRemoteVideoStreamEx(uid, mute, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteVideoStreamTypeEx(agora::rtc::uid_t uid, agora::rtc::VIDEO_STREAM_TYPE streamType, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setRemoteVideoStreamTypeEx(uid, streamType, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteVideoSubscriptionOptionsEx(agora::rtc::uid_t uid, agora::rtc::VideoSubscriptionOptions const& options, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setRemoteVideoSubscriptionOptionsEx(uid, options, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteVoicePositionEx(agora::rtc::uid_t uid, double pan, double gain, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setRemoteVoicePositionEx(uid, pan, gain, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteUserSpatialAudioParamsEx(agora::rtc::uid_t uid, agora::SpatialAudioParams const& params, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setRemoteUserSpatialAudioParamsEx(uid, params, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::setRemoteRenderModeEx(agora::rtc::uid_t uid, media::base::RENDER_MODE_TYPE renderMode, agora::rtc::VIDEO_MIRROR_MODE_TYPE mirrorMode, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setRemoteRenderModeEx(uid, renderMode, mirrorMode, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableLoopbackRecordingEx(agora::rtc::RtcConnection const& connection, bool enabled, char const* deviceName) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->enableLoopbackRecordingEx(connection, enabled, deviceName); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::adjustRecordingSignalVolumeEx(int volume, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->adjustRecordingSignalVolumeEx(volume, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::muteRecordingSignalEx(bool mute, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->muteRecordingSignalEx(mute, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + agora::rtc::CONNECTION_STATE_TYPE AgoraUERtcEngine::getConnectionStateEx(agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->getConnectionStateEx(connection); + } + return agora::rtc::CONNECTION_STATE_TYPE::CONNECTION_STATE_FAILED; + } + + int AgoraUERtcEngine::enableEncryptionEx(agora::rtc::RtcConnection const& connection, bool enabled, agora::rtc::EncryptionConfig const& config) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->enableEncryptionEx(connection, enabled, config); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::createDataStreamEx(int* streamId, bool reliable, bool ordered, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->createDataStreamEx(streamId, reliable, ordered, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::createDataStreamEx(int* streamId, const agora::rtc::DataStreamConfig& config, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->createDataStreamEx(streamId, config, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::sendStreamMessageEx(int streamId, char const* data, size_t length, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->sendStreamMessageEx(streamId, data, length, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::addVideoWatermarkEx(char const* watermarkUrl, agora::rtc::WatermarkOptions const& options, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->addVideoWatermarkEx(watermarkUrl, options, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::clearVideoWatermarkEx(agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->clearVideoWatermarkEx(connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::sendCustomReportMessageEx(char const* id, char const* category, char const* event, char const* label, int value, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->sendCustomReportMessageEx(id, category, event, label, value, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::enableAudioVolumeIndicationEx(int interval, int smooth, bool reportVad, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->enableAudioVolumeIndicationEx(interval, smooth, reportVad, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getUserInfoByUserAccountEx(char const* userAccount, rtc::UserInfo* userInfo, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->getUserInfoByUserAccountEx(userAccount, userInfo, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::getUserInfoByUidEx(agora::rtc::uid_t uid, rtc::UserInfo* userInfo, agora::rtc::RtcConnection const& connection) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->getUserInfoByUidEx(uid, userInfo, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::takeSnapshotEx(agora::rtc::RtcConnection const& connection, agora::rtc::uid_t uid, char const* filePath) { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->takeSnapshotEx(connection, uid, filePath); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::enableContentInspectEx(bool enabled, const media::ContentInspectConfig& config, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->enableContentInspectEx(enabled, config, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + int AgoraUERtcEngine::startMediaRenderingTracingEx(const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->startMediaRenderingTracingEx(connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::setParametersEx(const RtcConnection& connection, const char* parameters) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->setParametersEx(connection, parameters); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::getCallIdEx(agora::util::AString& callId, const RtcConnection& connection) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->getCallIdEx(callId, connection); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } + + + int AgoraUERtcEngine::sendAudioMetadataEx(const RtcConnection& connection, const char* metadata, size_t length) + { + if (RtcEngine != nullptr) { + return ((IRtcEngineEx*)RtcEngine)->sendAudioMetadataEx(connection, metadata, length); + } + return AGORA_UE_ERR_CODE(ERROR_NULLPTR); + } +#pragma endregion Other Native APIs + } + } +} + diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/CacheManagerImpl.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/CacheManagerImpl.cpp deleted file mode 100644 index 897062e0..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/CacheManagerImpl.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "AgoraCppPlugin/include/CacheManagerImpl.h" -namespace agora { - namespace rtc { - namespace ue { - - void CacheManagerImpl::enableVideoFrameObserver(const VideoFrameIdentity* Identity) - { - std::lock_guard lock(Mutex); - - // refresh the status to be true - auto it = CacheMapStatus.find(*Identity); - if (it == CacheMapStatus.end()) { - CacheMapStatus[*Identity] = true; - } - else { - it->second = true; - } - - // if not found, insert a new item - auto videoFrameIterator = DataMap.find(*Identity); - if (videoFrameIterator == DataMap.end()) { - auto frame = new FramesInfo(); - frame->CurrentFrame = new VideoFrame(); - frame->CurrentFrame->yBuffer = nullptr; - frame->SwipFrame = new VideoFrame(); - frame->SwipFrame->yBuffer = nullptr; - - DataMap[*Identity] = frame; - } - } - - void CacheManagerImpl::disableVideoFrameObserver(const VideoFrameIdentity* Identity) - { - std::lock_guard lock(Mutex); - auto it = CacheMapStatus.find(*Identity); - if (it == CacheMapStatus.end()) { - return; - } - else { - it->second = false; - } - } - - int CacheManagerImpl::pushVideo(const VideoFrameIdentity* Identity, VideoFrame* Frame) - { - std::lock_guard lock(Mutex); - if (Frame == nullptr) - { - return false; - } - - auto it = CacheMapStatus.find(*Identity); - if (it == CacheMapStatus.end()) { - return CACHE_MANAGER_NOT_ENABLE; - } - - if (it->second == false) { - return CACHE_MANAGER_NOT_ENABLE; - } - - auto iterator = DataMap.find(*Identity); - - if (iterator != DataMap.end()) { - auto local_frames = iterator->second; - - if (!local_frames->CurrentFrame->yBuffer) { - local_frames->CurrentFrame->yBuffer = (uint8*)malloc(Frame->width * Frame->height * 4); - } - - if (local_frames->CurrentFrame->width != Frame->width || local_frames->CurrentFrame->height != Frame->height) { - local_frames->CurrentFrame->yBuffer = (uint8*)realloc(local_frames->CurrentFrame->yBuffer, Frame->width * Frame->height * 4); - } - - memcpy(local_frames->CurrentFrame->yBuffer, Frame->yBuffer, Frame->width * Frame->height * 4); - local_frames->CurrentFrame->width = Frame->width; - local_frames->CurrentFrame->height = Frame->height; - local_frames->CurrentFrame->yStride = Frame->yStride; - - local_frames->bIsFresh = true; - } - return ERROR_OK; - } - - int CacheManagerImpl::popVideo(const VideoFrameIdentity* Identity, VideoFrame*& Frame) - { - std::lock_guard lock(Mutex); - auto It = CacheMapStatus.find(*Identity); - if (It == CacheMapStatus.end()) { - return CACHE_MANAGER_NOT_ENABLE; - } - - if (It->second == false) { - return CACHE_MANAGER_NOT_ENABLE; - } - - auto iterator = DataMap.find(*Identity); - - if (iterator != DataMap.end()) { - auto Localframes = iterator->second; - - if (Localframes->CurrentFrame->yBuffer && Localframes->bIsFresh) { - - swap(Localframes->SwipFrame, Localframes->CurrentFrame); - - Frame = Localframes->SwipFrame; - - Localframes->bIsFresh = false; - } - else { - return VIDEO_FRAME_BUFFER_EMPTY; - } - - return ERROR_OK; - } - else { - return CACHE_MANAGER_NOT_ENABLE; - } - - return ERROR_OK; - } - - void CacheManagerImpl::clear(const VideoFrameIdentity* Identity) - { - std::lock_guard lock(Mutex); - auto it = DataMap.find(*Identity); - if (it == DataMap.end()) { - return; - } - else { - FramesInfo* frames = it->second; - if (frames) { - if (frames->CurrentFrame->yBuffer) { - free(frames->CurrentFrame->yBuffer); - frames->CurrentFrame->yBuffer = nullptr; - delete(frames->CurrentFrame); - frames->CurrentFrame = nullptr; - } - if (frames->SwipFrame->yBuffer) { - free(frames->SwipFrame->yBuffer); - frames->SwipFrame->yBuffer = nullptr; - delete(frames->SwipFrame); - frames->SwipFrame = nullptr; - } - delete frames; - - } - DataMap.erase(it); - } - } - - void CacheManagerImpl::clearAll() - { - std::lock_guard lock(Mutex); - auto it = DataMap.begin(); - for (; it != DataMap.end(); it++) { - clear(&(it->first)); - } - DataMap.clear(); - } - - void CacheManagerImpl::swap(VideoFrame*& SwipFrame, VideoFrame*& CurrentFrame) - { - VideoFrame* Temp = SwipFrame; - SwipFrame = CurrentFrame; - CurrentFrame = Temp; - } - - ICacheManager* createCacheManager() { - return new CacheManagerImpl(); - } - - } - } -} - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/DataManager.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/DataManager.cpp deleted file mode 100644 index 961083ff..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/DataManager.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "AgoraCppPlugin/include/DataManager.h" - -namespace agora { - namespace rtc { - namespace ue { - - DataManager::DataManager() - { - Cache = createCacheManager(); - } - - DataManager* DataManager::getInstance() - { - static DataManager Inst; - return &Inst; - } - - ICacheManager* DataManager::getCacheManager() - { - return Cache; - } - - } - } -} - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoObserverInternal.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/AgoraUEVideoFrameObserver.h similarity index 58% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoObserverInternal.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/AgoraUEVideoFrameObserver.h index 4a39463d..a485f7b5 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoObserverInternal.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/AgoraUEVideoFrameObserver.h @@ -1,67 +1,50 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "CoreMinimal.h" -#include "SlateOptMacros.h" -#include "Engine/Texture2D.h" -#include "Components/Image.h" -#include -#include "AgoraHeaderBase.h" -#include "CacheManagerImpl.h" -/** - * - */ -namespace agora { - namespace rtc { - namespace ue { - - using VideoFrame = media::IVideoFrameObserver::VideoFrame; - - class VideoObserverInternal : public media::IVideoFrameObserver - { - public: - - VideoObserverInternal(media::IVideoFrameObserver* observer, ICacheManager* cache); - - virtual ~VideoObserverInternal() override; - - virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, VideoFrame& videoFrame) override; - - virtual bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, VideoFrame& videoFrame) override; - - virtual bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) override; - - virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame) override; - - virtual bool onTranscodedVideoFrame(VideoFrame& videoFrame) override; - - virtual VIDEO_FRAME_PROCESS_MODE getVideoFrameProcessMode() override; - - virtual agora::media::base::VIDEO_PIXEL_FORMAT getVideoFormatPreference() override; - - virtual bool getRotationApplied() override; - - virtual bool getMirrorApplied() override; - - virtual uint32_t getObservedFramePosition() override; - - virtual bool isExternal() override; - - void registerVideoFrameObserver(media::IVideoFrameObserver* observer); - private: - - void setVideoFrame(VideoFrameIdentity* identity, VideoFrame* frame); - - public: - ICacheManager* AacheManager; - media::IVideoFrameObserver* UserObserver; - }; - - } - } -} - +#pragma once +#if AGORA_UESDK_ENABLE_VIDEO +#include "AgoraHeaderBase.h" + +namespace agora { + namespace rtc { + namespace ue { + + + class AgoraUEVideoFrameObserver : public media::IVideoFrameObserver { + + public: + + AgoraUEVideoFrameObserver(media::IVideoFrameObserver* observer); + + virtual ~AgoraUEVideoFrameObserver() override; + +#pragma region Overrride Agora Native Methods + virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, VideoFrame& videoFrame) override; + + virtual bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, VideoFrame& videoFrame) override; + + virtual bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) override; + + virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame) override; + + virtual bool onTranscodedVideoFrame(VideoFrame& videoFrame) override; + + virtual VIDEO_FRAME_PROCESS_MODE getVideoFrameProcessMode() override; + + virtual agora::media::base::VIDEO_PIXEL_FORMAT getVideoFormatPreference() override; + + virtual bool getRotationApplied() override; + + virtual bool getMirrorApplied() override; + + virtual uint32_t getObservedFramePosition() override; + + virtual bool isExternal() override; +#pragma endregion Agora Native Methods + + + private: + media::IVideoFrameObserver* _NativeAgoraVideoObserver = nullptr; + }; + } + } +} + #endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/DataTypes.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/DataTypes.h new file mode 100644 index 00000000..740812b8 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/DataTypes.h @@ -0,0 +1,78 @@ +#pragma once +#include "CoreMinimal.h" +#include "Templates/TypeHash.h" +#include "AgoraHeaderBase.h" +#include + +namespace agora { + namespace rtc { + namespace ue { + + using VideoFrame = media::base::VideoFrame; + + enum class VideoRenderType :uint8 { + RGBA = 0, + YUV = 1, + }; + + /* + Since [setupRemoteVideo] doesn't pass the channel name, and Agora doesn't support joining multiple video channels, we don't use the channel ID to judge. + */ + typedef struct VideoFrameId { + + VIDEO_SOURCE_TYPE Type; + agora::rtc::uid_t Id; + std::string Channel; + + VideoFrameId() :Type(VIDEO_SOURCE_CAMERA), Id(0), Channel("") {} + VideoFrameId(VIDEO_SOURCE_TYPE Type, uid_t Id, const char* ChannelName) :Type(Type), Id(Id), Channel(ChannelName) {} + + + bool operator <(const VideoFrameId& Other) const + { + if (Type < Other.Type) + { + return true; + } + else if (Type == Other.Type) + { + if (Id < Other.Id) + { + return true; + } + //else if (Id == Other.Id) + //{ + // if (Channel== Other.Channel) + // { + // return true; + // } + //} + + } + return false; + } + bool operator==(const VideoFrameId& Other) const + { + //return Type == Other.Type && Id == Other.Id && Channel == Other.Channel; + + return Type == Other.Type && Id == Other.Id; + } + + friend FORCEINLINE uint32 GetTypeHash(const VideoFrameId& Key) + { + uint32 Hash = 0; + + Hash = HashCombine(Hash, (uint32)(Key.Type)); + Hash = HashCombine(Hash, (uint32)(Key.Id)); + //Hash = HashCombine(Hash, FCrc::StrCrc32(*FString(Key.Channel.c_str()))); + return Hash; + } + + } VideoFrameId; + + + + + } + } +} \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameDataManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameDataManager.h new file mode 100644 index 00000000..6e8d2cf2 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameDataManager.h @@ -0,0 +1,68 @@ +#pragma once +#include "CoreMinimal.h" +#include "DataTypes.h" +#include "AgoraHeaderBase.h" + +namespace agora { + namespace rtc { + namespace ue { + using namespace media; + + class VideoFrameBuffer + { + + public: + VideoFrameBuffer(); + + virtual ~VideoFrameBuffer(); + + void Init(); + + int Push(VideoFrame* Frame); + int Pop(VideoFrame*& Frame); + + void Clear(); + + + inline void SetStartUpdatingStatus(bool IsStartUpdating) { + this->IsUpdating = IsStartUpdating; + } + + private: + void _ClearOneBuffer(VideoFrame* BufferFrame); + int _CopyOneFrameToBuffer(VideoFrame* SrcFrame, VideoFrame* DstFrameBuffer); + void _Swap(); + + VideoFrame* FrontBufferFrame = nullptr; + VideoFrame* BackBufferFrame = nullptr; + bool IsUpdating = false; + bool HasData = false; + + //Status Statistics + bool IsFirstPop = true; + }; + + + + + class VideoFrameDataManager { + + public: + static VideoFrameDataManager* Get(); + static void Release(); + static VideoFrameDataManager* VideoFrameDataManagerInstance; + + void StartUpdatingOneVideoBuffer(const VideoFrameId& FrameId); + void StopUpdatingOneVideoBuffer(const VideoFrameId& FrameId); + + int PushVideoFrame(const VideoFrameId& FrameId, VideoFrame* Frame); + int PopVideoFrame(const VideoFrameId& FrameId, VideoFrame*& Frame); + void ClearAll(); + + private: + FCriticalSection _CriticalSection; + TMap DataMapVideoFrameBuffers; + }; + } + } +} \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameRender.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameRender.h new file mode 100644 index 00000000..3464898a --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameRender.h @@ -0,0 +1,55 @@ +#pragma once + +#if AGORA_UESDK_ENABLE_VIDEO + +#include "DataTypes.h" + +class UTexture2D; +class UImage; +class UTextureRenderTarget2D; +class VideoFrameDataManager; +class VideoFrame; + +namespace agora { + namespace rtc { + namespace ue { + + class VideoFrameRender { + + public: + VideoFrameRender(); + virtual ~VideoFrameRender(); + + void Init(const VideoFrameId & FrameId); + void Clear(); + void OnTick(); + + void SetRenderImage(UImage* Image); + + private: + void InitTexture2D(int Width,int Height); + void CopyToTexture2D(VideoFrame* _VideoFrame); + + void UpdateImage(); + + // CPU + UTexture2D* RenderTexture = nullptr; + + + + // Base On Texture + UImage* RenderImage = nullptr; + + + // Another RenderTarget + // GPU + // UTextureRenderTarget2D* RenderTarget; + + + VideoFrameId _VideoFrameId; + }; + } + } +} + +#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameRenderManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameRenderManager.h new file mode 100644 index 00000000..6f642e45 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/PrivateInclude/VideoRender/VideoFrameRenderManager.h @@ -0,0 +1,43 @@ +#pragma once + +#if AGORA_UESDK_ENABLE_VIDEO + +#include "CoreMinimal.h" +#include "Tickable.h" +#include "DataTypes.h" + +class UImage; + +namespace agora { + namespace rtc { + namespace ue { + + class VideoFrameRenderManager : public FTickableGameObject + { + public: + VideoFrameRenderManager() {} + virtual ~VideoFrameRenderManager(){} + + void AddOneRender(UImage* RenderImage, VIDEO_SOURCE_TYPE SourceType,const char* ChannelId, uid_t Uid); + + void ReleaseOneRender(VIDEO_SOURCE_TYPE SourceType,const char* ChannelId, uid_t Uid); + + void ReleaseAll(); + + virtual void Tick(float DeltaTime) override; + + + virtual bool IsTickable() const override { return true; } + + virtual bool IsTickableWhenPaused() const override { return true; } + + virtual TStatId GetStatId() const override { return TStatId();} + + private: + TMap> DataMapVideoRenders; + }; + } + } +} + +#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/RtcEngineProxy.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/RtcEngineProxy.cpp deleted file mode 100644 index 3f530a7e..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/RtcEngineProxy.cpp +++ /dev/null @@ -1,2571 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#include "AgoraCppPlugin/include/RtcEngineProxy.h" -#include "AgoraPluginInterface.h" - -namespace agora -{ - namespace rtc - { - namespace ue - { - // Interface - agora::rtc::IRtcEngine* createAgoraRtcEngine() - { - return RtcEngineProxy::GetInstance(); - } - - agora::rtc::IRtcEngineEx* createAgoraRtcEngineEx() - { - return RtcEngineProxy::GetInstance(); - } - - - // RtcEngineProxy - RtcEngineProxy* RtcEngineProxy::Instance = nullptr; - std::mutex RtcEngineProxy::MutexLock; - - void RtcEngineProxy::InitInstance() - { -#if PLATFORM_ANDROID - if (JNIEnv* Env = FAndroidApplication::GetJavaEnv()) - { - static jmethodID LoadLibrary = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID, "LoadLibrary", "()V", false); - FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, LoadLibrary); - if (LoadLibrary != NULL) - { - FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, LoadLibrary); - } - - static jmethodID LoadAndroidScreenCaptureSo = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID, "LoadAndroidScreenCaptureSo", "()V", false); - if (LoadAndroidScreenCaptureSo != NULL) - { - FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, LoadAndroidScreenCaptureSo); - } - } -#endif - RtcEngine = ::createAgoraRtcEngine(); -#if AGORA_UESDK_ENABLE_VIDEO - VideoRenderMgr = MakeShareable(new VideoRenderManager()); -#endif - } - - - void RtcEngineProxy::UnInitInstance(bool sync /*= false*/) - { - if(RtcEngine){ - - RtcEngine->release(sync); - RtcEngine = nullptr; -#if AGORA_UESDK_ENABLE_VIDEO - VideoRenderMgr = nullptr; -#endif - - } - } - - - - agora::rtc::ue::RtcEngineProxy* RtcEngineProxy::GetInstance() - { - if (Instance == nullptr) { - std::unique_lock lock(MutexLock); - if (Instance == nullptr) { - Instance = new RtcEngineProxy(); - Instance->InitInstance(); - } - } - return Instance; - } - - - void RtcEngineProxy::ReleaseInstance(bool sync /*= false*/) - { - if (Instance != nullptr) { - std::unique_lock lock(MutexLock); - if (Instance != nullptr) { - Instance->UnInitInstance(sync); - delete Instance; - Instance = nullptr; - } - } - } - - RtcEngineProxy::RtcEngineProxy() {} - - RtcEngineProxy::~RtcEngineProxy() {} - - void RtcEngineProxy::release(bool sync) { - if (Instance != nullptr) - { - RtcEngineProxy::ReleaseInstance(sync); - } - } - - int RtcEngineProxy::initialize(agora::rtc::RtcEngineContext const& context) { - int ret = RtcEngine->initialize(context); - - UE_LOG(LogTemp, Warning, TEXT("RtcEngineProxy initialize %d"), ret); - if (RtcEngine != nullptr && ret == 0) - { - AppType appType = kAppTypeUnreal; - - FString ParamType = FString::Printf(TEXT("{\"rtc.set_app_type\": %d}"), appType); - agora::base::AParameter apm(RtcEngine); - apm->setParameters(TCHAR_TO_UTF8(*ParamType)); - -#if AGORA_UESDK_ENABLE_VIDEO - -#if PLATFORM_ANDROID - - // The following parameter is the same as "{\"rtc.enable_camera_capture_yuv\":\"true\"}" - // These 2 parameters are used to capture YUV data directly. - // Otherwise, the inconsistent rotation applied to video frame can lead to flickering in the displayed image. - - apm->setParameters("{\"che.video.android_camera_output_type\":0}"); - -#endif - // Our client can also use addVideoFrameRenderer to listen to VideoFrameObserver - queryInterface(AGORA_IID_MEDIA_ENGINE, (void**)&MediaEngine); - VideoObserverInternal* VideoObserver = new VideoObserverInternal(nullptr, DataManager::getInstance()->getCacheManager()); - MediaEngine->addVideoFrameRenderer(VideoObserver); -#endif - return ret; - } - else if (RtcEngine != nullptr && ret != 0) - { - return ret; - } - return -ERROR_NULLPTR; - } - int RtcEngineProxy::queryInterface(agora::rtc::INTERFACE_ID_TYPE iid, void** inter) { - if (RtcEngine != nullptr) { - return RtcEngine->queryInterface(iid, inter); - } - return -ERROR_NULLPTR; - } - -#if defined(__APPLE__) && TARGET_OS_IOS - int RtcEngineProxy::enableMultiCamera(bool enabled, const CameraCapturerConfiguration& config) - { - if (RtcEngine != nullptr) { - return RtcEngine->enableMultiCamera(enabled, config); - } - return -ERROR_NULLPTR; - } -#endif - char const* RtcEngineProxy::getVersion(int* build) { - if (RtcEngine != nullptr) { - return RtcEngine->getVersion(build); - } - return NULL; - } - - char const* RtcEngineProxy::getErrorDescription(int code) { - if (RtcEngine != nullptr) { - return RtcEngine->getErrorDescription(code); - } - return NULL; - } - - - int RtcEngineProxy::queryCodecCapability(CodecCapInfo* codecInfo, int& size) - { - if (RtcEngine != nullptr) { - return RtcEngine->queryCodecCapability(codecInfo, size); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::joinChannel(char const* token, char const* channelId, char const* info, agora::rtc::uid_t uid) { - if (RtcEngine != nullptr) { - return RtcEngine->joinChannel(token, channelId, info, uid); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::joinChannel(char const* token, char const* channelId, agora::rtc::uid_t uid, agora::rtc::ChannelMediaOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->joinChannel(token, channelId, uid, options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateChannelMediaOptions(agora::rtc::ChannelMediaOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->updateChannelMediaOptions(options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::leaveChannel() { - if (RtcEngine != nullptr) { - int ret = RtcEngine->leaveChannel(); - return ret; - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::leaveChannel(agora::rtc::LeaveChannelOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->leaveChannel(options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::renewToken(char const* token) { - if (RtcEngine != nullptr) { - return RtcEngine->renewToken(token); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setChannelProfile(agora::CHANNEL_PROFILE_TYPE profile) { - if (RtcEngine != nullptr) { - return RtcEngine->setChannelProfile(profile); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setClientRole(agora::rtc::CLIENT_ROLE_TYPE role) { - if (RtcEngine != nullptr) { - return RtcEngine->setClientRole(role); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setClientRole(agora::rtc::CLIENT_ROLE_TYPE role, agora::rtc::ClientRoleOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->setClientRole(role, options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startEchoTest() { - if (RtcEngine != nullptr) { - return RtcEngine->startEchoTest(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startEchoTest(int intervalInSeconds) { - if (RtcEngine != nullptr) { - return RtcEngine->startEchoTest(intervalInSeconds); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startEchoTest(agora::rtc::EchoTestConfiguration const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->startEchoTest(config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopEchoTest() { - if (RtcEngine != nullptr) { - return RtcEngine->stopEchoTest(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableVideo() { - if (RtcEngine != nullptr) { - return RtcEngine->enableVideo(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::disableVideo() { - if (RtcEngine != nullptr) { - return RtcEngine->disableVideo(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startPreview() { - if (RtcEngine != nullptr) { - return RtcEngine->startPreview(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startPreview(agora::rtc::VIDEO_SOURCE_TYPE sourceType) { - if (RtcEngine != nullptr) { - return RtcEngine->startPreview(sourceType); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopPreview() { - if (RtcEngine != nullptr) { - return RtcEngine->stopPreview(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopPreview(agora::rtc::VIDEO_SOURCE_TYPE sourceType) { - if (RtcEngine != nullptr) { - return RtcEngine->stopPreview(sourceType); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startLastmileProbeTest(agora::rtc::LastmileProbeConfig const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->startLastmileProbeTest(config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopLastmileProbeTest() { - if (RtcEngine != nullptr) { - return RtcEngine->stopLastmileProbeTest(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVideoEncoderConfiguration(agora::rtc::VideoEncoderConfiguration const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->setVideoEncoderConfiguration(config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setBeautyEffectOptions(bool enabled, agora::rtc::BeautyOptions const& options, agora::media::MEDIA_SOURCE_TYPE type) { - if (RtcEngine != nullptr) { - return RtcEngine->setBeautyEffectOptions(enabled, options, type); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLowlightEnhanceOptions(bool enabled, agora::rtc::LowlightEnhanceOptions const& options, agora::media::MEDIA_SOURCE_TYPE type) { - if (RtcEngine != nullptr) { - return RtcEngine->setLowlightEnhanceOptions(enabled, options, type); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVideoDenoiserOptions(bool enabled, agora::rtc::VideoDenoiserOptions const& options, agora::media::MEDIA_SOURCE_TYPE type) { - if (RtcEngine != nullptr) { - return RtcEngine->setVideoDenoiserOptions(enabled, options, type); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setColorEnhanceOptions(bool enabled, agora::rtc::ColorEnhanceOptions const& options, agora::media::MEDIA_SOURCE_TYPE type) { - if (RtcEngine != nullptr) { - return RtcEngine->setColorEnhanceOptions(enabled, options, type); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableVirtualBackground(bool enabled, agora::rtc::VirtualBackgroundSource backgroundSource, agora::rtc::SegmentationProperty segproperty, agora::media::MEDIA_SOURCE_TYPE type) { - if (RtcEngine != nullptr) { - return RtcEngine->enableVirtualBackground(enabled, backgroundSource, segproperty, type); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setupRemoteVideo(agora::rtc::VideoCanvas const& canvas) { -#if AGORA_UESDK_ENABLE_VIDEO - if (RtcEngine != nullptr) { - if (canvas.view != nullptr) { - VideoRenderMgr->setRenderImage((UImage*)canvas.view, canvas.uid, "", canvas.sourceType); - } - else { - VideoRenderMgr->releaseVideoRender(canvas.uid, "", canvas.sourceType); - } - return -ERROR_OK; - } -#endif - return -ERROR_NULLPTR; - } - int RtcEngineProxy::setupLocalVideo(agora::rtc::VideoCanvas const& canvas) { -#if AGORA_UESDK_ENABLE_VIDEO - if (RtcEngine != nullptr) { - if (canvas.view != nullptr) { - VideoRenderMgr->setRenderImage((UImage*)canvas.view, canvas.uid, "", canvas.sourceType); - } - else { - VideoRenderMgr->releaseVideoRender(canvas.uid, "", canvas.sourceType); - //_videoRenderMgr->releaseAllVideoRender(); - } - return -ERROR_OK; - } -#endif - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVideoScenario(VIDEO_APPLICATION_SCENARIO_TYPE scenarioType) - { - if (RtcEngine != nullptr) { - return RtcEngine->setVideoScenario(scenarioType); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableAudio() { - if (RtcEngine != nullptr) { - return RtcEngine->enableAudio(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::disableAudio() { - if (RtcEngine != nullptr) { - return RtcEngine->disableAudio(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) - { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioProfile(profile, scenario); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAudioProfile(AUDIO_PROFILE_TYPE profile) - { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioProfile(profile); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAudioScenario(agora::rtc::AUDIO_SCENARIO_TYPE scenario) { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioScenario(scenario); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableLocalAudio(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->enableLocalAudio(enabled); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteLocalAudioStream(bool mute) { - if (RtcEngine != nullptr) { - return RtcEngine->muteLocalAudioStream(mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteAllRemoteAudioStreams(bool mute) { - if (RtcEngine != nullptr) { - return RtcEngine->muteAllRemoteAudioStreams(mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setDefaultMuteAllRemoteAudioStreams(bool mute) - { - if (RtcEngine != nullptr) { - return RtcEngine->setDefaultMuteAllRemoteAudioStreams(mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteRemoteAudioStream(agora::rtc::uid_t uid, bool mute) { - if (RtcEngine != nullptr) { - return RtcEngine->muteRemoteAudioStream(uid, mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteLocalVideoStream(bool mute) { - if (RtcEngine != nullptr) { - return RtcEngine->muteLocalVideoStream(mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableLocalVideo(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->enableLocalVideo(enabled); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteAllRemoteVideoStreams(bool mute) { - if (RtcEngine != nullptr) { - return RtcEngine->muteAllRemoteVideoStreams(mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setDefaultMuteAllRemoteVideoStreams(bool mute) - { - if (RtcEngine != nullptr) { - return RtcEngine->setDefaultMuteAllRemoteVideoStreams(mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setSubscribeAudioBlocklist(uid_t* uidList, int uidNumber) - { - if (RtcEngine != nullptr) { - return RtcEngine->setSubscribeAudioBlocklist(uidList, uidNumber); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setSubscribeAudioAllowlist(uid_t* uidList, int uidNumber) - { - if (RtcEngine != nullptr) { - return RtcEngine->setSubscribeAudioAllowlist(uidList, uidNumber); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setSubscribeVideoBlocklist(uid_t* uidList, int uidNumber) - { - if (RtcEngine != nullptr) { - return RtcEngine->setSubscribeVideoBlocklist(uidList, uidNumber); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setSubscribeVideoAllowlist(uid_t* uidList, int uidNumber) - { - if (RtcEngine != nullptr) { - return RtcEngine->setSubscribeVideoAllowlist(uidList, uidNumber); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setHeadphoneEQPreset(HEADPHONE_EQUALIZER_PRESET preset) - { - if (RtcEngine != nullptr) { - return RtcEngine->setHeadphoneEQPreset(preset); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setHeadphoneEQParameters(int lowGain, int highGain) - { - if (RtcEngine != nullptr) { - return RtcEngine->setHeadphoneEQParameters(lowGain, highGain); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteRemoteVideoStream(agora::rtc::uid_t uid, bool mute) { - if (RtcEngine != nullptr) { - return RtcEngine->muteRemoteVideoStream(uid, mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteVideoStreamType(agora::rtc::uid_t uid, agora::rtc::VIDEO_STREAM_TYPE streamType) { - if (RtcEngine != nullptr) { - return RtcEngine->setRemoteVideoStreamType(uid, streamType); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteVideoSubscriptionOptions(agora::rtc::uid_t uid, agora::rtc::VideoSubscriptionOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->setRemoteVideoSubscriptionOptions(uid, options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteDefaultVideoStreamType(agora::rtc::VIDEO_STREAM_TYPE streamType) { - if (RtcEngine != nullptr) { - return RtcEngine->setRemoteDefaultVideoStreamType(streamType); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::enableAudioVolumeIndication(int interval, int smooth, bool reportVad) { - if (RtcEngine != nullptr) { - return RtcEngine->enableAudioVolumeIndication(interval, smooth, reportVad); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startAudioRecording(char const* filePath, agora::rtc::AUDIO_RECORDING_QUALITY_TYPE quality) { - if (RtcEngine != nullptr) { - return RtcEngine->startAudioRecording(filePath, quality); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startAudioRecording(char const* filePath, int sampleRate, agora::rtc::AUDIO_RECORDING_QUALITY_TYPE quality) { - if (RtcEngine != nullptr) { - return RtcEngine->startAudioRecording(filePath, sampleRate, quality); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startAudioRecording(agora::rtc::AudioRecordingConfiguration const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->startAudioRecording(config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::registerAudioEncodedFrameObserver(agora::rtc::AudioEncodedFrameObserverConfig const& config, agora::rtc::IAudioEncodedFrameObserver* observer) { - if (RtcEngine != nullptr) { - return RtcEngine->registerAudioEncodedFrameObserver(config, observer); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopAudioRecording() { - if (RtcEngine != nullptr) { - return RtcEngine->stopAudioRecording(); - } - return -ERROR_NULLPTR; - } - - agora_refptr RtcEngineProxy::createMediaPlayer() { - if (RtcEngine != nullptr) { - return RtcEngine->createMediaPlayer(); - } - return NULL; - } - - int RtcEngineProxy::destroyMediaPlayer(agora_refptr media_player) { - if (RtcEngine != nullptr) { - return RtcEngine->destroyMediaPlayer(media_player); - } - return -ERROR_NULLPTR; - } - - - agora::agora_refptr RtcEngineProxy::createMediaRecorder(const RecorderStreamInfo& info) - { - if (RtcEngine != nullptr) { - return RtcEngine->createMediaRecorder(info); - } - return nullptr; - } - - - int RtcEngineProxy::destroyMediaRecorder(agora_refptr mediaRecorder) - { - if (RtcEngine != nullptr) { - return RtcEngine->destroyMediaRecorder(mediaRecorder); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startAudioMixing(char const* filePath, bool loopback, int cycle) { - if (RtcEngine != nullptr) { - return RtcEngine->startAudioMixing(filePath, loopback, cycle); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startAudioMixing(char const* filePath, bool loopback, int cycle, int startPos) { - if (RtcEngine != nullptr) { - return RtcEngine->startAudioMixing(filePath, loopback, cycle, startPos); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopAudioMixing() { - if (RtcEngine != nullptr) { - return RtcEngine->stopAudioMixing(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::pauseAudioMixing() { - if (RtcEngine != nullptr) { - return RtcEngine->pauseAudioMixing(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::resumeAudioMixing() { - if (RtcEngine != nullptr) { - return RtcEngine->resumeAudioMixing(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::selectAudioTrack(int index) { - if (RtcEngine != nullptr) { - return RtcEngine->selectAudioTrack(index); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getAudioTrackCount() { - if (RtcEngine != nullptr) { - return RtcEngine->getAudioTrackCount(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustAudioMixingVolume(int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->adjustAudioMixingVolume(volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustAudioMixingPublishVolume(int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->adjustAudioMixingPublishVolume(volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getAudioMixingPublishVolume() { - if (RtcEngine != nullptr) { - return RtcEngine->getAudioMixingPublishVolume(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustAudioMixingPlayoutVolume(int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->adjustAudioMixingPlayoutVolume(volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getAudioMixingPlayoutVolume() { - if (RtcEngine != nullptr) { - return RtcEngine->getAudioMixingPlayoutVolume(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getAudioMixingDuration() { - if (RtcEngine != nullptr) { - return RtcEngine->getAudioMixingDuration(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getAudioMixingCurrentPosition() { - if (RtcEngine != nullptr) { - return RtcEngine->getAudioMixingCurrentPosition(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAudioMixingPosition(int pos) { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioMixingPosition(pos); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAudioMixingDualMonoMode(media::AUDIO_MIXING_DUAL_MONO_MODE mode) { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioMixingDualMonoMode(mode); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAudioMixingPitch(int pitch) { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioMixingPitch(pitch); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getEffectsVolume() { - if (RtcEngine != nullptr) { - return RtcEngine->getEffectsVolume(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setEffectsVolume(int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->setEffectsVolume(volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::preloadEffect(int soundId, char const* filePath, int startPos) { - if (RtcEngine != nullptr) { - return RtcEngine->preloadEffect(soundId, filePath, startPos); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::playEffect(int soundId, char const* filePath, int loopCount, double pitch, double pan, int gain, bool publish, int startPos) { - if (RtcEngine != nullptr) { - return RtcEngine->playEffect(soundId, filePath, loopCount, pitch, pan, gain, publish, startPos); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::playAllEffects(int loopCount, double pitch, double pan, int gain, bool publish) { - if (RtcEngine != nullptr) { - return RtcEngine->playAllEffects(loopCount, pitch, pan, gain, publish); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getVolumeOfEffect(int soundId) { - if (RtcEngine != nullptr) { - return RtcEngine->getVolumeOfEffect(soundId); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVolumeOfEffect(int soundId, int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->setVolumeOfEffect(soundId, volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::pauseEffect(int soundId) { - if (RtcEngine != nullptr) { - return RtcEngine->pauseEffect(soundId); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::pauseAllEffects() { - if (RtcEngine != nullptr) { - return RtcEngine->pauseAllEffects(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::resumeEffect(int soundId) { - if (RtcEngine != nullptr) { - return RtcEngine->resumeEffect(soundId); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::resumeAllEffects() { - if (RtcEngine != nullptr) { - return RtcEngine->resumeAllEffects(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopEffect(int soundId) { - if (RtcEngine != nullptr) { - return RtcEngine->stopEffect(soundId); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopAllEffects() { - if (RtcEngine != nullptr) { - return RtcEngine->stopAllEffects(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::unloadEffect(int soundId) { - if (RtcEngine != nullptr) { - return RtcEngine->unloadEffect(soundId); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::unloadAllEffects() { - if (RtcEngine != nullptr) { - return RtcEngine->unloadAllEffects(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getEffectDuration(char const* filePath) { - if (RtcEngine != nullptr) { - return RtcEngine->getEffectDuration(filePath); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setEffectPosition(int soundId, int pos) { - if (RtcEngine != nullptr) { - return RtcEngine->setEffectPosition(soundId, pos); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getEffectCurrentPosition(int soundId) { - if (RtcEngine != nullptr) { - return RtcEngine->getEffectCurrentPosition(soundId); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableSoundPositionIndication(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->enableSoundPositionIndication(enabled); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteVoicePosition(agora::rtc::uid_t uid, double pan, double gain) { - if (RtcEngine != nullptr) { - return RtcEngine->setRemoteVoicePosition(uid, pan, gain); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableSpatialAudio(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->enableSpatialAudio(enabled); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteUserSpatialAudioParams(agora::rtc::uid_t uid, agora::SpatialAudioParams const& params) { - if (RtcEngine != nullptr) { - return RtcEngine->setRemoteUserSpatialAudioParams(uid, params); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVoiceBeautifierPreset(agora::rtc::VOICE_BEAUTIFIER_PRESET preset) { - if (RtcEngine != nullptr) { - return RtcEngine->setVoiceBeautifierPreset(preset); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAudioEffectPreset(agora::rtc::AUDIO_EFFECT_PRESET preset) { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioEffectPreset(preset); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVoiceConversionPreset(agora::rtc::VOICE_CONVERSION_PRESET preset) { - if (RtcEngine != nullptr) { - return RtcEngine->setVoiceConversionPreset(preset); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAudioEffectParameters(agora::rtc::AUDIO_EFFECT_PRESET preset, int param1, int param2) { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioEffectParameters(preset, param1, param2); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVoiceBeautifierParameters(agora::rtc::VOICE_BEAUTIFIER_PRESET preset, int param1, int param2) { - if (RtcEngine != nullptr) { - return RtcEngine->setVoiceBeautifierParameters(preset, param1, param2); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVoiceConversionParameters(agora::rtc::VOICE_CONVERSION_PRESET preset, int param1, int param2) { - if (RtcEngine != nullptr) { - return RtcEngine->setVoiceConversionParameters(preset, param1, param2); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLocalVoicePitch(double pitch) { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalVoicePitch(pitch); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::setLocalVoiceFormant(double formantRatio) - { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalVoiceFormant(formantRatio); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLocalVoiceEqualization(agora::rtc::AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalVoiceEqualization(bandFrequency, bandGain); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLocalVoiceReverb(agora::rtc::AUDIO_REVERB_TYPE reverbKey, int value) { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalVoiceReverb(reverbKey, value); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLogFile(char const* filePath) { - if (RtcEngine != nullptr) { - return RtcEngine->setLogFile(filePath); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLogFilter(unsigned int filter) { - if (RtcEngine != nullptr) { - return RtcEngine->setLogFilter(filter); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLogLevel(commons::LOG_LEVEL level) { - if (RtcEngine != nullptr) { - return RtcEngine->setLogLevel(level); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLogFileSize(unsigned int fileSizeInKBytes) { - if (RtcEngine != nullptr) { - return RtcEngine->setLogFileSize(fileSizeInKBytes); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::uploadLogFile(agora::util::AString& requestId) { - if (RtcEngine != nullptr) { - return RtcEngine->uploadLogFile(requestId); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode, agora::rtc::VIDEO_MIRROR_MODE_TYPE mirrorMode) { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalRenderMode(renderMode, mirrorMode); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteRenderMode(agora::rtc::uid_t uid, media::base::RENDER_MODE_TYPE renderMode, agora::rtc::VIDEO_MIRROR_MODE_TYPE mirrorMode) { - if (RtcEngine != nullptr) { - return RtcEngine->setRemoteRenderMode(uid, renderMode, mirrorMode); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode) { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalRenderMode(renderMode); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLocalVideoMirrorMode(agora::rtc::VIDEO_MIRROR_MODE_TYPE mirrorMode) { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalVideoMirrorMode(mirrorMode); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableDualStreamMode(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->enableDualStreamMode(enabled); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) - { - if (RtcEngine != nullptr) { - return RtcEngine->enableDualStreamMode(enabled, streamConfig); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setDualStreamMode(agora::rtc::SIMULCAST_STREAM_MODE mode) { - if (RtcEngine != nullptr) { - return RtcEngine->setDualStreamMode(mode); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setDualStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig) - { - if (RtcEngine != nullptr) { - return RtcEngine->setDualStreamMode(mode, streamConfig); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setEarMonitoringAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) - { - if (RtcEngine != nullptr) { - return RtcEngine->setEarMonitoringAudioFrameParameters(sampleRate, channel, mode, samplesPerCall); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::registerExtension(const char* provider, const char* extension, agora::media::MEDIA_SOURCE_TYPE type /*= agora::media::UNKNOWN_MEDIA_SOURCE*/) - { - if (RtcEngine != nullptr) { - return RtcEngine->registerExtension(provider, extension, type); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::enableCustomAudioLocalPlayback(track_id_t trackId, bool enabled) - { - if (RtcEngine != nullptr) { - return RtcEngine->enableCustomAudioLocalPlayback(trackId, enabled); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRecordingAudioFrameParameters(int sampleRate, int channel, agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) { - if (RtcEngine != nullptr) { - return RtcEngine->setRecordingAudioFrameParameters(sampleRate, channel, mode, samplesPerCall); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setPlaybackAudioFrameParameters(int sampleRate, int channel, agora::rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) { - if (RtcEngine != nullptr) { - return RtcEngine->setPlaybackAudioFrameParameters(sampleRate, channel, mode, samplesPerCall); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall) { - if (RtcEngine != nullptr) { - return RtcEngine->setMixedAudioFrameParameters(sampleRate, channel, samplesPerCall); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel) { - if (RtcEngine != nullptr) { - return RtcEngine->setPlaybackAudioFrameBeforeMixingParameters(sampleRate, channel); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableAudioSpectrumMonitor(int intervalInMS) { - if (RtcEngine != nullptr) { - return RtcEngine->enableAudioSpectrumMonitor(intervalInMS); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::disableAudioSpectrumMonitor() { - if (RtcEngine != nullptr) { - return RtcEngine->disableAudioSpectrumMonitor(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::registerAudioSpectrumObserver(agora::media::IAudioSpectrumObserver* observer) { - if (RtcEngine != nullptr) { - return RtcEngine->registerAudioSpectrumObserver(observer); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::unregisterAudioSpectrumObserver(agora::media::IAudioSpectrumObserver* observer) { - if (RtcEngine != nullptr) { - return RtcEngine->unregisterAudioSpectrumObserver(observer); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustRecordingSignalVolume(int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->adjustRecordingSignalVolume(volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteRecordingSignal(bool mute) { - if (RtcEngine != nullptr) { - return RtcEngine->muteRecordingSignal(mute); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustPlaybackSignalVolume(int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->adjustPlaybackSignalVolume(volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustUserPlaybackSignalVolume(unsigned int uid, int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->adjustUserPlaybackSignalVolume(uid, volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLocalPublishFallbackOption(agora::rtc::STREAM_FALLBACK_OPTIONS option) { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalPublishFallbackOption(option); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteSubscribeFallbackOption(agora::rtc::STREAM_FALLBACK_OPTIONS option) { - if (RtcEngine != nullptr) { - return RtcEngine->setRemoteSubscribeFallbackOption(option); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::setHighPriorityUserList(uid_t* uidList, int uidNum, STREAM_FALLBACK_OPTIONS option) - { - if (RtcEngine != nullptr) { - return RtcEngine->setHighPriorityUserList(uidList, uidNum, option); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableLoopbackRecording(bool enabled, char const* deviceName) { - if (RtcEngine != nullptr) { - return RtcEngine->enableLoopbackRecording(enabled, deviceName); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustLoopbackSignalVolume(int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->adjustLoopbackSignalVolume(volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getLoopbackRecordingVolume() { - if (RtcEngine != nullptr) { - return RtcEngine->getLoopbackRecordingVolume(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableInEarMonitoring(bool enabled, int includeAudioFilters) { - if (RtcEngine != nullptr) { - return RtcEngine->enableInEarMonitoring(enabled, includeAudioFilters); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setInEarMonitoringVolume(int volume) { - if (RtcEngine != nullptr) { - return RtcEngine->setInEarMonitoringVolume(volume); - } - return -ERROR_NULLPTR; - } -#if defined (_WIN32) || defined(__linux__) || defined(__ANDROID__) - int RtcEngineProxy::loadExtensionProvider(char const* path, bool unload_after_use) { - if (RtcEngine != nullptr) { - return RtcEngine->loadExtensionProvider(path, unload_after_use); - } - return -ERROR_NULLPTR; - } -#endif - int RtcEngineProxy::setExtensionProviderProperty(char const* provider, char const* key, char const* value) { - if (RtcEngine != nullptr) { - return RtcEngine->setExtensionProviderProperty(provider, key, value); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableExtension(char const* provider, char const* extension, bool enable, agora::media::MEDIA_SOURCE_TYPE type) { - if (RtcEngine != nullptr) { - return RtcEngine->enableExtension(provider, extension, enable, type); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableExtension(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, bool enable /*= true*/) - { - if (RtcEngine != nullptr) { - return RtcEngine->enableExtension(provider, extension, extensionInfo, enable); - } - return -ERROR_NULLPTR; - } - - - - int RtcEngineProxy::setExtensionProperty(const char* provider, const char* extension, const char* key, const char* value, agora::media::MEDIA_SOURCE_TYPE type /*= agora::media::UNKNOWN_MEDIA_SOURCE*/) - { - if (RtcEngine != nullptr) { - return RtcEngine->setExtensionProperty(provider, extension, key, value, type); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::setExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, const char* value) - { - if (RtcEngine != nullptr) { - return RtcEngine->setExtensionProperty(provider, extension, extensionInfo, key, value); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::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*/) - { - if (RtcEngine != nullptr) { - return RtcEngine->getExtensionProperty(provider, extension, key, value, buf_len, type); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::getExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, char* value, int buf_len) - { - if (RtcEngine != nullptr) { - return RtcEngine->getExtensionProperty(provider, extension, extensionInfo, key, value, buf_len); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setCameraCapturerConfiguration(agora::rtc::CameraCapturerConfiguration const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->setCameraCapturerConfiguration(config); - } - return -ERROR_NULLPTR; - } - - agora::rtc::video_track_id_t RtcEngineProxy::createCustomVideoTrack() { - if (RtcEngine != nullptr) { - return RtcEngine->createCustomVideoTrack(); - } - return 0; - } - - agora::rtc::video_track_id_t RtcEngineProxy::createCustomEncodedVideoTrack(agora::rtc::SenderOptions const& sender_option) { - if (RtcEngine != nullptr) { - return RtcEngine->createCustomEncodedVideoTrack(sender_option); - } - return 0; - } - - int RtcEngineProxy::destroyCustomVideoTrack(agora::rtc::video_track_id_t video_track_id) { - if (RtcEngine != nullptr) { - return RtcEngine->destroyCustomVideoTrack(video_track_id); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::destroyCustomEncodedVideoTrack(agora::rtc::video_track_id_t video_track_id) { - if (RtcEngine != nullptr) { - return RtcEngine->destroyCustomEncodedVideoTrack(video_track_id); - } - return -ERROR_NULLPTR; - } -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - int RtcEngineProxy::switchCamera() { - if (RtcEngine != nullptr) { - return RtcEngine->switchCamera(); - } - return -ERROR_NULLPTR; - } - - bool RtcEngineProxy::isCameraZoomSupported() { - if (RtcEngine != nullptr) { - return RtcEngine->isCameraZoomSupported(); - } - return true; - } - - bool RtcEngineProxy::isCameraFaceDetectSupported() { - if (RtcEngine != nullptr) { - return RtcEngine->isCameraFaceDetectSupported(); - } - return true; - } - - bool RtcEngineProxy::isCameraTorchSupported() { - if (RtcEngine != nullptr) { - return RtcEngine->isCameraTorchSupported(); - } - return true; - } - - bool RtcEngineProxy::isCameraFocusSupported() { - if (RtcEngine != nullptr) { - return RtcEngine->isCameraFocusSupported(); - } - return true; - } - - bool RtcEngineProxy::isCameraAutoFocusFaceModeSupported() { - if (RtcEngine != nullptr) { - return RtcEngine->isCameraAutoFocusFaceModeSupported(); - } - return true; - } - - int RtcEngineProxy::setCameraZoomFactor(float factor) { - if (RtcEngine != nullptr) { - return RtcEngine->setCameraZoomFactor(factor); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableFaceDetection(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->enableFaceDetection(enabled); - } - return -ERROR_NULLPTR; - } - - float RtcEngineProxy::getCameraMaxZoomFactor() { - if (RtcEngine != nullptr) { - return RtcEngine->getCameraMaxZoomFactor(); - } - return 0.0; - } - - int RtcEngineProxy::setCameraFocusPositionInPreview(float positionX, float positionY) { - if (RtcEngine != nullptr) { - return RtcEngine->setCameraFocusPositionInPreview(positionX, positionY); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setCameraTorchOn(bool isOn) { - if (RtcEngine != nullptr) { - return RtcEngine->setCameraTorchOn(isOn); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setCameraAutoFocusFaceModeEnabled(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->setCameraAutoFocusFaceModeEnabled(enabled); - } - return -ERROR_NULLPTR; - } - - bool RtcEngineProxy::isCameraExposurePositionSupported() { - if (RtcEngine != nullptr) { - return RtcEngine->isCameraExposurePositionSupported(); - } - return true; - } - - int RtcEngineProxy::setCameraExposurePosition(float positionXinView, float positionYinView) { - if (RtcEngine != nullptr) { - return RtcEngine->setCameraExposurePosition(positionXinView, positionYinView); - } - return -ERROR_NULLPTR; - } -#if defined(__APPLE__) - bool RtcEngineProxy::isCameraAutoExposureFaceModeSupported() { - if (RtcEngine != nullptr) { - return RtcEngine->isCameraAutoExposureFaceModeSupported(); - } - return true; - } - - int RtcEngineProxy::setCameraAutoExposureFaceModeEnabled(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->setCameraAutoExposureFaceModeEnabled(enabled); - } - return -ERROR_NULLPTR; - } -#endif - int RtcEngineProxy::setDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker) { - if (RtcEngine != nullptr) { - return RtcEngine->setDefaultAudioRouteToSpeakerphone(defaultToSpeaker); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setEnableSpeakerphone(bool speakerOn) { - if (RtcEngine != nullptr) { - return RtcEngine->setEnableSpeakerphone(speakerOn); - } - return -ERROR_NULLPTR; - } - - bool RtcEngineProxy::isSpeakerphoneEnabled() { - if (RtcEngine != nullptr) { - return RtcEngine->isSpeakerphoneEnabled(); - } - return true; - } -#endif -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - agora::rtc::IScreenCaptureSourceList* RtcEngineProxy::getScreenCaptureSources(SIZE const& thumbSize, SIZE const& iconSize, bool const includeScreen) { - if (RtcEngine != nullptr) { - return RtcEngine->getScreenCaptureSources(thumbSize, iconSize, includeScreen); - } - return NULL; - } -#endif -#if (defined(__APPLE__) && TARGET_OS_IOS) - int RtcEngineProxy::setAudioSessionOperationRestriction(AUDIO_SESSION_OPERATION_RESTRICTION restriction) - { - if (RtcEngine != nullptr) { - return RtcEngine->setAudioSessionOperationRestriction(restriction); - } - return -ERROR_NULLPTR; - } -#endif -#if defined(_WIN32) || (defined(__APPLE__) && !TARGET_OS_IPHONE && TARGET_OS_MAC) - int RtcEngineProxy::startScreenCaptureByDisplayId(uint32_t displayId, Rectangle const& regionRect, ScreenCaptureParameters const& captureParams) { - if (RtcEngine != nullptr) { - return RtcEngine->startScreenCaptureByDisplayId(displayId, regionRect, captureParams); - } - return -ERROR_NULLPTR; - } -#if defined(_WIN32) - int RtcEngineProxy::startScreenCaptureByScreenRect(const Rectangle& screenRect, const Rectangle& regionRect, const ScreenCaptureParameters& captureParams) - { - if (RtcEngine != nullptr) { - return RtcEngine->startScreenCaptureByScreenRect(screenRect, regionRect, captureParams); - } - return -ERROR_NULLPTR; - } -#endif -#endif -#if defined(__ANDROID__) - int RtcEngineProxy::getAudioDeviceInfo(agora::rtc::DeviceInfo& deviceInfo) { - if (RtcEngine != nullptr) { - return RtcEngine->getAudioDeviceInfo(deviceInfo); - } - return -ERROR_NULLPTR; - } -#endif -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - int RtcEngineProxy::startScreenCaptureByWindowId(agora::view_t windowId, agora::rtc::Rectangle const& regionRect, agora::rtc::ScreenCaptureParameters const& captureParams) { - if (RtcEngine != nullptr) { - return RtcEngine->startScreenCaptureByWindowId(windowId, regionRect, captureParams); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setScreenCaptureContentHint(agora::rtc::VIDEO_CONTENT_HINT contentHint) { - if (RtcEngine != nullptr) { - return RtcEngine->setScreenCaptureContentHint(contentHint); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateScreenCaptureRegion(agora::rtc::Rectangle const& regionRect) { - if (RtcEngine != nullptr) { - return RtcEngine->updateScreenCaptureRegion(regionRect); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateScreenCaptureParameters(agora::rtc::ScreenCaptureParameters const& captureParams) { - if (RtcEngine != nullptr) { - return RtcEngine->updateScreenCaptureParameters(captureParams); - } - return -ERROR_NULLPTR; - } -#endif -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - int RtcEngineProxy::startScreenCapture(agora::rtc::ScreenCaptureParameters2 const& captureParams) { - if (RtcEngine != nullptr) { - return RtcEngine->startScreenCapture(captureParams); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateScreenCapture(agora::rtc::ScreenCaptureParameters2 const& captureParams) { - if (RtcEngine != nullptr) { - return RtcEngine->updateScreenCapture(captureParams); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::queryScreenCaptureCapability() - { - if (RtcEngine != nullptr) { - return RtcEngine->queryScreenCaptureCapability(); - } - return -ERROR_NULLPTR; - } - - - -#endif -#if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) - - - int RtcEngineProxy::setScreenCaptureScenario(SCREEN_SCENARIO_TYPE screenScenario) - { - if (RtcEngine != nullptr) { - return RtcEngine->setScreenCaptureScenario(screenScenario); - } - return -ERROR_NULLPTR; - } - - - - int RtcEngineProxy::stopScreenCapture() { - if (RtcEngine != nullptr) { - return RtcEngine->stopScreenCapture(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startScreenCapture(VIDEO_SOURCE_TYPE sourceType, const ScreenCaptureConfiguration& config) - { - if (RtcEngine != nullptr) { - return RtcEngine->startScreenCapture(sourceType, config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopScreenCapture(VIDEO_SOURCE_TYPE sourceType) - { - if (RtcEngine != nullptr) { - return RtcEngine->stopScreenCapture(sourceType); - } - return -ERROR_NULLPTR; - } - -#endif - int RtcEngineProxy::getCallId(agora::util::AString& callId) { - if (RtcEngine != nullptr) { - return RtcEngine->getCallId(callId); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::rate(char const* callId, int rating, char const* description) { - if (RtcEngine != nullptr) { - return RtcEngine->rate(callId, rating, description); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::complain(char const* callId, char const* description) { - if (RtcEngine != nullptr) { - return RtcEngine->complain(callId, description); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startRtmpStreamWithoutTranscoding(char const* url) { - if (RtcEngine != nullptr) { - return RtcEngine->startRtmpStreamWithoutTranscoding(url); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startRtmpStreamWithTranscoding(char const* url, agora::rtc::LiveTranscoding const& transcoding) { - if (RtcEngine != nullptr) { - return RtcEngine->startRtmpStreamWithTranscoding(url, transcoding); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateRtmpTranscoding(agora::rtc::LiveTranscoding const& transcoding) { - if (RtcEngine != nullptr) { - return RtcEngine->updateRtmpTranscoding(transcoding); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopRtmpStream(char const* url) { - if (RtcEngine != nullptr) { - return RtcEngine->stopRtmpStream(url); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startLocalVideoTranscoder(agora::rtc::LocalTranscoderConfiguration const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->startLocalVideoTranscoder(config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateLocalTranscoderConfiguration(agora::rtc::LocalTranscoderConfiguration const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->updateLocalTranscoderConfiguration(config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopLocalVideoTranscoder() { - if (RtcEngine != nullptr) { - return RtcEngine->stopLocalVideoTranscoder(); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::startCameraCapture(VIDEO_SOURCE_TYPE sourceType, const CameraCapturerConfiguration& config) - { - if (RtcEngine != nullptr) { - return RtcEngine->startCameraCapture(sourceType, config); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::stopCameraCapture(VIDEO_SOURCE_TYPE sourceType) - { - if (RtcEngine != nullptr) { - return RtcEngine->stopCameraCapture(sourceType); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setCameraDeviceOrientation(agora::rtc::VIDEO_SOURCE_TYPE type, agora::rtc::VIDEO_ORIENTATION orientation) { - if (RtcEngine != nullptr) { - return RtcEngine->setCameraDeviceOrientation(type, orientation); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setScreenCaptureOrientation(agora::rtc::VIDEO_SOURCE_TYPE type, agora::rtc::VIDEO_ORIENTATION orientation) { - if (RtcEngine != nullptr) { - return RtcEngine->setScreenCaptureOrientation(type, orientation); - } - return -ERROR_NULLPTR; - } - - - agora::rtc::CONNECTION_STATE_TYPE RtcEngineProxy::getConnectionState() { - if (RtcEngine != nullptr) { - return RtcEngine->getConnectionState(); - } - return agora::rtc::CONNECTION_STATE_TYPE::CONNECTION_STATE_FAILED; - } - - bool RtcEngineProxy::registerEventHandler(agora::rtc::IRtcEngineEventHandler* eventHandler) { - if (RtcEngine != nullptr) { - return RtcEngine->registerEventHandler(eventHandler); - } - return true; - } - - bool RtcEngineProxy::unregisterEventHandler(agora::rtc::IRtcEngineEventHandler* eventHandler) { - if (RtcEngine != nullptr) { - return RtcEngine->unregisterEventHandler(eventHandler); - } - return true; - } - - int RtcEngineProxy::setRemoteUserPriority(agora::rtc::uid_t uid, agora::rtc::PRIORITY_TYPE userPriority) { - if (RtcEngine != nullptr) { - return RtcEngine->setRemoteUserPriority(uid, userPriority); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::registerPacketObserver(agora::rtc::IPacketObserver* observer) { - if (RtcEngine != nullptr) { - return RtcEngine->registerPacketObserver(observer); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setEncryptionMode(char const* encryptionMode) - { - if (RtcEngine != nullptr) { - return RtcEngine->setEncryptionMode(encryptionMode); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setEncryptionSecret(char const* secret) - { - if (RtcEngine != nullptr) { - return RtcEngine->setEncryptionSecret(secret); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableEncryption(bool enabled, agora::rtc::EncryptionConfig const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->enableEncryption(enabled, config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::createDataStream(int* streamId, bool reliable, bool ordered) { - if (RtcEngine != nullptr) { - return RtcEngine->createDataStream(streamId, reliable, ordered); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::createDataStream(int* streamId, agora::rtc::DataStreamConfig& config) { - if (RtcEngine != nullptr) { - return RtcEngine->createDataStream(streamId, config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::sendStreamMessage(int streamId, char const* data, size_t length) { - if (RtcEngine != nullptr) { - return RtcEngine->sendStreamMessage(streamId, data, length); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::addVideoWatermark(agora::rtc::RtcImage const& watermark) { - if (RtcEngine != nullptr) { - return RtcEngine->addVideoWatermark(watermark); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::addVideoWatermark(char const* watermarkUrl, agora::rtc::WatermarkOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->addVideoWatermark(watermarkUrl, options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::clearVideoWatermarks() { - if (RtcEngine != nullptr) { - return RtcEngine->clearVideoWatermarks(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::pauseAudio() { - if (RtcEngine != nullptr) { - return RtcEngine->pauseAudio(); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::resumeAudio() { - if (RtcEngine != nullptr) { - return RtcEngine->resumeAudio(); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::enableWebSdkInteroperability(bool enabled) { - if (RtcEngine != nullptr) { - return RtcEngine->enableWebSdkInteroperability(enabled); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setAdvancedAudioOptions(AdvancedAudioOptions& options, int sourceType /*= 0*/) - { - if (RtcEngine != nullptr) { - return RtcEngine->setAdvancedAudioOptions(options, sourceType); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::getNetworkType() - { - if (RtcEngine != nullptr) { - return RtcEngine->getNetworkType(); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::setParameters(const char* parameters) - { - if (RtcEngine != nullptr) { - return RtcEngine->setParameters(parameters); - } - return -ERROR_NULLPTR; - } - - int64_t RtcEngineProxy::getCurrentMonotonicTimeInMs() - { - if (RtcEngine != nullptr) { - return RtcEngine->getCurrentMonotonicTimeInMs(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::sendCustomReportMessage(char const* id, char const* category, char const* event, char const* label, int value) { - if (RtcEngine != nullptr) { - return RtcEngine->sendCustomReportMessage(id, category, event, label, value); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::registerMediaMetadataObserver(agora::rtc::IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) { - if (RtcEngine != nullptr) { - return RtcEngine->registerMediaMetadataObserver(observer, type); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::unregisterMediaMetadataObserver(agora::rtc::IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) { - if (RtcEngine != nullptr) { - return RtcEngine->unregisterMediaMetadataObserver(observer, type); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startAudioFrameDump(char const* channel_id, agora::rtc::uid_t user_id, char const* location, char const* uuid, char const* passwd, long duration_ms, bool auto_upload) { - if (RtcEngine != nullptr) { - return RtcEngine->startAudioFrameDump(channel_id, user_id, location, uuid, passwd, duration_ms, auto_upload); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopAudioFrameDump(char const* channel_id, agora::rtc::uid_t user_id, char const* location) { - if (RtcEngine != nullptr) { - return RtcEngine->stopAudioFrameDump(channel_id, user_id, location); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::setAINSMode(bool enabled, AUDIO_AINS_MODE mode) - { - if (RtcEngine != nullptr) { - return RtcEngine->setAINSMode(enabled, mode); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::registerLocalUserAccount(char const* appId, char const* userAccount) { - if (RtcEngine != nullptr) { - return RtcEngine->registerLocalUserAccount(appId, userAccount); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::joinChannelWithUserAccount(char const* token, char const* channelId, char const* userAccount) { - if (RtcEngine != nullptr) { - return RtcEngine->joinChannelWithUserAccount(token, channelId, userAccount); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::joinChannelWithUserAccount(char const* token, char const* channelId, char const* userAccount, agora::rtc::ChannelMediaOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->joinChannelWithUserAccount(token, channelId, userAccount, options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::joinChannelWithUserAccountEx(char const* token, char const* channelId, char const* userAccount, agora::rtc::ChannelMediaOptions const& options, agora::rtc::IRtcEngineEventHandler* eventHandler) { - if (RtcEngine != nullptr) { - return RtcEngine->joinChannelWithUserAccountEx(token, channelId, userAccount, options, eventHandler); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getUserInfoByUserAccount(char const* userAccount, rtc::UserInfo* userInfo) { - if (RtcEngine != nullptr) { - return RtcEngine->getUserInfoByUserAccount(userAccount, userInfo); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getUserInfoByUid(agora::rtc::uid_t uid, rtc::UserInfo* userInfo) { - if (RtcEngine != nullptr) { - return RtcEngine->getUserInfoByUid(uid, userInfo); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::startOrUpdateChannelMediaRelay(const ChannelMediaRelayConfiguration& configuration) - { - if (RtcEngine != nullptr) { - return RtcEngine->startOrUpdateChannelMediaRelay(configuration); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startChannelMediaRelay(agora::rtc::ChannelMediaRelayConfiguration const& configuration) { - if (RtcEngine != nullptr) { - return RtcEngine->startChannelMediaRelay(configuration); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateChannelMediaRelay(agora::rtc::ChannelMediaRelayConfiguration const& configuration) { - if (RtcEngine != nullptr) { - return RtcEngine->updateChannelMediaRelay(configuration); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopChannelMediaRelay() { - if (RtcEngine != nullptr) { - return RtcEngine->stopChannelMediaRelay(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::pauseAllChannelMediaRelay() { - if (RtcEngine != nullptr) { - return RtcEngine->pauseAllChannelMediaRelay(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::resumeAllChannelMediaRelay() { - if (RtcEngine != nullptr) { - return RtcEngine->resumeAllChannelMediaRelay(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setDirectCdnStreamingAudioConfiguration(agora::rtc::AUDIO_PROFILE_TYPE profile) { - if (RtcEngine != nullptr) { - return RtcEngine->setDirectCdnStreamingAudioConfiguration(profile); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setDirectCdnStreamingVideoConfiguration(agora::rtc::VideoEncoderConfiguration const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->setDirectCdnStreamingVideoConfiguration(config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startDirectCdnStreaming(agora::rtc::IDirectCdnStreamingEventHandler* eventHandler, char const* publishUrl, agora::rtc::DirectCdnStreamingMediaOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->startDirectCdnStreaming(eventHandler, publishUrl, options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopDirectCdnStreaming() { - if (RtcEngine != nullptr) { - return RtcEngine->stopDirectCdnStreaming(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateDirectCdnStreamingMediaOptions(agora::rtc::DirectCdnStreamingMediaOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->updateDirectCdnStreamingMediaOptions(options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startRhythmPlayer(char const* sound1, char const* sound2, agora::rtc::AgoraRhythmPlayerConfig const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->startRhythmPlayer(sound1, sound2, config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopRhythmPlayer() { - if (RtcEngine != nullptr) { - return RtcEngine->stopRhythmPlayer(); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::configRhythmPlayer(agora::rtc::AgoraRhythmPlayerConfig const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->configRhythmPlayer(config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::takeSnapshot(agora::rtc::uid_t uid, char const* filePath) { - if (RtcEngine != nullptr) { - return RtcEngine->takeSnapshot(uid, filePath); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableContentInspect(bool enabled, media::ContentInspectConfig const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->enableContentInspect(enabled, config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustCustomAudioPublishVolume(track_id_t trackId, int volume) - { - if (RtcEngine != nullptr) { - return RtcEngine->adjustCustomAudioPublishVolume(trackId, volume); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::adjustCustomAudioPlayoutVolume(track_id_t trackId, int volume) - { - if (RtcEngine != nullptr) { - return RtcEngine->adjustCustomAudioPlayoutVolume(trackId, volume); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setCloudProxy(agora::rtc::CLOUD_PROXY_TYPE proxyType) { - if (RtcEngine != nullptr) { - return RtcEngine->setCloudProxy(proxyType); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setLocalAccessPoint(agora::rtc::LocalAccessPointConfiguration const& config) { - if (RtcEngine != nullptr) { - return RtcEngine->setLocalAccessPoint(config); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::setAVSyncSource(char const* channelId, agora::rtc::uid_t uid) { - if (RtcEngine != nullptr) { - return RtcEngine->setAVSyncSource(channelId, uid); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableVideoImageSource(bool enable, agora::rtc::ImageTrackOptions const& options) { - if (RtcEngine != nullptr) { - return RtcEngine->enableVideoImageSource(enable, options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::joinChannelEx(char const* token, agora::rtc::RtcConnection const& connection, agora::rtc::ChannelMediaOptions const& options, agora::rtc::IRtcEngineEventHandler* eventHandler) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->joinChannelEx(token, connection, options, eventHandler); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::leaveChannelEx(agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->leaveChannelEx(connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::leaveChannelEx(const RtcConnection& connection, const LeaveChannelOptions& options) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->leaveChannelEx(connection, options); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteLocalAudioStreamEx(bool mute, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->muteLocalAudioStreamEx(mute, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteLocalVideoStreamEx(bool mute, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->muteLocalVideoStreamEx(mute, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteAllRemoteAudioStreamsEx(bool mute, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->muteAllRemoteAudioStreamsEx(mute, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteAllRemoteVideoStreamsEx(bool mute, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->muteAllRemoteVideoStreamsEx(mute, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setSubscribeAudioBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setSubscribeAudioBlocklistEx(uidList, uidNumber, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setSubscribeAudioAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setSubscribeAudioAllowlistEx(uidList, uidNumber, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setSubscribeVideoBlocklistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setSubscribeVideoBlocklistEx(uidList, uidNumber, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setSubscribeVideoAllowlistEx(uid_t* uidList, int uidNumber, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setSubscribeVideoAllowlistEx(uidList, uidNumber, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::adjustUserPlaybackSignalVolumeEx(unsigned int uid, int volume, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->adjustUserPlaybackSignalVolumeEx(uid, volume, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startRtmpStreamWithoutTranscodingEx(const char* url, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->startRtmpStreamWithoutTranscodingEx(url, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startRtmpStreamWithTranscodingEx(const char* url, const LiveTranscoding& transcoding, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->startRtmpStreamWithTranscodingEx(url, transcoding, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateRtmpTranscodingEx(const LiveTranscoding& transcoding, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->updateRtmpTranscodingEx(transcoding, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopRtmpStreamEx(const char* url, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->stopRtmpStreamEx(url, connection); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::startOrUpdateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->startOrUpdateChannelMediaRelayEx(configuration, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->startChannelMediaRelayEx(configuration, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->updateChannelMediaRelayEx(configuration, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::stopChannelMediaRelayEx(const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->stopChannelMediaRelayEx(connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::pauseAllChannelMediaRelayEx(const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->stopChannelMediaRelayEx(connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::resumeAllChannelMediaRelayEx(const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->resumeAllChannelMediaRelayEx(connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableDualStreamModeEx(bool enabled, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->enableDualStreamModeEx(enabled, streamConfig, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setDualStreamModeEx(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setDualStreamModeEx(mode, streamConfig, connection); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::setHighPriorityUserListEx(uid_t* uidList, int uidNum, STREAM_FALLBACK_OPTIONS option, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setHighPriorityUserListEx(uidList, uidNum, option, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::updateChannelMediaOptionsEx(agora::rtc::ChannelMediaOptions const& options, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->updateChannelMediaOptionsEx(options, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setVideoEncoderConfigurationEx(agora::rtc::VideoEncoderConfiguration const& config, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setVideoEncoderConfigurationEx(config, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setupRemoteVideoEx(agora::rtc::VideoCanvas const& canvas, agora::rtc::RtcConnection const& connection) { -#if AGORA_UESDK_ENABLE_VIDEO - if (RtcEngine != nullptr) { - if (canvas.view != nullptr) { - VideoRenderMgr->setRenderImage((UImage*)canvas.view, canvas.uid, connection.channelId, canvas.sourceType); - } - else { - VideoRenderMgr->releaseVideoRender(canvas.uid, connection.channelId, canvas.sourceType); - } - return -ERROR_OK; - } -#endif - return -ERROR_NULLPTR; - } - int RtcEngineProxy::muteRemoteAudioStreamEx(agora::rtc::uid_t uid, bool mute, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->muteRemoteAudioStreamEx(uid, mute, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::muteRemoteVideoStreamEx(agora::rtc::uid_t uid, bool mute, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->muteRemoteVideoStreamEx(uid, mute, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteVideoStreamTypeEx(agora::rtc::uid_t uid, agora::rtc::VIDEO_STREAM_TYPE streamType, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setRemoteVideoStreamTypeEx(uid, streamType, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteVideoSubscriptionOptionsEx(agora::rtc::uid_t uid, agora::rtc::VideoSubscriptionOptions const& options, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setRemoteVideoSubscriptionOptionsEx(uid, options, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteVoicePositionEx(agora::rtc::uid_t uid, double pan, double gain, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setRemoteVoicePositionEx(uid, pan, gain, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteUserSpatialAudioParamsEx(agora::rtc::uid_t uid, agora::SpatialAudioParams const& params, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setRemoteUserSpatialAudioParamsEx(uid, params, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::setRemoteRenderModeEx(agora::rtc::uid_t uid, media::base::RENDER_MODE_TYPE renderMode, agora::rtc::VIDEO_MIRROR_MODE_TYPE mirrorMode, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->setRemoteRenderModeEx(uid, renderMode, mirrorMode, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableLoopbackRecordingEx(agora::rtc::RtcConnection const& connection, bool enabled, char const* deviceName) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->enableLoopbackRecordingEx(connection, enabled, deviceName); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::adjustRecordingSignalVolumeEx(int volume, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->adjustRecordingSignalVolumeEx(volume, connection); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::muteRecordingSignalEx(bool mute, const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->muteRecordingSignalEx(mute, connection); - } - return -ERROR_NULLPTR; - } - - agora::rtc::CONNECTION_STATE_TYPE RtcEngineProxy::getConnectionStateEx(agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->getConnectionStateEx(connection); - } - return agora::rtc::CONNECTION_STATE_TYPE::CONNECTION_STATE_FAILED; - } - - int RtcEngineProxy::enableEncryptionEx(agora::rtc::RtcConnection const& connection, bool enabled, agora::rtc::EncryptionConfig const& config) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->enableEncryptionEx(connection, enabled, config); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::createDataStreamEx(int* streamId, bool reliable, bool ordered, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->createDataStreamEx(streamId, reliable, ordered, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::createDataStreamEx(int* streamId, agora::rtc::DataStreamConfig& config, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->createDataStreamEx(streamId, config, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::sendStreamMessageEx(int streamId, char const* data, size_t length, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->sendStreamMessageEx(streamId, data, length, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::addVideoWatermarkEx(char const* watermarkUrl, agora::rtc::WatermarkOptions const& options, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->addVideoWatermarkEx(watermarkUrl, options, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::clearVideoWatermarkEx(agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->clearVideoWatermarkEx(connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::sendCustomReportMessageEx(char const* id, char const* category, char const* event, char const* label, int value, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->sendCustomReportMessageEx(id, category, event, label, value, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableAudioVolumeIndicationEx(int interval, int smooth, bool reportVad, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->enableAudioVolumeIndicationEx(interval, smooth, reportVad, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getUserInfoByUserAccountEx(char const* userAccount, rtc::UserInfo* userInfo, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->getUserInfoByUserAccountEx(userAccount, userInfo, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::getUserInfoByUidEx(agora::rtc::uid_t uid, rtc::UserInfo* userInfo, agora::rtc::RtcConnection const& connection) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->getUserInfoByUidEx(uid, userInfo, connection); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::enableWirelessAccelerate(bool enabled) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->enableWirelessAccelerate(enabled); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::takeSnapshotEx(agora::rtc::RtcConnection const& connection, agora::rtc::uid_t uid, char const* filePath) { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->takeSnapshotEx(connection, uid, filePath); - } - return -ERROR_NULLPTR; - } - - int RtcEngineProxy::startMediaRenderingTracingEx(const RtcConnection& connection) - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->startMediaRenderingTracingEx(connection); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::startMediaRenderingTracing() - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->startMediaRenderingTracing(); - } - return -ERROR_NULLPTR; - } - - - int RtcEngineProxy::enableInstantMediaRendering() - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->enableInstantMediaRendering(); - } - return -ERROR_NULLPTR; - } - - - uint64_t RtcEngineProxy::getNtpWallTimeInMs() - { - if (RtcEngine != nullptr) { - return ((IRtcEngineEx*)RtcEngine)->getNtpWallTimeInMs(); - } - return -ERROR_NULLPTR; - } - - } - } -} - - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/UnrealMemory.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/UnrealMemory.cpp similarity index 94% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/UnrealMemory.cpp rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/UnrealMemory.cpp index 57fce37f..2a2d529b 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/UnrealMemory.cpp +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/UnrealMemory.cpp @@ -2,8 +2,11 @@ #include "UnrealMemory.h" + +#if USE_ANSI_ALLOCATOR && AG_UE_5_3_OR_LATER #include "src/Core/util/Macros.h" #include "src/Core/util/ConfigureVectorization.h" +#endif #if USE_ANSI_ALLOCATOR && AG_UE_5_3_OR_LATER diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoObserverInternal.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoObserverInternal.cpp deleted file mode 100644 index aa45beb6..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoObserverInternal.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "AgoraCppPlugin/include/VideoObserverInternal.h" - -namespace agora { - namespace rtc { - namespace ue { - - VideoObserverInternal::VideoObserverInternal(media::IVideoFrameObserver* observer, ICacheManager* cache) - { - AacheManager = cache; - UserObserver = observer; - - } - - VideoObserverInternal::~VideoObserverInternal() - { - - } - - bool VideoObserverInternal::onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, VideoFrame& videoFrame) - { - VideoFrameIdentity config{ sourceType, 0, "" }; - setVideoFrame(&config, &videoFrame); - if (UserObserver != nullptr) UserObserver->onCaptureVideoFrame(sourceType, videoFrame); - return true; - } - - bool VideoObserverInternal::onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, VideoFrame& videoFrame) - { - VideoFrameIdentity config{ sourceType, 0, "" }; - setVideoFrame(&config, &videoFrame); - if (UserObserver != nullptr) UserObserver->onPreEncodeVideoFrame(sourceType, videoFrame); - return true; - } - - - bool VideoObserverInternal::onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) - { - unsigned int MediaplayId = (unsigned int)mediaPlayerId; - - VideoFrameIdentity config{ VIDEO_SOURCE_MEDIA_PLAYER,MediaplayId, "" }; - setVideoFrame(&config, &videoFrame); - if (UserObserver != nullptr) UserObserver->onMediaPlayerVideoFrame(videoFrame, mediaPlayerId); - return true; - } - - bool VideoObserverInternal::onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame) - { - VideoFrameIdentity config{ VIDEO_SOURCE_REMOTE, remoteUid, channelId }; - setVideoFrame(&config, &videoFrame); - if (UserObserver != nullptr) UserObserver->onRenderVideoFrame(channelId, remoteUid, videoFrame); - return true; - } - - bool VideoObserverInternal::onTranscodedVideoFrame(VideoFrame& videoFrame) - { - VideoFrameIdentity config{ VIDEO_SOURCE_TRANSCODED, 0, "" }; - - setVideoFrame(&config, &videoFrame); - if (UserObserver != nullptr) UserObserver->onTranscodedVideoFrame(videoFrame); - return true; - } - - agora::media::IVideoFrameObserver::VIDEO_FRAME_PROCESS_MODE VideoObserverInternal::getVideoFrameProcessMode() - { - return PROCESS_MODE_READ_ONLY; - } - - agora::media::base::VIDEO_PIXEL_FORMAT VideoObserverInternal::getVideoFormatPreference() - { - return agora::media::base::VIDEO_PIXEL_RGBA; - } - - bool VideoObserverInternal::getRotationApplied() - { - return true; - } - - - bool VideoObserverInternal::getMirrorApplied() - { - return false; - } - - uint32_t VideoObserverInternal::getObservedFramePosition() - { - return agora::media::base::POSITION_POST_CAPTURER | agora::media::base::POSITION_PRE_RENDERER; - } - - bool VideoObserverInternal::isExternal() - { - return true; - } - - void VideoObserverInternal::setVideoFrame(VideoFrameIdentity* identity, VideoFrame* frame) - { - if (AacheManager) { - AacheManager->pushVideo(identity, frame); - } - } - - void VideoObserverInternal::registerVideoFrameObserver(media::IVideoFrameObserver* observer) - { - UserObserver = observer; - } - - - } //namespace ue - } // namespace rtc -} //namespace agora - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender.cpp deleted file mode 100644 index 93163a02..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "AgoraCppPlugin/include/VideoRender.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "AgoraCppPlugin/include/RtcEngineProxy.h" -#include "AgoraCppPlugin/include/VideoObserverInternal.h" -namespace agora { - namespace rtc { - namespace ue { - VideoRender::VideoRender(ICacheManager* CacheManager) :RenderFrameId(VIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA, 0, "") - { - RenderTexture = nullptr; - RenderVideoFrame = nullptr; - RenderImage = nullptr; - VideoCacheManager = CacheManager; - bEnableUpdatePreview = false; - ArgbPixSize = 4; - } - - VideoRender::~VideoRender() - { - UE_LOG(LogTemp, Warning, TEXT("~VideoRender")); - VideoCacheManager->clear(&RenderFrameId); - RenderVideoFrame = nullptr; - RenderImage = nullptr; - } - - void VideoRender::onTick() - { - if (RenderImage == nullptr || bEnableUpdatePreview) { - return; - } - int re = getVideoFrame(&RenderFrameId, RenderVideoFrame); - if (re != ERROR_OK) { - return; - } - if (!RenderVideoFrame) { - return; - } - if (RenderTexture == nullptr || !RenderTexture->IsValidLowLevel() || RenderTexture->GetSizeX() != RenderVideoFrame->width || RenderTexture->GetSizeY() != RenderVideoFrame->height) { - - RenderTexture = UTexture2D::CreateTransient(RenderVideoFrame->width, RenderVideoFrame->height, PF_R8G8B8A8); - } - else - { - UTexture2D* tex = (UTexture2D*)RenderTexture; - - uint8* raw = (uint8*)tex->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); - memcpy(raw, RenderVideoFrame->yBuffer, RenderVideoFrame->height * RenderVideoFrame->width * 4); - tex->PlatformData->Mips[0].BulkData.Unlock(); - tex->UpdateResource(); - RenderBrush.SetResourceObject(tex); - if (RenderImage != nullptr) { - RenderImage->SetBrush(RenderBrush); - } - } - //_texture->UpdateTextureRegions(0, 1, _region.get(), videoFrame_->yStride, (uint32)argbPixSize, static_cast(videoFrame_->yBuffer)); - } - - void VideoRender::enableVideoFrameIdentity(UImage* Image, VideoFrameIdentity VideoFrameId) - { - this->RenderImage = Image; - RenderFrameId = VideoFrameId; - VideoCacheManager->enableVideoFrameObserver(&RenderFrameId); - bEnableUpdatePreview = false; - } - - int VideoRender::getVideoFrame(const VideoFrameIdentity* Identity, VideoFrame*& Frame) - { - int ret = VideoCacheManager->popVideo(Identity, Frame); - if (ret != 0) { - return ret; - } - return ERROR_OK; - } - } - } -} - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/AgoraUEVideoFrameObserver.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/AgoraUEVideoFrameObserver.cpp new file mode 100644 index 00000000..9f8e5c98 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/AgoraUEVideoFrameObserver.cpp @@ -0,0 +1,120 @@ +#if AGORA_UESDK_ENABLE_VIDEO + +#include "AgoraUEVideoFrameObserver.h" +#include "DataTypes.h" +#include "VideoFrameDataManager.h" + +namespace agora { + namespace rtc { + namespace ue { + + AgoraUEVideoFrameObserver::AgoraUEVideoFrameObserver(media::IVideoFrameObserver* observer) + { + _NativeAgoraVideoObserver = observer; + } + + AgoraUEVideoFrameObserver::~AgoraUEVideoFrameObserver() + { + _NativeAgoraVideoObserver = nullptr; + } + +#pragma region Overrride Agora Native Methods + + bool AgoraUEVideoFrameObserver::onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, VideoFrame& videoFrame) + { + VideoFrameDataManager::Get()->PushVideoFrame({ sourceType, 0, "" }, &videoFrame); + + // trigger native observer if it has been set + if(_NativeAgoraVideoObserver != nullptr){ + _NativeAgoraVideoObserver->onCaptureVideoFrame(sourceType,videoFrame); + } + + return true; + } + + bool AgoraUEVideoFrameObserver::onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, VideoFrame& videoFrame) + { + VideoFrameDataManager::Get()->PushVideoFrame({ sourceType, 0, "" }, &videoFrame); + + // trigger native observer if it has been set + if (_NativeAgoraVideoObserver != nullptr) { + _NativeAgoraVideoObserver->onPreEncodeVideoFrame(sourceType, videoFrame); + } + + return true; + } + + bool AgoraUEVideoFrameObserver::onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) + { + VideoFrameDataManager::Get()->PushVideoFrame({ VIDEO_SOURCE_MEDIA_PLAYER,static_cast(mediaPlayerId),""}, &videoFrame); + + // trigger native observer if it has been set + if (_NativeAgoraVideoObserver != nullptr) { + _NativeAgoraVideoObserver->onMediaPlayerVideoFrame(videoFrame, mediaPlayerId); + } + + return true; + } + + bool AgoraUEVideoFrameObserver::onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame) + { + VideoFrameDataManager::Get()->PushVideoFrame({ VIDEO_SOURCE_REMOTE,remoteUid,channelId}, &videoFrame); + + // trigger native observer if it has been set + if (_NativeAgoraVideoObserver != nullptr) { + _NativeAgoraVideoObserver->onRenderVideoFrame(channelId, remoteUid, videoFrame); + } + + return true; + } + + bool AgoraUEVideoFrameObserver::onTranscodedVideoFrame(VideoFrame& videoFrame) + { + VideoFrameDataManager::Get()->PushVideoFrame({ VIDEO_SOURCE_TRANSCODED,0,""}, &videoFrame); + + // trigger native observer if it has been set + if (_NativeAgoraVideoObserver != nullptr) { + _NativeAgoraVideoObserver->onTranscodedVideoFrame(videoFrame); + } + + return true; + } + + agora::media::IVideoFrameObserver::VIDEO_FRAME_PROCESS_MODE AgoraUEVideoFrameObserver::getVideoFrameProcessMode() + { + return PROCESS_MODE_READ_ONLY; + } + + agora::media::base::VIDEO_PIXEL_FORMAT AgoraUEVideoFrameObserver::getVideoFormatPreference() + { + return agora::media::base::VIDEO_PIXEL_RGBA; + } + + bool AgoraUEVideoFrameObserver::getRotationApplied() + { + return true; + } + + bool AgoraUEVideoFrameObserver::getMirrorApplied() + { + return false; + } + + uint32_t AgoraUEVideoFrameObserver::getObservedFramePosition() + { + return agora::media::base::POSITION_POST_CAPTURER | agora::media::base::POSITION_PRE_RENDERER; + } + + bool AgoraUEVideoFrameObserver::isExternal() + { + return true; + } + +#pragma endregion Overrride Agora Native Methods + + } + } +} + +#endif + diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameDataManager.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameDataManager.cpp new file mode 100644 index 00000000..2540bc3b --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameDataManager.cpp @@ -0,0 +1,230 @@ +#if AGORA_UESDK_ENABLE_VIDEO + +#include "VideoFrameDataManager.h" + +namespace agora { + namespace rtc { + namespace ue { + +#pragma region VideoFrameBuffer + + void VideoFrameBuffer::_ClearOneBuffer(VideoFrame* BufferFrame) + { + if (BufferFrame) { + FMemory::Free(BufferFrame->yBuffer); + delete BufferFrame; + BufferFrame = nullptr; + } + } + + int VideoFrameBuffer::_CopyOneFrameToBuffer(VideoFrame* SrcFrame, VideoFrame* DstFrameBuffer) + { + if (SrcFrame == nullptr) { + return AGORA_UE_ERR_CODE(ERROR_RENDER_NULL_FRAME); + } + + if(DstFrameBuffer == nullptr){ + return AGORA_UE_ERR_CODE(ERROR_RENDER_NULL_BUFFER); + } + + // make sure DstFrameBuffer has the same size as SrcFrame + int SrcWidth = SrcFrame->width; + int SrcHeight = SrcFrame->height; + int TotalBytes = SrcWidth * SrcHeight * 4; + + // Empty + if (DstFrameBuffer->yBuffer == nullptr) { + DstFrameBuffer->yBuffer = static_cast(FMemory::Malloc(TotalBytes)); + } + + int DstBufferWidth = DstFrameBuffer->width; + int DstBufferHeight = DstFrameBuffer->height; + + // Or Different Size + if (SrcWidth != DstBufferWidth || SrcHeight != DstBufferHeight) { + + DstFrameBuffer->yBuffer = static_cast(FMemory::Realloc(DstFrameBuffer->yBuffer, TotalBytes)); + } + + FMemory::Memcpy(DstFrameBuffer->yBuffer,SrcFrame->yBuffer, TotalBytes); + + DstFrameBuffer->width = SrcFrame->width; + DstFrameBuffer->height = SrcFrame->height; + DstFrameBuffer->yStride = SrcFrame->yStride; + + return AGORA_UE_ERR_CODE(ERROR_OK); + } + + + VideoFrameBuffer::VideoFrameBuffer() + { + FrontBufferFrame = nullptr; + BackBufferFrame = nullptr; + Init(); + } + + VideoFrameBuffer::~VideoFrameBuffer(){ + Clear(); + } + + void VideoFrameBuffer::Init() + { + if (FrontBufferFrame == nullptr) { + FrontBufferFrame = new VideoFrame(); + FrontBufferFrame->yBuffer = nullptr; + } + + if (BackBufferFrame == nullptr) { + BackBufferFrame = new VideoFrame(); + BackBufferFrame->yBuffer = nullptr; + } + + IsUpdating = false; + HasData = false; + IsFirstPop = true; + } + + int VideoFrameBuffer::Push(VideoFrame* Frame) + { + if (!IsUpdating) { + return AGORA_UE_ERR_CODE(ERROR_RENDER_BUFFER_STOP_UPDATEING); + } + + _CopyOneFrameToBuffer(Frame, BackBufferFrame); + HasData = true; + + return AGORA_UE_ERR_CODE(ERROR_OK); + } + + int VideoFrameBuffer::Pop(VideoFrame*& Frame) + { + if (HasData) { + _Swap(); + //_ClearOneBuffer(BackBufferFrame); + HasData = false; + Frame = FrontBufferFrame; + + return AGORA_UE_ERR_CODE(ERROR_OK); + } + + return AGORA_UE_ERR_CODE(ERROR_RENDER_NO_NEW_FRAME_DATA); + } + + void VideoFrameBuffer::Clear() + { + _ClearOneBuffer(FrontBufferFrame); + _ClearOneBuffer(BackBufferFrame); + IsUpdating = false; + HasData = false; + IsFirstPop = true; + } + + + + void VideoFrameBuffer::_Swap() + { + VideoFrame* Temp = FrontBufferFrame; + FrontBufferFrame = BackBufferFrame; + BackBufferFrame = Temp; + } + +#pragma endregion VideoFrameBuffer + + + + #pragma region VideoFrameDataManager + + + VideoFrameDataManager* VideoFrameDataManager::VideoFrameDataManagerInstance = nullptr; + + void VideoFrameDataManager::StartUpdatingOneVideoBuffer(const VideoFrameId& FrameId) + { + FScopeLock Lock(&_CriticalSection); + if (DataMapVideoFrameBuffers.Contains(FrameId)) { + DataMapVideoFrameBuffers[FrameId]->SetStartUpdatingStatus(true); + } + else{ + VideoFrameBuffer* Buffer = new VideoFrameBuffer(); + DataMapVideoFrameBuffers.Add(FrameId, Buffer); + Buffer->SetStartUpdatingStatus(true); + } + } + + void VideoFrameDataManager::StopUpdatingOneVideoBuffer(const VideoFrameId& FrameId) + { + FScopeLock Lock(&_CriticalSection); + if (DataMapVideoFrameBuffers.Contains(FrameId)) { + DataMapVideoFrameBuffers[FrameId]->SetStartUpdatingStatus(false); + } + } + + agora::rtc::ue::VideoFrameDataManager* VideoFrameDataManager::Get() + { + if(VideoFrameDataManagerInstance == nullptr){ + VideoFrameDataManagerInstance = new VideoFrameDataManager(); + } + return VideoFrameDataManagerInstance; + } + + void VideoFrameDataManager::Release() + { + if (VideoFrameDataManagerInstance) { + VideoFrameDataManagerInstance->ClearAll(); + delete VideoFrameDataManagerInstance; + VideoFrameDataManagerInstance = nullptr; + } + } + + int VideoFrameDataManager::PushVideoFrame(const VideoFrameId& FrameId, VideoFrame* Frame) + { + FScopeLock Lock(&_CriticalSection); + + if(Frame == nullptr){ + return AGORA_UE_ERR_CODE(ERROR_RENDER_NULL_FRAME); + } + + if (!DataMapVideoFrameBuffers.Contains(FrameId)){ + return AGORA_UE_ERR_CODE(ERROR_RENDER_NULL_BUFFER); + } + + int ret = DataMapVideoFrameBuffers[FrameId]->Push(Frame); + return ret; + } + + int VideoFrameDataManager::PopVideoFrame(const VideoFrameId& FrameId, VideoFrame*& Frame) + { + FScopeLock Lock(&_CriticalSection); + + // Frame would be nullptr, no need to check + //if (Frame == nullptr) { + // return AGORA_UE_ERR_CODE(ERROR_RENDER_NULL_FRAME); + //} + + if (!DataMapVideoFrameBuffers.Contains(FrameId)) { + return AGORA_UE_ERR_CODE(ERROR_RENDER_NULL_BUFFER); + } + + int ret = DataMapVideoFrameBuffers[FrameId]->Pop(Frame); + + return ret; + } + + void VideoFrameDataManager::ClearAll() + { + FScopeLock Lock(&_CriticalSection); + + for (auto& OneVideoBuffer : DataMapVideoFrameBuffers) { + OneVideoBuffer.Value->Clear(); + delete OneVideoBuffer.Value; + } + DataMapVideoFrameBuffers.Empty(); + } + +#pragma endregion VideoFrameDataManager + + + } + } +} + +#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameRender.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameRender.cpp new file mode 100644 index 00000000..26e76f89 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameRender.cpp @@ -0,0 +1,112 @@ +#if AGORA_UESDK_ENABLE_VIDEO + +#include "VideoFrameRender.h" + +#include "AgoraHeaderBase.h" +#include "VideoFrameDataManager.h" + +#include "Components/Image.h" +#include "Engine/Texture2D.h" + +#include "Components/CanvasPanelSlot.h" + + +namespace agora { + namespace rtc { + namespace ue { + + VideoFrameRender::VideoFrameRender() + { + + } + + VideoFrameRender::~VideoFrameRender() + { + + } + + void VideoFrameRender::Init(const VideoFrameId& FrameId) + { + RenderTexture = nullptr; + _VideoFrameId = FrameId; + VideoFrameDataManager::Get()->StartUpdatingOneVideoBuffer(_VideoFrameId); + } + + void VideoFrameRender::Clear() + { + VideoFrameDataManager::Get()->StopUpdatingOneVideoBuffer(_VideoFrameId); + } + + void VideoFrameRender::OnTick() + { + VideoFrame* RenderVideoFrame = nullptr; + int ret = VideoFrameDataManager::Get()->PopVideoFrame(_VideoFrameId,RenderVideoFrame); + + if(AGORA_GET_ERR_TYPE(ret) != AGORA_UE_ERROR_CODE::ERROR_OK) + return; + + if (RenderVideoFrame != nullptr) { + CopyToTexture2D(RenderVideoFrame); + + if (RenderImage != nullptr) + { + UpdateImage(); + } + } + } + + void VideoFrameRender::SetRenderImage(UImage* Image) + { + RenderImage = Image; + } + + void VideoFrameRender::InitTexture2D(int Width, int Height) + { + if (RenderTexture == nullptr || !RenderTexture->IsValidLowLevel() || RenderTexture->GetSizeX() != Width || RenderTexture->GetSizeY() != Height) { + + RenderTexture = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8); + } + } + + void VideoFrameRender::CopyToTexture2D(VideoFrame* RenderFrame) + { + InitTexture2D(RenderFrame->width, RenderFrame->height); + +#if AG_UE5_OR_LATER + uint8* RawData = (uint8*)RenderTexture->GetPlatformData()->Mips[0].BulkData.Lock(LOCK_READ_WRITE); + FMemory::Memcpy(RawData, RenderFrame->yBuffer, RenderFrame->height * RenderFrame->width * 4); + RenderTexture->GetPlatformData()->Mips[0].BulkData.Unlock(); + RenderTexture->UpdateResource(); +#else + uint8* RawData = (uint8*)RenderTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); + FMemory::Memcpy(RawData, RenderFrame->yBuffer, RenderFrame->height * RenderFrame->width * 4); + RenderTexture->PlatformData->Mips[0].BulkData.Unlock(); + RenderTexture->UpdateResource(); + +#endif + + + } + + void VideoFrameRender::UpdateImage() + { + if (RenderImage != nullptr) { + int Width = RenderTexture->GetSizeX(); + int Height = RenderTexture->GetSizeY(); + + FSlateBrush RenderBrush; + RenderBrush.SetResourceObject(RenderTexture); + RenderBrush.SetImageSize(FVector2D( + Width, + Height + )); + RenderImage->SetBrush(RenderBrush); + + } + } + + } + } +} + +#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameRenderManager.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameRenderManager.cpp new file mode 100644 index 00000000..ee965ea9 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRender/VideoFrameRenderManager.cpp @@ -0,0 +1,57 @@ +#if AGORA_UESDK_ENABLE_VIDEO + +#include "VideoFrameRenderManager.h" +#include "VideoFrameRender.h" +namespace agora { + namespace rtc { + namespace ue { + + void VideoFrameRenderManager::AddOneRender(UImage* RenderImage, VIDEO_SOURCE_TYPE SourceType, const char* ChannelId, uid_t Uid) + { + VideoFrameId _VideoFrameId = { SourceType,Uid,ChannelId }; + + if (DataMapVideoRenders.Contains(_VideoFrameId)) + { + DataMapVideoRenders[_VideoFrameId]->SetRenderImage(RenderImage); + } + else + { + TSharedPtr _VideoFrameRender = MakeShareable(new VideoFrameRender()); + _VideoFrameRender->Init(_VideoFrameId); + _VideoFrameRender->SetRenderImage(RenderImage); + DataMapVideoRenders.Add(_VideoFrameId, _VideoFrameRender); + } + } + + void VideoFrameRenderManager::ReleaseOneRender(VIDEO_SOURCE_TYPE SourceType, const char* ChannelId, uid_t Uid) + { + VideoFrameId FrameId = { SourceType,Uid,ChannelId }; + + if (DataMapVideoRenders.Contains(FrameId)) + { + DataMapVideoRenders[FrameId]->Clear(); + DataMapVideoRenders.Remove(FrameId); + } + } + + void VideoFrameRenderManager::ReleaseAll() + { + for (auto& OneVideoRender : DataMapVideoRenders) + { + OneVideoRender.Value->Clear(); + } + DataMapVideoRenders.Empty(); + } + + void VideoFrameRenderManager::Tick(float DeltaTime) + { + for (auto& OneVideoRender : DataMapVideoRenders) + { + OneVideoRender.Value->OnTick(); + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRenderManager.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRenderManager.cpp deleted file mode 100644 index 0e875c9d..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/VideoRenderManager.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "AgoraCppPlugin/include/VideoRenderManager.h" - -namespace agora { - namespace rtc { - namespace ue { - - VideoRenderManager::VideoRenderManager() - { - - } - - VideoRenderManager::~VideoRenderManager() - { - releaseAllVideoRender(); - } - - void VideoRenderManager::Tick(float DeltaTime) - { - //std::lock_guard lock(VideoRenderMutex); - for (VideoRenderIter = VideoRenderMap.begin(); VideoRenderIter != VideoRenderMap.end(); VideoRenderIter++) - { - if (VideoRenderIter->second != nullptr) - { - VideoRenderIter->second->onTick(); - } - } - } - - void VideoRenderManager::setRenderImage(UImage* RenderImage, unsigned int Uid, const char* ChannelId, VIDEO_SOURCE_TYPE SourceType) - { - VideoFrameIdentity VideoFrameId(SourceType, Uid, ChannelId); - //std::lock_guard lock(VideoRenderMutex); - auto it = VideoRenderMap.find(VideoFrameId); - if (it == VideoRenderMap.end()) { - TSharedPtr videoRender = MakeShareable(new VideoRender(DataManager::getInstance()->getCacheManager())); - VideoRenderMap[VideoFrameId] = videoRender; - videoRender->enableVideoFrameIdentity(RenderImage, VideoFrameId); - } - else { - it->second->enableVideoFrameIdentity(RenderImage, VideoFrameId); - } - } - - void VideoRenderManager::releaseVideoRender(unsigned int Uid, const char* ChannelId, VIDEO_SOURCE_TYPE SourceType) - { - VideoFrameIdentity VideoFrameId(SourceType, Uid, ChannelId); - //std::lock_guard lock(VideoRenderMutex); - auto it = VideoRenderMap.find(VideoFrameId); - if (it != VideoRenderMap.end()) { - VideoRenderMap[VideoFrameId].Reset(); - VideoRenderMap.erase(it); - } - } - - void VideoRenderManager::releaseAllVideoRender() - { - //std::lock_guard lock(VideoRenderMutex); - VideoRenderMap.clear(); - } - - TStatId VideoRenderManager::GetStatId() const - { - return TStatId(); - } - } - } -} - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/AgoraHeaderBase.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/AgoraHeaderBase.h deleted file mode 100644 index a08c9d95..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/AgoraHeaderBase.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -// For compiling the plugin independently using UAT's BuildPlugin command -#if PLATFORM_WINDOWS -#include "Windows/WindowsHWrapper.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// additional -#include - - -// #include "Runtime/Launch/Resources/Version.h" -// #define UE_5_3_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3) - -enum AGORA_UNREAL_PLUGIN_ERROR_CODE -{ - ERROR_OK = 0, - ERROR_NULLPTR = 1999, - ENGINE_PROXY_NOT_CREATED = 2000, - - - // videoRenderModule - CACHE_MANAGER_NOT_ENABLE = 2001, - VIDEO_FRAME_BUFFER_EMPTY = 2002, - -}; - - -enum AppType { - kAppTypeNative = 0, - kAppTypeCocos = 1, - kAppTypeUnity = 2, - kAppTypeElectron = 3, - kAppTypeFlutter = 4, - kAppTypeUnreal = 5, - kAppTypeXamarin = 6, - kAppTypeApiCloud = 7, - kAppTypeReactNative = 8, - kAppTypePython = 9, - kAppTypeCocosCreator = 10, - kAppTypeRust = 11, - kAppTypeCSharp = 12, - kAppTypeCef = 13, - kAppTypeUniApp = 14, -}; - - -// For UE4.25 or older versions - Target Platforms like: Android, define CONSTEXPR back -// Currently AgoraOptional.h would undefine CONSTEXPR at the end of the file. -// This issue would be resolved in a later SDK version. - -#ifndef CONSTEXPR -#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) -#define CONSTEXPR constexpr -#else -#define CONSTEXPR -#endif -#endif // !CONSTEXPR \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/CacheManagerImpl.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/CacheManagerImpl.h deleted file mode 100644 index 79b539cf..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/CacheManagerImpl.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once -#if AGORA_UESDK_ENABLE_VIDEO - -#include -#include -#include -#include -#include "AgoraHeaderBase.h" -#include "Containers/CircularQueue.h" -#include "ICacheManager.h" - -#define MAX_CACHE_SIZE 1; - -namespace agora { - namespace rtc { - namespace ue { - - using namespace media; - using VideoFrame = media::IVideoFrameObserver::VideoFrame; - - struct FramesInfo - { - VideoFrame* SwipFrame; - VideoFrame* CurrentFrame; - bool bIsFresh = false; - }; - - typedef std::map MapStatus; - typedef std::map VideoFrameMap; - - class CacheManagerImpl : public ICacheManager - { - public: - virtual void enableVideoFrameObserver(const VideoFrameIdentity* Identity) override; - virtual void disableVideoFrameObserver(const VideoFrameIdentity* Identity) override; - virtual int pushVideo(const VideoFrameIdentity* Identity, VideoFrame* Frame) override; - virtual int popVideo(const VideoFrameIdentity* Identity, VideoFrame*& Frame) override; - virtual void clear(const VideoFrameIdentity* Identity) override; - virtual void clearAll() override; - void swap(VideoFrame*& SwipFrame, VideoFrame*& CurrentFrame); - private: - std::recursive_mutex Mutex; - MapStatus CacheMapStatus; - VideoFrameMap DataMap; - }; - - } - } -} - -#endif diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/DataManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/DataManager.h deleted file mode 100644 index 1e2a9bf1..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/DataManager.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once -#if AGORA_UESDK_ENABLE_VIDEO - -#include "ICacheManager.h" - -namespace agora { - namespace rtc { - namespace ue { - - class DataManager - { - DataManager(); - public: - static DataManager* getInstance(); - ICacheManager* getCacheManager(); - - public: - ICacheManager* Cache; - }; - - } - } -} - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/ICacheManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/ICacheManager.h deleted file mode 100644 index 3b6ebaf1..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/ICacheManager.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "AgoraHeaderBase.h" -#include -#include - -namespace agora { - namespace rtc { - namespace ue { - - using namespace media; - using VideoFrame = media::IVideoFrameObserver::VideoFrame; - - typedef struct VideoFrameIdentity { - - VIDEO_SOURCE_TYPE Type; - unsigned int Id; - std::string Channel; - - VideoFrameIdentity(VIDEO_SOURCE_TYPE Type, unsigned int Id, const char* ChannelName) - { - this->Type = Type; - this->Id = Id; - Channel = std::string(ChannelName); - } - - bool operator <(const VideoFrameIdentity& Other) const - { - if (Type < Other.Type) - { - return true; - } - else if (Type == Other.Type) - { - if (Id < Other.Id) - { - return true; - } - else if (Id == Other.Id) - { - if (Channel.c_str() == Other.Channel.c_str()) - { - return true; - } - } - - } - return false; - } - } VideoFrameIdentity; - - class ICacheManager - { - public: - virtual ~ICacheManager() {} - virtual void enableVideoFrameObserver(const VideoFrameIdentity* Identity) = 0; - virtual void disableVideoFrameObserver(const VideoFrameIdentity* Identity) = 0; - virtual int pushVideo(const VideoFrameIdentity* Identity, VideoFrame* Frame) = 0; - virtual int popVideo(const VideoFrameIdentity* Identity, VideoFrame*& Frame) = 0; - virtual void clear(const VideoFrameIdentity* Identity) = 0; - virtual void clearAll() = 0; - }; - - ICacheManager* createCacheManager(); - - } - } -} - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoRender.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoRender.h deleted file mode 100644 index a8491f7a..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoRender.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "CoreMinimal.h" -#include "SlateOptMacros.h" -#include "Components/Image.h" -#include "DataManager.h" -#include "Engine/Texture2D.h" -#include "TextureResource.h" -#include "VideoObserverInternal.h" -#include "VideoRenderManager.h" -#include - -namespace agora { - namespace rtc { - namespace ue { - - using VideoFrame = media::IVideoFrameObserver::VideoFrame; - - class VideoRender - { - public: - VideoRender(ICacheManager* CacheManager); - ~VideoRender(); - - void onTick(); - void enableVideoFrameIdentity(UImage* RenderImage, VideoFrameIdentity VideoFrameId); - - private: - int getVideoFrame(const VideoFrameIdentity* Identity, VideoFrame*& Frame); - - private: - ICacheManager* VideoCacheManager; - UTexture2D* RenderTexture; - FSlateBrush RenderBrush; - UImage* RenderImage; - VideoFrame* RenderVideoFrame; - VideoFrameIdentity RenderFrameId; - bool bEnableUpdatePreview; - int ArgbPixSize; - }; - } - } -} - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoRenderManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoRenderManager.h deleted file mode 100644 index ac97b75e..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/VideoRenderManager.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#if AGORA_UESDK_ENABLE_VIDEO - -#include "CoreMinimal.h" -#include "SlateOptMacros.h" -#include "VideoRender.h" -#include "RtcEngineProxy.h" -#include "DataManager.h" -#include "VideoObserverInternal.h" -#include -#include -#include "Tickable.h" -#include "Templates/SharedPointer.h" -/** - * - */ -namespace agora { - namespace rtc { - namespace ue { - - class VideoRenderManager : public FTickableGameObject - { - public: - VideoRenderManager(); - - ~VideoRenderManager(); - - void setRenderImage(UImage* RenderImage, unsigned int Uid, const char* ChannelId, VIDEO_SOURCE_TYPE SourceType); - - void releaseVideoRender(unsigned int Uid, const char* ChannelId, VIDEO_SOURCE_TYPE SourceType); - - void releaseAllVideoRender(); - - virtual void Tick(float DeltaTime) override; - - virtual bool IsTickable() const override - { - return true; - } - virtual bool IsTickableWhenPaused() const override - { - return true; - } - - virtual TStatId GetStatId() const override; - - private: - //std::mutex VideoRenderMutex; - - std::map> VideoRenderMap; - - std::map>::iterator VideoRenderIter; - }; - - } - } -} - -#endif \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraPlugin.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraPlugin.cpp index 35501ec5..887d4002 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraPlugin.cpp +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraPlugin.cpp @@ -1,47 +1,24 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#include "AgoraPlugin.h" -#include "Core.h" -#include "Modules/ModuleManager.h" -#include "Interfaces/IPluginManager.h" -#include -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" - -#define LOCTEXT_NAMESPACE "FAgoraPluginModule" - -void FAgoraPluginModule::StartupModule() -{ - FString BaseDir = IPluginManager::Get().FindPlugin("AgoraPlugin")->GetBaseDir(); - - FString LibraryPath; -#if PLATFORM_WINDOWS - LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/ThirdParty/AgoraPluginLibrary/Win/Release/x86_64/agora_rtc_sdk.dll")); - - AgoraLibraryHandle = !LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr; - - if (AgoraLibraryHandle) - { - int build = 0; - - getAgoraRtcEngineVersion(&build); - - std::string buildVersion = std::to_string(build); - buildVersion = "Hello from Agora! buildVersion: " + buildVersion; - - UE_LOG(LogTemp, Warning, TEXT("FAgoraPluginModule: %s"), ANSI_TO_TCHAR(buildVersion.c_str())); - } -#endif -} - -void FAgoraPluginModule::ShutdownModule() -{ - if (AgoraLibraryHandle) - { - FPlatformProcess::FreeDllHandle(AgoraLibraryHandle); - AgoraLibraryHandle = nullptr; - } -} - -#undef LOCTEXT_NAMESPACE - -IMPLEMENT_MODULE(FAgoraPluginModule, AgoraPlugin) +// Copyright (c) 2023 Agora.io. All rights reserved. + +#include "AgoraPlugin.h" +#include "Core.h" +#include "Modules/ModuleManager.h" +#include "Interfaces/IPluginManager.h" +#include "AgoraPluginInterface.h" + +#define LOCTEXT_NAMESPACE "FAgoraPluginModule" + +DEFINE_LOG_CATEGORY(LogAgora); + +void FAgoraPluginModule::StartupModule() +{ + UE_LOG(LogAgora, Warning, TEXT("FAgoraPluginModule: %s"), *(AgoraUERtcEngine::GetSDKVersion())); +} + +void FAgoraPluginModule::ShutdownModule() +{ +} + +#undef LOCTEXT_NAMESPACE + +IMPLEMENT_MODULE(FAgoraPluginModule, AgoraPlugin) diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraAudioDeviceManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraAudioDeviceManager.h deleted file mode 100644 index 736db5f0..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraAudioDeviceManager.h +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "AgoraAudioDeviceManager.generated.h" - -/** - * - */ -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIAudioDeviceCollection : public UObject -{ - GENERATED_BODY() - -private: - agora::rtc::IAudioDeviceCollection* AudioDeviceCollection; - -public: - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - int GetCount(); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - int GetDevice(int index, FString& deviceName, FString& deviceId); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - int SetDevice(FString deviceId); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - int GetDefaultDevice(FString& deviceName, FString& deviceId); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - int SetApplicationVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - int GetApplicationVolume(int& volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - int SetApplicationMute(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - int IsApplicationMute(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") - void Release(); - void SetAudioDeviceCollection(agora::rtc::IAudioDeviceCollection* audioDeviceCollection); - -}; - - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIAudioDeviceManager : public UObject -{ - GENERATED_BODY() -private: - UIAudioDeviceCollection* playbackDevice; - UIAudioDeviceCollection* recordDevice; -public: - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - UIAudioDeviceCollection* EnumeratePlaybackDevices(); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - UIAudioDeviceCollection* EnumerateRecordingDevices(); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int SetPlaybackDevice(FString deviceId); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int GetPlaybackDevice(FString& deviceId); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int GetPlaybackDeviceInfo(FString& deviceId, FString& deviceName); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int SetPlaybackDeviceVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int GetPlaybackDeviceVolume(int& volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int SetRecordingDevice(FString deviceId); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int GetRecordingDevice(FString& deviceId); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int GetRecordingDeviceInfo(FString& deviceId, FString& deviceName); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int SetRecordingDeviceVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int GetRecordingDeviceVolume(int& volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int SetPlaybackDeviceMute(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int GetPlaybackDeviceMute(bool& mute); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int SetRecordingDeviceMute(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int GetRecordingDeviceMute(bool& mute); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int StartPlaybackDeviceTest(FString testAudioFilePath); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int StopPlaybackDeviceTest(); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int StartRecordingDeviceTest(int indicationInterval); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int StopRecordingDeviceTest(); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int StartAudioDeviceLoopbackTest(int indicationInterval); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int StopAudioDeviceLoopbackTest(); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int FollowSystemPlaybackDevice(bool enable); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - int FollowSystemRecordingDevice(bool enable); - UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") - void Release(); - void SetAudioDeviceManager(agora::rtc::IAudioDeviceManager* audioDeviceManager); -private: - agora::rtc::IAudioDeviceManager* AudioDeviceManager; -}; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuBaseDataTypes.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuBaseDataTypes.h new file mode 100644 index 00000000..b56d8fb1 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuBaseDataTypes.h @@ -0,0 +1,5802 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. +#pragma once + +#include "CoreMinimal.h" +#include "AgoraPluginInterface.h" +#include "UtilityUEEnumAgoraConvertMacro.h" +#include "UtilityUABTTypeHelper.h" +#include "UtilityAgoraBPuLogger.h" +#include "Components/Image.h" +#include "AgoraBPuBaseDataTypes.generated.h" + +using UABT = agora::rtc::ue::UABT; + + +#pragma region Custom Defined + +UENUM() +enum class EAgoraBPuEventHandlerType : uint8 +{ + None UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + EventHandler = 1, + EventHandlerEx = 2 +}; + +#pragma endregion Custom Defined + + +#pragma region EventHandler + +UENUM(BlueprintType) +enum class EVIDEO_SOURCE_TYPE : uint8 { + /** 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 for voice drive. + */ + VIDEO_SOURCE_SPEECH_DRIVEN = 15, + + VIDEO_SOURCE_UNKNOWN = 100 +}; + +UENUM(BlueprintType) +enum class EPROXY_TYPE : uint8 { + + NONE_PROXY_TYPE = 0, + + UDP_PROXY_TYPE = 1, + + TCP_PROXY_TYPE = 2, + + LOCAL_PROXY_TYPE = 3, + + TCP_PROXY_AUTO_FALLBACK_TYPE = 4, + + HTTP_PROXY_TYPE = 5, + + HTTPS_PROXY_TYPE = 6, +}; + + +UENUM(BlueprintType) +enum class ELASTMILE_PROBE_RESULT_STATE :uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + LASTMILE_PROBE_RESULT_COMPLETE = 1, + + LASTMILE_PROBE_RESULT_INCOMPLETE_NO_BWE = 2, + + LASTMILE_PROBE_RESULT_UNAVAILABLE = 3 +}; + + + +USTRUCT(BlueprintType) +struct FLastmileProbeOneWayResult { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeOneWayResult") + int64 packetLossRate = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeOneWayResult") + int64 jitter = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeOneWayResult") + int64 availableBandwidth = 0; + + FLastmileProbeOneWayResult(){} + FLastmileProbeOneWayResult(const agora::rtc::LastmileProbeOneWayResult & AgoraData){ + packetLossRate = AgoraData.packetLossRate; + jitter = AgoraData.jitter; + availableBandwidth = AgoraData.availableBandwidth; + } + + agora::rtc::LastmileProbeOneWayResult CreateAgoraData() const { + agora::rtc::LastmileProbeOneWayResult AgoraData; + AgoraData.packetLossRate = packetLossRate; + AgoraData.jitter = jitter; + AgoraData.availableBandwidth = availableBandwidth; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LastmileProbeOneWayResult & AgoraData) const { + + } + +}; + + +USTRUCT(BlueprintType) +struct FAudioVolumeInfo { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioVolumeInfo") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioVolumeInfo") + int64 volume = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioVolumeInfo") + int64 vad = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioVolumeInfo") + float voicePitch = 0; + + FAudioVolumeInfo(){} + FAudioVolumeInfo(const agora::rtc::AudioVolumeInfo & AgoraData){ + uid = AgoraData.uid; + volume = AgoraData.volume; + vad = AgoraData.vad; + voicePitch = AgoraData.voicePitch; + } + + agora::rtc::AudioVolumeInfo CreateAgoraData() const { + agora::rtc::AudioVolumeInfo AgoraData; + AgoraData.uid = uid; + AgoraData.volume = volume; + AgoraData.vad = vad; + AgoraData.voicePitch = voicePitch; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::AudioVolumeInfo & AgoraData) const { + + } + + +}; + + +USTRUCT(BlueprintType) +struct FLastmileProbeResult { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeResult") + ELASTMILE_PROBE_RESULT_STATE state = ELASTMILE_PROBE_RESULT_STATE::LASTMILE_PROBE_RESULT_UNAVAILABLE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeResult") + FLastmileProbeOneWayResult uplinkReport = FLastmileProbeOneWayResult(); + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeResult") + FLastmileProbeOneWayResult downlinkReport = FLastmileProbeOneWayResult(); + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeResult") + int64 rtt = 0; + + FLastmileProbeResult(){} + FLastmileProbeResult(const agora::rtc::LastmileProbeResult & AgoraData){ + state = static_cast(AgoraData.state); + uplinkReport = FLastmileProbeOneWayResult(AgoraData.uplinkReport); + downlinkReport = FLastmileProbeOneWayResult(AgoraData.downlinkReport); + rtt = AgoraData.rtt; + } + + agora::rtc::LastmileProbeResult CreateAgoraData() const { + agora::rtc::LastmileProbeResult AgoraData; + AgoraData.state = static_cast(state); + AgoraData.uplinkReport = uplinkReport.CreateAgoraData(); + AgoraData.downlinkReport = downlinkReport.CreateAgoraData(); + AgoraData.rtt = rtt; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LastmileProbeResult & AgoraData) const { + uplinkReport.FreeAgoraData(AgoraData.uplinkReport); + downlinkReport.FreeAgoraData(AgoraData.downlinkReport); + } +}; + + + + +USTRUCT(BlueprintType) +struct FRtcStats +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int64 duration = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int64 txBytes = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int64 rxBytes = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int64 txAudioBytes = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int64 txVideoBytes = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int64 rxAudioBytes = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int64 rxVideoBytes = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 txKBitRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 rxKBitRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 rxAudioKBitRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 txAudioKBitRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 rxVideoKBitRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 txVideoKBitRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 lastmileDelay = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int64 userCount = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + FString cpuAppUsage = "0"; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + FString cpuTotalUsage = "0"; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 gatewayRtt = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + FString memoryAppUsageRatio = "0"; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + FString memoryTotalUsageRatio = "0"; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 memoryAppUsageInKbytes = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 connectTimeMs = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 firstAudioPacketDuration = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 firstVideoPacketDuration = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 firstVideoKeyFramePacketDuration = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 packetsBeforeFirstKeyFramePacket = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 firstAudioPacketDurationAfterUnmute = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 firstVideoPacketDurationAfterUnmute = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 firstVideoKeyFramePacketDurationAfterUnmute = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 firstVideoKeyFrameDecodedDurationAfterUnmute = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 firstVideoKeyFrameRenderedDurationAfterUnmute = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 txPacketLossRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") + int32 rxPacketLossRate = 0; + + + + FRtcStats(){} + FRtcStats(const agora::rtc::RtcStats & AgoraData){ + duration = AgoraData.duration; + txBytes = AgoraData.txBytes; + rxBytes = AgoraData.rxBytes; + txAudioBytes = AgoraData.txAudioBytes; + txVideoBytes = AgoraData.txVideoBytes; + rxAudioBytes = AgoraData.rxAudioBytes; + rxVideoBytes = AgoraData.rxVideoBytes; + txKBitRate = AgoraData.txKBitRate; + rxKBitRate = AgoraData.rxKBitRate; + rxAudioKBitRate = AgoraData.rxAudioKBitRate; + txAudioKBitRate = AgoraData.txAudioKBitRate; + rxVideoKBitRate = AgoraData.rxVideoKBitRate; + txVideoKBitRate = AgoraData.txVideoKBitRate; + lastmileDelay = AgoraData.lastmileDelay; + userCount = AgoraData.userCount; + + SET_UABT_DOUBLE_TO_FSTRING(this->cpuAppUsage, AgoraData.cpuAppUsage); + SET_UABT_DOUBLE_TO_FSTRING(this->cpuTotalUsage, AgoraData.cpuTotalUsage); + + gatewayRtt = AgoraData.gatewayRtt; + + SET_UABT_DOUBLE_TO_FSTRING(this->memoryAppUsageRatio, AgoraData.memoryAppUsageRatio); + SET_UABT_DOUBLE_TO_FSTRING(this->memoryTotalUsageRatio, AgoraData.memoryTotalUsageRatio); + + memoryAppUsageInKbytes = AgoraData.memoryAppUsageInKbytes; + connectTimeMs = AgoraData.connectTimeMs; + firstAudioPacketDuration = AgoraData.firstAudioPacketDuration; + firstVideoPacketDuration = AgoraData.firstVideoPacketDuration; + firstVideoKeyFramePacketDuration = AgoraData.firstVideoKeyFramePacketDuration; + packetsBeforeFirstKeyFramePacket = AgoraData.packetsBeforeFirstKeyFramePacket; + firstAudioPacketDurationAfterUnmute = AgoraData.firstAudioPacketDurationAfterUnmute; + firstVideoPacketDurationAfterUnmute = AgoraData.firstVideoPacketDurationAfterUnmute; + firstVideoKeyFramePacketDurationAfterUnmute = AgoraData.firstVideoKeyFramePacketDurationAfterUnmute; + firstVideoKeyFrameDecodedDurationAfterUnmute = AgoraData.firstVideoKeyFrameDecodedDurationAfterUnmute; + firstVideoKeyFrameRenderedDurationAfterUnmute = AgoraData.firstVideoKeyFrameRenderedDurationAfterUnmute; + txPacketLossRate = AgoraData.txPacketLossRate; + rxPacketLossRate = AgoraData.rxPacketLossRate; + } + + + agora::rtc::RtcStats CreateAgoraData(){ + + agora::rtc::RtcStats AgoraData; + AgoraData.duration = duration; + AgoraData.txBytes = txBytes; + AgoraData.rxBytes = rxBytes; + AgoraData.txAudioBytes = txAudioBytes; + AgoraData.txVideoBytes = txVideoBytes; + AgoraData.rxAudioBytes = rxAudioBytes; + AgoraData.rxVideoBytes = rxVideoBytes; + AgoraData.txKBitRate = txKBitRate; + AgoraData.rxKBitRate = rxKBitRate; + AgoraData.rxAudioKBitRate = rxAudioKBitRate; + AgoraData.txAudioKBitRate = txAudioKBitRate; + AgoraData.rxVideoKBitRate = rxVideoKBitRate; + AgoraData.txVideoKBitRate = txVideoKBitRate; + AgoraData.lastmileDelay = lastmileDelay; + AgoraData.userCount = userCount; + + SET_UABT_FSTRING_TO_DOUBLE(AgoraData.cpuAppUsage, this->cpuAppUsage); + SET_UABT_FSTRING_TO_DOUBLE(AgoraData.cpuTotalUsage, this->cpuTotalUsage); + + AgoraData.gatewayRtt = gatewayRtt; + + SET_UABT_FSTRING_TO_DOUBLE(AgoraData.memoryAppUsageRatio, this->memoryAppUsageRatio); + SET_UABT_FSTRING_TO_DOUBLE(AgoraData.memoryTotalUsageRatio, this->memoryTotalUsageRatio); + + AgoraData.memoryAppUsageInKbytes = memoryAppUsageInKbytes; + AgoraData.connectTimeMs = connectTimeMs; + AgoraData.firstAudioPacketDuration = firstAudioPacketDuration; + AgoraData.firstVideoPacketDuration = firstVideoPacketDuration; + AgoraData.firstVideoKeyFramePacketDuration = firstVideoKeyFramePacketDuration; + AgoraData.packetsBeforeFirstKeyFramePacket = packetsBeforeFirstKeyFramePacket; + AgoraData.firstAudioPacketDurationAfterUnmute = firstAudioPacketDurationAfterUnmute; + AgoraData.firstVideoPacketDurationAfterUnmute = firstVideoPacketDurationAfterUnmute; + AgoraData.firstVideoKeyFramePacketDurationAfterUnmute = firstVideoKeyFramePacketDurationAfterUnmute; + AgoraData.firstVideoKeyFrameDecodedDurationAfterUnmute = firstVideoKeyFrameDecodedDurationAfterUnmute; + AgoraData.firstVideoKeyFrameRenderedDurationAfterUnmute = firstVideoKeyFrameRenderedDurationAfterUnmute; + AgoraData.txPacketLossRate = txPacketLossRate; + AgoraData.rxPacketLossRate = rxPacketLossRate; + + return AgoraData; + } + + void FreeAgoraData(agora::rtc::RtcStats & AgoraData) const { + } +}; + + + +USTRUCT(BlueprintType) +struct FUplinkNetworkInfo { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UplinkNetworkInfo") + int video_encoder_target_bitrate_bps = 0; + + FUplinkNetworkInfo(){} + FUplinkNetworkInfo(const agora::rtc::UplinkNetworkInfo & AgoraData){ + video_encoder_target_bitrate_bps = AgoraData.video_encoder_target_bitrate_bps; + } + + agora::rtc::UplinkNetworkInfo CreateAgoraData() const { + agora::rtc::UplinkNetworkInfo AgoraData; + AgoraData.video_encoder_target_bitrate_bps = video_encoder_target_bitrate_bps; + return AgoraData; + } + void FreeAgoraData(agora::rtc::UplinkNetworkInfo & AgoraData) const { + + } +}; + + +UENUM(BlueprintType) +enum class EREMOTE_VIDEO_DOWNSCALE_LEVEL : uint8 { + + REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE, + + REMOTE_VIDEO_DOWNSCALE_LEVEL_1, + + REMOTE_VIDEO_DOWNSCALE_LEVEL_2, + + REMOTE_VIDEO_DOWNSCALE_LEVEL_3, + + REMOTE_VIDEO_DOWNSCALE_LEVEL_4, +}; + + + +UENUM(BlueprintType) +enum class EVIDEO_STREAM_TYPE : uint8 { + VIDEO_STREAM_HIGH = 0, + VIDEO_STREAM_LOW = 1, +}; + + + +USTRUCT(BlueprintType) +struct FPeerDownlinkInfo { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PeerDownlinkInfo") + FString userId = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PeerDownlinkInfo") + EVIDEO_STREAM_TYPE stream_type = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PeerDownlinkInfo") + EREMOTE_VIDEO_DOWNSCALE_LEVEL current_downscale_level = EREMOTE_VIDEO_DOWNSCALE_LEVEL::REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PeerDownlinkInfo") + int expected_bitrate_bps = 0; + + FPeerDownlinkInfo(){} + FPeerDownlinkInfo(const agora::rtc::DownlinkNetworkInfo::PeerDownlinkInfo & AgoraData){ + userId = UTF8_TO_TCHAR(AgoraData.userId); + stream_type = static_cast(AgoraData.stream_type); + current_downscale_level = static_cast(AgoraData.current_downscale_level); + expected_bitrate_bps = AgoraData.expected_bitrate_bps; + } + + agora::rtc::DownlinkNetworkInfo::PeerDownlinkInfo CreateAgoraData() const { + agora::rtc::DownlinkNetworkInfo::PeerDownlinkInfo AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.userId,this->userId) + AgoraData.stream_type = static_cast(stream_type); + AgoraData.current_downscale_level = static_cast(current_downscale_level); + AgoraData.expected_bitrate_bps = expected_bitrate_bps; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::DownlinkNetworkInfo::PeerDownlinkInfo & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.userId) + } +}; + + +USTRUCT(BlueprintType) +struct FDownlinkNetworkInfo { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") + int lastmile_buffer_delay_time_ms = -1; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") + int bandwidth_estimation_bps = -1; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") + int total_downscale_level_count = -1; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") + TArray peer_downlink_info; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") + int total_received_video_count = -1; + + FDownlinkNetworkInfo(){} + FDownlinkNetworkInfo(const agora::rtc::DownlinkNetworkInfo & AgoraData){ + lastmile_buffer_delay_time_ms = AgoraData.lastmile_buffer_delay_time_ms; + bandwidth_estimation_bps = AgoraData.bandwidth_estimation_bps; + total_downscale_level_count = AgoraData.total_downscale_level_count; + for (int i = 0; i < total_received_video_count; ++i) { + peer_downlink_info.Add(FPeerDownlinkInfo(AgoraData.peer_downlink_info[i])); + } + total_received_video_count = AgoraData.total_received_video_count; + } + + agora::rtc::DownlinkNetworkInfo CreateAgoraData() const { + agora::rtc::DownlinkNetworkInfo AgoraData; + AgoraData.lastmile_buffer_delay_time_ms = lastmile_buffer_delay_time_ms; + AgoraData.bandwidth_estimation_bps = bandwidth_estimation_bps; + AgoraData.total_downscale_level_count = total_downscale_level_count; + AgoraData.total_received_video_count = total_received_video_count; + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(AgoraData.peer_downlink_info, agora::rtc::DownlinkNetworkInfo::PeerDownlinkInfo, total_received_video_count, this->peer_downlink_info) + return AgoraData; + } + + void FreeAgoraData(agora::rtc::DownlinkNetworkInfo & AgoraData) const { + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(AgoraData.peer_downlink_info, total_received_video_count, FPeerDownlinkInfo) + } +}; + + + +UENUM(BlueprintType) +enum class ELOCAL_VIDEO_STREAM_STATE : uint8 { + + LOCAL_VIDEO_STREAM_STATE_STOPPED = 0, + + LOCAL_VIDEO_STREAM_STATE_CAPTURING = 1, + + LOCAL_VIDEO_STREAM_STATE_ENCODING = 2, + + LOCAL_VIDEO_STREAM_STATE_FAILED = 3 +}; + +UENUM(BlueprintType) +enum class ELOCAL_VIDEO_STREAM_REASON : uint8 { + LOCAL_VIDEO_STREAM_REASON_OK = 0, + LOCAL_VIDEO_STREAM_REASON_FAILURE = 1, + LOCAL_VIDEO_STREAM_REASON_DEVICE_NO_PERMISSION = 2, + LOCAL_VIDEO_STREAM_REASON_DEVICE_BUSY = 3, + LOCAL_VIDEO_STREAM_REASON_CAPTURE_FAILURE = 4, + LOCAL_VIDEO_STREAM_REASON_CODEC_NOT_SUPPORT = 5, + LOCAL_VIDEO_STREAM_REASON_CAPTURE_INBACKGROUND = 6, + LOCAL_VIDEO_STREAM_REASON_CAPTURE_MULTIPLE_FOREGROUND_APPS = 7, + LOCAL_VIDEO_STREAM_REASON_DEVICE_NOT_FOUND = 8, + LOCAL_VIDEO_STREAM_REASON_DEVICE_DISCONNECTED = 9, + LOCAL_VIDEO_STREAM_REASON_DEVICE_INVALID_ID = 10, + LOCAL_VIDEO_STREAM_REASON_DEVICE_INTERRUPT = 14, + LOCAL_VIDEO_STREAM_REASON_DEVICE_FATAL_ERROR = 15, + LOCAL_VIDEO_STREAM_REASON_DEVICE_SYSTEM_PRESSURE = 101, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_MINIMIZED = 11, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_CLOSED = 12, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_OCCLUDED = 13, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_NOT_SUPPORTED = 20, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_FAILURE = 21, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_NO_PERMISSION = 22, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_AUTO_FALLBACK = 24, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_HIDDEN = 25, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_RECOVER_FROM_HIDDEN = 26, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_RECOVER_FROM_MINIMIZED = 27, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_PAUSED = 28, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_RESUMED = 29 +}; + + + + +UENUM(BlueprintType) +enum class EREMOTE_VIDEO_STATE : uint8 { + + REMOTE_VIDEO_STATE_STOPPED = 0, + + REMOTE_VIDEO_STATE_STARTING = 1, + + REMOTE_VIDEO_STATE_DECODING = 2, + + REMOTE_VIDEO_STATE_FROZEN = 3, + + REMOTE_VIDEO_STATE_FAILED = 4, +}; + +UENUM(BlueprintType) +enum class EREMOTE_VIDEO_STATE_REASON : uint8 { + + REMOTE_VIDEO_STATE_REASON_INTERNAL = 0, + + REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION = 1, + + REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY = 2, + + REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED = 3, + + REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED = 4, + + REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED = 5, + + REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED = 6, + + REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE = 7, + + REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK = 8, + + REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY = 9, + + REMOTE_VIDEO_STATE_REASON_VIDEO_STREAM_TYPE_CHANGE_TO_LOW = 10, + + REMOTE_VIDEO_STATE_REASON_VIDEO_STREAM_TYPE_CHANGE_TO_HIGH = 11, + + REMOTE_VIDEO_STATE_REASON_SDK_IN_BACKGROUND = 12, + + REMOTE_VIDEO_STATE_REASON_CODEC_NOT_SUPPORT = 13, +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_REMOTE_USER_STATE : uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + USER_STATE_MUTE_AUDIO, + USER_STATE_MUTE_VIDEO, + USER_STATE_ENABLE_VIDEO, + USER_STATE_ENABLE_LOCAL_VIDEO, +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_REMOTE_USER_STATE +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EENUMWRAP_REMOTE_USER_STATE") + EENUMCUSTOM_REMOTE_USER_STATE ValueWrapper = EENUMCUSTOM_REMOTE_USER_STATE::USER_STATE_MUTE_AUDIO; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_4_ENTRIES(FENUMWRAP_REMOTE_USER_STATE, agora::rtc::REMOTE_USER_STATE, EENUMCUSTOM_REMOTE_USER_STATE, + USER_STATE_MUTE_AUDIO, + USER_STATE_MUTE_VIDEO, + USER_STATE_ENABLE_VIDEO, + USER_STATE_ENABLE_LOCAL_VIDEO) +}; + + +USTRUCT(BlueprintType) +struct FLocalAudioStats +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int numChannels = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int sentSampleRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int sentBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int internalCodec = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int txPacketLossRate = 0; // unsigned short + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int audioDeviceDelay = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int audioPlayoutDelay = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int earMonitorDelay = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") + int aecEstimatedDelay = 0; + + FLocalAudioStats(){} + FLocalAudioStats(const agora::rtc::LocalAudioStats & AgoraData){ + numChannels = AgoraData.numChannels; + sentSampleRate = AgoraData.sentSampleRate; + sentBitrate = AgoraData.sentBitrate; + internalCodec = AgoraData.internalCodec; + txPacketLossRate = AgoraData.txPacketLossRate; + audioDeviceDelay = AgoraData.audioDeviceDelay; + audioPlayoutDelay = AgoraData.audioPlayoutDelay; + earMonitorDelay = AgoraData.earMonitorDelay; + aecEstimatedDelay = AgoraData.aecEstimatedDelay; + } + + agora::rtc::LocalAudioStats CreateAgoraData() const { + agora::rtc::LocalAudioStats AgoraData; + AgoraData.numChannels = numChannels; + AgoraData.sentSampleRate = sentSampleRate; + AgoraData.sentBitrate = sentBitrate; + AgoraData.internalCodec = internalCodec; + AgoraData.txPacketLossRate = txPacketLossRate; + AgoraData.audioDeviceDelay = audioDeviceDelay; + AgoraData.audioPlayoutDelay = audioPlayoutDelay; + AgoraData.earMonitorDelay = earMonitorDelay; + AgoraData.aecEstimatedDelay = aecEstimatedDelay; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LocalAudioStats & AgoraData) const { + + } +}; + + + +USTRUCT(BlueprintType) +struct FRemoteAudioStats +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int quality = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int networkTransportDelay = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int jitterBufferDelay = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int audioLossRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int numChannels = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int receivedSampleRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int receivedBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int totalFrozenTime = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int frozenRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int mosValue = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int64 frozenRateByCustomPlcCount = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int64 plcCount = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int totalActiveTime = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int publishDuration = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int qoeQuality = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int qualityChangedReason = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int64 rxAudioBytes = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") + int e2eDelay = 0; + + FRemoteAudioStats(){} + FRemoteAudioStats(const agora::rtc::RemoteAudioStats & AgoraData){ + uid = AgoraData.uid; + quality = AgoraData.quality; + networkTransportDelay = AgoraData.networkTransportDelay; + jitterBufferDelay = AgoraData.jitterBufferDelay; + audioLossRate = AgoraData.audioLossRate; + numChannels = AgoraData.numChannels; + receivedSampleRate = AgoraData.receivedSampleRate; + receivedBitrate = AgoraData.receivedBitrate; + totalFrozenTime = AgoraData.totalFrozenTime; + frozenRate = AgoraData.frozenRate; + mosValue = AgoraData.mosValue; + frozenRateByCustomPlcCount = AgoraData.frozenRateByCustomPlcCount; + plcCount = AgoraData.plcCount; + totalActiveTime = AgoraData.totalActiveTime; + publishDuration = AgoraData.publishDuration; + qoeQuality = AgoraData.qoeQuality; + qualityChangedReason = AgoraData.qualityChangedReason; + rxAudioBytes = AgoraData.rxAudioBytes; + e2eDelay = AgoraData.e2eDelay; + } + + agora::rtc::RemoteAudioStats CreateAgoraData() const { + agora::rtc::RemoteAudioStats AgoraData; + AgoraData.uid = uid; + AgoraData.quality = quality; + AgoraData.networkTransportDelay = networkTransportDelay; + AgoraData.jitterBufferDelay = jitterBufferDelay; + AgoraData.audioLossRate = audioLossRate; + AgoraData.numChannels = numChannels; + AgoraData.receivedSampleRate = receivedSampleRate; + AgoraData.receivedBitrate = receivedBitrate; + AgoraData.totalFrozenTime = totalFrozenTime; + AgoraData.frozenRate = frozenRate; + AgoraData.mosValue = mosValue; + AgoraData.frozenRateByCustomPlcCount = frozenRateByCustomPlcCount; + AgoraData.plcCount = plcCount; + AgoraData.totalActiveTime = totalActiveTime; + AgoraData.publishDuration = publishDuration; + AgoraData.qoeQuality = qoeQuality; + AgoraData.qualityChangedReason = qualityChangedReason; + AgoraData.rxAudioBytes = rxAudioBytes; + AgoraData.e2eDelay = e2eDelay; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::RemoteAudioStats & AgoraData) const { + + } + +}; + + +UENUM(BlueprintType) +enum class EQUALITY_ADAPT_INDICATION : uint8 { + + ADAPT_NONE = 0, + + ADAPT_UP_BANDWIDTH = 1, + + ADAPT_DOWN_BANDWIDTH = 2, +}; + +UENUM(BlueprintType) +enum class EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE : uint8 { + + CAPTURE_BRIGHTNESS_LEVEL_INVALID = 0, + + CAPTURE_BRIGHTNESS_LEVEL_NORMAL = 1, + + CAPTURE_BRIGHTNESS_LEVEL_BRIGHT = 2, + + CAPTURE_BRIGHTNESS_LEVEL_DARK = 3, +}; + + + +USTRUCT(BlueprintType) +struct FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE") + EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_4_ENTRIES(FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE, agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE, EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE, + CAPTURE_BRIGHTNESS_LEVEL_INVALID, + CAPTURE_BRIGHTNESS_LEVEL_NORMAL, + CAPTURE_BRIGHTNESS_LEVEL_BRIGHT, + CAPTURE_BRIGHTNESS_LEVEL_DARK) +}; + +UENUM(BlueprintType) +enum class EVIDEO_CODEC_TYPE : uint8 { + + VIDEO_CODEC_NONE = 0, + + VIDEO_CODEC_VP8 = 1, + + VIDEO_CODEC_H264 = 2, + + VIDEO_CODEC_H265 = 3, + + VIDEO_CODEC_GENERIC = 6, + + VIDEO_CODEC_GENERIC_H264 = 7, + + VIDEO_CODEC_AV1 = 12, + + VIDEO_CODEC_VP9 = 13, + + VIDEO_CODEC_GENERIC_JPEG = 20, +}; + +USTRUCT(BlueprintType) +struct FLocalVideoStats +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int sentBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int sentFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int captureFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int captureFrameWidth = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int captureFrameHeight = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int regulatedCaptureFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int regulatedCaptureFrameWidth = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int regulatedCaptureFrameHeight = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int encoderOutputFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int encodedFrameWidth = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int encodedFrameHeight = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int rendererOutputFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int targetBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int targetFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + EQUALITY_ADAPT_INDICATION qualityAdaptIndication = EQUALITY_ADAPT_INDICATION::ADAPT_NONE; + int encodedBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int encodedFrameCount = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_GENERIC_H264; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int txPacketLossRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE captureBrightnessLevel = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + bool dualStreamEnabled = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") + int hwEncoderAccelerating = 0; + + + FLocalVideoStats(){} + FLocalVideoStats(const agora::rtc::LocalVideoStats & AgoraData){ + uid = AgoraData.uid; + sentBitrate = AgoraData.sentBitrate; + sentFrameRate = AgoraData.sentFrameRate; + captureFrameRate = AgoraData.captureFrameRate; + captureFrameWidth = AgoraData.captureFrameWidth; + captureFrameHeight = AgoraData.captureFrameHeight; + regulatedCaptureFrameRate = AgoraData.regulatedCaptureFrameRate; + regulatedCaptureFrameWidth = AgoraData.regulatedCaptureFrameWidth; + regulatedCaptureFrameHeight = AgoraData.regulatedCaptureFrameHeight; + encoderOutputFrameRate = AgoraData.encoderOutputFrameRate; + encodedFrameWidth = AgoraData.encodedFrameWidth; + encodedFrameHeight = AgoraData.encodedFrameHeight; + rendererOutputFrameRate = AgoraData.rendererOutputFrameRate; + targetBitrate = AgoraData.targetBitrate; + targetFrameRate = AgoraData.targetFrameRate; + qualityAdaptIndication = static_cast(AgoraData.qualityAdaptIndication); + encodedBitrate = AgoraData.encodedBitrate; + encodedFrameCount = AgoraData.encodedFrameCount; + codecType = static_cast(AgoraData.codecType); + txPacketLossRate = AgoraData.txPacketLossRate; + captureBrightnessLevel = FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE(AgoraData.captureBrightnessLevel); + dualStreamEnabled = AgoraData.dualStreamEnabled; + hwEncoderAccelerating = AgoraData.hwEncoderAccelerating; + } + + agora::rtc::LocalVideoStats CreateAgoraData() const { + agora::rtc::LocalVideoStats AgoraData; + AgoraData.uid = uid; + AgoraData.sentBitrate = sentBitrate; + AgoraData.sentFrameRate = sentFrameRate; + AgoraData.captureFrameRate = captureFrameRate; + AgoraData.captureFrameWidth = captureFrameWidth; + AgoraData.captureFrameHeight = captureFrameHeight; + AgoraData.regulatedCaptureFrameRate = regulatedCaptureFrameRate; + AgoraData.regulatedCaptureFrameWidth = regulatedCaptureFrameWidth; + AgoraData.regulatedCaptureFrameHeight = regulatedCaptureFrameHeight; + AgoraData.encoderOutputFrameRate = encoderOutputFrameRate; + AgoraData.encodedFrameWidth = encodedFrameWidth; + AgoraData.encodedFrameHeight = encodedFrameHeight; + AgoraData.rendererOutputFrameRate = rendererOutputFrameRate; + AgoraData.targetBitrate = targetBitrate; + AgoraData.targetFrameRate = targetFrameRate; + AgoraData.qualityAdaptIndication = static_cast(qualityAdaptIndication); + AgoraData.encodedBitrate = encodedBitrate; + AgoraData.encodedFrameCount = encodedFrameCount; + AgoraData.codecType = static_cast(codecType); + AgoraData.txPacketLossRate = txPacketLossRate; + AgoraData.captureBrightnessLevel = captureBrightnessLevel.GetRawValue(); + AgoraData.dualStreamEnabled = dualStreamEnabled; + AgoraData.hwEncoderAccelerating = hwEncoderAccelerating; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LocalVideoStats & AgoraData) const + { + + } +}; + + + +USTRUCT(BlueprintType) +struct FRemoteVideoStats { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int delay = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int e2eDelay = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int width = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int height = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int receivedBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int decoderOutputFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int rendererOutputFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int frameLossRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int packetLossRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + EVIDEO_STREAM_TYPE rxStreamType = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int totalFrozenTime = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int frozenRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int avSyncTimeMs = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int totalActiveTime = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int publishDuration = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int mosValue = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") + int64 rxVideoBytes = 0; + + + FRemoteVideoStats(){} + FRemoteVideoStats(const agora::rtc::RemoteVideoStats & AgoraData){ + uid = AgoraData.uid; + delay = AgoraData.delay; + e2eDelay = AgoraData.e2eDelay; + width = AgoraData.width; + height = AgoraData.height; + receivedBitrate = AgoraData.receivedBitrate; + decoderOutputFrameRate = AgoraData.decoderOutputFrameRate; + rendererOutputFrameRate = AgoraData.rendererOutputFrameRate; + frameLossRate = AgoraData.frameLossRate; + packetLossRate = AgoraData.packetLossRate; + rxStreamType = static_cast(AgoraData.rxStreamType); + totalFrozenTime = AgoraData.totalFrozenTime; + frozenRate = AgoraData.frozenRate; + avSyncTimeMs = AgoraData.avSyncTimeMs; + totalActiveTime = AgoraData.totalActiveTime; + publishDuration = AgoraData.publishDuration; + mosValue = AgoraData.mosValue; + rxVideoBytes = AgoraData.rxVideoBytes; + } + + agora::rtc::RemoteVideoStats CreateAgoraData() const { + agora::rtc::RemoteVideoStats AgoraData; + AgoraData.uid = uid; + AgoraData.delay = delay; + AgoraData.e2eDelay = e2eDelay; + AgoraData.width = width; + AgoraData.height = height; + AgoraData.receivedBitrate = receivedBitrate; + AgoraData.decoderOutputFrameRate = decoderOutputFrameRate; + AgoraData.rendererOutputFrameRate = rendererOutputFrameRate; + AgoraData.frameLossRate = frameLossRate; + AgoraData.packetLossRate = packetLossRate; + AgoraData.rxStreamType = static_cast(rxStreamType); + AgoraData.totalFrozenTime = totalFrozenTime; + AgoraData.frozenRate = frozenRate; + AgoraData.avSyncTimeMs = avSyncTimeMs; + AgoraData.totalActiveTime = totalActiveTime; + AgoraData.publishDuration = publishDuration; + AgoraData.mosValue = mosValue; + AgoraData.rxVideoBytes = rxVideoBytes; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::RemoteVideoStats & AgoraData) const { + + } +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE : uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + AUDIO_MIXING_STATE_PLAYING = 1, + + AUDIO_MIXING_STATE_PAUSED = 2, + + AUDIO_MIXING_STATE_STOPPED = 3, + + AUDIO_MIXING_STATE_FAILED = 4, +}; + + +USTRUCT(BlueprintType) +struct FENUMWRAP_AUDIO_MIXING_STATE_TYPE +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_AUDIO_MIXING_STATE_TYPE") + EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_4_ENTRIES(FENUMWRAP_AUDIO_MIXING_STATE_TYPE, agora::rtc::AUDIO_MIXING_STATE_TYPE, EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE, + AUDIO_MIXING_STATE_PLAYING, + AUDIO_MIXING_STATE_PAUSED, + AUDIO_MIXING_STATE_STOPPED, + AUDIO_MIXING_STATE_FAILED) +}; + +UENUM(BlueprintType) +enum class EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE : uint8 { + + AUDIO_MIXING_REASON_OK = 0, + + AUDIO_MIXING_REASON_CAN_NOT_OPEN = 1, + + AUDIO_MIXING_REASON_TOO_FREQUENT_CALL = 2, + + AUDIO_MIXING_REASON_INTERRUPTED_EOF = 3, + + AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED = 4, + + AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED = 5, + + AUDIO_MIXING_REASON_STOPPED_BY_USER = 6, + +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_AUDIO_MIXING_REASON_TYPE +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_AUDIO_MIXING_REASON_TYPE") + EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_OK; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_7_ENTRIES(FENUMWRAP_AUDIO_MIXING_REASON_TYPE, agora::rtc::AUDIO_MIXING_REASON_TYPE, EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE, + AUDIO_MIXING_REASON_OK, + AUDIO_MIXING_REASON_CAN_NOT_OPEN, + AUDIO_MIXING_REASON_TOO_FREQUENT_CALL, + AUDIO_MIXING_REASON_INTERRUPTED_EOF, + AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED, + AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED, + AUDIO_MIXING_REASON_STOPPED_BY_USER) +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE : uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + RHYTHM_PLAYER_STATE_IDLE = 1, + + RHYTHM_PLAYER_STATE_OPENING, + + RHYTHM_PLAYER_STATE_DECODING, + + RHYTHM_PLAYER_STATE_PLAYING, + + RHYTHM_PLAYER_STATE_FAILED, +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE") + EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_5_ENTRIES(FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE, agora::rtc::RHYTHM_PLAYER_STATE_TYPE, EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE, + RHYTHM_PLAYER_STATE_IDLE, + RHYTHM_PLAYER_STATE_OPENING, + RHYTHM_PLAYER_STATE_DECODING, + RHYTHM_PLAYER_STATE_PLAYING, + RHYTHM_PLAYER_STATE_FAILED) +}; + +UENUM(BlueprintType) +enum class EENUMCUSTOM_RHYTHM_PLAYER_REASON :uint8 { + + RHYTHM_PLAYER_REASON_OK = 0, + + RHYTHM_PLAYER_REASON_FAILED = 1, + + RHYTHM_PLAYER_REASON_CAN_NOT_OPEN, + + RHYTHM_PLAYER_REASON_CAN_NOT_PLAY, + + RHYTHM_PLAYER_REASON_FILE_OVER_DURATION_LIMIT, +}; + + +USTRUCT(BlueprintType) +struct FENUMWRAP_RHYTHM_PLAYER_REASON +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_RHYTHM_PLAYER_ERROR_TYPE") + EENUMCUSTOM_RHYTHM_PLAYER_REASON ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_REASON::RHYTHM_PLAYER_REASON_OK; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_5_ENTRIES(FENUMWRAP_RHYTHM_PLAYER_REASON, agora::rtc::RHYTHM_PLAYER_REASON, EENUMCUSTOM_RHYTHM_PLAYER_REASON, + RHYTHM_PLAYER_REASON_OK, + RHYTHM_PLAYER_REASON_FAILED, + RHYTHM_PLAYER_REASON_CAN_NOT_OPEN, + RHYTHM_PLAYER_REASON_CAN_NOT_PLAY, + RHYTHM_PLAYER_REASON_FILE_OVER_DURATION_LIMIT) +}; + + +UENUM(BlueprintType) +enum class ELICENSE_ERROR_TYPE : uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + LICENSE_ERR_INVALID = 1, + + LICENSE_ERR_EXPIRE = 2, + + LICENSE_ERR_MINUTES_EXCEED = 3, + + LICENSE_ERR_LIMITED_PERIOD = 4, + + LICENSE_ERR_DIFF_DEVICES = 5, + + LICENSE_ERR_INTERNAL = 99, +}; + + + +UENUM(BlueprintType) +enum class ELOCAL_AUDIO_STREAM_STATE : uint8 { + + LOCAL_AUDIO_STREAM_STATE_STOPPED = 0, + + LOCAL_AUDIO_STREAM_STATE_RECORDING = 1, + + LOCAL_AUDIO_STREAM_STATE_ENCODING = 2, + + LOCAL_AUDIO_STREAM_STATE_FAILED = 3 +}; + +UENUM(BlueprintType) +enum class ELOCAL_AUDIO_STREAM_REASON : uint8 { + + LOCAL_AUDIO_STREAM_REASON_OK = 0, + LOCAL_AUDIO_STREAM_REASON_FAILURE = 1, + LOCAL_AUDIO_STREAM_REASON_DEVICE_NO_PERMISSION = 2, + LOCAL_AUDIO_STREAM_REASON_DEVICE_BUSY = 3, + LOCAL_AUDIO_STREAM_REASON_RECORD_FAILURE = 4, + LOCAL_AUDIO_STREAM_REASON_ENCODE_FAILURE = 5, + LOCAL_AUDIO_STREAM_REASON_NO_RECORDING_DEVICE = 6, + LOCAL_AUDIO_STREAM_REASON_NO_PLAYOUT_DEVICE = 7, + LOCAL_AUDIO_STREAM_REASON_INTERRUPTED = 8, + LOCAL_AUDIO_STREAM_REASON_RECORD_INVALID_ID = 9, + LOCAL_AUDIO_STREAM_REASON_PLAYOUT_INVALID_ID = 10, +}; + + +UENUM(BlueprintType) +enum class EREMOTE_AUDIO_STATE : uint8 +{ + + REMOTE_AUDIO_STATE_STOPPED = 0, + + REMOTE_AUDIO_STATE_STARTING = 1, + + REMOTE_AUDIO_STATE_DECODING = 2, + + REMOTE_AUDIO_STATE_FROZEN = 3, + + REMOTE_AUDIO_STATE_FAILED = 4, +}; + +UENUM(BlueprintType) +enum class EREMOTE_AUDIO_STATE_REASON : uint8 +{ + REMOTE_AUDIO_REASON_INTERNAL = 0, + + REMOTE_AUDIO_REASON_NETWORK_CONGESTION = 1, + + REMOTE_AUDIO_REASON_NETWORK_RECOVERY = 2, + + REMOTE_AUDIO_REASON_LOCAL_MUTED = 3, + + REMOTE_AUDIO_REASON_LOCAL_UNMUTED = 4, + + REMOTE_AUDIO_REASON_REMOTE_MUTED = 5, + + REMOTE_AUDIO_REASON_REMOTE_UNMUTED = 6, + + REMOTE_AUDIO_REASON_REMOTE_OFFLINE = 7, + + REMOTE_AUDIO_REASON_NO_PACKET_RECEIVE = 8, + + REMOTE_AUDIO_REASON_LOCAL_PLAY_FAILED = 9, + +}; + + +UENUM(BlueprintType) +enum class ECONTENT_INSPECT_RESULT : uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + CONTENT_INSPECT_NEUTRAL = 1, + CONTENT_INSPECT_SEXY = 2, + CONTENT_INSPECT_PORN = 3, +}; + +UENUM(BlueprintType) +enum class ECLIENT_ROLE_CHANGE_FAILED_REASON : uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + CLIENT_ROLE_CHANGE_FAILED_TOO_MANY_BROADCASTERS = 1, + + CLIENT_ROLE_CHANGE_FAILED_NOT_AUTHORIZED = 2, + + CLIENT_ROLE_CHANGE_FAILED_REQUEST_TIME_OUT = 3, + + CLIENT_ROLE_CHANGE_FAILED_CONNECTION_FAILED = 4, +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_MEDIA_DEVICE_TYPE : uint8 { + + UNKNOWN_AUDIO_DEVICE = 0, + + AUDIO_PLAYOUT_DEVICE = 1, + + AUDIO_RECORDING_DEVICE = 2, + + VIDEO_RENDER_DEVICE = 3, + + VIDEO_CAPTURE_DEVICE = 4, + + AUDIO_APPLICATION_PLAYOUT_DEVICE = 5, + + AUDIO_VIRTUAL_PLAYOUT_DEVICE = 6, + + AUDIO_VIRTUAL_RECORDING_DEVICE = 7, +}; + + + +USTRUCT(BlueprintType) +struct FENUMWRAP_MEDIA_DEVICE_TYPE +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_MEDIA_DEVICE_TYPE") + EENUMCUSTOM_MEDIA_DEVICE_TYPE ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::UNKNOWN_AUDIO_DEVICE; + + + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_8_ENTRIES(FENUMWRAP_MEDIA_DEVICE_TYPE, agora::rtc::MEDIA_DEVICE_TYPE, EENUMCUSTOM_MEDIA_DEVICE_TYPE, + UNKNOWN_AUDIO_DEVICE, + AUDIO_PLAYOUT_DEVICE, + AUDIO_RECORDING_DEVICE, + VIDEO_RENDER_DEVICE, + VIDEO_CAPTURE_DEVICE, + AUDIO_APPLICATION_PLAYOUT_DEVICE, + AUDIO_VIRTUAL_PLAYOUT_DEVICE, + AUDIO_VIRTUAL_RECORDING_DEVICE) + + +}; + + + +UENUM(BlueprintType) +enum class ERTMP_STREAM_PUBLISH_STATE : uint8 { + + RTMP_STREAM_PUBLISH_STATE_IDLE = 0, + + RTMP_STREAM_PUBLISH_STATE_CONNECTING = 1, + + RTMP_STREAM_PUBLISH_STATE_RUNNING = 2, + + RTMP_STREAM_PUBLISH_STATE_RECOVERING = 3, + + RTMP_STREAM_PUBLISH_STATE_FAILURE = 4, + + RTMP_STREAM_PUBLISH_STATE_DISCONNECTING = 5, +}; + +UENUM(BlueprintType) +enum class ERTMP_STREAM_PUBLISH_REASON : uint8 { + + RTMP_STREAM_PUBLISH_REASON_OK = 0, + + RTMP_STREAM_PUBLISH_REASON_INVALID_ARGUMENT = 1, + + RTMP_STREAM_PUBLISH_REASON_ENCRYPTED_STREAM_NOT_ALLOWED = 2, + + RTMP_STREAM_PUBLISH_REASON_CONNECTION_TIMEOUT = 3, + + RTMP_STREAM_PUBLISH_REASON_INTERNAL_SERVER_ERROR = 4, + + RTMP_STREAM_PUBLISH_REASON_RTMP_SERVER_ERROR = 5, + + RTMP_STREAM_PUBLISH_REASON_TOO_OFTEN = 6, + + RTMP_STREAM_PUBLISH_REASON_REACH_LIMIT = 7, + + RTMP_STREAM_PUBLISH_REASON_NOT_AUTHORIZED = 8, + + RTMP_STREAM_PUBLISH_REASON_STREAM_NOT_FOUND = 9, + + RTMP_STREAM_PUBLISH_REASON_FORMAT_NOT_SUPPORTED = 10, + + RTMP_STREAM_PUBLISH_REASON_NOT_BROADCASTER = 11, + + RTMP_STREAM_PUBLISH_REASON_TRANSCODING_NO_MIX_STREAM = 13, + + RTMP_STREAM_PUBLISH_REASON_NET_DOWN = 14, + + RTMP_STREAM_PUBLISH_REASON_INVALID_APPID = 15, + + RTMP_STREAM_PUBLISH_REASON_INVALID_PRIVILEGE = 16, + + RTMP_STREAM_UNPUBLISH_REASON_OK = 100, +}; + + +UENUM(BlueprintType) +enum class ERTMP_STREAMING_EVENT : uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE = 1, + + RTMP_STREAMING_EVENT_URL_ALREADY_IN_USE = 2, + + RTMP_STREAMING_EVENT_ADVANCED_FEATURE_NOT_SUPPORT = 3, + + RTMP_STREAMING_EVENT_REQUEST_TOO_OFTEN = 4, +}; + + +UENUM(BlueprintType) +enum class ECONNECTION_STATE_TYPE : uint8 { + INVALID_OPT_BPGEN_NULL = 0, + CONNECTION_STATE_DISCONNECTED = 1, + CONNECTION_STATE_CONNECTING = 2, + CONNECTION_STATE_CONNECTED = 3, + CONNECTION_STATE_RECONNECTING = 4, + CONNECTION_STATE_FAILED = 5, +}; + + +UENUM(BlueprintType) +enum class ECONNECTION_CHANGED_REASON_TYPE : uint8 +{ + CONNECTION_CHANGED_CONNECTING = 0, + + CONNECTION_CHANGED_JOIN_SUCCESS = 1, + + CONNECTION_CHANGED_INTERRUPTED = 2, + + CONNECTION_CHANGED_BANNED_BY_SERVER = 3, + + CONNECTION_CHANGED_JOIN_FAILED = 4, + + CONNECTION_CHANGED_LEAVE_CHANNEL = 5, + + CONNECTION_CHANGED_INVALID_APP_ID = 6, + + CONNECTION_CHANGED_INVALID_CHANNEL_NAME = 7, + + CONNECTION_CHANGED_INVALID_TOKEN = 8, + + CONNECTION_CHANGED_TOKEN_EXPIRED = 9, + + CONNECTION_CHANGED_REJECTED_BY_SERVER = 10, + + CONNECTION_CHANGED_SETTING_PROXY_SERVER = 11, + + CONNECTION_CHANGED_RENEW_TOKEN = 12, + + CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED = 13, + + CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT = 14, + + CONNECTION_CHANGED_REJOIN_SUCCESS = 15, + + CONNECTION_CHANGED_LOST = 16, + + CONNECTION_CHANGED_ECHO_TEST = 17, + + CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED_BY_USER = 18, + + CONNECTION_CHANGED_SAME_UID_LOGIN = 19, + + CONNECTION_CHANGED_TOO_MANY_BROADCASTERS = 20, + + CONNECTION_CHANGED_LICENSE_VERIFY_FAILED = 21, + + CONNECTION_CHANGED_CERTIFICATION_VERYFY_FAILURE = 22, + + CONNECTION_CHANGED_STREAM_CHANNEL_NOT_AVAILABLE = 23, + + CONNECTION_CHANGED_INCONSISTENT_APPID = 24 + +}; + + +UENUM(BlueprintType) +enum class EWLACC_MESSAGE_REASON : uint8 { + + WLACC_MESSAGE_REASON_WEAK_SIGNAL = 0, + + WLACC_MESSAGE_REASON_CHANNEL_CONGESTION = 1, +}; + +UENUM(BlueprintType) +enum class EWLACC_SUGGEST_ACTION : uint8 { + + WLACC_SUGGEST_ACTION_CLOSE_TO_WIFI = 0, + + WLACC_SUGGEST_ACTION_CONNECT_SSID = 1, + + WLACC_SUGGEST_ACTION_CHECK_5G = 2, + + WLACC_SUGGEST_ACTION_MODIFY_SSID = 3, +}; + + +USTRUCT(BlueprintType) +struct FWlAccStats { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WlAccStats") + int64 e2eDelayPercent = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WlAccStats") + int64 frozenRatioPercent = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WlAccStats") + int64 lossRatePercent = 0; + + FWlAccStats(){} + FWlAccStats(const agora::rtc::WlAccStats & AgoraData){ + e2eDelayPercent = AgoraData.e2eDelayPercent; + frozenRatioPercent = AgoraData.frozenRatioPercent; + lossRatePercent = AgoraData.lossRatePercent; + } + + agora::rtc::WlAccStats CreateAgoraData() const { + agora::rtc::WlAccStats AgoraData; + AgoraData.e2eDelayPercent = e2eDelayPercent; + AgoraData.frozenRatioPercent = frozenRatioPercent; + AgoraData.lossRatePercent = lossRatePercent; + return AgoraData; + } +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_NETWORK_TYPE : uint8 { + + NETWORK_TYPE_UNKNOWN = 0, + + NETWORK_TYPE_DISCONNECTED = 1, + + NETWORK_TYPE_LAN = 2, + + NETWORK_TYPE_WIFI = 3, + + NETWORK_TYPE_MOBILE_2G = 4, + + NETWORK_TYPE_MOBILE_3G = 5, + + NETWORK_TYPE_MOBILE_4G = 6, + + NETWORK_TYPE_MOBILE_5G = 7 + +}; + + +USTRUCT(BlueprintType) +struct FENUMWRAP_NETWORK_TYPE +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_NETWORK_TYPE") + EENUMCUSTOM_NETWORK_TYPE ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_UNKNOWN; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_8_ENTRIES(FENUMWRAP_NETWORK_TYPE, agora::rtc::NETWORK_TYPE, EENUMCUSTOM_NETWORK_TYPE, + NETWORK_TYPE_UNKNOWN, + NETWORK_TYPE_DISCONNECTED, + NETWORK_TYPE_LAN, + NETWORK_TYPE_WIFI, + NETWORK_TYPE_MOBILE_2G, + NETWORK_TYPE_MOBILE_3G, + NETWORK_TYPE_MOBILE_4G, + NETWORK_TYPE_MOBILE_5G) +}; + + +UENUM(BlueprintType) +enum class EENCRYPTION_ERROR_TYPE : uint8 { + ENCRYPTION_ERROR_INTERNAL_FAILURE = 0, + ENCRYPTION_ERROR_DECRYPTION_FAILURE = 1, + ENCRYPTION_ERROR_ENCRYPTION_FAILURE = 2, + ENCRYPTION_ERROR_DATASTREAM_DECRYPTION_FAILURE = 3, + ENCRYPTION_ERROR_DATASTREAM_ENCRYPTION_FAILURE = 4, + +}; + + +UENUM(BlueprintType) +enum class EPERMISSION_TYPE : uint8 { + RECORD_AUDIO = 0, + CAMERA = 1, + SCREEN_CAPTURE = 2, +}; + + +USTRUCT(BlueprintType) +struct FUserInfo +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") + FString userAccount = ""; + + FUserInfo(){} + FUserInfo(const agora::rtc::UserInfo & AgoraData){ + uid = AgoraData.uid; + userAccount = UTF8_TO_TCHAR(AgoraData.userAccount); + } + + agora::rtc::UserInfo CreateAgoraData() const { + agora::rtc::UserInfo AgoraData; + AgoraData.uid = uid; + SET_UABT_FSTRING_TO_CHAR_ARRAY(AgoraData.userAccount,this->userAccount,agora::rtc::MAX_USER_ACCOUNT_LENGTH) + return AgoraData; + } + + void FreeAgoraData(agora::rtc::UserInfo & AgoraData) const { + + } +}; + +UENUM(BlueprintType) +enum class EMEDIA_TRACE_EVENT : uint8 { + + MEDIA_TRACE_EVENT_VIDEO_RENDERED = 0, + + MEDIA_TRACE_EVENT_VIDEO_DECODED = 1, +}; + + + +USTRUCT(BlueprintType) +struct FVideoRenderingTracingInfo { + + GENERATED_BODY() + +public: + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") + int elapsedTime = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") + int start2JoinChannel = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") + int join2JoinSuccess = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") + int joinSuccess2RemoteJoined = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") + int remoteJoined2SetView = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") + int remoteJoined2UnmuteVideo = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") + int remoteJoined2PacketReceived = 0; + + FVideoRenderingTracingInfo() {} + FVideoRenderingTracingInfo(const agora::rtc::VideoRenderingTracingInfo& AgoraData) { + elapsedTime = AgoraData.elapsedTime; + start2JoinChannel = AgoraData.start2JoinChannel; + join2JoinSuccess = AgoraData.join2JoinSuccess; + joinSuccess2RemoteJoined = AgoraData.joinSuccess2RemoteJoined; + remoteJoined2SetView = AgoraData.remoteJoined2SetView; + remoteJoined2UnmuteVideo = AgoraData.remoteJoined2UnmuteVideo; + remoteJoined2PacketReceived = AgoraData.remoteJoined2PacketReceived; + } + + agora::rtc::VideoRenderingTracingInfo CreateAgoraData() const { + agora::rtc::VideoRenderingTracingInfo AgoraData; + AgoraData.elapsedTime = elapsedTime; + AgoraData.start2JoinChannel = start2JoinChannel; + AgoraData.join2JoinSuccess = join2JoinSuccess; + AgoraData.joinSuccess2RemoteJoined = joinSuccess2RemoteJoined; + AgoraData.remoteJoined2SetView = remoteJoined2SetView; + AgoraData.remoteJoined2UnmuteVideo = remoteJoined2UnmuteVideo; + AgoraData.remoteJoined2PacketReceived = remoteJoined2PacketReceived; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::VideoRenderingTracingInfo& AgoraData) const { + // no need to free + } +}; + + + +USTRUCT(BlueprintType) +struct FTranscodingVideoStream { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + int64 remoteUserUid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + FString imageUrl = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + int mediaPlayerId = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + int x = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + int y = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + int width = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + int height = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + int zOrder = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + float alpha = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") + bool mirror = false; + + FTranscodingVideoStream(){} + FTranscodingVideoStream(const agora::rtc::TranscodingVideoStream & AgoraData){ + sourceType = static_cast(AgoraData.sourceType); + remoteUserUid = AgoraData.remoteUserUid; + imageUrl = UTF8_TO_TCHAR(AgoraData.imageUrl); + mediaPlayerId = AgoraData.mediaPlayerId; + x = AgoraData.x; + y = AgoraData.y; + width = AgoraData.width; + height = AgoraData.height; + zOrder = AgoraData.zOrder; + alpha = AgoraData.alpha; + mirror = AgoraData.mirror; + } + + agora::rtc::TranscodingVideoStream CreateAgoraData() const{ + + agora::rtc::TranscodingVideoStream AgoraData; + AgoraData.sourceType = static_cast(sourceType); + AgoraData.remoteUserUid = remoteUserUid; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.imageUrl,this->imageUrl) + AgoraData.mediaPlayerId = mediaPlayerId; + AgoraData.x = x; + AgoraData.y = y; + AgoraData.width = width; + AgoraData.height = height; + AgoraData.zOrder = zOrder; + AgoraData.alpha = alpha; + AgoraData.mirror = mirror; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::TranscodingVideoStream & AgoraData) const{ + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.imageUrl) + } +}; + + +UENUM(BlueprintType) +enum class EVIDEO_TRANSCODER_ERROR : uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + VT_ERR_VIDEO_SOURCE_NOT_READY = 1, + VT_ERR_INVALID_VIDEO_SOURCE_TYPE = 2, + VT_ERR_INVALID_IMAGE_PATH = 3, + VT_ERR_UNSUPPORT_IMAGE_FORMAT = 4, + VT_ERR_INVALID_LAYOUT = 5, + VT_ERR_INTERNAL = 20 + +}; + +UENUM(BlueprintType) +enum class EUPLOAD_ERROR_REASON : uint8 +{ + UPLOAD_SUCCESS = 0, + UPLOAD_NET_ERROR = 1, + UPLOAD_SERVER_ERROR = 2, +}; + +UENUM(BlueprintType) +enum class ESTREAM_SUBSCRIBE_STATE : uint8 { + SUB_STATE_IDLE = 0, + SUB_STATE_NO_SUBSCRIBED = 1, + SUB_STATE_SUBSCRIBING = 2, + SUB_STATE_SUBSCRIBED = 3 +}; + +UENUM(BlueprintType) +enum class ESTREAM_PUBLISH_STATE : uint8 { + PUB_STATE_IDLE = 0, + PUB_STATE_NO_PUBLISHED = 1, + PUB_STATE_PUBLISHING = 2, + PUB_STATE_PUBLISHED = 3 +}; + + + +USTRUCT(BlueprintType) +struct FVideoLayout +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoLayout") + FString channelId = ""; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoLayout") + int64 uid = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoLayout") + FString strUid = ""; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoLayout") + int64 x = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoLayout") + int64 y = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoLayout") + int64 width = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoLayout") + int64 height = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoLayout") + int64 videoState = 0; + + FVideoLayout(){} + FVideoLayout(const agora::VideoLayout & AgoraData){ + channelId = UTF8_TO_TCHAR(AgoraData.channelId); + uid = AgoraData.uid; + strUid = UTF8_TO_TCHAR(AgoraData.strUid); + x = AgoraData.x; + y = AgoraData.y; + width = AgoraData.width; + height = AgoraData.height; + videoState = AgoraData.videoState; + } + + agora::VideoLayout CreateAgoraData() const { + agora::VideoLayout AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.channelId, channelId) + AgoraData.uid = uid; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.strUid, strUid) + AgoraData.x = x; + AgoraData.y = y; + AgoraData.width = width; + AgoraData.height = height; + AgoraData.videoState = videoState; + return AgoraData; + } + + void FreeAgoraData(agora::VideoLayout & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.channelId) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.strUid) + } +}; + + +USTRUCT(BlueprintType) +struct FAgoraMetadata +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraMetadata") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraMetadata") + int64 size = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraMetadata") + FString buffer; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraMetadata") + int64 timeStampMs = 0; + + FAgoraMetadata(){} + FAgoraMetadata(const agora::rtc::IMetadataObserver::Metadata & AgoraData){ + uid = AgoraData.uid; + size = AgoraData.size; + buffer = UTF8_TO_TCHAR(AgoraData.buffer); + timeStampMs = AgoraData.timeStampMs; + } + + agora::rtc::IMetadataObserver::Metadata CreateAgoraData() const { + agora::rtc::IMetadataObserver::Metadata AgoraData; + AgoraData.uid = uid; + AgoraData.size = size; + SET_UABT_FSTRING_TO_UNSIGNED_CHAR___MEMALLOC(AgoraData.buffer,this->buffer) + AgoraData.timeStampMs = timeStampMs; + return AgoraData; + } + void FreeAgoraData (agora::rtc::IMetadataObserver::Metadata& AgoraData){ + SET_UABT_FSTRING_TO_UNSIGNED_CHAR___MEMFREE(AgoraData.buffer) + } +}; + + +UENUM(BlueprintType) +enum class EDIRECT_CDN_STREAMING_STATE : uint8 { + + 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, +}; + +UENUM(BlueprintType) +enum class EDIRECT_CDN_STREAMING_REASON : uint8 { + + DIRECT_CDN_STREAMING_REASON_OK = 0, + + DIRECT_CDN_STREAMING_REASON_FAILED = 1, + + DIRECT_CDN_STREAMING_REASON_AUDIO_PUBLICATION = 2, + + DIRECT_CDN_STREAMING_REASON_VIDEO_PUBLICATION = 3, + + DIRECT_CDN_STREAMING_REASON_NET_CONNECT = 4, + + DIRECT_CDN_STREAMING_REASON_BAD_NAME = 5, +}; + + +USTRUCT(BlueprintType) +struct FDirectCdnStreamingStats { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") + int videoWidth = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") + int videoHeight = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") + int fps = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") + int videoBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") + int audioBitrate = 0; + + FDirectCdnStreamingStats(){} + FDirectCdnStreamingStats(const agora::rtc::DirectCdnStreamingStats & AgoraData){ + videoWidth = AgoraData.videoWidth; + videoHeight = AgoraData.videoHeight; + fps = AgoraData.fps; + videoBitrate = AgoraData.videoBitrate; + audioBitrate = AgoraData.audioBitrate; + } + + agora::rtc::DirectCdnStreamingStats CreateAgoraData() const { + agora::rtc::DirectCdnStreamingStats AgoraData; + AgoraData.videoWidth = videoWidth; + AgoraData.videoHeight = videoHeight; + AgoraData.fps = fps; + AgoraData.videoBitrate = videoBitrate; + AgoraData.audioBitrate = audioBitrate; + return AgoraData; + } + void FreeAgoraData(agora::rtc::DirectCdnStreamingStats & AgoraData) const { + + } +}; + + +UENUM(BlueprintType) +enum class EUSER_OFFLINE_REASON_TYPE : uint8 { + + USER_OFFLINE_QUIT = 0, + + USER_OFFLINE_DROPPED = 1, + + USER_OFFLINE_BECOME_AUDIENCE = 2, +}; + + +USTRUCT(BlueprintType) +struct FExtensionContext { + + GENERATED_BODY() + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionContext") + bool isValid = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionContext") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionContext") + FString providerName = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionContext") + FString extensionName = ""; + + FExtensionContext(){} + FExtensionContext(const agora::rtc::ExtensionContext& AgoraData){ + isValid = AgoraData.isValid; + uid = AgoraData.uid; + providerName = UTF8_TO_TCHAR(AgoraData.providerName); + extensionName = UTF8_TO_TCHAR(AgoraData.extensionName); + } + + agora::rtc::ExtensionContext CreateAgoraData() const { + agora::rtc::ExtensionContext AgoraData; + AgoraData.isValid = isValid; + AgoraData.uid = uid; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.providerName, providerName) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.extensionName, extensionName) + return AgoraData; + } + void FreeAgoraData(agora::rtc::ExtensionContext& AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.providerName) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.extensionName) + } +}; + + +#pragma endregion EventHandler + + +#pragma region MediaPlayer +UENUM(BlueprintType) +enum class EMEDIA_PLAYER_STATE : uint8 { + PLAYER_STATE_IDLE = 0, + PLAYER_STATE_OPENING, + PLAYER_STATE_OPEN_COMPLETED, + PLAYER_STATE_PLAYING, + PLAYER_STATE_PAUSED, + PLAYER_STATE_PLAYBACK_COMPLETED, + PLAYER_STATE_PLAYBACK_ALL_LOOPS_COMPLETED, + PLAYER_STATE_STOPPED, + PLAYER_STATE_PAUSING_INTERNAL = 50, + PLAYER_STATE_STOPPING_INTERNAL, + PLAYER_STATE_SEEKING_INTERNAL, + PLAYER_STATE_GETTING_INTERNAL, + PLAYER_STATE_NONE_INTERNAL, + PLAYER_STATE_DO_NOTHING_INTERNAL, + PLAYER_STATE_SET_TRACK_INTERNAL, + PLAYER_STATE_FAILED = 100, +}; + +#pragma endregion MediaPlayer + +#pragma region Rtc Engine + + +UENUM(BlueprintType) +enum class EENCRYPTION_MODE :uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + AES_128_XTS = 1, + + AES_128_ECB = 2, + + AES_256_XTS = 3, + + SM4_128_ECB = 4, + + AES_128_GCM = 5, + + AES_256_GCM = 6, + + AES_128_GCM2 = 7, + + AES_256_GCM2 = 8, + + MODE_END, +}; + +USTRUCT(BlueprintType) +struct FEncryptionConfig +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig") + EENCRYPTION_MODE encryptionMode = EENCRYPTION_MODE::AES_128_GCM; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig") + FString encryptionKey = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig") + FString encryptionKdfSalt = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig") + bool datastreamEncryptionEnabled = false; + + FEncryptionConfig(){} + FEncryptionConfig(const agora::rtc::EncryptionConfig & AgoraData){ + encryptionMode = static_cast(AgoraData.encryptionMode); + encryptionKey = UTF8_TO_TCHAR(AgoraData.encryptionKey); + + char valencryptionKdfSalt[32] = {0}; + int AgoraCount = 32; + for (int i = 0; i < AgoraCount; i++) { + + encryptionKdfSalt[i] = AgoraData.encryptionKdfSalt[i]; + } + encryptionKdfSalt = valencryptionKdfSalt; + + datastreamEncryptionEnabled = AgoraData.datastreamEncryptionEnabled; + } + + agora::rtc::EncryptionConfig CreateAgoraData() const { + agora::rtc::EncryptionConfig AgoraData; + AgoraData.encryptionMode = static_cast(encryptionMode); + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.encryptionKey,this->encryptionKey) + + + std::string StdencryptionKdfSalt = TCHAR_TO_UTF8(*encryptionKdfSalt); + int AgoraCount = 32; + for (int i = 0; i < AgoraCount; i++) { + if(i >= StdencryptionKdfSalt.size()){ + break; + } + AgoraData.encryptionKdfSalt[i] = StdencryptionKdfSalt[i]; + } + + AgoraData.datastreamEncryptionEnabled = datastreamEncryptionEnabled; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::EncryptionConfig & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.encryptionKey) + } +}; + +#pragma endregion Rtc Engine + + +UENUM(BlueprintType) +enum class ECLIENT_ROLE_TYPE : uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + CLIENT_ROLE_BROADCASTER = 1, + CLIENT_ROLE_AUDIENCE = 2, +}; + + +UENUM(BlueprintType) +enum class ECHANNEL_PROFILE_TYPE : uint8 { + CHANNEL_PROFILE_COMMUNICATION = 0, + CHANNEL_PROFILE_LIVE_BROADCASTING = 1, + CHANNEL_PROFILE_GAME = 2, + CHANNEL_PROFILE_CLOUD_GAMING = 3, + CHANNEL_PROFILE_COMMUNICATION_1v1 = 4, +}; + + +UENUM(BlueprintType) +enum class EAUDIENCE_LATENCY_LEVEL_TYPE : uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + AUDIENCE_LATENCY_LEVEL_LOW_LATENCY = 1, + AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY = 2, +}; + + +USTRUCT(BlueprintType) +struct FClientRoleOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ClientRoleOptions") + EAUDIENCE_LATENCY_LEVEL_TYPE audienceLatencyLevel = EAUDIENCE_LATENCY_LEVEL_TYPE::AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY; + + FClientRoleOptions() {} + + FClientRoleOptions(const agora::rtc::ClientRoleOptions& AgoraData) { + audienceLatencyLevel = static_cast(AgoraData.audienceLatencyLevel); + } + + agora::rtc::ClientRoleOptions CreateAgoraData() const { + agora::rtc::ClientRoleOptions AgoraData; + AgoraData.audienceLatencyLevel = static_cast(audienceLatencyLevel); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ClientRoleOptions& AgoraData) const { + + } +}; + + + +UENUM(BlueprintType) +enum class EEXTERNAL_VIDEO_SOURCE_TYPE :uint8 { + /** + * 0: non-encoded video frame. + */ + VIDEO_FRAME = 0, + /** + * 1: encoded video frame. + */ + ENCODED_VIDEO_FRAME, +}; + +UENUM(BlueprintType) +enum class ETCcMode :uint8 { + + CC_ENABLED, + + CC_DISABLED, +}; + + +USTRUCT(BlueprintType) +struct FSenderOptions +{ + GENERATED_BODY() + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SenderOptions") + ETCcMode ccMode = ETCcMode::CC_ENABLED; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SenderOptions") + EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_GENERIC_H264; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SenderOptions") + int targetBitrate = 6500; + + + agora::rtc::SenderOptions CreateAgoraData() const { + agora::rtc::SenderOptions AgoraData; + AgoraData.ccMode = (agora::rtc::TCcMode)ccMode; + AgoraData.codecType = (agora::rtc::VIDEO_CODEC_TYPE)codecType; + AgoraData.targetBitrate = targetBitrate; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::SenderOptions& AgoraData) const { + + } + +}; + + + +UENUM(BlueprintType) +enum class ERENDER_MODE_TYPE : uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + RENDER_MODE_HIDDEN = 1, + RENDER_MODE_FIT = 2, + RENDER_MODE_ADAPTIVE = 3, +}; + +UENUM(BlueprintType) +enum class EVIDEO_MIRROR_MODE_TYPE : uint8 { + VIDEO_MIRROR_MODE_AUTO = 0, + VIDEO_MIRROR_MODE_ENABLED = 1, + VIDEO_MIRROR_MODE_DISABLED = 2, +}; + + + +USTRUCT(BlueprintType) +struct FRectangle +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Rectangle") + int x = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Rectangle") + int y = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Rectangle") + int width = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Rectangle") + int height = 0; + + FRectangle(){} + FRectangle(const agora::rtc::Rectangle & AgoraData){ + x = AgoraData.x; + y = AgoraData.y; + width = AgoraData.width; + height = AgoraData.height; + } + + agora::rtc::Rectangle CreateAgoraData() const { + agora::rtc::Rectangle AgoraData; + AgoraData.x = x; + AgoraData.y = y; + AgoraData.width = width; + AgoraData.height = height; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::Rectangle& AgoraData) const { + + } +}; + + +UENUM(BlueprintType) +enum class EVIDEO_VIEW_SETUP_MODE : uint8 { + + VIDEO_VIEW_SETUP_REPLACE = 0, + + VIDEO_VIEW_SETUP_ADD = 1, + + VIDEO_VIEW_SETUP_REMOVE = 2, +}; + + +UENUM(BlueprintType) +enum class EVIDEO_MODULE_POSITION :uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + POSITION_POST_CAPTURER = 1 << 0, + POSITION_PRE_RENDERER = 1 << 1, + POSITION_PRE_ENCODER = 1 << 2, + POSITION_POST_CAPTURER_ORIGIN = 1 << 3, +}; + + +USTRUCT(BlueprintType) +struct FVideoCanvas +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + int64 subviewUid = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + UImage* view = nullptr; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + int64 backgroundColor = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + ERENDER_MODE_TYPE renderMode = ERENDER_MODE_TYPE::RENDER_MODE_HIDDEN; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + EVIDEO_MIRROR_MODE_TYPE mirrorMode = EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_AUTO; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + EVIDEO_VIEW_SETUP_MODE setupMode = EVIDEO_VIEW_SETUP_MODE::VIDEO_VIEW_SETUP_REPLACE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + int mediaPlayerId = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + FRectangle cropArea; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + bool enableAlphaMask = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") + EVIDEO_MODULE_POSITION position = EVIDEO_MODULE_POSITION::POSITION_POST_CAPTURER; + + + FVideoCanvas(){} + FVideoCanvas(const agora::rtc::VideoCanvas & AgoraData){ + view = nullptr; // [not support] + uid = AgoraData.uid; + subviewUid = AgoraData.subviewUid; + backgroundColor = AgoraData.backgroundColor; + renderMode = static_cast(AgoraData.renderMode); + mirrorMode = static_cast(AgoraData.mirrorMode); + setupMode = static_cast(AgoraData.setupMode); + sourceType = static_cast(AgoraData.sourceType); + mediaPlayerId = AgoraData.mediaPlayerId; + cropArea = FRectangle(AgoraData.cropArea); + enableAlphaMask = AgoraData.enableAlphaMask; + position = static_cast(AgoraData.position); + } + + agora::rtc::VideoCanvas CreateAgoraData() const { + agora::rtc::VideoCanvas AgoraData; + AgoraData.view = (agora::view_t) view; + AgoraData.uid = uid; + AgoraData.subviewUid = subviewUid; + AgoraData.backgroundColor = backgroundColor; + AgoraData.renderMode = static_cast(renderMode); + AgoraData.mirrorMode = static_cast(mirrorMode); + AgoraData.setupMode = static_cast(setupMode); + AgoraData.sourceType = static_cast(sourceType); + AgoraData.mediaPlayerId = AgoraData.mediaPlayerId; + AgoraData.cropArea = cropArea.CreateAgoraData(); + AgoraData.enableAlphaMask = enableAlphaMask; + AgoraData.position = static_cast(position); + + return AgoraData; + } + + void FreeAgoraData(agora::rtc::VideoCanvas& AgoraData) const { + cropArea.FreeAgoraData(AgoraData.cropArea); + } +}; + + +USTRUCT(BlueprintType) +struct FRtcEngineContext +{ + GENERATED_BODY() + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + FString appId = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + EAgoraBPuEventHandlerType EventHandlerCreationType = EAgoraBPuEventHandlerType::EventHandler; + //UIRtcEngineEventHandler* eventHandler = nullptr; + //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + //int64 context = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + FString license = ""; + //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + //ECHANNEL_PROFILE_TYPE channelProfile = ECHANNEL_PROFILE_TYPE::CHANNEL_PROFILE_LIVE_BROADCASTING; + //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + //EAUDIO_SCENARIO_TYPE audioScenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT; + //// If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + //bool threadPriority_SetValue = false; + //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + //ETHREAD_PRIORITY_TYPE threadPriority = ETHREAD_PRIORITY_TYPE::NORMAL; + //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + //FLogConfig logConfig = FLogConfig(); + //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + //FENUMWRAP_AREA_CODE areaCode = EENUMCUSTOM_AREA_CODE::AREA_CODE_GLOB; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") + bool useExternalEglContext = false; + + + agora::rtc::RtcEngineContext CreateAgoraData() const { + agora::rtc::RtcEngineContext AgoraData; + + char* AppIdCharPtr = new char[appId.Len() + 1]; + FMemory::Memcpy(AppIdCharPtr, TCHAR_TO_UTF8(*appId), appId.Len()); + AppIdCharPtr[appId.Len()] = '\0'; + AgoraData.appId = AppIdCharPtr; + return AgoraData; + } + + + void FreeAgoraData(agora::rtc::RtcEngineContext& AgoraData) const { + if (AgoraData.appId) { + delete[] AgoraData.appId; + AgoraData.appId = nullptr; + } + } +}; + +USTRUCT(BlueprintType) +struct FRtcConnection +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcConnection") + FString channelId = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcConnection") + int64 localUid = 0; + + FRtcConnection(){} + FRtcConnection(const agora::rtc::RtcConnection & AgoraData){ + channelId = UTF8_TO_TCHAR(AgoraData.channelId); + localUid = AgoraData.localUid; + } + + agora::rtc::RtcConnection CreateAgoraData() const { + agora::rtc::RtcConnection AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.channelId, this->channelId) + AgoraData.localUid = localUid; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::RtcConnection & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.channelId) + } + +}; + + + + + + +#pragma region Rtc Engine 2 +UENUM(BlueprintType) +enum class EENUMCUSTOM_VIDEO_CODEC_CAPABILITY_LEVEL : uint8{ + CODEC_CAPABILITY_LEVEL_UNSPECIFIED, + CODEC_CAPABILITY_LEVEL_BASIC_SUPPORT, + CODEC_CAPABILITY_LEVEL_1080P30FPS, + CODEC_CAPABILITY_LEVEL_1080P60FPS, + CODEC_CAPABILITY_LEVEL_4K60FPS +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_VIDEO_CODEC_CAPABILITY_LEVEL +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_VIDEO_CODEC_CAPABILITY_LEVEL") + EENUMCUSTOM_VIDEO_CODEC_CAPABILITY_LEVEL ValueWrapper = EENUMCUSTOM_VIDEO_CODEC_CAPABILITY_LEVEL::CODEC_CAPABILITY_LEVEL_UNSPECIFIED; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_5_ENTRIES(FENUMWRAP_VIDEO_CODEC_CAPABILITY_LEVEL, agora::rtc::VIDEO_CODEC_CAPABILITY_LEVEL, EENUMCUSTOM_VIDEO_CODEC_CAPABILITY_LEVEL, + CODEC_CAPABILITY_LEVEL_UNSPECIFIED, + CODEC_CAPABILITY_LEVEL_BASIC_SUPPORT, + CODEC_CAPABILITY_LEVEL_1080P30FPS, + CODEC_CAPABILITY_LEVEL_1080P60FPS, + CODEC_CAPABILITY_LEVEL_4K60FPS) +}; + +USTRUCT(BlueprintType) +struct FCodecCapLevels { + + GENERATED_BODY() + +public: + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FCodecCapLevels") + FENUMWRAP_VIDEO_CODEC_CAPABILITY_LEVEL hwDecodingLevel; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FCodecCapLevels") + FENUMWRAP_VIDEO_CODEC_CAPABILITY_LEVEL swDecodingLevel; + + FCodecCapLevels() {} + FCodecCapLevels(const agora::rtc::CodecCapLevels& AgoraData) { + hwDecodingLevel = AgoraData.hwDecodingLevel; + swDecodingLevel = AgoraData.swDecodingLevel; + } + + agora::rtc::CodecCapLevels CreateAgoraData() const { + agora::rtc::CodecCapLevels AgoraData; + AgoraData.hwDecodingLevel = hwDecodingLevel.GetRawValue(); + AgoraData.swDecodingLevel = swDecodingLevel.GetRawValue(); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::CodecCapLevels& AgoraData) const { + // no need to free + } +}; + +USTRUCT(BlueprintType) +struct FCodecCapInfo { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CodecCapInfo") + EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_NONE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CodecCapInfo") + int codecCapMask = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CodecCapInfo") + FCodecCapLevels codecLevels; + + FCodecCapInfo(){} + FCodecCapInfo(const agora::rtc::CodecCapInfo & AgoraData){ + codecType = static_cast(AgoraData.codecType); + codecCapMask = AgoraData.codecCapMask; + codecLevels = AgoraData.codecLevels; + } + + agora::rtc::CodecCapInfo CreateAgoraData() const { + agora::rtc::CodecCapInfo AgoraData; + AgoraData.codecType = static_cast(codecType); + AgoraData.codecCapMask = codecCapMask; + AgoraData.codecLevels = codecLevels.CreateAgoraData(); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::CodecCapInfo& AgoraData) const { + codecLevels.FreeAgoraData(AgoraData.codecLevels); + } +}; + + + +USTRUCT(BlueprintType) +struct FChannelMediaOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishCameraTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishSecondaryCameraTrack = EAgoraOptional::AGORA_NULL_VALUE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishThirdCameraTrack = EAgoraOptional::AGORA_NULL_VALUE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishFourthCameraTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishMicrophoneTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishScreenCaptureVideo = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishScreenCaptureAudio = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishScreenTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishSecondaryScreenTrack = EAgoraOptional::AGORA_NULL_VALUE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishThirdScreenTrack = EAgoraOptional::AGORA_NULL_VALUE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishFourthScreenTrack = EAgoraOptional::AGORA_NULL_VALUE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishCustomAudioTrack = EAgoraOptional::AGORA_NULL_VALUE; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool publishCustomAudioTrackId_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + int publishCustomAudioTrackId = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishCustomVideoTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishEncodedVideoTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishMediaPlayerAudioTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishMediaPlayerVideoTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishTranscodedVideoTrack = EAgoraOptional::AGORA_NULL_VALUE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishMixedAudioTrack = EAgoraOptional::AGORA_NULL_VALUE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishLipSyncTrack = EAgoraOptional::AGORA_NULL_VALUE; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional autoSubscribeAudio = EAgoraOptional::AGORA_TRUE_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional autoSubscribeVideo = EAgoraOptional::AGORA_TRUE_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional enableAudioRecordingOrPlayout = EAgoraOptional::AGORA_NULL_VALUE; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool publishMediaPlayerId_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + int publishMediaPlayerId = 0; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool clientRoleType_SetValue = true; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + ECLIENT_ROLE_TYPE clientRoleType = ECLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool audienceLatencyLevel_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAUDIENCE_LATENCY_LEVEL_TYPE audienceLatencyLevel = EAUDIENCE_LATENCY_LEVEL_TYPE::AUDIENCE_LATENCY_LEVEL_LOW_LATENCY; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool defaultVideoStreamType_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EVIDEO_STREAM_TYPE defaultVideoStreamType = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool channelProfile_SetValue = true; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + ECHANNEL_PROFILE_TYPE channelProfile = ECHANNEL_PROFILE_TYPE::CHANNEL_PROFILE_LIVE_BROADCASTING; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool audioDelayMs_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + int audioDelayMs = 0; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool mediaPlayerAudioDelayMs_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + int mediaPlayerAudioDelayMs = 0; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool token_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + FString token = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional enableBuiltInMediaEncryption = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional publishRhythmPlayerTrack = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional isInteractiveAudience = EAgoraOptional::AGORA_NULL_VALUE; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool customVideoTrackId_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + int64 customVideoTrackId = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional isAudioFilterable = EAgoraOptional::AGORA_NULL_VALUE; + + + FChannelMediaOptions(){} + + FChannelMediaOptions(const agora::rtc::ChannelMediaOptions & AgoraData){ + + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishCameraTrack, AgoraData.publishCameraTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishSecondaryCameraTrack, AgoraData.publishSecondaryCameraTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishThirdCameraTrack, AgoraData.publishThirdCameraTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishFourthCameraTrack, AgoraData.publishFourthCameraTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishMicrophoneTrack, AgoraData.publishMicrophoneTrack) + +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishScreenCaptureVideo, AgoraData.publishScreenCaptureVideo) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishScreenCaptureAudio, AgoraData.publishScreenCaptureAudio) +#else + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishScreenTrack, AgoraData.publishScreenTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishSecondaryScreenTrack, AgoraData.publishSecondaryScreenTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishThirdScreenTrack, AgoraData.publishThirdScreenTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishFourthScreenTrack, AgoraData.publishFourthScreenTrack) + +#endif + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishCustomAudioTrack, AgoraData.publishCustomAudioTrack) + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->publishCustomAudioTrackId, AgoraData.publishCustomAudioTrackId) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishCustomVideoTrack, AgoraData.publishCustomVideoTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishEncodedVideoTrack, AgoraData.publishEncodedVideoTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishMediaPlayerAudioTrack, AgoraData.publishMediaPlayerAudioTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishMediaPlayerVideoTrack, AgoraData.publishMediaPlayerVideoTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishTranscodedVideoTrack, AgoraData.publishTranscodedVideoTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishMixedAudioTrack, AgoraData.publishMixedAudioTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishLipSyncTrack, AgoraData.publishLipSyncTrack) + SET_UEBP_OPTIONAL_VAL_BOOL(this->autoSubscribeAudio, AgoraData.autoSubscribeAudio) + SET_UEBP_OPTIONAL_VAL_BOOL(this->autoSubscribeVideo, AgoraData.autoSubscribeVideo) + SET_UEBP_OPTIONAL_VAL_BOOL(this->enableAudioRecordingOrPlayout, AgoraData.enableAudioRecordingOrPlayout) + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->publishMediaPlayerId, AgoraData.publishMediaPlayerId) + + SET_UEBP_OPTIONAL_VAL_ASSIGN_VAL(this->clientRoleType,AgoraData.clientRoleType,static_cast(AgoraData.clientRoleType.value())) + + SET_UEBP_OPTIONAL_VAL_ASSIGN_VAL(this->audienceLatencyLevel, AgoraData.audienceLatencyLevel, static_cast(AgoraData.audienceLatencyLevel.value())) + + SET_UEBP_OPTIONAL_VAL_ASSIGN_VAL(this->defaultVideoStreamType, AgoraData.defaultVideoStreamType, static_cast(AgoraData.defaultVideoStreamType.value())) + + SET_UEBP_OPTIONAL_VAL_ASSIGN_VAL(this->channelProfile, AgoraData.channelProfile, static_cast(AgoraData.channelProfile.value())) + + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->audioDelayMs, AgoraData.audioDelayMs) + + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->mediaPlayerAudioDelayMs, AgoraData.mediaPlayerAudioDelayMs) + + SET_UEBP_OPTIONAL_VAL_FString(this->token,AgoraData.token) + + SET_UEBP_OPTIONAL_VAL_BOOL(this->enableBuiltInMediaEncryption, AgoraData.enableBuiltInMediaEncryption) + + SET_UEBP_OPTIONAL_VAL_BOOL(this->publishRhythmPlayerTrack, AgoraData.publishRhythmPlayerTrack) + + SET_UEBP_OPTIONAL_VAL_BOOL(this->isInteractiveAudience, AgoraData.isInteractiveAudience) + + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->customVideoTrackId, AgoraData.customVideoTrackId) + + SET_UEBP_OPTIONAL_VAL_BOOL(this->isAudioFilterable, AgoraData.isAudioFilterable) + } + + agora::rtc::ChannelMediaOptions CreateAgoraData() const{ + agora::rtc::ChannelMediaOptions AgoraData; + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishCameraTrack, this->publishCameraTrack) + + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishSecondaryCameraTrack, this->publishSecondaryCameraTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishThirdCameraTrack, this->publishThirdCameraTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishFourthCameraTrack, this->publishFourthCameraTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishMicrophoneTrack, this->publishMicrophoneTrack) + +#if defined(__ANDROID__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishScreenCaptureVideo, this->publishScreenCaptureVideo) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishScreenCaptureAudio, this->publishScreenCaptureAudio) +#else + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishScreenTrack, this->publishScreenTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishSecondaryScreenTrack, this->publishSecondaryScreenTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishThirdScreenTrack, this->publishThirdScreenTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishFourthScreenTrack, this->publishFourthScreenTrack) +#endif + + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishCustomAudioTrack, this->publishCustomAudioTrack) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.publishCustomAudioTrackId, this->publishCustomAudioTrackId) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishCustomVideoTrack, this->publishCustomVideoTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishEncodedVideoTrack, this->publishEncodedVideoTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishMediaPlayerAudioTrack, this->publishMediaPlayerAudioTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishMediaPlayerVideoTrack, this->publishMediaPlayerVideoTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishTranscodedVideoTrack, this->publishTranscodedVideoTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishMixedAudioTrack, this->publishMixedAudioTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishLipSyncTrack, this->publishLipSyncTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.autoSubscribeAudio, this->autoSubscribeAudio) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.autoSubscribeVideo, this->autoSubscribeVideo) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.enableAudioRecordingOrPlayout, this->enableAudioRecordingOrPlayout) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.publishMediaPlayerId, this->publishMediaPlayerId) + SET_AGORA_OPTIONAL_VAL_ASSIGN_VAL(AgoraData.clientRoleType, this->clientRoleType,static_cast(this->clientRoleType)) + SET_AGORA_OPTIONAL_VAL_ASSIGN_VAL(AgoraData.audienceLatencyLevel, this->audienceLatencyLevel, static_cast(this->audienceLatencyLevel)) + SET_AGORA_OPTIONAL_VAL_ASSIGN_VAL(AgoraData.defaultVideoStreamType, this->defaultVideoStreamType, static_cast(this->defaultVideoStreamType)) + SET_AGORA_OPTIONAL_VAL_ASSIGN_VAL(AgoraData.channelProfile, this->channelProfile, static_cast(this->channelProfile)) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.audioDelayMs, this->audioDelayMs) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.mediaPlayerAudioDelayMs, this->mediaPlayerAudioDelayMs) + SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOALLOC(AgoraData.token, this->token) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.enableBuiltInMediaEncryption, this->enableBuiltInMediaEncryption) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.publishRhythmPlayerTrack, this->publishRhythmPlayerTrack) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.isInteractiveAudience, this->isInteractiveAudience) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.customVideoTrackId, this->customVideoTrackId) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.isAudioFilterable, this->isAudioFilterable) + + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ChannelMediaOptions& AgoraData) const { + SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOFREE(AgoraData.token) + } +}; + + + +USTRUCT(BlueprintType) +struct FLeaveChannelOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LeaveChannelOptions") + bool stopAudioMixing = true; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LeaveChannelOptions") + bool stopAllEffect = true; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LeaveChannelOptions") + bool stopMicrophoneRecording = true; + + + FLeaveChannelOptions() {} + + FLeaveChannelOptions(const agora::rtc::LeaveChannelOptions& AgoraData) { + this->stopAudioMixing = AgoraData.stopAudioMixing; + this->stopAllEffect = AgoraData.stopAllEffect; + this->stopMicrophoneRecording = AgoraData.stopMicrophoneRecording; + } + + agora::rtc::LeaveChannelOptions CreateAgoraData() const { + agora::rtc::LeaveChannelOptions AgoraData; + AgoraData.stopAudioMixing = this->stopAudioMixing; + AgoraData.stopAllEffect = this->stopAllEffect; + AgoraData.stopMicrophoneRecording = this->stopMicrophoneRecording; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LeaveChannelOptions& AgoraData) const { + + } + +}; + + + +USTRUCT(BlueprintType) +struct FEchoTestConfiguration +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") + UImage* view = nullptr; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") + bool enableAudio = true; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") + bool enableVideo = true; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") + FString token = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") + FString channelId = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") + int intervalInSeconds = 2; + + + FEchoTestConfiguration() {} + + FEchoTestConfiguration(const agora::rtc::EchoTestConfiguration& AgoraData) { + view = nullptr; // [not support] + enableAudio = AgoraData.enableAudio; + enableVideo = AgoraData.enableVideo; + token = AgoraData.token; + channelId = AgoraData.channelId; + intervalInSeconds = AgoraData.intervalInSeconds; + } + + agora::rtc::EchoTestConfiguration CreateAgoraData() const{ + agora::rtc::EchoTestConfiguration AgoraData; + //AgoraData.view = view; + AgoraData.enableAudio = enableAudio; + AgoraData.enableVideo = enableVideo; + + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.token,this->token) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.channelId, this->channelId) + + AgoraData.intervalInSeconds = intervalInSeconds; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::EchoTestConfiguration& AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.token) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.channelId) + } + +}; + + +UENUM(BlueprintType) +enum class ECAMERA_DIRECTION :uint8 { + + CAMERA_REAR = 0, + + CAMERA_FRONT = 1, +}; + +UENUM(BlueprintType) +enum class ECAMERA_FOCAL_LENGTH_TYPE :uint8 { + CAMERA_FOCAL_LENGTH_DEFAULT = 0, + CAMERA_FOCAL_LENGTH_WIDE_ANGLE = 1, + CAMERA_FOCAL_LENGTH_URLTRA_WIDE = 2, + CAMERA_FOCAL_LENGTH_TELEPHOTO = 3, +}; + +USTRUCT(BlueprintType) +struct FVideoFormat { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFormat") + int width = 640; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFormat") + int height = 360; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFormat") + int fps = 15; + + FVideoFormat(){} + FVideoFormat(const agora::rtc::VideoFormat & AgoraData){ + width = AgoraData.width; + height = AgoraData.height; + fps = AgoraData.fps; + } + + agora::rtc::VideoFormat CreateAgoraData() const { + agora::rtc::VideoFormat AgoraData; + AgoraData.width = width; + AgoraData.height = height; + AgoraData.fps = fps; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::VideoFormat& AgoraData) const { + + } +}; + +USTRUCT(BlueprintType) +struct FCameraCapturerConfiguration +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") + ECAMERA_DIRECTION cameraDirection = ECAMERA_DIRECTION::CAMERA_FRONT; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") + ECAMERA_FOCAL_LENGTH_TYPE cameraFocalLengthType = ECAMERA_FOCAL_LENGTH_TYPE::CAMERA_FOCAL_LENGTH_DEFAULT; + + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") + bool deviceId_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") + FString deviceId = ""; + + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") + bool cameraId_SetValue = false; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") + FString cameraId = ""; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") + FVideoFormat format = FVideoFormat(); + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + EAgoraOptional followEncodeDimensionRatio = EAgoraOptional::AGORA_NULL_VALUE; + + + FCameraCapturerConfiguration(){} + FCameraCapturerConfiguration(const agora::rtc::CameraCapturerConfiguration & AgoraData){ +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + cameraDirection = static_cast(AgoraData.cameraDirection.value()); + cameraFocalLengthType = static_cast(AgoraData.cameraFocalLengthType.value()); +#else + + SET_UEBP_OPTIONAL_VAL_FString(this->deviceId, AgoraData.deviceId); +#endif + +#if defined(__ANDROID__) + cameraId = UTF8_TO_TCHAR(AgoraData.cameraId.value()); +#endif + + format = FVideoFormat(AgoraData.format); + SET_UEBP_OPTIONAL_VAL_BOOL( followEncodeDimensionRatio ,AgoraData.followEncodeDimensionRatio) + } + + agora::rtc::CameraCapturerConfiguration CreateAgoraData() const { + agora::rtc::CameraCapturerConfiguration AgoraData; + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + AgoraData.cameraDirection = static_cast(cameraDirection); + AgoraData.cameraFocalLengthType = static_cast(cameraFocalLengthType); +#else + + SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOALLOC(AgoraData.deviceId, this->deviceId) +#endif + +#if defined(__ANDROID__) + SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOALLOC( + AgoraData.cameraId,this->cameraId) + +#endif + + AgoraData.format = format.CreateAgoraData(); + + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.followEncodeDimensionRatio, this->followEncodeDimensionRatio) + return AgoraData; + } + + void FreeAgoraData(agora::rtc::CameraCapturerConfiguration& AgoraData) const { + format.FreeAgoraData(AgoraData.format); + + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + +#else + SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOFREE(AgoraData.deviceId) +#endif + +#if defined(__ANDROID__) + SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOFREE(AgoraData.cameraId) + +#endif + + } +}; + + + +USTRUCT(BlueprintType) +struct FLastmileProbeConfig +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") + bool probeUplink = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") + bool probeDownlink = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") + int expectedUplinkBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") + int expectedDownlinkBitrate = 0; + + FLastmileProbeConfig(){} + FLastmileProbeConfig(const agora::rtc::LastmileProbeConfig & AgoraData){ + probeUplink = AgoraData.probeUplink; + probeDownlink = AgoraData.probeDownlink; + expectedUplinkBitrate = AgoraData.expectedUplinkBitrate; + expectedDownlinkBitrate = AgoraData.expectedDownlinkBitrate; + } + + agora::rtc::LastmileProbeConfig CreateAgoraData() const{ + agora::rtc::LastmileProbeConfig AgoraData; + AgoraData.probeUplink = probeUplink; + AgoraData.probeDownlink = probeDownlink; + AgoraData.expectedUplinkBitrate = expectedUplinkBitrate; + AgoraData.expectedDownlinkBitrate = expectedDownlinkBitrate; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LastmileProbeConfig& AgoraData) const { + + } +}; + + + +USTRUCT(BlueprintType) +struct FVideoDimensions { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoDimensions") + int width = 640; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FVideoDimensions") + int height = 480; + + FVideoDimensions(){} + FVideoDimensions(const agora::rtc::VideoDimensions & AgoraData){ + width = AgoraData.width; + height = AgoraData.height; + } + + agora::rtc::VideoDimensions CreateAgoraData() const{ + agora::rtc::VideoDimensions AgoraData; + AgoraData.width = width; + AgoraData.height = height; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::VideoDimensions& AgoraData) const { + + } +}; + +UENUM(BlueprintType) +enum class EORIENTATION_MODE : uint8 { + + ORIENTATION_MODE_ADAPTIVE = 0, + + ORIENTATION_MODE_FIXED_LANDSCAPE = 1, + + ORIENTATION_MODE_FIXED_PORTRAIT = 2, +}; + +UENUM(BlueprintType) +enum class EDEGRADATION_PREFERENCE : uint8 { + + MAINTAIN_QUALITY = 0, + + MAINTAIN_FRAMERATE = 1, + + MAINTAIN_BALANCED = 2, + + MAINTAIN_RESOLUTION = 3, + + DISABLED = 100, +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_ENCODING_PREFERENCE :uint8 { + + PREFER_AUTO = 0, + + PREFER_SOFTWARE = 1, + + PREFER_HARDWARE = 2, +}; + + +USTRUCT(BlueprintType) +struct FENUMWRAP_ENCODING_PREFERENCE { + + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_ENCODING_PREFERENCE") + EENUMCUSTOM_ENCODING_PREFERENCE ValueWrapper = EENUMCUSTOM_ENCODING_PREFERENCE::PREFER_AUTO; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_3_ENTRIES(FENUMWRAP_ENCODING_PREFERENCE,agora::rtc::ENCODING_PREFERENCE, EENUMCUSTOM_ENCODING_PREFERENCE, + PREFER_AUTO, + PREFER_SOFTWARE, + PREFER_HARDWARE) +}; + +UENUM(BlueprintType) +enum class ECOMPRESSION_PREFERENCE : uint8 { + + PREFER_LOW_LATENCY = 0, + + PREFER_QUALITY = 1, +}; + +USTRUCT(BlueprintType) +struct FAdvanceOptions { + + GENERATED_BODY() + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvanceOptions") + FENUMWRAP_ENCODING_PREFERENCE encodingPreference = EENUMCUSTOM_ENCODING_PREFERENCE::PREFER_AUTO; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvanceOptions") + ECOMPRESSION_PREFERENCE compressionPreference = ECOMPRESSION_PREFERENCE::PREFER_QUALITY; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvanceOptions") + bool encodeAlpha = false; + + + FAdvanceOptions() {} + + FAdvanceOptions(const agora::rtc::AdvanceOptions & AgoraData){ + encodingPreference = AgoraData.encodingPreference; + compressionPreference = static_cast(AgoraData.compressionPreference); + encodeAlpha = AgoraData.encodeAlpha; + } + + agora::rtc::AdvanceOptions CreateAgoraData() const{ + agora::rtc::AdvanceOptions AgoraData; + AgoraData.encodingPreference = encodingPreference.GetRawValue(); + AgoraData.compressionPreference =static_cast(compressionPreference); + AgoraData.encodeAlpha = encodeAlpha; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::AdvanceOptions& AgoraData) const { + // no need to free + } +}; + +USTRUCT(BlueprintType) +struct FVideoEncoderConfiguration +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_NONE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + FVideoDimensions dimensions = FVideoDimensions(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + int frameRate = 15; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + int bitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + int minBitrate = -1; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + EORIENTATION_MODE orientationMode = EORIENTATION_MODE::ORIENTATION_MODE_ADAPTIVE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + EDEGRADATION_PREFERENCE degradationPreference = EDEGRADATION_PREFERENCE::MAINTAIN_QUALITY; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + EVIDEO_MIRROR_MODE_TYPE mirrorMode = EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_DISABLED; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") + FAdvanceOptions advanceOptions = FAdvanceOptions(); + + FVideoEncoderConfiguration(){} + FVideoEncoderConfiguration(const agora::rtc::VideoEncoderConfiguration & AgoraData){ + codecType = static_cast(AgoraData.codecType); + dimensions = FVideoDimensions(AgoraData.dimensions); + frameRate = AgoraData.frameRate; + bitrate = AgoraData.bitrate; + minBitrate = AgoraData.minBitrate; + orientationMode = static_cast(AgoraData.orientationMode); + degradationPreference = static_cast(AgoraData.degradationPreference); + mirrorMode = static_cast(AgoraData.mirrorMode); + advanceOptions = FAdvanceOptions(AgoraData.advanceOptions); + } + + agora::rtc::VideoEncoderConfiguration CreateAgoraData() const { + agora::rtc::VideoEncoderConfiguration AgoraData; + AgoraData.codecType = static_cast(codecType); + AgoraData.dimensions = dimensions.CreateAgoraData(); + AgoraData.frameRate = frameRate; + AgoraData.bitrate = bitrate; + AgoraData.minBitrate = minBitrate; + AgoraData.orientationMode = static_cast(orientationMode); + AgoraData.degradationPreference = static_cast(degradationPreference); + AgoraData.mirrorMode = static_cast(mirrorMode); + AgoraData.advanceOptions = advanceOptions.CreateAgoraData(); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::VideoEncoderConfiguration& AgoraData) const { + dimensions.FreeAgoraData(AgoraData.dimensions); + advanceOptions.FreeAgoraData(AgoraData.advanceOptions); + } +}; + +UENUM(BlueprintType) +enum class ELIGHTENING_CONTRAST_LEVEL : uint8 { + + LIGHTENING_CONTRAST_LOW = 0, + + LIGHTENING_CONTRAST_NORMAL = 1, + + LIGHTENING_CONTRAST_HIGH = 2, +}; + +USTRUCT(BlueprintType) +struct FBeautyOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") + ELIGHTENING_CONTRAST_LEVEL lighteningContrastLevel = ELIGHTENING_CONTRAST_LEVEL::LIGHTENING_CONTRAST_NORMAL; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") + float lighteningLevel = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") + float smoothnessLevel = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") + float rednessLevel = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") + float sharpnessLevel = 0; + + FBeautyOptions(){} + FBeautyOptions(const agora::rtc::BeautyOptions & AgoraData){ + lighteningContrastLevel = static_cast(AgoraData.lighteningContrastLevel); + lighteningLevel = AgoraData.lighteningLevel; + smoothnessLevel = AgoraData.smoothnessLevel; + rednessLevel = AgoraData.rednessLevel; + sharpnessLevel = AgoraData.sharpnessLevel; + } + + agora::rtc::BeautyOptions CreateAgoraData() const { + agora::rtc::BeautyOptions AgoraData; + AgoraData.lighteningContrastLevel = static_cast(lighteningContrastLevel); + AgoraData.lighteningLevel = lighteningLevel; + AgoraData.smoothnessLevel = smoothnessLevel; + AgoraData.rednessLevel = rednessLevel; + AgoraData.sharpnessLevel = sharpnessLevel; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::BeautyOptions& AgoraData) const { + + } +}; + +UENUM(BlueprintType) +enum class EMEDIA_SOURCE_TYPE : uint8 { + AUDIO_PLAYOUT_SOURCE = 0, + AUDIO_RECORDING_SOURCE = 1, + PRIMARY_CAMERA_SOURCE = 2, + SECONDARY_CAMERA_SOURCE = 3, + PRIMARY_SCREEN_SOURCE = 4, + SECONDARY_SCREEN_SOURCE = 5, + CUSTOM_VIDEO_SOURCE = 6, + MEDIA_PLAYER_SOURCE = 7, + RTC_IMAGE_PNG_SOURCE = 8, + RTC_IMAGE_JPEG_SOURCE = 9, + RTC_IMAGE_GIF_SOURCE = 10, + REMOTE_VIDEO_SOURCE = 11, + TRANSCODED_VIDEO_SOURCE = 12, + UNKNOWN_MEDIA_SOURCE = 100, +}; + + + +UENUM(BlueprintType) +enum class ELOW_LIGHT_ENHANCE_MODE : uint8 { + + LOW_LIGHT_ENHANCE_AUTO = 0, + + LOW_LIGHT_ENHANCE_MANUAL = 1, +}; + +UENUM(BlueprintType) +enum class ELOW_LIGHT_ENHANCE_LEVEL : uint8 { + + LOW_LIGHT_ENHANCE_LEVEL_HIGH_QUALITY = 0, + + LOW_LIGHT_ENHANCE_LEVEL_FAST = 1, +}; + + +USTRUCT(BlueprintType) +struct FLowlightEnhanceOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LowlightEnhanceOptions") + ELOW_LIGHT_ENHANCE_MODE mode = ELOW_LIGHT_ENHANCE_MODE::LOW_LIGHT_ENHANCE_AUTO; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LowlightEnhanceOptions") + ELOW_LIGHT_ENHANCE_LEVEL level = ELOW_LIGHT_ENHANCE_LEVEL::LOW_LIGHT_ENHANCE_LEVEL_HIGH_QUALITY; + + FLowlightEnhanceOptions(){} + FLowlightEnhanceOptions(const agora::rtc::LowlightEnhanceOptions & AgoraData){ + mode = static_cast(AgoraData.mode); + level = static_cast(AgoraData.level); + } + agora::rtc::LowlightEnhanceOptions CreateAgoraData() const { + agora::rtc::LowlightEnhanceOptions AgoraData; + AgoraData.mode = static_cast(mode); + AgoraData.level = static_cast(level); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LowlightEnhanceOptions& AgoraData) const { + + } +}; + + + +UENUM(BlueprintType) +enum class EVIDEO_DENOISER_MODE : uint8 { + + VIDEO_DENOISER_AUTO = 0, + + VIDEO_DENOISER_MANUAL = 1, +}; + + +UENUM(BlueprintType) +enum class EVIDEO_DENOISER_LEVEL : uint8 { + + VIDEO_DENOISER_LEVEL_HIGH_QUALITY = 0, + + VIDEO_DENOISER_LEVEL_FAST = 1, + + VIDEO_DENOISER_LEVEL_STRENGTH = 2, +}; + +USTRUCT(BlueprintType) +struct FVideoDenoiserOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoDenoiserOptions") + EVIDEO_DENOISER_MODE mode = EVIDEO_DENOISER_MODE::VIDEO_DENOISER_AUTO; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoDenoiserOptions") + EVIDEO_DENOISER_LEVEL level = EVIDEO_DENOISER_LEVEL::VIDEO_DENOISER_LEVEL_HIGH_QUALITY; + + FVideoDenoiserOptions(){} + FVideoDenoiserOptions(const agora::rtc::VideoDenoiserOptions & AgoraData){ + mode = static_cast(AgoraData.mode); + level = static_cast(AgoraData.level); + } + + agora::rtc::VideoDenoiserOptions CreateAgoraData() const { + agora::rtc::VideoDenoiserOptions AgoraData; + AgoraData.mode = static_cast(mode); + AgoraData.level = static_cast(level); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::VideoDenoiserOptions& AgoraData) const { + + } +}; + + +USTRUCT(BlueprintType) +struct FColorEnhanceOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ColorEnhanceOptions") + float strengthLevel = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ColorEnhanceOptions") + float skinProtectLevel = 0; + + FColorEnhanceOptions(){} + FColorEnhanceOptions(const agora::rtc::ColorEnhanceOptions & AgoraData){ + strengthLevel = AgoraData.strengthLevel; + skinProtectLevel = AgoraData.skinProtectLevel; + } + + agora::rtc::ColorEnhanceOptions CreateAgoraData() const { + agora::rtc::ColorEnhanceOptions AgoraData; + AgoraData.strengthLevel = strengthLevel; + AgoraData.skinProtectLevel = skinProtectLevel; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ColorEnhanceOptions& AgoraData) const { + + } + +}; + + +UENUM(BlueprintType) +enum class EBACKGROUND_SOURCE_TYPE :uint8 { + + BACKGROUND_NONE = 0, + + BACKGROUND_COLOR = 1, + + BACKGROUND_IMG = 2, + + BACKGROUND_BLUR = 3, + BACKGROUND_VIDEO = 4, +}; + +UENUM(BlueprintType) +enum class EBACKGROUND_BLUR_DEGREE :uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + BLUR_DEGREE_LOW = 1, + + BLUR_DEGREE_MEDIUM = 2, + + BLUR_DEGREE_HIGH = 3, +}; + +USTRUCT(BlueprintType) +struct FVirtualBackgroundSource +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource") + EBACKGROUND_SOURCE_TYPE background_source_type = EBACKGROUND_SOURCE_TYPE::BACKGROUND_COLOR; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource") + int64 color = 0xffffff; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource") + FString source = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource") + EBACKGROUND_BLUR_DEGREE blur_degree = EBACKGROUND_BLUR_DEGREE::BLUR_DEGREE_HIGH; + + FVirtualBackgroundSource(){} + FVirtualBackgroundSource(const agora::rtc::VirtualBackgroundSource & AgoraData){ + background_source_type = static_cast(AgoraData.background_source_type); + color = AgoraData.color; + source = AgoraData.source; + blur_degree = static_cast(AgoraData.blur_degree); + } + + agora::rtc::VirtualBackgroundSource CreateAgoraData() const { + agora::rtc::VirtualBackgroundSource AgoraData; + AgoraData.background_source_type = static_cast(background_source_type); + AgoraData.color = color; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.source, this->source) + AgoraData.blur_degree = static_cast(blur_degree); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::VirtualBackgroundSource& AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.source) + } +}; + + +UENUM(BlueprintType) +enum class ESEG_MODEL_TYPE : uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + SEG_MODEL_AI = 1, + SEG_MODEL_GREEN = 2 +}; + +USTRUCT(BlueprintType) +struct FSegmentationProperty +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SegmentationProperty") + ESEG_MODEL_TYPE modelType = ESEG_MODEL_TYPE::SEG_MODEL_AI; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SegmentationProperty") + float greenCapacity = 0.5; + + FSegmentationProperty(){} + FSegmentationProperty(const agora::rtc::SegmentationProperty & AgoraData){ + modelType = static_cast(AgoraData.modelType); + greenCapacity = AgoraData.greenCapacity; + } + + agora::rtc::SegmentationProperty CreateAgoraData() const { + agora::rtc::SegmentationProperty AgoraData; + AgoraData.modelType = static_cast(modelType); + AgoraData.greenCapacity = greenCapacity; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::SegmentationProperty& AgoraData) const { + + } +}; + + +UENUM(BlueprintType) +enum class EVIDEO_APPLICATION_SCENARIO_TYPE : uint8 { + APPLICATION_SCENARIO_GENERAL = 0, + APPLICATION_SCENARIO_VIDEO = 1, +}; + + +UENUM(BlueprintType) +enum class EVIDEO_QOE_PREFERENCE_TYPE : uint8 { + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + VIDEO_QOE_PREFERENCE_BALANCE = 1, + VIDEO_QOE_PREFERENCE_DELAY_FIRST = 2, + VIDEO_QOE_PREFERENCE_PICTURE_QUALITY_FIRST = 3, + VIDEO_QOE_PREFERENCE_FLUENCY_FIRST = 4 + +}; + + + +UENUM(BlueprintType) +enum class EAUDIO_PROFILE_TYPE : uint8 { + AUDIO_PROFILE_DEFAULT = 0, + AUDIO_PROFILE_SPEECH_STANDARD = 1, + AUDIO_PROFILE_MUSIC_STANDARD = 2, + AUDIO_PROFILE_MUSIC_STANDARD_STEREO = 3, + AUDIO_PROFILE_MUSIC_HIGH_QUALITY = 4, + AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO = 5, + AUDIO_PROFILE_IOT = 6, + AUDIO_PROFILE_NUM = 7, +}; + +UENUM(BlueprintType) +enum class EAUDIO_SCENARIO_TYPE : uint8 { + AUDIO_SCENARIO_DEFAULT = 0, + AUDIO_SCENARIO_GAME_STREAMING = 3, + AUDIO_SCENARIO_CHATROOM = 5, + AUDIO_SCENARIO_CHORUS = 7, + AUDIO_SCENARIO_MEETING = 8, + AUDIO_SCENARIO_NUM = 9, +}; + + +USTRUCT(BlueprintType) +struct FVideoSubscriptionOptions +{ + GENERATED_BODY() + +public: + + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") + bool type_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoSubscriptionOptions") + EVIDEO_STREAM_TYPE type = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoSubscriptionOptions") + EAgoraOptional encodedFrameOnly = EAgoraOptional::AGORA_NULL_VALUE; + + FVideoSubscriptionOptions(){} + FVideoSubscriptionOptions(const agora::rtc::VideoSubscriptionOptions & AgoraData){ + SET_UEBP_OPTIONAL_VAL_ASSIGN_VAL(this->type,AgoraData.type,static_cast(AgoraData.type.value())) + SET_UEBP_OPTIONAL_VAL_BOOL(this->encodedFrameOnly,AgoraData.encodedFrameOnly) + } + + agora::rtc::VideoSubscriptionOptions CreateAgoraData() const { + agora::rtc::VideoSubscriptionOptions AgoraData; + SET_AGORA_OPTIONAL_VAL_ASSIGN_VAL(AgoraData.type,this->type,static_cast(this->type)) + + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.encodedFrameOnly,this->encodedFrameOnly) + return AgoraData; + } + + void FreeAgoraData(agora::rtc::VideoSubscriptionOptions& AgoraData) const { + + } +}; + + +UENUM(BlueprintType) +enum class EAUDIO_FILE_RECORDING_TYPE :uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + AUDIO_FILE_RECORDING_MIC = 1, + + AUDIO_FILE_RECORDING_PLAYBACK = 2, + + AUDIO_FILE_RECORDING_MIXED = 3, +}; + + +UENUM(BlueprintType) +enum class EAUDIO_RECORDING_QUALITY_TYPE : uint8 { + AUDIO_RECORDING_QUALITY_LOW = 0, + AUDIO_RECORDING_QUALITY_MEDIUM = 1, + AUDIO_RECORDING_QUALITY_HIGH = 2, + AUDIO_RECORDING_QUALITY_ULTRA_HIGH = 3, +}; + + +USTRUCT(BlueprintType) +struct FAudioRecordingConfiguration +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") + FString filePath = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") + bool encode = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") + int sampleRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") + EAUDIO_FILE_RECORDING_TYPE fileRecordingType = EAUDIO_FILE_RECORDING_TYPE::AUDIO_FILE_RECORDING_MIXED; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") + EAUDIO_RECORDING_QUALITY_TYPE quality = EAUDIO_RECORDING_QUALITY_TYPE::AUDIO_RECORDING_QUALITY_LOW; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") + int recordingChannel = 0; + + FAudioRecordingConfiguration(){} + FAudioRecordingConfiguration(const agora::rtc::AudioRecordingConfiguration & AgoraData){ + filePath = UTF8_TO_TCHAR(AgoraData.filePath); + encode = AgoraData.encode; + sampleRate = AgoraData.sampleRate; + fileRecordingType = static_cast(AgoraData.fileRecordingType); + quality = static_cast(AgoraData.quality); + recordingChannel = AgoraData.recordingChannel; + } + + agora::rtc::AudioRecordingConfiguration CreateAgoraData() const { + agora::rtc::AudioRecordingConfiguration AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.filePath, this->filePath) + AgoraData.encode = encode; + AgoraData.sampleRate = sampleRate; + AgoraData.fileRecordingType = static_cast(fileRecordingType); + AgoraData.quality = static_cast(quality); + AgoraData.recordingChannel = recordingChannel; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::AudioRecordingConfiguration& AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.filePath) + } +}; + + +UENUM(BlueprintType) +enum class EAUDIO_ENCODED_FRAME_OBSERVER_POSITION :uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_RECORD = 1, + + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK = 2, + + AUDIO_ENCODED_FRAME_OBSERVER_POSITION_MIXED = 3, +}; + + +UENUM(BlueprintType) +enum class EAUDIO_MIXING_DUAL_MONO_MODE : uint8 { + AUDIO_MIXING_DUAL_MONO_AUTO = 0, + AUDIO_MIXING_DUAL_MONO_L = 1, + AUDIO_MIXING_DUAL_MONO_R = 2, + AUDIO_MIXING_DUAL_MONO_MIX = 3, +}; + + +USTRUCT(BlueprintType) +struct FSpatialAudioParams +{ + GENERATED_BODY() + +public: + + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + bool speaker_azimuth_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + float speaker_azimuth = 0; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + bool speaker_elevation_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + float speaker_elevation = 0; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + bool speaker_distance_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + float speaker_distance = 0; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + bool speaker_orientation_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + int speaker_orientation = 0; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + EAgoraOptional enable_blur = EAgoraOptional::AGORA_NULL_VALUE; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + EAgoraOptional enable_air_absorb = EAgoraOptional::AGORA_NULL_VALUE; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + bool speaker_attenuation_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + float speaker_attenuation = 0; + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") + EAgoraOptional enable_doppler = EAgoraOptional::AGORA_NULL_VALUE; + + FSpatialAudioParams(){} + FSpatialAudioParams(const agora::SpatialAudioParams & AgoraData){ + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->speaker_azimuth,AgoraData.speaker_azimuth) + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->speaker_elevation,AgoraData.speaker_elevation) + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->speaker_distance,AgoraData.speaker_distance) + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->speaker_orientation,AgoraData.speaker_orientation) + SET_UEBP_OPTIONAL_VAL_BOOL(this->enable_blur,AgoraData.enable_blur) + SET_UEBP_OPTIONAL_VAL_BOOL(this->enable_air_absorb,AgoraData.enable_air_absorb) + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->speaker_attenuation,AgoraData.speaker_attenuation) + SET_UEBP_OPTIONAL_VAL_BOOL(this->enable_doppler,AgoraData.enable_doppler) + } + + agora::SpatialAudioParams CreateAgoraData() const { + agora::SpatialAudioParams AgoraData; + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.speaker_azimuth,this->speaker_azimuth) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.speaker_elevation,this->speaker_elevation) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.speaker_distance,this->speaker_distance) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.speaker_orientation,this->speaker_orientation) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.enable_blur,this->enable_blur) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.enable_air_absorb,this->enable_air_absorb) + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.speaker_attenuation,this->speaker_attenuation) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.enable_doppler,this->enable_doppler) + return AgoraData; + } + + void FreeAgoraData(agora::SpatialAudioParams& AgoraData) const { + + } +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET :uint8 { + VOICE_BEAUTIFIER_OFF = 0, + CHAT_BEAUTIFIER_MAGNETIC = 1, + CHAT_BEAUTIFIER_FRESH = 2, + CHAT_BEAUTIFIER_VITALITY = 3, + SINGING_BEAUTIFIER = 4, + TIMBRE_TRANSFORMATION_VIGOROUS = 5, + TIMBRE_TRANSFORMATION_DEEP = 6, + TIMBRE_TRANSFORMATION_MELLOW = 7, + TIMBRE_TRANSFORMATION_FALSETTO = 8, + TIMBRE_TRANSFORMATION_FULL = 9, + TIMBRE_TRANSFORMATION_CLEAR = 10, + TIMBRE_TRANSFORMATION_RESOUNDING = 11, + TIMBRE_TRANSFORMATION_RINGING = 12, + ULTRA_HIGH_QUALITY_VOICE = 13, +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_VOICE_BEAUTIFIER_PRESET { + GENERATED_BODY() + + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_VOICE_BEAUTIFIER_PRESET") + EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET ValueWrapper = EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::VOICE_BEAUTIFIER_OFF; + + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_14_ENTRIES(FENUMWRAP_VOICE_BEAUTIFIER_PRESET, agora::rtc::VOICE_BEAUTIFIER_PRESET, EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET, + VOICE_BEAUTIFIER_OFF, + CHAT_BEAUTIFIER_MAGNETIC, + CHAT_BEAUTIFIER_FRESH , + CHAT_BEAUTIFIER_VITALITY , + SINGING_BEAUTIFIER , + TIMBRE_TRANSFORMATION_VIGOROUS, + TIMBRE_TRANSFORMATION_DEEP , + TIMBRE_TRANSFORMATION_MELLOW, + TIMBRE_TRANSFORMATION_FALSETTO, + TIMBRE_TRANSFORMATION_FULL, + TIMBRE_TRANSFORMATION_CLEAR , + TIMBRE_TRANSFORMATION_RESOUNDING, + TIMBRE_TRANSFORMATION_RINGING, + ULTRA_HIGH_QUALITY_VOICE + ) +}; + + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_AUDIO_EFFECT_PRESET : uint8 { + AUDIO_EFFECT_OFF, + ROOM_ACOUSTICS_KTV, + ROOM_ACOUSTICS_VOCAL_CONCERT, + ROOM_ACOUSTICS_STUDIO, + ROOM_ACOUSTICS_PHONOGRAPH, + ROOM_ACOUSTICS_VIRTUAL_STEREO, + ROOM_ACOUSTICS_SPACIAL, + ROOM_ACOUSTICS_ETHEREAL, + ROOM_ACOUSTICS_3D_VOICE, + ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND, + 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, + STYLE_TRANSFORMATION_RNB, + STYLE_TRANSFORMATION_POPULAR, + PITCH_CORRECTION +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_AUDIO_EFFECT_PRESET { + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_AUDIO_EFFECT_PRESET") + EENUMCUSTOM_AUDIO_EFFECT_PRESET ValueWrapper = EENUMCUSTOM_AUDIO_EFFECT_PRESET::AUDIO_EFFECT_OFF; + + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_21_ENTRIES(FENUMWRAP_AUDIO_EFFECT_PRESET, agora::rtc::AUDIO_EFFECT_PRESET, EENUMCUSTOM_AUDIO_EFFECT_PRESET, + AUDIO_EFFECT_OFF, + ROOM_ACOUSTICS_KTV, + ROOM_ACOUSTICS_VOCAL_CONCERT, + ROOM_ACOUSTICS_STUDIO, + ROOM_ACOUSTICS_PHONOGRAPH, + ROOM_ACOUSTICS_VIRTUAL_STEREO, + ROOM_ACOUSTICS_SPACIAL, + ROOM_ACOUSTICS_ETHEREAL, + ROOM_ACOUSTICS_3D_VOICE, + ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND, + 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, + STYLE_TRANSFORMATION_RNB, + STYLE_TRANSFORMATION_POPULAR, + PITCH_CORRECTION) +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_VOICE_CONVERSION_PRESET :uint8 { + + VOICE_CONVERSION_OFF = 0, + VOICE_CHANGER_NEUTRAL = 1, + VOICE_CHANGER_SWEET = 2, + VOICE_CHANGER_SOLID = 3, + VOICE_CHANGER_BASS = 4, + VOICE_CHANGER_CARTOON = 5, + VOICE_CHANGER_CHILDLIKE = 6, + VOICE_CHANGER_PHONE_OPERATOR = 7, + VOICE_CHANGER_MONSTER = 8, + VOICE_CHANGER_TRANSFORMERS = 9, + VOICE_CHANGER_GROOT = 10, + VOICE_CHANGER_DARTH_VADER = 11, + VOICE_CHANGER_IRON_LADY = 12, + VOICE_CHANGER_SHIN_CHAN = 13, + VOICE_CHANGER_GIRLISH_MAN = 14, + VOICE_CHANGER_CHIPMUNK = 15, +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_VOICE_CONVERSION_PRESET +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_VOICE_CONVERSION_PRESET") + EENUMCUSTOM_VOICE_CONVERSION_PRESET ValueWrapper = EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CONVERSION_OFF; + + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_16_ENTRIES(FENUMWRAP_VOICE_CONVERSION_PRESET, agora::rtc::VOICE_CONVERSION_PRESET, EENUMCUSTOM_VOICE_CONVERSION_PRESET, + VOICE_CONVERSION_OFF, + VOICE_CHANGER_NEUTRAL, + VOICE_CHANGER_SWEET, + VOICE_CHANGER_SOLID, + VOICE_CHANGER_BASS, + VOICE_CHANGER_CARTOON, + VOICE_CHANGER_CHILDLIKE, + VOICE_CHANGER_PHONE_OPERATOR, + VOICE_CHANGER_MONSTER, + VOICE_CHANGER_TRANSFORMERS, + VOICE_CHANGER_GROOT, + VOICE_CHANGER_DARTH_VADER, + VOICE_CHANGER_IRON_LADY, + VOICE_CHANGER_SHIN_CHAN, + VOICE_CHANGER_GIRLISH_MAN, + VOICE_CHANGER_CHIPMUNK) +}; + +UENUM(BlueprintType) +enum class EAUDIO_EQUALIZATION_BAND_FREQUENCY : uint8 { + AUDIO_EQUALIZATION_BAND_31 = 0, + AUDIO_EQUALIZATION_BAND_62 = 1, + AUDIO_EQUALIZATION_BAND_125 = 2, + AUDIO_EQUALIZATION_BAND_250 = 3, + AUDIO_EQUALIZATION_BAND_500 = 4, + AUDIO_EQUALIZATION_BAND_1K = 5, + AUDIO_EQUALIZATION_BAND_2K = 6, + AUDIO_EQUALIZATION_BAND_4K = 7, + AUDIO_EQUALIZATION_BAND_8K = 8, + AUDIO_EQUALIZATION_BAND_16K = 9, +}; + + +UENUM(BlueprintType) +enum class EAUDIO_REVERB_TYPE : uint8 { + AUDIO_REVERB_DRY_LEVEL = 0, + AUDIO_REVERB_WET_LEVEL = 1, + AUDIO_REVERB_ROOM_SIZE = 2, + AUDIO_REVERB_WET_DELAY = 3, + AUDIO_REVERB_STRENGTH = 4, +}; + + + +UENUM(BlueprintType) +enum class ELOG_LEVEL : uint8 { + 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, + LOG_LEVEL_DEBUG = 0x0020, +}; + + +USTRUCT(BlueprintType) +struct FSimulcastStreamConfig +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SimulcastStreamConfig") + FVideoDimensions dimensions = FVideoDimensions(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SimulcastStreamConfig") + int kBitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SimulcastStreamConfig") + int framerate = 0; + + FSimulcastStreamConfig(){} + FSimulcastStreamConfig(const agora::rtc::SimulcastStreamConfig & AgoraData){ + dimensions = FVideoDimensions(AgoraData.dimensions); + kBitrate = AgoraData.kBitrate; + framerate = AgoraData.framerate; + } + + agora::rtc::SimulcastStreamConfig CreateAgoraData() const { + agora::rtc::SimulcastStreamConfig AgoraData; + AgoraData.dimensions = dimensions.CreateAgoraData(); + AgoraData.kBitrate = kBitrate; + AgoraData.framerate = framerate; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::SimulcastStreamConfig& AgoraData) const { + dimensions.FreeAgoraData(AgoraData.dimensions); + } +}; + + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_SIMULCAST_STREAM_MODE : uint8 { + AUTO_SIMULCAST_STREAM = 0, + DISABLE_SIMULCAST_STREAM = 1, + ENABLE_SIMULCAST_STREAM = 2, +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_SIMULCAST_STREAM_MODE +{ + GENERATED_BODY() + +public: + + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_SIMULCAST_STREAM_MODE") + EENUMCUSTOM_SIMULCAST_STREAM_MODE ValueWrapper = EENUMCUSTOM_SIMULCAST_STREAM_MODE::AUTO_SIMULCAST_STREAM; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_3_ENTRIES(FENUMWRAP_SIMULCAST_STREAM_MODE, agora::rtc::SIMULCAST_STREAM_MODE, EENUMCUSTOM_SIMULCAST_STREAM_MODE, + AUTO_SIMULCAST_STREAM, + DISABLE_SIMULCAST_STREAM, + ENABLE_SIMULCAST_STREAM) + +}; + + +UENUM(BlueprintType) +enum class ERAW_AUDIO_FRAME_OP_MODE_TYPE : uint8 { + RAW_AUDIO_FRAME_OP_MODE_READ_ONLY = 0, + RAW_AUDIO_FRAME_OP_MODE_READ_WRITE = 2, +}; + +UENUM(BlueprintType) +enum class ESTREAM_FALLBACK_OPTIONS : uint8 { + STREAM_FALLBACK_OPTION_DISABLED = 0, + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW = 1, + STREAM_FALLBACK_OPTION_AUDIO_ONLY = 2, +}; + + + +USTRUCT(BlueprintType) +struct FExtensionInfo { + + GENERATED_BODY(); + +public: + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionInfo") + EMEDIA_SOURCE_TYPE mediaSourceType = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionInfo") + int64 remoteUid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionInfo") + FString channelId = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionInfo") + int64 localUid = 0; + + FExtensionInfo() {} + + FExtensionInfo(const agora::rtc::ExtensionInfo& AgoraData) { + mediaSourceType = (EMEDIA_SOURCE_TYPE)AgoraData.mediaSourceType; + remoteUid = AgoraData.remoteUid; + channelId = UTF8_TO_TCHAR(AgoraData.channelId); + localUid = AgoraData.localUid; + } + + agora::rtc::ExtensionInfo CreateAgoraData() const { + agora::rtc::ExtensionInfo AgoraData; + AgoraData.mediaSourceType = (agora::media::MEDIA_SOURCE_TYPE)mediaSourceType; + AgoraData.remoteUid = UABT::ToUID(remoteUid); + + char* ChannelIdCharPtr = new char[channelId.Len() + 1]; + FMemory::Memcpy(ChannelIdCharPtr, TCHAR_TO_UTF8(*channelId), channelId.Len()); + ChannelIdCharPtr[channelId.Len()] = '\0'; + + AgoraData.channelId = ChannelIdCharPtr; + AgoraData.localUid = UABT::ToUID(localUid); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ExtensionInfo& AgoraData) const { + if (AgoraData.channelId) { + delete[] AgoraData.channelId; + AgoraData.channelId = nullptr; + } + } +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_CAMERA_STABILIZATION_MODE : uint8{ + CAMERA_STABILIZATION_MODE_OFF, + CAMERA_STABILIZATION_MODE_AUTO, + CAMERA_STABILIZATION_MODE_LEVEL_1, + CAMERA_STABILIZATION_MODE_LEVEL_2, + CAMERA_STABILIZATION_MODE_LEVEL_3 +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_CAMERA_STABILIZATION_MODE { + + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_CAMERA_STABILIZATION_MODE") + EENUMCUSTOM_CAMERA_STABILIZATION_MODE ValueWrapper = EENUMCUSTOM_CAMERA_STABILIZATION_MODE::CAMERA_STABILIZATION_MODE_OFF; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_5_ENTRIES(FENUMWRAP_CAMERA_STABILIZATION_MODE, agora::rtc::CAMERA_STABILIZATION_MODE, EENUMCUSTOM_CAMERA_STABILIZATION_MODE, + CAMERA_STABILIZATION_MODE_OFF, + CAMERA_STABILIZATION_MODE_AUTO, + CAMERA_STABILIZATION_MODE_LEVEL_1, + CAMERA_STABILIZATION_MODE_LEVEL_2, + CAMERA_STABILIZATION_MODE_LEVEL_3) + +}; + +#pragma endregion Rtc Engine 2 + + + +#pragma region Screen Share + + +USTRUCT(BlueprintType) +struct FThumbImageBuffer { + + GENERATED_BODY() + +public: + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") + UImage* Image = nullptr; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") + TArray buffer; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") + int64 length = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") + int64 width = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") + int64 height = 0; + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + FThumbImageBuffer(){} + FThumbImageBuffer(const agora::rtc::ThumbImageBuffer & AgoraData){ + + length = AgoraData.length; + buffer.SetNumZeroed(length); + for (int i = 0; i < length; i++) { + this->buffer[i] = AgoraData.buffer[i]; + } + width = AgoraData.width; + height = AgoraData.height; + + + if(Image == nullptr){ + Image = NewObject(); + } + + UTexture2D* RenderTexture = UTexture2D::CreateTransient(width, height, PF_R8G8B8A8); + + if(RenderTexture){ + +#if AG_UE5_OR_LATER + uint8* RawData = (uint8*)RenderTexture->GetPlatformData()->Mips[0].BulkData.Lock(LOCK_READ_WRITE); + FMemory::Memcpy(RawData, AgoraData.buffer, width * height * 4); + RenderTexture->GetPlatformData()->Mips[0].BulkData.Unlock(); + RenderTexture->UpdateResource(); +#else + uint8* RawData = (uint8*)RenderTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); + FMemory::Memcpy(RawData, AgoraData.buffer, width * height * 4); + RenderTexture->PlatformData->Mips[0].BulkData.Unlock(); + RenderTexture->UpdateResource(); +#endif + + FSlateBrush RenderBrush; + RenderBrush.SetResourceObject(RenderTexture); + Image->SetBrush(RenderBrush); + } + + + } + + agora::rtc::ThumbImageBuffer CreateAgoraData() const { + agora::rtc::ThumbImageBuffer AgoraData; + + // Temp solution for now + char* TmpChar = new char[length]; + for (int i = 0; i < length; i++) { + TmpChar[i] = this->buffer[i]; + } + + AgoraData.buffer = TmpChar; + AgoraData.length = length; + AgoraData.width = width; + AgoraData.height = height; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ThumbImageBuffer & AgoraData) const { + SET_UABT_GENERIC_PTR___MEMFREE(AgoraData.buffer) + } +#endif +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_ScreenCaptureSourceType : uint8 { + ScreenCaptureSourceType_Unknown = 0, + ScreenCaptureSourceType_Window = 1, + ScreenCaptureSourceType_Screen = 2, + ScreenCaptureSourceType_Custom = 3, +}; + + +USTRUCT(BlueprintType) +struct FENUMWRAP_ScreenCaptureSourceType +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_ScreenCaptureSourceType") + EENUMCUSTOM_ScreenCaptureSourceType ValueWrapper = EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown; + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_4_ENTRIES(FENUMWRAP_ScreenCaptureSourceType, agora::rtc::ScreenCaptureSourceType, EENUMCUSTOM_ScreenCaptureSourceType, + ScreenCaptureSourceType_Unknown, + ScreenCaptureSourceType_Window, + ScreenCaptureSourceType_Screen, + ScreenCaptureSourceType_Custom) + +#endif +}; + + +USTRUCT(BlueprintType) +struct FScreenCaptureSourceInfo { + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + FENUMWRAP_ScreenCaptureSourceType type = FENUMWRAP_ScreenCaptureSourceType(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + int64 sourceId = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + FString sourceName = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + FThumbImageBuffer thumbImage = FThumbImageBuffer(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + FThumbImageBuffer iconImage = FThumbImageBuffer(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + FString processPath = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + FString sourceTitle = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + bool primaryMonitor = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + bool isOccluded = false; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + FRectangle position = FRectangle(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + bool minimizeWindow = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") + int64 sourceDisplayId = 0; + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + FScreenCaptureSourceInfo(){} + FScreenCaptureSourceInfo(const agora::rtc::ScreenCaptureSourceInfo & AgoraData){ + + type = AgoraData.type; + + sourceId = UABT::FromViewToInt(AgoraData.sourceId); + sourceName = UTF8_TO_TCHAR(AgoraData.sourceName); + thumbImage = FThumbImageBuffer(AgoraData.thumbImage); + iconImage = FThumbImageBuffer(AgoraData.iconImage); + processPath = UTF8_TO_TCHAR(AgoraData.processPath); + sourceTitle = UTF8_TO_TCHAR(AgoraData.sourceTitle); + primaryMonitor = AgoraData.primaryMonitor; + isOccluded = AgoraData.isOccluded; + position = FRectangle(AgoraData.position); +#if defined(_WIN32) + minimizeWindow = AgoraData.minimizeWindow; + sourceDisplayId = UABT::FromViewToInt(AgoraData.sourceDisplayId); +#endif + } + + agora::rtc::ScreenCaptureSourceInfo CreateAgoraData() const { + agora::rtc::ScreenCaptureSourceInfo AgoraData; + AgoraData.type = static_cast(type.GetRawValue()); + AgoraData.sourceId = UABT::ToView(sourceId); + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.sourceName, sourceName) + AgoraData.thumbImage = thumbImage.CreateAgoraData(); + AgoraData.iconImage = iconImage.CreateAgoraData(); + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.processPath, processPath) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.sourceTitle, sourceTitle) + AgoraData.primaryMonitor = primaryMonitor; + AgoraData.isOccluded = isOccluded; + AgoraData.position = position.CreateAgoraData(); +#if defined(_WIN32) + AgoraData.minimizeWindow = minimizeWindow; + AgoraData.sourceDisplayId = UABT::ToView(sourceDisplayId); +#endif + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ScreenCaptureSourceInfo & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.sourceName) + thumbImage.FreeAgoraData(AgoraData.thumbImage); + thumbImage.FreeAgoraData(AgoraData.iconImage); + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.processPath) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.sourceTitle) + position.FreeAgoraData(AgoraData.position); + } +#endif +}; + + +USTRUCT(BlueprintType) +struct FSIZE { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SIZE") + int width = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SIZE") + int height = 0; + +#if (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) + FSIZE(){} + FSIZE(const agora::rtc::SIZE & AgoraData){ + width = AgoraData.width; + height = AgoraData.height; + } + + agora::rtc::SIZE CreateAgoraData() const { + agora::rtc::SIZE AgoraData; + AgoraData.width = width; + AgoraData.height = height; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::SIZE & AgoraData) const { + + } +#endif +}; + + + +USTRUCT(BlueprintType) +struct FScreenCaptureParameters +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + FVideoDimensions dimensions = FVideoDimensions(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + int frameRate = 5; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + int bitrate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + bool captureMouseCursor = true; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + bool windowFocus = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + int64 excludeWindowList = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + int excludeWindowCount = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + int highLightWidth = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + int highLightColor = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") + bool enableHighLight = false; + + FScreenCaptureParameters(){} + FScreenCaptureParameters(const agora::rtc::ScreenCaptureParameters & AgoraData){ + dimensions = FVideoDimensions(AgoraData.dimensions); + frameRate = AgoraData.frameRate; + bitrate = AgoraData.bitrate; + captureMouseCursor = AgoraData.captureMouseCursor; + windowFocus = AgoraData.windowFocus; + //excludeWindowList = AgoraData.excludeWindowList; + //excludeWindowCount = AgoraData.excludeWindowCount; + highLightWidth = AgoraData.highLightWidth; + highLightColor = AgoraData.highLightColor; + enableHighLight = AgoraData.enableHighLight; + } + + agora::rtc::ScreenCaptureParameters CreateAgoraData() const { + agora::rtc::ScreenCaptureParameters AgoraData; + AgoraData.dimensions = dimensions.CreateAgoraData(); + AgoraData.frameRate = frameRate; + AgoraData.bitrate = bitrate; + AgoraData.captureMouseCursor = captureMouseCursor; + AgoraData.windowFocus = windowFocus; + //AgoraData.excludeWindowList = excludeWindowList; + //AgoraData.excludeWindowCount = excludeWindowCount; + AgoraData.highLightWidth = highLightWidth; + AgoraData.highLightColor = highLightColor; + AgoraData.enableHighLight = enableHighLight; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ScreenCaptureParameters& AgoraData) const { + dimensions.FreeAgoraData(AgoraData.dimensions); + } +}; + +USTRUCT(BlueprintType) +struct FScreenAudioParameters { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenAudioParameters") + int sampleRate = 16000; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenAudioParameters") + int channels = 2; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenAudioParameters") + int captureSignalVolume = 100; + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + FScreenAudioParameters(){} + FScreenAudioParameters(const agora::rtc::ScreenAudioParameters & AgoraData){ + sampleRate = AgoraData.sampleRate; + channels = AgoraData.channels; + captureSignalVolume = AgoraData.captureSignalVolume; + } + + agora::rtc::ScreenAudioParameters CreateAgoraData() const { + agora::rtc::ScreenAudioParameters AgoraData; + AgoraData.sampleRate = sampleRate; + AgoraData.channels = channels; + AgoraData.captureSignalVolume = captureSignalVolume; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ScreenAudioParameters& AgoraData) const { + + } +#endif +}; + +UENUM(BlueprintType) +enum class EVIDEO_CONTENT_HINT : uint8 { + CONTENT_HINT_NONE, + CONTENT_HINT_MOTION, + CONTENT_HINT_DETAILS, +}; + + + +USTRUCT(BlueprintType) +struct FScreenVideoParameters { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenVideoParameters") + FVideoDimensions dimensions = FVideoDimensions(); + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenVideoParameters") + int frameRate = 15; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenVideoParameters") + int bitrate = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenVideoParameters") + EVIDEO_CONTENT_HINT contentHint = EVIDEO_CONTENT_HINT::CONTENT_HINT_MOTION; + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + FScreenVideoParameters(){} + FScreenVideoParameters(const agora::rtc::ScreenVideoParameters & AgoraData){ + dimensions = FVideoDimensions(AgoraData.dimensions); + frameRate = AgoraData.frameRate; + bitrate = AgoraData.bitrate; + contentHint = static_cast(AgoraData.contentHint); + } + + agora::rtc::ScreenVideoParameters CreateAgoraData() const { + agora::rtc::ScreenVideoParameters AgoraData; + AgoraData.dimensions = dimensions.CreateAgoraData(); + AgoraData.frameRate = frameRate; + AgoraData.bitrate = bitrate; + AgoraData.contentHint = static_cast(contentHint); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ScreenVideoParameters& AgoraData) const { + dimensions.FreeAgoraData(AgoraData.dimensions); + } +#endif +}; + + +USTRUCT(BlueprintType) +struct FScreenCaptureParameters2 +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters2") + bool captureAudio = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters2") + FScreenAudioParameters audioParams = FScreenAudioParameters(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters2") + bool captureVideo = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters2") + FScreenVideoParameters videoParams = FScreenVideoParameters(); + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + FScreenCaptureParameters2(){} + FScreenCaptureParameters2(const agora::rtc::ScreenCaptureParameters2 & AgoraData){ + captureAudio = AgoraData.captureAudio; + audioParams = FScreenAudioParameters(AgoraData.audioParams); + captureVideo = AgoraData.captureVideo; + videoParams = FScreenVideoParameters(AgoraData.videoParams); + } + + agora::rtc::ScreenCaptureParameters2 CreateAgoraData() const { + agora::rtc::ScreenCaptureParameters2 AgoraData; + AgoraData.captureAudio = captureAudio; + AgoraData.audioParams = audioParams.CreateAgoraData(); + AgoraData.captureVideo = captureVideo; + AgoraData.videoParams = videoParams.CreateAgoraData(); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ScreenCaptureParameters2& AgoraData) const { + audioParams.FreeAgoraData(AgoraData.audioParams); + videoParams.FreeAgoraData(AgoraData.videoParams); + } +#endif +}; + + +USTRUCT(BlueprintType) +struct FScreenCaptureConfiguration +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") + bool isCaptureWindow = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") + int displayId = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") + FRectangle screenRect = FRectangle(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") + int64 windowId = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") + FScreenCaptureParameters params = FScreenCaptureParameters(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") + FRectangle regionRect = FRectangle(); + + FScreenCaptureConfiguration(){} + FScreenCaptureConfiguration(const agora::rtc::ScreenCaptureConfiguration & AgoraData){ + isCaptureWindow = AgoraData.isCaptureWindow; + displayId = AgoraData.displayId; + screenRect = FRectangle(AgoraData.screenRect); + //windowId = AgoraData.windowId; + params = FScreenCaptureParameters(AgoraData.params); + regionRect = FRectangle(AgoraData.regionRect); + } + + agora::rtc::ScreenCaptureConfiguration CreateAgoraData() const { + agora::rtc::ScreenCaptureConfiguration AgoraData; + AgoraData.isCaptureWindow = isCaptureWindow; + AgoraData.displayId = displayId; + AgoraData.screenRect = screenRect.CreateAgoraData(); + //AgoraData.windowId = windowId; + AgoraData.params = params.CreateAgoraData(); + AgoraData.regionRect = regionRect.CreateAgoraData(); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ScreenCaptureConfiguration & AgoraData) const { + screenRect.FreeAgoraData(AgoraData.screenRect); + params.FreeAgoraData(AgoraData.params); + regionRect.FreeAgoraData(AgoraData.regionRect); + } +}; + +#pragma endregion Screen Share + + + +#pragma region Rtc Engine 3 + +UENUM(BlueprintType) +enum class EAUDIO_SESSION_OPERATION_RESTRICTION : uint8 { + AUDIO_SESSION_OPERATION_RESTRICTION_NONE = 0, + AUDIO_SESSION_OPERATION_RESTRICTION_SET_CATEGORY = 1, + AUDIO_SESSION_OPERATION_RESTRICTION_CONFIGURE_SESSION = 1 << 1, + AUDIO_SESSION_OPERATION_RESTRICTION_DEACTIVATE_SESSION = 1 << 2, + AUDIO_SESSION_OPERATION_RESTRICTION_ALL = 1 << 7, +}; + + +USTRUCT(BlueprintType) +struct FFocalLengthInfo { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FFocalLengthInfo") + int cameraDirection = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FFocalLengthInfo") + ECAMERA_FOCAL_LENGTH_TYPE focalLengthType = ECAMERA_FOCAL_LENGTH_TYPE::CAMERA_FOCAL_LENGTH_DEFAULT; + + FFocalLengthInfo(){} + FFocalLengthInfo(const agora::rtc::FocalLengthInfo & AgoraData){ + cameraDirection = AgoraData.cameraDirection; + focalLengthType = static_cast(AgoraData.focalLengthType); + } + + agora::rtc::FocalLengthInfo CreateAgoraData() const { + agora::rtc::FocalLengthInfo AgoraData; + AgoraData.cameraDirection = cameraDirection; + AgoraData.focalLengthType = static_cast(focalLengthType); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::FocalLengthInfo& AgoraData) const { + + } + +}; + + +UENUM(BlueprintType) +enum class ESCREEN_SCENARIO_TYPE : uint8 { + INVALID_OPT_BPGEN_NULL = 0, + SCREEN_SCENARIO_DOCUMENT = 1, + SCREEN_SCENARIO_GAMING = 2, + SCREEN_SCENARIO_VIDEO = 3, + SCREEN_SCENARIO_RDC = 4, +}; + + +UENUM(BlueprintType) +enum class EVIDEO_CODEC_PROFILE_TYPE : uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + VIDEO_CODEC_PROFILE_BASELINE = 66, + + VIDEO_CODEC_PROFILE_MAIN = 77, + + VIDEO_CODEC_PROFILE_HIGH = 100, +}; + + +UENUM(BlueprintType) +enum class EVIDEO_CODEC_TYPE_FOR_STREAM : uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + VIDEO_CODEC_H264_FOR_STREAM = 1, + + VIDEO_CODEC_H265_FOR_STREAM = 2, +}; + + +USTRUCT(BlueprintType) +struct FTranscodingUser { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") + int64 uid = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") + int x = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") + int y = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") + int width = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") + int height = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") + int zOrder = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") + float alpha = 1.0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") + int audioChannel = 0; + + FTranscodingUser(){} + FTranscodingUser(const agora::rtc::TranscodingUser & AgoraData){ + uid = AgoraData.uid; + x = AgoraData.x; + y = AgoraData.y; + width = AgoraData.width; + height = AgoraData.height; + zOrder = AgoraData.zOrder; + alpha = AgoraData.alpha; + audioChannel = AgoraData.audioChannel; + } + + agora::rtc::TranscodingUser CreateAgoraData() const { + agora::rtc::TranscodingUser AgoraData; + AgoraData.uid = uid; + AgoraData.x = x; + AgoraData.y = y; + AgoraData.width = width; + AgoraData.height = height; + AgoraData.zOrder = zOrder; + AgoraData.alpha = alpha; + AgoraData.audioChannel = audioChannel; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::TranscodingUser& AgoraData) const { + + } + +}; + +USTRUCT(BlueprintType) +struct FRtcImage +{ + GENERATED_BODY() + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") + FString url = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") + int x = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") + int y = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") + int width = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") + int height = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") + int zOrder = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") + float alpha = 0; + + FRtcImage() {} + + FRtcImage(const agora::rtc::RtcImage& AgoraData) { + url = UTF8_TO_TCHAR(AgoraData.url); + x = AgoraData.x; + y = AgoraData.y; + width = AgoraData.width; + height = AgoraData.height; + zOrder = AgoraData.zOrder; + alpha = AgoraData.alpha; + } + + agora::rtc::RtcImage CreateAgoraData() const { + agora::rtc::RtcImage AgoraData; + + char* URLCharPtr = new char[url.Len() + 1]; + FMemory::Memcpy(URLCharPtr, TCHAR_TO_UTF8(*url), url.Len()); + URLCharPtr[url.Len()] = '\0'; + AgoraData.url = URLCharPtr; + + AgoraData.x = x; + AgoraData.y = y; + AgoraData.width = width; + AgoraData.height = height; + AgoraData.zOrder = zOrder; + AgoraData.alpha = alpha; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::RtcImage& AgoraData) const { + if (AgoraData.url) { + delete[] AgoraData.url; + AgoraData.url = nullptr; + } + } +}; + +UENUM(BlueprintType) +enum class EAUDIO_SAMPLE_RATE_TYPE:uint8 { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + + AUDIO_SAMPLE_RATE_32000 = 1, + + AUDIO_SAMPLE_RATE_44100 = 2, + + AUDIO_SAMPLE_RATE_48000 = 3, +}; + + + +UENUM(BlueprintType) +enum class EAUDIO_CODEC_PROFILE_TYPE : uint8 { + + AUDIO_CODEC_PROFILE_LC_AAC = 0, + + AUDIO_CODEC_PROFILE_HE_AAC = 1, + + AUDIO_CODEC_PROFILE_HE_AAC_V2 = 2, +}; + +USTRUCT(BlueprintType) +struct FLiveStreamAdvancedFeature { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveStreamAdvancedFeature") + FString featureName = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveStreamAdvancedFeature") + bool opened = false; + + FLiveStreamAdvancedFeature(){} + FLiveStreamAdvancedFeature(const agora::rtc::LiveStreamAdvancedFeature & AgoraData){ + featureName = UTF8_TO_TCHAR(AgoraData.featureName); + opened = AgoraData.opened; + } + + agora::rtc::LiveStreamAdvancedFeature CreateAgoraData() const { + agora::rtc::LiveStreamAdvancedFeature AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.featureName, this->featureName) + AgoraData.opened = opened; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LiveStreamAdvancedFeature& AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.featureName) + } +}; + + + +USTRUCT(BlueprintType) +struct FLiveTranscoding +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int width = 360; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int height = 640; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int videoBitrate = 400; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int videoFramerate = 15; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + bool lowLatency = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int videoGop = 30; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + EVIDEO_CODEC_PROFILE_TYPE videoCodecProfile = EVIDEO_CODEC_PROFILE_TYPE::VIDEO_CODEC_PROFILE_HIGH; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int64 backgroundColor = 0x000000; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + EVIDEO_CODEC_TYPE_FOR_STREAM videoCodecType = EVIDEO_CODEC_TYPE_FOR_STREAM::VIDEO_CODEC_H264_FOR_STREAM; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int userCount = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + TArray transcodingUsers; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + FString transcodingExtraInfo = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + FString metadata = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + TArray watermark; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int watermarkCount = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + TArray backgroundImage; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int backgroundImageCount = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + EAUDIO_SAMPLE_RATE_TYPE audioSampleRate = EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int audioBitrate = 48; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int audioChannels = 1; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + EAUDIO_CODEC_PROFILE_TYPE audioCodecProfile = EAUDIO_CODEC_PROFILE_TYPE::AUDIO_CODEC_PROFILE_LC_AAC; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + TArray advancedFeatures; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") + int advancedFeatureCount = 0; + + FLiveTranscoding(){} + FLiveTranscoding(const agora::rtc::LiveTranscoding & AgoraData){ + width = AgoraData.width; + height = AgoraData.height; + videoBitrate = AgoraData.videoBitrate; + videoFramerate = AgoraData.videoFramerate; + lowLatency = AgoraData.lowLatency; + videoGop = AgoraData.videoGop; + videoCodecProfile = static_cast(AgoraData.videoCodecProfile); + backgroundColor = AgoraData.backgroundColor; + videoCodecType = static_cast(AgoraData.videoCodecType); + userCount = AgoraData.userCount; + for(int i = 0; i< userCount; i++){ + transcodingUsers.Add(FTranscodingUser((AgoraData.transcodingUsers[i]))); + } + + transcodingExtraInfo = UTF8_TO_TCHAR(AgoraData.transcodingExtraInfo); + metadata = UTF8_TO_TCHAR(AgoraData.metadata); + + for(unsigned int i =0; i< AgoraData.watermarkCount;i++) + { + watermark.Add(FRtcImage(AgoraData.watermark[i])); + } + watermarkCount = AgoraData.watermarkCount; + + for(unsigned int i =0; i< AgoraData.backgroundImageCount;i++){ + backgroundImage.Add(FRtcImage(AgoraData.watermark[i])); + } + backgroundImageCount = AgoraData.backgroundImageCount; + audioSampleRate = static_cast(AgoraData.audioSampleRate); + audioBitrate = AgoraData.audioBitrate; + audioChannels = AgoraData.audioChannels; + audioCodecProfile = static_cast(AgoraData.audioCodecProfile); + + for(unsigned int i = 0; i< AgoraData.advancedFeatureCount; i++){ + advancedFeatures.Add(FLiveStreamAdvancedFeature(AgoraData.advancedFeatures[i])); + } + advancedFeatureCount = AgoraData.advancedFeatureCount; + } + + agora::rtc::LiveTranscoding CreateAgoraData() const { + agora::rtc::LiveTranscoding AgoraData; + AgoraData.width = width; + AgoraData.height = height; + AgoraData.videoBitrate = videoBitrate; + AgoraData.videoFramerate = videoFramerate; + AgoraData.lowLatency = lowLatency; + AgoraData.videoGop = videoGop; + AgoraData.videoCodecProfile = static_cast(videoCodecProfile); + AgoraData.backgroundColor = static_cast(backgroundColor); + AgoraData.videoCodecType = static_cast(videoCodecType); + + AgoraData.userCount = userCount; + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(AgoraData.transcodingUsers, agora::rtc::TranscodingUser, userCount, this->transcodingUsers) + + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.transcodingExtraInfo,this->transcodingExtraInfo) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.metadata,this->metadata) + + AgoraData.watermarkCount = watermarkCount; + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(AgoraData.watermark, agora::rtc::RtcImage, watermarkCount, this->watermark) + + AgoraData.backgroundImageCount = backgroundImageCount; + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(AgoraData.backgroundImage, agora::rtc::RtcImage, backgroundImageCount, this->backgroundImage) + + AgoraData.audioSampleRate = static_cast(audioSampleRate); + AgoraData.audioBitrate = audioBitrate; + AgoraData.audioChannels = audioChannels; + + AgoraData.advancedFeatureCount = advancedFeatureCount; + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(AgoraData.advancedFeatures,agora::rtc::LiveStreamAdvancedFeature, advancedFeatureCount,this->advancedFeatures) + + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LiveTranscoding & AgoraData) const{ + + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(AgoraData.transcodingUsers,userCount, FTranscodingUser) + + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.transcodingExtraInfo) + + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(AgoraData.watermark, watermarkCount, FRtcImage) + + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(AgoraData.backgroundImage, backgroundImageCount, FRtcImage) + + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(AgoraData.advancedFeatures, advancedFeatureCount, FLiveStreamAdvancedFeature) + + } + +}; + + + + +USTRUCT(BlueprintType) +struct FLocalTranscoderConfiguration +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalTranscoderConfiguration") + int64 streamCount = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalTranscoderConfiguration") + TArray videoInputStreams; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalTranscoderConfiguration") + FVideoEncoderConfiguration videoOutputConfiguration = FVideoEncoderConfiguration(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalTranscoderConfiguration") + bool syncWithPrimaryCamera = true; + + FLocalTranscoderConfiguration(){} + FLocalTranscoderConfiguration(const agora::rtc::LocalTranscoderConfiguration & AgoraData){ + streamCount = AgoraData.streamCount; + for(int i = 0; i< streamCount; i++){ + videoInputStreams.Add(FTranscodingVideoStream(AgoraData.videoInputStreams[i])); + } + videoOutputConfiguration = FVideoEncoderConfiguration(AgoraData.videoOutputConfiguration); + syncWithPrimaryCamera = AgoraData.syncWithPrimaryCamera; + } + + agora::rtc::LocalTranscoderConfiguration CreateAgoraData() const { + agora::rtc::LocalTranscoderConfiguration AgoraData; + AgoraData.streamCount = streamCount; + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(AgoraData.videoInputStreams, agora::rtc::TranscodingVideoStream, streamCount, this->videoInputStreams) + AgoraData.videoOutputConfiguration = videoOutputConfiguration.CreateAgoraData(); + AgoraData.syncWithPrimaryCamera = syncWithPrimaryCamera; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LocalTranscoderConfiguration & AgoraData) const { + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(AgoraData.videoInputStreams, streamCount, FTranscodingVideoStream) + videoOutputConfiguration.FreeAgoraData(AgoraData.videoOutputConfiguration); + } +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_VIDEO_ORIENTATION : uint8 { + VIDEO_ORIENTATION_0 = 0, + VIDEO_ORIENTATION_90 = 1, + VIDEO_ORIENTATION_180 = 2, + VIDEO_ORIENTATION_270 = 3, +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_VIDEO_ORIENTATION { + GENERATED_BODY() + + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_VIDEO_ORIENTATION") + EENUMCUSTOM_VIDEO_ORIENTATION ValueWrapper = EENUMCUSTOM_VIDEO_ORIENTATION::VIDEO_ORIENTATION_0; + + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_4_ENTRIES(FENUMWRAP_VIDEO_ORIENTATION, agora::rtc::VIDEO_ORIENTATION, EENUMCUSTOM_VIDEO_ORIENTATION, + VIDEO_ORIENTATION_0, + VIDEO_ORIENTATION_90, + VIDEO_ORIENTATION_180, + VIDEO_ORIENTATION_270) +}; + + +UENUM(BlueprintType) +enum class EPRIORITY_TYPE : uint8 { + INVALID_OPT_BPGEN_NULL = 0, + PRIORITY_HIGH = 50, + PRIORITY_NORMAL = 100, +}; + + +USTRUCT(BlueprintType) +struct FDataStreamConfig +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DataStreamConfig") + bool syncWithAudio = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DataStreamConfig") + bool ordered = false; + + FDataStreamConfig(){} + FDataStreamConfig(const agora::rtc::DataStreamConfig & AgoraData){ + syncWithAudio = AgoraData.syncWithAudio; + ordered = AgoraData.ordered; + } + + agora::rtc::DataStreamConfig CreateAgoraData() const { + agora::rtc::DataStreamConfig AgoraData; + AgoraData.syncWithAudio = syncWithAudio; + AgoraData.ordered = ordered; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::DataStreamConfig & AgoraData) const { + + } + +}; + + +USTRUCT(BlueprintType) +struct FWatermarkRatio { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkRatio") + float xRatio = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkRatio") + float yRatio = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkRatio") + float widthRatio = 0; + + FWatermarkRatio(){} + FWatermarkRatio(const agora::rtc::WatermarkRatio & AgoraData){ + xRatio = AgoraData.xRatio; + yRatio = AgoraData.yRatio; + widthRatio = AgoraData.widthRatio; + } + + agora::rtc::WatermarkRatio CreateAgoraData() const { + agora::rtc::WatermarkRatio AgoraData; + AgoraData.xRatio = xRatio; + AgoraData.yRatio = yRatio; + AgoraData.widthRatio = widthRatio; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::WatermarkRatio & AgoraData) const { + + } +}; + + +UENUM(BlueprintType) +enum class EWATERMARK_FIT_MODE : uint8 { + + FIT_MODE_COVER_POSITION, + + FIT_MODE_USE_IMAGE_RATIO +}; + +USTRUCT(BlueprintType) +struct FWatermarkOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") + bool visibleInPreview = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") + FRectangle positionInLandscapeMode = FRectangle(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") + FRectangle positionInPortraitMode = FRectangle(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") + FWatermarkRatio watermarkRatio = FWatermarkRatio(); + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") + EWATERMARK_FIT_MODE mode = EWATERMARK_FIT_MODE::FIT_MODE_COVER_POSITION; + + FWatermarkOptions(){} + FWatermarkOptions(const agora::rtc::WatermarkOptions & AgoraData){ + visibleInPreview = AgoraData.visibleInPreview; + positionInLandscapeMode = FRectangle(AgoraData.positionInLandscapeMode); + positionInPortraitMode = FRectangle(AgoraData.positionInPortraitMode); + watermarkRatio = FWatermarkRatio(AgoraData.watermarkRatio); + mode = static_cast(AgoraData.mode); + } + + agora::rtc::WatermarkOptions CreateAgoraData() const { + agora::rtc::WatermarkOptions AgoraData; + AgoraData.visibleInPreview = visibleInPreview; + AgoraData.positionInLandscapeMode = positionInLandscapeMode.CreateAgoraData(); + AgoraData.positionInPortraitMode = positionInPortraitMode.CreateAgoraData(); + AgoraData.watermarkRatio = watermarkRatio.CreateAgoraData(); + AgoraData.mode = static_cast(mode); + return AgoraData; + } + void FreeAgoraData(agora::rtc::WatermarkOptions & AgoraData) const { + positionInLandscapeMode.FreeAgoraData(AgoraData.positionInLandscapeMode); + positionInPortraitMode.FreeAgoraData(AgoraData.positionInPortraitMode); + watermarkRatio.FreeAgoraData(AgoraData.watermarkRatio); + } + +}; + + +UENUM(BlueprintType) +enum class EAUDIO_AINS_MODE : uint8 { + AINS_MODE_BALANCED = 0, + AINS_MODE_AGGRESSIVE = 1, + AINS_MODE_ULTRALOWLATENCY = 2 +}; + + + +USTRUCT(BlueprintType) +struct FAgoraRhythmPlayerConfig +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraRhythmPlayerConfig") + int beatsPerMeasure = 4; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraRhythmPlayerConfig") + int beatsPerMinute = 60; + + FAgoraRhythmPlayerConfig(){} + FAgoraRhythmPlayerConfig(const agora::rtc::AgoraRhythmPlayerConfig & AgoraData){ + beatsPerMeasure = AgoraData.beatsPerMeasure; + beatsPerMinute = AgoraData.beatsPerMinute; + } + + agora::rtc::AgoraRhythmPlayerConfig CreateAgoraData() const { + agora::rtc::AgoraRhythmPlayerConfig AgoraData; + AgoraData.beatsPerMeasure = beatsPerMeasure; + AgoraData.beatsPerMinute = beatsPerMinute; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::AgoraRhythmPlayerConfig & AgoraData) const { + + } + +}; + +UENUM(BlueprintType) +enum class ECONTENT_INSPECT_TYPE : uint8 { + + CONTENT_INSPECT_INVALID = 0, + + // deprecated + CONTENT_INSPECT_MODERATION = 1, + + CONTENT_INSPECT_SUPERVISION = 2, + + CONTENT_INSPECT_IMAGE_MODERATION = 3 + +}; + +USTRUCT(BlueprintType) +struct FContentInspectModule { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectModule") + ECONTENT_INSPECT_TYPE type = ECONTENT_INSPECT_TYPE::CONTENT_INSPECT_INVALID; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectModule") + int64 interval = 0; + + FContentInspectModule(){} + FContentInspectModule(const agora::media::ContentInspectModule & AgoraData){ + type = static_cast(AgoraData.type); + interval = AgoraData.interval; + } + + agora::media::ContentInspectModule CreateAgoraData() const { + agora::media::ContentInspectModule AgoraData; + AgoraData.type = static_cast(type); + AgoraData.interval = interval; + return AgoraData; + } + void FreeAgoraData(agora::media::ContentInspectModule & AgoraData) const { + + } +}; + +USTRUCT(BlueprintType) +struct FContentInspectConfig +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectConfig") + FString extraInfo = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectConfig") + FString serverConfig; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectConfig") + TArray modules; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectConfig") + int moduleCount = 0; + + FContentInspectConfig(){} + FContentInspectConfig(const agora::media::ContentInspectConfig & AgoraData){ + extraInfo = UTF8_TO_TCHAR(AgoraData.extraInfo); + serverConfig = UTF8_TO_TCHAR(AgoraData.serverConfig); + moduleCount = AgoraData.moduleCount; + for(int i = 0; i< moduleCount; i++){ + modules.Add(FContentInspectModule(AgoraData.modules[i])); + } + } + + agora::media::ContentInspectConfig CreateAgoraData() const { + agora::media::ContentInspectConfig AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.extraInfo,this->extraInfo) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.serverConfig, this->serverConfig) + AgoraData.moduleCount = moduleCount; + for(int i = 0;i < moduleCount; i++){ + AgoraData.modules[i] = modules[i].CreateAgoraData(); + } + return AgoraData; + } + + void FreeAgoraData(agora::media::ContentInspectConfig & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.extraInfo) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.serverConfig) + for (int i = 0; i < moduleCount; i++) { + FContentInspectModule ReleaseOperator; + ReleaseOperator.FreeAgoraData(AgoraData.modules[i]); + } + } + +}; + + +UENUM(BlueprintType) +enum class ECLOUD_PROXY_TYPE : uint8 { + NONE_PROXY = 0, + UDP_PROXY = 1, + TCP_PROXY = 2, +}; + + +USTRUCT(BlueprintType) +struct FLogUploadServerInfo { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogUploadServerInfo") + FString serverDomain = ""; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogUploadServerInfo") + FString serverPath = ""; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogUploadServerInfo") + int serverPort = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogUploadServerInfo") + bool serverHttps = true; + + FLogUploadServerInfo() {} + FLogUploadServerInfo(const agora::rtc::LogUploadServerInfo& AgoraData) { + serverDomain = UTF8_TO_TCHAR(AgoraData.serverDomain); + serverPath = UTF8_TO_TCHAR(AgoraData.serverPath); + serverPort = AgoraData.serverPort; + serverHttps = AgoraData.serverHttps; + } + + agora::rtc::LogUploadServerInfo CreateAgoraData() const { + agora::rtc::LogUploadServerInfo AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.serverDomain, serverDomain) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.serverPath, serverPath) + + AgoraData.serverPort = serverPort; + AgoraData.serverHttps = serverHttps; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LogUploadServerInfo& AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.serverDomain) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.serverPath) + } +}; + + +USTRUCT(BlueprintType) +struct FAdvancedConfigInfo { + + GENERATED_BODY() + +public: + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvancedConfigInfo") + FLogUploadServerInfo logUploadServer = FLogUploadServerInfo(); + + FAdvancedConfigInfo(){} + FAdvancedConfigInfo(const agora::rtc::AdvancedConfigInfo& AgoraData) { + logUploadServer = FLogUploadServerInfo(AgoraData.logUploadServer); + } + + agora::rtc::AdvancedConfigInfo CreateAgoraData() const { + agora::rtc::AdvancedConfigInfo AgoraData; + AgoraData.logUploadServer = logUploadServer.CreateAgoraData(); + return AgoraData; + } + + void FreeAgoraData(agora::rtc::AdvancedConfigInfo& AgoraData) const { + logUploadServer.FreeAgoraData(AgoraData.logUploadServer); + } +}; + +UENUM(BlueprintType) +enum class ELOCAL_PROXY_MODE :uint8{ + ConnectivityFirst = 0, + LocalOnly = 1, +}; + +USTRUCT(BlueprintType) +struct FLocalAccessPointConfiguration +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") + TArray ipList; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") + int ipListSize = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") + TArray domainList; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") + int domainListSize = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") + FString verifyDomainName = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") + ELOCAL_PROXY_MODE mode = ELOCAL_PROXY_MODE::ConnectivityFirst; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") + FAdvancedConfigInfo advancedConfig; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") + bool disableAut = false; + + FLocalAccessPointConfiguration(){} + FLocalAccessPointConfiguration(const agora::rtc::LocalAccessPointConfiguration & AgoraData){ + + for(int i = 0; i< AgoraData.ipListSize; i++){ + ipList.Add(UTF8_TO_TCHAR(AgoraData.ipList[i])); + } + + ipListSize = AgoraData.ipListSize; + + for (int i = 0; i < AgoraData.domainListSize; i++) { + domainList.Add(UTF8_TO_TCHAR(AgoraData.domainList[i])); + } + + domainListSize = AgoraData.domainListSize; + + verifyDomainName = UTF8_TO_TCHAR(AgoraData.verifyDomainName); + + mode = static_cast(AgoraData.mode); + + advancedConfig = FAdvancedConfigInfo(AgoraData.advancedConfig); + + disableAut = AgoraData.disableAut; + } + + agora::rtc::LocalAccessPointConfiguration CreateAgoraData() const { + + agora::rtc::LocalAccessPointConfiguration AgoraData; + SET_UABT_TARRARY_FSTRING_TO_CONST_AGORA_ARRAY___MEMALLOC(AgoraData.ipList, ipListSize, this->ipList) + AgoraData.ipListSize = ipListSize; + SET_UABT_TARRARY_FSTRING_TO_CONST_AGORA_ARRAY___MEMALLOC(AgoraData.domainList, domainListSize, this->domainList) + AgoraData.domainListSize = domainListSize; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.verifyDomainName, this->verifyDomainName) + AgoraData.mode = static_cast(mode); + AgoraData.advancedConfig = advancedConfig.CreateAgoraData(); + AgoraData.disableAut = disableAut; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::LocalAccessPointConfiguration & AgoraData) const { + SET_UABT_TARRARY_FSTRING_TO_AGORA_ARRAY___MEMFREE(AgoraData.ipList, ipListSize) + SET_UABT_TARRARY_FSTRING_TO_AGORA_ARRAY___MEMFREE(AgoraData.domainList, domainListSize) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.verifyDomainName) + advancedConfig.FreeAgoraData(AgoraData.advancedConfig); + } +}; + +USTRUCT(BlueprintType) +struct FAdvancedAudioOptions +{ + GENERATED_BODY() + +public: + + // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvancedAudioOptions") + bool audioProcessingChannels_SetValue = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvancedAudioOptions") + int audioProcessingChannels = 0; + + FAdvancedAudioOptions(){} + FAdvancedAudioOptions(const agora::rtc::AdvancedAudioOptions & AgoraData){ + SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(this->audioProcessingChannels, AgoraData.audioProcessingChannels) + } + + agora::rtc::AdvancedAudioOptions CreateAgoraData() const { + agora::rtc::AdvancedAudioOptions AgoraData; + SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(AgoraData.audioProcessingChannels, this->audioProcessingChannels) + return AgoraData; + } + + void FreeAgoraData(agora::rtc::AdvancedAudioOptions & AgoraData) const { + + } +}; + + +USTRUCT(BlueprintType) +struct FImageTrackOptions +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ImageTrackOptions") + FString imageUrl = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ImageTrackOptions") + int fps = 1; + + FImageTrackOptions(){} + FImageTrackOptions(const agora::rtc::ImageTrackOptions & AgoraData){ + imageUrl = UTF8_TO_TCHAR(AgoraData.imageUrl); + fps = AgoraData.fps; + } + + agora::rtc::ImageTrackOptions CreateAgoraData() const { + agora::rtc::ImageTrackOptions AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.imageUrl,this->imageUrl) + AgoraData.fps = fps; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ImageTrackOptions & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.imageUrl) + } + +}; + + +UENUM(BlueprintType) +enum class EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET : uint8 { + + HEADPHONE_EQUALIZER_OFF = 0, + + HEADPHONE_EQUALIZER_OVEREAR = 1, + + HEADPHONE_EQUALIZER_INEAR = 2 +}; + + +USTRUCT(BlueprintType) +struct FENUMWRAP_HEADPHONE_EQUALIZER_PRESET +{ + GENERATED_BODY() + +public: + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_HEADPHONE_EQUALIZER_PRESET") + EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET ValueWrapper = EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_OFF; + + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_3_ENTRIES(FENUMWRAP_HEADPHONE_EQUALIZER_PRESET, agora::rtc::HEADPHONE_EQUALIZER_PRESET, EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET, + HEADPHONE_EQUALIZER_OFF, + HEADPHONE_EQUALIZER_OVEREAR, + HEADPHONE_EQUALIZER_INEAR) + +}; + + + +UENUM(BlueprintType) +enum EFeatureType { + + INVALID_OPT_BPGEN_NULL UMETA(Hidden, DisplayName = "AGORA NULL VALUE"), + VIDEO_VIRTUAL_BACKGROUND = 1, + VIDEO_BEAUTY_EFFECT = 2, + +}; + + +USTRUCT(BlueprintType) +struct FDeviceInfo +{ + GENERATED_BODY() + +public: + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DeviceInfo") + bool isLowLatencyAudioSupported = false; + + FDeviceInfo(){} + FDeviceInfo(const agora::rtc::DeviceInfo & AgoraData){ + isLowLatencyAudioSupported = AgoraData.isLowLatencyAudioSupported; + } + + agora::rtc::DeviceInfo CreateAgoraData() const { + agora::rtc::DeviceInfo AgoraData; + AgoraData.isLowLatencyAudioSupported = isLowLatencyAudioSupported; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::DeviceInfo& AgoraData) const { + + } +}; + + + +USTRUCT(BlueprintType) +struct FChannelMediaInfo { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") + int64 uid = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") + FString channelName = ""; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") + FString token = ""; + + FChannelMediaInfo(){} + FChannelMediaInfo(const agora::rtc::ChannelMediaInfo & AgoraData){ + channelName = UTF8_TO_TCHAR(AgoraData.channelName); + token = UTF8_TO_TCHAR(AgoraData.token); + uid = AgoraData.uid; + } + + agora::rtc::ChannelMediaInfo CreateAgoraData() const { + agora::rtc::ChannelMediaInfo AgoraData; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.channelName,this->channelName) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.token,this->token) + AgoraData.uid = uid; + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ChannelMediaInfo & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.channelName) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.token) + } +}; + + +USTRUCT(BlueprintType) +struct FChannelMediaRelayConfiguration +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaRelayConfiguration") + FChannelMediaInfo srcInfo = FChannelMediaInfo(); + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaRelayConfiguration") + TArray destInfos; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaRelayConfiguration") + int destCount = 0; + + FChannelMediaRelayConfiguration(){} + FChannelMediaRelayConfiguration(const agora::rtc::ChannelMediaRelayConfiguration & AgoraData){ + srcInfo = FChannelMediaInfo(*(AgoraData.srcInfo)); + destCount = AgoraData.destCount; + for(int i = 0; i< destCount; i++){ + destInfos.Add(FChannelMediaInfo(AgoraData.destInfos[i])); + } + } + + agora::rtc::ChannelMediaRelayConfiguration CreateAgoraData() const { + agora::rtc::ChannelMediaRelayConfiguration AgoraData; + + SET_UABT_UECUSTOMDATA_TO_AGORA_PTR_1_ENTRY___MEMALLOC(AgoraData.srcInfo,agora::rtc::ChannelMediaInfo, this->srcInfo) + + AgoraData.destCount = destCount; + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(AgoraData.destInfos, agora::rtc::ChannelMediaInfo, destCount, this->destInfos) + + return AgoraData; + } + + void FreeAgoraData(agora::rtc::ChannelMediaRelayConfiguration & AgoraData) const { + SET_UABT_UECUSTOMDATA_TO_AGORA_PTR_1_ENTRY___MEMFREE(AgoraData.srcInfo, FChannelMediaInfo) + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(AgoraData.destInfos, destCount, FChannelMediaInfo) + } +}; + +#pragma endregion Rtc Engine 3 \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuDeviceManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuDeviceManager.h new file mode 100644 index 00000000..8babd408 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuDeviceManager.h @@ -0,0 +1,131 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. + +#pragma once + +#include "CoreMinimal.h" + +#include "AgoraPluginInterface.h" +#include "AgoraBPuBaseDataTypes.h" + + +#include "AgoraBPuDeviceManager.generated.h" + +UCLASS(Blueprintable) +class AGORAPLUGIN_API UVideoDeviceCollection : public UObject +{ + GENERATED_BODY() + +public: + void Init(agora::rtc::IVideoDeviceCollection* VideoCollectionPtr); + + + UFUNCTION(BlueprintPure, Category = "Agora|IVideoDeviceCollection") + int GetCount(); + UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceCollection") + int SetDevice(const FString& deviceId); + UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceCollection") + int GetDevice(int index, FString& deviceName, FString& deviceId); + UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceCollection") + void Release(); + +private: + agora::rtc::IVideoDeviceCollection* VideoDeviceCollection; +}; + + +UCLASS(Blueprintable) +class AGORAPLUGIN_API UAudioDeviceCollection : public UObject +{ + GENERATED_BODY() + +public: + void Init(agora::rtc::IAudioDeviceCollection* AudioCollectionPtr); + + + + UFUNCTION(BlueprintPure, Category = "Agora|IAudioDeviceCollection") + int GetCount(); + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") + int GetDevice(int index, FString& deviceName, FString& deviceId); + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") + int SetDevice(const FString & deviceId); + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") + int GetDefaultDevice(FString& deviceName, FString& deviceId); + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") + int SetApplicationVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") + int GetApplicationVolume(int & volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") + int SetApplicationMute(bool mute); + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") + int IsApplicationMute(bool mute); + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceCollection") + void Release(); +private: + agora::rtc::IAudioDeviceCollection* AudioDeviceCollection; + +}; + + + +UCLASS() +class AGORAPLUGIN_API UAgoraBPuVideoDeviceManager : public UObject +{ + GENERATED_BODY() + +public: + + UFUNCTION(BlueprintPure, Category = "Agora|IVideoDeviceManager") + static UAgoraBPuVideoDeviceManager* GetAgoraVideoDeviceManager(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") + void Release(); + + + UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") + UVideoDeviceCollection* EnumerateVideoDevices(); + +private: + + static UAgoraBPuVideoDeviceManager* Instance; + + agora::rtc::IVideoDeviceManager* VideoDeviceManager; + + UPROPERTY() + UVideoDeviceCollection* VideoDeviceCollection = nullptr; +}; + + + +UCLASS() +class AGORAPLUGIN_API UAgoraBPuAudioDeviceManager : public UObject +{ + GENERATED_BODY() + +public: + + UFUNCTION(BlueprintPure, Category = "Agora|IAudioDeviceManager") + static UAgoraBPuAudioDeviceManager* GetAgoraAudioDeviceManager(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") + void Release(); + + + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") + UAudioDeviceCollection* EnumeratePlaybackDevices(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IAudioDeviceManager") + UAudioDeviceCollection* EnumerateRecordingDevices(); + +private: + + static UAgoraBPuAudioDeviceManager* Instance; + + agora::rtc::IAudioDeviceManager* AudioDeviceManager; + + UPROPERTY() + UAudioDeviceCollection* PlaybackDeviceCollection = nullptr; + + UPROPERTY() + UAudioDeviceCollection* RecordDeviceCollection = nullptr; +}; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIMediaPlayerSourceObserver.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIMediaPlayerSourceObserver.h new file mode 100644 index 00000000..1382cd45 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIMediaPlayerSourceObserver.h @@ -0,0 +1,441 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. +#pragma once + +#include "CoreMinimal.h" +#include "AgoraPluginInterface.h" +#include "AgoraBPuBaseDataTypes.h" +#include "AgoraBPuIMediaPlayerSourceObserver.generated.h" + +#pragma region Data Types + +UENUM(BlueprintType) +enum class EENUMCUSTOM_MEDIA_PLAYER_REASON : uint8 { + PLAYER_REASON_NONE = 0, + + PLAYER_REASON_INVALID_ARGUMENTS = 1, + + PLAYER_REASON_INTERNAL = 2, + + + PLAYER_REASON_NO_RESOURCE = 3, + + PLAYER_REASON_INVALID_MEDIA_SOURCE = 4, + + PLAYER_REASON_UNKNOWN_STREAM_TYPE = 5, + + PLAYER_REASON_OBJ_NOT_INITIALIZED = 6, + + PLAYER_REASON_CODEC_NOT_SUPPORTED = 7, + + PLAYER_REASON_VIDEO_RENDER_FAILED = 8, + + PLAYER_REASON_INVALID_STATE = 9, + + PLAYER_REASON_URL_NOT_FOUND = 10, + + PLAYER_REASON_INVALID_CONNECTION_STATE = 11, + + PLAYER_REASON_SRC_BUFFER_UNDERFLOW = 12, + + PLAYER_REASON_INTERRUPTED = 13, + + PLAYER_REASON_NOT_SUPPORTED = 14, + + PLAYER_REASON_TOKEN_EXPIRED = 15, + + PLAYER_REASON_IP_EXPIRED = 16, + + PLAYER_REASON_UNKNOWN = 17, + +}; + +USTRUCT(BlueprintType) +struct FENUMWRAP_MEDIA_PLAYER_REASON { + + GENERATED_BODY() + +public: + + // require to call [GetRawValue] method to get the raw value + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_MEDIA_PLAYER_REASON") + EENUMCUSTOM_MEDIA_PLAYER_REASON ValueWrapper = EENUMCUSTOM_MEDIA_PLAYER_REASON::PLAYER_REASON_NONE; + + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_18_ENTRIES(FENUMWRAP_MEDIA_PLAYER_REASON, agora::media::base::MEDIA_PLAYER_REASON,EENUMCUSTOM_MEDIA_PLAYER_REASON, + PLAYER_REASON_NONE, + PLAYER_REASON_INVALID_ARGUMENTS, + PLAYER_REASON_INTERNAL, + PLAYER_REASON_NO_RESOURCE, + PLAYER_REASON_INVALID_MEDIA_SOURCE, + PLAYER_REASON_UNKNOWN_STREAM_TYPE, + PLAYER_REASON_OBJ_NOT_INITIALIZED, + PLAYER_REASON_CODEC_NOT_SUPPORTED, + PLAYER_REASON_VIDEO_RENDER_FAILED, + PLAYER_REASON_INVALID_STATE, + PLAYER_REASON_URL_NOT_FOUND, + PLAYER_REASON_INVALID_CONNECTION_STATE, + PLAYER_REASON_SRC_BUFFER_UNDERFLOW, + PLAYER_REASON_INTERRUPTED, + PLAYER_REASON_NOT_SUPPORTED, + PLAYER_REASON_TOKEN_EXPIRED, + PLAYER_REASON_IP_EXPIRED, + PLAYER_REASON_UNKNOWN); +}; + +UENUM(BlueprintType) +enum EMEDIA_PLAYER_EVENT { + + PLAYER_EVENT_SEEK_BEGIN = 0, + + PLAYER_EVENT_SEEK_COMPLETE = 1, + + PLAYER_EVENT_SEEK_ERROR = 2, + + PLAYER_EVENT_AUDIO_TRACK_CHANGED = 5, + + PLAYER_EVENT_BUFFER_LOW = 6, + + PLAYER_EVENT_BUFFER_RECOVER = 7, + + PLAYER_EVENT_FREEZE_START = 8, + + PLAYER_EVENT_FREEZE_STOP = 9, + + PLAYER_EVENT_SWITCH_BEGIN = 10, + + PLAYER_EVENT_SWITCH_COMPLETE = 11, + + PLAYER_EVENT_SWITCH_ERROR = 12, + + PLAYER_EVENT_FIRST_DISPLAYED = 13, + + PLAYER_EVENT_REACH_CACHE_FILE_MAX_COUNT = 14, + + PLAYER_EVENT_REACH_CACHE_FILE_MAX_SIZE = 15, + + PLAYER_EVENT_TRY_OPEN_START = 16, + + PLAYER_EVENT_TRY_OPEN_SUCCEED = 17, + + PLAYER_EVENT_TRY_OPEN_FAILED = 18, +}; + + +UENUM(BlueprintType) +enum class EPLAYER_PRELOAD_EVENT :uint8 { + + PLAYER_PRELOAD_EVENT_BEGIN = 0, + + PLAYER_PRELOAD_EVENT_COMPLETE = 1, + + PLAYER_PRELOAD_EVENT_ERROR = 2, +}; + + +USTRUCT(BlueprintType) +struct FSrcInfo { + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SrcInfo") + int bitrateInKbps = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SrcInfo") + FString name = ""; + + FSrcInfo(){} + FSrcInfo(const agora::media::base::SrcInfo& srcInfo) { + bitrateInKbps = srcInfo.bitrateInKbps; + name = UTF8_TO_TCHAR(srcInfo.name); + } + + agora::media::base::SrcInfo CreateAgoraData() const { + agora::media::base::SrcInfo srcInfo; + srcInfo.bitrateInKbps = bitrateInKbps; + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(srcInfo.name,name) + return srcInfo; + } + + void FreeAgoraData(agora::media::base::SrcInfo& srcInfo) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(srcInfo.name) + } + +}; + +USTRUCT(BlueprintType) +struct FCacheStatistics { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CacheStatistics") + int64 fileSize = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CacheStatistics") + int64 cacheSize = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CacheStatistics") + int64 downloadSize = 0; + + FCacheStatistics(){} + FCacheStatistics(const agora::media::base::CacheStatistics& cacheStatistics) { + fileSize = cacheStatistics.fileSize; + cacheSize = cacheStatistics.cacheSize; + downloadSize = cacheStatistics.downloadSize; + } + + agora::media::base::CacheStatistics CreateAgoraData() const { + agora::media::base::CacheStatistics cacheStatistics; + cacheStatistics.fileSize = fileSize; + cacheStatistics.cacheSize = cacheSize; + cacheStatistics.downloadSize = downloadSize; + return cacheStatistics; + } + void FreeAgoraData(agora::media::base::CacheStatistics & AgoraData) const { + + } +}; + +USTRUCT(BlueprintType) +struct FPlayerPlaybackStats { + + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FPlayerPlaybackStats") + int videoFps = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FPlayerPlaybackStats") + int videoBitrateInKbps =0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FPlayerPlaybackStats") + int audioBitrateInKbps =0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FPlayerPlaybackStats") + int totalBitrateInKbps =0; + + FPlayerPlaybackStats(){} + FPlayerPlaybackStats(const agora::media::base::PlayerPlaybackStats& AgoraData) { + videoFps = AgoraData.videoFps; + videoBitrateInKbps = AgoraData.videoBitrateInKbps; + audioBitrateInKbps = AgoraData.audioBitrateInKbps; + totalBitrateInKbps = AgoraData.totalBitrateInKbps; + } + + agora::media::base::PlayerPlaybackStats CreateAgoraData() const { + agora::media::base::PlayerPlaybackStats AgoraData; + AgoraData.videoFps = videoFps; + AgoraData.videoBitrateInKbps = videoBitrateInKbps; + AgoraData.audioBitrateInKbps = audioBitrateInKbps; + AgoraData.totalBitrateInKbps = totalBitrateInKbps; + return AgoraData; + } + + void FreeAgoraData(agora::media::base::PlayerPlaybackStats & AgoraData) const { + + } +}; + + +USTRUCT(BlueprintType) +struct FPlayerUpdatedInfo { + GENERATED_BODY() + +public: + + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") + FString internalPlayerUuid = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") + FString deviceId = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") + int videoHeight = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") + int videoWidth = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") + int audioSampleRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") + int audioChannels = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") + int audioBitsPerSample = 0; + + + + FPlayerUpdatedInfo(){} + FPlayerUpdatedInfo(const agora::media::base::PlayerUpdatedInfo& playerUpdatedInfo) { + + internalPlayerUuid = UTF8_TO_TCHAR(playerUpdatedInfo.internalPlayerUuid); + deviceId = UTF8_TO_TCHAR(playerUpdatedInfo.deviceId); + videoHeight = playerUpdatedInfo.videoHeight; + videoWidth = playerUpdatedInfo.videoWidth; + audioSampleRate = playerUpdatedInfo.audioSampleRate; + audioChannels = playerUpdatedInfo.audioChannels; + audioBitsPerSample = playerUpdatedInfo.audioBitsPerSample; + } + + agora::media::base::PlayerUpdatedInfo CreateAgoraData() const { + agora::media::base::PlayerUpdatedInfo AgoraData; + + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.internalPlayerUuid,this->internalPlayerUuid) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.deviceId,this->deviceId) + AgoraData.videoHeight = videoHeight; + AgoraData.videoWidth = videoWidth; + AgoraData.audioSampleRate = audioSampleRate; + AgoraData.audioChannels = audioChannels; + AgoraData.audioBitsPerSample = audioBitsPerSample; + + return AgoraData; + } + + void FreeAgoraData(agora::media::base::PlayerUpdatedInfo & AgoraData) const { + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.internalPlayerUuid) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.deviceId) + } +}; + + +#pragma endregion Data Types + + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPlayerSourceStateChanged, EMEDIA_PLAYER_STATE, state, FENUMWRAP_MEDIA_PLAYER_REASON, ec); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPositionChanged, int64, position_ms, int64, timestampMs); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnPlayerEvent, EMEDIA_PLAYER_EVENT, eventCode, int64, elapsedTime, const FString &, message); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMetaDataSource,const FString &,Data); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPlayBufferUpdated, int64, playCachedBuffer); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPreloadEvent, const FString&, src, EPLAYER_PRELOAD_EVENT, event); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnCompleted); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnAgoraCDNTokenWillExpire); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPlayerSrcInfoChanged, const FSrcInfo&, from, const FSrcInfo&, to); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPlayerInfoUpdated, const FPlayerUpdatedInfo&, info); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAudioVolumeIndicationSource, int, volume); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPlayerCacheStats, const FCacheStatistics &, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPlayerPlaybackStats, const FPlayerPlaybackStats&, stats); + + + + +class IMediaPlayerSourceObserverClassWrapper : public agora::rtc::IMediaPlayerSourceObserver {}; + +/** + * + */ +UCLASS(BlueprintType) +class AGORAPLUGIN_API UAgoraBPuIMediaPlayerSourceObserver : public UObject, public IMediaPlayerSourceObserverClassWrapper +{ + GENERATED_BODY() +public: + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPlayerSourceStateChanged OnPlayerSourceStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPositionChanged OnPositionChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPlayerEvent OnPlayerEvent; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnMetaDataSource OnMetaData; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPlayBufferUpdated OnPlayBufferUpdated; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPreloadEvent OnPreloadEvent; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnCompleted OnCompleted; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAgoraCDNTokenWillExpire OnAgoraCDNTokenWillExpire; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPlayerSrcInfoChanged OnPlayerSrcInfoChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPlayerInfoUpdated OnPlayerInfoUpdated; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPlayerCacheStats OnPlayerCacheStats; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPlayerPlaybackStats OnPlayerPlaybackStats; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioVolumeIndicationSource OnAudioVolumeIndication; + + void onPlayerSourceStateChanged(agora::media::base::MEDIA_PLAYER_STATE state, agora::media::base::MEDIA_PLAYER_REASON ec) override; + + void onPositionChanged(int64_t positionMs,int64_t timestampMs) override; + + void onPlayerEvent(agora::media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override; + + void onMetaData(const void* data, int length) override; + + void onPlayBufferUpdated(int64_t playCachedBuffer) override; + + void onPreloadEvent(const char* src, agora::media::base::PLAYER_PRELOAD_EVENT event) override; + + void onCompleted() override; + + void onAgoraCDNTokenWillExpire() override; + + void onPlayerSrcInfoChanged(const agora::media::base::SrcInfo& from, const agora::media::base::SrcInfo& to) override; + + void onPlayerInfoUpdated(const agora::media::base::PlayerUpdatedInfo& info) override; + + + void onPlayerCacheStats(const agora::media::base::CacheStatistics& stats) override; + + void onPlayerPlaybackStats(const agora::media::base::PlayerPlaybackStats& stats) override; + + void onAudioVolumeIndication(int volume) override; + + + + // You could add multiple executors to the target handler + UFUNCTION(BlueprintCallable, Category = "Agora|Event") + void AddBlueprintCallbackExecutor(UAgoraBPuIMediaPlayerSourceObserverCBExecutor* Executor); + + UFUNCTION(BlueprintCallable, Category = "Agora|Event") + void RemoveAllBlueprintCallbackExecutors(); + + + +}; + + +// this is a blueprint callback executor which you could add to the target handler +UCLASS(Blueprintable,Meta = (ShowWorldContextPin)) +class AGORAPLUGIN_API UAgoraBPuIMediaPlayerSourceObserverCBExecutor : public UObject { + GENERATED_BODY() + +public: + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPlayerSourceStateChanged(EMEDIA_PLAYER_STATE state, FENUMWRAP_MEDIA_PLAYER_REASON ec); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPositionChanged(int64 position_ms, int64 timestampMs); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPlayerEvent(EMEDIA_PLAYER_EVENT eventCode, int64 elapsedTime, const FString& message); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnMetaData(const FString& Data); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPlayBufferUpdated(int64 playCachedBuffer); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPreloadEvent(const FString& src, EPLAYER_PRELOAD_EVENT event); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnCompleted(); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAgoraCDNTokenWillExpire(); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPlayerSrcInfoChanged(const FSrcInfo& from, const FSrcInfo& to); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPlayerInfoUpdated(const FPlayerUpdatedInfo& info); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPlayerCacheStats(const FCacheStatistics& stats); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPlayerPlaybackStats(const FPlayerPlaybackStats& stats); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioVolumeIndication(int volume); + +}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandler.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandler.h new file mode 100644 index 00000000..94efda27 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandler.h @@ -0,0 +1,1030 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. +#pragma once + +#include "CoreMinimal.h" +#include "AgoraPluginInterface.h" +#include "AgoraBPuBaseDataTypes.h" +#include "AgoraBPuIRtcEngineEventHandler.generated.h" + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnJoinChannelSuccess, const FString&, channel, int64, uid, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLeaveChannel, const FRtcStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserJoined, int64, uid, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserOffline, int64, uid, EUSER_OFFLINE_REASON_TYPE, reason); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnRejoinChannelSuccess, const FString&, channel, int64, uid, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnProxyConnected, const FString&, channel, int64, uid, EPROXY_TYPE, proxyType, const FString&, localProxyIp, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnError, int, err, const FString&, msg); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnAudioQuality, int64, uid, int, quality, int, delay, int, lost); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLastmileProbeResult, const FLastmileProbeResult&, result); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnAudioVolumeIndication, const TArray&,speakers, int, totalVolume); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRtcStats, const FRtcStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAudioDeviceStateChanged, const FString&, deviceId, int, deviceType, int, deviceState); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAudioMixingPositionChanged, int64, position); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnAudioMixingFinished); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAudioEffectFinished, int, soundId); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnVideoDeviceStateChanged, const FString&, deviceId, int, deviceType, int, deviceState); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnNetworkQuality, int64, uid, int, txQuality, int, rxQuality); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnIntraRequestReceived); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnUplinkNetworkInfoUpdated, const FUplinkNetworkInfo&, info); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDownlinkNetworkInfoUpdated, const FDownlinkNetworkInfo&, info); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLastmileQuality, int, quality); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnFirstLocalVideoFrame, EVIDEO_SOURCE_TYPE, source, int, width, int, height, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstLocalVideoFramePublished, EVIDEO_SOURCE_TYPE, source, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnFirstRemoteVideoDecoded, int64, uid, int, width, int, height, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnVideoSizeChanged, EVIDEO_SOURCE_TYPE, sourceType, int64, uid, int, width, int, height, int, rotation); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnLocalVideoStateChanged, EVIDEO_SOURCE_TYPE, source, ELOCAL_VIDEO_STREAM_STATE, state, ELOCAL_VIDEO_STREAM_REASON, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRemoteVideoStateChanged, int64, uid, EREMOTE_VIDEO_STATE, state, EREMOTE_VIDEO_STATE_REASON, reason, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnFirstRemoteVideoFrame, int64, userId, int, width, int, height, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserMuteAudio, int64, uid, bool, muted); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserMuteVideo, int64, userId, bool, muted); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserEnableVideo, int64, uid, bool, enabled); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserStateChanged, int64, uid, FENUMWRAP_REMOTE_USER_STATE, state); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserEnableLocalVideo, int64, uid, bool, enabled); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLocalAudioStats, const FLocalAudioStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRemoteAudioStats, const FRemoteAudioStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalVideoStats, EVIDEO_SOURCE_TYPE, source, const FLocalVideoStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRemoteVideoStats, const FRemoteVideoStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnCameraReady); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnCameraFocusAreaChanged, int, x, int, y, int, width, int, height); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnCameraExposureAreaChanged, int, x, int, y, int, width, int, height); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnFacePositionChanged, int,imageWidth, int,imageHeight, const TArray&, vecRectangle, const TArray& ,vecDistance, int,numFaces); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnVideoStopped); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnAudioMixingStateChanged, FENUMWRAP_AUDIO_MIXING_STATE_TYPE, state, FENUMWRAP_AUDIO_MIXING_REASON_TYPE, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRhythmPlayerStateChanged, FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE, state, FENUMWRAP_RHYTHM_PLAYER_REASON, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnConnectionLost); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnConnectionInterrupted); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnConnectionBanned); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnStreamMessage, int64,uid, int ,streamId, const FString& ,data, int, length, int64, sentTs); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnStreamMessageError, int64, uid, int, streamId, int, code, int, missed, int, cached); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnRequestToken); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTokenPrivilegeWillExpire, const FString&, token); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLicenseValidationFailure, ELICENSE_ERROR_TYPE, error); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnFirstLocalAudioFramePublished, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstRemoteAudioFrame, int64, uid, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstRemoteAudioDecoded, int64, uid, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalAudioStateChanged, ELOCAL_AUDIO_STREAM_STATE, state, ELOCAL_AUDIO_STREAM_REASON, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRemoteAudioStateChanged, int64, uid, EREMOTE_AUDIO_STATE, state, EREMOTE_AUDIO_STATE_REASON, reason, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnActiveSpeaker, int64, userId); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnContentInspectResult, ECONTENT_INSPECT_RESULT, result); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnSnapshotTaken, int64, uid, const FString&, filePath, int, width, int, height, int, errCode); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnClientRoleChanged, ECLIENT_ROLE_TYPE,oldRole, ECLIENT_ROLE_TYPE, newRole, const FClientRoleOptions& ,newRoleOptions); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnClientRoleChangeFailed, ECLIENT_ROLE_CHANGE_FAILED_REASON, reason, ECLIENT_ROLE_TYPE, currentRole); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAudioDeviceVolumeChanged, FENUMWRAP_MEDIA_DEVICE_TYPE, deviceType, int, volume, bool, muted); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnRtmpStreamingStateChanged, const FString&, url, ERTMP_STREAM_PUBLISH_STATE, state, ERTMP_STREAM_PUBLISH_REASON, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRtmpStreamingEvent, const FString&, url, ERTMP_STREAMING_EVENT, eventCode); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnTranscodingUpdated); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAudioRoutingChanged, int, routing); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnChannelMediaRelayStateChanged, int, state, int, code); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLocalPublishFallbackToAudioOnly, bool, isFallbackOrRecover); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRemoteSubscribeFallbackToAudioOnly, int64, uid, bool, isFallbackOrRecover); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRemoteAudioTransportStats, int64, uid, int, delay, int, lost, int, rxKBitRate); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRemoteVideoTransportStats, int64, uid, int, delay, int, lost, int, rxKBitRate); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnConnectionStateChanged, ECONNECTION_STATE_TYPE, state, ECONNECTION_CHANGED_REASON_TYPE, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnWlAccMessage, EWLACC_MESSAGE_REASON, reason, EWLACC_SUGGEST_ACTION, action, const FString&, wlAccMsg); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnWlAccStats, const FWlAccStats&, currentStats, const FWlAccStats&, averageStats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnNetworkTypeChanged, FENUMWRAP_NETWORK_TYPE, type); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnEncryptionError, EENCRYPTION_ERROR_TYPE, errorType); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPermissionError, EPERMISSION_TYPE, permissionType); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalUserRegistered, int64, uid, const FString&, userAccount); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserInfoUpdated, int64, uid, const FUserInfo&, info); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserAccountUpdated, int64, uid, const FString&, userAccount); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnVideoRenderingTracingResult, int64, uid, EMEDIA_TRACE_EVENT, currentEvent, const FVideoRenderingTracingInfo &, tracingInfo); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalVideoTranscoderError, const FTranscodingVideoStream&, stream, EVIDEO_TRANSCODER_ERROR, error); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUploadLogResult, const FString&, requestId, bool, success, EUPLOAD_ERROR_REASON, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnAudioSubscribeStateChanged, const FString&, channel, int64, uid, ESTREAM_SUBSCRIBE_STATE, oldState, ESTREAM_SUBSCRIBE_STATE, newState, int, elapseSinceLastState); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnVideoSubscribeStateChanged, const FString&, channel, int64, uid, ESTREAM_SUBSCRIBE_STATE, oldState, ESTREAM_SUBSCRIBE_STATE, newState, int, elapseSinceLastState); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnAudioPublishStateChanged, const FString&, channel, ESTREAM_PUBLISH_STATE, oldState, ESTREAM_PUBLISH_STATE, newState, int, elapseSinceLastState); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnVideoPublishStateChanged, EVIDEO_SOURCE_TYPE, source, const FString&, channel, ESTREAM_PUBLISH_STATE, oldState, ESTREAM_PUBLISH_STATE, newState, int, elapseSinceLastState); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnTranscodedStreamLayoutInfo, int64, uid, int, width, int, height, int, layoutCount,const TArray &, layoutlist); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAudioMetadataReceived, int64, uid, const FString&, metadata, const FString&, length); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnExtensionEventWithContext, const FExtensionContext&, context, const FString &, key, const FString &, value); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnExtensionStartedWithContext, const FExtensionContext& ,context); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnExtensionStoppedWithContext, const FExtensionContext&, context); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnExtensionErrorWithContext, const FExtensionContext&, context, int, error , const FString&, message); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSetRtmFlagResult, int, code); + + +class IRtcEngineEventHandlerClassWrapper : public agora::rtc::IRtcEngineEventHandler {}; + +using namespace agora; +using namespace agora::rtc; + +// this is a native event handler managed in cpp +UCLASS(BlueprintType) +class AGORAPLUGIN_API UAgoraBPuIRtcEngineEventHandler : public UObject, public IRtcEngineEventHandlerClassWrapper +{ + GENERATED_BODY() + +public: + using IRtcEngineEventHandler::eventHandlerType; + //using IRtcEngineEventHandler::onJoinChannelSuccess; + //using IRtcEngineEventHandler::onLeaveChannel; + //using IRtcEngineEventHandler::onUserJoined; + //using IRtcEngineEventHandler::onUserOffline; +/* + + using IRtcEngineEventHandler::onRejoinChannelSuccess; + using IRtcEngineEventHandler::onAudioQuality; + using IRtcEngineEventHandler::onAudioVolumeIndication; + using IRtcEngineEventHandler::onRtcStats; + using IRtcEngineEventHandler::onNetworkQuality; + using IRtcEngineEventHandler::onIntraRequestReceived; + using IRtcEngineEventHandler::onFirstLocalVideoFramePublished; + using IRtcEngineEventHandler::onFirstRemoteVideoDecoded; + using IRtcEngineEventHandler::onVideoSizeChanged; + using IRtcEngineEventHandler::onLocalVideoStateChanged; + using IRtcEngineEventHandler::onRemoteVideoStateChanged; + using IRtcEngineEventHandler::onFirstRemoteVideoFrame; + 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::onUserInfoUpdated; + using IRtcEngineEventHandler::onUserAccountUpdated; + using IRtcEngineEventHandler::onAudioSubscribeStateChanged; + using IRtcEngineEventHandler::onVideoSubscribeStateChanged; + using IRtcEngineEventHandler::onAudioPublishStateChanged; + using IRtcEngineEventHandler::onVideoPublishStateChanged; + using IRtcEngineEventHandler::onSnapshotTaken; + using IRtcEngineEventHandler::onVideoRenderingTracingResult; + using IRtcEngineEventHandler::onSetRtmFlagResult; + using IRtcEngineEventHandler::onTranscodedStreamLayoutInfo; + using IRtcEngineEventHandler::onAudioMetadataReceived + +*/; +public: + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnJoinChannelSuccess OnJoinChannelSuccess; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLeaveChannel OnLeaveChannel; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserJoined OnUserJoined; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserOffline OnUserOffline; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRejoinChannelSuccess OnRejoinChannelSuccess; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnProxyConnected OnProxyConnected; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnError OnError; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioQuality OnAudioQuality; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLastmileProbeResult OnLastmileProbeResult; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioVolumeIndication OnAudioVolumeIndication; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRtcStats OnRtcStats; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioDeviceStateChanged OnAudioDeviceStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioMixingPositionChanged OnAudioMixingPositionChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioMixingFinished OnAudioMixingFinished; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioEffectFinished OnAudioEffectFinished; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnVideoDeviceStateChanged OnVideoDeviceStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnNetworkQuality OnNetworkQuality; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnIntraRequestReceived OnIntraRequestReceived; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUplinkNetworkInfoUpdated OnUplinkNetworkInfoUpdated; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnDownlinkNetworkInfoUpdated OnDownlinkNetworkInfoUpdated; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLastmileQuality OnLastmileQuality; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstLocalVideoFrame OnFirstLocalVideoFrame; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstLocalVideoFramePublished OnFirstLocalVideoFramePublished; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstRemoteVideoDecoded OnFirstRemoteVideoDecoded; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnVideoSizeChanged OnVideoSizeChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalVideoStateChanged OnLocalVideoStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteVideoStateChanged OnRemoteVideoStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstRemoteVideoFrame OnFirstRemoteVideoFrame; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserMuteAudio OnUserMuteAudio; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserMuteVideo OnUserMuteVideo; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserEnableVideo OnUserEnableVideo; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserStateChanged OnUserStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserEnableLocalVideo OnUserEnableLocalVideo; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalAudioStats OnLocalAudioStats; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteAudioStats OnRemoteAudioStats; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalVideoStats OnLocalVideoStats; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteVideoStats OnRemoteVideoStats; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnCameraReady OnCameraReady; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnCameraFocusAreaChanged OnCameraFocusAreaChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnCameraExposureAreaChanged OnCameraExposureAreaChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFacePositionChanged OnFacePositionChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnVideoStopped OnVideoStopped; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioMixingStateChanged OnAudioMixingStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRhythmPlayerStateChanged OnRhythmPlayerStateChanged; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnConnectionLost OnConnectionLost; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnConnectionInterrupted OnConnectionInterrupted; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnConnectionBanned OnConnectionBanned; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnStreamMessage OnStreamMessage; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnStreamMessageError OnStreamMessageError; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRequestToken OnRequestToken; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnTokenPrivilegeWillExpire OnTokenPrivilegeWillExpire; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLicenseValidationFailure OnLicenseValidationFailure; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstLocalAudioFramePublished OnFirstLocalAudioFramePublished; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstRemoteAudioDecoded OnFirstRemoteAudioDecoded; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstRemoteAudioFrame OnFirstRemoteAudioFrame; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalAudioStateChanged OnLocalAudioStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteAudioStateChanged OnRemoteAudioStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnActiveSpeaker OnActiveSpeaker; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnContentInspectResult OnContentInspectResult; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnSnapshotTaken OnSnapshotTaken; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnClientRoleChanged OnClientRoleChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnClientRoleChangeFailed OnClientRoleChangeFailed; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioDeviceVolumeChanged OnAudioDeviceVolumeChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRtmpStreamingStateChanged OnRtmpStreamingStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRtmpStreamingEvent OnRtmpStreamingEvent; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnTranscodingUpdated OnTranscodingUpdated; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioRoutingChanged OnAudioRoutingChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnChannelMediaRelayStateChanged OnChannelMediaRelayStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalPublishFallbackToAudioOnly OnLocalPublishFallbackToAudioOnly; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteSubscribeFallbackToAudioOnly OnRemoteSubscribeFallbackToAudioOnly; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteAudioTransportStats OnRemoteAudioTransportStats; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteVideoTransportStats OnRemoteVideoTransportStats; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnConnectionStateChanged OnConnectionStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnWlAccMessage OnWlAccMessage; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnWlAccStats OnWlAccStats; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnNetworkTypeChanged OnNetworkTypeChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnEncryptionError OnEncryptionError; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnPermissionError OnPermissionError; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalUserRegistered OnLocalUserRegistered; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserInfoUpdated OnUserInfoUpdated; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserAccountUpdated OnUserAccountUpdated; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnVideoRenderingTracingResult OnVideoRenderingTracingResult; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalVideoTranscoderError OnLocalVideoTranscoderError; + + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUploadLogResult OnUploadLogResult; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioSubscribeStateChanged OnAudioSubscribeStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnVideoSubscribeStateChanged OnVideoSubscribeStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioPublishStateChanged OnAudioPublishStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnVideoPublishStateChanged OnVideoPublishStateChanged; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnTranscodedStreamLayoutInfo OnTranscodedStreamLayoutInfo; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioMetadataReceived OnAudioMetadataReceived; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnExtensionEventWithContext OnExtensionEventWithContext; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnExtensionStartedWithContext OnExtensionStartedWithContext; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnExtensionStoppedWithContext OnExtensionStoppedWithContext; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnExtensionErrorWithContext OnExtensionErrorWithContext; + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnSetRtmFlagResult OnSetRtmFlagResult; + + virtual void onJoinChannelSuccess(const char* channel, agora::rtc::uid_t uid, int elapsed) override; + virtual void onLeaveChannel(const agora::rtc::RtcStats& stats) override; + + virtual void onUserJoined(agora::rtc::uid_t uid, int elapsed) override; + + virtual void onUserOffline(agora::rtc::uid_t uid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) override; + + + virtual void onRejoinChannelSuccess(const char* channel, agora::rtc::uid_t uid, int elapsed) override; + + virtual void onProxyConnected(const char* channel, agora::rtc::uid_t uid, agora::rtc::PROXY_TYPE proxyType, const char* localProxyIp, int elapsed) override; + + virtual void onError(int err, const char* msg) override; + + + virtual void onAudioQuality(uid_t uid, int quality, unsigned short delay, unsigned short lost) __deprecated override; + + + virtual void onLastmileProbeResult(const LastmileProbeResult& result) override; + + virtual void onAudioVolumeIndication(const AudioVolumeInfo* speakers, unsigned int speakerNumber, + int totalVolume) override; + + virtual void onRtcStats(const RtcStats& stats) override; + + + virtual void onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) override; + + + virtual void onAudioMixingPositionChanged(int64_t position) override; + + + virtual void onAudioMixingFinished() __deprecated override; + + + virtual void onAudioEffectFinished(int soundId) override; + + + virtual void onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) override; + + + virtual void onNetworkQuality(uid_t uid, int txQuality, int rxQuality) override; + + virtual void onIntraRequestReceived() override; + + virtual void onUplinkNetworkInfoUpdated(const UplinkNetworkInfo& info) override; + + + virtual void onDownlinkNetworkInfoUpdated(const DownlinkNetworkInfo& info) override; + + + virtual void onLastmileQuality(int quality) override; + + + virtual void onFirstLocalVideoFrame(VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) override; + + virtual void onFirstLocalVideoFramePublished(VIDEO_SOURCE_TYPE source, int elapsed) override; + + + virtual void onFirstRemoteVideoDecoded(uid_t uid, int width, int height, int elapsed) __deprecated override; + + + virtual void onVideoSizeChanged(VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) override; + + + virtual void onLocalVideoStateChanged(VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_REASON reason) override; + + + virtual void onRemoteVideoStateChanged(uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) override; + + + virtual void onFirstRemoteVideoFrame(uid_t uid, int width, int height, int elapsed) override; + + + virtual void onUserMuteAudio(uid_t uid, bool muted) override; + + + virtual void onUserMuteVideo(uid_t uid, bool muted) override; + + + virtual void onUserEnableVideo(uid_t uid, bool enabled) __deprecated override; + + + virtual void onUserStateChanged(uid_t uid, REMOTE_USER_STATE state) override; + + + virtual void onUserEnableLocalVideo(uid_t uid, bool enabled) __deprecated override; + + + + + virtual void onRemoteAudioStats(const RemoteAudioStats& stats) override; + + virtual void onLocalAudioStats(const LocalAudioStats& stats) override; + + virtual void onLocalVideoStats(VIDEO_SOURCE_TYPE source, const LocalVideoStats& stats) override; + + + virtual void onRemoteVideoStats(const RemoteVideoStats& stats) override; + + + virtual void onCameraReady() __deprecated override; + + virtual void onCameraFocusAreaChanged(int x, int y, int width, int height) override; + + + virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) override; + +#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) + + virtual void onFacePositionChanged(int imageWidth, int imageHeight, + const Rectangle* vecRectangle, const int* vecDistance, + int numFaces) override; + +#endif + + + virtual void onVideoStopped() __deprecated override; + + virtual void onAudioMixingStateChanged(AUDIO_MIXING_STATE_TYPE state, AUDIO_MIXING_REASON_TYPE reason) override; + + + virtual void onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_REASON reason) override; + + virtual void onConnectionLost() override; + + virtual void onConnectionInterrupted() __deprecated override; + + virtual void onConnectionBanned() __deprecated override; + + virtual void onStreamMessage(uid_t uid, int streamId, const char* data, size_t length, uint64_t sentTs) override; + + virtual void onStreamMessageError(uid_t uid, int streamId, int code, int missed, int cached) override; + + virtual void onRequestToken() override; + + virtual void onTokenPrivilegeWillExpire(const char* token) override; + + + virtual void onLicenseValidationFailure(LICENSE_ERROR_TYPE error) override; + + virtual void onFirstLocalAudioFramePublished(int elapsed) override; + + virtual void onFirstRemoteAudioDecoded(uid_t uid, int elapsed) __deprecated override; + + virtual void onFirstRemoteAudioFrame(uid_t uid, int elapsed) __deprecated override; + + virtual void onLocalAudioStateChanged(LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_REASON reason) override; + + virtual void onRemoteAudioStateChanged(uid_t uid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) override; + + + virtual void onActiveSpeaker(uid_t uid) override; + + virtual void onContentInspectResult(media::CONTENT_INSPECT_RESULT result) override; + + + virtual void onSnapshotTaken(uid_t uid, const char* filePath, int width, int height, int errCode) override; + + virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) override; + + + virtual void onClientRoleChangeFailed(CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) override; + + virtual void onAudioDeviceVolumeChanged(MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) override; + + virtual void onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, RTMP_STREAM_PUBLISH_REASON reason) override; + + virtual void onRtmpStreamingEvent(const char* url, RTMP_STREAMING_EVENT eventCode) override; + + + virtual void onTranscodingUpdated() override; + + virtual void onAudioRoutingChanged(int routing) override; + + + virtual void onChannelMediaRelayStateChanged(int state, int code) override; + + virtual void onLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover) override; + + virtual void onRemoteSubscribeFallbackToAudioOnly(uid_t uid, bool isFallbackOrRecover) override; + + virtual void onRemoteAudioTransportStats(uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) __deprecated override; + + virtual void onRemoteVideoTransportStats(uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) __deprecated override; + + + virtual void onConnectionStateChanged( + CONNECTION_STATE_TYPE state, CONNECTION_CHANGED_REASON_TYPE reason) override; + + virtual void onWlAccMessage(WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) override; + + + virtual void onWlAccStats(const WlAccStats& currentStats, const WlAccStats& averageStats) override; + + virtual void onNetworkTypeChanged(NETWORK_TYPE type) override; + + virtual void onEncryptionError(ENCRYPTION_ERROR_TYPE errorType) override; + + virtual void onPermissionError(PERMISSION_TYPE permissionType) override; + + virtual void onLocalUserRegistered(uid_t uid, const char* userAccount) override; + + virtual void onUserInfoUpdated(uid_t uid, const agora::rtc::UserInfo& info) override; + + virtual void onUserAccountUpdated(uid_t uid, const char* userAccount) override; + + virtual void onVideoRenderingTracingResult(uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) override; + + virtual void onLocalVideoTranscoderError(const TranscodingVideoStream& stream, VIDEO_TRANSCODER_ERROR error) override; + + virtual void onUploadLogResult(const char* requestId, bool success, UPLOAD_ERROR_REASON reason) override; + + virtual void onAudioSubscribeStateChanged(const char* channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) override; + + virtual void onVideoSubscribeStateChanged(const char* channel, uid_t uid, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) override; + + virtual void onAudioPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) override; + + virtual void onVideoPublishStateChanged(VIDEO_SOURCE_TYPE source, const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) override; + + virtual void onTranscodedStreamLayoutInfo(uid_t uid, int width, int height, int layoutCount, const VideoLayout* layoutlist) override; + + virtual void onAudioMetadataReceived(uid_t uid, const char* metadata, size_t length) override; + + virtual void onExtensionEventWithContext(const ExtensionContext& context, const char* key, const char* value) override; + + virtual void onExtensionStartedWithContext(const ExtensionContext& context) override; + + virtual void onExtensionStoppedWithContext(const ExtensionContext& context) override; + + virtual void onExtensionErrorWithContext(const ExtensionContext& context, int error, const char* message) override; + + virtual void onSetRtmFlagResult(int code) override; + + + + + // You could add multiple executors to the target handler + UFUNCTION(BlueprintCallable, Category = "Agora|Event") + void AddBlueprintCallbackExecutor(UAgoraBPuIRtcEngineEventHandlerCBExecutor* Executor); + + UFUNCTION(BlueprintCallable, Category = "Agora|Event") + void RemoveAllBlueprintCallbackExecutors(); + +private: + EAgoraBPuEventHandlerType Type = EAgoraBPuEventHandlerType::EventHandler; +}; + + + +// this is a blueprint callback executor which you could add to the target handler +UCLASS(Blueprintable,Meta = (ShowWorldContextPin)) +class AGORAPLUGIN_API UAgoraBPuIRtcEngineEventHandlerCBExecutor : public UObject { + GENERATED_BODY() + +public: + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnJoinChannelSuccess(const FString& Channel, int64 Uid, int Elapsed); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLeaveChannel(const FRtcStats& stats); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserJoined(int64 uid, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserOffline(int64 uid, EUSER_OFFLINE_REASON_TYPE reason); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRejoinChannelSuccess(const FString& channel, int64 uid, int elapsed); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnProxyConnected(const FString& channel, int64 uid, EPROXY_TYPE proxyType, const FString& localProxyIp, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnError(int error, const FString& msg); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioQuality(int64 uid, int quality, int delay, int lost); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLastmileProbeResult(const FLastmileProbeResult& result); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioVolumeIndication(const TArray& speakers, int totalVolume); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRtcStats(const FRtcStats& stats); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioDeviceStateChanged(const FString& deviceId, int deviceType, int deviceState); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioMixingPositionChanged(int64 position); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioMixingFinished(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioEffectFinished(int soundId); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnVideoDeviceStateChanged(const FString& deviceId, int deviceType, int deviceState); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnNetworkQuality(int64 uid, int txQuality, int rxQuality); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnIntraRequestReceived(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUplinkNetworkInfoUpdated(const FUplinkNetworkInfo& info); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnDownlinkNetworkInfoUpdated(const FDownlinkNetworkInfo& info); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLastmileQuality(int quality); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnFirstLocalVideoFrame(EVIDEO_SOURCE_TYPE source, int width, int height, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnFirstLocalVideoFramePublished(EVIDEO_SOURCE_TYPE source, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnFirstRemoteVideoDecoded(int64 uid, int width, int height, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnVideoSizeChanged(EVIDEO_SOURCE_TYPE sourceType, int64 uid, int width, int height, int rotation); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLocalVideoStateChanged(EVIDEO_SOURCE_TYPE source, ELOCAL_VIDEO_STREAM_STATE state, ELOCAL_VIDEO_STREAM_REASON reason); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRemoteVideoStateChanged(int64 uid, EREMOTE_VIDEO_STATE state, EREMOTE_VIDEO_STATE_REASON reason, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnFirstRemoteVideoFrame(int64 uid, int width, int height, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserMuteAudio(int64 uid, bool muted); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserMuteVideo(int64 uid, bool muted); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserEnableVideo(int64 uid, bool enabled); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserStateChanged(int64 uid, FENUMWRAP_REMOTE_USER_STATE state); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserEnableLocalVideo(int64 uid, bool enabled); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRemoteAudioStats(const FRemoteAudioStats& stats); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLocalAudioStats(const FLocalAudioStats& stats); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLocalVideoStats(EVIDEO_SOURCE_TYPE source, const FLocalVideoStats& stats); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRemoteVideoStats(const FRemoteVideoStats& stats); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnCameraReady(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnCameraFocusAreaChanged(int x, int y, int width, int height); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnCameraExposureAreaChanged(int x, int y, int width, int height); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnFacePositionChanged(int imageWidth, int imageHeight, const TArray& vecRectangle, const TArray& vecDistance, int numFaces); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnVideoStopped(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioMixingStateChanged(FENUMWRAP_AUDIO_MIXING_STATE_TYPE state, FENUMWRAP_AUDIO_MIXING_REASON_TYPE reason); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRhythmPlayerStateChanged(FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE state, FENUMWRAP_RHYTHM_PLAYER_REASON reason); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnConnectionLost(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnConnectionInterrupted(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnConnectionBanned(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnStreamMessage(int64 uid, int streamId, const FString& data, int length, int64 sentTs); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnStreamMessageError(int64 uid, int streamId, int code, int missed, int cached); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRequestToken(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnTokenPrivilegeWillExpire(const FString& token); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLicenseValidationFailure(ELICENSE_ERROR_TYPE error); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnFirstLocalAudioFramePublished(int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnFirstRemoteAudioDecoded(int64 uid, int elapsed); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnFirstRemoteAudioFrame(int64 uid, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLocalAudioStateChanged(ELOCAL_AUDIO_STREAM_STATE state, ELOCAL_AUDIO_STREAM_REASON reason); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRemoteAudioStateChanged(int64 uid, EREMOTE_AUDIO_STATE state, EREMOTE_AUDIO_STATE_REASON reason, int elapsed); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnActiveSpeaker(int64 uid); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnContentInspectResult(ECONTENT_INSPECT_RESULT result); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnSnapshotTaken(int64 uid, const FString& filePath, int width, int height, int errCode); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnClientRoleChanged(ECLIENT_ROLE_TYPE oldRole, ECLIENT_ROLE_TYPE newRole, const FClientRoleOptions& newRoleOptions); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnClientRoleChangeFailed(ECLIENT_ROLE_CHANGE_FAILED_REASON reason, ECLIENT_ROLE_TYPE currentRole); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioDeviceVolumeChanged(FENUMWRAP_MEDIA_DEVICE_TYPE deviceType, int volume, bool muted); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRtmpStreamingStateChanged(const FString& url, ERTMP_STREAM_PUBLISH_STATE state, ERTMP_STREAM_PUBLISH_REASON reason); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRtmpStreamingEvent(const FString& url, ERTMP_STREAMING_EVENT eventCode); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnTranscodingUpdated(); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioRoutingChanged(int routing); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnChannelMediaRelayStateChanged(int state, int code); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRemoteSubscribeFallbackToAudioOnly(int64 uid, bool isFallbackOrRecover); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRemoteAudioTransportStats(int64 uid, int delay, int lost, int rxKBitRate); + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnRemoteVideoTransportStats(int64 uid, int delay, int lost, int rxKBitRate); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnConnectionStateChanged(ECONNECTION_STATE_TYPE state, ECONNECTION_CHANGED_REASON_TYPE reason); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnWlAccMessage(EWLACC_MESSAGE_REASON reason, EWLACC_SUGGEST_ACTION action, const FString& wlAccMsg); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnWlAccStats(const FWlAccStats& currentStats, const FWlAccStats& averageStats); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnNetworkTypeChanged(FENUMWRAP_NETWORK_TYPE type); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnEncryptionError(EENCRYPTION_ERROR_TYPE errorType); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnPermissionError(EPERMISSION_TYPE permissionType); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLocalUserRegistered(int64 uid, const FString& userAccount); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserInfoUpdated(int64 uid, const FUserInfo& info); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUserAccountUpdated(int64 uid, const FString& userAccount); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnVideoRenderingTracingResult(int64 uid, EMEDIA_TRACE_EVENT currentEvent, const FVideoRenderingTracingInfo& tracingInfo); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnLocalVideoTranscoderError(const FTranscodingVideoStream& stream, EVIDEO_TRANSCODER_ERROR error); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnUploadLogResult(const FString& requestId, bool success, EUPLOAD_ERROR_REASON reason); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioSubscribeStateChanged(const FString& channel, int64 uid, ESTREAM_SUBSCRIBE_STATE oldState, ESTREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnVideoSubscribeStateChanged(const FString& channel, int64 uid, ESTREAM_SUBSCRIBE_STATE oldState, ESTREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioPublishStateChanged(const FString& channel, ESTREAM_PUBLISH_STATE oldState, ESTREAM_PUBLISH_STATE newState, int elapseSinceLastState); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnVideoPublishStateChanged(EVIDEO_SOURCE_TYPE source, const FString& channel, ESTREAM_PUBLISH_STATE oldState, ESTREAM_PUBLISH_STATE newState, int elapseSinceLastState); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnTranscodedStreamLayoutInfo(int64 uid, int width, int height, int layoutCount, const TArray& layoutlist); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnAudioMetadataReceived(int64 uid, const FString& metadata, const FString& length); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnExtensionEventWithContext(const FExtensionContext& context, const FString& key, const FString& value); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnExtensionStartedWithContext(const FExtensionContext& context); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnExtensionStoppedWithContext(const FExtensionContext& context); + + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnExtensionErrorWithContext(const FExtensionContext& context, int error, const FString& message); + + + UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event") + void OnSetRtmFlagResult(int code); + +}; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandlerEx.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandlerEx.h new file mode 100644 index 00000000..5c3eef25 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuIRtcEngineEventHandlerEx.h @@ -0,0 +1,641 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. +#pragma once + +#include "CoreMinimal.h" +#include "AgoraPluginInterface.h" +#include "AgoraBPuBaseDataTypes.h" +#include "AgoraBPuIRtcEngineEventHandlerEx.generated.h" + + + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnJoinChannelSuccessEx, const FRtcConnection&, connection, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLeaveChannelEx, const FRtcConnection&, connection, const FRtcStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserJoinedEx, const FRtcConnection&, connection, int64, remoteUid, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserOfflineEx, const FRtcConnection&, connection, int64, remoteUid, EUSER_OFFLINE_REASON_TYPE, reason); + + + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRejoinChannelSuccessEx, const FRtcConnection&, connection, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnAudioQualityEx, const FRtcConnection&, connection, int64, remoteUid, int, quality, int, delay, int, lost); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAudioVolumeIndicationEx, const FRtcConnection&, connection, const TArray&, speakers, int, totalVolume); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRtcStatsEx, const FRtcConnection&, connection, const FRtcStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnNetworkQualityEx, const FRtcConnection&, connection, int64, remoteUid, int, txQuality, int, rxQuality); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnIntraRequestReceivedEx, const FRtcConnection&, connection); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstLocalVideoFramePublishedEx, const FRtcConnection&, connection, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnVideoSourceFrameSizeChangedEx, const FRtcConnection&, connection, EVIDEO_SOURCE_TYPE, sourceType, int, width, int, height); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnFirstRemoteVideoDecodedEx, const FRtcConnection&, connection, int64, remoteUid, int, width, int, height, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FOnVideoSizeChangedEx, const FRtcConnection&, connection, EVIDEO_SOURCE_TYPE, sourceType, int64, uid, int, width, int, height, int, rotation); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRemoteVideoStateChangedEx, const FRtcConnection&, connection, int64, remoteUid, EREMOTE_VIDEO_STATE, state, EREMOTE_VIDEO_STATE_REASON, reason, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnFirstRemoteVideoFrameEx, const FRtcConnection&, connection, int64, remoteUid, int, width, int, height, int, elapsed); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserMuteAudioEx, const FRtcConnection&, connection, int64, remoteUid, bool, muted); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserMuteVideoEx, const FRtcConnection&, connection, int64, remoteUid, bool, muted); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserEnableVideoEx, const FRtcConnection&, connection, int64, remoteUid, bool, enabled); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserEnableLocalVideoEx, const FRtcConnection&, connection, int64, remoteUid, bool, enabled); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserStateChangedEx, const FRtcConnection&, connection, int64, remoteUid, int, state); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalAudioStatsEx, const FRtcConnection&, connection, const FLocalAudioStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRemoteAudioStatsEx, const FRtcConnection&, connection, const FRemoteAudioStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalVideoStatsEx, const FRtcConnection&, connection, const FLocalVideoStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRemoteVideoStatsEx, const FRtcConnection&, connection, const FRemoteVideoStats&, stats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnConnectionLostEx, const FRtcConnection&, connection); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnConnectionInterruptedEx, const FRtcConnection&, connection); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnConnectionBannedEx, const FRtcConnection&, connection); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FOnStreamMessageEx, const FRtcConnection&, connection, int64, remoteUid, int, streamId, const FString &, data, int64, length, int64, sentTs); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FOnStreamMessageErrorEx, const FRtcConnection&, connection, int64, remoteUid, int, streamId, int, code, int, missed, int, cached); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRequestTokenEx, const FRtcConnection&, connection); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLicenseValidationFailureEx, const FRtcConnection&, connection, ELICENSE_ERROR_TYPE, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnTokenPrivilegeWillExpireEx, const FRtcConnection&, connection, const FString &, token); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstLocalAudioFramePublishedEx, const FRtcConnection&, connection, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnFirstRemoteAudioFrameEx, const FRtcConnection&, connection, int64, userId, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnFirstRemoteAudioDecodedEx, const FRtcConnection&, connection, int64, uid, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnLocalAudioStateChangedEx, const FRtcConnection&, connection, ELOCAL_AUDIO_STREAM_STATE, state, ELOCAL_AUDIO_STREAM_REASON, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRemoteAudioStateChangedEx, const FRtcConnection&, connection, int64, remoteUid, EREMOTE_AUDIO_STATE, state, EREMOTE_AUDIO_STATE_REASON, reason, int, elapsed); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnActiveSpeakerEx, const FRtcConnection&, connection, int64, uid); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnClientRoleChangedEx, const FRtcConnection&, connection, ECLIENT_ROLE_TYPE, oldRole, ECLIENT_ROLE_TYPE, newRole, const FClientRoleOptions&, newRoleOptions); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnClientRoleChangeFailedEx, const FRtcConnection&, connection, ECLIENT_ROLE_CHANGE_FAILED_REASON, reason, ECLIENT_ROLE_TYPE, currentRole); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRemoteAudioTransportStatsEx, const FRtcConnection&, connection, int64, remoteUid, int, delay, int, lost, int, rxKBitRate); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRemoteVideoTransportStatsEx, const FRtcConnection&, connection, int64, remoteUid, int, delay, int, lost, int, rxKBitRate); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnConnectionStateChangedEx, const FRtcConnection&, connection, ECONNECTION_STATE_TYPE, state, ECONNECTION_CHANGED_REASON_TYPE, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnWlAccMessageEx, const FRtcConnection&, connection, EWLACC_MESSAGE_REASON, reason, EWLACC_SUGGEST_ACTION, action, const FString &, wlAccMsg); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnWlAccStatsEx, const FRtcConnection&, connection, const FWlAccStats &, currentStats, const FWlAccStats &, averageStats); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnNetworkTypeChangedEx, const FRtcConnection&, connection, FENUMWRAP_NETWORK_TYPE, type); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnEncryptionErrorEx, const FRtcConnection&, connection, EENCRYPTION_ERROR_TYPE, errorType); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnUploadLogResultEx, const FRtcConnection&, connection, const FString &, requestId, bool, success, EUPLOAD_ERROR_REASON, reason); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserAccountUpdatedEx, const FRtcConnection&, connection, int64, remoteUid, const FString &, remoteUserAccount); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FOnSnapshotTakenEx, const FRtcConnection&, connection, int64, uid, const FString &, filePath, int, width, int, height, int, errCode); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnVideoRenderingTracingResultEx, const FRtcConnection&, connection, int64, uid, EMEDIA_TRACE_EVENT, currentEvent, const FVideoRenderingTracingInfo &, tracingInfo); + +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSetRtmFlagResultEx, const FRtcConnection&, connection, int, code); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnTranscodedStreamLayoutInfoEx, const FRtcConnection&, connection, int64, uid, int, width, int, height, const TArray&, layoutlist); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAudioMetadataReceivedEx, const FRtcConnection&, connection, int64, uid, const FString &, metadata); + + + + + +class IRtcEngineEventHandlerExClassWrapper : public agora::rtc::IRtcEngineEventHandlerEx {}; + + +using namespace agora; +using namespace agora::rtc; + +// this is a native event handler managed in cpp +UCLASS(BlueprintType) +class AGORAPLUGIN_API UAgoraBPuIRtcEngineEventHandlerEx : public UObject, public IRtcEngineEventHandlerExClassWrapper +{ + GENERATED_BODY() + +public: + using IRtcEngineEventHandlerEx::eventHandlerType; + //using IRtcEngineEventHandlerEx::onJoinChannelSuccess; + //using IRtcEngineEventHandlerEx::onRejoinChannelSuccess; + //using IRtcEngineEventHandlerEx::onAudioQuality; + //using IRtcEngineEventHandlerEx::onAudioVolumeIndication; + //using IRtcEngineEventHandlerEx::onLeaveChannel; + //using IRtcEngineEventHandlerEx::onRtcStats; + //using IRtcEngineEventHandlerEx::onNetworkQuality; + //using IRtcEngineEventHandlerEx::onIntraRequestReceived; + //using IRtcEngineEventHandlerEx::onFirstLocalVideoFramePublished; + //using IRtcEngineEventHandlerEx::onFirstRemoteVideoDecoded; + //using IRtcEngineEventHandlerEx::onVideoSizeChanged; + //using IRtcEngineEventHandlerEx::onLocalVideoStateChanged; + //using IRtcEngineEventHandlerEx::onRemoteVideoStateChanged; + //using IRtcEngineEventHandlerEx::onFirstRemoteVideoFrame; + //using IRtcEngineEventHandlerEx::onUserJoined; + //using IRtcEngineEventHandlerEx::onUserOffline; + //using IRtcEngineEventHandlerEx::onUserMuteAudio; + //using IRtcEngineEventHandlerEx::onUserMuteVideo; + //using IRtcEngineEventHandlerEx::onUserEnableVideo; + //using IRtcEngineEventHandlerEx::onUserEnableLocalVideo; + //using IRtcEngineEventHandlerEx::onUserStateChanged; + //using IRtcEngineEventHandlerEx::onLocalAudioStats; + //using IRtcEngineEventHandlerEx::onRemoteAudioStats; + //using IRtcEngineEventHandlerEx::onLocalVideoStats; + //using IRtcEngineEventHandlerEx::onRemoteVideoStats; + //using IRtcEngineEventHandlerEx::onConnectionLost; + //using IRtcEngineEventHandlerEx::onConnectionInterrupted; + //using IRtcEngineEventHandlerEx::onConnectionBanned; + //using IRtcEngineEventHandlerEx::onStreamMessage; + //using IRtcEngineEventHandlerEx::onStreamMessageError; + //using IRtcEngineEventHandlerEx::onRequestToken; + //using IRtcEngineEventHandlerEx::onTokenPrivilegeWillExpire; + //using IRtcEngineEventHandlerEx::onLicenseValidationFailure; + //using IRtcEngineEventHandlerEx::onFirstLocalAudioFramePublished; + //using IRtcEngineEventHandlerEx::onFirstRemoteAudioFrame; + //using IRtcEngineEventHandlerEx::onFirstRemoteAudioDecoded; + //using IRtcEngineEventHandlerEx::onLocalAudioStateChanged; + //using IRtcEngineEventHandlerEx::onRemoteAudioStateChanged; + //using IRtcEngineEventHandlerEx::onActiveSpeaker; + //using IRtcEngineEventHandlerEx::onClientRoleChanged; + //using IRtcEngineEventHandlerEx::onClientRoleChangeFailed; + //using IRtcEngineEventHandlerEx::onRemoteAudioTransportStats; + //using IRtcEngineEventHandlerEx::onRemoteVideoTransportStats; + //using IRtcEngineEventHandlerEx::onConnectionStateChanged; + //using IRtcEngineEventHandlerEx::onWlAccMessage; + //using IRtcEngineEventHandlerEx::onWlAccStats; + //using IRtcEngineEventHandlerEx::onNetworkTypeChanged; + //using IRtcEngineEventHandlerEx::onEncryptionError; + //using IRtcEngineEventHandlerEx::onUploadLogResult; + //using IRtcEngineEventHandlerEx::onUserInfoUpdated; + //using IRtcEngineEventHandlerEx::onUserAccountUpdated; + //using IRtcEngineEventHandlerEx::onAudioSubscribeStateChanged; + //using IRtcEngineEventHandlerEx::onVideoSubscribeStateChanged; + //using IRtcEngineEventHandlerEx::onAudioPublishStateChanged; + //using IRtcEngineEventHandlerEx::onVideoPublishStateChanged; + //using IRtcEngineEventHandlerEx::onSnapshotTaken; + //using IRtcEngineEventHandlerEx::onVideoRenderingTracingResult; + //using IRtcEngineEventHandlerEx::onSetRtmFlagResult; + //using IRtcEngineEventHandlerEx::onTranscodedStreamLayoutInfo; + //using IRtcEngineEventHandlerEx::onAudioMetadataReceived; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnJoinChannelSuccessEx OnJoinChannelSuccessEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLeaveChannelEx OnLeaveChannelEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserJoinedEx OnUserJoinedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserOfflineEx OnUserOfflineEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRejoinChannelSuccessEx OnRejoinChannelSuccessEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioQualityEx OnAudioQualityEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioVolumeIndicationEx OnAudioVolumeIndicationEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRtcStatsEx OnRtcStatsEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnNetworkQualityEx OnNetworkQualityEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnIntraRequestReceivedEx OnIntraRequestReceivedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstLocalVideoFramePublishedEx OnFirstLocalVideoFramePublishedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstRemoteVideoDecodedEx OnFirstRemoteVideoDecodedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnVideoSizeChangedEx OnVideoSizeChangedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteVideoStateChangedEx OnRemoteVideoStateChangedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstRemoteVideoFrameEx OnFirstRemoteVideoFrameEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserMuteAudioEx OnUserMuteAudioEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserMuteVideoEx OnUserMuteVideoEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserEnableVideoEx OnUserEnableVideoEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserEnableLocalVideoEx OnUserEnableLocalVideoEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserStateChangedEx OnUserStateChangedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalAudioStatsEx OnLocalAudioStatsEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteAudioStatsEx OnRemoteAudioStatsEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalVideoStatsEx OnLocalVideoStatsEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteVideoStatsEx OnRemoteVideoStatsEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnConnectionLostEx OnConnectionLostEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnConnectionInterruptedEx OnConnectionInterruptedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnConnectionBannedEx OnConnectionBannedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnStreamMessageEx OnStreamMessageEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnStreamMessageErrorEx OnStreamMessageErrorEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRequestTokenEx OnRequestTokenEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLicenseValidationFailureEx OnLicenseValidationFailureEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnTokenPrivilegeWillExpireEx OnTokenPrivilegeWillExpireEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstLocalAudioFramePublishedEx OnFirstLocalAudioFramePublishedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstRemoteAudioFrameEx OnFirstRemoteAudioFrameEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnFirstRemoteAudioDecodedEx OnFirstRemoteAudioDecodedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnLocalAudioStateChangedEx OnLocalAudioStateChangedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteAudioStateChangedEx OnRemoteAudioStateChangedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnActiveSpeakerEx OnActiveSpeakerEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnClientRoleChangedEx OnClientRoleChangedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnClientRoleChangeFailedEx OnClientRoleChangeFailedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteAudioTransportStatsEx OnRemoteAudioTransportStatsEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnRemoteVideoTransportStatsEx OnRemoteVideoTransportStatsEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnConnectionStateChangedEx OnConnectionStateChangedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnWlAccMessageEx OnWlAccMessageEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnWlAccStatsEx OnWlAccStatsEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnNetworkTypeChangedEx OnNetworkTypeChangedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnEncryptionErrorEx OnEncryptionErrorEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUploadLogResultEx OnUploadLogResultEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnUserAccountUpdatedEx OnUserAccountUpdatedEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnSnapshotTakenEx OnSnapshotTakenEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnVideoRenderingTracingResultEx OnVideoRenderingTracingResultEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnSetRtmFlagResultEx OnSetRtmFlagResultEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnTranscodedStreamLayoutInfoEx OnTranscodedStreamLayoutInfoEx; + + UPROPERTY(BlueprintAssignable, Category = "Agora|Event") + FOnAudioMetadataReceivedEx OnAudioMetadataReceivedEx; + + + void onJoinChannelSuccess(const agora::rtc::RtcConnection& connection, int elapsed) override; + + + void onLeaveChannel(const agora::rtc::RtcConnection& connection, const agora::rtc::RtcStats& stats) override; + + + + void onUserJoined(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int elapsed) override; + + void onUserOffline(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) override; + + + virtual void onRejoinChannelSuccess(const RtcConnection& connection, int elapsed) override; + + virtual void onAudioQuality(const RtcConnection& connection, uid_t remoteUid, int quality, unsigned short delay, unsigned short lost) __deprecated override; + + virtual void onAudioVolumeIndication(const RtcConnection& connection, const AudioVolumeInfo* speakers, + unsigned int speakerNumber, int totalVolume) override; + + virtual void onRtcStats(const RtcConnection& connection, const RtcStats& stats) override; + + virtual void onNetworkQuality(const RtcConnection& connection, uid_t remoteUid, int txQuality, int rxQuality) override; + + virtual void onIntraRequestReceived(const RtcConnection& connection) override; + + virtual void onFirstLocalVideoFramePublished(const RtcConnection& connection, int elapsed) override; + + + virtual void onFirstRemoteVideoDecoded(const RtcConnection& connection, uid_t remoteUid, int width, int height, int elapsed) override; + + + virtual void onVideoSizeChanged(const RtcConnection& connection, VIDEO_SOURCE_TYPE sourceType, uid_t uid, int width, int height, int rotation) override; + + + virtual void onRemoteVideoStateChanged(const RtcConnection& connection, uid_t remoteUid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) override; + + + virtual void onFirstRemoteVideoFrame(const RtcConnection& connection, uid_t remoteUid, int width, int height, int elapsed) override; + + virtual void onUserMuteAudio(const RtcConnection& connection, uid_t remoteUid, bool muted) __deprecated override; + + + virtual void onUserMuteVideo(const RtcConnection& connection, uid_t remoteUid, bool muted) override; + + + virtual void onUserEnableVideo(const RtcConnection& connection, uid_t remoteUid, bool enabled) override; + + virtual void onUserEnableLocalVideo(const RtcConnection& connection, uid_t remoteUid, bool enabled) __deprecated override; + + + virtual void onUserStateChanged(const RtcConnection& connection, uid_t remoteUid, uint32_t state) override; + + + virtual void onLocalAudioStats(const RtcConnection& connection, const LocalAudioStats& stats) override; + + + virtual void onRemoteAudioStats(const RtcConnection& connection, const RemoteAudioStats& stats) override; + + + virtual void onLocalVideoStats(const RtcConnection& connection, const LocalVideoStats& stats) override; + + virtual void onRemoteVideoStats(const RtcConnection& connection, const RemoteVideoStats& stats) override; + + virtual void onConnectionLost(const RtcConnection& connection) override; + + virtual void onConnectionInterrupted(const RtcConnection& connection) __deprecated override; + + virtual void onConnectionBanned(const RtcConnection& connection) override; + + virtual void onStreamMessage(const RtcConnection& connection, uid_t remoteUid, int streamId, const char* data, size_t length, uint64_t sentTs) override; + + + virtual void onStreamMessageError(const RtcConnection& connection, uid_t remoteUid, int streamId, int code, int missed, int cached) override; + + + virtual void onRequestToken(const RtcConnection& connection) override; + + virtual void onLicenseValidationFailure(const RtcConnection& connection, LICENSE_ERROR_TYPE reason) override; + + + virtual void onTokenPrivilegeWillExpire(const RtcConnection& connection, const char* token) override; + + + virtual void onFirstLocalAudioFramePublished(const RtcConnection& connection, int elapsed) override; + + + virtual void onFirstRemoteAudioFrame(const RtcConnection& connection, uid_t userId, int elapsed) __deprecated override; + + + virtual void onFirstRemoteAudioDecoded(const RtcConnection& connection, uid_t uid, int elapsed) __deprecated override; + + + virtual void onLocalAudioStateChanged(const RtcConnection& connection, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_REASON reason) override; + + + virtual void onRemoteAudioStateChanged(const RtcConnection& connection, uid_t remoteUid, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed) override; + + + virtual void onActiveSpeaker(const RtcConnection& connection, uid_t uid) override; + + virtual void onClientRoleChanged(const RtcConnection& connection, CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole, const ClientRoleOptions& newRoleOptions) override; + + virtual void onClientRoleChangeFailed(const RtcConnection& connection, CLIENT_ROLE_CHANGE_FAILED_REASON reason, CLIENT_ROLE_TYPE currentRole) override; + + virtual void onRemoteAudioTransportStats(const RtcConnection& connection, uid_t remoteUid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) __deprecated override; + + + virtual void onRemoteVideoTransportStats(const RtcConnection& connection, uid_t remoteUid, unsigned short delay, unsigned short lost, + unsigned short rxKBitRate) __deprecated override; + + + virtual void onConnectionStateChanged(const RtcConnection& connection, + CONNECTION_STATE_TYPE state, + CONNECTION_CHANGED_REASON_TYPE reason) override; + + + virtual void onWlAccMessage(const RtcConnection& connection, WLACC_MESSAGE_REASON reason, WLACC_SUGGEST_ACTION action, const char* wlAccMsg) override; + + + virtual void onWlAccStats(const RtcConnection& connection, WlAccStats currentStats, WlAccStats averageStats) override; + + virtual void onNetworkTypeChanged(const RtcConnection& connection, NETWORK_TYPE type) override; + + + virtual void onEncryptionError(const RtcConnection& connection, ENCRYPTION_ERROR_TYPE errorType) override; + + virtual void onUploadLogResult(const RtcConnection& connection, const char* requestId, bool success, UPLOAD_ERROR_REASON reason)override; + + virtual void onUserAccountUpdated(const RtcConnection& connection, uid_t remoteUid, const char* remoteUserAccount) override; + + + virtual void onSnapshotTaken(const RtcConnection& connection, uid_t uid, const char* filePath, int width, int height, int errCode) override; + + virtual void onVideoRenderingTracingResult(const RtcConnection& connection, uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) override; + + + virtual void onSetRtmFlagResult(const RtcConnection& connection, int code) override; + + virtual void onTranscodedStreamLayoutInfo(const RtcConnection& connection, uid_t uid, int width, int height, int layoutCount, const VideoLayout* layoutlist) override; + + virtual void onAudioMetadataReceived(const RtcConnection& connection, uid_t uid, const char* metadata, size_t length) override; + + // You could add multiple executors to the target handler + UFUNCTION(BlueprintCallable, Category = "Agora|Event") + void AddBlueprintCallbackExecutorEx(UAgoraBPuIRtcEngineEventHandlerExCBExecutor* Executor); + + UFUNCTION(BlueprintCallable, Category = "Agora|Event") + void RemoveAllBlueprintCallbackExecutorExs(); + +private: + EAgoraBPuEventHandlerType Type = EAgoraBPuEventHandlerType::EventHandlerEx; +}; + +// this is a blueprint callback executor which you could add to the target handler +UCLASS(Blueprintable, Meta = (ShowWorldContextPin)) +class AGORAPLUGIN_API UAgoraBPuIRtcEngineEventHandlerExCBExecutor: public UObject{ + GENERATED_BODY() + +public: + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnJoinChannelSuccess(const FRtcConnection& Connection, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnLeaveChannel(const FRtcConnection& connection, const FRtcStats& stats); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUserJoined(const FRtcConnection& connection, int64 RemoteUid, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUserOffline(const FRtcConnection& connection, int64 RemoteUid, EUSER_OFFLINE_REASON_TYPE Reason); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRejoinChannelSuccess(const FRtcConnection& connection, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnAudioQuality(const FRtcConnection& connection, int64 RemoteUid, int Quality, int Delay, int Lost); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnAudioVolumeIndication(const FRtcConnection& connection, const TArray& Speakers, int TotalVolume); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRtcStats(const FRtcConnection& connection, const FRtcStats& Stats); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnNetworkQuality(const FRtcConnection& connection, int64 RemoteUid, int TxQuality, int RxQuality); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnIntraRequestReceived(const FRtcConnection& connection); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnFirstLocalVideoFramePublished(const FRtcConnection& connection, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnFirstRemoteVideoDecoded(const FRtcConnection& connection, int64 RemoteUid, int Width, int Height, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnVideoSizeChanged(const FRtcConnection& connection, EVIDEO_SOURCE_TYPE SourceType, int64 Uid, int Width, int Height, int Rotation); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRemoteVideoStateChanged(const FRtcConnection& connection, int64 RemoteUid, EREMOTE_VIDEO_STATE State, EREMOTE_VIDEO_STATE_REASON Reason, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnFirstRemoteVideoFrame(const FRtcConnection& connection, int64 RemoteUid, int Width, int Height, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUserMuteAudio(const FRtcConnection& connection, int64 RemoteUid, bool Muted); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUserMuteVideo(const FRtcConnection& connection, int64 RemoteUid, bool Muted); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUserEnableVideo(const FRtcConnection& connection, int64 RemoteUid, bool Enabled); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUserEnableLocalVideo(const FRtcConnection& connection, int64 RemoteUid, bool Enabled); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUserStateChanged(const FRtcConnection& connection, int64 RemoteUid, int State); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnLocalAudioStats(const FRtcConnection& connection, const FLocalAudioStats& Stats); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRemoteAudioStats(const FRtcConnection& connection, const FRemoteAudioStats& Stats); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnLocalVideoStats(const FRtcConnection& connection, const FLocalVideoStats& Stats); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRemoteVideoStats(const FRtcConnection& connection, const FRemoteVideoStats& Stats); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnConnectionLost(const FRtcConnection& connection); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnConnectionInterrupted(const FRtcConnection& connection); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnConnectionBanned(const FRtcConnection& connection); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnStreamMessage(const FRtcConnection& connection, int64 RemoteUid, int StreamId, const FString& Data, int64 Length, int64 SentTs); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnStreamMessageError(const FRtcConnection& connection, int64 RemoteUid, int StreamId, int Code, int Missed, int Cached); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRequestToken(const FRtcConnection& connection); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnLicenseValidationFailure(const FRtcConnection& connection, ELICENSE_ERROR_TYPE Reason); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnTokenPrivilegeWillExpire(const FRtcConnection& connection, const FString& Token); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnFirstLocalAudioFramePublished(const FRtcConnection& connection, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnFirstRemoteAudioFrame(const FRtcConnection& connection, int64 UserId, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnFirstRemoteAudioDecoded(const FRtcConnection& connection, int64 Uid, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnLocalAudioStateChanged(const FRtcConnection& connection, ELOCAL_AUDIO_STREAM_STATE State, ELOCAL_AUDIO_STREAM_REASON Reason); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRemoteAudioStateChanged(const FRtcConnection& connection, int64 RemoteUid, EREMOTE_AUDIO_STATE State, EREMOTE_AUDIO_STATE_REASON Reason, int Elapsed); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnActiveSpeaker(const FRtcConnection& connection, int64 Uid); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnClientRoleChanged(const FRtcConnection& connection, ECLIENT_ROLE_TYPE OldRole, ECLIENT_ROLE_TYPE NewRole, const FClientRoleOptions& NewRoleOptions); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnClientRoleChangeFailed(const FRtcConnection& connection, ECLIENT_ROLE_CHANGE_FAILED_REASON Reason, ECLIENT_ROLE_TYPE CurrentRole); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRemoteAudioTransportStats(const FRtcConnection& connection, int64 RemoteUid, int Delay, int Lost, int RxKBitRate); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnRemoteVideoTransportStats(const FRtcConnection& connection, int64 RemoteUid, int Delay, int Lost, int RxKBitRate); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnConnectionStateChanged(const FRtcConnection& connection, ECONNECTION_STATE_TYPE State, ECONNECTION_CHANGED_REASON_TYPE Reason); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnWlAccMessage(const FRtcConnection& connection, EWLACC_MESSAGE_REASON Reason, EWLACC_SUGGEST_ACTION Action, const FString& WlAccMsg); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnWlAccStats(const FRtcConnection& connection, const FWlAccStats& CurrentStats, const FWlAccStats& AverageStats); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnNetworkTypeChanged(const FRtcConnection& connection, FENUMWRAP_NETWORK_TYPE Type); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnEncryptionError(const FRtcConnection& connection, EENCRYPTION_ERROR_TYPE ErrorType); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUploadLogResult(const FRtcConnection& connection, const FString& RequestId, bool Success, EUPLOAD_ERROR_REASON Reason); + + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnUserAccountUpdated(const FRtcConnection& connection, int64 RemoteUid, const FString& RemoteUserAccount); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnSnapshotTaken(const FRtcConnection& connection, int64 Uid, const FString& FilePath, int Width, int Height, int ErrCode); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnVideoRenderingTracingResult(const FRtcConnection& connection, int64 Uid, EMEDIA_TRACE_EVENT CurrentEvent, const FVideoRenderingTracingInfo& TracingInfo); + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnSetRtmFlagResult(const FRtcConnection& connection, int Code); + + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnTranscodedStreamLayoutInfo(const FRtcConnection& connection, int64 Uid, int Width, int Height, const TArray& Layoutlist); + + + UFUNCTION(BlueprintNativeEvent,Category= "Agora|Event") + void OnAudioMetadataReceived(const FRtcConnection& connection, int64 Uid, const FString& Metadata); + + +}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraMediaPlayer.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuMediaPlayer.h similarity index 50% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraMediaPlayer.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuMediaPlayer.h index 6c7261fc..7a591007 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraMediaPlayer.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuMediaPlayer.h @@ -1,248 +1,327 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "URtcEngineProxyCompatibility.h" -#include "AgoraIMediaPlayerSourceObserver.h" -#include "IFrameObserver.h" -#include "AgoraMediaPlayer.generated.h" - -USTRUCT(BlueprintType) -struct FAgoraMediaSource -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") - FString url = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") - FString uri = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") - int startPos = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") - bool autoPlay = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") - bool enableCache = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") - AGORAOPTIONAL isAgoraSource = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") - AGORAOPTIONAL isLiveSource = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") - UIMediaPlayerCustomDataProvider* provider = nullptr; - -}; - - -UENUM(BlueprintType) -enum class EAUDIO_DUAL_MONO_MODE : uint8 { - AUDIO_DUAL_MONO_STEREO = 0, - AUDIO_DUAL_MONO_L = 1, - AUDIO_DUAL_MONO_R = 2, - AUDIO_DUAL_MONO_MIX = 3 -}; - -UENUM(BlueprintType) -enum class EMEDIA_STREAM_TYPE : uint8 { - - STREAM_TYPE_UNKNOWN = 0, - - STREAM_TYPE_VIDEO = 1, - - STREAM_TYPE_AUDIO = 2, - - STREAM_TYPE_SUBTITLE = 3, -}; - -USTRUCT(BlueprintType) -struct FPlayerStreamInfo -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int streamIndex = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - EMEDIA_STREAM_TYPE streamType = EMEDIA_STREAM_TYPE::STREAM_TYPE_AUDIO; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - FString codecName = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - FString language = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int videoFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int videoBitRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int videoWidth = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int videoHeight = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int videoRotation = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int audioSampleRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int audioChannels = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int audioBitsPerSample = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") - int duration = 0; -}; - - - -/** - * - */ -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIMediaPlayer : public UObject -{ - GENERATED_BODY() - -public: - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetMediaPlayerId(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int Open(FString url, int64 startPos); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int OpenWithCustomSource(int64 startPos, UIMediaPlayerCustomDataProvider* provider); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int OpenWithMediaSource(const FAgoraMediaSource& source); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int Play(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int Pause(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int Stop(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int Resume(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int Seek(int64 newPos); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetAudioPitch(int pitch); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetDuration(int64& duration); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetPlayPosition(int64& pos); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetStreamCount(int64& count); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetStreamInfo(int64 index, FPlayerStreamInfo& info); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetLoopCount(int loopCount); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetPlaybackSpeed(int speed); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SelectAudioTrack(int index); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetPlayerOptionInInt(FString key, int value); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetPlayerOptionInString(FString key, FString value); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int TakeScreenshot(FString filename); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SelectInternalSubtitle(int index); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetExternalSubtitle(FString url); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - EMEDIA_PLAYER_STATE GetState(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int Mute(bool muted); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetMute(bool muted); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int AdjustPlayoutVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetPlayoutVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int AdjustPublishSignalVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetPublishSignalVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetView(int64 view); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetRenderMode(ERENDER_MODE_TYPE renderMode); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int RegisterPlayerSourceObserver(UIMediaPlayerSourceObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int UnregisterPlayerSourceObserver(UIMediaPlayerSourceObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int RegisterAudioFrameObserver(UIAudioPcmFrameSink* observer, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode = ERAW_AUDIO_FRAME_OP_MODE_TYPE::RAW_AUDIO_FRAME_OP_MODE_READ_ONLY); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int UnregisterAudioFrameObserver(UIAudioPcmFrameSink* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int RegisterVideoFrameObserver(UIVideoFrameObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int UnregisterVideoFrameObserver(UIVideoFrameObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int RegisterMediaPlayerAudioSpectrumObserver(UIAudioSpectrumObserver* observer, int intervalInMS); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int UnregisterMediaPlayerAudioSpectrumObserver(UIAudioSpectrumObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetAudioDualMonoMode(EAUDIO_DUAL_MONO_MODE mode); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - FString GetPlayerSdkVersion(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - FString GetPlaySrc(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int OpenWithAgoraCDNSrc(FString src, int64 startPos); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetAgoraCDNLineCount(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SwitchAgoraCDNLineByIndex(int index); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int GetCurrentAgoraCDNIndex(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int EnableAutoSwitchAgoraCDN(bool enable); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int RenewAgoraCDNSrcToken(FString token, int64 ts); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SwitchAgoraCDNSrc(FString src, bool syncPts); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SwitchSrc(FString src, bool syncPts); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int PreloadSrc(FString src, int64 startPos); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int PlayPreloadedSrc(FString src); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int UnloadSrc(FString src); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetSpatialAudioParams(const FSpatialAudioParams& params); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") - int SetSoundPositionParams(float pan, float gain); - void SetMediaPlayer(agora::agora_refptr mediaPlayer); - agora::agora_refptr GetMediaPlayer(); -private: - agora::agora_refptr MediaPlayer; -}; - - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIMediaPlayerCacheManager : public UObject -{ - GENERATED_BODY() - -public: - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int RemoveAllCaches(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int RemoveOldCache(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int RemoveCacheByUri(FString uri); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int SetCacheDir(FString path); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int SetMaxCacheFileCount(int count); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int SetMaxCacheFileSize(int64 cacheSize); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int EnableAutoRemoveCache(bool enable); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int GetCacheDir(FString path, int length); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int GetMaxCacheFileCount(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int64 GetMaxCacheFileSize(); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayerCacheManager") - int GetCacheFileCount(); -}; - +// Copyright (c) 2024 Agora.io. All rights reserved. + +#pragma once + +#include "CoreMinimal.h" + +#include "AgoraPluginInterface.h" +#include "IAgoraMediaPlayer.h" // because UE has a IMediaPlayer class +#include "AgoraBPuBaseDataTypes.h" +#include "AgoraBPuIMediaPlayerSourceObserver.h" +#include "UObject/StrongObjectPtr.h" + +#include "AgoraBPuMediaPlayer.generated.h" + + +#pragma region Data Types + +USTRUCT(BlueprintType) +struct FAgoraMediaSource +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + FString url = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + FString uri = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + int64 startPos = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + bool autoPlay = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + bool enableCache = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + bool enableMultiAudioTrack = false; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + EAgoraOptional isAgoraSource = EAgoraOptional::AGORA_NULL_VALUE; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + EAgoraOptional isLiveSource = EAgoraOptional::AGORA_NULL_VALUE; + //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaSource") + //UIMediaPlayerCustomDataProvider* provider = nullptr; + + FAgoraMediaSource(){} + FAgoraMediaSource(const agora::media::base::MediaSource & AgoraData){ + url = UTF8_TO_TCHAR(AgoraData.url); + uri = UTF8_TO_TCHAR(AgoraData.uri); + startPos = AgoraData.startPos; + autoPlay = AgoraData.autoPlay; + enableCache = AgoraData.enableCache; + enableMultiAudioTrack = AgoraData.enableMultiAudioTrack; + SET_UEBP_OPTIONAL_VAL_BOOL(this->isAgoraSource,AgoraData.isAgoraSource) + SET_UEBP_OPTIONAL_VAL_BOOL(this->isLiveSource, AgoraData.isLiveSource) + // provider = AgoraData.provider; not supported + } + + agora::media::base::MediaSource CreateAgoraData() const { + agora::media::base::MediaSource AgoraData; + + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.url, url) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.uri, uri) + AgoraData.startPos = startPos; + AgoraData.autoPlay = autoPlay; + AgoraData.enableCache = enableCache; + AgoraData.enableMultiAudioTrack = enableMultiAudioTrack; + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.isAgoraSource,isAgoraSource) + SET_AGORA_OPTIONAL_VAL_BOOL(AgoraData.isLiveSource, isLiveSource) + // not supported + return AgoraData; + } + + void FreeAgoraData(agora::media::base::MediaSource& AgoraData) const{ + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.url) + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.uri) + } + +}; + + +UENUM(BlueprintType) +enum class EAUDIO_DUAL_MONO_MODE : uint8 { + AUDIO_DUAL_MONO_STEREO = 0, + AUDIO_DUAL_MONO_L = 1, + AUDIO_DUAL_MONO_R = 2, + AUDIO_DUAL_MONO_MIX = 3 +}; + +UENUM(BlueprintType) +enum class EMEDIA_STREAM_TYPE : uint8 { + + STREAM_TYPE_UNKNOWN = 0, + + STREAM_TYPE_VIDEO = 1, + + STREAM_TYPE_AUDIO = 2, + + STREAM_TYPE_SUBTITLE = 3, +}; + +USTRUCT(BlueprintType) +struct FPlayerStreamInfo +{ + GENERATED_BODY() + +public: + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int streamIndex = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + EMEDIA_STREAM_TYPE streamType = EMEDIA_STREAM_TYPE::STREAM_TYPE_UNKNOWN; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + FString codecName = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + FString language = ""; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int videoFrameRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int videoBitRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int videoWidth = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int videoHeight = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int videoRotation = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int audioSampleRate = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int audioChannels = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int audioBitsPerSample = 0; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerStreamInfo") + int duration = 0; + + FPlayerStreamInfo(){} + FPlayerStreamInfo(const agora::media::base::PlayerStreamInfo & AgoraData){ + streamIndex = AgoraData.streamIndex; + streamType = (EMEDIA_STREAM_TYPE)AgoraData.streamType; + codecName = UTF8_TO_TCHAR(AgoraData.codecName); + language = UTF8_TO_TCHAR(AgoraData.language); + videoFrameRate = AgoraData.videoFrameRate; + videoBitRate = AgoraData.videoBitRate; + videoWidth = AgoraData.videoWidth; + videoHeight = AgoraData.videoHeight; + videoRotation = AgoraData.videoRotation; + audioSampleRate = AgoraData.audioSampleRate; + audioChannels = AgoraData.audioChannels; + audioBitsPerSample = AgoraData.audioBitsPerSample; + duration = AgoraData.duration; + } + + agora::media::base::PlayerStreamInfo CreateAgoraData() const { + agora::media::base::PlayerStreamInfo AgoraData; + AgoraData.streamIndex = streamIndex; + AgoraData.streamType = (agora::media::base::MEDIA_STREAM_TYPE)streamType; + SET_UABT_FSTRING_TO_CHAR_ARRAY(AgoraData.codecName, codecName,agora::media::base::kMaxCharBufferLength) + SET_UABT_FSTRING_TO_CHAR_ARRAY(AgoraData.language, language, agora::media::base::kMaxCharBufferLength) + AgoraData.videoFrameRate = videoFrameRate; + AgoraData.videoBitRate = videoBitRate; + AgoraData.videoWidth = videoWidth; + AgoraData.videoHeight = videoHeight; + AgoraData.videoRotation = videoRotation; + AgoraData.audioSampleRate = audioSampleRate; + AgoraData.audioChannels = audioChannels; + AgoraData.audioBitsPerSample = audioBitsPerSample; + AgoraData.duration = duration; + return AgoraData; + } + + void FreeAgoraData(agora::media::base::PlayerStreamInfo & AgoraData) const { + + } +}; + + +#pragma endregion Data Types + + +/** + * + */ +UCLASS() +class AGORAPLUGIN_API UAgoraBPuMediaPlayer : public UObject +{ + GENERATED_BODY() + +public: + + UFUNCTION(BlueprintPure, Category = "Agora|IAgoraMediaPlayer") + static UAgoraBPuMediaPlayer* GetAgoraMediaPlayer(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IAgoraMediaPlayer") + void Release(); + + UFUNCTION(BlueprintPure, Category = "Agora|IRtcEngine") + UAgoraBPuIMediaPlayerSourceObserver* GetMediaPlayerSourceObserver(); + + + +#pragma region API + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetMediaPlayerId(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int Open(const FString & url, int64 startPos); + + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int OpenWithCustomSource(int64 startPos, UIMediaPlayerCustomDataProvider* provider); + + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int OpenWithMediaSource(const FAgoraMediaSource& source); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int Play(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int Pause(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int Stop(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int Resume(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int Seek(int64 newPos); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetAudioPitch(int pitch); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetDuration(int64& duration); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetPlayPosition(int64& pos); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetStreamCount(int64& count); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetStreamInfo(int64 index, FPlayerStreamInfo& info); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetLoopCount(int loopCount); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetPlaybackSpeed(int speed); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SelectAudioTrack(int index); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SelectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex); + + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetPlayerOptionWithInt(const FString & key, int value); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetPlayerOptionWithString(const FString & key, const FString & value); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int TakeScreenshot(const FString& filename); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SelectInternalSubtitle(int index); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetExternalSubtitle(const FString& url); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + EMEDIA_PLAYER_STATE GetState(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int Mute(bool muted); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetMute(bool & muted); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int AdjustPlayoutVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetPlayoutVolume(int & volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int AdjustPublishSignalVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetPublishSignalVolume(int & volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetView(int64 view); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetRenderMode(ERENDER_MODE_TYPE renderMode); + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int RegisterPlayerSourceObserver(UIMediaPlayerSourceObserver* observer); + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int UnregisterPlayerSourceObserver(UIMediaPlayerSourceObserver* observer); + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int RegisterAudioFrameObserver(UIAudioPcmFrameSink* observer, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode = ERAW_AUDIO_FRAME_OP_MODE_TYPE::RAW_AUDIO_FRAME_OP_MODE_READ_ONLY); + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int UnregisterAudioFrameObserver(UIAudioPcmFrameSink* observer); + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int RegisterVideoFrameObserver(UIVideoFrameObserver* observer); + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int UnregisterVideoFrameObserver(UIVideoFrameObserver* observer); + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int RegisterMediaPlayerAudioSpectrumObserver(UIAudioSpectrumObserver* observer, int intervalInMS); + //UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + //int UnregisterMediaPlayerAudioSpectrumObserver(UIAudioSpectrumObserver* observer); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetAudioDualMonoMode(EAUDIO_DUAL_MONO_MODE mode); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + FString GetPlayerSdkVersion(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + FString GetPlaySrc(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int OpenWithAgoraCDNSrc(const FString& src, int64 startPos); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetAgoraCDNLineCount(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SwitchAgoraCDNLineByIndex(int index); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int GetCurrentAgoraCDNIndex(); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int EnableAutoSwitchAgoraCDN(bool enable); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int RenewAgoraCDNSrcToken(const FString & token, int64 ts); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SwitchAgoraCDNSrc(const FString& src, bool syncPts = false); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SwitchSrc(const FString& src, bool syncPts = true); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int PreloadSrc(const FString& src, int64 startPos); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int PlayPreloadedSrc(const FString& src); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int UnloadSrc(const FString& src); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetSpatialAudioParams(const FSpatialAudioParams& params); + UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer") + int SetSoundPositionParams(float pan, float gain); + +#pragma endregion API + + + +private: + + static UAgoraBPuMediaPlayer* Instance; + + agora::agora_refptr MediaPlayer; + + TStrongObjectPtr UserMediaPlayerSourceObserver = nullptr; +}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuRtcEngine.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuRtcEngine.h new file mode 100644 index 00000000..bbd9e4bb --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraBPuRtcEngine.h @@ -0,0 +1,801 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. + +#pragma once + +#include "CoreMinimal.h" + +#include "AgoraPluginInterface.h" +#include "AgoraBPuBaseDataTypes.h" +#include "UObject/StrongObjectPtr.h" + + +#include "Sound/SoundCue.h" +#include "Sound/SoundWave.h" +#include "FileMediaSource.h" +#include "MediaPlayer.h" +#include "Kismet/GameplayStatics.h" + + +#include "AgoraBPuIRtcEngineEventHandler.h" +#include "AgoraBPuIRtcEngineEventHandlerEx.h" + + +#include "AgoraBPuRtcEngine.generated.h" + +#pragma region Screen Share + + +UCLASS(BlueprintType) +class AGORAPLUGIN_API UIScreenCaptureSourceList : public UObject +{ + GENERATED_BODY() +public: + + UFUNCTION(BlueprintCallable, Category = "Agora|ScreenCaptureSourceList") + int GetCount(); + UFUNCTION(BlueprintCallable, Category = "Agora|ScreenCaptureSourceList") + FScreenCaptureSourceInfo GetSourceInfo(int index); + UFUNCTION(BlueprintCallable, Category = "Agora|ScreenCaptureSourceList") + void Release(); + +#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) +public: + void SetScreenCaptureList(agora::rtc::IScreenCaptureSourceList* sourcelist); +private: + agora::rtc::IScreenCaptureSourceList* sourceListNative; +#endif +}; + + +#pragma endregion Screen Share + + +/** + * + */ +UCLASS() +class AGORAPLUGIN_API UAgoraBPuRtcEngine : public UObject +{ + GENERATED_BODY() + +public: + void InitInstance(); + + void UninitInstance(); + + UFUNCTION(BlueprintPure, Category = "Agora|IRtcEngine") + static UAgoraBPuRtcEngine* GetAgoraRtcEngine(); + + UFUNCTION(BlueprintPure, Category = "Agora|IRtcEngine") + void GetEventHandler(EAgoraBPuEventHandlerType& HandlerType, UAgoraBPuIRtcEngineEventHandler*& EventHandler, UAgoraBPuIRtcEngineEventHandlerEx* & EventHandlerEx); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int Initialize(const FRtcEngineContext& context); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + FString GetVersion(); + + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + void Release(bool sync = false); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + void ClearAllEventHandlerCBExecutors(); + + + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int JoinChannel(const FString & token, const FString& channelId, int64 uid); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int JoinChannelWithOptions(const FString& token, const FString& channelId, int64 uid, const FChannelMediaOptions& options); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int LeaveChannel(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int LeaveChannelWithOptions(const FLeaveChannelOptions& options); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableVideo(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int DisableVideo(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableAudio(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int DisableAudio(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetClientRole(FClientRoleOptions options, ECLIENT_ROLE_TYPE clientroletype = ECLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER); + + + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetupLocalVideo(const FVideoCanvas& canvas); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetupRemoteVideo(const FVideoCanvas& canvas); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetupRemoteVideoEx(const FVideoCanvas& canvas, const FRtcConnection& connection); + + +#pragma region Other APIs + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + FString GetErrorDescription(int code); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int QueryCodecCapability(TArray & codecInfo, int QuerySize = 10); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int QueryDeviceScore(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PreloadChannel(const FString & token, const FString & channelId, int64 uid); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PreloadChannelWithUserAccount(const FString& token, const FString& channelId, const FString& userAccount); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdatePreloadChannelToken(const FString& token); + + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdateChannelMediaOptions(const FChannelMediaOptions& options); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int RenewToken(const FString & token); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetChannelProfile(ECHANNEL_PROFILE_TYPE profile); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartEchoTest(const FEchoTestConfiguration& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopEchoTest(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableMultiCamera(bool enabled, const FCameraCapturerConfiguration& config); + + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartPreview(EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopPreview(EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartLastmileProbeTest(const FLastmileProbeConfig& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopLastmileProbeTest(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVideoEncoderConfiguration(const FVideoEncoderConfiguration& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetBeautyEffectOptions(bool enabled, const FBeautyOptions& options, EMEDIA_SOURCE_TYPE type); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLowlightEnhanceOptions(bool enabled, const FLowlightEnhanceOptions& options, EMEDIA_SOURCE_TYPE type); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVideoDenoiserOptions(bool enabled, const FVideoDenoiserOptions& options, EMEDIA_SOURCE_TYPE type); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetColorEnhanceOptions(bool enabled, const FColorEnhanceOptions& options, EMEDIA_SOURCE_TYPE type); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableVirtualBackground(bool enabled, FVirtualBackgroundSource backgroundSource, FSegmentationProperty segproperty, EMEDIA_SOURCE_TYPE type); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVideoScenario(EVIDEO_APPLICATION_SCENARIO_TYPE scenarioType); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVideoQoEPreference(EVIDEO_QOE_PREFERENCE_TYPE qoePreference); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioProfileAndScenario(EAUDIO_PROFILE_TYPE profile = EAUDIO_PROFILE_TYPE::AUDIO_PROFILE_DEFAULT, EAUDIO_SCENARIO_TYPE scenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioProfile(EAUDIO_PROFILE_TYPE profile = EAUDIO_PROFILE_TYPE::AUDIO_PROFILE_DEFAULT); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioScenario(EAUDIO_SCENARIO_TYPE scenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableLocalAudio(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteLocalAudioStream(bool mute); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteAllRemoteAudioStreams(bool mute); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteDefaultVideoStreamType(EVIDEO_STREAM_TYPE streamType); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteRemoteAudioStream(int64 uid, bool mute); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteLocalVideoStream(bool mute); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableLocalVideo(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteAllRemoteVideoStreams(bool mute); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteRemoteVideoStream(int64 uid, bool mute); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteVideoStreamType(int64 uid, EVIDEO_STREAM_TYPE streamType); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteVideoSubscriptionOptions(int64 uid, const FVideoSubscriptionOptions& options); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableAudioVolumeIndication(int interval, int smooth, bool reportVad); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartAudioRecording(const FAudioRecordingConfiguration& config); + + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int RegisterAudioEncodedFrameObserver(const FAudioEncodedFrameObserverConfig& config, UIAudioEncodedFrameObserver* observer); + + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopAudioRecording(); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //UIMediaPlayer* CreateMediaPlayer(); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int DestroyMediaPlayer(UIMediaPlayer* media_player); + + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //UIMediaRecorder* CreateMediaRecorder(FRecorderStreamInfo info); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int DestroyMediaRecorder(UIMediaRecorder* mediaRecorder); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartAudioMixing(const FString & filePath, bool loopback, int cycle, int startPos = 0); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopAudioMixing(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PauseAudioMixing(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ResumeAudioMixing(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SelectAudioTrack(int index); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetAudioTrackCount(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustAudioMixingVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustAudioMixingPublishVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetAudioMixingPublishVolume(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustAudioMixingPlayoutVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetAudioMixingPlayoutVolume(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetAudioMixingDuration(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetAudioMixingCurrentPosition(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioMixingPosition(int pos); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioMixingDualMonoMode(EAUDIO_MIXING_DUAL_MONO_MODE mode); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioMixingPitch(int pitch); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioMixingPlaybackSpeed(int speed); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetEffectsVolume(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetEffectsVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PreloadEffect(int soundId, const FString & filePath, int startPos); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PlayEffect(int soundId, const FString& filePath, int loopCount, float pitch, float pan, int gain, bool publish, int startPos); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PlayAllEffects(int loopCount, float pitch, float pan, int gain, bool publish); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetVolumeOfEffect(int soundId); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVolumeOfEffect(int soundId, int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PauseEffect(int soundId); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PauseAllEffects(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ResumeEffect(int soundId); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ResumeAllEffects(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopEffect(int soundId); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopAllEffects(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UnloadEffect(int soundId); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UnloadAllEffects(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetEffectDuration(const FString& filePath); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetEffectPosition(int soundId, int pos); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetEffectCurrentPosition(int soundId); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableSoundPositionIndication(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteVoicePosition(int64 uid, float pan, float gain); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableSpatialAudio(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteUserSpatialAudioParams(int64 uid, const FSpatialAudioParams& params); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVoiceBeautifierPreset(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioEffectPreset(FENUMWRAP_AUDIO_EFFECT_PRESET preset); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVoiceConversionPreset(FENUMWRAP_VOICE_CONVERSION_PRESET preset); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioEffectParameters(FENUMWRAP_AUDIO_EFFECT_PRESET preset, int param1, int param2); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVoiceBeautifierParameters(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset, int param1, int param2); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVoiceConversionParameters(FENUMWRAP_VOICE_CONVERSION_PRESET preset, int param1, int param2); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLocalVoicePitch(float pitch); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLocalVoiceFormant(const FString & formantRatio = "0.0"); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLocalVoiceEqualization(EAUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLocalVoiceReverb(EAUDIO_REVERB_TYPE reverbKey, int value); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLogFile(const FString& filePath); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLogFilter(int filter); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLogLevel(ELOG_LEVEL level); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLogFileSize(int fileSizeInKBytes); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UploadLogFile(FString& requestId); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int WriteLog(ELOG_LEVEL level, const FString& Content); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLocalRenderMode(ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode = EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_AUTO); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteRenderMode(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLocalVideoMirrorMode(EVIDEO_MIRROR_MODE_TYPE mirrorMode); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableDualStreamMode(bool enabled, const FSimulcastStreamConfig& streamConfig); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetDualStreamMode(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableCustomAudioLocalPlayback(int64 trackId, bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRecordingAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetPlaybackAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableAudioSpectrumMonitor(int intervalInMS); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int DisableAudioSpectrumMonitor(); + + + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int RegisterAudioSpectrumObserver(UIAudioSpectrumObserver* observer); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int UnregisterAudioSpectrumObserver(UIAudioSpectrumObserver* observer); + + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustRecordingSignalVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteRecordingSignal(bool mute); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustPlaybackSignalVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustUserPlaybackSignalVolume(int64 uid, int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLocalPublishFallbackOption(ESTREAM_FALLBACK_OPTIONS option); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteSubscribeFallbackOption(ESTREAM_FALLBACK_OPTIONS option); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetHighPriorityUserList(const TArray & uidList, ESTREAM_FALLBACK_OPTIONS option); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableLoopbackRecording(bool enabled, const FString & deviceName); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustLoopbackSignalVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetLoopbackRecordingVolume(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableInEarMonitoring(bool enabled, int includeAudioFilters); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetInEarMonitoringVolume(int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int LoadExtensionProvider(const FString& path, bool unload_after_use); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetExtensionProviderProperty(const FString& provider, const FString& key, const FString& value); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableExtension(const FString& provider, const FString& extension, bool enable = true, EMEDIA_SOURCE_TYPE type = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetExtensionProperty(const FString& provider, const FString& extension, const FString& key, const FString& value, EMEDIA_SOURCE_TYPE type = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetExtensionProperty(const FString& provider, const FString& extension,const FExtensionInfo & ExtensionInfo, const FString& key, FString& value); + + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraCapturerConfiguration(const FCameraCapturerConfiguration& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int64 CreateCustomVideoTrack(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int64 CreateCustomEncodedVideoTrack(const FSenderOptions& sender_option); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int DestroyCustomVideoTrack(int64 video_track_id); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int DestroyCustomEncodedVideoTrack(int64 video_track_id); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SwitchCamera(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsCameraZoomSupported(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsCameraFaceDetectSupported(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsCameraTorchSupported(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsCameraFocusSupported(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsCameraAutoFocusFaceModeSupported(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraZoomFactor(float factor); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableFaceDetection(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + float GetCameraMaxZoomFactor(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraFocusPositionInPreview(float positionX, float positionY); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraTorchOn(bool isOn); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraAutoFocusFaceModeEnabled(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsCameraExposurePositionSupported(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraExposurePosition(float positionXinView, float positionYinView); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsCameraExposureSupported(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraExposureFactor(float factor); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsCameraAutoExposureFaceModeSupported(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraAutoExposureFaceModeEnabled(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraStabilizationMode(FENUMWRAP_CAMERA_STABILIZATION_MODE mode); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetEnableSpeakerphone(bool speakerOn); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsSpeakerphoneEnabled(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRouteInCommunicationMode(int route); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + UIScreenCaptureSourceList* GetScreenCaptureSources(const FSIZE & thumbSize, const FSIZE & iconSize, bool includeScreen); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAudioSessionOperationRestriction(EAUDIO_SESSION_OPERATION_RESTRICTION restriction); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartScreenCaptureByDisplayId(int64 displayId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartScreenCaptureByScreenRect(const FRectangle& screenRect, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) __deprecated; + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetAudioDeviceInfo(FDeviceInfo& deviceInfo); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartScreenCaptureByWindowId(int64 windowId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetScreenCaptureContentHint(EVIDEO_CONTENT_HINT contentHint); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdateScreenCaptureRegion(const FRectangle& regionRect); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdateScreenCaptureParameters(const FScreenCaptureParameters& captureParams); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartScreenCapture(const FScreenCaptureParameters2& captureParams); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int QueryScreenCaptureCapability(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int QueryCameraFocalLengthCapability(const TArray & focalLengthInfos); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetScreenCaptureScenario(ESCREEN_SCENARIO_TYPE screenScenario); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdateScreenCapture(const FScreenCaptureParameters2& captureParams); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopScreenCapture(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetCallId(FString& callId); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int Rate(const FString& callId, int rating, const FString& description); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int Complain(const FString& callId, const FString& description); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartRtmpStreamWithoutTranscoding(const FString& url); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartRtmpStreamWithTranscoding(const FString& url, const FLiveTranscoding& transcoding); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdateRtmpTranscoding(const FLiveTranscoding& transcoding); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopRtmpStream(const FString& url); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartCameraCapture(EVIDEO_SOURCE_TYPE sourceType, const FCameraCapturerConfiguration& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopCameraCapture(EVIDEO_SOURCE_TYPE sourceType); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType, const FScreenCaptureConfiguration& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartLocalVideoTranscoder(const FLocalTranscoderConfiguration& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdateLocalTranscoderConfiguration(const FLocalTranscoderConfiguration& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopLocalVideoTranscoder(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCameraDeviceOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetScreenCaptureOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + ECONNECTION_STATE_TYPE GetConnectionState(); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //bool RegisterEventHandler(UIRtcEngineEventHandler* eventHandler); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //bool RegisterEventHandlerEx(UIRtcEngineEventHandlerEx* eventHandler); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //bool UnregisterEventHandler(UIRtcEngineEventHandler* eventHandler); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //bool UnregisterEventHandlerEx(UIRtcEngineEventHandlerEx* eventHandler); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteUserPriority(int64 uid, EPRIORITY_TYPE userPriority); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int RegisterPacketObserver(UIPacketObserver* observer); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableEncryption(bool enabled, const FEncryptionConfig& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int CreateDataStream(int& streamId, const FDataStreamConfig& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SendStreamMessage(int streamId, const FString& data); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AddVideoWatermark(const FString& watermarkUrl, const FWatermarkOptions& options); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ClearVideoWatermarks(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PauseAudio(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ResumeAudio(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableWebSdkInteroperability(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SendCustomReportMessage(const FString& id, const FString& category, const FString& event, const FString& label, int value); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int RegisterMediaMetadataObserver(UIMetadataObserver* observer, FENUMWRAP_METADATA_TYPE type); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int UnregisterMediaMetadataObserver(UIMetadataObserver* observer, FENUMWRAP_METADATA_TYPE type); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartAudioFrameDump(const FString& channel_id, int64 uid, const FString& location, const FString& uuid, const FString& passwd, int64 duration_ms, bool auto_upload); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopAudioFrameDump(const FString & channel_id, int64 uid, const FString & location); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAINSMode(bool enabled, EAUDIO_AINS_MODE mode); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int RegisterLocalUserAccount(const FString& appId, const FString& userAccount); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int JoinChannelWithUserAccount(const FString& token, const FString& channelId, const FString& userAccount, const FChannelMediaOptions& options); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int JoinChannelWithUserAccountEx(const FString& token, const FString& channelId, const FString& userAccount, const FChannelMediaOptions& options); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetUserInfoByUserAccount(const FString& userAccount, FUserInfo& userInfo); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetUserInfoByUid(int64 uid, FUserInfo& userInfo); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartOrUpdateChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartOrUpdateChannelMediaRelayEx(const FChannelMediaRelayConfiguration& configuration, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopChannelMediaRelay(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PauseAllChannelMediaRelay(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ResumeAllChannelMediaRelay(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetDirectCdnStreamingAudioConfiguration(EAUDIO_PROFILE_TYPE profile); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetDirectCdnStreamingVideoConfiguration(const FVideoEncoderConfiguration& config); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int StartDirectCdnStreaming(UIDirectCdnStreamingEventHandler* eventHandler, FString publishUrl, FDirectCdnStreamingMediaOptions& options); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int StopDirectCdnStreaming(); + //UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + //int UpdateDirectCdnStreamingMediaOptions(const FDirectCdnStreamingMediaOptions& options); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartRhythmPlayer(const FString& sound1, const FString& sound2, const FAgoraRhythmPlayerConfig& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopRhythmPlayer(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ConfigRhythmPlayer(const FAgoraRhythmPlayerConfig& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int TakeSnapshot(int64 uid, const FString& filePath); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableContentInspect(bool enabled, const FContentInspectConfig& config); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustCustomAudioPublishVolume(int64 trackId, int volume); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustCustomAudioPlayoutVolume(int64 trackId, int volume); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetCloudProxy(ECLOUD_PROXY_TYPE proxyType); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetLocalAccessPoint(const FLocalAccessPointConfiguration& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAdvancedAudioOptions(const FAdvancedAudioOptions& options); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetAVSyncSource(const FString& channelId, int64 uid); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableVideoImageSource(bool enable, const FImageTrackOptions& options); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int JoinChannelEx(const FString& token, const FRtcConnection& connection, const FChannelMediaOptions& options); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int LeaveChannelEx(const FRtcConnection& connection, const FLeaveChannelOptions& options); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdateChannelMediaOptionsEx(const FChannelMediaOptions& options, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetVideoEncoderConfigurationEx(const FVideoEncoderConfiguration& config, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteRemoteAudioStreamEx(int64 uid, bool mute, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteRemoteVideoStreamEx(int64 uid, bool mute, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteVideoStreamTypeEx(int64 uid, EVIDEO_STREAM_TYPE streamType, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteVideoSubscriptionOptionsEx(int64 uid, const FVideoSubscriptionOptions& options, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteVoicePositionEx(int64 uid, float pan, float gain, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteUserSpatialAudioParamsEx(int64 uid, const FSpatialAudioParams& params, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetRemoteRenderModeEx(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableLoopbackRecordingEx(const FRtcConnection& connection, bool enabled, const FString& deviceName); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + ECONNECTION_STATE_TYPE GetConnectionStateEx(const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableEncryptionEx(const FRtcConnection& connection, bool enabled, const FEncryptionConfig& config); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int CreateDataStreamEx(int& streamId, const FDataStreamConfig& config, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SendStreamMessageEx(int streamId, const FString& data, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AddVideoWatermarkEx(const FString& watermarkUrl, const FWatermarkOptions& options, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ClearVideoWatermarkEx(const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SendCustomReportMessageEx(const FString& id, const FString& category, const FString& event, const FString& label, int value, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableAudioVolumeIndicationEx(int interval, int smooth, bool reportVad, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetUserInfoByUserAccountEx(const FString& userAccount, FUserInfo& userInfo, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetUserInfoByUidEx(int64 uid, FUserInfo& userInfo, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableDualStreamModeEx(bool enabled, const FSimulcastStreamConfig& streamConfig, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetDualStreamModeEx(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableWirelessAccelerate(bool enabled); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int TakeSnapshotEx(const FRtcConnection& connection, int64 uid, const FString& filePath); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableContentInspectEx(bool enabled, const FContentInspectConfig& config, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + + int MuteLocalAudioStreamEx(bool mute, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteLocalVideoStreamEx(bool mute, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteAllRemoteAudioStreamsEx(bool mute, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int MuteAllRemoteVideoStreamsEx(bool mute, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetSubscribeAudioBlocklist(TArray uidList, int uidNumber); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetSubscribeAudioBlocklistEx(TArray uidList, int uidNumber, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetSubscribeAudioAllowlist(TArray uidList, int uidNumber); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetSubscribeAudioAllowlistEx(TArray uidList, int uidNumber, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetSubscribeVideoBlocklist(TArray uidList, int uidNumber); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetSubscribeVideoBlocklistEx(TArray uidList, int uidNumber, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetSubscribeVideoAllowlist(TArray uidList, int uidNumber); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetSubscribeVideoAllowlistEx(TArray uidList, int uidNumber, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int AdjustUserPlaybackSignalVolumeEx(int64 uid, int volume, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartRtmpStreamWithoutTranscodingEx(const FString& url, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartRtmpStreamWithTranscodingEx(const FString& url, const FLiveTranscoding& transcoding, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int UpdateRtmpTranscodingEx(const FLiveTranscoding& transcoding, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopRtmpStreamEx(const FString& url, const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StopChannelMediaRelayEx(const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int PauseAllChannelMediaRelayEx(const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int ResumeAllChannelMediaRelayEx(const FRtcConnection& connection); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetParameters(const FString& parameters); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetParametersEx(const FRtcConnection& connection, const FString & parameters); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetCallIdEx( FString & callId, const FRtcConnection& connection); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SendAudioMetadata(const FString& metadata, const FString& length); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SendAudioMetadataEx(const FRtcConnection& connection,const FString & metadata, const FString & length); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartMediaRenderingTracing(); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int StartMediaRenderingTracingEx(const FRtcConnection& connection); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int EnableInstantMediaRendering(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + FString GetNtpWallTimeInMs(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetHeadphoneEQPreset(FENUMWRAP_HEADPHONE_EQUALIZER_PRESET preset); + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetHeadphoneEQParameters(int lowGain, int highGain); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int SetEarMonitoringAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int64 GetCurrentMonotonicTimeInMs(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int RegisterExtension(const FString& provider, const FString& extension, EMEDIA_SOURCE_TYPE type); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + int GetNetworkType(); + + UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") + bool IsFeatureAvailableOnDevice(EFeatureType type); + +#pragma endregion Other APIs + + +private: + //// 防止拷贝和赋值操作 + //UAgoraBPRtcEngine(const UAgoraBPRtcEngine&) = delete; + //UAgoraBPRtcEngine& operator=(const UAgoraBPRtcEngine&) = delete; + + static UAgoraBPuRtcEngine* Instance; + + + EAgoraBPuEventHandlerType EventHandlerType = EAgoraBPuEventHandlerType::None; + TStrongObjectPtr UserRtcEventHandler = nullptr; + TStrongObjectPtr UserRtcEventHandlerEx = nullptr; + + TStrongObjectPtr UserScreenCaptureSourceList = nullptr; +}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIMediaPlayerSourceObserver.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIMediaPlayerSourceObserver.h deleted file mode 100644 index 95843cd5..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIMediaPlayerSourceObserver.h +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "AgoraBluePrintPlugin/URtcEngineProxyCompatibility.h" -#include "AgoraIMediaPlayerSourceObserver.generated.h" - -UENUM(BlueprintType) -enum class EENUMCUSTOM_MEDIA_PLAYER_ERROR : uint8 { - PLAYER_ERROR_NONE = 0, - - PLAYER_ERROR_INVALID_ARGUMENTS = 1, - - PLAYER_ERROR_INTERNAL = 2, - - - PLAYER_ERROR_NO_RESOURCE = 3, - - PLAYER_ERROR_INVALID_MEDIA_SOURCE = 4, - - PLAYER_ERROR_UNKNOWN_STREAM_TYPE = 5, - - PLAYER_ERROR_OBJ_NOT_INITIALIZED = 6, - - PLAYER_ERROR_CODEC_NOT_SUPPORTED = 7, - - PLAYER_ERROR_VIDEO_RENDER_FAILED = 8, - - PLAYER_ERROR_INVALID_STATE = 9, - - PLAYER_ERROR_URL_NOT_FOUND = 10, - - PLAYER_ERROR_INVALID_CONNECTION_STATE = 11, - - PLAYER_ERROR_SRC_BUFFER_UNDERFLOW = 12, - - PLAYER_ERROR_INTERRUPTED = 13, - - PLAYER_ERROR_NOT_SUPPORTED = 14, - - PLAYER_ERROR_TOKEN_EXPIRED = 15, - - PLAYER_ERROR_IP_EXPIRED = 16, - - PLAYER_ERROR_UNKNOWN = 17, - -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_MEDIA_PLAYER_ERROR { - - GENERATED_BODY() - -public: - - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EENUMCUSTOM_MEDIA_PLAYER_ERROR") - EENUMCUSTOM_MEDIA_PLAYER_ERROR ValueWrapper = EENUMCUSTOM_MEDIA_PLAYER_ERROR::PLAYER_ERROR_NONE; - - // default - FENUMWRAP_MEDIA_PLAYER_ERROR() :ValueWrapper(EENUMCUSTOM_MEDIA_PLAYER_ERROR::PLAYER_ERROR_NONE) {} - - FENUMWRAP_MEDIA_PLAYER_ERROR(EENUMCUSTOM_MEDIA_PLAYER_ERROR Val) :ValueWrapper(Val) {} - - FENUMWRAP_MEDIA_PLAYER_ERROR(agora::media::base::MEDIA_PLAYER_ERROR Val) :ValueWrapper((EENUMCUSTOM_MEDIA_PLAYER_ERROR)(-(int)Val)) {} - void operator = (EENUMCUSTOM_MEDIA_PLAYER_ERROR InValue) { - ValueWrapper = InValue; - } - - agora::rtc::AUDIO_EFFECT_PRESET GetRawValue() const { - return (agora::rtc::AUDIO_EFFECT_PRESET)(-(int)ValueWrapper); - } -}; - -UENUM(BlueprintType) -enum EMEDIA_PLAYER_EVENT { - - PLAYER_EVENT_SEEK_BEGIN = 0, - - PLAYER_EVENT_SEEK_COMPLETE = 1, - - PLAYER_EVENT_SEEK_ERROR = 2, - - PLAYER_EVENT_AUDIO_TRACK_CHANGED = 5, - - PLAYER_EVENT_BUFFER_LOW = 6, - - PLAYER_EVENT_BUFFER_RECOVER = 7, - - PLAYER_EVENT_FREEZE_START = 8, - - PLAYER_EVENT_FREEZE_STOP = 9, - - PLAYER_EVENT_SWITCH_BEGIN = 10, - - PLAYER_EVENT_SWITCH_COMPLETE = 11, - - PLAYER_EVENT_SWITCH_ERROR = 12, - - PLAYER_EVENT_FIRST_DISPLAYED = 13, - - PLAYER_EVENT_REACH_CACHE_FILE_MAX_COUNT = 14, - - PLAYER_EVENT_REACH_CACHE_FILE_MAX_SIZE = 15, - - PLAYER_EVENT_TRY_OPEN_START = 16, - - PLAYER_EVENT_TRY_OPEN_SUCCEED = 17, - - PLAYER_EVENT_TRY_OPEN_FAILED = 18, -}; - -UENUM(BlueprintType) -enum class EPLAYER_PRELOAD_EVENT :uint8 { - - PLAYER_PRELOAD_EVENT_BEGIN = 0, - - PLAYER_PRELOAD_EVENT_COMPLETE = 1, - - PLAYER_PRELOAD_EVENT_ERROR = 2, -}; - -USTRUCT(BlueprintType) -struct FSrcInfo { - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SrcInfo") - int bitrateInKbps = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SrcInfo") - FString name = ""; - -}; - -USTRUCT(BlueprintType) -struct FCacheStatistics { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CacheStatistics") - int64 fileSize = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CacheStatistics") - int64 cacheSize = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CacheStatistics") - int64 downloadSize = 0; -}; - -USTRUCT(BlueprintType) -struct FPlayerUpdatedInfo { - GENERATED_BODY() - - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") - bool playerId_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") - FString playerId = ""; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") - bool deviceId_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") - FString deviceId = ""; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") - bool cacheStatistics_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PlayerUpdatedInfo") - FCacheStatistics cacheStatistics = FCacheStatistics(); -}; - -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPlayerSourceStateChanged, EMEDIA_PLAYER_STATE, state, FENUMWRAP_MEDIA_PLAYER_ERROR, ec); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPositionChanged, int64, position_ms); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnPlayerEvent, EMEDIA_PLAYER_EVENT, eventCode, int64, elapsedTime, const FString, message); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnMetaDataSource, int64, data, int, length); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPlayBufferUpdated, int64, playCachedBuffer); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPreloadEvent, const FString, src, EPLAYER_PRELOAD_EVENT, event); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnCompleted); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnAgoraCDNTokenWillExpire); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPlayerSrcInfoChanged, const FSrcInfo&, from, const FSrcInfo&, to); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPlayerInfoUpdated, const FPlayerUpdatedInfo&, info); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAudioVolumeIndicationSource, int, volume); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnReadData, TArray, buffer, int, bufferSize); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSeek, int64, offset, int, whence); - - -class IMediaPlayerSourceObserverClassWrapper : public agora::rtc::IMediaPlayerSourceObserver {}; - -/** - * - */ -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIMediaPlayerSourceObserver : public UObject, public IMediaPlayerSourceObserverClassWrapper -{ - GENERATED_BODY() -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPlayerSourceStateChanged OnPlayerSourceStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPositionChanged OnPositionChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPlayerEvent OnPlayerEvent; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnMetaDataSource OnMetaData; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPlayBufferUpdated OnPlayBufferUpdated; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPreloadEvent OnPreloadEvent; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnCompleted OnCompleted; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAgoraCDNTokenWillExpire OnAgoraCDNTokenWillExpire; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPlayerSrcInfoChanged OnPlayerSrcInfoChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPlayerInfoUpdated OnPlayerInfoUpdated; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioVolumeIndicationSource OnAudioVolumeIndication; - - void onPlayerSourceStateChanged(agora::media::base::MEDIA_PLAYER_STATE state, agora::media::base::MEDIA_PLAYER_ERROR ec) override; - - void onPositionChanged(int64_t position_ms) override; - - void onPlayerEvent(agora::media::base::MEDIA_PLAYER_EVENT eventCode, int64_t elapsedTime, const char* message) override; - - void onMetaData(const void* data, int length) override; - - void onPlayBufferUpdated(int64_t playCachedBuffer) override; - - void onPreloadEvent(const char* src, agora::media::base::PLAYER_PRELOAD_EVENT event) override; - - void onCompleted() override; - - void onAgoraCDNTokenWillExpire() override; - - void onPlayerSrcInfoChanged(const agora::media::base::SrcInfo& from, const agora::media::base::SrcInfo& to) override; - - void onPlayerInfoUpdated(const agora::media::base::PlayerUpdatedInfo& info) override; - - void onAudioVolumeIndication(int volume) override; - -}; - - -class IMediaPlayerCustomDataProviderClassWrapper : public agora::media::base::IMediaPlayerCustomDataProvider {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIMediaPlayerCustomDataProvider : public UObject, public IMediaPlayerCustomDataProviderClassWrapper -{ - GENERATED_BODY() - -public: - - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnReadData OnReadData; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnSeek OnSeek; - int onReadData(unsigned char* buffer, int bufferSize) override; - - int64_t onSeek(int64_t offset, int whence) override; - -}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.h deleted file mode 100644 index 9ab8d2ee..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.h +++ /dev/null @@ -1,547 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "GameFramework/Actor.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "URtcEngineProxyCompatibility.h" -#include -#include -#include "AgoraIRtcEngineEventHandler.generated.h" - -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnJoinChannelSuccess, FString, channel, int64, uid, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnRejoinChannelSuccess, FString, channel, int64, uid, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnProxyConnected, FString, channel, int64, uid, EPROXY_TYPE, proxyType, FString, localProxyIp, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnError, int, err, FString, msg); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnAudioQuality, int64, uid, int, quality, int, delay, int, lost); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLastmileProbeResult, const FLastmileProbeResult&, result); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnAudioVolumeIndication, const TArray&, speakers, int, totalVolume); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLeaveChannel, const FRtcStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRtcStats, const FRtcStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAudioDeviceStateChanged, FString, deviceId, int, deviceType, int, deviceState); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAudioMixingPositionChanged, int64, position); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnAudioMixingFinished); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAudioEffectFinished, int, soundId); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnVideoDeviceStateChanged, FString, deviceId, int, deviceType, int, deviceState); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMediaDeviceChanged, int, deviceType); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnNetworkQuality, int64, uid, int, txQuality, int, rxQuality); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnIntraRequestReceived); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnUplinkNetworkInfoUpdated, const FUplinkNetworkInfo&, info); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDownlinkNetworkInfoUpdated, const FDownlinkNetworkInfo&, info); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLastmileQuality, int, quality); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnFirstLocalVideoFrame, EVIDEO_SOURCE_TYPE, source, int, width, int, height, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstLocalVideoFramePublished, EVIDEO_SOURCE_TYPE, source, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnVideoSourceFrameSizeChanged, EVIDEO_SOURCE_TYPE, sourceType, int, width, int, height); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnFirstRemoteVideoDecoded, int64, uid, int, width, int, height, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnVideoSizeChanged, EVIDEO_SOURCE_TYPE, sourceType, int64, uid, int, width, int, height, int, rotation); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnLocalVideoStateChanged, EVIDEO_SOURCE_TYPE, source, ELOCAL_VIDEO_STREAM_STATE, state, ELOCAL_VIDEO_STREAM_ERROR, error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRemoteVideoStateChanged, int64, uid, EREMOTE_VIDEO_STATE, state, EREMOTE_VIDEO_STATE_REASON, reason, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnFirstRemoteVideoFrame, int64, userId, int, width, int, height, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserJoined, int64, uid, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserOffline, int64, uid, EUSER_OFFLINE_REASON_TYPE, reason); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserMuteAudio, int64, uid, bool, muted); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserMuteVideo, int64, userId, bool, muted); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserEnableVideo, int64, uid, bool, enabled); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserStateChanged, int64, uid, int, state); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserEnableLocalVideo, int64, uid, bool, enabled); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLocalAudioStats, const FLocalAudioStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRemoteAudioStats, const FRemoteAudioStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalVideoStats, EVIDEO_SOURCE_TYPE, source, const FLocalVideoStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRemoteVideoStats, const FRemoteVideoStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnCameraReady); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnCameraFocusAreaChanged, int, x, int, y, int, width, int, height); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnCameraExposureAreaChanged, int, x, int, y, int, width, int, height); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnFacePositionChanged, int, imageWidth, int, imageHeight, FRectangle, vecRectangle, TArray, vecDistance, int, numFaces); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnVideoStopped); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnAudioMixingStateChanged, FENUMWRAP_AUDIO_MIXING_STATE_TYPE, state, FENUMWRAP_AUDIO_MIXING_REASON_TYPE, reason); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRhythmPlayerStateChanged, FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE, state, FENUMWRAP_RHYTHM_PLAYER_ERROR_TYPE, errorCode); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnConnectionLost); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnConnectionInterrupted); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnConnectionBanned); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnStreamMessage, int64, userId, int, streamId, FString, data, int64, length, int, sentTs); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnStreamMessageError, int64, userId, int, streamId, int, code, int, missed, int, cached); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnRequestToken); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTokenPrivilegeWillExpire, FString, token); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLicenseValidationFailure, ELICENSE_ERROR_TYPE, error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnFirstLocalAudioFramePublished, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstRemoteAudioFrame, int64, uid, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstRemoteAudioDecoded, int64, uid, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalAudioStateChanged, ELOCAL_AUDIO_STREAM_STATE, state, ELOCAL_AUDIO_STREAM_ERROR, error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRemoteAudioStateChanged, int64, uid, EREMOTE_AUDIO_STATE, state, EREMOTE_AUDIO_STATE_REASON, reason, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnActiveSpeaker, int64, userId); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnContentInspectResult, ECONTENT_INSPECT_RESULT, result); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnSnapshotTaken, int64, uid, FString, filePath, int, width, int, height, int, errCode); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnClientRoleChanged, ECLIENT_ROLE_TYPE, oldRole, ECLIENT_ROLE_TYPE, newRole, FClientRoleOptions, roleoption); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnClientRoleChangeFailed, ECLIENT_ROLE_CHANGE_FAILED_REASON, reason, ECLIENT_ROLE_TYPE, currentRole); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAudioDeviceVolumeChanged, FENUMWRAP_MEDIA_DEVICE_TYPE, deviceType, int, volume, bool, muted); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnRtmpStreamingStateChanged, FString, url, ERTMP_STREAM_PUBLISH_STATE, state, ERTMP_STREAM_PUBLISH_ERROR_TYPE, errCode); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRtmpStreamingEvent, FString, url, ERTMP_STREAMING_EVENT, eventCode); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnTranscodingUpdated); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAudioRoutingChanged, int, routing); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnChannelMediaRelayStateChanged, int, state, int, code); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnChannelMediaRelayEvent, int, code); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLocalPublishFallbackToAudioOnly, bool, isFallbackOrRecover); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRemoteSubscribeFallbackToAudioOnly, int64, uid, bool, isFallbackOrRecover); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRemoteAudioTransportStats, int64, uid, int, delay, int, lost, int, rxKBitRate); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRemoteVideoTransportStats, int64, uid, int, delay, int, lost, int, rxKBitRate); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnConnectionStateChanged, ECONNECTION_STATE_TYPE, state, ECONNECTION_CHANGED_REASON_TYPE, reason); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnWlAccMessage, EWLACC_MESSAGE_REASON, reason, EWLACC_SUGGEST_ACTION, action, FString, wlAccMsg); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnWlAccStats, FWlAccStats, currentStats, FWlAccStats, averageStats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnNetworkTypeChanged, FENUMWRAP_NETWORK_TYPE, type); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnEncryptionError, EENCRYPTION_ERROR_TYPE, errorType); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPermissionError, EPERMISSION_TYPE, permissionType); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalUserRegistered, int64, uid, FString, userAccount); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserInfoUpdated, int64, uid, const FUserInfo&, info); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUploadLogResult, FString, requestId, bool, success, EUPLOAD_ERROR_REASON, reason); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnAudioSubscribeStateChanged, FString, channel, int64, uid, ESTREAM_SUBSCRIBE_STATE, oldState, ESTREAM_SUBSCRIBE_STATE, newState, int, elapseSinceLastState); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnVideoSubscribeStateChanged, FString, channel, int64, uid, ESTREAM_SUBSCRIBE_STATE, oldState, ESTREAM_SUBSCRIBE_STATE, newState, int, elapseSinceLastState); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnAudioPublishStateChanged, FString, channel, ESTREAM_PUBLISH_STATE, oldState, ESTREAM_PUBLISH_STATE, newState, int, elapseSinceLastState); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnVideoPublishStateChanged, EVIDEO_SOURCE_TYPE, source, FString, channel, ESTREAM_PUBLISH_STATE, oldState, ESTREAM_PUBLISH_STATE, newState, int, elapseSinceLastState); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnExtensionEvent, FString, provider, FString, extension, FString, key, FString, value); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnExtensionStarted, FString, provider, FString, extension); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnExtensionStopped, FString, provider, FString, extension); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnExtensionError, FString, provider, FString, extension, int, error, FString, message); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnUserAccountUpdated, int64, uid, FString, userAccount); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalVideoTranscoderError, const FTranscodingVideoStream&, stream, EVIDEO_TRANSCODER_ERROR, error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnVideoRenderingTracingResult, int64, uid, EMEDIA_TRACE_EVENT, currentEvent, FVideoRenderingTracingInfo, tracingInfo); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetMaxMetadataSize); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnReadyToSendMetadata, const FAgoraMetadata&, metadata, EVIDEO_SOURCE_TYPE, source_type); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMetadataReceived, const FAgoraMetadata&, metadata); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnDirectCdnStreamingStateChanged, EDIRECT_CDN_STREAMING_STATE, state, EDIRECT_CDN_STREAMING_ERROR, error, FString, message); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDirectCdnStreamingStats, const FDirectCdnStreamingStats&, stats); - -class IRtcEngineEventHandlerClassWrapper : public agora::rtc::IRtcEngineEventHandler {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIRtcEngineEventHandler : public UObject, public IRtcEngineEventHandlerClassWrapper -{ - GENERATED_BODY() - -public: - using IRtcEngineEventHandler::eventHandlerType; - -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnJoinChannelSuccess OnJoinChannelSuccess; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRejoinChannelSuccess OnRejoinChannelSuccess; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnProxyConnected OnProxyConnected; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnError OnError; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioQuality OnAudioQuality; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLastmileProbeResult OnLastmileProbeResult; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioVolumeIndication OnAudioVolumeIndication; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLeaveChannel OnLeaveChannel; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRtcStats OnRtcStats; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioDeviceStateChanged OnAudioDeviceStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioMixingPositionChanged OnAudioMixingPositionChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioMixingFinished OnAudioMixingFinished; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioEffectFinished OnAudioEffectFinished; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoDeviceStateChanged OnVideoDeviceStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnMediaDeviceChanged OnMediaDeviceChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnNetworkQuality OnNetworkQuality; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnIntraRequestReceived OnIntraRequestReceived; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUplinkNetworkInfoUpdated OnUplinkNetworkInfoUpdated; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnDownlinkNetworkInfoUpdated OnDownlinkNetworkInfoUpdated; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLastmileQuality OnLastmileQuality; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstLocalVideoFrame OnFirstLocalVideoFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstLocalVideoFramePublished OnFirstLocalVideoFramePublished; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoSourceFrameSizeChanged OnVideoSourceFrameSizeChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstRemoteVideoDecoded OnFirstRemoteVideoDecoded; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoSizeChanged OnVideoSizeChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalVideoStateChanged OnLocalVideoStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteVideoStateChanged OnRemoteVideoStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstRemoteVideoFrame OnFirstRemoteVideoFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserJoined OnUserJoined; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserOffline OnUserOffline; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserMuteAudio OnUserMuteAudio; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserMuteVideo OnUserMuteVideo; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserEnableVideo OnUserEnableVideo; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserStateChanged OnUserStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserEnableLocalVideo OnUserEnableLocalVideo; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalAudioStats OnLocalAudioStats; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteAudioStats OnRemoteAudioStats; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalVideoStats OnLocalVideoStats; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteVideoStats OnRemoteVideoStats; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnCameraReady OnCameraReady; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnCameraFocusAreaChanged OnCameraFocusAreaChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnCameraExposureAreaChanged OnCameraExposureAreaChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFacePositionChanged OnFacePositionChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoStopped OnVideoStopped; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioMixingStateChanged OnAudioMixingStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRhythmPlayerStateChanged OnRhythmPlayerStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnConnectionLost OnConnectionLost; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnConnectionInterrupted OnConnectionInterrupted; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnConnectionBanned OnConnectionBanned; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnStreamMessage OnStreamMessage; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnStreamMessageError OnStreamMessageError; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRequestToken OnRequestToken; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnTokenPrivilegeWillExpire OnTokenPrivilegeWillExpire; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLicenseValidationFailure OnLicenseValidationFailure; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstLocalAudioFramePublished OnFirstLocalAudioFramePublished; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstRemoteAudioFrame OnFirstRemoteAudioFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstRemoteAudioDecoded OnFirstRemoteAudioDecoded; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalAudioStateChanged OnLocalAudioStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteAudioStateChanged OnRemoteAudioStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnActiveSpeaker OnActiveSpeaker; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnContentInspectResult OnContentInspectResult; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnSnapshotTaken OnSnapshotTaken; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnClientRoleChanged OnClientRoleChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnClientRoleChangeFailed OnClientRoleChangeFailed; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioDeviceVolumeChanged OnAudioDeviceVolumeChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRtmpStreamingStateChanged OnRtmpStreamingStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRtmpStreamingEvent OnRtmpStreamingEvent; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnTranscodingUpdated OnTranscodingUpdated; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioRoutingChanged OnAudioRoutingChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnChannelMediaRelayStateChanged OnChannelMediaRelayStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnChannelMediaRelayEvent OnChannelMediaRelayEvent; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalPublishFallbackToAudioOnly OnLocalPublishFallbackToAudioOnly; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteSubscribeFallbackToAudioOnly OnRemoteSubscribeFallbackToAudioOnly; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteAudioTransportStats OnRemoteAudioTransportStats; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteVideoTransportStats OnRemoteVideoTransportStats; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnConnectionStateChanged OnConnectionStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnWlAccMessage OnWlAccMessage; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnWlAccStats OnWlAccStats; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnNetworkTypeChanged OnNetworkTypeChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnEncryptionError OnEncryptionError; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPermissionError OnPermissionError; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalUserRegistered OnLocalUserRegistered; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserInfoUpdated OnUserInfoUpdated; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUploadLogResult OnUploadLogResult; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioSubscribeStateChanged OnAudioSubscribeStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoSubscribeStateChanged OnVideoSubscribeStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioPublishStateChanged OnAudioPublishStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoPublishStateChanged OnVideoPublishStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnExtensionEvent OnExtensionEvent; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnExtensionStarted OnExtensionStarted; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnExtensionStopped OnExtensionStopped; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnExtensionError OnExtensionError; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserAccountUpdated OnUserAccountUpdated; - - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalVideoTranscoderError OnLocalVideoTranscoderError; - - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoRenderingTracingResult OnVideoRenderingTracingResult; - - void onJoinChannelSuccess(const char* channel, agora::rtc::uid_t uid, int elapsed) override; - - void onRejoinChannelSuccess(const char* channel, agora::rtc::uid_t uid, int elapsed) override; - - void onProxyConnected(const char* channel, agora::rtc::uid_t uid, agora::rtc::PROXY_TYPE proxyType, const char* localProxyIp, int elapsed) override; - - void onError(int err, const char* msg) override; - - void onAudioQuality(agora::rtc::uid_t uid, int quality, unsigned short delay, unsigned short lost) override; - - void onLastmileProbeResult(const agora::rtc::LastmileProbeResult& result) override; - - void onAudioVolumeIndication(const agora::rtc::AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) override; - - void onLeaveChannel(const agora::rtc::RtcStats& stats) override; - - void onRtcStats(const agora::rtc::RtcStats& stats) override; - - void onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) override; - - void onAudioMixingPositionChanged(int64_t position) override; - - void onAudioMixingFinished() override; - - void onAudioEffectFinished(int soundId) override; - - void onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) override; - - void onNetworkQuality(agora::rtc::uid_t uid, int txQuality, int rxQuality) override; - - void onIntraRequestReceived() override; - - void onUplinkNetworkInfoUpdated(const agora::rtc::UplinkNetworkInfo& info) override; - - void onDownlinkNetworkInfoUpdated(const agora::rtc::DownlinkNetworkInfo& info) override; - - void onLastmileQuality(int quality) override; - - void onFirstLocalVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE source, int width, int height, int elapsed) override; - - void onFirstLocalVideoFramePublished(agora::rtc::VIDEO_SOURCE_TYPE source, int elapsed) override; - - void onFirstRemoteVideoDecoded(agora::rtc::uid_t uid, int width, int height, int elapsed) override; - - void onVideoSizeChanged(agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::rtc::uid_t uid, int width, int height, int rotation) override; - - void onLocalVideoStateChanged(agora::rtc::VIDEO_SOURCE_TYPE source, agora::rtc::LOCAL_VIDEO_STREAM_STATE state, agora::rtc::LOCAL_VIDEO_STREAM_ERROR error) override; - - void onRemoteVideoStateChanged(agora::rtc::uid_t uid, agora::rtc::REMOTE_VIDEO_STATE state, agora::rtc::REMOTE_VIDEO_STATE_REASON reason, int elapsed) override; - - void onFirstRemoteVideoFrame(agora::rtc::uid_t userId, int width, int height, int elapsed) override; - - void onUserJoined(agora::rtc::uid_t uid, int elapsed) override; - - void onUserOffline(agora::rtc::uid_t uid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) override; - - void onUserMuteAudio(agora::rtc::uid_t uid, bool muted) override; - - void onUserMuteVideo(agora::rtc::uid_t userId, bool muted) override; - - void onUserEnableVideo(agora::rtc::uid_t uid, bool enabled) override; - - void onUserStateChanged(agora::rtc::uid_t uid, uint32_t state) override; - - void onUserEnableLocalVideo(agora::rtc::uid_t uid, bool enabled) override; - - void onLocalAudioStats(const agora::rtc::LocalAudioStats& stats) override; - - void onRemoteAudioStats(const agora::rtc::RemoteAudioStats& stats) override; - - void onLocalVideoStats(agora::rtc::VIDEO_SOURCE_TYPE source, const agora::rtc::LocalVideoStats& stats) override; - - void onRemoteVideoStats(const agora::rtc::RemoteVideoStats& stats) override; - - void onCameraReady() override; - - void onCameraFocusAreaChanged(int x, int y, int width, int height) override; - - void onCameraExposureAreaChanged(int x, int y, int width, int height) override; -#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) - void onFacePositionChanged(int imageWidth, int imageHeight, const agora::rtc::Rectangle* vecRectangle, const int* vecDistance, int numFaces) override; -#endif - void onVideoStopped() override; - - void onAudioMixingStateChanged(agora::rtc::AUDIO_MIXING_STATE_TYPE state, agora::rtc::AUDIO_MIXING_REASON_TYPE reason) override; - - void onRhythmPlayerStateChanged(agora::rtc::RHYTHM_PLAYER_STATE_TYPE state, agora::rtc::RHYTHM_PLAYER_ERROR_TYPE errorCode) override; - - void onConnectionLost() override; - - void onConnectionInterrupted() override; - - void onConnectionBanned() override; - - void onStreamMessage(agora::rtc::uid_t userId, int streamId, const char* data, size_t length, uint64_t sentTs) override; - - void onStreamMessageError(agora::rtc::uid_t userId, int streamId, int code, int missed, int cached) override; - - void onRequestToken() override; - - void onTokenPrivilegeWillExpire(const char* token) override; - - void onLicenseValidationFailure(agora::LICENSE_ERROR_TYPE error) override; - - void onFirstLocalAudioFramePublished(int elapsed) override; - - void onFirstRemoteAudioFrame(agora::rtc::uid_t uid, int elapsed) override; - - void onFirstRemoteAudioDecoded(agora::rtc::uid_t uid, int elapsed) override; - - void onLocalAudioStateChanged(agora::rtc::LOCAL_AUDIO_STREAM_STATE state, agora::rtc::LOCAL_AUDIO_STREAM_ERROR error) override; - - void onRemoteAudioStateChanged(agora::rtc::uid_t uid, agora::rtc::REMOTE_AUDIO_STATE state, agora::rtc::REMOTE_AUDIO_STATE_REASON reason, int elapsed) override; - - void onActiveSpeaker(agora::rtc::uid_t userId) override; - - void onContentInspectResult(agora::media::CONTENT_INSPECT_RESULT result) override; - - void onSnapshotTaken(agora::rtc::uid_t uid, const char* filePath, int width, int height, int errCode) override; - - void onClientRoleChanged(agora::rtc::CLIENT_ROLE_TYPE oldRole, agora::rtc::CLIENT_ROLE_TYPE newRole, const agora::rtc::ClientRoleOptions& newRoleOptions) override; - - void onClientRoleChangeFailed(agora::rtc::CLIENT_ROLE_CHANGE_FAILED_REASON reason, agora::rtc::CLIENT_ROLE_TYPE currentRole) override; - - void onAudioDeviceVolumeChanged(agora::rtc::MEDIA_DEVICE_TYPE deviceType, int volume, bool muted) override; - - void onRtmpStreamingStateChanged(const char* url, agora::rtc::RTMP_STREAM_PUBLISH_STATE state, agora::rtc::RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) override; - - void onRtmpStreamingEvent(const char* url, agora::rtc::RTMP_STREAMING_EVENT eventCode) override; - - void onTranscodingUpdated() override; - - void onAudioRoutingChanged(int routing) override; - - void onChannelMediaRelayStateChanged(int state, int code) override; - - void onChannelMediaRelayEvent(int code) override; - - void onLocalPublishFallbackToAudioOnly(bool isFallbackOrRecover) override; - - void onRemoteSubscribeFallbackToAudioOnly(agora::rtc::uid_t uid, bool isFallbackOrRecover) override; - - void onRemoteAudioTransportStats(agora::rtc::uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) override; - - void onRemoteVideoTransportStats(agora::rtc::uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) override; - - void onConnectionStateChanged(agora::rtc::CONNECTION_STATE_TYPE state, agora::rtc::CONNECTION_CHANGED_REASON_TYPE reason) override; - - void onWlAccMessage(agora::rtc::WLACC_MESSAGE_REASON reason, agora::rtc::WLACC_SUGGEST_ACTION action, const char* wlAccMsg) override; - - void onWlAccStats(agora::rtc::WlAccStats currentStats, agora::rtc::WlAccStats averageStats) override; - - void onNetworkTypeChanged(agora::rtc::NETWORK_TYPE type) override; - - void onEncryptionError(agora::rtc::ENCRYPTION_ERROR_TYPE errorType) override; - - void onPermissionError(agora::rtc::PERMISSION_TYPE permissionType) override; - - void onLocalUserRegistered(agora::rtc::uid_t uid, const char* userAccount) override; - - void onUserInfoUpdated(agora::rtc::uid_t uid, const agora::rtc::UserInfo& info) override; - - void onUploadLogResult(const char* requestId, bool success, agora::rtc::UPLOAD_ERROR_REASON reason) override; - - void onAudioSubscribeStateChanged(const char* channel, agora::rtc::uid_t uid, agora::rtc::STREAM_SUBSCRIBE_STATE oldState, agora::rtc::STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) override; - - void onVideoSubscribeStateChanged(const char* channel, agora::rtc::uid_t uid, agora::rtc::STREAM_SUBSCRIBE_STATE oldState, agora::rtc::STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) override; - - void onAudioPublishStateChanged(const char* channel, agora::rtc::STREAM_PUBLISH_STATE oldState, agora::rtc::STREAM_PUBLISH_STATE newState, int elapseSinceLastState) override; - - void onVideoPublishStateChanged(agora::rtc::VIDEO_SOURCE_TYPE source, const char* channel, agora::rtc::STREAM_PUBLISH_STATE oldState, agora::rtc::STREAM_PUBLISH_STATE newState, int elapseSinceLastState) override; - - void onExtensionEvent(const char* provider, const char* extension, const char* key, const char* value) override; - - void onExtensionStarted(const char* provider, const char* extension) override; - - void onExtensionStopped(const char* provider, const char* extension) override; - - void onExtensionError(const char* provider, const char* extension, int error, const char* message) override; - - void onUserAccountUpdated(agora::rtc::uid_t uid, const char* userAccount) override; - - void onLocalVideoTranscoderError(const agora::rtc::TranscodingVideoStream& stream, agora::rtc::VIDEO_TRANSCODER_ERROR error) override; - - void onVideoRenderingTracingResult(agora::rtc::uid_t uid, agora::rtc::MEDIA_TRACE_EVENT currentEvent, agora::rtc::VideoRenderingTracingInfo tracingInfo) override; - -}; - - -class IMetadataObserverClassWrapper : public agora::rtc::IMetadataObserver {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIMetadataObserver : public UObject, public IMetadataObserverClassWrapper -{ - GENERATED_BODY() - -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetMaxMetadataSize GetMaxMetadataSize; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnReadyToSendMetadata OnReadyToSendMetadata; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnMetadataReceived OnMetadataReceived; - int getMaxMetadataSize() override; - - bool onReadyToSendMetadata(agora::rtc::IMetadataObserver::Metadata& metadata, agora::rtc::VIDEO_SOURCE_TYPE source_type) override; - - void onMetadataReceived(const agora::rtc::IMetadataObserver::Metadata& metadata) override; - -}; - - -class IDirectCdnStreamingEventHandlerClassWrapper : public agora::rtc::IDirectCdnStreamingEventHandler {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIDirectCdnStreamingEventHandler : public UObject, public IDirectCdnStreamingEventHandlerClassWrapper -{ - GENERATED_BODY() - -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnDirectCdnStreamingStateChanged OnDirectCdnStreamingStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnDirectCdnStreamingStats OnDirectCdnStreamingStats; - - void onDirectCdnStreamingStateChanged(agora::rtc::DIRECT_CDN_STREAMING_STATE state, agora::rtc::DIRECT_CDN_STREAMING_ERROR error, const char* message) override; - - void onDirectCdnStreamingStats(const agora::rtc::DirectCdnStreamingStats& stats) override; - -}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandlerEx.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandlerEx.h deleted file mode 100644 index 6c7387d7..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraIRtcEngineEventHandlerEx.h +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "URtcEngineProxyCompatibility.h" -#include "AgoraBluePrintPlugin/AgoraIRtcEngineEventHandler.h" -#include "AgoraIRtcEngineEventHandlerEx.generated.h" - - -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnJoinChannelSuccessEx, const FRtcConnection&, connection, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRejoinChannelSuccessEx, const FRtcConnection&, connection, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnAudioQualityEx, const FRtcConnection&, connection, int64, remoteUid, int, quality, int, delay, int, lost); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAudioVolumeIndicationEx, const FRtcConnection&, connection, const TArray&, speakers, int, totalVolume); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLeaveChannelEx, const FRtcConnection&, connection, const FRtcStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRtcStatsEx, const FRtcConnection&, connection, const FRtcStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnNetworkQualityEx, const FRtcConnection&, connection, int64, remoteUid, int, txQuality, int, rxQuality); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnIntraRequestReceivedEx, const FRtcConnection&, connection); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstLocalVideoFramePublishedEx, const FRtcConnection&, connection, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnVideoSourceFrameSizeChangedEx, const FRtcConnection&, connection, EVIDEO_SOURCE_TYPE, sourceType, int, width, int, height); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnFirstRemoteVideoDecodedEx, const FRtcConnection&, connection, int64, remoteUid, int, width, int, height, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FOnVideoSizeChangedEx, const FRtcConnection&, connection, EVIDEO_SOURCE_TYPE, sourceType, int64, uid, int, width, int, height, int, rotation); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnLocalVideoStateChangedEx, const FRtcConnection&, connection, ELOCAL_VIDEO_STREAM_STATE, state, ELOCAL_VIDEO_STREAM_ERROR, errorCode); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRemoteVideoStateChangedEx, const FRtcConnection&, connection, int64, remoteUid, EREMOTE_VIDEO_STATE, state, EREMOTE_VIDEO_STATE_REASON, reason, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnFirstRemoteVideoFrameEx, const FRtcConnection&, connection, int64, remoteUid, int, width, int, height, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserJoinedEx, const FRtcConnection&, connection, int64, remoteUid, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserOfflineEx, const FRtcConnection&, connection, int64, remoteUid, EUSER_OFFLINE_REASON_TYPE, reason); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserMuteAudioEx, const FRtcConnection&, connection, int64, remoteUid, bool, muted); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserMuteVideoEx, const FRtcConnection&, connection, int64, remoteUid, bool, muted); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserEnableVideoEx, const FRtcConnection&, connection, int64, remoteUid, bool, enabled); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserEnableLocalVideoEx, const FRtcConnection&, connection, int64, remoteUid, bool, enabled); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserStateChangedEx, const FRtcConnection&, connection, int64, remoteUid, int, state); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalAudioStatsEx, const FRtcConnection&, connection, const FLocalAudioStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRemoteAudioStatsEx, const FRtcConnection&, connection, const FRemoteAudioStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLocalVideoStatsEx, const FRtcConnection&, connection, const FLocalVideoStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRemoteVideoStatsEx, const FRtcConnection&, connection, const FRemoteVideoStats&, stats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnConnectionLostEx, const FRtcConnection&, connection); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnConnectionInterruptedEx, const FRtcConnection&, connection); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnConnectionBannedEx, const FRtcConnection&, connection); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FOnStreamMessageEx, const FRtcConnection&, connection, int64, remoteUid, int, streamId, const FString, data, int64, length, int64, sentTs); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FOnStreamMessageErrorEx, const FRtcConnection&, connection, int64, remoteUid, int, streamId, int, code, int, missed, int, cached); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRequestTokenEx, const FRtcConnection&, connection); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnLicenseValidationFailureEx, const FRtcConnection&, connection, ELICENSE_ERROR_TYPE, reason); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnTokenPrivilegeWillExpireEx, const FRtcConnection&, connection, const FString, token); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFirstLocalAudioFramePublishedEx, const FRtcConnection&, connection, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnFirstRemoteAudioFrameEx, const FRtcConnection&, connection, int64, userId, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnFirstRemoteAudioDecodedEx, const FRtcConnection&, connection, int64, uid, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnLocalAudioStateChangedEx, const FRtcConnection&, connection, ELOCAL_AUDIO_STREAM_STATE, state, ELOCAL_AUDIO_STREAM_ERROR, error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRemoteAudioStateChangedEx, const FRtcConnection&, connection, int64, remoteUid, EREMOTE_AUDIO_STATE, state, EREMOTE_AUDIO_STATE_REASON, reason, int, elapsed); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnActiveSpeakerEx, const FRtcConnection&, connection, int64, uid); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnClientRoleChangedEx, const FRtcConnection&, connection, ECLIENT_ROLE_TYPE, oldRole, ECLIENT_ROLE_TYPE, newRole, const FClientRoleOptions&, newRoleOptions); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnClientRoleChangeFailedEx, const FRtcConnection&, connection, ECLIENT_ROLE_CHANGE_FAILED_REASON, reason, ECLIENT_ROLE_TYPE, currentRole); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRemoteAudioTransportStatsEx, const FRtcConnection&, connection, int64, remoteUid, int, delay, int, lost, int, rxKBitRate); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRemoteVideoTransportStatsEx, const FRtcConnection&, connection, int64, remoteUid, int, delay, int, lost, int, rxKBitRate); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnConnectionStateChangedEx, const FRtcConnection&, connection, ECONNECTION_STATE_TYPE, state, ECONNECTION_CHANGED_REASON_TYPE, reason); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnWlAccMessageEx, const FRtcConnection&, connection, EWLACC_MESSAGE_REASON, reason, EWLACC_SUGGEST_ACTION, action, const FString, wlAccMsg); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnWlAccStatsEx, const FRtcConnection&, connection, FWlAccStats, currentStats, FWlAccStats, averageStats); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnNetworkTypeChangedEx, const FRtcConnection&, connection, FENUMWRAP_NETWORK_TYPE, type); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnEncryptionErrorEx, const FRtcConnection&, connection, EENCRYPTION_ERROR_TYPE, errorType); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnUploadLogResultEx, const FRtcConnection&, connection, const FString, requestId, bool, success, EUPLOAD_ERROR_REASON, reason); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnUserAccountUpdatedEx, const FRtcConnection&, connection, int64, remoteUid, const FString, userAccount); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FOnSnapshotTakenEx, const FRtcConnection&, connection, int64, uid, const FString, filePath, int, width, int, height, int, errCode); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnVideoRenderingTracingResultEx, const FRtcConnection&, connection, int64, uid, EMEDIA_TRACE_EVENT, currentEvent, FVideoRenderingTracingInfo, tracingInfo); - -class IRtcEngineEventHandlerExClassWrapper : public agora::rtc::IRtcEngineEventHandlerEx {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIRtcEngineEventHandlerEx : public UObject, public IRtcEngineEventHandlerExClassWrapper -{ - - GENERATED_BODY() - -public: - using IRtcEngineEventHandlerEx::eventHandlerType; - - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnJoinChannelSuccessEx OnJoinChannelSuccessEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRejoinChannelSuccessEx OnRejoinChannelSuccessEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioQualityEx OnAudioQualityEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnAudioVolumeIndicationEx OnAudioVolumeIndicationEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLeaveChannelEx OnLeaveChannelEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRtcStatsEx OnRtcStatsEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnNetworkQualityEx OnNetworkQualityEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnIntraRequestReceivedEx OnIntraRequestReceivedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstLocalVideoFramePublishedEx OnFirstLocalVideoFramePublishedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoSourceFrameSizeChangedEx OnVideoSourceFrameSizeChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstRemoteVideoDecodedEx OnFirstRemoteVideoDecodedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoSizeChangedEx OnVideoSizeChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalVideoStateChangedEx OnLocalVideoStateChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteVideoStateChangedEx OnRemoteVideoStateChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstRemoteVideoFrameEx OnFirstRemoteVideoFrameEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserJoinedEx OnUserJoinedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserOfflineEx OnUserOfflineEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserMuteAudioEx OnUserMuteAudioEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserMuteVideoEx OnUserMuteVideoEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserEnableVideoEx OnUserEnableVideoEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserEnableLocalVideoEx OnUserEnableLocalVideoEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserStateChangedEx OnUserStateChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalAudioStatsEx OnLocalAudioStatsEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteAudioStatsEx OnRemoteAudioStatsEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalVideoStatsEx OnLocalVideoStatsEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteVideoStatsEx OnRemoteVideoStatsEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnConnectionLostEx OnConnectionLostEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnConnectionInterruptedEx OnConnectionInterruptedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnConnectionBannedEx OnConnectionBannedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnStreamMessageEx OnStreamMessageEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnStreamMessageErrorEx OnStreamMessageErrorEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRequestTokenEx OnRequestTokenEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLicenseValidationFailureEx OnLicenseValidationFailureEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnTokenPrivilegeWillExpireEx OnTokenPrivilegeWillExpireEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstLocalAudioFramePublishedEx OnFirstLocalAudioFramePublishedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstRemoteAudioFrameEx OnFirstRemoteAudioFrameEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFirstRemoteAudioDecodedEx OnFirstRemoteAudioDecodedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalAudioStateChangedEx OnLocalAudioStateChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteAudioStateChangedEx OnRemoteAudioStateChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnActiveSpeakerEx OnActiveSpeakerEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnClientRoleChangedEx OnClientRoleChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnClientRoleChangeFailedEx OnClientRoleChangeFailedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteAudioTransportStatsEx OnRemoteAudioTransportStatsEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteVideoTransportStatsEx OnRemoteVideoTransportStatsEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnConnectionStateChangedEx OnConnectionStateChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnWlAccMessageEx OnWlAccMessageEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnWlAccStatsEx OnWlAccStatsEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnNetworkTypeChangedEx OnNetworkTypeChangedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnEncryptionErrorEx OnEncryptionErrorEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUploadLogResultEx OnUploadLogResultEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnUserAccountUpdatedEx OnUserAccountUpdatedEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnSnapshotTakenEx OnSnapshotTakenEx; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnVideoRenderingTracingResultEx OnVideoRenderingTracingResultEx; - - void onJoinChannelSuccess(const agora::rtc::RtcConnection& connection, int elapsed) override; - - void onRejoinChannelSuccess(const agora::rtc::RtcConnection& connection, int elapsed) override; - - void onAudioQuality(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int quality, unsigned short delay, unsigned short lost) override; - - void onAudioVolumeIndication(const agora::rtc::RtcConnection& connection, const agora::rtc::AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) override; - - void onLeaveChannel(const agora::rtc::RtcConnection& connection, const agora::rtc::RtcStats& stats) override; - - void onRtcStats(const agora::rtc::RtcConnection& connection, const agora::rtc::RtcStats& stats) override; - - void onNetworkQuality(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int txQuality, int rxQuality) override; - - void onIntraRequestReceived(const agora::rtc::RtcConnection& connection) override; - - void onFirstLocalVideoFramePublished(const agora::rtc::RtcConnection& connection, int elapsed) override; - - void onFirstRemoteVideoDecoded(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int width, int height, int elapsed) override; - - void onVideoSizeChanged(const agora::rtc::RtcConnection& connection, agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::rtc::uid_t uid, int width, int height, int rotation) override; - - void onLocalVideoStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::LOCAL_VIDEO_STREAM_STATE state, agora::rtc::LOCAL_VIDEO_STREAM_ERROR errorCode) override; - - void onRemoteVideoStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::REMOTE_VIDEO_STATE state, agora::rtc::REMOTE_VIDEO_STATE_REASON reason, int elapsed) override; - - void onFirstRemoteVideoFrame(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int width, int height, int elapsed) override; - - void onUserJoined(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int elapsed) override; - - void onUserOffline(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::USER_OFFLINE_REASON_TYPE reason) override; - - void onUserMuteAudio(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, bool muted) override; - - void onUserMuteVideo(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, bool muted) override; - - void onUserEnableVideo(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, bool enabled) override; - - void onUserEnableLocalVideo(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, bool enabled) override; - - void onUserStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, uint32_t state) override; - - void onLocalAudioStats(const agora::rtc::RtcConnection& connection, const agora::rtc::LocalAudioStats& stats) override; - - void onRemoteAudioStats(const agora::rtc::RtcConnection& connection, const agora::rtc::RemoteAudioStats& stats) override; - - void onLocalVideoStats(const agora::rtc::RtcConnection& connection, const agora::rtc::LocalVideoStats& stats) override; - - void onRemoteVideoStats(const agora::rtc::RtcConnection& connection, const agora::rtc::RemoteVideoStats& stats) override; - - void onConnectionLost(const agora::rtc::RtcConnection& connection) override; - - void onConnectionInterrupted(const agora::rtc::RtcConnection& connection) override; - - void onConnectionBanned(const agora::rtc::RtcConnection& connection) override; - - void onStreamMessage(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int streamId, const char* data, size_t length, uint64_t sentTs) override; - - void onStreamMessageError(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, int streamId, int code, int missed, int cached) override; - - void onRequestToken(const agora::rtc::RtcConnection& connection) override; - - void onLicenseValidationFailure(const agora::rtc::RtcConnection& connection, agora::LICENSE_ERROR_TYPE reason) override; - - void onTokenPrivilegeWillExpire(const agora::rtc::RtcConnection& connection, const char* token) override; - - void onFirstLocalAudioFramePublished(const agora::rtc::RtcConnection& connection, int elapsed) override; - - void onFirstRemoteAudioFrame(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t userId, int elapsed) override; - - void onFirstRemoteAudioDecoded(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t uid, int elapsed) override; - - void onLocalAudioStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::LOCAL_AUDIO_STREAM_STATE state, agora::rtc::LOCAL_AUDIO_STREAM_ERROR error) override; - - void onRemoteAudioStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, agora::rtc::REMOTE_AUDIO_STATE state, agora::rtc::REMOTE_AUDIO_STATE_REASON reason, int elapsed) override; - - void onActiveSpeaker(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t uid) override; - - void onClientRoleChanged(const agora::rtc::RtcConnection& connection, agora::rtc::CLIENT_ROLE_TYPE oldRole, agora::rtc::CLIENT_ROLE_TYPE newRole, const agora::rtc::ClientRoleOptions& newRoleOptions) override; - - void onClientRoleChangeFailed(const agora::rtc::RtcConnection& connection, agora::rtc::CLIENT_ROLE_CHANGE_FAILED_REASON reason, agora::rtc::CLIENT_ROLE_TYPE currentRole) override; - - void onRemoteAudioTransportStats(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) override; - - void onRemoteVideoTransportStats(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) override; - - void onConnectionStateChanged(const agora::rtc::RtcConnection& connection, agora::rtc::CONNECTION_STATE_TYPE state, agora::rtc::CONNECTION_CHANGED_REASON_TYPE reason) override; - - void onWlAccMessage(const agora::rtc::RtcConnection& connection, agora::rtc::WLACC_MESSAGE_REASON reason, agora::rtc::WLACC_SUGGEST_ACTION action, const char* wlAccMsg) override; - - void onWlAccStats(const agora::rtc::RtcConnection& connection, agora::rtc::WlAccStats currentStats, agora::rtc::WlAccStats averageStats) override; - - void onNetworkTypeChanged(const agora::rtc::RtcConnection& connection, agora::rtc::NETWORK_TYPE type) override; - - void onEncryptionError(const agora::rtc::RtcConnection& connection, agora::rtc::ENCRYPTION_ERROR_TYPE errorType) override; - - void onUploadLogResult(const agora::rtc::RtcConnection& connection, const char* requestId, bool success, agora::rtc::UPLOAD_ERROR_REASON reason) override; - - void onUserAccountUpdated(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t remoteUid, const char* userAccount) override; - - void onSnapshotTaken(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t uid, const char* filePath, int width, int height, int errCode) override; - - void onVideoRenderingTracingResult(const agora::rtc::RtcConnection& connection, agora::rtc::uid_t uid, agora::rtc::MEDIA_TRACE_EVENT currentEvent, agora::rtc::VideoRenderingTracingInfo tracingInfo) override; -}; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraMediaRecorder.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraMediaRecorder.h deleted file mode 100644 index 45f2e705..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraMediaRecorder.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "URtcEngineProxyCompatibility.h" -#include "AgoraBluePrintPlugin/IMediaRecorderObserver.h" -#include "AgoraMediaRecorder.generated.h" -UENUM(BlueprintType) -enum class EMediaRecorderContainerFormat : uint8 { - - FORMAT_NULL = 0, - FORMAT_MP4 = 1, -}; - -UENUM(BlueprintType) -enum class EMediaRecorderStreamType : uint8 { - - STREAM_TYPE_NULL = 0, - - STREAM_TYPE_AUDIO = 0x01, - - STREAM_TYPE_VIDEO = 0x02, - - STREAM_TYPE_BOTH = STREAM_TYPE_AUDIO | STREAM_TYPE_VIDEO, -}; - -USTRUCT(BlueprintType) -struct FMediaRecorderConfiguration -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaRecorderConfiguration") - FString storagePath = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaRecorderConfiguration") - EMediaRecorderContainerFormat containerFormat = EMediaRecorderContainerFormat::FORMAT_MP4; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaRecorderConfiguration") - EMediaRecorderStreamType streamType = EMediaRecorderStreamType::STREAM_TYPE_BOTH; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaRecorderConfiguration") - int maxDurationMs = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|MediaRecorderConfiguration") - int recorderInfoUpdateInterval = 0; -}; -/** - * - */ -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIMediaRecorder : public UObject -{ - GENERATED_BODY() - -public: - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaRecorder") - int SetMediaRecorderObserver(UIMediaRecorderObserver* callback); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaRecorder") - int StartRecording(FMediaRecorderConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|IMediaRecorder") - int StopRecording(); - void SetMediaRecorder(agora::rtc::IMediaRecorder* mediaRecorder); - agora::rtc::IMediaRecorder* GetMediaRecorder() { return MediaRecorder; } -private: - agora::rtc::IMediaRecorder* MediaRecorder; -}; - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraRtcEngine.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraRtcEngine.h deleted file mode 100644 index f09dc8e6..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraRtcEngine.h +++ /dev/null @@ -1,690 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "URtcEngineProxyCompatibility.h" -#include "CoreMinimal.h" -#include "GameFramework/Actor.h" -#include "IVideoDeviceManager.h" -#include "AgoraAudioDeviceManager.h" -#include "AgoraMediaRecorder.h" -#include "AgoraMediaPlayer.h" -#include "IAudioEncodedFrameObserver.h" -#include "IFrameObserver.h" -#include "string.h" -#include "AgoraCppPlugin/include/RtcEngineProxy.h" -#include "AgoraRtcEngine.generated.h" - - -UCLASS() -class AGORAPLUGIN_API UIScreenCaptureSourceList : public UObject -{ - GENERATED_BODY() -public: - - UFUNCTION(BlueprintCallable, Category = "Agora|ScreenCaptureSourceList") - int64 GetCount(); - UFUNCTION(BlueprintCallable, Category = "Agora|ScreenCaptureSourceList") - FScreenCaptureSourceInfo GetSourceInfo(int64 index); - UFUNCTION(BlueprintCallable, Category = "Agora|ScreenCaptureSourceList") - void Release(); - -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) -public: - void SetScreenCaptureList(agora::rtc::IScreenCaptureSourceList* sourcelist); -private: - agora::rtc::IScreenCaptureSourceList* sourceListNative; -#endif -}; - - -class RtcEngineProxyClassWrapper : public agora::rtc::ue::RtcEngineProxy {}; - -/** - * - */ -UCLASS(Blueprintable) -class AGORAPLUGIN_API UAgoraRtcEngine : public UObject, public RtcEngineProxyClassWrapper -{ - GENERATED_BODY() -public: - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - UObject* QueryInterface(EINTERFACE_ID_TYPE iid); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - void Release(bool sync); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int Initialize(const FRtcEngineContext& context); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int InitializeEx(const FRtcEngineContextEx& context); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - FString GetVersion(int build); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - FString GetErrorDescription(int code); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int QueryCodecCapability(TArray codecInfo); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int JoinChannel(FString token, FString channelId, int64 uid, const FChannelMediaOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateChannelMediaOptions(const FChannelMediaOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int LeaveChannel(const FLeaveChannelOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int RenewToken(FString token); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetChannelProfile(ECHANNEL_PROFILE_TYPE profile); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetClientRole(ECLIENT_ROLE_TYPE clientroletype, FClientRoleOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartEchoTest(const FEchoTestConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopEchoTest(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableMultiCamera(bool enabled, const FCameraCapturerConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableVideo(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int DisableVideo(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartPreview(EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopPreview(EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartLastmileProbeTest(const FLastmileProbeConfig& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopLastmileProbeTest(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVideoEncoderConfiguration(const FVideoEncoderConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetBeautyEffectOptions(bool enabled, const FBeautyOptions& options, EMEDIA_SOURCE_TYPE type); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLowlightEnhanceOptions(bool enabled, const FLowlightEnhanceOptions& options, EMEDIA_SOURCE_TYPE type); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVideoDenoiserOptions(bool enabled, const FVideoDenoiserOptions& options, EMEDIA_SOURCE_TYPE type); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetColorEnhanceOptions(bool enabled, const FColorEnhanceOptions& options, EMEDIA_SOURCE_TYPE type); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableVirtualBackground(bool enabled, FVirtualBackgroundSource backgroundSource, FSegmentationProperty segproperty, EMEDIA_SOURCE_TYPE type); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetupRemoteVideo(const FVideoCanvas& canvas); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetupLocalVideo(const FVideoCanvas& canvas); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVideoScenario(EVIDEO_APPLICATION_SCENARIO_TYPE scenarioType); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableAudio(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int DisableAudio(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAudioProfile(EAUDIO_PROFILE_TYPE profile = EAUDIO_PROFILE_TYPE::AUDIO_PROFILE_DEFAULT, EAUDIO_SCENARIO_TYPE scenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAudioScenario(EAUDIO_SCENARIO_TYPE scenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableLocalAudio(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteLocalAudioStream(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteAllRemoteAudioStreams(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetDefaultMuteAllRemoteAudioStreams(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteRemoteAudioStream(int64 uid, bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteLocalVideoStream(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableLocalVideo(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteAllRemoteVideoStreams(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetDefaultMuteAllRemoteVideoStreams(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteRemoteVideoStream(int64 uid, bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteVideoStreamType(int64 uid, EVIDEO_STREAM_TYPE streamType); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteVideoSubscriptionOptions(int64 uid, const FVideoSubscriptionOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteDefaultVideoStreamType(EVIDEO_STREAM_TYPE streamType); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableAudioVolumeIndication(int interval, int smooth, bool reportVad); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartAudioRecording(const FAudioRecordingConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int RegisterAudioEncodedFrameObserver(const FAudioEncodedFrameObserverConfig& config, UIAudioEncodedFrameObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopAudioRecording(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - UIMediaPlayer* CreateMediaPlayer(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int DestroyMediaPlayer(UIMediaPlayer* media_player); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - UIMediaRecorder* CreateMediaRecorder(FRecorderStreamInfo info); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int DestroyMediaRecorder(UIMediaRecorder* mediaRecorder); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartAudioMixing(FString filePath, bool loopback, int cycle, int startPos = 0); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopAudioMixing(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PauseAudioMixing(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ResumeAudioMixing(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SelectAudioTrack(int index); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetAudioTrackCount(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustAudioMixingVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustAudioMixingPublishVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetAudioMixingPublishVolume(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustAudioMixingPlayoutVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetAudioMixingPlayoutVolume(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetAudioMixingDuration(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetAudioMixingCurrentPosition(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAudioMixingPosition(int pos); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAudioMixingDualMonoMode(EAUDIO_MIXING_DUAL_MONO_MODE mode); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAudioMixingPitch(int pitch); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetEffectsVolume(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetEffectsVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PreloadEffect(int soundId, FString filePath, int startPos); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PlayEffect(int soundId, FString filePath, int loopCount, float pitch, float pan, int gain, bool publish, int startPos); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PlayAllEffects(int loopCount, float pitch, float pan, int gain, bool publish); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetVolumeOfEffect(int soundId); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVolumeOfEffect(int soundId, int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PauseEffect(int soundId); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PauseAllEffects(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ResumeEffect(int soundId); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ResumeAllEffects(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopEffect(int soundId); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopAllEffects(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UnloadEffect(int soundId); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UnloadAllEffects(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetEffectDuration(FString filePath); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetEffectPosition(int soundId, int pos); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetEffectCurrentPosition(int soundId); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableSoundPositionIndication(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteVoicePosition(int64 uid, float pan, float gain); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableSpatialAudio(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteUserSpatialAudioParams(int64 uid, const FSpatialAudioParams& params); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVoiceBeautifierPreset(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAudioEffectPreset(FENUMWRAP_AUDIO_EFFECT_PRESET preset); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVoiceConversionPreset(FENUMWRAP_VOICE_CONVERSION_PRESET preset); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAudioEffectParameters(FENUMWRAP_AUDIO_EFFECT_PRESET preset, int param1, int param2); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVoiceBeautifierParameters(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset, int param1, int param2); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVoiceConversionParameters(FENUMWRAP_VOICE_CONVERSION_PRESET preset, int param1, int param2); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLocalVoicePitch(float pitch); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLocalVoiceFormant(FString formantRatio = "0.0"); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLocalVoiceEqualization(EAUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLocalVoiceReverb(EAUDIO_REVERB_TYPE reverbKey, int value); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLogFile(FString filePath); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLogFilter(int filter); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLogLevel(ELOG_LEVEL level); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLogFileSize(int fileSizeInKBytes); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UploadLogFile(FString& requestId); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLocalRenderMode(ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode = EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_AUTO); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteRenderMode(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLocalVideoMirrorMode(EVIDEO_MIRROR_MODE_TYPE mirrorMode); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableDualStreamMode(bool enabled, const FSimulcastStreamConfig& streamConfig); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetDualStreamMode(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableCustomAudioLocalPlayback(int64 trackId, bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRecordingAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetPlaybackAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetMixedAudioFrameParameters(int sampleRate, int channel, int samplesPerCall); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetPlaybackAudioFrameBeforeMixingParameters(int sampleRate, int channel); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableAudioSpectrumMonitor(int intervalInMS); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int DisableAudioSpectrumMonitor(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int RegisterAudioSpectrumObserver(UIAudioSpectrumObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UnregisterAudioSpectrumObserver(UIAudioSpectrumObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustRecordingSignalVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteRecordingSignal(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustPlaybackSignalVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustUserPlaybackSignalVolume(int uid, int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLocalPublishFallbackOption(ESTREAM_FALLBACK_OPTIONS option); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteSubscribeFallbackOption(ESTREAM_FALLBACK_OPTIONS option); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetHighPriorityUserList(TArray uidList, ESTREAM_FALLBACK_OPTIONS option); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableLoopbackRecording(bool enabled, FString deviceName); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustLoopbackSignalVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetLoopbackRecordingVolume(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableInEarMonitoring(bool enabled, int includeAudioFilters); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetInEarMonitoringVolume(int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int LoadExtensionProvider(FString path, bool unload_after_use); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetExtensionProviderProperty(FString provider, FString key, FString value); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableExtension(FString provider, FString extension, bool enable = true, EMEDIA_SOURCE_TYPE type = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetExtensionProperty(FString provider, FString extension, FString key, FString value, EMEDIA_SOURCE_TYPE type = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetExtensionProperty(FString provider, FString extension, FString key, FString value, int buf_len, EMEDIA_SOURCE_TYPE type = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCameraCapturerConfiguration(const FCameraCapturerConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int64 CreateCustomVideoTrack(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int64 CreateCustomEncodedVideoTrack(const FSenderOptions& sender_option); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int DestroyCustomVideoTrack(int64 video_track_id); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int DestroyCustomEncodedVideoTrack(int64 video_track_id); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SwitchCamera(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool IsCameraZoomSupported(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool IsCameraFaceDetectSupported(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool IsCameraTorchSupported(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool IsCameraFocusSupported(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool IsCameraAutoFocusFaceModeSupported(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCameraZoomFactor(float factor); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableFaceDetection(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - float GetCameraMaxZoomFactor(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCameraFocusPositionInPreview(float positionX, float positionY); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCameraTorchOn(bool isOn); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCameraAutoFocusFaceModeEnabled(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool IsCameraExposurePositionSupported(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCameraExposurePosition(float positionXinView, float positionYinView); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool IsCameraAutoExposureFaceModeSupported(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCameraAutoExposureFaceModeEnabled(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetEnableSpeakerphone(bool speakerOn); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool IsSpeakerphoneEnabled(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - UIScreenCaptureSourceList* GetScreenCaptureSources(FSIZE thumbSize, FSIZE iconSize, bool includeScreen); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAudioSessionOperationRestriction(EAUDIO_SESSION_OPERATION_RESTRICTION restriction); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartScreenCaptureByDisplayId(int displayId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartScreenCaptureByScreenRect(const FRectangle& screenRect, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) __deprecated; - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetAudioDeviceInfo(FDeviceInfo& deviceInfo); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartScreenCaptureByWindowId(int64 windowId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetScreenCaptureContentHint(EVIDEO_CONTENT_HINT contentHint); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateScreenCaptureRegion(const FRectangle& regionRect); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateScreenCaptureParameters(const FScreenCaptureParameters& captureParams); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartScreenCapture(const FScreenCaptureParameters2& captureParams); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int QueryScreenCaptureCapability(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetScreenCaptureScenario(ESCREEN_SCENARIO_TYPE screenScenario); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateScreenCapture(const FScreenCaptureParameters2& captureParams); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopScreenCapture(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetCallId(FString& callId); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int Rate(FString callId, int rating, FString description); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int Complain(FString callId, FString description); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartRtmpStreamWithoutTranscoding(FString url); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartRtmpStreamWithTranscoding(FString url, FLiveTranscoding& transcoding); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateRtmpTranscoding(FLiveTranscoding& transcoding); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopRtmpStream(FString url); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartCameraCapture(EVIDEO_SOURCE_TYPE sourceType, const FCameraCapturerConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopCameraCapture(EVIDEO_SOURCE_TYPE sourceType); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType, const FScreenCaptureConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartLocalVideoTranscoder(const FLocalTranscoderConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateLocalTranscoderConfiguration(const FLocalTranscoderConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopLocalVideoTranscoder(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCameraDeviceOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetScreenCaptureOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - ECONNECTION_STATE_TYPE GetConnectionState(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool RegisterEventHandler(UIRtcEngineEventHandler* eventHandler); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool RegisterEventHandlerEx(UIRtcEngineEventHandlerEx* eventHandler); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool UnregisterEventHandler(UIRtcEngineEventHandler* eventHandler); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - bool UnregisterEventHandlerEx(UIRtcEngineEventHandlerEx* eventHandler); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteUserPriority(int64 uid, EPRIORITY_TYPE userPriority); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int RegisterPacketObserver(UIPacketObserver* observer); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetEncryptionMode(FString encryptionMode); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetEncryptionSecret(FString secret); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableEncryption(bool enabled, const FEncryptionConfig& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int CreateDataStream(int& streamId, const FDataStreamConfig& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SendStreamMessage(int streamId, FString data); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AddVideoWatermark(FString watermarkUrl, const FWatermarkOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ClearVideoWatermarks(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PauseAudio(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ResumeAudio(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableWebSdkInteroperability(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SendCustomReportMessage(FString id, FString category, FString event, FString label, int value); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int RegisterMediaMetadataObserver(UIMetadataObserver* observer, FENUMWRAP_METADATA_TYPE type); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UnregisterMediaMetadataObserver(UIMetadataObserver* observer, FENUMWRAP_METADATA_TYPE type); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartAudioFrameDump(FString channel_id, int64 user_id, FString location, FString uuid, FString passwd, int64 duration_ms, bool auto_upload); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAINSMode(bool enabled, EAUDIO_AINS_MODE mode); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int RegisterLocalUserAccount(FString appId, FString userAccount); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int JoinChannelWithUserAccount(FString token, FString channelId, FString userAccount, const FChannelMediaOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int JoinChannelWithUserAccountEx(FString token, FString channelId, FString userAccount, const FChannelMediaOptions& options, UIRtcEngineEventHandler* eventHandler); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetUserInfoByUserAccount(FString userAccount, FUserInfo& userInfo); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetUserInfoByUid(int64 uid, FUserInfo& userInfo); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartOrUpdateChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartOrUpdateChannelMediaRelayEx(const FChannelMediaRelayConfiguration& configuration, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration) __deprecated; - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration) __deprecated; - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopChannelMediaRelay(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PauseAllChannelMediaRelay(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ResumeAllChannelMediaRelay(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetDirectCdnStreamingAudioConfiguration(EAUDIO_PROFILE_TYPE profile); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetDirectCdnStreamingVideoConfiguration(const FVideoEncoderConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartDirectCdnStreaming(UIDirectCdnStreamingEventHandler* eventHandler, FString publishUrl, FDirectCdnStreamingMediaOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopDirectCdnStreaming(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateDirectCdnStreamingMediaOptions(const FDirectCdnStreamingMediaOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartRhythmPlayer(FString sound1, FString sound2, const FAgoraRhythmPlayerConfig& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopRhythmPlayer(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ConfigRhythmPlayer(const FAgoraRhythmPlayerConfig& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int TakeSnapshot(int64 uid, FString filePath); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableContentInspect(bool enabled, FContentInspectConfig& config); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustCustomAudioPublishVolume(int64 trackId, int volume); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustCustomAudioPlayoutVolume(int64 trackId, int volume); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetCloudProxy(ECLOUD_PROXY_TYPE proxyType); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetLocalAccessPoint(const FLocalAccessPointConfiguration& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAdvancedAudioOptions(const FAdvancedAudioOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetAVSyncSource(FString channelId, int64 uid); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableVideoImageSource(bool enable, const FImageTrackOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int JoinChannelEx(FString token, const FRtcConnection& connection, const FChannelMediaOptions& options, UIRtcEngineEventHandler* eventHandler); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int LeaveChannelEx(const FRtcConnection& connection, const FLeaveChannelOptions& options); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateChannelMediaOptionsEx(const FChannelMediaOptions& options, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetVideoEncoderConfigurationEx(const FVideoEncoderConfiguration& config, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetupRemoteVideoEx(const FVideoCanvas& canvas, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteRemoteAudioStreamEx(int64 uid, bool mute, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteRemoteVideoStreamEx(int64 uid, bool mute, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteVideoStreamTypeEx(int64 uid, EVIDEO_STREAM_TYPE streamType, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteVideoSubscriptionOptionsEx(int64 uid, const FVideoSubscriptionOptions& options, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteVoicePositionEx(int64 uid, float pan, float gain, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteUserSpatialAudioParamsEx(int64 uid, const FSpatialAudioParams& params, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetRemoteRenderModeEx(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableLoopbackRecordingEx(const FRtcConnection& connection, bool enabled, FString deviceName); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - ECONNECTION_STATE_TYPE GetConnectionStateEx(const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableEncryptionEx(const FRtcConnection& connection, bool enabled, const FEncryptionConfig& config); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int CreateDataStreamEx(int& streamId, const FDataStreamConfig& config, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SendStreamMessageEx(int streamId, FString data, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AddVideoWatermarkEx(FString watermarkUrl, const FWatermarkOptions& options, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ClearVideoWatermarkEx(const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SendCustomReportMessageEx(FString id, FString category, FString event, FString label, int value, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableAudioVolumeIndicationEx(int interval, int smooth, bool reportVad, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetUserInfoByUserAccountEx(FString userAccount, FUserInfo& userInfo, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetUserInfoByUidEx(int64 uid, FUserInfo& userInfo, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableDualStreamModeEx(bool enabled, const FSimulcastStreamConfig& streamConfig, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetDualStreamModeEx(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableWirelessAccelerate(bool enabled); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int TakeSnapshotEx(const FRtcConnection& connection, int64 uid, FString filePath); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteLocalAudioStreamEx(bool mute, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteLocalVideoStreamEx(bool mute, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteAllRemoteAudioStreamsEx(bool mute, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int MuteAllRemoteVideoStreamsEx(bool mute, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetSubscribeAudioBlocklist(TArray uidList, int uidNumber); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetSubscribeAudioBlocklistEx(TArray uidList, int uidNumber, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetSubscribeAudioAllowlist(TArray uidList, int uidNumber); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetSubscribeAudioAllowlistEx(TArray uidList, int uidNumber, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetSubscribeVideoBlocklist(TArray uidList, int uidNumber); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetSubscribeVideoBlocklistEx(TArray uidList, int uidNumber, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetSubscribeVideoAllowlist(TArray uidList, int uidNumber); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetSubscribeVideoAllowlistEx(TArray uidList, int uidNumber, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int AdjustUserPlaybackSignalVolumeEx(int64 uid, int volume, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartRtmpStreamWithoutTranscodingEx(FString url, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartRtmpStreamWithTranscodingEx(FString url, const FLiveTranscoding& transcoding, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateRtmpTranscodingEx(const FLiveTranscoding& transcoding, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopRtmpStreamEx(FString url, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartChannelMediaRelayEx(const FChannelMediaRelayConfiguration& configuration, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int UpdateChannelMediaRelayEx(const FChannelMediaRelayConfiguration& configuration, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StopChannelMediaRelayEx(const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int PauseAllChannelMediaRelayEx(const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int ResumeAllChannelMediaRelayEx(const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetParameters(FString parameters); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartMediaRenderingTracing(); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int StartMediaRenderingTracingEx(const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int EnableInstantMediaRendering(); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - FString GetNtpWallTimeInMs(); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetHeadphoneEQPreset(FENUMWRAP_HEADPHONE_EQUALIZER_PRESET preset); - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetHeadphoneEQParameters(int lowGain, int highGain); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int SetEarMonitoringAudioFrameParameters(int sampleRate, int channel, ERAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int64 GetCurrentMonotonicTimeInMs(); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int RegisterExtension(FString provider, FString extension, EMEDIA_SOURCE_TYPE type); - - UFUNCTION(BlueprintCallable, Category = "Agora|RtcEngineProxy") - int GetNetworkType(); - -private: - UIVideoDeviceManager* videoDeviceManager; - UIAudioDeviceManager* audioDeviceManager; - class UILocalSpatialAudioEngine* spatialAudioEngine; - UIMediaRecorder* mediaRecorder; - UIMediaPlayer* mediaPlayer; - UIScreenCaptureSourceList* screenCaptureSourceList; - -}; - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraSpatialAudio.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraSpatialAudio.h deleted file mode 100644 index 0dfed598..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/AgoraSpatialAudio.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "URtcEngineProxyCompatibility.h" -#include "AgoraBluePrintPlugin/AgoraRtcEngine.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "Kismet/KismetMathLibrary.h" -#include "AgoraSpatialAudio.generated.h" - -USTRUCT(BlueprintType) -struct FLocalSpatialAudioConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalSpatialAudioConfig") - UAgoraRtcEngine* rtcEngine = nullptr; -}; - -USTRUCT(BlueprintType) -struct FRemoteVoicePositionInfo -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVoicePositionInfo") - FVector position = FVector(0,0,0); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVoicePositionInfo") - FVector forward = FVector(0, 0, 0); -}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UILocalSpatialAudioEngine : public UObject -{ - GENERATED_BODY() -public: - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int Initialize(FLocalSpatialAudioConfig& config); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int UpdateRemotePosition(int64 uid, FRemoteVoicePositionInfo& posInfo); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int UpdateRemotePositionEx(int64 uid, FRemoteVoicePositionInfo& posInfo, FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int RemoveRemotePosition(int64 uid); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int RemoveRemotePositionEx(int64 uid, FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int ClearRemotePositions(); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int ClearRemotePositionsEx(FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int SetRemoteAudioAttenuation(int64 uid, bool forceSet, FString attenuation = "0.0"); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - void Release(); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int SetMaxAudioRecvCount(int maxCount); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int SetAudioRecvRange(float range); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int SetDistanceUnit(float unit); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int UpdateSelfPosition(FVector position, FVector axisForward, FVector axisRight, FVector axisUp); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int UpdateSelfPositionEx(FVector position, FVector axisForward, FVector axisRight, FVector axisUp, const FRtcConnection& connection); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int UpdatePlayerPositionInfo(int playerId, const FRemoteVoicePositionInfo& positionInfo); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int SetParameters(FString params); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int MuteLocalAudioStream(bool mute); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int MuteAllRemoteAudioStreams(bool mute); - - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int SetZones(TArray zones); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int SetPlayerAttenuation(int playerId, bool forceSet, FString attenuation = "0.0"); - UFUNCTION(BlueprintCallable, Category = "Agora|ILocalSpatialAudioEngine") - int muteRemoteAudioStream(int64 uid, bool mute); - - void SetLocalSpatialAudioEngine(agora::rtc::ILocalSpatialAudioEngine* localSpatialAudioEngine); -private: - agora::rtc::ILocalSpatialAudioEngine* LocalSpatialAudioEngine; -}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IAudioEncodedFrameObserver.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IAudioEncodedFrameObserver.h deleted file mode 100644 index e5ce3bcd..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IAudioEncodedFrameObserver.h +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "AgoraBluePrintPlugin/URtcEngineProxyCompatibility.h" -#include "IAudioEncodedFrameObserver.generated.h" - -USTRUCT(BlueprintType) -struct FPacket { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Packet") - TArray buffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Packet") - int64 size = 0; -}; - -UENUM(BlueprintType) -enum class EAUDIO_CODEC_TYPE : uint8 { - - AUDIO_CODEC_NULL = 0, - - AUDIO_CODEC_OPUS = 1, - - AUDIO_CODEC_PCMA = 3, - - AUDIO_CODEC_PCMU = 4, - - AUDIO_CODEC_G722 = 5, - - AUDIO_CODEC_AACLC = 8, - - AUDIO_CODEC_HEAAC = 9, - - AUDIO_CODEC_JC1 = 10, - - AUDIO_CODEC_HEAAC2 = 11, - - AUDIO_CODEC_LPCNET = 12, -}; - - -USTRUCT(BlueprintType) -struct FEncodedAudioFrameAdvancedSettings { - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedAudioFrameAdvancedSettings") - bool speech = true; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedAudioFrameAdvancedSettings") - bool sendEvenIfEmpty = true; -}; - - -USTRUCT(BlueprintType) -struct FEncodedAudioFrameInfo { - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedAudioFrameInfo") - EAUDIO_CODEC_TYPE codec = EAUDIO_CODEC_TYPE::AUDIO_CODEC_NULL; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedAudioFrameInfo") - int sampleRateHz = 44100; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedAudioFrameInfo") - int samplesPerChannel = 441; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedAudioFrameInfo") - int numberOfChannels = 1; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedAudioFrameInfo") - FEncodedAudioFrameAdvancedSettings advancedSettings = FEncodedAudioFrameAdvancedSettings(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedAudioFrameInfo") - int64 captureTimeMs = 0; -}; - - - - -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSendAudioPacket, const FPacket&, packet); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSendVideoPacket, const FPacket&, packet); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnReceiveAudioPacket, const FPacket&, packet); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnReceiveVideoPacket, const FPacket&, packet); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnRecordAudioEncodedFrame, const TArray, frameBuffer, int, length, const FEncodedAudioFrameInfo&, audioEncodedFrameInfo); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnPlaybackAudioEncodedFrame, const TArray, frameBuffer, int, length, const FEncodedAudioFrameInfo&, audioEncodedFrameInfo); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnMixedAudioEncodedFrame, const TArray, frameBuffer, int, length, const FEncodedAudioFrameInfo&, audioEncodedFrameInfo); - - -class IPacketObserverClassWrapper : public agora::rtc::IPacketObserver {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIPacketObserver : public UObject, public IPacketObserverClassWrapper -{ - GENERATED_BODY() - -public: - - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnSendAudioPacket OnSendAudioPacket; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnSendVideoPacket OnSendVideoPacket; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnReceiveAudioPacket OnReceiveAudioPacket; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnReceiveVideoPacket OnReceiveVideoPacket; - - bool onSendAudioPacket(agora::rtc::IPacketObserver::Packet& packet) override; - - bool onSendVideoPacket(agora::rtc::IPacketObserver::Packet& packet) override; - - bool onReceiveAudioPacket(agora::rtc::IPacketObserver::Packet& packet) override; - - bool onReceiveVideoPacket(agora::rtc::IPacketObserver::Packet& packet) override; - -}; - - -class IAudioEncodedFrameObserverClassWrapper : public agora::rtc::IAudioEncodedFrameObserver {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIAudioEncodedFrameObserver : public UObject, public IAudioEncodedFrameObserverClassWrapper -{ - GENERATED_BODY() - -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRecordAudioEncodedFrame OnRecordAudioEncoded; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPlaybackAudioEncodedFrame OnPlaybackAudioEncoded; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnMixedAudioEncodedFrame OnMixedAudioEncoded; - - void onRecordAudioEncodedFrame(const uint8_t* frameBuffer, int length, const agora::rtc::EncodedAudioFrameInfo& audioEncodedFrameInfo) override; - - void onPlaybackAudioEncodedFrame(const uint8_t* frameBuffer, int length, const agora::rtc::EncodedAudioFrameInfo& audioEncodedFrameInfo) override; - - void onMixedAudioEncodedFrame(const uint8_t* frameBuffer, int length, const agora::rtc::EncodedAudioFrameInfo& audioEncodedFrameInfo) override; - -}; - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IFrameObserver.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IFrameObserver.h deleted file mode 100644 index 38efd776..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IFrameObserver.h +++ /dev/null @@ -1,359 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "AgoraBluePrintPlugin/URtcEngineProxyCompatibility.h" -#include "IFrameObserver.generated.h" - -UENUM(BlueprintType) -enum class EBYTES_PER_SAMPLE :uint8 { - - TWO_BYTES_PER_NULL = 0, - - TWO_BYTES_PER_SAMPLE = 2, -}; - -USTRUCT(BlueprintType) -struct FAudioPcmFrame { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioPcmFrame") - int64 capture_timestamp = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioPcmFrame") - int64 samples_per_channel_ = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioPcmFrame") - int sample_rate_hz_ = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioPcmFrame") - int64 num_channels_ = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioPcmFrame") - EBYTES_PER_SAMPLE bytes_per_sample = EBYTES_PER_SAMPLE::TWO_BYTES_PER_SAMPLE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioPcmFrame") - /*3840 * sizeof(int16_t)*/ - TArray data_; -}; -UENUM(BlueprintType) -enum class EVIDEO_PIXEL_FORMAT :uint8 { - - VIDEO_PIXEL_DEFAULT = 0, - - VIDEO_PIXEL_I420 = 1, - - VIDEO_PIXEL_BGRA = 2, - - VIDEO_PIXEL_NV21 = 3, - - VIDEO_PIXEL_RGBA = 4, - - VIDEO_PIXEL_NV12 = 8, - - VIDEO_TEXTURE_2D = 10, - - VIDEO_TEXTURE_OES = 11, - - VIDEO_CVPIXEL_NV12 = 12, - - VIDEO_CVPIXEL_I420 = 13, - - VIDEO_CVPIXEL_BGRA = 14, - - VIDEO_PIXEL_I422 = 16, -}; - -USTRUCT(BlueprintType) -struct FVideoFrame { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - EVIDEO_PIXEL_FORMAT type = EVIDEO_PIXEL_FORMAT::VIDEO_PIXEL_BGRA; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int height = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int yStride = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int uStride = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int vStride = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int rotation = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - TArray yBuffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - TArray uBuffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - TArray vBuffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int64 renderTimeMs = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int avsync_type = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - TArray metadata_buffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int metadata_size = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int64 sharedContext = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - int textureId = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - TArray matrix; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - TArray alphaBuffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFrame") - TArray pixelBuffer; -}; - -UENUM(BlueprintType) -enum class EAUDIO_FRAME_TYPE :uint8 { - - FRAME_TYPE_PCM16 = 0, -}; - -USTRUCT(BlueprintType) -struct FAudioFrame { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioFrame") - EAUDIO_FRAME_TYPE type = EAUDIO_FRAME_TYPE::FRAME_TYPE_PCM16; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioFrame") - int samplesPerChannel = 441; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioFrame") - EBYTES_PER_SAMPLE bytesPerSample = EBYTES_PER_SAMPLE::TWO_BYTES_PER_SAMPLE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioFrame") - int channels = 1; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioFrame") - int samplesPerSec = 44100; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioFrame") - TArray buffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioFrame") - int64 renderTimeMs = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioFrame") - int avsync_type = 0; -}; -USTRUCT(BlueprintType) -struct FAudioSpectrumData { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioSpectrumData") - TArray audioSpectrumData; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioSpectrumData") - int dataLength = 0; -}; -USTRUCT(BlueprintType) -struct FUserAudioSpectrumInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserAudioSpectrumInfo") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserAudioSpectrumInfo") - FAudioSpectrumData spectrumData = FAudioSpectrumData(); - -}; -UENUM(BlueprintType) -enum class EVIDEO_FRAME_TYPE :uint8 { - - VIDEO_FRAME_TYPE_BLANK_FRAME = 0, - - VIDEO_FRAME_TYPE_KEY_FRAME = 3, - - VIDEO_FRAME_TYPE_DELTA_FRAME = 4, - - VIDEO_FRAME_TYPE_B_FRAME = 5, - - VIDEO_FRAME_TYPE_DROPPABLE_FRAME = 6, - - VIDEO_FRAME_TYPE_UNKNOW -}; -USTRUCT(BlueprintType) -struct FEncodedVideoFrameInfo { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_GENERIC_H264; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - int height = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - int framesPerSecond = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - EVIDEO_FRAME_TYPE frameType = EVIDEO_FRAME_TYPE::VIDEO_FRAME_TYPE_BLANK_FRAME; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - FENUMWRAP_VIDEO_ORIENTATION rotation = EENUMCUSTOM_VIDEO_ORIENTATION::VIDEO_ORIENTATION_0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - int trackId = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - int64 captureTimeMs = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - int64 decodeTimeMs = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncodedVideoFrameInfo") - EVIDEO_STREAM_TYPE streamType = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; -}; - - -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnPlaybackAudioFrameBeforeMixing, const FString, channelId, int64, uid, const FAudioFrame&, audioFrame); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLocalAudioSpectrum, const FAudioSpectrumData&, data); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRemoteAudioSpectrum, const TArray, spectrums, int, spectrumNumber); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnCaptureVideoFrame, EVIDEO_SOURCE_TYPE, sourceType, const FVideoFrame&, videoFrame); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPreEncodeVideoFrame, EVIDEO_SOURCE_TYPE, sourceType, const FVideoFrame&, videoFrame); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnMediaPlayerVideoFrame, const FVideoFrame&, videoFrame, int, mediaPlayerId); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnRenderVideoFrame, const FString, channelId, int64, remoteUid, const FVideoFrame&, videoFrame); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTranscodedVideoFrame, const FVideoFrame&, videoFrame); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetVideoFrameProcessMode); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetVideoFormatPreference); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetRotationApplied); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetMirrorApplied); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetObservedFramePosition); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FIsExternal); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnRecordAudioFrame, const FString, channelId, const FAudioFrame&, audioFrame); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPlaybackAudioFrame, const FString, channelId, const FAudioFrame&, audioFrame); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnMixedAudioFrame, const FString, channelId, const FAudioFrame&, audioFrame); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetObservedAudioFramePosition); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetPlaybackAudioParams); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetRecordAudioParams); -DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGetMixedAudioParams); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnFrame, const FAudioPcmFrame&, pcmFrame); - - -class IAudioFrameObserverClassWrapper : public agora::media::IAudioFrameObserver {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIAudioFrameObserver : public UObject, public IAudioFrameObserverClassWrapper -{ - GENERATED_BODY() -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPlaybackAudioFrameBeforeMixing OnPlaybackAudioFrameBeforeMixing; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRecordAudioFrame OnRecordAudioFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPlaybackAudioFrame OnPlaybackAudioFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnMixedAudioFrame OnMixedAudioFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetObservedAudioFramePosition GetObservedAudioFramePosition; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetPlaybackAudioParams GetPlaybackAudioParams; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetRecordAudioParams GetRecordAudioParams; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetMixedAudioParams GetMixedAudioParams; - - bool onRecordAudioFrame(const char* channelId, agora::media::IAudioFrameObserverBase::AudioFrame& audioFrame) override; - - bool onPlaybackAudioFrame(const char* channelId, agora::media::IAudioFrameObserverBase::AudioFrame& audioFrame) override; - - bool onMixedAudioFrame(const char* channelId, agora::media::IAudioFrameObserverBase::AudioFrame& audioFrame) override; - - int getObservedAudioFramePosition() override; - - agora::media::IAudioFrameObserverBase::AudioParams getPlaybackAudioParams() override; - - agora::media::IAudioFrameObserverBase::AudioParams getRecordAudioParams() override; - - agora::media::IAudioFrameObserverBase::AudioParams getMixedAudioParams() override; - - bool onPlaybackAudioFrameBeforeMixing(const char* channelId, agora::rtc::uid_t uid, AudioFrame& audioFrame) override; - - bool onEarMonitoringAudioFrame(AudioFrame& audioFrame) override; - - AudioParams getEarMonitoringAudioParams() override; - -}; - -class IAudioPcmFrameSinkClassWrapper : public agora::media::IAudioPcmFrameSink {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIAudioPcmFrameSink : public UObject, public IAudioPcmFrameSinkClassWrapper -{ - GENERATED_BODY() - -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnFrame OnFrame; - - void onFrame(agora::media::base::AudioPcmFrame* frame) override; -}; - - -class IAudioSpectrumObserverClassWrapper : public agora::media::IAudioSpectrumObserver {}; - - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIAudioSpectrumObserver : public UObject, public IAudioSpectrumObserverClassWrapper -{ - GENERATED_BODY() -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnLocalAudioSpectrum OnLocalAudioSpectrum; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRemoteAudioSpectrum OnRemoteAudioSpectrum; - bool onLocalAudioSpectrum(const agora::media::AudioSpectrumData& data) override; - - bool onRemoteAudioSpectrum(const agora::media::UserAudioSpectrumInfo* spectrums, unsigned int spectrumNumber) override; - -}; - - -class IVideoFrameObserverClassWrapper : public agora::media::IVideoFrameObserver {}; - - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIVideoFrameObserver : public UObject, public IVideoFrameObserverClassWrapper -{ - GENERATED_BODY() -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnCaptureVideoFrame OnCaptureVideoFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnPreEncodeVideoFrame OnPreEncodeVideoFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnMediaPlayerVideoFrame OnMediaPlayerVideoFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRenderVideoFrame OnRenderVideoFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnTranscodedVideoFrame OnTranscodedVideoFrame; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetVideoFrameProcessMode GetVideoFrameProcessMode; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetVideoFormatPreference GetVideoFormatPreference; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetRotationApplied GetRotationApplied; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetMirrorApplied GetMirrorApplied; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FGetObservedFramePosition GetObservedFramePosition; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FIsExternal IsExternal; - - - bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::media::base::VideoFrame& videoFrame) override; - - bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE sourceType, agora::media::base::VideoFrame& videoFrame) override; - - bool onMediaPlayerVideoFrame(agora::media::base::VideoFrame& videoFrame, int mediaPlayerId) override; - - bool onRenderVideoFrame(const char* channelId, agora::rtc::uid_t remoteUid, agora::media::base::VideoFrame& videoFrame) override; - - bool onTranscodedVideoFrame(agora::media::base::VideoFrame& videoFrame) override; - - agora::media::IVideoFrameObserver::VIDEO_FRAME_PROCESS_MODE getVideoFrameProcessMode() override; - - agora::media::base::VIDEO_PIXEL_FORMAT getVideoFormatPreference() override; - - bool getRotationApplied() override; - - bool getMirrorApplied() override; - - uint32_t getObservedFramePosition() override; - - bool isExternal() override; - -}; - diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IMediaRecorderObserver.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IMediaRecorderObserver.h deleted file mode 100644 index fd4781b5..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IMediaRecorderObserver.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "AgoraBluePrintPlugin/URtcEngineProxyCompatibility.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "IMediaRecorderObserver.generated.h" - - -DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnRecorderStateChanged, FString, channelId, int64, uid, FENUMWRAP_RecorderState, state, ERecorderErrorCode, error); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnRecorderInfoUpdated, FString, channelId, int64, uid, const FRecorderInfo&, info); - -class IMediaRecorderObserverClassWrapper : public agora::media::IMediaRecorderObserver {}; - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIMediaRecorderObserver : public UObject, public IMediaRecorderObserverClassWrapper -{ - GENERATED_BODY() -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRecorderStateChanged OnRecorderStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnRecorderInfoUpdated OnRecorderInfoUpdated; - void onRecorderStateChanged(const char* channelId, agora::rtc::uid_t uid, agora::media::RecorderState state, agora::media::RecorderErrorCode error) override; - void onRecorderInfoUpdated(const char* channelId, agora::rtc::uid_t uid, const agora::media::RecorderInfo& info) override; - -}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IMediaStreamingSourceObserver.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IMediaStreamingSourceObserver.h deleted file mode 100644 index 6fd79121..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IMediaStreamingSourceObserver.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "AgoraBluePrintPlugin/URtcEngineProxyCompatibility.h" -#include "IMediaStreamingSourceObserver.generated.h" - -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnStateChanged, ESTREAMING_SRC_STATE, state, ESTREAMING_SRC_ERR, err_code); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnOpenDone, ESTREAMING_SRC_ERR, err_code); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSeekDone, ESTREAMING_SRC_ERR, err_code); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnEofOnce, int64, progress_ms, int64, repeat_count); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnProgress, int64, position_ms); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnMetaData, const int64, data, int, length); - -class IMediaStreamingSourceObserverClassWrapper : public agora::rtc::IMediaStreamingSourceObserver {}; - -/** - * - */ -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIMediaStreamingSourceObserver : public UObject, public IMediaStreamingSourceObserverClassWrapper -{ - GENERATED_BODY() -public: - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnStateChanged OnStateChanged; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnOpenDone OnOpenDone; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnSeekDone OnSeekDone; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnEofOnce OnEofOnce; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnProgress OnProgress; - UPROPERTY(BlueprintAssignable, Category = "Agora|Event") - FOnMetaData OnMetaData; - - void onStateChanged(agora::rtc::STREAMING_SRC_STATE state, agora::rtc::STREAMING_SRC_ERR err_code) override; - - void onOpenDone(agora::rtc::STREAMING_SRC_ERR err_code) override; - - void onSeekDone(agora::rtc::STREAMING_SRC_ERR err_code) override; - - void onEofOnce(int64_t progress_ms, int64_t repeat_count) override; - - void onProgress(int64_t position_ms) override; - - void onMetaData(const void* data, int length) override; -}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IVideoDeviceManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IVideoDeviceManager.h deleted file mode 100644 index fbba8a31..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/IVideoDeviceManager.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "URtcEngineProxyCompatibility.h" -#include "AgoraCppPlugin/IAgoraRtcEngine.h" -#include "IVideoDeviceManager.generated.h" - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIVideoDeviceCollection : public UObject -{ - GENERATED_BODY() - -public: - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceCollection") - int GetCount(); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceCollection") - int SetDevice(FString& deviceIdUTF8); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceCollection") - int GetDevice(int index, FString& deviceNameUTF8, FString& deviceIdUTF8); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceCollection") - void Release(); - void SetVideoDeviceCollection(agora::rtc::IVideoDeviceCollection* videoDeviceCollection); -private: - agora::rtc::IVideoDeviceCollection* VideoDeviceCollection; -}; - - -UCLASS(Blueprintable) -class AGORAPLUGIN_API UIVideoDeviceManager : public UObject -{ - GENERATED_BODY() - -public: - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") - UIVideoDeviceCollection* EnumerateVideoDevices(); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") - int SetDevice(FString deviceIdUTF8); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") - int GetDevice(FString& deviceIdUTF8); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") - int NumberOfCapabilities(FString deviceIdUTF8); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") - int GetCapability(FString deviceIdUTF8, int deviceCapabilityNumber, FVideoFormat& capability); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") - int StartDeviceTest(int64 hwnd); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") - int StopDeviceTest(); - UFUNCTION(BlueprintCallable, Category = "Agora|IVideoDeviceManager") - void Release(); - void SetVideoDeviceManager(agora::rtc::IVideoDeviceManager* videoDeviceManager); - agora::rtc::IVideoDeviceManager* GetVideoDeviceManager(); -private: - agora::rtc::IVideoDeviceManager* VideoDeviceManager; - UIVideoDeviceCollection* deviceDevice; -}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/URtcEngineProxyCompatibility.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/URtcEngineProxyCompatibility.h deleted file mode 100644 index 64a39bc0..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/URtcEngineProxyCompatibility.h +++ /dev/null @@ -1,4485 +0,0 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "CoreMinimal.h" -#include "UObject/NoExportTypes.h" -#include "Components/Image.h" -#include "Async/Async.h" -#include "AgoraCppPlugin/include/AgoraHeaderBase.h" -#include "URtcEngineProxyCompatibility.generated.h" - -class UIRtcEngineEventHandler; -class UIRtcEngineEventHandlerEx; -UENUM(BlueprintType) -enum class AGORAOPTIONAL : uint8 { - AGORA_NULL_VALUE = 0, - AGORA_TRUE_VALUE = 1, - AGORA_FALSE_VALUE = 2, -}; - -UENUM(BlueprintType) -enum class EINTERFACE_ID_TYPE : uint8 { - AGORA_IID_NULL = 0, - 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_STATE_SYNC = 13, - AGORA_IID_METACHAT_SERVICE = 14, - AGORA_IID_MUSIC_CONTENT_CENTER = 15, - AGORA_IID_H265_TRANSCODER = 16, -}; -UENUM(BlueprintType) -enum class ECOMPRESSION_PREFERENCE : uint8 { - - PREFER_LOW_LATENCY = 0, - - PREFER_QUALITY = 1, -}; - - -UENUM(BlueprintType) -enum class EENUMCUSTOM_ENCODING_PREFERENCE :uint8 { - - PREFER_AUTO = 0, - - PREFER_SOFTWARE = 1, - - PREFER_HARDWARE = 2, -}; - - -USTRUCT(BlueprintType) -struct FENUMWRAP_ENCODING_PREFERENCE { - GENERATED_BODY() - - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_ENCODING_PREFERENCE") - EENUMCUSTOM_ENCODING_PREFERENCE ValueWrapper = EENUMCUSTOM_ENCODING_PREFERENCE::PREFER_AUTO; - - // default - FENUMWRAP_ENCODING_PREFERENCE() :ValueWrapper(EENUMCUSTOM_ENCODING_PREFERENCE::PREFER_AUTO) {} - - - FENUMWRAP_ENCODING_PREFERENCE(EENUMCUSTOM_ENCODING_PREFERENCE Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_ENCODING_PREFERENCE InValue) { - ValueWrapper = InValue; - } - - int GetRawValue() const { - return ((int)ValueWrapper - 1); - } -}; - - -USTRUCT(BlueprintType) -struct FAdvanceOptions { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvanceOptions") - FENUMWRAP_ENCODING_PREFERENCE encodingPreference = EENUMCUSTOM_ENCODING_PREFERENCE::PREFER_AUTO; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvanceOptions") - ECOMPRESSION_PREFERENCE compressionPreference = ECOMPRESSION_PREFERENCE::PREFER_LOW_LATENCY; -}; - -USTRUCT(BlueprintType) -struct FRtcImage -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") - FString url = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") - int x = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") - int y = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") - int height = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") - int zOrder = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcImage") - float alpha = 0; -}; - - -UENUM(BlueprintType) -enum class ELOG_LEVEL : uint8 { - 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, -}; - -UENUM(BlueprintType) -enum class ECHANNEL_PROFILE_TYPE : uint8 { - CHANNEL_PROFILE_COMMUNICATION = 0, - CHANNEL_PROFILE_LIVE_BROADCASTING = 1, - CHANNEL_PROFILE_GAME = 2, - CHANNEL_PROFILE_CLOUD_GAMING = 3, - CHANNEL_PROFILE_COMMUNICATION_1v1 = 4, -}; - -UENUM(BlueprintType) -enum class EAUDIO_SAMPLE_RATE_TYPE:uint8 { - - AUDIO_SAMPLE_NULL = 0, - - AUDIO_SAMPLE_RATE_32000 = 1, - - AUDIO_SAMPLE_RATE_44100 = 2, - - AUDIO_SAMPLE_RATE_48000 = 3, -}; - - - -UENUM(BlueprintType) -enum class ECLIENT_ROLE_TYPE : uint8 { - CLIENT_ROLE_NULL = 0, - CLIENT_ROLE_BROADCASTER = 1, - CLIENT_ROLE_AUDIENCE = 2, -}; - -UENUM(BlueprintType) -enum class EVIDEO_SOURCE_TYPE : uint8 { - VIDEO_SOURCE_CAMERA_PRIMARY = 0, - VIDEO_SOURCE_CAMERA = VIDEO_SOURCE_CAMERA_PRIMARY, - VIDEO_SOURCE_CAMERA_SECONDARY = 1, - VIDEO_SOURCE_SCREEN_PRIMARY = 2, - VIDEO_SOURCE_SCREEN = VIDEO_SOURCE_SCREEN_PRIMARY, - VIDEO_SOURCE_SCREEN_SECONDARY = 3, - VIDEO_SOURCE_CUSTOM = 4, - VIDEO_SOURCE_MEDIA_PLAYER = 5, - VIDEO_SOURCE_RTC_IMAGE_PNG = 6, - VIDEO_SOURCE_RTC_IMAGE_JPEG = 7, - VIDEO_SOURCE_RTC_IMAGE_GIF = 8, - VIDEO_SOURCE_REMOTE = 9, - VIDEO_SOURCE_TRANSCODED = 10, - VIDEO_SOURCE_CAMERA_THIRD = 11, - VIDEO_SOURCE_CAMERA_FOURTH = 12, - VIDEO_SOURCE_SCREEN_THIRD = 13, - VIDEO_SOURCE_SCREEN_FOURTH = 14, - VIDEO_SOURCE_UNKNOWN = 100, -}; - -UENUM(BlueprintType) -enum class EMEDIA_SOURCE_TYPE : uint8 { - AUDIO_PLAYOUT_SOURCE = 0, - AUDIO_RECORDING_SOURCE = 1, - PRIMARY_CAMERA_SOURCE = 2, - SECONDARY_CAMERA_SOURCE = 3, - PRIMARY_SCREEN_SOURCE = 4, - SECONDARY_SCREEN_SOURCE = 5, - CUSTOM_VIDEO_SOURCE = 6, - MEDIA_PLAYER_SOURCE = 7, - RTC_IMAGE_PNG_SOURCE = 8, - RTC_IMAGE_JPEG_SOURCE = 9, - RTC_IMAGE_GIF_SOURCE = 10, - REMOTE_VIDEO_SOURCE = 11, - TRANSCODED_VIDEO_SOURCE = 12, - UNKNOWN_MEDIA_SOURCE = 100, -}; - -UENUM(BlueprintType) -enum class EAUDIO_PROFILE_TYPE : uint8 { - AUDIO_PROFILE_DEFAULT = 0, - AUDIO_PROFILE_SPEECH_STANDARD = 1, - AUDIO_PROFILE_MUSIC_STANDARD = 2, - AUDIO_PROFILE_MUSIC_STANDARD_STEREO = 3, - AUDIO_PROFILE_MUSIC_HIGH_QUALITY = 4, - AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO = 5, - AUDIO_PROFILE_IOT = 6, - AUDIO_PROFILE_NUM = 7, -}; - -UENUM(BlueprintType) -enum class EAUDIO_SCENARIO_TYPE : uint8 { - AUDIO_SCENARIO_DEFAULT = 0, - AUDIO_SCENARIO_GAME_STREAMING = 3, - AUDIO_SCENARIO_CHATROOM = 5, - AUDIO_SCENARIO_CHORUS = 7, - AUDIO_SCENARIO_MEETING = 8, - AUDIO_SCENARIO_NUM = 9, -}; - -UENUM(BlueprintType) -enum class EVIDEO_STREAM_TYPE : uint8 { - VIDEO_STREAM_HIGH = 0, - VIDEO_STREAM_LOW = 1, -}; - -UENUM(BlueprintType) -enum class EAUDIO_RECORDING_QUALITY_TYPE : uint8 { - AUDIO_RECORDING_QUALITY_LOW = 0, - AUDIO_RECORDING_QUALITY_MEDIUM = 1, - AUDIO_RECORDING_QUALITY_HIGH = 2, - AUDIO_RECORDING_QUALITY_ULTRA_HIGH = 3, -}; - -UENUM(BlueprintType) -enum class EAUDIO_MIXING_DUAL_MONO_MODE : uint8 { - AUDIO_MIXING_DUAL_MONO_AUTO = 0, - AUDIO_MIXING_DUAL_MONO_L = 1, - AUDIO_MIXING_DUAL_MONO_R = 2, - AUDIO_MIXING_DUAL_MONO_MIX = 3, -}; - -UENUM(BlueprintType) -enum EVOICE_BEAUTIFIER_PRESET { - VOICE_BEAUTIFIER_OFF = 0x00000000, - CHAT_BEAUTIFIER_MAGNETIC = 0x01010100, - CHAT_BEAUTIFIER_FRESH = 0x01010200, - CHAT_BEAUTIFIER_VITALITY = 0x01010300, - SINGING_BEAUTIFIER = 0x01020100, - TIMBRE_TRANSFORMATION_VIGOROUS = 0x01030100, - TIMBRE_TRANSFORMATION_DEEP = 0x01030200, - TIMBRE_TRANSFORMATION_MELLOW = 0x01030300, - TIMBRE_TRANSFORMATION_FALSETTO = 0x01030400, - TIMBRE_TRANSFORMATION_FULL = 0x01030500, - TIMBRE_TRANSFORMATION_CLEAR = 0x01030600, - TIMBRE_TRANSFORMATION_RESOUNDING = 0x01030700, - TIMBRE_TRANSFORMATION_RINGING = 0x01030800, - ULTRA_HIGH_QUALITY_VOICE = 0x01040100, -}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET :uint8 { - VOICE_BEAUTIFIER_OFF = 0, - CHAT_BEAUTIFIER_MAGNETIC = 1, - CHAT_BEAUTIFIER_FRESH = 2, - CHAT_BEAUTIFIER_VITALITY = 3, - SINGING_BEAUTIFIER = 4, - TIMBRE_TRANSFORMATION_VIGOROUS = 5, - TIMBRE_TRANSFORMATION_DEEP = 6, - TIMBRE_TRANSFORMATION_MELLOW = 7, - TIMBRE_TRANSFORMATION_FALSETTO = 8, - TIMBRE_TRANSFORMATION_FULL = 9, - TIMBRE_TRANSFORMATION_CLEAR = 10, - TIMBRE_TRANSFORMATION_RESOUNDING = 11, - TIMBRE_TRANSFORMATION_RINGING = 12, - ULTRA_HIGH_QUALITY_VOICE = 13, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_VOICE_BEAUTIFIER_PRESET { - GENERATED_BODY() - - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_VOICE_BEAUTIFIER_PRESET") - EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET ValueWrapper = EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::VOICE_BEAUTIFIER_OFF; - - // default - FENUMWRAP_VOICE_BEAUTIFIER_PRESET() :ValueWrapper(EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::VOICE_BEAUTIFIER_OFF) {} - - - FENUMWRAP_VOICE_BEAUTIFIER_PRESET(EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET InValue) { - ValueWrapper = InValue; - } - - agora::rtc::VOICE_BEAUTIFIER_PRESET GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::VOICE_BEAUTIFIER_OFF: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::VOICE_BEAUTIFIER_OFF; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::CHAT_BEAUTIFIER_MAGNETIC: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::CHAT_BEAUTIFIER_MAGNETIC; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::CHAT_BEAUTIFIER_FRESH: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::CHAT_BEAUTIFIER_FRESH; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::CHAT_BEAUTIFIER_VITALITY: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::CHAT_BEAUTIFIER_VITALITY; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::SINGING_BEAUTIFIER: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::SINGING_BEAUTIFIER; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_VIGOROUS: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_VIGOROUS; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_DEEP: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_DEEP; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_MELLOW: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_MELLOW; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_FALSETTO: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_FALSETTO; - - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_FULL: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_FULL; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_CLEAR: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_CLEAR; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_RESOUNDING: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_RESOUNDING; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_RINGING: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::TIMBRE_TRANSFORMATION_RINGING; - case EENUMCUSTOM_VOICE_BEAUTIFIER_PRESET::ULTRA_HIGH_QUALITY_VOICE: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::ULTRA_HIGH_QUALITY_VOICE; - - default: - return agora::rtc::VOICE_BEAUTIFIER_PRESET::VOICE_BEAUTIFIER_OFF; - } - } -}; - - -// -//UENUM(BlueprintType) -//enum EAUDIO_EFFECT_PRESET { -// AUDIO_EFFECT_OFF = 0x00000000, -// ROOM_ACOUSTICS_KTV = 0x02010100, -// ROOM_ACOUSTICS_VOCAL_CONCERT = 0x02010200, -// ROOM_ACOUSTICS_STUDIO = 0x02010300, -// ROOM_ACOUSTICS_PHONOGRAPH = 0x02010400, -// ROOM_ACOUSTICS_VIRTUAL_STEREO = 0x02010500, -// ROOM_ACOUSTICS_SPACIAL = 0x02010600, -// ROOM_ACOUSTICS_ETHEREAL = 0x02010700, -// ROOM_ACOUSTICS_3D_VOICE = 0x02010800, -// ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND = 0x02010900, -// VOICE_CHANGER_EFFECT_UNCLE = 0x02020100, -// VOICE_CHANGER_EFFECT_OLDMAN = 0x02020200, -// VOICE_CHANGER_EFFECT_BOY = 0x02020300, -// VOICE_CHANGER_EFFECT_SISTER = 0x02020400, -// VOICE_CHANGER_EFFECT_GIRL = 0x02020500, -// VOICE_CHANGER_EFFECT_PIGKING = 0x02020600, -// VOICE_CHANGER_EFFECT_HULK = 0x02020700, -// STYLE_TRANSFORMATION_RNB = 0x02030100, -// STYLE_TRANSFORMATION_POPULAR = 0x02030200, -// PITCH_CORRECTION = 0x02040100, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_AUDIO_EFFECT_PRESET : uint8 { - AUDIO_EFFECT_OFF = 0, - ROOM_ACOUSTICS_KTV = 1, - ROOM_ACOUSTICS_VOCAL_CONCERT = 2, - ROOM_ACOUSTICS_STUDIO = 3, - ROOM_ACOUSTICS_PHONOGRAPH = 4, - ROOM_ACOUSTICS_VIRTUAL_STEREO = 5, - ROOM_ACOUSTICS_SPACIAL = 6, - ROOM_ACOUSTICS_ETHEREAL = 7, - ROOM_ACOUSTICS_3D_VOICE = 8, - ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND = 9, - VOICE_CHANGER_EFFECT_UNCLE = 10, - VOICE_CHANGER_EFFECT_OLDMAN = 11, - VOICE_CHANGER_EFFECT_BOY = 12, - VOICE_CHANGER_EFFECT_SISTER = 13, - VOICE_CHANGER_EFFECT_GIRL = 14, - VOICE_CHANGER_EFFECT_PIGKING = 15, - VOICE_CHANGER_EFFECT_HULK = 16, - STYLE_TRANSFORMATION_RNB = 17, - STYLE_TRANSFORMATION_POPULAR = 18, - PITCH_CORRECTION = 19 -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_AUDIO_EFFECT_PRESET { - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_AUDIO_EFFECT_PRESET") - EENUMCUSTOM_AUDIO_EFFECT_PRESET ValueWrapper = EENUMCUSTOM_AUDIO_EFFECT_PRESET::AUDIO_EFFECT_OFF; - - // default - FENUMWRAP_AUDIO_EFFECT_PRESET() :ValueWrapper(EENUMCUSTOM_AUDIO_EFFECT_PRESET::AUDIO_EFFECT_OFF) {} - - FENUMWRAP_AUDIO_EFFECT_PRESET(EENUMCUSTOM_AUDIO_EFFECT_PRESET Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_AUDIO_EFFECT_PRESET InValue) { - ValueWrapper = InValue; - } - - agora::rtc::AUDIO_EFFECT_PRESET GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::AUDIO_EFFECT_OFF: - return agora::rtc::AUDIO_EFFECT_PRESET::AUDIO_EFFECT_OFF; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_KTV: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_KTV; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_VOCAL_CONCERT: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_VOCAL_CONCERT; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_STUDIO: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_STUDIO; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_PHONOGRAPH: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_PHONOGRAPH; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_VIRTUAL_STEREO: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_VIRTUAL_STEREO; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_SPACIAL: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_SPACIAL; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_ETHEREAL: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_ETHEREAL; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_3D_VOICE: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_3D_VOICE; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND: - return agora::rtc::AUDIO_EFFECT_PRESET::ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_UNCLE: - return agora::rtc::AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_UNCLE; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_OLDMAN: - return agora::rtc::AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_OLDMAN; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_BOY: - return agora::rtc::AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_BOY; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_SISTER: - return agora::rtc::AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_SISTER; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_GIRL: - return agora::rtc::AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_GIRL; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_PIGKING: - return agora::rtc::AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_PIGKING; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_HULK: - return agora::rtc::AUDIO_EFFECT_PRESET::VOICE_CHANGER_EFFECT_HULK; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::STYLE_TRANSFORMATION_RNB: - return agora::rtc::AUDIO_EFFECT_PRESET::STYLE_TRANSFORMATION_RNB; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::STYLE_TRANSFORMATION_POPULAR: - return agora::rtc::AUDIO_EFFECT_PRESET::STYLE_TRANSFORMATION_POPULAR; - case EENUMCUSTOM_AUDIO_EFFECT_PRESET::PITCH_CORRECTION: - return agora::rtc::AUDIO_EFFECT_PRESET::PITCH_CORRECTION; - default: - return agora::rtc::AUDIO_EFFECT_PRESET::AUDIO_EFFECT_OFF; - } - } -}; - -//UENUM(BlueprintType) -//enum EVOICE_CONVERSION_PRESET { -// -// VOICE_CONVERSION_OFF = 0x00000000, -// VOICE_CHANGER_NEUTRAL = 0x03010100, -// VOICE_CHANGER_SWEET = 0x03010200, -// VOICE_CHANGER_SOLID = 0x03010300, -// VOICE_CHANGER_BASS = 0x03010400, -// VOICE_CHANGER_CARTOON = 0x03010500, -// VOICE_CHANGER_CHILDLIKE = 0x03010600, -// VOICE_CHANGER_PHONE_OPERATOR = 0x03010700, -// VOICE_CHANGER_MONSTER = 0x03010800, -// VOICE_CHANGER_TRANSFORMERS = 0x03010900, -// VOICE_CHANGER_GROOT = 0x03010A00, -// VOICE_CHANGER_DARTH_VADER = 0x03010B00, -// VOICE_CHANGER_IRON_LADY = 0x03010C00, -// VOICE_CHANGER_SHIN_CHAN = 0x03010D00, -// VOICE_CHANGER_GIRLISH_MAN = 0x03010E00, -// VOICE_CHANGER_CHIPMUNK = 0x03010F00, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_VOICE_CONVERSION_PRESET :uint8 { - - VOICE_CONVERSION_OFF = 0, - VOICE_CHANGER_NEUTRAL = 1, - VOICE_CHANGER_SWEET = 2, - VOICE_CHANGER_SOLID = 3, - VOICE_CHANGER_BASS = 4, - VOICE_CHANGER_CARTOON = 5, - VOICE_CHANGER_CHILDLIKE = 6, - VOICE_CHANGER_PHONE_OPERATOR = 7, - VOICE_CHANGER_MONSTER = 8, - VOICE_CHANGER_TRANSFORMERS = 9, - VOICE_CHANGER_GROOT = 10, - VOICE_CHANGER_DARTH_VADER = 11, - VOICE_CHANGER_IRON_LADY = 12, - VOICE_CHANGER_SHIN_CHAN = 13, - VOICE_CHANGER_GIRLISH_MAN = 14, - VOICE_CHANGER_CHIPMUNK = 15, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_VOICE_CONVERSION_PRESET -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_VOICE_CONVERSION_PRESET") - EENUMCUSTOM_VOICE_CONVERSION_PRESET ValueWrapper = EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CONVERSION_OFF; - - // default - FENUMWRAP_VOICE_CONVERSION_PRESET() :ValueWrapper(EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CONVERSION_OFF) {} - - FENUMWRAP_VOICE_CONVERSION_PRESET(EENUMCUSTOM_VOICE_CONVERSION_PRESET Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_VOICE_CONVERSION_PRESET InValue) { - ValueWrapper = InValue; - } - - agora::rtc::VOICE_CONVERSION_PRESET GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CONVERSION_OFF: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CONVERSION_OFF; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_NEUTRAL: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_NEUTRAL; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_SWEET: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_SWEET; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_SOLID: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_SOLID; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_BASS: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_BASS; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_CARTOON: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_CARTOON; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_CHILDLIKE: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_CHILDLIKE; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_PHONE_OPERATOR: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_PHONE_OPERATOR; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_MONSTER: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_MONSTER; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_TRANSFORMERS: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_TRANSFORMERS; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_GROOT: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_GROOT; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_IRON_LADY: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_IRON_LADY; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_SHIN_CHAN: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_SHIN_CHAN; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_GIRLISH_MAN: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_GIRLISH_MAN; - case EENUMCUSTOM_VOICE_CONVERSION_PRESET::VOICE_CHANGER_CHIPMUNK: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CHANGER_CHIPMUNK; - default: - return agora::rtc::VOICE_CONVERSION_PRESET::VOICE_CONVERSION_OFF; - } - } -}; - - -UENUM(BlueprintType) -enum class EAUDIO_EQUALIZATION_BAND_FREQUENCY : uint8 { - AUDIO_EQUALIZATION_BAND_31 = 0, - AUDIO_EQUALIZATION_BAND_62 = 1, - AUDIO_EQUALIZATION_BAND_125 = 2, - AUDIO_EQUALIZATION_BAND_250 = 3, - AUDIO_EQUALIZATION_BAND_500 = 4, - AUDIO_EQUALIZATION_BAND_1K = 5, - AUDIO_EQUALIZATION_BAND_2K = 6, - AUDIO_EQUALIZATION_BAND_4K = 7, - AUDIO_EQUALIZATION_BAND_8K = 8, - AUDIO_EQUALIZATION_BAND_16K = 9, -}; - -UENUM(BlueprintType) -enum class EAUDIO_REVERB_TYPE : uint8 { - AUDIO_REVERB_DRY_LEVEL = 0, - AUDIO_REVERB_WET_LEVEL = 1, - AUDIO_REVERB_ROOM_SIZE = 2, - AUDIO_REVERB_WET_DELAY = 3, - AUDIO_REVERB_STRENGTH = 4, -}; - -UENUM(BlueprintType) -enum class ERENDER_MODE_TYPE : uint8 { - RENDER_NULL = 0, - RENDER_MODE_HIDDEN = 1, - RENDER_MODE_FIT = 2, - RENDER_MODE_ADAPTIVE = 3, -}; - -UENUM(BlueprintType) -enum class EVIDEO_MIRROR_MODE_TYPE : uint8 { - VIDEO_MIRROR_MODE_AUTO = 0, - VIDEO_MIRROR_MODE_ENABLED = 1, - VIDEO_MIRROR_MODE_DISABLED = 2, -}; - -//UENUM(BlueprintType) -//enum ESIMULCAST_STREAM_MODE { -// AUTO_SIMULCAST_STREAM = -1, -// DISABLE_SIMULCAST_STREM = 0, -// ENABLE_SIMULCAST_STREAM = 1, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_SIMULCAST_STREAM_MODE : uint8 { - AUTO_SIMULCAST_STREAM = 0, - DISABLE_SIMULCAST_STREAM = 1, - ENABLE_SIMULCAST_STREAM = 2, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_SIMULCAST_STREAM_MODE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_SIMULCAST_STREAM_MODE") - EENUMCUSTOM_SIMULCAST_STREAM_MODE ValueWrapper = EENUMCUSTOM_SIMULCAST_STREAM_MODE::AUTO_SIMULCAST_STREAM; - - // default - FENUMWRAP_SIMULCAST_STREAM_MODE() :ValueWrapper(EENUMCUSTOM_SIMULCAST_STREAM_MODE::AUTO_SIMULCAST_STREAM) {} - - FENUMWRAP_SIMULCAST_STREAM_MODE(EENUMCUSTOM_SIMULCAST_STREAM_MODE Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_SIMULCAST_STREAM_MODE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::SIMULCAST_STREAM_MODE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_SIMULCAST_STREAM_MODE::AUTO_SIMULCAST_STREAM: - return agora::rtc::SIMULCAST_STREAM_MODE::AUTO_SIMULCAST_STREAM; - case EENUMCUSTOM_SIMULCAST_STREAM_MODE::DISABLE_SIMULCAST_STREAM: - return agora::rtc::SIMULCAST_STREAM_MODE::DISABLE_SIMULCAST_STREAM; - case EENUMCUSTOM_SIMULCAST_STREAM_MODE::ENABLE_SIMULCAST_STREAM: - return agora::rtc::SIMULCAST_STREAM_MODE::ENABLE_SIMULCAST_STREAM; - default: - return agora::rtc::SIMULCAST_STREAM_MODE::AUTO_SIMULCAST_STREAM; - } - } -}; - -UENUM(BlueprintType) -enum class ERAW_AUDIO_FRAME_OP_MODE_TYPE : uint8 { - RAW_AUDIO_FRAME_OP_MODE_READ_ONLY = 0, - RAW_AUDIO_FRAME_OP_MODE_READ_WRITE = 2, -}; - -UENUM(BlueprintType) -enum class ESTREAM_FALLBACK_OPTIONS : uint8 { - STREAM_FALLBACK_OPTION_DISABLED = 0, - STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW = 1, - STREAM_FALLBACK_OPTION_AUDIO_ONLY = 2, -}; -UENUM(BlueprintType) -enum class ELICENSE_ERROR_TYPE : uint8 { - - LICENSE_ERR_NULL = 0, - - LICENSE_ERR_INVALID = 1, - - LICENSE_ERR_EXPIRE = 2, - - LICENSE_ERR_MINUTES_EXCEED = 3, - - LICENSE_ERR_LIMITED_PERIOD = 4, - - LICENSE_ERR_DIFF_DEVICES = 5, - - LICENSE_ERR_INTERNAL = 99, -}; - - - -UENUM(BlueprintType) -enum class EAUDIO_SESSION_OPERATION_RESTRICTION : uint8 { - AUDIO_SESSION_OPERATION_RESTRICTION_NONE = 0, - AUDIO_SESSION_OPERATION_RESTRICTION_SET_CATEGORY = 1, - AUDIO_SESSION_OPERATION_RESTRICTION_CONFIGURE_SESSION = 1 << 1, - AUDIO_SESSION_OPERATION_RESTRICTION_DEACTIVATE_SESSION = 1 << 2, - AUDIO_SESSION_OPERATION_RESTRICTION_ALL = 1 << 7, -}; - -UENUM(BlueprintType) -enum class EVIDEO_CONTENT_HINT : uint8 { - CONTENT_HINT_NONE, - CONTENT_HINT_MOTION, - CONTENT_HINT_DETAILS, -}; - -UENUM(BlueprintType) -enum class ESCREEN_SCENARIO_TYPE : uint8 { - SCREEN_SCENARIO_NULL = 0, - SCREEN_SCENARIO_DOCUMENT = 1, - SCREEN_SCENARIO_GAMING = 2, - SCREEN_SCENARIO_VIDEO = 3, - SCREEN_SCENARIO_RDC = 4, -}; - -UENUM(BlueprintType) -enum class EVIDEO_APPLICATION_SCENARIO_TYPE : uint8 { - APPLICATION_SCENARIO_GENERAL = 0, - APPLICATION_SCENARIO_VIDEO = 1, -}; - -//UENUM(BlueprintType) -//enum EVIDEO_ORIENTATION { -// VIDEO_ORIENTATION_0 = 0, -// VIDEO_ORIENTATION_90 = 90, -// VIDEO_ORIENTATION_180 = 180, -// VIDEO_ORIENTATION_270 = 270, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_VIDEO_ORIENTATION : uint8 { - VIDEO_ORIENTATION_0 = 0, - VIDEO_ORIENTATION_90 = 1, - VIDEO_ORIENTATION_180 = 2, - VIDEO_ORIENTATION_270 = 3, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_VIDEO_ORIENTATION { - GENERATED_BODY() - - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_VIDEO_ORIENTATION") - EENUMCUSTOM_VIDEO_ORIENTATION ValueWrapper = EENUMCUSTOM_VIDEO_ORIENTATION::VIDEO_ORIENTATION_0; - - // default - FENUMWRAP_VIDEO_ORIENTATION() :ValueWrapper(EENUMCUSTOM_VIDEO_ORIENTATION::VIDEO_ORIENTATION_0) {} - - - FENUMWRAP_VIDEO_ORIENTATION(EENUMCUSTOM_VIDEO_ORIENTATION Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_VIDEO_ORIENTATION InValue) { - ValueWrapper = InValue; - } - - agora::rtc::VIDEO_ORIENTATION GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_VIDEO_ORIENTATION::VIDEO_ORIENTATION_0: - return agora::rtc::VIDEO_ORIENTATION::VIDEO_ORIENTATION_0; - case EENUMCUSTOM_VIDEO_ORIENTATION::VIDEO_ORIENTATION_90: - return agora::rtc::VIDEO_ORIENTATION::VIDEO_ORIENTATION_90; - case EENUMCUSTOM_VIDEO_ORIENTATION::VIDEO_ORIENTATION_180: - return agora::rtc::VIDEO_ORIENTATION::VIDEO_ORIENTATION_180; - case EENUMCUSTOM_VIDEO_ORIENTATION::VIDEO_ORIENTATION_270: - return agora::rtc::VIDEO_ORIENTATION::VIDEO_ORIENTATION_270; - default: - return agora::rtc::VIDEO_ORIENTATION::VIDEO_ORIENTATION_0; - } - } -}; - - -UENUM(BlueprintType) -enum class ECONNECTION_STATE_TYPE : uint8 { - CONNECTION_NULL = 0, - CONNECTION_STATE_DISCONNECTED = 1, - CONNECTION_STATE_CONNECTING = 2, - CONNECTION_STATE_CONNECTED = 3, - CONNECTION_STATE_RECONNECTING = 4, - CONNECTION_STATE_FAILED = 5, -}; - -UENUM(BlueprintType) -enum class EPRIORITY_TYPE : uint8 { - PRIORITY_NULL = 0, - PRIORITY_HIGH = 50, - PRIORITY_NORMAL = 100, -}; - -UENUM(BlueprintType) -enum class ECLOUD_PROXY_TYPE : uint8 { - NONE_PROXY = 0, - UDP_PROXY = 1, - TCP_PROXY = 2, -}; -UENUM(BlueprintType) -enum class EAUDIENCE_LATENCY_LEVEL_TYPE : uint8 { - AUDIENCE_NULL = 0, - AUDIENCE_LATENCY_LEVEL_LOW_LATENCY = 1, - AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY = 2, -}; - -USTRUCT(BlueprintType) -struct FLogUploadServerInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogUploadServerInfo") - FString serverDomain = ""; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogUploadServerInfo") - FString serverPath = ""; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogUploadServerInfo") - int serverPort = 0; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogUploadServerInfo") - bool serverHttps = true; -}; - -USTRUCT(BlueprintType) -struct FAdvancedConfigInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvancedConfigInfo") - FLogUploadServerInfo logUploadServer = FLogUploadServerInfo(); -}; - -UENUM(BlueprintType) -enum class EVIDEO_CODEC_TYPE : uint8 { - - VIDEO_CODEC_NONE = 0, - - VIDEO_CODEC_VP8 = 1, - - VIDEO_CODEC_H264 = 2, - - VIDEO_CODEC_H265 = 3, - - VIDEO_CODEC_GENERIC = 6, - - VIDEO_CODEC_GENERIC_H264 = 7, - - VIDEO_CODEC_AV1 = 12, - - VIDEO_CODEC_VP9 = 13, - - VIDEO_CODEC_GENERIC_JPEG = 20, -}; - -UENUM(BlueprintType) -enum class EORIENTATION_MODE : uint8 { - - ORIENTATION_MODE_ADAPTIVE = 0, - - ORIENTATION_MODE_FIXED_LANDSCAPE = 1, - - ORIENTATION_MODE_FIXED_PORTRAIT = 2, -}; - -UENUM(BlueprintType) -enum class EDEGRADATION_PREFERENCE : uint8 { - - MAINTAIN_QUALITY = 0, - - MAINTAIN_FRAMERATE = 1, - - MAINTAIN_BALANCED = 2, - - MAINTAIN_RESOLUTION = 3, - - DISABLED = 100, -}; - -UENUM(BlueprintType) -enum class ELOW_LIGHT_ENHANCE_MODE : uint8 { - - LOW_LIGHT_ENHANCE_AUTO = 0, - - LOW_LIGHT_ENHANCE_MANUAL = 1, -}; - -UENUM(BlueprintType) -enum class ELOW_LIGHT_ENHANCE_LEVEL : uint8 { - - LOW_LIGHT_ENHANCE_LEVEL_HIGH_QUALITY = 0, - - LOW_LIGHT_ENHANCE_LEVEL_FAST = 1, -}; - -UENUM(BlueprintType) -enum class ETHREAD_PRIORITY_TYPE : uint8 { - - LOWEST = 0, - - LOW = 1, - - NORMAL = 2, - - HIGH = 3, - - HIGHEST = 4, - - CRITICAL = 5, -}; - -UENUM(BlueprintType) -enum class EMEDIA_TRACE_EVENT : uint8 { - - MEDIA_TRACE_EVENT_VIDEO_RENDERED = 0, - - MEDIA_TRACE_EVENT_VIDEO_DECODED = 1, -}; - -USTRUCT(BlueprintType) -struct FVideoRenderingTracingInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") - int elapsedTime = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") - int start2JoinChannel = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") - int join2JoinSuccess = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") - int joinSuccess2RemoteJoined = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") - int remoteJoined2SetView = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") - int remoteJoined2UnmuteVideo = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoRenderingTracingInfo") - int remoteJoined2PacketReceived = 0; -}; - - - -USTRUCT(BlueprintType) -struct FLogConfig { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogConfig") - FString filePath = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogConfig") - int64 fileSizeInKB = 1024; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LogConfig") - ELOG_LEVEL level = ELOG_LEVEL::LOG_LEVEL_INFO; -}; - -USTRUCT(BlueprintType) -struct FRecorderStreamInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RecorderStreamInfo") - FString channelId = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RecorderStreamInfo") - int64 uid = 0; - -}; - - - -//UENUM(BlueprintType) -//enum EAREA_CODE { -// -// AREA_CODE_NULL = 0, -// -// AREA_CODE_CN = 0x00000001, -// -// AREA_CODE_NA = 0x00000002, -// -// AREA_CODE_EU = 0x00000004, -// -// AREA_CODE_AS = 0x00000008, -// -// AREA_CODE_JP = 0x00000010, -// -// AREA_CODE_IN = 0x00000020, -// -// AREA_CODE_GLOB = (0xFFFFFFFF), -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_AREA_CODE : uint8 { - - AREA_CODE_NULL = 0, - - AREA_CODE_CN = 1, - - AREA_CODE_NA = 2, - - AREA_CODE_EU = 3, - - AREA_CODE_AS = 4, - - AREA_CODE_JP = 5, - - AREA_CODE_IN = 6, - - AREA_CODE_GLOB = 255, -}; - - -USTRUCT(BlueprintType) -struct FENUMWRAP_AREA_CODE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_AREA_CODE") - EENUMCUSTOM_AREA_CODE ValueWrapper = EENUMCUSTOM_AREA_CODE::AREA_CODE_GLOB; - - // default - FENUMWRAP_AREA_CODE() :ValueWrapper(EENUMCUSTOM_AREA_CODE::AREA_CODE_GLOB) {} - - FENUMWRAP_AREA_CODE(EENUMCUSTOM_AREA_CODE Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_AREA_CODE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::AREA_CODE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_AREA_CODE::AREA_CODE_CN: - return agora::rtc::AREA_CODE::AREA_CODE_CN; - case EENUMCUSTOM_AREA_CODE::AREA_CODE_NA: - return agora::rtc::AREA_CODE::AREA_CODE_NA; - case EENUMCUSTOM_AREA_CODE::AREA_CODE_EU: - return agora::rtc::AREA_CODE::AREA_CODE_EU; - case EENUMCUSTOM_AREA_CODE::AREA_CODE_AS: - return agora::rtc::AREA_CODE::AREA_CODE_AS; - case EENUMCUSTOM_AREA_CODE::AREA_CODE_JP: - return agora::rtc::AREA_CODE::AREA_CODE_JP; - case EENUMCUSTOM_AREA_CODE::AREA_CODE_IN: - return agora::rtc::AREA_CODE::AREA_CODE_IN; - case EENUMCUSTOM_AREA_CODE::AREA_CODE_GLOB: - return agora::rtc::AREA_CODE::AREA_CODE_GLOB; - default: - return agora::rtc::AREA_CODE::AREA_CODE_GLOB; - } - } -}; - - -USTRUCT(BlueprintType) -struct FRtcEngineContext -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - FString appId = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - UIRtcEngineEventHandler* eventHandler = nullptr; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - int64 context = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - FString license = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - ECHANNEL_PROFILE_TYPE channelProfile = ECHANNEL_PROFILE_TYPE::CHANNEL_PROFILE_LIVE_BROADCASTING; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - EAUDIO_SCENARIO_TYPE audioScenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - bool threadPriority_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - ETHREAD_PRIORITY_TYPE threadPriority = ETHREAD_PRIORITY_TYPE::NORMAL; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - FLogConfig logConfig = FLogConfig(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - FENUMWRAP_AREA_CODE areaCode = EENUMCUSTOM_AREA_CODE::AREA_CODE_GLOB; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - bool useExternalEglContext = false; -}; - - -USTRUCT(BlueprintType) -struct FRtcEngineContextEx -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - FString appId = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - UIRtcEngineEventHandlerEx* eventHandler = nullptr; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - int64 context = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - FString license = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - ECHANNEL_PROFILE_TYPE channelProfile = ECHANNEL_PROFILE_TYPE::CHANNEL_PROFILE_LIVE_BROADCASTING; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - EAUDIO_SCENARIO_TYPE audioScenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - bool threadPriority_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - ETHREAD_PRIORITY_TYPE threadPriority = ETHREAD_PRIORITY_TYPE::NORMAL; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - FLogConfig logConfig = FLogConfig(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - FENUMWRAP_AREA_CODE areaCode = EENUMCUSTOM_AREA_CODE::AREA_CODE_GLOB; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcEngineContext") - bool useExternalEglContext = false; -}; - - - -USTRUCT(BlueprintType) -struct FExtensionInfo { - - GENERATED_BODY(); - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionInfo") - EMEDIA_SOURCE_TYPE mediaSourceType = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionInfo") - int64 remoteUid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionInfo") - FString channelId = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ExtensionInfo") - int64 localUid = 0; -}; - - -USTRUCT(BlueprintType) -struct FChannelMediaOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishCameraTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishSecondaryCameraTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishMicrophoneTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishScreenCaptureVideo = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishScreenCaptureAudio = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishScreenTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishSecondaryScreenTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishCustomAudioTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool publishCustomAudioTrackId_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - int publishCustomAudioTrackId = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishCustomVideoTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishEncodedVideoTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishMediaPlayerAudioTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishMediaPlayerVideoTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishTranscodedVideoTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL autoSubscribeAudio = AGORAOPTIONAL::AGORA_TRUE_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL autoSubscribeVideo = AGORAOPTIONAL::AGORA_TRUE_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL enableAudioRecordingOrPlayout = AGORAOPTIONAL::AGORA_NULL_VALUE; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool publishMediaPlayerId_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - int publishMediaPlayerId = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool clientRoleType_SetValue = true; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - ECLIENT_ROLE_TYPE clientRoleType = ECLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool audienceLatencyLevel_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - EAUDIENCE_LATENCY_LEVEL_TYPE audienceLatencyLevel = EAUDIENCE_LATENCY_LEVEL_TYPE::AUDIENCE_NULL; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool defaultVideoStreamType_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - EVIDEO_STREAM_TYPE defaultVideoStreamType = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool channelProfile_SetValue = true; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - ECHANNEL_PROFILE_TYPE channelProfile = ECHANNEL_PROFILE_TYPE::CHANNEL_PROFILE_LIVE_BROADCASTING; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool audioDelayMs_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - int audioDelayMs = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool mediaPlayerAudioDelayMs_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - int mediaPlayerAudioDelayMs = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool token_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - FString token = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL enableBuiltInMediaEncryption = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL publishRhythmPlayerTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL isInteractiveAudience = AGORAOPTIONAL::AGORA_NULL_VALUE; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool customVideoTrackId_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - int64 customVideoTrackId = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - AGORAOPTIONAL isAudioFilterable = AGORAOPTIONAL::AGORA_NULL_VALUE; -}; - -// Set ChannelMediaOptions Using FAgora_ChannelMediaOptions -#define SET_AGORA_DATA_CHANNELMEDIAOPTIONS_MOBILE(Agora_ChannelMediaOptions,UE_FAgora_ChannelMediaOptions)\ -{\ - if (UE_FAgora_ChannelMediaOptions.publishScreenCaptureVideo != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishScreenCaptureVideo = UE_FAgora_ChannelMediaOptions.publishScreenCaptureVideo == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishScreenCaptureAudio != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishScreenCaptureAudio = UE_FAgora_ChannelMediaOptions.publishScreenCaptureAudio == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_INNER_COMMON(Agora_ChannelMediaOptions,UE_FAgora_ChannelMediaOptions); \ -} - -#define SET_AGORA_DATA_CHANNELMEDIAOPTIONS_NONMOBILE_PLATFORM(Agora_ChannelMediaOptions,UE_FAgora_ChannelMediaOptions) \ -{\ - if (UE_FAgora_ChannelMediaOptions.publishScreenTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishScreenTrack = UE_FAgora_ChannelMediaOptions.publishScreenTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishSecondaryScreenTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishSecondaryScreenTrack = UE_FAgora_ChannelMediaOptions.publishSecondaryScreenTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - SET_AGORA_DATA_CHANNELMEDIAOPTIONS_INNER_COMMON(Agora_ChannelMediaOptions,UE_FAgora_ChannelMediaOptions); \ -} - - -#define SET_AGORA_DATA_CHANNELMEDIAOPTIONS_INNER_COMMON(Agora_ChannelMediaOptions,UE_FAgora_ChannelMediaOptions)\ -{\ - if (UE_FAgora_ChannelMediaOptions.publishCameraTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishCameraTrack = UE_FAgora_ChannelMediaOptions.publishCameraTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishSecondaryCameraTrack != AGORAOPTIONAL::AGORA_NULL_VALUE)\ - { \ - Agora_ChannelMediaOptions.publishSecondaryCameraTrack = UE_FAgora_ChannelMediaOptions.publishSecondaryCameraTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishMicrophoneTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishMicrophoneTrack = UE_FAgora_ChannelMediaOptions.publishMicrophoneTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishCustomAudioTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishCustomAudioTrack = UE_FAgora_ChannelMediaOptions.publishCustomAudioTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishCustomVideoTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishCustomVideoTrack = UE_FAgora_ChannelMediaOptions.publishCustomVideoTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishEncodedVideoTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishEncodedVideoTrack = UE_FAgora_ChannelMediaOptions.publishEncodedVideoTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishMediaPlayerAudioTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishMediaPlayerAudioTrack = UE_FAgora_ChannelMediaOptions.publishMediaPlayerAudioTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishMediaPlayerVideoTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishMediaPlayerVideoTrack = UE_FAgora_ChannelMediaOptions.publishMediaPlayerVideoTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishTranscodedVideoTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishTranscodedVideoTrack = UE_FAgora_ChannelMediaOptions.publishTranscodedVideoTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.autoSubscribeAudio != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.autoSubscribeAudio = UE_FAgora_ChannelMediaOptions.autoSubscribeAudio == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.autoSubscribeVideo != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.autoSubscribeVideo = UE_FAgora_ChannelMediaOptions.autoSubscribeVideo == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.enableAudioRecordingOrPlayout != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.enableAudioRecordingOrPlayout = UE_FAgora_ChannelMediaOptions.enableAudioRecordingOrPlayout == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishMediaPlayerId_SetValue) \ - { \ - Agora_ChannelMediaOptions.publishMediaPlayerId = UE_FAgora_ChannelMediaOptions.publishMediaPlayerId; \ - } \ - if (UE_FAgora_ChannelMediaOptions.clientRoleType_SetValue) \ - { \ - Agora_ChannelMediaOptions.clientRoleType = (agora::rtc::CLIENT_ROLE_TYPE)UE_FAgora_ChannelMediaOptions.clientRoleType; \ - } \ - if (UE_FAgora_ChannelMediaOptions.audienceLatencyLevel_SetValue) \ - { \ - Agora_ChannelMediaOptions.audienceLatencyLevel = (agora::rtc::AUDIENCE_LATENCY_LEVEL_TYPE)UE_FAgora_ChannelMediaOptions.audienceLatencyLevel; \ - } \ - if (UE_FAgora_ChannelMediaOptions.defaultVideoStreamType_SetValue) \ - { \ - Agora_ChannelMediaOptions.defaultVideoStreamType = (agora::rtc::VIDEO_STREAM_TYPE)UE_FAgora_ChannelMediaOptions.defaultVideoStreamType; \ - } \ - if (UE_FAgora_ChannelMediaOptions.channelProfile_SetValue) \ - { \ - Agora_ChannelMediaOptions.channelProfile = (agora::CHANNEL_PROFILE_TYPE)UE_FAgora_ChannelMediaOptions.channelProfile; \ - } \ - if (UE_FAgora_ChannelMediaOptions.audioDelayMs_SetValue) \ - { \ - Agora_ChannelMediaOptions.audioDelayMs = UE_FAgora_ChannelMediaOptions.audioDelayMs; \ - } \ - if (UE_FAgora_ChannelMediaOptions.mediaPlayerAudioDelayMs_SetValue) \ - { \ - Agora_ChannelMediaOptions.mediaPlayerAudioDelayMs = UE_FAgora_ChannelMediaOptions.mediaPlayerAudioDelayMs; \ - } \ - if (UE_FAgora_ChannelMediaOptions.token_SetValue) \ - { \ - std::string Token = TCHAR_TO_UTF8(*UE_FAgora_ChannelMediaOptions.token); \ - \ - Agora_ChannelMediaOptions.token = Token.c_str(); \ - } \ - if (UE_FAgora_ChannelMediaOptions.enableBuiltInMediaEncryption != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.enableBuiltInMediaEncryption = UE_FAgora_ChannelMediaOptions.enableBuiltInMediaEncryption == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.publishRhythmPlayerTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.publishRhythmPlayerTrack = UE_FAgora_ChannelMediaOptions.publishRhythmPlayerTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.isInteractiveAudience != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.isInteractiveAudience = UE_FAgora_ChannelMediaOptions.isInteractiveAudience == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_ChannelMediaOptions.customVideoTrackId_SetValue) \ - { \ - Agora_ChannelMediaOptions.customVideoTrackId = UE_FAgora_ChannelMediaOptions.customVideoTrackId; \ - } \ - if (UE_FAgora_ChannelMediaOptions.isAudioFilterable != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_ChannelMediaOptions.isAudioFilterable = options.isAudioFilterable == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ -} - - - - -USTRUCT(BlueprintType) -struct FLeaveChannelOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LeaveChannelOptions") - AGORAOPTIONAL stopAudioMixing = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LeaveChannelOptions") - AGORAOPTIONAL stopAllEffect = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LeaveChannelOptions") - AGORAOPTIONAL stopMicrophoneRecording = AGORAOPTIONAL::AGORA_NULL_VALUE; -}; - -#define SET_AGORA_DATA_LEAVECHANNELOPTIONS(Agora_LeaveChannelOptions,UE_FAgora_LeaveChannelOptions)\ -{\ - if (UE_FAgora_LeaveChannelOptions.stopAudioMixing != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_LeaveChannelOptions.stopAudioMixing = UE_FAgora_LeaveChannelOptions.stopAudioMixing == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_LeaveChannelOptions.stopAllEffect != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_LeaveChannelOptions.stopAllEffect = UE_FAgora_LeaveChannelOptions.stopAllEffect == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FAgora_LeaveChannelOptions.stopMicrophoneRecording != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_LeaveChannelOptions.stopMicrophoneRecording = UE_FAgora_LeaveChannelOptions.stopMicrophoneRecording == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ -} - - - -USTRUCT(BlueprintType) -struct FClientRoleOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ClientRoleOptions") - EAUDIENCE_LATENCY_LEVEL_TYPE audienceLatencyLevel = EAUDIENCE_LATENCY_LEVEL_TYPE::AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY; -}; - -USTRUCT(BlueprintType) -struct FEchoTestConfiguration -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") - UImage* view = nullptr; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") - bool enableAudio = true; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") - bool enableVideo = true; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") - FString token = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") - FString channelId = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EchoTestConfiguration") - int intervalInSeconds = 2; -}; - - -UENUM(BlueprintType) -enum class EVIDEO_TRANSCODER_ERROR : uint8 { - VT_ERR_OK = 0, - VT_ERR_VIDEO_SOURCE_NOT_READY = 1, - VT_ERR_INVALID_VIDEO_SOURCE_TYPE = 2, - VT_ERR_INVALID_IMAGE_PATH = 3, - VT_ERR_UNSUPPORT_IMAGE_FORMAT = 4, - VT_ERR_INVALID_LAYOUT = 5, - VT_ERR_INTERNAL = 20 - -}; - -USTRUCT(BlueprintType) -struct FLastmileProbeConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") - bool probeUplink = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") - bool probeDownlink = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") - int expectedUplinkBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") - int expectedDownlinkBitrate = 0; -}; - -USTRUCT(BlueprintType) -struct FVideoDimensions { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") - int width = 640; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeConfig") - int height = 480; -}; - -USTRUCT(BlueprintType) -struct FCodecCapInfo { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CodecCapInfo") - EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_GENERIC_H264; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CodecCapInfo") - int codecCapMask = 0; -}; - -USTRUCT(BlueprintType) -struct FVideoEncoderConfiguration -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_GENERIC_H264; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - FVideoDimensions dimensions = FVideoDimensions(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - int frameRate = 15; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - int bitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - int minBitrate = -1; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - EORIENTATION_MODE orientationMode = EORIENTATION_MODE::ORIENTATION_MODE_ADAPTIVE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - EDEGRADATION_PREFERENCE degradationPreference = EDEGRADATION_PREFERENCE::MAINTAIN_QUALITY; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - EVIDEO_MIRROR_MODE_TYPE mirrorMode = EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_DISABLED; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - ECOMPRESSION_PREFERENCE compressionPreference = ECOMPRESSION_PREFERENCE::PREFER_LOW_LATENCY; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoEncoderConfiguration") - FAdvanceOptions advanceOptions = FAdvanceOptions(); -}; - -UENUM(BlueprintType) -enum class ELIGHTENING_CONTRAST_LEVEL : uint8 { - - LIGHTENING_CONTRAST_LOW = 0, - - LIGHTENING_CONTRAST_NORMAL = 1, - - LIGHTENING_CONTRAST_HIGH = 2, -}; - - -USTRUCT(BlueprintType) -struct FBeautyOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") - ELIGHTENING_CONTRAST_LEVEL lighteningContrastLevel = ELIGHTENING_CONTRAST_LEVEL::LIGHTENING_CONTRAST_NORMAL; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") - float lighteningLevel = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") - float smoothnessLevel = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") - float rednessLevel = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|BeautyOptions") - float sharpnessLevel = 0; -}; - -USTRUCT(BlueprintType) -struct FLowlightEnhanceOptions -{ - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LowlightEnhanceOptions") - ELOW_LIGHT_ENHANCE_MODE mode = ELOW_LIGHT_ENHANCE_MODE::LOW_LIGHT_ENHANCE_AUTO; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LowlightEnhanceOptions") - ELOW_LIGHT_ENHANCE_LEVEL level = ELOW_LIGHT_ENHANCE_LEVEL::LOW_LIGHT_ENHANCE_LEVEL_HIGH_QUALITY; -}; -UENUM(BlueprintType) -enum class EVIDEO_DENOISER_MODE : uint8 { - - VIDEO_DENOISER_AUTO = 0, - - VIDEO_DENOISER_MANUAL = 1, -}; - -UENUM(BlueprintType) -enum class EVIDEO_DENOISER_LEVEL : uint8 { - - VIDEO_DENOISER_LEVEL_HIGH_QUALITY = 0, - - VIDEO_DENOISER_LEVEL_FAST = 1, - - VIDEO_DENOISER_LEVEL_STRENGTH = 2, -}; - - -USTRUCT(BlueprintType) -struct FVideoDenoiserOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoDenoiserOptions") - EVIDEO_DENOISER_MODE mode = EVIDEO_DENOISER_MODE::VIDEO_DENOISER_AUTO; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoDenoiserOptions") - EVIDEO_DENOISER_LEVEL level = EVIDEO_DENOISER_LEVEL::VIDEO_DENOISER_LEVEL_HIGH_QUALITY; -}; - - -USTRUCT(BlueprintType) -struct FColorEnhanceOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ColorEnhanceOptions") - float strengthLevel = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ColorEnhanceOptions") - float skinProtectLevel = 0; -}; - - -UENUM(BlueprintType) -enum class EBACKGROUND_SOURCE_TYPE :uint8 { - - BACKGROUND_NULL = 0, - - BACKGROUND_COLOR = 1, - - BACKGROUND_IMG = 2, - - BACKGROUND_BLUR = 3, - - BACKGROUND_VIDEO = 4, -}; - -UENUM(BlueprintType) -enum class EBACKGROUND_BLUR_DEGREE :uint8 { - - BLUR_NULL = 0, - - BLUR_DEGREE_LOW = 1, - - BLUR_DEGREE_MEDIUM = 2, - - BLUR_DEGREE_HIGH = 3, -}; - - -USTRUCT(BlueprintType) -struct FVirtualBackgroundSource -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource") - EBACKGROUND_SOURCE_TYPE background_source_type = EBACKGROUND_SOURCE_TYPE::BACKGROUND_COLOR; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource") - int64 color = 0xffffff; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource") - FString source = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VirtualBackgroundSource") - EBACKGROUND_BLUR_DEGREE blur_degree = EBACKGROUND_BLUR_DEGREE::BLUR_DEGREE_HIGH; -}; -UENUM(BlueprintType) -enum class ESEG_MODEL_TYPE : uint8 { - - SEG_MODEL_NULL, - SEG_MODEL_AI = 1, - SEG_MODEL_GREEN = 2 -}; - -USTRUCT(BlueprintType) -struct FSegmentationProperty -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SegmentationProperty") - ESEG_MODEL_TYPE modelType = ESEG_MODEL_TYPE::SEG_MODEL_AI; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SegmentationProperty") - float greenCapacity = 0.5; -}; - -UENUM(BlueprintType) -enum class EVIDEO_VIEW_SETUP_MODE : uint8 { - - VIDEO_VIEW_SETUP_REPLACE = 0, - - VIDEO_VIEW_SETUP_ADD = 1, - - VIDEO_VIEW_SETUP_REMOVE = 2, -}; -UENUM(BlueprintType) -enum class ETCcMode :uint8 { - - CC_ENABLED, - - CC_DISABLED, -}; - -USTRUCT(BlueprintType) -struct FSenderOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SenderOptions") - ETCcMode ccMode = ETCcMode::CC_ENABLED; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SenderOptions") - EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_GENERIC_H264; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SenderOptions") - int targetBitrate = 6500; -}; - - -USTRUCT(BlueprintType) -struct FRectangle -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Rectangle") - int x = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Rectangle") - int y = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Rectangle") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|Rectangle") - int height = 0; -}; - -USTRUCT(BlueprintType) -struct FVideoCanvas -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - UImage* view = nullptr; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - ERENDER_MODE_TYPE renderMode = ERENDER_MODE_TYPE::RENDER_MODE_HIDDEN; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - EVIDEO_MIRROR_MODE_TYPE mirrorMode = EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_AUTO; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - bool isScreenView = false; - //UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - //void priv; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - int64 priv_size = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - FRectangle cropArea = FRectangle(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") - EVIDEO_VIEW_SETUP_MODE setupMode = EVIDEO_VIEW_SETUP_MODE::VIDEO_VIEW_SETUP_REPLACE; -}; - -USTRUCT(BlueprintType) -struct FVideoSubscriptionOptions -{ - GENERATED_BODY() - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaOptions") - bool type_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoSubscriptionOptions") - EVIDEO_STREAM_TYPE type = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoSubscriptionOptions") - AGORAOPTIONAL encodedFrameOnly = AGORAOPTIONAL::AGORA_NULL_VALUE; -}; - -#define SET_AGORA_DATA_VIDEOSUBSCRIPTIONOPTIONS(Agora_VideoSubscriptionOptions,UE_FVideoSubscriptionOptions) \ -{ \ - if (UE_FVideoSubscriptionOptions.type_SetValue) \ - { \ - Agora_VideoSubscriptionOptions.type = (agora::rtc::VIDEO_STREAM_TYPE)UE_FVideoSubscriptionOptions.type; \ - } \ - \ - if (UE_FVideoSubscriptionOptions.encodedFrameOnly != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_VideoSubscriptionOptions.encodedFrameOnly = UE_FVideoSubscriptionOptions.encodedFrameOnly == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ -} - -UENUM(BlueprintType) -enum class EAUDIO_FILE_RECORDING_TYPE :uint8 { - - AUDIO_FILE_NULL = 0, - - AUDIO_FILE_RECORDING_MIC = 1, - - AUDIO_FILE_RECORDING_PLAYBACK = 2, - - AUDIO_FILE_RECORDING_MIXED = 3, -}; - - -USTRUCT(BlueprintType) -struct FAudioRecordingConfiguration -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") - FString filePath = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") - bool encode = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") - int sampleRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") - EAUDIO_FILE_RECORDING_TYPE fileRecordingType = EAUDIO_FILE_RECORDING_TYPE::AUDIO_FILE_RECORDING_MIXED; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") - EAUDIO_RECORDING_QUALITY_TYPE quality = EAUDIO_RECORDING_QUALITY_TYPE::AUDIO_RECORDING_QUALITY_LOW; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioRecordingConfiguration") - int recordingChannel = 0; -}; - -UENUM(BlueprintType) -enum class EAUDIO_ENCODED_FRAME_OBSERVER_POSITION :uint8 { - - AUDIO_ENCODED_FRAME_NULL = 0, - - AUDIO_ENCODED_FRAME_OBSERVER_POSITION_RECORD = 1, - - AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK = 2, - - AUDIO_ENCODED_FRAME_OBSERVER_POSITION_MIXED = 3, -}; - -//UENUM(BlueprintType) -//enum EENUMCUSTOM_AUDIO_ENCODING_TYPE { -// -// AUDIO_ENCODING_TYPE_AAC_16000_LOW = 0x010101, -// AUDIO_ENCODING_TYPE_AAC_16000_MEDIUM = 0x010102, -// AUDIO_ENCODING_TYPE_AAC_32000_LOW = 0x010201, -// AUDIO_ENCODING_TYPE_AAC_32000_MEDIUM = 0x010202, -// AUDIO_ENCODING_TYPE_AAC_32000_HIGH = 0x010203, -// AUDIO_ENCODING_TYPE_AAC_48000_MEDIUM = 0x010302, -// AUDIO_ENCODING_TYPE_AAC_48000_HIGH = 0x010303, -// AUDIO_ENCODING_TYPE_OPUS_16000_LOW = 0x020101, -// AUDIO_ENCODING_TYPE_OPUS_16000_MEDIUM = 0x020102, -// AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM = 0x020302, -// AUDIO_ENCODING_TYPE_OPUS_48000_HIGH = 0x020303, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_AUDIO_ENCODING_TYPE : uint8 { - - AUDIO_ENCODING_TYPE_NULL = 0, - AUDIO_ENCODING_TYPE_AAC_16000_LOW = 1, - AUDIO_ENCODING_TYPE_AAC_16000_MEDIUM = 2, - AUDIO_ENCODING_TYPE_AAC_32000_LOW = 3, - AUDIO_ENCODING_TYPE_AAC_32000_MEDIUM = 4, - AUDIO_ENCODING_TYPE_AAC_32000_HIGH = 5, - AUDIO_ENCODING_TYPE_AAC_48000_MEDIUM = 6, - AUDIO_ENCODING_TYPE_AAC_48000_HIGH = 7, - AUDIO_ENCODING_TYPE_OPUS_16000_LOW = 8, - AUDIO_ENCODING_TYPE_OPUS_16000_MEDIUM = 9, - AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM = 10, - AUDIO_ENCODING_TYPE_OPUS_48000_HIGH = 11, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_AUDIO_ENCODING_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_AUDIO_ENCODING_TYPE") - EENUMCUSTOM_AUDIO_ENCODING_TYPE ValueWrapper = EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_48000_MEDIUM; - - // default - FENUMWRAP_AUDIO_ENCODING_TYPE() :ValueWrapper(EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_48000_MEDIUM) {} - - FENUMWRAP_AUDIO_ENCODING_TYPE(EENUMCUSTOM_AUDIO_ENCODING_TYPE Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_AUDIO_ENCODING_TYPE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::AUDIO_ENCODING_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_16000_LOW: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_16000_LOW; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_16000_MEDIUM: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_16000_MEDIUM; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_32000_LOW: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_32000_LOW; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_32000_MEDIUM: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_32000_MEDIUM; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_32000_HIGH: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_32000_HIGH; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_48000_MEDIUM: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_48000_MEDIUM; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_48000_HIGH: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_AAC_48000_HIGH; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_16000_LOW: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_16000_LOW; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_16000_MEDIUM: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_16000_MEDIUM; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM; - case EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_48000_HIGH: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_48000_HIGH; - default: - return agora::rtc::AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM; - } - } -}; - -USTRUCT(BlueprintType) -struct FAudioEncodedFrameObserverConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioEncodedFrameObserverConfig") - EAUDIO_ENCODED_FRAME_OBSERVER_POSITION postionType = EAUDIO_ENCODED_FRAME_OBSERVER_POSITION::AUDIO_ENCODED_FRAME_OBSERVER_POSITION_PLAYBACK; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioEncodedFrameObserverConfig") - FENUMWRAP_AUDIO_ENCODING_TYPE encodingType = EENUMCUSTOM_AUDIO_ENCODING_TYPE::AUDIO_ENCODING_TYPE_OPUS_48000_MEDIUM; -}; - -USTRUCT(BlueprintType) -struct FSpatialAudioParams -{ - GENERATED_BODY() - - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool speaker_azimuth_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - float speaker_azimuth = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool speaker_elevation_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - float speaker_elevation = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool speaker_distance_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - float speaker_distance = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool speaker_orientation_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - int speaker_orientation = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool enable_blur_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool enable_blur = false; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool enable_air_absorb_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool enable_air_absorb = false; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool speaker_attenuation_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - float speaker_attenuation = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool enable_doppler_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SpatialAudioParams") - bool enable_doppler = false; -}; - -#define SET_AGORA_DATA_SPATIALAUDIOPARAMS(Agora_SpatialAudioParams,UE_FSpatialAudioParams) \ -{\ - if (UE_FSpatialAudioParams.speaker_azimuth_SetValue) \ - { \ - Agora_SpatialAudioParams.speaker_azimuth = UE_FSpatialAudioParams.speaker_azimuth; \ - } \ - \ - if (UE_FSpatialAudioParams.speaker_elevation_SetValue) \ - { \ - Agora_SpatialAudioParams.speaker_elevation = UE_FSpatialAudioParams.speaker_elevation; \ - } \ - \ - if (UE_FSpatialAudioParams.speaker_distance_SetValue) \ - { \ - Agora_SpatialAudioParams.speaker_distance = UE_FSpatialAudioParams.speaker_distance; \ - } \ - \ - if (UE_FSpatialAudioParams.speaker_orientation_SetValue) \ - { \ - Agora_SpatialAudioParams.speaker_orientation = UE_FSpatialAudioParams.speaker_orientation; \ - } \ - \ - if (UE_FSpatialAudioParams.enable_blur_SetValue) \ - { \ - Agora_SpatialAudioParams.enable_blur = UE_FSpatialAudioParams.enable_blur; \ - } \ - \ - if (UE_FSpatialAudioParams.enable_air_absorb_SetValue) \ - { \ - Agora_SpatialAudioParams.enable_air_absorb = UE_FSpatialAudioParams.enable_air_absorb; \ - } \ - \ - if (UE_FSpatialAudioParams.speaker_attenuation_SetValue) \ - { \ - Agora_SpatialAudioParams.speaker_attenuation = UE_FSpatialAudioParams.speaker_attenuation; \ - } \ - \ - if (UE_FSpatialAudioParams.enable_doppler_SetValue) \ - { \ - Agora_SpatialAudioParams.enable_doppler = UE_FSpatialAudioParams.enable_doppler; \ - } \ -} - - -USTRUCT(BlueprintType) -struct FSimulcastStreamConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SimulcastStreamConfig") - FVideoDimensions dimensions = FVideoDimensions(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SimulcastStreamConfig") - int bitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SimulcastStreamConfig") - int framerate = 0; -}; -USTRUCT(BlueprintType) -struct FAudioTrackConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioTrackConfig") - bool enableLocalPlayback = true; -}; - -UENUM(BlueprintType) -enum class ECAMERA_DIRECTION :uint8 { - - CAMERA_REAR = 0, - - CAMERA_FRONT = 1, -}; - -USTRUCT(BlueprintType) -struct FVideoFormat { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFormat") - int width = 640; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFormat") - int height = 360; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoFormat") - int fps = 15; -}; - -USTRUCT(BlueprintType) -struct FCameraCapturerConfiguration -{ - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") - ECAMERA_DIRECTION cameraDirection = ECAMERA_DIRECTION::CAMERA_FRONT; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") - FString deviceId = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") - FVideoFormat format = FVideoFormat(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|CameraCapturerConfiguration") - bool followEncodeDimensionRatio = true; -}; - -USTRUCT(BlueprintType) -struct FScreenCaptureParameters -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - FVideoDimensions dimensions = FVideoDimensions(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - int frameRate = 5; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - int bitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - bool captureMouseCursor = true; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - bool windowFocus = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - int64 excludeWindowList = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - int excludeWindowCount = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - int highLightWidth = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - int highLightColor = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters") - bool enableHighLight = false; -}; - - -USTRUCT(BlueprintType) -struct FDeviceInfo -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DeviceInfo") - bool isLowLatencyAudioSupported = false; -}; - -USTRUCT(BlueprintType) -struct FScreenAudioParameters { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenAudioParameters") - int sampleRate = 16000; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenAudioParameters") - int channels = 2; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenAudioParameters") - int captureSignalVolume = 100; - -}; - - -USTRUCT(BlueprintType) -struct FScreenVideoParameters { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenVideoParameters") - FVideoDimensions dimensions = FVideoDimensions(); - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenVideoParameters") - int frameRate = 15; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenVideoParameters") - int bitrate = 0; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenVideoParameters") - EVIDEO_CONTENT_HINT contentHint = EVIDEO_CONTENT_HINT::CONTENT_HINT_MOTION; - -}; - -USTRUCT(BlueprintType) -struct FScreenCaptureParameters2 -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters2") - bool captureAudio = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters2") - FScreenAudioParameters audioParams = FScreenAudioParameters(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters2") - bool captureVideo = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureParameters2") - FScreenVideoParameters videoParams = FScreenVideoParameters(); - -}; - -USTRUCT(BlueprintType) -struct FTranscodingUser { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") - int x = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") - int y = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") - int height = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") - int zOrder = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") - float alpha = 1.0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingUser") - int audioChannel = 0; - -}; - -USTRUCT(BlueprintType) -struct FLiveStreamAdvancedFeature { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveStreamAdvancedFeature") - FString featureName = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveStreamAdvancedFeature") - bool opened = false; -}; - -UENUM(BlueprintType) -enum class EVIDEO_CODEC_PROFILE_TYPE : uint8 { - - VIDEO_CODEC_PROFILE_NULL = 0, - - VIDEO_CODEC_PROFILE_BASELINE = 66, - - VIDEO_CODEC_PROFILE_MAIN = 77, - - VIDEO_CODEC_PROFILE_HIGH = 100, -}; - -UENUM(BlueprintType) -enum class EVIDEO_CODEC_TYPE_FOR_STREAM : uint8 { - - VIDEO_CODEC_NULL = 0, - - VIDEO_CODEC_H264_FOR_STREAM = 1, - - VIDEO_CODEC_H265_FOR_STREAM = 2, -}; - -UENUM(BlueprintType) -enum class EAUDIO_CODEC_PROFILE_TYPE : uint8 { - - AUDIO_CODEC_PROFILE_LC_AAC = 0, - - AUDIO_CODEC_PROFILE_HE_AAC = 1, - - AUDIO_CODEC_PROFILE_HE_AAC_V2 = 2, -}; - - - -USTRUCT(BlueprintType) -struct FLiveTranscoding -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int width = 360; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int height = 640; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int videoBitrate = 400; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int videoFramerate = 15; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - bool lowLatency = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int videoGop = 30; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - EVIDEO_CODEC_PROFILE_TYPE videoCodecProfile = EVIDEO_CODEC_PROFILE_TYPE::VIDEO_CODEC_PROFILE_HIGH; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int64 backgroundColor = 0x000000; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - EVIDEO_CODEC_TYPE_FOR_STREAM videoCodecType = EVIDEO_CODEC_TYPE_FOR_STREAM::VIDEO_CODEC_H264_FOR_STREAM; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int userCount = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - TArray transcodingUsers; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - FString transcodingExtraInfo = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - FString metadata = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - TArray watermark; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int watermarkCount = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - TArray backgroundImage; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int backgroundImageCount = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - EAUDIO_SAMPLE_RATE_TYPE audioSampleRate = EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int audioBitrate = 48; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int audioChannels = 1; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - EAUDIO_CODEC_PROFILE_TYPE audioCodecProfile = EAUDIO_CODEC_PROFILE_TYPE::AUDIO_CODEC_PROFILE_LC_AAC; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - TArray advancedFeatures; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LiveTranscoding") - int advancedFeatureCount = 0; -}; - -USTRUCT(BlueprintType) -struct FTranscodingVideoStream { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - EMEDIA_SOURCE_TYPE sourceType = EMEDIA_SOURCE_TYPE::PRIMARY_CAMERA_SOURCE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - int64 remoteUserUid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - FString imageUrl = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - int x = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - int y = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - int height = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - int zOrder = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - float alpha = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|TranscodingVideoStream") - bool mirror = false; -}; - -USTRUCT(BlueprintType) -struct FLocalTranscoderConfiguration -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalTranscoderConfiguration") - int streamCount = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalTranscoderConfiguration") - TArray VideoInputStreams; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalTranscoderConfiguration") - FVideoEncoderConfiguration videoOutputConfiguration = FVideoEncoderConfiguration(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalTranscoderConfiguration") - bool syncWithPrimaryCamera = true; -}; - - -USTRUCT(BlueprintType) -struct FScreenCaptureConfiguration -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") - bool isCaptureWindow = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") - int displayId = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") - FRectangle screenRect = FRectangle(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") - int64 windowId = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") - FScreenCaptureParameters params = FScreenCaptureParameters(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ScreenCaptureConfiguration") - FRectangle regionRect = FRectangle(); -}; - -UENUM(BlueprintType) -enum class ENCRYPTION_MODE :uint8 { - - AES_NULL = 0, - - AES_128_XTS = 1, - - AES_128_ECB = 2, - - AES_256_XTS = 3, - - SM4_128_ECB = 4, - - AES_128_GCM = 5, - - AES_256_GCM = 6, - - AES_128_GCM2 = 7, - - AES_256_GCM2 = 8, - - MODE_END, -}; - -USTRUCT(BlueprintType) -struct FEncryptionConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig") - ENCRYPTION_MODE encryptionMode = ENCRYPTION_MODE::AES_128_GCM; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig") - FString encryptionKey = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig") - FString encryptionKdfSalt = ""; -}; - -USTRUCT(BlueprintType) -struct FDataStreamConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DataStreamConfig") - bool syncWithAudio = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DataStreamConfig") - bool ordered = false; -}; - - - -USTRUCT(BlueprintType) -struct FWatermarkRatio { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkRatio") - float xRatio = 0; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkRatio") - float yRatio = 0; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkRatio") - float widthRatio = 0; -}; - -UENUM(BlueprintType) -enum class EWATERMARK_FIT_MODE : uint8 { - - FIT_MODE_COVER_POSITION, - - FIT_MODE_USE_IMAGE_RATIO -}; - - -USTRUCT(BlueprintType) -struct FWatermarkOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") - bool visibleInPreview = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") - FRectangle positionInLandscapeMode = FRectangle(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") - FRectangle positionInPortraitMode = FRectangle(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") - FWatermarkRatio watermarkRatio = FWatermarkRatio(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WatermarkOptions") - EWATERMARK_FIT_MODE mode = EWATERMARK_FIT_MODE::FIT_MODE_COVER_POSITION; -}; - - - - -USTRUCT(BlueprintType) -struct FInjectStreamConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|InjectStreamConfig") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|InjectStreamConfig") - int height = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|InjectStreamConfig") - int videoGop = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|InjectStreamConfig") - int videoFramerate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|InjectStreamConfig") - int videoBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|InjectStreamConfig") - EAUDIO_SAMPLE_RATE_TYPE audioSampleRate = EAUDIO_SAMPLE_RATE_TYPE::AUDIO_SAMPLE_RATE_48000; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|InjectStreamConfig") - int audioBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|InjectStreamConfig") - int audioChannels = 0; -}; - -USTRUCT(BlueprintType) -struct FUserInfo -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") - FString userAccount = ""; -}; - -USTRUCT(BlueprintType) -struct FChannelMediaInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") - FString channelName = ""; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") - FString token = ""; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UserInfo") - int64 uid = 0; - -}; - -USTRUCT(BlueprintType) -struct FChannelMediaRelayConfiguration -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaRelayConfiguration") - FChannelMediaInfo srcInfo = FChannelMediaInfo(); - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaRelayConfiguration") - TArray destInfos; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ChannelMediaRelayConfiguration") - int destCount = 0; -}; - -USTRUCT(BlueprintType) -struct FDirectCdnStreamingMediaOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - AGORAOPTIONAL publishCameraTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - AGORAOPTIONAL publishMicrophoneTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - AGORAOPTIONAL publishCustomAudioTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - AGORAOPTIONAL publishCustomVideoTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - AGORAOPTIONAL publishMediaPlayerAudioTrack = AGORAOPTIONAL::AGORA_NULL_VALUE; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - bool publishMediaPlayerId_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - int publishMediaPlayerId = 0; - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - bool customVideoTrackId_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingMediaOptions") - int64 customVideoTrackId = 0; -}; - -#define SET_AGORA_DATA_DIRECTCDNSTREAMINGMEDIAOPTIONS(Agora_DirectCdnStreamingMediaOptions,UE_FDirectCdnStreamingMediaOptions)\ -{\ - if (UE_FDirectCdnStreamingMediaOptions.publishCameraTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_DirectCdnStreamingMediaOptions.publishCameraTrack = UE_FDirectCdnStreamingMediaOptions.publishCameraTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FDirectCdnStreamingMediaOptions.publishMicrophoneTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_DirectCdnStreamingMediaOptions.publishMicrophoneTrack = UE_FDirectCdnStreamingMediaOptions.publishMicrophoneTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FDirectCdnStreamingMediaOptions.publishCustomAudioTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_DirectCdnStreamingMediaOptions.publishCustomAudioTrack = UE_FDirectCdnStreamingMediaOptions.publishCustomAudioTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FDirectCdnStreamingMediaOptions.publishCustomVideoTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_DirectCdnStreamingMediaOptions.publishCustomVideoTrack = UE_FDirectCdnStreamingMediaOptions.publishCustomVideoTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FDirectCdnStreamingMediaOptions.publishMediaPlayerAudioTrack != AGORAOPTIONAL::AGORA_NULL_VALUE) \ - { \ - Agora_DirectCdnStreamingMediaOptions.publishMediaPlayerAudioTrack = UE_FDirectCdnStreamingMediaOptions.publishMediaPlayerAudioTrack == AGORAOPTIONAL::AGORA_TRUE_VALUE; \ - } \ - if (UE_FDirectCdnStreamingMediaOptions.publishMediaPlayerId_SetValue) \ - { \ - Agora_DirectCdnStreamingMediaOptions.publishMediaPlayerId = UE_FDirectCdnStreamingMediaOptions.publishMediaPlayerId; \ - } \ - if (UE_FDirectCdnStreamingMediaOptions.customVideoTrackId_SetValue) \ - { \ - Agora_DirectCdnStreamingMediaOptions.customVideoTrackId = UE_FDirectCdnStreamingMediaOptions.customVideoTrackId; \ - } \ -} - - -USTRUCT(BlueprintType) -struct FAgoraRhythmPlayerConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraRhythmPlayerConfig") - int beatsPerMeasure = 4; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraRhythmPlayerConfig") - int beatsPerMinute = 60; -}; - -UENUM(BlueprintType) -enum class ECONTENT_INSPECT_TYPE : uint8 { - - CONTENT_INSPECT_INVALID = 0, - - CONTENT_INSPECT_MODERATION = 1, - - CONTENT_INSPECT_SUPERVISION = 2 -}; - -USTRUCT(BlueprintType) -struct FContentInspectModule { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectModule") - ECONTENT_INSPECT_TYPE type = ECONTENT_INSPECT_TYPE::CONTENT_INSPECT_INVALID; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectModule") - int64 interval = 0; -}; - -USTRUCT(BlueprintType) -struct FContentInspectConfig -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectConfig") - FString extraInfo = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectConfig") - TArray modules; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ContentInspectConfig") - int moduleCount = 0; -}; - -UENUM(BlueprintType) -enum class ELOCAL_PROXY_MODE :uint8 { - - ConnectivityFirst = 0, - - LocalOnly = 1, -}; - -USTRUCT(BlueprintType) -struct FLocalAccessPointConfiguration -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") - FString ipList = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") - int ipListSize = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") - FString domainList = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") - int domainListSize = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") - FString verifyDomainName = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAccessPointConfiguration") - ELOCAL_PROXY_MODE mode = ELOCAL_PROXY_MODE::ConnectivityFirst; -}; - -USTRUCT(BlueprintType) -struct FAdvancedAudioOptions -{ - GENERATED_BODY() - // If the box is unchecked, the value of the corresponding variable (named without _SetValue) will be ignored. - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvancedAudioOptions") - bool audioProcessingChannels_SetValue = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AdvancedAudioOptions") - int audioProcessingChannels = 0; -}; - -#define SET_AGORA_DATA_ADVANCEDAUDIOOPTIONS(Agora_AdvancedAudioOptions,UE_FAdvancedAudioOptions)\ -{\ - if (UE_FAdvancedAudioOptions.audioProcessingChannels_SetValue) \ - { \ - Agora_AdvancedAudioOptions.audioProcessingChannels = UE_FAdvancedAudioOptions.audioProcessingChannels; \ - } \ -} - -USTRUCT(BlueprintType) -struct FImageTrackOptions -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ImageTrackOptions") - FString imageUrl = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ImageTrackOptions") - int fps = 1; -}; - -USTRUCT(BlueprintType) -struct FRtcConnection -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcConnection") - FString channelId = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcConnection") - int64 localUid = 0; -}; - -UENUM(BlueprintType) -enum class ELASTMILE_PROBE_RESULT_STATE :uint8 { - - LASTMILE_PROBE_RESULT_NULL = 0, - - LASTMILE_PROBE_RESULT_COMPLETE = 1, - - LASTMILE_PROBE_RESULT_INCOMPLETE_NO_BWE = 2, - - LASTMILE_PROBE_RESULT_UNAVAILABLE = 3 -}; - -USTRUCT(BlueprintType) -struct FLastmileProbeOneWayResult { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeOneWayResult") - int64 packetLossRate = 0; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeOneWayResult") - int64 jitter = 0; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeOneWayResult") - int64 availableBandwidth = 0; -}; - - -USTRUCT(BlueprintType) -struct FLastmileProbeResult { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeResult") - ELASTMILE_PROBE_RESULT_STATE state = ELASTMILE_PROBE_RESULT_STATE::LASTMILE_PROBE_RESULT_UNAVAILABLE; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeResult") - FLastmileProbeOneWayResult uplinkReport = FLastmileProbeOneWayResult(); - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeResult") - FLastmileProbeOneWayResult downlinkReport = FLastmileProbeOneWayResult(); - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LastmileProbeResult") - int64 rtt = 0; -}; - -USTRUCT(BlueprintType) -struct FAudioVolumeInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioVolumeInfo") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioVolumeInfo") - int64 volume = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioVolumeInfo") - int64 vad = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AudioVolumeInfo") - float voicePitch = 0; - -}; - - -USTRUCT(BlueprintType) -struct FRtcStats -{ - GENERATED_BODY() - - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int64 duration = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int64 txBytes = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int64 rxBytes = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int64 txAudioBytes = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int64 txVideoBytes = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int64 rxAudioBytes = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int64 rxVideoBytes = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 txKBitRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 rxKBitRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 rxAudioKBitRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 txAudioKBitRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 rxVideoKBitRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 txVideoKBitRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 lastmileDelay = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int64 userCount = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - float cpuAppUsage = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - float cpuTotalUsage = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 connectTimeMs = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 firstAudioPacketDuration = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 firstVideoPacketDuration = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 firstVideoKeyFramePacketDuration = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 packetsBeforeFirstKeyFramePacket = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 firstAudioPacketDurationAfterUnmute = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 firstVideoPacketDurationAfterUnmute = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 firstVideoKeyFramePacketDurationAfterUnmute = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 firstVideoKeyFrameDecodedDurationAfterUnmute = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 firstVideoKeyFrameRenderedDurationAfterUnmute = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 txPacketLossRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int32 rxPacketLossRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int gatewayRtt = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - float memoryAppUsageRatio = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - float memoryTotalUsageRatio = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RtcStats") - int memoryAppUsageInKbytes = 0; -}; - -USTRUCT(BlueprintType) -struct FUplinkNetworkInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|UplinkNetworkInfo") - int video_encoder_target_bitrate_bps = 0; -}; - -UENUM(BlueprintType) -enum class EREMOTE_VIDEO_DOWNSCALE_LEVEL : uint8 { - - REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE, - - REMOTE_VIDEO_DOWNSCALE_LEVEL_1, - - REMOTE_VIDEO_DOWNSCALE_LEVEL_2, - - REMOTE_VIDEO_DOWNSCALE_LEVEL_3, - - REMOTE_VIDEO_DOWNSCALE_LEVEL_4, -}; - -USTRUCT(BlueprintType) -struct FPeerDownlinkInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PeerDownlinkInfo") - FString uid = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PeerDownlinkInfo") - EVIDEO_STREAM_TYPE stream_type = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PeerDownlinkInfo") - EREMOTE_VIDEO_DOWNSCALE_LEVEL current_downscale_level = EREMOTE_VIDEO_DOWNSCALE_LEVEL::REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|PeerDownlinkInfo") - int expected_bitrate_bps = 0; -}; -USTRUCT(BlueprintType) -struct FDownlinkNetworkInfo { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") - int lastmile_buffer_delay_time_ms = -1; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") - int bandwidth_estimation_bps = -1; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") - int total_downscale_level_count = -1; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") - FPeerDownlinkInfo peer_downlink_info = FPeerDownlinkInfo(); - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DownlinkNetworkInfo") - int total_received_video_count = -1; -}; - -UENUM(BlueprintType) -enum class ELOCAL_VIDEO_STREAM_STATE : uint8 { - - LOCAL_VIDEO_STREAM_STATE_STOPPED = 0, - - LOCAL_VIDEO_STREAM_STATE_CAPTURING = 1, - - LOCAL_VIDEO_STREAM_STATE_ENCODING = 2, - - LOCAL_VIDEO_STREAM_STATE_FAILED = 3 -}; - -UENUM(BlueprintType) -enum class ELOCAL_VIDEO_STREAM_ERROR : uint8 { - LOCAL_VIDEO_STREAM_ERROR_OK = 0, - LOCAL_VIDEO_STREAM_ERROR_FAILURE = 1, - LOCAL_VIDEO_STREAM_ERROR_DEVICE_NO_PERMISSION = 2, - LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY = 3, - LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE = 4, - LOCAL_VIDEO_STREAM_ERROR_ENCODE_FAILURE = 5, - LOCAL_VIDEO_STREAM_ERROR_CAPTURE_INBACKGROUND = 6, - LOCAL_VIDEO_STREAM_ERROR_CAPTURE_MULTIPLE_FOREGROUND_APPS = 7, - LOCAL_VIDEO_STREAM_ERROR_DEVICE_NOT_FOUND = 8, - LOCAL_VIDEO_STREAM_ERROR_DEVICE_DISCONNECTED = 9, - LOCAL_VIDEO_STREAM_ERROR_DEVICE_INVALID_ID = 10, - LOCAL_VIDEO_STREAM_ERROR_DEVICE_SYSTEM_PRESSURE = 101, - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_MINIMIZED = 11, - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_CLOSED = 12, - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_OCCLUDED = 13, - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_NOT_SUPPORTED = 20, - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_FAILURE = 21, - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_NO_PERMISSION = 22, -}; -UENUM(BlueprintType) -enum class EREMOTE_VIDEO_STATE : uint8 { - - REMOTE_VIDEO_STATE_STOPPED = 0, - - REMOTE_VIDEO_STATE_STARTING = 1, - - REMOTE_VIDEO_STATE_DECODING = 2, - - REMOTE_VIDEO_STATE_FROZEN = 3, - - REMOTE_VIDEO_STATE_FAILED = 4, -}; - -UENUM(BlueprintType) -enum class EREMOTE_VIDEO_STATE_REASON : uint8 { - - REMOTE_VIDEO_STATE_REASON_INTERNAL = 0, - - REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION = 1, - - REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY = 2, - - REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED = 3, - - REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED = 4, - - REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED = 5, - - REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED = 6, - - REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE = 7, - - REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK = 8, - - REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY = 9, - - REMOTE_VIDEO_STATE_REASON_VIDEO_STREAM_TYPE_CHANGE_TO_LOW = 10, - - REMOTE_VIDEO_STATE_REASON_VIDEO_STREAM_TYPE_CHANGE_TO_HIGH = 11, - - REMOTE_VIDEO_STATE_REASON_SDK_IN_BACKGROUND = 12, - - REMOTE_VIDEO_STATE_REASON_CODEC_NOT_SUPPORT = 13, -}; - -UENUM(BlueprintType) -enum class EUSER_OFFLINE_REASON_TYPE : uint8 { - - USER_OFFLINE_QUIT = 0, - - USER_OFFLINE_DROPPED = 1, - - USER_OFFLINE_BECOME_AUDIENCE = 2, -}; - -USTRUCT(BlueprintType) -struct FLocalAudioStats -{ - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") - int numChannels = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") - int sentSampleRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") - int sentBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") - int internalCodec = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") - int64 txPacketLossRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalAudioStats") - int audioDeviceDelay = 0; -}; - -USTRUCT(BlueprintType) -struct FRemoteAudioStats -{ - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int quality = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int networkTransportDelay = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int jitterBufferDelay = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int audioLossRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int numChannels = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int receivedSampleRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int receivedBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int totalFrozenTime = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int frozenRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int mosValue = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int totalActiveTime = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int publishDuration = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int qoeQuality = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteAudioStats") - int qualityChangedReason = 0; -}; - -UENUM(BlueprintType) -enum class EAUDIO_AINS_MODE : uint8 { - AINS_MODE_BALANCED = 0, - AINS_MODE_AGGRESSIVE = 1, - AINS_MODE_ULTRALOWLATENCY = 2 -}; - -UENUM(BlueprintType) -enum class EQUALITY_ADAPT_INDICATION : uint8 { - - ADAPT_NONE = 0, - - ADAPT_UP_BANDWIDTH = 1, - - ADAPT_DOWN_BANDWIDTH = 2, -}; -//UENUM(BlueprintType) -//enum ECAPTURE_BRIGHTNESS_LEVEL_TYPE { -// -// CAPTURE_BRIGHTNESS_LEVEL_INVALID = -1, -// -// CAPTURE_BRIGHTNESS_LEVEL_NORMAL = 0, -// -// CAPTURE_BRIGHTNESS_LEVEL_BRIGHT = 1, -// -// CAPTURE_BRIGHTNESS_LEVEL_DARK = 2, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE : uint8 { - - CAPTURE_BRIGHTNESS_LEVEL_INVALID = 0, - - CAPTURE_BRIGHTNESS_LEVEL_NORMAL = 1, - - CAPTURE_BRIGHTNESS_LEVEL_BRIGHT = 2, - - CAPTURE_BRIGHTNESS_LEVEL_DARK = 3, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE") - EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; - - // default - FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE() :ValueWrapper(EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID) {} - - FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE(EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE InValue) { - ValueWrapper = InValue; - } - FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE(agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE Val) { - switch (Val) { - case agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID: - ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; - break; - case agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_NORMAL: - ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_NORMAL; - break; - case agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_BRIGHT: - ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_BRIGHT; - break; - case agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_DARK: - ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_DARK; - break; - } - } - agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID: - return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; - case EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_NORMAL: - return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_NORMAL; - case EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_BRIGHT: - return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_BRIGHT; - case EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_DARK: - return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_DARK; - default: - return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; - } - } -}; - -USTRUCT(BlueprintType) -struct FLocalVideoStats -{ - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int sentBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int sentFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int captureFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int captureFrameWidth = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int captureFrameHeight = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int regulatedCaptureFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int regulatedCaptureFrameWidth = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int regulatedCaptureFrameHeight = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int encoderOutputFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int encodedFrameWidth = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int encodedFrameHeight = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int rendererOutputFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int targetBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int targetFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - EQUALITY_ADAPT_INDICATION qualityAdaptIndication = EQUALITY_ADAPT_INDICATION::ADAPT_NONE; - int encodedBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int encodedFrameCount = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - EVIDEO_CODEC_TYPE codecType = EVIDEO_CODEC_TYPE::VIDEO_CODEC_GENERIC_H264; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int64 txPacketLossRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE captureBrightnessLevel = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - bool dualStreamEnabled = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|LocalVideoStats") - int hwEncoderAccelerating = 0; -}; - - -//UENUM(BlueprintType) -//enum EAUDIO_MIXING_STATE_TYPE { -// -// AUDIO_MIXING_STATE_NULL = 0, -// -// AUDIO_MIXING_STATE_PLAYING = 710, -// -// AUDIO_MIXING_STATE_PAUSED = 711, -// -// AUDIO_MIXING_STATE_STOPPED = 713, -// -// AUDIO_MIXING_STATE_FAILED = 714, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE : uint8 { - - AUDIO_MIXING_STATE_NULL = 0, - - AUDIO_MIXING_STATE_PLAYING = 1, - - AUDIO_MIXING_STATE_PAUSED = 2, - - AUDIO_MIXING_STATE_STOPPED = 3, - - AUDIO_MIXING_STATE_FAILED = 4, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_AUDIO_MIXING_STATE_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_AUDIO_MIXING_STATE_TYPE") - EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED; - - // default - FENUMWRAP_AUDIO_MIXING_STATE_TYPE() :ValueWrapper(EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED) {} - - FENUMWRAP_AUDIO_MIXING_STATE_TYPE(EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE Val) :ValueWrapper(Val) {} - FENUMWRAP_AUDIO_MIXING_STATE_TYPE(agora::rtc::AUDIO_MIXING_STATE_TYPE Val) { - switch (Val) { - case agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_PLAYING: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_PLAYING; - break; - case agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_PAUSED: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_PAUSED; - break; - case agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_STOPPED: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_STOPPED; - break; - case agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED; - break; - default: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED; - break; - } - } - void operator = (EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::AUDIO_MIXING_STATE_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_PLAYING: - return agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_PLAYING; - case EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_PAUSED: - return agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_PAUSED; - case EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_STOPPED: - return agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_STOPPED; - case EENUMCUSTOM_AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED: - return agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED; - default: - return agora::rtc::AUDIO_MIXING_STATE_TYPE::AUDIO_MIXING_STATE_FAILED; - } - } -}; -// -//UENUM(BlueprintType) -//enum EAUDIO_MIXING_REASON_TYPE { -// -// AUDIO_MIXING_REASON_OK = 0, -// -// AUDIO_MIXING_REASON_CAN_NOT_OPEN = 701, -// -// AUDIO_MIXING_REASON_TOO_FREQUENT_CALL = 702, -// -// AUDIO_MIXING_REASON_INTERRUPTED_EOF = 703, -// -// AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED = 721, -// -// AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED = 723, -// -// AUDIO_MIXING_REASON_STOPPED_BY_USER = 724, -// -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE : uint8 { - - AUDIO_MIXING_REASON_OK = 0, - - AUDIO_MIXING_REASON_CAN_NOT_OPEN = 1, - - AUDIO_MIXING_REASON_TOO_FREQUENT_CALL = 2, - - AUDIO_MIXING_REASON_INTERRUPTED_EOF = 3, - - AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED = 4, - - AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED = 5, - - AUDIO_MIXING_REASON_STOPPED_BY_USER = 6, - -}; - - -USTRUCT(BlueprintType) -struct FENUMWRAP_AUDIO_MIXING_REASON_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_AUDIO_MIXING_REASON_TYPE") - EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_OK; - - // default - FENUMWRAP_AUDIO_MIXING_REASON_TYPE() :ValueWrapper(EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_OK) {} - - FENUMWRAP_AUDIO_MIXING_REASON_TYPE(EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE Val) :ValueWrapper(Val) {} - FENUMWRAP_AUDIO_MIXING_REASON_TYPE(agora::rtc::AUDIO_MIXING_REASON_TYPE Val) { - switch (Val) - { - case agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_OK: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_OK; - break; - case agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_CAN_NOT_OPEN: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_CAN_NOT_OPEN; - break; - case agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_TOO_FREQUENT_CALL: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_TOO_FREQUENT_CALL; - break; - case agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_INTERRUPTED_EOF: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_INTERRUPTED_EOF; - break; - case agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED; - break; - case agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED; - break; - case agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_STOPPED_BY_USER: - ValueWrapper = EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_STOPPED_BY_USER; - break; - } - } - void operator = (EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::AUDIO_MIXING_REASON_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_OK: - return agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_OK; - case EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_CAN_NOT_OPEN: - return agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_CAN_NOT_OPEN; - case EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_TOO_FREQUENT_CALL: - return agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_TOO_FREQUENT_CALL; - case EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_INTERRUPTED_EOF: - return agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_INTERRUPTED_EOF; - case EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED: - return agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED; - case EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED: - return agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED; - case EENUMCUSTOM_AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_STOPPED_BY_USER: - return agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_STOPPED_BY_USER; - default: - return agora::rtc::AUDIO_MIXING_REASON_TYPE::AUDIO_MIXING_REASON_OK; - } - } -}; - - - -//UENUM(BlueprintType) -//enum ERHYTHM_PLAYER_STATE_TYPE { -// -// RHYTHM_PLAYER_NULL = 0, -// -// RHYTHM_PLAYER_STATE_IDLE = 810, -// -// RHYTHM_PLAYER_STATE_OPENING, -// -// RHYTHM_PLAYER_STATE_DECODING, -// -// RHYTHM_PLAYER_STATE_PLAYING, -// -// RHYTHM_PLAYER_STATE_FAILED, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE : uint8 { - - RHYTHM_PLAYER_NULL = 0, - - RHYTHM_PLAYER_STATE_IDLE = 1, - - RHYTHM_PLAYER_STATE_OPENING, - - RHYTHM_PLAYER_STATE_DECODING, - - RHYTHM_PLAYER_STATE_PLAYING, - - RHYTHM_PLAYER_STATE_FAILED, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE") - EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED; - - // default - FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE() :ValueWrapper(EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED) {} - - FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE(EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE Val) :ValueWrapper(Val) {} - - FENUMWRAP_RHYTHM_PLAYER_STATE_TYPE(agora::rtc::RHYTHM_PLAYER_STATE_TYPE Val) { - switch (Val) - { - case agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_IDLE: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_IDLE; - break; - case agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_OPENING: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_OPENING; - break; - case agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_DECODING: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_DECODING; - break; - case agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_PLAYING: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_PLAYING; - break; - case agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED; - break; - default: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED; - break; - } - } - void operator = (EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::RHYTHM_PLAYER_STATE_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_IDLE: - return agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_IDLE; - case EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_OPENING: - return agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_OPENING; - case EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_DECODING: - return agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_DECODING; - case EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_PLAYING: - return agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_PLAYING; - case EENUMCUSTOM_RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED: - return agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED; - default: - return agora::rtc::RHYTHM_PLAYER_STATE_TYPE::RHYTHM_PLAYER_STATE_FAILED; - } - } -}; - -//UENUM(BlueprintType) -//enum ERHYTHM_PLAYER_ERROR_TYPE { -// -// RHYTHM_PLAYER_ERROR_OK = 0, -// -// RHYTHM_PLAYER_ERROR_FAILED = 1, -// -// RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN = 801, -// -// RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY, -// -// RHYTHM_PLAYER_ERROR_FILE_OVER_DURATION_LIMIT, -//}; - - -UENUM(BlueprintType) -enum class EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE :uint8 { - - RHYTHM_PLAYER_ERROR_OK = 0, - - RHYTHM_PLAYER_ERROR_FAILED = 1, - - RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN, - - RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY, - - RHYTHM_PLAYER_ERROR_FILE_OVER_DURATION_LIMIT, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_RHYTHM_PLAYER_ERROR_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_RHYTHM_PLAYER_ERROR_TYPE") - EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_OK; - - // default - FENUMWRAP_RHYTHM_PLAYER_ERROR_TYPE() :ValueWrapper(EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_OK) {} - - FENUMWRAP_RHYTHM_PLAYER_ERROR_TYPE(EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE Val) :ValueWrapper(Val) {} - - FENUMWRAP_RHYTHM_PLAYER_ERROR_TYPE(agora::rtc::RHYTHM_PLAYER_ERROR_TYPE Val) { - switch (Val) - { - case agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_OK: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_OK; - break; - case agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_FAILED: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_FAILED; - break; - case agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN; - break; - case agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY; - break; - case agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_FILE_OVER_DURATION_LIMIT: - ValueWrapper = EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_FILE_OVER_DURATION_LIMIT; - break; - } - } - - void operator = (EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::RHYTHM_PLAYER_ERROR_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_OK: - return agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_OK; - case EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_FAILED: - return agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_FAILED; - case EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN: - return agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN; - case EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY: - return agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY; - case EENUMCUSTOM_RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_FILE_OVER_DURATION_LIMIT: - return agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_FILE_OVER_DURATION_LIMIT; - default: - return agora::rtc::RHYTHM_PLAYER_ERROR_TYPE::RHYTHM_PLAYER_ERROR_OK; - } - } -}; - -UENUM(BlueprintType) -enum class ELOCAL_AUDIO_STREAM_STATE : uint8 { - - LOCAL_AUDIO_STREAM_STATE_STOPPED = 0, - - LOCAL_AUDIO_STREAM_STATE_RECORDING = 1, - - LOCAL_AUDIO_STREAM_STATE_ENCODING = 2, - - LOCAL_AUDIO_STREAM_STATE_FAILED = 3 -}; - -UENUM(BlueprintType) -enum class ELOCAL_AUDIO_STREAM_ERROR : uint8 { - - LOCAL_AUDIO_STREAM_ERROR_OK = 0, - LOCAL_AUDIO_STREAM_ERROR_FAILURE = 1, - LOCAL_AUDIO_STREAM_ERROR_DEVICE_NO_PERMISSION = 2, - LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY = 3, - LOCAL_AUDIO_STREAM_ERROR_RECORD_FAILURE = 4, - LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE = 5, - LOCAL_AUDIO_STREAM_ERROR_NO_RECORDING_DEVICE = 6, - LOCAL_AUDIO_STREAM_ERROR_NO_PLAYOUT_DEVICE = 7, - LOCAL_AUDIO_STREAM_ERROR_INTERRUPTED = 8, - LOCAL_AUDIO_STREAM_ERROR_RECORD_INVALID_ID = 9, - LOCAL_AUDIO_STREAM_ERROR_PLAYOUT_INVALID_ID = 10, -}; - -UENUM(BlueprintType) -enum class EREMOTE_AUDIO_STATE : uint8 -{ - - REMOTE_AUDIO_STATE_STOPPED = 0, - - REMOTE_AUDIO_STATE_STARTING = 1, - - REMOTE_AUDIO_STATE_DECODING = 2, - - REMOTE_AUDIO_STATE_FROZEN = 3, - - REMOTE_AUDIO_STATE_FAILED = 4, -}; - -UENUM(BlueprintType) -enum class EREMOTE_AUDIO_STATE_REASON : uint8 -{ - REMOTE_AUDIO_REASON_INTERNAL = 0, - - REMOTE_AUDIO_REASON_NETWORK_CONGESTION = 1, - - REMOTE_AUDIO_REASON_NETWORK_RECOVERY = 2, - - REMOTE_AUDIO_REASON_LOCAL_MUTED = 3, - - REMOTE_AUDIO_REASON_LOCAL_UNMUTED = 4, - - REMOTE_AUDIO_REASON_REMOTE_MUTED = 5, - - REMOTE_AUDIO_REASON_REMOTE_UNMUTED = 6, - - REMOTE_AUDIO_REASON_REMOTE_OFFLINE = 7, -}; -UENUM(BlueprintType) -enum class ECONTENT_INSPECT_RESULT : uint8 { - CONTENT_INSPECT_NULL = 0, - CONTENT_INSPECT_NEUTRAL = 1, - CONTENT_INSPECT_SEXY = 2, - CONTENT_INSPECT_PORN = 3, -}; - -UENUM(BlueprintType) -enum class ECLIENT_ROLE_CHANGE_FAILED_REASON : uint8 { - - CLIENT_ROLE_CHANGE_FAILED_TOO_MANY_NULL = 0, - - CLIENT_ROLE_CHANGE_FAILED_TOO_MANY_BROADCASTERS = 1, - - CLIENT_ROLE_CHANGE_FAILED_NOT_AUTHORIZED = 2, - - CLIENT_ROLE_CHANGE_FAILED_REQUEST_TIME_OUT = 3, - - CLIENT_ROLE_CHANGE_FAILED_CONNECTION_FAILED = 4, -}; - - - -//UENUM(BlueprintType) -//enum EMEDIA_DEVICE_TYPE { -// -// UNKNOWN_AUDIO_DEVICE = -1, -// -// AUDIO_PLAYOUT_DEVICE = 0, -// -// AUDIO_RECORDING_DEVICE = 1, -// -// VIDEO_RENDER_DEVICE = 2, -// -// VIDEO_CAPTURE_DEVICE = 3, -// -// AUDIO_APPLICATION_PLAYOUT_DEVICE = 4, -// -// AUDIO_VIRTUAL_PLAYOUT_DEVICE = 5, -// -// AUDIO_VIRTUAL_RECORDING_DEVICE = 6, -//}; - - -UENUM(BlueprintType) -enum class EENUMCUSTOM_MEDIA_DEVICE_TYPE : uint8 { - - UNKNOWN_AUDIO_DEVICE = 0, - - AUDIO_PLAYOUT_DEVICE = 1, - - AUDIO_RECORDING_DEVICE = 2, - - VIDEO_RENDER_DEVICE = 3, - - VIDEO_CAPTURE_DEVICE = 4, - - AUDIO_APPLICATION_PLAYOUT_DEVICE = 5, - - AUDIO_VIRTUAL_PLAYOUT_DEVICE = 6, - - AUDIO_VIRTUAL_RECORDING_DEVICE = 7, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_MEDIA_DEVICE_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_MEDIA_DEVICE_TYPE") - EENUMCUSTOM_MEDIA_DEVICE_TYPE ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::UNKNOWN_AUDIO_DEVICE; - - // default - FENUMWRAP_MEDIA_DEVICE_TYPE() :ValueWrapper(EENUMCUSTOM_MEDIA_DEVICE_TYPE::UNKNOWN_AUDIO_DEVICE) {} - - FENUMWRAP_MEDIA_DEVICE_TYPE(EENUMCUSTOM_MEDIA_DEVICE_TYPE Val) :ValueWrapper(Val) {} - FENUMWRAP_MEDIA_DEVICE_TYPE(agora::rtc::MEDIA_DEVICE_TYPE Val) { - switch (Val) - { - case agora::rtc::MEDIA_DEVICE_TYPE::UNKNOWN_AUDIO_DEVICE: - ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::UNKNOWN_AUDIO_DEVICE; - break; - case agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_PLAYOUT_DEVICE: - ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_PLAYOUT_DEVICE; - break; - case agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_RECORDING_DEVICE: - ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_RECORDING_DEVICE; - break; - case agora::rtc::MEDIA_DEVICE_TYPE::VIDEO_RENDER_DEVICE: - ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::VIDEO_RENDER_DEVICE; - break; - case agora::rtc::MEDIA_DEVICE_TYPE::VIDEO_CAPTURE_DEVICE: - ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::VIDEO_CAPTURE_DEVICE; - break; - case agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_APPLICATION_PLAYOUT_DEVICE: - ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_APPLICATION_PLAYOUT_DEVICE; - break; - case agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_VIRTUAL_PLAYOUT_DEVICE: - ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_VIRTUAL_PLAYOUT_DEVICE; - break; - case agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_VIRTUAL_RECORDING_DEVICE: - ValueWrapper = EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_VIRTUAL_RECORDING_DEVICE; - break; - } - - } - void operator = (EENUMCUSTOM_MEDIA_DEVICE_TYPE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::MEDIA_DEVICE_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_MEDIA_DEVICE_TYPE::UNKNOWN_AUDIO_DEVICE: - return agora::rtc::MEDIA_DEVICE_TYPE::UNKNOWN_AUDIO_DEVICE; - case EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_PLAYOUT_DEVICE: - return agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_PLAYOUT_DEVICE; - case EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_RECORDING_DEVICE: - return agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_RECORDING_DEVICE; - case EENUMCUSTOM_MEDIA_DEVICE_TYPE::VIDEO_RENDER_DEVICE: - return agora::rtc::MEDIA_DEVICE_TYPE::VIDEO_RENDER_DEVICE; - case EENUMCUSTOM_MEDIA_DEVICE_TYPE::VIDEO_CAPTURE_DEVICE: - return agora::rtc::MEDIA_DEVICE_TYPE::VIDEO_CAPTURE_DEVICE; - case EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_APPLICATION_PLAYOUT_DEVICE: - return agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_APPLICATION_PLAYOUT_DEVICE; - case EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_VIRTUAL_PLAYOUT_DEVICE: - return agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_VIRTUAL_PLAYOUT_DEVICE; - case EENUMCUSTOM_MEDIA_DEVICE_TYPE::AUDIO_VIRTUAL_RECORDING_DEVICE: - return agora::rtc::MEDIA_DEVICE_TYPE::AUDIO_VIRTUAL_RECORDING_DEVICE; - default: - return agora::rtc::MEDIA_DEVICE_TYPE::UNKNOWN_AUDIO_DEVICE; - } - } -}; - -UENUM(BlueprintType) -enum class ERTMP_STREAM_PUBLISH_STATE : uint8 { - - RTMP_STREAM_PUBLISH_STATE_IDLE = 0, - - RTMP_STREAM_PUBLISH_STATE_CONNECTING = 1, - - RTMP_STREAM_PUBLISH_STATE_RUNNING = 2, - - RTMP_STREAM_PUBLISH_STATE_RECOVERING = 3, - - RTMP_STREAM_PUBLISH_STATE_FAILURE = 4, - - RTMP_STREAM_PUBLISH_STATE_DISCONNECTING = 5, -}; - -UENUM(BlueprintType) -enum class ERTMP_STREAM_PUBLISH_ERROR_TYPE : uint8 { - - RTMP_STREAM_PUBLISH_ERROR_OK = 0, - - RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMENT = 1, - - RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED = 2, - - RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT = 3, - - RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR = 4, - - RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR = 5, - - RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN = 6, - - RTMP_STREAM_PUBLISH_ERROR_REACH_LIMIT = 7, - - RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED = 8, - - RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND = 9, - - RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED = 10, - - RTMP_STREAM_PUBLISH_ERROR_NOT_BROADCASTER = 11, - - RTMP_STREAM_PUBLISH_ERROR_TRANSCODING_NO_MIX_STREAM = 13, - - RTMP_STREAM_PUBLISH_ERROR_NET_DOWN = 14, - - RTMP_STREAM_PUBLISH_ERROR_INVALID_APPID = 15, - - RTMP_STREAM_PUBLISH_ERROR_INVALID_PRIVILEGE = 16, - - RTMP_STREAM_UNPUBLISH_ERROR_OK = 100, -}; - -UENUM(BlueprintType) -enum class ERTMP_STREAMING_EVENT : uint8 { - - RTMP_STREAMING_EVENT_FAILED_LOAD_NULL = 0, - - RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE = 1, - - RTMP_STREAMING_EVENT_URL_ALREADY_IN_USE = 2, - - RTMP_STREAMING_EVENT_ADVANCED_FEATURE_NOT_SUPPORT = 3, - - RTMP_STREAMING_EVENT_REQUEST_TOO_OFTEN = 4, -}; - -UENUM(BlueprintType) -enum class ECONNECTION_CHANGED_REASON_TYPE : uint8 -{ - CONNECTION_CHANGED_CONNECTING = 0, - - CONNECTION_CHANGED_JOIN_SUCCESS = 1, - - CONNECTION_CHANGED_INTERRUPTED = 2, - - CONNECTION_CHANGED_BANNED_BY_SERVER = 3, - - CONNECTION_CHANGED_JOIN_FAILED = 4, - - CONNECTION_CHANGED_LEAVE_CHANNEL = 5, - - CONNECTION_CHANGED_INVALID_APP_ID = 6, - - CONNECTION_CHANGED_INVALID_CHANNEL_NAME = 7, - - CONNECTION_CHANGED_INVALID_TOKEN = 8, - - CONNECTION_CHANGED_TOKEN_EXPIRED = 9, - - CONNECTION_CHANGED_REJECTED_BY_SERVER = 10, - - CONNECTION_CHANGED_SETTING_PROXY_SERVER = 11, - - CONNECTION_CHANGED_RENEW_TOKEN = 12, - - CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED = 13, - - CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT = 14, - - CONNECTION_CHANGED_REJOIN_SUCCESS = 15, - - CONNECTION_CHANGED_LOST = 16, - - CONNECTION_CHANGED_ECHO_TEST = 17, - - CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED_BY_USER = 18, - - CONNECTION_CHANGED_SAME_UID_LOGIN = 19, - - CONNECTION_CHANGED_TOO_MANY_BROADCASTERS = 20, - - CONNECTION_CHANGED_LICENSE_VERIFY_FAILED = 21, -}; - - -//UENUM(BlueprintType) -//enum HEADPHONE_EQUALIZER_PRESET { -// -// HEADPHONE_EQUALIZER_OFF = 0x00000000, -// -// HEADPHONE_EQUALIZER_OVEREAR = 0x04000001, -// -// HEADPHONE_EQUALIZER_INEAR = 0x04000002 -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET : uint8 { - - HEADPHONE_EQUALIZER_OFF = 0, - - HEADPHONE_EQUALIZER_OVEREAR = 1, - - HEADPHONE_EQUALIZER_INEAR = 2 -}; - - -USTRUCT(BlueprintType) -struct FENUMWRAP_HEADPHONE_EQUALIZER_PRESET -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_HEADPHONE_EQUALIZER_PRESET") - EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET ValueWrapper = EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_OFF; - - // default - FENUMWRAP_HEADPHONE_EQUALIZER_PRESET() :ValueWrapper(EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_OFF) {} - - FENUMWRAP_HEADPHONE_EQUALIZER_PRESET(EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET InValue) { - ValueWrapper = InValue; - } - - agora::rtc::HEADPHONE_EQUALIZER_PRESET GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_OFF: - return agora::rtc::HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_OFF; - case EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_OVEREAR: - return agora::rtc::HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_OVEREAR; - case EENUMCUSTOM_HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_INEAR: - return agora::rtc::HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_INEAR; - default: - return agora::rtc::HEADPHONE_EQUALIZER_PRESET::HEADPHONE_EQUALIZER_OFF; - } - } -}; - -UENUM(BlueprintType) -enum class EWLACC_MESSAGE_REASON : uint8 { - - WLACC_MESSAGE_REASON_WEAK_SIGNAL = 0, - - WLACC_MESSAGE_REASON_CHANNEL_CONGESTION = 1, -}; - -UENUM(BlueprintType) -enum class EWLACC_SUGGEST_ACTION : uint8 { - - WLACC_SUGGEST_ACTION_CLOSE_TO_WIFI = 0, - - WLACC_SUGGEST_ACTION_CONNECT_SSID = 1, - - WLACC_SUGGEST_ACTION_CHECK_5G = 2, - - WLACC_SUGGEST_ACTION_MODIFY_SSID = 3, -}; - -//UENUM(BlueprintType) -//enum ENETWORK_TYPE { -// -// NETWORK_TYPE_UNKNOWN = -1, -// -// NETWORK_TYPE_DISCONNECTED = 0, -// -// NETWORK_TYPE_LAN = 1, -// -// NETWORK_TYPE_WIFI = 2, -// -// NETWORK_TYPE_MOBILE_2G = 3, -// -// NETWORK_TYPE_MOBILE_3G = 4, -// -// NETWORK_TYPE_MOBILE_4G = 5, -//}; - - -UENUM(BlueprintType) -enum class EENUMCUSTOM_NETWORK_TYPE : uint8 { - - NETWORK_TYPE_UNKNOWN = 0, - - NETWORK_TYPE_DISCONNECTED = 1, - - NETWORK_TYPE_LAN = 2, - - NETWORK_TYPE_WIFI = 3, - - NETWORK_TYPE_MOBILE_2G = 4, - - NETWORK_TYPE_MOBILE_3G = 5, - - NETWORK_TYPE_MOBILE_4G = 6, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_NETWORK_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_NETWORK_TYPE") - EENUMCUSTOM_NETWORK_TYPE ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_UNKNOWN; - - // default - FENUMWRAP_NETWORK_TYPE() :ValueWrapper(EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_UNKNOWN) {} - - FENUMWRAP_NETWORK_TYPE(EENUMCUSTOM_NETWORK_TYPE Val) :ValueWrapper(Val) {} - - FENUMWRAP_NETWORK_TYPE(agora::rtc::NETWORK_TYPE Val) { - switch (Val) - { - case agora::rtc::NETWORK_TYPE::NETWORK_TYPE_UNKNOWN: - ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_UNKNOWN; - break; - case agora::rtc::NETWORK_TYPE::NETWORK_TYPE_DISCONNECTED: - ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_DISCONNECTED; - break; - case agora::rtc::NETWORK_TYPE::NETWORK_TYPE_LAN: - ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_LAN; - break; - case agora::rtc::NETWORK_TYPE::NETWORK_TYPE_WIFI: - ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_WIFI; - break; - case agora::rtc::NETWORK_TYPE::NETWORK_TYPE_MOBILE_2G: - ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_MOBILE_2G; - break; - case agora::rtc::NETWORK_TYPE::NETWORK_TYPE_MOBILE_3G: - ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_MOBILE_3G; - break; - case agora::rtc::NETWORK_TYPE::NETWORK_TYPE_MOBILE_4G: - ValueWrapper = EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_MOBILE_4G; - break; - } - } - void operator = (EENUMCUSTOM_NETWORK_TYPE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::NETWORK_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_UNKNOWN: - return agora::rtc::NETWORK_TYPE::NETWORK_TYPE_UNKNOWN; - case EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_DISCONNECTED: - return agora::rtc::NETWORK_TYPE::NETWORK_TYPE_DISCONNECTED; - case EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_LAN: - return agora::rtc::NETWORK_TYPE::NETWORK_TYPE_LAN; - case EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_WIFI: - return agora::rtc::NETWORK_TYPE::NETWORK_TYPE_WIFI; - case EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_MOBILE_2G: - return agora::rtc::NETWORK_TYPE::NETWORK_TYPE_MOBILE_2G; - case EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_MOBILE_3G: - return agora::rtc::NETWORK_TYPE::NETWORK_TYPE_MOBILE_3G; - case EENUMCUSTOM_NETWORK_TYPE::NETWORK_TYPE_MOBILE_4G: - return agora::rtc::NETWORK_TYPE::NETWORK_TYPE_MOBILE_4G; - default: - return agora::rtc::NETWORK_TYPE::NETWORK_TYPE_UNKNOWN; - } - } -}; - -UENUM(BlueprintType) -enum class EENCRYPTION_ERROR_TYPE : uint8 { - ENCRYPTION_ERROR_INTERNAL_FAILURE = 0, - ENCRYPTION_ERROR_DECRYPTION_FAILURE = 1, - ENCRYPTION_ERROR_ENCRYPTION_FAILURE = 2, -}; - -UENUM(BlueprintType) -enum class EPERMISSION_TYPE : uint8 { - RECORD_AUDIO = 0, - CAMERA = 1, - SCREEN_CAPTURE = 2, -}; - -UENUM(BlueprintType) -enum class EUPLOAD_ERROR_REASON : uint8 -{ - UPLOAD_SUCCESS = 0, - UPLOAD_NET_ERROR = 1, - UPLOAD_SERVER_ERROR = 2, -}; - -UENUM(BlueprintType) -enum class ESTREAM_SUBSCRIBE_STATE : uint8 { - SUB_STATE_IDLE = 0, - SUB_STATE_NO_SUBSCRIBED = 1, - SUB_STATE_SUBSCRIBING = 2, - SUB_STATE_SUBSCRIBED = 3 -}; - -UENUM(BlueprintType) -enum class ESTREAM_PUBLISH_STATE : uint8 { - PUB_STATE_IDLE = 0, - PUB_STATE_NO_PUBLISHED = 1, - PUB_STATE_PUBLISHING = 2, - PUB_STATE_PUBLISHED = 3 -}; -UENUM(BlueprintType) -enum class EPROXY_TYPE : uint8 { - - NONE_PROXY_TYPE = 0, - - UDP_PROXY_TYPE = 1, - - TCP_PROXY_TYPE = 2, - - LOCAL_PROXY_TYPE = 3, - - TCP_PROXY_AUTO_FALLBACK_TYPE = 4, - - HTTP_PROXY_TYPE = 5, - - HTTPS_PROXY_TYPE = 6, -}; - - -USTRUCT(BlueprintType) -struct FRemoteVideoStats { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int delay = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int e2eDelay = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int height = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int receivedBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int decoderOutputFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int rendererOutputFrameRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int frameLossRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int packetLossRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - EVIDEO_STREAM_TYPE rxStreamType = EVIDEO_STREAM_TYPE::VIDEO_STREAM_HIGH; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int totalFrozenTime = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int frozenRate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int avSyncTimeMs = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int totalActiveTime = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int publishDuration = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int mosValue = 0; - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RemoteVideoStats") - int64 rxVideoBytes = 0; -}; - -USTRUCT(BlueprintType) -struct FWlAccStats { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WlAccStats") - int64 e2eDelayPercent = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WlAccStats") - int64 frozenRatioPercent = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|WlAccStats") - int64 lossRatePercent = 0; -}; -USTRUCT(BlueprintType) -struct FAgoraMetadata -{ - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraMetadata") - int64 uid = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraMetadata") - int64 size = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraMetadata") - TArray buffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|AgoraMetadata") - int64 timeStampMs = 0; -}; -UENUM(BlueprintType) -enum class EDIRECT_CDN_STREAMING_STATE : uint8 { - - 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, -}; - -UENUM(BlueprintType) -enum class EDIRECT_CDN_STREAMING_ERROR : uint8 { - - DIRECT_CDN_STREAMING_ERROR_OK = 0, - - DIRECT_CDN_STREAMING_ERROR_FAILED = 1, - - DIRECT_CDN_STREAMING_ERROR_AUDIO_PUBLICATION = 2, - - DIRECT_CDN_STREAMING_ERROR_VIDEO_PUBLICATION = 3, - - DIRECT_CDN_STREAMING_ERROR_NET_CONNECT = 4, - - DIRECT_CDN_STREAMING_ERROR_BAD_NAME = 5, -}; - -USTRUCT(BlueprintType) -struct FDirectCdnStreamingStats { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") - int videoWidth = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") - int videoHeight = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") - int fps = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") - int videoBitrate = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|DirectCdnStreamingStats") - int audioBitrate = 0; -}; - -//UENUM(BlueprintType) -//enum EMETADATA_TYPE -//{ -// UNKNOWN_METADATA = -1, -// -// VIDEO_METADATA = 0, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_METADATA_TYPE : uint8 -{ - UNKNOWN_METADATA = 0, - - VIDEO_METADATA = 1, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_METADATA_TYPE -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_METADATA_TYPE") - EENUMCUSTOM_METADATA_TYPE ValueWrapper = EENUMCUSTOM_METADATA_TYPE::UNKNOWN_METADATA; - - // default - FENUMWRAP_METADATA_TYPE() :ValueWrapper(EENUMCUSTOM_METADATA_TYPE::UNKNOWN_METADATA) {} - - FENUMWRAP_METADATA_TYPE(EENUMCUSTOM_METADATA_TYPE Val) :ValueWrapper(Val) {} - void operator = (EENUMCUSTOM_METADATA_TYPE InValue) { - ValueWrapper = InValue; - } - - agora::rtc::IMetadataObserver::METADATA_TYPE GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_METADATA_TYPE::UNKNOWN_METADATA: - return agora::rtc::IMetadataObserver::METADATA_TYPE::UNKNOWN_METADATA; - case EENUMCUSTOM_METADATA_TYPE::VIDEO_METADATA: - return agora::rtc::IMetadataObserver::METADATA_TYPE::VIDEO_METADATA; - default: - return agora::rtc::IMetadataObserver::METADATA_TYPE::UNKNOWN_METADATA; - } - } -}; - - -UENUM(BlueprintType) -enum class ESTREAMING_SRC_STATE : uint8 { - STREAMING_SRC_STATE_CLOSED = 0, - STREAMING_SRC_STATE_OPENING = 1, - STREAMING_SRC_STATE_IDLE = 2, - STREAMING_SRC_STATE_PLAYING = 3, - STREAMING_SRC_STATE_SEEKING = 4, - STREAMING_SRC_STATE_EOF = 5, - STREAMING_SRC_STATE_ERROR = 6, -}; - -UENUM(BlueprintType) -enum class ESTREAMING_SRC_ERR : uint8 { - STREAMING_SRC_ERR_NONE = 0, - STREAMING_SRC_ERR_UNKNOWN = 1, - STREAMING_SRC_ERR_INVALID_PARAM = 2, - STREAMING_SRC_ERR_BAD_STATE = 3, - STREAMING_SRC_ERR_NO_MEM = 4, - STREAMING_SRC_ERR_BUFFER_OVERFLOW = 5, - STREAMING_SRC_ERR_BUFFER_UNDERFLOW = 6, - STREAMING_SRC_ERR_NOT_FOUND = 7, - STREAMING_SRC_ERR_TIMEOUT = 8, - STREAMING_SRC_ERR_EXPIRED = 9, - STREAMING_SRC_ERR_UNSUPPORTED = 10, - STREAMING_SRC_ERR_NOT_EXIST = 11, - STREAMING_SRC_ERR_EXIST = 12, - STREAMING_SRC_ERR_OPEN = 13, - STREAMING_SRC_ERR_CLOSE = 14, - STREAMING_SRC_ERR_READ = 15, - STREAMING_SRC_ERR_WRITE = 16, - STREAMING_SRC_ERR_SEEK = 17, - STREAMING_SRC_ERR_EOF = 18, - STREAMING_SRC_ERR_CODECOPEN = 19, - STREAMING_SRC_ERR_CODECCLOSE = 20, - STREAMING_SRC_ERR_CODECPROC = 21, -}; - - -UENUM(BlueprintType) -enum class EMEDIA_PLAYER_STATE : uint8 { - PLAYER_STATE_IDLE = 0, - PLAYER_STATE_OPENING, - PLAYER_STATE_OPEN_COMPLETED, - PLAYER_STATE_PLAYING, - PLAYER_STATE_PAUSED, - PLAYER_STATE_PLAYBACK_COMPLETED, - PLAYER_STATE_PLAYBACK_ALL_LOOPS_COMPLETED, - PLAYER_STATE_STOPPED, - PLAYER_STATE_PAUSING_INTERNAL = 50, - PLAYER_STATE_STOPPING_INTERNAL, - PLAYER_STATE_SEEKING_INTERNAL, - PLAYER_STATE_GETTING_INTERNAL, - PLAYER_STATE_NONE_INTERNAL, - PLAYER_STATE_DO_NOTHING_INTERNAL, - PLAYER_STATE_SET_TRACK_INTERNAL, - PLAYER_STATE_FAILED = 100, -}; -USTRUCT(BlueprintType) -struct FThumbImageBuffer { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") - TArray buffer; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") - int64 length = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") - int64 width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|ThumbImageBuffer") - int64 height = 0; -}; - - -//UENUM(BlueprintType) -//enum EScreenCaptureSourceType { -// ScreenCaptureSourceType_Unknown = -1, -// ScreenCaptureSourceType_Window = 0, -// ScreenCaptureSourceType_Screen = 1, -// ScreenCaptureSourceType_Custom = 2, -//}; - -UENUM(BlueprintType) -enum class EENUMCUSTOM_ScreenCaptureSourceType : uint8 { - ScreenCaptureSourceType_Unknown = 0, - ScreenCaptureSourceType_Window = 1, - ScreenCaptureSourceType_Screen = 2, - ScreenCaptureSourceType_Custom = 3, -}; - - -USTRUCT(BlueprintType) -struct FENUMWRAP_ScreenCaptureSourceType -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_ScreenCaptureSourceType") - EENUMCUSTOM_ScreenCaptureSourceType ValueWrapper = EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown; - - // default - FENUMWRAP_ScreenCaptureSourceType() :ValueWrapper(EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown) {} - - FENUMWRAP_ScreenCaptureSourceType(EENUMCUSTOM_ScreenCaptureSourceType Val) :ValueWrapper(Val) {} - - void operator = (EENUMCUSTOM_ScreenCaptureSourceType InValue) { - ValueWrapper = InValue; - } - -#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) - - FENUMWRAP_ScreenCaptureSourceType(agora::rtc::ScreenCaptureSourceType Val) { - switch (Val) - { - case agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown: - ValueWrapper = EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown; - break; - case agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Window: - ValueWrapper = EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Window; - break; - case agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Screen: - ValueWrapper = EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Screen; - break; - case agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Custom: - ValueWrapper = EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Custom; - break; - default: - ValueWrapper = EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown; - } - } - - agora::rtc::ScreenCaptureSourceType GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown: - return agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown; - case EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Window: - return agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Window; - case EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Screen: - return agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Screen; - case EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Custom: - return agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Custom; - default: - return agora::rtc::ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown; - } - } - -#endif -}; - -USTRUCT(BlueprintType) -struct FScreenCaptureSourceInfo { - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - FENUMWRAP_ScreenCaptureSourceType type = EENUMCUSTOM_ScreenCaptureSourceType::ScreenCaptureSourceType_Unknown; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - int64 sourceId = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - FString sourceName = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - FThumbImageBuffer thumbImage = FThumbImageBuffer(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - FThumbImageBuffer iconImage = FThumbImageBuffer(); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - FString processPath = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - FString sourceTitle = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - bool primaryMonitor = false; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FScreenCaptureSourceInfo") - bool isOccluded = false; -}; - - -USTRUCT(BlueprintType) -struct FSIZE { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SIZE") - int width = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|SIZE") - int height = 0; -}; - -USTRUCT(BlueprintType) -struct FRecorderInfo { - - GENERATED_BODY() - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RecorderInfo") - FString fileName = ""; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RecorderInfo") - int64 durationMs = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|RecorderInfo") - int64 fileSize = 0; -}; - -//UENUM(BlueprintType) -//enum ERecorderState { -// -// RECORDER_STATE_NULL = 0, -// -// RECORDER_STATE_ERROR = -1, -// -// RECORDER_STATE_START = 2, -// -// RECORDER_STATE_STOP = 3, -//}; - - -UENUM(BlueprintType) -enum class EENUMCUSTOM_RecorderState : uint8 { - - RECORDER_STATE_NULL = 0, - - RECORDER_STATE_ERROR = 1, - - RECORDER_STATE_START = 2, - - RECORDER_STATE_STOP = 3, -}; - -USTRUCT(BlueprintType) -struct FENUMWRAP_RecorderState -{ - GENERATED_BODY() - -public: - // require to call [GetRawValue] method to get the raw value - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_RecorderState") - EENUMCUSTOM_RecorderState ValueWrapper = EENUMCUSTOM_RecorderState::RECORDER_STATE_ERROR; - - // default - FENUMWRAP_RecorderState() :ValueWrapper(EENUMCUSTOM_RecorderState::RECORDER_STATE_ERROR) {} - - FENUMWRAP_RecorderState(EENUMCUSTOM_RecorderState Val) :ValueWrapper(Val) {} - - FENUMWRAP_RecorderState(agora::media::RecorderState Val) { - switch (Val) - { - case agora::media::RecorderState::RECORDER_STATE_ERROR: - ValueWrapper = EENUMCUSTOM_RecorderState::RECORDER_STATE_ERROR; - break; - case agora::media::RecorderState::RECORDER_STATE_START: - ValueWrapper = EENUMCUSTOM_RecorderState::RECORDER_STATE_START; - break; - case agora::media::RecorderState::RECORDER_STATE_STOP: - ValueWrapper = EENUMCUSTOM_RecorderState::RECORDER_STATE_STOP; - break; - default: - ValueWrapper = EENUMCUSTOM_RecorderState::RECORDER_STATE_ERROR; - } - } - void operator = (EENUMCUSTOM_RecorderState InValue) { - ValueWrapper = InValue; - } - - agora::media::RecorderState GetRawValue() const { - switch (ValueWrapper) - { - case EENUMCUSTOM_RecorderState::RECORDER_STATE_ERROR: - return agora::media::RecorderState::RECORDER_STATE_ERROR; - case EENUMCUSTOM_RecorderState::RECORDER_STATE_START: - return agora::media::RecorderState::RECORDER_STATE_START; - case EENUMCUSTOM_RecorderState::RECORDER_STATE_STOP: - return agora::media::RecorderState::RECORDER_STATE_STOP; - default: - return agora::media::RecorderState::RECORDER_STATE_ERROR; - } - } -}; - - - -UENUM(BlueprintType) -enum class ERecorderErrorCode : uint8 { - - RECORDER_ERROR_NONE = 0, - - RECORDER_ERROR_WRITE_FAILED = 1, - - RECORDER_ERROR_NO_STREAM = 2, - - RECORDER_ERROR_OVER_MAX_DURATION = 3, - - RECORDER_ERROR_CONFIG_CHANGED = 4, -}; - - -USTRUCT(BlueprintType) -struct FSpatialAudioZone { - - GENERATED_BODY() - - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - int zoneSetId = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - FVector position = FVector(0,0,0); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - FVector forward = FVector(0, 0, 0); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - FVector right = FVector(0, 0, 0); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - FVector up = FVector(0, 0, 0); - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - float forwardLength = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - float rightLength = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - float upLength = 0; - UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FSpatialAudioZone") - float audioAttenuation = 0; - -}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityAgoraBPuLogger.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityAgoraBPuLogger.h new file mode 100644 index 00000000..dfe3532c --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityAgoraBPuLogger.h @@ -0,0 +1,44 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. + +#pragma once + +#include "CoreMinimal.h" +#include "AgoraPlugin.h" +#include "Kismet/BlueprintFunctionLibrary.h" + +#include "AgoraHeaderBase.h" +#include "UtilityAgoraBPuLogger.generated.h" + + +#if defined(_MSC_VER) +#define AG_FUNCTION_MACRO __FUNCTION__ +#else +#define AG_FUNCTION_MACRO __PRETTY_FUNCTION__ +#endif + +static TMap AGORA_UEBP_ERR_STR = +{ + {AGORA_UE_ERROR_CODE::ERROR_BP_RTC_ENGINE_NOT_INITIALIZED," Agora Rtc Engine may not be initialized, please check if it has been initialized. "}, + {AGORA_UE_ERROR_CODE::ERROR_NULLPTR," Agora pointer Is nullptr, please check if it has been created successfully."}, +}; + +/** + * + */ +UCLASS() +class AGORAPLUGIN_API UAgoraBPuLogger : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() + +public: + + static bool bDisablePrintToConsole; + static bool bDisablePrintToLogMsgView; + static bool bDisablePrintOnScreen; + static FString ConsolePrefix; + + + static void Print(FString LogMsg, bool bToConsole = true,bool bOnScreen = true); + static void PrintWarn(FString LogMsg, bool bToConsole = true, bool bOnScreen = true); + static void PrintError(FString LogMsg, bool bToConsole = true, bool bOnScreen = true); +}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityUABTTypeHelper.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityUABTTypeHelper.h new file mode 100644 index 00000000..6307e4e7 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityUABTTypeHelper.h @@ -0,0 +1,440 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. + +#pragma once + +#include "CoreMinimal.h" +#include "UObject/NoExportTypes.h" +#include "Components/Image.h" + + +#include "UtilityAgoraBPuLogger.h" +#include "AgoraHeaderBase.h" + + +#include "UtilityUABTTypeHelper.generated.h" + + + +UENUM(BlueprintType) +enum class EAgoraOptional : uint8 { + AGORA_NULL_VALUE = 0, + AGORA_TRUE_VALUE = 1, + AGORA_FALSE_VALUE = 2, +}; + + +namespace agora { + namespace rtc { + namespace ue { + // Unreal Agora Blueprint Type Helper + class UABT { + + public: + + + +#pragma region To + // UE Blueprint Type To Agora Blueprint Type + static inline agora::rtc::uid_t ToUID(int64 num) { + if (num < 0 || num > static_cast(std::numeric_limits::max())) { + FString Msg = FString::Printf(TEXT("%lld is over the range of uid_t"), num); + UAgoraBPuLogger::PrintWarn(Msg); + } + + return static_cast(num); + } + + static inline agora::rtc::track_id_t ToVTID(int64 ID) { + if (ID < 0 || ID > static_cast(std::numeric_limits::max())) { + FString Msg = FString::Printf(TEXT("%lld is over the range of track_id_t"), ID); + UAgoraBPuLogger::PrintWarn(Msg); + } + + return static_cast(ID); + } + + + static inline double ToDouble(const FString& str) { + return FCString::Atod(*str); + } + + + static inline double ToDisplayID(int64 ID) { + if (ID < 0 || ID > static_cast(std::numeric_limits::max())) { + FString Msg = FString::Printf(TEXT("%lld is over the range of track_id_t"), ID); + UAgoraBPuLogger::PrintWarn(Msg); + } + + return static_cast(ID); + } + + + static inline agora::view_t ToView(int64 view) { + // For now, Windows doesn't support 32 bit + return (view_t)(view); + } +#pragma endregion To + + + + +#pragma region From + // From Agora Type to UE Blueprint Type + + + static inline int64 FromViewToInt(agora::view_t view) { + return (int64)view; + } +#pragma endregion From + + }; + + + } + } +} + + + +#pragma region Set UEBP Optional Value + +// Currently, We use UEnum for optional bool value display. +// For other (non-bool) optional variables, _SetValue is added to represent the Optional Null case. + +#ifndef UABT_FUNCTION_MACRO + +#if defined(_MSC_VER) +//#define UABT_FUNCTION_MACRO __FUNCSIG__ +#define UABT_FUNCTION_MACRO __FUNCTION__ +#else +#define UABT_FUNCTION_MACRO __PRETTY_FUNCTION__ +#endif + +#endif + +#define AGUE_OPT_SUFFIX _SetValue + +#define AGUE_CONCAT_(a, b) a##b +#define AGUE_CONCAT(a, b) AGUE_CONCAT_(a, b) + +#define SET_UABT_FVECTOR_TO_AGORA_FLOAT3(DST_AGORA_FLOAT3,SRC_UEBP_FVECTOR)\ + {\ + (DST_AGORA_FLOAT3)[0] = (SRC_UEBP_FVECTOR).X;\ + (DST_AGORA_FLOAT3)[1] = (SRC_UEBP_FVECTOR).Y;\ + (DST_AGORA_FLOAT3)[2] = (SRC_UEBP_FVECTOR).Z;\ + } + +#define SET_UABT_AGORA_FLOAT3_TO_FVECTOR(DST_UEBP_FVECTOR,SRC_AGORA_FLOAT3)\ + {\ + (DST_UEBP_FVECTOR) = FVector((SRC_AGORA_FLOAT3)[0],(SRC_AGORA_FLOAT3)[1],(SRC_AGORA_FLOAT3)[2]);\ + } + + +#define SET_UABT_GENERIC_PTR___MEMFREE(DST_AGORA_PTR)\ + {\ + if(DST_AGORA_PTR){\ + delete[] DST_AGORA_PTR;\ + DST_AGORA_PTR = nullptr;\ + }\ + } + +// Convert: From double to FString (The precision is 6 decimal places.) +#define SET_UABT_DOUBLE_TO_FSTRING(DST_UEBP_VAR_FSTR,SRC_AGORA_VAR_DOUBLE)\ + {\ + (DST_UEBP_VAR_FSTR) = FString::SanitizeFloat((SRC_AGORA_VAR_DOUBLE)); \ + } + +// Convert: From FString to double +#define SET_UABT_FSTRING_TO_DOUBLE(DST_AGORA_VAR_DOUBLE,SRC_UEBP_VAR_FSTR)\ + {\ + (DST_AGORA_VAR_DOUBLE) = static_cast(FCString::Atod(*(SRC_UEBP_VAR_FSTR)));\ + } + + +// Convert: From FString to const char* +#define SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(DST_AGORA_CHARPTR,SRC_UE_FSTR)\ + {\ + FTCHARToUTF8 TempUTF8String(*(SRC_UE_FSTR));\ + char* TempCharPtr = new char[TempUTF8String.Length() + 1];\ + FMemory::Memcpy(TempCharPtr, TempUTF8String.Get(), TempUTF8String.Length()); \ + TempCharPtr[TempUTF8String.Length()] = '\0';\ + DST_AGORA_CHARPTR = TempCharPtr;\ + } + +// Free: const char* (From FString) +#define SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(DST_AGORA_CHARPTR)\ + {\ + if(DST_AGORA_CHARPTR){\ + delete[] DST_AGORA_CHARPTR;\ + DST_AGORA_CHARPTR = nullptr;\ + }\ + } + +// Convert: From FString to unsigned char* +#define SET_UABT_FSTRING_TO_UNSIGNED_CHAR___MEMALLOC(DST_AGORA_CHARPTR,SRC_UE_FSTR)\ + {\ + FTCHARToUTF8 TempUTF8String(*(SRC_UE_FSTR));\ + unsigned char* TempCharPtr = new unsigned char[TempUTF8String.Length() + 1];\ + FMemory::Memcpy(TempCharPtr, TempUTF8String.Get(), TempUTF8String.Length()); \ + TempCharPtr[TempUTF8String.Length()] = '\0';\ + DST_AGORA_CHARPTR = TempCharPtr;\ + } + +// Free: unsigned char* (From FString) +#define SET_UABT_FSTRING_TO_UNSIGNED_CHAR___MEMFREE(DST_AGORA_CHARPTR)\ + {\ + if(DST_AGORA_CHARPTR){\ + delete[] DST_AGORA_CHARPTR;\ + DST_AGORA_CHARPTR = nullptr;\ + }\ + } + +// Convert: From TArray to uint8* +#define SET_UABT_TARRAY_UINT8_TO_AGORA_UINT8_PTR___MEMALLOC(DST_AGORA_PTR,SRC_UE_TARRAY)\ + {\ + uint8* TmpPtr = new uint8[(SRC_UE_TARRAY).Num()];\ + FMemory::Memcpy(TmpPtr,(SRC_UE_TARRAY).GetData(),(SRC_UE_TARRAY).Num());\ + (DST_AGORA_PTR) = TmpPtr;\ + } + +// Free: uuint8* (TArray) +#define SET_UABT_TARRAY_UINT8_TO_AGORA_UINT8_PTR___MEMFREE(DST_AGORA_PTR)\ + {\ + if(DST_AGORA_PTR){\ + delete[] DST_AGORA_PTR;\ + DST_AGORA_PTR = nullptr;\ + }\ + } + + +// Convert: From TArray to TYPE* +#define SET_UABT_GENERIC_TARRAY_TO_AGORA_PTR___MEMALLOC(DST_AGORA_PTR,SRC_UE_TARRAY,AGORA_TPYE,BYTE_COUNT)\ + {\ + AGORA_TPYE* TmpPtr = new AGORA_TPYE[(SRC_UE_TARRAY).Num()];\ + FMemory::Memcpy(TmpPtr,(SRC_UE_TARRAY).GetData(),BYTE_COUNT);\ + (DST_AGORA_PTR) = TmpPtr;\ + } + +// Free: TYPE* (TArray) +#define SET_UABT_GENERIC_TARRAY_TO_AGORA_PTR___MEMFREE(DST_AGORA_PTR)\ + {\ + if(DST_AGORA_PTR){\ + delete[] DST_AGORA_PTR;\ + DST_AGORA_PTR = nullptr;\ + }\ + } + + +// Convert: TArray to const char** +#define SET_UABT_TARRARY_FSTRING_TO_CONST_AGORA_ARRAY___MEMALLOC(DST_AGORA_PTR,UNSIGNED_INT_SIZE_COUNT,UEBP_TARRAY)\ + {\ + (DST_AGORA_PTR) = new const char*[UNSIGNED_INT_SIZE_COUNT];\ + for (unsigned int i = 0; i < static_cast(UNSIGNED_INT_SIZE_COUNT); i++) {\ + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(((DST_AGORA_PTR)[i]), ((UEBP_TARRAY)[i]))\ + }\ + } + +// Convert: TArray to char** +#define SET_UABT_TARRARY_FSTRING_TO_AGORA_ARRAY___MEMALLOC(DST_AGORA_PTR,UNSIGNED_INT_SIZE_COUNT,UEBP_TARRAY)\ + {\ + (DST_AGORA_PTR) = new char*[UNSIGNED_INT_SIZE_COUNT];\ + for (unsigned int i = 0; i < static_cast(UNSIGNED_INT_SIZE_COUNT); i++) {\ + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(((DST_AGORA_PTR)[i]), ((UEBP_TARRAY)[i]))\ + }\ + } + +// Free: TArray to char** +#define SET_UABT_TARRARY_FSTRING_TO_AGORA_ARRAY___MEMFREE(DST_AGORA_PTR,UNSIGNED_INT_SIZE_COUNT)\ + {\ + if((DST_AGORA_PTR)){\ + for (unsigned int i = 0; i < static_cast(UNSIGNED_INT_SIZE_COUNT); i++) {\ + SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE((DST_AGORA_PTR)[i]);\ + }\ + delete[] (DST_AGORA_PTR);\ + (DST_AGORA_PTR) = nullptr;\ + }\ + } + + +// Convert: FAgoraStruct to AgoraStruct* +#define SET_UABT_UECUSTOMDATA_TO_AGORA_PTR_1_ENTRY___MEMALLOC(DST_AGORA_PTR, AGORA_TYPE,UEBP_STRUCT)\ + {\ + (DST_AGORA_PTR) = new AGORA_TYPE;\ + *(DST_AGORA_PTR) = (UEBP_STRUCT).CreateAgoraData();\ + } + +// Unsafe, No Check +// Free AgoraStruct* +#define SET_UABT_UECUSTOMDATA_TO_AGORA_PTR_1_ENTRY___MEMFREE(DST_AGORA_PTR,UEBP_TYPE)\ + SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(DST_AGORA_PTR,1,UEBP_TYPE) + + +// Convert: TArray to AgoraStruct* +#define SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMALLOC(DST_AGORA_PTR, AGORA_TYPE,UNSIGNED_INT_SIZE_COUNT,UEBP_TARRAY)\ + {\ + (DST_AGORA_PTR) = new AGORA_TYPE[UNSIGNED_INT_SIZE_COUNT];\ + for (unsigned int i = 0; i < static_cast(UNSIGNED_INT_SIZE_COUNT); i++) {\ + (DST_AGORA_PTR)[i] = (UEBP_TARRAY)[i].CreateAgoraData();\ + }\ + } + +// Unsafe, No Check +// Free: AgoraStruct* +#define SET_UABT_TARRARY_CUSTOMDATA_TO_AGORA_ARRAY___MEMFREE(DST_AGORA_PTR,UNSIGNED_INT_SIZE_COUNT,UEBP_TYPE)\ + {\ + if((DST_AGORA_PTR)){\ + UEBP_TYPE ReleaseOperator;\ + for (unsigned int i = 0; i < static_cast(UNSIGNED_INT_SIZE_COUNT); i++) {\ + ReleaseOperator.FreeAgoraData((DST_AGORA_PTR)[i]);\ + }\ + delete[] (DST_AGORA_PTR);\ + (DST_AGORA_PTR) = nullptr;\ + }\ + } + +// Convert: FString to Char[] +#define SET_UABT_FSTRING_TO_CHAR_ARRAY(DST_AGORA_CHAR_ARRAY,SRC_UE_FSTR,MAX_ARRAY_LENGTH)\ + {\ + std::string cstr = TCHAR_TO_UTF8(*(SRC_UE_FSTR));\ + if (cstr.length() < (MAX_ARRAY_LENGTH)) {\ + for (int i = 0; i < cstr.length(); i++) {\ + (DST_AGORA_CHAR_ARRAY)[i] = cstr[i];\ + }\ + (DST_AGORA_CHAR_ARRAY)[cstr.length()] = '\0';\ + }\ + else {\ + UE_LOG(LogTemp, Warning, TEXT("[Agora UABT] FString to CharArray Failed: Reason:[Size %d >= %d, leaving no space for the end-of-line symbol. Location: [%s] ]"),cstr.length(),(MAX_ARRAY_LENGTH),*FString(UABT_FUNCTION_MACRO));\ + }\ + } + + +// [SetUEBPOptional] - Bool +#define SET_UEBP_OPTIONAL_VAL_BOOL(DST_UEBP_VAR,SRC_AGORA_VAR)\ + if((SRC_AGORA_VAR).has_value()){\ + (DST_UEBP_VAR) = (SRC_AGORA_VAR).value() ? EAgoraOptional::AGORA_TRUE_VALUE : EAgoraOptional::AGORA_FALSE_VALUE;\ + }else{\ + (DST_UEBP_VAR) = EAgoraOptional::AGORA_NULL_VALUE;\ + } + + +// UE Use FString for double type, so we need to convert the double to FString +// [SetUEBPOptional] - Double +#define SET_UEBP_OPTIONAL_VAL_DOUBLE(DST_UEBP_VAR,SRC_AGORA_VAR)\ + if((SRC_AGORA_VAR).has_value()){\ + UABT_DOUBLE_TO_FSTRING((DST_UEBP_VAR),((SRC_AGORA_VAR).value()))\ + AGUE_CONCAT(DST_UEBP_VAR,AGUE_OPT_SUFFIX)= true;\ + }else{\ + AGUE_CONCAT(DST_UEBP_VAR,AGUE_OPT_SUFFIX) = false;\ + } + + +// UE Use FString for double type, so we need to convert the double to FString +// [SetUEBPOptional] - FString +#define SET_UEBP_OPTIONAL_VAL_FString(DST_UEBP_VAR,SRC_AGORA_VAR)\ + if((SRC_AGORA_VAR).has_value()){\ + (DST_UEBP_VAR) = UTF8_TO_TCHAR((SRC_AGORA_VAR).value());\ + AGUE_CONCAT(DST_UEBP_VAR,AGUE_OPT_SUFFIX)= true;\ + }else{\ + AGUE_CONCAT(DST_UEBP_VAR,AGUE_OPT_SUFFIX) = false;\ + } + +// directly assign value to the variable +// [SetUEBPOptional] - Directly Assign [SRC_AGORA_VAR] +#define SET_UEBP_OPTIONAL_VAL_DIR_ASSIGN(DST_UEBP_VAR,SRC_AGORA_VAR)\ + if((SRC_AGORA_VAR).has_value()){\ + (DST_UEBP_VAR) = (SRC_AGORA_VAR).value();\ + AGUE_CONCAT(DST_UEBP_VAR,AGUE_OPT_SUFFIX)= true;\ + }else{\ + AGUE_CONCAT(DST_UEBP_VAR,AGUE_OPT_SUFFIX) = false;\ + } + +// directly assign value to the variable +// [SetUEBPOptional] - Directly Assign With Value [OPT_VAL] +#define SET_UEBP_OPTIONAL_VAL_ASSIGN_VAL(DST_UEBP_VAR,SRC_AGORA_VAR,OPT_VAL)\ + if((SRC_AGORA_VAR).has_value()){\ + (DST_UEBP_VAR) = OPT_VAL;\ + AGUE_CONCAT(DST_UEBP_VAR,AGUE_OPT_SUFFIX)= true;\ + }else{\ + AGUE_CONCAT(DST_UEBP_VAR,AGUE_OPT_SUFFIX) = false;\ + } + + +// Convert: TArray to GENERIC_TYPE* +#define SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMALLOC(DST_AGORA_PTR, AGORA_TYPE,UNSIGNED_INT_SIZE_COUNT,UEBP_TARRAY)\ + {\ + (DST_AGORA_PTR) = new AGORA_TYPE[UNSIGNED_INT_SIZE_COUNT];\ + for (unsigned int i = 0; i < static_cast(UNSIGNED_INT_SIZE_COUNT); i++) {\ + (DST_AGORA_PTR)[i] = static_cast((UEBP_TARRAY)[i]);\ + }\ + } + +// Free: TArray to GENERIC_TYPE* +#define SET_UABT_GENERIC_TYPE_TARRARY_TO_AGORA_PTR_FORLOOP_ASSIGN___MEMFREE(DST_AGORA_PTR)\ + SET_UABT_GENERIC_PTR___MEMFREE(DST_AGORA_PTR) + +#pragma endregion + + +#pragma region Set Agora Optional Value + +// [SetAgoraOptional] - Optional +#define SET_AGORA_OPTIONAL_VAL_BOOL(DST_AGORA_VAR,SRC_UEBP_VAR)\ + if((SRC_UEBP_VAR) == EAgoraOptional::AGORA_TRUE_VALUE){\ + (DST_AGORA_VAR) = true;\ + }else if((SRC_UEBP_VAR) == EAgoraOptional::AGORA_FALSE_VALUE){\ + (DST_AGORA_VAR) = false;\ + }else{\ + (DST_AGORA_VAR) = agora::nullopt;\ + } + +// [SetAgoraOptional] - Optional +#define SET_AGORA_OPTIONAL_VAL_DOUBLE(DST_AGORA_VAR,SRC_UEBP_VAR)\ + if(AGUE_CONCAT(SRC_UEBP_VAR,AGUE_OPT_SUFFIX)== true){\ + UABT_FSTRING_TO_DOUBLE((DST_AGORA_VAR),(SRC_UEBP_VAR));\ + } + +// DST_AGORA_VAR [const char*] SRC_UEBP_VAR [FString] +// [SetAgoraOptional] - Optional +#define SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOALLOC(DST_AGORA_VAR_CHAR_PTR,SRC_UEBP_VAR_FSTR)\ + if(AGUE_CONCAT(SRC_UEBP_VAR_FSTR,AGUE_OPT_SUFFIX)== true){\ + SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(DST_AGORA_VAR_CHAR_PTR,SRC_UEBP_VAR_FSTR);\ + } + +// [Free] - Optional +#define SET_AGORA_OPTIONAL_VAL_CHARPTR______MEMOFREE(DST_AGORA_VAR_CHAR_PTR)\ + {\ + if(DST_AGORA_VAR_CHAR_PTR){\ + delete[] DST_AGORA_VAR_CHAR_PTR.value();\ + DST_AGORA_VAR_CHAR_PTR = nullptr;\ + }\ + } + +//[SetAgoraOptional] - Directly Assign +#define SET_AGORA_OPTIONAL_VAL_DIR_ASSIGN(DST_AGORA_VAR,SRC_UEBP_VAR)\ + if(AGUE_CONCAT(SRC_UEBP_VAR,AGUE_OPT_SUFFIX)== true){\ + (DST_AGORA_VAR) = SRC_UEBP_VAR;\ + } + +//[SetAgoraOptional] - Directly Assign with Specified Value +#define SET_AGORA_OPTIONAL_VAL_ASSIGN_VAL(DST_AGORA_VAR,SRC_UEBP_VAR,OPT_VAL)\ + if(AGUE_CONCAT(SRC_UEBP_VAR,AGUE_OPT_SUFFIX)== true){\ + (DST_AGORA_VAR) = OPT_VAL;\ + } + +//[SetAgoraOptional] - Optional +#define SET_AGORA_OPTIONAL_VAL_CUSTOMDATA___CREATE(DST_AGORA_VAR,SRC_UEBP_VAR)\ + if(AGUE_CONCAT(SRC_UEBP_VAR,AGUE_OPT_SUFFIX)== true){\ + (DST_AGORA_VAR) = ((SRC_UEBP_VAR).CreateAgoraData());\ + } + +//[Free] - Optional +#define SET_AGORA_OPTIONAL_VAL_CUSTOMDATA___FREE(DST_AGORA_VAR,UEBP_TYPE)\ + {\ + UEBP_TYPE ReleaseOperator;\ + auto TempVar = (DST_AGORA_VAR).value();\ + ReleaseOperator.FreeAgoraData(TempVar);\ + } + +#pragma endregion + + diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityUEEnumAgoraConvertMacro.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityUEEnumAgoraConvertMacro.h new file mode 100644 index 00000000..7f90273c --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraBluePrintPlugin/UtilityUEEnumAgoraConvertMacro.h @@ -0,0 +1,648 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. + +#pragma once + + +#pragma region AGORAENUM_UEENUM_CONVERT - Base + +// Base + +#pragma region Complete Base Macro Example +//// Complete BASE Macro +//#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) \ +// USTRUCTNAME() :ValueWrapper(UE_ENUM_TYPE::DEFAULT_ENUM_VAL) {}\ +// USTRUCTNAME(UE_ENUM_TYPE Val) :ValueWrapper(Val) {}\ +// USTRUCTNAME(AGORA_ENUM_TYPE val){\ +// switch (val) {\ +// case AGORA_ENUM_TYPE::DEFAULT_ENUM_VAL: ValueWrapper = UE_ENUM_TYPE::DEFAULT_ENUM_VAL; break;\ +// \ +// CONSTRUCTPR_SWITCH_MACROFUNC(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) \ +// \ +// default: ValueWrapper = UE_ENUM_TYPE::DEFAULT_ENUM_VAL; break;\ +// };\ +// }\ +// void operator = (UE_ENUM_TYPE InValue) {\ +// \ +// ValueWrapper = InValue; \ +// }\ +// AGORA_ENUM_TYPE GetRawValue() const { \ +// switch (ValueWrapper)\ +// {\ +// case UE_ENUM_TYPE::DEFAULT_ENUM_VAL: return AGORA_ENUM_TYPE::DEFAULT_ENUM_VAL; break;\ +// \ +// GET_RAW_VAL_SWITCH_MACROFUNC()\ +// \ +// default: return AGORA_ENUM_TYPE::DEFAULT_ENUM_VAL;\ +// }\ +// }; +#pragma endregion + + +#pragma region Original UStruct Example +//USTRUCT(BlueprintType) +//struct FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE +//{ +// GENERATED_BODY() +// +//public: +// // require to call [GetRawValue] method to get the raw value +// UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE") +// EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; +// +// // default +// FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE() :ValueWrapper(EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID) {} +// +// FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE(EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE Val) :ValueWrapper(Val) {} +// void operator = (EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE InValue) { +// ValueWrapper = InValue; +// } +// FENUMWRAP_CAPTURE_BRIGHTNESS_LEVEL_TYPE(agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE Val) { +// switch (Val) { +// case agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID: +// ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; +// break; +// case agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_NORMAL: +// ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_NORMAL; +// break; +// case agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_BRIGHT: +// ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_BRIGHT; +// break; +// case agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_DARK: +// ValueWrapper = EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_DARK; +// break; +// } +// } +// agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE GetRawValue() const { +// switch (ValueWrapper) +// { +// case EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID: +// return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; +// case EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_NORMAL: +// return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_NORMAL; +// case EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_BRIGHT: +// return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_BRIGHT; +// case EENUMCUSTOM_CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_DARK: +// return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_DARK; +// default: +// return agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE::CAPTURE_BRIGHTNESS_LEVEL_INVALID; +// } +// } +//}; +#pragma endregion + + +// a member variable name in UAgoraEnumConvertToUEEnumStruct +#define AGORA_UE_ENUM_C_VAR_NAME ValueWrapper + +#define GET_AGORA_ENUM_VAL_FUNC_NAME GetRawValue + +/* +1. default constructor +2. constructor with UE enum val +3. constructor with agora enum val +*/ +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) \ + USTRUCTNAME() :AGORA_UE_ENUM_C_VAR_NAME(UE_ENUM_TYPE::DEFAULT_ENUM_VAL) {}\ + USTRUCTNAME(UE_ENUM_TYPE Val) :AGORA_UE_ENUM_C_VAR_NAME(Val) {}\ + USTRUCTNAME(AGORA_ENUM_TYPE val){\ + switch (val) {\ + case AGORA_ENUM_TYPE::DEFAULT_ENUM_VAL: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::DEFAULT_ENUM_VAL; break;\ + +/* +1. assignment operator overloading +2. get raw agora enum value +*/ +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + default: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::DEFAULT_ENUM_VAL; break;\ + };\ + }\ + void operator = (UE_ENUM_TYPE InValue) {\ + \ + AGORA_UE_ENUM_C_VAR_NAME = InValue; \ + }\ + AGORA_ENUM_TYPE GET_AGORA_ENUM_VAL_FUNC_NAME() const { \ + switch (AGORA_UE_ENUM_C_VAR_NAME)\ + {\ + case UE_ENUM_TYPE::DEFAULT_ENUM_VAL: return AGORA_ENUM_TYPE::DEFAULT_ENUM_VAL; break;\ + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + default: return AGORA_ENUM_TYPE::DEFAULT_ENUM_VAL;\ + }\ + }; + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 1 Entry + +// 1 Entry + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_1_ENTRY(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 2 Entries + +// 2 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_1_ENTRY(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02)\ + case AGORA_ENUM_TYPE::ENUM_VAL02: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL02; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_1_ENTRY(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02)\ + case UE_ENUM_TYPE::ENUM_VAL02: return AGORA_ENUM_TYPE::ENUM_VAL02; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_2_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_1_ENTRY(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_1_ENTRY(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 3 Entries + +// 3 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_2_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_1_ENTRY(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02)\ + case AGORA_ENUM_TYPE::ENUM_VAL03: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL03; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_2_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_1_ENTRY(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02)\ + case UE_ENUM_TYPE::ENUM_VAL03: return AGORA_ENUM_TYPE::ENUM_VAL03; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_3_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_2_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_2_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 4 Entries + +// 4 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_3_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_2_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03)\ + case AGORA_ENUM_TYPE::ENUM_VAL04: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL04; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_3_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_2_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03)\ + case UE_ENUM_TYPE::ENUM_VAL04: return AGORA_ENUM_TYPE::ENUM_VAL04; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_4_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_3_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_3_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 5 Entries + +// 5 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_4_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_3_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04)\ + case AGORA_ENUM_TYPE::ENUM_VAL05: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL05; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_4_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_3_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04)\ + case UE_ENUM_TYPE::ENUM_VAL05: return AGORA_ENUM_TYPE::ENUM_VAL05; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_5_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_4_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_4_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 6 Entries + +// 6 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_5_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_4_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05)\ + case AGORA_ENUM_TYPE::ENUM_VAL06: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL06; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_5_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_4_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05)\ + case UE_ENUM_TYPE::ENUM_VAL06: return AGORA_ENUM_TYPE::ENUM_VAL06; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_6_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_5_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_5_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 7 Entries + +// 7 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_6_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_5_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06)\ + case AGORA_ENUM_TYPE::ENUM_VAL07: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL07; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_6_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_5_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06)\ + case UE_ENUM_TYPE::ENUM_VAL07: return AGORA_ENUM_TYPE::ENUM_VAL07; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_7_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_6_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_6_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + + + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 8 Entries + +// 8 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_7_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_6_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07)\ + case AGORA_ENUM_TYPE::ENUM_VAL08: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL08; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_7_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_6_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07)\ + case UE_ENUM_TYPE::ENUM_VAL08: return AGORA_ENUM_TYPE::ENUM_VAL08; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_8_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_7_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_7_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 9 Entries + +// 9 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_8_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_7_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08)\ + case AGORA_ENUM_TYPE::ENUM_VAL09: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL09; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_8_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_7_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08)\ + case UE_ENUM_TYPE::ENUM_VAL09: return AGORA_ENUM_TYPE::ENUM_VAL09; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_9_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_8_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_8_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 10 Entries + +// 10 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_9_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_8_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09)\ + case AGORA_ENUM_TYPE::ENUM_VAL10: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL10; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_9_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_8_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09)\ + case UE_ENUM_TYPE::ENUM_VAL10: return AGORA_ENUM_TYPE::ENUM_VAL10; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_10_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_9_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_9_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 11 Entries + +// 11 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_10_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_9_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10)\ + case AGORA_ENUM_TYPE::ENUM_VAL11: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL11; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_10_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_9_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10)\ + case UE_ENUM_TYPE::ENUM_VAL11: return AGORA_ENUM_TYPE::ENUM_VAL11; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_11_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_10_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_10_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 12 Entries + +// 12 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_11_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_10_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11)\ + case AGORA_ENUM_TYPE::ENUM_VAL12: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL12; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_11_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_10_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11)\ + case UE_ENUM_TYPE::ENUM_VAL12: return AGORA_ENUM_TYPE::ENUM_VAL12; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_12_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_11_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_11_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 13 Entries + +// 13 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_12_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_11_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12)\ + case AGORA_ENUM_TYPE::ENUM_VAL13: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL13; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_12_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_11_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12)\ + case UE_ENUM_TYPE::ENUM_VAL13: return AGORA_ENUM_TYPE::ENUM_VAL13; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_13_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_12_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_12_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 14 Entries + +// 14 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_13_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_12_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13)\ + case AGORA_ENUM_TYPE::ENUM_VAL14: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL14; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_13_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_12_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13)\ + case UE_ENUM_TYPE::ENUM_VAL14: return AGORA_ENUM_TYPE::ENUM_VAL14; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_14_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_13_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_13_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 15 Entries + +// 15 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_14_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_13_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14)\ + case AGORA_ENUM_TYPE::ENUM_VAL15: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL15; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_14_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_13_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14)\ + case UE_ENUM_TYPE::ENUM_VAL15: return AGORA_ENUM_TYPE::ENUM_VAL15; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_15_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_14_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_14_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 16 Entries + +// 16 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_15_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_14_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15)\ + case AGORA_ENUM_TYPE::ENUM_VAL16: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL16; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_15_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_14_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15)\ + case UE_ENUM_TYPE::ENUM_VAL16: return AGORA_ENUM_TYPE::ENUM_VAL16; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_16_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_15_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_15_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 17 Entries + +// 17 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_16_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_15_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16)\ + case AGORA_ENUM_TYPE::ENUM_VAL17: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL17; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_16_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_15_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16)\ + case UE_ENUM_TYPE::ENUM_VAL17: return AGORA_ENUM_TYPE::ENUM_VAL17; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_17_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_16_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_16_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 18 Entries + +// 18 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_17_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_16_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17)\ + case AGORA_ENUM_TYPE::ENUM_VAL18: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL18; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_17_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_16_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17)\ + case UE_ENUM_TYPE::ENUM_VAL18: return AGORA_ENUM_TYPE::ENUM_VAL18; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_18_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_17_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_17_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 19 Entries + +// 19 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_18_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_17_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18)\ + case AGORA_ENUM_TYPE::ENUM_VAL19: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL19; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_18_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_17_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18)\ + case UE_ENUM_TYPE::ENUM_VAL19: return AGORA_ENUM_TYPE::ENUM_VAL19; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_19_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_18_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_18_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 20 Entries + +// 20 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_19_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_18_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19)\ + case AGORA_ENUM_TYPE::ENUM_VAL20: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL20; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_19_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_18_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19)\ + case UE_ENUM_TYPE::ENUM_VAL20: return AGORA_ENUM_TYPE::ENUM_VAL20; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_20_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_19_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_19_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion + +#pragma region AGORAENUM_UEENUM_CONVERT 21 Entries + +// 21 Entries + +#define AGORA_CONVERT_TO_UEENUM_EXTRA_20_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20,ENUM_VAL21)\ + AGORA_CONVERT_TO_UEENUM_EXTRA_19_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20)\ + case AGORA_ENUM_TYPE::ENUM_VAL21: AGORA_UE_ENUM_C_VAR_NAME = UE_ENUM_TYPE::ENUM_VAL21; break; + +#define AGORA_CONVERT_TO_AGORAENUM_EXTRA_20_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20,ENUM_VAL21)\ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_19_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20)\ + case UE_ENUM_TYPE::ENUM_VAL21: return AGORA_ENUM_TYPE::ENUM_VAL21; break; + +#define AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_21_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20,ENUM_VAL21)\ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_CONSTRUCTOR_SWITCH(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_UEENUM_EXTRA_20_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20,ENUM_VAL21)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BEFORE_GETRAWVAL(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL)\ + \ + AGORA_CONVERT_TO_AGORAENUM_EXTRA_20_ENTRIES(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,ENUM_VAL02,ENUM_VAL03,ENUM_VAL04,ENUM_VAL05,ENUM_VAL06,ENUM_VAL07,ENUM_VAL08,ENUM_VAL09,ENUM_VAL10,ENUM_VAL11,ENUM_VAL12,ENUM_VAL13,ENUM_VAL14,ENUM_VAL15,ENUM_VAL16,ENUM_VAL17,ENUM_VAL18,ENUM_VAL19,ENUM_VAL20,ENUM_VAL21)\ + \ + AGORA_CREATE_UEENUM_CONVERT_STRUCT_INNER_BASE_BOTTOM(USTRUCTNAME,AGORA_ENUM_TYPE,UE_ENUM_TYPE,DEFAULT_ENUM_VAL) + +#pragma endregion \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraHeaderBase.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraHeaderBase.h new file mode 100644 index 00000000..7d6716bb --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraHeaderBase.h @@ -0,0 +1,90 @@ +// Copyright (c) 2023 Agora.io. All rights reserved. + +#pragma once + +#include "Runtime/Launch/Resources/Version.h" +#define AG_UE_5_4_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 4) +#define AG_UE_5_3_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3) +#define AG_UE_5_2_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 2) +#define AG_UE_5_1_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#define AG_UE5_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 0) + +// For compiling the plugin independently using UAT's BuildPlugin command +#if PLATFORM_WINDOWS +#include "Windows/WindowsHWrapper.h" +#endif + + +#if AG_UE_5_4_OR_LATER +// remove UE_DEPRECATED_MACRO deprecated warning +#undef CONSTEXPR +#define CONSTEXPR constexpr +#endif + +THIRD_PARTY_INCLUDES_START +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// additional +#include +THIRD_PARTY_INCLUDES_END + +#define AGORA_UE_ERR_CODE(ERROR_TYPE) (-static_cast(AGORA_UE_ERROR_CODE::ERROR_TYPE)) +#define AGORA_GET_ERR_TYPE(CODE) (static_cast(-CODE)) + + +enum class AGORA_UE_ERROR_CODE +{ + ERROR_OK = 0, + ERROR_NULLPTR = 12, + ERROR_NOT_SUPPORT_PLATFORM = 13, + ERROR_VIDEO_NOT_ENABLED = 14, + + // VideoRenderError + ERROR_RENDER_NULL_FRAME = 15, + ERROR_RENDER_NULL_BUFFER = 16, + ERROR_RENDER_BUFFER_STOP_UPDATEING =17, + ERROR_RENDER_NO_NEW_FRAME_DATA = 18, + + // BP + ERROR_BP_RTC_ENGINE_NOT_INITIALIZED = 50, + +}; + + +enum class AgoraAppType { + kAppTypeNative = 0, + kAppTypeCocos = 1, + kAppTypeUnity = 2, + kAppTypeElectron = 3, + kAppTypeFlutter = 4, + kAppTypeUnreal = 5, // Unreal Engine Cpp Version + kAppTypeXamarin = 6, + kAppTypeApiCloud = 7, + kAppTypeReactNative = 8, + kAppTypePython = 9, + kAppTypeCocosCreator = 10, + kAppTypeRust = 11, + kAppTypeCSharp = 12, + kAppTypeCef = 13, + kAppTypeUniApp = 14, + kAppTypeUnrealBlueprint = 15, // Unreal Engine Blueprint Version +}; + + +// For UE4.25 or older versions - Target Platforms like: Android, define CONSTEXPR back +// Currently AgoraOptional.h would undefine CONSTEXPR at the end of the file. +// This issue would be resolved in a later SDK version. + +#ifndef CONSTEXPR +#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) +#define CONSTEXPR constexpr +#endif +#endif // !CONSTEXPR \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/RtcEngineProxy.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraUERTCEngine.h similarity index 83% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/RtcEngineProxy.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraUERTCEngine.h index 57946b80..3876fe70 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Private/AgoraCppPlugin/include/RtcEngineProxy.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraUERTCEngine.h @@ -3,58 +3,87 @@ #pragma once // AgoraHeaderBase should be included first. -#include "AgoraHeaderBase.h" - -#if AGORA_UESDK_ENABLE_VIDEO -#include "VideoRenderManager.h" -#include "VideoObserverInternal.h" -#endif -#if PLATFORM_ANDROID -#include "Android/AndroidApplication.h" -#include "Android/AndroidJni.h" -#endif -#include +#include "AgoraHeaderBase.h" #include #include "Templates/SharedPointer.h" -namespace agora -{ - namespace rtc - { - namespace ue - { - class AGORAPLUGIN_API RtcEngineProxy : public IRtcEngineEx - { + +namespace agora { + namespace rtc { + namespace ue { + + // there would be some naming conflicts: + // Ex. Unreal has already define Rectangle as a function + class VideoFrameRenderManager; + class AgoraUEVideoFrameObserver; + + + + // This is a ue singleton wrapper for Agora Rtc Engine. + class AGORAPLUGIN_API AgoraUERtcEngine : public agora::rtc::IRtcEngineEx { + public: - static RtcEngineProxy* GetInstance(); - static void ReleaseInstance(bool sync = false); + AgoraUERtcEngine(); + ~AgoraUERtcEngine(); + + static AgoraUERtcEngine* Get(); + static agora::rtc::IRtcEngine* NativeRtcEnginePtr(); + static FString GetSDKVersion(); + static void EnableIOSAudioSession(bool bEnable); + static void Release(bool sync = false); + static AgoraAppType RtcEngineAppType; protected: + //static variables + static AgoraUERtcEngine* Instance; static std::mutex MutexLock; - static RtcEngineProxy* Instance; - IRtcEngine* RtcEngine; + // member variables + agora::rtc::IRtcEngine* RtcEngine; + agora::util::AutoPtr MediaEngine; + #if AGORA_UESDK_ENABLE_VIDEO - TSharedPtr VideoRenderMgr; + TSharedPtr _VideoFrameRenderManager; + TSharedPtr< AgoraUEVideoFrameObserver>_VideoObserver; #endif private: - void InitInstance(); - void UnInitInstance(bool sync = false); + void CreateEngine(); + void DestroyEngine(bool sync = false); + public: - RtcEngineProxy(); - ~RtcEngineProxy(); +#pragma region Agora API Wrapper + virtual int initialize(const agora::rtc::RtcEngineContext& context) override; - util::AutoPtr MediaEngine; + // Use Unreal Rendering + virtual int setupRemoteVideo(const agora::rtc::VideoCanvas& canvas) override; + virtual int setupLocalVideo(const agora::rtc::VideoCanvas& canvas) override; + virtual int setupRemoteVideoEx(const agora::rtc::VideoCanvas& canvas, const agora::rtc::RtcConnection& connection) override; + + // Set Parameter + + // Audio Dump + + // WITH_AGORA_CALLBACKS + +#pragma endregion Agora API Wrapper + + + +#pragma region Other Native APIs virtual int queryInterface(rtc::INTERFACE_ID_TYPE iid, void** inter) override; - virtual void release(bool sync = false) override; - virtual int initialize(const RtcEngineContext& context) override; virtual const char* getVersion(int* build) override; virtual const char* getErrorDescription(int code) override; virtual int queryCodecCapability(CodecCapInfo* codecInfo, int& size) override; + virtual int queryDeviceScore() override; + virtual int preloadChannel(const char* token, const char* channelId, uid_t uid) override; + virtual int preloadChannelWithUserAccount(const char* token, const char* channelId, const char* userAccount) override; + virtual int updatePreloadChannelToken(const char* token) override; + + virtual int joinChannel(const char* token, const char* channelId, const char* info, uid_t uid) override; virtual int joinChannel(const char* token, const char* channelId, uid_t uid, const ChannelMediaOptions& options) override; virtual int updateChannelMediaOptions(const ChannelMediaOptions& options) override; @@ -64,8 +93,6 @@ namespace agora virtual int setChannelProfile(CHANNEL_PROFILE_TYPE profile) override; virtual int setClientRole(CLIENT_ROLE_TYPE role) override; virtual int setClientRole(CLIENT_ROLE_TYPE role, const ClientRoleOptions& options) override; - virtual int startEchoTest() override; - virtual int startEchoTest(int intervalInSeconds) override; virtual int startEchoTest(const EchoTestConfiguration& config) override; virtual int stopEchoTest() override; #if defined(__APPLE__) && TARGET_OS_IOS @@ -81,13 +108,16 @@ namespace agora virtual int stopLastmileProbeTest() override; virtual int setVideoEncoderConfiguration(const VideoEncoderConfiguration& config) override; virtual int setBeautyEffectOptions(bool enabled, const BeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; + virtual int setFaceShapeBeautyOptions(bool enabled, const FaceShapeBeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; + virtual int setFaceShapeAreaOptions(const FaceShapeAreaOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; + virtual int getFaceShapeBeautyOptions(FaceShapeBeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; + virtual int getFaceShapeAreaOptions(agora::rtc::FaceShapeAreaOptions::FACE_SHAPE_AREA shapeArea, FaceShapeAreaOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; virtual int setLowlightEnhanceOptions(bool enabled, const LowlightEnhanceOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; virtual int setVideoDenoiserOptions(bool enabled, const VideoDenoiserOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; virtual int setColorEnhanceOptions(bool enabled, const ColorEnhanceOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; virtual int enableVirtualBackground(bool enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) override; - virtual int setupRemoteVideo(const VideoCanvas& canvas) override; - virtual int setupLocalVideo(const VideoCanvas& canvas) override; virtual int setVideoScenario(VIDEO_APPLICATION_SCENARIO_TYPE scenarioType) override; + virtual int setVideoQoEPreference(VIDEO_QOE_PREFERENCE_TYPE qoePreference) override; virtual int enableAudio() override; virtual int disableAudio() override; virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) __deprecated override; @@ -96,16 +126,14 @@ namespace agora virtual int enableLocalAudio(bool enabled) override; virtual int muteLocalAudioStream(bool mute) override; virtual int muteAllRemoteAudioStreams(bool mute) override; - virtual int setDefaultMuteAllRemoteAudioStreams(bool mute) __deprecated override; virtual int muteRemoteAudioStream(uid_t uid, bool mute) override; virtual int muteLocalVideoStream(bool mute) override; virtual int enableLocalVideo(bool enabled) override; virtual int muteAllRemoteVideoStreams(bool mute) override; - virtual int setDefaultMuteAllRemoteVideoStreams(bool mute) __deprecated override; + virtual int setRemoteDefaultVideoStreamType(VIDEO_STREAM_TYPE streamType) override; virtual int muteRemoteVideoStream(uid_t uid, bool mute) override; virtual int setRemoteVideoStreamType(uid_t uid, VIDEO_STREAM_TYPE streamType) override; virtual int setRemoteVideoSubscriptionOptions(uid_t uid, const VideoSubscriptionOptions& options) override; - virtual int setRemoteDefaultVideoStreamType(VIDEO_STREAM_TYPE streamType) override; virtual int setSubscribeAudioBlocklist(uid_t* uidList, int uidNumber) override; virtual int setSubscribeAudioAllowlist(uid_t* uidList, int uidNumber) override; virtual int setSubscribeVideoBlocklist(uid_t* uidList, int uidNumber) override; @@ -137,6 +165,8 @@ namespace agora virtual int setAudioMixingPosition(int pos) override; virtual int setAudioMixingDualMonoMode(media::AUDIO_MIXING_DUAL_MONO_MODE mode) override; virtual int setAudioMixingPitch(int pitch) override; + virtual int setAudioMixingPlaybackSpeed(int speed) override; + virtual int getEffectsVolume() override; virtual int setEffectsVolume(int volume) override; virtual int preloadEffect(int soundId, const char* filePath, int startPos = 0) override; @@ -171,18 +201,21 @@ namespace agora virtual int setLocalVoiceReverb(AUDIO_REVERB_TYPE reverbKey, int value) override; virtual int setHeadphoneEQPreset(HEADPHONE_EQUALIZER_PRESET preset) override; virtual int setHeadphoneEQParameters(int lowGain, int highGain) override; + virtual int enableVoiceAITuner(bool enabled, VOICE_AI_TUNER_TYPE type) override; virtual int setLogFile(const char* filePath) override; virtual int setLogFilter(unsigned int filter) override; virtual int setLogLevel(commons::LOG_LEVEL level) override; virtual int setLogFileSize(unsigned int fileSizeInKBytes) override; virtual int uploadLogFile(agora::util::AString& requestId) override; + virtual int writeLog(commons::LOG_LEVEL level, const char* fmt, ...) override; virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode, VIDEO_MIRROR_MODE_TYPE mirrorMode) override; virtual int setRemoteRenderMode(uid_t uid, media::base::RENDER_MODE_TYPE renderMode, VIDEO_MIRROR_MODE_TYPE mirrorMode) override; - virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode) override; - virtual int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) override; - virtual int enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) override; - virtual int enableDualStreamMode(bool enabled) override; + virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode) __deprecated override; + virtual int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) __deprecated override; + virtual int enableDualStreamMode(bool enabled) __deprecated override; + virtual int enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) __deprecated override; virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode) override; + virtual int setSimulcastConfig(const SimulcastConfig& simulcastConfig) override; virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig) override; virtual int enableCustomAudioLocalPlayback(track_id_t trackId, bool enabled) override; virtual int setRecordingAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) override; @@ -197,10 +230,13 @@ namespace agora virtual int adjustRecordingSignalVolume(int volume) override; virtual int muteRecordingSignal(bool mute) override; virtual int adjustPlaybackSignalVolume(int volume) override; - virtual int adjustUserPlaybackSignalVolume(unsigned int uid, int volume) override; + virtual int adjustUserPlaybackSignalVolume(uid_t uid, int volume) override; virtual int setLocalPublishFallbackOption(STREAM_FALLBACK_OPTIONS option) override; virtual int setRemoteSubscribeFallbackOption(STREAM_FALLBACK_OPTIONS option) override; virtual int setHighPriorityUserList(uid_t* uidList, int uidNum, STREAM_FALLBACK_OPTIONS option) override; + virtual int enableExtension(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, bool enable = true) override; + virtual int setExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, const char* value)override; + virtual int getExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, char* value, int buf_len)override; virtual int enableLoopbackRecording(bool enabled, const char* deviceName = NULL) override; virtual int adjustLoopbackSignalVolume(int volume) override; virtual int getLoopbackRecordingVolume() override; @@ -212,11 +248,12 @@ namespace agora virtual int setExtensionProviderProperty(const char* provider, const char* key, const char* value) override; virtual int registerExtension(const char* provider, const char* extension, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) override; virtual int enableExtension(const char* provider, const char* extension, bool enable = true, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) override; - virtual int enableExtension(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, bool enable = true) override; - 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) override; - 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) override; - virtual int setExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, const char* value) override; - virtual int getExtensionProperty(const char* provider, const char* extension, const ExtensionInfo& extensionInfo, const char* key, char* value, int buf_len) override; + 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)override; + 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) override; virtual int setCameraCapturerConfiguration(const CameraCapturerConfiguration& config) override; virtual video_track_id_t createCustomVideoTrack() override; virtual video_track_id_t createCustomEncodedVideoTrack(const SenderOptions& sender_option) override; @@ -238,14 +275,28 @@ namespace agora virtual int setCameraAutoFocusFaceModeEnabled(bool enabled) override; virtual bool isCameraExposurePositionSupported() override; virtual int setCameraExposurePosition(float positionXinView, float positionYinView) override; + virtual bool isCameraExposureSupported() override; + virtual int setCameraExposureFactor(float factor) override; + + #if defined(__APPLE__) virtual bool isCameraAutoExposureFaceModeSupported() override; virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) override; + virtual int setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode) override; + #endif virtual int setDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker) override; virtual int setEnableSpeakerphone(bool speakerOn) override; virtual bool isSpeakerphoneEnabled() override; + virtual int setRouteInCommunicationMode(int route) override; + +#endif +#if defined(__APPLE__) + virtual bool isCameraCenterStageSupported() override; + virtual int enableCameraCenterStage(bool enabled) override; #endif + + #if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) virtual IScreenCaptureSourceList* getScreenCaptureSources(const SIZE& thumbSize, const SIZE& iconSize, const bool includeScreen) override; #endif @@ -271,6 +322,8 @@ namespace agora virtual int startScreenCapture(const ScreenCaptureParameters2& captureParams) override; virtual int updateScreenCapture(const ScreenCaptureParameters2& captureParams) override; virtual int queryScreenCaptureCapability() override; + virtual int queryCameraFocalLengthCapability(agora::rtc::FocalLengthInfo* focalLengthInfos, int& size) override; + #endif #if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) virtual int setScreenCaptureScenario(SCREEN_SCENARIO_TYPE screenScenario) override; @@ -282,9 +335,10 @@ namespace agora virtual int startRtmpStreamWithoutTranscoding(const char* url) override; virtual int startRtmpStreamWithTranscoding(const char* url, const LiveTranscoding& transcoding) override; virtual int updateRtmpTranscoding(const LiveTranscoding& transcoding) override; - virtual int stopRtmpStream(const char* url) override; virtual int startLocalVideoTranscoder(const LocalTranscoderConfiguration& config) override; virtual int updateLocalTranscoderConfiguration(const LocalTranscoderConfiguration& config) override; + + virtual int stopRtmpStream(const char* url) override; virtual int stopLocalVideoTranscoder() override; virtual int startCameraCapture(VIDEO_SOURCE_TYPE sourceType, const CameraCapturerConfiguration& config) override; virtual int stopCameraCapture(VIDEO_SOURCE_TYPE sourceType) override; @@ -297,13 +351,11 @@ namespace agora virtual bool unregisterEventHandler(IRtcEngineEventHandler* eventHandler) override; virtual int setRemoteUserPriority(uid_t uid, PRIORITY_TYPE userPriority) override; virtual int registerPacketObserver(IPacketObserver* observer) override; - virtual int setEncryptionMode(const char* encryptionMode) __deprecated override; - virtual int setEncryptionSecret(const char* secret) __deprecated override; virtual int enableEncryption(bool enabled, const EncryptionConfig& config) override; virtual int createDataStream(int* streamId, bool reliable, bool ordered) override; - virtual int createDataStream(int* streamId, DataStreamConfig& config) override; + virtual int createDataStream(int* streamId, const DataStreamConfig& config) override; virtual int sendStreamMessage(int streamId, const char* data, size_t length) override; - virtual int addVideoWatermark(const RtcImage& watermark) override; + virtual int addVideoWatermark(const RtcImage& watermark) __deprecated override; virtual int addVideoWatermark(const char* watermarkUrl, const WatermarkOptions& options) override; virtual int clearVideoWatermarks() override; virtual int pauseAudio() __deprecated override; @@ -312,8 +364,10 @@ namespace agora virtual int sendCustomReportMessage(const char* id, const char* category, const char* event, const char* label, int value) override; virtual int registerMediaMetadataObserver(IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) override; virtual int unregisterMediaMetadataObserver(IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) override; - 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) override; - virtual int stopAudioFrameDump(const char* channel_id, uid_t user_id, const char* location) override; + virtual int startAudioFrameDump(const char* channel_id, uid_t uid, const char* location, const char* uuid, const char* passwd, long duration_ms, bool auto_upload) override; + + virtual int stopAudioFrameDump(const char* channel_id, uid_t uid, const char* location) override; + virtual int setAINSMode(bool enabled, AUDIO_AINS_MODE mode) override; virtual int registerLocalUserAccount(const char* appId, const char* userAccount) override; virtual int joinChannelWithUserAccount(const char* token, const char* channelId, const char* userAccount) override; @@ -322,8 +376,6 @@ namespace agora virtual int getUserInfoByUserAccount(const char* userAccount, rtc::UserInfo* userInfo) override; virtual int getUserInfoByUid(uid_t uid, rtc::UserInfo* userInfo) override; virtual int startOrUpdateChannelMediaRelay(const ChannelMediaRelayConfiguration& configuration) override; - virtual int startChannelMediaRelay(const ChannelMediaRelayConfiguration& configuration) __deprecated override; - virtual int updateChannelMediaRelay(const ChannelMediaRelayConfiguration& configuration) __deprecated override; virtual int stopChannelMediaRelay() override; virtual int pauseAllChannelMediaRelay() override; virtual int resumeAllChannelMediaRelay() override; @@ -345,12 +397,21 @@ namespace agora virtual int setAVSyncSource(const char* channelId, uid_t uid) override; virtual int enableVideoImageSource(bool enable, const ImageTrackOptions& options) override; virtual int64_t getCurrentMonotonicTimeInMs() override; + + virtual int enableWirelessAccelerate(bool enabled) override; + virtual int getNetworkType() override; + virtual int setParameters(const char* parameters) override; + virtual int startMediaRenderingTracing() override; + virtual int enableInstantMediaRendering() override; + virtual uint64_t getNtpWallTimeInMs() override; + virtual bool isFeatureAvailableOnDevice(FeatureType type) override; + virtual int sendAudioMetadata(const char* metadata, size_t length) override; + virtual int joinChannelEx(const char* token, const RtcConnection& connection, const ChannelMediaOptions& options, IRtcEngineEventHandler* eventHandler) override; virtual int leaveChannelEx(const RtcConnection& connection) override; virtual int leaveChannelEx(const RtcConnection& connection, const LeaveChannelOptions& options) override; virtual int updateChannelMediaOptionsEx(const ChannelMediaOptions& options, const RtcConnection& connection) override; virtual int setVideoEncoderConfigurationEx(const VideoEncoderConfiguration& config, const RtcConnection& connection) override; - virtual int setupRemoteVideoEx(const VideoCanvas& canvas, const RtcConnection& connection) override; virtual int muteRemoteAudioStreamEx(uid_t uid, bool mute, const RtcConnection& connection) override; virtual int muteRemoteVideoStreamEx(uid_t uid, bool mute, const RtcConnection& connection) override; virtual int setRemoteVideoStreamTypeEx(uid_t uid, VIDEO_STREAM_TYPE streamType, const RtcConnection& connection) override; @@ -369,11 +430,11 @@ namespace agora virtual int enableLoopbackRecordingEx(const RtcConnection& connection, bool enabled, const char* deviceName = NULL) override; virtual int adjustRecordingSignalVolumeEx(int volume, const RtcConnection& connection) override; virtual int muteRecordingSignalEx(bool mute, const RtcConnection& connection) override; - virtual int adjustUserPlaybackSignalVolumeEx(unsigned int uid, int volume, const RtcConnection& connection) override; + virtual int adjustUserPlaybackSignalVolumeEx(uid_t uid, int volume, const RtcConnection& connection) override; virtual CONNECTION_STATE_TYPE getConnectionStateEx(const RtcConnection& connection) override; virtual int enableEncryptionEx(const RtcConnection& connection, bool enabled, const EncryptionConfig& config) override; virtual int createDataStreamEx(int* streamId, bool reliable, bool ordered, const RtcConnection& connection) override; - virtual int createDataStreamEx(int* streamId, DataStreamConfig& config, const RtcConnection& connection) override; + virtual int createDataStreamEx(int* streamId, const DataStreamConfig& config, const RtcConnection& connection) override; virtual int sendStreamMessageEx(int streamId, const char* data, size_t length, const RtcConnection& connection) override; virtual int addVideoWatermarkEx(const char* watermarkUrl, const WatermarkOptions& options, const RtcConnection& connection) override; virtual int clearVideoWatermarkEx(const RtcConnection& connection) override; @@ -384,8 +445,6 @@ namespace agora virtual int updateRtmpTranscodingEx(const LiveTranscoding& transcoding, const RtcConnection& connection) override; virtual int stopRtmpStreamEx(const char* url, const RtcConnection& connection) override; virtual int startOrUpdateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) override; - virtual int startChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) __deprecated override; - virtual int updateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) __deprecated override; virtual int stopChannelMediaRelayEx(const RtcConnection& connection) override; virtual int pauseAllChannelMediaRelayEx(const RtcConnection& connection) override; virtual int resumeAllChannelMediaRelayEx(const RtcConnection& connection) override; @@ -393,18 +452,21 @@ namespace agora virtual int getUserInfoByUidEx(uid_t uid, rtc::UserInfo* userInfo, const RtcConnection& connection) override; virtual int enableDualStreamModeEx(bool enabled, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) override; virtual int setDualStreamModeEx(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) override; + virtual int setSimulcastConfigEx(const SimulcastConfig& simulcastConfig, + const RtcConnection& connection) override; virtual int setHighPriorityUserListEx(uid_t* uidList, int uidNum, STREAM_FALLBACK_OPTIONS option, const RtcConnection& connection) override; - virtual int enableWirelessAccelerate(bool enabled) override; - virtual int getNetworkType() override; - virtual int setParameters(const char* parameters) override; virtual int takeSnapshotEx(const RtcConnection& connection, uid_t uid, const char* filePath) override; + virtual int enableContentInspectEx(bool enabled, const media::ContentInspectConfig& config, const RtcConnection& connection) override; + virtual int startMediaRenderingTracingEx(const RtcConnection& connection) override; - virtual int startMediaRenderingTracing() override; - virtual int enableInstantMediaRendering() override; - virtual uint64_t getNtpWallTimeInMs() override; + virtual int setParametersEx(const RtcConnection& connection, const char* parameters) override; + virtual int getCallIdEx(agora::util::AString& callId, const RtcConnection& connection) override; + virtual int sendAudioMetadataEx(const RtcConnection& connection, const char* metadata, size_t length) override; + +#pragma endregion Other Native APIs }; - }; + } } } diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtmClient.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtmClient.h deleted file mode 100644 index ada2faae..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtmClient.h +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright (c) 2022 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 "IAgoraLog.h" -#include "IAgoraStreamChannel.h" -#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 rtm { -class IRtmEventHandler; - -/** - * Configurations for RTM Client. - */ -struct RtmConfig { - /** - * The App ID of your project. - */ - const char* appId; - - /** - * The ID of the user. - */ - const char* userId; - - /** - * The callbacks handler - */ - IRtmEventHandler* eventHandler; - - /** - * The config for customer set log path, log size and log level. - */ - commons::LogConfig logConfig; - - RtmConfig() : appId(nullptr), - userId(nullptr), - eventHandler(nullptr) {} -}; - -/** - * The information of a Topic. - */ -struct TopicInfo { - /** - * The name of the topic. - */ - const char* topic; - - /** - * The number of publisher in current topic. - */ - size_t numOfPublisher; - - /** - * The publisher's user ids in current topic. - */ - const char** publisherUserIds; - - /** - * The metaData of publisher in current topic. - */ - const char** publisherMetas; - - TopicInfo() : topic(NULL), - numOfPublisher(0), - publisherUserIds(NULL), - publisherMetas(NULL) {} -}; - -/** - * The error codes of rtm client. - */ -enum RTM_ERROR_CODE { - /** - * 10001: The topic already joined - */ - RTM_ERR_TOPIC_ALREADY_JOINED = 10001, - /** - * 10002: Exceed topic limiation when try to join new topic - */ - RTM_ERR_EXCEED_JOIN_TOPIC_LIMITATION = 10002, - /** - * 10003: Topic name is invalid - */ - RTM_ERR_INVALID_TOPIC_NAME = 10003, - /** - * 10004: Publish topic message failed - */ - RTM_ERR_PUBLISH_TOPIC_MESSAGE_FAILED = 10004, - /** - * 10005: Exceed topic limitation when try to subscribe new topic - */ - RTM_ERR_EXCEED_SUBSCRIBE_TOPIC_LIMITATION = 10005, - /** - * 10006: Exceed user limitation when try to subscribe new topic - */ - RTM_ERR_EXCEED_USER_LIMITATION = 10006, - /** - * 10007: Exceed channel limitation when try to join new channel - */ - RTM_ERR_EXCEED_CHANNEL_LIMITATION = 10007, - /** - * 10008: The channel already joined - */ - RTM_ERR_ALREADY_JOIN_CHANNEL = 10008, - /** - * 10009: Try to perform channel related operation before joining channel - */ - RTM_ERR_NOT_JOIN_CHANNEL = 10009, -}; - -/** - * Connection states between rtm sdk and agora server. - */ -enum RTM_CONNECTION_STATE { - /** - * 1: The SDK is disconnected with server. - */ - RTM_CONNECTION_STATE_DISCONNECTED = 1, - /** - * 2: The SDK is connecting to the server. - */ - RTM_CONNECTION_STATE_CONNECTING = 2, - /** - * 3: The SDK is connected to the server and has joined a channel. You can now publish or subscribe to - * a track in the channel. - */ - RTM_CONNECTION_STATE_CONNECTED = 3, - /** - * 4: The SDK keeps rejoining the channel after being disconnected from the channel, probably because of - * network issues. - */ - RTM_CONNECTION_STATE_RECONNECTING = 4, - /** - * 5: The SDK fails to connect to the server or join the channel. - */ - RTM_CONNECTION_STATE_FAILED = 5, -}; - -/** - * Reasons for connection state change. - */ -enum RTM_CONNECTION_CHANGE_REASON { - /** - * 0: The SDK is connecting to the server. - */ - RTM_CONNECTION_CHANGED_CONNECTING = 0, - /** - * 1: The SDK has joined the channel successfully. - */ - RTM_CONNECTION_CHANGED_JOIN_SUCCESS = 1, - /** - * 2: The connection between the SDK and the server is interrupted. - */ - RTM_CONNECTION_CHANGED_INTERRUPTED = 2, - /** - * 3: The connection between the SDK and the server is banned by the server. - */ - RTM_CONNECTION_CHANGED_BANNED_BY_SERVER = 3, - /** - * 4: The SDK fails to join the channel for more than 20 minutes and stops reconnecting to the channel. - */ - RTM_CONNECTION_CHANGED_JOIN_FAILED = 4, - /** - * 5: The SDK has left the channel. - */ - RTM_CONNECTION_CHANGED_LEAVE_CHANNEL = 5, - /** - * 6: The connection fails because the App ID is not valid. - */ - RTM_CONNECTION_CHANGED_INVALID_APP_ID = 6, - /** - * 7: The connection fails because the channel name is not valid. - */ - RTM_CONNECTION_CHANGED_INVALID_CHANNEL_NAME = 7, - /** - * 8: The connection fails because the token is not valid. - */ - RTM_CONNECTION_CHANGED_INVALID_TOKEN = 8, - /** - * 9: The connection fails because the token has expired. - */ - RTM_CONNECTION_CHANGED_TOKEN_EXPIRED = 9, - /** - * 10: The connection is rejected by the server. - */ - RTM_CONNECTION_CHANGED_REJECTED_BY_SERVER = 10, - /** - * 11: The connection changes to reconnecting because the SDK has set a proxy server. - */ - RTM_CONNECTION_CHANGED_SETTING_PROXY_SERVER = 11, - /** - * 12: When the connection state changes because the app has renewed the token. - */ - RTM_CONNECTION_CHANGED_RENEW_TOKEN = 12, - /** - * 13: The IP Address of the app has changed. A change in the network type or IP/Port changes the IP - * address of the app. - */ - RTM_CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED = 13, - /** - * 14: A timeout occurs for the keep-alive of the connection between the SDK and the server. - */ - RTM_CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT = 14, - /** - * 15: The SDK has rejoined the channel successfully. - */ - RTM_CONNECTION_CHANGED_REJOIN_SUCCESS = 15, - /** - * 16: The connection between the SDK and the server is lost. - */ - RTM_CONNECTION_CHANGED_LOST = 16, - /** - * 17: The change of connection state is caused by echo test. - */ - RTM_CONNECTION_CHANGED_ECHO_TEST = 17, - /** - * 18: The local IP Address is changed by user. - */ - RTM_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. - */ - RTM_CONNECTION_CHANGED_SAME_UID_LOGIN = 19, - /** - * 20: The connection is failed due to too many broadcasters in the channel. - */ - RTM_CONNECTION_CHANGED_TOO_MANY_BROADCASTERS = 20, -}; - -/** - * RTM channel type. - */ -enum RTM_CHANNEL_TYPE { - /** - * 0: Message channel. - */ - RTM_CHANNEL_TYPE_MESSAGE = 0, - /** - * 1: Stream channel. - */ - RTM_CHANNEL_TYPE_STREAM = 1, -}; - -/** - * RTM presence type. - */ -enum RTM_PRESENCE_TYPE { - /** - * 0: Triggered when remote user join channel - */ - RTM_PRESENCE_TYPE_REMOTE_JOIN_CHANNEL = 0, - /** - * 1: Triggered when remote leave join channel - */ - RTM_PRESENCE_TYPE_REMOTE_LEAVE_CHANNEL = 1, - /** - * 2: Triggered when remote user's connection timeout - */ - RTM_PRESENCE_TYPE_REMOTE_CONNECTION_TIMEOUT = 2, - /** - * 3: Triggered when remote user join a topic - */ - RTM_PRESENCE_TYPE_REMOTE_JOIN_TOPIC = 3, - /** - * 4: Triggered when remote user leave a topic - */ - RTM_PRESENCE_TYPE_REMOTE_LEAVE_TOPIC = 4, - /** - * 5: Triggered when local user join channel - */ - RTM_PRESENCE_TYPE_SELF_JOIN_CHANNEL = 5, -}; - -/** - * RTM error code occurs in stream channel. - */ -enum STREAM_CHANNEL_ERROR_CODE { - /** - * 0: No error occurs. - */ - STREAM_CHANNEL_ERROR_OK = 0, - /** - * 1: Triggered when subscribe user exceed limitation - */ - STREAM_CHANNEL_ERROR_EXCEED_LIMITATION = 1, - /** - * 2: Triggered when unsubscribe inexistent user - */ - STREAM_CHANNEL_ERROR_USER_NOT_EXIST = 2, -}; - -/** - * The IRtmEventHandler 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 IRtmEventHandler { - public: - virtual ~IRtmEventHandler() {} - - struct MessageEvent { - /** - * Which channel type, RTM_CHANNEL_TYPE_STREAM or RTM_CHANNEL_TYPE_MESSAGE - */ - RTM_CHANNEL_TYPE channelType; - /** - * The channel which the message was published - */ - const char* channelName; - /** - * If the channelType is RTM_CHANNEL_TYPE_STREAM, which topic the message came from. only for RTM_CHANNEL_TYPE_STREAM - */ - const char* channelTopic; - /** - * The payload - */ - const char* message; - /** - * The payload length - */ - size_t messageLength; - /** - * The publisher - */ - const char* publisher; - - MessageEvent() : channelType(RTM_CHANNEL_TYPE_STREAM), - channelName(nullptr), - channelTopic(nullptr), - message(nullptr), - publisher(nullptr) {} - }; - - struct PresenceEvent { - /** - * Which channel type, RTM_CHANNEL_TYPE_STREAM or RTM_CHANNEL_TYPE_MESSAGE - */ - RTM_CHANNEL_TYPE channelType; - /** - * Indicate presence type - */ - RTM_PRESENCE_TYPE type; - /** - * The channel which the presence event was triggered - */ - const char* channelName; - /** - * Topic information array. - */ - TopicInfo* topicInfos; - /** - * The number of topicInfos. - */ - size_t topicInfoNumber; - /** - * The user who triggered this event. - */ - const char* userId; - - PresenceEvent() : channelType(RTM_CHANNEL_TYPE_STREAM), - type(RTM_PRESENCE_TYPE_REMOTE_JOIN_CHANNEL), - channelName(nullptr), - topicInfos(nullptr), - topicInfoNumber(0), - userId(nullptr) {} - }; - - /** - * Occurs when receive a message. - * - * @param event details of message event. - */ - virtual void onMessageEvent(MessageEvent& event) {} - - /** - * Occurs when remote user join/leave channel, join/leave topic or local user joined channel. - * - * note: - * When remote user join/leave channel will trigger this callback. - * When remote user(in same channel) joinTopic/destroy Topic will trigger this callback. - * When local user join channel will trigger this callback. - * - * For type(RTM_PRESENCE_TYPE_REMOTE_JOIN_CHANNEL/RTM_PRESENCE_TYPE_REMOTE_LEAVE_CHANNEL), - * valid field will be channelType/type/channelName/userId - * For type(RTM_PRESENCE_TYPE_REMOTE_JOIN_TOPIC/RTM_PRESENCE_TYPE_REMOTE_LEAVE_TOPIC) - * valid field will be channelType/type/channelName/topicInfos/topicInfoNumber - * For type(RTM_PRESENCE_TYPE_SELF_JOIN_CHANNEL) - * valid field will be channelType/type/channelName/topicInfos/topicInfoNumber/userId - * - * @param event details of presence event. - */ - virtual void onPresenceEvent(PresenceEvent& event) {} - - /** - * Occurs when user join a channel. - * - * @param channelName The Name of the channel. - * @param userId The id of the user. - * @param errorCode The error code. - */ - virtual void onJoinResult(const char* channelName, const char* userId, STREAM_CHANNEL_ERROR_CODE errorCode) {} - - /** - * Occurs when user leave a channel. - * - * @param channelName The Name of the channel. - * @param userId The id of the user. - * @param errorCode The error code. - */ - virtual void onLeaveResult(const char* channelName, const char* userId, STREAM_CHANNEL_ERROR_CODE errorCode) {} - - /** - * Occurs when user join topic. - * - * @param channelName The Name of the channel. - * @param userId The id of the user. - * @param topic The name of the topic. - * @param meta The meta of the topic. - * @param errorCode The error code. - */ - virtual void onJoinTopicResult(const char* channelName, const char* userId, const char* topic, const char* meta, STREAM_CHANNEL_ERROR_CODE errorCode) {} - - /** - * Occurs when user leave topic. - * - * @param channelName The Name of the channel. - * @param userId The id of the user. - * @param topic The name of the topic. - * @param meta The meta of the topic. - * @param errorCode The error code. - */ - virtual void onLeaveTopicResult(const char* channelName, const char* userId, const char* topic, const char* meta, STREAM_CHANNEL_ERROR_CODE errorCode) {} - - /** - * Occurs when user subscribe topic. - * - * @param channelName The Name of the channel. - * @param userId The id of the user. - * @param topic The name of the topic. - * @param succeedUsers The subscribed users. - * @param failedUser The failed to subscribe users. - * @param errorCode The error code. - */ - virtual void onTopicSubscribed(const char* channelName, const char* userId, const char* topic, UserList succeedUsers, UserList failedUsers, STREAM_CHANNEL_ERROR_CODE errorCode) {} - - /** - * Occurs when user unsubscribe topic. - * - * @param channelName The Name of the channel. - * @param userId The id of the user. - * @param topic The name of the topic. - * @param succeedUsers The unsubscribed users. - * @param failedUser The failed to unsubscribe users. - * @param errorCode The error code. - */ - virtual void onTopicUnsubscribed(const char* channelName, const char* userId, const char* topic, UserList succeedUsers, UserList failedUsers, STREAM_CHANNEL_ERROR_CODE errorCode) {} - - /** - * Occurs when the connection state changes between rtm sdk and agora service. - * - * @param channelName The Name of the channel. - * @param state The new connection state. - * @param reason The reason for the connection state change. - */ - virtual void onConnectionStateChange(const char* channelName, RTM_CONNECTION_STATE state, RTM_CONNECTION_CHANGE_REASON reason) {} -}; - -/** - * The IRtmClient class. - * - * This class provides the main methods that can be invoked by your app. - * - * IRtmClient is the basic interface class of the Agora RTM SDK. - * Creating an IRtmClient object and then calling the methods of - * this object enables you to use Agora RTM SDK's functionality. - */ -class IRtmClient { - public: - /** - * Initializes the rtm client instance. - * - * @param [in] config The configurations for RTM Client. - * @param [in] eventHandler . - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int initialize(const RtmConfig& config) = 0; - /** - * Release the rtm client instance. - * - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int release() = 0; - - /** - * Create a stream channel instance. - * - * @param [in] channelName The Name of the channel. - */ - virtual IStreamChannel* createStreamChannel(const char* channelName) = 0; - - protected: - virtual ~IRtmClient() {} -}; - -/** Creates the rtm client object and returns the pointer. - -* @return Pointer of the rtm client object. -*/ -AGORA_API IRtmClient* AGORA_CALL createAgoraRtmClient(); - -} // namespace rtm -} // namespace agora diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraStateSync.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraStateSync.h deleted file mode 100644 index 974fe4ed..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraStateSync.h +++ /dev/null @@ -1,122 +0,0 @@ -// -// Agora Rtc Engine SDK -// -// Copyright (c) 2022 Agora.io. All rights reserved. -// -#pragma once - -#include "AgoraBase.h" -#include "AgoraMediaBase.h" - -namespace agora { -namespace rtc { - -/** connection state of sync service - */ -enum SYNC_CONNECTION_STATE_TYPE { - /* The SDK is disconnected from the state sync server. */ - SYNC_CONNECTION_STATE_DISCONNECTED = 1, - /* The SDK is connecting to the state sync server. */ - SYNC_CONNECTION_STATE_CONNECTING, - /* The SDK is connected to the state sync server. */ - SYNC_CONNECTION_STATE_CONNECTED, - /* The SDK is reconnecting to the state sync server. */ - SYNC_CONNECTION_STATE_RECONNECTING, - /* The SDK is reconnected to the state sync server. */ - SYNC_CONNECTION_STATE_ABORTED -}; - -/** reason of connection state change of sync service - */ -enum SYNC_CONNECTION_CHANGED_REASON_TYPE { - /* The connection state is changed. */ - SYNC_CONNECTION_CHANGED_DEFAULT = 0, -}; - -struct RoomStateItem { - const char *key; - const char *value; - int64_t revision; - RoomStateItem() : key(NULL), value(NULL), revision(-1) {} -}; - -struct RoomLockInfo { - const char *ownerId; - const char *key; - const char *value; - int64_t revision; - int64_t updateTime; - int64_t timeToLive; -}; - -struct UserStateItem { - const char *key; - const char *value; -}; - -class IStateSyncEventHandler { -public: - virtual void onConnectionStateChanged(SYNC_CONNECTION_STATE_TYPE state, SYNC_CONNECTION_CHANGED_REASON_TYPE reason) {} - virtual void onRequestToken() {} - - virtual void onJoinRoomSuccess(const char *roomName) {} - virtual void onJoinRoomFailed(const char *roomName, int errorCode) {} - virtual void onLeaveRoom(const char *roomName, int errorCode) {} - virtual void onRemoteUserJoinedRoom(const char *roomName, const char *userId) {} - virtual void onRemoteUserLeftRoom(const char *roomName, const char *userId) {} - virtual void onGetRoomUsers(const char *roomName, const char *users[], int userCount, int errorCode) {} - - virtual void onRecvRoomMessage(const char *roomName, const char *userId, const uint8_t *msg, int len) {} - virtual void onLockResult(const char *roomName, const char *lockName, int errorCode) {} - virtual void onLockExpired(const char *roomName, const char *lockName) {} - virtual void onUnlockResult(const char *roomName, const char *lockName, int errorCode) {} - virtual void onRecvRoomState(const char *roomName, const RoomStateItem roomStateItems[], int count) {} - virtual void onRecvUserState(const char *userId, const UserStateItem userStateItems[], int count) {} -}; - -struct StateSyncConfig { - const char *appId; - const char *token; - const char *userId; - IStateSyncEventHandler *eventHandler; -}; - -class IStateSync { -protected: - virtual ~IStateSync() {} -public: - virtual int release() = 0; - - virtual int initialize(const StateSyncConfig &cfg) = 0; - virtual int uninitialize() = 0; - - virtual int addEventHandler(IStateSyncEventHandler *eventHandler) = 0; - virtual int removeEventHandler(IStateSyncEventHandler *eventHandler) = 0; - - virtual int sendPeerMessage(const char *userId, const uint8_t *msg, int len) = 0; - - virtual int joinRoom(const char *roomName) = 0; - virtual int leaveRoom(const char *roomName) = 0; - virtual int renewToken(const char *token) = 0; - - virtual int getRoomUsers(const char *roomName) = 0; - - virtual int sendRoomMessage(const char *roomName, const uint8_t *msg, int len) = 0; - - virtual int tryLock(const char *roomName, const char *lockName) = 0; - virtual int unlock(const char *roomName, const char *lockName) = 0; - virtual int getLocks(const char *roomName, const RoomLockInfo **locks, int *locksCount) = 0; - - virtual int setRoomState(const char *roomName, const RoomStateItem items[], int count) = 0; - virtual int deleteRoomState(const char *roomName, const char *keys[], int count) = 0; - virtual int getRoomStates(const char *roomName) = 0; - virtual int clearRoomStates(const char *roomName) = 0; - - virtual int subscribeUserState(const char *userId) = 0; - virtual int setUserState(const UserStateItem items[], int count) = 0; - virtual int deleteUserState(const char *keys[], int count) = 0; - virtual int unsubscribeUserState(const char *userId) = 0; -}; - -} -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraStreamChannel.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraStreamChannel.h deleted file mode 100644 index c706f1fe..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraStreamChannel.h +++ /dev/null @@ -1,207 +0,0 @@ - -// Copyright (c) 2022 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" - -namespace agora { -namespace rtm { -/** - * The qos of rtm message. - */ -enum RTM_MESSAGE_QOS { - /** - * Will not ensure that messages arrive in order. - */ - RTM_MESSAGE_QOS_UNORDERED = 0, - /** - * Will ensure that messages arrive in order. - */ - RTM_MESSAGE_QOS_ORDERED = 1, -}; - -/** - * Join channel options. - */ -struct JoinChannelOptions { - /** - * Token used to join channel. - */ - const char* token; - - JoinChannelOptions() : token(NULL) {} -}; - -/** - * Create topic options. - */ -struct JoinTopicOptions { - /** - * The qos of rtm message. - */ - RTM_MESSAGE_QOS qos; - - /** - * The metaData of topic. - */ - const char* meta; - - /** - * The length of meta. - */ - size_t metaLength; - - JoinTopicOptions() : qos(RTM_MESSAGE_QOS_UNORDERED), meta(NULL), metaLength(0) {} -}; - -/** - * Topic options. - */ -struct TopicOptions { - /** - * The list of users to subscribe. - */ - const char** users; - /** - * The number of users. - */ - size_t userCount; - - TopicOptions() : users(NULL), userCount(0) {} -}; - -/** - * User list. - */ -struct UserList { - /** - * The list of users. - */ - const char** users; - /** - * The number of users. - */ - size_t userCount; - - UserList() : users(NULL), userCount(0) {} -}; - -/** - * The IStreamChannel class. - * - * This class provides the stream channel methods that can be invoked by your app. - */ -class IStreamChannel { - public: - /** - * Join the channel. - * - * @param [in] options join channel options. - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int join(const JoinChannelOptions& options) = 0; - - /** - * Leave the channel. - * - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int leave() = 0; - - /** - * Return the channel name of this stream channel. - * - * @return The channel name. - */ - virtual const char* getChannelName() = 0; - - /** - * Join a topic. - * - * @param [in] topic The name of the topic. - * @param [in] options The options of the topic. - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int joinTopic(const char* topic, const JoinTopicOptions& options) = 0; - - /** - * Publish a message in the topic. - * - * @param [in] topic The name of the topic. - * @param [in] message The content of the message. - * @param [in] length The length of the message. - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int publishTopicMessage(const char* topic, const char* message, size_t length) = 0; - - /** - * Leave the topic. - * - * @param [in] topic The name of the topic. - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int leaveTopic(const char* topic) = 0; - - /** - * Subscribe a topic. - * - * @param [in] topic The name of the topic. - * @param [in] options The options of subscribe the topic. - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int subscribeTopic(const char* topic, const TopicOptions& options) = 0; - - /** - * Unsubscribe a topic. - * - * @param [in] topic The name of the topic. - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int unsubscribeTopic(const char* topic, const TopicOptions& options) = 0; - - /** - * Get subscribed user list - * - * @param [in] topic The name of the topic. - * @param [out] users The list of subscribed users. - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int getSubscribedUserList(const char* topic, UserList* users) = 0; - - /** - * Release the stream channel instance. - * - * @return - * - 0: Success. - * - < 0: Failure. - */ - virtual int release() = 0; - - protected: - ~IStreamChannel() {} -}; - -} // namespace rtm -} // namespace agora diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/UnrealMemory.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/UnrealMemory.h similarity index 100% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/UnrealMemory.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/UnrealMemory.h diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraBase.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraBase.h similarity index 84% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraBase.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraBase.h index c7f7f059..7ccb6891 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraBase.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraBase.h @@ -33,31 +33,42 @@ #if defined(AGORARTC_EXPORT) #define AGORA_API extern "C" __declspec(dllexport) +#define AGORA_CPP_API __declspec(dllexport) #else #define AGORA_API extern "C" __declspec(dllimport) +#define AGORA_CPP_API __declspec(dllimport) #endif // AGORARTC_EXPORT #define AGORA_CALL __cdecl #define __deprecated +#define AGORA_CPP_INTERNAL_API extern + #elif defined(__APPLE__) #include #define AGORA_API extern "C" __attribute__((visibility("default"))) +#define AGORA_CPP_API __attribute__((visibility("default"))) #define AGORA_CALL +#define AGORA_CPP_INTERNAL_API __attribute__((visibility("hidden"))) + #elif defined(__ANDROID__) || defined(__linux__) #define AGORA_API extern "C" __attribute__((visibility("default"))) +#define AGORA_CPP_API __attribute__((visibility("default"))) #define AGORA_CALL #define __deprecated +#define AGORA_CPP_INTERNAL_API __attribute__((visibility("hidden"))) + #else // !_WIN32 && !__APPLE__ && !(__ANDROID__ || __linux__) #define AGORA_API extern "C" +#define AGORA_CPP_API #define AGORA_CALL #define __deprecated @@ -80,7 +91,7 @@ #endif #endif -#define INVALID_DISPLAY_ID 0xffff +#define INVALID_DISPLAY_ID (-2) namespace agora { namespace util { @@ -92,16 +103,16 @@ class AutoPtr { typedef T* pointer_type; public: - explicit AutoPtr(pointer_type p = NULL) : ptr_(p) {} + explicit AutoPtr(pointer_type p = OPTIONAL_NULLPTR) : ptr_(p) {} ~AutoPtr() { if (ptr_) { ptr_->release(); - ptr_ = NULL; + ptr_ = OPTIONAL_NULLPTR; } } - operator bool() const { return (ptr_ != NULL); } + operator bool() const { return (ptr_ != OPTIONAL_NULLPTR); } value_type& operator*() const { return *get(); } @@ -115,7 +126,7 @@ class AutoPtr { return ret; } - void reset(pointer_type ptr = NULL) { + void reset(pointer_type ptr = OPTIONAL_NULLPTR) { if (ptr != ptr_ && ptr_) { ptr_->release(); } @@ -125,12 +136,12 @@ class AutoPtr { template bool queryInterface(C1* c, C2 iid) { - pointer_type p = NULL; + pointer_type p = OPTIONAL_NULLPTR; if (c && !c->queryInterface(iid, reinterpret_cast(&p))) { reset(p); } - return (p != NULL); + return (p != OPTIONAL_NULLPTR); } private: @@ -153,7 +164,7 @@ class CopyableAutoPtr : public AutoPtr { return *this; } pointer_type clone() const { - if (!this->get()) return NULL; + if (!this->get()) return OPTIONAL_NULLPTR; return this->get()->clone(); } }; @@ -197,7 +208,7 @@ class AOutputIterator { typedef const value_type& const_reference; typedef value_type* pointer; typedef const value_type* const_pointer; - explicit AOutputIterator(IIterator* it = NULL) : p(it) {} + explicit AOutputIterator(IIterator* it = OPTIONAL_NULLPTR) : p(it) {} ~AOutputIterator() { if (p) p->release(); } @@ -215,7 +226,7 @@ class AOutputIterator { 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; } + bool valid() const { return p && p->current() != OPTIONAL_NULLPTR; } }; template @@ -234,16 +245,16 @@ class AList { typedef const AOutputIterator const_iterator; public: - AList() : container(NULL), owner(false) {} + AList() : container(OPTIONAL_NULLPTR), owner(false) {} AList(IContainer* c, bool take_ownership) : container(c), owner(take_ownership) {} ~AList() { reset(); } - void reset(IContainer* c = NULL, bool take_ownership = false) { + void reset(IContainer* c = OPTIONAL_NULLPTR, 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); } + iterator begin() { return container ? iterator(container->begin()) : iterator(OPTIONAL_NULLPTR); } + iterator end() { return iterator(OPTIONAL_NULLPTR); } size_type size() const { return container ? container->size() : 0; } bool empty() const { return size() == 0; } }; @@ -631,7 +642,7 @@ enum ERROR_CODE_TYPE { */ ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119, /** - * 120: Decryption fails. The user may have tried to join the channel with a wrong + * 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, @@ -639,6 +650,11 @@ enum ERROR_CODE_TYPE { * 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. */ @@ -850,12 +866,11 @@ enum INTERFACE_ID_TYPE { 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_STATE_SYNC = 13, - AGORA_IID_METACHAT_SERVICE = 14, + AGORA_IID_META_SERVICE = 14, AGORA_IID_MUSIC_CONTENT_CENTER = 15, - AGORA_IID_H265_TRANSCODER = 16, + AGORA_IID_H265_TRANSCODER = 16, }; /** @@ -1120,6 +1135,22 @@ enum SCREEN_CAPTURE_FRAMERATE_CAPABILITY { SCREEN_CAPTURE_FRAMERATE_CAPABILITY_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 4k video at a rate of approximately 30 fps. */ + CODEC_CAPABILITY_LEVEL_4K60FPS = 30, +}; + /** * The video codec types. */ @@ -1147,11 +1178,12 @@ enum VIDEO_CODEC_TYPE { */ VIDEO_CODEC_GENERIC_H264 = 7, /** - * 12: AV1. - */ + * 12: AV1. + * @technical preview + */ VIDEO_CODEC_AV1 = 12, /** - * 5: VP9. + * 13: VP9. */ VIDEO_CODEC_VP9 = 13, /** @@ -1160,6 +1192,28 @@ enum VIDEO_CODEC_TYPE { VIDEO_CODEC_GENERIC_JPEG = 20, }; +/** + * Camera focal length type. + */ +enum CAMERA_FOCAL_LENGTH_TYPE { + /** + * By default, there are no wide-angle and ultra-wide-angle properties. + */ + CAMERA_FOCAL_LENGTH_DEFAULT = 0, + /** + * Lens with focal length from 24mm to 35mm. + */ + CAMERA_FOCAL_LENGTH_WIDE_ANGLE = 1, + /** + * Lens with focal length of less than 24mm. + */ + CAMERA_FOCAL_LENGTH_ULTRA_WIDE = 2, + /** + * Telephoto lens. + */ + CAMERA_FOCAL_LENGTH_TELEPHOTO = 3, +}; + /** * The CC (Congestion Control) mode options. */ @@ -1247,7 +1301,7 @@ struct SenderOptions { SenderOptions() : ccMode(CC_ENABLED), - codecType(VIDEO_CODEC_H264), + codecType(VIDEO_CODEC_H265), targetBitrate(6500) {} }; @@ -1295,6 +1349,10 @@ enum AUDIO_CODEC_TYPE { * 12: LPCNET. */ AUDIO_CODEC_LPCNET = 12, + /** + * 13: Opus codec, supporting 3 to 8 channels audio. + */ + AUDIO_CODEC_OPUSMC = 13, }; /** @@ -1495,13 +1553,38 @@ enum H264PacketizeMode { */ enum VIDEO_STREAM_TYPE { /** - * 0: The high-quality video stream, which has a higher resolution and bitrate. + * 0: The high-quality video stream, which has the highest resolution and bitrate. */ VIDEO_STREAM_HIGH = 0, /** - * 1: The low-quality video stream, which has a lower resolution and bitrate. + * 1: The low-quality video stream, which has the lowest resolution and bitrate. */ VIDEO_STREAM_LOW = 1, + /** + * 4: The video stream of layer_1, which has a lower resolution and bitrate than VIDEO_STREAM_HIGH. + */ + VIDEO_STREAM_LAYER_1 = 4, + /** + * 5: The video stream of layer_2, which has a lower resolution and bitrate than VIDEO_STREAM_LAYER_1. + */ + VIDEO_STREAM_LAYER_2 = 5, + /** + * 6: The video stream of layer_3, which has a lower resolution and bitrate than VIDEO_STREAM_LAYER_2. + */ + VIDEO_STREAM_LAYER_3 = 6, + /** + * 7: The video stream of layer_4, which has a lower resolution and bitrate than VIDEO_STREAM_LAYER_3. + */ + VIDEO_STREAM_LAYER_4 = 7, + /** + * 8: The video stream of layer_5, which has a lower resolution and bitrate than VIDEO_STREAM_LAYER_4. + */ + VIDEO_STREAM_LAYER_5 = 8, + /** + * 9: The video stream of layer_6, which has a lower resolution and bitrate than VIDEO_STREAM_LAYER_5. + */ + VIDEO_STREAM_LAYER_6 = 9, + }; struct VideoSubscriptionOptions { @@ -1522,12 +1605,23 @@ struct VideoSubscriptionOptions { VideoSubscriptionOptions() {} }; + +/** 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 definition of the EncodedVideoFrameInfo struct, which contains the information of the external encoded video frame. */ struct EncodedVideoFrameInfo { EncodedVideoFrameInfo() - : codecType(VIDEO_CODEC_H264), + : uid(0), + codecType(VIDEO_CODEC_H264), width(0), height(0), framesPerSecond(0), @@ -1536,11 +1630,12 @@ struct EncodedVideoFrameInfo { trackId(0), captureTimeMs(0), decodeTimeMs(0), - uid(0), - streamType(VIDEO_STREAM_HIGH) {} + streamType(VIDEO_STREAM_HIGH), + presentationMs(-1) {} EncodedVideoFrameInfo(const EncodedVideoFrameInfo& rhs) - : codecType(rhs.codecType), + : uid(rhs.uid), + codecType(rhs.codecType), width(rhs.width), height(rhs.height), framesPerSecond(rhs.framesPerSecond), @@ -1549,11 +1644,12 @@ struct EncodedVideoFrameInfo { trackId(rhs.trackId), captureTimeMs(rhs.captureTimeMs), decodeTimeMs(rhs.decodeTimeMs), - uid(rhs.uid), - streamType(rhs.streamType) {} + streamType(rhs.streamType), + presentationMs(rhs.presentationMs) {} EncodedVideoFrameInfo& operator=(const EncodedVideoFrameInfo& rhs) { if (this == &rhs) return *this; + uid = rhs.uid; codecType = rhs.codecType; width = rhs.width; height = rhs.height; @@ -1563,12 +1659,17 @@ struct EncodedVideoFrameInfo { trackId = rhs.trackId; captureTimeMs = rhs.captureTimeMs; decodeTimeMs = rhs.decodeTimeMs; - uid = rhs.uid; streamType = rhs.streamType; + presentationMs = rhs.presentationMs; return *this; } + + /** + * ID of the user that pushes the the external encoded video frame.. + */ + uid_t uid; /** - * The codec type of the local video stream. See #VIDEO_CODEC_TYPE. The default value is `VIDEO_CODEC_H264 (2)`. + * The codec type of the local video stream. See #VIDEO_CODEC_TYPE. The default value is `VIDEO_CODEC_H265 (3)`. */ VIDEO_CODEC_TYPE codecType; /** @@ -1606,16 +1707,15 @@ struct EncodedVideoFrameInfo { * 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; + // @technical preview + int64_t presentationMs; }; + /** * Video compression preference. */ @@ -1663,17 +1763,27 @@ struct AdvanceOptions { */ COMPRESSION_PREFERENCE compressionPreference; + /** + * Whether to encode and send the alpha data to the remote when alpha data is present. + * The default value is false. + */ + bool encodeAlpha; + AdvanceOptions() : encodingPreference(PREFER_AUTO), - compressionPreference(PREFER_LOW_LATENCY) {} + compressionPreference(PREFER_LOW_LATENCY), + encodeAlpha(false) {} AdvanceOptions(ENCODING_PREFERENCE encoding_preference, - COMPRESSION_PREFERENCE compression_preference) : + COMPRESSION_PREFERENCE compression_preference, + bool encode_alpha) : encodingPreference(encoding_preference), - compressionPreference(compression_preference) {} + compressionPreference(compression_preference), + encodeAlpha(encode_alpha) {} bool operator==(const AdvanceOptions& rhs) const { return encodingPreference == rhs.encodingPreference && - compressionPreference == rhs.compressionPreference; + compressionPreference == rhs.compressionPreference && + encodeAlpha == rhs.encodeAlpha; } }; @@ -1696,6 +1806,17 @@ enum VIDEO_MIRROR_MODE_TYPE { 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 { @@ -1715,12 +1836,31 @@ enum CODEC_CAP_MASK { 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; + + CodecCapInfo(): codecType(VIDEO_CODEC_NONE), codecCapMask(0) {} +}; + +/** FocalLengthInfo contains the IDs of the front and rear cameras, along with the wide-angle types. */ +struct FocalLengthInfo { + /** The camera direction. */ + int cameraDirection; + /** Camera focal segment type. */ + CAMERA_FOCAL_LENGTH_TYPE focalLengthType; }; /** @@ -1834,7 +1974,7 @@ struct VideoEncoderConfiguration { 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), + : codecType(VIDEO_CODEC_NONE), dimensions(d), frameRate(f), bitrate(b), @@ -1842,9 +1982,9 @@ struct VideoEncoderConfiguration { orientationMode(m), degradationPreference(MAINTAIN_QUALITY), mirrorMode(mirror), - advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY, false) {} 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), + : codecType(VIDEO_CODEC_NONE), dimensions(width, height), frameRate(f), bitrate(b), @@ -1852,7 +1992,7 @@ struct VideoEncoderConfiguration { orientationMode(m), degradationPreference(MAINTAIN_QUALITY), mirrorMode(mirror), - advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY, false) {} VideoEncoderConfiguration(const VideoEncoderConfiguration& config) : codecType(config.codecType), dimensions(config.dimensions), @@ -1864,7 +2004,7 @@ struct VideoEncoderConfiguration { mirrorMode(config.mirrorMode), advanceOptions(config.advanceOptions) {} VideoEncoderConfiguration() - : codecType(VIDEO_CODEC_H264), + : codecType(VIDEO_CODEC_NONE), dimensions(FRAME_WIDTH_960, FRAME_HEIGHT_540), frameRate(FRAME_RATE_FPS_15), bitrate(STANDARD_BITRATE), @@ -1872,7 +2012,7 @@ struct VideoEncoderConfiguration { orientationMode(ORIENTATION_MODE_ADAPTIVE), degradationPreference(MAINTAIN_QUALITY), mirrorMode(VIDEO_MIRROR_MODE_DISABLED), - advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY) {} + advanceOptions(PREFER_AUTO, PREFER_LOW_LATENCY, false) {} VideoEncoderConfiguration& operator=(const VideoEncoderConfiguration& rhs) { if (this == &rhs) return *this; @@ -1946,15 +2086,78 @@ struct SimulcastStreamConfig { */ int kBitrate; /** - * he capture frame rate (fps) of the local video. The default value is 5. + * The capture frame rate (fps) of the local video. The default value is 5. */ int framerate; SimulcastStreamConfig() : dimensions(160, 120), kBitrate(65), framerate(5) {} + SimulcastStreamConfig(const SimulcastStreamConfig& other) : dimensions(other.dimensions), kBitrate(other.kBitrate), framerate(other.framerate) {} bool operator==(const SimulcastStreamConfig& rhs) const { return dimensions == rhs.dimensions && kBitrate == rhs.kBitrate && framerate == rhs.framerate; } }; +/** + * The configuration of the multi-layer video stream. + */ +struct SimulcastConfig { + /** + * The index of multi-layer video stream + */ + enum StreamLayerIndex { + /** + * 0: video stream index of layer_1 + */ + STREAM_LAYER_1 = 0, + /** + * 1: video stream index of layer_2 + */ + STREAM_LAYER_2 = 1, + /** + * 2: video stream index of layer_3 + */ + STREAM_LAYER_3 = 2, + /** + * 3: video stream index of layer_4 + */ + STREAM_LAYER_4 = 3, + /** + * 4: video stream index of layer_5 + */ + STREAM_LAYER_5 = 4, + /** + * 5: video stream index of layer_6 + */ + STREAM_LAYER_6 = 5, + /** + * 6: video stream index of low + */ + STREAM_LOW = 6, + /** + * 7: max count of video stream layers + */ + STREAM_LAYER_COUNT_MAX = 7 + }; + struct StreamLayerConfig { + /** + * The video frame dimension. The default value is 0. + */ + VideoDimensions dimensions; + /** + * The capture frame rate (fps) of the local video. The default value is 0. + */ + int framerate; + /** + * Whether to enable the corresponding layer of video stream. The default value is false. + */ + bool enable; + StreamLayerConfig() : dimensions(0, 0), framerate(0), enable(false) {} + }; + + /** + * The array of StreamLayerConfig, which contains STREAM_LAYER_COUNT_MAX layers of video stream at most. + */ + StreamLayerConfig configs[STREAM_LAYER_COUNT_MAX]; +}; /** * 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. @@ -2552,6 +2755,33 @@ enum VIDEO_APPLICATION_SCENARIO_TYPE { * 1: Meeting Scenario. This scenario is the best QoE practice of meeting application. */ APPLICATION_SCENARIO_MEETING = 1, + /** + * 2: Video Call Scenario. This scenario is used to optimize the video experience in video application, like 1v1 video call. + */ + APPLICATION_SCENARIO_1V1 = 2, +}; + +/** + * The video QoE preference type. + */ +enum VIDEO_QOE_PREFERENCE_TYPE { + /** + * 1: Default QoE type, balance the delay, picture quality and fluency. + */ + VIDEO_QOE_PREFERENCE_BALANCE = 1, + /** + * 2: lower the e2e delay. + */ + VIDEO_QOE_PREFERENCE_DELAY_FIRST = 2, + /** + * 3: picture quality. + */ + VIDEO_QOE_PREFERENCE_PICTURE_QUALITY_FIRST = 3, + /** + * 4: more fluency. + */ + VIDEO_QOE_PREFERENCE_FLUENCY_FIRST = 4, + }; /** @@ -2573,6 +2803,27 @@ enum CAPTURE_BRIGHTNESS_LEVEL_TYPE { CAPTURE_BRIGHTNESS_LEVEL_DARK = 2, }; +enum CAMERA_STABILIZATION_MODE { + /** The camera stabilization mode is disabled. + */ + CAMERA_STABILIZATION_MODE_OFF = -1, + /** device choose stabilization mode automatically. + */ + CAMERA_STABILIZATION_MODE_AUTO = 0, + /** stabilization mode level 1. + */ + CAMERA_STABILIZATION_MODE_LEVEL_1 = 1, + /** stabilization mode level 2. + */ + CAMERA_STABILIZATION_MODE_LEVEL_2 = 2, + /** stabilization mode level 3. + */ + CAMERA_STABILIZATION_MODE_LEVEL_3 = 3, + /** The maximum level of the camera stabilization mode. + */ + CAMERA_STABILIZATION_MODE_MAX_LEVEL = CAMERA_STABILIZATION_MODE_LEVEL_3, +}; + /** * Local audio states. */ @@ -2598,50 +2849,50 @@ enum LOCAL_AUDIO_STREAM_STATE { /** * Local audio state error codes. */ -enum LOCAL_AUDIO_STREAM_ERROR { +enum LOCAL_AUDIO_STREAM_REASON { /** * 0: The local audio is normal. */ - LOCAL_AUDIO_STREAM_ERROR_OK = 0, + LOCAL_AUDIO_STREAM_REASON_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, + LOCAL_AUDIO_STREAM_REASON_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, + LOCAL_AUDIO_STREAM_REASON_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, + LOCAL_AUDIO_STREAM_REASON_DEVICE_BUSY = 3, /** * 4: The local audio capture failed. */ - LOCAL_AUDIO_STREAM_ERROR_RECORD_FAILURE = 4, + LOCAL_AUDIO_STREAM_REASON_RECORD_FAILURE = 4, /** * 5: The local audio encoding failed. */ - LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE = 5, + LOCAL_AUDIO_STREAM_REASON_ENCODE_FAILURE = 5, /** 6: The SDK cannot find the local audio recording device. */ - LOCAL_AUDIO_STREAM_ERROR_NO_RECORDING_DEVICE = 6, + LOCAL_AUDIO_STREAM_REASON_NO_RECORDING_DEVICE = 6, /** 7: The SDK cannot find the local audio playback device. */ - LOCAL_AUDIO_STREAM_ERROR_NO_PLAYOUT_DEVICE = 7, + LOCAL_AUDIO_STREAM_REASON_NO_PLAYOUT_DEVICE = 7, /** * 8: The local audio capturing is interrupted by the system call. */ - LOCAL_AUDIO_STREAM_ERROR_INTERRUPTED = 8, + LOCAL_AUDIO_STREAM_REASON_INTERRUPTED = 8, /** 9: An invalid audio capture device ID. */ - LOCAL_AUDIO_STREAM_ERROR_RECORD_INVALID_ID = 9, + LOCAL_AUDIO_STREAM_REASON_RECORD_INVALID_ID = 9, /** 10: An invalid audio playback device ID. */ - LOCAL_AUDIO_STREAM_ERROR_PLAYOUT_INVALID_ID = 10, + LOCAL_AUDIO_STREAM_REASON_PLAYOUT_INVALID_ID = 10, }; /** Local video state types. @@ -2669,73 +2920,83 @@ enum LOCAL_VIDEO_STREAM_STATE { /** * Local video state error codes. */ -enum LOCAL_VIDEO_STREAM_ERROR { +enum LOCAL_VIDEO_STREAM_REASON { /** * 0: The local video is normal. */ - LOCAL_VIDEO_STREAM_ERROR_OK = 0, + LOCAL_VIDEO_STREAM_REASON_OK = 0, /** * 1: No specified reason for the local video failure. */ - LOCAL_VIDEO_STREAM_ERROR_FAILURE = 1, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_CAPTURE_FAILURE = 4, /** * 5: The local video encoder is not supported. */ - LOCAL_VIDEO_STREAM_ERROR_ENCODE_FAILURE = 5, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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_REASON_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_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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, + LOCAL_VIDEO_STREAM_REASON_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. @@ -2750,15 +3011,40 @@ enum LOCAL_VIDEO_STREAM_ERROR { * 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, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_CLOSED = 12, /** 13: The local screen capture window is occluded. */ - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_OCCLUDED = 13, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_OCCLUDED = 13, /** 20: The local screen capture window is not supported. */ - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_NOT_SUPPORTED = 20, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_NOT_SUPPORTED = 20, /** 21: The screen capture fails. */ - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_FAILURE = 21, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_FAILURE = 21, /** 22: No permision to capture screen. */ - LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_NO_PERMISSION = 22, + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_NO_PERMISSION = 22, + /** + * 24: (Windows Only) An unexpected error (possibly due to window block failure) occurs during the screen + * sharing process, resulting in performance degradation. However, the screen sharing process itself is + * functioning normally. + */ + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_AUTO_FALLBACK = 24, + /** 25: (Windows only) The local screen capture window is currently hidden and not visible on the desktop. */ + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_HIDDEN = 25, + /** 26: (Windows only) The local screen capture window is recovered from its hidden state. */ + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_RECOVER_FROM_HIDDEN = 26, + /** 27: (Windows and macOS only) The window is recovered from miniminzed */ + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_WINDOW_RECOVER_FROM_MINIMIZED = 27, + /** + * 28: The screen capture paused. + * + * Common scenarios for reporting this error code: + * - When the desktop switch to the secure desktop such as UAC dialog or the Winlogon desktop on + * Windows platform, the SDK reports this error code. + */ + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_PAUSED = 28, + /** 29: The screen capture is resumed. */ + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_RESUMED = 29, + /** 30: The shared display has been disconnected */ + LOCAL_VIDEO_STREAM_REASON_SCREEN_CAPTURE_DISPLAY_DISCONNECTED = 30, + }; /** @@ -2835,6 +3121,14 @@ enum REMOTE_AUDIO_STATE_REASON * 7: The remote user leaves the channel. */ REMOTE_AUDIO_REASON_REMOTE_OFFLINE = 7, + /** + * 8: The local user does not receive any audio packet from remote user. + */ + REMOTE_AUDIO_REASON_NO_PACKET_RECEIVE = 8, + /** + * 9: The local user receives remote audio packet but fails to play. + */ + REMOTE_AUDIO_REASON_LOCAL_PLAY_FAILED = 9, }; /** @@ -2946,7 +3240,6 @@ enum REMOTE_USER_STATE { * The remote user has enabled the local video capturing. */ USER_STATE_ENABLE_LOCAL_VIDEO = (1 << 8), - }; /** @@ -2956,7 +3249,7 @@ enum REMOTE_USER_STATE { struct VideoTrackInfo { VideoTrackInfo() : isLocal(false), ownerUid(0), trackId(0), channelId(OPTIONAL_NULLPTR) - , streamType(VIDEO_STREAM_HIGH), codecType(VIDEO_CODEC_H264) + , codecType(VIDEO_CODEC_H265) , encodedFrameOnly(false), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY) , observationPosition(agora::media::base::POSITION_POST_CAPTURER) {} /** @@ -2969,7 +3262,6 @@ struct VideoTrackInfo { * ID of the user who publishes the video track. */ uid_t ownerUid; - /** * ID of the video track. */ @@ -2978,10 +3270,6 @@ struct VideoTrackInfo { * 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. */ @@ -3100,7 +3388,7 @@ class IPacketObserver { */ unsigned int size; - Packet() : buffer(NULL), size(0) {} + Packet() : buffer(OPTIONAL_NULLPTR), size(0) {} }; /** * Occurs when the SDK is ready to send the audio packet. @@ -3233,6 +3521,18 @@ struct LocalAudioStats * The audio delay of the device, contains record and playout delay */ int audioDeviceDelay; + /** + * The playout delay of the device + */ + int audioPlayoutDelay; + /** + * The signal delay estimated from audio in-ear monitoring (ms). + */ + int earMonitorDelay; + /** + * The signal delay estimated during the AEC process from nearin and farin (ms). + */ + int aecEstimatedDelay; }; @@ -3271,74 +3571,74 @@ enum RTMP_STREAM_PUBLISH_STATE { /** * Error codes of the RTMP or RTMPS streaming. */ -enum RTMP_STREAM_PUBLISH_ERROR_TYPE { +enum RTMP_STREAM_PUBLISH_REASON { /** * 0: The RTMP or RTMPS streaming publishes successfully. */ - RTMP_STREAM_PUBLISH_ERROR_OK = 0, + RTMP_STREAM_PUBLISH_REASON_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, + RTMP_STREAM_PUBLISH_REASON_INVALID_ARGUMENT = 1, /** * 2: The RTMP or RTMPS streaming is encrypted and cannot be published. */ - RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED = 2, + RTMP_STREAM_PUBLISH_REASON_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, + RTMP_STREAM_PUBLISH_REASON_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, + RTMP_STREAM_PUBLISH_REASON_INTERNAL_SERVER_ERROR = 4, /** * 5: An error occurs in the CDN server. */ - RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR = 5, + RTMP_STREAM_PUBLISH_REASON_RTMP_SERVER_ERROR = 5, /** * 6: The RTMP or RTMPS streaming publishes too frequently. */ - RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN = 6, + RTMP_STREAM_PUBLISH_REASON_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, + RTMP_STREAM_PUBLISH_REASON_REACH_LIMIT = 7, /** * 8: The host manipulates other hosts' URLs. Check your app logic. */ - RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED = 8, + RTMP_STREAM_PUBLISH_REASON_NOT_AUTHORIZED = 8, /** * 9: Agora's server fails to find the RTMP or RTMPS streaming. */ - RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND = 9, + RTMP_STREAM_PUBLISH_REASON_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, + RTMP_STREAM_PUBLISH_REASON_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 + RTMP_STREAM_PUBLISH_REASON_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 + RTMP_STREAM_PUBLISH_REASON_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 + RTMP_STREAM_PUBLISH_REASON_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 + RTMP_STREAM_PUBLISH_REASON_INVALID_APPID = 15, // Note: match to ERR_PUBLISH_STREAM_APPID_INVALID in AgoraBase.h /** invalid privilege. */ - RTMP_STREAM_PUBLISH_ERROR_INVALID_PRIVILEGE = 16, + RTMP_STREAM_PUBLISH_REASON_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, + RTMP_STREAM_UNPUBLISH_REASON_OK = 100, }; /** Events during the RTMP or RTMPS streaming. */ @@ -3400,7 +3700,7 @@ typedef struct RtcImage { */ double alpha; - RtcImage() : url(NULL), x(0), y(0), width(0), height(0), zOrder(0), alpha(1.0) {} + RtcImage() : url(OPTIONAL_NULLPTR), 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. @@ -3408,7 +3708,7 @@ typedef struct RtcImage { * If you want to enable the advanced features of streaming with transcoding, contact support@agora.io. */ struct LiveStreamAdvancedFeature { - LiveStreamAdvancedFeature() : featureName(NULL), opened(false) {} + LiveStreamAdvancedFeature() : featureName(OPTIONAL_NULLPTR), 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"; @@ -3528,6 +3828,7 @@ struct TranscodingUser { * @note If the value is not `0`, a special player is required. */ int audioChannel; + TranscodingUser() : uid(0), x(0), @@ -3647,7 +3948,31 @@ struct LiveTranscoding { /** 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) {} + + 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(OPTIONAL_NULLPTR), + transcodingExtraInfo(OPTIONAL_NULLPTR), + metadata(OPTIONAL_NULLPTR), + watermark(OPTIONAL_NULLPTR), + watermarkCount(0), + backgroundImage(OPTIONAL_NULLPTR), + backgroundImageCount(0), + audioSampleRate(AUDIO_SAMPLE_RATE_48000), + audioBitrate(48), + audioChannels(1), + audioCodecProfile(AUDIO_CODEC_PROFILE_LC_AAC), + advancedFeatures(OPTIONAL_NULLPTR), + advancedFeatureCount(0) {} }; /** @@ -3709,7 +4034,7 @@ struct TranscodingVideoStream { TranscodingVideoStream() : sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), remoteUserUid(0), - imageUrl(NULL), + imageUrl(OPTIONAL_NULLPTR), x(0), y(0), width(0), @@ -3719,7 +4044,6 @@ struct TranscodingVideoStream { mirror(false) {} }; - /** * The configuration of the video mixing on the local client. */ @@ -3743,18 +4067,10 @@ struct LocalTranscoderConfiguration { */ bool syncWithPrimaryCamera; - LocalTranscoderConfiguration() - : streamCount(0), - videoInputStreams(NULL), - videoOutputConfiguration(), - syncWithPrimaryCamera(true) {} + LocalTranscoderConfiguration() : streamCount(0), videoInputStreams(OPTIONAL_NULLPTR), videoOutputConfiguration(), syncWithPrimaryCamera(true) {} }; enum VIDEO_TRANSCODER_ERROR { - /** - * No error - */ - VT_ERR_OK = 0, /** * The video track of the video source is not started. */ @@ -3973,6 +4289,18 @@ enum CONNECTION_CHANGED_REASON_TYPE * 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, + /** + * 23: The connection is failed due to the lack of granting permission to the stream channel. + */ + CONNECTION_CHANGED_STREAM_CHANNEL_NOT_AVAILABLE = 23, + /** + * 24: The connection is failed due to join channel with an inconsistent appid. + */ + CONNECTION_CHANGED_INCONSISTENT_APPID = 24, }; /** @@ -3989,12 +4317,14 @@ enum CLIENT_ROLE_CHANGE_FAILED_REASON { CLIENT_ROLE_CHANGE_FAILED_NOT_AUTHORIZED = 2, /** * 3: The operation of changing role is timeout. + * @deprecated This reason is deprecated. */ - CLIENT_ROLE_CHANGE_FAILED_REQUEST_TIME_OUT = 3, + CLIENT_ROLE_CHANGE_FAILED_REQUEST_TIME_OUT __deprecated = 3, /** * 4: The operation of changing role is interrupted since we lost connection with agora service. + * @deprecated This reason is deprecated. */ - CLIENT_ROLE_CHANGE_FAILED_CONNECTION_FAILED = 4, + CLIENT_ROLE_CHANGE_FAILED_CONNECTION_FAILED __deprecated = 4, }; /** @@ -4083,6 +4413,10 @@ enum NETWORK_TYPE { * 5: The network type is mobile 4G. */ NETWORK_TYPE_MOBILE_4G = 5, + /** + * 6: The network type is mobile 5G. + */ + NETWORK_TYPE_MOBILE_5G = 6, }; /** @@ -4107,14 +4441,23 @@ enum VIDEO_VIEW_SETUP_MODE { * Attributes of video canvas object. */ struct VideoCanvas { + /** + * The user id of local video. + */ + uid_t uid; + + /** + * The uid of video stream composing the video stream from transcoder which will be drawn on this video canvas. + */ + uid_t subviewUid; /** * Video display window. */ view_t view; /** - * The user id of local video. + * A RGBA value indicates background color of the render view. Defaults to 0x00000000. */ - uid_t uid; + uint32_t backgroundColor; /** * The video render mode. See \ref agora::media::base::RENDER_MODE_TYPE "RENDER_MODE_TYPE". * The default value is RENDER_MODE_HIDDEN. @@ -4152,25 +4495,37 @@ struct VideoCanvas { * The default value is empty(that is, if it has zero width or height), which means no cropping. */ Rectangle cropArea; - /** - * Whether to apply alpha mask to the video frame if exsit: - * true: Apply alpha mask to video frame. - * false: (Default) Do not apply alpha mask to video frame. - */ + * Whether to apply alpha mask to the video frame if exsit: + * true: Apply alpha mask to video frame. + * false: (Default) Do not apply alpha mask to video frame. + */ bool enableAlphaMask; - + /** + * The video frame position in pipeline. See \ref VIDEO_MODULE_POSITION "VIDEO_MODULE_POSITION". + * The default value is POSITION_POST_CAPTURER. + */ + media::base::VIDEO_MODULE_POSITION position; + VideoCanvas() - : view(NULL), uid(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) {} - + : uid(0), subviewUid(0), view(NULL), backgroundColor(0x00000000), 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), position(media::base::POSITION_POST_CAPTURER) {} + + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt) + : uid(0), subviewUid(0), view(v), backgroundColor(0x00000000), 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), position(media::base::POSITION_POST_CAPTURER) {} + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, uid_t u) - : view(v), uid(u), 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), 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) {} + : uid(u), subviewUid(0), view(v), backgroundColor(0x00000000), 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), position(media::base::POSITION_POST_CAPTURER) {} + + VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, uid_t u, uid_t subu) + : uid(u), subviewUid(subu), view(v), backgroundColor(0x00000000), 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), position(media::base::POSITION_POST_CAPTURER) {} }; /** Image enhancement options. @@ -4211,6 +4566,85 @@ struct BeautyOptions { BeautyOptions() : lighteningContrastLevel(LIGHTENING_CONTRAST_NORMAL), lighteningLevel(0), smoothnessLevel(0), rednessLevel(0), sharpnessLevel(0) {} }; +/** Face shape area options. This structure defines options for facial adjustments on different facial areas. + * + * @technical preview + */ +struct FaceShapeAreaOptions { + /** The specific facial area to be adjusted. + */ + enum FACE_SHAPE_AREA { + /** (Default) Invalid area. */ + FACE_SHAPE_AREA_NONE = -1, + /** Head Scale, reduces the size of head. */ + FACE_SHAPE_AREA_HEADSCALE = 0, + /** Forehead, adjusts the size of forehead. */ + FACE_SHAPE_AREA_FOREHEAD = 1, + /** Face Contour, slims the facial contour. */ + FACE_SHAPE_AREA_FACECONTOUR = 2, + /** Face Length, adjusts the length of face. */ + FACE_SHAPE_AREA_FACELENGTH = 3, + /** Face Width, narrows the width of face. */ + FACE_SHAPE_AREA_FACEWIDTH = 4, + /** Cheekbone, adjusts the size of cheekbone. */ + FACE_SHAPE_AREA_CHEEKBONE = 5, + /** Cheek, adjusts the size of cheek. */ + FACE_SHAPE_AREA_CHEEK = 6, + /** Chin, adjusts the length of chin. */ + FACE_SHAPE_AREA_CHIN = 7, + /** Eye Scale, adjusts the size of eyes. */ + FACE_SHAPE_AREA_EYESCALE = 8, + /** Nose Length, adjusts the length of nose. */ + FACE_SHAPE_AREA_NOSELENGTH = 9, + /** Nose Width, adjusts the width of nose. */ + FACE_SHAPE_AREA_NOSEWIDTH = 10, + /** Mouth Scale, adjusts the size of mouth. */ + FACE_SHAPE_AREA_MOUTHSCALE = 11, + }; + + /** The specific facial area to be adjusted, See #FACE_SHAPE_AREA. + */ + FACE_SHAPE_AREA shapeArea; + + /** The intensity of the pinching effect applied to the specified facial area. + * For the following area values: #FACE_SHAPE_AREA_FOREHEAD, #FACE_SHAPE_AREA_FACELENGTH, #FACE_SHAPE_AREA_CHIN, #FACE_SHAPE_AREA_NOSELENGTH, #FACE_SHAPE_AREA_NOSEWIDTH, #FACE_SHAPE_AREA_MOUTHSCALE, the value ranges from -100 to 100. + * The default value is 0. The greater the absolute value, the stronger the intensity applied to the specified facial area, and negative values indicate the opposite direction. + * For enumeration values other than the above, the value ranges from 0 to 100. The default value is 0. The greater the value, the stronger the intensity applied to the specified facial area. + */ + int shapeIntensity; + + FaceShapeAreaOptions(FACE_SHAPE_AREA shapeArea, int areaIntensity) : shapeArea(shapeArea), shapeIntensity(areaIntensity) {} + + FaceShapeAreaOptions() : shapeArea(FACE_SHAPE_AREA_NONE), shapeIntensity(0) {} +}; + +/** Face shape beauty options. This structure defines options for facial adjustments of different facial styles. + * + * @technical preview + */ +struct FaceShapeBeautyOptions { + /** The face shape style. + */ + enum FACE_SHAPE_BEAUTY_STYLE { + /** (Default) Female face shape style. */ + FACE_SHAPE_BEAUTY_STYLE_FEMALE = 0, + /** Male face shape style. */ + FACE_SHAPE_BEAUTY_STYLE_MALE = 1, + }; + + /** The face shape style, See #FACE_SHAPE_BEAUTY_STYLE. + */ + FACE_SHAPE_BEAUTY_STYLE shapeStyle; + + /** The intensity of the pinching effect applied to the specified facial style. The value ranges from 0 (original) to 100. The default value is 0. The greater the value, the stronger the intensity applied to face pinching. + */ + int styleIntensity; + + FaceShapeBeautyOptions(FACE_SHAPE_BEAUTY_STYLE shapeStyle, int styleIntensity) : shapeStyle(shapeStyle), styleIntensity(styleIntensity) {} + + FaceShapeBeautyOptions() : shapeStyle(FACE_SHAPE_BEAUTY_STYLE_FEMALE), styleIntensity(50) {} +}; + struct LowlightEnhanceOptions { /** * The low-light enhancement mode. @@ -4382,7 +4816,7 @@ struct VirtualBackgroundSource { */ BACKGROUND_BLUR_DEGREE blur_degree; - VirtualBackgroundSource() : background_source_type(BACKGROUND_COLOR), color(0xffffff), source(NULL), blur_degree(BLUR_DEGREE_HIGH) {} + VirtualBackgroundSource() : background_source_type(BACKGROUND_COLOR), color(0xffffff), source(OPTIONAL_NULLPTR), blur_degree(BLUR_DEGREE_HIGH) {} }; struct SegmentationProperty { @@ -4534,6 +4968,7 @@ enum VOICE_BEAUTIFIER_PRESET { * - `ROOM_ACOUSTICS_PHONOGRAPH` * - `ROOM_ACOUSTICS_SPACIAL` * - `ROOM_ACOUSTICS_ETHEREAL` + * - `ROOM_ACOUSTICS_CHORUS` * - `VOICE_CHANGER_EFFECT_UNCLE` * - `VOICE_CHANGER_EFFECT_OLDMAN` * - `VOICE_CHANGER_EFFECT_BOY` @@ -4595,6 +5030,14 @@ enum AUDIO_EFFECT_PRESET { * 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 @@ -4727,6 +5170,41 @@ enum HEADPHONE_EQUALIZER_PRESET { HEADPHONE_EQUALIZER_INEAR = 0x04000002 }; +/** The options for SDK voice AI tuner. + */ +enum VOICE_AI_TUNER_TYPE { + /** Uncle, deep and magnetic male voice. + */ + VOICE_AI_TUNER_MATURE_MALE, + /** Fresh male, refreshing and sweet male voice. + */ + VOICE_AI_TUNER_FRESH_MALE, + /** Big sister, deep and charming female voice. + */ + VOICE_AI_TUNER_ELEGANT_FEMALE, + /** Lolita, high-pitched and cute female voice. + */ + VOICE_AI_TUNER_SWEET_FEMALE, + /** Warm man singing, warm and melodic male voice that is suitable for male lyrical songs. + */ + VOICE_AI_TUNER_WARM_MALE_SINGING, + /** Gentle female singing, soft and delicate female voice that is suitable for female lyrical songs. + */ + VOICE_AI_TUNER_GENTLE_FEMALE_SINGING, + /** Smoky uncle singing, unique husky male voice that is suitable for rock or blues songs. + */ + VOICE_AI_TUNER_HUSKY_MALE_SINGING, + /** Warm big sister singing, warm and mature female voice that is suitable for emotionally powerful songs. + */ + VOICE_AI_TUNER_WARM_ELEGANT_FEMALE_SINGING, + /** Forceful male singing, strong and powerful male voice that is suitable for passionate songs. + */ + VOICE_AI_TUNER_POWERFUL_MALE_SINGING, + /** Dreamy female singing, dreamlike and soft female voice that is suitable for airy and dream-like songs. + */ + VOICE_AI_TUNER_DREAMY_FEMALE_SINGING, +}; + /** * Screen sharing configurations. */ @@ -4780,22 +5258,22 @@ struct ScreenCaptureParameters { */ 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; + /** 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) {} @@ -4912,7 +5390,7 @@ struct AudioRecordingConfiguration { int recordingChannel; AudioRecordingConfiguration() - : filePath(NULL), + : filePath(OPTIONAL_NULLPTR), encode(false), sampleRate(32000), fileRecordingType(AUDIO_FILE_RECORDING_MIXED), @@ -5039,6 +5517,10 @@ enum AREA_CODE { AREA_CODE_GLOB = (0xFFFFFFFF) }; +/** + Extra region code + @technical preview +*/ enum AREA_CODE_EX { /** * Oceania @@ -5064,6 +5546,10 @@ enum AREA_CODE_EX { * United States */ AREA_CODE_US = 0x00000800, + /** + * Russia + */ + AREA_CODE_RU = 0x00001000, /** * The global area (except China) */ @@ -5116,59 +5602,6 @@ enum CHANNEL_MEDIA_RELAY_ERROR { 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. */ @@ -5191,17 +5624,20 @@ enum CHANNEL_MEDIA_RELAY_STATE { /** The definition of ChannelMediaInfo. */ struct ChannelMediaInfo { - /** The channel name. The default value is NULL, which means that the SDK - * applies the current channel name. + /** The user ID. */ + uid_t uid; + /** 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. - */ + /** 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; + + ChannelMediaInfo() : uid(0), channelName(NULL), token(NULL) {} + ChannelMediaInfo(const char* c, const char* t, uid_t u) : uid(u), channelName(c), token(t) {} }; /** The definition of ChannelMediaRelayConfiguration. @@ -5219,7 +5655,7 @@ struct ChannelMediaRelayConfiguration { * - 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; + 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 @@ -5234,18 +5670,14 @@ struct ChannelMediaRelayConfiguration { * If you have enabled the App Certificate, you must use the token generated with the `channelName` * and `uid`. */ - ChannelMediaInfo *destInfos; + 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` + * 6. 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) - {} + ChannelMediaRelayConfiguration() : srcInfo(OPTIONAL_NULLPTR), destInfos(OPTIONAL_NULLPTR), destCount(0) {} }; /** @@ -5264,15 +5696,12 @@ struct UplinkNetworkInfo { } }; -/** - * The collections of downlink network info. - */ struct DownlinkNetworkInfo { struct PeerDownlinkInfo { /** * The ID of the user who owns the remote video stream. */ - const char* uid; + const char* userId; /** * The remote video stream type: #VIDEO_STREAM_TYPE. */ @@ -5287,28 +5716,41 @@ struct DownlinkNetworkInfo { int expected_bitrate_bps; PeerDownlinkInfo() - : uid(OPTIONAL_NULLPTR), + : userId(OPTIONAL_NULLPTR), stream_type(VIDEO_STREAM_HIGH), current_downscale_level(REMOTE_VIDEO_DOWNSCALE_LEVEL_NONE), expected_bitrate_bps(-1) {} + PeerDownlinkInfo(const PeerDownlinkInfo& rhs) + : stream_type(rhs.stream_type), + current_downscale_level(rhs.current_downscale_level), + expected_bitrate_bps(rhs.expected_bitrate_bps) { + if (rhs.userId != OPTIONAL_NULLPTR) { + const int len = std::strlen(rhs.userId); + char* buf = new char[len + 1]; + std::memcpy(buf, rhs.userId, len); + buf[len] = '\0'; + userId = buf; + } + } + PeerDownlinkInfo& operator=(const PeerDownlinkInfo& rhs) { if (this == &rhs) return *this; - uid = OPTIONAL_NULLPTR; + userId = 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; + if (rhs.userId != OPTIONAL_NULLPTR) { + const int len = std::strlen(rhs.userId); + char* buf = new char[len + 1]; + std::memcpy(buf, rhs.userId, len); + buf[len] = '\0'; + userId = buf; } return *this; } - ~PeerDownlinkInfo() { - if (uid) { delete [] uid; } - } + ~PeerDownlinkInfo() { delete[] userId; } }; /** @@ -5366,9 +5808,7 @@ struct DownlinkNetworkInfo { return *this; } - ~DownlinkNetworkInfo() { - if (peer_downlink_info) delete [] peer_downlink_info; - } + ~DownlinkNetworkInfo() { delete[] peer_downlink_info; } }; /** @@ -5428,10 +5868,13 @@ struct EncryptionConfig { * In this case, ensure that this parameter is not 0. */ uint8_t encryptionKdfSalt[32]; + + bool datastreamEncryptionEnabled; EncryptionConfig() : encryptionMode(AES_128_GCM2), - encryptionKey(NULL) + encryptionKey(OPTIONAL_NULLPTR), + datastreamEncryptionEnabled(false) { memset(encryptionKdfSalt, 0, sizeof(encryptionKdfSalt)); } @@ -5471,13 +5914,21 @@ enum ENCRYPTION_ERROR_TYPE { */ ENCRYPTION_ERROR_INTERNAL_FAILURE = 0, /** - * 1: Decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. + * 1: MediaStream decryption errors. Ensure that the receiver and the sender use the same encryption mode and key. */ ENCRYPTION_ERROR_DECRYPTION_FAILURE = 1, /** - * 2: Encryption errors. + * 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 @@ -5502,15 +5953,6 @@ enum PERMISSION_TYPE { 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. */ @@ -5528,8 +5970,8 @@ enum STREAM_SUBSCRIBE_STATE { * - 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. + * - Calls `muteRemoteAudioStream(true)`, `muteAllRemoteAudioStreams(true)` to stop receiving the remote audio streams. + * - Calls `muteRemoteVideoStream(true)`, `muteAllRemoteVideoStreams(true)` to stop receiving the remote video streams. */ SUB_STATE_NO_SUBSCRIBED = 1, /** @@ -5598,8 +6040,8 @@ struct UserInfo { * The user account. The maximum data length is `MAX_USER_ACCOUNT_LENGTH_TYPE`. */ char userAccount[MAX_USER_ACCOUNT_LENGTH]; - UserInfo() - : uid(0) { + + UserInfo() : uid(0) { userAccount[0] = '\0'; } }; @@ -5620,7 +6062,12 @@ enum EAR_MONITORING_FILTER_TYPE { /** * 4: Enable noise suppression to the in-ear monitor. */ - EAR_MONITORING_FILTER_NOISE_SUPPRESSION = (1<<2) + EAR_MONITORING_FILTER_NOISE_SUPPRESSION = (1<<2), + /** + * 32768: Enable audio filters by reuse post-processing filter to the in-ear monitor. + * This bit is intended to be used in exclusive mode, which means, if this bit is set, all other bits will be disregarded. + */ + EAR_MONITORING_FILTER_REUSE_POST_PROCESSING_FILTER = (1<<15), }; /** @@ -5839,21 +6286,91 @@ enum CONFIG_FETCH_TYPE { CONFIG_FETCH_TYPE_JOIN_CHANNEL = 2, }; + +/** 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, +}; + +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; + /** + * Whether to disable vos-aut: + - true: (Default)disable vos-aut. + - false: not disable vos-aut + */ + bool disableAut; + LocalAccessPointConfiguration() : ipList(NULL), ipListSize(0), domainList(NULL), domainListSize(0), verifyDomainName(NULL), mode(ConnectivityFirst), disableAut(true) {} +}; + /** - * media recorder source stream information + * The information about recorded media streams. */ struct RecorderStreamInfo { - /** - * The channel ID of the video track. - */ const char* channelId; /** * The user ID. */ uid_t uid; + /** + * The channel ID of the audio/video stream needs to be recorded. + */ RecorderStreamInfo() : channelId(NULL), uid(0) {} + RecorderStreamInfo(const char* channelId, uid_t uid) : channelId(channelId), uid(uid) {} }; - } // namespace rtc namespace base { @@ -5872,9 +6389,9 @@ class AParameter : public agora::util::AutoPtr { private: bool initialize(IEngineBase* engine) { - IAgoraParameter* p = NULL; + IAgoraParameter* p = OPTIONAL_NULLPTR; if (engine && !engine->queryInterface(rtc::AGORA_IID_PARAMETER_ENGINE, (void**)&p)) reset(p); - return p != NULL; + return p != OPTIONAL_NULLPTR; } }; @@ -5926,7 +6443,47 @@ struct SpatialAudioParams { */ Optional enable_doppler; }; +/** + * Layout info of video stream which compose a transcoder video stream. +*/ +struct VideoLayout +{ + /** + * Channel Id from which this video stream come from. + */ + const char* channelId; + /** + * User id of video stream. + */ + rtc::uid_t uid; + /** + * User account of video stream. + */ + user_id_t strUid; + /** + * x coordinate of video stream on a transcoded video stream canvas. + */ + uint32_t x; + /** + * y coordinate of video stream on a transcoded video stream canvas. + */ + uint32_t y; + /** + * width of video stream on a transcoded video stream canvas. + */ + uint32_t width; + /** + * height of video stream on a transcoded video stream canvas. + */ + uint32_t height; + /** + * video state of video stream on a transcoded video stream canvas. + * 0 for normal video , 1 for placeholder image showed , 2 for black image. + */ + uint32_t videoState; + VideoLayout() : channelId(OPTIONAL_NULLPTR), uid(0), strUid(OPTIONAL_NULLPTR), x(0), y(0), width(0), height(0), videoState(0) {} +}; } // namespace agora /** diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraMediaBase.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraMediaBase.h similarity index 75% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraMediaBase.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraMediaBase.h index e44d418b..26b2eb2e 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraMediaBase.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraMediaBase.h @@ -1,4 +1,3 @@ -// // Agora Engine SDK // // Created by Sting Feng in 2017-11. @@ -35,8 +34,32 @@ 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; +/** +* The definition of extension context types. +**/ +struct ExtensionContext { + /** + * Whether the uid is valid. + * - true: The uid is valid. + * - false: The uid is invalid. + */ + bool isValid; + /** + * The ID of the user. + * A uid of 0 indicates the local user, and a uid greater than 0 represents a remote user. + */ + uid_t uid; + /** + * The provider name of the current extension. + */ + const char *providerName; + /** + * The extension name of the current extension. + */ + const char *extensionName; + ExtensionContext():isValid(false), uid(0), providerName(NULL), extensionName(NULL) {} +}; /** @@ -91,6 +114,9 @@ enum VIDEO_SOURCE_TYPE { /** Video for fourth screen sharing. */ VIDEO_SOURCE_SCREEN_FOURTH = 14, + /** Video for voice drive. + */ + VIDEO_SOURCE_SPEECH_DRIVEN = 15, VIDEO_SOURCE_UNKNOWN = 100 }; @@ -105,45 +131,49 @@ enum AudioRoute */ ROUTE_DEFAULT = -1, /** - * The headset. + * The Headset. */ ROUTE_HEADSET = 0, /** - * The earpiece. + * The Earpiece. */ ROUTE_EARPIECE = 1, /** - * The headset with no microphone. + * The Headset with no microphone. */ ROUTE_HEADSETNOMIC = 2, /** - * The speakerphone. + * The Speakerphone. */ ROUTE_SPEAKERPHONE = 3, /** - * The loudspeaker. + * The Loudspeaker. */ ROUTE_LOUDSPEAKER = 4, /** - * The Bluetooth headset. + * The Bluetooth Device via HFP. */ - ROUTE_HEADSETBLUETOOTH = 5, + ROUTE_BLUETOOTH_DEVICE_HFP = 5, /** - * The USB + * The USB. */ ROUTE_USB = 6, /** - * The HDMI + * The HDMI. */ ROUTE_HDMI = 7, /** - * The DISPLAYPORT + * The DisplayPort. */ ROUTE_DISPLAYPORT = 8, /** - * The AIRPLAY + * The AirPlay. */ ROUTE_AIRPLAY = 9, + /** + * The Bluetooth Device via A2DP. + */ + ROUTE_BLUETOOTH_DEVICE_A2DP = 10, }; /** @@ -241,6 +271,10 @@ enum MEDIA_SOURCE_TYPE { * 12: Video for transcoded. */ TRANSCODED_VIDEO_SOURCE = 12, + /** + * 13: Video for voice drive. + */ + SPEECH_DRIVEN_VIDEO_SOURCE = 13, /** * 100: Internal Usage only. */ @@ -261,13 +295,18 @@ enum CONTENT_INSPECT_TYPE { */ CONTENT_INSPECT_INVALID = 0, /** + * @deprecated * Content inspect type moderation */ -CONTENT_INSPECT_MODERATION = 1, +CONTENT_INSPECT_MODERATION __deprecated = 1, /** * Content inspect type supervise */ -CONTENT_INSPECT_SUPERVISION = 2 +CONTENT_INSPECT_SUPERVISION = 2, +/** + * Content inspect type image moderation + */ +CONTENT_INSPECT_IMAGE_MODERATION = 3 }; struct ContentInspectModule { @@ -288,7 +327,10 @@ struct ContentInspectModule { */ struct ContentInspectConfig { const char* extraInfo; - + /** + * The specific server configuration for image moderation. Please contact technical support. + */ + const char* serverConfig; /**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. */ @@ -299,11 +341,12 @@ struct ContentInspectConfig { ContentInspectConfig& operator=(const ContentInspectConfig& rth) { extraInfo = rth.extraInfo; + serverConfig = rth.serverConfig; moduleCount = rth.moduleCount; memcpy(&modules, &rth.modules, MAX_CONTENT_INSPECT_MODULE_COUNT * sizeof(ContentInspectModule)); return *this; } - ContentInspectConfig() :extraInfo(NULL), moduleCount(0){} + ContentInspectConfig() :extraInfo(NULL), serverConfig(NULL), moduleCount(0){} }; namespace base { @@ -385,24 +428,31 @@ struct AudioPcmFrame { rtc::BYTES_PER_SAMPLE bytes_per_sample; /** The audio frame data. */ int16_t data_[kMaxDataSizeSamples]; + + /** + * @technical preview + * data_[kMaxDataSizeSamples] is real stereo data + */ + bool is_stereo_; AudioPcmFrame& operator=(const AudioPcmFrame& src) { - if(this == &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_; + capture_timestamp = src.capture_timestamp; + samples_per_channel_ = src.samples_per_channel_; + sample_rate_hz_ = src.sample_rate_hz_; + bytes_per_sample = src.bytes_per_sample; + num_channels_ = src.num_channels_; + is_stereo_ = src.is_stereo_; size_t length = src.samples_per_channel_ * src.num_channels_; if (length > kMaxDataSizeSamples) { length = kMaxDataSizeSamples; } - memcpy(this->data_, src.data_, length * sizeof(int16_t)); + memcpy(data_, src.data_, length * sizeof(int16_t)); return *this; } @@ -412,7 +462,8 @@ struct AudioPcmFrame { samples_per_channel_(0), sample_rate_hz_(0), num_channels_(0), - bytes_per_sample(rtc::TWO_BYTES_PER_SAMPLE) { + bytes_per_sample(rtc::TWO_BYTES_PER_SAMPLE), + is_stereo_(false) { memset(data_, 0, sizeof(data_)); } @@ -421,7 +472,8 @@ struct AudioPcmFrame { 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) { + bytes_per_sample(src.bytes_per_sample), + is_stereo_(src.is_stereo_) { size_t length = src.samples_per_channel_ * src.num_channels_; if (length > kMaxDataSizeSamples) { length = kMaxDataSizeSamples; @@ -492,10 +544,23 @@ enum VIDEO_PIXEL_FORMAT { 14: pixel format for iOS CVPixelBuffer BGRA */ VIDEO_CVPIXEL_BGRA = 14, + /** + 15: pixel format for iOS CVPixelBuffer P010(10bit NV12) + */ + VIDEO_CVPIXEL_P010 = 15, /** * 16: I422. */ VIDEO_PIXEL_I422 = 16, + /** + * 17: ID3D11Texture2D, only support DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_TYPELESS, DXGI_FORMAT_NV12 texture format + */ + VIDEO_TEXTURE_ID3D11TEXTURE2D = 17, + /** + * 18: I010. 10bit I420 data. + * @technical preview + */ + VIDEO_PIXEL_I010 = 18, }; /** @@ -538,6 +603,204 @@ enum CAMERA_VIDEO_SOURCE_TYPE { VIDEO_SOURCE_UNSPECIFIED = 2, }; +/** + * The IVideoFrameMetaInfo class. + * This interface provides access to metadata information. + */ +class IVideoFrameMetaInfo { + public: + enum META_INFO_KEY { + KEY_FACE_CAPTURE = 0, + }; + virtual ~IVideoFrameMetaInfo() {}; + virtual const char* getMetaInfoStr(META_INFO_KEY key) const = 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) {} + + bool validate() const { + return primaries != PRIMARYID_UNSPECIFIED || transfer != TRANSFERID_UNSPECIFIED || + matrix != MATRIXID_UNSPECIFIED || + range != RANGEID_INVALID; + } +}; + +/** + * The definition of the Hdr10MetadataInfo struct. + */ +struct Hdr10MetadataInfo { + /** + * The x coordinates of the red value in the CIE1931 color space. The values need to normalized to 50,000. + */ + uint16_t redPrimaryX; + /** + * The y coordinates of the red value in the CIE1931 color space. The values need to normalized to 50,000. + */ + uint16_t redPrimaryY; + /** + * The x coordinates of the green value in the CIE1931 color space. The values need to normalized to 50,000. + */ + uint16_t greenPrimaryX; + /** + * The y coordinates of the green value in the CIE1931 color space. The values need to normalized to 50,000. + */ + uint16_t greenPrimaryY; + /** + * The x coordinates of the blue value in the CIE1931 color space. The values need to normalized to 50,000. + */ + uint16_t bluePrimaryX; + /** + * The y coordinates of the blue value in the CIE1931 color space. The values need to normalized to 50,000. + */ + uint16_t bluePrimaryY; + /** + * The x coordinates of the white point in the CIE1931 color space.The values need to normalized to 50,000. + */ + uint16_t whitePointX; + /** + * The y coordinates of the white point in the CIE1931 color space.The values need to normalized to 50,000. + */ + uint16_t whitePointY; + /** + * The maximum number of nits of the display used to master the content. The values need to normalized to 10,000. + */ + unsigned int maxMasteringLuminance; + /** + * The minimum number of nits of the display used to master the content. The values need to normalized to 10,000. + */ + unsigned int minMasteringLuminance; + /** + * The maximum content light level (MaxCLL). This is the nit value corresponding to the brightest pixel used anywhere in the content. + */ + uint16_t maxContentLightLevel; + /** + * The maximum frame average light level (MaxFALL). This is the nit value corresponding to the average luminance of the frame which has the brightest average luminance anywhere in the content. + */ + uint16_t maxFrameAverageLightLevel; + + Hdr10MetadataInfo() + : redPrimaryX(0), + redPrimaryY(0), + greenPrimaryX(0), + greenPrimaryY(0), + bluePrimaryX(0), + bluePrimaryY(0), + whitePointX(0), + whitePointY(0), + maxMasteringLuminance(0), + minMasteringLuminance(0), + maxContentLightLevel(0), + maxFrameAverageLightLevel(0){} + + bool validate() const { + return maxContentLightLevel >= 0 && maxContentLightLevel <= 20000 && + maxFrameAverageLightLevel >= 0 && + maxFrameAverageLightLevel <= 20000; + } +}; + +/** + * The relative position between alphabuffer and the frame. + */ +enum ALPHA_STITCH_MODE { + /** + * 0: Normal frame without alphabuffer stitched + */ + NO_ALPHA_STITCH = 0, + /** + * 1: Alphabuffer is above the frame + */ + ALPHA_STITCH_UP = 1, + /** + * 2: Alphabuffer is below the frame + */ + ALPHA_STITCH_BELOW = 2, + /** + * 3: Alphabuffer is on the left of frame + */ + ALPHA_STITCH_LEFT = 3, + /** + * 4: Alphabuffer is on the right of frame + */ + ALPHA_STITCH_RIGHT = 4, +}; + + /** * The definition of the ExternalVideoFrame struct. */ @@ -557,9 +820,14 @@ struct ExternalVideoFrame { eglContext(NULL), eglType(EGL_CONTEXT10), textureId(0), - metadata_buffer(NULL), - metadata_size(0), - alphaBuffer(NULL){} + fenceObject(0), + metadataBuffer(NULL), + metadataSize(0), + alphaBuffer(NULL), + fillAlphaBuffer(false), + alphaStitchMode(NO_ALPHA_STITCH), + d3d11Texture2d(NULL), + textureSliceIndex(0){} /** * The EGL context type. @@ -661,6 +929,11 @@ struct ExternalVideoFrame { * [Texture related parameter] Incoming 4 × 4 transformational matrix. The typical value is a unit matrix. */ int textureId; + /** + * [Texture related parameter] The fence object related to the textureId parameter, indicating the synchronization status of the video data in Texture format. + * The default value is 0 + */ + long long fenceObject; /** * [Texture related parameter] Incoming 4 × 4 transformational matrix. The typical value is a unit matrix. */ @@ -669,18 +942,53 @@ struct ExternalVideoFrame { * [Texture related parameter] The MetaData buffer. * The default value is NULL */ - uint8_t* metadata_buffer; + uint8_t* metadataBuffer; /** * [Texture related parameter] The MetaData size. * The default value is 0 */ - int metadata_size; + int metadataSize; /** - * Indicates the output data of the portrait segmentation algorithm, which is consistent with the size of the video frame. - * The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground (portrait). - * The default value is NULL + * 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; + /** + * [For bgra or rgba only] 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 relative position between alphabuffer and the frame. + * 0: Normal frame; + * 1: Alphabuffer is above the frame; + * 2: Alphabuffer is below the frame; + * 3: Alphabuffer is on the left of frame; + * 4: Alphabuffer is on the right of frame; + * The default value is 0. + */ + ALPHA_STITCH_MODE alphaStitchMode; + + /** + * [For Windows only] The pointer of ID3D11Texture2D used by the video frame. + */ + void *d3d11Texture2d; + + /** + * [For Windows only] The index of ID3D11Texture2D array used by the video frame. + */ + int textureSliceIndex; + + /** + * metadata info used for hdr video data + */ + Hdr10MetadataInfo hdr10MetadataInfo; + + /** + * The ColorSpace of the video frame. + */ + ColorSpace colorSpace; }; /** @@ -704,8 +1012,11 @@ struct VideoFrame { metadata_size(0), sharedContext(0), textureId(0), + d3d11Texture2d(NULL), alphaBuffer(NULL), - pixelBuffer(NULL){ + alphaStitchMode(NO_ALPHA_STITCH), + pixelBuffer(NULL), + metaInfo(NULL){ memset(matrix, 0, sizeof(matrix)); } /** @@ -777,20 +1088,48 @@ struct VideoFrame { * [Texture related parameter], Texture ID used by the video frame. */ int textureId; + /** + * [Texture related parameter] The pointer of ID3D11Texture2D used by the video frame,for Windows only. + */ + void* d3d11Texture2d; /** * [Texture related parameter], Incoming 4 × 4 transformational matrix. */ float matrix[16]; /** - * Indicates the output data of the portrait segmentation algorithm, which is consistent with the size of the video frame. - * The value range of each pixel is [0,255], where 0 represents the background; 255 represents the foreground (portrait). - * The default value is NULL + * 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 relative position between alphabuffer and the frame. + * 0: Normal frame; + * 1: Alphabuffer is above the frame; + * 2: Alphabuffer is below the frame; + * 3: Alphabuffer is on the left of frame; + * 4: Alphabuffer is on the right of frame; + * The default value is 0. + */ + ALPHA_STITCH_MODE alphaStitchMode; /** *The type of CVPixelBufferRef, for iOS and macOS only. */ void* pixelBuffer; + /** + * The pointer to IVideoFrameMetaInfo, which is the interface to get metainfo contents from VideoFrame. + */ + IVideoFrameMetaInfo* metaInfo; + + /** + * metadata info used for hdr video data + */ + Hdr10MetadataInfo hdr10MetadataInfo; + + /** + * The ColorSpace of the video frame + */ + ColorSpace colorSpace; }; /** @@ -835,6 +1174,7 @@ enum VIDEO_MODULE_POSITION { POSITION_POST_CAPTURER = 1 << 0, POSITION_PRE_RENDERER = 1 << 1, POSITION_PRE_ENCODER = 1 << 2, + POSITION_POST_CAPTURER_ORIGIN = 1 << 3, }; } // namespace base @@ -894,14 +1234,14 @@ class IAudioFrameObserverBase { */ int channels; /** - *The number of samples per channel in the audio frame. + * The sample rate */ 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. + * Buffer data size: buffer = samplesPerChannel × channels × bytesPerSample. */ void* buffer; /** @@ -914,8 +1254,27 @@ class IAudioFrameObserverBase { int64_t renderTimeMs; /** * A reserved parameter. + * + * You can use this presentationMs parameter to indicate the presenation milisecond timestamp, + * this will then filled into audio4 extension part, the remote side could use this pts in av + * sync process with video frame. */ int avsync_type; + /** + * The pts timestamp of this audio frame. + * + * This timestamp is used to indicate the origin pts time of the frame, and sync with video frame by + * the pts time stamp + */ + int64_t presentationMs; + /** + * The number of the audio track. + */ + int audioTrackNumber; + /** + * RTP timestamp of the first sample in the audio frame + */ + uint32_t rtpTimestamp; AudioFrame() : type(FRAME_TYPE_PCM16), samplesPerChannel(0), @@ -924,7 +1283,10 @@ class IAudioFrameObserverBase { samplesPerSec(0), buffer(NULL), renderTimeMs(0), - avsync_type(0) {} + avsync_type(0), + presentationMs(0), + audioTrackNumber(0), + rtpTimestamp(0) {} }; enum AUDIO_FRAME_POSITION { @@ -1141,9 +1503,9 @@ struct UserAudioSpectrumInfo { */ 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; } + UserAudioSpectrumInfo() : uid(0) {} + + UserAudioSpectrumInfo(agora::rtc::uid_t uid, const float* data, int length) : uid(uid), spectrumData(data, length) {} }; /** @@ -1166,7 +1528,6 @@ class IAudioSpectrumObserver { * - false: Not processed. */ virtual bool onLocalAudioSpectrum(const AudioSpectrumData& data) = 0; - /** * Reports the audio spectrum of remote user. * @@ -1184,7 +1545,7 @@ class IAudioSpectrumObserver { * - true: Processed. * - false: Not processed. */ - virtual bool onRemoteAudioSpectrum(const UserAudioSpectrumInfo * spectrums, unsigned int spectrumNumber) = 0; + virtual bool onRemoteAudioSpectrum(const UserAudioSpectrumInfo* spectrums, unsigned int spectrumNumber) = 0; }; /** @@ -1466,7 +1827,7 @@ enum MediaRecorderStreamType { */ enum RecorderState { /** - * -1: An error occurs during the recording. See RecorderErrorCode for the reason. + * -1: An error occurs during the recording. See RecorderReasonCode for the reason. */ RECORDER_STATE_ERROR = -1, /** @@ -1483,27 +1844,27 @@ enum RecorderState { * * @since v3.5.2 */ -enum RecorderErrorCode { +enum RecorderReasonCode { /** * 0: No error occurs. */ - RECORDER_ERROR_NONE = 0, + RECORDER_REASON_NONE = 0, /** * 1: The SDK fails to write the recorded data to a file. */ - RECORDER_ERROR_WRITE_FAILED = 1, + RECORDER_REASON_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, + RECORDER_REASON_NO_STREAM = 2, /** * 3: The recording duration exceeds the upper limit. */ - RECORDER_ERROR_OVER_MAX_DURATION = 3, + RECORDER_REASON_OVER_MAX_DURATION = 3, /** * 4: The recording configuration changes. */ - RECORDER_ERROR_CONFIG_CHANGED = 4, + RECORDER_REASON_CONFIG_CHANGED = 4, }; /** * Configurations for the local audio and video recording. @@ -1543,6 +1904,21 @@ struct MediaRecorderConfiguration { 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) {} }; + +class IFaceInfoObserver { +public: + /** + * Occurs when the face info is received. + * @param outFaceInfo The output face info. + * @return + * - true: The face info is valid. + * - false: The face info is invalid. + */ + virtual bool onFaceInfo(const char* outFaceInfo) = 0; + + virtual ~IFaceInfoObserver() {} +}; + /** * Information for the recording file. * @@ -1566,7 +1942,6 @@ struct RecorderInfo { RecorderInfo(const char* name, unsigned int dur, unsigned int size) : fileName(name), durationMs(dur), fileSize(size) {} }; - class IMediaRecorderObserver { public: /** @@ -1580,9 +1955,9 @@ class IMediaRecorderObserver { * @param channelId The channel name. * @param uid ID of the user. * @param state The current recording state. See \ref agora::media::RecorderState "RecorderState". - * @param error The reason for the state change. See \ref agora::media::RecorderErrorCode "RecorderErrorCode". + * @param reason The reason for the state change. See \ref agora::media::RecorderReasonCode "RecorderReasonCode". */ - virtual void onRecorderStateChanged(const char* channelId, rtc::uid_t uid, RecorderState state, RecorderErrorCode error) = 0; + virtual void onRecorderStateChanged(const char* channelId, rtc::uid_t uid, RecorderState state, RecorderReasonCode reason) = 0; /** * Occurs when the recording information is updated. * @@ -1598,7 +1973,9 @@ class IMediaRecorderObserver { * */ virtual void onRecorderInfoUpdated(const char* channelId, rtc::uid_t uid, const RecorderInfo& info) = 0; + virtual ~IMediaRecorderObserver() {} }; + } // namespace media } // namespace agora diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraMediaPlayerTypes.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraMediaPlayerTypes.h similarity index 81% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraMediaPlayerTypes.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraMediaPlayerTypes.h index d9bd1a85..2df2a430 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraMediaPlayerTypes.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraMediaPlayerTypes.h @@ -105,61 +105,61 @@ enum MEDIA_PLAYER_STATE { * @brief Player error code * */ -enum MEDIA_PLAYER_ERROR { +enum MEDIA_PLAYER_REASON { /** No error. */ - PLAYER_ERROR_NONE = 0, + PLAYER_REASON_NONE = 0, /** The parameter is invalid. */ - PLAYER_ERROR_INVALID_ARGUMENTS = -1, + PLAYER_REASON_INVALID_ARGUMENTS = -1, /** Internel error. */ - PLAYER_ERROR_INTERNAL = -2, + PLAYER_REASON_INTERNAL = -2, /** No resource. */ - PLAYER_ERROR_NO_RESOURCE = -3, + PLAYER_REASON_NO_RESOURCE = -3, /** Invalid media source. */ - PLAYER_ERROR_INVALID_MEDIA_SOURCE = -4, + PLAYER_REASON_INVALID_MEDIA_SOURCE = -4, /** The type of the media stream is unknown. */ - PLAYER_ERROR_UNKNOWN_STREAM_TYPE = -5, + PLAYER_REASON_UNKNOWN_STREAM_TYPE = -5, /** The object is not initialized. */ - PLAYER_ERROR_OBJ_NOT_INITIALIZED = -6, + PLAYER_REASON_OBJ_NOT_INITIALIZED = -6, /** The codec is not supported. */ - PLAYER_ERROR_CODEC_NOT_SUPPORTED = -7, + PLAYER_REASON_CODEC_NOT_SUPPORTED = -7, /** Invalid renderer. */ - PLAYER_ERROR_VIDEO_RENDER_FAILED = -8, + PLAYER_REASON_VIDEO_RENDER_FAILED = -8, /** An error occurs in the internal state of the player. */ - PLAYER_ERROR_INVALID_STATE = -9, + PLAYER_REASON_INVALID_STATE = -9, /** The URL of the media file cannot be found. */ - PLAYER_ERROR_URL_NOT_FOUND = -10, + PLAYER_REASON_URL_NOT_FOUND = -10, /** Invalid connection between the player and the Agora server. */ - PLAYER_ERROR_INVALID_CONNECTION_STATE = -11, + PLAYER_REASON_INVALID_CONNECTION_STATE = -11, /** The playback buffer is insufficient. */ - PLAYER_ERROR_SRC_BUFFER_UNDERFLOW = -12, + PLAYER_REASON_SRC_BUFFER_UNDERFLOW = -12, /** The audio mixing file playback is interrupted. */ - PLAYER_ERROR_INTERRUPTED = -13, + PLAYER_REASON_INTERRUPTED = -13, /** The SDK does not support this function. */ - PLAYER_ERROR_NOT_SUPPORTED = -14, + PLAYER_REASON_NOT_SUPPORTED = -14, /** The token has expired. */ - PLAYER_ERROR_TOKEN_EXPIRED = -15, + PLAYER_REASON_TOKEN_EXPIRED = -15, /** The ip has expired. */ - PLAYER_ERROR_IP_EXPIRED = -16, + PLAYER_REASON_IP_EXPIRED = -16, /** An unknown error occurs. */ - PLAYER_ERROR_UNKNOWN = -17, + PLAYER_REASON_UNKNOWN = -17, }; /** @@ -357,18 +357,60 @@ struct CacheStatistics { int64_t downloadSize; }; -struct PlayerUpdatedInfo { - /** playerId has value when user trigger interface of opening +/** + * @brief The real time statistics of the media stream being played. + * + */ +struct PlayerPlaybackStats { + /** Video fps. */ - Optional playerId; - - /** deviceId has value when user trigger interface of opening + int videoFps; + /** Video bitrate (Kbps). + */ + int videoBitrateInKbps; + /** Audio bitrate (Kbps). */ - Optional deviceId; + int audioBitrateInKbps; + /** Total bitrate (Kbps). + */ + int totalBitrateInKbps; +}; - /** cacheStatistics exist if you enable cache, triggered 1s at a time after openning url +/** + * @brief The updated information of media player. + * + */ +struct PlayerUpdatedInfo { + /** @technical preview */ - Optional cacheStatistics; + const char* internalPlayerUuid; + /** The device ID of the playback device. + */ + const char* deviceId; + /** Video height. + */ + int videoHeight; + /** Video width. + */ + int videoWidth; + /** Audio sample rate. + */ + int audioSampleRate; + /** The audio channel number. + */ + int audioChannels; + /** The bit number of each audio sample. + */ + int audioBitsPerSample; + + PlayerUpdatedInfo() + : internalPlayerUuid(NULL), + deviceId(NULL), + videoHeight(0), + videoWidth(0), + audioSampleRate(0), + audioChannels(0), + audioBitsPerSample(0) {} }; /** @@ -436,6 +478,17 @@ struct MediaSource { * - 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. @@ -454,7 +507,7 @@ struct MediaSource { IMediaPlayerCustomDataProvider* provider; MediaSource() : url(NULL), uri(NULL), startPos(0), autoPlay(true), enableCache(false), - provider(NULL){ + enableMultiAudioTrack(false), provider(NULL){ } }; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraOptional.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraOptional.h similarity index 100% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraOptional.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraOptional.h diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraRefPtr.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraRefPtr.h similarity index 100% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/AgoraRefPtr.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/AgoraRefPtr.h diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraH265Transcoder.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraH265Transcoder.h similarity index 95% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraH265Transcoder.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraH265Transcoder.h index 721d7058..3dd465b3 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraH265Transcoder.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraH265Transcoder.h @@ -71,10 +71,8 @@ enum H265_TRANSCODE_RESULT { */ class IH265TranscoderObserver { public: - virtual ~IH265TranscoderObserver() {}; - /** * Use to notify the result of invoking enableTranscode interface. * @param result Result of invoking enableTranscode interface. There are some processing advice below of result. @@ -119,9 +117,8 @@ class IH265TranscoderObserver { /** * The IH265Transcoder class */ -class IH265Transcoder: public RefCountInterface { +class IH265Transcoder : public RefCountInterface { public: - /** * Enable transcoding for a channel. * @param token The token for authentication. @@ -154,19 +151,17 @@ class IH265Transcoder: public RefCountInterface { * - <0: Failure. */ virtual int triggerTranscode(const char* token, const char* channel, uid_t uid) = 0; - /** * Register a IH265TranscoderObserver object. - * @param observer + * @param observer IH265TranscoderObserver. * @return * - 0: Success. * - <0: Failure. */ virtual int registerTranscoderObserver(IH265TranscoderObserver *observer) = 0; - /** * Unregister a IH265TranscoderObserver object. - * @param observer + * @param observer IH265TranscoderObserver. * @return * - 0: Success. * - <0: Failure. @@ -178,5 +173,6 @@ class IH265Transcoder: public RefCountInterface { virtual ~IH265Transcoder() {}; }; + } // namespace rtc } // namespace agora \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraLog.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraLog.h similarity index 90% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraLog.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraLog.h index 51d7a367..876a75c1 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraLog.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraLog.h @@ -37,6 +37,7 @@ OPTIONAL_ENUM_CLASS LOG_LEVEL { LOG_LEVEL_ERROR = 0x0004, LOG_LEVEL_FATAL = 0x0008, LOG_LEVEL_API_CALL = 0x0010, + LOG_LEVEL_DEBUG = 0x0020, }; /* @@ -75,7 +76,7 @@ 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; +const uint32_t DEFAULT_LOG_SIZE_IN_KB = 2048; /** Definition of LogConfiguration */ @@ -83,7 +84,7 @@ 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 + /** The log file size, KB , set 2048KB to use default log size */ uint32_t fileSizeInKB; /** The log level, set LOG_LEVEL_INFO to use default log level diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaComponentFactory.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaComponentFactory.h similarity index 100% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaComponentFactory.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaComponentFactory.h diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaEngine.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaEngine.h similarity index 90% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaEngine.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaEngine.h index 1f9eab86..2ad93eef 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaEngine.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaEngine.h @@ -58,7 +58,6 @@ class IMediaEngine { * - < 0: Failure. */ virtual int registerVideoFrameObserver(IVideoFrameObserver* observer) = 0; - /** * Registers a receiver object for the encoded video image. * @@ -73,7 +72,21 @@ class IMediaEngine { * - < 0: Failure. */ virtual int registerVideoEncodedFrameObserver(IVideoEncodedFrameObserver* observer) = 0; - + + /** + * Registers a face info observer object. + * + * @note + * Ensure that you call this method before \ref IRtcEngine::joinChannel "joinChannel". + * + * @param observer A pointer to the face info observer object: IFaceInfoObserver. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int registerFaceInfoObserver(IFaceInfoObserver* observer) = 0; + /** * Pushes the external audio data to the app. * @@ -83,7 +96,8 @@ class IMediaEngine { * - 0: Success. * - < 0: Failure. */ - virtual int pushAudioFrame(IAudioFrameObserver::AudioFrame* frame, rtc::track_id_t trackId = 0) = 0; + + virtual int pushAudioFrame(IAudioFrameObserverBase::AudioFrame* frame, rtc::track_id_t trackId = 0) = 0; /** * Pulls the remote audio data. @@ -101,7 +115,7 @@ class IMediaEngine { * - 0: Success. * - < 0: Failure. */ - virtual int pullAudioFrame(IAudioFrameObserver::AudioFrame* frame) = 0; + virtual int pullAudioFrame(IAudioFrameObserverBase::AudioFrame* frame) = 0; /** * Sets the external video source. @@ -237,7 +251,6 @@ class IMediaEngine { * - < 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. @@ -248,10 +261,9 @@ class IMediaEngine { * - 0: Success. * - < 0: Failure. */ - virtual int pushEncodedVideoImage(const uint8_t* imageBuffer, size_t length, + virtual int pushEncodedVideoImage(const unsigned char* imageBuffer, size_t length, const agora::rtc::EncodedVideoFrameInfo& videoEncodedFrameInfo, unsigned int videoTrackId = 0) = 0; - /** * @hide For internal usage only */ diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaPlayer.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaPlayer.h similarity index 89% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaPlayer.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaPlayer.h index 60a9d7f7..eab4d3f1 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaPlayer.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaPlayer.h @@ -49,17 +49,6 @@ class IMediaPlayer : public RefCountInterface { */ 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) __deprecated = 0; - /** * @brief Open a media file with a media file source. * @param source Media file source that you want to play, see `MediaSource` @@ -158,13 +147,30 @@ class IMediaPlayer : public RefCountInterface { /** * Slect playback audio track of the media file - * @param speed the index of the audio track in meia 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_REASON MEDIA_PLAYER_REASON}. + * - -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 @@ -217,7 +223,7 @@ class IMediaPlayer : public RefCountInterface { * @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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ virtual int mute(bool muted) = 0; @@ -225,7 +231,7 @@ class IMediaPlayer : public RefCountInterface { * @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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ virtual int getMute(bool& muted) = 0; @@ -237,7 +243,7 @@ class IMediaPlayer : public RefCountInterface { * 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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ virtual int adjustPlayoutVolume(int volume) = 0; @@ -245,21 +251,21 @@ class IMediaPlayer : public RefCountInterface { * @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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ 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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ 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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ virtual int getPublishSignalVolume(int& volume) = 0; @@ -267,7 +273,7 @@ class IMediaPlayer : public RefCountInterface { * @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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ virtual int setView(media::base::view_t view) = 0; @@ -275,7 +281,7 @@ class IMediaPlayer : public RefCountInterface { * @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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ virtual int setRenderMode(media::base::RENDER_MODE_TYPE renderMode) = 0; @@ -337,7 +343,7 @@ class IMediaPlayer : public RefCountInterface { * @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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ virtual int registerVideoFrameObserver(media::base::IVideoFrameObserver* observer) = 0; @@ -345,7 +351,7 @@ class IMediaPlayer : public RefCountInterface { * @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 + * @return int < 0 on behalf of an error, the value corresponds to one of MEDIA_PLAYER_REASON */ virtual int unregisterVideoFrameObserver(agora::media::base::IVideoFrameObserver* observer) = 0; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaPlayerSource.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaPlayerSource.h similarity index 77% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaPlayerSource.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaPlayerSource.h index 50a71557..964eefd6 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaPlayerSource.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaPlayerSource.h @@ -42,17 +42,6 @@ class IMediaPlayerSource : public RefCountInterface { * - < 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) __deprecated = 0; /** * Opens a media file with a media file source. @@ -118,7 +107,7 @@ class IMediaPlayerSource : public RefCountInterface { * @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}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int getPlayPosition(int64_t& pos) = 0; @@ -127,7 +116,7 @@ class IMediaPlayerSource : public RefCountInterface { * @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}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int getStreamCount(int64_t& count) = 0; @@ -137,7 +126,7 @@ class IMediaPlayerSource : public RefCountInterface { * @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}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* info) = 0; @@ -149,7 +138,7 @@ class IMediaPlayerSource : public RefCountInterface { * - -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}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int setLoopCount(int64_t loopCount) = 0; @@ -158,7 +147,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param speed The playback speed ref [50-400]. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int setPlaybackSpeed(int speed) = 0; @@ -167,17 +156,34 @@ class IMediaPlayerSource : public RefCountInterface { * @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}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ 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_REASON MEDIA_PLAYER_REASON}. + * - -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}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int setPlayerOption(const char* key, int64_t value) = 0; @@ -187,7 +193,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param value The value of option parameter. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int setPlayerOption(const char* key, const char* value) = 0; @@ -196,7 +202,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param filename The filename of the screenshot file. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int takeScreenshot(const char* filename) = 0; @@ -205,7 +211,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param index The index of the internal subtitles. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int selectInternalSubtitle(int64_t index) = 0; @@ -214,7 +220,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param url The URL of the subtitle file. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int setExternalSubtitle(const char* url) = 0; @@ -231,7 +237,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param observer The pointer to the IMediaPlayerSourceObserver object. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int registerPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; @@ -240,7 +246,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param observer The pointer to the IMediaPlayerSourceObserver object. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int unregisterPlayerSourceObserver(IMediaPlayerSourceObserver* observer) = 0; @@ -250,7 +256,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param observer The pointer to the {@link media::IAudioPcmFrameSink observer} object. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int registerAudioFrameObserver(media::IAudioPcmFrameSink* observer) = 0; @@ -259,7 +265,7 @@ class IMediaPlayerSource : public RefCountInterface { * @param observer The pointer to the {@link media::IAudioPcmFrameSink observer} object. * @return * - 0: Success. - * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_ERROR MEDIA_PLAYER_ERROR}. + * - < 0: Failure. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual int unregisterAudioFrameObserver(media::IAudioPcmFrameSink* observer) = 0; @@ -380,18 +386,19 @@ class IMediaPlayerSourceObserver { * * 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}. + * @param reason The player's error code. See {@link media::base::MEDIA_PLAYER_REASON MEDIA_PLAYER_REASON}. */ virtual void onPlayerSourceStateChanged(media::base::MEDIA_PLAYER_STATE state, - media::base::MEDIA_PLAYER_ERROR ec) = 0; + media::base::MEDIA_PLAYER_REASON reason) = 0; /** * @brief Reports current playback progress. * * The callback occurs once every one second during the playback and reports the current playback progress. - * @param position Current playback progress (milisecond). + * @param positionMs Current playback progress (milisecond). + * @param timestampMs Current NTP(Network Time Protocol) time (milisecond). */ - virtual void onPositionChanged(int64_t position_ms) = 0; + virtual void onPositionChanged(int64_t positionMs, int64_t timestampMs) = 0; /** * @brief Reports the playback event. @@ -455,6 +462,24 @@ class IMediaPlayerSourceObserver { * @param info Include information of media player. */ virtual void onPlayerInfoUpdated(const media::base::PlayerUpdatedInfo& info) = 0; + + /** + * @brief Triggered every 1 second, reports the statistics of the files being cached. + * + * @param stats Cached file statistics. + */ + virtual void onPlayerCacheStats(const media::base::CacheStatistics& stats) { + (void)stats; + } + + /** + * @brief Triggered every 1 second, reports the statistics of the media stream being played. + * + * @param stats The statistics of the media stream. + */ + virtual void onPlayerPlaybackStats(const media::base::PlayerPlaybackStats& stats) { + (void)stats; + } /** * @brief Triggered every 200 millisecond ,update player current volume range [0,255] diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaRecorder.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaRecorder.h similarity index 93% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaRecorder.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaRecorder.h index de8dd9b4..33f5a30e 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaRecorder.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaRecorder.h @@ -15,6 +15,7 @@ namespace rtc { class IMediaRecorder : public RefCountInterface { protected: virtual ~IMediaRecorder() {} + public: /** * Registers the IMediaRecorderObserver object. @@ -62,8 +63,7 @@ class IMediaRecorder : public RefCountInterface { * - The specified path of the recording file exists and is writable. * - The specified format of the recording file is supported. * - The maximum recording duration is correctly set. - * - During remote recording, ensure the channel ID and user ID After calling \ref - * IRtcEngine::createMediaRecorder did join the channel. + * - During remote recording, ensure the user whose media streams you want record did join the channel. * - `-4(ERR_NOT_SUPPORTED)`: IRtcEngine does not support the request due to one of the following reasons: * - The recording is ongoing. * - The recording stops because an error occurs. diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaStreamingSource.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaStreamingSource.h similarity index 100% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMediaStreamingSource.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMediaStreamingSource.h diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMusicContentCenter.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMusicContentCenter.h similarity index 67% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMusicContentCenter.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMusicContentCenter.h index 75955ba6..76002d69 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraMusicContentCenter.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraMusicContentCenter.h @@ -13,64 +13,90 @@ namespace agora { namespace rtc { +/** + * Modes for playing songs. + */ +typedef enum +{ + /** + * 0: The music player is in the origin mode, which means playing the original song. + */ + kMusicPlayModeOriginal = 0, + + /** + * 1: The music player is in the accompany mode, which means playing the accompaniment only. + */ + kMusicPlayModeAccompany = 1, + + /** + * 2: The music player is in the lead sing mode, which means playing the lead vocals. + */ + kMusicPlayModeLeadSing = 2, + +} MusicPlayMode; + typedef enum { /** * 0: No error occurs and preload succeeds. */ - kPreloadStatusCompleted = 0, + kPreloadStateCompleted = 0, /** * 1: A general error occurs. */ - kPreloadStatusFailed = 1, + kPreloadStateFailed = 1, /** * 2: The media file is preloading. */ - kPreloadStatusPreloading = 2, + kPreloadStatePreloading = 2, /** * 3: The media file is removed. */ - kPreloadStatusRemoved = 3, -} PreloadStatusCode; + kPreloadStateRemoved = 3, +} PreloadState; typedef enum { /** * 0: No error occurs and request succeeds. */ - kMusicContentCenterStatusOk = 0, + kMusicContentCenterReasonOk = 0, /** * 1: A general error occurs. */ - kMusicContentCenterStatusErr = 1, + kMusicContentCenterReasonError = 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, + kMusicContentCenterReasonGateway = 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, + kMusicContentCenterReasonPermissionAndResource = 3, /** * 4: Internal data parse error. Please contact technical support */ - kMusicContentCenterStatusErrInternalDataParse = 4, + kMusicContentCenterReasonInternalDataParse = 4, /** * 5: Music loading error. Please contact technical support */ - kMusicContentCenterStatusErrMusicLoading = 5, + kMusicContentCenterReasonMusicLoading = 5, /** * 6: Music decryption error. Please contact technical support */ - kMusicContentCenterStatusErrMusicDecryption = 6, -} MusicContentCenterStatusCode; + kMusicContentCenterReasonMusicDecryption = 6, + /** + * 7: Http internal error. Please retry later. + */ + kMusicContentCenterReasonHttpInternalError = 7, +} MusicContentCenterStateReason; typedef struct { @@ -227,37 +253,53 @@ class IMusicContentCenterEventHandler { public: /** * The music chart result callback; occurs when getMusicCharts method is called. - * @param requestId The request id same with return from getMusicCharts. + * + * @param requestId The request id is same as that returned by getMusicCharts. * @param result The result of music chart collection - * @param error_code The status of the request. See MusicContentCenterStatusCode + * @param reason The status of the request. See MusicContentCenterStateReason */ - virtual void onMusicChartsResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode error_code) = 0; + virtual void onMusicChartsResult(const char* requestId, agora_refptr result, MusicContentCenterStateReason reason) = 0; /** * 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 requestId The request id is same as that returned by getMusicCollectionByMusicChartId or searchMusic * @param result The result of music collection - * @param error_code The status of the request. See MusicContentCenterStatusCode + * @param reason The status of the request. See MusicContentCenterStateReason */ - virtual void onMusicCollectionResult(const char* requestId, agora_refptr result, MusicContentCenterStatusCode error_code) = 0; + virtual void onMusicCollectionResult(const char* requestId, agora_refptr result, MusicContentCenterStateReason reason) = 0; /** * Lyric url callback of getLyric, occurs when getLyric is called - * @param requestId The request id same with return from getLyric + * + * @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 error_code The status of the request. See MusicContentCenterStatusCode + * @param reason The status of the request. See MusicContentCenterStateReason */ - virtual void onLyricResult(const char* requestId, const char* lyricUrl, MusicContentCenterStatusCode error_code) = 0; + virtual void onLyricResult(const char* requestId, int64_t songCode, const char* lyricUrl, MusicContentCenterStateReason reason) = 0; + /** - * preload process callback, occurs when preload is called - * + * 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 reason The status of the request. See MusicContentCenterStateReason + */ + virtual void onSongSimpleInfoResult(const char* requestId, int64_t songCode, const char* simpleInfo, MusicContentCenterStateReason reason) = 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 error_code The status of the request. See MusicContentCenterStatusCode + * @param state Preload state; see PreloadState. + * @param reason The status of the request. See MusicContentCenterStateReason */ - virtual void onPreLoadEvent(int64_t songCode, int percent, const char* lyricUrl, PreloadStatusCode status, MusicContentCenterStatusCode error_code) = 0; + virtual void onPreLoadEvent(const char* requestId, int64_t songCode, int percent, const char* lyricUrl, PreloadState state, MusicContentCenterStateReason reason) = 0; virtual ~IMusicContentCenterEventHandler() {}; }; @@ -279,13 +321,17 @@ struct MusicContentCenterConfiguration { * The max number which the music content center caches cannot exceed 50. */ int32_t maxCacheSize; + /** + * @technical preview + */ + const char* mccDomain; /** * Event handler to get callback result. */ IMusicContentCenterEventHandler* eventHandler; - MusicContentCenterConfiguration():appId(nullptr),token(nullptr),eventHandler(nullptr),mccUid(0),maxCacheSize(10){} - MusicContentCenterConfiguration(const char*appid,const char* token,int64_t id,IMusicContentCenterEventHandler* handler,int32_t maxSize = 10): - appId(appid),token(token),mccUid(id),eventHandler(handler),maxCacheSize(maxSize){} + 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 { @@ -305,6 +351,18 @@ class IMusicPlayer : public IMediaPlayer { * - < 0: Failure. */ virtual int open(int64_t songCode, int64_t startPos = 0) = 0; + + /** + * Set the mode for playing songs. + * You can call this method to switch from original to accompaniment or lead vocals. + * If you do not call this method to set the mode, the SDK plays the accompaniment by default. + * + * @param model The playing mode. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setPlayMode(MusicPlayMode mode) = 0; }; class IMusicContentCenter @@ -359,6 +417,15 @@ class IMusicContentCenter * - The empty pointer NULL, if the method call fails. */ virtual agora_refptr createMusicPlayer() = 0; + + /** + * Destroy a music player source object and return result. + * @param music_player The pointer to \ref rtc::IMusicPlayer "IMusicPlayer". + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int destroyMusicPlayer(agora_refptr music_player) = 0; /** * Get music chart collection of music. @@ -407,13 +474,26 @@ class IMusicContentCenter /** * 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 = nullptr) = 0; + 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 @@ -462,13 +542,39 @@ class IMusicContentCenter /** * 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. + * @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; + 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 diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraParameter.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraParameter.h similarity index 92% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraParameter.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraParameter.h index 0b5e575f..e224006c 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraParameter.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraParameter.h @@ -15,6 +15,7 @@ */ #pragma once // NOLINT(build/header_guard) +#include "AgoraRefPtr.h" // external key /** @@ -38,8 +39,7 @@ * 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" +#define KEY_RTC_VIDEO_HARDWARE_ENCODEING "che.hardware_encoding" // deprecated, please use engine.video.enable_hw_encoder /** * set the hardware video encoder provider (nv for nvidia or qsv for intel) */ @@ -49,7 +49,7 @@ * 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" +#define KEY_RTC_VIDEO_HARDWARE_DECODING "che.hardware_decoding" // deprecated, please use engine.video.enable_hw_decoder /** * set the hardware video decoder provider (h264_cuvid(default) or h264_qsv) @@ -114,7 +114,7 @@ /** * set the video codec type, such as "H264", "JPEG" */ -#define KEY_RTC_VIDEO_CODEC_TYPE "engine.video.codec_type" +#define KEY_RTC_VIDEO_MINOR_STREAM_CODEC_INDEX "engine.video.minor_stream_codec_index" #define KEY_RTC_VIDEO_CODEC_INDEX "che.video.videoCodecIndex" /** * only use average QP for quality scaling @@ -144,7 +144,7 @@ typedef CopyableAutoPtr AString; namespace base { -class IAgoraParameter { +class IAgoraParameter : public RefCountInterface { public: /** * release the resource @@ -300,6 +300,7 @@ class IAgoraParameter { virtual int convertPath(const char* filePath, agora::util::AString& value) = 0; + protected: virtual ~IAgoraParameter() {} }; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRhythmPlayer.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRhythmPlayer.h similarity index 87% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRhythmPlayer.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRhythmPlayer.h index 760bfbd2..f657b1cb 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRhythmPlayer.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRhythmPlayer.h @@ -35,19 +35,19 @@ enum RHYTHM_PLAYER_STATE_TYPE { }; /** - The error codes of the rhythm player. + The reason codes of the rhythm player. */ -enum RHYTHM_PLAYER_ERROR_TYPE { +enum RHYTHM_PLAYER_REASON { /** 0: The rhythm player works well. */ - RHYTHM_PLAYER_ERROR_OK = 0, + RHYTHM_PLAYER_REASON_OK = 0, /** 1: The rhythm player occurs a internal error. */ - RHYTHM_PLAYER_ERROR_FAILED = 1, + RHYTHM_PLAYER_REASON_FAILED = 1, /** 801: The rhythm player can not open the file. */ - RHYTHM_PLAYER_ERROR_CAN_NOT_OPEN = 801, + RHYTHM_PLAYER_REASON_CAN_NOT_OPEN = 801, /** 802: The rhythm player can not play the file. */ - RHYTHM_PLAYER_ERROR_CAN_NOT_PLAY, + RHYTHM_PLAYER_REASON_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, + RHYTHM_PLAYER_REASON_FILE_OVER_DURATION_LIMIT, }; /** diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtcEngine.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRtcEngine.h similarity index 88% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtcEngine.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRtcEngine.h index 1c524b23..9f52693c 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtcEngine.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRtcEngine.h @@ -15,6 +15,9 @@ #include "IAgoraH265Transcoder.h" namespace agora { +namespace rtm { +class IStreamChannel; +} namespace rtc { template @@ -227,19 +230,30 @@ enum AUDIO_REVERB_TYPE { }; enum STREAM_FALLBACK_OPTIONS { - /** 0: No fallback operation for the stream when the network - condition is poor. The stream quality cannot be guaranteed. */ - + /** 0: No fallback operation to a lower resolution stream when the network + condition is poor. Fallback to Scalable Video Coding (e.g. SVC) + is still possible, but the resolution remains in high stream. + The stream quality cannot be guaranteed. */ STREAM_FALLBACK_OPTION_DISABLED = 0, - /** 1: (Default) Under poor network conditions, the SDK will send or receive + /** 1: (Default) Under poor network conditions, the receiver SDK will 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. */ + /** 2: Under poor network conditions, the SDK may receive agora::rtc::VIDEO_STREAM_LOW first, + then agora::rtc::VIDEO_STREAM_LAYER_1 to agora::rtc::VIDEO_STREAM_LAYER_6 if the related layer exists. + If the network still does not allow displaying the video, the SDK will receive audio only. */ STREAM_FALLBACK_OPTION_AUDIO_ONLY = 2, + /** 3~8: If the receiver SDK uses RtcEngineParameters::setRemoteSubscribeFallbackOption,it will receive + one of the streams from agora::rtc::VIDEO_STREAM_LAYER_1 to agora::rtc::VIDEO_STREAM_LAYER_6 + if the related layer exists when the network condition is poor. The lower bound of fallback depends on + the STREAM_FALLBACK_OPTION_VIDEO_STREAM_LAYER_X. */ + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LAYER_1 = 3, + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LAYER_2 = 4, + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LAYER_3 = 5, + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LAYER_4 = 6, + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LAYER_5 = 7, + STREAM_FALLBACK_OPTION_VIDEO_STREAM_LAYER_6 = 8, }; enum PRIORITY_TYPE { @@ -257,87 +271,90 @@ struct RtcConnection; */ 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; + /** + * 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; + /** The dimensions of the simulcast streams's encoding frame. + */ + VideoDimensions simulcastDimensions[SimulcastConfig::STREAM_LAYER_COUNT_MAX]; }; /** @@ -440,26 +457,31 @@ struct RemoteAudioStats * 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), - frozenRateByCustomPlcCount(0), - plcCount(0), - totalActiveTime(0), - publishDuration(0), - qoeQuality(0), - qualityChangedReason(0), - rxAudioBytes(0) {} + RemoteAudioStats() + : uid(0), + quality(0), + networkTransportDelay(0), + jitterBufferDelay(0), + audioLossRate(0), + numChannels(0), + receivedSampleRate(0), + receivedBitrate(0), + totalFrozenTime(0), + frozenRate(0), + mosValue(0), + frozenRateByCustomPlcCount(0), + plcCount(0), + totalActiveTime(0), + publishDuration(0), + qoeQuality(0), + qualityChangedReason(0), + rxAudioBytes(0), + e2eDelay(0) {} }; /** @@ -494,6 +516,9 @@ struct RemoteVideoStats { * Bitrate (Kbps) received since the last count. */ int receivedBitrate; + /** The decoder input frame rate (fps) of the remote video. + */ + int decoderInputFrameRate; /** The decoder output frame rate (fps) of the remote video. */ int decoderOutputFrameRate; @@ -575,8 +600,7 @@ struct VideoCompositingLayout { */ double alpha; - media::base::RENDER_MODE_TYPE - renderMode; // RENDER_MODE_HIDDEN: Crop, RENDER_MODE_FIT: Zoom to fit + media::base::RENDER_MODE_TYPE renderMode; // RENDER_MODE_HIDDEN: Crop, RENDER_MODE_FIT: Zoom to fit Region() : uid(0), @@ -619,10 +643,10 @@ struct VideoCompositingLayout { VideoCompositingLayout() : canvasWidth(0), canvasHeight(0), - backgroundColor(NULL), + backgroundColor(OPTIONAL_NULLPTR), regions(NULL), regionCount(0), - appData(NULL), + appData(OPTIONAL_NULLPTR), appDataLength(0) {} }; @@ -790,21 +814,32 @@ struct CameraCapturerConfiguration { /** * The camera direction. */ - CAMERA_DIRECTION cameraDirection; + Optional cameraDirection; + + /*- CAMERA_FOCAL_LENGTH_TYPE.CAMERA_FOCAL_LENGTH_DEFAULT: + For iOS, if iPhone/iPad has 3 or 2 back camera, it means combination of triple (wide + ultra wide + telephoto) camera + or dual wide(wide + ultra wide) camera.In this situation, you can apply for ultra wide len by set smaller zoom fator + and bigger zoom fator for telephoto len.Otherwise, it always means wide back/front camera. + + - CAMERA_FOCAL_LENGTH_TYPE.CAMERA_FOCAL_LENGTH_WIDE_ANGLE:wide camera + - CAMERA_FOCAL_LENGTH_TYPE.CAMERA_FOCAL_LENGTH_ULTRA_WIDE:ultra wide camera + - CAMERA_FOCAL_LENGTH_TYPE.CAMERA_FOCAL_LENGTH_TELEPHOTO:telephoto camera*/ + Optional cameraFocalLengthType; #else - /** For windows. The device ID of the playback device. The maximum length is #MAX_DEVICE_ID_LENGTH. */ - char deviceId[MAX_DEVICE_ID_LENGTH]; + /** For windows. The device ID of the playback device. */ + Optional deviceId; #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)); + +#if defined(__ANDROID__) + /** + * The camera id. + */ + Optional cameraId; #endif - } + Optional followEncodeDimensionRatio; + /** The video format. See VideoFormat. */ + VideoFormat format; + CameraCapturerConfiguration() : format(VideoFormat(0, 0, 0)) {} }; /** * The configuration of the captured screen. @@ -1029,10 +1064,22 @@ struct ChannelMediaOptions { Optional publishCameraTrack; /** * Whether to publish the video of the secondary camera track. - * - `true`: (Default) Publish the video track of the secondary camera capturer. - * - `false`: Do not publish the video track of the secondary camera capturer. + * - `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. @@ -1066,6 +1113,18 @@ struct ChannelMediaOptions { * - 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 /** @@ -1108,6 +1167,18 @@ struct ChannelMediaOptions { * - `false`: (Default) Do not publish the local transcoded video track. */ Optional publishTranscodedVideoTrack; + /** + * 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 publish the local lip sync video track. + * - `true`: Publish the video track of local lip sync video track. + * - `false`: (Default) Do not publish the local lip sync video track. + */ + Optional publishLipSyncTrack; /** * Whether to automatically subscribe to all remote audio streams when the user joins a channel: * - `true`: (Default) Subscribe to all remote audio streams. @@ -1202,6 +1273,12 @@ struct ChannelMediaOptions { */ 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. + * @technical preview + */ + Optional parameters; + ChannelMediaOptions() {} ~ChannelMediaOptions() {} @@ -1210,6 +1287,8 @@ struct ChannelMediaOptions { 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); @@ -1217,8 +1296,12 @@ struct ChannelMediaOptions { #else SET_FROM(publishScreenTrack); SET_FROM(publishSecondaryScreenTrack); + SET_FROM(publishThirdScreenTrack); + SET_FROM(publishFourthScreenTrack); #endif SET_FROM(publishTranscodedVideoTrack); + SET_FROM(publishMixedAudioTrack); + SET_FROM(publishLipSyncTrack); SET_FROM(publishCustomAudioTrack); SET_FROM(publishCustomAudioTrackId); SET_FROM(publishCustomVideoTrack); @@ -1241,6 +1324,7 @@ struct ChannelMediaOptions { SET_FROM(customVideoTrackId); SET_FROM(isAudioFilterable); SET_FROM(isInteractiveAudience); + SET_FROM(parameters); #undef SET_FROM } @@ -1252,6 +1336,8 @@ struct ChannelMediaOptions { 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); @@ -1259,8 +1345,12 @@ struct ChannelMediaOptions { #else ADD_COMPARE(publishScreenTrack); ADD_COMPARE(publishSecondaryScreenTrack); + ADD_COMPARE(publishThirdScreenTrack); + ADD_COMPARE(publishFourthScreenTrack); #endif ADD_COMPARE(publishTranscodedVideoTrack); + ADD_COMPARE(publishMixedAudioTrack); + ADD_COMPARE(publishLipSyncTrack); ADD_COMPARE(publishCustomAudioTrack); ADD_COMPARE(publishCustomAudioTrackId); ADD_COMPARE(publishCustomVideoTrack); @@ -1283,6 +1373,7 @@ struct ChannelMediaOptions { ADD_COMPARE(customVideoTrackId); ADD_COMPARE(isAudioFilterable); ADD_COMPARE(isInteractiveAudience); + ADD_COMPARE(parameters); END_COMPARE(); #undef BEGIN_COMPARE @@ -1297,6 +1388,8 @@ struct ChannelMediaOptions { 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); @@ -1304,8 +1397,12 @@ struct ChannelMediaOptions { #else REPLACE_BY(publishScreenTrack); REPLACE_BY(publishSecondaryScreenTrack); + REPLACE_BY(publishThirdScreenTrack); + REPLACE_BY(publishFourthScreenTrack); #endif REPLACE_BY(publishTranscodedVideoTrack); + REPLACE_BY(publishMixedAudioTrack); + REPLACE_BY(publishLipSyncTrack); REPLACE_BY(publishCustomAudioTrack); REPLACE_BY(publishCustomAudioTrackId); REPLACE_BY(publishCustomVideoTrack); @@ -1328,22 +1425,13 @@ struct ChannelMediaOptions { 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. */ @@ -1368,57 +1456,9 @@ enum PROXY_TYPE { HTTPS_PROXY_TYPE = 6, }; -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) {} +enum FeatureType { + VIDEO_VIRTUAL_BACKGROUND = 1, + VIDEO_BEAUTY_EFFECT = 2, }; /** @@ -1534,8 +1574,7 @@ class IRtcEngineEventHandler { @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) __deprecated { + virtual void onAudioQuality(uid_t uid, int quality, unsigned short delay, unsigned short lost) __deprecated { (void)uid; (void)quality; (void)delay; @@ -1637,6 +1676,7 @@ class IRtcEngineEventHandler { 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. * @@ -1804,7 +1844,7 @@ class IRtcEngineEventHandler { (void)width; (void)height; (void)rotation; - } + } /** Occurs when the local video stream state changes. * @@ -1814,13 +1854,13 @@ class IRtcEngineEventHandler { * 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: + * and error code of `LOCAL_VIDEO_STREAM_REASON_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`. + * of `LOCAL_VIDEO_STREAM_STATE_CAPTURING` and error code of `LOCAL_VIDEO_STREAM_REASON_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. * @@ -1830,12 +1870,12 @@ class IRtcEngineEventHandler { * * @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. + * @param reason The detailed error information. See #LOCAL_VIDEO_STREAM_REASON. */ - virtual void onLocalVideoStateChanged(VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_ERROR error) { + virtual void onLocalVideoStateChanged(VIDEO_SOURCE_TYPE source, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_REASON reason) { (void)source; (void)state; - (void)error; + (void)reason; } /** @@ -1858,13 +1898,13 @@ class IRtcEngineEventHandler { /** 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 uid 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; + virtual void onFirstRemoteVideoFrame(uid_t uid, int width, int height, int elapsed) { + (void)uid; (void)width; (void)height; (void)elapsed; @@ -1944,8 +1984,8 @@ class IRtcEngineEventHandler { - 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; + virtual void onUserMuteVideo(uid_t uid, bool muted) { + (void)uid; (void)muted; } @@ -1967,11 +2007,11 @@ class IRtcEngineEventHandler { } /** - * Occurs when the remote user state is updated. + * Occurs when the remote user audio or video state is updated. * @param uid The uid of the remote user. - * @param state The remote user state: #REMOTE_USER_STATE. + * @param state The remote user's audio or video state: #REMOTE_USER_STATE. */ - virtual void onUserStateChanged(uid_t uid, uint32_t state) { + virtual void onUserStateChanged(uid_t uid, REMOTE_USER_STATE state) { (void)uid; (void)state; } @@ -1991,17 +2031,6 @@ class IRtcEngineEventHandler { (void)enabled; } - /** 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 @@ -2013,6 +2042,17 @@ class IRtcEngineEventHandler { (void)stats; } + /** 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 local video stream. * * The SDK triggers this callback once every two seconds for each @@ -2042,12 +2082,14 @@ class IRtcEngineEventHandler { 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() __deprecated {} + /** * Occurs when the camera focus area changes. * @@ -2146,11 +2188,11 @@ class IRtcEngineEventHandler { callback. @param state The state code. See #RHYTHM_PLAYER_STATE_TYPE. - @param errorCode The error code. See #RHYTHM_PLAYER_ERROR_TYPE. + @param reason The error code. See #RHYTHM_PLAYER_REASON. */ - virtual void onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_ERROR_TYPE errorCode) { + virtual void onRhythmPlayerStateChanged(RHYTHM_PLAYER_STATE_TYPE state, RHYTHM_PLAYER_REASON reason) { (void)state; - (void)errorCode; + (void)reason; } /** @@ -2186,14 +2228,14 @@ class IRtcEngineEventHandler { * 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 uid 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; + virtual void onStreamMessage(uid_t uid, int streamId, const char* data, size_t length, uint64_t sentTs) { + (void)uid; (void)streamId; (void)data; (void)length; @@ -2205,15 +2247,15 @@ class IRtcEngineEventHandler { * 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 uid 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; + virtual void onStreamMessageError(uid_t uid, int streamId, int code, int missed, int cached) { + (void)uid; (void)streamId; (void)code; (void)missed; @@ -2269,18 +2311,6 @@ class IRtcEngineEventHandler { (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) __deprecated { - (void)uid; - (void)elapsed; - } - /** * Occurs when the SDK decodes the first remote audio frame for playback. * @@ -2302,6 +2332,18 @@ class IRtcEngineEventHandler { (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) __deprecated { + (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 @@ -2313,12 +2355,12 @@ class IRtcEngineEventHandler { * 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. + * @param reason The reason information of the local audio. + * See #LOCAL_AUDIO_STREAM_REASON. */ - virtual void onLocalAudioStateChanged(LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error) { + virtual void onLocalAudioStateChanged(LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_REASON reason) { (void)state; - (void)error; + (void)reason; } /** Occurs when the remote audio state changes. @@ -2357,12 +2399,16 @@ class IRtcEngineEventHandler { * * @param userId The ID of the active speaker. A `uid` of 0 means the local user. */ - virtual void onActiveSpeaker(uid_t userId) { (void)userId; } + virtual void onActiveSpeaker(uid_t uid) { + (void)uid; + } + /** 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 @@ -2387,6 +2433,7 @@ class IRtcEngineEventHandler { (void)height; (void)errCode; } + /** * Occurs when the user role switches in the interactive live streaming. * @@ -2399,6 +2446,7 @@ class IRtcEngineEventHandler { (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. @@ -2410,6 +2458,7 @@ class IRtcEngineEventHandler { (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. @@ -2432,13 +2481,13 @@ class IRtcEngineEventHandler { * * @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. + * @param reason The detailed error information for the media push: #RTMP_STREAM_PUBLISH_REASON. */ virtual void onRtmpStreamingStateChanged(const char* url, RTMP_STREAM_PUBLISH_STATE state, - RTMP_STREAM_PUBLISH_ERROR_TYPE errCode) { + RTMP_STREAM_PUBLISH_REASON reason) { (void)url; (void)state; - (void)errCode; + (void)reason; } /** Reports events during the media push. @@ -2478,7 +2527,6 @@ class IRtcEngineEventHandler { */ virtual void onAudioRoutingChanged(int routing) { (void)routing; } - /** * Occurs when the state of the media stream relay changes. * @@ -2515,32 +2563,6 @@ class IRtcEngineEventHandler { (void)code; } - /** - * Reports events during the media stream relay. - * @deprecated v4.2.0. This callback is not recommended and will be removed in future releases. - * @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) __deprecated { - (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. @@ -2557,6 +2579,7 @@ class IRtcEngineEventHandler { 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. @@ -2593,8 +2616,7 @@ class IRtcEngineEventHandler { @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) __deprecated { + virtual void onRemoteAudioTransportStats(uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) __deprecated { (void)uid; (void)delay; (void)lost; @@ -2618,8 +2640,7 @@ class IRtcEngineEventHandler { @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) __deprecated { + virtual void onRemoteVideoTransportStats(uid_t uid, unsigned short delay, unsigned short lost, unsigned short rxKBitRate) __deprecated { (void)uid; (void)delay; (void)lost; @@ -2657,7 +2678,7 @@ class IRtcEngineEventHandler { * @param currentStats Instantaneous value of optimization effect. * @param averageStats Average value of cumulative optimization effect. */ - virtual void onWlAccStats(WlAccStats currentStats, WlAccStats averageStats) { + virtual void onWlAccStats(const WlAccStats& currentStats, const WlAccStats& averageStats) { (void)currentStats; (void)averageStats; } @@ -2725,6 +2746,42 @@ class IRtcEngineEventHandler { (void)uid; (void)info; } + + /** + * 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; + } + + /** + * 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; + } + /** * Reports the user log upload result * @param requestId RequestId of the upload @@ -2802,96 +2859,99 @@ class IRtcEngineEventHandler { (void)newState; (void)elapseSinceLastState; } + + /** + * Occurs when receive a video transcoder stream which has video layout info. + * + * @param uid user id of the transcoded stream. + * @param width width of the transcoded stream. + * @param height height of the transcoded stream. + * @param layoutCount count of layout info in the transcoded stream. + * @param layoutlist video layout info list of the transcoded stream. + */ + 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; + } + + /** + * Occurs when the SDK receives audio metadata. + * @since v4.3.1 + * @param uid ID of the remote user. + * @param metadata The pointer of metadata + * @param length Size of metadata + * @technical preview + */ + virtual void onAudioMetadataReceived(uid_t uid, const char* metadata, size_t length) { + (void)uid; + (void)metadata; + (void)length; + } + /** * The event callback of the extension. * * To listen for events while the extension is running, you need to register this callback. - * - * @param provider The name of the extension provider. - * @param extension The name of the extension. + * + * @param context The context 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) { - (void)provider; - (void)extension; + 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 call of `enableExtension(true)`, the extension triggers this callback. - * - * @param provider The name of the extension provider. - * @param extension The name of the extension. + * + * After a successful creation of filter , the extension triggers this callback. + * + * @param context The context of the extension. */ - virtual void onExtensionStarted(const char* provider, const char* extension) { - (void)provider; - (void)extension; + virtual void onExtensionStartedWithContext(const ExtensionContext &context) { + (void)context; } + /** * Occurs when the extension is disabled. - * - * After a successful call of `enableExtension(false)`, the extension triggers this callback. - * - * @param provider The name of the extension provider. - * @param extension The name of the extension. + * + * After a successful destroy filter, the extension triggers this callback. + * + * @param context The context of the extension. */ - virtual void onExtensionStopped(const char* provider, const char* extension) { - (void)provider; - (void)extension; + virtual void onExtensionStoppedWithContext(const ExtensionContext &context) { + (void)context; } + /** * Occurs when the extension runs incorrectly. - * - * When calling `enableExtension(true)` fails or the extension runs in error, the extension triggers + * + * When the extension runs in error, the extension triggers * this callback and reports the error code and reason. * - * @param provider The name of the extension provider. - * @param extension The name of the extension. + * @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 onExtensionError(const char* provider, const char* extension, int error, const char* message) { - (void)provider; - (void)extension; + virtual void onExtensionErrorWithContext(const ExtensionContext &context, int error, const char* message) { + (void)context; (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; - } - - /** - * 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; - } /** - * 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. + * Occurs when the SDK receives RTM setting change response. + * + * @technical preview + * @param code The error code. */ - virtual void onVideoRenderingTracingResult(uid_t uid, MEDIA_TRACE_EVENT currentEvent, VideoRenderingTracingInfo tracingInfo) { - (void)uid; - (void)currentEvent; - (void)tracingInfo; + virtual void onSetRtmFlagResult(int code) { + (void)code; } }; @@ -3049,8 +3109,6 @@ class IVideoDeviceManager { virtual void release() = 0; }; - -class IRtcEngineEventHandlerEx; /** * The context of IRtcEngine. */ @@ -3146,11 +3204,8 @@ struct RtcEngineContext { bool autoRegisterAgoraExtensions; RtcEngineContext() - : eventHandler(NULL), appId(NULL), context(NULL), - channelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING), - license(NULL), - audioScenario(AUDIO_SCENARIO_DEFAULT), - areaCode(AREA_CODE_GLOB), + : 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) {} }; @@ -3158,6 +3213,8 @@ struct RtcEngineContext { */ class IMetadataObserver { public: + virtual ~IMetadataObserver() {} + /** The metadata type. * * @note We only support video metadata for now. @@ -3185,6 +3242,9 @@ class IMetadataObserver { */ struct Metadata { + /** The channel ID of the `metadata`. + */ + const char* channelId; /** 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. @@ -3196,13 +3256,13 @@ class IMetadataObserver { /** The buffer address of the sent or received `metadata`. */ unsigned char *buffer; - /** The timestamp (ms) of the `metadata`. - * + /** The NTP timestamp (ms) when the metadata is sent. + * @note If the receiver is audience, the receiver cannot get the NTP timestamp (ms). */ long long timeStampMs; - }; - virtual ~IMetadataObserver() {} + Metadata() : channelId(NULL), uid(0), size(0), buffer(NULL), timeStampMs(0) {} + }; /** Occurs when the SDK requests the maximum size of the metadata. * @@ -3235,24 +3295,24 @@ class IMetadataObserver { * @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; + virtual void onMetadataReceived(const Metadata& metadata) = 0; }; -// The error codes for media streaming +// The reason codes for media streaming // GENERATED_JAVA_ENUM_PACKAGE: io.agora.streaming -enum DIRECT_CDN_STREAMING_ERROR { +enum DIRECT_CDN_STREAMING_REASON { // No error occurs. - DIRECT_CDN_STREAMING_ERROR_OK = 0, + DIRECT_CDN_STREAMING_REASON_OK = 0, // A general error occurs (no specified reason). - DIRECT_CDN_STREAMING_ERROR_FAILED = 1, + DIRECT_CDN_STREAMING_REASON_FAILED = 1, // Audio publication error. - DIRECT_CDN_STREAMING_ERROR_AUDIO_PUBLICATION = 2, + DIRECT_CDN_STREAMING_REASON_AUDIO_PUBLICATION = 2, // Video publication error. - DIRECT_CDN_STREAMING_ERROR_VIDEO_PUBLICATION = 3, + DIRECT_CDN_STREAMING_REASON_VIDEO_PUBLICATION = 3, - DIRECT_CDN_STREAMING_ERROR_NET_CONNECT = 4, + DIRECT_CDN_STREAMING_REASON_NET_CONNECT = 4, // Already exist stream name. - DIRECT_CDN_STREAMING_ERROR_BAD_NAME = 5, + DIRECT_CDN_STREAMING_REASON_BAD_NAME = 5, }; // The connection state of media streaming @@ -3311,12 +3371,12 @@ class IDirectCdnStreamingEventHandler { /** * Event callback of direct cdn streaming * @param state Current status - * @param error Error Code + * @param reason Reason Code * @param message Message */ - virtual void onDirectCdnStreamingStateChanged(DIRECT_CDN_STREAMING_STATE state, DIRECT_CDN_STREAMING_ERROR error, const char* message) { + virtual void onDirectCdnStreamingStateChanged(DIRECT_CDN_STREAMING_STATE state, DIRECT_CDN_STREAMING_REASON reason, const char* message) { (void)state; - (void)error; + (void)reason; (void)message; }; @@ -3457,11 +3517,7 @@ struct ExtensionInfo { */ uid_t localUid; - ExtensionInfo() - : mediaSourceType(agora::media::UNKNOWN_MEDIA_SOURCE), - remoteUid(0), - channelId(NULL), - localUid(0) {} + ExtensionInfo() : mediaSourceType(agora::media::UNKNOWN_MEDIA_SOURCE), remoteUid(0), channelId(NULL), localUid(0) {} }; class IMediaPlayer; @@ -3472,7 +3528,6 @@ class IMediaRecorder; * * `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: @@ -3493,14 +3548,12 @@ class IRtcEngine : public agora::base::IEngineBase { * @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. + * in any callback generated by the SDK, or it may result in a deadlock. * - `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; + AGORA_CPP_API static void release(bool sync = false); /** * Initializes `IRtcEngine`. @@ -3557,6 +3610,116 @@ class IRtcEngine : public agora::base::IEngineBase { */ virtual int queryCodecCapability(CodecCapInfo* codecInfo, 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 preloadChannelWithUserAccount(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. * @@ -3616,8 +3779,7 @@ class IRtcEngine : public agora::base::IEngineBase { * 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; + virtual int joinChannel(const char* token, const char* channelId, const char* info, uid_t uid) = 0; /** * Joins a channel with media options. @@ -3686,8 +3848,7 @@ class IRtcEngine : public agora::base::IEngineBase { * 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; + 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. @@ -3774,6 +3935,7 @@ class IRtcEngine : public agora::base::IEngineBase { * @return * - 0: Success. * - < 0: Failure. + * - -8(ERR_INVALID_STATE): The current status is invalid, only allowed to be called when the connection is disconnected. */ virtual int setChannelProfile(CHANNEL_PROFILE_TYPE profile) = 0; @@ -3822,51 +3984,13 @@ class IRtcEngine : public agora::base::IEngineBase { * - -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. + * - -8(ERR_INVALID_STATE): The channel profile is not `LIVE_BROADCASTING`. */ 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. + * @param config: configuration for video call test. * * @return * - 0: Success. @@ -4028,6 +4152,41 @@ class IRtcEngine : public agora::base::IEngineBase { * @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; + /** Enables/Disables face shape and sets the beauty options. + * + * @note Call this method after calling the \ref IRtcEngine::enableVideo "enableVideo" method. + * + * @param enabled Sets whether or not to enable face shape: + * - true: enables face shape. + * - false: disables face shape. + * @param options Sets the face shape beauty option. See FaceShapeBeautyOptions. + */ + virtual int setFaceShapeBeautyOptions(bool enabled, const FaceShapeBeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + /** Enables/Disables face shape and sets the area options. + * + * @note Call this method after calling the \ref IRtcEngine::setFaceShapeBeautyOptions "setFaceShapeBeautyOptions" method. + * + * @param options Sets the face shape area option. See FaceShapeAreaOptions. + */ + virtual int setFaceShapeAreaOptions(const FaceShapeAreaOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + + /** Gets the face shape beauty options. + * + * @note Call this method after calling the \ref IRtcEngine::enableVideo "enableVideo" method. + * + * @param options Gets the face shape beauty option. See FaceShapeBeautyOptions. + */ + virtual int getFaceShapeBeautyOptions(FaceShapeBeautyOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + + /** Gets the face shape area options. + * + * @note Call this method after calling the \ref IRtcEngine::enableVideo "enableVideo" method. + * + * @param shapeArea The face area. See FaceShapeAreaOptions::FACE_SHAPE_AREA. + * @param options Gets the face area beauty option. See FaceShapeAreaOptions. + */ + virtual int getFaceShapeAreaOptions(agora::rtc::FaceShapeAreaOptions::FACE_SHAPE_AREA shapeArea, FaceShapeAreaOptions& options, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0; + /** * Sets low-light enhancement. * @@ -4206,6 +4365,26 @@ class IRtcEngine : public agora::base::IEngineBase { */ virtual int setVideoScenario(VIDEO_APPLICATION_SCENARIO_TYPE scenarioType) = 0; + /** + * Sets the video qoe preference. + * + * @since v4.2.1 + * + * You can call this method to set the expected QoE Preference. + * The SDK will optimize the video experience for each preference you set. + * + * + * @param qoePreference The qoe preference type. See #VIDEO_QOE_PREFERENCE_TYPE. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - ERR_FAILED (1): A general error occurs (no specified reason). + * - ERR_NOT_SUPPORTED (4): Unable to set video application scenario. + * - ERR_NOT_INITIALIZED (7): The SDK is not initialized. + */ + virtual int setVideoQoEPreference(VIDEO_QOE_PREFERENCE_TYPE qoePreference) = 0; + /** * Enables the audio. * @@ -4233,7 +4412,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 0: Failure. */ virtual int disableAudio() = 0; - + /** * Sets the audio parameters and application scenarios. * @@ -4256,7 +4435,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 0: Failure. */ virtual int setAudioProfile(AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario) __deprecated = 0; - + /** * Sets the audio profile. * @@ -4376,29 +4555,6 @@ class IRtcEngine : public agora::base::IEngineBase { */ 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. * @@ -4498,27 +4654,15 @@ class IRtcEngine : public agora::base::IEngineBase { 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. + * 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 setDefaultMuteAllRemoteVideoStreams(bool mute) __deprecated = 0; + virtual int setRemoteDefaultVideoStreamType(VIDEO_STREAM_TYPE streamType) = 0; /** * Stops or resumes receiving the video stream of a specified user. @@ -4569,17 +4713,6 @@ class IRtcEngine : public agora::base::IEngineBase { */ 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. * @@ -4759,8 +4892,8 @@ class IRtcEngine : public agora::base::IEngineBase { - < 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. @@ -4788,7 +4921,7 @@ class IRtcEngine : public agora::base::IEngineBase { /** * Creates a media recorder object and return its pointer. * - * @param connection The RtcConnection object. It contains user ID and channel name of user. + * @param info The RecorderStreamInfo object. It contains the user ID and the channel name. * * @return * - The pointer to \ref rtc::IMediaRecorder "IMediaRecorder", @@ -5058,6 +5191,24 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 0: Failure. */ virtual int setAudioMixingPitch(int pitch) = 0; + + /** + * Sets the playback speed of the current music file. + * + * @note Call this method after calling \ref IRtcEngine::startAudioMixing(const char*,bool,bool,int,int) "startAudioMixing" [2/2] + * and receiving the \ref IRtcEngineEventHandler::onAudioMixingStateChanged "onAudioMixingStateChanged" (AUDIO_MIXING_STATE_PLAYING) callback. + * + * @param speed The playback speed. Agora recommends that you limit this value to between 50 and 400, defined as follows: + * - 50: Half the original speed. + * - 100: The original speed. + * - 400: 4 times the original speed. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setAudioMixingPlaybackSpeed(int speed) = 0; + /** * Gets the volume of audio effects. * @@ -5324,6 +5475,7 @@ class IRtcEngine : public agora::base::IEngineBase { - < 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. @@ -5360,7 +5512,7 @@ class IRtcEngine : public agora::base::IEngineBase { /** Sets remote user parameters for spatial audio @param uid The ID of the remote user. - @param params Spatial audio parameters. see SpatialAudioParams. + @param param spatial audio parameters: SpatialAudioParams. @return int - 0: Success. @@ -5656,8 +5808,7 @@ class IRtcEngine : public agora::base::IEngineBase { - 0: Success. - -1: Failure. */ - virtual int setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, - int bandGain) = 0; + virtual int setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) = 0; /** Sets the local voice reverberation. @@ -5680,6 +5831,7 @@ class IRtcEngine : public agora::base::IEngineBase { - -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]. @@ -5691,6 +5843,19 @@ class IRtcEngine : public agora::base::IEngineBase { */ virtual int setHeadphoneEQParameters(int lowGain, int highGain) = 0; + /** Enables or disables the voice AI tuner. + * + * @param enabled Determines whether to enable the voice AI tuner: + * - true: Enable the voice AI tuner + * - false: (default) Disable the voice AI tuner. + * + * @param type. The options for SDK voice AI tuner types. See #VOICE_AI_TUNER_TYPE. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableVoiceAITuner(bool enabled, VOICE_AI_TUNER_TYPE type) = 0; + /** **DEPRECATED** Specifies an SDK output log file. * * The log file records all log data for the SDK’s operation. Ensure that the @@ -5776,6 +5941,23 @@ class IRtcEngine : public agora::base::IEngineBase { */ 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. * @@ -5795,6 +5977,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 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. * @@ -5837,7 +6020,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode) = 0; + virtual int setLocalRenderMode(media::base::RENDER_MODE_TYPE renderMode) __deprecated = 0; /** * Sets the local video mirror mode. @@ -5850,13 +6033,11 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) = 0; + virtual int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) __deprecated = 0; /** * Enables or disables the dual video stream mode. * - * @deprecated v4.2.0. This method is deprecated. Use setDualStreamMode instead. - * * 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". @@ -5868,13 +6049,11 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int enableDualStreamMode(bool enabled) = 0; + virtual int enableDualStreamMode(bool enabled) __deprecated = 0; /** * Enables or disables the dual video stream mode. * - * @deprecated v4.2.0. This method is deprecated. Use setDualStreamMode instead. - * * 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". @@ -5888,7 +6067,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) = 0; + virtual int enableDualStreamMode(bool enabled, const SimulcastStreamConfig& streamConfig) __deprecated = 0; /** @@ -5907,7 +6086,24 @@ class IRtcEngine : public agora::base::IEngineBase { virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode) = 0; /** - * Enables, disables or auto enable the dual video stream mode. + * Sets the multi-layer video stream configuration. + * + * If multi-layer is configured, the subscriber can choose to receive the coresponding layer + * of video stream using {@link setRemoteVideoStreamType setRemoteVideoStreamType}. + * + * @param simulcastConfig + * - The configuration for multi-layer video stream. It includes seven layers, ranging from + * STREAM_LAYER_1 to STREAM_LOW. A maximum of 3 layers can be enabled simultaneously. + * + * @return + * - 0: Success. + * - < 0: Failure. + * @technical preview + */ + virtual int setSimulcastConfig(const SimulcastConfig& simulcastConfig) = 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) @@ -5919,8 +6115,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode, - const SimulcastStreamConfig& streamConfig) = 0; + virtual int setDualStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig) = 0; /** * Sets the external audio track. @@ -6149,7 +6344,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int adjustUserPlaybackSignalVolume(unsigned int uid, int volume) = 0; + virtual int adjustUserPlaybackSignalVolume(uid_t uid, int volume) = 0; /** Sets the fallback option for the published video stream based on the network conditions. @@ -6206,6 +6401,59 @@ class IRtcEngine : public agora::base::IEngineBase { */ virtual int setHighPriorityUserList(uid_t* uidList, int uidNum, STREAM_FALLBACK_OPTIONS option) = 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 compatibility reasons, 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: + * - 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 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; + /** Enables loopback recording. * * If you enable loopback recording, the output of the default sound card is mixed into @@ -6289,8 +6537,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int setExtensionProviderProperty( - const char* provider, const char* key, const char* value) = 0; + 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. @@ -6304,8 +6551,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 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; + 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. @@ -6327,30 +6573,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 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 compatibility reasons, 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: - * - 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; + virtual int enableExtension(const char* provider, const char* extension, bool enable=true, agora::media::MEDIA_SOURCE_TYPE type = agora::media::UNKNOWN_MEDIA_SOURCE) = 0; /** * Sets the properties of an extension. @@ -6385,37 +6608,6 @@ class IRtcEngine : public agora::base::IEngineBase { 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", @@ -6429,7 +6621,6 @@ class IRtcEngine : public agora::base::IEngineBase { */ virtual int setCameraCapturerConfiguration(const CameraCapturerConfiguration& config) = 0; - /** * Get an custom video track id created by internal,which could used to publish or preview * @@ -6468,9 +6659,7 @@ class IRtcEngine : public agora::base::IEngineBase { */ 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. * @@ -6612,6 +6801,32 @@ class IRtcEngine : public agora::base::IEngineBase { */ virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0; + /** + * Returns whether exposure value adjusting is supported by the current device. + * Exposure compensation is in auto exposure mode. + * @since v4.2.2 + * @note + * This method only supports Android and iOS. + * 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 camera exposure ratio. + * @since v4.2.2 + * @param factor The camera zoom factor. The recommended camera exposure factor ranging from -8.0 to 8.0 for iOS, + * and -20.0 to 20.0 for Android. + * + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int setCameraExposureFactor(float factor) = 0; + #if defined(__APPLE__) /** * Checks whether the camera auto exposure function is supported. @@ -6631,6 +6846,13 @@ class IRtcEngine : public agora::base::IEngineBase { * - false: Do not enable the auto exposure face function. */ virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0; + + /** + * set camera stabilization mode.If open stabilization mode, fov will be smaller and capture latency will be longer. + * + * @param mode specifies the camera stabilization mode. + */ + virtual int setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode) = 0; #endif /** Sets the default audio route (for Android and iOS only). @@ -6705,8 +6927,37 @@ class IRtcEngine : public agora::base::IEngineBase { */ virtual bool isSpeakerphoneEnabled() = 0; + /** Select preferred route for android communication mode + + @param route The preferred route. For example, when a Bluetooth headset is connected, + you can use this API to switch the route to a wired headset. + @return meanless, route switch result is pass through CallbackOnRoutingChanged + */ + virtual int setRouteInCommunicationMode(int route) = 0; + #endif // __ANDROID__ || (__APPLE__ && TARGET_OS_IOS) +#if defined(__APPLE__) + /** + * Checks whether the center stage is supported. Use this method after starting the camera. + * + * @return + * - true: The center stage is supported. + * - false: The center stage is not supported. + */ + virtual bool isCameraCenterStageSupported() = 0; + + /** Enables the camera Center Stage. + * @param enabled enable Center Stage: + * - true: Enable Center Stage. + * - false: Disable Center Stage. + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int enableCameraCenterStage(bool enabled) = 0; +#endif + #if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) /** Get \ref ScreenCaptureSourceInfo list including available windows and screens. * @@ -6776,7 +7027,6 @@ class IRtcEngine : public agora::base::IEngineBase { #endif // __APPLE__ && TARGET_OS_MAC && !TARGET_OS_IPHONE #if defined(_WIN32) - /** * Shares the whole or part of a screen by specifying the screen rect. * @@ -6803,8 +7053,7 @@ class IRtcEngine : public agora::base::IEngineBase { virtual int startScreenCaptureByScreenRect(const Rectangle& screenRect, const Rectangle& regionRect, const ScreenCaptureParameters& captureParams) __deprecated = 0; - -#endif // _WIN32 +#endif #if defined(__ANDROID__) /** @@ -6814,7 +7063,6 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 0: Failure.. */ virtual int getAudioDeviceInfo(DeviceInfo& deviceInfo) = 0; - #endif // __ANDROID__ #if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE) @@ -6925,6 +7173,19 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 0: Failure. */ virtual int queryScreenCaptureCapability() = 0; + + /** + * Query all focal attributes supported by the camera. + * + * @param focalLengthInfos The camera supports the collection of focal segments.Ensure the size of array is not less than 8. + * + * @param size The camera supports the size of the focal segment set. Ensure the size is not less than 8. + * + * @return + * - 0: Success. + * - < 0: Failure.. + */ + virtual int queryCameraFocalLengthCapability(agora::rtc::FocalLengthInfo* focalLengthInfos, int& size) = 0; #endif #if defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__) @@ -6988,8 +7249,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int rate(const char* callId, int rating, - const char* description) = 0; // 0~10 + virtual int rate(const char* callId, int rating, const char* description) = 0; // 0~10 /** * Allows a user to complain about the call quality. @@ -7061,6 +7321,10 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 0: Failure. */ virtual int updateRtmpTranscoding(const LiveTranscoding& transcoding) = 0; + + virtual int startLocalVideoTranscoder(const LocalTranscoderConfiguration& config) = 0; + virtual int updateLocalTranscoderConfiguration(const LocalTranscoderConfiguration& config) = 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 @@ -7081,9 +7345,6 @@ class IRtcEngine : public agora::base::IEngineBase { */ 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. @@ -7179,47 +7440,6 @@ class IRtcEngine : public agora::base::IEngineBase { */ 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. * @@ -7286,7 +7506,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - Returns 0: Success. * - < 0: Failure. */ - virtual int createDataStream(int* streamId, DataStreamConfig& config) = 0; + virtual int createDataStream(int* streamId, const DataStreamConfig& config) = 0; /** Sends a data stream. * @@ -7341,7 +7561,7 @@ class IRtcEngine : public agora::base::IEngineBase { - 0: Success. - < 0: Failure. */ - virtual int addVideoWatermark(const RtcImage& watermark) = 0; + virtual int addVideoWatermark(const RtcImage& watermark) __deprecated = 0; /** Adds a watermark image to the local video. @@ -7428,8 +7648,7 @@ class IRtcEngine : public agora::base::IEngineBase { * 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; + virtual int sendCustomReportMessage(const char* id, const char* category, const char* event, const char* label, int value) = 0; /** Registers the metadata observer. @@ -7472,13 +7691,12 @@ class IRtcEngine : public agora::base::IEngineBase { "pre_play_proc", "at_playout", "atw_playout" for audio receiving. */ + virtual int startAudioFrameDump(const char* channel_id, uid_t uid, const char* location, const char* uuid, const char* passwd, long duration_ms, bool auto_upload) = 0; - 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; + virtual int stopAudioFrameDump(const char* channel_id, uid_t uid, const char* location) = 0; /** * Enables/Disables Agora AI Noise Suppression(AINS) with preset mode. @@ -7560,8 +7778,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int joinChannelWithUserAccount(const char* token, const char* channelId, - const char* userAccount) = 0; + virtual int joinChannelWithUserAccount(const char* token, const char* channelId, const char* userAccount) = 0; /** Joins the channel with a user account. * @@ -7594,8 +7811,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - 0: Success. * - < 0: Failure. */ - virtual int joinChannelWithUserAccount(const char* token, const char* channelId, - const char* userAccount, const ChannelMediaOptions& options) = 0; + virtual int joinChannelWithUserAccount(const char* token, const char* channelId, const char* userAccount, const ChannelMediaOptions& options) = 0; /** Joins the channel with a user account. * @@ -7670,157 +7886,73 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 0: Failure. */ virtual int getUserInfoByUid(uid_t uid, rtc::UserInfo* userInfo) = 0; - /** Starts relaying media streams across channels or updates the channels for media relay. - * - * 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. - * - Contact sales-us@agora.io before implementing this function. - * - We do not support string user accounts in this API. - * - * @since v4.2.0 - * @param configuration The configuration of the media stream relay: - * ChannelMediaRelayConfiguration. - * - * @return - * - 0: Success. - * - < 0: Failure. - * - -1(ERR_FAILED): A general error occurs (no specified reason). - * - -2(ERR_INVALID_ARGUMENT): The argument is invalid. - * - -5(ERR_REFUSED): The request is rejected. - * - -8(ERR_INVALID_STATE): The current status is invalid, only allowed to be called when the role is the broadcaster. - */ - virtual int startOrUpdateChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) = 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. - * - * @deprecated v4.2.0 Use `startOrUpdateChannelMediaRelay` instead. - * @param configuration The configuration of the media stream relay: - * ChannelMediaRelayConfiguration. - * - * @return - * - 0: Success. - * - < 0: Failure. - * - -1(ERR_FAILED): A general error occurs (no specified reason). - * - -2(ERR_INVALID_ARGUMENT): The argument is invalid. - * - -5(ERR_REFUSED): The request is rejected. - * - -8(ERR_INVALID_STATE): The current status is invalid, only allowed to be called when the role is the broadcaster. - */ - virtual int startChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) __deprecated = 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. - * - * @deprecated v4.2.0 Use `startOrUpdateChannelMediaRelay` instead. - * @param configuration The media stream relay configuration: - * ChannelMediaRelayConfiguration. - * - * @return - * - 0: Success. - * - < 0: Failure. - * - -1(ERR_FAILED): A general error occurs (no specified reason). - * - -2(ERR_INVALID_ARGUMENT): The argument is invalid. - * - -5(ERR_REFUSED): The request is rejected. - * - -7(ERR_NOT_INITIALIZED): cross channel media streams are not relayed. - */ - virtual int updateChannelMediaRelay(const ChannelMediaRelayConfiguration &configuration) __deprecated = 0; + /** Starts relaying media streams across channels or updates the channels for media relay. + * + * After a successful method call, the SDK triggers the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback, and this callback return the state of the media stream relay. + * - If the + * \ref agora::rtc::IRtcEngineEventHandler::onChannelMediaRelayStateChanged + * "onChannelMediaRelayStateChanged" callback returns + * #RELAY_STATE_RUNNING (2) and #RELAY_OK (0), 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. + * - Contact sales-us@agora.io before implementing this function. + * - We do not support string user accounts in this API. + * + * @since v4.2.0 + * @param configuration The configuration of the media stream relay: + * ChannelMediaRelayConfiguration. + * + * @return + * - 0: Success. + * - < 0: Failure. + * - -1(ERR_FAILED): A general error occurs (no specified reason). + * - -2(ERR_INVALID_ARGUMENT): The argument is invalid. + * - -5(ERR_REFUSED): The request is rejected. + * - -8(ERR_INVALID_STATE): The current status is invalid, only allowed to be called when the role is the broadcaster. + **/ + virtual int startOrUpdateChannelMediaRelay(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. - * - -1(ERR_FAILED): A general error occurs (no specified reason). - * - -2(ERR_INVALID_ARGUMENT): The argument is invalid. - * - -5(ERR_REFUSED): The request is rejected. - * - -7(ERR_NOT_INITIALIZED): cross channel media streams are not relayed. - */ + /** 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. + * - -1(ERR_FAILED): A general error occurs (no specified reason). + * - -2(ERR_INVALID_ARGUMENT): The argument is invalid. + * - -5(ERR_REFUSED): The request is rejected. + * - -7(ERR_NOT_INITIALIZED): cross channel media streams are not relayed. + */ virtual int stopChannelMediaRelay() = 0; - /** pause the channels for media stream relay. * @return * - 0: Success. @@ -7942,6 +8074,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 0: Failure. */ virtual int configRhythmPlayer(const AgoraRhythmPlayerConfig& config) = 0; + /** * Takes a snapshot of a video stream. * @@ -7972,6 +8105,7 @@ class IRtcEngine : public agora::base::IEngineBase { * - < 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. @@ -8051,7 +8185,7 @@ class IRtcEngine : public agora::base::IEngineBase { - 0: Success - < 0: Failure */ - virtual int setAdvancedAudioOptions(AdvancedAudioOptions &options, int sourceType = 0) = 0; + 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 @@ -8177,20 +8311,27 @@ class IRtcEngine : public agora::base::IEngineBase { */ virtual uint64_t getNtpWallTimeInMs() = 0; -}; - -class AAudioDeviceManager : public agora::util::AutoPtr { - public: - AAudioDeviceManager(IRtcEngine* engine) { - queryInterface(engine, AGORA_IID_AUDIO_DEVICE_MANAGER); - } -}; + /** + * @brief Whether the target feature is available for the device. + * @since v4.3.0 + * @param type The feature type. See FeatureType. + * @return + * - true: available. + * - false: not available. + */ + virtual bool isFeatureAvailableOnDevice(FeatureType type) = 0; -class AVideoDeviceManager : public agora::util::AutoPtr { - public: - AVideoDeviceManager(IRtcEngine* engine) { - queryInterface(engine, AGORA_IID_VIDEO_DEVICE_MANAGER); - } + /** + * @brief send audio metadata + * @since v4.3.1 + * @param metadata The pointer of metadata + * @param length Size of metadata + * @return + * - 0: success + * - <0: failure + * @technical preview + */ + virtual int sendAudioMetadata(const char* metadata, size_t length) = 0; }; // The following types are either deprecated or not implmented yet. @@ -8214,6 +8355,11 @@ enum MEDIA_DEVICE_STATE_TYPE { /** 2: The device is disabled. */ MEDIA_DEVICE_STATE_DISABLED = 2, + + /** 3: The device is plugged in. + */ + MEDIA_DEVICE_STATE_PLUGGED_IN = 3, + /** 4: The device is not present. */ MEDIA_DEVICE_STATE_NOT_PRESENT = 4, @@ -8367,6 +8513,20 @@ enum VIDEO_PROFILE_TYPE { VIDEO_PROFILE_DEFAULT = VIDEO_PROFILE_LANDSCAPE_360P, }; +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); + } +}; + } // namespace rtc } // namespace agora diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtcEngineEx.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRtcEngineEx.h similarity index 92% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtcEngineEx.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRtcEngineEx.h index afeaf45c..099de84d 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraRtcEngineEx.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraRtcEngineEx.h @@ -91,6 +91,7 @@ class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { using IRtcEngineEventHandler::onNetworkTypeChanged; using IRtcEngineEventHandler::onEncryptionError; using IRtcEngineEventHandler::onUploadLogResult; + using IRtcEngineEventHandler::onUserInfoUpdated; using IRtcEngineEventHandler::onUserAccountUpdated; using IRtcEngineEventHandler::onAudioSubscribeStateChanged; using IRtcEngineEventHandler::onVideoSubscribeStateChanged; @@ -98,6 +99,9 @@ class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { using IRtcEngineEventHandler::onVideoPublishStateChanged; using IRtcEngineEventHandler::onSnapshotTaken; using IRtcEngineEventHandler::onVideoRenderingTracingResult; + using IRtcEngineEventHandler::onSetRtmFlagResult; + using IRtcEngineEventHandler::onTranscodedStreamLayoutInfo; + using IRtcEngineEventHandler::onAudioMetadataReceived; virtual const char* eventHandlerType() const { return "event_handler_ex"; } @@ -314,40 +318,6 @@ class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { (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. * @@ -762,13 +732,13 @@ class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { * * @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. + * @param reason The reason information of the local audio. + * See #LOCAL_AUDIO_STREAM_REASON. */ - virtual void onLocalAudioStateChanged(const RtcConnection& connection, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR error) { + virtual void onLocalAudioStateChanged(const RtcConnection& connection, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_REASON reason) { (void)connection; (void)state; - (void)error; + (void)reason; } /** Occurs when the remote audio state changes. @@ -976,6 +946,7 @@ class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { (void)success; (void)reason; } + /** * Occurs when the user account is updated. * @@ -983,10 +954,10 @@ class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { * @param remoteUid The user ID. * @param userAccount The user account. */ - virtual void onUserAccountUpdated(const RtcConnection& connection, uid_t remoteUid, const char* userAccount){ + virtual void onUserAccountUpdated(const RtcConnection& connection, uid_t remoteUid, const char* remoteUserAccount){ (void)connection; (void)remoteUid; - (void)userAccount; + (void)remoteUserAccount; } /** Reports the result of taking a video snapshot. @@ -1027,6 +998,48 @@ class IRtcEngineEventHandlerEx : public IRtcEngineEventHandler { (void)currentEvent; (void)tracingInfo; } + + /** + * Occurs when receive use rtm response. + * + * @param connection The RtcConnection object. + * @param code The error code: + */ + virtual void onSetRtmFlagResult(const RtcConnection& connection, int code) { + (void)connection; + (void)code; + } + /** + * Occurs when receive a video transcoder stream which has video layout info. + * + * @param connection The RtcConnection object. + * @param uid user id of the transcoded stream. + * @param width width of the transcoded stream. + * @param height height of the transcoded stream. + * @param layoutCount count of layout info in the transcoded stream. + * @param layoutlist video layout info list of the transcoded stream. + */ + 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; + } + + /** + * The audio metadata received. + * + * @param connection The RtcConnection object. + * @param uid ID of the remote user. + * @param metadata The pointer of metadata + * @param length Size of metadata + * @technical preview + */ + virtual void onAudioMetadataReceived(const RtcConnection& connection, uid_t uid, const char* metadata, size_t length) { + (void)metadata; + (void)length; + } }; class IRtcEngineEx : public IRtcEngine { @@ -1488,7 +1501,7 @@ class IRtcEngineEx : public IRtcEngine { * - 0: Success. * - < 0: Failure. */ - virtual int adjustUserPlaybackSignalVolumeEx(unsigned int uid, int volume, const RtcConnection& connection) = 0; + virtual int adjustUserPlaybackSignalVolumeEx(uid_t uid, int volume, const RtcConnection& connection) = 0; /** Gets the current connection state of the SDK. @param connection The RtcConnection object. @@ -1561,7 +1574,7 @@ class IRtcEngineEx : public IRtcEngine { * - Returns 0: Success. * - < 0: Failure. */ - virtual int createDataStreamEx(int* streamId, DataStreamConfig& config, const RtcConnection& connection) = 0; + virtual int createDataStreamEx(int* streamId, const DataStreamConfig& config, const RtcConnection& connection) = 0; /** Sends a data stream. * * After calling \ref IRtcEngine::createDataStream "createDataStream", you can call @@ -1729,35 +1742,6 @@ class IRtcEngineEx : public IRtcEngine { */ virtual int startOrUpdateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) = 0; - /** Starts to relay media streams across channels. - * - * @deprecated v4.2.0 Use `startOrUpdateChannelMediaRelayEx` instead. - * @param configuration The configuration of the media stream relay:ChannelMediaRelayConfiguration. - * @param connection RtcConnection. - * @return - * - 0: Success. - * - < 0: Failure. - * - -1(ERR_FAILED): A general error occurs (no specified reason). - * - -2(ERR_INVALID_ARGUMENT): The argument is invalid. - * - -5(ERR_REFUSED): The request is rejected. - * - -8(ERR_INVALID_STATE): The current status is invalid, only allowed to be called when the role is the broadcaster. - */ - virtual int startChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) __deprecated = 0; - - /** Updates the channels for media stream relay - * @deprecated v4.2.0 Use `startOrUpdateChannelMediaRelayEx` instead. - * @param configuration The media stream relay configuration: ChannelMediaRelayConfiguration. - * @param connection RtcConnection. - * @return - * - 0: Success. - * - < 0: Failure. - * - -1(ERR_FAILED): A general error occurs (no specified reason). - * - -2(ERR_INVALID_ARGUMENT): The argument is invalid. - * - -5(ERR_REFUSED): The request is rejected. - * - -7(ERR_NOT_INITIALIZED): cross channel media streams are not relayed. - */ - virtual int updateChannelMediaRelayEx(const ChannelMediaRelayConfiguration& configuration, const RtcConnection& connection) __deprecated = 0; - /** Stops the media stream relay. * * Once the relay stops, the host quits all the destination @@ -1861,6 +1845,24 @@ class IRtcEngineEx : public IRtcEngine { virtual int setDualStreamModeEx(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& streamConfig, const RtcConnection& connection) = 0; + + /** + * Set the multi-layer video stream configuration. + * + * If multi-layer is configed, the subscriber can choose to receive the coresponding layer + * of video stream using {@link setRemoteVideoStreamType setRemoteVideoStreamType}. + * + * @param simulcastConfig + * - The configuration for multi-layer video stream. It includes seven layers, ranging from + * STREAM_LAYER_1 to STREAM_LOW. A maximum of 3 layers can be enabled simultaneously. + * @param connection The RtcConnection object. + * @return + * - 0: Success. + * - < 0: Failure. + * @technical preview + */ + virtual int setSimulcastConfigEx(const SimulcastConfig& simulcastConfig, + const RtcConnection& connection) = 0; /** * Set the high priority user list and their fallback level in weak network condition. @@ -1913,6 +1915,18 @@ class IRtcEngineEx : public IRtcEngine { */ virtual int takeSnapshotEx(const RtcConnection& connection, uid_t uid, const char* filePath) = 0; + /** Enables video screenshot and upload with the connection ID. + @param enabled Whether to enable video screenshot and upload: + - `true`: Yes. + - `false`: No. + @param config The configuration for video screenshot and upload. + @param connection The connection information. See RtcConnection. + @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 @@ -1930,6 +1944,48 @@ class IRtcEngineEx : public IRtcEngine { - -7(ERR_NOT_INITIALIZED): The SDK is not initialized. Initialize the `IRtcEngine` instance before calling this method. */ virtual int startMediaRenderingTracingEx(const RtcConnection& connection) = 0; + + /** Provides the technical preview functionalities or special customizations by configuring the SDK with JSON options. + @since v4.3.0 + @param connection The connection information. See RtcConnection. + @param parameters Pointer to the set parameters in a JSON string. + @return + - 0: Success. + - < 0: Failure. + */ + virtual int setParametersEx(const RtcConnection& connection, const char* parameters) = 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; + + /** + * send audio metadata + * @since v4.3.1 + * @param connection The RtcConnection object. + * @param metadata The pointer of metadata + * @param length Size of metadata + * @return + * - 0: success + * - <0: failure + * @technical preview + */ + virtual int sendAudioMetadataEx(const RtcConnection& connection, const char* metadata, size_t length) = 0; }; } // namespace rtc diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraSpatialAudio.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraSpatialAudio.h similarity index 92% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraSpatialAudio.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraSpatialAudio.h index 35f9a2e8..1c966322 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAgoraSpatialAudio.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAgoraSpatialAudio.h @@ -4,8 +4,7 @@ // Copyright (c) 2019 Agora.io. All rights reserved. // -#ifndef AGORA_SPATIAL_AUDIO_H -#define AGORA_SPATIAL_AUDIO_H +#pragma once #include #include "AgoraBase.h" @@ -22,7 +21,6 @@ struct RemoteVoicePositionInfo { 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 { @@ -44,7 +42,6 @@ struct SpatialAudioZone { float upLength; //the audio attenuation of zone float audioAttenuation; - SpatialAudioZone() = default; }; /** The definition of LocalSpatialAudioConfig @@ -60,15 +57,93 @@ struct LocalSpatialAudioConfig { /** The IBaseSpatialAudioEngine class provides the common methods of ICloudSpatialAudioEngine and ILocalSpatialAudioEngine. */ -class IBaseSpatialAudioEngine: public RefCountInterface { +class ILocalSpatialAudioEngine: public RefCountInterface { protected: - virtual ~IBaseSpatialAudioEngine() {} + virtual ~ILocalSpatialAudioEngine() {} public: /** * Releases all the resources occupied by spatial audio engine. */ virtual void release() = 0; + + /** + * 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. It's supposed to use with IRtcEngineEx::joinChannelEx. + * + * @return + * - 0: Success. + * - <0: Failure. + */ + virtual int clearRemotePositionsEx(const RtcConnection& connection) = 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(const float position[3], const float axisForward[3], const float axisRight[3], const float axisUp[3], const RtcConnection& connection) = 0; + /** * This method sets the maximum number of streams that a player can receive in a * specified audio reception range. @@ -136,24 +211,7 @@ class IBaseSpatialAudioEngine: public RefCountInterface { * - 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; - + virtual int updateSelfPosition(const float position[3], const float axisForward[3], const float axisRight[3], const float axisUp[3]) = 0; /** * Updates the position of a media player in scene. This method has same behavior both in ICloudSpatialAudioEngine and ILocalSpatialAudioEngine. * @@ -196,28 +254,7 @@ class IBaseSpatialAudioEngine: public RefCountInterface { * - <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. * @@ -228,65 +265,29 @@ class IBaseSpatialAudioEngine: public RefCountInterface { * - <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; + virtual int setRemoteAudioAttenuation(uid_t uid, double attenuation, bool forceSet) = 0; + /** - * Remove the position information of remote user. You should call it when remote user called IRtcEngine::leaveChannel. + * Setting up sound Space * - * @param uid The remote user ID. It should be the same as RTC channel remote user id. + * @param zones The Sound space array + * @param zoneCount the sound Space count of array * @return * - 0: Success. * - <0: Failure. */ - virtual int removeRemotePosition(uid_t uid) = 0; + virtual int setZones(const SpatialAudioZone *zones, unsigned int zoneCount) = 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. + * 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 removeRemotePositionEx(uid_t uid, const RtcConnection& connection) = 0; + virtual int setPlayerAttenuation(int playerId, double attenuation, bool forceSet) = 0; /** * Clear the position informations of remote users. * @@ -294,21 +295,8 @@ class ILocalSpatialAudioEngine : public IBaseSpatialAudioEngine { * - 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; + virtual int clearRemotePositions() = 0; }; } // namespace rtc } // namespace agora - -#endif diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAudioDeviceManager.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAudioDeviceManager.h similarity index 82% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAudioDeviceManager.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAudioDeviceManager.h index f192020e..ab3cfe5b 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/IAudioDeviceManager.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/IAudioDeviceManager.h @@ -50,6 +50,20 @@ class IAudioDeviceCollection { virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * Gets the information of a specified audio device. + * @note + * @param index An input parameter that specifies the audio device. + * @param deviceName An output parameter that indicates the device name. + * @param deviceTypeName An output parameter that indicates the device type name. such as Built-in, USB, HDMI, etc. (MacOS only) + * @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 deviceTypeName[MAX_DEVICE_ID_LENGTH], + char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + /** * Specifies a device with the device ID. * @param deviceId The device ID. @@ -71,6 +85,19 @@ class IAudioDeviceCollection { */ virtual int getDefaultDevice(char deviceName[MAX_DEVICE_ID_LENGTH], 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 deviceTypeName The device type name of the the system default audio device, such as Built-in, USB, HDMI, etc. (MacOS only) + * @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 deviceTypeName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; + /** * Sets the volume of the app. * @@ -199,6 +226,17 @@ class IAudioDeviceManager : public RefCountInterface { virtual int getPlaybackDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], char deviceName[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * Gets the device ID and device name and device type 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. + * @param deviceTypeName An output parameter that specifies the device type name. such as Built-in, USB, HDMI, etc. (MacOS only) + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getPlaybackDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], char deviceName[MAX_DEVICE_ID_LENGTH], char deviceTypeName[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 @@ -254,6 +292,18 @@ class IAudioDeviceManager : public RefCountInterface { virtual int getRecordingDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], char deviceName[MAX_DEVICE_ID_LENGTH]) = 0; + /** + * Gets the device ID and device name and device type name of the audio recording device. + * + * @param deviceId An output parameter that indicates the device id. + * @param deviceName An output parameter that indicates the device name. + * @param deviceTypeName An output parameter that indicates the device type name. such as Built-in, USB, HDMI, etc. (MacOS only) + * @return + * - 0: Success. + * - < 0: Failure. + */ + virtual int getRecordingDeviceInfo(char deviceId[MAX_DEVICE_ID_LENGTH], char deviceName[MAX_DEVICE_ID_LENGTH], char deviceTypeName[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, diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp.h new file mode 100644 index 00000000..4f4c42ca --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp.h @@ -0,0 +1,14 @@ +/** + * + * Agora Real Time Engagement + * Copyright (c) 2024 Agora IO. All rights reserved. + * + */ +#pragma once + +#include "rte_cpp_error.h" // IWYU pragma: export +#include "rte_cpp_player.h" // IWYU pragma: export +#include "rte_cpp_rte.h" // IWYU pragma: export +#include "rte_cpp_canvas.h" // IWYU pragma: export +#include "rte_cpp_string.h" // IWYU pragma: export +#include "rte_cpp_callback_utils.h" // IWYU pragma: export diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_callback_utils.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_callback_utils.h new file mode 100644 index 00000000..48d9d545 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_callback_utils.h @@ -0,0 +1,132 @@ +#pragma once +#include +#include "rte_cpp_error.h" +#include "internal/c/handle.h" + +namespace rte { + +template +class SingleUseCallback { + public: + + using CallbackType = std::function; + + SingleUseCallback(){}; + + void Store(T* self, CallbackType cb, void* cb_data){ + self_ = self; + cb_ = cb; + cb_data_ = cb_data; + } + + void Invoke(RteError* err){ + if(cb_ != nullptr){ + cb_(self_, cb_data_, err); + + self_ = nullptr; + cb_ = nullptr; + cb_data_ = nullptr; + } + } + + bool Invalid(){ + return cb_ == nullptr; + } + + CallbackType cb_; + void* cb_data_; + T* self_; +}; // class SingleUseCallback + +template +class CallbackContext { + public: + + using CallbackType = std::function; + using CallbackTypeWithCppError = std::function; + + CallbackContext(T* self, CallbackType cb, void* cb_data) + :self_(self), cb_(cb), cb_data_(cb_data) {} + + CallbackContext(T* self, CallbackTypeWithCppError cb, void* cb_data) + :self_(self), cb_with_cpp_error_(cb), cb_data_(cb_data) {} + + CallbackType cb_; + CallbackTypeWithCppError cb_with_cpp_error_; + void* cb_data_; + T* self_; +}; + +template +void CallbackFunc(FromeType* self, void* cb_data, RteError* err){ + auto *ctx = static_cast*>(cb_data); + + if(ctx->cb_with_cpp_error_ != nullptr){ + rte::Error cpp_err(err); + ctx->cb_with_cpp_error_( self != nullptr ? ctx->self_ : nullptr, ctx->cb_data_, &cpp_err); + } + + if(ctx->cb_ != nullptr){ + ctx->cb_(self != nullptr ? ctx->self_ : nullptr, ctx->cb_data_, err); + } + + delete ctx; +} + +template +class CallbackContextWithArgs { + public: + + using CallbackType = std::function; + using CallbackTypeWithCppError = std::function; + + CallbackContextWithArgs(T* self, CallbackType cb, void* cb_data) + :self_(self), cb_(cb), cb_data_(cb_data) {} + + CallbackContextWithArgs(T* self, CallbackTypeWithCppError cb, void* cb_data) + :self_(self), cb_with_cpp_error_(cb), cb_data_(cb_data) {} + + CallbackType cb_; + CallbackTypeWithCppError cb_with_cpp_error_; + void* cb_data_; + T* self_; +}; + +template +void CallbackFuncWithArgs(FromeType* self, Args... args, void* cb_data, RteError* err){ + auto *ctx = static_cast*>(cb_data); + + if(ctx->cb_with_cpp_error_ != nullptr){ + Error cpp_err(err); + ctx->cb_with_cpp_error_(ctx->self_, args..., ctx->cb_data_, &cpp_err); + } + + if(ctx->cb_ != nullptr){ + ctx->cb_(ctx->self_, args..., ctx->cb_data_, err); + } + delete ctx; +} + +template +class ObserverDestroyContext { + public: + + using ObserverDestroyer = std::function; + + ObserverDestroyContext(ObserverDestroyer destroyer, void* cb_data) + :destroyer_(destroyer), cb_data_(cb_data) {} + + ObserverDestroyer destroyer_; + void* cb_data_; +}; + +template +void ObserverDestroyProxy(FromeType* observer, void* cb_data){ + auto *ctx = static_cast*>(cb_data); + if(ctx->destroyer_ != nullptr){ + ctx->destroyer_(static_cast(observer->base_observer.me_in_target_lang), ctx->cb_data_); + } + delete ctx; +} + +} // namespace rte diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_canvas.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_canvas.h new file mode 100644 index 00000000..b5635c46 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_canvas.h @@ -0,0 +1,109 @@ +#pragma once + +#include "internal/c/c_player.h" +#include "internal/c/handle.h" +#include "internal/c/track/canvas.h" + +#include "rte_cpp_error.h" +#include "rte_cpp_rte.h" +#include "rte_cpp_callback_utils.h" + + +namespace rte { + +using VideoRenderMode = ::RteVideoRenderMode; +using VideoMirrorMode = ::RteVideoMirrorMode; +using ViewConfig = ::RteViewConfig; +using View = ::RteView; +using Rect = ::RteRect; + +class CanvasInitialConfig { + public: + CanvasInitialConfig() {RteCanvasInitialConfigInit(&c_canvas_initial_config, nullptr);} + ~CanvasInitialConfig() {RteCanvasInitialConfigDeinit(&c_canvas_initial_config, nullptr);} + + private: + friend class Canvas; + ::RteCanvasInitialConfig c_canvas_initial_config; +}; + + +class CanvasConfig { + public: + CanvasConfig() {RteCanvasConfigInit(&c_canvas_config, nullptr);} + ~CanvasConfig() {RteCanvasConfigDeinit(&c_canvas_config, nullptr);} + + void SetRenderMode(VideoRenderMode mode, Error *err) { + RteCanvasConfigSetVideoRenderMode(&c_canvas_config, mode, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + VideoRenderMode GetRenderMode(Error *err) { + VideoRenderMode mode; + RteCanvasConfigGetVideoRenderMode(&c_canvas_config, &mode, err != nullptr ? err->get_underlying_impl() : nullptr); + return mode; + } + + void SetMirrorMode(VideoMirrorMode mode, Error *err) { + RteCanvasConfigSetVideoMirrorMode(&c_canvas_config, mode, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + VideoMirrorMode GetMirrorMode(Error *err) { + VideoMirrorMode mode; + RteCanvasConfigGetVideoMirrorMode(&c_canvas_config, &mode, err != nullptr ? err->get_underlying_impl() : nullptr); + return mode; + } + + void SetCropArea(RteRect &crop_area, Error *err) { + RteCanvasConfigSetCropArea(&c_canvas_config, crop_area, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + RteRect GetCropArea(Error *err) { + RteRect crop_area; + RteCanvasConfigGetCropArea(&c_canvas_config, &crop_area, err != nullptr ? err->get_underlying_impl() : nullptr); + return crop_area; + } + + private: + friend class Canvas; + ::RteCanvasConfig c_canvas_config; +}; + +class Canvas { + public: + Canvas(Rte *rte, CanvasInitialConfig *initial_config) { + c_canvas = ::RteCanvasCreate(&rte->c_rte, &initial_config->c_canvas_initial_config, nullptr); + }; + ~Canvas() { RteCanvasDestroy(&c_canvas, nullptr); }; + + void Destroy(Error *err = nullptr) { + RteCanvasDestroy(&c_canvas, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + Canvas(const Canvas& other) = delete; + Canvas(Canvas&& other) = delete; + Canvas& operator=(const Canvas& other) = delete; + Canvas& operator=(Canvas&& other) = delete; + + void GetConfigs(CanvasConfig *config, Error *err) { + RteCanvasGetConfigs(&c_canvas, &config->c_canvas_config, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + void SetConfigs(CanvasConfig *config, std::function cb, void *cb_data) { + CallbackContext* callbackCtx = new CallbackContext(this, cb, cb_data); + RteCanvasSetConfigs(&c_canvas, &config->c_canvas_config, &CallbackFunc<::RteCanvas, Canvas>, callbackCtx); + } + + void AddView(View *view, ViewConfig *config, std::function cb, void *cb_data) { + CallbackContextWithArgs *ctx = new CallbackContextWithArgs(this, cb, cb_data); + RteCanvasAddView(&c_canvas, view, config, &CallbackFuncWithArgs<::RteCanvas, Canvas, View*>, ctx); + } + + private: + + friend class Player; + + ::RteCanvas c_canvas; +}; + +} // namespace rte \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_error.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_error.h new file mode 100644 index 00000000..4016f9c7 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_error.h @@ -0,0 +1,67 @@ +/** + * + * Agora Real Time Engagement + * Copyright (c) 2024 Agora IO. All rights reserved. + * + */ +#pragma once + +#include +#include + +#include "internal/c/c_error.h" +#include "internal/c/utils/string.h" + +namespace rte { + + +class Rte; +class Player; +class Canvas; +class Config; +class PlayerConfig; +class CanvasConfig; + +class Error { + public: + + using ErrorCode = ::RteErrorCode; + + Error() : c_error(RteErrorCreate()) {} + explicit Error(::RteError *error) : c_error(error), c_error_owned(false) {} + + ~Error() { + if (c_error != nullptr && c_error_owned) { + RteErrorDestroy(c_error); + } + } + + // @{ + Error(Error &other) = delete; + Error(Error &&other) = delete; + Error &operator=(const Error &cmd) = delete; + Error &operator=(Error &&cmd) = delete; + // @} + + void Set(ErrorCode code, const char *message) { + RteErrorSet(c_error, code, "%s", message); + } + + ErrorCode Code() const { return c_error != nullptr ? c_error->code : kRteErrorDefault; } + + const char *Message() const { + if(c_error != nullptr && c_error->message != nullptr){ + return RteStringCStr(c_error->message, nullptr); + } + return ""; + } + + ::RteError *get_underlying_impl() const { return c_error; } + + private: + + ::RteError *c_error; + bool c_error_owned = true; +}; + +} // namespace rte diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_player.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_player.h new file mode 100644 index 00000000..1c3c7138 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_player.h @@ -0,0 +1,443 @@ +/** + * + * Agora Real Time Engagement + * Copyright (c) 2024 Agora IO. All rights reserved. + * + */ +#pragma once +#include + +#include "internal/c/c_rte.h" +#include "internal/c/c_player.h" + +#include "rte_cpp_error.h" +#include "rte_cpp_callback_utils.h" +#include "rte_cpp_canvas.h" +#include "rte_cpp_string.h" +#include "rte_cpp_stream.h" + +struct RtePlayerObserver; + +namespace rte { + + +using PlayerState = ::RtePlayerState; +using PlayerEvent = ::RtePlayerEvent; +using PlayerMetadataType = ::RtePlayerMetadataType; +using PlayerInfo = ::RtePlayerInfo; +using PlayerStats = ::RtePlayerStats; +using PlayerCustomSourceProvider = ::RtePlayerCustomSourceProvider; + +class PlayerInitialConfig {}; + +static void onStateChanged(::RtePlayerObserver *observer, + RtePlayerState old_state, RtePlayerState new_state, + RteError *err); + +static void onPositionChanged(::RtePlayerObserver *observer, uint64_t curr_time, + uint64_t utc_time); + +static void onResolutionChanged(::RtePlayerObserver *observer, int width, int height); + +static void onEvent(::RtePlayerObserver *observer, RtePlayerEvent event); + +static void onMetadata(::RtePlayerObserver *observer, RtePlayerMetadataType type, + const uint8_t *data, size_t length); + +static void onPlayerInfoUpdated(::RtePlayerObserver *observer, const RtePlayerInfo *info); + +static void onAudioVolumeIndication(::RtePlayerObserver *observer, int32_t volume); + + +class PlayerObserver { + public: + PlayerObserver() : c_rte_observer(::RtePlayerObserverCreate(nullptr)) { + + c_rte_observer->base_observer.me_in_target_lang = this; + + c_rte_observer->on_state_changed = rte::onStateChanged; + c_rte_observer->on_position_changed = rte::onPositionChanged; + c_rte_observer->on_resolution_changed = rte::onResolutionChanged; + c_rte_observer->on_event = rte::onEvent; + c_rte_observer->on_metadata = rte::onMetadata; + c_rte_observer->on_player_info_updated = rte::onPlayerInfoUpdated; + c_rte_observer->on_audio_volume_indication = rte::onAudioVolumeIndication; + } + virtual ~PlayerObserver(){ RtePlayerObserverDestroy(c_rte_observer, nullptr); } + + // @{ + PlayerObserver(PlayerObserver &other) = delete; + PlayerObserver(PlayerObserver &&other) = delete; + PlayerObserver &operator=(const PlayerObserver &cmd) = delete; + PlayerObserver &operator=(PlayerObserver &&cmd) = delete; + // @} + + virtual void onStateChanged(PlayerState old_state, PlayerState new_state, + rte::Error *err) = 0; + virtual void onPositionChanged(uint64_t curr_time, + uint64_t utc_time) = 0; + virtual void onResolutionChanged(int width, int height) = 0; + virtual void onEvent(PlayerEvent event) = 0; + virtual void onMetadata(PlayerMetadataType type, + const uint8_t *data, size_t length) = 0; + + virtual void onPlayerInfoUpdated(const PlayerInfo *info) = 0; + + virtual void onAudioVolumeIndication(int32_t volume) = 0; + + private: + friend class Player; + + ::RtePlayerObserver *c_rte_observer; +}; + +void onStateChanged(::RtePlayerObserver *observer, + RtePlayerState old_state, RtePlayerState new_state, + RteError *err){ + auto *player_observer = static_cast(observer->base_observer.me_in_target_lang); + if (player_observer != nullptr){ + Error cpp_err(err); + player_observer->onStateChanged(old_state, new_state, &cpp_err); + } +} +void onPositionChanged(::RtePlayerObserver *observer, uint64_t curr_time, + uint64_t utc_time){ + auto *player_observer = static_cast(observer->base_observer.me_in_target_lang); + if (player_observer != nullptr){ + player_observer->onPositionChanged(curr_time, utc_time); + } +} + +void onResolutionChanged(::RtePlayerObserver *observer, int width, int height){ + auto *player_observer = static_cast(observer->base_observer.me_in_target_lang); + if (player_observer != nullptr){ + player_observer->onResolutionChanged(width, height); + } +} + +void onEvent(::RtePlayerObserver *observer, RtePlayerEvent event){ + auto *player_observer = static_cast(observer->base_observer.me_in_target_lang); + if (player_observer != nullptr){ + player_observer->onEvent(event); + } + +} + +void onMetadata(::RtePlayerObserver *observer, RtePlayerMetadataType type, + const uint8_t *data, size_t length){ + auto *player_observer = static_cast(observer->base_observer.me_in_target_lang); + if (player_observer != nullptr){ + player_observer->onMetadata(type, data, length); + } +} + +void onPlayerInfoUpdated(::RtePlayerObserver *observer, const RtePlayerInfo *info){ + auto *player_observer = static_cast(observer->base_observer.me_in_target_lang); + if (player_observer != nullptr){ + player_observer->onPlayerInfoUpdated(info); + } +} + +void onAudioVolumeIndication(::RtePlayerObserver *observer, int32_t volume){ + auto *player_observer = static_cast(observer->base_observer.me_in_target_lang); + if (player_observer != nullptr){ + player_observer->onAudioVolumeIndication(volume); + } +} + +class PlayerConfig { + public: + PlayerConfig() { RtePlayerConfigInit(&c_rte_player_config, nullptr); } + ~PlayerConfig() { RtePlayerConfigDeinit(&c_rte_player_config, nullptr); } + + // @{ + PlayerConfig(PlayerConfig &other) = delete; + PlayerConfig(PlayerConfig &&other) = delete; + PlayerConfig &operator=(const PlayerConfig &cmd) = delete; + PlayerConfig &operator=(PlayerConfig &&cmd) = delete; + // @} + + void SetAutoPlay(bool auto_play, Error *err) { + RtePlayerConfigSetAutoPlay(&c_rte_player_config, auto_play, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + bool GetAutoPlay(Error *err) { + bool auto_play; + RtePlayerConfigGetAutoPlay(&c_rte_player_config, &auto_play, + err != nullptr ? err->get_underlying_impl() : nullptr); + return auto_play; + } + + void SetPlaybackSpeed(int32_t speed, Error *err) { + RtePlayerConfigSetPlaybackSpeed(&c_rte_player_config, speed, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetPlaybackSpeed(Error *err) { + int32_t speed; + RtePlayerConfigGetPlaybackSpeed(&c_rte_player_config, &speed, + err != nullptr ? err->get_underlying_impl() : nullptr); + return speed; + } + + void SetPlayoutAudioTrackIdx(int idx, Error *err) { + RtePlayerConfigSetPlayoutAudioTrackIdx(&c_rte_player_config, idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetPlayoutAudioTrackIdx(Error *err) { + int32_t idx; + RtePlayerConfigGetPlayoutAudioTrackIdx(&c_rte_player_config, &idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + return idx; + } + + void SetPublishAudioTrackIdx(int32_t idx, Error *err) { + RtePlayerConfigSetPublishAudioTrackIdx(&c_rte_player_config, idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetPublishAudioTrackIdx(Error *err) { + int32_t idx; + RtePlayerConfigGetPublishAudioTrackIdx(&c_rte_player_config, &idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + return idx; + } + + void SetAudioTrackIdx(int32_t idx, Error *err) { + RtePlayerConfigSetAudioTrackIdx(&c_rte_player_config, idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetAudioTrackIdx(Error *err) { + int32_t idx; + RtePlayerConfigGetAudioTrackIdx(&c_rte_player_config, &idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + return idx; + } + + void SetSubtitleTrackIdx(int32_t idx, Error *err) { + RtePlayerConfigSetSubtitleTrackIdx(&c_rte_player_config, idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetSubtitleTrackIdx(Error *err) { + int32_t idx; + RtePlayerConfigGetSubtitleTrackIdx(&c_rte_player_config, &idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + return idx; + } + + void SetExternalSubtitleTrackIdx(int32_t idx, Error *err) { + RtePlayerConfigSetExternalSubtitleTrackIdx(&c_rte_player_config, idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetExternalSubtitleTrackIdx(Error *err) { + int32_t idx; + RtePlayerConfigGetExternalSubtitleTrackIdx(&c_rte_player_config, &idx, + err != nullptr ? err->get_underlying_impl() : nullptr); + return idx; + } + + void SetAudioPitch(int32_t audio_pitch, Error *err) { + RtePlayerConfigSetAudioPitch(&c_rte_player_config, audio_pitch, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetAudioPitch(Error *err) { + int32_t audio_pitch; + RtePlayerConfigGetAudioPitch(&c_rte_player_config, &audio_pitch, + err != nullptr ? err->get_underlying_impl() : nullptr); + return audio_pitch; + } + + void SetPlayoutVolume(int32_t volume, Error *err) { + RtePlayerConfigSetPlayoutVolume(&c_rte_player_config, volume, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetPlayoutVolume(Error *err) { + int32_t volume; + RtePlayerConfigGetPlayoutVolume(&c_rte_player_config, &volume, + err != nullptr ? err->get_underlying_impl() : nullptr); + return volume; + } + + void SetAudioPlaybackDelay(int32_t delay, Error *err) { + RtePlayerConfigSetAudioPlaybackDelay(&c_rte_player_config, delay, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetAudioPlaybackDelay(Error *err) { + int32_t delay; + RtePlayerConfigGetAudioPlaybackDelay(&c_rte_player_config, &delay, + err != nullptr ? err->get_underlying_impl() : nullptr); + return delay; + } + + void SetAudioDualMonoMode(RteAudioDualMonoMode mode, Error *err) { + RtePlayerConfigSetAudioDualMonoMode(&c_rte_player_config, mode, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + RteAudioDualMonoMode GetAudioDualMonoMode(Error *err) { + RteAudioDualMonoMode mode; + RtePlayerConfigGetAudioDualMonoMode(&c_rte_player_config, &mode, + err != nullptr ? err->get_underlying_impl() : nullptr); + return mode; + } + + void SetPublishVolume(int32_t volume, Error *err) { + RtePlayerConfigSetPublishVolume(&c_rte_player_config, volume, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetPublishVolume(Error *err) { + int32_t volume; + RtePlayerConfigGetPublishVolume(&c_rte_player_config, &volume, + err != nullptr ? err->get_underlying_impl() : nullptr); + return volume; + } + + void SetLoopCount(int32_t count, Error *err) { + RtePlayerConfigSetLoopCount(&c_rte_player_config, count, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetLoopCount(Error *err) { + int32_t count; + RtePlayerConfigGetLoopCount(&c_rte_player_config, &count, + err != nullptr ? err->get_underlying_impl() : nullptr); + return count; + } + + void SetJsonParameter(const char *json_parameter, Error *err) { + String str(json_parameter); + RtePlayerConfigSetJsonParameter(&c_rte_player_config, str.get_underlying_impl(), + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + const char *GetJsonParameter(Error *err) { + String str; + RtePlayerConfigGetJsonParameter(&c_rte_player_config, str.get_underlying_impl(), + err != nullptr ? err->get_underlying_impl() : nullptr); + return str.Cstr(); + } + + private: + ::RtePlayerConfig* get_underlying_impl() { return &c_rte_player_config; } + + private: + friend class Player; + + ::RtePlayerConfig c_rte_player_config; +}; + + +class Player { + public: + explicit Player(Rte *self, PlayerInitialConfig *config = nullptr) + : c_rte(::RtePlayerCreate(&self->c_rte, nullptr, nullptr)) {}; + ~Player() { RtePlayerDestroy(&c_rte, nullptr); }; + + void Destroy(Error *err = nullptr){ + RtePlayerDestroy(&c_rte, err != nullptr ? err->get_underlying_impl() : nullptr); +}; + + Player(Player &other) = default; + Player(Player &&other) = default; + + // @{ + Player &operator=(const Player &cmd) = delete; + Player &operator=(Player &&cmd) = delete; + // @} + + void PreloadWithUrl(const char* url, Error* err) { + RtePlayerPreloadWithUrl(&c_rte, url, err != nullptr ? err->get_underlying_impl() : nullptr); + }; + + void OpenWithUrl(const char* url, uint64_t start_time, std::function cb, + void* cb_data) { + CallbackContext* callbackCtx = new CallbackContext(this, cb, cb_data); + RtePlayerOpenWithUrl(&c_rte, url, start_time, &CallbackFunc<::RtePlayer, Player>, callbackCtx); + }; + + void OpenWithCustomSourceProvider(PlayerCustomSourceProvider* provider, uint64_t start_time, + std::function cb, + void* cb_data) { + CallbackContext* callbackCtx = new CallbackContext(this, cb, cb_data); + RtePlayerOpenWithCustomSourceProvider(&c_rte, provider, start_time, &CallbackFunc<::RtePlayer, Player>, callbackCtx); + }; + + + void OpenWithStream(Stream* stream, std::function cb, + void* cb_data) { + CallbackContext* callbackCtx = new CallbackContext(this, cb, cb_data); + RtePlayerOpenWithStream(&c_rte, stream != nullptr ? &stream->c_rte_stream : nullptr, &CallbackFunc<::RtePlayer, Player>, callbackCtx); + }; + + void GetStats(std::function cb, void *cb_data){ + CallbackContextWithArgs *ctx = new CallbackContextWithArgs(this, cb, cb_data); + RtePlayerGetStats(&c_rte, &CallbackFuncWithArgs<::RtePlayer, Player, rte::PlayerStats*>, ctx); + } + + void SetCanvas(Canvas *canvas, Error *err) { + RtePlayerSetCanvas(&c_rte, canvas != nullptr ? &canvas->c_canvas : nullptr, err != nullptr ? err->get_underlying_impl() : nullptr); + }; + + void Play(Error* err) { + RtePlayerPlay(&c_rte, err != nullptr ? err->get_underlying_impl() : nullptr); + } + void Stop(Error* err) { + RtePlayerStop(&c_rte, err != nullptr ? err->get_underlying_impl() : nullptr); + } + void Pause(Error* err) { + RtePlayerPause(&c_rte, err != nullptr ? err->get_underlying_impl() : nullptr); + } + void Seek(uint64_t new_time, Error* err) { + RtePlayerSeek(&c_rte, new_time, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + void MuteAudio(bool mute, Error* err) { + RtePlayerMuteAudio(&c_rte, mute, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + void MuteVideo(bool mute, Error* err) { + RtePlayerMuteVideo(&c_rte, mute, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + uint64_t GetPosition(Error *err){ + return RtePlayerGetPosition(&c_rte, err != nullptr ? err->get_underlying_impl() : nullptr); + } + void GetInfo(PlayerInfo *info, Error *err){ + RtePlayerGetInfo(&c_rte, info, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + void GetConfigs(PlayerConfig* config, Error* err) { + RtePlayerGetConfigs(&c_rte, config->get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + } + + void SetConfigs(PlayerConfig* config, std::function cb, + void* cb_data) { + + rte::CallbackContext* callbackCtx = new CallbackContext(this, cb, cb_data); + RtePlayerSetConfigs(&c_rte, config->get_underlying_impl(), &CallbackFunc<::RtePlayer, Player>, callbackCtx); + } + + bool RegisterObserver(PlayerObserver *observer, Error *err) { + return RtePlayerRegisterObserver( + &c_rte, observer->c_rte_observer, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + void UnregisterObserver(PlayerObserver *observer, Error *err){ + RtePlayerUnregisterObserver(&c_rte, observer->c_rte_observer, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + private: + ::RtePlayer c_rte; +}; + +} // namespace rte diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_rte.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_rte.h new file mode 100644 index 00000000..95b32602 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_rte.h @@ -0,0 +1,218 @@ +/** + * + * Agora Real Time Engagement + * Copyright (c) 2024 Agora IO. All rights reserved. + * + */ +#pragma once + +#include "internal/c/c_rte.h" +#include "internal/c/bridge.h" + +#include "rte_cpp_error.h" +#include "rte_cpp_callback_utils.h" +#include "rte_cpp_string.h" + + +struct RteObserver; +struct RteInitialConfig; +struct RteConfig; + +namespace rte { + +class Player; + +class RteInitialConfig { + ::RteInitialConfig *c_rte_init_cfg; +}; + +class RteObserver { + public: + RteObserver(): c_rte_observer(::RteObserverCreate(nullptr)) { + c_rte_observer->base_observer.me_in_target_lang = this;} + ~RteObserver() { RteObserverDestroy(c_rte_observer, nullptr); } + + // @{ + RteObserver(RteObserver &other) = delete; + RteObserver(RteObserver &&other) = delete; + RteObserver &operator=(const RteObserver &cmd) = delete; + RteObserver &operator=(RteObserver &&cmd) = delete; + // @} + + private: + friend class Rte; + + ::RteObserver *c_rte_observer; +}; + +class Config { + public: + Config() {RteConfigInit(&c_rte_config, nullptr);} + ~Config() {RteConfigDeinit(&c_rte_config, nullptr);} + + // @{ + Config(Config &other) = delete; + Config(Config &&other) = delete; + Config &operator=(const Config &cmd) = delete; + Config &operator=(Config &&cmd) = delete; + // @} + + void SetAppId(const char *app_id, Error *err){ + String str(app_id); + RteConfigSetAppId(&c_rte_config, str.get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + } + + const char* GetAppId(Error *err){ + String str; + RteConfigGetAppId(&c_rte_config, str.get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + return str.Cstr(); + } + + void SetLogFolder(const char *log_folder, Error *err){ + String str(log_folder); + RteConfigSetLogFolder(&c_rte_config, str.get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + } + + const char* GetLogFolder(Error *err){ + String str; + RteConfigGetLogFolder(&c_rte_config, str.get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + return str.Cstr(); + } + + void SetLogFileSize(size_t log_file_size, Error *err){ + RteConfigSetLogFileSize(&c_rte_config, log_file_size, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + size_t GetLogFileSize(Error *err){ + size_t log_file_size; + RteConfigGetLogFileSize(&c_rte_config, &log_file_size, err != nullptr ? err->get_underlying_impl() : nullptr); + return log_file_size; + } + + void SetAreaCode(int32_t area_code, Error *err){ + RteConfigSetAreaCode(&c_rte_config, area_code, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + int32_t GetAreaCode(Error *err){ + int32_t area_code; + RteConfigGetAreaCode(&c_rte_config, &area_code, err != nullptr ? err->get_underlying_impl() : nullptr); + return area_code; + } + + void SetCloudProxy(const char *cloud_proxy, Error *err){ + String str(cloud_proxy); + RteConfigSetCloudProxy(&c_rte_config, str.get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + } + + const char* GetCloudProxy(Error *err){ + String str; + RteConfigGetCloudProxy(&c_rte_config, str.get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + return str.Cstr(); + } + + void SetJsonParameter(const char *json_parameter, Error *err){ + String str(json_parameter); + RteConfigSetJsonParameter(&c_rte_config, str.get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + } + + const char* GetJsonParameter(Error *err){ + String str; + RteConfigGetJsonParameter(&c_rte_config, str.get_underlying_impl(), err != nullptr ? err->get_underlying_impl() : nullptr); + return str.Cstr(); + } + + private: + ::RteConfig* get_underlying_impl() { return &c_rte_config; } + + private: + friend class Rte; + ::RteConfig c_rte_config; +}; + +class Rte { + public: + + static Rte GetFromBridge(Error* err = nullptr){ + Rte rte( RteGetFromBridge(err != nullptr ? err->get_underlying_impl() : nullptr)); + return rte; + } + + explicit Rte(::RteInitialConfig *config = nullptr): c_rte(::RteCreate(config, nullptr)) {} + ~Rte()=default; + + void Destroy(Error *err = nullptr) { + RteDestroy(&c_rte, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + bool RegisterObserver(RteObserver *observer, Error *err){ + return RteRegisterObserver(&c_rte, observer->c_rte_observer, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + bool UnregisterObserver(RteObserver *observer, Error *err){ + return RteUnregisterObserver(&c_rte, observer->c_rte_observer, + err != nullptr ? err->get_underlying_impl() : nullptr); + } + + bool InitMediaEngine(std::function cb, void *cb_data, Error *err = nullptr){ + auto* ctx = new CallbackContext(this, cb, cb_data); + return RteInitMediaEngine(&c_rte, &CallbackFunc<::Rte, Rte>, ctx, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + Rte(Rte &other) = default; + Rte(Rte &&other) = default; + + // @{ + Rte &operator=(const Rte &cmd) = delete; + Rte &operator=(Rte &&cmd) = delete; + // @} + + void GetConfigs(Config *config, Error *err){ + RteGetConfigs(&c_rte, config != nullptr ? config->get_underlying_impl(): nullptr, err != nullptr ? err->get_underlying_impl() : nullptr); + } + bool SetConfigs(Config *config, std::function cb, void *cb_data, Error *err = nullptr){ + CallbackContext* callbackCtx = new CallbackContext(this, cb, cb_data); + return RteSetConfigs(&c_rte, config != nullptr ? config->get_underlying_impl(): nullptr, &CallbackFunc<::Rte, Rte>, callbackCtx, err != nullptr ? err->get_underlying_impl() : nullptr); + } + + private: + + explicit Rte(::Rte other) { c_rte = other; } + + private: + friend class Player; + friend class Canvas; + + ::Rte c_rte; + +// struct RteInitMediaEngineCtx { +// RteInitMediaEngineCtx(InitMediaEngineCb cb, void *cb_data) +// : cb(cb), cb_data(cb_data) {} + +// ~RteInitMediaEngineCtx() = default; + +// // @{ +// RteInitMediaEngineCtx(RteInitMediaEngineCtx &other) = delete; +// RteInitMediaEngineCtx(RteInitMediaEngineCtx &&other) = delete; +// RteInitMediaEngineCtx &operator=(const RteInitMediaEngineCtx &cmd) = delete; +// RteInitMediaEngineCtx &operator=(RteInitMediaEngineCtx &&cmd) = delete; +// // @} + +// InitMediaEngineCb cb; +// void *cb_data; +// }; + +// static void RteInitMediaEngineCtxProxy(::Rte *self, void *cb_data, +// ::RteError *err){ +// auto *ctx = static_cast(cb_data); + +// Rte rte; +// rte.c_rte = *self; + +// Error cpp_err(err); +// ctx->cb(&rte, ctx->cb_data, &cpp_err); + +// delete ctx; +// } +}; + +} // namespace rte diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_stream.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_stream.h new file mode 100644 index 00000000..bc3df3fd --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_stream.h @@ -0,0 +1,25 @@ +/** + * + * Agora Real Time Engagement + * Copyright (c) 2024 Agora IO. All rights reserved. + * + */ +#pragma once +#include "internal/c/stream/stream.h" + +namespace rte { + +class Stream { + + public: + Stream() = default; + ~Stream() = default; + + private: + friend class Rte; + friend class Player; + + ::RteStream c_rte_stream; +}; + +} // namespace rte \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_string.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_string.h new file mode 100644 index 00000000..be4642f9 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/rte_cpp_string.h @@ -0,0 +1,61 @@ +/** + * + * Agora Real Time Engagement + * Copyright (c) 2024 Agora IO. All rights reserved. + * + */ +#pragma once +#include "internal/c/utils/string.h" + +namespace rte { + +class Config; +class PlayerConfig; + +class String { + public: + + String(){ + c_rte_string = RteStringCreate(nullptr); + RteStringInit(c_rte_string, nullptr); + } + + String(const char* str) { + c_rte_string = RteStringCreate(nullptr); + RteStringInit(c_rte_string, nullptr); + if(nullptr != str){ + RteStringInitWithCStr(c_rte_string, str, nullptr); + } + } + + ~String() { + RteStringDeinit(c_rte_string, nullptr); + RteStringDestroy(c_rte_string, nullptr); + } + + void Format(const char* fmt, ...) { + va_list args; + va_start(args, fmt); + RteStringInitWithValue(c_rte_string, nullptr, fmt, args); + va_end(args); + } + + void Copy(const String &other) { + RteStringCopy(c_rte_string, other.c_rte_string, nullptr); + } + + const char* Cstr() const { + return RteStringCStr(c_rte_string, nullptr); + } + + friend class Config; + friend class PlayerConfig; + + private: + ::RteString* get_underlying_impl() const { return c_rte_string; } + + private: + ::RteString *c_rte_string; +}; + +} // namespace rte diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/time_utils.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/time_utils.h similarity index 100% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/time_utils.h rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/include/time_utils.h diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/media_engine_i.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/media_engine_i.h deleted file mode 100644 index 1739cbe3..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/media_engine_i.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// Agora Media SDK -// -// Copyright (c) 2015 Agora IO. All rights reserved. -// - -#pragma once - -#include "api/video/video_frame.h" -#include "IAgoraMediaEngine.h" -#include "IAgoraRtcEngineEx.h" - -namespace agora { -namespace media { -namespace base { -class IVideoFrameObserverEx : public IVideoFrameObserver { - public: - virtual ~IVideoFrameObserverEx() {} - void onFrame(const VideoFrame* frame) final {} - bool isExternal() final { return false; } - virtual void onFrame(const webrtc::VideoFrame& frame) = 0; -}; -} - -/** - * The IVideoFrameObserverEx class. - */ -class IVideoFrameObserverEx : public IVideoFrameObserver { - public: - virtual ~IVideoFrameObserverEx() {} - - bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) final { return false; } - bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) final { return false; } - - bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, - VideoFrame& videoFrame) final { return false; } - bool onTranscodedVideoFrame(VideoFrame& videoFrame) final { return false; } - bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) final { return false; } - bool isExternal() final { return false; } - - virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, webrtc::VideoFrame& videoFrame) { return false; } - virtual bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, webrtc::VideoFrame& videoFrame) { return false; } - - virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, - webrtc::VideoFrame& videoFrame) { return false; } - virtual bool onTranscodedVideoFrame(webrtc::VideoFrame& videoFrame) { return false; } - virtual bool onMediaPlayerVideoFrame(webrtc::VideoFrame& videoFrame, int mediaPlayerId) { return false; } -}; - -/** - * The IMediaEngineEx class - */ -class IMediaEngineEx : public IMediaEngine { - public: - virtual int pushVideoFrameEx(const webrtc::VideoFrame& frame, unsigned int video_track_id = 0) = 0; - - virtual int enableDualStreamModeEx(bool enabled, const rtc::SimulcastStreamConfig& streamConfig, - const rtc::RtcConnection& connection) = 0; - /** - * Deprecated by IRtcEngine::setVideoEncoderConfiguration. - */ - virtual int setExternalVideoConfigEx(const rtc::VideoEncoderConfiguration& config) = 0; - virtual int setExternalVideoConfigEx(const rtc::VideoEncoderConfiguration& config, const rtc::RtcConnection& connection) = 0; - - protected: - ~IMediaEngineEx() override = default; -}; - -} // namespace media -} // namespace agora diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/media_player_i.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/media_player_i.h deleted file mode 100644 index 5840dff7..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/media_player_i.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// Agora SDK -// -// Copyright (c) 2020 Agora.io. All rights reserved. -// -#pragma once // NOLINT(build/header_guard) - -#include - -#include "IAgoraMediaPlayer.h" - -namespace agora { -namespace rtc { - -class IMediaPlayerEx: public IMediaPlayer { -public: - - virtual void release() = 0; - - static agora::agora_refptr Create( - media::base::MEDIA_PLAYER_SOURCE_TYPE type = - media::base::MEDIA_PLAYER_SOURCE_TYPE::MEDIA_PLAYER_SOURCE_DEFAULT); - - virtual agora_refptr getLocalAudioTrack() = 0; - - virtual agora_refptr getLocalVideoTrack() = 0; - - virtual int waitForOpenCompleted(int ms) = 0; - - virtual int stopAsync() = 0; - - virtual int enableMusicMode(bool enable) = 0; -}; - -class IMediaPlayerCacheManagerEx: public IMediaPlayerCacheManager{ - public: - static void SetRtcEngineInitialized(bool is_initialized); - - protected: - static std::atomic_bool is_rtc_engine_initialized_; -}; - -} //namespace rtc -} // namespace agora diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/metachat_service_i.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/metachat_service_i.h deleted file mode 100644 index 2b70089c..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/metachat_service_i.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Agora Rtc Engine SDK -// -// Copyright (c) 2022 Agora.io. All rights reserved. -// -#pragma once - -#include "meta_chat/IAgoraMetachat.h" - -namespace agora { -namespace rtc { -namespace metachat { - -class IMetachatSceneInternal: public IMetachatScene { -public: - virtual int addEventHandler(IMetachatSceneEventHandler* eventHandler, - void (*deleter)(IMetachatSceneEventHandler*)) = 0; -}; - -} -} -} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/rtc_engine_i.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/rtc_engine_i.h deleted file mode 100644 index 95f539ec..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraCppPlugin/rtc_engine_i.h +++ /dev/null @@ -1,451 +0,0 @@ -// -// Agora Media SDK -// -// Created by Sting Feng in 2015-05. -// Copyright (c) 2015 Agora IO. All rights reserved. -// -#pragma once - -#include -#include -#include -#include - -#include "AgoraBase.h" -#include "api2/NGIAgoraAudioDeviceManager.h" -#include "api2/NGIAgoraExtensionProvider.h" -#include "api2/AgoraRefCountedObject.h" -#include "api2/NGIAgoraRtcConnection.h" -#include "api2/internal/media_recorder_i.h" -#include "IAgoraRtcEngineEx.h" -#include "rtc/rtc_event.h" -#include "utils/thread/thread_pool.h" -#include "main/extension_event_handler.h" -#include "base/time_utils.h" - -#if defined(_WIN32) -extern HINSTANCE GetCurrentModuleInstance(); -#elif defined(__ANDROID__) || defined(__linux__) -#include -#endif // _WIN32 - -namespace agora { -namespace commons { -namespace cjson { -class JsonWrapper; -} // namespace cjson - -namespace network { -struct network_info_t; -} // namespace network -} // namespace commons - -namespace base { -class IParameterEngine { - public: - virtual int setParametersInternal(const char* parameters) = 0; - virtual int getParameters(const char* key, commons::cjson::JsonWrapper& result) = 0; - virtual ~IParameterEngine() {} -}; -} // namespace base - -namespace rtc { -struct VideoNetOptions; - -enum INTERFACE_ID_EX_TYPE { - AGORA_IID_RTC_ENGINE_EX = 0xacbd, -}; - -enum SCREEN_SHARING_MODE { SCREEN_SHARING_NORMAL = 0, SCREEN_SHARING_MOVIE = 1 }; - -#ifdef INTERNAL_ENGINE_STATUS -struct InternalEngineStatus { - int recfreq; - int playoutfreq; - int audio_send_frame_rate; - int audio_send_packet_rate; - int audio_recv_packet_rate; - int nearin_signal_level; - int nearout_signal_level; - int farin_signal_level; -}; -#endif // INTERNAL_ENGINE_STATUS - -enum class RecordingEventType : unsigned { - RECORDING_EVENT_UNKNOWN, - RECORDING_EVENT_START, - RECORDING_EVENT_JOIN = RECORDING_EVENT_START, - RECORDING_EVENT_LEAVE, - - RECORDING_EVENT_END = RECORDING_EVENT_LEAVE, -}; - -enum RecordingEventKeyIndex { - // Join event - RECORDING_JOIN_EVT_START = 1, - RECORDING_JOIN_EVT_MIXMODE = RECORDING_JOIN_EVT_START, - RECORDING_JOIN_EVT_MIXEDVIDEOAUDIOMODE = 2, - RECORDING_JOIN_EVT_MIXHIGH = 3, - RECORDING_JOIN_EVT_MIXLOW = 4, - RECORDING_JOIN_EVT_MIXFPS = 5, - RECORDING_JOIN_EVT_MIXKBPS = 6, - RECORDING_JOIN_EVT_MINUDPPORT = 7, - RECORDING_JOIN_EVT_MAXUDPPORT = 8, - RECORDING_JOIN_EVT_DECODEAUDIOTYPE = 9, - RECORDING_JOIN_EVT_DECODEVIDEOTYPE = 10, - RECORDING_JOIN_EVT_LIVEMODE = 11, - RECORDING_JOIN_EVT_IDLE = 12, - RECORDING_JOIN_EVT_AUDIOONLY = 13, - RECORDING_JOIN_EVT_VIDEOONLY = 14, // NEW INSERT - RECORDING_JOIN_EVT_SYSLOGFACILITY = 15, - RECORDING_JOIN_EVT_STREAMTYPE = 16, - RECORDING_JOIN_EVT_TRIGGERMODE = 17, - RECORDING_JOIN_EVT_LANGUAGE = 18, - RECORDING_JOIN_EVT_RESERVE1 = 19, - - // add new recording join event here ... - - MAX_RECORDING_JOIN_EVT_RESERVE15 = RECORDING_JOIN_EVT_RESERVE1 + 14, - RECORDING_JOIN_EVT_MAX = MAX_RECORDING_JOIN_EVT_RESERVE15, - - // Leave event - RECORDING_LEAVE_EVT_START = 101, - RECORDING_LEAVE_EVT_LEAVEPATHCODE = RECORDING_LEAVE_EVT_START, - RECORDING_LEAVE_EVT_RESERVE1, - - // add new recording leave event here ... - - RECORDING_LEAVE_EVT_RESERVE5 = RECORDING_LEAVE_EVT_RESERVE1 + 4, - RECORDING_LEAVE_EVT_MAX = RECORDING_LEAVE_EVT_RESERVE5, -}; - -/** - * The development type of app - */ -enum APP_TYPE { - APP_TYPE_INVALID_VALUE = -1, - APP_TYPE_NATIVE = 0, - APP_TYPE_COCOS = 1, - APP_TYPE_UNITY = 2, - APP_TYPE_ELECTRON = 3, - APP_TYPE_FLUTTER = 4, - APP_TYPE_UNREAL = 5, - APP_TYPE_XAMARIN = 6, - APP_TYPE_APICLOUD = 7, - APP_TYPE_REACT_NATIVE = 8, - APP_TYPE_PYTHON = 9, - APP_TYPE_COCOS_CREATOR = 10, - APP_TYPE_RUST = 11, - APP_TYPE_C_SHARP = 12, - APP_TYPE_CEF = 13, - APP_TYPE_UNI_APP = 14, -}; - -struct video_transport_packet_info { - uid_t uid; - unsigned int frame_num; - unsigned int sent_ts; - unsigned int ts; -}; - -struct audio_transport_packet_info { - uid_t uid; - unsigned int ts; - unsigned int sent_ts; -}; - -class IRtcAvTransportPacketInfoObserver { -public: - virtual ~IRtcAvTransportPacketInfoObserver() = default; - - virtual void onVideoTransportPacketInfo(const video_transport_packet_info& info) = 0; - virtual void onAudioTransportPacketInfo(const audio_transport_packet_info& info) = 0; -}; - -struct RtcEngineContextInternal : public RtcEngineContext { - bool isPassThruMode; - int maxOutputBitrateKpbs; - - // extension event observer - agora_refptr extensionObserver; - - // 0 for AGORA_CC, - // 1 for REMB - // 2 for TRANSPORT_CC - bool is_p2p_switch_enabled_; - - RtcEngineContextInternal() - : RtcEngineContext(), - isPassThruMode(false), - maxOutputBitrateKpbs(30 * 1000), - extensionObserver(nullptr), -#if defined(P2P_SWITCH_DEFAULT_VALUE) - is_p2p_switch_enabled_(P2P_SWITCH_DEFAULT_VALUE) -#else - is_p2p_switch_enabled_(false) -#endif - {} - - explicit RtcEngineContextInternal(const RtcEngineContext& ctx) - : RtcEngineContext(ctx), - isPassThruMode(false), - maxOutputBitrateKpbs(30 * 1000), - extensionObserver(nullptr), -#if defined(P2P_SWITCH_DEFAULT_VALUE) - is_p2p_switch_enabled_(P2P_SWITCH_DEFAULT_VALUE) -#else - is_p2p_switch_enabled_(false) -#endif - { - if (ctx.eventHandler) { - extensionObserver = new RefCountedObject(ctx.eventHandler); - } - } -}; - -struct WebAgentVideoStats { - user_id_t userId; - int delay; - int sentFrameRate; - int renderedFrameRate; - int skippedFrames; -}; - -class IRtcEngineEventHandlerInternal : public IRtcEngineEventHandlerEx { - public: - virtual const char* eventHandlerType() const { return "event_handler_internal"; } - - virtual bool onEvent(RTC_EVENT evt, std::string* payload) { - (void)evt; - (void)payload; - - /* return false to indicate this event is not handled */ - return false; - } -}; - -class IRtcEngineInternal : public IRtcEngineEx, - public agora::base::IParameterEngine { - public: - virtual ~IRtcEngineInternal() {} - virtual int initializeEx(const RtcEngineContextInternal& context) = 0; - virtual uint32_t getCid(const RtcConnection& connection = {}) = 0; - virtual std::string getSid(const RtcConnection& connection = {}) = 0; - virtual int setProfile(const char* profile, bool merge) = 0; - virtual int getProfile(commons::cjson::JsonWrapper& result) = 0; - virtual int notifyNetworkChange(agora::commons::network::network_info_t&& networkInfo) = 0; - virtual int initializeInternal(const RtcEngineContextInternal& context) = 0; - - virtual int setAudioOptionParams(const char* params) = 0; - virtual int getAudioOptionParams(char* params) = 0; - virtual bool isMicrophoneOn() = 0; - - virtual int reportWebAgentVideoStats(const WebAgentVideoStats& stats) = 0; - -#if (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IOS) - virtual int monitorDeviceChange(bool enabled) = 0; -#endif // __APPLE__ && !TARGET_OS_IOS && TARGET_OS_MAC - - virtual int printLog(int level, const char* message) = 0; - virtual int runOnWorkerThread(std::function&& f) = 0; - virtual int reportArgusCounters(int* counterId, int* value, int count, uid_t uid) = 0; - - virtual int reportRecordingArgusEvent(uint32_t* eventIds, int64_t* value, int count, - RecordingEventType eventType) = 0; - virtual int enableYuvDumper(bool enable) = 0; - - // this function is only for expert of video codec, - // please do NOT call it if not knowing what's it about - virtual int setVideoConfigParam(const char* params) = 0; - - virtual int getVideoConfigParam(char* params, size_t size) = 0; - - virtual int setExternalVideoConfigEx(const VideoEncoderConfiguration& config) = 0; - virtual int setExternalVideoConfigEx(const VideoEncoderConfiguration& config, - const RtcConnection& connection) = 0; - - // this function is only for switching screen capture source api on windows platform -#if defined(_WIN32) - virtual void SetScreenCaptureSource(bool allow_magnification_api, bool allow_directx_capturer) = 0; - virtual int GetScreenCaptureType() = 0; -#endif - - virtual int setLogLevelEx(unsigned int filter) = 0; - - virtual int simulateOnSetParameters(const std::string& parameters) = 0; - - virtual int setCameraDevice(const char dev_id[MAX_DEVICE_ID_LENGTH]) = 0; - - virtual agora_refptr getMediaPlayer(int sourceId) = 0; - - virtual agora_refptr getConnection(const RtcConnection& connection = {}) const = 0; - -#if defined(FEATURE_ENABLE_UT_SUPPORT) - // 0 is left channel, 1 is right channel, -1 is invalid - virtual int soundPositionChannel(uid_t uid) = 0; - virtual int soundPositionChannel(uid_t uid, const RtcConnection& connection) = 0; -#endif - - virtual int32_t setAppType(APP_TYPE appType) = 0; - virtual int32_t enableVosUserInfoHidden(bool enabled) = 0; - virtual int setMediaRecorderObserver(const char* channelId, uid_t uid, bool isLocal, - media::IMediaRecorderObserverEx* observer, int sys_version = 0) = 0; - virtual int startRecording(const char* channelId, uid_t uid, bool isLocal, - const media::MediaRecorderConfiguration& config) = 0; - virtual int stopRecording(const char* channelId, uid_t uid, bool isLocal) = 0; - virtual int releaseRecorder(const char* channelId, uid_t uid, bool isLocal) = 0; - virtual std::string getRecentSid(const RtcConnection* connection = nullptr) = 0; -}; - -class RtcEngineLibHelper { - typedef const char*(AGORA_CALL* PFN_GetAgoraRtcEngineVersion)(int* build); - typedef IRtcEngine*(AGORA_CALL* PFN_CreateAgoraRtcEngine)(); - typedef void(AGORA_CALL* PFN_ShutdownAgoraRtcEngineService)(); - -#if defined(_WIN32) - typedef HINSTANCE lib_handle_t; - static HINSTANCE MyLoadLibrary(const char* dllname) { - char path[MAX_PATH]; - GetModuleFileNameA(GetCurrentModuleInstance(), path, MAX_PATH); - auto p = strrchr(path, '\\'); - strcpy(p + 1, dllname); // NOLINT - HINSTANCE hDll = LoadLibraryA(path); - if (hDll) return hDll; - - hDll = LoadLibraryA(dllname); - return hDll; - } -#else - typedef void* lib_handle_t; -#endif // _WIN32 - - public: - RtcEngineLibHelper(const char* dllname) - : m_firstInit(true), - m_lib(NULL), - m_dllName(dllname), - m_pfnCreateAgoraRtcEngine(nullptr), - m_pfnGetAgoraRtcEngineVersion(nullptr) {} - - bool initialize() { - if (!m_firstInit) { - return isValid(); - } - - if (m_dllName.empty()) { - return false; - } - - m_firstInit = false; -#if defined(_WIN32) - m_lib = MyLoadLibrary(m_dllName.c_str()); - if (m_lib) { - m_pfnCreateAgoraRtcEngine = - (PFN_CreateAgoraRtcEngine)GetProcAddress(m_lib, "createAgoraRtcEngine"); - m_pfnGetAgoraRtcEngineVersion = - (PFN_GetAgoraRtcEngineVersion)GetProcAddress(m_lib, "getAgoraRtcEngineVersion"); - } -#elif defined(__ANDROID__) || defined(__linux__) - m_lib = dlopen(m_dllName.c_str(), RTLD_LAZY); - if (m_lib) { - m_pfnCreateAgoraRtcEngine = (PFN_CreateAgoraRtcEngine)dlsym(m_lib, "createAgoraRtcEngine"); - m_pfnGetAgoraRtcEngineVersion = - (PFN_GetAgoraRtcEngineVersion)dlsym(m_lib, "getAgoraRtcEngineVersion"); - } -#endif // _WIN32 - - return isValid(); - } - - void deinitialize() { - if (m_lib) { -#if defined(_WIN32) - FreeLibrary(m_lib); -#elif defined(__ANDROID__) || defined(__linux__) - dlclose(m_lib); -#endif // _WIN32 - - m_lib = NULL; - } - - m_pfnCreateAgoraRtcEngine = nullptr; - m_pfnGetAgoraRtcEngineVersion = nullptr; - } - - ~RtcEngineLibHelper() { deinitialize(); } - - bool isValid() { return m_pfnCreateAgoraRtcEngine != NULL; } - - agora::rtc::IRtcEngine* createEngine() { - return m_pfnCreateAgoraRtcEngine ? m_pfnCreateAgoraRtcEngine() : NULL; - } - - const char* getVersion(int* build) { - return m_pfnGetAgoraRtcEngineVersion ? m_pfnGetAgoraRtcEngineVersion(build) : nullptr; - } - - private: - bool m_firstInit; - lib_handle_t m_lib; - std::string m_dllName; - PFN_CreateAgoraRtcEngine m_pfnCreateAgoraRtcEngine; - PFN_GetAgoraRtcEngineVersion m_pfnGetAgoraRtcEngineVersion; -}; - -// A helper function for decoding out the SEI layout - -struct canvas_info { - int width; - int height; - int bgcolor; -}; - -struct region_info { - unsigned id; - - double x; - double y; - double width; - double height; - - int alpha; // [0, 255] - - int render_mode; // 0, crop; 1, ZoomtoFit - int zorder; // [0, 100] -}; - -#define NUM_OF_LAYOUT_REGIONS 17 - -struct layout_info { - long long ms; - canvas_info canvas; - // At most 9 broadcasters: 1 host, 8 guests. - unsigned int region_count; - region_info regions[NUM_OF_LAYOUT_REGIONS]; -}; - -class EncryptionConfigInternal { -public: - EncryptionConfigInternal(const EncryptionConfig& config) - : encryptionMode(config.encryptionMode), encryptionKey(config.encryptionKey ? config.encryptionKey : "") - { - for(size_t i = 0; i < encryptionKdfSalt.size(); i++) { - encryptionKdfSalt[i] = config.encryptionKdfSalt[i]; - } - } - void ToEncryptionConfig(EncryptionConfig& config) const { - config.encryptionMode = encryptionMode; - config.encryptionKey = encryptionKey.c_str(); - for(size_t i = 0; i < encryptionKdfSalt.size(); i++) { - config.encryptionKdfSalt[i] = encryptionKdfSalt.at(i); - } - } - ENCRYPTION_MODE encryptionMode; - std::string encryptionKey; - std::array encryptionKdfSalt; -}; - -AGORA_API bool AGORA_CALL decode_sei_layout(const void* data, unsigned size, layout_info* layout); - -} // namespace rtc -} // namespace agora diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraPlugin.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraPlugin.h index 7af081ea..59848954 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraPlugin.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraPlugin.h @@ -1,18 +1,22 @@ -// Copyright (c) 2023 Agora.io. All rights reserved. - -#pragma once - -#include "Modules/ModuleManager.h" - -class FAgoraPluginModule : public IModuleInterface -{ -public: - - /** IModuleInterface implementation */ - virtual void StartupModule() override; - virtual void ShutdownModule() override; - -private: - /** Handle to the test dll we will load */ - void* AgoraLibraryHandle; -}; +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + + +#include "CoreMinimal.h" +#include "Modules/ModuleManager.h" + +DECLARE_LOG_CATEGORY_EXTERN(LogAgora, Log, All); + +class FAgoraPluginModule : public IModuleInterface +{ +public: + + /** IModuleInterface implementation */ + virtual void StartupModule() override; + virtual void ShutdownModule() override; + +private: + /** Handle to the test dll we will load */ + void* AgoraLibraryHandle; +}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraPluginInterface.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraPluginInterface.h index 354333b8..9a4b143a 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraPluginInterface.h +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraPlugin/Public/AgoraPluginInterface.h @@ -2,16 +2,6 @@ #pragma once -#include "../Private/AgoraCppPlugin/include/AgoraHeaderBase.h" -namespace agora -{ - namespace rtc - { - namespace ue - { - AGORAPLUGIN_API agora::rtc::IRtcEngine* AGORA_CALL createAgoraRtcEngine(); - AGORAPLUGIN_API agora::rtc::IRtcEngineEx* AGORA_CALL createAgoraRtcEngineEx(); - } - } -} \ No newline at end of file +#include "AgoraUERTCEngine.h" +using AgoraUERtcEngine = agora::rtc::ue::AgoraUERtcEngine; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/AgoraUtilityHelper.build.cs b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/AgoraUtilityHelper.build.cs new file mode 100644 index 00000000..556e6faa --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/AgoraUtilityHelper.build.cs @@ -0,0 +1,48 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. + +using System; +using System.Linq; +using System.IO; +using UnrealBuildTool; + +public class AgoraUtilityHelper : ModuleRules +{ + public AgoraUtilityHelper(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange( + new string[] + { + "Core", + "Projects", + + "MediaAssets", + "MediaUtils" + // ... add other public dependencies that you statically link with here ... + } + ); + + + PrivateDependencyModuleNames.AddRange( + new string[] + { + "CoreUObject", + "Engine", + "Slate", + "SlateCore", + "UMG", + // ... add private dependencies that you statically link with here ... + } + ); + + + DynamicallyLoadedModuleNames.AddRange( + new string[] + { + // ... add any modules that your module loads dynamically here ... + } + ); + + } +} diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Private/AgoraUEVideoHelper.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Private/AgoraUEVideoHelper.cpp new file mode 100644 index 00000000..18df9845 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Private/AgoraUEVideoHelper.cpp @@ -0,0 +1,19 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. + +#include "AgoraUEVideoHelper.h" + +#include "IMediaPlayer.h" +#include "MediaPlayerFacade.h" +#include "MediaPlayer.h" + + +IMediaSamples& UEVideoMediaPlayer::GetSamples(UMediaPlayer* MediaPlayer) +{ + TSharedRef PlayerFacade = MediaPlayer->GetPlayerFacade(); + + // Agora has a agora::rtc::IMediaPlayer interface + TSharedPtr<::IMediaPlayer, ESPMode::ThreadSafe> IPlayer = PlayerFacade->GetPlayer(); + + return IPlayer->GetSamples(); +} + diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Private/AgoraUtilityHelper.cpp b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Private/AgoraUtilityHelper.cpp new file mode 100644 index 00000000..6b1ec5c2 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Private/AgoraUtilityHelper.cpp @@ -0,0 +1,18 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. + +#include "AgoraUtilityHelper.h" + +#define LOCTEXT_NAMESPACE "FAgoraUtilityHelperModule" + +void FAgoraUtilityHelperModule::StartupModule() +{ + +} + +void FAgoraUtilityHelperModule::ShutdownModule() +{ +} + +#undef LOCTEXT_NAMESPACE + +IMPLEMENT_MODULE(FAgoraUtilityHelperModule, AgoraUtilityHelper) \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Public/AgoraUEVideoHelper.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Public/AgoraUEVideoHelper.h new file mode 100644 index 00000000..dae5a7e2 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Public/AgoraUEVideoHelper.h @@ -0,0 +1,20 @@ +// Copyright(c) 2024 Agora.io.All rights reserved. + +#pragma once + + +class UMediaPlayer; +class IMediaSamples; + +// the reason for making a new module is: +// agora has agora::rtc::IMediaPlayer interface, UE also has this one, but it doesn't have a namespace for it. +// Inside the FMediaPlayerFacade, it has a class forward declaration of IMediaPlayer, which would cause ambiguious symbol error. + +class AGORAUTILITYHELPER_API UEVideoMediaPlayer { + + +public: + + static IMediaSamples& GetSamples(UMediaPlayer* MediaPlayer); + +}; \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Public/AgoraUtilityHelper.h b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Public/AgoraUtilityHelper.h new file mode 100644 index 00000000..e66a8fad --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/AgoraUtilityHelper/Public/AgoraUtilityHelper.h @@ -0,0 +1,17 @@ +// Copyright (c) 2024 Agora.io. All rights reserved. + +#pragma once + + +#include "CoreMinimal.h" +#include "Modules/ModuleManager.h" + +class FAgoraUtilityHelperModule : public IModuleInterface +{ +public: + + /** IModuleInterface implementation */ + virtual void StartupModule() override; + virtual void ShutdownModule() override; + +}; diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/AgoraPluginLibrary.Build.cs b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/AgoraPluginLibrary.Build.cs index d80110e1..b0406b96 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/AgoraPluginLibrary.Build.cs +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/AgoraPluginLibrary.Build.cs @@ -11,9 +11,19 @@ public class AgoraPluginLibrary : ModuleRules private string soFormatStr = " "; + // bool bUE427OrLater = false; public AgoraPluginLibrary(ReadOnlyTargetRules Target) : base(Target) { + // if(Target.Version.MajorVersion >= 4 && Target.Version.MinorVersion >= 27) + // { + // bUE427OrLater = true; + // } + // else + // { + // bUE427OrLater = false; + // } + Type = ModuleType.External; if (Target.Platform == UnrealTargetPlatform.Win64) @@ -62,7 +72,13 @@ public void LoadIOSLibrary(string librarypath) { string filenamWithoutExtension = Path.GetFileNameWithoutExtension(fileNames[i]); string filenamWithoutFrameWork = Path.GetFileNameWithoutExtension(filenamWithoutExtension); - PublicAdditionalFrameworks.Add(new Framework(filenamWithoutFrameWork, Path.Combine(librarypath, fileNames[i]), "", true)); + +#if UE_4_27_OR_LATER + PublicAdditionalFrameworks.Add(new Framework(filenamWithoutFrameWork, Path.Combine(librarypath, fileNames[i]), "", true)); +#else + PublicAdditionalFrameworks.Add(new Framework(filenamWithoutFrameWork, Path.Combine(librarypath, fileNames[i]), "")); +#endif + Console.WriteLine("PublicAdditionalFrameworks Add" + fileNames[i]); } } @@ -72,7 +88,7 @@ public void LoadIOSLibrary(string librarypath) public void LoadAndroidLibrary(string librarypath) { - string xmlTemplateData = File.ReadAllText(Path.Combine(librarypath, "APL_armv7Template.xml")); + string xmlTemplateData = File.ReadAllText(Path.Combine(librarypath, "APL_Template.xml")); string[] Architectures = { "armeabi-v7a", "arm64-v8a" }; string sopathwrite = ""; for (int i = 0; i < Architectures.Length; i++) @@ -99,8 +115,8 @@ public void LoadAndroidLibrary(string librarypath) sopathwrite += " " + "\r\n"; sopathwrite += " "; xmlTemplateData = xmlTemplateData.Replace("", sopathwrite); - File.WriteAllText(Path.Combine(librarypath, "APL_armv7.xml"), xmlTemplateData); - AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(librarypath, "APL_armv7.xml")); + File.WriteAllText(Path.Combine(librarypath, "APL_Generated.xml"), xmlTemplateData); + AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(librarypath, "APL_Generated.xml")); } public void LoadWindowsLibrary(string librarypath) diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_Template.xml b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_Template.xml new file mode 100644 index 00000000..cadf4211 --- /dev/null +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_Template.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + import io.agora.rtc2.internal.RtcEngineImpl; + + + + + + -keep class io.agora.** { *; } + + + + + + + + + + + + + + + + + + + + + + + + + + + dependencies { + implementation fileTree(dir: 'libs', include: ['*.aar']) + implementation fileTree(dir: 'src/main/libs', include: ['*.aar']) + } + + + \ No newline at end of file diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7TemplateFULL.xml b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_TemplateSourceFULL.xml similarity index 88% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7TemplateFULL.xml rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_TemplateSourceFULL.xml index ac78a511..657eafdc 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7TemplateFULL.xml +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_TemplateSourceFULL.xml @@ -21,10 +21,16 @@ import io.agora.rtc2.internal.RtcEngineImpl; - import io.agora.rtc2.internal.CommonUtility; + + + -keep class io.agora.** { *; } + + + + diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7TemplateVoice.xml b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_TemplateSourceVoice.xml similarity index 91% rename from Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7TemplateVoice.xml rename to Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_TemplateSourceVoice.xml index 105fc805..6bd23f2a 100644 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7TemplateVoice.xml +++ b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_TemplateSourceVoice.xml @@ -21,7 +21,6 @@ import io.agora.rtc2.internal.RtcEngineImpl; - import io.agora.rtc2.internal.CommonUtility; @@ -39,10 +38,6 @@ boolean init = RtcEngineImpl.initializeNativeLibs(); System.out.println("Call LoadLibrary Result is " + init); } - public void LoadAndroidScreenCaptureSo() - { - System.out.println("Call LoadAndroidScreenCaptureSo Result"); - } ]]> diff --git a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7.xml b/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7.xml deleted file mode 100644 index 2c586f3c..00000000 --- a/Agora-Unreal-SDK-CPP/AgoraPlugin/Source/ThirdParty/AgoraPluginLibrary/Android/Release/APL_armv7.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - import io.agora.rtc2.internal.RtcEngineImpl; - import io.agora.rtc2.internal.CommonUtility; - - - - - - -keep class io.agora.** { *; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.aar']) - implementation fileTree(dir: 'src/main/libs', include: ['*.aar']) -} - - - \ No newline at end of file