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