This repository contains an example of using Huddle01 for selectively produce and consume which you can use it for your metaverse. Selectively produce means you can select to which peers you want to produce your stream and selectively consume means you can select from which peers you want to consume streams.
- Clone the repository using
git clone https://github.com/Huddle01/selective-consuming-example
- Change the directory using
cd selective-consuming-example
- Run
pnpm i
,yarn install
ornpm install
to install all packages. - Once, all packages are install start the server using
pnpm dev
,yarn dev
ornpm run dev
.
- Generate
projectId
from docs by connecting your wallet. Also, copy theAPI_KEY
to generateroomId
. - Use any API testing platform such as Postman, Thunderclient or even you can use cURL to generate roomId. To generate
roomId
refer here - Once, you generate
projectId
and haveroomId
you can use that to join lobby. - After joining lobby, allow permissions for cam/mic and click on join room.
- Repeat these same steps by opening same URL in other two tabs (for testing purpose). Make sure that you join using same
roomId
. - Now, go to first tab click on checkbox for audio/video of any peer and click on mic/cam icon to start producing.
- If you go to that peer (by opening respective tab) you can see that peer will starts consuming the audio/video. This happened because we have selectively produce for that peer.
selective-producing-consuming.mp4
To know more about selective consuming and producing you can refer to detailed docs from here.