twilio / video-quickstart-ios

Twilio Video Quickstart for iOS
https://www.twilio.com/docs/api/video
MIT License
460 stars 177 forks source link

Local camera preview orientation issue #532

Closed madhu-kadyala closed 4 years ago

madhu-kadyala commented 4 years ago

Hi, I'm developing iOS video call app. In my case, I'm using Twilio -> 3.5 SDK. During a video call, If I rotate the device to landscape left my video is showing in landscape right direction. My video was 180 degrees wrong direction. I'm following the steps that was giving in video quick start in twilio. My app is not supported for landscape orientation.

Swift version: 4

Device details :

iPhone 6S Plus iOS 13.6

iPhone 7 plus 13.3.1

ceaglest commented 4 years ago

Hey @madhu-kadyala,

You should try to compare your app code to the Quickstart example. On my test devices the Quickstart example is working in all orientations, does it work for you on your iPhone 6S Plus and iPhone 7 Plus?

Best, Chris

madhu-kadyala commented 4 years ago

Hi @ceaglest Thanks for your support! I have already compared my code with Quickstart example. Only difference I have found is quickstart was supporting device orientation but my app only support Portrait orientation.

ceaglest commented 4 years ago

First of all, apps that use the camera should strive to be immersive experiences that support any orientation even if its just for the duration of the call. You can support landscape just for a single view controller hierarchy if you want... I think the root of your problem is you have an experience where users want to hold their device in landscape but your app doesn't support landscape.

I did the following to test:

  1. Open QuickStart Xcode project.
  2. Remove support for landscape orientations.
Screen Shot 2020-07-24 at 11 20 31 AM
  1. Launch the app and rotate my device to landscape.

Result

  1. The app always remains in portrait orientation.
  2. The preview looks correct to me.
  3. The remote side sees video that is always portrait even if the local phone is held in landscape.

I guess what you want is the remote side to see video that is not always in portrait? If that is the case then you could use the custom tracker solution in https://github.com/twilio/video-quickstart-ios/issues/324. I still think this is a bad idea when your app only supports portrait. Tell me this, what if both sides hold their phone in landscape? Neither will see a UI that looks correct, and the remote landscape video will be 90 (instead of 180) degrees off for each party.

madhu-kadyala commented 4 years ago

Hi @ceaglest I have cross-checked again with QuickStart project. Initially, it's rotating in the wrong direction only, once I flip the camera to back camera again flip to front camera It's working fine.

madhu-kadyala commented 4 years ago

Hi @ceaglest , Thank you so much for your support!!! Finally, I figure out why it happened. In my code Unfortunately I have called two-time startCapture method. So that this issue happens.