# Subtitle

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/text/Subtitle.java+class:androidx.media3.extractor.text.Subtitle)

*** ** * ** ***


```
@UnstableApi
public interface Subtitle
```

<br />

Known direct subclasses [SubtitleOutputBuffer](https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleOutputBuffer)

|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleOutputBuffer` | Base class for `https://developer.android.com/reference/androidx/media3/extractor/text/SubtitleDecoder` output buffers. |

*** ** * ** ***

A subtitle consisting of timed `https://developer.android.com/reference/androidx/media3/common/text/Cue`s.

## Summary

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/text/Cue>` | `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle#getCues(long)(long timeUs)` Retrieve the cues that should be displayed at a given time. |
| `abstract long` | `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle#getEventTime(int)(int index)` Returns the event time at a specified index. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle#getEventTimeCount()()` Returns the number of event times, where events are defined as points in time at which the cues returned by `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle#getCues(long)` changes. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle#getNextEventTimeIndex(long)(long timeUs)` Returns the index of the first event that occurs after a given time (exclusive). |

## Public methods

### getCues

```
abstract List<Cue> getCues(long timeUs)
```

Retrieve the cues that should be displayed at a given time.

| Parameters |
|---|---|
| `long timeUs` | The time in microseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/text/Cue>` | A list of cues that should be displayed, possibly empty. |

### getEventTime

```
abstract long getEventTime(int index)
```

Returns the event time at a specified index.

| Parameters |
|---|---|
| `int index` | The index of the event time to obtain. |

| Returns |
|---|---|
| `long` | The event time in microseconds. |

### getEventTimeCount

```
abstract int getEventTimeCount()
```

Returns the number of event times, where events are defined as points in time at which the cues returned by `https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle#getCues(long)` changes.

| Returns |
|---|---|
| `int` | The number of event times. |

### getNextEventTimeIndex

```
abstract int getNextEventTimeIndex(long timeUs)
```

Returns the index of the first event that occurs after a given time (exclusive).

| Parameters |
|---|---|
| `long timeUs` | The time in microseconds. |

| Returns |
|---|---|
| `int` | The index of the next event, or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if there are no events after the specified time. |