声纹图-声谱图-js之wavesurfer.js(配置、事件、方法中文版翻译)

WaveSurfer.js是一个开源库,用于在网页中可视化音频。文章详细介绍了配置选项,包括播放速度、音频渲染、波形样式、交互性等,并提供了事件处理方法如播放、暂停、音量控制等。此外,还提及了如何订阅和取消订阅播放器事件。

配置信息

option type default English description translate
audioRate float 1 Speed at which to play audio. Lower number is slower. 播放音频的速度。数值越低,速度越慢。
audioContext object none Use your own previously initialized AudioContext or leave blank. none
audioScriptProcessor object none Use your own previously initialized ScriptProcessorNode or leave blank. 使用您自己先前初始化的ScriptProcessorNode或留空。
autoCenter boolean true If a scrollbar is present, center the waveform around the progress. 如果出现滚动条,则将波形围绕进度居中。
backend string WebAudio WebAudio, MediaElement or MediaElementWebAudio. MediaElement is a fallback for unsupported browsers. WebAudio, MediaElement或MediaElementwebAudio。MediaElement是不受支持的浏览器的备用方案。
backgroundColor string none Change background color of the waveform container. 改变波形容器的背景颜色。
barGap number none The optional spacing between bars of the wave, if not provided will be calculated in legacy format. 波条之间的可选间距,如果没有提供,将以遗留格式计算。
barHeight number 1 Height of the waveform bars. Higher number than 1 will increase the waveform bar heights. 波形条的高度。大于1的数字将增加波形条的高度。
barMinHeight number null Minimum height to draw a waveform bar. Default behavior is to not draw a bar during silence. 绘制波形条的最小高度。默认行为是在静默期间不画条。
barRadius number 0 The radius that makes bars rounded. 使bars变圆的半径
barWidth number none If specified, the waveform will be drawn like this: ▁ ▂ ▇ ▃ ▅ ▂ 如果指定,波形将像这样绘制▁ ▂ ▇ ▃ ▅ ▂
closeAudioContext boolean false Close and nullify all audio contexts when the destroy method is called. 当destroy方法被调用时,关闭并使所有音频上下文无效。
container mixed none CSS-selector or HTML-element where the waveform should be drawn. This is the only required parameter. css选择器或html元素,其中应该绘制波形。这是惟一必需的参数。
cursorColor string #333 The fill color of the cursor indicating the playhead position. 指针的填充颜色,表示播放头位置。
cursorWidth integer 1 Measured in pixels. 以像素为单位
drawingContextAttributes object {desynchronized: true} Specify canvas 2d drawing context attributes. 指定画布2d绘图上下文属性。
fillParent boolean true Whether to fill the entire container or draw only according to minPxPerSec. 是否填充整个容器或仅根据minPxPerSec绘制。
forceDecode boolean false Force decoding of audio using web audio when zooming to get a more detailed waveform. 在缩放时使用web音频强制解码音频以获得更详细的波形。
height integer 128 The height of the waveform. Measured in pixels. 波形的高度。以像素为单位。
hideScrollbar boolean false Whether to hid
评论 5
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值