amazon-chime-sdk-ios icon indicating copy to clipboard operation
amazon-chime-sdk-ios copied to clipboard

Local video stop/start after `videoAtCapacityViewOnly` status not triggering expected observer callbacks

Open tiltem opened this issue 3 years ago • 9 comments

Describe the bug Hello, wondering if we could get some help answering a question about the AudioVideoObserver in iOS SDK? The question is about the status code videoAtCapacityViewOnly that is triggered from videoSessionDidStartWithStatus when over 16 videos are streaming. We are noticing this is posted only once, and that the video tile is still added via videoTileDidAddjust after this status code is posted. Then, after getting videoAtCapacityViewOnly status, later calls to audioVideoFacade.stopLocalVideo() do not trigger videoTileDidRemove. Also noticing that if a stream opens up (someone stops video or leaves) then the previously blocked stream starts coming through.

Is there a way to stop the local video when hitting videoAtCapacityViewOnly such that future attempts to start local (via audioVideo.startLocalVideo()) will trigger videoTileDidAdd if space allows, or videoAtCapacityViewOnly if still full?

I have read #243 and it doesn't provide context for this use case.

To Reproduce Steps to reproduce the behavior:

  1. Run meeting with 16 video streams
  2. Add a 17 video stream
  3. Attempt to stop the local video after receiving videoAtCapacityViewOnly

Expected behavior When receiving videoAtCapacityViewOnly no video tile would be added via videoTileDidAdd, or added tile would be removed with call to audioVideoFacade.stopLocalVideo() AND, each attempt to start video when past max streams would trigger videoAtCapacityViewOnly status

Logs N/A

Screenshots N/A

Test environment Info (please complete the following information):

  • Device: [e.g. iPhone12]
  • OS: [e.g. iOS14]
  • Version AmazonChimeSDK: [e.g. 0.16.1]
  • Version AmazonChimeSDKMedia: [e.g. 0.11.2]

Additional context N/A

tiltem avatar Sep 26 '21 16:09 tiltem

Hi @tiltem, sorry for the late reply. Before making any suggestion, I'd like to understand more about your reproduce steps.

You mentioned that in step 2 you add the 17th video stream, were there already 16 video streams ongoing from other attendees?
Immediately you received videoAtCapacityVideoOnly? And were you able to confirm the 17th video stream is received from other ends?

Also noticing that if a stream opens up (someone stops video or leaves) then the previously blocked stream starts coming through

Which stream is blocked in the above example?

linsang21 avatar Oct 05 '21 17:10 linsang21

Hello @linsang21 ,

Yes, 16 streams already running, and 17th stream added results in videoAtCapacityVideoOnly status. The videoTileDidAdd is only received for the local video, right after the videoAtCapacityVideoOnly message. However, after receiving videoAtCapacityVideoOnly status, any calls to audioVideoFacade.stopLocalVideo() and audioVideoFacade.startLocalVideo() do not trigger related videoTileDidRemove/videoTileDidAdd callbacks for that user even if number of streams is below 16.

The "blocked" stream is referring to what was the 17th stream.

tiltem avatar Oct 05 '21 19:10 tiltem

Hi @tiltem, thanks for the info. If I understand correctly, the 17th stream is only happened for local video, and it's only subscribed locally (means you got videoTileDidAdd for this local video, nobody else is able to receive it). My current suspicion is that internally local video subscription is different from remote videos, may because of a shortcut. We'll look further into this. Out of curious, have you seen this issue on Android?

linsang21 avatar Oct 06 '21 19:10 linsang21

Hi @linsang21, Yes issue is seen in iOS SDK, haven't tested Android

tiltem avatar Oct 06 '21 19:10 tiltem

I was able to reproduce the issue using demo app. While we're looking further into this, you may consider protecting the app by disabling start local video call at app level once reaching the limit temporarily.

linsang21 avatar Oct 19 '21 19:10 linsang21

It's important to note that StartLocalVideo and StopLocalVideo are idempotent. VideoTileDidAdd won't be triggered on the second consecutive StartLocalVideo and VideoTileDidStop won't be triggered on the second consecutive StopLocalVideo. If you are calling StartLocalVideo then StopLocalVideo once, but still not seeing VideoTileDidRemove, then I think that's unexpected. That error videoAtCapacityViewOnly is kicked back from the server if either the server or the SDK are at capacity for videos turned on. There is also another callback that is not technically supported yet, but its in the internal directory so use with caution. It could change at any time. This callback tells you whether any attendee has hit their local video rendering limit and is invoked when attendees update their videos. You could use this callback to know when to restart local video after hitting the limit.

dylonChime avatar Nov 08 '21 11:11 dylonChime

Hello @dylonChime, When StartLocalVideo triggers error videoAtCapacityViewOnly, VideoTileDidAdd follows (for local video only). After this there is no way to trigger VideoTileDidRemove, a call to StopLocalVideo does not do it.

tiltem avatar Nov 08 '21 15:11 tiltem

Ok then this is the heart of the issue I think. Other behavior looks expected. We will continue to investigate.

dylonChime avatar Nov 08 '21 17:11 dylonChime

Just wanted to escalate this issue as we've been encountering it as well. We've imposed an internal app limit of 24 tiles that we are jumping through a few hoops to reinforce but it would be great for us to be able to rely on the SDK. Additionally we'd love to see the methods videoSendDidBecomeUnavailable supported in the iOS SDK like it is here as well as videoAvailabilityDidChange here. Let me know if you like a separate ticket for those or if that doesn't make sense.

jatindervrify avatar Mar 28 '22 23:03 jatindervrify

Hi @jatindervrify,

I don't think you need to open another issue, since those callbacks are closely related to the behavior of this edge case. We will post here when we have an update.

dylonChime avatar Sep 01 '22 00:09 dylonChime

The fix has been released in v.0.22.3. @jatindervrify @tiltem Feel free to try it out.

ziyiz-amzn avatar Sep 15 '22 21:09 ziyiz-amzn