Blurred background using Vidyo SDK for android

88 Views Asked by At

I want to apply a blurred background effect during a call using the Vidyo SDK for Android. I downloaded their sample application and tried using the setCameraBackgroundEffect method. However, the end result is always the same. I get this error: VIDYO_CONNECTORCAMERAEFFECTERROR_LoadEffectFailed.

Here's exactly what I did:

  1. I cloned this repo.

  2. As instructed I downloaded Vidyo SDK 23.1.1.5

  3. I copied VidyoClient.aar and banuba_effect_player_c_api-release.aar to app/libs

  4. In activity_video_conference.xml I added an extra button (SET BLUR) that calls setBlur method.

  5. I launch the app and click on 'VIDEO CONFERENCE.' The camera preview starts, but when I click on the 'SET BLUR' button, the camera effect is not applied. I receive a 'VIDYO_CONNECTORCAMERAEFFECTERROR_LoadEffectFailed' error via the CameraEffectErrorListener.

    private void setBlur() {
        connector.registerCameraEffectErrorListener(connectorCameraEffectError -> android.util.Log.d("yomama", "onCameraEffectError: " + connectorCameraEffectError));
    
        BnbResources bnbResources = BanubaHelpersKt.prepareBnbResources(this);
    
        ConnectorCameraEffectInfo cameraEffect = new ConnectorCameraEffectInfo();
        cameraEffect.effectType = Connector.ConnectorCameraEffectType.VIDYO_CONNECTORCAMERAEFFECTTYPE_Blur;
        cameraEffect.blurIntensity = 5;
        cameraEffect.pathToEffect = bnbResources.getBackgroundBlurEffect().getAbsolutePath();
        cameraEffect.pathToResources = bnbResources.getRoot().getAbsolutePath();
        cameraEffect.token = "yP3dl+HLWuvbCBP65hfTXjRKfEC8pkAjGbiOTzWJ7EqOv1CPuRAzMXL/FL+QCPM/+L9SaFjkOqgbUjzlCV3HG5IqgIXScOmDG9AFZKaWjzgY9JsbOjP1ryvjz0GY2fS7CmfsNJt8mshflXzNW2pGEEOv1QRxbdMYz4nU1MiT0B54amokYGrzOBjCPgaTVJURMfcgOY1ch7q8Ga6JtgWgEGQZFiieAqb4MinvoBiti3nYNt4c6bzFAoAetuwar2LlzXwmjvRLhL+Ij/tQ4s7jkZQmq1pqg1JK4K3dsdcB3VM9ZHn70K5+f6l74Teu0KE1RF6efLH86HsU5bbTNmzqNftbmYPXhB4SRHRRjmXk2FB8fE8B43S/j15InvN/RHctHcMYmBeyjmv2vJvaMQIWMboo86S8Ati4R147u7JSetkFnFJF1wGAz77DPQUiFdyIdzGI6qxKF8rsLqgqhXRrlZXfnxkupsqjwmA5fbR4pxrhq1xRWGngWQd0xP1Y9xl7GD9fFNcyrFCvGIHb2DaHdsjOYDhtfRouWJcYTD2lE2juHMPIpDforQDjwQG7r0hHE6N0sWafyQ/SbNHrOTVY6mdJGe9CMvG9";
        connector.setCameraBackgroundEffect(cameraEffect);
    }
    

What am I doing wrong? How to correctly apply camera background effects?

1

There are 1 best solutions below

6
VonC On

I do not see any issue in the project, so try at least to check to make sure the files for the Banuba effect (effectFile) and the Banuba resources directory (resourcesDir) actually exist before attempting to set the camera background effect:

File effectFile = bnbResources.getBackgroundBlurEffect();
File resourcesDir = bnbResources.getRoot();

if (!effectFile.exists() || !resourcesDir.exists()) {
    android.util.Log.e("VidyoError", "Banuba effect file or resources directory does not exist.");
    return;
}

The other check is to make sure the versions of Vidyo SDK and Banuba SDK are compatible with each other. And that the target SDK (version: 33) and min SDK (version: 23) are compatible with your test environment.


There's only one other effect left to try: VIDYO_CONNECTORCAMERAEFFECTTYPE_VirtualBackground. And yes, I encounter the same error with this effect as well.

So the issue is not related to file existence or SDK incompatibility since the Banuba SDK is included in the same archive as the Vidyo SDK, suggesting they should be compatible.

Since the issue persists across different effects, it is important to make sure the Banuba SDK is initialized correctly and used as per the instructions. Double-check the initialization code and make sure all required steps are performed before attempting to apply any effects.
Enhance error handling and logging around the effect application code. Look for any warnings or errors that might provide more insight into why the effect application is failing. That could involve enabling more verbose logging for the SDKs if supported.