-
Notifications
You must be signed in to change notification settings - Fork 54
/
index.html
48 lines (42 loc) · 1.23 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>mpd-parser Demo</title>
</head>
<body>
<p>Open dev tools to try it out</p>
<ul>
<li><a href="test/debug.html">Run unit tests in browser.</a></li>
<li><a href="docs/api/">Read generated docs.</a></li>
</ul>
<form id=parse>
<label>
Video URL:
<input id=url type=url value="http://dash.edgesuite.net/akamai/bbb_30fps/bbb_30fps.mpd">
</label>
<button type=submit>Parse</button>
</form>
<script src="dist/mpd-parser.js"></script>
<script>
(function(window, mpdParser) {
var parseForm = document.getElementById('parse');
var url = document.getElementById('url');
parseForm.addEventListener('submit', function(event) {
event.preventDefault();
fetch(url.value)
.then(function(response) {
return response.text();
}).then(function(body) {
console.log('Original ->');
console.log(body);
var parsedMpd = mpdParser.parse(body, {});
console.log('Parsed ->');
console.log(parsedMpd);
}).catch(error => console.error(error));
return false;
});
}(window, window.mpdParser));
</script>
</body>
</html>