Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[bug] Can't play local audio file in Linux #8654

Closed
thewh1teagle opened this issue Jan 22, 2024 · 8 comments
Closed

[bug] Can't play local audio file in Linux #8654

thewh1teagle opened this issue Jan 22, 2024 · 8 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@thewh1teagle
Copy link
Contributor

thewh1teagle commented Jan 22, 2024

Describe the bug

new Audio(localAudioPath).play() throws Unhandled Promise Rejection: NotSupportedError: The operation is not supported

When playing external audio it works.

new Audio("https://samplelib.com/lib/preview/wav/sample-3s.wav").play()

Reproduction

Load audio path with open() and convert it to asset path using convertFileSrc, then try to play with new Audio(path).play()

Expected behavior

It should play the sound

Full tauri info output

[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.0: 2.42.4
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.7.0
    - npm: 10.1.0
    - bun: 1.0.3

[-] Packages
    - tauri [RUST]: 1.5.4
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.5
    - tauri-cli [RUST]: 1.5.9
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 1.5.9

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React

Stack trace

No response

Additional context

https://discord.com/channels/616186924390023171/1198765010558664704

@thewh1teagle thewh1teagle added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jan 22, 2024
@FabianLars
Copy link
Member

Duplicate of #3725 (don't mind the title, it's for audio and video), thanks for the report nonetheless.

@FabianLars FabianLars closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
@thewh1teagle
Copy link
Contributor Author

@FabianLars
It's very long list with a lot of solutions.
Do you know some known workround?

@FabianLars
Copy link
Member

Not really, no. The only this is to spawn a http server on the rust side that serves the file :/

@thewh1teagle
Copy link
Contributor Author

thewh1teagle commented Jan 22, 2024

@FabianLars What about multipurpose custom protocol as workaround for such cases?
The goal is to load the files efficiently same as file object does, and easily with path.
So I will load it as URL to custom asset which will be handled from rust side

And of course I prefer not to spawn http server

@thewh1teagle
Copy link
Contributor Author

I tried to load image in the same path of the audio file and it loaded it. so it happens only in audio files / videos
image

@FabianLars
Copy link
Member

What about multipurpose custom protocol as workaround for such cases?

The custom protocol is the issue here. webkitgtk simply cannot load audio/video from custom protocols, seemingly no matter how the rust side of it is implemented. iirc it doesn't accept unknown schemes. In the issue i linked there should also be a reference to the webkit bugtracker with hopefully more info.

@thewh1teagle
Copy link
Contributor Author

I reproduces the problem in simple C code which uses webkitgtk.
The problem happens there too.
I hope tauri won't use webkitgtk in long term. it doesn't have normal repo, seems to be very old, and so many bugs inside of webkitgtk itself.
I hope tauri will use servo project someday.

@amosjyng
Copy link

+1, my experience with Tauri has been pretty pleasant except for webkitgtk, which has honestly been a real PITA.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

3 participants