Created
August 30, 2024 17:50
-
-
Save apeckham/2db891e45d0649eda10748c9d22be4ca to your computer and use it in GitHub Desktop.
custom appsmith component for wavesurfer audio player
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import WaveSurfer from 'https://cdn.jsdelivr.net/npm/wavesurfer.js@7/dist/wavesurfer.esm.js'; | |
appsmith.onReady(() => { | |
const wavesurfer = WaveSurfer.create({ | |
container: '#root', | |
waveColor: '#4F4A85', | |
progressColor: '#383351', | |
url: '[url with cors setup]', | |
}); | |
document.getElementById('startButton').addEventListener('click', () => { | |
wavesurfer.play(); | |
}); | |
document.getElementById('stopButton').addEventListener('click', () => { | |
wavesurfer.pause(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment