-
Notifications
You must be signed in to change notification settings - Fork 7.4k
/
debug.html.example
109 lines (95 loc) · 2.69 KB
/
debug.html.example
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Video.js Sandbox</title>
<style type="text/css">
#intro {
width: 938px;
background-color: #eee;
border: 1px solid #777;
padding: 0 10px;
margin-bottom: 20px;
line-height: 1.5em;
}
#source-form {
width: 938px;
padding: 10px 10px 0;
border: 1px solid #777;
margin: 0 0 20px;
}
#source-form > div {
margin: 0 0 12px;
overflow: hidden;
}
#source-form label {
float: left;
width: 200px;
}
#source-form input[type="text"],
#source-form select {
float: left;
}
#source-form input[type="text"] {
width: 700px;
}
</style>
<link href="../dist/video-js.css" rel="stylesheet" type="text/css">
<script src="../dist/alt/video.debug.js"></script>
</head>
<body>
<div id="intro">
<p>You can use /sandbox/ for writing and testing your own code. Nothing in /sandbox/ will get checked into the repo, except files that end in .example (so don't edit or add those files). To get started run `npm start` and open the index.html</p>
<pre>npm start</pre>
<pre>open http://localhost:9999/sandbox/debug.html</pre>
</div>
<form id="source-form">
<div>
<label for="source">Set Media Source URL</label>
<input type="text" id="source" value="https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8">
</div>
<div>
<label for="source-type">Set Media Source Type</label>
<select id="source-type">
<option value="">None</option>
<option value="video/mp4">MP4 (video/mp4)</option>
<option selected value="application/x-mpegurl">HLS (application/x-mpegurl)</option>
<option value="application/dash+xml">DASH (application/dash+xml)</option>
</select>
</div>
<div>
<button type="submit">Set</button>
</div>
</form>
<video-js
id="debug"
controls
preload="auto"
width="960"
height="396">
</video-js>
<script>
const vid = document.getElementById('debug');
const player = videojs(vid);
const form = document.getElementById('source-form');
const sourceField = document.getElementById('source');
const sourceTypeField = document.getElementById('source-type');
const setSource = () => {
const source = {
src: sourceField.value,
type: sourceTypeField.value
};
if (!source.type) {
delete source.type;
}
player.log('setting source', source);
player.src(source);
};
form.addEventListener('submit', (e) => {
e.preventDefault();
setSource();
});
setSource();
</script>
</body>
</html>