Skip to content

How flexible is framework? How much can I plug in and change? #3157

Answered by katspaugh
alankent asked this question in Q&A
Discussion options

You must be logged in to vote

You could probably shoehorn other media types into wavesurfer by making them mimic an HTML audio or video element.

Something like

class CustomMedia extends Audio {
  play() { ... }
  pause() { ... }
  get currentTime() { ... }
  set currentTime() { ... }
  get duration() { ... }
  addEventListener() { ... } // probably the trickiest part
}

and then pass it to wavesurfer like this:

const wavesurfer = WaveSurfer.create({
  container: '#container',
  media: new CustomMedia()
})

Regarding slicing audio into clips, you can do it with Web Audio (search in the issues of this repo, there were many questions about this with some solutions provided).

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@alankent
Comment options

@katspaugh
Comment options

@katspaugh
Comment options

Answer selected by alankent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants