I am sending a mediastream of canvas over webrtc peer connection. Now, when I receive mediastream, I add mediastream to the video element which shows background black. I want to make the background transparent so that a multi-layer canvas can be streamed. I found similar questions but most of them seems to old.
After reading different blogs and comments I learned below approaches :-
- When I receive mediastream I will stream video over canvas and then change alpha of canvas image to effect background. But this will be slow.
- I read somewhere that VP9 or H286 codec used by webrtc mediastream don't have any alpha field so we can't make video transparent. So it is not possible to make video transparent.
I want to know is there any better way to resolve these issues.
For example, I created a server where canvas whiteboard is running and on client side client can able to stream that canvas as video.
Canvas whiteboard
Video stream of above canvas
So in above image one is original canvas whiteboard and second one is video stream of a canvas. Now the video has black background. I want to make background transparent.