-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
59 lines (55 loc) · 2.15 KB
/
index.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
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0"/>
<title>Dead simple video</title>
<link rel="stylesheet" href="src/VideoPlayer.css" />
</head>
<body>
<div class="ad">
<h1><a href="#">网页表单的本地客户端验证</a></h1>
<div class="ad-content">
<div class="video">
<img id="canvas" src="assert/star.jpg" alt="" />
</div>
<div class="ad-desc">
众所周知,验证表单一直有很痛苦的开发体验。实现一种用户体验好、开发体验好且可访...<br/>
<a href="http://mzhou.me">http://mzhou.me</a> - <span>blog</span>
</div>
<script type="text/javascript">
(function() {
var data = {
htmlUrl: './play.html',
videoUrl: 'http://bs.baidu.com/adtest/29cf39d796cbcfd7d6807ef6bbefeb41.mp4',
type: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
};
var img = document.getElementById('canvas');
var parent = img.parentNode;
var video = document.createElement('video');
if (video.canPlayType(data.type)) {
// create video
var source = document.createElement('source');
source.src = data.videoUrl;
source.type = data.type;
video.appendChild(source);
// create time span
var span = document.createElement('span');
span.innerHTML = '00:30';
// create link image
var a = document.createElement('a');
a.href = data.htmlUrl + '?video=' + encodeURIComponent(data.videoUrl) + '&type=' + encodeURIComponent(data.type);
a.target = '_blank';
parent.removeChild(img);
a.appendChild(img);
parent.appendChild(video);
parent.appendChild(a);
parent.appendChild(span);
}
})();
</script>
</div>
</div>
</body>
</html>