瀏覽代碼

code review

j8
Tudor-Ovidiu Avram 4 年之前
父節點
當前提交
3ebfb1de70

+ 3
- 3
lang/main.json 查看文件

@@ -294,7 +294,7 @@
294 294
         "sessionRestarted": "Call restarted by the bridge",
295 295
         "Share": "Share",
296 296
         "shareVideoLinkError": "Please provide a correct youtube link.",
297
-        "shareVideoTitle": "Share a video",
297
+        "shareVideoTitle": "Share video",
298 298
         "shareYourScreen": "Share your screen",
299 299
         "shareYourScreenDisabled": "Screen sharing disabled.",
300 300
         "startLiveStreaming": "Start live stream",
@@ -828,7 +828,7 @@
828 828
         "security": "Security options",
829 829
         "Settings": "Settings",
830 830
         "shareaudio": "Share audio",
831
-        "sharedvideo": "Share a video",
831
+        "sharedvideo": "Share video",
832 832
         "shareRoom": "Invite someone",
833 833
         "shortcuts": "View shortcuts",
834 834
         "speakerStats": "Speaker stats",
@@ -836,7 +836,7 @@
836 836
         "startSubtitles": "Start subtitles",
837 837
         "stopScreenSharing": "Stop screen sharing",
838 838
         "stopSubtitles": "Stop subtitles",
839
-        "stopSharedVideo": "Stop YouTube video",
839
+        "stopSharedVideo": "Stop video",
840 840
         "talkWhileMutedPopup": "Trying to speak? You are muted.",
841 841
         "tileViewToggle": "Toggle tile view",
842 842
         "toggleCamera": "Toggle camera",

+ 1
- 1
modules/API/API.js 查看文件

