Class AudioAttributes
- java.lang.Object
-
- com.google.android.exoplayer2.audio.AudioAttributes
-
- All Implemented Interfaces:
Bundleable
public final class AudioAttributes extends Object implements Bundleable
Attributes for audio playback, which configure the underlying platformAudioTrack
.To set the audio attributes, create an instance using the
AudioAttributes.Builder
and either pass it to the player or send a message of typeRenderer#MSG_SET_AUDIO_ATTRIBUTES
to the audio renderers.This class is based on
AudioAttributes
, but can be used on all supported API versions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AudioAttributes.Builder
Builder forAudioAttributes
.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable
Bundleable.Creator<T extends Bundleable>
-
-
Field Summary
Fields Modifier and Type Field Description @com.google.android.exoplayer2.C.AudioAllowedCapturePolicy int
allowedCapturePolicy
@com.google.android.exoplayer2.C.AudioContentType int
contentType
TheC.AudioContentType
.static Bundleable.Creator<AudioAttributes>
CREATOR
Object that can restoreAudioAttributes
from aBundle
.static AudioAttributes
DEFAULT
The default audio attributes, where the content type isC.CONTENT_TYPE_UNKNOWN
, usage isC.USAGE_MEDIA
, capture policy isC.ALLOW_CAPTURE_BY_ALL
and no flags are set.@com.google.android.exoplayer2.C.AudioFlags int
flags
TheC.AudioFlags
.@com.google.android.exoplayer2.C.SpatializationBehavior int
spatializationBehavior
@com.google.android.exoplayer2.C.AudioUsage int
usage
TheC.AudioUsage
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
AudioAttributes
getAudioAttributesV21()
Returns aAudioAttributes
from this instance.int
hashCode()
Bundle
toBundle()
Returns aBundle
representing the information stored in this object.
-
-
-
Field Detail
-
DEFAULT
public static final AudioAttributes DEFAULT
The default audio attributes, where the content type isC.CONTENT_TYPE_UNKNOWN
, usage isC.USAGE_MEDIA
, capture policy isC.ALLOW_CAPTURE_BY_ALL
and no flags are set.
-
contentType
@AudioContentType public final @com.google.android.exoplayer2.C.AudioContentType int contentType
TheC.AudioContentType
.
-
flags
@AudioFlags public final @com.google.android.exoplayer2.C.AudioFlags int flags
TheC.AudioFlags
.
-
usage
@AudioUsage public final @com.google.android.exoplayer2.C.AudioUsage int usage
TheC.AudioUsage
.
-
allowedCapturePolicy
@AudioAllowedCapturePolicy public final @com.google.android.exoplayer2.C.AudioAllowedCapturePolicy int allowedCapturePolicy
-
spatializationBehavior
public final @com.google.android.exoplayer2.C.SpatializationBehavior int spatializationBehavior
-
CREATOR
public static final Bundleable.Creator<AudioAttributes> CREATOR
Object that can restoreAudioAttributes
from aBundle
.
-
-
Method Detail
-
getAudioAttributesV21
@RequiresApi(21) public AudioAttributes getAudioAttributesV21()
Returns aAudioAttributes
from this instance.Field
allowedCapturePolicy
is ignored for API levels prior to 29.
-
toBundle
public Bundle toBundle()
Description copied from interface:Bundleable
Returns aBundle
representing the information stored in this object.- Specified by:
toBundle
in interfaceBundleable
-
-