MediaStream.getAudioTracks() returns an array of every MediaStreamTrack in the stream whose kind is "audio". Per MDN, the array is empty when there are no audio tracks.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call stream.getAudioTracks. Start with this line.
JavaScript
mediaStream.getAudioTracks()
Call
What it does
mediaStream.getAudioTracks()
Primary signature.
stream.getAudioTracks(...)
Call with the arguments your case needs.
Built into the browser. Call getAudioTracks(...) on a MediaStream — no import required.
Library declarations
JavaScript
mediaStream.getAudioTracks()
Parameters
This member has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
Array of audio MediaStreamTracks (may be empty)
JavaScript Examples
Example 1 — Basic getAudioTracks()
List audio tracks from a Web Audio destination stream (no mic permission).
Set enabled = false. Soft mute — track stays in the stream.
Read back.enabled is now false.
vs stop(). Stopping ends the track; muting can be reversed with enabled = true.
Compatibility
Browser Support
MediaStream.getAudioTracks() is Baseline Widely available (MDN: since September 2017). It is part of the Media Capture and Streams specification. It is a browser Web API — not available in Node.js, Bun, or Deno.
✓ Baseline · Widely available
MediaStream.getAudioTracks()
Supported across modern Chrome, Firefox, Safari, and Edge for listing audio tracks.
98%Browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
getAudioTracks()Excellent
Bottom line: Browser only — not a Node.js API. Safe for production. Use it whenever you need only the audio tracks from a MediaStream.
Frequently Asked Questions
An array of MediaStreamTrack objects whose kind is "audio". If the stream has no audio tracks, the array is empty.
No. MDN marks MediaStream.getAudioTracks() as Baseline Widely available (since September 2017). It is not Deprecated, Experimental, or Non-standard. Early AudioStreamTrack was merged into MediaStreamTrack.
No. Call it on a MediaStream with no arguments: stream.getAudioTracks().
No. MDN says the order is not defined by the specification and may change from one call to the next.
getTracks() returns every track. getAudioTracks() returns only tracks where track.kind === "audio".
getAudioTracks() returns []. That is normal — check length before using tracks[0].