Skip to main content
←API Reference ←com.nianticspatial.nsdk.playback ←PlaybackDataset

loadFrom

Loads a dataset from [source]: reads capture JSON, decodes it in one pass with [kotlinx.serialization], and returns a [PlaybackDataset] that uses [source] for on-demand frame loading.

Declaration​

@Deprecated( "Will be removed in a future release. Use PlaybackDataset.open(), which reads the dataset " + "through native playback.", level = DeprecationLevel.WARNING ) @Suppress("DEPRECATION") @JvmStatic @JvmOverloads fun loadFrom( source: PlaybackDatasetSource, imageDecoder: (ByteArray) -> Bitmap? = { bytes -> BitmapFactory.decodeByteArray(bytes, 0, bytes.size) } ): PlaybackDataset?

Summary​

Loads a dataset from source: reads capture JSON, decodes it in one pass with kotlinx.serialization, and returns a PlaybackDataset that uses source for on-demand frame loading.

Returns​

The dataset, or null if JSON is missing or invalid.

Parameters​

NameTypeSummary
sourcePlaybackDatasetSource
-
imageDecoder(ByteArray) -> Bitmap?
Decodes image bytes to [Bitmap]; default uses [BitmapFactory]. In unit tests pass { null } to avoid "BitmapFactory not mocked".