tauri icon indicating copy to clipboard operation
tauri copied to clipboard

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

Open GernotDoriat opened this issue 2 years ago • 2 comments

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

GernotDoriat avatar Aug 02 '22 06:08 GernotDoriat

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.

shunsukeoka avatar Aug 03 '22 10:08 shunsukeoka

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.

lygamac avatar Sep 10 '22 14:09 lygamac