t-mullen / Web-Broadcasting-Software

Broadcasting software for the web. (WBS)
https://t-mullen.github.io/Web-Broadcasting-Software/
MIT License
141 stars 25 forks source link

How to use an incoming MediaStream? #13

Closed maks closed 6 years ago

maks commented 6 years ago

I'd like to be able to use an incoming MediaStream (eg. one being captured from another a webbrowser on another computer using a desktop (eg. using something like https://github.com/muaz-khan/Chrome-Extensions) as one of the video inputs in a scene. The Readme currently does say I can add any video input to opts.inputs but I'm clear what the stream arg in the callback should be? Is it a MediaStream object that I create by pointing at a url that the desktop capture streaming extension would provide? Sorry if this is a very basic/obvious question.

t-mullen commented 6 years ago

Yes, the stream argument in the callback is a Mediastream object obtained in any way.

t-mullen commented 6 years ago

If you're asking how to get a MediaStream object, there's many ways: They can be generated using the captureStream APIs (on canvas or video), provided by a bunch of different desktop capture APIs (like the Chrome one you linked), received through an RTCPeerConnection or through getusermedia.

maks commented 6 years ago

Thank you again. RTCPeerConnection is what I'm looking for. Really appreciate your help! I think I have all the pieces now to experiment with the setup I need.