From 6951089130baea54b3f5c2e43dca80863eadac90 Mon Sep 17 00:00:00 2001 From: damencho Date: Thu, 31 Mar 2016 00:07:12 -0500 Subject: [PATCH] Force seek when transition from and to pause state. --- modules/UI/shared_video/SharedVideo.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js index 6adab009b..179ec6c31 100644 --- a/modules/UI/shared_video/SharedVideo.js +++ b/modules/UI/shared_video/SharedVideo.js @@ -184,7 +184,7 @@ export default class SharedVideoManager { if (attributes.state == 'playing') { - this.processTime(player, attributes); + this.processTime(player, attributes, playerPaused); // lets check the volume if (attributes.volume !== undefined && @@ -200,7 +200,7 @@ export default class SharedVideoManager { // if its not paused, pause it player.pauseVideo(); - this.processTime(player, attributes); + this.processTime(player, attributes, !playerPaused); } } @@ -208,9 +208,15 @@ export default class SharedVideoManager { * Check for time in attributes and if needed seek in current player * @param player the player to operate over * @param attributes the attributes with the player state we want + * @param forceSeek whether seek should be forced */ - processTime (player, attributes) + processTime (player, attributes, forceSeek) { + if(forceSeek) { + player.seekTo(attributes.time); + return; + } + // check received time and current time let currentPosition = player.getCurrentTime(); let diff = Math.abs(attributes.time - currentPosition);