-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
54 lines (47 loc) · 1.3 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test swap</title>
<style>
#play_button {
display: block;
}
</style>
</head>
<body>
<video id="vid1" width="320" height="240" controls>
<source src="http://vendri.com/test/assets/big_buck_bunny.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<video id="vid2" width="320" height="240" webkit-playsinline controls>
<source src="" type="video/mp4">
Your browser does not support the video tag.
</video>
<button id="play_button">PLAY</button>
<script>
var button, vid1, vid2, vid2src;
button = document.getElementById("play_button");
vid1 = document.getElementById("vid1");
vid2 = document.getElementById("vid2");
vid2src = 'http://techslides.com/demos/sample-videos/small.mp4';
function playAd(){
vid1.pause();
vid2.src = vid2src;
vid2.play();
vid2.onended = function() {
vid1.play();
};
}
function runTest() {
vid2.play(); // give gesture permission on touch devices
vid2.pause();
vid1.play(); // begin content video
setTimeout(playAd, 5000); // schedule an ad for 3 seconds in future
}
button.onclick = function clicker() {
runTest();
};
</script>
</body>
</html>