Skip to main content
←API Reference ←NSDK

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​

NameTypeSummary
cachedPlaybacks[CachedPlayback]
Every scan in the cache with its state: each entry on the device, and each scan this
session is opening that has no entry yet. In unspecified order. A snapshot from one
directory listing and no network call, from any thread.
clearCachevoid
Deletes every cached scan recording. The cache does not track datasets it has returned:
close every dataset opened from a scan first.
deleteCachedvoid
Deletes a scan's cached recording. The cache does not track datasets it has returned:
close every dataset opened from the scan first.
isCachedBool
Whether a scan's recording is fully downloaded and extracted in the cache; false while it is
still downloading, and for a malformed scanId. Two file-system checks and no network
call, from any thread.
openPlaybackDataset
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 the
first chunk of a chunked recording plays. Cancelling the calling Task cancels the
download. The dataset does not loop.
playbackFileInfoPlaybackFileInfo
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