DEV Community

Discussion on: An introduction to the MediaRecorder API

Collapse
 
philnash profile image
Phil Nash

You can capture desktop video using getDisplayMedia as I show in this post on desktop capture in Edge. This works for Chrome now too, though you used to need an extension. Firefox supports desktop capture, but with an non-standard methods.

Once you capture the media stream, you can use the MediaRecorder just like in this post.

Collapse
 
flozero profile image
florent giraud

ok i got my response for the specific window capture

Collapse
 
flozero profile image
florent giraud • Edited

Maybe you will know this too so !

Can we stream just a part of the screen or can we take just a specific window

Do you know how to send this media stream to a rtmp flux ?

Thread Thread
 
philnash profile image
Phil Nash

This isn’t something I’ve done, but I’m interested!

Within the getDisplayMedia permissions dialog, the user gets to choose whether they share the whole screen or just a window.

To stream just part of the screen, you could copy the video to a canvas element and crop it there, then export the canvas back to a MediaStream using the captureStream method.

As for streaming to RTMP, that is not something built into the browser. You’ll need to stream to a server using webRTC or web sockets and then have the server turn it into a RTMP stream.