RESOLVED FIXED 242679
[macOS] Canvas.getContext('2d').drawImage on a camera video stream does not work when tab is backgrounded
https://bugs.webkit.org/show_bug.cgi?id=242679
Summary [macOS] Canvas.getContext('2d').drawImage on a camera video stream does not w...
youenn fablet
Reported 2022-07-13 01:07:50 PDT
1. Load https://jsfiddle.net/eq5upzh6/. 2. Grant prompt 3. Once the camera starts, switch to another tab and change what the camera captures. 4. Wait 6 seconds 5. Switch back to the JSFiddle tab. One of the canvas (canvas1) stayed to a camera frame just before the switch to the other tab. We would expect canvas1 to keep being updated even when the other tab is backgrounded.
Attachments
Radar WebKit Bug Importer
Comment 1 2022-07-13 01:08:08 PDT
youenn fablet
Comment 2 2022-07-13 01:08:49 PDT
This bug was externally reported.
Anastasiya Sarmant
Comment 3 2022-07-13 01:22:20 PDT
The canvas stops streaming when the tab becomes inactive.
youenn fablet
Comment 4 2022-07-22 04:15:51 PDT
In the jsfiddle, the video element is not playing any audio and might be paused when page goes to background. One way to prevent it is to add a silent audio track. For instance https://jsfiddle.net/0h5edpLw/. This raises the question of what happens to media elements which get paused as not visible+silent while they are repeatedly drawn to canvas. In a sense, these media elements are visible so we should probably not pause them.
youenn fablet
Comment 5 2022-07-22 06:50:14 PDT
EWS
Comment 6 2022-07-22 12:19:12 PDT
Committed 252738@main (de9dae2e5319): <https://commits.webkit.org/252738@main> Reviewed commits have been landed. Closing PR #2655 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.