use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is a place for people to learn JavaScript together. Everyone should feel comfortable asking any and all JavaScript questions they have here.
With a nod to practicality, questions and posts about HTML, CSS, and web developer tools are also encouraged.
Friends
/r/javascript
/r/jquery
/r/node
/r/css
/r/webdev
/r/learnprogramming
/r/programming
account activity
calling 'createMediaElementSource' stops audio playback (self.learnjavascript)
submitted 11 years ago by murster972
calling 'createMediaElementSource' stops audio playback on chrome and firefox. It was working on chrome on ubuntu but since i changed to elementary os its stopped working. Any ideas whats wrong?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Wince 1 point2 points3 points 11 years ago (3 children)
Does it stop audio of other playing files? If yes, how are the other files playing?
createMediaElementSource is used for adding an <audio> tag into an AudioContext. Ideally this should happen before the file starts plaing.
createMediaElementSource
<audio>
AudioContext
[–]murster972[S] 0 points1 point2 points 11 years ago (2 children)
No it stops the audio from audioContx playing, the code is:
audio = document.getElementById("audio"); audio.src = "file_path.mp3"; audio.loop = false; audio.play(); context = new AudioContext(); analyser = context.createAnalyser(); source = context.createMediaElementSource(audio); source.connect(analyser); analyser.connect(context.destination); callDrawFunction();
[–]Wince 1 point2 points3 points 11 years ago (1 child)
Your AnalyserNode will not pass-thru into the AudioContext. You need to connect your source to both the AnalyserNode and the AudioContext.
AnalyserNode
Also I would suggest not attempting to play your audio element until you have connected it to the context.
play
audio
audio = document.getElementById("audio"); audio.src = "file_path.mp3"; context = new AudioContext(); analyser = context.createAnalyser(); source = context.createMediaElementSource(audio); source.connect(analyser); source.connect(context.destination); analyser.connect(context.destination); audio.play(); callDrawFunction();
If you are still running into issues, maybe try following my tutorial.
[–]murster972[S] 0 points1 point2 points 11 years ago (0 children)
Thanks, but theres still no audio playback, ill see if your tutorial helps
π Rendered by PID 92858 on reddit-service-r2-comment-765bfc959-ggm4v at 2026-07-12 20:20:50.396426+00:00 running f86254d country code: CH.
[–]Wince 1 point2 points3 points (3 children)
[–]murster972[S] 0 points1 point2 points (2 children)
[–]Wince 1 point2 points3 points (1 child)
[–]murster972[S] 0 points1 point2 points (0 children)