TrackChangeEvent.Builder


public static final class TrackChangeEvent.Builder
extends Object

java.lang.Object
   ↳ android.media.metrics.TrackChangeEvent.Builder


A builder for TrackChangeEvent

Summary

Public constructors

Builder(int type)

Creates a new Builder.

Public methods

TrackChangeEvent build()

Builds the instance.

TrackChangeEvent.Builder setAudioSampleRate(int value)

Sets sample rate.

TrackChangeEvent.Builder setBitrate(int value)

Sets bitrate in bits per second.

TrackChangeEvent.Builder setChannelCount(int value)

Sets channel count.

TrackChangeEvent.Builder setCodecName(String value)

Sets codec name.

TrackChangeEvent.Builder setContainerMimeType(String value)

Sets container MIME type.

TrackChangeEvent.Builder setHeight(int value)

Sets video height.

TrackChangeEvent.Builder setLanguage(String value)

Sets language code.

TrackChangeEvent.Builder setLanguageRegion(String value)

Sets language region code.

TrackChangeEvent.Builder setMetricsBundle(Bundle metricsBundle)

Sets metrics-related information that is not supported by dedicated methods.

TrackChangeEvent.Builder setSampleMimeType(String value)

Sets the MIME type of the video/audio/text samples.

TrackChangeEvent.Builder setTimeSinceCreatedMillis(long value)

Sets timestamp since the creation in milliseconds.

TrackChangeEvent.Builder setTrackChangeReason(int value)

Sets track change reason.

TrackChangeEvent.Builder setTrackState(int value)

Sets track state.

TrackChangeEvent.Builder setVideoFrameRate(float value)

Sets video frame rate.

TrackChangeEvent.Builder setWidth(int value)

Sets video width.

Inherited methods

Public constructors

Builder

Added in API level 31
public Builder (int type)

Creates a new Builder.

Parameters
type int: the track type. It must be one of TrackChangeEvent.TRACK_TYPE_AUDIO, TrackChangeEvent.TRACK_TYPE_VIDEO, TrackChangeEvent.TRACK_TYPE_TEXT. Value is TrackChangeEvent.TRACK_TYPE_AUDIO, TrackChangeEvent.TRACK_TYPE_VIDEO, or TrackChangeEvent.TRACK_TYPE_TEXT

Public methods

build

Added in API level 31
public TrackChangeEvent build ()

Builds the instance. This builder should not be touched after calling this!

Returns
TrackChangeEvent This value cannot be null.

setAudioSampleRate

Added in API level 31
public TrackChangeEvent.Builder setAudioSampleRate (int value)

Sets sample rate.

Parameters
value int: the sample rate. -1 indicates the value is unknown. Value is between -1 and Integer.MAX_VALUE inclusive

Returns
TrackChangeEvent.Builder This value cannot be null.

setBitrate

Added in API level 31
public TrackChangeEvent.Builder setBitrate (int value)

Sets bitrate in bits per second.

Parameters
value int: the bitrate in bits per second. -1 indicates the value is unknown. Value is between -1 and Integer.MAX_VALUE inclusive

Returns
TrackChangeEvent.Builder This value cannot be null.

setChannelCount

Added in API level 31
public TrackChangeEvent.Builder setChannelCount (int value)

Sets channel count.

Parameters
value int: the channel count. -1 indicates the value is unknown. Value is between -1 and Integer.MAX_VALUE inclusive

Returns
TrackChangeEvent.Builder This value cannot be null.

setCodecName

Added in API level 31
public TrackChangeEvent.Builder setCodecName (String value)

Sets codec name.

Parameters
value String: This value cannot be null.

Returns
TrackChangeEvent.Builder This value cannot be null.

setContainerMimeType

Added in API level 31
public TrackChangeEvent.Builder setContainerMimeType (String value)

Sets container MIME type.

Parameters
value String: This value cannot be null.

Returns
TrackChangeEvent.Builder This value cannot be null.

setHeight

Added in API level 31
public TrackChangeEvent.Builder setHeight (int value)

Sets video height.

Parameters
value int: the video height. -1 indicates the value is unknown. Value is between -1 and Integer.MAX_VALUE inclusive

Returns
TrackChangeEvent.Builder This value cannot be null.

setLanguage

Added in API level 31
public TrackChangeEvent.Builder setLanguage (String value)

Sets language code.

Parameters
value String: a two-letter ISO 639-1 language code. This value cannot be null.

Returns
TrackChangeEvent.Builder This value cannot be null.

setLanguageRegion

Added in API level 31
public TrackChangeEvent.Builder setLanguageRegion (String value)

Sets language region code.

Parameters
value String: an IETF BCP 47 optional language region subtag based on a two-letter country code. This value cannot be null.

Returns
TrackChangeEvent.Builder This value cannot be null.

setMetricsBundle

Added in API level 31
public TrackChangeEvent.Builder setMetricsBundle (Bundle metricsBundle)

Sets metrics-related information that is not supported by dedicated methods.

It is intended to be used for backwards compatibility by the metrics infrastructure.

Parameters
metricsBundle Bundle: This value cannot be null.

Returns
TrackChangeEvent.Builder This value cannot be null.

setSampleMimeType

Added in API level 31
public TrackChangeEvent.Builder setSampleMimeType (String value)

Sets the MIME type of the video/audio/text samples.

Parameters
value String: This value cannot be null.

Returns
TrackChangeEvent.Builder This value cannot be null.

setTimeSinceCreatedMillis

Added in API level 31
public TrackChangeEvent.Builder setTimeSinceCreatedMillis (long value)

Sets timestamp since the creation in milliseconds.

Parameters
value long: the timestamp since the creation in milliseconds. -1 indicates the value is unknown. Value is -1 or greater

Returns
TrackChangeEvent.Builder This value cannot be null.

setTrackState

Added in API level 31
public TrackChangeEvent.Builder setTrackState (int value)

Sets track state.

Parameters
value int: Value is TrackChangeEvent.TRACK_STATE_OFF, or TrackChangeEvent.TRACK_STATE_ON

Returns
TrackChangeEvent.Builder This value cannot be null.

setVideoFrameRate

Added in API level 31
public TrackChangeEvent.Builder setVideoFrameRate (float value)

Sets video frame rate.

Parameters
value float: the video frame rate. -1 indicates the value is unknown. Value is between -1 and Float.MAX_VALUE inclusive

Returns
TrackChangeEvent.Builder This value cannot be null.

setWidth

Added in API level 31
public TrackChangeEvent.Builder setWidth (int value)

Sets video width.

Parameters
value int: the video width. -1 indicates the value is unknown. Value is between -1 and Integer.MAX_VALUE inclusive

Returns
TrackChangeEvent.Builder This value cannot be null.