Skip to content

Commit

Permalink
fix(playback-core): Make sure seekable TimeRanges is populated when u…
Browse files Browse the repository at this point in the history
…pdating state. (#1004)

Suspect this is the root cause of (non-fatal) error logs showing up in
test runs (including CI).
  • Loading branch information
cjpillsbury authored Oct 21, 2024
1 parent 99a0726 commit b53b1ba
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/playback-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,12 +1100,17 @@ export const loadMedia = (
}
};

let prevSeekableStart: number;
let prevSeekableEnd: number;
let prevSeekableStart: number | undefined;
let prevSeekableEnd: number | undefined;

const seekableChange = () => {
const nextSeekableStart = getSeekable(mediaEl)?.start(0);
const nextSeekableEnd = getSeekable(mediaEl)?.end(0);
const seekableTimeRanges = getSeekable(mediaEl);
let nextSeekableStart: number | undefined;
let nextSeekableEnd: number | undefined;
if (seekableTimeRanges.length > 0) {
nextSeekableStart = seekableTimeRanges.start(0);
nextSeekableEnd = seekableTimeRanges.end(0);
}
if (prevSeekableEnd !== nextSeekableEnd || prevSeekableStart !== nextSeekableStart) {
mediaEl.dispatchEvent(new CustomEvent('seekablechange', { composed: true }));
}
Expand Down

0 comments on commit b53b1ba

Please sign in to comment.