Skip to content

Commit

Permalink
Merge cacb1a2 into c73da67
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Mar 18, 2019
2 parents c73da67 + cacb1a2 commit 817ccaa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
@@ -1,6 +1,12 @@
videojs-record changelog
========================

3.6.0 (unreleased)
------------------

- Improve time accuracy with monotonic clock


3.5.1 - 2019/03/06
------------------

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/js/videojs.record.js
Expand Up @@ -769,7 +769,7 @@ class Record extends Plugin {
// register starting point
this.paused = false;
this.pauseTime = this.pausedTime = 0;
this.startTime = new Date().getTime();
this.startTime = performance.now();

// start countdown
const COUNTDOWN_SPEED = 100; // ms
Expand Down Expand Up @@ -862,7 +862,7 @@ class Record extends Plugin {
*/
pause() {
if (!this.paused) {
this.pauseTime = new Date().getTime();
this.pauseTime = performance.now();
this.paused = true;

this.engine.pause();
Expand All @@ -874,7 +874,7 @@ class Record extends Plugin {
*/
resume() {
if (this.paused) {
this.pausedTime += new Date().getTime() - this.pauseTime;
this.pausedTime += performance.now() - this.pauseTime;

this.engine.resume();
this.paused = false;
Expand Down Expand Up @@ -1003,7 +1003,7 @@ class Record extends Plugin {
*/
onCountDown() {
if (!this.paused) {
let now = new Date().getTime();
let now = performance.now();
let duration = this.maxLength;
let currentTime = (now - (this.startTime +
this.pausedTime)) / 1000; // buddy ignore:line
Expand Down

0 comments on commit 817ccaa

Please sign in to comment.