MediaElementAudioSourceNode

The MediaElementAudioSourceNode interface represents an audio source consisting of an HTML5 <audio> or <video> element. It is an AudioNode that acts as an audio source.

A MediaElementSourceNode has no inputs and exactly one output, and is created using the AudioContext.createMediaElementSource() method. The amount of channels in the output equals the number of channels of the audio referenced by the HTMLMediaElement used in the creation of the node, or is 1 if the HTMLMediaElement has no audio.

Number of inputs 0
Number of outputs 1
Channel count defined by the media in the HTMLMediaElement passed to the AudioContext.createMediaElementSource method that created it.

Constructor

MediaElementAudioSourceNode()
Creates a new MediaElementAudioSourceNode object instance.

Properties

Inherits properties from its parent, AudioNode.

mediaElement Read only
The HTMLMediaElement used when constructing this MediaStreamAudioSourceNode.

Methods

Inherits methods from its parent, AudioNode.

Example

See AudioContext.createMediaElementSource() for example code.

Specifications

Specification
Web Audio API
# MediaElementAudioSourceNode

Browser compatibility

BCD tables only load in the browser

See also