Skip to content

Commit 298be0c

Browse files
committed
fix(player): vimeo should fire seeking
1 parent 5f11163 commit 298be0c

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

packages/vidstack/src/providers/vimeo/embed/event.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export interface VimeoEventPayload {
105105
loaded: { id: number };
106106
ended: void;
107107
seeking: void;
108+
seek: void;
108109
seeked: void;
109110
cuechange: void;
110111
fullscreenchange: { fullscreen: boolean };

packages/vidstack/src/providers/vimeo/provider.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ export class VimeoProvider
150150

151151
async play() {
152152
const { paused } = this._ctx.$state;
153-
if (!peek(paused)) return;
154153

155154
if (!this._playPromise) {
156155
this._playPromise = timedPromise<void, string>(() => {
@@ -166,7 +165,6 @@ export class VimeoProvider
166165

167166
async pause() {
168167
const { paused } = this._ctx.$state;
169-
if (peek(paused)) return;
170168

171169
if (!this._pausePromise) {
172170
this._pausePromise = timedPromise<void, string>(() => {
@@ -186,6 +184,7 @@ export class VimeoProvider
186184

187185
setCurrentTime(time) {
188186
this._remote('seekTo', time);
187+
this._notify('seeking', time);
189188
}
190189

191190
setVolume(volume) {
@@ -327,16 +326,11 @@ export class VimeoProvider
327326
}
328327

329328
protected _onTimeUpdate(time: number, trigger: Event) {
330-
const { currentTime, paused, seeking, bufferedEnd } = this._ctx.$state;
329+
const { realCurrentTime, paused, bufferedEnd } = this._ctx.$state;
331330

332-
if (seeking() && paused()) {
333-
this._remote('getBuffered');
334-
if (bufferedEnd() > time) this._notify('seeked', time, trigger);
335-
}
336-
337-
if (currentTime() === time) return;
331+
if (realCurrentTime() === time) return;
338332

339-
const prevTime = currentTime(),
333+
const prevTime = realCurrentTime(),
340334
detail = {
341335
currentTime: time,
342336
played:
@@ -373,7 +367,6 @@ export class VimeoProvider
373367
{ controls } = this._ctx.$state,
374368
showControls = controls() || $iosControls();
375369

376-
this._timeRAF._start();
377370
this._pro.set(pro);
378371
this._seekableRange = new TimeRange(0, duration);
379372
this._notify('poster-change', poster, trigger);
@@ -446,12 +439,14 @@ export class VimeoProvider
446439
}
447440

448441
protected _onPause(trigger: Event) {
442+
this._timeRAF._stop();
449443
this._notify('pause', undefined, trigger);
450444
this._pausePromise?.resolve();
451445
this._pausePromise = null;
452446
}
453447

454448
protected _onPlay(trigger: Event) {
449+
this._timeRAF._start();
455450
this._notify('play', undefined, trigger);
456451
this._playPromise?.resolve();
457452
this._playPromise = null;
@@ -633,6 +628,7 @@ export class VimeoProvider
633628
case 'error':
634629
this._onError(payload, trigger);
635630
break;
631+
case 'seek':
636632
case 'seeked':
637633
this._onSeeked(payload.seconds, trigger);
638634
break;

0 commit comments

Comments
 (0)