-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestvideo.html
49 lines (40 loc) · 1.41 KB
/
testvideo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<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>Media</title>
</head>
<body style="height: 1000px;">
<button onclick="play()">点击播放视频</button>
<video id="player" controls="controls" style="width:480px;height:300px" webkit-playsinline="true" x5-playsinline="true" playsinline="true">
<source src="0a726b0b97bccef91e9ce8063404b4a6.mp4" type='video/mp4'>
</video>
<script>
const video = document.getElementById('player');
function play() {
//const video = document.createElement('video');
//video.setAttribute('webkit-playsinline', true); // 兼容iOS旧版本
//video.setAttribute('x5-playsinline', true); // 兼容X5内核
//video.setAttribute('playsinline', true);
//video.src = '00ee33f6cd72f4fb13f14910441d7f12.mp4';
//document.body.appendChild(video);
video.onerror = alert;
video.play();
//if (video.paused)
// video.play();
//else
//video.pause();
setTimeout(() => {
video.pause();
setTimeout(() => {
video.play().catch(alert);
//video.play();
}, 1500);
}, 5000);
}
</script>
<img src="http://mqq-imgcache.gtimg.cn/res/fmd_mojo_static/OSaMmKejDIdtRherxb5HGPab8dqUWt9r.png">
</body>
</html>
<body>
</body>