Handle cleared MPV entry during fallback failure
This commit is contained in:
@@ -539,7 +539,10 @@ export class MediaPlayer {
|
||||
if (result?.error !== "success") {
|
||||
if (fallbackEligible) {
|
||||
this.removePendingCandidate(url);
|
||||
if (![...this.entryCandidates.values()].includes(url)) this.fallbackCandidates.delete(url);
|
||||
if (!this.pendingCandidateUrls.includes(url) &&
|
||||
![...this.entryCandidates.values()].includes(url)) {
|
||||
this.fallbackCandidates.delete(url);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -784,6 +787,13 @@ export class MediaPlayer {
|
||||
const file = this.entryCandidates.get(entryId) || response.file ||
|
||||
(entryId === this.activeEntryId ? this.activeUrl : null);
|
||||
if (!file) return;
|
||||
if (this.activeEntryId === null && !this.fallbackSuppressedUntilStart) {
|
||||
// MPV can clear its current entry before delivering end-file. Restore
|
||||
// this event's known entry from its playlist_entry_id for mirroring.
|
||||
this.activeEntryId = entryId;
|
||||
this.activeUrl = file;
|
||||
this.currentFile = file;
|
||||
}
|
||||
const errorMessage = response.file_error || response.error || response["file-error"] || "Unknown playback error";
|
||||
this.playbackErrors.set(file, errorMessage);
|
||||
this.handleEvent(UserEvent.PlaybackError, { filename: file, error: errorMessage });
|
||||
|
||||
Reference in New Issue
Block a user