inspect

suspend fun inspect(media: MediaItem): MediaInspection

Reads what open would publish about media, and plays nothing.

For a library screen that wants the length, the tracks and the chapters of a great many files. It touches nothing this player already has open: the session it makes to read the container is closed before this returns, so calling it while something is playing is safe.

It reads the container, so it costs what reaching and parsing a header costs. That is far less than an open, and it is not free. It reaches the media as open does, through the same reader resolution, and the reading runs off the caller's thread. An item with a MediaItem.clip reports the clip's length and chapters, as open does.

Throws

when the media cannot be reached or is not media.