Selfie segmentation / virtual background via Webrtc

53 views
Skip to first unread message

Elena

unread,
Aug 12, 2022, 12:10:45 PMAug 12
to discuss-webrtc

I was able to implement Selfie segmentation on a videoconference project in Vue.js, but I cannot in any way send the result of the canvas to a remote peer.

I tried with 'insertable streams' and also with the captureStream() function, but to no avail.

After generating the canvas output, I try to add the track to the peer with a simple addTrack


this.signalClient.peers().forEach((p) => { p.removeTrack(old, this.localStream); p.addTrack(trackCanvas, this.localStream)})


Anyone know how this is done? I can't find any documentation about it, nor a sample anywhere

Thanks a lot


 

Lorenzo Miniero

unread,
Aug 26, 2022, 7:04:31 AMAug 26
to discuss-webrtc
You can check this demo I added to the Janus repo a few months ago: https://janus.conf.meetecho.com/virtualbg
It does indeed use the canvas as source of a PeerConnection, to send the encoded video to the EchoTest demo in Janus.

L.
Reply all
Reply to author
Forward
0 new messages