Jump to content
  • 1

Broadcast camera and screen as separate streams/tracks


dmitry027
 Share

Question

Hello, everyone.

Using JavaScript SDK, when we are broadcasting in "screen+camera" mode, both streams are combined into one on the client side and sent to the server as a single stream.

image.png.95f1b598812d4e03be1f73afb54abd11.png

Is there a way to broadcast camera and screen streams as a separate streams/tracks simultaneously?

image.thumb.png.2e3c1c7e9c1e44ee929ef354fc818208.png

  • Like 1
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

Hi @dmitry027

We are adding camera to stream with canvas in "screen+camera" option in our example. 

I have some options for you:

1- You may send 2 stream with seperately. One of them is screen, the other one is camera. On the viewer side, you can show streams with separated video tags.

2- Combine localstreams with canvas as "screen+camera" example. I'm adding guide pages to you:

https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Manipulating_video_using_canvas

https://antmedia.io/how-to-merge-live-stream-and-canvas-in-webrtc-easily/

I hope, I could help you.

Best Regards,

Selim

  • Like 1
Link to comment
Share on other sites

  • 0

Hello, @Selim. Thank you for your answer.

As far as I understand WebRTCAdaptor provides no ability to broadcast multiple streams simultaneously, as stated in webrtc_adaptor.js:

/**
 * This is the Stream Id for the publisher. One @WebRCTCAdaptor supports only one publishing
 * session for now (23.02.2022).
 * ...
 */
this.publishStreamId = null;

So, do I need to create two instances of WebRTCAdaptor (one for camera and one for screen) to broadcast them separately?

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...