1. How to solve the problem of playback delay of audio tags on mobile iOS?
2, and why the canplay event is not triggered under the mobile iOS, but can be triggered if the load () method of HTMLMediaElement is called first?
let audioDom = document.createElement("audio");
let sourceDom = document.createElement("source");
sourceDom.type = "audio/mpeg";
sourceDom.src = src;
audioDom.preload = "auto";
audioDom.appendChild(sourceDom);
audioContainer.appendChild(audioDom);
audioDom.load();
//
audioDom.oncanplay = (e) => {
let _audioDom = e.target;
// this.totalTime = _audioDom.duration;
_audioDom.play();
}
audioDom.onplay = (e) => {
console.log("onplay")
}