belongs to Maven artifact com.android.support:support-media-compat:28.0.0-alpha1
AudioAttributesCompat.Builder
public
static
class
AudioAttributesCompat.Builder
extends Object
java.lang.Object | |
↳ | android.support.v4.media.AudioAttributesCompat.Builder |
Builder class for AudioAttributesCompat
objects.
example:
new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_MEDIA) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) .build();
By default all types of information (usage, content type, flags) conveyed by an
AudioAttributesCompat
instance are set to "unknown". Unknown information will be
interpreted as a default value that is dependent on the context of use, for instance a MediaPlayer
will use a default usage of
USAGE_MEDIA
. See also AudioAttributes.Builder
.
Summary
Public constructors | |
---|---|
AudioAttributesCompat.Builder()
Constructs a new Builder with the defaults. |
|
AudioAttributesCompat.Builder(AudioAttributesCompat aa)
Constructs a new Builder from a given AudioAttributes |
Public methods | |
---|---|
AudioAttributesCompat
|
build()
Combines all of the attributes that have been set and return a new |
AudioAttributesCompat.Builder
|
setContentType(int contentType)
Sets the attribute describing the content type of the audio signal, such as speech, or music. |
AudioAttributesCompat.Builder
|
setFlags(int flags)
Sets the combination of flags. |
AudioAttributesCompat.Builder
|
setLegacyStreamType(int streamType)
Create an |
AudioAttributesCompat.Builder
|
setUsage(int usage)
Sets the attribute describing what is the intended use of the the audio signal, such as alarm or ringtone. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Public constructors
AudioAttributesCompat.Builder
AudioAttributesCompat.Builder ()
Constructs a new Builder with the defaults. By default, usage and content type are
respectively USAGE_UNKNOWN
and CONTENT_TYPE_UNKNOWN
, and flags are 0. It is recommended to
configure the usage (with setUsage(int)
) or deriving attributes from a legacy
stream type (with setLegacyStreamType(int)
) before calling build()
to
override any default playback behavior in terms of routing and volume management.
AudioAttributesCompat.Builder
AudioAttributesCompat.Builder (AudioAttributesCompat aa)
Constructs a new Builder from a given AudioAttributes
Parameters | |
---|---|
aa |
AudioAttributesCompat : the AudioAttributesCompat object whose data will be reused in the new Builder.
|
Public methods
build
AudioAttributesCompat build ()
Combines all of the attributes that have been set and return a new AudioAttributesCompat
object.
Returns | |
---|---|
AudioAttributesCompat |
a new AudioAttributesCompat object
|
setContentType
AudioAttributesCompat.Builder setContentType (int contentType)
Sets the attribute describing the content type of the audio signal, such as speech, or music.
Parameters | |
---|---|
contentType |
int : the content type values, one of CONTENT_TYPE_MOVIE , CONTENT_TYPE_MUSIC , CONTENT_TYPE_SONIFICATION , CONTENT_TYPE_SPEECH , CONTENT_TYPE_UNKNOWN . |
Returns | |
---|---|
AudioAttributesCompat.Builder |
the same Builder instance. |
setFlags
AudioAttributesCompat.Builder setFlags (int flags)
Sets the combination of flags.
This is a bitwise OR with the existing flags.
Parameters | |
---|---|
flags |
int : a combination of FLAG_AUDIBILITY_ENFORCED ,
FLAG_HW_AV_SYNC . |
Returns | |
---|---|
AudioAttributesCompat.Builder |
the same Builder instance. |
setLegacyStreamType
AudioAttributesCompat.Builder setLegacyStreamType (int streamType)
Create an AudioAttributesCompat
that best approximates the specified AudioManager
stream type constant.
Parameters | |
---|---|
streamType |
int : one of AudioManager.STREAM_* |
Returns | |
---|---|
AudioAttributesCompat.Builder |
this same Builder |
setUsage
AudioAttributesCompat.Builder setUsage (int usage)
Sets the attribute describing what is the intended use of the the audio signal, such as alarm or ringtone.
Returns | |
---|---|
AudioAttributesCompat.Builder |
the same Builder instance. |
Classes
- AudioAttributesCompat
- AudioAttributesCompat.Builder
- MediaBrowserCompat
- MediaBrowserCompat.ConnectionCallback
- MediaBrowserCompat.CustomActionCallback
- MediaBrowserCompat.ItemCallback
- MediaBrowserCompat.MediaItem
- MediaBrowserCompat.SearchCallback
- MediaBrowserCompat.SubscriptionCallback
- MediaBrowserServiceCompat
- MediaBrowserServiceCompat.BrowserRoot
- MediaBrowserServiceCompat.Result
- MediaDescriptionCompat
- MediaDescriptionCompat.Builder
- MediaMetadataCompat
- MediaMetadataCompat.Builder
- RatingCompat
- VolumeProviderCompat
- VolumeProviderCompat.Callback