Bläddra i källkod

Force seek when transition from and to pause state.

j8
damencho 9 år sedan
förälder
incheckning
6951089130
1 ändrade filer med 9 tillägg och 3 borttagningar
  1. 9
    3
      modules/UI/shared_video/SharedVideo.js

+ 9
- 3
modules/UI/shared_video/SharedVideo.js Visa fil

@@ -184,7 +184,7 @@ export default class SharedVideoManager {
184 184
 
185 185
         if (attributes.state == 'playing') {
186 186
 
187
-            this.processTime(player, attributes);
187
+            this.processTime(player, attributes, playerPaused);
188 188
 
189 189
             // lets check the volume
190 190
             if (attributes.volume !== undefined &&
@@ -200,7 +200,7 @@ export default class SharedVideoManager {
200 200
             // if its not paused, pause it
201 201
             player.pauseVideo();
202 202
 
203
-            this.processTime(player, attributes);
203
+            this.processTime(player, attributes, !playerPaused);
204 204
         }
205 205
     }
206 206
 
@@ -208,9 +208,15 @@ export default class SharedVideoManager {
208 208
      * Check for time in attributes and if needed seek in current player
209 209
      * @param player the player to operate over
210 210
      * @param attributes the attributes with the player state we want
211
+     * @param forceSeek whether seek should be forced
211 212
      */
212
-    processTime (player, attributes)
213
+    processTime (player, attributes, forceSeek)
213 214
     {
215
+        if(forceSeek) {
216
+            player.seekTo(attributes.time);
217
+            return;
218
+        }
219
+
214 220
         // check received time and current time
215 221
         let currentPosition = player.getCurrentTime();
216 222
         let diff = Math.abs(attributes.time - currentPosition);

Laddar…
Avbryt
Spara