How to set orientation of camera when the app is in background state?

As the documentation says checkVideoRotation to be used in onResume but how to use that when an app is in the background?
For example, I was using the custom UI and using the checkVideoRotation method to configure the orientation( )

        Display display = ((WindowManager) context.getSystemService(Service.WINDOW_SERVICE)).getDefaultDisplay();
        int displayRotation = display.getRotation();

This is working perfectly when the app is in the foreground. But when the user goes to the background and starts rotating the device then this method is not working even though we forcefully call that from some timer task or senior manager for getting events.
Is there any possibility to use checkVideoRotation to set the camera orientation when the app is in the background?

Smartphone :

  • Devices used for testing are OnePlus6, Pixel 2
  • OS: Android 10,11

Additional context
The orientation of the camera when the app is in the background while using Custom UI

Hi @pavan.careers5208, thanks for using our SDK.

Can you please provide some additional information about the behavior you are observing when the app is backgrounded?


Yeah sure.
While the app is in the foreground and if the user rotates his device his camera preview will be in the correct orientation on the other user’s screen because we are using checkVideoRotation which rotates the camera preview accordingly.
But when the zoom integrated app is going to the background state while the user is using some other app and then if he rotates the device to landscape then the video view of that user is getting tilted ( means the camera preview will be in the wrong orientation on the other person’s device).

Procedure to be Observed:
We need two devices to test this scenario. And on both devices join the same meeting and keep their video on. On-device one stay on the app and on the second device follow the below step after a few mins of the call starts

Steps to Reproduce:

  1. On Device two press the home button so the app goes to the background state.
  2. Make sure your device orientation is not fixed. Make sure auto-rotate is enabled
  3. As you are on the home screen open any app like Youtube or Play store and rotate your device to Landscape mode
  4. Now observe your view on device one it will be shown in an opposite or tilted direction

If we are in the foreground state and call checkVideoRotation which will rotate the preview and the view on the first device will look perfectly. But in the case of the above situation when the app is in background state the video is looking titled even we call checkVideoRotation

Will checkVideoRotation will work when the app is backgrounded?

Hi @pavan.careers5208, thank you for the detailed response.

We were able to consistently reproduce the behavior you are describing and will investigate this further. As soon as I have an update I will let you know.


Any update here @jon.lieblich ?

Hi @pavan.careers5208, thanks for following up on this.

This has not yet been resolved, but I will follow up with the team on this and see if we can figure out when a fix will be deployed.