We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello, I would like to create multiple waveforms.
Could someone tell me on why my code is not working? Thanks.
<!DOCTYPE html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://unpkg.com/wavesurfer.js"></script> </head> <body> <div class="player d-flex justify-content-between"> <div class="controls"> <img src="play.png" alt="" id="play1"> </div> <div id="waveform1"></div> </div> <div class="player d-flex justify-content-between"> <div class="controls"> <img src="play.png" alt="" id="play2"> </div> <div id="waveform2"></div> </div> <script src="script.js"></script> </body> </html>
class waveForm { init(fileName, idWaveForm, idBtn) { var wavesurfer = WaveSurfer.create({ container: idWaveForm, waveColor: '#000', progressColor: '#f2f2f2', cursorWidth: 1, normalize: true, partialRender: true, responsive: true }) wavesurfer.load(fileName) let playBtn = document.getElementById(idBtn) playBtn.onclick = function() { wavesurfer.playPause() playBtn.src.includes('play.png')? playBtn.src = 'pause.png': playBtn.src = 'play.png' } } } let p1 = new waveForm() p1.init('track1.mp3', '#waveform1','play1') let p2 = new waveForm() p2.init('track2.mp3', '#waveform2','play2')
The text was updated successfully, but these errors were encountered:
Hi @Raspberry42
I did try your example in CodeSandbox - https://codesandbox.io/s/goofy-chandrasekhar-rrhqt?file=/src/index.js
Everything is working good there. Could it be problem with your audio files? Do you have any errors in console?
Thanks
Sorry, something went wrong.
Yes it works! Thank you.
No branches or pull requests
Hello, I would like to create multiple waveforms.
Could someone tell me on why my code is not working?
Thanks.
The text was updated successfully, but these errors were encountered: