@24i/bigscreen-sdk 1.0.54-alpha.2838 → 1.0.54-alpha.2844
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
CHANGED
|
@@ -15,6 +15,7 @@ const SLOW_TIME = 10000;
|
|
|
15
15
|
const FAST_TIME = 30000;
|
|
16
16
|
const SAFE_END_MARGIN = 10000;
|
|
17
17
|
const TO_PERCENT = 100;
|
|
18
|
+
const PENDING_SEEK_THRESHOLD = 2000;
|
|
18
19
|
|
|
19
20
|
type Props = {
|
|
20
21
|
ui: IPlayerUIWithSeeking;
|
|
@@ -50,6 +51,8 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
50
51
|
|
|
51
52
|
seekingDisabled = false;
|
|
52
53
|
|
|
54
|
+
pendingSeekTime: number | null = null;
|
|
55
|
+
|
|
53
56
|
static defaultProps = {
|
|
54
57
|
className: '',
|
|
55
58
|
};
|
|
@@ -95,6 +98,7 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
95
98
|
const percentage = (TO_PERCENT * event.offsetX) / wrapWidth;
|
|
96
99
|
const seekTo = Math.round((this.duration / TO_PERCENT) * percentage);
|
|
97
100
|
seeking.setSeekTime(seekTo);
|
|
101
|
+
this.pendingSeekTime = seekTo;
|
|
98
102
|
seeking.confirmSeek();
|
|
99
103
|
};
|
|
100
104
|
|
|
@@ -107,6 +111,9 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
107
111
|
onMouseUp = () => {
|
|
108
112
|
const { ui } = this.props;
|
|
109
113
|
this.isMouseDownPressed = false;
|
|
114
|
+
if (ui.seeking.seekTime != null) {
|
|
115
|
+
this.pendingSeekTime = ui.seeking.seekTime;
|
|
116
|
+
}
|
|
110
117
|
ui.seeking.confirmSeek();
|
|
111
118
|
ui.enableHiding();
|
|
112
119
|
};
|
|
@@ -169,13 +176,17 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
169
176
|
const { ui: { seeking, getPlayer } } = this.props;
|
|
170
177
|
const player = getPlayer();
|
|
171
178
|
if (!player.playing) player.play();
|
|
179
|
+
if (seeking.seekTime != null) {
|
|
180
|
+
this.pendingSeekTime = seeking.seekTime;
|
|
181
|
+
}
|
|
172
182
|
return seeking.confirmSeek();
|
|
173
183
|
};
|
|
174
184
|
|
|
175
185
|
onSeekTimeUpdate = (seekTime: number) => {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
186
|
+
if (seekTime !== null) {
|
|
187
|
+
this.seekTime.current!.updateTime(seekTime);
|
|
188
|
+
this.updateSeekBar();
|
|
189
|
+
}
|
|
179
190
|
};
|
|
180
191
|
|
|
181
192
|
onStopAutomaticSeek = () => {
|
|
@@ -185,7 +196,13 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
185
196
|
|
|
186
197
|
onTimeUpdate = ({ currentTime }: ITimeUpdateEvent) => {
|
|
187
198
|
const { ui } = this.props;
|
|
199
|
+
const { pendingSeekTime } = this;
|
|
188
200
|
this.currentTime = currentTime;
|
|
201
|
+
const isPendingSeekReached = pendingSeekTime !== null
|
|
202
|
+
&& Math.abs(currentTime - pendingSeekTime) < PENDING_SEEK_THRESHOLD;
|
|
203
|
+
if (isPendingSeekReached) {
|
|
204
|
+
this.pendingSeekTime = null;
|
|
205
|
+
}
|
|
189
206
|
if (ui.seeking.seekTime === null) {
|
|
190
207
|
this.seekTime.current!.updateTime(currentTime);
|
|
191
208
|
}
|
|
@@ -229,7 +246,7 @@ export class Seekbar extends Component<Props> implements IFocusable {
|
|
|
229
246
|
const { ui } = this.props;
|
|
230
247
|
const time = ui.seeking.isSeeking()
|
|
231
248
|
? ui.seeking.seekTime!
|
|
232
|
-
: this.getCurrentTime();
|
|
249
|
+
: (this.pendingSeekTime ?? this.getCurrentTime());
|
|
233
250
|
const percentTime = TO_PERCENT * (time / this.duration);
|
|
234
251
|
this.seekBar.current!.style.width = `${percentTime}%`;
|
|
235
252
|
this.seekPoint.current!.style.left = `${percentTime}%`;
|