Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

Loading...
Summary: Ctors | Methods | Inherited Methods | [Expand All]
public static class

# MediaInfo.Builder

extends Object

java.lang.Object
↳ | com.google.android.gms.cast.MediaInfo.Builder

## Class Overview

A builder for `MediaInfo` objects. `MediaInfo` is used by `RemoteMediaPlayer` to load media on the receiver application.

## Summary

Public Constructors
| MediaInfo.Builder(String contentId) Constructs a new Builder with the given content ID.

Public Methods
MediaInfo | build() Builds and returns the `MediaInfo` object.
MediaInfo.Builder | setContentType(String contentType) Sets the content (MIME) type.
MediaInfo.Builder | setCustomData(JSONObject customData) Sets the custom application-specific data.
MediaInfo.Builder | setMetadata(MediaMetadata metadata) Sets the media item metadata.
MediaInfo.Builder | setStreamDuration(long duration) Sets the stream duration, in milliseconds.
MediaInfo.Builder | setStreamType(int streamType) Sets the stream type.

[Expand] Inherited Methods

From class java.lang.Object

Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## Public Constructors

#### public MediaInfo.Builder (String contentId)

Constructs a new Builder with the given content ID.

##### Throws

IllegalArgumentException | If the content ID is `null` or empty.

## Public Methods

#### public MediaInfo build ()

Builds and returns the `MediaInfo` object.

##### Throws

IllegalArgumentException | If all required fields have not been populated with valid values.

#### public MediaInfo.Builder setContentType (String contentType)

Sets the content (MIME) type. This is a required field.

##### Throws

IllegalArgumentException | If the content type is `null` or empty.

#### public MediaInfo.Builder setCustomData (JSONObject customData)

Sets the custom application-specific data.

#### public MediaInfo.Builder setMetadata (MediaMetadata metadata)

Sets the media item metadata.

#### public MediaInfo.Builder setStreamDuration (long duration)

Sets the stream duration, in milliseconds.

##### Throws

IllegalArgumentException | If the duration is negative.

#### public MediaInfo.Builder setStreamType (int streamType)

Sets the stream type. This is a required field.

##### Throws

IllegalArgumentException | If the value is not one of the predefined stream type constants.