-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
145 lines (129 loc) · 6.07 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Browser UA, MSE/MMS/EME, HDCP and InsertableStreams/RTCRtpScriptTransform tests">
<title>Browser API Tests</title>
<link rel="icon" type="image/x-icon" href="./favicon.ico">
<style>
body {
font-family: monospace;
}
</style>
<script>
async function maxHdcpVersion() {
let hdcpVersion = 'N/A';
const config = [{
videoCapabilities: [{
contentType: 'video/mp4; codecs="avc1.640032"',
robustness: 'SW_SECURE_DECODE'
}]
}];
const hdcpVersions = ['1.0', '1.1', '1.2', '1.3', '1.4', '2.0', '2.1', '2.2', '2.3'];
try {
const mksa = await navigator.requestMediaKeySystemAccess('com.widevine.alpha', config);
const mk = await mksa.createMediaKeys();
for (let i = 0; i < hdcpVersions.length; ++i) {
const version = hdcpVersions[i];
const status = await mk.getStatusForPolicy({minHdcpVersion: version});
if (status === 'usable')
hdcpVersion = version;
}
}
catch (e) {
}
return hdcpVersion;
}
async function supportsFairPlayStreaming() {
let fpsAvailable = false;
try {
const a = await navigator.requestMediaKeySystemAccess('com.apple.fps', [{
initDataTypes: ['sinf'],
videoCapabilities: [{contentType: 'video/mp4', robustness: ''}],
distinctiveIdentifier: 'not-allowed',
persistentState: 'not-allowed',
sessionTypes: ['temporary']
}]);
fpsAvailable = true;
}
catch(e) {}
return fpsAvailable;
}
async function checkKsrPair(keySystem, robustness) {
let available = false;
try {
const a = await navigator.requestMediaKeySystemAccess(keySystem, [{
initDataTypes: ['cenc'],
videoCapabilities:[{contentType:'video/mp4; codecs="avc1.42E01E"', robustness}]
}]);
available = true;
}
catch(e) {}
return available;
}
async function supportsCenc(system, hw) {
let keySystem, robustness;
if (system === 'WV') {
keySystem = 'com.widevine.alpha';
robustness = hw ? 'HW_SECURE_ALL' : 'SW_SECURE_CRYPTO';
}
else if (system === 'PR') {
keySystem = 'com.microsoft.playready.recommendation';
robustness = hw ? '3000' : '2000';
}
else if (system === 'CK') {
keySystem = 'org.w3.clearkey';
}
let available = await checkKsrPair(keySystem, robustness);
if (!available && system === 'WV' && hw)
available = await checkKsrPair(keySystem + '.experiment', robustness);
return available;
}
window.onload = async function() {
document.getElementById('userAgent').textContent = window?.navigator?.userAgent;
document.getElementById('platform').textContent = window?.navigator?.userAgentData?.platform || window?.navigator?.platform;
let hasEnoughAPIs = !!window.RTCRtpScriptTransform;
if (!hasEnoughAPIs) {
const supportsInsertableStreams = !!RTCRtpSender.prototype.createEncodedStreams;
let supportsTransferableStreams = false;
try {
const stream = new ReadableStream();
window.postMessage(stream, '*', [stream]);
supportsTransferableStreams = true;
}
catch (e) {
console.error('Transferable streams are not supported.');
}
hasEnoughAPIs = supportsInsertableStreams && supportsTransferableStreams;
}
let encTransSupport = hasEnoughAPIs ? 'Yes' : 'No';
if (hasEnoughAPIs)
encTransSupport += ' (' + (!!window.RTCRtpScriptTransform ? 'RTCRtpScriptTransform' : 'InsertableStreams') + ')';
document.getElementById('etSupport').textContent = encTransSupport;
document.getElementById('mmsSupport').textContent = !window.ManagedMediaSource ? 'No' : 'Yes';
document.getElementById('hdcpVersion').textContent = await maxHdcpVersion();
document.getElementById('wvL3Support').textContent = (await supportsCenc('WV', false)) ? 'Yes' : 'No';
document.getElementById('wvL1Support').textContent = (await supportsCenc('WV', true)) ? 'Yes' : 'No';
document.getElementById('pr2000Support').textContent = (await supportsCenc('PR', false)) ? 'Yes' : 'No';
document.getElementById('pr3000Support').textContent = (await supportsCenc('PR', true)) ? 'Yes' : 'No';
document.getElementById('fpsSupport').textContent = (await supportsFairPlayStreaming()) ? 'Yes' : 'No';
}
</script>
</head>
<body>
<p>User Agent: <span id="userAgent"></span></p>
<p>Platform: <span id="platform"></span></p>
<p>Encoded Transform supported: <span id="etSupport"></span></p>
<p>Managed Media Source supported: <span id="mmsSupport"></span></p>
<p>HDCP version: <span id="hdcpVersion"></span></p>
<p>
Widevine (L3): <span id="wvL3Support"></span><br>
Widevine (L1): <span id="wvL1Support"></span><br>
PlayReady (2000): <span id="pr2000Support"></span><br>
PlayReady (3000): <span id="pr3000Support"></span><br>
FairPlay Streaming: <span id="fpsSupport"></span><br>
</p>
<p><a href="https://googlechrome.github.io/samples/hdcp-detection/">HDCP tests</></p>
<p><a href="https://research.akamaized.net/capabilitiescheck.html">Akamai</></p>
</body>
</html>