Skip to content

Player::Append blocks thread in wasm #921

Description

@Boneyan

I try to do simple thing:

  1. Call Player::clear() to stop current audio track
  2. Immediately after that I call Player::append() to play new track
if !player.empty() {
    player.clear();
}
player.append(sound);

It works fine on linux/windows, but it deadlocks my app thread in WASM.
I have a guess why: inside append there is call to sleep_until_end. sleep_until_end does std::sync::mpsc::Receiver::recv inside of it. And recv blocks calling thread. It causes no issues in linux/windows, because rodio lives in separate thread. But in wasm we have single thread for all things and recv blocks it.
(playing sound on empty Player in WASM works fine)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions