Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/4.5.0 #157

Merged
merged 12 commits into from
Dec 4, 2024
Merged
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 19 additions & 5 deletions Agora-Unreal-SDK-Blueprint-Example/Source/AgoraBPExample.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using UnrealBuildTool;
using System.Collections.Generic;
using System;

public class AgoraBPExampleTarget : TargetRules
{
Expand All @@ -19,7 +20,7 @@ public AgoraBPExampleTarget( TargetInfo Target) : base(Target)
if (Target.Platform == UnrealTargetPlatform.IOS || Target.Platform == UnrealTargetPlatform.Mac)
{
bOverrideBuildEnvironment = true;

// [-Wno-unused-but-set-variable]: fix error "variable 'layerNames' set but not used"
// [-Wno-gcc-compat]: gcc does not allow an attribute in this position on a function declaration
// [-Wno-reorder-ctor]: fix error "field 'eventHandler' will be initialized after field 'mccUid'"
Expand All @@ -33,12 +34,25 @@ public AgoraBPExampleTarget( TargetInfo Target) : base(Target)

// [-Wno-single-bit-bitfield-constant-conversion]: UE_4.27/Engine/Source/Runtime/Engine/Public/MaterialShared.h:2304:30: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
// MarkedForGarbageCollection = 1;
// AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor -Wno-deprecated-builtins -Wno-bitwise-instead-of-logical -Wno-single-bit-bitfield-constant-conversion";

if (Target.Version.MajorVersion < 5)
{
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor -Wno-deprecated-builtins -Wno-bitwise-instead-of-logical -Wno-single-bit-bitfield-constant-conversion";

Console.WriteLine("[Apply Compiler Arguments] For UE Ver < 5: AdditionalCompilerArguments: " + AdditionalCompilerArguments);
}


// error: unknown warning option '-Wno-deprecated-builtins'; did you mean '-Wno-deprecated-volatile'? [-Werror,-Wunknown-warning-option]
// error: unknown warning option '-Wno-single-bit-bitfield-constant-conversion'; did you mean '-Wno-bitfield-constant-conversion'? [-Werror,-Wunknown-warning-option]
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor";

}

else
{
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor";

Console.WriteLine("[Apply Compiler Arguments] For UE Ver >= 5: AdditionalCompilerArguments: " + AdditionalCompilerArguments);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


#include "BFL_UtilityTool.h"
#include "Misc/EngineVersion.h"


bool UBFL_UtilityTool::IsAgoraAudioOnlySDK()
{
Expand All @@ -12,3 +14,14 @@ bool UBFL_UtilityTool::IsAgoraAudioOnlySDK()
#endif

}

FString UBFL_UtilityTool::GetAgoraSaveDataSlotName()
{

FEngineVersion EngineVersion = FEngineVersion::Current();
FString VersionString = EngineVersion.ToString(EVersionComponent::Patch);
// UE_LOG(LogTemp, Log, TEXT("Current Engine Version: %s"), *VersionString);

FString SlotName = "AgoraSaveData_" + VersionString;
return SlotName;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ class AGORABPEXAMPLE_API UBFL_UtilityTool : public UBlueprintFunctionLibrary

UFUNCTION(Blueprintcallable)
static bool IsAgoraAudioOnlySDK();


UFUNCTION(BlueprintPure)
static FString GetAgoraSaveDataSlotName();
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using UnrealBuildTool;
using System.Collections.Generic;
using System;

public class AgoraBPExampleEditorTarget : TargetRules
{
Expand All @@ -28,11 +29,25 @@ public AgoraBPExampleEditorTarget( TargetInfo Target) : base(Target)

// [-Wno-single-bit-bitfield-constant-conversion]: UE_4.27/Engine/Source/Runtime/Engine/Public/MaterialShared.h:2304:30: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
// MarkedForGarbageCollection = 1;
// AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor -Wno-deprecated-builtins -Wno-bitwise-instead-of-logical -Wno-single-bit-bitfield-constant-conversion";

if (Target.Version.MajorVersion < 5)
{
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor -Wno-deprecated-builtins -Wno-bitwise-instead-of-logical -Wno-single-bit-bitfield-constant-conversion";

Console.WriteLine("[Apply Compiler Arguments] For UE Ver < 5: AdditionalCompilerArguments: " + AdditionalCompilerArguments);
}


// error: unknown warning option '-Wno-deprecated-builtins'; did you mean '-Wno-deprecated-volatile'? [-Werror,-Wunknown-warning-option]
// error: unknown warning option '-Wno-single-bit-bitfield-constant-conversion'; did you mean '-Wno-bitfield-constant-conversion'? [-Werror,-Wunknown-warning-option]
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor";

else
{
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor";

Console.WriteLine("[Apply Compiler Arguments] For UE Ver >= 5: AdditionalCompilerArguments: " + AdditionalCompilerArguments);
}


}

Expand Down
Binary file not shown.
19 changes: 17 additions & 2 deletions Agora-Unreal-SDK-CPP-Example/Source/AgoraExample.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using UnrealBuildTool;
using System.Collections.Generic;
using System;

public class AgoraExampleTarget : TargetRules
{
Expand Down Expand Up @@ -32,13 +33,27 @@ public AgoraExampleTarget( TargetInfo Target) : base(Target)
// [-Wno-bitwise-instead-of-logical]: UE_4.27/Engine/Source/Runtime/CoreUObject/Public/AssetRegistry/AssetDataTagMap.h:36:32: note: cast one or both operands to int to silence this warning
// bool IsEmpty() const { return Class.IsNone() & Package.IsNone() & Object.IsNone(); } //-V792\n


// [-Wno-single-bit-bitfield-constant-conversion]: UE_4.27/Engine/Source/Runtime/Engine/Public/MaterialShared.h:2304:30: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
// MarkedForGarbageCollection = 1;
// AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor -Wno-deprecated-builtins -Wno-bitwise-instead-of-logical -Wno-single-bit-bitfield-constant-conversion";

if (Target.Version.MajorVersion < 5)
{
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor -Wno-deprecated-builtins -Wno-bitwise-instead-of-logical -Wno-single-bit-bitfield-constant-conversion";

Console.WriteLine("[Apply Compiler Arguments] For UE Ver < 5: AdditionalCompilerArguments: " + AdditionalCompilerArguments);
}


// error: unknown warning option '-Wno-deprecated-builtins'; did you mean '-Wno-deprecated-volatile'? [-Werror,-Wunknown-warning-option]
// error: unknown warning option '-Wno-single-bit-bitfield-constant-conversion'; did you mean '-Wno-bitfield-constant-conversion'? [-Werror,-Wunknown-warning-option]
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor";

else {
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor";

Console.WriteLine("[Apply Compiler Arguments] For UE Ver >= 5: AdditionalCompilerArguments: " + AdditionalCompilerArguments);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "AgoraActor.h"
#include "Engine/Engine.h"
#include "Utility/BFL_UtilityTool.h"

// Sets default values
AAgoraActor::AAgoraActor()
Expand All @@ -23,7 +24,7 @@ void AAgoraActor::BeginPlay()
}
VideoWidget->AddToViewport();

if (UAgoraConfig* LoadedGame = Cast<UAgoraConfig>(UGameplayStatics::LoadGameFromSlot(FString("AgoraSave"), 0)))
if (UAgoraConfig* LoadedGame = Cast<UAgoraConfig>(UGameplayStatics::LoadGameFromSlot(UBFL_UtilityTool::GetAgoraSaveDataSlotName(), 0)))
{
if (bLoadConfig)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void UJoinChannelWithTokenWidget::ShowUserGuide()
"1. You can join the channel using the token you provide.\n"
"2. You can also join the channel using the token retrieved from the server.\n"
"3. A simple server can be launched with the website link commented in the source code.\n"
"4. The demo won't work if the engine version is under 4.27."
"";

UBFL_Logger::DisplayUserGuide(Guide, LogMsgViewPtr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ class AGORAEXAMPLE_API USpatialAudioWithMPWidget : public UBaseAgoraUserWidget
FString MPL_URL = "https://download.agora.io/demo/test/Agora.io-Interactions.wav";

#else
FString MPL_URL =
"https://agoracdn.s3.us-west-1.amazonaws.com/videos/Agora.io-Interactions.mp4";

FString MPL_URL = "https://download.agora.io/demo/test/Agora.io-Interactions.mp4";

#endif

TSharedPtr<FUserIMediaPlayerSourceObserver> MediaPlayerSourceObserverWarpper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "MainAgoraUserWidget.h"
#include "AgoraPluginInterface.h"
#include "Kismet/KismetSystemLibrary.h"
#include "../Utility//BFL_UtilityTool.h"
#include "GameFramework/GameUserSettings.h"

#pragma region CustomTileView
Expand Down Expand Up @@ -61,6 +63,13 @@ void UMainAgoraUserWidget::NativeConstruct()
if(Txt_SDKVer){
Txt_SDKVer->SetText(FText::FromString(AgoraUERtcEngine::GetSDKVersion()));
}

#if PLATFORM_ANDROID
// to keep screen on
// For IOS: please check IOS config ini: bEnableIdleTimer
UKismetSystemLibrary::ControlScreensaver(false);
#endif

}

void UMainAgoraUserWidget::NativeDestruct()
Expand All @@ -72,7 +81,7 @@ void UMainAgoraUserWidget::NativeDestruct()
SaveGameInstance->Token = FString(TokenBox->GetText().ToString());
SaveGameInstance->Channelname = FString(ChannelBox->GetText().ToString());

if (UGameplayStatics::SaveGameToSlot(SaveGameInstance, FString("AgoraSave"), 0))
if (UGameplayStatics::SaveGameToSlot(SaveGameInstance, UBFL_UtilityTool::GetAgoraSaveDataSlotName(), 0))
{
UE_LOG(LogTemp,Warning,TEXT("Save Config Succeed"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
void UBFL_HTTPHelper::FetchToken(FString RequestURL, int64 uid, FString ChannelName, int64 Role, std::function<void(FString, bool)> Callback)
{

#if AG_UE427_OR_LATER
// Create Json Data
FString ServerData;

Expand Down Expand Up @@ -54,10 +55,15 @@ void UBFL_HTTPHelper::FetchToken(FString RequestURL, int64 uid, FString ChannelN

// Send Request
Request->ProcessRequest();

#endif
}

void UBFL_HTTPHelper::HandleRequest(FHttpRequestPtr RequestPtr, FHttpResponsePtr ResponsePtr, bool bIsSuccess, std::function<void(FString, bool)> Callback)
{

#if AG_UE427_OR_LATER

if (!EHttpResponseCodes::IsOk(ResponsePtr->GetResponseCode())) {
Callback("", false);
return;
Expand All @@ -81,4 +87,6 @@ void UBFL_HTTPHelper::HandleRequest(FHttpRequestPtr RequestPtr, FHttpResponsePtr
}

Callback("", false);

#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "BFL_UtilityTool.h"
#include "MediaPlayer.h"
#include "Misc/EngineVersion.h"

FString UBFL_UtilityTool::ConvertToAbsolutePath(FString InRelativePath, bool bAndroidUseInternalBasePath /*= false*/)
{
Expand Down Expand Up @@ -96,6 +97,16 @@ FString UBFL_UtilityTool::GenSimpleUIDPart_FuncCode(EUIDFuncType Type)
return "00" + FString::FromInt(ValType);
}

FString UBFL_UtilityTool::GetAgoraSaveDataSlotName()
{
FEngineVersion EngineVersion = FEngineVersion::Current();
FString VersionString = EngineVersion.ToString(EVersionComponent::Patch);
// UE_LOG(LogTemp, Log, TEXT("Current Engine Version: %s"), *VersionString);

FString SlotName = "AgoraSaveData_" + VersionString;
return SlotName;
}

void UBFL_UtilityTool::SetCBSTextColor(UComboBoxString* CBSPtr)
{
// Because in UE5.2.1, the default style of ComboBoxString is the black text on the black background.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class AGORAEXAMPLE_API UBFL_UtilityTool : public UBlueprintFunctionLibrary

static FString GenSimpleUIDPart_FuncCode(EUIDFuncType Type);


static FString GetAgoraSaveDataSlotName();

UFUNCTION(BlueprintCallable, Category = "Utility")
static void SetCBSTextColor(UComboBoxString* CBSPtr);
};
18 changes: 15 additions & 3 deletions Agora-Unreal-SDK-CPP-Example/Source/AgoraExampleEditor.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using UnrealBuildTool;
using System.Collections.Generic;
using System;

public class AgoraExampleEditorTarget : TargetRules
{
Expand All @@ -28,12 +29,23 @@ public AgoraExampleEditorTarget( TargetInfo Target) : base(Target)

// [-Wno-single-bit-bitfield-constant-conversion]: UE_4.27/Engine/Source/Runtime/Engine/Public/MaterialShared.h:2304:30: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
// MarkedForGarbageCollection = 1;
// AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor -Wno-deprecated-builtins -Wno-bitwise-instead-of-logical -Wno-single-bit-bitfield-constant-conversion";

if (Target.Version.MajorVersion < 5)
{
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor -Wno-deprecated-builtins -Wno-bitwise-instead-of-logical -Wno-single-bit-bitfield-constant-conversion";

Console.WriteLine("[Apply Compiler Arguments] For UE Ver < 5: AdditionalCompilerArguments: " + AdditionalCompilerArguments);
}

// error: unknown warning option '-Wno-deprecated-builtins'; did you mean '-Wno-deprecated-volatile'? [-Werror,-Wunknown-warning-option]
// error: unknown warning option '-Wno-single-bit-bitfield-constant-conversion'; did you mean '-Wno-bitfield-constant-conversion'? [-Werror,-Wunknown-warning-option]
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor";

else
{
AdditionalCompilerArguments = "-Wno-unused-but-set-variable -Wno-gcc-compat -Wno-reorder-ctor";

Console.WriteLine("[Apply Compiler Arguments] For UE Ver >= 5: AdditionalCompilerArguments: " + AdditionalCompilerArguments);
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ DEFINE_LOG_CATEGORY(LogAgora);

void FAgoraPluginModule::StartupModule()
{
UE_LOG(LogAgora, Warning, TEXT("FAgoraPluginModule: %s"), *(AgoraUERtcEngine::GetSDKVersion()));
UE_LOG(LogAgora, Display, TEXT("FAgoraPluginModule - StartupModule: %s"), *(AgoraUERtcEngine::GetSDKVersion()));
}

void FAgoraPluginModule::ShutdownModule()
{
//untested, so comment out the code for now
//AgoraUERtcEngine::Release();
AgoraUERtcEngine::Release();
UE_LOG(LogAgora, Display, TEXT("FAgoraPluginModule - ShutdownModule: Release RTC Engine"));
}

#undef LOCTEXT_NAMESPACE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
#pragma once

#include "Runtime/Launch/Resources/Version.h"
#define AG_UE_5_4_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 4)
#define AG_UE_5_3_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 3)
#define AG_UE_5_2_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 2)
#define AG_UE_5_1_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1)
#define AG_UE5_OR_LATER (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 0)
#define AG_UE_5_4_OR_LATER (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4)
#define AG_UE_5_3_OR_LATER (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 3)
#define AG_UE_5_2_OR_LATER (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2)
#define AG_UE_5_1_OR_LATER (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1)
#define AG_UE5_OR_LATER (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 0)
#define AG_UE427_OR_LATER (ENGINE_MAJOR_VERSION >= 4 && ENGINE_MINOR_VERSION >= 27)

// For compiling the plugin independently using UAT's BuildPlugin command
#if PLATFORM_WINDOWS
Expand Down