PlaybackMetrics.Builder


public static final class PlaybackMetrics.Builder
extends Object

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


A builder for PlaybackMetrics

Summary

Public constructors

Builder()

Creates a new Builder.

Public methods

PlaybackMetrics.Builder addExperimentId(long value)

Adds the experiment ID.

PlaybackMetrics build()

Builds the instance.

PlaybackMetrics.Builder setAudioUnderrunCount(int value)

Sets the audio underrun count.

PlaybackMetrics.Builder setContentType(int value)

Sets the content type.

PlaybackMetrics.Builder setDrmSessionId(byte[] drmSessionId)

Sets DRM session ID.

PlaybackMetrics.Builder setDrmType(int value)

Sets the DRM type.

PlaybackMetrics.Builder setLocalBytesRead(long value)

Sets the number of local bytes read.

PlaybackMetrics.Builder setMediaDurationMillis(long value)

Sets the media duration in milliseconds.

PlaybackMetrics.Builder setMetricsBundle(Bundle metricsBundle)

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

PlaybackMetrics.Builder setNetworkBytesRead(long value)

Sets the number of network bytes read.

PlaybackMetrics.Builder setNetworkTransferDurationMillis(long value)

Sets the network transfer duration in milliseconds.

PlaybackMetrics.Builder setPlaybackType(int value)

Sets the playback type.

PlaybackMetrics.Builder setPlayerName(String value)

Sets the player name.

PlaybackMetrics.Builder setPlayerVersion(String value)

Sets the player version.

PlaybackMetrics.Builder setStreamSource(int value)

Sets the stream source type.

PlaybackMetrics.Builder setStreamType(int value)

Sets the stream type.

PlaybackMetrics.Builder setVideoFramesDropped(int value)

Sets the video frames dropped.

PlaybackMetrics.Builder setVideoFramesPlayed(int value)

Sets the video frames played.

Inherited methods

Public constructors

Builder

Added in API level 31
public Builder ()

Creates a new Builder.

Public methods

addExperimentId

Added in API level 31
public PlaybackMetrics.Builder addExperimentId (long value)

Adds the experiment ID.

Parameters
value long

Returns
PlaybackMetrics.Builder This value cannot be null.

build

Added in API level 31
public PlaybackMetrics build ()

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

Returns
PlaybackMetrics This value cannot be null.

setAudioUnderrunCount

Added in API level 31
public PlaybackMetrics.Builder setAudioUnderrunCount (int value)

Sets the audio underrun count.

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

Returns
PlaybackMetrics.Builder This value cannot be null.

setContentType

Added in API level 31
public PlaybackMetrics.Builder setContentType (int value)

Sets the content type.

Parameters
value int: Value is PlaybackMetrics.CONTENT_TYPE_UNKNOWN, PlaybackMetrics.CONTENT_TYPE_MAIN, PlaybackMetrics.CONTENT_TYPE_AD, or PlaybackMetrics.CONTENT_TYPE_OTHER

Returns
PlaybackMetrics.Builder This value cannot be null.

setDrmSessionId

Added in API level 31
public PlaybackMetrics.Builder setDrmSessionId (byte[] drmSessionId)

Sets DRM session ID.

Parameters
drmSessionId byte: This value cannot be null.

Returns
PlaybackMetrics.Builder This value cannot be null.

setLocalBytesRead

Added in API level 31
public PlaybackMetrics.Builder setLocalBytesRead (long value)

Sets the number of local bytes read.

Parameters
value long: the number of local bytes read. -1 indicates the value is unknown. Value is -1 or greater

Returns
PlaybackMetrics.Builder This value cannot be null.

setMediaDurationMillis

Added in API level 31
public PlaybackMetrics.Builder setMediaDurationMillis (long value)

Sets the media duration in milliseconds.

Parameters
value long: the media duration in milliseconds. -1 indicates the value is unknown. Value is -1 or greater

Returns
PlaybackMetrics.Builder This value cannot be null.

setMetricsBundle

Added in API level 31
public PlaybackMetrics.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
PlaybackMetrics.Builder This value cannot be null.

setNetworkBytesRead

Added in API level 31
public PlaybackMetrics.Builder setNetworkBytesRead (long value)

Sets the number of network bytes read.

Parameters
value long: the number of network bytes read. -1 indicates the value is unknown. Value is -1 or greater

Returns
PlaybackMetrics.Builder This value cannot be null.

setNetworkTransferDurationMillis

Added in API level 31
public PlaybackMetrics.Builder setNetworkTransferDurationMillis (long value)

Sets the network transfer duration in milliseconds.

Parameters
value long: the network transfer duration in milliseconds. -1 indicates the value is unknown. Value is -1 or greater

Returns
PlaybackMetrics.Builder This value cannot be null.

setPlaybackType

Added in API level 31
public PlaybackMetrics.Builder setPlaybackType (int value)

Sets the playback type.

Parameters
value int: Value is PlaybackMetrics.PLAYBACK_TYPE_UNKNOWN, PlaybackMetrics.PLAYBACK_TYPE_VOD, PlaybackMetrics.PLAYBACK_TYPE_LIVE, or PlaybackMetrics.PLAYBACK_TYPE_OTHER

Returns
PlaybackMetrics.Builder This value cannot be null.

setPlayerName

Added in API level 31
public PlaybackMetrics.Builder setPlayerName (String value)

Sets the player name.

Parameters
value String: This value cannot be null.

Returns
PlaybackMetrics.Builder This value cannot be null.

setPlayerVersion

Added in API level 31
public PlaybackMetrics.Builder setPlayerVersion (String value)

Sets the player version.

Parameters
value String: This value cannot be null.

Returns
PlaybackMetrics.Builder This value cannot be null.

setStreamSource

Added in API level 31
public PlaybackMetrics.Builder setStreamSource (int value)

Sets the stream source type.

Parameters
value int: Value is PlaybackMetrics.STREAM_SOURCE_UNKNOWN, PlaybackMetrics.STREAM_SOURCE_NETWORK, PlaybackMetrics.STREAM_SOURCE_DEVICE, or PlaybackMetrics.STREAM_SOURCE_MIXED

Returns
PlaybackMetrics.Builder This value cannot be null.

setVideoFramesDropped

Added in API level 31
public PlaybackMetrics.Builder setVideoFramesDropped (int value)

Sets the video frames dropped.

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

Returns
PlaybackMetrics.Builder This value cannot be null.

setVideoFramesPlayed

Added in API level 31
public PlaybackMetrics.Builder setVideoFramesPlayed (int value)

Sets the video frames played.

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

Returns
PlaybackMetrics.Builder This value cannot be null.