0

I want to use wavesurfer.js to create a audio waveform with cursor, so I tried the demo code. I copied the demo code into a html file, it works, but when I want to change the mp3 file, it doesn't work any more.

In the demo code, it uses another server as shown below:

Two methods floading audio file

But I just wrote the code following the first method:

wavesurfer.load('../songname.mp3');

BTW, I put the songname.mp3 and the html file in the same file.

I don't know where is going wrong? please help!

  • 1
    Are you serving the local page as file (ie. file://) or via a local server (ie. http://)? The file:// protocol is for security reasons considered cross-origin. In that case you would need to use a simple local server so you can serve the file via the http:// protocol. –  Nov 28 '17 at 23:56
  • Yes, I just served the local page as file. So I need to use a simple local server right? I am going to use Xampp, is that ok? –  Nov 29 '17 at 00:41
  • Sure, any server will do, Xampp, [Mongoose](https://github.com/cesanta/mongoose/), Node.js with [http-server](https://www.npmjs.com/package/http-server) etc. –  Nov 29 '17 at 01:24

0 Answers0