Skip to content

fix(filmstrip) Excludes partially visible tiles from visible participants calculation#16909

Closed
jallamsetty1 wants to merge 2 commits intomasterfrom
fix-filmstrip
Closed

fix(filmstrip) Excludes partially visible tiles from visible participants calculation#16909
jallamsetty1 wants to merge 2 commits intomasterfrom
fix-filmstrip

Conversation

@jallamsetty1
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 6, 2026 20:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates filmstrip “visible participants” computation so partially visible thumbnails at the viewport edges are excluded, improving accuracy of the visible range used by the filmstrip feature.

Changes:

  • Web: adds _excludePartiallyVisibleTiles and applies it in _onListItemsRendered before dispatching setVisibleRemoteParticipants.
  • Native: adjusts _onViewableItemsChanged to shrink the computed visible index range based on container/item dimensions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
react/features/filmstrip/components/web/Filmstrip.tsx Adds helper to adjust visible indices and uses it before dispatching visible remote participants.
react/features/filmstrip/components/native/Filmstrip.tsx Shrinks viewable index range to exclude partial tiles based on computed filmstrip dimensions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 896 to 909
// Calculate how many items can fit fully in the container
const fullyVisibleCount = Math.floor(containerSize / itemSize);

// Calculate how many items are currently in the visible range (inclusive)
const currentVisibleCount = stopIndex - startIndex + 1;

// If we have more items visible than can fit fully, we have a partially visible tile at the end
if (currentVisibleCount > fullyVisibleCount) {
// Reduce stopIndex to exclude the partially visible tile
return {
startIndex,
stopIndex: startIndex + fullyVisibleCount - 1
};
}
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

The calculation here can produce fullyVisibleCount === 0 when containerSize < itemSize, which makes the returned stopIndex become startIndex - 1. That can later propagate into setVisibleRemoteParticipants(startIndex, stopIndex) and lead to an invalid/negative range. Consider clamping fullyVisibleCount to at least 1 (or short-circuiting to an empty visible range with a well-defined sentinel) so downstream code never receives endIndex < startIndex unexpectedly.

Copilot uses AI. Check for mistakes.
Comment on lines 984 to 1018
dispatch,
_currentLayout,
_filmstripWidth,
_filmstripHeight,
_thumbnailWidth,
_thumbnailHeight,
_isVerticalFilmstrip
} = this.props;

let adjustedStartIndex = visibleStartIndex;
let adjustedStopIndex = visibleStopIndex;

// Exclude partially visible tiles
if (_currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
const itemSize = _thumbnailWidth + TILE_HORIZONTAL_MARGIN;

({ startIndex: adjustedStartIndex, stopIndex: adjustedStopIndex } = this._excludePartiallyVisibleTiles(
visibleStartIndex,
visibleStopIndex,
_filmstripWidth,
itemSize
));
} else if (_isVerticalFilmstrip) {
const itemSize = _thumbnailHeight + TILE_VERTICAL_MARGIN;

({ startIndex: adjustedStartIndex, stopIndex: adjustedStopIndex } = this._excludePartiallyVisibleTiles(
visibleStartIndex,
visibleStopIndex,
_filmstripHeight,
itemSize
));
}

const { startIndex, stopIndex } = this._calculateIndices(adjustedStartIndex, adjustedStopIndex);

Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

This approach only uses visibleStartIndex/visibleStopIndex plus a count-based heuristic, so it can’t reliably exclude partially visible tiles at the start of the viewport (e.g., when scrolled mid-item) and can still include a partially visible first tile when both ends are partial. To truly exclude partials, you likely need the current scroll offset (e.g., from FixedSizeList onScroll) and adjust startIndex/stopIndex based on scrollOffset % itemSize and (scrollOffset + containerSize) % itemSize.

Suggested change
dispatch,
_currentLayout,
_filmstripWidth,
_filmstripHeight,
_thumbnailWidth,
_thumbnailHeight,
_isVerticalFilmstrip
} = this.props;
let adjustedStartIndex = visibleStartIndex;
let adjustedStopIndex = visibleStopIndex;
// Exclude partially visible tiles
if (_currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
const itemSize = _thumbnailWidth + TILE_HORIZONTAL_MARGIN;
({ startIndex: adjustedStartIndex, stopIndex: adjustedStopIndex } = this._excludePartiallyVisibleTiles(
visibleStartIndex,
visibleStopIndex,
_filmstripWidth,
itemSize
));
} else if (_isVerticalFilmstrip) {
const itemSize = _thumbnailHeight + TILE_VERTICAL_MARGIN;
({ startIndex: adjustedStartIndex, stopIndex: adjustedStopIndex } = this._excludePartiallyVisibleTiles(
visibleStartIndex,
visibleStopIndex,
_filmstripHeight,
itemSize
));
}
const { startIndex, stopIndex } = this._calculateIndices(adjustedStartIndex, adjustedStopIndex);
dispatch
} = this.props;
const { startIndex, stopIndex } = this._calculateIndices(visibleStartIndex, visibleStopIndex);

Copilot uses AI. Check for mistakes.
*/
_onViewableItemsChanged({ viewableItems = [] }: { viewableItems: ViewToken[]; }) {
const { _disableSelfView } = this.props;
const { _aspectRatio, _clientWidth, _clientHeight, _disableSelfView } = this.props;
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

_clientWidth and _clientHeight are destructured here but never used in the method. With typical TS/ESLint no-unused-vars settings this will fail lint/typecheck; please remove them or use them in the calculation (e.g., via _getDimensions() if that was the intent).

Suggested change
const { _aspectRatio, _clientWidth, _clientHeight, _disableSelfView } = this.props;
const { _aspectRatio, _disableSelfView } = this.props;

Copilot uses AI. Check for mistakes.
@jallamsetty1
Copy link
Member Author

This approach does not work since the client will not request videos for these partially visible endpoints and they will appear frozen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant