Created
March 13, 2019 06:30
-
-
Save wwj718/c073bc145bcac8e812e5c168ecedabf7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>video player</title> | |
</head> | |
<body onload="onload();"> | |
<video | |
id="idle_video" | |
onended="onVideoEnded();" | |
controls="controls" | |
></video> | |
<script> | |
// 输入视频名称 | |
var video_list = ["wormhole.mp4", "blender.mp4", "cozmo_vector.mp4"]; | |
var video_index = 0; | |
var video_player = null; | |
function onload() { | |
console.log("body loaded"); | |
video_player = document.getElementById("idle_video"); | |
video_player.setAttribute("src", video_list[video_index]); | |
video_player.play(); | |
} | |
function onVideoEnded() { | |
console.log("video ended"); | |
if (video_index < video_list.length - 1) { | |
video_index++; | |
} else { | |
video_index = 0; | |
} | |
video_player.setAttribute("src", video_list[video_index]); | |
video_player.play(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
循环播放当前文件夹内多个视频: video_list