Class VideoStream.Builder
- java.lang.Object
-
- org.schabi.newpipe.extractor.stream.VideoStream.Builder
-
- Enclosing class:
- VideoStream
public static final class VideoStream.Builder extends java.lang.ObjectClass to buildVideoStreamobjects.
-
-
Constructor Summary
Constructors Constructor Description Builder()Create a newVideoStream.Builderinstance with its default values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VideoStreambuild()Build aVideoStreamusing the builder's current values.VideoStream.BuildersetContent(java.lang.String content, boolean isUrl)Set the content of theVideoStream.VideoStream.BuildersetDeliveryMethod(DeliveryMethod deliveryMethod)Set theDeliveryMethodof theVideoStream.VideoStream.BuildersetId(java.lang.String id)Set the identifier of theVideoStream.VideoStream.BuildersetIsVideoOnly(boolean isVideoOnly)Set whether theVideoStreamis video-only.VideoStream.BuildersetItagItem(ItagItem itagItem)Set theItagItemcorresponding to theVideoStream.VideoStream.BuildersetManifestUrl(java.lang.String manifestUrl)Sets the URL of the manifest this stream comes from (if applicable, otherwise null).VideoStream.BuildersetMediaFormat(MediaFormat mediaFormat)Set theMediaFormatused by theVideoStream.VideoStream.BuildersetResolution(java.lang.String resolution)Set the resolution of theVideoStream.
-
-
-
Constructor Detail
-
Builder
public Builder()
Create a newVideoStream.Builderinstance with its default values.
-
-
Method Detail
-
setId
public VideoStream.Builder setId(@Nonnull java.lang.String id)
Set the identifier of theVideoStream.It 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 theVideoStream, which must not be null- Returns:
- this
VideoStream.Builderinstance
-
setContent
public VideoStream.Builder setContent(@Nonnull java.lang.String content, boolean isUrl)
Set the content of theVideoStream.It must not be null, and should be non empty.
- Parameters:
content- the content of theVideoStreamisUrl- whether the content is a URL- Returns:
- this
VideoStream.Builderinstance
-
setMediaFormat
public VideoStream.Builder setMediaFormat(@Nullable MediaFormat mediaFormat)
Set theMediaFormatused by theVideoStream.It should be one of the video
MediaFormats (MPEG_4,v3GPP, orWEBM) but can benullif the media format could not be determined.The default value is
null.- Parameters:
mediaFormat- theMediaFormatof theVideoStream, which can be null- Returns:
- this
VideoStream.Builderinstance
-
setDeliveryMethod
public VideoStream.Builder setDeliveryMethod(@Nonnull DeliveryMethod deliveryMethod)
Set theDeliveryMethodof theVideoStream.It must not be null.
The default delivery method is
DeliveryMethod.PROGRESSIVE_HTTP.- Parameters:
deliveryMethod- theDeliveryMethodof theVideoStream, which must not be null- Returns:
- this
VideoStream.Builderinstance
-
setManifestUrl
public VideoStream.Builder setManifestUrl(@Nullable java.lang.String manifestUrl)
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
VideoStream.Builderinstance
-
setIsVideoOnly
public VideoStream.Builder setIsVideoOnly(boolean isVideoOnly)
Set whether theVideoStreamis video-only.This property must be set before building the
VideoStream.- Parameters:
isVideoOnly- whether theVideoStreamis video-only- Returns:
- this
VideoStream.Builderinstance
-
setResolution
public VideoStream.Builder setResolution(@Nonnull java.lang.String resolution)
Set the resolution of theVideoStream.This resolution can be used by clients to know the quality of the video stream.
If you are not able to know the resolution, you should use
VideoStream.RESOLUTION_UNKNOWNas the resolution of the video stream.It must be set before building the builder and not null.
- Parameters:
resolution- the resolution of theVideoStream- Returns:
- this
VideoStream.Builderinstance
-
setItagItem
public VideoStream.Builder setItagItem(@Nullable ItagItem itagItem)
Set theItagItemcorresponding to theVideoStream.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 theVideoStream, which can be null- Returns:
- this
VideoStream.Builderinstance
-
build
@Nonnull public VideoStream build()
Build aVideoStreamusing the builder's current values.The identifier, the content (and so the
isUrlboolean), theisVideoOnlyand theresolutionproperties must have been set.- Returns:
- a new
VideoStreamusing the builder's current values - Throws:
java.lang.IllegalStateException- ifid,content(and soisUrl),deliveryMethod,isVideoOnlyorresolutionhave been not set, or have been set asnull
-
-