Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 1x 1x 24x 6x 6x 8x 8x | import { filter, map, pluck, pairwise, withLatestFrom, distinctUntilChanged } from 'rxjs/operators';
const MIN_SECONDS_SEEK_THRESHOLD = 2;
const calculateProgressDelta = ([prev, next]) => Math.abs(prev - next);
const createPlaybackSeekStream = (playerPlaybackUpdate$, resumePointsUpdate$) =>
playerPlaybackUpdate$
.pipe(
pluck('currentTime'),
distinctUntilChanged(),
pairwise(),
map(calculateProgressDelta),
filter(delta => delta > MIN_SECONDS_SEEK_THRESHOLD),
withLatestFrom(resumePointsUpdate$),
filter(([, { isEnabled }]) => isEnabled),
withLatestFrom(playerPlaybackUpdate$),
map(([, { currentTime }]) => currentTime),
);
export default createPlaybackSeekStream;
|