AudioAttributes


public final class AudioAttributes


Attributes for audio playback, which configure the underlying platform .

To set the audio attributes, create an instance using the Builder and either pass it to the player or send a message of type Renderer#MSG_SET_AUDIO_ATTRIBUTES to the audio renderers.

This class is based on android.media.AudioAttributes, but can be used on all supported API versions.

Summary

Nested types

A direct wrapper around android.media.AudioAttributes.

public final class AudioAttributes.Builder

Builder for AudioAttributes.

Constants

static final AudioAttributes

The default audio attributes, where the content type is AUDIO_CONTENT_TYPE_UNKNOWN, usage is USAGE_MEDIA, capture policy is ALLOW_CAPTURE_BY_ALL and no flags are set.

Public methods

boolean
static AudioAttributes

Restores a AudioAttributes from a Bundle.

AudioAttributes.AudioAttributesV21

Returns a AudioAttributesV21 from this instance.

int
Bundle

Constants

DEFAULT

public static final AudioAttributes DEFAULT

The default audio attributes, where the content type is AUDIO_CONTENT_TYPE_UNKNOWN, usage is USAGE_MEDIA, capture policy is ALLOW_CAPTURE_BY_ALL and no flags are set.

Public fields

allowedCapturePolicy

@C.AudioAllowedCapturePolicy
public final int allowedCapturePolicy

The C.AudioAllowedCapturePolicy.

contentType

@C.AudioContentType
public final int contentType

The C.AudioContentType.

flags

@C.AudioFlags
public final int flags

The C.AudioFlags.

spatializationBehavior

@C.SpatializationBehavior
public final int spatializationBehavior

The C.SpatializationBehavior.

usage

@C.AudioUsage
public final int usage

The C.AudioUsage.

Public methods

equals

public boolean equals(@Nullable Object obj)

fromBundle

@UnstableApi
public static AudioAttributes fromBundle(Bundle bundle)

Restores a AudioAttributes from a Bundle.

getAudioAttributesV21

public AudioAttributes.AudioAttributesV21 getAudioAttributesV21()

Returns a AudioAttributesV21 from this instance.

Some fields are ignored if the corresponding android.media.AudioAttributes.Builder setter is not available on the current API level.

hashCode

public int hashCode()

toBundle

@UnstableApi
public Bundle toBundle()