Can I set the video-source as my own html-5 canvas instead of camera? Thanks!

Hi,

I am trying to mix the camera video and user’s painting(in real-time) in a html-5 canvas, then capture this canvas as the video-source of a webRTC PeerConnection and send out the mixed video(camera+painting), I can do it with webRTC referenced the following samples:
https://webrtc.github.io/samples/


https://webrtc.github.io/samples/src/content/capture/canvas-pc/
https://webrtc.github.io/samples/src/content/capture/canvas-record/
https://webrtc.github.io/samples/src/content/getusermedia/canvas/

now I am trying to send this mixed video to jitsi-server so this user could share both video and paining to other participants in this meet-room, could you let me know how can I use jitsi-meet LIB to do this?
can I do the following with jitsi-met LIB:

const stream = canvas.captureStream();

also I find a sample “Hats for Jitsi Meet”? can I find the source code of this sample? Thanks!
https://jitsi.org/gsoc/hats/