|
@@ -101,6 +101,13 @@ type Props = {
|
101
|
101
|
*/
|
102
|
102
|
_seek: number,
|
103
|
103
|
|
|
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
|
+
|
104
|
111
|
/**
|
105
|
112
|
* Youtube id of the video to be played.
|
106
|
113
|
*
|
|
@@ -131,10 +138,11 @@ const YoutubeLargeVideo = (props: Props) => {
|
131
|
138
|
const {
|
132
|
139
|
_isOwner,
|
133
|
140
|
_isPlaying,
|
|
141
|
+ _shouldPrepareForStop,
|
134
|
142
|
_seek
|
135
|
143
|
} = props;
|
136
|
144
|
|
137
|
|
- if (shouldSetNewStatus(_isOwner, e, _isPlaying, time, _seek)) {
|
|
145
|
+ if (shouldSetNewStatus(_shouldPrepareForStop, _isOwner, e, _isPlaying, time, _seek)) {
|
138
|
146
|
props._onVideoChangeEvent(props.youtubeId, e, time, props._ownerId);
|
139
|
147
|
}
|
140
|
148
|
});
|
|
@@ -193,6 +201,7 @@ const YoutubeLargeVideo = (props: Props) => {
|
193
|
201
|
* Return true if the user is the owner and
|
194
|
202
|
* the status has changed or the seek time difference from the previous set is larger than 5 seconds.
|
195
|
203
|
*
|
|
204
|
+ * @param {boolean} shouldPrepareForStop - Once the status was set to stop, all the other statuses should be ignored.
|
196
|
205
|
* @param {boolean} isOwner - Whether the local user is sharing the video.
|
197
|
206
|
* @param {string} status - The new status.
|
198
|
207
|
* @param {boolean} isPlaying - Whether the component is playing at the moment.
|
|
@@ -201,7 +210,11 @@ const YoutubeLargeVideo = (props: Props) => {
|
201
|
210
|
* @private
|
202
|
211
|
* @returns {boolean}
|
203
|
212
|
*/
|
204
|
|
-function shouldSetNewStatus(isOwner, status, isPlaying, newTime, previousTime) {
|
|
213
|
+function shouldSetNewStatus(shouldPrepareForStop, isOwner, status, isPlaying, newTime, previousTime) {
|
|
214
|
+ if (shouldPrepareForStop) {
|
|
215
|
+ return false;
|
|
216
|
+ }
|
|
217
|
+
|
205
|
218
|
if (!isOwner || status === 'buffering') {
|
206
|
219
|
return false;
|
207
|
220
|
}
|
|
@@ -247,7 +260,8 @@ function _mapStateToProps(state) {
|
247
|
260
|
_ownerId: ownerId,
|
248
|
261
|
_screenHeight: screenHeight,
|
249
|
262
|
_screenWidth: screenWidth,
|
250
|
|
- _seek: time
|
|
263
|
+ _seek: time,
|
|
264
|
+ _shouldPrepareForStop: status === 'stop'
|
251
|
265
|
};
|
252
|
266
|
}
|
253
|
267
|
|