lightbulb_outline Please take our October 2018 developer survey. Start survey

UriDataSourceDesc2.Builder

public static final class UriDataSourceDesc2.Builder
extends Builder<UriDataSourceDesc2.Builder>

java.lang.Object
   ↳ androidx.media2.DataSourceDesc2.Builder<androidx.media2.UriDataSourceDesc2.Builder>
     ↳ androidx.media2.UriDataSourceDesc2.Builder


This Builder class simplifies the creation of a UriDataSourceDesc2 object.

Summary

Public constructors

UriDataSourceDesc2.Builder(Context context, Uri uri)

Creates a new Builder object with a content Uri.

UriDataSourceDesc2.Builder(Context context, Uri uri, Map<String, String> headers, List<HttpCookie> cookies)

Creates a new Builder object with a content Uri.

Public methods

UriDataSourceDesc2 build()

Inherited methods

Public constructors

UriDataSourceDesc2.Builder

public UriDataSourceDesc2.Builder (Context context, 
                Uri uri)

Creates a new Builder object with a content Uri.

Parameters
context Context: the Context to use when resolving the Uri

uri Uri: the Content URI of the data you want to play

UriDataSourceDesc2.Builder

public UriDataSourceDesc2.Builder (Context context, 
                Uri uri, 
                Map<String, String> headers, 
                List<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 setDataSource 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 Context: the Context to use when resolving the Uri

uri Uri: the Content URI of the data you want to play

headers Map: the headers to be sent together with the request for the data The headers must not include cookies. Instead, use the cookies param.

cookies List: the cookies to be sent together with the request

Throws
IllegalArgumentException if the cookie handler is not of CookieManager type when cookies are provided.

Public methods

build

public UriDataSourceDesc2 build ()

Returns
UriDataSourceDesc2 A new UriDataSourceDesc2 with values supplied by the Builder.