@checksub_team/peaks_timeline 1.4.19 → 1.4.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/peaks.js +4 -4
- package/src/player.js +3 -3
- package/src/segment.js +1 -9
- package/src/segments-group.js +10 -2
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -15989,17 +15989,17 @@ module.exports = function (Utils) {
|
|
|
15989
15989
|
};
|
|
15990
15990
|
Player.prototype.play = function () {
|
|
15991
15991
|
if (!this._playInterval) {
|
|
15992
|
-
var prevTime =
|
|
15992
|
+
var prevTime = performance.now();
|
|
15993
15993
|
var time;
|
|
15994
15994
|
var self = this;
|
|
15995
15995
|
this._isPlaying = true;
|
|
15996
15996
|
this._peaks.overrideInteractions(true, false);
|
|
15997
15997
|
this._playInterval = setInterval(function () {
|
|
15998
|
-
time =
|
|
15998
|
+
time = performance.now();
|
|
15999
15999
|
self._currentTime += (time - prevTime) / 1000 * self._speed;
|
|
16000
16000
|
prevTime = time;
|
|
16001
16001
|
self._peaks.emit('timeline.update', self._currentTime);
|
|
16002
|
-
},
|
|
16002
|
+
}, 20);
|
|
16003
16003
|
this._peaks.emit('timeline.play', this._currentTime);
|
|
16004
16004
|
}
|
|
16005
16005
|
};
|
|
@@ -16621,7 +16621,7 @@ module.exports = function (Utils) {
|
|
|
16621
16621
|
}
|
|
16622
16622
|
if (options.endTime < 0) {
|
|
16623
16623
|
options.endTime = 0;
|
|
16624
|
-
} else if (options.endTime
|
|
16624
|
+
} else if (options.endTime - options.startTime < peaks.options.minSegmentSize) {
|
|
16625
16625
|
options.endTime = options.startTime + peaks.options.minSegmentSize;
|
|
16626
16626
|
}
|
|
16627
16627
|
options.startTime = Utils.roundTime(options.startTime);
|
package/src/player.js
CHANGED
|
@@ -66,7 +66,7 @@ define([
|
|
|
66
66
|
|
|
67
67
|
Player.prototype.play = function() {
|
|
68
68
|
if (!this._playInterval) {
|
|
69
|
-
var prevTime =
|
|
69
|
+
var prevTime = performance.now();
|
|
70
70
|
var time;
|
|
71
71
|
var self = this;
|
|
72
72
|
|
|
@@ -75,11 +75,11 @@ define([
|
|
|
75
75
|
this._peaks.overrideInteractions(true, false);
|
|
76
76
|
|
|
77
77
|
this._playInterval = setInterval(function() {
|
|
78
|
-
time =
|
|
78
|
+
time = performance.now();
|
|
79
79
|
self._currentTime += ((time - prevTime) / 1000) * self._speed;
|
|
80
80
|
prevTime = time;
|
|
81
81
|
self._peaks.emit('timeline.update', self._currentTime);
|
|
82
|
-
},
|
|
82
|
+
}, 20);
|
|
83
83
|
|
|
84
84
|
this._peaks.emit('timeline.play', this._currentTime);
|
|
85
85
|
}
|
package/src/segment.js
CHANGED
|
@@ -24,7 +24,6 @@ define([
|
|
|
24
24
|
|
|
25
25
|
options.startTime = Utils.roundTime(options.startTime);
|
|
26
26
|
options.endTime = Utils.roundTime(options.endTime);
|
|
27
|
-
|
|
28
27
|
if (options.startTime < 0) {
|
|
29
28
|
options.startTime = 0;
|
|
30
29
|
}
|
|
@@ -32,20 +31,13 @@ define([
|
|
|
32
31
|
if (options.endTime < 0) {
|
|
33
32
|
options.endTime = 0;
|
|
34
33
|
}
|
|
35
|
-
else if (options.endTime
|
|
34
|
+
else if (options.endTime - options.startTime < peaks.options.minSegmentSize) {
|
|
36
35
|
options.endTime = options.startTime + peaks.options.minSegmentSize;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
options.startTime = Utils.roundTime(options.startTime);
|
|
40
39
|
options.endTime = Utils.roundTime(options.endTime);
|
|
41
40
|
|
|
42
|
-
// if (options.endTime <= options.startTime) {
|
|
43
|
-
// // eslint-disable-next-line max-len
|
|
44
|
-
// throw new RangeError(
|
|
45
|
-
// 'peaks.segments.' + context + ': endTime should be greater than startTime'
|
|
46
|
-
// );
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
41
|
if (options.opacity < 0 || options.opacity > 1) {
|
|
50
42
|
// eslint-disable-next-line max-len
|
|
51
43
|
throw new RangeError('peaks.segments.' + context + ': opacity should be between 0 and 1');
|
package/src/segments-group.js
CHANGED
|
@@ -508,7 +508,11 @@ define([
|
|
|
508
508
|
}
|
|
509
509
|
|
|
510
510
|
if (previousSegment.endTime !== newStartTime) {
|
|
511
|
-
newXs = this.manageCollision(
|
|
511
|
+
newXs = this.manageCollision(
|
|
512
|
+
previousSegment,
|
|
513
|
+
this._view.timeToPixels(previousSegment.startTime),
|
|
514
|
+
this._view.timeToPixels(newStartTime)
|
|
515
|
+
);
|
|
512
516
|
|
|
513
517
|
if (newXs.startX !== null) {
|
|
514
518
|
previousSegment.startTime = this._view.pixelsToTime(newXs.startX);
|
|
@@ -562,7 +566,11 @@ define([
|
|
|
562
566
|
}
|
|
563
567
|
|
|
564
568
|
if (nextSegment.startTime !== newEndTime) {
|
|
565
|
-
newXs = this.manageCollision(
|
|
569
|
+
newXs = this.manageCollision(
|
|
570
|
+
nextSegment,
|
|
571
|
+
this._view.timeToPixels(newEndTime),
|
|
572
|
+
this._view.timeToPixels(nextSegment.endTime)
|
|
573
|
+
);
|
|
566
574
|
|
|
567
575
|
if (newXs.startX !== null) {
|
|
568
576
|
nextSegment.startTime = this._view.pixelsToTime(newXs.startX);
|