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

documentation on how to use the output MediaStream #12

Closed maks closed 6 years ago

maks commented 6 years ago

I'm new to using the MediaCapture and WebRTC APIs, so I was hoping you could include some samples or pointers to examples in the Readme on how to get hold of the output MediaStream and for example to save it to a file?

t-mullen commented 6 years ago

Here's how you can get the output Mediastream (from the docs).

wbs.on('stream', function (stream) {
    // fired when user presses "Start Streaming"
    stream // <--- the output MediaStream, ready to use
  })

You can use the MediaRecorder API to save to a file. There are multiple repos that assist with this API: https://github.com/streamproc/MediaStreamRecorder https://github.com/mafintosh/media-recorder-stream https://github.com/muaz-khan/RecordRTC

maks commented 6 years ago

Perfect, thanks that's exactly what I was after. Sorry I missed that in the readme, makes perfect sense now and also thank you for the links to the other projects too.