mirror of
https://github.com/yattee/yattee.git
synced 2024-12-14 14:20:32 +05:30
Improve EOF handling with MPV
This commit is contained in:
parent
aeb7bac886
commit
cb81a687bc
@ -470,7 +470,19 @@ final class MPVBackend: PlayerBackend {
|
|||||||
isSeeking = true
|
isSeeking = true
|
||||||
|
|
||||||
case MPV_EVENT_END_FILE:
|
case MPV_EVENT_END_FILE:
|
||||||
DispatchQueue.main.async { [weak self] in self?.handleEndOfFile() }
|
let reason = event!.pointee.data.load(as: mpv_end_file_reason.self)
|
||||||
|
|
||||||
|
if reason != MPV_END_FILE_REASON_STOP {
|
||||||
|
DispatchQueue.main.async { [weak self] in
|
||||||
|
guard let self else { return }
|
||||||
|
NavigationModel.shared.presentAlert(title: "Error while opening file")
|
||||||
|
self.model.closeCurrentItem(finished: true)
|
||||||
|
self.getTimeUpdates()
|
||||||
|
self.eofPlaybackModeAction()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DispatchQueue.main.async { [weak self] in self?.handleEndOfFile() }
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.info(.init(stringLiteral: "UNHANDLED event: \(String(cString: mpv_event_name(event.pointee.event_id)))"))
|
logger.info(.init(stringLiteral: "UNHANDLED event: \(String(cString: mpv_event_name(event.pointee.event_id)))"))
|
||||||
|
Loading…
Reference in New Issue
Block a user