# NSDKPlaybackCacheSession Source: https://www.nianticspatial.com/docs/api/swift/NSDK.class-NSDKPlaybackCacheSession/ NSDKPlaybackCacheSession --- ## Declaration final class NSDKPlaybackCacheSession ## Summary Opens scan recordings from the Niantic Spatial portal through one `NSDKSession`, caching them on the device. Acquire it with `NSDKSession.acquirePlaybackCacheSession()`. Thread-safe. Once its `NSDKSession` is released or it is destroyed, every call fails with `PlaybackOpenError.sessionEnded`. --- ## Methods | Name | Type | Summary | | --- | --- | --- | | cachedPlaybacks | [CachedPlayback] | Every scan in the cache with its state: each entry on the device, and each scan thissession is opening that has no entry yet. In unspecified order. A snapshot from onedirectory listing and no network call, from any thread. | | clearCache | void | Deletes every cached scan recording. The cache does not track datasets it has returned:close every dataset opened from a scan first. | | deleteCached | void | Deletes a scan's cached recording. The cache does not track datasets it has returned:close every dataset opened from the scan first. | | isCached | Bool | Whether a scan's recording is fully downloaded and extracted in the cache; false while it isstill downloading, and for a malformed `scanId`. Two file-system checks and no networkcall, from any thread. | | open | PlaybackDataset | Opens a scan's recording, downloading it into the cache unless it is already there.Create and authorize the `NSDKSession` first. A cached scan needs no network. Only thefirst chunk of a chunked recording plays. Cancelling the calling `Task` cancels thedownload. The dataset does not loop. | | playbackFileInfo | PlaybackFileInfo | Looks up the recording `open(scanId:onProgress:)` would play for a scan: its frame count,size and duration as the portal lists them, before anything is downloaded. | --- ## Relationships conforms to: Swift.Sendable conforms to: Swift.SendableMetatype