@UnstableApi
interface Chapter : Metadata.Entry

Known direct subclasses
ChapterFrame

Chapter information ID3 frame.


Chapter information, for example ID3 CHAP or Quicktime chap data.

The start and end times are an offset from the start of the current Timeline.Period. To use these times with seekTo, they must be converted to be relative to the window by subtracting the window offset.

Example conversion:

long windowOffsetMs = player.getCurrentTimeline().getWindow(player.getCurrentMediaItemIndex(), new Timeline.Window()).positionInFirstPeriodUs / 1000;
long seekPositionMs = chapter.getStartTimeMs() - windowOffsetMs;
player.seekTo(seekPositionMs);

Summary

Nested types

Builder for Chapter instances.

Public functions

Long

Returns the end time of the chapter in milliseconds, or TIME_UNSET if unknown.

Long

Returns the start time of the chapter in milliseconds, or TIME_UNSET if unknown.

Label?

Returns the title of the chapter, or null if it has no title.

Boolean

Returns whether the chapter is hidden.

Inherited functions

From androidx.media3.common.Metadata.Entry
ByteArray<Byte>?

Returns the bytes of the wrapped metadata in this Entry, or null if it doesn't contain wrapped metadata.

Format?

Returns the Format that can be used to decode the wrapped metadata in getWrappedMetadataBytes, or null if this Entry doesn't contain wrapped metadata.

Unit

Updates the MediaMetadata.Builder with the type-specific values stored in this Entry.

Public functions

getEndTimeMs

fun getEndTimeMs(): Long

Returns the end time of the chapter in milliseconds, or TIME_UNSET if unknown.

getStartTimeMs

fun getStartTimeMs(): Long

Returns the start time of the chapter in milliseconds, or TIME_UNSET if unknown.

getTitle

fun getTitle(): Label?

Returns the title of the chapter, or null if it has no title.

isHidden

fun isHidden(): Boolean

Returns whether the chapter is hidden.

A hidden chapter should not be shown in a table of contents UI, but should not affect playback.