Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix]VideoRenderers being added in multiple superviews #251

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

ipavlidakis
Copy link
Collaborator

@ipavlidakis ipavlidakis commented Dec 11, 2023

🎯 Goal

Ensure that video tracks are always visible.

📝 Summary

There are a two underline issues resulting in this bug:

  • When a user stops publishing video (that is translated as track muted for BE) we remove the track from our array and then we stop receiving events about it whenever the user decides to re-enable their camera.
  • The visibility observation was being added on the view ONLY when the participant had video. When the user reenables their video the view doesn't fire the geometry calculation causing the view to not trigger the track visibility change.
  • For local track we rely on 2 input signals to disable the track a) we disable locally the track we have a reference to, b) we send a mute request to the SFU which replies with an event that updates the participant to hasVideo:false. Due to this we have multiple instances of VideoRendererView trying to use the cached VideoRenderer.

🛠 Implementation

  • We now remove the unpublished track only in the case where the reason is different that muted
  • We apply the visibility modifier on all renderer views regardless of the user's publishing video.
  • We now have an optimisation in the VideoRendererView, where if the participant doesn't need to showVideo we render a dummy VideoRenderer and not trying to use the cached value.

🧪 Manual Testing Notes

  • Enter a call from web and iOS (with more than 6 participants).
  • Try all layouts and verify they work.
  • Start sharing from web and ensure that the local track is visible in all layouts.

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change follows zero ⚠️ policy (required)
  • This change should receive manual QA
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (Docusaurus, tutorial, CMS)

@ipavlidakis ipavlidakis added the bug Something isn't working label Dec 11, 2023
@ipavlidakis ipavlidakis self-assigned this Dec 11, 2023
@ipavlidakis ipavlidakis force-pushed the fix/local-video-track-disappears branch from 1f124db to 2e06696 Compare December 13, 2023 12:02
@ipavlidakis ipavlidakis changed the title [Fix]Use userId instead of id [Fix]VideoRenderers being added in multiple superviews Dec 13, 2023
@ipavlidakis ipavlidakis marked this pull request as ready for review December 13, 2023 14:13
@ipavlidakis ipavlidakis requested a review from a team as a code owner December 13, 2023 14:13
@ipavlidakis ipavlidakis force-pushed the fix/local-video-track-disappears branch from 42c5200 to 1f9a193 Compare December 15, 2023 18:41
Remove computed property
@ipavlidakis ipavlidakis force-pushed the fix/local-video-track-disappears branch from 1f9a193 to e4ef748 Compare December 19, 2023 10:29
Copy link
Collaborator

@martinmitrevski martinmitrevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find 👍 So now we remove the track in 2 cases:

  • when participant leaves the call
  • when the track is unpublished for other reasons than muting

@@ -72,10 +72,10 @@ struct VisibilityThresholdModifier: ViewModifier {

/// Check if the content view is vertically within the parent's bounds.
let verticalVisible = (minY + requiredHeight <= bounds.maxY && minY >= bounds.minY) ||
(maxY - requiredHeight >= bounds.minY && maxY <= bounds.maxY)
(maxY - requiredHeight >= bounds.minY && maxY <= bounds.maxY)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation here and on the next one

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually did that in purpose to help with the readability of the calculations. I can roll it back if you want though.

@ipavlidakis ipavlidakis force-pushed the fix/local-video-track-disappears branch from dbc32ce to 1d24d96 Compare December 19, 2023 13:35
Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

4 New issues
0 Security Hotspots
66.4% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@ipavlidakis ipavlidakis merged commit 5898d8f into main Dec 19, 2023
8 of 11 checks passed
@ipavlidakis ipavlidakis deleted the fix/local-video-track-disappears branch December 19, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ✅ QAed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants