问题
I am trying to capture html5 canvas using captureStream API which has drawings on it and play it using html5 video tag.
Problem I am facing is, when I capture the stream and play it with in video tag It plays exactly same.
But when I send that stream to the another peer (webRTC Streaming Using Licode MCU) and play it there.
It gets played with the black background. i.e. video is not transparent anymore.
Has anyone encountered this before?
What could be the issue:
Is it the issue with the webrtc channel, may be its not able to handle transparent pixels?
OR
It can be something to do with the media server? Or something else?
回答1:
It sounds like you're sending your canvas as video data. WebRTC usually uses either VP8 or H264 to transmit video and neither support alpha channels. So if you want to sent it as a video, it is not possible to use transparency.
You could, however, send it using the data channel part of WebRTC. You'd have to serialize and deserialize it yourself, but since it's just transmitting bytes, you can keep your alpha channel.
来源:https://stackoverflow.com/questions/39763812/streaming-video-with-transparent-pixels-using-webrtc