# Subtitle

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/extractor/text/Subtitle "View this page in Java")

<br />

```
@UnstableApi
interface Subtitle
```

<br />

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

|----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| [SubtitleOutputBuffer](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleOutputBuffer) | Base class for[SubtitleDecoder](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleDecoder)output buffers. |

*** ** * ** ***

A subtitle consisting of timed[Cue](https://developer.android.com/reference/kotlin/androidx/media3/common/text/Cue)s.

## Summary

|                                                                                                                                       ### Public functions                                                                                                                                       |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cue](https://developer.android.com/reference/kotlin/androidx/media3/common/text/Cue)`!>!` | [getCues](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle#getCues(long))`(timeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Retrieve the cues that should be displayed at a given time.                                                                                                 |
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                                                                                                                                                                                                    | [getEventTime](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle#getEventTime(int))`(index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns the event time at a specified index.                                                                                                          |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                      | [getEventTimeCount](https://developer.android.com/reference/kotlin/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[getCues](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle#getCues(long))changes. |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                      | [getNextEventTimeIndex](https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/Subtitle#getNextEventTimeIndex(long))`(timeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Returns the index of the first event that occurs after a given time (exclusive).                                                |

## Public functions

### getCues

```
fun getCues(timeUs: Long): (Mutable)List<Cue!>!
```

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

|                                       Parameters                                        |
|-----------------------------------------------------------------------------------------|---------------------------|
| `timeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The time in microseconds. |

|                                                                                                                                             Returns                                                                                                                                              |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cue](https://developer.android.com/reference/kotlin/androidx/media3/common/text/Cue)`!>!` | A list of cues that should be displayed, possibly empty. |

### getEventTime

```
fun getEventTime(index: Int): Long
```

Returns the event time at a specified index.  

|                                      Parameters                                      |
|--------------------------------------------------------------------------------------|----------------------------------------|
| `index: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The index of the event time to obtain. |

|                                    Returns                                    |
|-------------------------------------------------------------------------------|---------------------------------|
| [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The event time in microseconds. |

### getEventTimeCount

```
fun getEventTimeCount(): Int
```

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

|                                   Returns                                   |
|-----------------------------------------------------------------------------|----------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The number of event times. |

### getNextEventTimeIndex

```
fun getNextEventTimeIndex(timeUs: Long): Int
```

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

|                                       Parameters                                        |
|-----------------------------------------------------------------------------------------|---------------------------|
| `timeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The time in microseconds. |

|                                   Returns                                   |
|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The index of the next event, or[INDEX_UNSET](https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET())if there are no events after the specified time. |