client-sdk-swift icon indicating copy to clipboard operation
client-sdk-swift copied to clipboard

When "Portait Locked" option is activated, VideoView behaves wrong

Open joaomurta opened this issue 3 years ago • 5 comments

these are the test steps I did demonstrated in the video: Remembering that the view controller is locked in landscape, which is supposed to be.

  1. I'm in landscape without "Portait Locked"
  2. I turn on the camera
  3. Rotate iPhone to Portait (physically)
  4. I run back to Landscape
  5. Turn off camera( we have an observer to turn off the camera when we go to “Control Panel”)
  6. Enable “Portait Locked” option
  7. I turn on the camera (I'm physically in landscape with “Portait Locked”), and the camera appears like this, with rotation
  8. Rotate iPhone to Portait (physically)
  9. I run back to Landscape

If you can solve the problem as soon as possible, I would really appreciate it, in fact it is something urgent for me. Thanks and keep up the good work.

https://user-images.githubusercontent.com/24411127/195927883-f55c335d-12dc-4345-b08f-f72f0e867b5b.mov

joaomurta avatar Oct 14 '22 19:10 joaomurta

Hello I will try to replicate this one.

hiroshihorie avatar Oct 16 '22 12:10 hiroshihorie

As soon as you have feedback, please let me know. Thank you and keep up the good work.

joaomurta avatar Oct 17 '22 09:10 joaomurta

Hi I did a quick check and it seems to be working as expected . Can you explain more details or can you upload example code to reproduce the issue ?

Do you mean you want to rotate even when the OS's rotation is locked ?

hiroshihorie avatar Oct 17 '22 12:10 hiroshihorie

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    .landscape
}

override var shouldAutorotate: Bool {
    true
}

what happens is that when we have the "portrait Locked" the camera is rotated as you can see. Videoview behaves like portrait.

https://user-images.githubusercontent.com/24411127/196243735-9655dc68-adc2-44ea-888b-09fe891ed444.mov

joaomurta avatar Oct 17 '22 17:10 joaomurta

I can reproduce this one, it looks like related with the CameraCapturer. This will be a bit tricky to fix.

Looks like related to RTCCameraCapturer using UIDeviceOrientation instead of UIInterfaceOrientation .

https://chromium.googlesource.com/external/webrtc/+/branch-heads/62/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCCameraVideoCapturer.m

Related: https://stackoverflow.com/questions/7968451/different-ways-of-getting-current-interface-orientation

I have a few fixes in mind:

  1. Allow to override rotation to any value the developer prefers.
  2. Attempt to use UIInterfaceOrientation for applying "real" rotation .

These fixes will need direct changes in WebRTC and may take a while.

hiroshihorie avatar Oct 20 '22 06:10 hiroshihorie

Hi @hiroshihorie , first of all, thanks for reply.

I think it's a good approach, as soon as the fix is available can you notify me here in the ticket please?

joaomurta avatar Oct 27 '22 15:10 joaomurta

do you remember about it? There is the same problem. The app only has a horizontal view and the camera is not working properly. It would be nice to rotate the picture for sending.

inflamesonly avatar Jul 19 '23 14:07 inflamesonly

Hi, sorry for taking so long but this patch should fix it : https://github.com/webrtc-sdk/webrtc/pull/92

It will be in the new release. Please re-open if you still see issues.

hiroshihorie avatar Sep 12 '23 06:09 hiroshihorie