shaka-player 4.12.9 → 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 +36 -36
- package/dist/shaka-player.compiled.d.ts +131 -36
- package/dist/shaka-player.compiled.debug.d.ts +131 -36
- package/dist/shaka-player.compiled.debug.externs.js +355 -107
- package/dist/shaka-player.compiled.debug.js +799 -742
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +355 -107
- package/dist/shaka-player.compiled.js +1456 -1423
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +165 -38
- package/dist/shaka-player.ui.debug.d.ts +165 -38
- package/dist/shaka-player.ui.debug.externs.js +394 -113
- package/dist/shaka-player.ui.debug.js +808 -738
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +394 -113
- package/dist/shaka-player.ui.js +1671 -1632
- 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 +137 -108
- package/externs/shaka/text.js +3 -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 +34 -24
- 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 +98 -108
- 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 +14 -14
- 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/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 +71 -26
- 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 +270 -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/ssa_text_parser.js +3 -1
- package/lib/text/stub_text_displayer.js +5 -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 +13 -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
|
@@ -53,6 +53,8 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
53
53
|
* of whether the switching is allowed.
|
|
54
54
|
* @param {shaka.net.NetworkingEngine.OnHeadersReceived=} onHeadersReceived
|
|
55
55
|
* Called when the headers are received for a download.
|
|
56
|
+
* @param {shaka.net.NetworkingEngine.OnDownloadCompleted=
|
|
57
|
+
* } onDownloadCompleted Called when a download completed successfully.
|
|
56
58
|
* @param {shaka.net.NetworkingEngine.OnDownloadFailed=} onDownloadFailed
|
|
57
59
|
* Called when a download fails, for any reason.
|
|
58
60
|
* @param {shaka.net.NetworkingEngine.OnRequest=} onRequest
|
|
@@ -62,8 +64,8 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
62
64
|
* @param {shaka.net.NetworkingEngine.OnResponse=} onResponse
|
|
63
65
|
* Called when receive the response
|
|
64
66
|
*/
|
|
65
|
-
constructor(onProgressUpdated, onHeadersReceived,
|
|
66
|
-
onRequest, onRetry, onResponse) {
|
|
67
|
+
constructor(onProgressUpdated, onHeadersReceived, onDownloadCompleted,
|
|
68
|
+
onDownloadFailed, onRequest, onRetry, onResponse) {
|
|
67
69
|
super();
|
|
68
70
|
|
|
69
71
|
/** @private {boolean} */
|
|
@@ -72,10 +74,10 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
72
74
|
/** @private {!shaka.util.OperationManager} */
|
|
73
75
|
this.operationManager_ = new shaka.util.OperationManager();
|
|
74
76
|
|
|
75
|
-
/** @private {!Set
|
|
77
|
+
/** @private {!Set<shaka.extern.RequestFilter>} */
|
|
76
78
|
this.requestFilters_ = new Set();
|
|
77
79
|
|
|
78
|
-
/** @private {!Set
|
|
80
|
+
/** @private {!Set<shaka.extern.ResponseFilter>} */
|
|
79
81
|
this.responseFilters_ = new Set();
|
|
80
82
|
|
|
81
83
|
/** @private {?shaka.net.NetworkingEngine.onProgressUpdated} */
|
|
@@ -84,6 +86,9 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
84
86
|
/** @private {?shaka.net.NetworkingEngine.OnHeadersReceived} */
|
|
85
87
|
this.onHeadersReceived_ = onHeadersReceived || null;
|
|
86
88
|
|
|
89
|
+
/** @private {?shaka.net.NetworkingEngine.OnDownloadCompleted} */
|
|
90
|
+
this.onDownloadCompleted_ = onDownloadCompleted || null;
|
|
91
|
+
|
|
87
92
|
/** @private {?shaka.net.NetworkingEngine.OnDownloadFailed} */
|
|
88
93
|
this.onDownloadFailed_ = onDownloadFailed || null;
|
|
89
94
|
|
|
@@ -104,6 +109,9 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
104
109
|
|
|
105
110
|
/** @private {number} */
|
|
106
111
|
this.minBytesForProgressEvents_ = 16e3;
|
|
112
|
+
|
|
113
|
+
/** @private {!Map<string, string>} */
|
|
114
|
+
this.hostCommonAccessTokenMap_ = new Map();
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
/**
|
|
@@ -241,6 +249,15 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
241
249
|
this.responseFilters_.clear();
|
|
242
250
|
}
|
|
243
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Clears Common Access Token map.
|
|
254
|
+
*
|
|
255
|
+
* @export
|
|
256
|
+
*/
|
|
257
|
+
clearCommonAccessTokenMap() {
|
|
258
|
+
this.hostCommonAccessTokenMap_.clear();
|
|
259
|
+
}
|
|
260
|
+
|
|
244
261
|
/**
|
|
245
262
|
* Gets a copy of the default retry parameters.
|
|
246
263
|
*
|
|
@@ -258,7 +275,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
258
275
|
/**
|
|
259
276
|
* Makes a simple network request for the given URIs.
|
|
260
277
|
*
|
|
261
|
-
* @param {!Array
|
|
278
|
+
* @param {!Array<string>} uris
|
|
262
279
|
* @param {shaka.extern.RetryParameters} retryParams
|
|
263
280
|
* @param {?function(BufferSource):!Promise=} streamDataCallback
|
|
264
281
|
* @return {shaka.extern.Request}
|
|
@@ -289,6 +306,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
289
306
|
this.destroyed_ = true;
|
|
290
307
|
this.requestFilters_.clear();
|
|
291
308
|
this.responseFilters_.clear();
|
|
309
|
+
this.hostCommonAccessTokenMap_.clear();
|
|
292
310
|
|
|
293
311
|
// FakeEventTarget implements IReleasable
|
|
294
312
|
super.release();
|
|
@@ -453,8 +471,8 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
453
471
|
* @param {shaka.net.NetworkingEngine.RequestType} type
|
|
454
472
|
* @param {shaka.extern.Request} request
|
|
455
473
|
* @param {(shaka.extern.RequestContext|undefined)} context
|
|
456
|
-
* @param {shaka.net.NetworkingEngine.NumBytesRemainingClass
|
|
457
|
-
*
|
|
474
|
+
* @param {shaka.net.NetworkingEngine.NumBytesRemainingClass
|
|
475
|
+
* } numBytesRemainingObj
|
|
458
476
|
* @return {!shaka.extern.IAbortableOperation.<
|
|
459
477
|
* shaka.net.NetworkingEngine.ResponseAndGotProgress>}
|
|
460
478
|
* @private
|
|
@@ -477,8 +495,8 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
477
495
|
* @param {!shaka.net.Backoff} backoff
|
|
478
496
|
* @param {number} index
|
|
479
497
|
* @param {?shaka.util.Error} lastError
|
|
480
|
-
* @param {shaka.net.NetworkingEngine.NumBytesRemainingClass
|
|
481
|
-
*
|
|
498
|
+
* @param {shaka.net.NetworkingEngine.NumBytesRemainingClass
|
|
499
|
+
* } numBytesRemainingObj
|
|
482
500
|
* @return {!shaka.extern.IAbortableOperation.<
|
|
483
501
|
* shaka.net.NetworkingEngine.ResponseAndGotProgress>}
|
|
484
502
|
* @private
|
|
@@ -533,6 +551,13 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
533
551
|
}
|
|
534
552
|
const progressSupport = object.progressSupport;
|
|
535
553
|
|
|
554
|
+
// Add headers from CommonAccessToken
|
|
555
|
+
const commonAccessToken =
|
|
556
|
+
this.hostCommonAccessTokenMap_.get(uri.getDomain());
|
|
557
|
+
if (commonAccessToken) {
|
|
558
|
+
request.headers[shaka.net.NetworkingEngine.CommonAccessTokenHeaderName_] =
|
|
559
|
+
commonAccessToken;
|
|
560
|
+
}
|
|
536
561
|
|
|
537
562
|
// Every attempt must have an associated backoff.attempt() call so that the
|
|
538
563
|
// accounting is correct.
|
|
@@ -624,6 +649,14 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
624
649
|
if (response.timeMs == undefined) {
|
|
625
650
|
response.timeMs = Date.now() - startTimeMs;
|
|
626
651
|
}
|
|
652
|
+
// Process headers to get the new CommonAccessToken
|
|
653
|
+
const commonAccessTokenHeader = response.headers[
|
|
654
|
+
shaka.net.NetworkingEngine.CommonAccessTokenHeaderName_];
|
|
655
|
+
if (commonAccessTokenHeader) {
|
|
656
|
+
const responseHost = new goog.Uri(response.uri);
|
|
657
|
+
this.hostCommonAccessTokenMap_.set(
|
|
658
|
+
responseHost.getDomain(), commonAccessTokenHeader);
|
|
659
|
+
}
|
|
627
660
|
const responseAndGotProgress = {
|
|
628
661
|
response: response,
|
|
629
662
|
gotProgress: gotProgress,
|
|
@@ -635,7 +668,9 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
635
668
|
this.onHeadersReceived_(response.headers, request, type);
|
|
636
669
|
}
|
|
637
670
|
}
|
|
638
|
-
|
|
671
|
+
if (this.onDownloadCompleted_) {
|
|
672
|
+
this.onDownloadCompleted_(request, response);
|
|
673
|
+
}
|
|
639
674
|
return responseAndGotProgress;
|
|
640
675
|
}, (error) => {
|
|
641
676
|
if (connectionTimer) {
|
|
@@ -700,8 +735,8 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
700
735
|
|
|
701
736
|
/**
|
|
702
737
|
* @param {shaka.net.NetworkingEngine.RequestType} type
|
|
703
|
-
* @param {shaka.net.NetworkingEngine.ResponseAndGotProgress
|
|
704
|
-
* responseAndGotProgress
|
|
738
|
+
* @param {shaka.net.NetworkingEngine.ResponseAndGotProgress
|
|
739
|
+
* } responseAndGotProgress
|
|
705
740
|
* @param {shaka.extern.RequestContext=} context
|
|
706
741
|
* @return {!shaka.extern.IAbortableOperation.<
|
|
707
742
|
* shaka.net.NetworkingEngine.ResponseAndGotProgress>}
|
|
@@ -828,12 +863,12 @@ class extends shaka.util.AbortableOperation {
|
|
|
828
863
|
* shaka.util.Error object using the error code OPERATION_ABORTED.
|
|
829
864
|
* @param {function():!Promise} onAbort
|
|
830
865
|
* Will be called by this object to abort the underlying operation. This
|
|
831
|
-
* is not
|
|
866
|
+
* is not cancellation, and will not necessarily result in any work being
|
|
832
867
|
* undone. abort() should return a Promise which is resolved when the
|
|
833
868
|
* underlying operation has been aborted. The returned Promise should
|
|
834
869
|
* never be rejected.
|
|
835
|
-
* @param {shaka.net.NetworkingEngine.NumBytesRemainingClass
|
|
836
|
-
*
|
|
870
|
+
* @param {shaka.net.NetworkingEngine.NumBytesRemainingClass
|
|
871
|
+
* } numBytesRemainingObj
|
|
837
872
|
*/
|
|
838
873
|
constructor(promise, onAbort, numBytesRemainingObj) {
|
|
839
874
|
super(promise, onAbort);
|
|
@@ -850,6 +885,14 @@ class extends shaka.util.AbortableOperation {
|
|
|
850
885
|
}
|
|
851
886
|
};
|
|
852
887
|
|
|
888
|
+
/**
|
|
889
|
+
* @const {string}
|
|
890
|
+
* @private
|
|
891
|
+
*/
|
|
892
|
+
shaka.net.NetworkingEngine.CommonAccessTokenHeaderName_ =
|
|
893
|
+
'common-access-token';
|
|
894
|
+
|
|
895
|
+
|
|
853
896
|
/**
|
|
854
897
|
* Request types. Allows a filter to decide which requests to read/alter.
|
|
855
898
|
*
|
|
@@ -929,7 +972,7 @@ shaka.net.NetworkingEngine.SchemeObject;
|
|
|
929
972
|
/**
|
|
930
973
|
* Contains the scheme plugins.
|
|
931
974
|
*
|
|
932
|
-
* @private {!Object
|
|
975
|
+
* @private {!Object<string, shaka.net.NetworkingEngine.SchemeObject>}
|
|
933
976
|
*/
|
|
934
977
|
shaka.net.NetworkingEngine.schemes_ = {};
|
|
935
978
|
|
|
@@ -952,7 +995,7 @@ shaka.net.NetworkingEngine.ResponseAndGotProgress;
|
|
|
952
995
|
|
|
953
996
|
/**
|
|
954
997
|
* @typedef {function(
|
|
955
|
-
* !Object
|
|
998
|
+
* !Object<string, string>,
|
|
956
999
|
* !shaka.extern.Request,
|
|
957
1000
|
* !shaka.net.NetworkingEngine.RequestType)}
|
|
958
1001
|
*
|
|
@@ -979,6 +1022,18 @@ shaka.net.NetworkingEngine.OnHeadersReceived;
|
|
|
979
1022
|
*/
|
|
980
1023
|
shaka.net.NetworkingEngine.onProgressUpdated;
|
|
981
1024
|
|
|
1025
|
+
/**
|
|
1026
|
+
* @typedef {function(
|
|
1027
|
+
* !shaka.extern.Request,
|
|
1028
|
+
* !shaka.extern.Response)}
|
|
1029
|
+
*
|
|
1030
|
+
* @description
|
|
1031
|
+
* A callback function that notifies the player when a download completed
|
|
1032
|
+
* successfully.
|
|
1033
|
+
* @export
|
|
1034
|
+
*/
|
|
1035
|
+
shaka.net.NetworkingEngine.OnDownloadCompleted;
|
|
1036
|
+
|
|
982
1037
|
/**
|
|
983
1038
|
* @typedef {function(
|
|
984
1039
|
* !shaka.extern.Request,
|
|
@@ -19,7 +19,7 @@ shaka.net.NetworkingUtils = class {
|
|
|
19
19
|
* @param {string} uri
|
|
20
20
|
* @param {!shaka.net.NetworkingEngine} netEngine
|
|
21
21
|
* @param {shaka.extern.RetryParameters} retryParams
|
|
22
|
-
* @return {!Promise
|
|
22
|
+
* @return {!Promise<string>}
|
|
23
23
|
*/
|
|
24
24
|
static async getMimeType(uri, netEngine, retryParams) {
|
|
25
25
|
const extension = shaka.net.NetworkingUtils.getExtension_(uri);
|
|
@@ -73,7 +73,7 @@ shaka.net.NetworkingUtils = class {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* @const {!Object
|
|
76
|
+
* @const {!Object<string, string>}
|
|
77
77
|
* @private
|
|
78
78
|
*/
|
|
79
79
|
shaka.net.NetworkingUtils.EXTENSIONS_TO_MIME_TYPES_ = {
|
|
@@ -104,9 +104,12 @@ shaka.net.NetworkingUtils.EXTENSIONS_TO_MIME_TYPES_ = {
|
|
|
104
104
|
'lrc': 'application/x-subtitle-lrc',
|
|
105
105
|
'ssa': 'text/x-ssa',
|
|
106
106
|
'ass': 'text/x-ssa',
|
|
107
|
+
'jpeg': 'image/jpeg',
|
|
107
108
|
'jpg': 'image/jpeg',
|
|
108
109
|
'png': 'image/png',
|
|
109
110
|
'svg': 'image/svg+xml',
|
|
110
111
|
'webp': 'image/webp',
|
|
111
112
|
'avif': 'image/avif',
|
|
113
|
+
'html': 'text/html',
|
|
114
|
+
'htm': 'text/html',
|
|
112
115
|
};
|
|
@@ -22,8 +22,9 @@ shaka.offline.DownloadInfo = class {
|
|
|
22
22
|
* @param {number} estimateId
|
|
23
23
|
* @param {number} groupId
|
|
24
24
|
* @param {boolean} isInitSegment
|
|
25
|
+
* @param {number} refPosition
|
|
25
26
|
*/
|
|
26
|
-
constructor(ref, estimateId, groupId, isInitSegment) {
|
|
27
|
+
constructor(ref, estimateId, groupId, isInitSegment, refPosition) {
|
|
27
28
|
/** @type {shaka.media.SegmentReference|shaka.media.InitSegmentReference} */
|
|
28
29
|
this.ref = ref;
|
|
29
30
|
|
|
@@ -35,6 +36,9 @@ shaka.offline.DownloadInfo = class {
|
|
|
35
36
|
|
|
36
37
|
/** @type {boolean} */
|
|
37
38
|
this.isInitSegment = isInitSegment;
|
|
39
|
+
|
|
40
|
+
/** @type {number} */
|
|
41
|
+
this.refPosition = refPosition;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
/**
|
|
@@ -38,7 +38,7 @@ shaka.offline.DownloadManager = class {
|
|
|
38
38
|
* series. Between groups, the requests are executed in parallel. We store
|
|
39
39
|
* the promise chain that is doing the work.
|
|
40
40
|
*
|
|
41
|
-
* @private {!Map
|
|
41
|
+
* @private {!Map<number, !Promise>}
|
|
42
42
|
*/
|
|
43
43
|
this.groups_ = new Map();
|
|
44
44
|
|
|
@@ -51,7 +51,7 @@ shaka.offline.DownloadManager = class {
|
|
|
51
51
|
/**
|
|
52
52
|
* A list of callback functions to cancel any in-progress downloads.
|
|
53
53
|
*
|
|
54
|
-
* @private {!Array
|
|
54
|
+
* @private {!Array<function(): !Promise>}
|
|
55
55
|
*/
|
|
56
56
|
this.abortCallbacks_ = [];
|
|
57
57
|
|
|
@@ -75,6 +75,9 @@ shaka.offline.DownloadManager = class {
|
|
|
75
75
|
|
|
76
76
|
/** @private {shaka.offline.DownloadProgressEstimator} */
|
|
77
77
|
this.estimator_ = new shaka.offline.DownloadProgressEstimator();
|
|
78
|
+
|
|
79
|
+
/** @private {boolean} */
|
|
80
|
+
this.aborted_ = false;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
/** @override */
|
|
@@ -97,11 +100,19 @@ shaka.offline.DownloadManager = class {
|
|
|
97
100
|
* aborted.
|
|
98
101
|
*/
|
|
99
102
|
abortAll() {
|
|
103
|
+
this.aborted_ = true;
|
|
100
104
|
const promises = this.abortCallbacks_.map((callback) => callback());
|
|
101
105
|
this.abortCallbacks_ = [];
|
|
102
106
|
return Promise.all(promises);
|
|
103
107
|
}
|
|
104
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @return {boolean}
|
|
111
|
+
*/
|
|
112
|
+
isAborted() {
|
|
113
|
+
return this.aborted_;
|
|
114
|
+
}
|
|
115
|
+
|
|
105
116
|
/**
|
|
106
117
|
* Adds a byte length to the download estimate.
|
|
107
118
|
*
|
|
@@ -247,7 +258,7 @@ shaka.offline.DownloadManager = class {
|
|
|
247
258
|
* Get a promise that will resolve when all currently queued downloads have
|
|
248
259
|
* finished.
|
|
249
260
|
*
|
|
250
|
-
* @return {!Promise
|
|
261
|
+
* @return {!Promise<number>}
|
|
251
262
|
*/
|
|
252
263
|
async waitToFinish() {
|
|
253
264
|
await Promise.all(this.groups_.values());
|
|
@@ -258,7 +269,7 @@ shaka.offline.DownloadManager = class {
|
|
|
258
269
|
* Download a segment and return the data in the response.
|
|
259
270
|
*
|
|
260
271
|
* @param {shaka.extern.Request} request
|
|
261
|
-
* @return {!Promise
|
|
272
|
+
* @return {!Promise<BufferSource>}
|
|
262
273
|
* @private
|
|
263
274
|
*/
|
|
264
275
|
async fetchSegment_(request) {
|
|
@@ -48,7 +48,7 @@ shaka.offline.DownloadProgressEstimator = class {
|
|
|
48
48
|
* internal id) to the estimate. This will allow us to update
|
|
49
49
|
* |estimatedDownloaded_| when |close| is called.
|
|
50
50
|
*
|
|
51
|
-
* @private {!Map
|
|
51
|
+
* @private {!Map<number, number>}
|
|
52
52
|
*/
|
|
53
53
|
this.pending_ = new Map();
|
|
54
54
|
|
|
@@ -122,7 +122,7 @@ shaka.offline.indexeddb.BaseStorageCell = class {
|
|
|
122
122
|
/** @type {!shaka.offline.indexeddb.DBOperation} */
|
|
123
123
|
const op = this.connection_.startReadOnlyOperation(this.manifestStore_);
|
|
124
124
|
|
|
125
|
-
/** @type {!Map
|
|
125
|
+
/** @type {!Map<number, shaka.extern.ManifestDB>} */
|
|
126
126
|
const values = new Map();
|
|
127
127
|
|
|
128
128
|
await op.forEachEntry(async (key, value) => {
|
|
@@ -146,7 +146,7 @@ shaka.offline.indexeddb.BaseStorageCell = class {
|
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* @param {?} old
|
|
149
|
-
* @return {!Promise
|
|
149
|
+
* @return {!Promise<shaka.extern.ManifestDB>}
|
|
150
150
|
* @protected
|
|
151
151
|
*/
|
|
152
152
|
convertManifest(old) {
|
|
@@ -182,8 +182,8 @@ shaka.offline.indexeddb.BaseStorageCell = class {
|
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
184
|
* @param {string} storeName
|
|
185
|
-
* @param {!Array
|
|
186
|
-
* @return {!Promise
|
|
185
|
+
* @param {!Array<T>} values
|
|
186
|
+
* @return {!Promise<!Array<number>>}
|
|
187
187
|
* @template T
|
|
188
188
|
* @protected
|
|
189
189
|
*/
|
|
@@ -191,7 +191,7 @@ shaka.offline.indexeddb.BaseStorageCell = class {
|
|
|
191
191
|
const op = this.connection_.startReadWriteOperation(storeName);
|
|
192
192
|
const store = op.store();
|
|
193
193
|
|
|
194
|
-
/** @type {!Array
|
|
194
|
+
/** @type {!Array<number>} */
|
|
195
195
|
const keys = [];
|
|
196
196
|
|
|
197
197
|
// Write each segment out. When each request completes, the key will
|
|
@@ -213,7 +213,7 @@ shaka.offline.indexeddb.BaseStorageCell = class {
|
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
215
|
* @param {string} storeName
|
|
216
|
-
* @param {!Array
|
|
216
|
+
* @param {!Array<number>} keys
|
|
217
217
|
* @param {function(number)} onRemove
|
|
218
218
|
* @return {!Promise}
|
|
219
219
|
* @private
|
|
@@ -231,8 +231,8 @@ shaka.offline.indexeddb.BaseStorageCell = class {
|
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
233
|
* @param {string} storeName
|
|
234
|
-
* @param {!Array
|
|
235
|
-
* @return {!Promise
|
|
234
|
+
* @param {!Array<number>} keys
|
|
235
|
+
* @return {!Promise<!Array<T>>}
|
|
236
236
|
* @template T
|
|
237
237
|
* @private
|
|
238
238
|
*/
|
|
@@ -241,7 +241,7 @@ shaka.offline.indexeddb.BaseStorageCell = class {
|
|
|
241
241
|
const store = op.store();
|
|
242
242
|
|
|
243
243
|
const values = {};
|
|
244
|
-
/** @type {!Array
|
|
244
|
+
/** @type {!Array<number>} */
|
|
245
245
|
const missing = [];
|
|
246
246
|
|
|
247
247
|
// Use a map to store the objects so that we can reorder the results to
|
|
@@ -22,7 +22,7 @@ shaka.offline.indexeddb.DBConnection = class {
|
|
|
22
22
|
constructor(connection) {
|
|
23
23
|
/** @private {IDBDatabase} */
|
|
24
24
|
this.connection_ = connection;
|
|
25
|
-
/** @private {!Array
|
|
25
|
+
/** @private {!Array<shaka.offline.indexeddb.DBOperation>} */
|
|
26
26
|
this.pending_ = [];
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -62,8 +62,8 @@ shaka.offline.indexeddb.DBOperation = class {
|
|
|
62
62
|
/**
|
|
63
63
|
* Calls the given callback for each entry in the database.
|
|
64
64
|
*
|
|
65
|
-
* @param {function(!IDBKeyType, T, !IDBCursorWithValue=):
|
|
66
|
-
*
|
|
65
|
+
* @param {function(!IDBKeyType, T, !IDBCursorWithValue=):
|
|
66
|
+
* (Promise|undefined)} callback
|
|
67
67
|
* @return {!Promise}
|
|
68
68
|
* @template T
|
|
69
69
|
*/
|
|
@@ -35,7 +35,7 @@ shaka.offline.indexeddb.EmeSessionStorageCell = class {
|
|
|
35
35
|
async getAll() {
|
|
36
36
|
/** @type {!shaka.offline.indexeddb.DBOperation} */
|
|
37
37
|
const op = this.connection_.startReadOnlyOperation(this.store_);
|
|
38
|
-
/** @type {!Array
|
|
38
|
+
/** @type {!Array<shaka.extern.EmeSessionDB>} */
|
|
39
39
|
const values = [];
|
|
40
40
|
|
|
41
41
|
await op.forEachEntry((key, value) => {
|
|
@@ -392,7 +392,7 @@ shaka.offline.indexeddb.StorageMechanism.SESSION_ID_STORE = 'session-ids';
|
|
|
392
392
|
shaka.offline.StorageMuxer.register(
|
|
393
393
|
'idb',
|
|
394
394
|
() => {
|
|
395
|
-
// Offline storage is not supported on the Chromecast Linux/
|
|
395
|
+
// Offline storage is not supported on the Chromecast Linux/Fuchsia or
|
|
396
396
|
// Xbox One platforms.
|
|
397
397
|
if ((shaka.util.Platform.isChromecast() &&
|
|
398
398
|
!shaka.util.Platform.isAndroidCastDevice()) ||
|
|
@@ -42,7 +42,7 @@ shaka.offline.indexeddb.V1StorageCell = class
|
|
|
42
42
|
// Indexeddb does not fail when you get a value that is not in the
|
|
43
43
|
// database. It will return an undefined value. However, we expect
|
|
44
44
|
// the value to never be null, so something is wrong if we get a
|
|
45
|
-
//
|
|
45
|
+
// falsy value.
|
|
46
46
|
if (manifest) {
|
|
47
47
|
// Since this store's scheme uses in-line keys, we don't specify the key
|
|
48
48
|
// with |put|. This difference is why we must override the base class.
|
|
@@ -69,7 +69,7 @@ shaka.offline.indexeddb.V1StorageCell = class
|
|
|
69
69
|
/**
|
|
70
70
|
* @override
|
|
71
71
|
* @param {shaka.extern.ManifestDBV1} old
|
|
72
|
-
* @return {!Promise
|
|
72
|
+
* @return {!Promise<shaka.extern.ManifestDB>}
|
|
73
73
|
*/
|
|
74
74
|
async convertManifest(old) {
|
|
75
75
|
const V1StorageCell = shaka.offline.indexeddb.V1StorageCell;
|
|
@@ -106,7 +106,7 @@ shaka.offline.indexeddb.V1StorageCell = class
|
|
|
106
106
|
/**
|
|
107
107
|
* @param {shaka.extern.PeriodDBV1} old
|
|
108
108
|
* @param {number} periodDuration
|
|
109
|
-
* @return {!Array
|
|
109
|
+
* @return {!Array<shaka.extern.StreamDB>}
|
|
110
110
|
* @private
|
|
111
111
|
*/
|
|
112
112
|
static convertPeriod_(old, periodDuration) {
|
|
@@ -31,7 +31,7 @@ shaka.offline.indexeddb.V2StorageCell = class
|
|
|
31
31
|
/**
|
|
32
32
|
* @override
|
|
33
33
|
* @param {shaka.extern.ManifestDBV2} old
|
|
34
|
-
* @return {!Promise
|
|
34
|
+
* @return {!Promise<shaka.extern.ManifestDB>}
|
|
35
35
|
*/
|
|
36
36
|
async convertManifest(old) {
|
|
37
37
|
const streamsPerPeriod = [];
|
|
@@ -67,7 +67,7 @@ shaka.offline.indexeddb.V2StorageCell = class
|
|
|
67
67
|
/**
|
|
68
68
|
* @param {shaka.extern.PeriodDBV2} period
|
|
69
69
|
* @param {number} periodDuration
|
|
70
|
-
* @return {!Array
|
|
70
|
+
* @return {!Array<shaka.extern.StreamDB>}
|
|
71
71
|
* @private
|
|
72
72
|
*/
|
|
73
73
|
convertPeriod_(period, periodDuration) {
|
|
@@ -49,23 +49,23 @@ shaka.offline.ManifestConverter = class {
|
|
|
49
49
|
const timeline = new shaka.media.PresentationTimeline(null, 0);
|
|
50
50
|
timeline.setDuration(manifestDB.duration);
|
|
51
51
|
|
|
52
|
-
/** @type {!Array
|
|
52
|
+
/** @type {!Array<shaka.extern.StreamDB>} */
|
|
53
53
|
const audioStreams =
|
|
54
54
|
manifestDB.streams.filter((streamDB) => this.isAudio_(streamDB));
|
|
55
55
|
|
|
56
|
-
/** @type {!Array
|
|
56
|
+
/** @type {!Array<shaka.extern.StreamDB>} */
|
|
57
57
|
const videoStreams =
|
|
58
58
|
manifestDB.streams.filter((streamDB) => this.isVideo_(streamDB));
|
|
59
59
|
|
|
60
|
-
/** @type {!Map
|
|
60
|
+
/** @type {!Map<number, shaka.extern.Variant>} */
|
|
61
61
|
const variants = this.createVariants(audioStreams, videoStreams, timeline);
|
|
62
62
|
|
|
63
|
-
/** @type {!Array
|
|
63
|
+
/** @type {!Array<shaka.extern.Stream>} */
|
|
64
64
|
const textStreams =
|
|
65
65
|
manifestDB.streams.filter((streamDB) => this.isText_(streamDB))
|
|
66
66
|
.map((streamDB) => this.fromStreamDB_(streamDB, timeline));
|
|
67
67
|
|
|
68
|
-
/** @type {!Array
|
|
68
|
+
/** @type {!Array<shaka.extern.Stream>} */
|
|
69
69
|
const imageStreams =
|
|
70
70
|
manifestDB.streams.filter((streamDB) => this.isImage_(streamDB))
|
|
71
71
|
.map((streamDB) => this.fromStreamDB_(streamDB, timeline));
|
|
@@ -84,7 +84,6 @@ shaka.offline.ManifestConverter = class {
|
|
|
84
84
|
|
|
85
85
|
return {
|
|
86
86
|
presentationTimeline: timeline,
|
|
87
|
-
minBufferTime: 2,
|
|
88
87
|
offlineSessionIds: manifestDB.sessionIds,
|
|
89
88
|
variants: Array.from(variants.values()),
|
|
90
89
|
textStreams: textStreams,
|
|
@@ -104,14 +103,14 @@ shaka.offline.ManifestConverter = class {
|
|
|
104
103
|
/**
|
|
105
104
|
* Recreates Variants from audio and video StreamDB collections.
|
|
106
105
|
*
|
|
107
|
-
* @param {!Array
|
|
108
|
-
* @param {!Array
|
|
106
|
+
* @param {!Array<!shaka.extern.StreamDB>} audios
|
|
107
|
+
* @param {!Array<!shaka.extern.StreamDB>} videos
|
|
109
108
|
* @param {shaka.media.PresentationTimeline} timeline
|
|
110
|
-
* @return {!Map
|
|
109
|
+
* @return {!Map<number, !shaka.extern.Variant>}
|
|
111
110
|
*/
|
|
112
111
|
createVariants(audios, videos, timeline) {
|
|
113
112
|
// Get all the variant ids from all audio and video streams.
|
|
114
|
-
/** @type {!Set
|
|
113
|
+
/** @type {!Set<number>} */
|
|
115
114
|
const variantIds = new Set();
|
|
116
115
|
for (const streamDB of audios) {
|
|
117
116
|
for (const id of streamDB.variantIds) {
|
|
@@ -124,7 +123,7 @@ shaka.offline.ManifestConverter = class {
|
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
/** @type {!Map
|
|
126
|
+
/** @type {!Map<number, shaka.extern.Variant>} */
|
|
128
127
|
const variantMap = new Map();
|
|
129
128
|
for (const id of variantIds) {
|
|
130
129
|
variantMap.set(id, this.createEmptyVariant_(id));
|
|
@@ -173,7 +172,7 @@ shaka.offline.ManifestConverter = class {
|
|
|
173
172
|
* @private
|
|
174
173
|
*/
|
|
175
174
|
fromStreamDB_(streamDB, timeline) {
|
|
176
|
-
/** @type {!Array
|
|
175
|
+
/** @type {!Array<!shaka.media.SegmentReference>} */
|
|
177
176
|
const segments = streamDB.segments.map(
|
|
178
177
|
(segment, index) => this.fromSegmentDB_(index, segment, streamDB));
|
|
179
178
|
|
|
@@ -32,12 +32,12 @@ shaka.offline.OfflineScheme = class {
|
|
|
32
32
|
const offlineUri = shaka.offline.OfflineUri.parse(uri);
|
|
33
33
|
|
|
34
34
|
if (offlineUri && offlineUri.isManifest()) {
|
|
35
|
-
return shaka.offline.OfflineScheme.getManifest_(uri);
|
|
35
|
+
return shaka.offline.OfflineScheme.getManifest_(uri, request);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (offlineUri && offlineUri.isSegment()) {
|
|
39
39
|
return shaka.offline.OfflineScheme.getSegment_(
|
|
40
|
-
offlineUri.key(), offlineUri);
|
|
40
|
+
offlineUri.key(), offlineUri, request);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return shaka.util.AbortableOperation.failed(
|
|
@@ -50,16 +50,18 @@ shaka.offline.OfflineScheme = class {
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* @param {string} uri
|
|
53
|
+
* @param {shaka.extern.Request} request
|
|
53
54
|
* @return {!shaka.extern.IAbortableOperation.<shaka.extern.Response>}
|
|
54
55
|
* @private
|
|
55
56
|
*/
|
|
56
|
-
static getManifest_(uri) {
|
|
57
|
+
static getManifest_(uri, request) {
|
|
57
58
|
/** @type {shaka.extern.Response} */
|
|
58
59
|
const response = {
|
|
59
60
|
uri: uri,
|
|
60
61
|
originalUri: uri,
|
|
61
62
|
data: new ArrayBuffer(0),
|
|
62
63
|
headers: {'content-type': 'application/x-offline-manifest'},
|
|
64
|
+
originalRequest: request,
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
return shaka.util.AbortableOperation.completed(response);
|
|
@@ -68,10 +70,11 @@ shaka.offline.OfflineScheme = class {
|
|
|
68
70
|
/**
|
|
69
71
|
* @param {number} id
|
|
70
72
|
* @param {!shaka.offline.OfflineUri} uri
|
|
73
|
+
* @param {shaka.extern.Request} request
|
|
71
74
|
* @return {!shaka.extern.IAbortableOperation.<shaka.extern.Response>}
|
|
72
75
|
* @private
|
|
73
76
|
*/
|
|
74
|
-
static getSegment_(id, uri) {
|
|
77
|
+
static getSegment_(id, uri, request) {
|
|
75
78
|
goog.asserts.assert(
|
|
76
79
|
uri.isSegment(),
|
|
77
80
|
'Only segment uri\'s should be given to getSegment');
|
|
@@ -90,6 +93,7 @@ shaka.offline.OfflineScheme = class {
|
|
|
90
93
|
uri: uri,
|
|
91
94
|
data: segment.data,
|
|
92
95
|
headers: {},
|
|
96
|
+
originalRequest: request,
|
|
93
97
|
};
|
|
94
98
|
})
|
|
95
99
|
.finally(() => muxer.destroy());
|