tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.58k stars 2.36k forks source link

[bug] Can't access local audio files on macOS #4826

Open GernotDoriat opened 1 year ago

GernotDoriat commented 1 year ago

Describe the bug

My tauri app make use of local files for video, img and audio elements via convertFileSrc. On Win10 everything works fine, but on macOS the local audio files are not accepted and an exception is thrown:

NotSupportedError: The operation is not supported.

video and img elements are loaded without problems.

Also a variant of this app accessing non-local assets is running on macOS without problems

Reproduction

No response

Expected behavior

Playing local audio assets on macOS as on Win10

Platform and versions

Environment › OS: Mac OS 12.5.0 X64 › Node.js: 16.15.0 › npm: 8.5.5 › pnpm: Not installed! › yarn: Not installed! › rustup: 1.24.3 › rustc: 1.60.0 › cargo: 1.60.0 › Rust toolchain: stable-aarch64-apple-darwin

Packages › @tauri-apps/cli [NPM]: 1.0.5 › @tauri-apps/api [NPM]: 1.0.2 › tauri [RUST]: 1.0.5, › tauri-build [RUST]: 1.0.4, › tao [RUST]: 0.12.2, › wry [RUST]: 0.19.0,

App › build-type: bundle › CSP: unset › distDir: ../build › devPath: http://localhost:5173/ › framework: Svelte

App directory structure ├─ .husky ├─ node_modules ├─ netlify ├─ static ├─ src-tauri ├─ .svelte-kit ├─ build ├─ .git ├─ .vscode └─ src

Stack trace

No response

Additional context

No response

shunsukeoka commented 1 year ago

I have the same problem on macOS.

I get an error when I try to play a local audio file with the Audio tag using convertFileSrc. I am using howler.js to play the sound file, but the error seems to occur at the loading stage.

The media resource indicated by the src attribute or assigned media provider object was not suitable.

I also tried to playback using the Web Audio API, but this works fine.

No problems with images and video.

lygamac commented 1 year ago

Same error in ArchLinux.

In my case, the code is simple:

let longBreakAudio = new Audio('@/path/to.mp3')
audio.play()

The error only happens for binary builds (both debug and release). Preview in npx tauri dev works fine.