Skip to content

Rebuilding OutputStream and Sinks after stream invalidation on Android #836

@Johannes0021

Description

@Johannes0021

On Android I noticed that the OutputStream becomes invalid when the audio device changes, for example when Bluetooth headphones are connected. This can be detected via with_error_callback.

When this happens I have to recreate the OutputStream. As a consequence all Sinks tied to that stream must also be recreated.

The problem is that Sinks hold important state like queued Sources, playback order, volume, paused state, and the current playback position inside a track. Recreating Sinks causes all of this state to be lost.

Is there an official or recommended way in rodio to handle this situation?
Should applications keep track of all Sources and Sink state manually and reapply everything to newly created Sinks?

The goal is to continue playback seamlessly after the OutputStream is rebuilt, without breaking behavior or restarting audio.

Is there a recommended way to handle this use case?

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