Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend constructor to allow for async args #48

Open
dy opened this issue Jan 11, 2018 · 0 comments
Open

Extend constructor to allow for async args #48

dy opened this issue Jan 11, 2018 · 0 comments

Comments

@dy
Copy link
Member

dy commented Jan 11, 2018

Similar to Image:

Audio('./x.wav', (err, a) => {})
Audio(blob).on('load', a => {})
Audio(file).then(a => {})
  1. That would allow to get rid of / hide .decode, .load methods.
  2. Audio w/o content loaded is in temporary state of empty buffer, but available already.
  3. That complicates Promise interface Audio(url).then(a => {}): audio is thenable.
  4. That mixes up sync/async pattern: some audio sources are available synchronously, like buffers, others only in async way.

Otherwise it is not clear the natural way of creating blobs: Audio.load(blob),Audio.decode(blob) or Audio.from(blob)?

@dy dy mentioned this issue Jan 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant