MediaItem.SubtitleConfiguration.Builder
class MediaItem.SubtitleConfiguration.Builder
Builder for SubtitleConfiguration instances.
Summary
Public constructors
Public functions
build
fun build(): MediaItem.SubtitleConfiguration!
Creates a SubtitleConfiguration from the values of this builder.
setId
@CanIgnoreReturnValue
fun setId(id: String?): MediaItem.SubtitleConfiguration.Builder!
Sets the optional ID for this subtitle track.
setLabel
@CanIgnoreReturnValue
fun setLabel(label: String?): MediaItem.SubtitleConfiguration.Builder!
Sets the optional label for this subtitle track.
setLanguage
@CanIgnoreReturnValue
fun setLanguage(language: String?): MediaItem.SubtitleConfiguration.Builder!
Sets the optional language of the subtitle file.
setMimeType
@CanIgnoreReturnValue
fun setMimeType(mimeType: String?): MediaItem.SubtitleConfiguration.Builder!
Sets the MIME type.
setRoleFlags
@CanIgnoreReturnValue
fun setRoleFlags(@C.RoleFlags roleFlags: Int): MediaItem.SubtitleConfiguration.Builder!
Sets the role flags. These are used for track selection.
setSelectionFlags
@CanIgnoreReturnValue
fun setSelectionFlags(@C.SelectionFlags selectionFlags: Int): MediaItem.SubtitleConfiguration.Builder!
Sets the flags used for track selection.
setTimeOffsetUs
@CanIgnoreReturnValue
@UnstableApi
fun setTimeOffsetUs(timeOffsetUs: Long): MediaItem.SubtitleConfiguration.Builder!
Sets the offset that is added to the timestamps of the cues in this subtitle track, in microseconds.
A positive value shifts the cues to be displayed later relative to the media, a negative value shifts them to be displayed earlier.
ExoPlayer specific notes:
- The offset can be changed during playback by passing an updated
MediaItemtoPlayer.replaceMediaItem(int, MediaItem). If only the time offsets of theSubtitleConfigurationinstances are changed, playback continues uninterrupted and the new offsets apply to cues that have not been read by the renderer yet. To also apply the new offset to the cues currently on screen, disable and re-enable the text track, for example withTrackSelectionParameters.Builder.setTrackTypeDisabled(C.TRACK_TYPE_TEXT, boolean). - The offset only takes effect if the subtitles are parsed during extraction (the default behavior of
DefaultMediaSourceFactory), and is ignored by the deprecated legacy subtitle decoding path.
The default value is 0.
setUri
@CanIgnoreReturnValue
fun setUri(uri: Uri!): MediaItem.SubtitleConfiguration.Builder!
Sets the Uri to the subtitle file.