Examples of how to convert a video file to a MediaStream where it can be sent via WebRTC.
See webrtcHacks post for full details, commentary, and comparisons.
- getDisplayMedia of pop-out video file - load a video file into a pop-up and use
getDisplayMediafor capture. - VideoElement Capture Stream - capture the video and audio directly from a
videoelement. The audio is captured using the Web Audio API and combined with the video stream to create aMediaStream. - VideoElement Capture Stream with WebAudio - same as above, but experimenting with using WebAudio for local audio control.
- Canvas Capture + Web Audio - write a source video to a canvas and then use
canvas.captureStream()to capture the video with Web Audio API to capture the audio. - WebCodecs - load a video file and use WebCodecs to convert it to a MediaStream
- getDisplayMedia of pop-out video file - load a video file into a pop-up and use the
getDisplayMediafor capture. - VideoElement Capture Stream - capture the video and audio directly from a
videoelement. The audio is captured using the Web Audio API and combined with the video stream to create aMediaStream. - VideoElement Capture Stream with WebAudio - same as above, but experimenting with using WebAudio for local audio control.
- Canvas Capture + Web Audio - write a source video to a canvas and then use
canvas.captureStream()to capture the video with Web Audio API to capture the audio. - WebCodecs - load a video file and use WebCodecs to convert it to a MediaStream
Big Buck Bunny video converted to 640x360 at 30 fps from peach.blender.org.