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.
MediaInfo.Builder(String contentId, String entity)
Constructs a new Builder with the given content ID and entity.
Public Methods
MediaInfo build()
Builds and returns the MediaInfo object.
MediaInfo.Builder setAdBreakClips(List<AdBreakClipInfo> adBreakClips)
Sets the list of AdBreakClipInfos, each containing the content of a specific ad.
MediaInfo.Builder setAdBreaks(List<AdBreakInfo> adBreaks)
Sets the list of AdBreakInfo, which describes where each ad break is located and what AdBreakClipInfos each break includes.
MediaInfo.Builder setContentType(String contentType)
Sets the content (MIME) type.
MediaInfo.Builder setCustomData(JSONObject customData)
Sets the custom application-specific data.
MediaInfo.Builder setEntity(String entity)
Sets the entity, the deep link for the media as used by Google Assistant.
MediaInfo.Builder setMediaTracks(List<MediaTrack> mediaTracks)
Sets the media tracks.
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; one of the STREAM_TYPE_ constants.
MediaInfo.Builder setTextTrackStyle(TextTrackStyle textTrackStyle)
Sets the text track style.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public MediaInfo.Builder (String contentId)

Constructs a new Builder with the given content ID.

Parameters
contentId String
Throws
IllegalArgumentException If the content ID is null.

public MediaInfo.Builder (String contentId, String entity)

Constructs a new Builder with the given content ID and entity.

Parameters
contentId String
entity String
Throws
IllegalArgumentException If the content ID is null.

Public Methods

public MediaInfo build ()

Builds and returns the MediaInfo object.

Returns
MediaInfo

public MediaInfo.Builder setAdBreakClips (List<AdBreakClipInfo> adBreakClips)

Sets the list of AdBreakClipInfos, each containing the content of a specific ad.

Parameters
adBreakClips List
Returns
MediaInfo.Builder

public MediaInfo.Builder setAdBreaks (List<AdBreakInfo> adBreaks)

Sets the list of AdBreakInfo, which describes where each ad break is located and what AdBreakClipInfos each break includes.

Parameters
adBreaks List
Returns
MediaInfo.Builder

public MediaInfo.Builder setContentType (String contentType)

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

Parameters
contentType String
Returns
MediaInfo.Builder

public MediaInfo.Builder setCustomData (JSONObject customData)

Sets the custom application-specific data.

Parameters
customData JSONObject
Returns
MediaInfo.Builder

public MediaInfo.Builder setEntity (String entity)

Sets the entity, the deep link for the media as used by Google Assistant.

Parameters
entity String
Returns
MediaInfo.Builder

public MediaInfo.Builder setMediaTracks (List<MediaTrack> mediaTracks)

Sets the media tracks.

Parameters
mediaTracks List
Returns
MediaInfo.Builder

public MediaInfo.Builder setMetadata (MediaMetadata metadata)

Sets the media item metadata.

Parameters
metadata MediaMetadata
Returns
MediaInfo.Builder

public MediaInfo.Builder setStreamDuration (long duration)

Sets the stream duration, in milliseconds.

Parameters
duration long
Returns
MediaInfo.Builder
Throws
IllegalArgumentException If the duration is negative.

public MediaInfo.Builder setStreamType (int streamType)

Sets the stream type; one of the STREAM_TYPE_ constants. This is a required field.

Parameters
streamType int
Returns
MediaInfo.Builder
Throws
IllegalArgumentException If the value is not one of the predefined stream type constants.

public MediaInfo.Builder setTextTrackStyle (TextTrackStyle textTrackStyle)

Sets the text track style.

Parameters
textTrackStyle TextTrackStyle
Returns
MediaInfo.Builder