question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Switch from Audio to AudioContext to play music

See original GitHub issue

last 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.js Interface (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 than HtmlMediaElement
    • error: means what it means

Hints

  • lib/player.js can use Audio tags as they can be used as sources for AudioContext

Help

This issue is required to eventually do #127 #31 #114

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
martpiecommented, Nov 30, 2016

This issue is just about AudioContext, for other things, issues already exist or create another ones.

0reactions
s0commented, Mar 13, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found