About Pagination & subscribe partically

Currently I’m adding pagenations to webrtc.

My question is, is it possible to subscribe to audio and video in partically?

For example, there are 4 participants,

Let’s say there are two people on page 1 and the other two on page 2.
When I’m looking at page 1, I get audio for all 4 people, but I only get 2 videos and I want to keep the other 2 videos out of sight.
The point here is, Not display: none for people on page 2, but I want to subscribe ‘audio’ only for the people on page 2.
If any developers have encountered this situation, please help.
Thank you!

(I think I need to use function update… hmm)

  /**
   * [multistream] Update a subscription.
   *
   * @param {object[]} subscribe - The array of streams to subscribe
   * @param {object[]} unsubscribe - The array of streams to unsubscribe
   *
   * @returns {Promise<module:videoroom-plugin~VIDEOROOM_EVENT_UPDATED>}
   */
  async update({ subscribe, unsubscribe }) {
    const body = {
      request: REQUEST_UPDATE, // 'update'
    };
    if (Array.isArray(subscribe)) body.subscribe = subscribe;
    if (Array.isArray(unsubscribe)) body.unsubscribe = unsubscribe;

    const response = await this.message(body);
    const { event, data: evtdata } = response._janode || {};
    if (event === PLUGIN_EVENT.UPDATED) {
      return evtdata;
    }
    const error = new Error(`unexpected response to ${body.request} request`);
    throw (error);
  }

For pagination, better to use switch than update, since switch just changes the source of media on existing streams, and so doesn’t need a renegotiation (much faster).

When subscribing to participants on pages that are not currently visible in pagination, how about subscribing only to their audio?
In fact, the reason for doing this is not only to reduce the traffic coming to the client, but also to anticipate a reduction in the load on the Janus server.
As an idea to alleviate the burden on both the client and the server, I would appreciate it if you could let me know if you have any better suggestions.

Thank you I’ll keep that in my mind :slight_smile:

This is what I’m looking for haha Thank you for your reply

In general you can subscribe to the audio of a participant by specifying only the audio mid in the streams object (you get that info from the participant list).
Doing so you’ll need renegotiation anytime your pagination changes (send update requests with new mids).
Another approach would be to use the “send” parameter of a stream to update the subscription. Start with subscribing to all mids (audio and video), then update to make Janus send only the needed media, according to pagination.

That said, unfortunately much of this is still largely unsupported on Janode. I’ll try to add something in the next weeks.

a draft patch is currently available for vr