Bläddra i källkod

fix(share-video) fix backwards compatibility issue

j8
Tudor-Ovidiu Avram 3 år sedan
förälder
incheckning
b2985934f7

+ 1
- 1
react/features/base/participants/components/ParticipantView.native.js Visa fil

224
                     onPress = { renderYoutubeLargeVideo ? undefined : onPress }
224
                     onPress = { renderYoutubeLargeVideo ? undefined : onPress }
225
                     value = '' />
225
                     value = '' />
226
 
226
 
227
-                { renderYoutubeLargeVideo && <YoutubeLargeVideo youtubeUrl = { this.props.participantId } /> }
227
+                { renderYoutubeLargeVideo && <YoutubeLargeVideo youtubeId = { this.props.participantId } /> }
228
 
228
 
229
                 { !_isFakeParticipant && renderVideo
229
                 { !_isFakeParticipant && renderVideo
230
                     && <VideoTrack
230
                     && <VideoTrack

+ 1
- 1
react/features/shared-video/components/native/SharedVideoDialog.js Visa fil

49
         if (videoId) {
49
         if (videoId) {
50
             const { onPostSubmit } = this.props;
50
             const { onPostSubmit } = this.props;
51
 
51
 
52
-            onPostSubmit && onPostSubmit(link);
52
+            onPostSubmit && onPostSubmit(videoId);
53
 
53
 
54
             return true;
54
             return true;
55
         }
55
         }

+ 9
- 10
react/features/shared-video/components/native/YoutubeLargeVideo.js Visa fil

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

+ 8
- 18
react/features/shared-video/components/web/SharedVideo.js Visa fil

6
 import { getLocalParticipant } from '../../../base/participants';
6
 import { getLocalParticipant } from '../../../base/participants';
7
 import { connect } from '../../../base/redux';
7
 import { connect } from '../../../base/redux';
8
 import { getToolboxHeight } from '../../../toolbox/functions.web';
8
 import { getToolboxHeight } from '../../../toolbox/functions.web';
9
-import { getYoutubeId } from '../../functions';
10
 
9
 
11
 import VideoManager from './VideoManager';
10
 import VideoManager from './VideoManager';
12
 import YoutubeVideoManager from './YoutubeVideoManager';
11
 import YoutubeVideoManager from './YoutubeVideoManager';
38
      isOwner: boolean,
37
      isOwner: boolean,
39
 
38
 
40
     /**
39
     /**
41
-     * The shared video id
40
+     * The shared video url
42
      */
41
      */
43
-     sharedVideoId: string,
44
-
45
-    /**
46
-     * The shared youtube video id
47
-     */
48
-     sharedYoutubeVideoId: string,
42
+     videoUrl: string,
49
 }
43
 }
50
 
44
 
51
 /**
45
 /**
97
      * @returns {Component}
91
      * @returns {Component}
98
      */
92
      */
99
     getManager() {
93
     getManager() {
100
-        const {
101
-            sharedVideoId,
102
-            sharedYoutubeVideoId
103
-        } = this.props;
94
+        const { videoUrl } = this.props;
104
 
95
 
105
-        if (!sharedVideoId) {
96
+        if (!videoUrl) {
106
             return null;
97
             return null;
107
         }
98
         }
108
 
99
 
109
-        if (sharedYoutubeVideoId) {
110
-            return <YoutubeVideoManager videoId = { sharedYoutubeVideoId } />;
100
+        if (videoUrl.match(/http/)) {
101
+            return <VideoManager videoId = { videoUrl } />;
111
         }
102
         }
112
 
103
 
113
-        return <VideoManager videoId = { sharedVideoId } />;
104
+        return <YoutubeVideoManager videoId = { videoUrl } />;
114
     }
105
     }
115
 
106
 
116
     /**
107
     /**
154
         clientWidth,
145
         clientWidth,
155
         filmstripVisible: visible,
146
         filmstripVisible: visible,
156
         isOwner: ownerId === localParticipant.id,
147
         isOwner: ownerId === localParticipant.id,
157
-        sharedVideoId: videoUrl,
158
-        sharedYoutubeVideoId: getYoutubeId(videoUrl)
148
+        videoUrl
159
     };
149
     };
160
 }
150
 }
161
 
151
 

+ 3
- 1
react/features/shared-video/components/web/SharedVideoDialog.js Visa fil

8
 import { getFieldValue } from '../../../base/react';
8
 import { getFieldValue } from '../../../base/react';
9
 import { connect } from '../../../base/redux';
9
 import { connect } from '../../../base/redux';
10
 import { defaultSharedVideoLink } from '../../constants';
10
 import { defaultSharedVideoLink } from '../../constants';
11
+import { getYoutubeId } from '../../functions';
11
 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
12
 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
12
 
13
 
13
 /**
14
 /**
108
             return false;
109
             return false;
109
         }
110
         }
110
 
111
 
112
+        const youtubeId = getYoutubeId(link);
111
         const { onPostSubmit } = this.props;
113
         const { onPostSubmit } = this.props;
112
 
114
 
113
-        onPostSubmit(link);
115
+        onPostSubmit(youtubeId || link);
114
 
116
 
115
         return true;
117
         return true;
116
     }
118
     }

+ 2
- 2
react/features/shared-video/middleware.any.js Visa fil

18
     setSharedVideoStatus
18
     setSharedVideoStatus
19
 } from './actions.any';
19
 } from './actions.any';
20
 import { SHARED_VIDEO, VIDEO_PLAYER_PARTICIPANT_NAME } from './constants';
20
 import { SHARED_VIDEO, VIDEO_PLAYER_PARTICIPANT_NAME } from './constants';
21
-import { getYoutubeId, isSharingStatus } from './functions';
21
+import { isSharingStatus } from './functions';
22
 
22
 
23
 /**
23
 /**
24
  * Middleware that captures actions related to video sharing and updates
24
  * Middleware that captures actions related to video sharing and updates
126
     const oldStatus = getState()['features/shared-video']?.status;
126
     const oldStatus = getState()['features/shared-video']?.status;
127
 
127
 
128
     if (state === 'start' || ![ 'playing', 'pause', 'start' ].includes(oldStatus)) {
128
     if (state === 'start' || ![ 'playing', 'pause', 'start' ].includes(oldStatus)) {
129
-        const youtubeId = getYoutubeId(videoUrl);
129
+        const youtubeId = videoUrl.match(/http/) ? false : videoUrl;
130
         const avatarURL = youtubeId ? `https://img.youtube.com/vi/${youtubeId}/0.jpg` : '';
130
         const avatarURL = youtubeId ? `https://img.youtube.com/vi/${youtubeId}/0.jpg` : '';
131
 
131
 
132
         dispatch(participantJoined({
132
         dispatch(participantJoined({

Laddar…
Avbryt
Spara