🎥 Make videos programmatically with React
progress
Jonny Burger0da6474e515f
diff --git a/packages/media-parser/src/containers/m3u/get-seeking-byte.ts b/packages/media-parser/src/containers/m3u/get-seeking-byte.tsindex 817c45f04c..8d8694568e 100644--- a/packages/media-parser/src/containers/m3u/get-seeking-byte.ts+++ b/packages/media-parser/src/containers/m3u/get-seeking-byte.ts@@ -1,14 +1,39 @@+import type {LogLevel} from '../../log';+import {Log} from '../../log';import type {M3u8SeekingHints} from '../../seeking-hints';+import type {M3uState} from '../../state/m3u-state';import type {SeekResolution} from '../../work-on-seek-request';export const getSeekingByteForM3u8 = ({time,seekingHints,+ currentPosition,+ m3uState,+ logLevel,}: {time: number;seekingHints: M3u8SeekingHints;+ currentPosition: number;+ m3uState: M3uState;+ logLevel: LogLevel;}): SeekResolution => {+ const selectedPlaylists = m3uState.getSelectedPlaylists();+ for (const playlistUrl of selectedPlaylists) {+ const streamRun = m3uState.getM3uStreamRun(playlistUrl);+ if (streamRun) {+ streamRun.abort();+ }++ Log.trace(logLevel, 'Clearing M3U stream run for', playlistUrl);+ m3uState.setM3uStreamRun(playlistUrl, null);+ }++ m3uState.clearAllChunksProcessed();++ console.log({selectedPlaylists, seekingHints, time});+return {- type: 'valid-but-must-wait',+ type: 'do-seek',+ byte: currentPosition,};};diff --git a/packages/media-parser/src/containers/m3u/iterate-over-segment-files.ts b/packages/media-parser/src/containers/m3u/iterate-over-segment-files.tsdeleted file mode 100644index 9dff8d6834..0000000000--- a/packages/media-parser/src/containers/m3u/iterate-over-segment-files.ts+++ /dev/null@@ -1,186 +0,0 @@-import type {MediaParserController} from '../../controller/media-parser-controller';-import {mediaParserController} from '../../controller/media-parser-controller';-import type {PrefetchCache} from '../../fetch';-import {forwardMediaParserControllerPauseResume} from '../../forward-controller-pause-resume-abort';-import type {AudioTrack, VideoTrack} from '../../get-tracks';-import type {LogLevel} from '../../log';-import {parseMedia} from '../../parse-media';-import type {ReaderInterface} from '../../readers/reader';-import type {M3uRun, M3uState} from '../../state/m3u-state';-import type {OnAudioSample, OnVideoSample} from '../../webcodec-sample-types';-import {withResolvers} from '../../with-resolvers';-import {getChunks} from './get-chunks';-import {getPlaylist} from './get-playlist';-import type {M3uStructure} from './types';--export const iteratorOverSegmentFiles = async ({- structure,- onVideoTrack,- m3uState,- onAudioTrack,- onDoneWithTracks,- playlistUrl,- logLevel,- parentController,- onInitialProgress,- readerInterface,- prefetchCache,-}: {- structure: M3uStructure;- onVideoTrack: null | ((track: VideoTrack) => Promise<OnVideoSample | null>);- onAudioTrack: null | ((track: AudioTrack) => Promise<OnAudioSample | null>);- onDoneWithTracks: () => void;- m3uState: M3uState;- playlistUrl: string;- logLevel: LogLevel;- parentController: MediaParserController;- onInitialProgress: (run: M3uRun | null) => void;- readerInterface: ReaderInterface;- prefetchCache: PrefetchCache;-}) => {- const playlist = getPlaylist(structure, playlistUrl);- const chunks = getChunks(playlist);- let resolver: (run: M3uRun | null) => void = onInitialProgress;- // eslint-disable-next-line @typescript-eslint/no-unused-vars- let rejector = (_e: Error) => {};-- for (const chunk of chunks) {- resolver = onInitialProgress;- // eslint-disable-next-line @typescript-eslint/no-unused-vars- rejector = (_e: Error) => {};- const childController = mediaParserController();- const forwarded = forwardMediaParserControllerPauseResume({- childController,- parentController,- });-- const nextChunk = chunks[chunks.indexOf(chunk) + 1];- if (nextChunk) {- const nextChunkSource = readerInterface.createAdjacentFileSource(- nextChunk.url,- playlistUrl,- );- readerInterface.preload({- logLevel,- range: null,- src: nextChunkSource,- prefetchCache,- });- }-- const makeContinuationFn = (): M3uRun => {- return {- continue() {- const {promise, reject, resolve} = withResolvers<M3uRun | null>();- resolver = resolve;- rejector = reject;- childController.resume();- return promise;- },- abort() {- childController.abort();- },- };- };-- const isLastChunk = chunk === chunks[chunks.length - 1];- await childController._internals.checkForAbortAndPause();- const src = readerInterface.createAdjacentFileSource(- chunk.url,- playlistUrl,- );-- try {- const mp4HeaderSegment = m3uState.getMp4HeaderSegment(playlistUrl);- const data = await parseMedia({- src,- acknowledgeRemotionLicense: true,- logLevel,- controller: childController,- progressIntervalInMs: 0,- onParseProgress: () => {- childController.pause();- resolver(makeContinuationFn());- },- fields: chunk.isHeader ? {structure: true} : undefined,- onTracks: () => {- if (!m3uState.hasEmittedDoneWithTracks(playlistUrl)) {- m3uState.setHasEmittedDoneWithTracks(playlistUrl);- onDoneWithTracks();- return null;- }- },- onAudioTrack:- onAudioTrack === null- ? null- : async ({track}) => {- const callbackOrFalse =- m3uState.hasEmittedAudioTrack(playlistUrl);- if (callbackOrFalse === false) {- const callback = await onAudioTrack(track);-- if (!callback) {- m3uState.setHasEmittedAudioTrack(playlistUrl, null);- return null;- }-- m3uState.setHasEmittedAudioTrack(playlistUrl, callback);- return (sample) => {- return callback(sample);- };- }-- return callbackOrFalse;- },- onVideoTrack:- onVideoTrack === null- ? null- : async ({track}) => {- const callbackOrFalse =- m3uState.hasEmittedVideoTrack(playlistUrl);- if (callbackOrFalse === false) {- const callback = await onVideoTrack({- ...track,- m3uStreamFormat:- chunk.isHeader || mp4HeaderSegment ? 'mp4' : 'ts',- });-- if (!callback) {- m3uState.setHasEmittedVideoTrack(playlistUrl, null);- return null;- }-- m3uState.setHasEmittedVideoTrack(playlistUrl, callback);- return (sample) => {- return callback(sample);- };- }-- return callbackOrFalse;- },- reader: readerInterface,- mp4HeaderSegment,- makeSamplesStartAtZero: false,- });- if (chunk.isHeader) {- if (data.structure.type !== 'iso-base-media') {- throw new Error('Expected an mp4 file');- }-- m3uState.setMp4HeaderSegment(playlistUrl, data.structure);- }- } catch (e) {- rejector(e as Error);- throw e;- }-- forwarded.cleanup();-- if (!isLastChunk) {- childController.pause();- resolver(makeContinuationFn());- }- }-- resolver(null);-};diff --git a/packages/media-parser/src/containers/m3u/parse-m3u.ts b/packages/media-parser/src/containers/m3u/parse-m3u.tsindex b881e0ee23..e6f73a911d 100644--- a/packages/media-parser/src/containers/m3u/parse-m3u.ts+++ b/packages/media-parser/src/containers/m3u/parse-m3u.ts@@ -5,7 +5,9 @@ import {runOverM3u} from './run-over-m3u';export const parseM3u = async ({state}: {state: ParserState}) => {const structure = state.structure.getM3uStructure();+ console.log('parse m3u');if (state.m3u.isReadyToIterateOverM3u()) {+ console.log('is ready to iterate over m3u');const selectedPlaylists = state.m3u.getSelectedPlaylists();const whichPlaylistToRunOver =@@ -28,7 +30,9 @@ export const parseM3u = async ({state}: {state: ParserState}) => {state.mediaSection.addMediaSection({start: 0,- size: state.contentLength,+ // We do a pseudo-seek when seeking m3u, which will be the same byte+ // as we are currently in, which in most cases is the end of the file.+ size: state.contentLength + 1,});await afterManifestFetch({diff --git a/packages/media-parser/src/containers/m3u/process-m3u-chunk.ts b/packages/media-parser/src/containers/m3u/process-m3u-chunk.tsindex fa23542f9b..09f74f7700 100644--- a/packages/media-parser/src/containers/m3u/process-m3u-chunk.ts+++ b/packages/media-parser/src/containers/m3u/process-m3u-chunk.ts@@ -1,8 +1,14 @@+import {mediaParserController} from '../../controller/media-parser-controller';+import {forwardMediaParserControllerPauseResume} from '../../forward-controller-pause-resume-abort';+import type {AudioTrack, VideoTrack} from '../../get-tracks';+import {parseMedia} from '../../parse-media';import {registerAudioTrack, registerVideoTrack} from '../../register-track';-import type {M3uRun} from '../../state/m3u-state';+import {type M3uRun} from '../../state/m3u-state';import type {ParserState} from '../../state/parser-state';+import type {OnAudioSample, OnVideoSample} from '../../webcodec-sample-types';import {withResolvers} from '../../with-resolvers';-import {iteratorOverSegmentFiles} from './iterate-over-segment-files';+import {getChunks} from './get-chunks';+import {getPlaylist} from './get-playlist';import type {M3uStructure} from './types';export const processM3uChunk = ({@@ -20,96 +26,244 @@ export const processM3uChunk = ({}) => {const {promise, reject, resolve} = withResolvers<M3uRun | null>();- const run = iteratorOverSegmentFiles({- playlistUrl,- structure,- onInitialProgress: (newRun) => {- resolve(newRun);- },- logLevel: state.logLevel,- onDoneWithTracks() {- const allDone = state.m3u.setTracksDone(playlistUrl);- if (allDone) {- state.callbacks.tracks.setIsDone(state.logLevel);+ const _onInitialProgress = (newRun: M3uRun | null) => {+ resolve(newRun);+ };++ const _onDoneWithTracks = () => {+ const allDone = state.m3u.setTracksDone(playlistUrl);+ if (allDone) {+ state.callbacks.tracks.setIsDone(state.logLevel);+ }+ };++ const _onAudioTrack = audioDone+ ? null+ : async (track: AudioTrack): Promise<OnAudioSample | null> => {+ const existingTracks = state.callbacks.tracks.getTracks();+ let {trackId} = track;+ while (existingTracks.find((t) => t.trackId === trackId)) {+ trackId++;+ }++ const onAudioSample = await registerAudioTrack({+ container: 'm3u8',+ track: {+ ...track,+ trackId,+ },+ registerAudioSampleCallback:+ state.callbacks.registerAudioSampleCallback,+ tracks: state.callbacks.tracks,+ logLevel: state.logLevel,+ onAudioTrack: state.onAudioTrack,+ });+ state.m3u.sampleSorter.addToStreamWithTrack(playlistUrl);++ if (onAudioSample === null) {+ return null;+ }++ state.m3u.sampleSorter.addAudioStreamToConsider(+ playlistUrl,+ onAudioSample,+ );++ return async (sample) => {+ await state.m3u.sampleSorter.addAudioSample(playlistUrl, sample);+ };+ };++ const _onVideoTrack = videoDone+ ? null+ : async (track: VideoTrack): Promise<OnVideoSample | null> => {+ const existingTracks = state.callbacks.tracks.getTracks();+ let {trackId} = track;+ while (existingTracks.find((t) => t.trackId === trackId)) {+ trackId++;+ }++ const onVideoSample = await registerVideoTrack({+ container: 'm3u8',+ track: {+ ...track,+ trackId,+ },+ logLevel: state.logLevel,+ onVideoTrack: state.onVideoTrack,+ registerVideoSampleCallback:+ state.callbacks.registerVideoSampleCallback,+ tracks: state.callbacks.tracks,+ });+ state.m3u.sampleSorter.addToStreamWithTrack(playlistUrl);++ if (onVideoSample === null) {+ return null;+ }++ state.m3u.sampleSorter.addVideoStreamToConsider(+ playlistUrl,+ onVideoSample,+ );++ return async (sample) => {+ await state.m3u.sampleSorter.addVideoSample(playlistUrl, sample);+ };+ };++ const iteratorOverSegmentFiles = async () => {+ const playlist = getPlaylist(structure, playlistUrl);+ const chunks = getChunks(playlist);+ let resolver: (run: M3uRun | null) => void = _onInitialProgress;+ // eslint-disable-next-line @typescript-eslint/no-unused-vars+ let rejector = (_e: Error) => {};++ for (const chunk of chunks) {+ resolver = _onInitialProgress;+ // eslint-disable-next-line @typescript-eslint/no-unused-vars+ rejector = (_e: Error) => {};+ const childController = mediaParserController();+ const forwarded = forwardMediaParserControllerPauseResume({+ childController,+ parentController: state.controller,+ });++ const nextChunk = chunks[chunks.indexOf(chunk) + 1];+ if (nextChunk) {+ const nextChunkSource = state.readerInterface.createAdjacentFileSource(+ nextChunk.url,+ playlistUrl,+ );+ state.readerInterface.preload({+ logLevel: state.logLevel,+ range: null,+ src: nextChunkSource,+ prefetchCache: state.prefetchCache,+ });}- },- onAudioTrack: audioDone- ? null- : async (track) => {- const existingTracks = state.callbacks.tracks.getTracks();- let {trackId} = track;- while (existingTracks.find((t) => t.trackId === trackId)) {- trackId++;- }- const onAudioSample = await registerAudioTrack({- container: 'm3u8',- track: {- ...track,- trackId,- },- registerAudioSampleCallback:- state.callbacks.registerAudioSampleCallback,- tracks: state.callbacks.tracks,- logLevel: state.logLevel,- onAudioTrack: state.onAudioTrack,- });- state.m3u.sampleSorter.addToStreamWithTrack(playlistUrl);-- if (onAudioSample === null) {- return null;- }+ const makeContinuationFn = (): M3uRun => {+ return {+ continue() {+ const {+ promise: promise_,+ reject: reject_,+ resolve: resolve_,+ } = withResolvers<M3uRun | null>();+ resolver = resolve_;+ rejector = reject_;+ childController.resume();+ return promise_;+ },+ abort() {+ childController.abort();+ },+ };+ };- state.m3u.sampleSorter.addAudioStreamToConsider(- playlistUrl,- onAudioSample,- );-- return async (sample) => {- await state.m3u.sampleSorter.addAudioSample(playlistUrl, sample);- };- },- onVideoTrack: videoDone- ? null- : async (track) => {- const existingTracks = state.callbacks.tracks.getTracks();- let {trackId} = track;- while (existingTracks.find((t) => t.trackId === trackId)) {- trackId++;- }+ const isLastChunk = chunk === chunks[chunks.length - 1];+ await childController._internals.checkForAbortAndPause();+ const src = state.readerInterface.createAdjacentFileSource(+ chunk.url,+ playlistUrl,+ );++ try {+ const mp4HeaderSegment = state.m3u.getMp4HeaderSegment(playlistUrl);+ const data = await parseMedia({+ src,+ acknowledgeRemotionLicense: true,+ logLevel: state.logLevel,+ controller: childController,+ progressIntervalInMs: 0,+ onParseProgress: () => {+ childController.pause();+ resolver(makeContinuationFn());+ },+ fields: chunk.isHeader ? {structure: true} : undefined,+ onTracks: () => {+ if (!state.m3u.hasEmittedDoneWithTracks(playlistUrl)) {+ state.m3u.setHasEmittedDoneWithTracks(playlistUrl);+ _onDoneWithTracks();+ return null;+ }+ },+ onAudioTrack:+ _onAudioTrack === null+ ? null+ : async ({track}) => {+ const callbackOrFalse =+ state.m3u.hasEmittedAudioTrack(playlistUrl);+ if (callbackOrFalse === false) {+ const callback = await _onAudioTrack(track);++ if (!callback) {+ state.m3u.setHasEmittedAudioTrack(playlistUrl, null);+ return null;+ }++ state.m3u.setHasEmittedAudioTrack(playlistUrl, callback);+ return (sample) => {+ return callback(sample);+ };+ }++ return callbackOrFalse;+ },+ onVideoTrack:+ _onVideoTrack === null+ ? null+ : async ({track}) => {+ const callbackOrFalse =+ state.m3u.hasEmittedVideoTrack(playlistUrl);+ if (callbackOrFalse === false) {+ const callback = await _onVideoTrack({+ ...track,+ m3uStreamFormat:+ chunk.isHeader || mp4HeaderSegment ? 'mp4' : 'ts',+ });++ if (!callback) {+ state.m3u.setHasEmittedVideoTrack(playlistUrl, null);+ return null;+ }++ state.m3u.setHasEmittedVideoTrack(playlistUrl, callback);+ return (sample) => {+ return callback(sample);+ };+ }- const onVideoSample = await registerVideoTrack({- container: 'm3u8',- track: {- ...track,- trackId,- },- logLevel: state.logLevel,- onVideoTrack: state.onVideoTrack,- registerVideoSampleCallback:- state.callbacks.registerVideoSampleCallback,- tracks: state.callbacks.tracks,- });- state.m3u.sampleSorter.addToStreamWithTrack(playlistUrl);-- if (onVideoSample === null) {- return null;+ return callbackOrFalse;+ },+ reader: state.readerInterface,+ mp4HeaderSegment,+ makeSamplesStartAtZero: false,+ });+ if (chunk.isHeader) {+ if (data.structure.type !== 'iso-base-media') {+ throw new Error('Expected an mp4 file');}- state.m3u.sampleSorter.addVideoStreamToConsider(- playlistUrl,- onVideoSample,- );-- return async (sample) => {- await state.m3u.sampleSorter.addVideoSample(playlistUrl, sample);- };- },- m3uState: state.m3u,- parentController: state.controller,- readerInterface: state.readerInterface,- prefetchCache: state.prefetchCache,- });+ state.m3u.setMp4HeaderSegment(playlistUrl, data.structure);+ }+ } catch (e) {+ rejector(e as Error);+ throw e;+ }++ forwarded.cleanup();++ if (!isLastChunk) {+ childController.pause();+ resolver(makeContinuationFn());+ }+ }++ resolver(null);+ };++ const run = iteratorOverSegmentFiles();run.catch((err) => {reject(err);diff --git a/packages/media-parser/src/containers/m3u/run-over-m3u.ts b/packages/media-parser/src/containers/m3u/run-over-m3u.tsindex 4ad3ab499c..ce86edcacc 100644--- a/packages/media-parser/src/containers/m3u/run-over-m3u.ts+++ b/packages/media-parser/src/containers/m3u/run-over-m3u.ts@@ -15,6 +15,7 @@ export const runOverM3u = async ({playlistUrl: string;logLevel: LogLevel;}) => {+ console.log('---');const tracksDone = state.m3u.getTrackDone(playlistUrl);const hasAudioStreamToConsider =state.m3u.sampleSorter.hasAudioStreamToConsider(playlistUrl);@@ -26,6 +27,7 @@ export const runOverM3u = async ({const bothDone = audioDone && videoDone;if (bothDone) {+ console.log('both done');state.m3u.setAllChunksProcessed(playlistUrl);return;}@@ -34,7 +36,9 @@ export const runOverM3u = async ({if (existingRun) {Log.trace(logLevel, 'Existing M3U parsing process found for', playlistUrl);+ console.log('existing run');const run = await existingRun.continue();+ console.log('existing run, continued');state.m3u.setM3uStreamRun(playlistUrl, run);if (!run) {state.m3u.setAllChunksProcessed(playlistUrl);diff --git a/packages/media-parser/src/containers/m3u/seeking-hints.ts b/packages/media-parser/src/containers/m3u/seeking-hints.tsindex ad86e4eba5..f10b70440d 100644--- a/packages/media-parser/src/containers/m3u/seeking-hints.ts+++ b/packages/media-parser/src/containers/m3u/seeking-hints.ts@@ -12,7 +12,10 @@ export const getSeekingHintsForM3u = ({(b) => b.type === 'm3u-playlist',) as M3uPlaylist[];console.log(- playlists.map((b) => b.boxes.filter((b) => b.type === 'm3u-extinf')),+ playlists.map((b) => ({+ a: JSON.stringify(b.boxes),+ i: b.boxes.filter((b) => b.type === 'm3u-extinf'),+ })),);return {diff --git a/packages/media-parser/src/get-seeking-byte.ts b/packages/media-parser/src/get-seeking-byte.tsindex 7d91c14032..1775a065e7 100644--- a/packages/media-parser/src/get-seeking-byte.ts+++ b/packages/media-parser/src/get-seeking-byte.ts@@ -10,6 +10,7 @@ import type {LogLevel} from './log';import type {IsoBaseMediaStructure} from './parse-result';import type {SeekingHints} from './seeking-hints';import type {IsoBaseMediaState} from './state/iso-base-media/iso-state';+import type {M3uState} from './state/m3u-state';import type {WebmState} from './state/matroska/webm';import type {RiffState} from './state/riff';import type {StructureState} from './state/structure';@@ -30,6 +31,7 @@ export const getSeekingByte = ({mp4HeaderSegment,structure,riffState,+ m3uState,}: {info: SeekingHints;time: number;@@ -42,6 +44,7 @@ export const getSeekingByte = ({structure: StructureState;mp4HeaderSegment: IsoBaseMediaStructure | null;riffState: RiffState;+ m3uState: M3uState;}): Promise<SeekResolution> => {if (info.type === 'iso-base-media-seeking-hints') {return getSeekingByteFromIsoBaseMedia({@@ -136,6 +139,9 @@ export const getSeekingByte = ({getSeekingByteForM3u8({time,seekingHints: info,+ currentPosition,+ m3uState,+ logLevel,}),);}diff --git a/packages/media-parser/src/parse-loop.ts b/packages/media-parser/src/parse-loop.tsindex 1198f5123d..108cf8b389 100644--- a/packages/media-parser/src/parse-loop.ts+++ b/packages/media-parser/src/parse-loop.ts@@ -77,7 +77,9 @@ export const parseLoop = async ({try {await triggerInfoEmit(state);+ Log.trace(state.logLevel, 'pause check');await state.controller._internals.checkForAbortAndPause();+ Log.trace(state.logLevel, 'pause check done');const skip = await runParseIteration({state,});diff --git a/packages/media-parser/src/state/m3u-state.ts b/packages/media-parser/src/state/m3u-state.tsindex 852434e747..cb08c07de2 100644--- a/packages/media-parser/src/state/m3u-state.ts+++ b/packages/media-parser/src/state/m3u-state.ts@@ -111,6 +111,11 @@ export const m3uState = (logLevel: LogLevel) => {setAllChunksProcessed: (src: string) => {allChunksProcessed[src] = true;},+ clearAllChunksProcessed: () => {+ Object.keys(allChunksProcessed).forEach((key) => {+ delete allChunksProcessed[key];+ });+ },getAllChunksProcessedForPlaylist,getAllChunksProcessedOverall: () => {if (!selectedMainPlaylist) {@@ -140,6 +145,11 @@ export const m3uState = (logLevel: LogLevel) => {getTrackDone: (playlistUrl: string) => {return tracksDone[playlistUrl];},+ clearTracksDone: () => {+ Object.keys(tracksDone).forEach((key) => {+ delete tracksDone[key];+ });+ },getM3uStreamRun: (playlistUrl: string) =>m3uStreamRuns[playlistUrl] ?? null,abortM3UStreamRuns: () => {diff --git a/packages/media-parser/src/test/seeking/seek-m3u.test.ts b/packages/media-parser/src/test/seeking/seek-m3u.test.tsindex 38fb1c773a..8af66e22d3 100644--- a/packages/media-parser/src/test/seeking/seek-m3u.test.ts+++ b/packages/media-parser/src/test/seeking/seek-m3u.test.ts@@ -7,16 +7,17 @@ import {parseMedia} from '../../parse-media';test('seek m3u', async () => {const controller = mediaParserController();- controller._experimentalSeek({+ /* controller._experimentalSeek({type: 'keyframe-before-time',timeInSeconds: 4,- });+ }); */await parseMedia({src: exampleVideos.localplaylist,acknowledgeRemotionLicense: true,controller,reader: nodeReader,+ logLevel: 'trace',onVideoTrack: () => {return (sample) => {console.log(sample.dts / sample.timescale);diff --git a/packages/media-parser/src/work-on-seek-request.ts b/packages/media-parser/src/work-on-seek-request.tsindex 63693169df..5f256aef2b 100644--- a/packages/media-parser/src/work-on-seek-request.ts+++ b/packages/media-parser/src/work-on-seek-request.ts@@ -17,6 +17,7 @@ import type {FlacState} from './state/flac-state';import type {TracksState} from './state/has-tracks-section';import type {IsoBaseMediaState} from './state/iso-base-media/iso-state';import type {KeyframesState} from './state/keyframes';+import type {M3uState} from './state/m3u-state';import type {WebmState} from './state/matroska/webm';import type {Mp3State} from './state/mp3';import type {ParserState} from './state/parser-state';@@ -45,6 +46,7 @@ const turnSeekIntoByte = async ({mp3State,contentLength,aacState,+ m3uState,}: {seek: Seek;mediaSectionState: MediaSectionState;@@ -63,6 +65,7 @@ const turnSeekIntoByte = async ({mp3State: Mp3State;aacState: AacState;contentLength: number;+ m3uState: M3uState;}): Promise<SeekResolution> => {const mediaSections = mediaSectionState.getMediaSections();@@ -116,6 +119,7 @@ const turnSeekIntoByte = async ({mp4HeaderSegment,structure: structureState,riffState,+ m3uState,});return seekingByte;@@ -158,6 +162,7 @@ export type WorkOnSeekRequestOptions = {riffState: RiffState;mp3State: Mp3State;aacState: AacState;+ m3uState: M3uState;prefetchCache: PrefetchCache;};@@ -189,6 +194,7 @@ export const getWorkOnSeekRequestOptions = (riffState: state.riff,mp3State: state.mp3,aacState: state.aac,+ m3uState: state.m3u,prefetchCache: state.prefetchCache,};};@@ -220,6 +226,7 @@ export const workOnSeekRequest = async (options: WorkOnSeekRequestOptions) => {mp3State,aacState,prefetchCache,+ m3uState,} = options;const seek = controller._internals.seekSignal.getSeek();if (!seek) {@@ -245,6 +252,7 @@ export const workOnSeekRequest = async (options: WorkOnSeekRequestOptions) => {mp3State,contentLength,aacState,+ m3uState,});Log.trace(logLevel, `Seek action: ${JSON.stringify(resolution)}`);