Skip to main content

Function: classifyEndFile()

function classifyEndFile(
reason: MpvEndFileReason,
errorText: string | undefined,
uri?: string
): EndFileOutcome;

Defined in: packages/player/src/errors.ts:550

Classify an end-file event into a natural end, a deliberate stop, a playlist redirect, or a typed failure.

Parameters

ParameterTypeDescription
reasonMpvEndFileReasonmpv_end_file_reason, as renamed by the native spec (endOfFile rather than eof).
errorTextstring | undefinedmpv_error_string() of mpv_event_end_file.error; populated by native only when reason === 'error'.
uri?stringThe source that was playing, used to separate a network failure from a local one.

Returns

EndFileOutcome

Remarks

mpv documents that "incomplete or broken files" may end with either EOF or ERROR (mpv/client.h, MPV_END_FILE_REASON_ERROR), so a clean endOfFile is always reported as a natural end — guessing otherwise would turn ordinary track completions into spurious errors.