feat: add thumbnail extraction and timeline display
Wire ffmpeg frame extraction into post-download processing and render adaptive thumbnail strips on the timeline via the asset protocol. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::services::{keyframe_index, waveform_generator};
|
||||
use crate::models::ThumbnailSpritesheet;
|
||||
use crate::services::{keyframe_index, thumbnail_extractor, waveform_generator};
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn extract_keyframes(file_path: String) -> Result<Vec<f64>, String> {
|
||||
@@ -18,3 +19,19 @@ pub async fn extract_waveform(
|
||||
.await
|
||||
.map_err(|e| format!("Task failed: {e}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn extract_thumbnails(
|
||||
file_path: String,
|
||||
duration: f64,
|
||||
) -> Result<Vec<ThumbnailSpritesheet>, String> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let temp_dir = std::env::temp_dir()
|
||||
.join("video-clipper-thumbs")
|
||||
.join(uuid::Uuid::new_v4().to_string());
|
||||
let temp_dir_str = temp_dir.to_string_lossy().to_string();
|
||||
thumbnail_extractor::extract_thumbnails(&file_path, duration, &temp_dir_str)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| format!("Task failed: {e}"))?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user