Class AudioStream.Builder
- Enclosing class:
- AudioStream
AudioStream objects.-
Constructor Summary
ConstructorsConstructorDescriptionBuilder()Create a newAudioStream.Builderinstance with its default values. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build anAudioStreamusing the builder's current values.setAudioLocale(Locale audioLocale) Set theLocaleof the audio which represents its language.setAudioTrackId(String audioTrackId) Set the audio track id of theAudioStream.setAudioTrackName(String audioTrackName) Set the audio track name of theAudioStream.setAudioTrackType(AudioTrackType audioTrackType) Set theAudioTrackTypeof theAudioStream.setAverageBitrate(int averageBitrate) Set the average bitrate of theAudioStream.setContent(String content, boolean isUrl) Set the content or the URL of theAudioStream, depending on whether isUrl is truesetDeliveryMethod(DeliveryMethod deliveryMethod) Set theDeliveryMethodof theAudioStream.Set the identifier of theAudioStreamwhich uniquely identifies the stream, e.g.setItagItem(ItagItem itagItem) Set theItagItemcorresponding to theAudioStream.setManifestUrl(String manifestUrl) Sets the URL of the manifest this stream comes from (if applicable, otherwise null).setMediaFormat(MediaFormat mediaFormat) Set theMediaFormatused by theAudioStream, which can be null
-
Constructor Details
-
Builder
public Builder()Create a newAudioStream.Builderinstance with its default values.
-
-
Method Details
-
setId
Set the identifier of theAudioStreamwhich uniquely identifies the stream, e.g. for YouTube this would be the itagIt must not be null and should be non empty.
If you are not able to get an identifier, use the static constant
ID_UNKNOWNof theStreamclass.- Parameters:
id- the identifier of theAudioStream, which must not be null- Returns:
- this
AudioStream.Builderinstance
-
setContent
Set the content or the URL of theAudioStream, depending on whether isUrl is trueIt must not be null, and should be non empty.
- Parameters:
content- the content of theAudioStreamisUrl- whether content is the URL or the actual content of e.g. a DASH manifest- Returns:
- this
AudioStream.Builderinstance
-
setMediaFormat
Set theMediaFormatused by theAudioStream, which can be nullIt should be one of the audio
MediaFormats (M4A,WEBMA,MP3,OPUS,OGG, orWEBMA_OPUS) but can benullif the media format could not be determined.The default value is
null.- Parameters:
mediaFormat- theMediaFormatof theAudioStream, which can be null- Returns:
- this
AudioStream.Builderinstance
-
setDeliveryMethod
Set theDeliveryMethodof theAudioStream.It must not be null.
The default delivery method is
DeliveryMethod.PROGRESSIVE_HTTP.- Parameters:
deliveryMethod- theDeliveryMethodof theAudioStream, which must not be null- Returns:
- this
AudioStream.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
AudioStream.Builderinstance
-
setAverageBitrate
Set the average bitrate of theAudioStream.The default value is
AudioStream.UNKNOWN_BITRATE.- Parameters:
averageBitrate- the average bitrate of theAudioStream, which should positive- Returns:
- this
AudioStream.Builderinstance
-
setAudioTrackId
Set the audio track id of theAudioStream.The default value is
null.- Parameters:
audioTrackId- the audio track id of theAudioStream, which can be null- Returns:
- this
AudioStream.Builderinstance
-
setAudioTrackName
Set the audio track name of theAudioStream.The default value is
null.- Parameters:
audioTrackName- the audio track name of theAudioStream, which can be null- Returns:
- this
AudioStream.Builderinstance
-
setAudioTrackType
- Parameters:
audioTrackType- the audio track type of theAudioStream, which can be null- Returns:
- this
AudioStream.Builderinstance
-
setAudioLocale
Set theLocaleof the audio which represents its language.The default value is
null, which means that theLocaleis unknown.- Parameters:
audioLocale- theLocaleof the audio, which could benull- Returns:
- this
AudioStream.Builderinstance
-
setItagItem
Set theItagItemcorresponding to theAudioStream.ItagItems are YouTube specific objects, so they are only known for this service and can be null.The default value is
null.- Parameters:
itagItem- theItagItemof theAudioStream, which can be null- Returns:
- this
AudioStream.Builderinstance
-
build
Build anAudioStreamusing the builder's current values.The identifier and the content (and thus
isUrl) properties must have been set.- Returns:
- a new
AudioStreamusing the builder's current values - Throws:
IllegalStateException- ifid,content(and thusisUrl) ordeliveryMethodhave been not set, or have been set asnull
-