@checksub_team/peaks_timeline 1.4.43 → 1.4.44
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 +22 -4
- package/src/player.js +10 -3
- package/src/playhead-layer.js +13 -2
- package/src/timeline-zoomview.js +3 -0
package/package.json
CHANGED
package/peaks.js
CHANGED
|
@@ -16018,12 +16018,18 @@ module.exports = function (Utils) {
|
|
|
16018
16018
|
return this._currentTime;
|
|
16019
16019
|
};
|
|
16020
16020
|
Player.prototype.seek = function (time) {
|
|
16021
|
+
if (!this._seek(time)) {
|
|
16022
|
+
return;
|
|
16023
|
+
}
|
|
16024
|
+
this._peaks.emit('timeline.seek', this._currentTime);
|
|
16025
|
+
};
|
|
16026
|
+
Player.prototype._seek = function (time) {
|
|
16021
16027
|
if (!Utils.isValidTime(time)) {
|
|
16022
16028
|
this._peaks.logger('peaks.player.seek(): parameter must be a valid time, in seconds');
|
|
16023
|
-
return;
|
|
16029
|
+
return false;
|
|
16024
16030
|
}
|
|
16025
16031
|
this._currentTime = Math.max(0, time);
|
|
16026
|
-
|
|
16032
|
+
return true;
|
|
16027
16033
|
};
|
|
16028
16034
|
Player.prototype.playSegment = function (segment) {
|
|
16029
16035
|
var self = this;
|
|
@@ -16088,6 +16094,9 @@ module.exports = function (Utils, Konva) {
|
|
|
16088
16094
|
PlayheadLayer.prototype.addToStage = function (stage) {
|
|
16089
16095
|
stage.add(this._playheadLayer);
|
|
16090
16096
|
};
|
|
16097
|
+
PlayheadLayer.prototype.listening = function (bool) {
|
|
16098
|
+
this._playheadLayer.listening(bool);
|
|
16099
|
+
};
|
|
16091
16100
|
PlayheadLayer.prototype.zoomLevelChanged = function () {
|
|
16092
16101
|
var pixelsPerSecond = this._view.timeToPixels(1);
|
|
16093
16102
|
var time;
|
|
@@ -16135,9 +16144,9 @@ module.exports = function (Utils, Konva) {
|
|
|
16135
16144
|
var time = Math.max(0, self._view.pixelsToTime(pos.x + self._view.getFrameOffset()));
|
|
16136
16145
|
var autoPos = self._view.updateWithAutoScroll(this, function () {
|
|
16137
16146
|
time = Math.max(0, self._view.pixelsToTime(self._view.getPointerPosition().x + self._view.getFrameOffset()));
|
|
16138
|
-
self.
|
|
16147
|
+
self._onPlayheadDrag(time);
|
|
16139
16148
|
}, function () {
|
|
16140
|
-
self.
|
|
16149
|
+
self._onPlayheadDrag(time);
|
|
16141
16150
|
});
|
|
16142
16151
|
return {
|
|
16143
16152
|
x: autoPos.x,
|
|
@@ -16151,6 +16160,11 @@ module.exports = function (Utils, Konva) {
|
|
|
16151
16160
|
this._playheadGroup.add(this._playheadLine);
|
|
16152
16161
|
this._playheadLayer.add(this._playheadGroup);
|
|
16153
16162
|
};
|
|
16163
|
+
PlayheadLayer.prototype._onPlayheadDrag = function (time) {
|
|
16164
|
+
if (self._peaks.player._seek(time)) {
|
|
16165
|
+
self._peaks.emit('playhead.drag', self._peaks.player.getCurrentTime());
|
|
16166
|
+
}
|
|
16167
|
+
};
|
|
16154
16168
|
PlayheadLayer.prototype._onPlayheadDragStart = function () {
|
|
16155
16169
|
this._view.enableAutoScroll(false);
|
|
16156
16170
|
this._dragging = true;
|
|
@@ -16163,6 +16177,7 @@ module.exports = function (Utils, Konva) {
|
|
|
16163
16177
|
clearInterval(this._playheadGroup._scrollingInterval);
|
|
16164
16178
|
this._playheadGroup._scrollingInterval = null;
|
|
16165
16179
|
}
|
|
16180
|
+
this._peaks.emit('playhead.dragend', this._peaks.player.getCurrentTime());
|
|
16166
16181
|
};
|
|
16167
16182
|
PlayheadLayer.prototype._createPlayheadText = function (color) {
|
|
16168
16183
|
this._playheadText = new Konva.Text({
|
|
@@ -19353,6 +19368,8 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
19353
19368
|
self._onCutMode = self._onCutMode.bind(self);
|
|
19354
19369
|
self._peaks.on('timeline.update', self._onTimeUpdate);
|
|
19355
19370
|
self._peaks.on('timeline.seek', self._onTimeUpdate);
|
|
19371
|
+
self._peaks.on('playhead.drag', self._onTimeUpdate);
|
|
19372
|
+
self._peaks.on('playhead.dragend', self._onTimeUpdate);
|
|
19356
19373
|
self._peaks.on('user_seek', self._onSeek);
|
|
19357
19374
|
self._peaks.on('timeline.play', self._onPlay);
|
|
19358
19375
|
self._peaks.on('timeline.pause', self._onPause);
|
|
@@ -19543,6 +19560,7 @@ module.exports = function (MouseDragHandler, PlayheadLayer, SourcesLayer, ModeLa
|
|
|
19543
19560
|
};
|
|
19544
19561
|
TimelineZoomView.prototype.overrideInteractions = function (bool, areInteractionsAllowed) {
|
|
19545
19562
|
this._sourcesLayer._lines.overrideInteractions(bool, areInteractionsAllowed);
|
|
19563
|
+
this._playheadLayer.listening(areInteractionsAllowed);
|
|
19546
19564
|
this._sourcesLayer.stopDrag();
|
|
19547
19565
|
this._sourcesLayer.draw();
|
|
19548
19566
|
};
|
package/src/player.js
CHANGED
|
@@ -128,14 +128,21 @@ define([
|
|
|
128
128
|
*/
|
|
129
129
|
|
|
130
130
|
Player.prototype.seek = function(time) {
|
|
131
|
+
if (!this._seek(time)) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
this._peaks.emit('timeline.seek', this._currentTime);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
Player.prototype._seek = function(time) {
|
|
131
139
|
if (!Utils.isValidTime(time)) {
|
|
132
140
|
this._peaks.logger('peaks.player.seek(): parameter must be a valid time, in seconds');
|
|
133
|
-
return;
|
|
141
|
+
return false;
|
|
134
142
|
}
|
|
135
143
|
|
|
136
144
|
this._currentTime = Math.max(0, time);
|
|
137
|
-
|
|
138
|
-
this._peaks.emit('timeline.seek', this._currentTime);
|
|
145
|
+
return true;
|
|
139
146
|
};
|
|
140
147
|
|
|
141
148
|
/**
|
package/src/playhead-layer.js
CHANGED
|
@@ -85,6 +85,10 @@ define([
|
|
|
85
85
|
stage.add(this._playheadLayer);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
PlayheadLayer.prototype.listening = function(bool) {
|
|
89
|
+
this._playheadLayer.listening(bool);
|
|
90
|
+
};
|
|
91
|
+
|
|
88
92
|
/**
|
|
89
93
|
* Decides whether to use an animation to update the playhead position.
|
|
90
94
|
*
|
|
@@ -180,10 +184,10 @@ define([
|
|
|
180
184
|
)
|
|
181
185
|
);
|
|
182
186
|
|
|
183
|
-
self.
|
|
187
|
+
self._onPlayheadDrag(time);
|
|
184
188
|
},
|
|
185
189
|
function() {
|
|
186
|
-
self.
|
|
190
|
+
self._onPlayheadDrag(time);
|
|
187
191
|
}
|
|
188
192
|
);
|
|
189
193
|
|
|
@@ -202,6 +206,12 @@ define([
|
|
|
202
206
|
this._playheadLayer.add(this._playheadGroup);
|
|
203
207
|
};
|
|
204
208
|
|
|
209
|
+
PlayheadLayer.prototype._onPlayheadDrag = function(time) {
|
|
210
|
+
if (self._peaks.player._seek(time)) {
|
|
211
|
+
self._peaks.emit('playhead.drag', self._peaks.player.getCurrentTime());
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
205
215
|
PlayheadLayer.prototype._onPlayheadDragStart = function() {
|
|
206
216
|
this._view.enableAutoScroll(false);
|
|
207
217
|
this._dragging = true;
|
|
@@ -215,6 +225,7 @@ define([
|
|
|
215
225
|
clearInterval(this._playheadGroup._scrollingInterval);
|
|
216
226
|
this._playheadGroup._scrollingInterval = null;
|
|
217
227
|
}
|
|
228
|
+
this._peaks.emit('playhead.dragend', this._peaks.player.getCurrentTime());
|
|
218
229
|
};
|
|
219
230
|
|
|
220
231
|
PlayheadLayer.prototype._createPlayheadText = function(color) {
|
package/src/timeline-zoomview.js
CHANGED
|
@@ -56,6 +56,8 @@ define([
|
|
|
56
56
|
// Register event handlers
|
|
57
57
|
self._peaks.on('timeline.update', self._onTimeUpdate);
|
|
58
58
|
self._peaks.on('timeline.seek', self._onTimeUpdate);
|
|
59
|
+
self._peaks.on('playhead.drag', self._onTimeUpdate);
|
|
60
|
+
self._peaks.on('playhead.dragend', self._onTimeUpdate);
|
|
59
61
|
self._peaks.on('user_seek', self._onSeek);
|
|
60
62
|
self._peaks.on('timeline.play', self._onPlay);
|
|
61
63
|
self._peaks.on('timeline.pause', self._onPause);
|
|
@@ -352,6 +354,7 @@ define([
|
|
|
352
354
|
|
|
353
355
|
TimelineZoomView.prototype.overrideInteractions = function(bool, areInteractionsAllowed) {
|
|
354
356
|
this._sourcesLayer._lines.overrideInteractions(bool, areInteractionsAllowed);
|
|
357
|
+
this._playheadLayer.listening(areInteractionsAllowed);
|
|
355
358
|
this._sourcesLayer.stopDrag();
|
|
356
359
|
this._sourcesLayer.draw();
|
|
357
360
|
};
|