Force seek when transition from and to pause state.

This commit is contained in:
damencho 2016-03-31 00:07:12 -05:00
parent 952eaf5a0c
commit 6951089130
1 changed files with 9 additions and 3 deletions

View File

@ -184,7 +184,7 @@ export default class SharedVideoManager {
if (attributes.state == 'playing') { if (attributes.state == 'playing') {
this.processTime(player, attributes); this.processTime(player, attributes, playerPaused);
// lets check the volume // lets check the volume
if (attributes.volume !== undefined && if (attributes.volume !== undefined &&
@ -200,7 +200,7 @@ export default class SharedVideoManager {
// if its not paused, pause it // if its not paused, pause it
player.pauseVideo(); 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 * Check for time in attributes and if needed seek in current player
* @param player the player to operate over * @param player the player to operate over
* @param attributes the attributes with the player state we want * @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 // check received time and current time
let currentPosition = player.getCurrentTime(); let currentPosition = player.getCurrentTime();
let diff = Math.abs(attributes.time - currentPosition); let diff = Math.abs(attributes.time - currentPosition);