RESOLVED FIXED330932
REGRESSION (Safari 27): Camera preview painted at ~56% size after a second getUserMedia stream is assigned to the same <video>
https://bugs.webkit.org/show_bug.cgi?id=330932
Summary REGRESSION (Safari 27): Camera preview painted at ~56% size after a second ge...
kaspar
Reported 2026-11-10 07:48:28 PST

Created attachment 482264 [details]
Repro: preview shrinks after the second getUserMedia on the same <video> (iOS 27)

Since iOS 27, assigning a second getUserMedia camera stream to a <video> element that is
already showing one makes Safari paint the preview at about 56% of its size, centred in the
element. The <video> element keeps its full size; only the painted picture shrinks.

Reproduces every time with the attached repro.html.

Environment:

  • iPhone 13 Pro, iOS 27.2.1, Safari, held in portrait
  • Front camera (facingMode: 'user')

Regression: only iOS 27 is affected. Not reproducible on:

  • iOS 26 Safari, same device
  • Chrome and Firefox on Android

Steps to reproduce:

  1. Open the attached repro.html over HTTPS on an iPhone with iOS 27, held in portrait.
  2. Tap "Start camera" and allow camera access.
    The front-camera preview fills the width of the grey box.
  3. Tap "Start camera" again. This calls getUserMedia a second time with the same
    constraints (width min 1280 / ideal 1280 / max 1920, height min 720 / ideal 720 /
    max 1080), does not stop the first track, and assigns the new stream to the same
    <video> through srcObject.

Expected result:
The preview fills the width of the box again, just as after step 2.

Actual result:
The preview is painted at about 56% of its width and height, centred in the box, with the
box background visible around it. It stays that way and does not recover.

Everything the page can measure stays correct after the second start: videoWidth/videoHeight
are 720x1280, the element box is 390x693 and the track settings are 720x1280 (log below).
So layout is correct and only the rendering of the frame is wrong.

The painted size (about 219x390 CSS px) matches the 1280x720 landscape camera buffer being
fitted into the 390x693 element first (390x219) and rotated by 90 degrees afterwards
(219x390). The ratio is exactly 720/1280 = 0.5625. The renderer seems to scale the unrotated
buffer and apply the rotation separately.

Log output from the attached page:
resize event: videoWidth/Height 720x1280, element 390x693, track 720x1280
start #1: videoWidth/Height 720x1280, element 390x693, track 720x1280
500 ms after start #1: videoWidth/Height 720x1280, element 390x693, track 720x1280
resize event: videoWidth/Height 720x1280, element 390x693, track 720x1280
start #2: videoWidth/Height 720x1280, element 390x693, track 720x1280
500 ms after start #2: videoWidth/Height 720x1280, element 390x693, track 720x1280

Attachments:

  • repro.html (minimal test page)
  • after-step-2.png (preview correct)
  • after-step-3.png (preview shrunk)
Attachments
Repro: preview shrinks after the second getUserMedia on the same <video> (iOS 27) (1.81 KB, text/plain)
2026-11-10 07:48 PST, kaspar
no flags
preview correct (1.78 MB, image/png)
2026-11-10 07:49 PST, kaspar
no flags
preview shrunk (2.30 MB, image/png)
2026-11-10 07:49 PST, kaspar
no flags
kaspar
Comment 1 2026-11-10 07:49:22 PST
Created attachment 482265 [details] preview correct
kaspar
Comment 2 2026-11-10 07:49:38 PST
Created attachment 482266 [details] preview shrunk
Radar WebKit Bug Importer
Comment 3 2026-11-10 15:57:46 PST
Eric Carlson
Comment 4 2026-11-18 13:48:33 PST
EWS
Comment 5 2026-11-19 11:19:38 PST
Committed 327326@main (d1ac3006178f): <https://commits.webkit.org/327326@main> Reviewed commits have been landed. Closing PR #81478 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.