How to change the playing speed of videos in HTML5? depicts a way of setting the playback speed of a html5 audio/video element, but the answers given in that question rely on the actual video/audio tag being present in the dom. The website - SoundCloud - in particular does not put the audio player in the DOM anywhere, but it still does use it internally. Since document.queryselector will not work, how can I set the playback rate?
You don't need to actually insert the audio tag into the DOM.
quick example here:
document.getElementById('play').addEventListener('click', event => {
const audio = document.createElement('audio')
audio.src = "https://www.w3schools.com/html/mov_bbb.mp4"
audio.play()
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.