Thumbnails

object Thumbnails

Seek previews and library grids: images at positions, scaled and encoded in one call.

Functions

Link copied to clipboard
suspend fun at(item: MediaItem, positions: List<Duration>, maxWidth: Int = 320, format: SnapshotFormat = SnapshotFormat.Jpeg): List<Thumbnail>

One image per position, scaled to at most maxWidth wide with the aspect kept, encoded in format. Opens the item once and closes it before returning. Positions are keyframe-snapped the way frame extraction works: the frame at or first after the position, fast rather than exact. A hardware-decoded frame is downloaded first; the scale runs once per call on a graph built from the first frame's geometry. The work runs off the caller's thread, and a cancel takes effect between two positions.