简体   繁体   English

无法使用wavesurfer.js播放本地音频.wav文件

[英]unable to play local audio .wav file with wavesurfer.js

i unable to play my local audio file in wavesurfer.js. 我无法在waveurfer.js中播放本地音频文件。 If i pass direct local file path to load method it raises the exception in browser console. 如果我将本地文件的直接路径传递给加载方法,则会在浏览器控制台中引发异常。 Could any one solve me this with snippet will be appreciate. 有人能用片段解决我这个问题,我将不胜感激。 Thanks in advance Here is my code 预先感谢这是我的代码

       var wavesurfer = WaveSurfer.create({
           container: '#player',
           waveColor: 'violet',
           progressColor: 'purple',
           scrollParent: true,
           hideScrollbar: true
       });

       wavesurfer.load("C://user/bla bla...");

here it raises error 在这里它引发错误

You cannot read directly from the hard drive with Javascript. 您无法使用Java脚本直接从硬盘驱动器进行读取。 You need to save the file on the web server, or if you are running the JS file, then locally save the file in the same folder as the js files and change: 您需要将文件保存在Web服务器上,或者如果您正在运行JS文件,则将文件本地保存在与js文件相同的文件夹中,然后更改:

wavesurfer.load("C://user/bla bla...");

to: 至:

wavesurfer.load("file_name");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM