[Webkit-unassigned] [Bug 230621] MediaStream canvas.captureStream() fails for Canvas Context2D

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 14 08:26:16 PST 2022


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

--- Comment #7 from Anastasiya Sarmant <ansarman at microsoft.com> ---
Any updates on that bug?
We have developed webgl2 based background replacement feature for MS Teams and this bug prevents us from shipping it on Safari.
We have Macbook Air M1 and Macbook Pro Intel based. The result of the below code snippet is a bit different on those machines. On M1 the stream is frozen but I'm able to get frames flowing by randomly clicking the page or scrolling, it looks the canvas streams expects repaint or layout update. On Macbook Pro it's frozen regardless. Attached a video example.

// simple repro
public async processStream(mediaStream: MediaStream): Promise<MediaStream> { 
        const settings = mediaStream.getVideoTracks()[0].getSettings(); 
        const canvas = document.createElement('canvas'); 
        const ctx = canvas.getContext('2d'); 
        canvas.width = settings.width; 
        canvas.height = settings.height; 
        const video = document.createElement('video'); 
        video.srcObject = mediaStream; 
        video.autoplay = true; 
        video.onplay = (): void => { 
            const loop = (): void => { 
                if (!video.paused && !video.ended) { 
                    ctx.drawImage(video, 0, 0); 
                    setTimeout(loop,1000 /66);  
                } 
            }; 
            loop(); 
        }; 
        video.play(); 
        return canvas.captureStream(); 
    }

-- 
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/20220114/fe2c1892/attachment.htm>


More information about the webkit-unassigned mailing list