Skip to main content
←API Reference ←NSDK ←NSDKPlaybackCacheSession

open


Declaration​

func open(scanId: String, onProgress: ((Double) -> Void)? = nil) async throws -> PlaybackDataset

Summary​

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.

Throws​

  • PlaybackOpenError if the open fails, including sessionEnded once the NSDKSession is released; NSDKError.invalidArgument if scanId is malformed; .unknown if the device has no cache directory; .invalidOperation while this session is already opening scanId.

Parameters​

NameTypeSummary
scanIdString
The portal scan ID.
onProgress ((Double) -> Void)?
Called from the opening task with download progress in [0, 1]. Called off
the main actor; hop to the main actor before updating UI.