Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(media/VideoTrack.native): remove fade animation

paweldomas6a31c5908161
diff --git a/react/features/base/media/components/native/VideoTrack.js b/react/features/base/media/components/native/VideoTrack.js
index dd885fee17..a586f47d69 100644
--- a/react/features/base/media/components/native/VideoTrack.js
+++ b/react/features/base/media/components/native/VideoTrack.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { Animated, View } from 'react-native';
+import { View } from 'react-native';
import { connect } from 'react-redux';
import AbstractVideoTrack from '../AbstractVideoTrack';
@@ -18,33 +18,6 @@ class VideoTrack extends AbstractVideoTrack {
*/
static propTypes = AbstractVideoTrack.propTypes
- /**
- * Initializes a new VideoTrack instance.
- *
- * @param {Object} props - The read-only properties with which the new
- * instance is to be initialized.
- */
- constructor(props) {
- super(props);
-
- /**
- * Reference to currently running animation if any.
- *
- * @private
- */
- this._animation = null;
-
- /**
- * Extend Component's state with additional animation-related vars.
- *
- * @type {Object}
- */
- this.state = {
- ...this.state,
- fade: new Animated.Value(0)
- };
- }
-
/**
* Renders video element with animation.
*
@@ -52,98 +25,12 @@ class VideoTrack extends AbstractVideoTrack {
* @returns {ReactElement}
*/
render() {
- const animatedStyles
- = [ styles.videoCover, this._getAnimationStyles() ];
-
return (
<View style = { styles.video } >
{ super.render() }
- <Animated.View
- pointerEvents = 'none'
- style = { animatedStyles } />
</View>
);
}
-
- /**
- * Animates setting a new video track to be rendered by this instance.
- *
- * @param {Track} oldValue - The old video track rendered by this instance.
- * @param {Track} newValue - The new video track to be rendered by this
- * instance.
- * @private
- * @returns {Promise}
- */
- _animateSetVideoTrack(oldValue, newValue) {
- // If we're in the middle of an animation and a new animation is about
- // to start, stop the previous one first.
- if (this._animation) {
- this._animation.stop();
- this._animation = null;
- this.state.fade.setValue(0);
- }
-
- return this._animateVideoTrack(1)
- .then(() => {
- super._setVideoTrack(newValue);
-
- return this._animateVideoTrack(0);
- })
- .catch(() => console.log('Animation was stopped'));
- }
-
- /**
- * Animates the display of the state videoTrack.
- *
- * @param {number} toValue - The value to which the specified animatedValue
- * is to be animated.
- * @private
- * @returns {Promise}
- */
- _animateVideoTrack(toValue) {
- return new Promise((resolve, reject) => {
- this._animation
- = Animated.timing(this.state.fade, { toValue });
- this._animation.start(result => {
- this._animation = null;
- result.finished ? resolve() : reject();
- });
- });
- }
-
- /**
- * Returns animation styles for Animated.View.
- *
- * @private
- * @returns {Object}
- */
- _getAnimationStyles() {
- return {
- opacity: this.state.fade
- };
- }
-
- // eslint-disable-next-line valid-jsdoc
- /**
- * Animate the setting of the video track to be rendered by this instance.
- *
- * @inheritdoc
- * @protected
- */
- _setVideoTrack(videoTrack) {
- // If JitsiTrack instance didn't change, that means some other track's
- // props were changed and we don't need to animate.
- const oldValue = this.state.videoTrack;
- const oldJitsiTrack = oldValue ? oldValue.jitsiTrack : null;
- const newValue = videoTrack;
- const newJitsiTrack = newValue ? newValue.jitsiTrack : null;
-
- if (oldJitsiTrack === newJitsiTrack) {
- super._setVideoTrack(newValue);
- } else {
- this._animateSetVideoTrack(oldValue, newValue);
- }
- }
}
export default connect()(VideoTrack);
diff --git a/react/features/base/media/components/native/styles.js b/react/features/base/media/components/native/styles.js
index 34053e151a..a624db6d2d 100644
--- a/react/features/base/media/components/native/styles.js
+++ b/react/features/base/media/components/native/styles.js
@@ -1,7 +1,5 @@
import { StyleSheet } from 'react-native';
-import { ColorPalette } from '../../../styles';
-
/**
* The styles of the feature base/media.
*/
@@ -28,14 +26,5 @@ export default StyleSheet.create({
*/
video: {
flex: 1
- },
-
- /**
- * Black cover for the video, which will be animated by reducing its opacity
- * and create a fade-in effect.
- */
- videoCover: {
- ...StyleSheet.absoluteFillObject,
- backgroundColor: ColorPalette.black
}
});