Skip to content

Commit

Permalink
Force seek when transition from and to pause state.
Browse files Browse the repository at this point in the history
damencho committed Mar 31, 2016
1 parent 952eaf5 commit 6951089
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/UI/shared_video/SharedVideo.js
Original file line number Diff line number Diff line change
@@ -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,17 +200,23 @@ export default class SharedVideoManager {
// if its not paused, pause it
player.pauseVideo();

this.processTime(player, attributes);
this.processTime(player, attributes, !playerPaused);
}
}

/**
* 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);

0 comments on commit 6951089

Please sign in to comment.