瀏覽代碼

rn: adds support for mobile youtube link

master
Titus-Andrei Moldovan 5 年之前
父節點
當前提交
482ba23954

+ 1
- 1
react/features/youtube-player/components/AbstractEnterVideoLinkPrompt.js 查看文件

76
  * @returns {boolean}
76
  * @returns {boolean}
77
  */
77
  */
78
 function getYoutubeLink(url) {
78
 function getYoutubeLink(url) {
79
-    const p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;// eslint-disable-line max-len
79
+    const p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|(?:m\.)?youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;// eslint-disable-line max-len
80
     const result = url.match(p);
80
     const result = url.match(p);
81
 
81
 
82
     return result ? result[1] : false;
82
     return result ? result[1] : false;

+ 14
- 14
react/features/youtube-player/components/native/YoutubeLargeVideo.js 查看文件

45
      */
45
      */
46
     _isPlaying: string,
46
     _isPlaying: string,
47
 
47
 
48
+    /**
49
+     * Set to true when the status is set to stop and the view should not react to further changes.
50
+     *
51
+     * @private
52
+     */
53
+    _isStopped: boolean,
54
+
48
     /**
55
     /**
49
      * True if in landscape mode.
56
      * True if in landscape mode.
50
      *
57
      *
101
      */
108
      */
102
     _seek: number,
109
     _seek: number,
103
 
110
 
104
-    /**
105
-     * Set to true when the status is set to stop and the view should not react to further changes.
106
-     *
107
-     * @private
108
-     */
109
-    _shouldPrepareForStop: boolean,
110
-
111
     /**
111
     /**
112
      * Youtube id of the video to be played.
112
      * Youtube id of the video to be played.
113
      *
113
      *
138
             const {
138
             const {
139
                 _isOwner,
139
                 _isOwner,
140
                 _isPlaying,
140
                 _isPlaying,
141
-                _shouldPrepareForStop,
141
+                _isStopped,
142
                 _seek
142
                 _seek
143
             } = props;
143
             } = props;
144
 
144
 
145
-            if (shouldSetNewStatus(_shouldPrepareForStop, _isOwner, e, _isPlaying, time, _seek)) {
145
+            if (shouldSetNewStatus(_isStopped, _isOwner, e, _isPlaying, time, _seek)) {
146
                 props._onVideoChangeEvent(props.youtubeId, e, time, props._ownerId);
146
                 props._onVideoChangeEvent(props.youtubeId, e, time, props._ownerId);
147
             }
147
             }
148
         });
148
         });
201
  * Return true if the user is the owner and
201
  * Return true if the user is the owner and
202
  * the status has changed or the seek time difference from the previous set is larger than 5 seconds.
202
  * the status has changed or the seek time difference from the previous set is larger than 5 seconds.
203
  *
203
  *
204
- * @param {boolean} shouldPrepareForStop - Once the status was set to stop, all the other statuses should be ignored.
204
+ * @param {boolean} isStopped - Once the status was set to stop, all the other statuses should be ignored.
205
  * @param {boolean} isOwner - Whether the local user is sharing the video.
205
  * @param {boolean} isOwner - Whether the local user is sharing the video.
206
  * @param {string} status - The new status.
206
  * @param {string} status - The new status.
207
  * @param {boolean} isPlaying - Whether the component is playing at the moment.
207
  * @param {boolean} isPlaying - Whether the component is playing at the moment.
210
  * @private
210
  * @private
211
  * @returns {boolean}
211
  * @returns {boolean}
212
 */
212
 */
213
-function shouldSetNewStatus(shouldPrepareForStop, isOwner, status, isPlaying, newTime, previousTime) {
214
-    if  (shouldPrepareForStop) {
213
+function shouldSetNewStatus(isStopped, isOwner, status, isPlaying, newTime, previousTime) {
214
+    if (isStopped) {
215
         return false;
215
         return false;
216
     }
216
     }
217
 
217
 
256
         _enableControls: ownerId === localParticipant.id,
256
         _enableControls: ownerId === localParticipant.id,
257
         _isOwner: ownerId === localParticipant.id,
257
         _isOwner: ownerId === localParticipant.id,
258
         _isPlaying: status === 'playing',
258
         _isPlaying: status === 'playing',
259
+        _isStopped: status === 'stop',
259
         _isWideScreen: responsiveUi.aspectRatio === ASPECT_RATIO_WIDE,
260
         _isWideScreen: responsiveUi.aspectRatio === ASPECT_RATIO_WIDE,
260
         _ownerId: ownerId,
261
         _ownerId: ownerId,
261
         _screenHeight: screenHeight,
262
         _screenHeight: screenHeight,
262
         _screenWidth: screenWidth,
263
         _screenWidth: screenWidth,
263
-        _seek: time,
264
-        _shouldPrepareForStop: status === 'stop'
264
+        _seek: time
265
     };
265
     };
266
 }
266
 }
267
 
267
 

Loading…
取消
儲存