wavesurfer.backend.getPeaks() returns array with NULL
See original GitHub issueHello,
I’m urgently looking for a way to save the waveform on serverside. getPeaks() doesn#t work for me . Any suggestions ? This might be something that should be important in all use cases.
Wavesurfer.js version(s):
2.03
Browser version(s):
Chrome
Code needed to reproduce the issue:
wavesurfer.on('waveform-ready', function () {
var dataJSON = wavesurfer.backend.getPeaks(960);
console.log (JSON.stringify(dataJSON));
var dataImg = wavesurfer.exportImage();
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:12
Top Results From Across the Web
wavesurfer getPeaks is returning an empty array
It works if you remove this line from the config: backend: 'MediaElement',. Working example: $(document).ready(function() { var wavesurfer ...
Read more >MediaElement | wavesurfer.js documentation API Document
Returns the current time in seconds relative to the audioclip's duration. ... init(). Initialise the backend, called in wavesurfer.createBackend().
Read more >src/webaudio.js | wavesurfer.js documentation API Document
* peaks consisting of (max, min) values for each subrange. */; getPeaks(length, first, last) ...
Read more >src/wavesurfer.js | wavesurfer.js documentation API Document
createBackend ();; this.createPeakCache();; return this;; }; /**; * Add and initialise array of plugins (if `plugin.deferInit` is falsey),; * this function ...
Read more >src/wavesurfer.js
You have to use the same methods of MediaElement backend for loading and ... with the array of plugin definitions; * @return {this}...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just to add I was trying to get at the same data and have the same issue using wavesurfer 1.4.0 on both Chrome 63 and Safari 8.0.8 running on Mac 10.10.5. The audio loads and plays as normal.
@thijstriemstra even including the minified script:
<script src="https://unpkg.com/wavesurfer.js"></script>
the problem remainsbelow is my code where i was returning the audio peaks in an interval, 3 days ago it was working normally, until yesterday it was working normally,
today it just stopped returning some value and is returning an empty array
if i remove the backend option from the setup it does not render my audio on the screen
I will explain my application better, I am sending a file through a form so I pass the file (path)
$audio = asset('original/'. $file->getClientOriginalName ());
to the return view
return view ('result')-> with('audio', $audio);
and i’m rendering it this way
and in this way, using the backend when creating the WaveSurfer the waves are rendered on screen, if I remove them, the peaks appear but the waves on the screen do not