# Chapter

Artifact: [androidx.media3:media3-extractor](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/extractor/metadata/Chapter.java+class:androidx.media3.extractor.metadata.Chapter)

*** ** * ** ***

<br />

```
@UnstableApi
public interface Chapter extends Metadata.Entry
```

<br />

Known direct subclasses [ChapterFrame](https://developer.android.com/reference/androidx/media3/extractor/metadata/id3/ChapterFrame)

|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/metadata/id3/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 `https://developer.android.com/reference/androidx/media3/common/Timeline.Period`. To use these times with `https://developer.android.com/reference/androidx/media3/common/Player#seekTo(long)`, 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 https://developer.android.com/reference/androidx/media3/extractor/metadata/Chapter.Builder` Builder for `https://developer.android.com/reference/androidx/media3/extractor/metadata/Chapter` instances. |

| ### Public methods |
|---|---|
| `abstract long` | `https://developer.android.com/reference/androidx/media3/extractor/metadata/Chapter#getEndTimeMs()()` Returns the end time of the chapter in milliseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/extractor/metadata/Chapter#getStartTimeMs()()` Returns the start time of the chapter in milliseconds, or `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown. |
| `abstract @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/Label` | `https://developer.android.com/reference/androidx/media3/extractor/metadata/Chapter#getTitle()()` Returns the title of the chapter, or `null` if it has no title. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/extractor/metadata/Chapter#isHidden()()` Returns whether the chapter is hidden. |

### Inherited methods

From [androidx.media3.common.Metadata.Entry](https://developer.android.com/reference/androidx/media3/common/Metadata.Entry) `default @https://developer.android.com/reference/androidx/annotation/Nullable byte[]` `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry#getWrappedMetadataBytes()()`

Returns the bytes of the wrapped metadata in this Entry, or null if it doesn't contain wrapped metadata.
`default @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/Format` `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry#getWrappedMetadataFormat()()`

Returns the `https://developer.android.com/reference/androidx/media3/common/Format` that can be used to decode the wrapped metadata in `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry#getWrappedMetadataBytes()`, or null if this Entry doesn't contain wrapped metadata.
`default void` `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry#populateMediaMetadata(androidx.media3.common.MediaMetadata.Builder)(https://developer.android.com/reference/androidx/media3/common/MediaMetadata.Builder builder)`

Updates the `https://developer.android.com/reference/androidx/media3/common/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 `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` if unknown.

### getStartTimeMs

```
abstract long getStartTimeMs()
```

Returns the start time of the chapter in milliseconds, or `https://developer.android.com/reference/androidx/media3/common/C#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.