Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref(jQuery) Replace some jQuery with JS (#13116)
Robert Pintiliic879f5f04d6a
diff --git a/css/_videolayout_default.scss b/css/_videolayout_default.scssindex 0b339a53ba..a18f9cf8e7 100644--- a/css/_videolayout_default.scss+++ b/css/_videolayout_default.scss@@ -76,6 +76,35 @@}}+.animatedFadeIn {+ opacity: 0;+ animation: fadeInAnimation 0.3s ease forwards;+}++@keyframes fadeInAnimation {+ from {+ opacity: 0;+ }+ to {+ opacity: 1;+ }+}++.animatedFadeOut {+ opacity: 1;+ animation: fadeOutAnimation 0.3s ease forwards;+}++@keyframes fadeOutAnimation {+ from {+ opacity: 1;+ }++ to {+ opacity: 0;+ }+}+#largeVideoContainer {height: 100%;width: 100%;diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.jsindex a365872d37..aacfbd2dd2 100644--- a/modules/UI/videolayout/VideoContainer.js+++ b/modules/UI/videolayout/VideoContainer.js@@ -19,6 +19,7 @@ import LargeContainer from './LargeContainer';// FIXME should be 'video'export const VIDEO_CONTAINER_TYPE = 'camera';+// Corresponds to animation duration from the animatedFadeIn and animatedFadeOut CSS classes.const FADE_DURATION_MS = 300;/**@@ -175,8 +176,8 @@ export class VideoContainer extends LargeContainer {/****/- get $video() {- return $('#largeVideo');+ get video() {+ return document.getElementById('largeVideo');}/**@@ -234,14 +235,9 @@ export class VideoContainer extends LargeContainer {this.$wrapper = $('#largeVideoWrapper');- /**- * FIXME: currently using parent() because I can't come up with name- * for id. We'll need to probably refactor the HTML related to the large- * video anyway.- */- this.$wrapperParent = this.$wrapper.parent();+ this.wrapperParent = document.getElementById('largeVideoElementsContainer');this.avatarHeight = document.getElementById('dominantSpeakerAvatarContainer').getBoundingClientRect().height;- this.$video[0].onplaying = function(event) {+ this.video.onplaying = function(event) {if (typeof resizeContainer === 'function') {resizeContainer(event);}@@ -254,7 +250,7 @@ export class VideoContainer extends LargeContainer {*/this._resizeListeners = new Set();- this.$video[0].onresize = this._onResize.bind(this);+ this.video.onresize = this._onResize.bind(this);}/**@@ -282,7 +278,7 @@ export class VideoContainer extends LargeContainer {* @returns {{width, height}}*/getStreamSize() {- const video = this.$video[0];+ const video = this.video;return {@@ -387,7 +383,7 @@ export class VideoContainer extends LargeContainer {resize(containerWidth, containerHeight, animate = false) {// XXX Prevent TypeError: undefined is not an object when the Web// browser does not support WebRTC (yet).- if (this.$video.length === 0) {+ if (!this.video) {return;}const state = APP.store.getState();@@ -480,8 +476,8 @@ export class VideoContainer extends LargeContainer {}// detach old stream- if (this.stream && this.$video[0]) {- this.stream.detach(this.$video[0]);+ if (this.stream && this.video) {+ this.stream.detach(this.video);}this.stream = stream;@@ -491,18 +487,16 @@ export class VideoContainer extends LargeContainer {return;}- if (this.$video[0]) {- stream.attach(this.$video[0]);+ if (this.video) {+ stream.attach(this.video);// Ensure large video gets play() called on it when a new stream is attached to it. This is necessary in the// case of Safari as autoplay doesn't kick-in automatically on Safari 15 and newer versions.- browser.isWebKitBased() && this.$video[0].play();+ browser.isWebKitBased() && this.video.play();const flipX = stream.isLocal() && this.localFlipX && !this.isScreenSharing();- this.$video.css({- transform: flipX ? 'scaleX(-1)' : 'none'- });+ this.video.style.transform = flipX ? 'scaleX(-1)' : 'none';this._updateBackground();}}@@ -513,12 +507,10 @@ export class VideoContainer extends LargeContainer {*/setLocalFlipX(val) {this.localFlipX = val;- if (!this.$video || !this.stream || !this.stream.isLocal()) {+ if (!this.video || !this.stream || !this.stream.isLocal()) {return;}- this.$video.css({- transform: this.localFlipX ? 'scaleX(-1)' : 'none'- });+ this.video.style.transform = this.localFlipX ? 'scaleX(-1)' : 'none';this._updateBackground();}@@ -544,30 +536,23 @@ export class VideoContainer extends LargeContainer {}/**- * We are doing fadeOut/fadeIn animations on parent div which wraps- * largeVideo, because when Temasys plugin is in use it replaces- * <video> elements with plugin <object> tag. In Safari jQuery is- * unable to store values on this plugin object which breaks all- * animation effects performed on it directly.- *- * TODO: refactor this since Temasys is no longer supported.+ * Show video container.*/show() {return new Promise(resolve => {- this.$wrapperParent.css('visibility', 'visible').fadeTo(- FADE_DURATION_MS,- 1,- () => {- this._isHidden = false;- this._updateBackground();- resolve();- }- );+ this.wrapperParent.style.visibility = 'visible';+ this.wrapperParent.classList.remove('animatedFadeOut');+ this.wrapperParent.classList.add('animatedFadeIn');+ setTimeout(() => {+ this._isHidden = false;+ this._updateBackground();+ resolve();+ }, FADE_DURATION_MS);});}/**- *+ * Hide video container.*/hide() {// as the container is hidden/replaced by another container@@ -575,12 +560,14 @@ export class VideoContainer extends LargeContainer {this.showAvatar(false);return new Promise(resolve => {- this.$wrapperParent.fadeTo(FADE_DURATION_MS, 0, () => {- this.$wrapperParent.css('visibility', 'hidden');+ this.wrapperParent.classList.remove('animatedFadeIn');+ this.wrapperParent.classList.add('animatedFadeOut');+ setTimeout(() => {+ this.wrapperParent.style.visibility = 'hidden';this._isHidden = true;this._updateBackground();resolve();- });+ }, FADE_DURATION_MS);});}@@ -628,7 +615,7 @@ export class VideoContainer extends LargeContainer {&& this.localFlipX}orientationFit = { this._backgroundOrientation }- videoElement = { this.$video && this.$video[0] }+ videoElement = { this.video }videoTrack = { this.stream } />,document.getElementById('largeVideoBackgroundContainer'));