IVS Realtime "Listener" Participant Events

0

I've set up an Audio room using IVS Realtime where there are two types of participants, speakers and listeners. My problem is I only see STAGE_PARTICIPANT_JOINED events trigger for "speaker" participants, not "listeners".

When a "speaker" joins the stage, their token includes both the "PUBLISH" and "SUBSCRIBE" capabilities and their strategy looks like:

      const strategy = {
        stageStreamsToPublish() {
          return [micStream];
        },
        shouldPublishParticipant(participant: StageParticipantInfo) {
          return true;
        },
        shouldSubscribeToParticipant(participant: StageParticipantInfo) {
          switch (participant?.attributes?.role) {
            case "speaker":
              return SubscribeType.AUDIO_ONLY;
            case "listener":
              return SubscribeType.NONE;
            default:
              return SubscribeType.NONE;
          }
        },
      };

and when a "listener" joins the stage, their token only includes the "SUBSCRIBE" capability and their strategy looks like:

     const strategy = {
      stageStreamsToPublish() {
        return [];
      },
      shouldPublishParticipant(participant: StageParticipantInfo) {
        return false;
      },
      shouldSubscribeToParticipant(participant: StageParticipantInfo) {
        switch (participant.attributes.role) {
          case "speaker":
            return SubscribeType.AUDIO_ONLY;
          case "listener":
            return SubscribeType.NONE;
          default:
            return SubscribeType.NONE;
        }
      },
    };

My event handler for STAGE_PARTICIPANT_JOINED events just console logs the participant info and, as mentioned, I only see this happen when a participant joins with role "speaker".

I've tested various combinations of strategies and capabilities for the listener but I don't see any events unless I match the settings to that of a "speaker" which means adding a stream to publish and I'll need to request microphone access. I'd really like to avoid this as I don't think that should be necessary if the participant will never publish audio.

Is there a way to have a participant join without a publishable stream and still see STAGE_PARTICIPANT_JOINED events for that participant?

asked 23 days ago25 views
1 Answer
0
Accepted Answer

Based on the information provided, it appears that the behavior you're experiencing is expected with the current configuration of your IVS Realtime stage and participant strategies.

The STAGE_PARTICIPANT_JOINED event is typically triggered when a participant joins the stage and is ready to publish or be subscribed to. In your case, the "listener" participants are not publishing any streams and are not being subscribed to by anyone else, which is likely why you're not seeing these events for them.

To address this issue and receive STAGE_PARTICIPANT_JOINED events for "listener" participants without requiring them to publish a stream, you could try the following approaches:

  1. Modify the strategy for other participants (including speakers) to subscribe to listeners, even if it's just temporarily. This might trigger the join event for listeners. You could set SubscribeType.AUDIO_ONLY or SubscribeType.AUDIO_VIDEO for listeners in the shouldSubscribeToParticipant function, then immediately unsubscribe if needed.

  2. Consider adding a dummy stream for listeners to publish, which doesn't actually transmit any data but satisfies the publishing requirement. This could be a silent audio stream or a blank video stream.

  3. Explore using the IVS Real-Time Streaming API to list stage participants. You could periodically call the ListStageParticipants API to get an up-to-date list of all participants, including listeners.

  4. If possible, adjust your application logic to not rely solely on the STAGE_PARTICIPANT_JOINED event for tracking listener presence. You might need to implement a custom solution using a separate signaling mechanism (like AWS AppSync or Amazon IVS Chat) to track listener join/leave events.

It's important to note that the exact behavior of IVS Realtime with regards to non-publishing participants may vary, and the service might have limitations or specific requirements for triggering events for such participants. If these suggestions don't resolve the issue, you may need to contact AWS support for more specific guidance on handling listener participants in your use case.
Sources
Publishing & Subscribing with the IVS Android Broadcast SDK | Real-Time Streaming - Amazon IVS
Publishing & Subscribing with the IVS iOS Broadcast SDK | Real-Time Streaming - Amazon IVS
Community | Live Streaming from Unity - Real-Time Playback (Part 7)
Community | Build a UGC Live Streaming App with Amazon IVS: Broadcast Real-Time with Multi-Hosts (Lesson 4.3)

profile picture
answered 23 days ago
profile pictureAWS
EXPERT
reviewed 20 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions