ref(video-layout): remove instance variable for gating show/hide

The instance variable is not accurate. By default isVisible is
set to false but nothing sets the video container to actually
not be visible. As such it is possible for the video element
itself to autoplay, thereby making video visible, while the
isVisible boolean is still false. The fix chosen is to remove
instance variable and always respect calls to show/hide so
that the video container can be set to hidden.
pull/3419/head
Leonard Kim 6 years ago
parent 3b754fa219
commit dafcde5060
  1. 14
      modules/UI/videolayout/VideoContainer.js

@ -216,8 +216,6 @@ export class VideoContainer extends LargeContainer {
this.emitter = emitter;
this.resizeContainer = resizeContainer;
this.isVisible = false;
/**
* Whether the background should fit the height of the container
* (portrait) or fit the width of the container (landscape).
@ -603,17 +601,11 @@ export class VideoContainer extends LargeContainer {
* TODO: refactor this since Temasys is no longer supported.
*/
show() {
// its already visible
if (this.isVisible) {
return Promise.resolve();
}
return new Promise(resolve => {
this.$wrapperParent.css('visibility', 'visible').fadeTo(
FADE_DURATION_MS,
1,
() => {
this.isVisible = true;
resolve();
}
);
@ -628,15 +620,9 @@ export class VideoContainer extends LargeContainer {
// hide its avatar
this.showAvatar(false);
// its already hidden
if (!this.isVisible) {
return Promise.resolve();
}
return new Promise(resolve => {
this.$wrapperParent.fadeTo(FADE_DURATION_MS, 0, () => {
this.$wrapperParent.css('visibility', 'hidden');
this.isVisible = false;
resolve();
});
});

Loading…
Cancel
Save