Skip to content

[bug] I can't play mp3 #9326

Description

@ulizkoigor

Describe the bug

I am writing an application in linux OS. I need to play an mp3 file. When I do this:

        const fileName = `audio/sound.mp3`
        const path = await resolveResource(`resources/${fileName}`)
        new Audio(path).play()

there is no sound, but the console outputs "Unhandled Promise Rejection: NotSupportedError: The operation is not supported.".

And when I do that, it doesn't work either:

        const fileName = `audio/sound.mp3`
        const path = await resolveResource(`resources/${fileName}`)
        const assetUrl = convertFileSrc(path)
        new Audio(assetUrl).play()

The error in the console is the same: "Unhandled Promise Rejection: NotSupportedError: The operation is not supported."

I found a lot of topics on this issue here, but I still haven't figured out how to solve this problem. Help please. Thanks.

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Linux Mint 21.3 X64
    ✔ webkit2gtk-4.0: 2.42.5
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.76.0 (07dca489a 2024-02-04)
    ✔ cargo: 1.76.0 (c84b36747 2024-01-18)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 21.7.1
    - npm: 10.5.0

[-] Packages
    - tauri [RUST]: 1.6.1
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.7
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.5.11

[-] App
    - build-type: bundle
    - CSP: default-src 'self'; media-src 'self' asset: https://asset.localhost;
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions