Class SubtitlesStream.Builder
- Enclosing class:
- SubtitlesStream
SubtitlesStream objects.-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Create a newSubtitlesStream.Builderinstance with default values. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build aSubtitlesStreamusing the builder's current values.setAutoGenerated(boolean autoGenerated) Set whether the subtitles have been auto-generated by the streaming service.setContent(String content, boolean isUrl) Set the content of theSubtitlesStream.setDeliveryMethod(DeliveryMethod deliveryMethod) Set theDeliveryMethodof theSubtitlesStream.Set the identifier of theSubtitlesStream.setLanguageCode(String languageCode) Set the language code of theSubtitlesStream.setManifestUrl(String manifestUrl) Sets the URL of the manifest this stream comes from (if applicable, otherwise null).setMediaFormat(MediaFormat mediaFormat) Set theMediaFormatused by theSubtitlesStream.Set the display name of theSubtitlesStreamas provided by the streaming service.
-
Constructor Details
-
Builder
public Builder()Create a newSubtitlesStream.Builderinstance with default values.
-
-
Method Details
-
setId
Set the identifier of theSubtitlesStream.- Parameters:
id- the identifier of theSubtitlesStream, which should not be null (otherwise the fallback to create the identifier will be used when building the builder)- Returns:
- this
SubtitlesStream.Builderinstance
-
setContent
Set the content of theSubtitlesStream.It must not be null, and should be non empty.
- Parameters:
content- the content of theSubtitlesStream, which must not be nullisUrl- whether the content is a URL- Returns:
- this
SubtitlesStream.Builderinstance
-
setMediaFormat
Set theMediaFormatused by theSubtitlesStream.It should be one of the subtitles
MediaFormats (SRT,TRANSCRIPT1,TRANSCRIPT2,TRANSCRIPT3,TTML, orVTT) but can benullif the media format could not be determined.The default value is
null.- Parameters:
mediaFormat- theMediaFormatof theSubtitlesStream, which can be null- Returns:
- this
SubtitlesStream.Builderinstance
-
setDeliveryMethod
Set theDeliveryMethodof theSubtitlesStream.It must not be null.
The default delivery method is
DeliveryMethod.PROGRESSIVE_HTTP.- Parameters:
deliveryMethod- theDeliveryMethodof theSubtitlesStream, which must not be null- Returns:
- this
SubtitlesStream.Builderinstance
-
setManifestUrl
Sets the URL of the manifest this stream comes from (if applicable, otherwise null).- Parameters:
manifestUrl- the URL of the manifest this stream comes from ornull- Returns:
- this
SubtitlesStream.Builderinstance
-
setLanguageCode
Set the language code of theSubtitlesStream.It must not be null and should not be an empty string.
- Parameters:
languageCode- the language code of theSubtitlesStream- Returns:
- this
SubtitlesStream.Builderinstance
-
setName
Set the display name of theSubtitlesStreamas provided by the streaming service.Some services (e.g. YouTube) ship a user-facing track label alongside the language code, which is useful when a video has multiple tracks that share the same language code (e.g. two "en" tracks with different track names). When present, consumers should prefer this over the locale-derived display name so the two tracks can be told apart in a picker.
May be
nullif the service does not expose a track name.- Parameters:
name- the display name of the stream, ornull- Returns:
- this
SubtitlesStream.Builderinstance
-
setAutoGenerated
Set whether the subtitles have been auto-generated by the streaming service.- Parameters:
autoGenerated- whether the subtitles have been generated by the streaming service- Returns:
- this
SubtitlesStream.Builderinstance
-
build
Build aSubtitlesStreamusing the builder's current values.The content (and so the
isUrlboolean), the language code and theisAutoGeneratedproperties must have been set.If no identifier has been set, an identifier will be generated using the language code and the media format suffix, if the media format is known.
- Returns:
- a new
SubtitlesStreamusing the builder's current values - Throws:
IllegalStateException- ifid,content(and soisUrl),deliveryMethod,languageCodeor theisAutogeneratedhave been not set, or have been set asnullParsingException
-