Sfoglia il codice sorgente

rn: adds support for mobile youtube link

master
Titus-Andrei Moldovan 5 anni fa
parent
commit
482ba23954

+ 1
- 1
react/features/youtube-player/components/AbstractEnterVideoLinkPrompt.js Vedi File

@@ -76,7 +76,7 @@ export default class AbstractEnterVideoLinkPrompt<S: *> extends Component < Prop
76 76
  * @returns {boolean}
77 77
  */
78 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 80
     const result = url.match(p);
81 81
 
82 82
     return result ? result[1] : false;

+ 14
- 14
react/features/youtube-player/components/native/YoutubeLargeVideo.js Vedi File

@@ -45,6 +45,13 @@ type Props = {
45 45
      */
46 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 56
      * True if in landscape mode.
50 57
      *
@@ -101,13 +108,6 @@ type Props = {
101 108
      */
102 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 112
      * Youtube id of the video to be played.
113 113
      *
@@ -138,11 +138,11 @@ const YoutubeLargeVideo = (props: Props) => {
138 138
             const {
139 139
                 _isOwner,
140 140
                 _isPlaying,
141
-                _shouldPrepareForStop,
141
+                _isStopped,
142 142
                 _seek
143 143
             } = props;
144 144
 
145
-            if (shouldSetNewStatus(_shouldPrepareForStop, _isOwner, e, _isPlaying, time, _seek)) {
145
+            if (shouldSetNewStatus(_isStopped, _isOwner, e, _isPlaying, time, _seek)) {
146 146
                 props._onVideoChangeEvent(props.youtubeId, e, time, props._ownerId);
147 147
             }
148 148
         });
@@ -201,7 +201,7 @@ const YoutubeLargeVideo = (props: Props) => {
201 201
  * Return true if the user is the owner and
202 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 205
  * @param {boolean} isOwner - Whether the local user is sharing the video.
206 206
  * @param {string} status - The new status.
207 207
  * @param {boolean} isPlaying - Whether the component is playing at the moment.
@@ -210,8 +210,8 @@ const YoutubeLargeVideo = (props: Props) => {
210 210
  * @private
211 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 215
         return false;
216 216
     }
217 217
 
@@ -256,12 +256,12 @@ function _mapStateToProps(state) {
256 256
         _enableControls: ownerId === localParticipant.id,
257 257
         _isOwner: ownerId === localParticipant.id,
258 258
         _isPlaying: status === 'playing',
259
+        _isStopped: status === 'stop',
259 260
         _isWideScreen: responsiveUi.aspectRatio === ASPECT_RATIO_WIDE,
260 261
         _ownerId: ownerId,
261 262
         _screenHeight: screenHeight,
262 263
         _screenWidth: screenWidth,
263
-        _seek: time,
264
-        _shouldPrepareForStop: status === 'stop'
264
+        _seek: time
265 265
     };
266 266
 }
267 267
 

Loading…
Annulla
Salva