-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.html
119 lines (95 loc) · 2.79 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
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
110
111
112
113
114
115
116
117
118
119
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>VideoJS Fairplay Tech</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<style>
fieldset
{
margin-bottom: 20px;
}
label
{
display: block;
}
input
{
box-sizing: border-box;
margin-bottom: 5px;
padding: 5px;
width: 100%;
}
button
{
margin: 0;
margin-top: 20px;
padding: 8px 12px;
}
</style>
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
</head>
<body>
<fieldset>
<legend>
Fairplay
</legend>
<form onSubmit="play(event)">
<div>
<label>Certificate</label>
<input type="text" name="certificate_url" onblur="onBlur(event);" />
</div>
<div>
<label>Source</label>
<input type="text" name="source_url" onblur="onBlur(event);" />
</div>
<div>
<label>License</label>
<input type="text" name="license_url" onblur="onBlur(event);" />
</div>
<div>
<button type="submit">Submit</button>
</div>
</form>
</fieldset>
<video id="player" class="video-js vjs-default-skin vjs-big-play-centered" height="250" width="600" autoplay controls>
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
<script src="node_modules/video.js/dist/video.js"></script>
<script src="videojs.fairplay.js"></script>
<script>
function onBlur(event) {
localStorage.setItem(event.target.name, event.target.value);
}
function play(event) {
event.preventDefault();
videojs.Html5Fairplay.setLogToBrowserConsole(true);
// initialize the plugin
videojs('player').ready(function() {
this.src([{
src: sourceUrl.value,
type: 'application/x-mpegURL',
protection: {
keySystem: 'com.apple.fps.1_0',
certificateUrl: certificateUrl.value,
licenseUrl: licenseUrl.value,
},
}]);
});
}
var certificateUrl = document.getElementsByName('certificate_url')[0];
certificateUrl.value = localStorage.getItem('certificate_url');
var sourceUrl = document.getElementsByName('source_url')[0];
sourceUrl.value = localStorage.getItem('source_url');
var licenseUrl = document.getElementsByName('license_url')[0];
licenseUrl.value = localStorage.getItem('license_url');
</script>
</body>
</html>