소스 검색

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,6 +7,7 @@ import { connect } from '../../base/redux';
7 7
 import { setColorAlpha } from '../../base/util';
8 8
 import { SharedVideo } from '../../shared-video/components/web';
9 9
 import { Captions } from '../../subtitles/';
10
+import { setTileView } from '../../video-layout/actions';
10 11
 
11 12
 declare var interfaceConfig: Object;
12 13
 
@@ -36,7 +37,12 @@ type Props = {
36 37
      * Used to determine the value of the autoplay attribute of the underlying
37 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,6 +52,19 @@ type Props = {
46 52
  * @extends Component
47 53
  */
48 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 70
      * Implements React's {@link Component#render()}.
@@ -71,7 +90,9 @@ class LargeVideo extends Component<Props> {
71 90
 
72 91
                 <Watermarks />
73 92
 
74
-                <div id = 'dominantSpeaker'>
93
+                <div
94
+                    id = 'dominantSpeaker'
95
+                    onTouchEnd = { this._onDoubleTap }>
75 96
                     <div className = 'dynamic-shadow' />
76 97
                     <div id = 'dominantSpeakerAvatarContainer' />
77 98
                 </div>
@@ -90,6 +111,7 @@ class LargeVideo extends Component<Props> {
90 111
                       */}
91 112
                     <div
92 113
                         id = 'largeVideoWrapper'
114
+                        onTouchEnd = { this._onDoubleTap }
93 115
                         role = 'figure' >
94 116
                         <video
95 117
                             autoPlay = { !_noAutoPlayVideo }
@@ -104,6 +126,19 @@ class LargeVideo extends Component<Props> {
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 143
      * Creates the custom styles object.
109 144
      *
@@ -129,6 +164,27 @@ class LargeVideo extends Component<Props> {
129 164
 
130 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
 

Loading…
취소
저장