Browse Source

code review

j8
Tudor-Ovidiu Avram 4 years ago
parent
commit
3ebfb1de70

+ 3
- 3
lang/main.json View File

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

+ 1
- 1
modules/API/API.js View File

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

+ 2
- 4
react/features/base/participants/components/ParticipantView.native.js View File

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

+ 1
- 7
react/features/filmstrip/components/web/Thumbnail.js View File

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

+ 1
- 22
react/features/shared-video/components/AbstractSharedVideoDialog.js View File

29
  * Implements an abstract class for {@code SharedVideoDialog}.
29
  * Implements an abstract class for {@code SharedVideoDialog}.
30
  */
30
  */
31
 export default class AbstractSharedVideoDialog<S: *> extends Component < Props, S > {
31
 export default class AbstractSharedVideoDialog<S: *> extends Component < Props, S > {
32
+
32
     /**
33
     /**
33
      * Instantiates a new component.
34
      * Instantiates a new component.
34
      *
35
      *
41
     }
42
     }
42
 
43
 
43
     _onSetVideoLink: string => boolean;
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 View File

4
 
4
 
5
 import { InputDialog } from '../../../base/dialog';
5
 import { InputDialog } from '../../../base/dialog';
6
 import { connect } from '../../../base/redux';
6
 import { connect } from '../../../base/redux';
7
-import { defaultSharedVideoLink } from '../../constants';
7
+import { defaultMobileSharedVideoLink } from '../../constants';
8
+import { getYoutubeId } from '../../functions';
8
 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
9
 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
9
 
10
 
10
 /**
11
 /**
11
  * Implements a component to render a display name prompt.
12
  * Implements a component to render a display name prompt.
12
  */
13
  */
13
 class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
14
 class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
15
+
14
     /**
16
     /**
15
      * Implements React's {@link Component#render()}.
17
      * Implements React's {@link Component#render()}.
16
      *
18
      *
22
                 contentKey = 'dialog.shareVideoTitle'
24
                 contentKey = 'dialog.shareVideoTitle'
23
                 onSubmit = { this._onSetVideoLink }
25
                 onSubmit = { this._onSetVideoLink }
24
                 textInputProps = {{
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
 export default connect()(SharedVideoDialog);
61
 export default connect()(SharedVideoDialog);

+ 10
- 9
react/features/shared-video/components/native/YoutubeLargeVideo.js View File

9
 import { ASPECT_RATIO_WIDE } from '../../../base/responsive-ui';
9
 import { ASPECT_RATIO_WIDE } from '../../../base/responsive-ui';
10
 import { setToolboxVisible } from '../../../toolbox/actions';
10
 import { setToolboxVisible } from '../../../toolbox/actions';
11
 import { setSharedVideoStatus } from '../../actions.native';
11
 import { setSharedVideoStatus } from '../../actions.native';
12
+import { getYoutubeId } from '../../functions';
12
 
13
 
13
 import styles from './styles';
14
 import styles from './styles';
14
 
15
 
100
     dispatch: Function,
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
      * @private
106
      * @private
106
      */
107
      */
107
-    youtubeId: string
108
+    youtubeUrl: string
108
 };
109
 };
109
 
110
 
110
 /**
111
 /**
199
             _isPlaying,
200
             _isPlaying,
200
             _playerHeight,
201
             _playerHeight,
201
             _playerWidth,
202
             _playerWidth,
202
-            youtubeId
203
+            youtubeUrl
203
         } = this.props;
204
         } = this.props;
204
 
205
 
205
         return (
206
         return (
220
                     play = { _isPlaying }
221
                     play = { _isPlaying }
221
                     playbackRate = { 1 }
222
                     playbackRate = { 1 }
222
                     ref = { this.playerRef }
223
                     ref = { this.playerRef }
223
-                    videoId = { youtubeId }
224
+                    videoId = { getYoutubeId(youtubeUrl) }
224
                     volume = { 50 }
225
                     volume = { 50 }
225
                     webViewProps = {{
226
                     webViewProps = {{
226
                         bounces: false,
227
                         bounces: false,
243
     _onReady() {
244
     _onReady() {
244
         if (this.props?._isOwner) {
245
         if (this.props?._isOwner) {
245
             this.onVideoReady(
246
             this.onVideoReady(
246
-                this.props.youtubeId,
247
+                this.props.youtubeUrl,
247
                 this.playerRef.current && this.playerRef.current.getCurrentTime(),
248
                 this.playerRef.current && this.playerRef.current.getCurrentTime(),
248
                 this.props._ownerId);
249
                 this.props._ownerId);
249
         }
250
         }
266
                 _isStopped,
267
                 _isStopped,
267
                 _ownerId,
268
                 _ownerId,
268
                 _seek,
269
                 _seek,
269
-                youtubeId
270
+                youtubeUrl
270
             } = this.props;
271
             } = this.props;
271
 
272
 
272
             if (shouldSetNewStatus(_isStopped, _isOwner, status, _isPlaying, time, _seek)) {
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
      * @returns {void}
283
      * @returns {void}
283
     */
284
     */
284
     saveRefTime() {
285
     saveRefTime() {
285
-        const { youtubeId, _status, _ownerId } = this.props;
286
+        const { youtubeUrl, _status, _ownerId } = this.props;
286
 
287
 
287
         this.playerRef.current && this.playerRef.current.getCurrentTime().then(time => {
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 View File

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

+ 21
- 1
react/features/shared-video/components/web/SharedVideoDialog.js View File

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
     _onChange: Object => void;
118
     _onChange: Object => void;
99
 }
119
 }

+ 6
- 1
react/features/shared-video/constants.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
 /**
3
 /**
4
- * Example shared video link.
4
+ * Placeholder for web share video input.
5
  * @type {string}
5
  * @type {string}
6
  */
6
  */
7
 export const defaultSharedVideoLink = 'Youtube link or direct video link';
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
  * Fixed name of the video player fake participant.
15
  * Fixed name of the video player fake participant.
11
  * @type {string}
16
  * @type {string}

Loading…
Cancel
Save