Source: lib/polyfill/encryption_scheme.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.polyfill.EncryptionScheme');
  7. goog.require('shaka.polyfill');
  8. goog.require('shaka.util.Platform');
  9. /**
  10. * @summary A polyfill to add support for EncryptionScheme queries in EME.
  11. * @see https://wicg.github.io/encrypted-media-encryption-scheme/
  12. * @see https://github.com/w3c/encrypted-media/pull/457
  13. * @see https://github.com/shaka-project/eme-encryption-scheme-polyfill
  14. * @export
  15. */
  16. shaka.polyfill.EncryptionScheme = class {
  17. /**
  18. * Install the polyfill if needed.
  19. *
  20. * @suppress {missingRequire}
  21. * @export
  22. */
  23. static install() {
  24. // Skip polyfill for PlayStation 4 and SkyQ devices due to known crashes
  25. // caused by unsupported encryptionScheme handling. These platforms do not
  26. // require the polyfill, and forcing encryptionScheme processing can result
  27. // in playback crashes.
  28. if (shaka.util.Platform.isPS4() || shaka.util.Platform.isSkyQ()) {
  29. return;
  30. }
  31. EncryptionSchemePolyfills.install();
  32. }
  33. };
  34. // Install at a low priority so that other EME polyfills go first.
  35. shaka.polyfill.register(shaka.polyfill.EncryptionScheme.install, -2);