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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

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.

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.

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.

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.