비디오 태그를 사용해서 주어진 주소 중 랜덤하게 선택해서 영상을 재생해주는 소스이다. 동영상의 HLS 방식을 사용했다.
const videoFiles = [ "영상1.mp4/playlist.m3u8","영상2.mp4/playlist.m3u8", ]; const video = document.getElementById("videoPlayer"); // 랜덤 인덱스 선택 const randomIndex = Math.floor(Math.random() * videoFiles.length); const selectedSource = videoFiles[randomIndex]; let hls; function playVideo(s...
원문 링크 : 비디오 태그로 영상 랜덤선택 재생 - HLS