fix: handle int end-file reason from mpv on Windows/Linux

This commit is contained in:
edde746
2026-03-03 19:00:32 +01:00
parent 34e8c179fe
commit 1b673743b2
+10 -1
View File
@@ -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);