【发布时间】:2019-08-27 15:03:37
【问题描述】:
我有:
this.wavesurfer = WaveSurfer.create({
container: "#wavesurfer-player",
height: 60,
barWidth: 2,
barHeight: 1, // the height of the wave
barGap: null,
scrollParent: false
});
this.wavesurfer.load(this.url);
this.wavesurfer.on(
"loading",
progress => (this.loadingProgress = progress)
);
this.wavesurfer.on("ready", () => {
let progressBarContainer = document.querySelector(
".progress-bar-container"
);
progressBarContainer.classList.add("animated", "fadeOut");
this.loadingProgress = 100;
this.wavesurfer.un("ready");
progressBarContainer.addEventListener("animationend", () => {
this.hideProgressBar = true;
});
});
this.wavesurfer.on("audioprocess", this.audioprocess);
在iOS safari 上,这不会播放。显然,我需要在用户操作之后创建一个 AudioContext。所以我可以添加一个带有click 事件的按钮来触发它。但我希望波形在负载时显示。
【问题讨论】:
标签: mobile-safari audiocontext wavesurfer.js