shaka-player 4.12.8 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -0
- package/CONTRIBUTORS +4 -0
- package/README.md +22 -21
- package/cspell.config.yaml +18 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +29 -24
- package/dist/locales.js +33 -33
- package/dist/shaka-player.compiled.d.ts +138 -36
- package/dist/shaka-player.compiled.debug.d.ts +138 -36
- package/dist/shaka-player.compiled.debug.externs.js +367 -107
- package/dist/shaka-player.compiled.debug.js +828 -765
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +367 -107
- package/dist/shaka-player.compiled.js +1451 -1416
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +172 -38
- package/dist/shaka-player.ui.debug.d.ts +172 -38
- package/dist/shaka-player.ui.debug.externs.js +406 -113
- package/dist/shaka-player.ui.debug.js +842 -766
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +406 -113
- package/dist/shaka-player.ui.js +1670 -1628
- package/dist/shaka-player.ui.map +4 -4
- package/eslint.config.mjs +343 -0
- package/externs/airplay.js +1 -1
- package/externs/audiotrack.js +1 -1
- package/externs/awesomplete.js +1 -1
- package/externs/cast-sdk-v2.js +2 -2
- package/externs/cmcd.js +16 -1
- package/externs/device_sensor_event.js +1 -1
- package/externs/ima.js +8 -8
- package/externs/isoboxer.js +31 -31
- package/externs/jwk_set.js +1 -1
- package/externs/lcevc.js +8 -8
- package/externs/mediakeys.js +1 -1
- package/externs/mediasession.js +3 -2
- package/externs/mediatailor.js +18 -18
- package/externs/pictureinpicture.js +41 -1
- package/externs/playstation.js +2 -2
- package/externs/prefixed_eme.js +1 -1
- package/externs/shaka/abortable.js +4 -4
- package/externs/shaka/abr_manager.js +1 -1
- package/externs/shaka/ads.js +45 -6
- package/externs/shaka/cea.js +2 -2
- package/externs/shaka/codecs.js +4 -4
- package/externs/shaka/drm_info.js +6 -6
- package/externs/shaka/error.js +5 -5
- package/externs/shaka/manifest.js +51 -56
- package/externs/shaka/manifest_parser.js +3 -9
- package/externs/shaka/net.js +23 -20
- package/externs/shaka/offline.js +37 -37
- package/externs/shaka/offline_compat_v1.js +10 -10
- package/externs/shaka/offline_compat_v2.js +10 -10
- package/externs/shaka/player.js +139 -109
- package/externs/shaka/text.js +10 -3
- package/externs/shaka/transmuxer.js +1 -1
- package/externs/videotrack.js +1 -1
- package/lib/abr/ewma.js +1 -1
- package/lib/abr/simple_abr_manager.js +70 -22
- package/lib/ads/ad_manager.js +43 -18
- package/lib/ads/ad_utils.js +160 -58
- package/lib/ads/ads_stats.js +1 -1
- package/lib/ads/client_side_ad_manager.js +2 -2
- package/lib/ads/interstitial_ad.js +16 -11
- package/lib/ads/interstitial_ad_manager.js +419 -72
- package/lib/ads/interstitial_static_ad.js +299 -0
- package/lib/ads/media_tailor_ad.js +1 -0
- package/lib/ads/media_tailor_ad_manager.js +37 -36
- package/lib/ads/server_side_ad_manager.js +7 -6
- package/lib/cast/cast_receiver.js +5 -3
- package/lib/cast/cast_sender.js +2 -2
- package/lib/cast/cast_utils.js +20 -13
- package/lib/cea/cea608_data_channel.js +53 -53
- package/lib/cea/cea708_service.js +42 -40
- package/lib/cea/cea708_window.js +5 -2
- package/lib/cea/cea_decoder.js +5 -7
- package/lib/cea/mp4_cea_parser.js +1 -1
- package/lib/cea/sei_processor.js +1 -1
- package/lib/dash/content_protection.js +62 -192
- package/lib/dash/dash_parser.js +119 -119
- package/lib/dash/mpd_utils.js +14 -13
- package/lib/dash/segment_base.js +5 -5
- package/lib/dash/segment_list.js +10 -10
- package/lib/dash/segment_template.js +55 -53
- package/lib/debug/log.js +2 -2
- package/lib/dependencies/all.js +2 -1
- package/lib/{media → drm}/drm_engine.js +274 -143
- package/lib/{util → drm}/drm_utils.js +20 -11
- package/lib/drm/playready.js +233 -0
- package/lib/hls/hls_classes.js +14 -14
- package/lib/hls/hls_parser.js +257 -196
- package/lib/hls/hls_utils.js +14 -14
- package/lib/hls/manifest_text_parser.js +10 -10
- package/lib/media/adaptation_set.js +6 -5
- package/lib/media/adaptation_set_criteria.js +51 -379
- package/lib/media/buffering_observer.js +5 -4
- package/lib/media/closed_caption_parser.js +2 -2
- package/lib/media/content_workarounds.js +2 -2
- package/lib/media/example_based_criteria.js +69 -0
- package/lib/media/gap_jumping_controller.js +14 -1
- package/lib/media/manifest_filterer.js +8 -8
- package/lib/media/manifest_parser.js +2 -2
- package/lib/media/media_source_capabilities.js +20 -1
- package/lib/media/media_source_engine.js +84 -35
- package/lib/media/mp4_segment_index_parser.js +5 -5
- package/lib/media/playhead.js +2 -8
- package/lib/media/playhead_observer.js +1 -1
- package/lib/media/preference_based_criteria.js +333 -0
- package/lib/media/preload_manager.js +53 -37
- package/lib/media/presentation_timeline.js +2 -2
- package/lib/media/quality_observer.js +35 -35
- package/lib/media/region_observer.js +2 -2
- package/lib/media/region_timeline.js +3 -3
- package/lib/media/segment_index.js +14 -14
- package/lib/media/segment_prefetch.js +17 -13
- package/lib/media/segment_reference.js +7 -7
- package/lib/media/segment_utils.js +9 -9
- package/lib/media/streaming_engine.js +77 -38
- package/lib/media/time_ranges_utils.js +1 -1
- package/lib/media/video_wrapper.js +1 -1
- package/lib/media/webm_segment_index_parser.js +4 -4
- package/lib/mss/content_protection.js +17 -222
- package/lib/mss/mss_parser.js +23 -24
- package/lib/net/data_uri_plugin.js +1 -0
- package/lib/net/http_fetch_plugin.js +8 -7
- package/lib/net/http_plugin_utils.js +5 -2
- package/lib/net/http_xhr_plugin.js +4 -3
- package/lib/net/networking_engine.js +72 -17
- package/lib/net/networking_utils.js +5 -2
- package/lib/offline/download_info.js +5 -1
- package/lib/offline/download_manager.js +15 -4
- package/lib/offline/download_progress_estimator.js +1 -1
- package/lib/offline/indexeddb/base_storage_cell.js +9 -9
- package/lib/offline/indexeddb/db_connection.js +1 -1
- package/lib/offline/indexeddb/db_operation.js +2 -2
- package/lib/offline/indexeddb/eme_session_storage_cell.js +1 -1
- package/lib/offline/indexeddb/storage_mechanism.js +1 -1
- package/lib/offline/indexeddb/v1_storage_cell.js +3 -3
- package/lib/offline/indexeddb/v2_storage_cell.js +2 -2
- package/lib/offline/manifest_converter.js +11 -12
- package/lib/offline/offline_scheme.js +8 -4
- package/lib/offline/session_deleter.js +11 -11
- package/lib/offline/storage.js +137 -88
- package/lib/offline/storage_muxer.js +8 -8
- package/lib/offline/stored_content_utils.js +3 -3
- package/lib/offline/stream_bandwidth_estimator.js +1 -1
- package/lib/player.js +291 -207
- package/lib/polyfill/all.js +1 -1
- package/lib/polyfill/media_capabilities.js +5 -5
- package/lib/polyfill/patchedmediakeys_apple.js +6 -6
- package/lib/polyfill/patchedmediakeys_webkit.js +8 -8
- package/lib/polyfill/video_play_promise.js +0 -1
- package/lib/text/cue.js +3 -2
- package/lib/text/lrc_text_parser.js +1 -1
- package/lib/text/mp4_ttml_parser.js +1 -1
- package/lib/text/mp4_vtt_parser.js +3 -3
- package/lib/text/sbv_text_parser.js +1 -1
- package/lib/text/simple_text_displayer.js +37 -10
- package/lib/text/ssa_text_parser.js +3 -1
- package/lib/text/stub_text_displayer.js +12 -5
- package/lib/text/text_engine.js +5 -4
- package/lib/text/text_utils.js +4 -4
- package/lib/text/ttml_text_parser.js +21 -20
- package/lib/text/ui_text_displayer.js +20 -13
- package/lib/text/vtt_text_parser.js +10 -10
- package/lib/text/web_vtt_generator.js +2 -2
- package/lib/transmuxer/aac_transmuxer.js +2 -2
- package/lib/transmuxer/ac3_transmuxer.js +2 -2
- package/lib/transmuxer/adts.js +2 -0
- package/lib/transmuxer/ec3.js +3 -3
- package/lib/transmuxer/ec3_transmuxer.js +2 -2
- package/lib/transmuxer/h264.js +5 -5
- package/lib/transmuxer/h265.js +3 -3
- package/lib/transmuxer/mp3_transmuxer.js +2 -2
- package/lib/transmuxer/mpeg_audio.js +6 -6
- package/lib/transmuxer/mss_transmuxer.js +2 -0
- package/lib/transmuxer/transmuxer_engine.js +1 -1
- package/lib/transmuxer/ts_transmuxer.js +10 -10
- package/lib/util/abortable_operation.js +10 -10
- package/lib/util/array_utils.js +6 -6
- package/lib/util/cmcd_manager.js +149 -18
- package/lib/util/cmsd_manager.js +11 -11
- package/lib/util/config_utils.js +3 -3
- package/lib/util/content_steering_manager.js +17 -17
- package/lib/util/data_view_reader.js +3 -3
- package/lib/util/ebml_parser.js +1 -1
- package/lib/util/error.js +11 -6
- package/lib/util/event_manager.js +1 -1
- package/lib/util/exp_golomb.js +1 -1
- package/lib/util/fairplay_utils.js +6 -1
- package/lib/util/fake_event.js +3 -2
- package/lib/util/fake_event_target.js +1 -1
- package/lib/util/functional.js +8 -8
- package/lib/util/id3_utils.js +1 -1
- package/lib/util/iterables.js +6 -6
- package/lib/util/language_utils.js +17 -17
- package/lib/util/manifest_parser_utils.js +13 -13
- package/lib/util/map_utils.js +6 -6
- package/lib/util/media_ready_state_utils.js +1 -1
- package/lib/util/mime_utils.js +15 -4
- package/lib/util/mp4_box_parsers.js +5 -5
- package/lib/util/mp4_generator.js +31 -30
- package/lib/util/mp4_parser.js +2 -2
- package/lib/util/multi_map.js +5 -5
- package/lib/util/mutex.js +1 -1
- package/lib/util/networking.js +1 -1
- package/lib/util/object_utils.js +5 -1
- package/lib/util/operation_manager.js +1 -1
- package/lib/util/periods.js +24 -24
- package/lib/util/platform.js +8 -4
- package/lib/util/player_configuration.js +50 -17
- package/lib/util/pssh.js +34 -6
- package/lib/util/public_promise.js +2 -2
- package/lib/util/state_history.js +2 -2
- package/lib/util/stream_utils.js +138 -120
- package/lib/util/string_utils.js +4 -3
- package/lib/util/switch_history.js +2 -2
- package/lib/util/tXml.js +22 -17
- package/lib/util/text_parser.js +2 -2
- package/lib/util/timer.js +1 -1
- package/lib/util/ts_parser.js +22 -22
- package/lib/util/xml_utils.js +1 -0
- package/package.json +7 -4
- package/project-words.txt +485 -0
- package/shaka-player.uncompiled.js +1 -1
- package/third_party/closure-uri/uri.js +2 -2
- package/third_party/closure-uri/utils.js +2 -2
- package/third_party/language-mapping-list/language-mapping-list.js +1 -1
- package/ui/ad_statistics_button.js +9 -5
- package/ui/airplay_button.js +1 -0
- package/ui/audio_language_selection.js +2 -1
- package/ui/context_menu.js +2 -2
- package/ui/controls.js +7 -7
- package/ui/externs/ui.js +29 -21
- package/ui/externs/watermark.js +64 -0
- package/ui/fast_forward_button.js +1 -1
- package/ui/gl_matrix/matrix_4x4.js +11 -5
- package/ui/hidden_fast_forward_button.js +1 -1
- package/ui/hidden_seek_button.js +1 -1
- package/ui/language_utils.js +27 -26
- package/ui/less/buttons.less +2 -2
- package/ui/localization.js +21 -21
- package/ui/loop_button.js +2 -2
- package/ui/overflow_menu.js +2 -2
- package/ui/playback_rate_selection.js +1 -1
- package/ui/presentation_time.js +4 -1
- package/ui/range_element.js +2 -2
- package/ui/resolution_selection.js +42 -6
- package/ui/rewind_button.js +1 -1
- package/ui/seek_bar.js +5 -5
- package/ui/statistics_button.js +8 -4
- package/ui/text_selection.js +3 -2
- package/ui/ui.js +32 -2
- package/ui/vr_manager.js +3 -3
- package/ui/vr_utils.js +14 -14
- package/ui/vr_webgl.js +5 -5
- package/ui/watermark.js +313 -0
- package/.eslintignore +0 -4
- package/.eslintrc.js +0 -310
- package/lib/polyfill/patchedmediakeys_nop.js +0 -148
|
@@ -403,7 +403,7 @@ shaka.cea.Mp4CeaParser.BitstreamFormat = {
|
|
|
403
403
|
H266: 3,
|
|
404
404
|
};
|
|
405
405
|
|
|
406
|
-
/** @private {Object
|
|
406
|
+
/** @private {Object<string, shaka.cea.Mp4CeaParser.BitstreamFormat>} */
|
|
407
407
|
shaka.cea.Mp4CeaParser.CodecBitstreamMap_ = {
|
|
408
408
|
// AVC
|
|
409
409
|
'avc1': shaka.cea.Mp4CeaParser.BitstreamFormat.H264,
|
package/lib/cea/sei_processor.js
CHANGED
|
@@ -14,7 +14,7 @@ shaka.cea.SeiProcessor = class {
|
|
|
14
14
|
/**
|
|
15
15
|
* Processes supplemental enhancement information data.
|
|
16
16
|
* @param {!Uint8Array} naluData NALU from which SEI data is to be processed.
|
|
17
|
-
* @return {!Array
|
|
17
|
+
* @return {!Array<!Uint8Array>}
|
|
18
18
|
*/
|
|
19
19
|
process(naluData) {
|
|
20
20
|
const seiPayloads = [];
|
|
@@ -8,7 +8,7 @@ goog.provide('shaka.dash.ContentProtection');
|
|
|
8
8
|
|
|
9
9
|
goog.require('goog.asserts');
|
|
10
10
|
goog.require('shaka.log');
|
|
11
|
-
goog.require('shaka.
|
|
11
|
+
goog.require('shaka.drm.PlayReady');
|
|
12
12
|
goog.require('shaka.util.Error');
|
|
13
13
|
goog.require('shaka.util.ManifestParserUtils');
|
|
14
14
|
goog.require('shaka.util.Platform');
|
|
@@ -26,18 +26,18 @@ shaka.dash.ContentProtection = class {
|
|
|
26
26
|
/**
|
|
27
27
|
* Parses info from the ContentProtection elements at the AdaptationSet level.
|
|
28
28
|
*
|
|
29
|
-
* @param {!Array
|
|
29
|
+
* @param {!Array<!shaka.extern.xml.Node>} elements
|
|
30
30
|
* @param {boolean} ignoreDrmInfo
|
|
31
|
-
* @param {!Object
|
|
31
|
+
* @param {!Object<string, string>} keySystemsByURI
|
|
32
32
|
* @return {shaka.dash.ContentProtection.Context}
|
|
33
33
|
*/
|
|
34
|
-
static parseFromAdaptationSet(
|
|
34
|
+
static parseFromAdaptationSet(elements, ignoreDrmInfo, keySystemsByURI) {
|
|
35
35
|
const ContentProtection = shaka.dash.ContentProtection;
|
|
36
36
|
const ManifestParserUtils = shaka.util.ManifestParserUtils;
|
|
37
|
-
const parsed = ContentProtection.parseElements_(
|
|
38
|
-
/** @type {Array
|
|
37
|
+
const parsed = ContentProtection.parseElements_(elements);
|
|
38
|
+
/** @type {Array<shaka.extern.InitDataOverride>} */
|
|
39
39
|
let defaultInit = null;
|
|
40
|
-
/** @type {!Array
|
|
40
|
+
/** @type {!Array<shaka.extern.DrmInfo>} */
|
|
41
41
|
let drmInfos = [];
|
|
42
42
|
let parsedNonCenc = [];
|
|
43
43
|
/** @type {?shaka.dash.ContentProtection.Aes128Info} */
|
|
@@ -149,17 +149,17 @@ shaka.dash.ContentProtection = class {
|
|
|
149
149
|
* Parses the given ContentProtection elements found at the Representation
|
|
150
150
|
* level. This may update the |context|.
|
|
151
151
|
*
|
|
152
|
-
* @param {!Array
|
|
152
|
+
* @param {!Array<!shaka.extern.xml.Node>} elements
|
|
153
153
|
* @param {shaka.dash.ContentProtection.Context} context
|
|
154
154
|
* @param {boolean} ignoreDrmInfo
|
|
155
|
-
* @param {!Object
|
|
155
|
+
* @param {!Object<string, string>} keySystemsByURI
|
|
156
156
|
* @return {?string} The parsed key ID
|
|
157
157
|
*/
|
|
158
158
|
static parseFromRepresentation(
|
|
159
|
-
|
|
159
|
+
elements, context, ignoreDrmInfo, keySystemsByURI) {
|
|
160
160
|
const ContentProtection = shaka.dash.ContentProtection;
|
|
161
161
|
const repContext = ContentProtection.parseFromAdaptationSet(
|
|
162
|
-
|
|
162
|
+
elements, ignoreDrmInfo, keySystemsByURI);
|
|
163
163
|
|
|
164
164
|
if (context.firstRepresentation) {
|
|
165
165
|
const asUnknown = context.drmInfos.length == 1 &&
|
|
@@ -242,11 +242,11 @@ shaka.dash.ContentProtection = class {
|
|
|
242
242
|
return textContents;
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const msLaUrlNode = shaka.util.TXml.findChildNS(
|
|
246
246
|
element.node, 'urn:microsoft', 'laurl');
|
|
247
|
-
if (
|
|
247
|
+
if (msLaUrlNode) {
|
|
248
248
|
return StringUtils.htmlUnescape(
|
|
249
|
-
|
|
249
|
+
msLaUrlNode.attributes['licenseUrl']) || '';
|
|
250
250
|
}
|
|
251
251
|
return '';
|
|
252
252
|
}
|
|
@@ -285,107 +285,6 @@ shaka.dash.ContentProtection = class {
|
|
|
285
285
|
return '';
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
/**
|
|
289
|
-
* Parses an Array buffer starting at byteOffset for PlayReady Object Records.
|
|
290
|
-
* Each PRO Record is preceded by its PlayReady Record type and length in
|
|
291
|
-
* bytes.
|
|
292
|
-
*
|
|
293
|
-
* PlayReady Object Record format: https://goo.gl/FTcu46
|
|
294
|
-
*
|
|
295
|
-
* @param {!DataView} view
|
|
296
|
-
* @param {number} byteOffset
|
|
297
|
-
* @return {!Array.<shaka.dash.ContentProtection.PlayReadyRecord>}
|
|
298
|
-
* @private
|
|
299
|
-
*/
|
|
300
|
-
static parseMsProRecords_(view, byteOffset) {
|
|
301
|
-
const records = [];
|
|
302
|
-
|
|
303
|
-
while (byteOffset < view.byteLength - 1) {
|
|
304
|
-
const type = view.getUint16(byteOffset, true);
|
|
305
|
-
byteOffset += 2;
|
|
306
|
-
|
|
307
|
-
const byteLength = view.getUint16(byteOffset, true);
|
|
308
|
-
byteOffset += 2;
|
|
309
|
-
|
|
310
|
-
if ((byteLength & 1) != 0 || byteLength + byteOffset > view.byteLength) {
|
|
311
|
-
shaka.log.warning('Malformed MS PRO object');
|
|
312
|
-
return [];
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const recordValue = shaka.util.BufferUtils.toUint8(
|
|
316
|
-
view, byteOffset, byteLength);
|
|
317
|
-
records.push({
|
|
318
|
-
type: type,
|
|
319
|
-
value: recordValue,
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
byteOffset += byteLength;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
return records;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Parses a buffer for PlayReady Objects. The data
|
|
330
|
-
* should contain a 32-bit integer indicating the length of
|
|
331
|
-
* the PRO in bytes. Following that, a 16-bit integer for
|
|
332
|
-
* the number of PlayReady Object Records in the PRO. Lastly,
|
|
333
|
-
* a byte array of the PRO Records themselves.
|
|
334
|
-
*
|
|
335
|
-
* PlayReady Object format: https://goo.gl/W8yAN4
|
|
336
|
-
*
|
|
337
|
-
* @param {BufferSource} data
|
|
338
|
-
* @return {!Array.<shaka.dash.ContentProtection.PlayReadyRecord>}
|
|
339
|
-
* @private
|
|
340
|
-
*/
|
|
341
|
-
static parseMsPro_(data) {
|
|
342
|
-
let byteOffset = 0;
|
|
343
|
-
const view = shaka.util.BufferUtils.toDataView(data);
|
|
344
|
-
|
|
345
|
-
// First 4 bytes is the PRO length (DWORD)
|
|
346
|
-
const byteLength = view.getUint32(byteOffset, /* littleEndian= */ true);
|
|
347
|
-
byteOffset += 4;
|
|
348
|
-
|
|
349
|
-
if (byteLength != data.byteLength) {
|
|
350
|
-
// Malformed PRO
|
|
351
|
-
shaka.log.warning('PlayReady Object with invalid length encountered.');
|
|
352
|
-
return [];
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// Skip PRO Record count (WORD)
|
|
356
|
-
byteOffset += 2;
|
|
357
|
-
|
|
358
|
-
// Rest of the data contains the PRO Records
|
|
359
|
-
const ContentProtection = shaka.dash.ContentProtection;
|
|
360
|
-
return ContentProtection.parseMsProRecords_(view, byteOffset);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* PlayReady Header format: https://goo.gl/dBzxNA
|
|
365
|
-
*
|
|
366
|
-
* @param {!shaka.extern.xml.Node} xml
|
|
367
|
-
* @return {string}
|
|
368
|
-
* @private
|
|
369
|
-
*/
|
|
370
|
-
static getLaurl_(xml) {
|
|
371
|
-
const TXml = shaka.util.TXml;
|
|
372
|
-
// LA_URL element is optional and no more than one is
|
|
373
|
-
// allowed inside the DATA element. Only absolute URLs are allowed.
|
|
374
|
-
// If the LA_URL element exists, it must not be empty.
|
|
375
|
-
for (const elem of TXml.getElementsByTagName(xml, 'DATA')) {
|
|
376
|
-
if (elem.children) {
|
|
377
|
-
for (const child of elem.children) {
|
|
378
|
-
if (child.tagName == 'LA_URL') {
|
|
379
|
-
return /** @type{string} */(shaka.util.TXml.getTextContents(child));
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// Not found
|
|
386
|
-
return '';
|
|
387
|
-
}
|
|
388
|
-
|
|
389
288
|
/**
|
|
390
289
|
* Gets a PlayReady license URL from a content protection element
|
|
391
290
|
* containing a PlayReady Header Object
|
|
@@ -394,46 +293,43 @@ shaka.dash.ContentProtection = class {
|
|
|
394
293
|
* @return {string}
|
|
395
294
|
*/
|
|
396
295
|
static getPlayReadyLicenseUrl(element) {
|
|
397
|
-
const
|
|
296
|
+
const TXml = shaka.util.TXml;
|
|
297
|
+
const dashIfLaurlNode = TXml.findChildNS(
|
|
398
298
|
element.node, shaka.dash.ContentProtection.DashIfNamespaceUri_,
|
|
399
299
|
'Laurl',
|
|
400
300
|
);
|
|
401
301
|
if (dashIfLaurlNode) {
|
|
402
|
-
const textContents =
|
|
302
|
+
const textContents = TXml.getTextContents(dashIfLaurlNode);
|
|
403
303
|
if (textContents) {
|
|
404
304
|
return textContents;
|
|
405
305
|
}
|
|
406
306
|
}
|
|
407
307
|
|
|
408
|
-
const proNode =
|
|
308
|
+
const proNode = TXml.findChildNS(
|
|
409
309
|
element.node, 'urn:microsoft:playready', 'pro');
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
const ContentProtection = shaka.dash.ContentProtection;
|
|
416
|
-
const PLAYREADY_RECORD_TYPES = ContentProtection.PLAYREADY_RECORD_TYPES;
|
|
417
|
-
|
|
418
|
-
const textContent =
|
|
419
|
-
/** @type {string} */ (shaka.util.TXml.getTextContents(proNode));
|
|
420
|
-
const bytes = shaka.util.Uint8ArrayUtils.fromBase64(textContent);
|
|
421
|
-
const records = ContentProtection.parseMsPro_(bytes);
|
|
422
|
-
const record = records.filter((record) => {
|
|
423
|
-
return record.type === PLAYREADY_RECORD_TYPES.RIGHTS_MANAGEMENT;
|
|
424
|
-
})[0];
|
|
425
|
-
|
|
426
|
-
if (!record) {
|
|
427
|
-
return '';
|
|
310
|
+
if (proNode) {
|
|
311
|
+
const textContents = TXml.getTextContents(proNode);
|
|
312
|
+
if (textContents) {
|
|
313
|
+
return shaka.drm.PlayReady.getLicenseUrl(proNode);
|
|
314
|
+
}
|
|
428
315
|
}
|
|
429
316
|
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
if (
|
|
433
|
-
|
|
317
|
+
const psshNode = TXml.findChildNS(
|
|
318
|
+
element.node, shaka.dash.ContentProtection.CencNamespaceUri_, 'pssh');
|
|
319
|
+
if (psshNode) {
|
|
320
|
+
const textContents = TXml.getTextContents(psshNode);
|
|
321
|
+
if (textContents) {
|
|
322
|
+
const proData = shaka.util.Pssh.getPsshData(
|
|
323
|
+
shaka.util.Uint8ArrayUtils.fromBase64(textContents));
|
|
324
|
+
const proString = shaka.util.Uint8ArrayUtils.toStandardBase64(proData);
|
|
325
|
+
const reBuildProNode =
|
|
326
|
+
TXml.parseXmlString('<pro>' + proString + '</pro>');
|
|
327
|
+
goog.asserts.assert(reBuildProNode, 'Must have pro node');
|
|
328
|
+
return shaka.drm.PlayReady.getLicenseUrl(reBuildProNode);
|
|
329
|
+
}
|
|
434
330
|
}
|
|
435
331
|
|
|
436
|
-
return
|
|
332
|
+
return '';
|
|
437
333
|
}
|
|
438
334
|
|
|
439
335
|
/**
|
|
@@ -441,7 +337,7 @@ shaka.dash.ContentProtection = class {
|
|
|
441
337
|
* containing a PlayReady Pro Object
|
|
442
338
|
*
|
|
443
339
|
* @param {shaka.dash.ContentProtection.Element} element
|
|
444
|
-
* @return {?Array
|
|
340
|
+
* @return {?Array<shaka.extern.InitDataOverride>}
|
|
445
341
|
* @private
|
|
446
342
|
*/
|
|
447
343
|
static getInitDataFromPro_(element) {
|
|
@@ -453,7 +349,7 @@ shaka.dash.ContentProtection = class {
|
|
|
453
349
|
|
|
454
350
|
const Uint8ArrayUtils = shaka.util.Uint8ArrayUtils;
|
|
455
351
|
const textContent =
|
|
456
|
-
/** @type{string} */ (shaka.util.TXml.getTextContents(proNode));
|
|
352
|
+
/** @type {string} */ (shaka.util.TXml.getTextContents(proNode));
|
|
457
353
|
const data = Uint8ArrayUtils.fromBase64(textContent);
|
|
458
354
|
const systemId = new Uint8Array([
|
|
459
355
|
0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, 0x42, 0x86,
|
|
@@ -476,8 +372,8 @@ shaka.dash.ContentProtection = class {
|
|
|
476
372
|
* Creates ClearKey initData from Default_KID value retrieved from previously
|
|
477
373
|
* parsed ContentProtection tag.
|
|
478
374
|
* @param {shaka.dash.ContentProtection.Element} element
|
|
479
|
-
* @param {!Set
|
|
480
|
-
* @return {?Array
|
|
375
|
+
* @param {!Set<string>} keyIds
|
|
376
|
+
* @return {?Array<shaka.extern.InitDataOverride>}
|
|
481
377
|
* @private
|
|
482
378
|
*/
|
|
483
379
|
static getInitDataClearKey_(element, keyIds) {
|
|
@@ -506,12 +402,12 @@ shaka.dash.ContentProtection = class {
|
|
|
506
402
|
/**
|
|
507
403
|
* Creates DrmInfo objects from the given element.
|
|
508
404
|
*
|
|
509
|
-
* @param {Array
|
|
405
|
+
* @param {Array<shaka.extern.InitDataOverride>} defaultInit
|
|
510
406
|
* @param {string} encryptionScheme
|
|
511
|
-
* @param {!Array
|
|
512
|
-
* @param {!Object
|
|
513
|
-
* @param {!Set
|
|
514
|
-
* @return {!Array
|
|
407
|
+
* @param {!Array<shaka.dash.ContentProtection.Element>} elements
|
|
408
|
+
* @param {!Object<string, string>} keySystemsByURI
|
|
409
|
+
* @param {!Set<string>} keyIds
|
|
410
|
+
* @return {!Array<shaka.extern.DrmInfo>}
|
|
515
411
|
* @private
|
|
516
412
|
*/
|
|
517
413
|
static convertElements_(defaultInit, encryptionScheme, elements,
|
|
@@ -520,7 +416,7 @@ shaka.dash.ContentProtection = class {
|
|
|
520
416
|
const ManifestParserUtils = shaka.util.ManifestParserUtils;
|
|
521
417
|
const licenseUrlParsers = ContentProtection.licenseUrlParsers_;
|
|
522
418
|
|
|
523
|
-
/** @type {!Array
|
|
419
|
+
/** @type {!Array<shaka.extern.DrmInfo>} */
|
|
524
420
|
const out = [];
|
|
525
421
|
|
|
526
422
|
for (const element of elements) {
|
|
@@ -557,16 +453,16 @@ shaka.dash.ContentProtection = class {
|
|
|
557
453
|
* Parses the given ContentProtection elements. If there is an error, it
|
|
558
454
|
* removes those elements.
|
|
559
455
|
*
|
|
560
|
-
* @param {!Array
|
|
561
|
-
* @return {!Array
|
|
456
|
+
* @param {!Array<!shaka.extern.xml.Node>} elements
|
|
457
|
+
* @return {!Array<shaka.dash.ContentProtection.Element>}
|
|
562
458
|
* @private
|
|
563
459
|
*/
|
|
564
|
-
static parseElements_(
|
|
565
|
-
/** @type {!Array
|
|
460
|
+
static parseElements_(elements) {
|
|
461
|
+
/** @type {!Array<shaka.dash.ContentProtection.Element>} */
|
|
566
462
|
const out = [];
|
|
567
463
|
|
|
568
|
-
for (const
|
|
569
|
-
const parsed = shaka.dash.ContentProtection.parseElement_(
|
|
464
|
+
for (const element of elements) {
|
|
465
|
+
const parsed = shaka.dash.ContentProtection.parseElement_(element);
|
|
570
466
|
if (parsed) {
|
|
571
467
|
out.push(parsed);
|
|
572
468
|
}
|
|
@@ -590,7 +486,7 @@ shaka.dash.ContentProtection = class {
|
|
|
590
486
|
let schemeUri = elem.attributes['schemeIdUri'];
|
|
591
487
|
/** @type {?string} */
|
|
592
488
|
let keyId = TXml.getAttributeNS(elem, NS, 'default_KID');
|
|
593
|
-
/** @type {!Array
|
|
489
|
+
/** @type {!Array<string>} */
|
|
594
490
|
const psshs = TXml.findChildrenNS(elem, NS, 'pssh')
|
|
595
491
|
.map(TXml.getContents);
|
|
596
492
|
|
|
@@ -613,7 +509,7 @@ shaka.dash.ContentProtection = class {
|
|
|
613
509
|
}
|
|
614
510
|
}
|
|
615
511
|
|
|
616
|
-
/** @type {!Array
|
|
512
|
+
/** @type {!Array<shaka.extern.InitDataOverride>} */
|
|
617
513
|
let init = [];
|
|
618
514
|
try {
|
|
619
515
|
// Try parsing PSSH data.
|
|
@@ -715,37 +611,11 @@ shaka.dash.ContentProtection = class {
|
|
|
715
611
|
}
|
|
716
612
|
};
|
|
717
613
|
|
|
718
|
-
/**
|
|
719
|
-
* @typedef {{
|
|
720
|
-
* type: number,
|
|
721
|
-
* value: !Uint8Array
|
|
722
|
-
* }}
|
|
723
|
-
*
|
|
724
|
-
* @description
|
|
725
|
-
* The parsed result of a PlayReady object record.
|
|
726
|
-
*
|
|
727
|
-
* @property {number} type
|
|
728
|
-
* Type of data stored in the record.
|
|
729
|
-
* @property {!Uint8Array} value
|
|
730
|
-
* Record content.
|
|
731
|
-
*/
|
|
732
|
-
shaka.dash.ContentProtection.PlayReadyRecord;
|
|
733
|
-
|
|
734
|
-
/**
|
|
735
|
-
* Enum for PlayReady record types.
|
|
736
|
-
* @enum {number}
|
|
737
|
-
*/
|
|
738
|
-
shaka.dash.ContentProtection.PLAYREADY_RECORD_TYPES = {
|
|
739
|
-
RIGHTS_MANAGEMENT: 0x001,
|
|
740
|
-
RESERVED: 0x002,
|
|
741
|
-
EMBEDDED_LICENSE: 0x003,
|
|
742
|
-
};
|
|
743
|
-
|
|
744
614
|
/**
|
|
745
615
|
* @typedef {{
|
|
746
616
|
* defaultKeyId: ?string,
|
|
747
|
-
* defaultInit: Array
|
|
748
|
-
* drmInfos: !Array
|
|
617
|
+
* defaultInit: Array<shaka.extern.InitDataOverride>,
|
|
618
|
+
* drmInfos: !Array<shaka.extern.DrmInfo>,
|
|
749
619
|
* aes128Info: ?shaka.dash.ContentProtection.Aes128Info,
|
|
750
620
|
* firstRepresentation: boolean
|
|
751
621
|
* }}
|
|
@@ -757,10 +627,10 @@ shaka.dash.ContentProtection.PLAYREADY_RECORD_TYPES = {
|
|
|
757
627
|
* @property {?string} defaultKeyId
|
|
758
628
|
* The default key ID to use. This is used by parseKeyIds as a default. This
|
|
759
629
|
* can be null to indicate that there is no default.
|
|
760
|
-
* @property {Array
|
|
630
|
+
* @property {Array<shaka.extern.InitDataOverride>} defaultInit
|
|
761
631
|
* The default init data override. This can be null to indicate that there
|
|
762
632
|
* is no default.
|
|
763
|
-
* @property {!Array
|
|
633
|
+
* @property {!Array<shaka.extern.DrmInfo>} drmInfos
|
|
764
634
|
* The DrmInfo objects.
|
|
765
635
|
* @property {?shaka.dash.ContentProtection.Aes128Info} aes128Info
|
|
766
636
|
* The AES-128 key info.
|
|
@@ -794,7 +664,7 @@ shaka.dash.ContentProtection.Aes128Info;
|
|
|
794
664
|
* node: !shaka.extern.xml.Node,
|
|
795
665
|
* schemeUri: string,
|
|
796
666
|
* keyId: ?string,
|
|
797
|
-
* init: Array
|
|
667
|
+
* init: Array<shaka.extern.InitDataOverride>,
|
|
798
668
|
* encryptionScheme: ?string
|
|
799
669
|
* }}
|
|
800
670
|
*
|
|
@@ -807,7 +677,7 @@ shaka.dash.ContentProtection.Aes128Info;
|
|
|
807
677
|
* The scheme URI.
|
|
808
678
|
* @property {?string} keyId
|
|
809
679
|
* The default key ID, if present.
|
|
810
|
-
* @property {Array
|
|
680
|
+
* @property {Array<shaka.extern.InitDataOverride>} init
|
|
811
681
|
* The init data, if present. If there is no init data, it will be null. If
|
|
812
682
|
* this is non-null, there is at least one element.
|
|
813
683
|
* @property {?string} encryptionScheme
|
|
@@ -818,7 +688,7 @@ shaka.dash.ContentProtection.Element;
|
|
|
818
688
|
/**
|
|
819
689
|
* A map of key system name to license server url parser.
|
|
820
690
|
*
|
|
821
|
-
* @const {!Map
|
|
691
|
+
* @const {!Map<string, function(shaka.dash.ContentProtection.Element)>}
|
|
822
692
|
* @private
|
|
823
693
|
*/
|
|
824
694
|
shaka.dash.ContentProtection.licenseUrlParsers_ = new Map()
|