Browse Source

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

master
paweldomas 7 years ago
parent
commit
6a31c59081

+ 1
- 114
react/features/base/media/components/native/VideoTrack.js View File

@@ -1,5 +1,5 @@
1 1
 import React from 'react';
2
-import { Animated, View } from 'react-native';
2
+import { View } from 'react-native';
3 3
 import { connect } from 'react-redux';
4 4
 
5 5
 import AbstractVideoTrack from '../AbstractVideoTrack';
@@ -18,33 +18,6 @@ class VideoTrack extends AbstractVideoTrack {
18 18
      */
19 19
     static propTypes = AbstractVideoTrack.propTypes
20 20
 
21
-    /**
22
-     * Initializes a new VideoTrack instance.
23
-     *
24
-     * @param {Object} props - The read-only properties with which the new
25
-     * instance is to be initialized.
26
-     */
27
-    constructor(props) {
28
-        super(props);
29
-
30
-        /**
31
-         * Reference to currently running animation if any.
32
-         *
33
-         * @private
34
-         */
35
-        this._animation = null;
36
-
37
-        /**
38
-         * Extend Component's state with additional animation-related vars.
39
-         *
40
-         * @type {Object}
41
-         */
42
-        this.state = {
43
-            ...this.state,
44
-            fade: new Animated.Value(0)
45
-        };
46
-    }
47
-
48 21
     /**
49 22
      * Renders video element with animation.
50 23
      *
@@ -52,98 +25,12 @@ class VideoTrack extends AbstractVideoTrack {
52 25
      * @returns {ReactElement}
53 26
      */
54 27
     render() {
55
-        const animatedStyles
56
-            = [ styles.videoCover, this._getAnimationStyles() ];
57
-
58 28
         return (
59 29
             <View style = { styles.video } >
60 30
                 { super.render() }
61
-                <Animated.View
62
-                    pointerEvents = 'none'
63
-                    style = { animatedStyles } />
64 31
             </View>
65 32
         );
66 33
     }
67
-
68
-    /**
69
-     * Animates setting a new video track to be rendered by this instance.
70
-     *
71
-     * @param {Track} oldValue - The old video track rendered by this instance.
72
-     * @param {Track} newValue - The new video track to be rendered by this
73
-     * instance.
74
-     * @private
75
-     * @returns {Promise}
76
-     */
77
-    _animateSetVideoTrack(oldValue, newValue) {
78
-        // If we're in the middle of an animation and a new animation is about
79
-        // to start, stop the previous one first.
80
-        if (this._animation) {
81
-            this._animation.stop();
82
-            this._animation = null;
83
-            this.state.fade.setValue(0);
84
-        }
85
-
86
-        return this._animateVideoTrack(1)
87
-            .then(() => {
88
-                super._setVideoTrack(newValue);
89
-
90
-                return this._animateVideoTrack(0);
91
-            })
92
-            .catch(() => console.log('Animation was stopped'));
93
-    }
94
-
95
-    /**
96
-     * Animates the display of the state videoTrack.
97
-     *
98
-     * @param {number} toValue - The value to which the specified animatedValue
99
-     * is to be animated.
100
-     * @private
101
-     * @returns {Promise}
102
-     */
103
-    _animateVideoTrack(toValue) {
104
-        return new Promise((resolve, reject) => {
105
-            this._animation
106
-                = Animated.timing(this.state.fade, { toValue });
107
-            this._animation.start(result => {
108
-                this._animation = null;
109
-                result.finished ? resolve() : reject();
110
-            });
111
-        });
112
-    }
113
-
114
-    /**
115
-     * Returns animation styles for Animated.View.
116
-     *
117
-     * @private
118
-     * @returns {Object}
119
-     */
120
-    _getAnimationStyles() {
121
-        return {
122
-            opacity: this.state.fade
123
-        };
124
-    }
125
-
126
-    // eslint-disable-next-line valid-jsdoc
127
-    /**
128
-     * Animate the setting of the video track to be rendered by this instance.
129
-     *
130
-     * @inheritdoc
131
-     * @protected
132
-     */
133
-    _setVideoTrack(videoTrack) {
134
-        // If JitsiTrack instance didn't change, that means some other track's
135
-        // props were changed and we don't need to animate.
136
-        const oldValue = this.state.videoTrack;
137
-        const oldJitsiTrack = oldValue ? oldValue.jitsiTrack : null;
138
-        const newValue = videoTrack;
139
-        const newJitsiTrack = newValue ? newValue.jitsiTrack : null;
140
-
141
-        if (oldJitsiTrack === newJitsiTrack) {
142
-            super._setVideoTrack(newValue);
143
-        } else {
144
-            this._animateSetVideoTrack(oldValue, newValue);
145
-        }
146
-    }
147 34
 }
148 35
 
149 36
 export default connect()(VideoTrack);

+ 0
- 11
react/features/base/media/components/native/styles.js View File

@@ -1,7 +1,5 @@
1 1
 import { StyleSheet } from 'react-native';
2 2
 
3
-import { ColorPalette } from '../../../styles';
4
-
5 3
 /**
6 4
  * The styles of the feature base/media.
7 5
  */
@@ -28,14 +26,5 @@ export default StyleSheet.create({
28 26
      */
29 27
     video: {
30 28
         flex: 1
31
-    },
32
-
33
-    /**
34
-     * Black cover for the video, which will be animated by reducing its opacity
35
-     * and create a fade-in effect.
36
-     */
37
-    videoCover: {
38
-        ...StyleSheet.absoluteFillObject,
39
-        backgroundColor: ColorPalette.black
40 29
     }
41 30
 });

Loading…
Cancel
Save