MediaItem.SubtitleConfiguration.Builder
public final class MediaItem.SubtitleConfiguration.Builder
Builder for SubtitleConfiguration instances.
Summary
Public constructors
Public methods
build
public MediaItem.SubtitleConfiguration build()
Creates a SubtitleConfiguration from the values of this builder.
setId
@CanIgnoreReturnValue
public MediaItem.SubtitleConfiguration.Builder setId(@Nullable String id)
Sets the optional ID for this subtitle track.
setLabel
@CanIgnoreReturnValue
public MediaItem.SubtitleConfiguration.Builder setLabel(@Nullable String label)
Sets the optional label for this subtitle track.
setLanguage
@CanIgnoreReturnValue
public MediaItem.SubtitleConfiguration.Builder setLanguage(@Nullable String language)
Sets the optional language of the subtitle file.
setMimeType
@CanIgnoreReturnValue
public MediaItem.SubtitleConfiguration.Builder setMimeType(@Nullable String mimeType)
Sets the MIME type.
setRoleFlags
@CanIgnoreReturnValue
public MediaItem.SubtitleConfiguration.Builder setRoleFlags(@C.RoleFlags int roleFlags)
Sets the role flags. These are used for track selection.
setSelectionFlags
@CanIgnoreReturnValue
public MediaItem.SubtitleConfiguration.Builder setSelectionFlags(@C.SelectionFlags int selectionFlags)
Sets the flags used for track selection.
setTimeOffsetUs
@CanIgnoreReturnValue
@UnstableApi
public MediaItem.SubtitleConfiguration.Builder setTimeOffsetUs(long timeOffsetUs)
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
public MediaItem.SubtitleConfiguration.Builder setUri(Uri uri)
Sets the Uri to the subtitle file.