Skip to content

Commit

Permalink
feat: Add remainingTimeDisplay method to Player (#4620)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey authored and misteroneill committed Oct 2, 2017
1 parent 5ca0992 commit 445eb26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/control-bar/time-controls/remaining-time-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class RemainingTimeDisplay extends TimeDisplay {
return;
}

this.updateFormattedTime_(this.player_.remainingTime());
this.updateFormattedTime_(this.player_.remainingTimeDisplay());
}

/**
Expand Down
11 changes: 11 additions & 0 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,17 @@ class Player extends Component {
return this.duration() - this.currentTime();
}

/**
* A remaining time function that is intented to be used when
* the time is to be displayed directly to the user.
*
* @return {number}
* The rounded time remaining in seconds
*/
remainingTimeDisplay() {
return Math.floor(this.duration()) - Math.floor(this.currentTime());
}

//
// Kind of like an array of portions of the video that have been downloaded.

Expand Down

0 comments on commit 445eb26

Please sign in to comment.