diff --git a/lib/media/manifest_filterer.js b/lib/media/manifest_filterer.js index 6cc1a3ca46..a5e3135e13 100644 --- a/lib/media/manifest_filterer.js +++ b/lib/media/manifest_filterer.js @@ -59,7 +59,8 @@ shaka.media.ManifestFilterer = class { */ async filterManifestWithStreamUtils_(manifest) { goog.asserts.assert(manifest, 'Manifest should exist!'); - await shaka.util.StreamUtils.filterManifest(this.drmEngine_, manifest); + await shaka.util.StreamUtils.filterManifest(this.drmEngine_, manifest, + this.config_.drm.preferredKeySystems); this.checkPlayableVariants_(manifest); } diff --git a/lib/offline/storage.js b/lib/offline/storage.js index 0235e595c7..aee97a554a 100644 --- a/lib/offline/storage.js +++ b/lib/offline/storage.js @@ -664,7 +664,8 @@ shaka.offline.Storage = class { // Filter the manifest based on what we know MediaCapabilities will be able // to play later (no point storing something we can't play). await shaka.util.StreamUtils.filterManifestByMediaCapabilities( - drmEngine, manifest, config.offline.usePersistentLicense); + drmEngine, manifest, config.offline.usePersistentLicense, + config.drm.preferredKeySystems); // Gather all tracks. const allTracks = []; diff --git a/lib/util/stream_utils.js b/lib/util/stream_utils.js index 6ce87fb624..9cc8b1799d 100644 --- a/lib/util/stream_utils.js +++ b/lib/util/stream_utils.js @@ -337,10 +337,12 @@ shaka.util.StreamUtils = class { * * @param {shaka.media.DrmEngine} drmEngine * @param {shaka.extern.Manifest} manifest + * @param {!Array=} preferredKeySystems */ - static async filterManifest(drmEngine, manifest) { + static async filterManifest(drmEngine, manifest, preferredKeySystems = []) { await shaka.util.StreamUtils.filterManifestByMediaCapabilities( - drmEngine, manifest, manifest.offlineSessionIds.length > 0); + drmEngine, manifest, manifest.offlineSessionIds.length > 0, + preferredKeySystems); shaka.util.StreamUtils.filterTextStreams_(manifest); await shaka.util.StreamUtils.filterImageStreams_(manifest); } @@ -353,15 +355,16 @@ shaka.util.StreamUtils = class { * @param {shaka.media.DrmEngine} drmEngine * @param {shaka.extern.Manifest} manifest * @param {boolean} usePersistentLicenses + * @param {!Array} preferredKeySystems */ static async filterManifestByMediaCapabilities( - drmEngine, manifest, usePersistentLicenses) { + drmEngine, manifest, usePersistentLicenses, preferredKeySystems) { goog.asserts.assert(navigator.mediaCapabilities, 'MediaCapabilities should be valid.'); await shaka.util.StreamUtils.getDecodingInfosForVariants( manifest.variants, usePersistentLicenses, /* srcEquals= */ false, - /** preferredKeySystems= */ []); + preferredKeySystems); let keySystem = null; if (drmEngine) {