aws / amazon-chime-sdk-js

A JavaScript client library for integrating multi-party communications powered by the Amazon Chime service.
Apache License 2.0
699 stars 472 forks source link

unsubscribe/resubscribe incoming video streams from certain attendees. #2822

Closed MohammedTaha closed 4 months ago

MohammedTaha commented 6 months ago

What are you trying to do?

Unsubscribe incoming video streams from a specific set of users.

How can the documentation be improved to help your use case?

As of now, there's no specific example about how to unsubscribe incoming video streams (irrespective of its type, either its content or just the normal user's webcam video).

Our use case is to have meetings with 25 or more attendees. We've implemented pagination to show max 20 attendees per page and pause/unsubscribe rest of them until user manually switch to next/previous page. There are few examples suggesting using VideoPriorityBasedPolicy but I wasn't able to actually make it work. Also it wont work on Firefox according to official documentation.

As soon as 26th attendee joins, the SDK throws this warning

Video receive limit exceeded. Limiting the videos to 25. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.

I've also tried to use the pauseVideoTile from VideoTileControllerFacade (no tile will be rendered for 2nd page's user, it will stay in paused mode and will get rendered and unpaused once someone changes the page) but it also didn't work and resulted same warning message as the 26th attendee joins.

What documentation have you looked at so far?

MohammedTaha commented 6 months ago

Hello team, hope you guys are back from holidays. Some updates after my last comment, I've paused all incoming video streams via pauseVideTile function, still as soon as the 26th attendee joins, the warnings gets logged into browser console Video receive limit exceeded. ......

const observer = {
  .. 
  .. 
  ...
  videoTileDidUpdate: (tile) => {
    ..
    ...
    if (tile.localTile) {

    } else {
      meetingSession.audioVideo.pauseVideoTile(tile.tileId);
    }
  }
}

Is there any chance I can get some help on it? cc @devalevenkatesh

hensmi-amazon commented 6 months ago

pauseVideoTile will not have any impact on the video limit. You can call chooseRemoteVideoSources on AllHighestVideoBandwidthPolicy: https://github.com/aws/amazon-chime-sdk-js/blob/main/src/videodownlinkbandwidthpolicy/AllHighestVideoBandwidthPolicy.ts#L52C22-L52C22 . Hopefully that works for you.

MohammedTaha commented 6 months ago

Thanks for responding @hensmi-amazon, calling chooseRemoteVideoSources with AllHighestVideoBandwidthPolicy seems the best available option.