[Webkit-unassigned] [Bug 220326] New: [iOS] Camera preview gets cropped or zoomed after device rotation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 5 06:50:38 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=220326

            Bug ID: 220326
           Summary: [iOS] Camera preview gets cropped or zoomed after
                    device rotation
           Product: WebKit
           Version: Safari 14
          Hardware: iPhone / iPad
                OS: iOS 14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebRTC
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: stefan.benicke at gmail.com
                CC: youennf at gmail.com

Created attachment 417000

  --> https://bugs.webkit.org/attachment.cgi?id=417000&action=review

Screenshots of different states of camera preview before and after rotation

A simple preview of `getUserMedia` video stream is cropped or zoomed after device rotation. It happens randomly and unpredictable.

Steps to reproduce:
- Open https://webrtc.github.io/samples/src/content/getusermedia/gum/ and click "Open camera", confirm camera access to see the preview
- Rotate device for 90°
- Rotate device back
- Repeat to see different results

What happens on my iPhone SE (v14.3, Safari v14.0.2):
- When rotated to landscape - sometimes - cam seems like zoomed out to just fill a quarter of the video element (rest is black)
- When rotated to portrait - sometimes - cam seems like zoomed in to double size
- When rotated to portrait - sometimes - cam seems like cropped the bottom half (black bars)
- Sometimes after a rotation cam is correct

What should happen instead:
- No cropped parts
- No zoom

My observations:
I have tested with another device iPad Air 3 (v14.3) and it worked perfectly! I know that other users with their iPhones or iPads also have issues like black bars, cropped cam preview or even an offset of the cam preview within the video element.

I have tried to force video width and height in `getUserMedia` video constraints and/or force fixed width and height of video element, trigger stream update with `applyConstraints({ height: … })` or similar after `window.onrotationchange` event but nothing has solved the issue for me.

I've noticed that video track dimensions change after device orientation change event. It starts with 480x640 and after rotation it reports 640x480. ( `stream.getVideoTracks()[0].getSettings()` ) And for me on the iPhone SE it shows the same issues either with front- or backcamera.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210105/5ee7985a/attachment-0001.htm>


More information about the webkit-unassigned mailing list