H5视频,播放,暂停,重新播放
```<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<video src="https://pic.ibaotu.com/00/41/33/24B888piCexZ.mp4" ></video>
</body>
<script >
var video = document.querySelector('video');
var totalTime = 0;
var currentTime = 0;
function start() {
video.play();
}
video.addEventListener('loadedmetadata', function() {
totalTime = video.duration;
})
video.addEventListener('timeupdate', function() {
currentTime = video.currentTime;
})
video.onload = function () {
start()
}
function pause() {
video.pause();
}
function volum (value) {
video.volume = value;
}
function restart() {
video.currentTime = totalTime;
video.play();
}
</script>
</html>