Reputation: 1008
Is it possible to record 2 webm videos (with WebRTC
) and then merge them into one stream (picture in picture).
Example:
recording A shows camera A (streams out)
recording B shows camera B (streams out)
stream A shows one frame with A+B as merged stream (interview between two people)
Upvotes: 3
Views: 2118
Reputation: 21380
Yes, it is by using the Media Recording API.
First you have to create a <canvas>
where you will draw the two <video>
elements. When creating the MediaRecorder you will pass the canvas stream: new MediaRecorder(canvas.captureStream())
.
In a timeout/interval you will draw the two videos in the canvas: canvas.getContext("2d").drawImage(video, 0, 0, width, height);
.
Upvotes: 4