@@ -272,7 +272,7 @@ function initCommands() {
272 272
 
273 273
         'stop-share-video': () => {
274 274
             logger.debug('Share video command received');
275
-            sendAnalytics(createApiEvent('share.video.start'));
275
+            sendAnalytics(createApiEvent('share.video.stop'));
276 276
             APP.store.dispatch(stopSharedVideo());
277 277
         },
278 278
 

+ 2
- 4
react/features/base/participants/components/ParticipantView.native.js 查看文件

@@ -4,7 +4,6 @@ import React, { Component } from 'react';
4 4
 import { Text, View } from 'react-native';
5 5
 
6 6
 import { YoutubeLargeVideo } from '../../../shared-video/components';
7
-import { getYoutubeId } from '../../../shared-video/functions';
8 7
 import { Avatar } from '../../avatar';
9 8
 import { translate } from '../../i18n';
10 9
 import { JitsiParticipantConnectionStatus } from '../../lib-jitsi-meet';
@@ -209,8 +208,7 @@ class ParticipantView extends Component<Props> {
209 208
                 ? this.props.testHintId
210 209
                 : `org.jitsi.meet.Participant#${this.props.participantId}`;
211 210
 
212
-        const youtubeId = getYoutubeId(this.props.participantId);
213
-        const renderYoutubeLargeVideo = _isFakeParticipant && !disableVideo && Boolean(youtubeId);
211
+        const renderYoutubeLargeVideo = _isFakeParticipant && !disableVideo;
214 212
 
215 213
         return (
216 214
             <Container
@@ -226,7 +224,7 @@ class ParticipantView extends Component<Props> {
226 224
                     onPress = { renderYoutubeLargeVideo ? undefined : onPress }
227 225
                     value = '' />
228 226
 
229
-                { renderYoutubeLargeVideo && <YoutubeLargeVideo youtubeId = { youtubeId } /> }
227
+                { renderYoutubeLargeVideo && <YoutubeLargeVideo youtubeUrl = { this.props.participantId } /> }
230 228
 
231 229
                 { !_isFakeParticipant && renderVideo
232 230
                     && <VideoTrack

+ 1
- 7
react/features/filmstrip/components/web/Thumbnail.js 查看文件

@@ -549,8 +549,7 @@ class Thumbnail extends Component<Props, State> {
549 549
      * @returns {ReactElement}
550 550
      */
551 551
     _renderFakeParticipant() {
552
-        const { _participant } = this.props;
553
-        const { id, avatarURL } = _participant;
552
+        const { _participant: { avatarURL } } = this.props;
554 553
         const styles = this._getStyles();
555 554
         const containerClassName = this._getContainerClassName();
556 555
 
@@ -568,11 +567,6 @@ class Thumbnail extends Component<Props, State> {
568 567
                         src = { avatarURL } />
569 568
                 )
570 569
                     : this._renderAvatar(styles.avatar)}
571
-                <div className = 'displayNameContainer'>
572
-                    <DisplayName
573
-                        elementID = 'sharedVideoContainer_name'
574
-                        participantID = { id } />
575
-                </div>
576 570
             </span>
577 571
         );
578 572
     }

+ 1
- 22
react/features/shared-video/components/AbstractSharedVideoDialog.js 查看文件

@@ -29,6 +29,7 @@ export type Props = {
29 29
  * Implements an abstract class for {@code SharedVideoDialog}.
30 30
  */
31 31
 export default class AbstractSharedVideoDialog<S: *> extends Component < Props, S > {
32
+
32 33
     /**
33 34
      * Instantiates a new component.
34 35
      *
@@ -41,26 +42,4 @@ export default class AbstractSharedVideoDialog<S: *> extends Component < Props,
41 42
     }
42 43
 
43 44
     _onSetVideoLink: string => boolean;
44
-
45
-    /**
46
-     * Validates the entered video link by extracting the id and dispatches it.
47
-     *
48
-     * It returns a boolean to comply the Dialog behaviour:
49
-     *     {@code true} - the dialog should be closed.
50
-     *     {@code false} - the dialog should be left open.
51
-     *
52
-     * @param {string} link - The entered video link.
53
-     * @returns {boolean}
54
-     */
55
-    _onSetVideoLink(link: string) {
56
-        if (!link || !link.trim()) {
57
-            return false;
58
-        }
59
-
60
-        const { onPostSubmit } = this.props;
61
-
62
-        onPostSubmit(link);
63
-
64
-        return true;
65
-    }
66 45
 }

+ 31
- 3
react/features/shared-video/components/native/SharedVideoDialog.js 查看文件

@@ -4,13 +4,15 @@ import React from 'react';
4 4
 
5 5
 import { InputDialog } from '../../../base/dialog';
6 6
 import { connect } from '../../../base/redux';
7
-import { defaultSharedVideoLink } from '../../constants';
7
+import { defaultMobileSharedVideoLink } from '../../constants';
8
+import { getYoutubeId } from '../../functions';
8 9
 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
9 10
 
10 11
 /**
11 12
  * Implements a component to render a display name prompt.
12 13
  */
13 14
 class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
15
+
14 16
     /**
15 17
      * Implements React's {@link Component#render()}.
16 18
      *
@@ -22,12 +24,38 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
22 24
                 contentKey = 'dialog.shareVideoTitle'
23 25
                 onSubmit = { this._onSetVideoLink }
24 26
                 textInputProps = {{
25
-                    placeholder: defaultSharedVideoLink
27
+                    placeholder: defaultMobileSharedVideoLink
26 28
                 }} />
27 29
         );
28 30
     }
29 31
 
30
-    _onSetVideoLink: string => boolean;
32
+    /**
33
+     * Validates the entered video link by extracting the id and dispatches it.
34
+     *
35
+     * It returns a boolean to comply the Dialog behaviour:
36
+     *     {@code true} - the dialog should be closed.
37
+     *     {@code false} - the dialog should be left open.
38
+     *
39
+     * @param {string} link - The entered video link.
40
+     * @returns {boolean}
41
+     */
42
+    _onSetVideoLink(link: string) {
43
+        if (!link || !link.trim()) {
44
+            return false;
45
+        }
46
+
47
+        const videoId = getYoutubeId(link);
48
+
49
+        if (videoId) {
50
+            const { onPostSubmit } = this.props;
51
+
52
+            onPostSubmit && onPostSubmit(link);
53
+
54
+            return true;
55
+        }
56
+
57
+        return false;
58
+    }
31 59
 }
32 60
 
33 61
 export default connect()(SharedVideoDialog);

+ 10
- 9
react/features/shared-video/components/native/YoutubeLargeVideo.js 查看文件

@@ -9,6 +9,7 @@ import { connect } from '../../../base/redux';
9 9
 import { ASPECT_RATIO_WIDE } from '../../../base/responsive-ui';
10 10
 import { setToolboxVisible } from '../../../toolbox/actions';
11 11
 import { setSharedVideoStatus } from '../../actions.native';
12
+import { getYoutubeId } from '../../functions';
12 13
 
13 14
 import styles from './styles';
14 15
 
@@ -100,11 +101,11 @@ type Props = {
100 101
     dispatch: Function,
101 102
 
102 103
     /**
103
-     * Youtube id of the video to be played.
104
+     * Youtube url of the video to be played.
104 105
      *
105 106
      * @private
106 107
      */
107
-    youtubeId: string
108
+    youtubeUrl: string
108 109
 };
109 110
 
110 111
 /**
@@ -199,7 +200,7 @@ class YoutubeLargeVideo extends Component<Props, *> {
199 200
             _isPlaying,
200 201
             _playerHeight,
201 202
             _playerWidth,
202
-            youtubeId
203
+            youtubeUrl
203 204
         } = this.props;
204 205
 
205 206
         return (
@@ -220,7 +221,7 @@ class YoutubeLargeVideo extends Component<Props, *> {
220 221
                     play = { _isPlaying }
221 222
                     playbackRate = { 1 }
222 223
                     ref = { this.playerRef }
223
-                    videoId = { youtubeId }
224
+                    videoId = { getYoutubeId(youtubeUrl) }
224 225
                     volume = { 50 }
225 226
                     webViewProps = {{
226 227
                         bounces: false,
@@ -243,7 +244,7 @@ class YoutubeLargeVideo extends Component<Props, *> {
243 244
     _onReady() {
244 245
         if (this.props?._isOwner) {
245 246
             this.onVideoReady(
246
-                this.props.youtubeId,
247
+                this.props.youtubeUrl,
247 248
                 this.playerRef.current && this.playerRef.current.getCurrentTime(),
248 249
                 this.props._ownerId);
249 250
         }
@@ -266,11 +267,11 @@ class YoutubeLargeVideo extends Component<Props, *> {
266 267
                 _isStopped,
267 268
                 _ownerId,
268 269
                 _seek,
269
-                youtubeId
270
+                youtubeUrl
270 271
             } = this.props;
271 272
 
272 273
             if (shouldSetNewStatus(_isStopped, _isOwner, status, _isPlaying, time, _seek)) {
273
-                this.onVideoChangeEvent(youtubeId, status, time, _ownerId);
274
+                this.onVideoChangeEvent(youtubeUrl, status, time, _ownerId);
274 275
             }
275 276
         });
276 277
     }
@@ -282,10 +283,10 @@ class YoutubeLargeVideo extends Component<Props, *> {
282 283
      * @returns {void}
283 284
     */
284 285
     saveRefTime() {
285
-        const { youtubeId, _status, _ownerId } = this.props;
286
+        const { youtubeUrl, _status, _ownerId } = this.props;
286 287
 
287 288
         this.playerRef.current && this.playerRef.current.getCurrentTime().then(time => {
288
-            this.onVideoChangeEvent(youtubeId, _status, time, _ownerId);
289
+            this.onVideoChangeEvent(youtubeUrl, _status, time, _ownerId);
289 290
         });
290 291
     }
291 292
 

+ 2
- 2
react/features/shared-video/components/web/SharedVideo.js 查看文件

@@ -58,7 +58,7 @@ class SharedVideo extends Component<Props> {
58 58
      *  width: number
59 59
      * }}
60 60
      */
61
-    getDimmensions() {
61
+    getDimensions() {
62 62
         const { clientHeight, clientWidth } = this.props;
63 63
 
64 64
         let width;
@@ -114,7 +114,7 @@ class SharedVideo extends Component<Props> {
114 114
             <div
115 115
                 className = { className }
116 116
                 id = 'sharedVideo'
117
-                style = { this.getDimmensions() }>
117
+                style = { this.getDimensions() }>
118 118
                 {this.getManager()}
119 119
             </div>
120 120
         );

+ 21
- 1
react/features/shared-video/components/web/SharedVideoDialog.js 查看文件

@@ -93,7 +93,27 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
93 93
         );
94 94
     }
95 95
 
96
-    _onSetVideoLink: string => boolean;
96
+    /**
97
+     * Validates the entered video link by extracting the id and dispatches it.
98
+     *
99
+     * It returns a boolean to comply the Dialog behaviour:
100
+     *     {@code true} - the dialog should be closed.
101
+     *     {@code false} - the dialog should be left open.
102
+     *
103
+    * @param {string} link - The entered video link.
104
+     * @returns {boolean}
105
+     */
106
+    _onSetVideoLink(link: string) {
107
+        if (!link || !link.trim()) {
108
+            return false;
109
+        }
110
+
111
+        const { onPostSubmit } = this.props;
112
+
113
+        onPostSubmit(link);
114
+
115
+        return true;
116
+    }
97 117
 
98 118
     _onChange: Object => void;
99 119
 }

+ 6
- 1
react/features/shared-video/constants.js 查看文件

@@ -1,11 +1,16 @@
1 1
 // @flow
2 2
 
3 3
 /**
4
- * Example shared video link.
4
+ * Placeholder for web share video input.
5 5
  * @type {string}
6 6
  */
7 7
 export const defaultSharedVideoLink = 'Youtube link or direct video link';
8 8
 
9
+/**
10
+ * Mobile example for a youtube video
11
+ */
12
+export const defaultMobileSharedVideoLink = 'https://youtu.be/TB7LlM4erx8';
13
+
9 14
 /**
10 15
  * Fixed name of the video player fake participant.
11 16
  * @type {string}

Loading…
取消
儲存