需求是第一生产力!!!刷了半天感觉以上的数据集质量太低了,唔好食~
所以自己简单写了一个demo,给各位拿去食~
<!DOCTYPE html>
<html style="width: 100%; height: 100%;">
<body style="width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;">
<video id="videoPlayer" controls autoplay style="width: 100%; height: 100%;"></video>
<script>
let index = 1;
const base_url = "https://v0-1.qqsuu.cn/xjj/";
function fetchUrl() {
let url = base_url + index + ".mp4";
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error("HTTP error " + response.status);
}
return response.blob();
})
.then(blob => {
let video = document.getElementById('videoPlayer');
video.src = URL.createObjectURL(blob);
return video.play();
})
.then(_ => {
let video = document.getElementById('videoPlayer');
if (video.requestFullscreen) {
video.requestFullscreen();
} else if (video.mozRequestFullScreen) { /* Firefox */
video.mozRequestFullScreen();
} else if (video.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
video.webkitRequestFullscreen();
} else if (video.msRequestFullscreen) { /* IE/Edge */
video.msRequestFullscreen();
}
})
.catch(error => {
console.error("播放视频时出错: ", error);
});
index++;
}
// 在页面加载时执行一次
fetchUrl();
// 当视频播放结束时,播放下一个视频
document.getElementById('videoPlayer').addEventListener('ended', fetchUrl);
</script>
</body>
</html>