import { getLatestMediaEngine } from "../tasks/makeMediaEngineTask.js";
import { Task } from "@lit/task";
const makeAudioSegmentIdTask = (host) => {
	return new Task(host, {
		args: () => [host.mediaEngineTask.value, host.desiredSeekTimeMs],
		onError: (error) => {
			console.error("audioSegmentIdTask error", error);
		},
		onComplete: (_value) => {},
		task: async ([, targetSeekTimeMs], { signal }) => {
			const mediaEngine = await getLatestMediaEngine(host, signal);
			signal.throwIfAborted();
			return mediaEngine.computeSegmentId(targetSeekTimeMs, mediaEngine.getAudioRendition());
		}
	});
};
export { makeAudioSegmentIdTask };
