Close item if could not be opened

This commit is contained in:
Arkadiusz Fal 2022-11-12 01:40:55 +01:00
parent ebc9ea0031
commit 2c004b81fe
2 changed files with 2 additions and 0 deletions

View File

@ -133,6 +133,7 @@ final class AVPlayerBackend: PlayerBackend {
if video.isLocal, video.localStreamIsFile, let localURL = video.localStream?.localURL { if video.isLocal, video.localStreamIsFile, let localURL = video.localStream?.localURL {
guard localURL.startAccessingSecurityScopedResource() else { guard localURL.startAccessingSecurityScopedResource() else {
model.navigation.presentAlert(title: "Could not open file") model.navigation.presentAlert(title: "Could not open file")
model.closeCurrentItem()
return return
} }
url = localURL url = localURL

View File

@ -293,6 +293,7 @@ final class MPVBackend: PlayerBackend {
if video.isLocal, video.localStreamIsFile, let localStream = video.localStream { if video.isLocal, video.localStreamIsFile, let localStream = video.localStream {
guard localStream.localURL.startAccessingSecurityScopedResource() else { guard localStream.localURL.startAccessingSecurityScopedResource() else {
self.model.navigation.presentAlert(title: "Could not open file") self.model.navigation.presentAlert(title: "Could not open file")
self.model.closeCurrentItem()
return return
} }
} }