Skip to content

Instantly share code, notes, and snippets.

@apeckham
Created August 30, 2024 17:50
Show Gist options
  • Save apeckham/2db891e45d0649eda10748c9d22be4ca to your computer and use it in GitHub Desktop.
Save apeckham/2db891e45d0649eda10748c9d22be4ca to your computer and use it in GitHub Desktop.
custom appsmith component for wavesurfer audio player
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