0

I want to use AWS IVS (with the Web Broadcast SDK) to send a user's webcam and screen live streams to two separate IVS channels in a React webapp. I can send each one separately, or both in separate tabs, but when I try to send both from the same tab / instance of the webapp, it sends either the webcam or the screen to both channels, essentially overwriting the first one sent when the second is sent.

I have creating separate objects for each stream, but the IVSBroadcastClient object isn't instantiated so I can't figure out how I can do this.

jackomeara
  • 11
  • 1

1 Answers1

0

It's not explicitly supported, but it technically works if you create multiple instances of the broadcast client. See the example below, but watch out for possible performance issues as this may cause CPU spikes on the client running this code.

const broadcastClientOne = IVSBroadcastClient.create({
    streamConfig: IVSBroadcastClient.STANDARD_LANDSCAPE,
    ingestEndpoint: 'f99084460c35.global-contribute.live-video.net', // make sure to use your own ingestEndpoint
});

const broadcastClientTwo = IVSBroadcastClient.create({
    streamConfig: IVSBroadcastClient.STANDARD_LANDSCAPE,
    ingestEndpoint: 'f99084460c35.global-contribute.live-video.net', // make sure to use your own ingestEndpoint
});

Here's a full demo on CodePen:

https://codepen.io/recursivecodes/pen/JjmGrdw

Todd Sharp
  • 3,207
  • 2
  • 19
  • 27
  • Thanks for your answer. Unfortunately, this solution behaves the same as my web app: when trying to stream two different video sources (like a screen and a webcam), this method will stream the same video to both channels. It streams the video source of whichever IVSBroadastClient was created second, seemingly overwriting the original instance. I'm looking for a way to stream two different sources to two different channels, simultaneously. – jackomeara Apr 14 '23 at 15:40
  • @jackomeara - can you share your code? – Todd Sharp May 09 '23 at 13:49
  • My code is the same as your demo (but in ReactJS), and behaves in the same way. I contacted AWS support and they advised to use stages to combine the screens to a single stream. This would work, but would be more expensive – jackomeara May 12 '23 at 08:56