This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note: This feature is available in Dedicated Web Workers.
The allocationSize() method of the AudioData interface returns the size in bytes required to hold the current sample as filtered by options passed into the method.
allocationSize(options)
optionsAn object containing the following:
planeIndexThe index of the plane to return the size of.
frameOffset OptionalAn integer giving an offset into the plane data indicating which plane to begin from. Defaults to 0.
frameCount OptionalAn integer giving the number of frames to return the size of. If omitted then all frames in the plane will be used, beginning with the frame specified in frameOffset.
An integer containing the number of bytes needed to hold the samples described by options.
The following example gets the size of the plane at index 1.
let size = AudioData.allocationSize({ planeIndex: 1 });
| Specification |
|---|
| WebCodecs> # dom-audiodata-allocationsize> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
allocationSize |
94 | 94 | 130 | 80 | 26 | 94 | No | 66 | 26 | 17.0 | 94 | 26 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AudioData/allocationSize