Bug 255770

Summary: getUserMedia occasionally doesn't work in SFSafariViewController x iPhone
Product: WebKit Reporter: Kengo <kenken19920616>
Component: WebRTCAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: webkit-bug-importer, youennf
Priority: P1 Keywords: InRadar
Version: Other   
Hardware: iPhone / iPad   
OS: All   
URL: https://webrtc-test-loading-reproduction.netlify.app/
Attachments:
Description Flags
Reproduction Bug none

Description Kengo 2023-04-21 01:22:24 PDT
Created attachment 466027 [details]
Reproduction Bug

## Component
Web RTC

## Platform and OS
We found this issue with the devices and OS version below.

### devices 
iPhone SE / iPhone 8 / iPhone 12 mini / iPhone 14 / iPhone 14 Pro / iPhone 14 Pro Max, etc...
### OS Version
iOS 15.6 / 15.7.3 / 15.7.4 / 16.2 / 16.3.1. / 16.4, etc...

## Priority
Default

## Severity
normal

## URL
- Reprodction Site: https://webrtc-test-loading-reproduction.netlify.app/
- Reproduction Code: https://github.com/kei-creative-life/webrtc-test

## Summary
Occasionally, the camera in iPhone doesn't work in SFSafariViewController, which means getUserMedia doesn't work.
But it works all fine in Safari.
We found that we can reproduct this bug in most kinds of iPhone series like iPhone 14, iPhone 14 Pro, etc.

## Description
You can reproduct the issue with the following steps.

When the camera in the reproduction site worked, logs which is video events log showed up below.
[log]
video loadstart → video progress → video suspend → video durationchange → video resize
→ video loadedmetadata → video loadeddata → video canplay → video canplaythrough → video play
→ video playing

On the other hand, when camera doesn't work, video events log finished with "video suspend" event.
[log]
video loadstart → video progress → video suspend

### Via Slack App
1. You click and open the reproduction website URL (https://webrtc-test-loading-reproduction.netlify.app/) via Slack App with any iPhone.
2. You push "open camera" on the site.
3. You can sometimes see the video button on the upper right is disabled, and the screen still gets black.

### Via Shortcuts App
1. You click and open the reproduction site (https://webrtc-test-loading-reproduction.netlify.app/) via Shortcuts App with any iPhone.
2. You push "open camera" on the site.
3. You can sometimes see the video button on the upper right is disabled, and the screen still gets black.
Comment 1 youenn fablet 2023-04-21 03:38:36 PDT
<rdar://108362887>