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

AudioPlayer #2

Open
kareniel opened this issue Mar 12, 2018 · 1 comment
Open

AudioPlayer #2

kareniel opened this issue Mar 12, 2018 · 1 comment

Comments

@kareniel
Copy link

kareniel commented Mar 12, 2018

"A test suite and interface you can use to implement a hyperaudio compatible audio player."

"This would also serve as a place to design a playback API that can be swapped out with native ones in the future."

"A random-audio-player instance is a common interface for an audio player abstraction, that provides a core api."

I extracted what I understand to be the public api of the AudioPlayer class I found in Hyperamp.
This is basically a wrapper class around the node from a given audio element, right?

🔀 abstract-audio-player

usage

audioPlayer = AudioPlayer(audioNode, globalState)

properties

  • volume (from globalState.volume)
  • muted (from globalState.volume)
  • src (from globalState.audioLibray.currentTrack.filepath)
  • seeking
  • timeupdate
  • audio (audioNode)
    • volume
    • muted
    • src
    • currentTime

methods

  • seekDebounce
  • load
  • play
  • pause
  • volume
  • mute
  • unmute
  • seek

+ nanobus methods:

  • bus.emit(eventName, [data])
  • bus.on(eventName, listener([data]))
  • bus.prependListener(eventName, listener([data]))
  • bus.once(eventName, listener([data]))
  • bus.prependOnceListener(eventName, listener([data]))
  • bus.removeListener(eventName, listener)
  • bus.listeners(eventName)

events

  • ended
  • timeupdate
  • initialized
  • loading
  • playing
  • paused
  • volume
  • muted
  • unmuted
  • seek

See also:

@bcomnes
Copy link
Contributor

bcomnes commented Mar 12, 2018

Thanks for putting this together. I started going down the road of abstracting this, but didn't finish but yeah, I think you have the idea.

I paused because I wanted to figure out how a possible integration with mpd would look before sinking to much work into it.

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

2 participants