MediaItemBuilder

Builds a MediaItem one setting at a time. Each call has the name of the field it sets, every call is optional, and each returns this builder.

Kotlin builds an item in the block of mediaItem. Java cannot call the MediaItem constructor, because a parameter of the type Duration hides it, so it makes a builder, chains its calls and ends with build (#394):

MediaItem item = new MediaItemBuilder("https://example.com/movie.mp4")
.title("Movie")
.startPositionMillis(90_000)
.build();

Constructors

Link copied to clipboard
constructor(uri: String)

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The item these settings describe, checked as its constructor checks it.

Link copied to clipboard
fun clip(start: Duration, end: Duration? = null): MediaItemBuilder

See MediaItem.clip. A null end runs to the end of the file.

Link copied to clipboard
fun clipMillis(startMillis: Long, endMillis: Long? = null): MediaItemBuilder

MediaItem.clip in milliseconds, for Java, which cannot make a Duration. A null endMillis runs to the end of the file.

Link copied to clipboard

Replaces the whole of MediaItem.demux. probe, corruptPackets, generateTimestamps, lowLatency and skipInitialBytes change one field of it each.

Link copied to clipboard

Adds a subtitle file. See SubtitleSource.

Link copied to clipboard

Adds subtitle files. See SubtitleSource.

Link copied to clipboard

See MediaItem.formatHint. Null leaves the format to the probe.

Link copied to clipboard
fun header(name: String, value: String): MediaItemBuilder

Adds one request header. See MediaItem.headers.

Link copied to clipboard
fun headers(vararg pairs: Pair<String, String>): MediaItemBuilder

Adds request headers. See MediaItem.headers.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Adds one raw demuxer option. See MediaItem.openOptions.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

MediaItem.startPosition in milliseconds, for Java, which cannot make a Duration.

Link copied to clipboard

A WebVTT thumbnail file for a seek bar's preview. See MediaItem.thumbnails.

Link copied to clipboard
Link copied to clipboard