Skip to content
Advertisement

noteOn is not a function

I have:

JavaScript

But then I get an error here:

JavaScript

Uncaught TypeError: sourceHuman.noteOn is not a function

Why is noteOn method not defined?

UPDATE

I’m using my HTML audio tag to stream by hls.js:

JavaScript
JavaScript

I would like to get the audio streamed by HLS and process it with Web Audio API.

According to this post, I guess I would have to use MediaElementAudioSourceNode. But I’m not quite sure how.

UPDATE

By logging the output to console, I understand that the MediaElementAudioSourceNode is actually the output type of the createMediaElementSource method.

Advertisement

Answer

As pointed out by @DDomen , what I didn’t understand was the fact that HTML5 <audio> element play/pause/stop methods are still valid with AudioContext:

Note: As a consequence of calling createMediaElementSource(), audio playback from the HTMLMediaElement will be re-routed into the processing graph of the AudioContext. So playing/pausing the media can still be done through the media element API and the player controls.

Documentation

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement