From ccded28468cfd4fb1592bd21e10f1562cfb551df Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 12 Nov 2022 03:05:56 +0100 Subject: [PATCH] Improve bookmarks loading --- Model/Player/Backends/AVPlayerBackend.swift | 9 ++------- Model/Player/Backends/MPVBackend.swift | 8 ++------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Model/Player/Backends/AVPlayerBackend.swift b/Model/Player/Backends/AVPlayerBackend.swift index e0934aba..88af160d 100644 --- a/Model/Player/Backends/AVPlayerBackend.swift +++ b/Model/Player/Backends/AVPlayerBackend.swift @@ -130,13 +130,8 @@ final class AVPlayerBackend: PlayerBackend { if var url = stream.singleAssetURL { model.logger.info("playing stream with one asset\(stream.kind == .hls ? " (HLS)" : ""): \(url)") - if video.isLocal, video.localStreamIsFile, let localURL = video.localStream?.localURL { - guard localURL.startAccessingSecurityScopedResource() else { - model.navigation.presentAlert(title: "Could not open file") - model.closeCurrentItem() - return - } - url = localURL + if video.isLocal, video.localStreamIsFile { + _ = url.startAccessingSecurityScopedResource() } loadSingleAsset(url, stream: stream, of: video, preservingTime: preservingTime) diff --git a/Model/Player/Backends/MPVBackend.swift b/Model/Player/Backends/MPVBackend.swift index 9c0ea133..bb48dee3 100644 --- a/Model/Player/Backends/MPVBackend.swift +++ b/Model/Player/Backends/MPVBackend.swift @@ -290,12 +290,8 @@ final class MPVBackend: PlayerBackend { startPlaying() } - if video.isLocal, video.localStreamIsFile, let localStream = video.localStream { - guard localStream.localURL.startAccessingSecurityScopedResource() else { - self.model.navigation.presentAlert(title: "Could not open file") - self.model.closeCurrentItem() - return - } + if video.isLocal, video.localStreamIsFile { + _ = url.startAccessingSecurityScopedResource() } self.client.loadFile(url, sub: captions?.url, time: time, forceSeekable: stream.kind == .hls) { [weak self] _ in