From 1b673743b23ca8356bd4a3b0a7516f618b84b69a Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Tue, 3 Mar 2026 18:59:26 +0100 Subject: [PATCH] fix: handle int end-file reason from mpv on Windows/Linux --- lib/mpv/player/player_base.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/mpv/player/player_base.dart b/lib/mpv/player/player_base.dart index a7d10d36..ac64b754 100644 --- a/lib/mpv/player/player_base.dart +++ b/lib/mpv/player/player_base.dart @@ -324,7 +324,16 @@ abstract class PlayerBase with PlayerStreamControllersMixin implements Player { if (_disposed) return; switch (name) { case 'end-file': - final reason = data?['reason'] as String?; + final rawReason = data?['reason']; + final reason = switch (rawReason) { + 0 => 'eof', + 2 => 'stop', + 3 => 'quit', + 4 => 'error', + 5 => 'redirect', + String s => s, + _ => null, + }; if (reason == 'eof') { _state = _state.copyWith(completed: true); completedController.add(true);