forked from shaka-project/shaka-player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupport.html
110 lines (86 loc) · 3.51 KB
/
support.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
<!DOCTYPE html>
<!--
Copyright 2014 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<script>
var found = [];
found.push(navigator.userAgent);
var media = window.HTMLMediaElement;
media && found.push('HTMLMediaElement');
window.MediaSource && found.push('MediaSource');
window.WebKitMediaSource && found.push('WebKitMediaSource');
var ms = window.MediaSource || window.WebKitMediaSource;
window.VTTCue && found.push('VTT');
var webmType = 'video/webm; codecs="vp8"';
var webm = ms && ms.isTypeSupported(webmType);
webm && found.push('WebM');
var mp4Type = 'video/mp4; codecs="avc1.42E01E"';
var mp4 = ms && ms.isTypeSupported(mp4Type);
mp4 && found.push('MP4');
var tsType = 'video/mp2t; codecs="avc1.42E01E"';
var ts = ms && ms.isTypeSupported(tsType);
ts && found.push('TS');
var promise = window.Promise;
promise && found.push('Promise');
var prefixed = window.HTMLMediaElement && HTMLMediaElement.prototype &&
HTMLMediaElement.prototype.webkitGenerateKeyRequest;
prefixed && found.push('prefixed EME');
window.MediaKeys && found.push('MediaKeys');
window.MSMediaKeys && found.push('MSMediaKeys');
window.WebKitMediaKeys && found.push('WebKitMediaKeys');
var mk = window.MediaKeys || window.MSMediaKeys || window.WebKitMediaKeys;
var v = document.createElement('video');
var bogusKs = 'com.bogus.keysystem';
function isKeySystemSupported(ks) {
return mk ? mk.isTypeSupported(ks) :
v.canPlayType(webmType, ks) ||
v.canPlayType(mp4Type, ks) ||
v.canPlayType(tsType, ks);
}
if (isKeySystemSupported(bogusKs)) {
// Clearly the browser doesn't understand two arguments to canPlayType.
// Don't trust any results from it.
isKeySystemSupported = function() { return false; };
}
window.MediaKeySession && found.push('MediaKeySession');
window.MSMediaKeySession && found.push('MSMediaKeySession');
window.WebKitMediaKeySession && found.push('WebKitMediaKeySession');
var promise_mk = mk && mk.create;
promise_mk && found.push('Promise-based MediaKeys');
var clearkey = isKeySystemSupported('org.w3.clearkey') ||
isKeySystemSupported('webkit-org.w3.clearkey');
clearkey && found.push('Clear Key');
var widevine = isKeySystemSupported('com.widevine.alpha');
widevine && found.push('Widevine');
var playready = isKeySystemSupported('com.microsoft.playready');
playready && found.push('PlayReady');
var adobe = isKeySystemSupported('com.adobe.access');
adobe && found.push('Adobe Access');
var fairplay = isKeySystemSupported('com.apple.fairplay');
fairplay && found.push('FairPlay');
var pass = media && ms && (webm || mp4) && promise &&
(prefixed || mk) && widevine;
pass && found.push('<font color="green">PASS</font>');
pass || found.push('<font color="red">FAIL</font>');
var no_polyfill = pass && promise_mk;
no_polyfill && found.push('<font color="green">NO POLYFILL!</font>');
document.addEventListener('DOMContentLoaded', function() {
document.body.innerHTML += '<H1>' + found.join('<br>\n') + '</H1>';
});
</script>
</head>
<body>
Testing support... found:
</body>
</html>