mirror of
https://github.com/yattee/yattee.git
synced 2026-05-14 03:15:03 +00:00
Fix local folder playback after app container UUID changes
After iOS reinstall/restore the app container UUID rotates, which left both the persisted source.url and the security-scoped bookmark pointing at a no-longer-current path. Files derived a stale absolute path that got appended onto the resolved bookmark, producing doubled URLs that MPV could not load. - Resolve the base URL by picking whichever of the bookmark or source.url actually exists on disk. - Compute MediaFile relative paths against the resolved root so they survive later container changes. - Hold the security-scoped resource access for the source's lifetime via a shared resolver, so MPV can open files long after the directory enumeration that resolved the bookmark has returned. - Normalize legacy absolute paths embedded in old recents/history video IDs so they re-resolve under the current container.
This commit is contained in:
@@ -67,7 +67,14 @@ struct MediaFile: Identifiable, Hashable, Sendable {
|
||||
|
||||
/// Full URL to this file.
|
||||
var url: URL {
|
||||
source.url.appendingPathComponent(path)
|
||||
// For local folders, the persisted `source.url` may point at a stale app
|
||||
// container path after iOS reinstall/restore. Prefer the freshly resolved
|
||||
// bookmark URL stored in `LocalFolderURLResolver` when available.
|
||||
if source.type == .localFolder,
|
||||
let resolved = LocalFolderURLResolver.resolvedURL(for: source.id) {
|
||||
return resolved.appendingPathComponent(path)
|
||||
}
|
||||
return source.url.appendingPathComponent(path)
|
||||
}
|
||||
|
||||
/// File extension (lowercase).
|
||||
|
||||
Reference in New Issue
Block a user