# PlaybackCacheSession Source: https://www.nianticspatial.com/docs/api/kotlin/com.nianticspatial.nsdk.playback.PlaybackCacheSession/ PlaybackCacheSession > extends SessionBase --- ## Declaration class PlaybackCacheSession ## Summary Opens scan recordings from the Niantic Spatial portal through one [com.nianticspatial.nsdk.NSDKSession], caching them on the device. The NSDK session creates it on its creating thread and holds one acquisition, so it is ready at `nsdkSession.playbackCache` from any thread. Closing the NSDK session ends it: an open in flight then fails, and every later call fails, with [PlaybackOpenError.SESSION_ENDED]. Thread-safe. Two locks guard the native calls: this session's own monitor, which [close] and [destroy] take, ends the cache cleanly; [NativeHandle]'s read lock keeps the NSDK instance alive underneath, so a call after the NSDK session is closed, even an [acquire], receives a null handle rather than a freed one. --- ## Functions | Name | Type | Summary | | --- | --- | --- | | cachedPlaybacks | List | Every scan in the cache with its state: each entry on the device, and each scan this sessionis opening that has no entry yet. In unspecified order. A snapshot from one directory listingand 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 | Boolean | 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 network call,from any thread. | | onDestroy | void | - | | onInit | void | - | | open | PlaybackDataset | Opens a scan's recording, downloading it into the cache unless it is already there.Create and authorize the NSDK session first. A cached scan needs no network. Only the firstchunk of a chunked recording plays. Cancelling the calling coroutine cancels the download.The dataset does not loop. | | playbackFileInfo | PlaybackFileInfo | Looks up the recording [open] would play for a scan: its frame count, size and duration asthe portal lists them, before anything is downloaded.Lists the scan's files on the portal and downloads nothing, so it needs the network and anauthorized NSDK session even for a cached scan; keep the result to show it offline.Describes only the first chunk of a chunked recording, the one that plays. Any number mayrun at once, so a list can look up each row as it appears. Cancelling the calling coroutinetakes effect once the lookup ends. | ---