The MediaElementAudioSourceNode() constructor creates a new MediaElementAudioSourceNode object instance.


var myAudioSource = new MediaElementAudioSourceNode(context, options);


Inherits parameters from the AudioNodeOptions dictionary.

An AudioContext representing the audio context you want the node to be associated with.
A MediaElementAudioSourceOptions dictionary object defining the properties you want the MediaElementAudioSourceNode to have:
  • mediaElement: An HTMLMediaElement that will be used as the source for the audio.

Return value

A new MediaElementAudioSourceNode object instance.


var ac = new AudioContext();
var mediaElement = document.createElement('audio');

var options = {
  mediaElement : mediaElement 

var myAudioSource = new MediaElementAudioSourceNode(ac, options);


Specification Status Comment
Web Audio API
The definition of 'MediaElementAudioSourceNode' in that specification.
Working Draft  

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support551 ?53 No42 ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support551551 ?5342 ?6.0

1. Before Chrome 59, the default values were not supported.

Document Tags and Contributors

Contributors to this page: fscholz, teoli, chrisdavidmills, jpmedley
Last updated by: fscholz,