[Webkit-unassigned] [Bug 181663] Video Element cannot playback local Canvas.captureStream on iOS

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Apr 30 03:34:28 PDT 2022


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

Claudio Destro <claudio.destro at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |claudio.destro at gmail.com

--- Comment #24 from Claudio Destro <claudio.destro at gmail.com> ---
Hope this helps.

The issue still persists in Safari 15.4+ desktop but using "webgl2" context seems to work:

Modified example code:

            const videoEl = document.createElement('video');

            const canvas = document.createElement('canvas');
            const ctx = canvas.getContext('webgl2');
            canvas.width = 640;
            canvas.height = 480;

            const randomColour = () => {
                return Math.round(Math.random() * 255);
            };

            setInterval(function () {
                ctx.viewport(0, 0, canvas.width, canvas.height);
                ctx.clearColor(Math.random(), Math.random(), Math.random(), 1.0);
                ctx.clear(ctx.COLOR_BUFFER_BIT);

                // ctx.clearRect(0, 0, canvas.width, canvas.height);
                // ctx.fillStyle = `rgb(${randomColour()}, ${randomColour()}, ${randomColour()})`;
                // ctx.fillRect(0, 0, canvas.width, canvas.height);
            }, 1000);

            document.body.appendChild(canvas);
            document.body.appendChild(videoEl);

            videoEl.srcObject = canvas.captureStream(1);
            videoEl.setAttribute('playsinline', '');
            videoEl.play();

PS: In fact WebRTC Sample "Canvas to Video" works
https://webrtc.github.io/samples/src/content/capture/canvas-video/

-- 
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/20220430/05e3e470/attachment.htm>


More information about the webkit-unassigned mailing list