public final class

UriMediaItem.Builder

extends MediaItem.BuilderBase<UriMediaItem.Builder>

 java.lang.Object

androidx.media2.MediaItem.BuilderBase<UriMediaItem.Builder>

↳androidx.media2.UriMediaItem.Builder

Overview

This Builder class simplifies the creation of a UriMediaItem object.

Summary

Constructors
publicBuilder(Context context, Uri uri)

Creates a new Builder object with a content Uri.

publicBuilder(Context context, Uri uri, java.util.Map<java.lang.String, java.lang.String> headers, java.util.List<java.net.HttpCookie> cookies)

Creates a new Builder object with a content Uri.

Methods
public UriMediaItembuild()

from MediaItem.BuilderBase<T>setEndPosition, setMetadata, setStartPosition
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(Context context, Uri uri)

Creates a new Builder object with a content Uri.

Parameters:

context: the Context to use when resolving the Uri
uri: the Content URI of the data you want to play

public Builder(Context context, Uri uri, java.util.Map<java.lang.String, java.lang.String> headers, java.util.List<java.net.HttpCookie> cookies)

Creates a new Builder object with a content Uri. To provide cookies for the subsequent HTTP requests, you can install your own default cookie handler and use other variants of setMediaItem APIs instead.

Note that the cross domain redirection is allowed by default, but that can be changed with key/value pairs through the headers parameter with "android-allow-cross-domain-redirect" as the key and "0" or "1" as the value to disallow or allow cross domain redirection.

Parameters:

context: the Context to use when resolving the Uri
uri: the Content URI of the data you want to play
headers: the headers to be sent together with the request for the data The headers must not include cookies. Instead, use the cookies param.
cookies: the cookies to be sent together with the request

Methods

public UriMediaItem build()

Returns:

A new UriMediaItem with values supplied by the Builder.