Hi.
I am trying to access Android camera.
I found this video tutorial: Unreal Engine 4.18 - Android Camera Plugin Highlight - YouTube ,which shows off how to do that using
blueprints. What happens is that OpenURL node returns false. I checked that the URL is playable. It is. I am also getting the URL string for the front camera and it looks okay. The player texture stays black.
I have also tried to implement this via C++, and I am getting black texture there as well. See the code below:
void AAndroidCameraManager::BeginPlay()
{
Super::BeginPlay();
if (mPlayer)
{
TArray<FMediaCaptureDeviceInfo> deviceInfos;
MediaCaptureSupport::EnumerateVideoCaptureDevices(deviceInfos);
for (int32 i = 0; i < deviceInfos.Num();++i)
{
FMediaCaptureDeviceInfo dInfo = deviceInfos[i];
if (dInfo.Type == EMediaCaptureDeviceType::WebcamRear)
{
GEngine->AddOnScreenDebugMessage(-1, 50.0f, FColor::Red, dInfo.Url);
mPlayer->OpenUrl(dInfo.Url);
break;
}
}
if (videoTexture)
{
videoTexture->AddToRoot();
videoTexture->UpdateResource();
GEngine->AddOnScreenDebugMessage(-1, 50.0f, FColor::Red, "Video texture resource updated");
}
mPlayer->Play();
}
}
UMediaPlayer and the texture are set from the editor. But I also experimented with constructing those from within the code. It changed nothing. I also found all kind of suggestion in other post, like calling UpdateResource() on the texture.
dInfo.Url string shows rear camera URL, which I suppose is correct.
The logs don’t show any errors or warnings regarding the stream. What am I missing here?
And I have another question in this context. I am playing around with this setup in order to understand how much of
device camera functionality is exposed by Unreal to the user. For example, can I control additional parameters of the camera like zoom, shooting modes, flash light etc?
The documentation regarding this module is quite scarce and I am currently experimenting with this stuff to see if UE4 provide me with functionality I need to build a future product on top of it. Thanks in advance.