feat: add waveform generation and timeline display
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::services::keyframe_index;
|
||||
use crate::services::{keyframe_index, waveform_generator};
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn extract_keyframes(file_path: String) -> Result<Vec<f64>, String> {
|
||||
@@ -6,3 +6,15 @@ pub async fn extract_keyframes(file_path: String) -> Result<Vec<f64>, String> {
|
||||
.await
|
||||
.map_err(|e| format!("Task failed: {e}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn extract_waveform(
|
||||
file_path: String,
|
||||
sample_count: usize,
|
||||
) -> Result<Vec<f64>, String> {
|
||||
tokio::task::spawn_blocking(move || {
|
||||
waveform_generator::extract_waveform(&file_path, sample_count)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| format!("Task failed: {e}"))?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user