浏览代码

feat(large-video): Switch to tile view on large video double tap

master
Vlad Piersec 3 年前
父节点
当前提交
f879ecfc70
共有 1 个文件被更改,包括 58 次插入2 次删除
  1. 58
    2
      react/features/large-video/components/LargeVideo.web.js

+ 58
- 2
react/features/large-video/components/LargeVideo.web.js 查看文件

7
 import { setColorAlpha } from '../../base/util';
7
 import { setColorAlpha } from '../../base/util';
8
 import { SharedVideo } from '../../shared-video/components/web';
8
 import { SharedVideo } from '../../shared-video/components/web';
9
 import { Captions } from '../../subtitles/';
9
 import { Captions } from '../../subtitles/';
10
+import { setTileView } from '../../video-layout/actions';
10
 
11
 
11
 declare var interfaceConfig: Object;
12
 declare var interfaceConfig: Object;
12
 
13
 
36
      * Used to determine the value of the autoplay attribute of the underlying
37
      * Used to determine the value of the autoplay attribute of the underlying
37
      * video element.
38
      * video element.
38
      */
39
      */
39
-    _noAutoPlayVideo: boolean
40
+    _noAutoPlayVideo: boolean,
41
+
42
+    /**
43
+     * The Redux dispatch function.
44
+     */
45
+    dispatch: Function
40
 }
46
 }
41
 
47
 
42
 /**
48
 /**
46
  * @extends Component
52
  * @extends Component
47
  */
53
  */
48
 class LargeVideo extends Component<Props> {
54
 class LargeVideo extends Component<Props> {
55
+    _tappedTimeout: ?TimeoutID
56
+
57
+    /**
58
+     * Constructor of the component.
59
+     *
60
+     * @inheritdoc
61
+     */
62
+    constructor(props) {
63
+        super(props);
64
+
65
+        this._clearTapTimeout = this._clearTapTimeout.bind(this);
66
+        this._onDoubleTap = this._onDoubleTap.bind(this);
67
+    }
49
 
68
 
50
     /**
69
     /**
51
      * Implements React's {@link Component#render()}.
70
      * Implements React's {@link Component#render()}.
71
 
90
 
72
                 <Watermarks />
91
                 <Watermarks />
73
 
92
 
74
-                <div id = 'dominantSpeaker'>
93
+                <div
94
+                    id = 'dominantSpeaker'
95
+                    onTouchEnd = { this._onDoubleTap }>
75
                     <div className = 'dynamic-shadow' />
96
                     <div className = 'dynamic-shadow' />
76
                     <div id = 'dominantSpeakerAvatarContainer' />
97
                     <div id = 'dominantSpeakerAvatarContainer' />
77
                 </div>
98
                 </div>
90
                       */}
111
                       */}
91
                     <div
112
                     <div
92
                         id = 'largeVideoWrapper'
113
                         id = 'largeVideoWrapper'
114
+                        onTouchEnd = { this._onDoubleTap }
93
                         role = 'figure' >
115
                         role = 'figure' >
94
                         <video
116
                         <video
95
                             autoPlay = { !_noAutoPlayVideo }
117
                             autoPlay = { !_noAutoPlayVideo }
104
         );
126
         );
105
     }
127
     }
106
 
128
 
129
+    _clearTapTimeout: () => void
130
+
131
+    /**
132
+     * Clears the '_tappedTimout'.
133
+     *
134
+     * @private
135
+     * @returns {void}
136
+     */
137
+    _clearTapTimeout() {
138
+        clearTimeout(this._tappedTimeout);
139
+        this._tappedTimeout = undefined;
140
+    }
141
+
107
     /**
142
     /**
108
      * Creates the custom styles object.
143
      * Creates the custom styles object.
109
      *
144
      *
129
 
164
 
130
         return styles;
165
         return styles;
131
     }
166
     }
167
+
168
+    _onDoubleTap: () => void
169
+
170
+    /**
171
+     * Creates the custom styles object.
172
+     *
173
+     * @param {Object} e - The event.
174
+     * @private
175
+     * @returns {void}
176
+     */
177
+    _onDoubleTap(e) {
178
+        e.stopPropagation();
179
+        e.preventDefault();
180
+
181
+        if (this._tappedTimeout) {
182
+            this._clearTapTimeout();
183
+            this.props.dispatch(setTileView(true));
184
+        } else {
185
+            this._tappedTimeout = setTimeout(this._clearTapTimeout, 300);
186
+        }
187
+    }
132
 }
188
 }
133
 
189
 
134
 
190
 

正在加载...
取消
保存