11import { createScope , effect , peek , signal } from 'maverick.js' ;
2- import { deferredPromise , isString , listenEvent , type DeferredPromise } from 'maverick.js/std' ;
2+ import {
3+ deferredPromise ,
4+ isArray ,
5+ isString ,
6+ listenEvent ,
7+ type DeferredPromise ,
8+ } from 'maverick.js/std' ;
39
410import { TimeRange , type MediaSrc } from '../../core' ;
511import { QualitySymbol } from '../../core/quality/symbols' ;
@@ -319,7 +325,13 @@ export class VimeoProvider
319325 }
320326
321327 protected _onTimeUpdate ( time : number , trigger : Event ) {
322- const { currentTime, paused, bufferedEnd } = this . _ctx . $state ;
328+ const { currentTime, paused, seeking, bufferedEnd } = this . _ctx . $state ;
329+
330+ if ( seeking ( ) && paused ( ) ) {
331+ this . _remote ( 'getBuffered' ) ;
332+ if ( bufferedEnd ( ) > time ) this . _notify ( 'seeked' , time , trigger ) ;
333+ }
334+
323335 if ( currentTime ( ) === time ) return ;
324336
325337 const prevTime = currentTime ( ) ,
@@ -336,6 +348,7 @@ export class VimeoProvider
336348 // This is how we detect `seeking` early.
337349 if ( Math . abs ( prevTime - time ) > 1.5 ) {
338350 this . _notify ( 'seeking' , time , trigger ) ;
351+
339352 if ( ! paused ( ) && bufferedEnd ( ) < time ) {
340353 this . _notify ( 'waiting' , undefined , trigger ) ;
341354 }
@@ -404,6 +417,11 @@ export class VimeoProvider
404417 // Why isn't this narrowing type?
405418 this . _onTimeUpdate ( data as number , trigger ) ;
406419 break ;
420+ case 'getBuffered' :
421+ if ( isArray ( data ) && data . length ) {
422+ this . _onLoadProgress ( data [ data . length - 1 ] [ 1 ] as number , trigger ) ;
423+ }
424+ break ;
407425 case 'setMuted' :
408426 this . _onVolumeChange ( peek ( this . _ctx . $state . volume ) , data as boolean , trigger ) ;
409427 break ;
0 commit comments