[Webkit-unassigned] [Bug 271127] New: History.pushState breaks camera connection from MediaDevices.getUserMedia

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 17 06:55:29 PDT 2024


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

            Bug ID: 271127
           Summary: History.pushState breaks camera connection from
                    MediaDevices.getUserMedia
           Product: WebKit
           Version: Safari 17
          Hardware: iPhone / iPad
                OS: Unspecified
            Status: NEW
          Severity: Blocker
          Priority: P2
         Component: Media
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: adamhenson1979 at gmail.com

Created attachment 470403

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

Simple reproduction screen recording

I contribute to a website that establishes a webcam stream via `Media.getUserMedia` and "client side navigation" via `History.pushState`. During navigation, the same stream is displayed intentionally throughout navigation within a `video` element as the `srcObject` attribute. Since the 17.4 release of Safari on 3/5/2024 we've been receiving reports of the webcam stream stopping and showing an all black background (Safari for iOS). This issue breaks an important flow of our website that provides critical functionality to the business.

I did a significant amount of debugging and pinpointed the issue source that can be easily reproduced. I created a minimal reproduction with code on GitHub and deployed to Vercel. See below for details.

Reproduction environment:
Safari iOS 17.4

Description:
When utilizing `MediaDevices.getUserMedia()` to display a webcam stream and `History.pushState()` for navigation, the connection to the webcam appears to be lost upon call to `history.pushState()`. When the stream is displayed as a video element via `srcObject`, at the point of `pushState()` call, video displays a black background only. Also noteworthy is that the browser indicator of the webcam connection changes despite `stream.active` remaining true and all other properties of `MediaStream` instance remaining unchanged.

Noteworthy points:
- The issue is not reproducible in Safari 17.4 on desktop (macOS).
- It's not clear what specific change could potentially cause this issue.
- It's not clear (to me) if this issue is specific to Safari or Webkit.

Reproduction code: https://github.com/adamhenson/get-user-media

Reproduction demo: https://get-user-media-sage.vercel.app/

Reproduction demo steps and expectations:
This demo will open a webcam stream upon clicking the "getUserMedia()" button. Clicking the "pushState()" button will push to browser history the path "/foo".
- Expected: the webpage will remain unchanged as nothing is listening to browser history.
- Actual: the webcam stream stops and instead display black.

-- 
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/20240317/ff888b6b/attachment.htm>


More information about the webkit-unassigned mailing list