AudioAttributes
public final class AudioAttributes
Attributes for audio playback, which configure the underlying platform android.media.AudioTrack.
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 |
|---|
public final class AudioAttributes.AudioAttributesV21This class is deprecated. |
public final class AudioAttributes.BuilderBuilder for |
Constants |
|
|---|---|
static final AudioAttributes |
The default audio attributes, where the content type is |
Public fields |
|
|---|---|
final int |
|
final int |
The |
final int |
The |
final boolean |
Whether haptic channels are muted. |
final boolean |
Whether the content is spatialized. |
@Nullable AudioAttributes |
|
final int |
|
final int |
The |
Public methods |
|
|---|---|
boolean |
|
static AudioAttributes |
@UnstableApiRestores a |
static AudioAttributes |
fromPlatformAudioAttributes(AudioAttributes audioAttributes)Creates a new instance from the provided |
AudioAttributes.AudioAttributesV21 |
This method is deprecated. |
AudioAttributes |
Returns a |
int |
Returns the |
int |
hashCode() |
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
hapticChannelsMuted
@UnstableApi
public final boolean hapticChannelsMuted
Whether haptic channels are muted.
isContentSpatialized
@UnstableApi
public final boolean isContentSpatialized
Whether the content is spatialized.
Public methods
fromBundle
@UnstableApi
public static AudioAttributes fromBundle(Bundle bundle)
Restores a AudioAttributes from a Bundle.
fromPlatformAudioAttributes
public static AudioAttributes fromPlatformAudioAttributes(AudioAttributes audioAttributes)
Creates a new instance from the provided android.media.AudioAttributes.
getPlatformAudioAttributes
public AudioAttributes getPlatformAudioAttributes()
Returns a android.media.AudioAttributes from this instance.
Some fields are ignored if the corresponding android.media.AudioAttributes.Builder setter is not available on the current API level.
getStreamType
@UnstableApi
@C.StreamType
public int getStreamType()
Returns the C.StreamType corresponding to these audio attributes.