Hi!
I’m creating a small VR app that requires two web browsers playing at the same time. It works flawlessly on PC, but the resolution and framerate go super wonky on an android phone.
Also, the only seems to be working just a properly resolution (without any kind of stretching) which is 500x500. I’ve found that value hardcoded in two android web browser constructors, both C++ and Java, but when trying to change that value to any other number, I meet the following error:
Error 'USE_ANDROID_JNI' is not defined, evaluates to 0 -Werror,-Wundef] VNT_Android_Opt C:\...\UnrealEngine\Engine\Source\Runtime\WebBrowser\Private\Android\AndroidWebBrowserWindow.h 5
The code I’m changing is:
Inside AndroidWebBrowserWindow.cpp
FAndroidWebBrowserWindow::FAndroidWebBrowserWindow(FString InUrl, TOptional<FString> InContentsToLoad, bool InShowErrorMessage, bool InThumbMouseButtonNavigation, bool InUseTransparency, bool bInJSBindingToLoweringEnabled)
: CurrentUrl(MoveTemp(InUrl))
, ContentsToLoad(MoveTemp(InContentsToLoad))
, bUseTransparency(InUseTransparency)
, DocumentState(EWebBrowserDocumentState::NoDocument)
, ErrorCode(0)
, Scripting(new FAndroidJSScripting(bInJSBindingToLoweringEnabled))
, AndroidWindowSize(FIntPoint(500, 500))
{
}
To:
FAndroidWebBrowserWindow::FAndroidWebBrowserWindow(FString InUrl, TOptional<FString> InContentsToLoad, bool InShowErrorMessage, bool InThumbMouseButtonNavigation, bool InUseTransparency, bool bInJSBindingToLoweringEnabled)
: CurrentUrl(MoveTemp(InUrl))
, ContentsToLoad(MoveTemp(InContentsToLoad))
, bUseTransparency(InUseTransparency)
, DocumentState(EWebBrowserDocumentState::NoDocument)
, ErrorCode(0)
, Scripting(new FAndroidJSScripting(bInJSBindingToLoweringEnabled))
, AndroidWindowSize(FIntPoint(1280, 720))
{
}
Just the last line. It makes the project uncompilable.
So I thought it might be hardcoded somewhere else, and I found it on WebViewControl.java (Build/Android/Java/src/com/epicgames/ue4):
private static int initialWidth = 500;
private static int initialHeight = 500;
Is there any need to regenerate something before changing the android’s related code?
The whole combination of problems I’m experiencing with Android web browser inside VR is:
- Slowness: Framerate of the video on PC is around 20fps (that’s what we are sending from the server, so it is ok), android 1 - 2 fps when its best.
- Resolution madness: It will ignore any changes on the widget and just stretch the image somehow. Is there any kind of documentation around this? Standard UI documentation on Android does not work properly with the integrated Web browser.
Thank you for reading me!
I would appreciate any kind of light shed on this issue.
Cheers,