feat: add waveform generation and timeline display
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { VideoMetadata } from '$lib/bindings/video';
|
||||
import { startDownload } from '$lib/bindings/video';
|
||||
import type { ThumbnailSpritesheet } from '$lib/bindings/mediaAnalysis';
|
||||
import { extractKeyframes } from '$lib/bindings/mediaAnalysis';
|
||||
import { extractKeyframes, extractWaveform } from '$lib/bindings/mediaAnalysis';
|
||||
|
||||
export type SessionStatus = 'idle' | 'resolving' | 'ready' | 'error';
|
||||
export type DownloadStatus = 'idle' | 'downloading' | 'complete' | 'failed';
|
||||
@@ -79,12 +79,22 @@ export function reset() {
|
||||
}
|
||||
|
||||
async function triggerPostDownloadProcessing(filePath: string) {
|
||||
try {
|
||||
session.keyframePositions = await extractKeyframes(filePath);
|
||||
} catch (e) {
|
||||
console.error('Keyframe extraction failed:', e);
|
||||
const [keyframes, waveform] = await Promise.allSettled([
|
||||
extractKeyframes(filePath),
|
||||
extractWaveform(filePath, 8000),
|
||||
]);
|
||||
|
||||
if (keyframes.status === 'fulfilled') {
|
||||
session.keyframePositions = keyframes.value;
|
||||
} else {
|
||||
console.error('Keyframe extraction failed:', keyframes.reason);
|
||||
}
|
||||
|
||||
if (waveform.status === 'fulfilled') {
|
||||
session.waveformPeaks = waveform.value;
|
||||
} else {
|
||||
console.error('Waveform extraction failed:', waveform.reason);
|
||||
}
|
||||
// Waveform and thumbnails will be added in Tasks 10 and 11
|
||||
}
|
||||
|
||||
export async function beginDownload() {
|
||||
|
||||
Reference in New Issue
Block a user