Is there "listener" mode in daily.co in react native?

73 Views Asked by At

Is there a way to have "listener" mode in Daily.co where the user is not using the mic and is only subscribed listening to the other user?

I tried Daily.join but it automatically joins the room

const callObject = await Daily.createCallObject({
      url: dailyRoomUrl,
    });

    await callObject.join({
      userName: username,
      startVideoOff: true,
      startAudioOff: true,
    });
1

There are 1 best solutions below

2
Md Rafiqul Islam On

Yes, it is possible to have a "listener" mode in Daily.co where the user is only subscribed and can listen to the other user without using the microphone. To achieve this, you can set the startAudioOff option to true when joining the call, which will turn off the user's microphone upon joining.

In your code snippet, you have already set startAudioOff: true, which is the correct approach. However, you mentioned that the user is automatically joining the room. If you want to prevent automatic joining and instead have the user join as a "listener" after the initial join, you can modify your code as follows:

const callObject = await Daily.createCallObject({
  url: dailyRoomUrl,
  userName: username,
  startVideoOff: true,
  startAudioOff: true,
});

// This will create the call object without joining the room

// Later, when you want to join the room as a listener:
await callObject.join();

By separating the call object creation and joining, you have more control over when the user actually joins the call. This way, you can create the call object with the desired settings (such as audio off), and then join the call later when you're ready for the user to start listening.