Files
YMhut-box-C-/参考/NexBox-main/src-tauri/src/video_bg.rs
T

10 lines
332 B
Rust

/// 打开原生文件对话框选择视频文件,返回绝对路径
#[tauri::command]
pub fn pick_video_file() -> Result<Option<String>, String> {
let file = rfd::FileDialog::new()
.add_filter("视频文件 (mp4/webm)", &["mp4", "webm"])
.pick_file();
Ok(file.map(|p| p.to_string_lossy().to_string()))
}