Stay organized with collections
Save and categorize content based on your preferences.
AudioCapabilities
class AudioCapabilities
A class that supports querying the audio capabilities of a codec.
Summary
Public methods |
Range<Int!>! |
Returns the range of supported bitrates in bits/second.
|
Array<Range<Int!>!> |
|
Int |
Returns the maximum number of input channels supported.
|
Int |
Returns the minimum number of input channels supported.
|
Array<Range<Int!>!>! |
Returns the array of supported sample rate ranges.
|
IntArray! |
Returns the array of supported sample rates if the codec supports only discrete values.
|
Boolean |
Query whether the sample rate is supported by the codec.
|
Public methods
getBitrateRange
fun getBitrateRange(): Range<Int!>!
Returns the range of supported bitrates in bits/second.
fun getMinInputChannelCount(): Int
Returns the minimum number of input channels supported. This is often 1, but does vary for certain mime types. This returns the lowest channel count in the ranges returned by getInputChannelCountRanges
.
Return |
Int |
Value is between 1 and 255 inclusive |
getSupportedSampleRateRanges
fun getSupportedSampleRateRanges(): Array<Range<Int!>!>!
Returns the array of supported sample rate ranges. The array is sorted in ascending order, and the ranges are distinct.
getSupportedSampleRates
fun getSupportedSampleRates(): IntArray!
Returns the array of supported sample rates if the codec supports only discrete values. Otherwise, it returns null
. The array is sorted in ascending order.
isSampleRateSupported
fun isSampleRateSupported(sampleRate: Int): Boolean
Query whether the sample rate is supported by the codec.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MediaCodecInfo.AudioCapabilities\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nAudioCapabilities\n=================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/MediaCodecInfo.AudioCapabilities \"View this page in Java\") \n\n```\nclass AudioCapabilities\n```\n\n|---|-----------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.MediaCodecInfo.AudioCapabilities](#) |\n\nA class that supports querying the audio capabilities of a codec.\n\nSummary\n-------\n\n| Public methods ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Range](../util/Range.html#)\\\u003c[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\\\u003e! | [getBitrateRange](#getBitrateRange())`()` Returns the range of supported bitrates in bits/second. |\n| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\\\u003c[Range](../util/Range.html#)\\\u003c[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\\\u003e!\\\u003e | [getInputChannelCountRanges](#getInputChannelCountRanges())`()` \u003cbr /\u003e |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getMaxInputChannelCount](#getMaxInputChannelCount())`()` Returns the maximum number of input channels supported. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getMinInputChannelCount](#getMinInputChannelCount())`()` Returns the minimum number of input channels supported. |\n| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\\\u003c[Range](../util/Range.html#)\\\u003c[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\\\u003e!\\\u003e! | [getSupportedSampleRateRanges](#getSupportedSampleRateRanges())`()` Returns the array of supported sample rate ranges. |\n| [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)! | [getSupportedSampleRates](#getSupportedSampleRates())`()` Returns the array of supported sample rates if the codec supports only discrete values. |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isSampleRateSupported](#isSampleRateSupported(kotlin.Int))`(`sampleRate:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Query whether the sample rate is supported by the codec. |\n\nPublic methods\n--------------\n\n### getBitrateRange\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getBitrateRange(): Range\u003cInt!\u003e!\n```\n\nReturns the range of supported bitrates in bits/second. \n\n### getInputChannelCountRanges\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getInputChannelCountRanges(): Array\u003cRange\u003cInt!\u003e!\u003e\n```\n\n| Return ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|\n| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\u003c[Range](../util/Range.html#)\u003c[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\u003e!\u003e | This value cannot be `null`. |\n\n### getMaxInputChannelCount\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getMaxInputChannelCount(): Int\n```\n\nReturns the maximum number of input channels supported. Through [android.os.Build.VERSION_CODES#R](../os/Build.VERSION_CODES.html#R:kotlin.Int), this method indicated support for any number of input channels between 1 and this maximum value. As of [android.os.Build.VERSION_CODES#S](../os/Build.VERSION_CODES.html#S:kotlin.Int), the implied lower limit of 1 channel is no longer valid. As of [android.os.Build.VERSION_CODES#S](../os/Build.VERSION_CODES.html#S:kotlin.Int), [getMaxInputChannelCount](#getMaxInputChannelCount()) is superseded by [getInputChannelCountRanges](#getInputChannelCountRanges()), which returns an array of ranges of channels. The [getMaxInputChannelCount](#getMaxInputChannelCount()) method will return the highest value in the ranges returned by [getInputChannelCountRanges](#getInputChannelCountRanges())\n\n| Return ||\n|----------------------------------------------------------------------------|--------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is between 1 and 255 inclusive |\n\n### getMinInputChannelCount\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getMinInputChannelCount(): Int\n```\n\nReturns the minimum number of input channels supported. This is often 1, but does vary for certain mime types. This returns the lowest channel count in the ranges returned by [getInputChannelCountRanges](#getInputChannelCountRanges()).\n\n| Return ||\n|----------------------------------------------------------------------------|--------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is between 1 and 255 inclusive |\n\n### getSupportedSampleRateRanges\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getSupportedSampleRateRanges(): Array\u003cRange\u003cInt!\u003e!\u003e!\n```\n\nReturns the array of supported sample rate ranges. The array is sorted in ascending order, and the ranges are distinct. \n\n### getSupportedSampleRates\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getSupportedSampleRates(): IntArray!\n```\n\nReturns the array of supported sample rates if the codec supports only discrete values. Otherwise, it returns `null`. The array is sorted in ascending order. \n\n### isSampleRateSupported\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun isSampleRateSupported(sampleRate: Int): Boolean\n```\n\nQuery whether the sample rate is supported by the codec."]]