Skip to main content

## player_recover_stream

# Function player_recover_stream

Source

    pub async fn player_recover_stream(
        player: State<'_, PlayerStateWrapper>,
    ) -> Result<bool, String>

Expand description

Try to recover playback after a recoverable player error, reporting whether it was handled.

The frontend’s error handler stops the player, which is right for a real failure and wrong for a network blip — it turned every hiccup into “playback died”. This is the echo path for backends that cannot decide in-process: MpvBackend is constructed before `PlayerController` exists ([`lib.rs`]), so its event thread has no controller to ask. It emits the error, the frontend echoes it here, and the decision stays in Rust — the same shape as `PlaybackEnded` → `player_on_playback_ended`.

Returns `true` when the stream was re-opened and the caller must NOT stop the player; `false` when the error is real and should be surfaced as before. Android decides inside its JNI callback and only emits errors it has already declined to recover, so this reports `false` for those without a second opinion — the shared attempt budget is spent by then either way.

TRACES: UR-004, UR-040 | DR-130 | UT-117