Skip to content

Commit

Permalink
add check for display: none
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO committed Jun 22, 2022
1 parent f3ed1a1 commit 5b65074
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/room/track/RemoteVideoTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function isElementInViewport(el: HTMLElement) {
const width = el.offsetWidth;
const height = el.offsetHeight;
const { hidden } = el;
const { opacity } = getComputedStyle(el);
const { opacity, display } = getComputedStyle(el);

while (el.offsetParent) {
el = el.offsetParent as HTMLElement;
Expand All @@ -356,6 +356,7 @@ function isElementInViewport(el: HTMLElement) {
top + height > window.pageYOffset &&
left + width > window.pageXOffset &&
!hidden &&
(opacity !== '' ? parseFloat(opacity) > 0 : true)
(opacity !== '' ? parseFloat(opacity) > 0 : true) &&
display !== 'none'
);
}

0 comments on commit 5b65074

Please sign in to comment.