Class AudioCapabilities

  • public final class AudioCapabilities
    extends Object
    Represents the set of audio formats that a device is capable of playing.
    • Field Detail


        public static final AudioCapabilities DEFAULT_AUDIO_CAPABILITIES
        The minimum audio capabilities supported by all devices.
    • Constructor Detail

      • AudioCapabilities

        public AudioCapabilities​(@Nullable
                                 int[] supportedEncodings,
                                 int maxChannelCount)
        Constructs new audio capabilities based on a set of supported encodings and a maximum channel count.

        Applications should generally call getCapabilities(Context) to obtain an instance based on the capabilities advertised by the platform, rather than calling this constructor.

        supportedEncodings - Supported audio encodings from AudioFormat's ENCODING_* constants. Passing null indicates that no encodings are supported.
        maxChannelCount - The maximum number of audio channels that can be played simultaneously.
    • Method Detail

      • getCapabilities

        public static AudioCapabilities getCapabilities​(Context context)
        Returns the current audio capabilities for the device.
        context - A context for obtaining the current audio capabilities.
        The current audio capabilities for the device.
      • supportsEncoding

        public boolean supportsEncoding​(@Encoding
                                        int encoding)
        Returns whether this device supports playback of the specified audio encoding.
        encoding - One of C.Encoding's ENCODING_* constants.
        Whether this device supports playback the specified audio encoding.
      • getMaxChannelCount

        public int getMaxChannelCount()
        Returns the maximum number of channels the device can play at the same time.
      • equals

        public boolean equals​(@Nullable
                              Object other)
        equals in class Object
      • hashCode

        public int hashCode()
        hashCode in class Object