forked from Tidwell/videoThumb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
81 lines (76 loc) · 2.55 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE HTML>
<html>
<head>
<title>HTML5 Video Thumbnail Demo</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="makethumb.js"></script>
<style type="text/css">
#thumbImg,
#thumbImg2, #thumbImg3 {
border: 1px solid;
position: relative;
cursor: pointer;
}
.playBtn {
background: url("play.png") no-repeat scroll 0 0 transparent;
display: block;
height: 50px;
right: -15px;
position: absolute;
text-indent: -9999px;
bottom: -15px;
width: 50px;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
makeThumb({
src: 'video.ogg.ogv',
thumbSelector: '#thumbImg',
height: '100',
width: '100',
numFrames: 15,
minOffset: 2,
duration: 200,
static: 'thumb.png'
})
makeThumb({
src: 'video.ogg.ogv',
thumbSelector: '#thumbImg2',
height: '150',
width: '150',
numFrames: 10,
minOffset: 5,
duration: 300,
static: 'thumb.png',
showStaticOff: true
})
makeThumb({
src: 'video.ogg.ogv', //relative to the page
thumbSelector: '#thumbImg3', //css selector
height: '150', //px
width: '150', //px
numFrames: 1, //int
minOffset: 40.9, //seconds (can use decimals to pinpoint start frame)
duration: 300, //milliseconds
static: 'thumb.png', //relative to the page
showStaticOff: true //bool
})
});
</script>
</head>
<body>
<p>Requires JQuery. On hover, will cycle through the video to create a number of preview thumbnail frames and will continue to cycle through while hovered. Use numFrames: 1 to have a single frame pulled from the video (and minOffset, to set where that comes from). Use showStaticOff to revert to the static image on hover-off. duration is how long each frame will last. If you view source, you'll notice that the element you pass in can be arbitrarily styled and can contain arbitrary elements inside it (in this example, we added a play button with an anchor).</p>
<div id="thumbImg">
<a href="#" class="playBtn">Play</a>
</div>
<br /><br />
<div id="thumbImg2">
<a href="#" class="playBtn">Play</a>
</div>
<br /><br />
<div id="thumbImg3">
<a href="#" class="playBtn">Play</a>
</div>
</body>
</html>