Replies: 2 comments 2 replies
-
You can create a Web Audio player to shim an audio element like this: import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js'
import WebAudioPlayer from 'https://unpkg.com/wavesurfer.js@7/dist/webaudio.js'
const webAudioPlayer = new WebAudioPlayer(/* optionally pass your own AudioContext instance */)
webAudioPlayer.src = '/examples/audio/audio.wav'
const wavesurfer = WaveSurfer.create({
container: document.body,
waveColor: 'rgb(200, 0, 200)',
progressColor: 'rgb(100, 0, 100)',
media: webAudioPlayer,
})
wavesurfer.on('click', () => {
wavesurfer.play()
}) It uses a BufferSourceNode + GainNode under the hood. You can access the GainNode via |
Beta Was this translation helpful? Give feedback.
1 reply
-
I tried to implement this option and I am getting the following error when trying to set the media attribute in the way shown above:
What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi quick question,
Would it be possible to use the Web Audio API, instead of relying on an audio html element?
Im working on a project where im trying to achieve a bit more drm protection. And am looking into a way to not be reliant on this!
To be more specific:
audioContext or webkitAudioContext
Thanks for v7!
Beta Was this translation helpful? Give feedback.
All reactions