try to make audio play

This commit is contained in:
Martin Drechsel
2025-05-16 08:52:04 +02:00
parent ad3aa4293a
commit 6a1351752b
9 changed files with 250 additions and 1218 deletions

View File

@ -130,7 +130,7 @@ pub fn resolve_secure_extension_asset_path<R: Runtime>(
// 2. Bestimme das Basisverzeichnis für alle Erweiterungen (Resource Directory)
let base_extensions_dir = app_handle
.path()
.resource_dir() // Korrekt für Ressourcen
.app_data_dir() // Korrekt für Ressourcen
// Wenn du stattdessen App Local Data willst: .app_local_data_dir()
.map_err(|e: TauriError| format!("Basis-Verzeichnis nicht gefunden: {}", e))?
.join("extensions");
@ -220,6 +220,7 @@ pub fn extension_protocol_handler<R: Runtime>(
let mime_type = mime_guess::from_path(&absolute_secure_path)
.first_or(mime::APPLICATION_OCTET_STREAM)
.to_string();
let content_length = content.len();
println!(
"Liefere {} ({}) ",
absolute_secure_path.display(),
@ -228,6 +229,9 @@ pub fn extension_protocol_handler<R: Runtime>(
Response::builder()
.status(200)
.header("Content-Type", mime_type)
.header("Content-Length", content_length.to_string()) // <-- HIER HINZUGEFÜGT
// Optional, aber gut für Streaming-Fähigkeit:
.header("Accept-Ranges", "bytes")
.body(content)
.map_err(|e| e.into())
}