Summary: | <video> rendered inside <template> shows black for webcam stream (Safari 14.0.3 only) | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Alex <asashayko> | ||||||
Component: | WebRTC | Assignee: | youenn fablet <youennf> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | calvaris, cdumez, changseok, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, philipj, rniwa, ryansolid, sergio, webkit-bug-importer, youennf | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | Safari 14 | ||||||||
Hardware: | Mac (Intel) | ||||||||
OS: | macOS 11 | ||||||||
Attachments: |
|
Description
Alex
2021-02-18 09:12:01 PST
Reproduced this black screen on M1 Mac as well. https://codesandbox.io/s/streaming-user-device-dodse Video seems to come in when the window loses and regains focus. Template cloning also seems to also affect autoplay behavior of any video. https://codesandbox.io/s/broken-autoplay-safari-vrr40?file=/src/index.js I noticed this since it breaks in JavaScript frameworks that rely on this method for cloning nodes to do their templating. Lit uses `document.importNode` which seems to be fine, a number of other frameworks use this method. I'm the maintainer of Solid(https://github.com/solidui/solid) one such framework affected by this. I cannot reproduce on my iMacPro with STP. As of back screen on M1 Mac, this is handled internally. @Ryan, can you try the latest BigSur 11.3 update to see whether the issue is fixed for you on the M1? Just updated to 11.3.1 and Safari 14.1 (16611.1.21.161.6). I can still reproduce in all the posted reproductions. Thanks Ryan, I split your issues as separate issues as they might be M1 specific. @Alex, are you still seeing this issue. Is it M1 specific? I think this is basically https://bugs.webkit.org/show_bug.cgi?id=222657. I had a look and it seems that the media element thinks it is hidden, hence why rendering does not work. This probably explains also the autoplay restriction. I also reproduced this in Safari 14.1 on my Intel Macbook Pro on Catalina (work computer). Created attachment 429145 [details]
Patch
Comment on attachment 429145 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429145&action=review > LayoutTests/fast/media/template-hidden.html:19 > + myVideo.srcObject = await navigator.mediaDevices.getUserMedia({video:true}); > + await myVideo.play(); Do we really need to use getUserMedia here? I think a regular video will be enough? (In reply to Ryosuke Niwa from comment #10) > Comment on attachment 429145 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=429145&action=review > > > LayoutTests/fast/media/template-hidden.html:19 > > + myVideo.srcObject = await navigator.mediaDevices.getUserMedia({video:true}); > > + await myVideo.play(); > > Do we really need to use getUserMedia here? I think a regular video will be > enough? The test does not need it as it uses internals API. When running the test manually, it is safer to use this code path since the renderer is different from regular video streaming. I'll update the patch to have it run in WK1 as well by making the getUserMedia call optional. Created attachment 429153 [details]
Patch
(In reply to youenn fablet from comment #5) > Thanks Ryan, I split your issues as separate issues as they might be M1 > specific. > @Alex, are you still seeing this issue. Is it M1 specific? Hi! Yes, still happening for me at Safari 14.1 (16611.1.21.161.6) macOS Big Sur 11.3.1, Intel-based Macbook Pro. Cheers! Comment on attachment 429153 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429153&action=review > LayoutTests/fast/media/template-hidden.html:17 > + if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) Isn’t this test reversed? Comment on attachment 429153 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429153&action=review >> LayoutTests/fast/media/template-hidden.html:17 >> + if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) > > Isn’t this test reversed? Should be fine as is, we call getUserMedia if defined and return undefined otherwise Committed r277783 (237944@main): <https://commits.webkit.org/237944@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 429153 [details]. |