Streaming video from a canvas element using WebRTC

I use WebRTC for peer-to-peer video calling, and I would like to apply video filters to the local video in the webcam before sending it to a remote partner.

The approach I'm considering is to send the local video to the webcam on the canvas element, where I will apply javascript filters to the video. Then I would like to transfer the video from the canvas element to peer using WebRTC. However, it is not clear to me whether this is possible.

Can I transfer video from a canvas element using WebRTC? If so, how can this be done? Alternatively, are there any other approaches that I could consider to achieve my goal?

+4
source share
2 answers

mozCaptureStreamUntilEnded is supported in firefox, but the resulting stream cannot be attached to a peer connection.

Playback is <canvas>simpler, but streaming media from an element <video>requires a media processing API (capture-stream-until-end) along with RTCPeerConnection (with all the support functions).

We can get images from <canvas>, but I'm not sure if we can create a MediaStream from <canvas>.

So mozCaptureStreamUntilEnded is only useful for wth pre-recorded media streaming .

0
source

, , , , , , ( n ) ( ) settimeout/requestAnimationFrame.

0

All Articles