Switch from Audio to AudioContext to play music
See original GitHub issuelast edit: november 30th 2016 (specs added)
The Audio media element works well, but we need the power of AudioContext to add effects, play without interruptions, easy cross fade ect.
That’s a huge work.
Tasks
Those are hints on how to accomplish this, these may change depending of our needs. More over, they more explain how “a player work” than “how it should be done”
- Re-implement the
lib/player.jsInterface (already existing)-
play() -
pause() - [ ]
stop() -
mute() -
unmute() -
setAudioVolume() -
setAudioPlaybackRate() - Unload track and load another one (ex-
setAudioSrc()) - Seek to a certain time (ex-
setAudioCurrentTime()) - + the few utils of
player.js
-
- Emits corresponding events (may not be needed anymore)
-
play: new track is being played -
pause: the whole thing is paused -
ended: the track ended -
timeupdate: same thanHtmlMediaElement -
error: means what it means
-
Hints
lib/player.jscan use Audio tags as they can be used as sources forAudioContext
Help
- Example play/pause with AudioContext http://jsbin.com/lenapigo/1/edit?html,css,js,output
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Using the Web Audio API - Web APIs - MDN Web Docs
Now, the audio context we've created needs some sound to play through it. ... We'll expose the song on the page using an...
Read more >Getting started with Web Audio API
An AudioContext is for managing and playing all sounds. To produce a sound using the Web Audio API, create one or more sound...
Read more >Making Music in the Browser - Web Audio API, Part 1
The AudioContext comprises a variety of AudioNodes which process audio and output the new values to other AudioNodes or AudioParams. Nothing can ...
Read more >Web Audio API: Why Compose When You Can Code? - Toptal
Gone are the days when the web browser could rarely play a sound file ... this case I am going to show you...
Read more >Introduction to Web Audio API | CSS-Tricks
Let's try to make some noise. Here's what we need for that: ... Let's convert those steps into code. var context = new...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This issue is just about
AudioContext, for other things, issues already exist or create another ones.I’ve effectively implemented this in https://github.com/s0/museeks/blob/synesthesia/src/ui/lib/player.ts, as part of the work towards #31 (see https://github.com/martpie/museeks/issues/31#issuecomment-598853728).
Hopefully I’ll soon have a PR open that will address this issue and #31.