Video autoplay with multiple videos.
by Ankit Patidar
HTML
<input id="file" type="file" multiple>
<button onclick="play()">play</button>
<video id="video" src="" autoplay controls></video>
JavaScript
let index = 0
video = document.getElementsByTagName('video')[0]
play = () => {
const files = document.getElementById('file').files
const file = files[index++ % files.length]
const url = window.URL.createObjectURL(file)
video.src = url
video.load()
}
video.addEventListener('ended', play, false)