Skip to content

Commit 83604c3

Browse files
authored
chore: Move eme-encryption-scheme-polyfill to the Shaka Player repo (#8818)
We want to apply several optimizations to MCap and Shaka management, which makes everything easier if the code is in this repo.
1 parent f056c8c commit 83604c3

19 files changed

+808
-74
lines changed

build/types/polyfill

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Polyfills used to emulate missing browsers features.
22

3-
+../../node_modules/eme-encryption-scheme-polyfill/index.js
4-
+../../lib/polyfill/encryption_scheme.js
3+
+../../lib/polyfill/eme_encryption_scheme.js
4+
+../../lib/polyfill/encryption_scheme_media_key_system_access.js
5+
+../../lib/polyfill/encryption_scheme_utils.js
6+
+../../lib/polyfill/mcap_encryption_scheme.js
57
+../../lib/polyfill/mediasource.js
68
+../../lib/polyfill/media_capabilities.js
79
+../../lib/polyfill/patchedmediakeys_cert.js

demo/cast_receiver/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
// Bootstrap the Shaka Player library through the Closure library.
4848
'../../node_modules/google-closure-library/closure/goog/base.js',
4949
'../../dist/deps.js',
50-
// Compiled into Shaka Player, but outside of the Closure deps system.
51-
'../../node_modules/eme-encryption-scheme-polyfill/index.js',
5250
// This file contains goog.require calls for all exported library classes.
5351
'../../shaka-player.uncompiled.js',
5452
// These are the individual parts of the receiver app.

demo/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@
7777
'../dist/deps.js',
7878
// This is required for goog.asserts.
7979
'../lib/debug/asserts.js',
80-
// Compiled into Shaka Player, but outside of the Closure deps system.
81-
'../node_modules/eme-encryption-scheme-polyfill/index.js',
8280
// This file contains goog.require calls for all exported library classes.
8381
'../shaka-player.uncompiled.js',
8482
// Enable less, the CSS pre-processor.

externs/polyfill.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@
1313

1414
/** @type {string} */
1515
window.shakaMediaKeysPolyfill;
16+
17+
18+
/** @type {boolean} */
19+
navigator.emeEncryptionSchemePolyfilled;
20+
21+
22+
/** @type {boolean} */
23+
navigator.mediaCapabilitiesEncryptionSchemePolyfilled;

karma.conf.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,6 @@ module.exports = (config) => {
218218
},
219219
'node_modules/lcevc_dec.js/dist/lcevc_dec.min.js',
220220

221-
// EME encryption scheme polyfill, compiled into Shaka Player, but outside
222-
// of the Closure deps system, so not in shaka-player.uncompiled.js. This
223-
// is specifically the compiled, minified, cross-browser build of it. It
224-
// is necessary to use the compiled version to avoid problems on older
225-
// TVs.
226-
// eslint-disable-next-line @stylistic/max-len
227-
'node_modules/eme-encryption-scheme-polyfill/dist/eme-encryption-scheme-polyfill.js',
228-
229221
// load closure base, the deps tree, and the uncompiled library
230222
'test/test/closure-boot.js',
231223
'node_modules/google-closure-library/closure/goog/base.js',

lib/device/abstract_device.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,13 @@ shaka.device.AbstractDevice = class {
307307
return false;
308308
}
309309

310+
/**
311+
* @override
312+
*/
313+
supportsCbcsWithoutEncryptionSchemeSupport() {
314+
return false;
315+
}
316+
310317
/**
311318
* @override
312319
*/

lib/device/chromecast.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ shaka.device.Chromecast = class extends shaka.device.AbstractDevice {
161161
return false;
162162
}
163163

164+
/**
165+
* @override
166+
*/
167+
supportsCbcsWithoutEncryptionSchemeSupport() {
168+
return true;
169+
}
170+
164171
/**
165172
* Check if the current platform is Vizio TV.
166173
* @return {boolean}

lib/device/default_browser.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,18 @@ shaka.device.DefaultBrowser = class extends shaka.device.AbstractDevice {
175175
return this.isWindows_.value() &&
176176
this.getBrowserEngine() === shaka.device.IDevice.BrowserEngine.GECKO;
177177
}
178+
179+
/**
180+
* @override
181+
*/
182+
supportsCbcsWithoutEncryptionSchemeSupport() {
183+
if (this.getBrowserEngine() === shaka.device.IDevice.BrowserEngine.GECKO) {
184+
const version = this.getVersion();
185+
return version !== null ?
186+
version >= 100 : super.supportsCbcsWithoutEncryptionSchemeSupport();
187+
}
188+
return super.supportsCbcsWithoutEncryptionSchemeSupport();
189+
}
178190
};
179191

180192
shaka.device.DeviceFactory.registerDefaultDeviceFactory(

lib/device/i_device.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ shaka.device.IDevice = class {
224224
* @return {boolean}
225225
*/
226226
disableHEVCSupport() {}
227+
228+
/**
229+
* @return {boolean}
230+
*/
231+
supportsCbcsWithoutEncryptionSchemeSupport() {}
227232
};
228233

229234
/**

lib/device/webos.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ shaka.device.WebOS = class extends shaka.device.AbstractDevice {
205205
return false;
206206
}
207207

208+
/**
209+
* @override
210+
*/
211+
supportsCbcsWithoutEncryptionSchemeSupport() {
212+
const version = this.getVersion();
213+
return version !== null ?
214+
version >= 6 : super.supportsCbcsWithoutEncryptionSchemeSupport();
215+
}
216+
208217
/**
209218
* @return {boolean}
210219
* @private

0 commit comments

Comments
 (0)