Audio waveform generation and playback component using Wavesurfer.js renders the first item in an array fine, but fails when rendering subsequent items.
使用Wavesurfer.js的音频波形生成和回放组件可以很好地呈现数组中的第一个项目,但在呈现后续项目时会失败。
Code
代码
Wavesurfer.js docs show that the container element for a single waveform component should be included as a property in the return statement. However, the container element is not being updated with each pass of the map loop.
Js文档显示,单个波形组件的容器元素应该作为属性包含在返回语句中。但是,容器元素不会随着映射循环的每一次传递而更新。
Are renders failing because we're triggering the first render successfully (using useEffect) and subsequent ones are unable to "find" the correct container element?
呈现失败是因为我们成功地触发了第一次呈现(使用useEffect),并且后续呈现无法“找到”正确的容器元素吗?
Here's the Wavesurfer example code for a single waveform using React. I'm unable to find examples of apps using multiple Wavesurfer waveforms, which would be super useful.
以下是使用REACT的单个波形的Wavesurfer示例代码。我找不到使用多个Wavesurfer波形的应用程序示例,这将是非常有用的。
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!