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
package/lib/dash/mpd_utils.js
CHANGED
|
@@ -37,7 +37,7 @@ shaka.dash.MpdUtils = class {
|
|
|
37
37
|
*/
|
|
38
38
|
static fillUriTemplate(
|
|
39
39
|
uriTemplate, representationId, number, subNumber, bandwidth, time) {
|
|
40
|
-
/** @type {!Object
|
|
40
|
+
/** @type {!Object<string, ?number | ?string>} */
|
|
41
41
|
const valueTable = {
|
|
42
42
|
'RepresentationID': representationId,
|
|
43
43
|
'Number': number,
|
|
@@ -46,6 +46,7 @@ shaka.dash.MpdUtils = class {
|
|
|
46
46
|
'Time': time,
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
// cspell: disable-next-line
|
|
49
50
|
const re = /\$(RepresentationID|Number|SubNumber|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g; // eslint-disable-line max-len
|
|
50
51
|
const uri = uriTemplate.replace(re, (match, name, widthStr, format) => {
|
|
51
52
|
if (match == '$$') {
|
|
@@ -129,7 +130,7 @@ shaka.dash.MpdUtils = class {
|
|
|
129
130
|
* @param {number} periodDuration The Period's duration in seconds.
|
|
130
131
|
* Infinity indicates that the Period continues indefinitely.
|
|
131
132
|
* @param {number} startNumber
|
|
132
|
-
* @return {!Array
|
|
133
|
+
* @return {!Array<shaka.media.PresentationTimeline.TimeRange>}
|
|
133
134
|
*/
|
|
134
135
|
static createTimeline(
|
|
135
136
|
timePoints, timescale, unscaledPresentationTimeOffset,
|
|
@@ -143,7 +144,7 @@ shaka.dash.MpdUtils = class {
|
|
|
143
144
|
// Alias.
|
|
144
145
|
const TXml = shaka.util.TXml;
|
|
145
146
|
|
|
146
|
-
/** @type {!Array
|
|
147
|
+
/** @type {!Array<shaka.media.PresentationTimeline.TimeRange>} */
|
|
147
148
|
const timeline = [];
|
|
148
149
|
let lastEndTime = -unscaledPresentationTimeOffset;
|
|
149
150
|
|
|
@@ -186,7 +187,7 @@ shaka.dash.MpdUtils = class {
|
|
|
186
187
|
return timeline;
|
|
187
188
|
} else if (startTime >= nextStartTime) {
|
|
188
189
|
shaka.log.warning(
|
|
189
|
-
'An "S" element cannot have a negative
|
|
190
|
+
'An "S" element cannot have a negative repeat if its start ',
|
|
190
191
|
'time exceeds the next "S" element\'s start time:',
|
|
191
192
|
'ignoring the remaining "S" elements.', timePoint);
|
|
192
193
|
return timeline;
|
|
@@ -207,7 +208,7 @@ shaka.dash.MpdUtils = class {
|
|
|
207
208
|
shaka.log.warning(
|
|
208
209
|
'The last "S" element cannot have a negative repeat',
|
|
209
210
|
'if its start time exceeds the Period\'s duration:',
|
|
210
|
-
'
|
|
211
|
+
'ignoring the last "S" element.', timePoint);
|
|
211
212
|
return timeline;
|
|
212
213
|
}
|
|
213
214
|
repeat = Math.ceil((periodDuration * timescale - startTime) / d) - 1;
|
|
@@ -293,7 +294,7 @@ shaka.dash.MpdUtils = class {
|
|
|
293
294
|
startNumber = 1;
|
|
294
295
|
}
|
|
295
296
|
|
|
296
|
-
/** @type {Array
|
|
297
|
+
/** @type {Array<shaka.media.PresentationTimeline.TimeRange>} */
|
|
297
298
|
let timeline = null;
|
|
298
299
|
const timelineNode =
|
|
299
300
|
MpdUtils.inheritChild(context, callback, 'SegmentTimeline');
|
|
@@ -322,8 +323,8 @@ shaka.dash.MpdUtils = class {
|
|
|
322
323
|
* @param {shaka.dash.DashParser.Context} context
|
|
323
324
|
* @param {function(?shaka.dash.DashParser.InheritanceFrame):
|
|
324
325
|
* ?shaka.extern.xml.Node} callback
|
|
325
|
-
* @return {!Array
|
|
326
|
-
|
|
326
|
+
* @return {!Array<!shaka.extern.xml.Node>}
|
|
327
|
+
*/
|
|
327
328
|
static getNodes(context, callback) {
|
|
328
329
|
const Functional = shaka.util.Functional;
|
|
329
330
|
goog.asserts.assert(
|
|
@@ -417,9 +418,9 @@ shaka.dash.MpdUtils = class {
|
|
|
417
418
|
// Remove the xlink properties, so it won't download again
|
|
418
419
|
// when re-processed.
|
|
419
420
|
for (const key of Object.keys(element.attributes)) {
|
|
420
|
-
const
|
|
421
|
+
const segments = key.split(':');
|
|
421
422
|
const namespace = shaka.util.TXml.getKnownNameSpace(NS);
|
|
422
|
-
if (
|
|
423
|
+
if (segments[0] == namespace) {
|
|
423
424
|
delete element.attributes[key];
|
|
424
425
|
}
|
|
425
426
|
}
|
|
@@ -504,7 +505,7 @@ shaka.dash.MpdUtils = class {
|
|
|
504
505
|
* @param {boolean} failGracefully
|
|
505
506
|
* @param {string} baseUri
|
|
506
507
|
* @param {!shaka.net.NetworkingEngine} networkingEngine
|
|
507
|
-
* @param {number=} linkDepth
|
|
508
|
+
* @param {number=} linkDepth default set to 0
|
|
508
509
|
* @return {!shaka.util.AbortableOperation.<!shaka.extern.xml.Node>}
|
|
509
510
|
*/
|
|
510
511
|
static processXlinks(
|
|
@@ -569,7 +570,7 @@ shaka.dash.MpdUtils = class {
|
|
|
569
570
|
* startNumber: number,
|
|
570
571
|
* scaledPresentationTimeOffset: number,
|
|
571
572
|
* unscaledPresentationTimeOffset: number,
|
|
572
|
-
* timeline: Array
|
|
573
|
+
* timeline: Array<shaka.media.PresentationTimeline.TimeRange>
|
|
573
574
|
* }}
|
|
574
575
|
*
|
|
575
576
|
* @description
|
|
@@ -587,7 +588,7 @@ shaka.dash.MpdUtils = class {
|
|
|
587
588
|
* The presentation time offset of the representation, in seconds.
|
|
588
589
|
* @property {number} unscaledPresentationTimeOffset
|
|
589
590
|
* The presentation time offset of the representation, in timescale units.
|
|
590
|
-
* @property {Array
|
|
591
|
+
* @property {Array<shaka.media.PresentationTimeline.TimeRange>} timeline
|
|
591
592
|
* The timeline of the representation, if given. Times in seconds.
|
|
592
593
|
*/
|
|
593
594
|
shaka.dash.MpdUtils.SegmentInfo;
|
package/lib/dash/segment_base.js
CHANGED
|
@@ -136,11 +136,11 @@ shaka.dash.SegmentBase = class {
|
|
|
136
136
|
* @param {shaka.dash.DashParser.Context} context
|
|
137
137
|
* @param {shaka.dash.DashParser.RequestSegmentCallback} requestSegment
|
|
138
138
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
139
|
-
* @param {!Array
|
|
139
|
+
* @param {!Array<string>} uris
|
|
140
140
|
* @param {number} startByte
|
|
141
141
|
* @param {?number} endByte
|
|
142
142
|
* @param {number} scaledPresentationTimeOffset
|
|
143
|
-
* @return {!Promise
|
|
143
|
+
* @return {!Promise<shaka.media.SegmentIndex>}
|
|
144
144
|
*/
|
|
145
145
|
static async generateSegmentIndexFromUris(
|
|
146
146
|
context, requestSegment, initSegmentReference, uris, startByte,
|
|
@@ -173,7 +173,7 @@ shaka.dash.SegmentBase = class {
|
|
|
173
173
|
const results = await Promise.all(responses);
|
|
174
174
|
const indexData = results[0];
|
|
175
175
|
const initData = results[1] || null;
|
|
176
|
-
/** @type {Array
|
|
176
|
+
/** @type {Array<!shaka.media.SegmentReference>} */
|
|
177
177
|
let references = null;
|
|
178
178
|
|
|
179
179
|
const timestampOffset = periodStart - scaledPresentationTimeOffset;
|
|
@@ -249,7 +249,7 @@ shaka.dash.SegmentBase = class {
|
|
|
249
249
|
* Compute the URIs of the segment index from the container.
|
|
250
250
|
*
|
|
251
251
|
* @param {shaka.dash.DashParser.Context} context
|
|
252
|
-
* @return {!Array
|
|
252
|
+
* @return {!Array<string>}
|
|
253
253
|
* @private
|
|
254
254
|
*/
|
|
255
255
|
static computeIndexUris_(context) {
|
|
@@ -350,7 +350,7 @@ shaka.dash.SegmentBase = class {
|
|
|
350
350
|
* @param {shaka.dash.DashParser.RequestSegmentCallback} requestSegment
|
|
351
351
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
352
352
|
* @param {number} scaledPresentationTimeOffset
|
|
353
|
-
* @return {!Promise
|
|
353
|
+
* @return {!Promise<shaka.media.SegmentIndex>}
|
|
354
354
|
* @private
|
|
355
355
|
*/
|
|
356
356
|
static generateSegmentIndex_(
|
package/lib/dash/segment_list.js
CHANGED
|
@@ -31,7 +31,7 @@ shaka.dash.SegmentList = class {
|
|
|
31
31
|
* Updates the existing SegmentIndex, if any.
|
|
32
32
|
*
|
|
33
33
|
* @param {shaka.dash.DashParser.Context} context
|
|
34
|
-
* @param {!Object
|
|
34
|
+
* @param {!Object<string, !shaka.extern.Stream>} streamMap
|
|
35
35
|
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
36
36
|
* @return {shaka.dash.DashParser.StreamInfo}
|
|
37
37
|
*/
|
|
@@ -197,7 +197,7 @@ shaka.dash.SegmentList = class {
|
|
|
197
197
|
* @param {number} periodStart in seconds.
|
|
198
198
|
* @param {?number} periodDuration in seconds.
|
|
199
199
|
* @param {number} startNumber
|
|
200
|
-
* @param {function()
|
|
200
|
+
* @param {function(): !Array<string>} getBaseUris
|
|
201
201
|
* @param {shaka.dash.SegmentList.SegmentListInfo} info
|
|
202
202
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
203
203
|
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
@@ -205,7 +205,7 @@ shaka.dash.SegmentList = class {
|
|
|
205
205
|
* @param {string} codecs
|
|
206
206
|
* @param {number} bandwidth
|
|
207
207
|
* @param {function():string} urlParams
|
|
208
|
-
* @return {!Array
|
|
208
|
+
* @return {!Array<!shaka.media.SegmentReference>}
|
|
209
209
|
* @private
|
|
210
210
|
*/
|
|
211
211
|
static createSegmentReferences_(
|
|
@@ -227,7 +227,7 @@ shaka.dash.SegmentList = class {
|
|
|
227
227
|
const appendWindowEnd = periodDuration ?
|
|
228
228
|
periodStart + periodDuration : Infinity;
|
|
229
229
|
|
|
230
|
-
/** @type {!Array
|
|
230
|
+
/** @type {!Array<!shaka.media.SegmentReference>} */
|
|
231
231
|
const references = [];
|
|
232
232
|
let prevEndTime = info.startTime;
|
|
233
233
|
for (let i = 0; i < max; i++) {
|
|
@@ -287,12 +287,12 @@ shaka.dash.SegmentList = class {
|
|
|
287
287
|
* Parses the media URIs from the context.
|
|
288
288
|
*
|
|
289
289
|
* @param {shaka.dash.DashParser.Context} context
|
|
290
|
-
* @return {!Array
|
|
290
|
+
* @return {!Array<shaka.dash.SegmentList.MediaSegment>}
|
|
291
291
|
* @private
|
|
292
292
|
*/
|
|
293
293
|
static parseMediaSegments_(context) {
|
|
294
294
|
const Functional = shaka.util.Functional;
|
|
295
|
-
/** @type {!Array
|
|
295
|
+
/** @type {!Array<!shaka.extern.xml.Node>} */
|
|
296
296
|
const segmentLists = [
|
|
297
297
|
context.representation.segmentList,
|
|
298
298
|
context.adaptationSet.segmentList,
|
|
@@ -347,8 +347,8 @@ shaka.dash.SegmentList.MediaSegment;
|
|
|
347
347
|
* startTime: number,
|
|
348
348
|
* startNumber: number,
|
|
349
349
|
* scaledPresentationTimeOffset: number,
|
|
350
|
-
* timeline: Array
|
|
351
|
-
* mediaSegments: !Array
|
|
350
|
+
* timeline: Array<shaka.media.PresentationTimeline.TimeRange>,
|
|
351
|
+
* mediaSegments: !Array<shaka.dash.SegmentList.MediaSegment>
|
|
352
352
|
* }}
|
|
353
353
|
* @private
|
|
354
354
|
*
|
|
@@ -363,9 +363,9 @@ shaka.dash.SegmentList.MediaSegment;
|
|
|
363
363
|
* The start number of the segments; 1 or greater.
|
|
364
364
|
* @property {number} scaledPresentationTimeOffset
|
|
365
365
|
* The scaledPresentationTimeOffset of the representation, in seconds.
|
|
366
|
-
* @property {Array
|
|
366
|
+
* @property {Array<shaka.media.PresentationTimeline.TimeRange>} timeline
|
|
367
367
|
* The timeline of the representation, if given. Times in seconds.
|
|
368
|
-
* @property {!Array
|
|
368
|
+
* @property {!Array<shaka.dash.SegmentList.MediaSegment>} mediaSegments
|
|
369
369
|
* The URI and byte-ranges of the media segments.
|
|
370
370
|
*/
|
|
371
371
|
shaka.dash.SegmentList.SegmentListInfo;
|
|
@@ -33,11 +33,11 @@ shaka.dash.SegmentTemplate = class {
|
|
|
33
33
|
*
|
|
34
34
|
* @param {shaka.dash.DashParser.Context} context
|
|
35
35
|
* @param {shaka.dash.DashParser.RequestSegmentCallback} requestSegment
|
|
36
|
-
* @param {!Object
|
|
36
|
+
* @param {!Object<string, !shaka.extern.Stream>} streamMap
|
|
37
37
|
* @param {boolean} isUpdate True if the manifest is being updated.
|
|
38
38
|
* @param {number} segmentLimit The maximum number of segments to generate for
|
|
39
39
|
* a SegmentTemplate with fixed duration.
|
|
40
|
-
* @param {!Object
|
|
40
|
+
* @param {!Object<string, number>} periodDurationMap
|
|
41
41
|
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
42
42
|
* @param {?number} lastSegmentNumber
|
|
43
43
|
* @param {boolean} isPatchUpdate
|
|
@@ -131,24 +131,6 @@ shaka.dash.SegmentTemplate = class {
|
|
|
131
131
|
|
|
132
132
|
shaka.log.debug(`New manifest ${periodStart} - ${periodEnd}`);
|
|
133
133
|
|
|
134
|
-
/* When to fit segments. All refactors should honor/update this table:
|
|
135
|
-
*
|
|
136
|
-
* | dynamic | infinite | last | should | notes |
|
|
137
|
-
* | | period | period | fit | |
|
|
138
|
-
* | ------- | -------- | ------ | ------ | ------------------------- |
|
|
139
|
-
* | F | F | X | T | typical VOD |
|
|
140
|
-
* | F | T | X | X | impossible: infinite VOD |
|
|
141
|
-
* | T | F | F | T | typical live, old period |
|
|
142
|
-
* | T | F | T | F | typical IPR |
|
|
143
|
-
* | T | T | F | X | impossible: old, infinite |
|
|
144
|
-
* | T | T | T | F | typical live, new period |
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
// We never fit the final period of dynamic content, which could be
|
|
148
|
-
// infinite live (with no limit to fit to) or IPR (which would expand the
|
|
149
|
-
// most recent segment to the end of the presentation).
|
|
150
|
-
const shouldFit = !(context.dynamic && context.periodInfo.isLastPeriod);
|
|
151
|
-
|
|
152
134
|
if (!segmentIndex) {
|
|
153
135
|
shaka.log.debug(`Creating TSI with end ${periodEnd}`);
|
|
154
136
|
segmentIndex = new TimelineSegmentIndex(
|
|
@@ -160,14 +142,13 @@ shaka.dash.SegmentTemplate = class {
|
|
|
160
142
|
periodStart,
|
|
161
143
|
periodEnd,
|
|
162
144
|
initSegmentReference,
|
|
163
|
-
shouldFit,
|
|
164
145
|
aesKey,
|
|
165
146
|
context.representation.segmentSequenceCadence,
|
|
166
147
|
);
|
|
167
148
|
} else {
|
|
168
149
|
const tsi = /** @type {!TimelineSegmentIndex} */(segmentIndex);
|
|
169
150
|
tsi.appendTemplateInfo(
|
|
170
|
-
info, periodStart, periodEnd,
|
|
151
|
+
info, periodStart, periodEnd, initSegmentReference);
|
|
171
152
|
|
|
172
153
|
const availabilityStart =
|
|
173
154
|
context.presentationTimeline.getSegmentAvailabilityStart();
|
|
@@ -177,7 +158,9 @@ shaka.dash.SegmentTemplate = class {
|
|
|
177
158
|
if (info.timeline &&
|
|
178
159
|
context.adaptationSet.contentType !== 'image' &&
|
|
179
160
|
context.adaptationSet.contentType !== 'text') {
|
|
180
|
-
const
|
|
161
|
+
const tsi = /** @type {!TimelineSegmentIndex} */(segmentIndex);
|
|
162
|
+
// getTimeline is the info.timeline but fitted to the period.
|
|
163
|
+
const timeline = tsi.getTimeline();
|
|
181
164
|
context.presentationTimeline.notifyTimeRange(
|
|
182
165
|
timeline,
|
|
183
166
|
periodStart);
|
|
@@ -195,7 +178,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
195
178
|
if (segmentIndex instanceof shaka.dash.TimelineSegmentIndex &&
|
|
196
179
|
segmentIndex.isEmpty()) {
|
|
197
180
|
segmentIndex.appendTemplateInfo(info, periodStart,
|
|
198
|
-
periodEnd,
|
|
181
|
+
periodEnd, initSegmentReference);
|
|
199
182
|
}
|
|
200
183
|
return Promise.resolve(segmentIndex);
|
|
201
184
|
},
|
|
@@ -319,7 +302,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
319
302
|
shaka.util.Error.Code.DASH_NO_SEGMENT_INFO);
|
|
320
303
|
} else if (n != 1) {
|
|
321
304
|
shaka.log.warning(
|
|
322
|
-
'SegmentTemplate
|
|
305
|
+
'SegmentTemplate contains multiple segment information sources:',
|
|
323
306
|
'the SegmentTemplate should only contain an index URL template,',
|
|
324
307
|
'a SegmentTimeline or a segment duration.',
|
|
325
308
|
context.representation);
|
|
@@ -355,7 +338,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
355
338
|
* @param {shaka.dash.DashParser.RequestSegmentCallback} requestSegment
|
|
356
339
|
* @param {shaka.media.InitSegmentReference} init
|
|
357
340
|
* @param {shaka.dash.SegmentTemplate.SegmentTemplateInfo} info
|
|
358
|
-
* @return {!Promise
|
|
341
|
+
* @return {!Promise<shaka.media.SegmentIndex>}
|
|
359
342
|
* @private
|
|
360
343
|
*/
|
|
361
344
|
static generateSegmentIndexFromIndexTemplate_(
|
|
@@ -383,11 +366,11 @@ shaka.dash.SegmentTemplate = class {
|
|
|
383
366
|
* @param {shaka.dash.SegmentTemplate.SegmentTemplateInfo} info
|
|
384
367
|
* @param {number} segmentLimit The maximum number of segments to generate.
|
|
385
368
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
386
|
-
* @param {!Object
|
|
369
|
+
* @param {!Object<string, number>} periodDurationMap
|
|
387
370
|
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
388
371
|
* @param {?number} lastSegmentNumber
|
|
389
372
|
* @param {number} segmentSequenceCadence
|
|
390
|
-
* @return {!Promise
|
|
373
|
+
* @return {!Promise<shaka.media.SegmentIndex>}
|
|
391
374
|
* @private
|
|
392
375
|
*/
|
|
393
376
|
static generateSegmentIndexFromDuration_(
|
|
@@ -699,7 +682,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
699
682
|
const getBaseUris = context.representation.getBaseUris;
|
|
700
683
|
const urlParams = context.urlParams;
|
|
701
684
|
const getUris = () => {
|
|
702
|
-
goog.asserts.assert(initialization, 'Should have returned
|
|
685
|
+
goog.asserts.assert(initialization, 'Should have returned earlier');
|
|
703
686
|
const filledTemplate = MpdUtils.fillUriTemplate(
|
|
704
687
|
initialization, repId, null, null, bandwidth, null);
|
|
705
688
|
const resolvedUris = ManifestParserUtils.resolveUris(
|
|
@@ -728,7 +711,7 @@ shaka.dash.SegmentTemplate = class {
|
|
|
728
711
|
*
|
|
729
712
|
* @extends shaka.media.SegmentIndex
|
|
730
713
|
* @implements {shaka.util.IReleasable}
|
|
731
|
-
* @implements {Iterable
|
|
714
|
+
* @implements {Iterable<!shaka.media.SegmentReference>}
|
|
732
715
|
*
|
|
733
716
|
* @private
|
|
734
717
|
*
|
|
@@ -739,45 +722,50 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
739
722
|
* @param {!shaka.dash.SegmentTemplate.SegmentTemplateInfo} templateInfo
|
|
740
723
|
* @param {?string} representationId
|
|
741
724
|
* @param {number} bandwidth
|
|
742
|
-
* @param {function():Array
|
|
725
|
+
* @param {function(): Array<string>} getBaseUris
|
|
743
726
|
* @param {function():string} urlParams
|
|
744
727
|
* @param {number} periodStart
|
|
745
728
|
* @param {number} periodEnd
|
|
746
729
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
747
|
-
* @param {boolean} shouldFit
|
|
748
730
|
* @param {shaka.extern.aesKey|undefined} aesKey
|
|
749
731
|
* @param {number} segmentSequenceCadence
|
|
750
|
-
|
|
732
|
+
*/
|
|
751
733
|
constructor(templateInfo, representationId, bandwidth, getBaseUris,
|
|
752
|
-
urlParams, periodStart, periodEnd, initSegmentReference,
|
|
734
|
+
urlParams, periodStart, periodEnd, initSegmentReference,
|
|
753
735
|
aesKey, segmentSequenceCadence) {
|
|
754
736
|
super([]);
|
|
755
737
|
|
|
756
738
|
/** @private {?shaka.dash.SegmentTemplate.SegmentTemplateInfo} */
|
|
757
739
|
this.templateInfo_ = templateInfo;
|
|
740
|
+
|
|
758
741
|
/** @private {?string} */
|
|
759
742
|
this.representationId_ = representationId;
|
|
743
|
+
|
|
760
744
|
/** @private {number} */
|
|
761
745
|
this.bandwidth_ = bandwidth;
|
|
762
|
-
|
|
746
|
+
|
|
747
|
+
/** @private {function(): Array<string>} */
|
|
763
748
|
this.getBaseUris_ = getBaseUris;
|
|
749
|
+
|
|
764
750
|
/** @private {function():string} */
|
|
765
751
|
this.urlParams_ = urlParams;
|
|
752
|
+
|
|
766
753
|
/** @private {number} */
|
|
767
754
|
this.periodStart_ = periodStart;
|
|
755
|
+
|
|
768
756
|
/** @private {number} */
|
|
769
757
|
this.periodEnd_ = periodEnd;
|
|
758
|
+
|
|
770
759
|
/** @private {shaka.media.InitSegmentReference} */
|
|
771
760
|
this.initSegmentReference_ = initSegmentReference;
|
|
761
|
+
|
|
772
762
|
/** @private {shaka.extern.aesKey|undefined} */
|
|
773
763
|
this.aesKey_ = aesKey;
|
|
764
|
+
|
|
774
765
|
/** @private {number} */
|
|
775
766
|
this.segmentSequenceCadence_ = segmentSequenceCadence;
|
|
776
767
|
|
|
777
|
-
|
|
778
|
-
if (shouldFit) {
|
|
779
|
-
this.fitTimeline();
|
|
780
|
-
}
|
|
768
|
+
this.fitTimeline();
|
|
781
769
|
}
|
|
782
770
|
|
|
783
771
|
/**
|
|
@@ -845,11 +833,9 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
845
833
|
* @param {shaka.dash.SegmentTemplate.SegmentTemplateInfo} info
|
|
846
834
|
* @param {number} periodStart
|
|
847
835
|
* @param {number} periodEnd
|
|
848
|
-
* @param {boolean} shouldFit
|
|
849
836
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
850
837
|
*/
|
|
851
|
-
appendTemplateInfo(info, periodStart, periodEnd,
|
|
852
|
-
initSegmentReference) {
|
|
838
|
+
appendTemplateInfo(info, periodStart, periodEnd, initSegmentReference) {
|
|
853
839
|
this.updateInitSegmentReference(initSegmentReference);
|
|
854
840
|
if (!this.templateInfo_) {
|
|
855
841
|
this.templateInfo_ = info;
|
|
@@ -883,9 +869,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
883
869
|
}
|
|
884
870
|
}
|
|
885
871
|
|
|
886
|
-
|
|
887
|
-
this.fitTimeline();
|
|
888
|
-
}
|
|
872
|
+
this.fitTimeline();
|
|
889
873
|
}
|
|
890
874
|
|
|
891
875
|
/**
|
|
@@ -930,14 +914,19 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
930
914
|
return;
|
|
931
915
|
}
|
|
932
916
|
const timeline = this.templateInfo_.timeline;
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
917
|
+
goog.asserts.assert(timeline, 'Timeline should be non-null!');
|
|
918
|
+
const newTimeline = [];
|
|
919
|
+
for (const range of timeline) {
|
|
920
|
+
if (range.start >= this.periodEnd_) {
|
|
921
|
+
// Starts after end of period.
|
|
922
|
+
} else if (range.end <= 0) {
|
|
923
|
+
// Ends before start of period.
|
|
937
924
|
} else {
|
|
938
|
-
|
|
925
|
+
// Usable.
|
|
926
|
+
newTimeline.push(range);
|
|
939
927
|
}
|
|
940
928
|
}
|
|
929
|
+
this.templateInfo_.timeline = newTimeline;
|
|
941
930
|
|
|
942
931
|
this.evict(this.periodStart_);
|
|
943
932
|
|
|
@@ -947,6 +936,19 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
947
936
|
// find/get() methods whenever possible.
|
|
948
937
|
}
|
|
949
938
|
|
|
939
|
+
/**
|
|
940
|
+
* Get the current timeline
|
|
941
|
+
* @return {!Array<shaka.media.PresentationTimeline.TimeRange>}
|
|
942
|
+
*/
|
|
943
|
+
getTimeline() {
|
|
944
|
+
if (!this.templateInfo_) {
|
|
945
|
+
return [];
|
|
946
|
+
}
|
|
947
|
+
const timeline = this.templateInfo_.timeline;
|
|
948
|
+
goog.asserts.assert(timeline, 'Timeline should be non-null!');
|
|
949
|
+
return timeline;
|
|
950
|
+
}
|
|
951
|
+
|
|
950
952
|
/**
|
|
951
953
|
* @override
|
|
952
954
|
*/
|
|
@@ -1146,7 +1148,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
1146
1148
|
/**
|
|
1147
1149
|
* Fill in a specific template with values to get the segment uris
|
|
1148
1150
|
*
|
|
1149
|
-
* @return {!Array
|
|
1151
|
+
* @return {!Array<string>}
|
|
1150
1152
|
* @private
|
|
1151
1153
|
*/
|
|
1152
1154
|
static createUris_(mediaTemplate, repId, segmentReplacement,
|
|
@@ -1170,7 +1172,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
1170
1172
|
* startNumber: number,
|
|
1171
1173
|
* scaledPresentationTimeOffset: number,
|
|
1172
1174
|
* unscaledPresentationTimeOffset: number,
|
|
1173
|
-
* timeline: Array
|
|
1175
|
+
* timeline: Array<shaka.media.PresentationTimeline.TimeRange>,
|
|
1174
1176
|
* mediaTemplate: ?string,
|
|
1175
1177
|
* indexTemplate: ?string,
|
|
1176
1178
|
* mimeType: string,
|
|
@@ -1194,7 +1196,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
1194
1196
|
* The presentation time offset of the representation, in seconds.
|
|
1195
1197
|
* @property {number} unscaledPresentationTimeOffset
|
|
1196
1198
|
* The presentation time offset of the representation, in timescale units.
|
|
1197
|
-
* @property {Array
|
|
1199
|
+
* @property {Array<shaka.media.PresentationTimeline.TimeRange>} timeline
|
|
1198
1200
|
* The timeline of the representation, if given. Times in seconds.
|
|
1199
1201
|
* @property {?string} mediaTemplate
|
|
1200
1202
|
* The media URI template, if given.
|
package/lib/debug/log.js
CHANGED
|
@@ -129,13 +129,13 @@ shaka.log.MAX_LOG_LEVEL = 3;
|
|
|
129
129
|
/**
|
|
130
130
|
* A Set to indicate which one-time warnings have been issued.
|
|
131
131
|
*
|
|
132
|
-
* @private {!Set
|
|
132
|
+
* @private {!Set<string>}
|
|
133
133
|
*/
|
|
134
134
|
shaka.log.oneTimeWarningIssued_ = new Set();
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
if (window.console) {
|
|
138
|
-
/** @private {!Object
|
|
138
|
+
/** @private {!Object<shaka.log.Level, function(...*)>} */
|
|
139
139
|
shaka.log.logMap_ = {
|
|
140
140
|
[shaka.log.Level.ERROR]: (...args) => console.error(...args),
|
|
141
141
|
[shaka.log.Level.WARNING]: (...args) => console.warn(...args),
|
package/lib/dependencies/all.js
CHANGED
|
@@ -60,11 +60,12 @@ shaka.dependencies.Allowed = {
|
|
|
60
60
|
ISOBoxer: 'ISOBoxer',
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
// eslint-disable-next-line jsdoc/require-returns
|
|
63
64
|
/**
|
|
64
65
|
* Contains accessor functions to shared dependencies that could be used by
|
|
65
66
|
* other components. The default accessors can be overridden.
|
|
66
67
|
*
|
|
67
|
-
* @private {!Map
|
|
68
|
+
* @private {!Map<shaka.dependencies.Allowed, function(): ?>}
|
|
68
69
|
*/
|
|
69
70
|
shaka.dependencies.dependencies_ = new Map([
|
|
70
71
|
[shaka.dependencies.Allowed.ISOBoxer, () => window.ISOBoxer],
|