neeraj sinha
neeraj sinha

Reputation: 31

How to fetch multiple live streams as an audience in agora using web sdk?

How to fetch multiple live streams as an audience in agora using web sdk? My use case is I am creating a web application where the screen is divided into 4 divs. Each div is fetching live stream as audience from 4 different channel similar to cctv monitors. Can I do this using agora?

Upvotes: 0

Views: 936

Answers (2)

Pranav Tk
Pranav Tk

Reputation: 1

First create a client using web-Sdk then create handler to listen to them (client.on('stream-added') then each created stream is to be subscribed(client.subscribe(stream) And still if small doubts just check this site: https://medium.com/agora-io/video-calling-using-agoras-javascript-sdk-73ba0a315cbd

Upvotes: 0

chrisg
chrisg

Reputation: 11

Are you using video or stream sdk?

For the Audience

You can create a client using the web-sdk, then create a handler to listen to when streams are added. For example:

client.on('stream-added'

Where you then have to subscribe to each stream using

client.subscribe(stream

So if you are the audience, you will be listening for stream-added 4 times. Then you can subscribe them and play them on different streams.

For the Streamer

You need to subscribe to the channel as usual, but set your role as host You can then publish a stream, which will be notified to all your audience members.

Refer to the Quickstart guide for the full example: https://docs.agora.io/en/Interactive%20Broadcast/publish_web_live?platform=Web

Upvotes: 1

Related Questions