fetchLocator

abstract fun fetchLocator(timelinePosition: Int, onSuccess: (SimpleLocatorData) -> Unit, onError: (ColibrioException) -> Unit)

Fetches a locator that most closely matches the specified timelinePosition.

By passing 0, you fetch the locator matching the start of the timeline. By passing the value returned by ContentPositionTimeline.length, you fetch the locator matching the end of the timeline.

For example, if the timeline has WORDS as unit of measurement, calling fetchLocator(20) will fetch the locator pointing to the start of the 21st word in the publication.

Parameters

timelinePosition

An integer value that will be clamped between 0 and the timeline length.

onSuccess

Called with the locator that most closely matches the specified timelinePosition

onError

Called if an error occurs when the operation is performed.


abstract suspend fun fetchLocator(timelinePosition: Int): ColibrioResult<SimpleLocatorData>

Fetches a locator that most closely matches the specified timelinePosition.

By passing 0, you fetch the locator matching the start of the timeline. By passing the value returned by ContentPositionTimeline.length, you fetch the locator matching the end of the timeline.

For example, if the timeline has WORDS as unit of measurement, calling fetchLocator(20) will fetch the locator pointing to the start of the 21st word in the publication.

Return

Either ColibrioResult.Success containing the locator that most closely matches the specified timelinePosition, or ColibrioResult.Error containing the error.

Parameters

timelinePosition

An integer value that will be clamped between 0 and the timeline length.