@UnstableApi
public interface Chapter extends 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

public class Chapter.Builder

Builder for Chapter instances.

Public methods

abstract long

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

abstract long

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

abstract @Nullable Label

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

abstract boolean

Returns whether the chapter is hidden.

Inherited methods

From androidx.media3.common.Metadata.Entry
default @Nullable byte[]

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

default @Nullable 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.

default void

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

Public methods

getEndTimeMs

abstract long getEndTimeMs()

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

getStartTimeMs

abstract long getStartTimeMs()

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

getTitle

abstract @Nullable Label getTitle()

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

isHidden

abstract boolean isHidden()

Returns whether the chapter is hidden.

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