-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideo.html
More file actions
88 lines (77 loc) · 2.6 KB
/
video.html
File metadata and controls
88 lines (77 loc) · 2.6 KB
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
82
83
84
85
86
<html>
<video id="video" preload="auto" tabindex="0" controls="" type="video/mp4" width="80%" playsinline>
<source type="video/mp4" src="http://thenewcode.com/assets/videos/glacier.mp4">
Sorry, your browser does not support HTML5 audio.
</video>
<ul id="playlist">
<li class="active"><a href="http://thenewcode.com/assets/videos/glacier.mp4">Glacier</a></li>
<li><a href="http://thenewcode.com/assets/videos/lake.mp4">Lake</a></li>
<li><a href="http://thenewcode.com/assets/videos/mountain.mp4">Mountain</a></li>
</ul>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script>
var audio;
var playlist;
var tracks;
var current;
var height;
init();
function init(){
current = 0;
audio = $('video');
playlist = $('#playlist');
tracks = playlist.find('li a');
len = tracks.length - 1;
playlist.find('a').click(function(e){
e.preventDefault();
link = $(this);
current = link.parent().index();
run(link, audio[0]);
});
audio[0].addEventListener('ended',function(e){
height = $(audio).height();
current++;
if(current == len){
current = 0;
link = playlist.find('a')[0];
}else{
link = playlist.find('a')[current];
}
run($(link),audio[0]);
});
}
function run(link, player){
player.src = link.attr('href');
par = link.parent();
par.addClass('active').siblings().removeClass('active');
if (height && height > 0)
$(audio).height(height);
audio[0].load();
audio[0].play();
}
</script>
<html>
<!--
<figure id="video_player">
<div id="video_container">
<video controls poster="http://thenewcode.com/assets/images/vid-glacier.jpg" playsinline>
<source src="http://thenewcode.com/assets/videos/glacier.mp4" type="video/mp4">
<source src="http://thenewcode.com/assets/videos/glacier.webm" type="video/webm">
</video>
</div>
<figcaption>
<a href="http://thenewcode.com/assets/videos/glacier.mp4" class="currentvid">
<img src="http://thenewcode.com/assets/images/vid-glacier.jpg" alt="Athabasca Glacier">
</a>
<a href="http://thenewcode.com/assets/videos/lake.mp4">
<img src="http://thenewcode.com/assets/images/vid-lake.jpg" alt="Athabasca Lake">
</a>
<a href="http://thenewcode.com/assets/videos/mountain.mp4">
<img src="http://thenewcode.com/assets/images/vid-mountain.jpg" alt="Mountain">
</a>
</figcaption>
</figure>
// -->