diff --git a/externs/mediakeys.js b/externs/mediakeys.js index 4f90494fad..ecdb3ae467 100644 --- a/externs/mediakeys.js +++ b/externs/mediakeys.js @@ -23,6 +23,20 @@ */ +/** + * @typedef {string} + * 'optional', 'required', 'not-allowed' + */ +var MediaKeysRequirement; + + +/** + * @typedef {string} + * 'temporary', 'persistent-license', 'persistent-usage-record' + */ +var MediaKeySessionType; + + /** * @typedef {{contentType: string, robustness: string}} * gjslint: disable=900 @@ -35,9 +49,9 @@ var MediaKeySystemMediaCapability; * initDataTypes: (Array.|undefined), * audioCapabilities: (Array.|undefined), * videoCapabilities: (Array.|undefined), - * distinctiveIdentifier: (string|undefined), - * persistentState: (string|undefined), - * sessionTypes: (Array.|undefined) + * distinctiveIdentifier: (MediaKeysRequirement|undefined), + * persistentState: (MediaKeysRequirement|undefined), + * sessionTypes: (Array.|undefined) * }} * gjslint: disable=900 */ @@ -87,7 +101,7 @@ function MediaKeys() {} /** - * @param {string=} opt_sessionType defaults to "temporary" + * @param {MediaKeySessionType=} opt_sessionType defaults to "temporary" * @return {!MediaKeySession} * @throws {TypeError} if opt_sessionType is invalid. */ diff --git a/externs/shaka/manifest.js b/externs/shaka/manifest.js index f2d27b805c..9b338e821c 100644 --- a/externs/shaka/manifest.js +++ b/externs/shaka/manifest.js @@ -102,11 +102,80 @@ shakaExtern.Manifest; shakaExtern.Period; +/** + * @typedef {{ + * initData: !Uint8Array, + * initDataType: string + * }} + * + * @description + * Explicit initialization data, which override any initialization data in the + * content. The initDataType values and the formats that they correspond to + * are specified {@link http://goo.gl/hKBdff here}. + * + * @property {!Uint8Array} initData + * Initialization data in the format indicated by initDataType. + * @property {string} initDataType + * A string to indicate what format initData is in. + * + * @exportDoc + */ +shakaExtern.InitDataOverride; + + +/** + * @typedef {{ + * keySystem: string, + * licenseServerUri: string, + * distinctiveIdentifierRequired: boolean, + * persistentStateRequired: boolean, + * robustness: string, + * serverCertificate: Uint8Array, + * initData: Array. + * }} + * + * @description + * DRM configuration for a single key system. + * + * @property {string} keySystem + * Required.
+ * The key system, e.g., "com.widevine.alpha". + * @property {string} licenseServerUri + * Required.
+ * The license server URI. + * @property {boolean} distinctiveIdentifierRequired + * Defaults to false.
+ * True if the application requires the key system to support distinctive + * identifiers. + * @property {boolean} persistentStateRequired + * Defaults to false.
+ * True if the application requires the key system to support persistent + * state, e.g., for persistent license storage. + * @property {string} robustness + * A key-system-specific string that specifies a required security level. + * Defaults to '', e.g., no specific robustness required.
+ * @property {Uint8Array} serverCertificate + * Defaults to null, e.g., certificate will be requested from the license + * server if required.
+ * A key-system-specific server certificate used to encrypt license requests. + * Its use is optional and is meant as an optimization to avoid a round-trip + * to request a certificate. + * @property {Array.} initData + * Defaults to [], e.g., no override.
+ * A list of initialization data which override any initialization data found + * in the content. See also shakaExtern.InitDataOverride. + * + * @exportDoc + */ +shakaExtern.DrmInfo; + + /** * @typedef {{ * language: string, * type: string, * primary: boolean, + * drmInfos: Array., * streams: !Array. * }} * @@ -129,6 +198,10 @@ shakaExtern.Period; * the same type in the same Period. However, the player may use another * StreamSet to meet application preferences, or to achieve better MIME type * or DRM compatibility among other StreamSets. + * @property {Array.} drmInfos + * Defaults to [] (i.e., no DRM).
+ * An array of DrmInfo objects which describe DRM schemes are compatible with + * the content. * @property {!Array.} streams * Required.
* The StreamSets's Streams. There must be at least one Stream. diff --git a/lib/dash/dash_parser.js b/lib/dash/dash_parser.js index ae39a8e63d..400b4efcd3 100644 --- a/lib/dash/dash_parser.js +++ b/lib/dash/dash_parser.js @@ -813,6 +813,7 @@ shaka.dash.DashParser.prototype.createStreamSets_ = function(adaptationSets) { language: lang, type: type, primary: sets.some(function(s) { return s.main; }), + drmInfos: [], // TODO streams: sets.map(function(s) { return s.streams; }) .reduce(function(all, part) { return all.concat(part); }, []) diff --git a/spec/dash_parser_manifest_spec.js b/spec/dash_parser_manifest_spec.js index 778e6eef24..ba537c350e 100644 --- a/spec/dash_parser_manifest_spec.js +++ b/spec/dash_parser_manifest_spec.js @@ -144,6 +144,7 @@ describe('DashParser.Manifest', function() { language: 'en', type: 'video', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({ id: 1, @@ -179,6 +180,7 @@ describe('DashParser.Manifest', function() { language: 'es', type: 'text', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({ id: 3, @@ -199,6 +201,7 @@ describe('DashParser.Manifest', function() { language: '', type: 'audio', primary: true, + drmInfos: [], streams: [ jasmine.objectContaining({ id: 4, @@ -241,6 +244,7 @@ describe('DashParser.Manifest', function() { language: 'en', type: 'video', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({bandwidth: 100}), jasmine.objectContaining({bandwidth: 200}) @@ -271,6 +275,7 @@ describe('DashParser.Manifest', function() { language: 'en', type: 'video', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({bandwidth: 100}) ] @@ -279,6 +284,7 @@ describe('DashParser.Manifest', function() { language: 'en', type: 'video', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({bandwidth: 200}) ] @@ -308,6 +314,7 @@ describe('DashParser.Manifest', function() { language: 'en', type: 'video', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({bandwidth: 100}) ] @@ -316,6 +323,7 @@ describe('DashParser.Manifest', function() { language: 'es', type: 'video', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({bandwidth: 200}) ] @@ -345,6 +353,7 @@ describe('DashParser.Manifest', function() { language: 'en', type: 'video', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({bandwidth: 100}) ] @@ -353,6 +362,7 @@ describe('DashParser.Manifest', function() { language: 'en', type: 'audio', primary: false, + drmInfos: [], streams: [ jasmine.objectContaining({bandwidth: 200}) ]