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
|
@@ -20,12 +20,12 @@ goog.require('shaka.util.Timer');
|
|
|
20
20
|
*
|
|
21
21
|
* @implements {shaka.extern.SegmentIndex}
|
|
22
22
|
* @implements {shaka.util.IReleasable}
|
|
23
|
-
* @implements {Iterable
|
|
23
|
+
* @implements {Iterable<!shaka.media.SegmentReference>}
|
|
24
24
|
* @export
|
|
25
25
|
*/
|
|
26
26
|
shaka.media.SegmentIndex = class {
|
|
27
27
|
/**
|
|
28
|
-
* @param {!Array
|
|
28
|
+
* @param {!Array<!shaka.media.SegmentReference>} references The list of
|
|
29
29
|
* SegmentReferences, which must be sorted first by their start times
|
|
30
30
|
* (ascending) and second by their end times (ascending).
|
|
31
31
|
*/
|
|
@@ -34,7 +34,7 @@ shaka.media.SegmentIndex = class {
|
|
|
34
34
|
shaka.media.SegmentIndex.assertCorrectReferences_(references);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/** @protected {!Array
|
|
37
|
+
/** @protected {!Array<!shaka.media.SegmentReference>} */
|
|
38
38
|
this.references = references;
|
|
39
39
|
|
|
40
40
|
/** @private {shaka.util.Timer} */
|
|
@@ -213,7 +213,7 @@ shaka.media.SegmentIndex = class {
|
|
|
213
213
|
* all available references, so we must keep available references in memory to
|
|
214
214
|
* fill the availability window.
|
|
215
215
|
*
|
|
216
|
-
* @param {!Array
|
|
216
|
+
* @param {!Array<!shaka.media.SegmentReference>} references The list of
|
|
217
217
|
* SegmentReferences, which must be sorted first by their start times
|
|
218
218
|
* (ascending) and second by their end times (ascending).
|
|
219
219
|
*/
|
|
@@ -254,7 +254,7 @@ shaka.media.SegmentIndex = class {
|
|
|
254
254
|
* all available references, so we must keep available references in memory to
|
|
255
255
|
* fill the availability window.
|
|
256
256
|
*
|
|
257
|
-
* @param {!Array
|
|
257
|
+
* @param {!Array<!shaka.media.SegmentReference>} references The list of
|
|
258
258
|
* SegmentReferences, which must be sorted first by their start times
|
|
259
259
|
* (ascending) and second by their end times (ascending).
|
|
260
260
|
* @param {number} windowStart The start of the availability window to filter
|
|
@@ -389,7 +389,7 @@ shaka.media.SegmentIndex = class {
|
|
|
389
389
|
* returned by the callback is null.
|
|
390
390
|
*
|
|
391
391
|
* @param {number} interval The interval in seconds.
|
|
392
|
-
* @param {function():Array
|
|
392
|
+
* @param {function(): Array<shaka.media.SegmentReference>} updateCallback
|
|
393
393
|
* @export
|
|
394
394
|
*/
|
|
395
395
|
updateEvery(interval, updateCallback) {
|
|
@@ -435,12 +435,12 @@ shaka.media.SegmentIndex = class {
|
|
|
435
435
|
* Playlist will contain at least one independent frame."
|
|
436
436
|
*
|
|
437
437
|
* @param {number} time
|
|
438
|
-
* @param {boolean=}
|
|
438
|
+
* @param {boolean=} allowNonIndependent
|
|
439
439
|
* @param {boolean=} reverse
|
|
440
440
|
* @return {?shaka.media.SegmentIterator}
|
|
441
441
|
* @export
|
|
442
442
|
*/
|
|
443
|
-
getIteratorForTime(time,
|
|
443
|
+
getIteratorForTime(time, allowNonIndependent = false, reverse = false) {
|
|
444
444
|
let index = this.find(time);
|
|
445
445
|
if (index == null) {
|
|
446
446
|
return null;
|
|
@@ -463,7 +463,7 @@ shaka.media.SegmentIndex = class {
|
|
|
463
463
|
let r = ref.partialReferences[i];
|
|
464
464
|
// Note that a segment ends immediately before the end time.
|
|
465
465
|
if ((time >= r.startTime) && (time < r.endTime)) {
|
|
466
|
-
if (!
|
|
466
|
+
if (!allowNonIndependent) {
|
|
467
467
|
// Find an independent partial segment by moving backwards.
|
|
468
468
|
while (i && (!r.isIndependent())) {
|
|
469
469
|
i--;
|
|
@@ -503,7 +503,7 @@ shaka.media.SegmentIndex = class {
|
|
|
503
503
|
*
|
|
504
504
|
* @param {number} startTime
|
|
505
505
|
* @param {number} duration
|
|
506
|
-
* @param {!Array
|
|
506
|
+
* @param {!Array<string>} uris
|
|
507
507
|
* @return {!shaka.media.SegmentIndex}
|
|
508
508
|
* @export
|
|
509
509
|
*/
|
|
@@ -527,7 +527,7 @@ if (goog.DEBUG) {
|
|
|
527
527
|
/**
|
|
528
528
|
* Asserts that the given SegmentReferences are sorted.
|
|
529
529
|
*
|
|
530
|
-
* @param {!Array
|
|
530
|
+
* @param {!Array<shaka.media.SegmentReference>} references
|
|
531
531
|
* @private
|
|
532
532
|
*/
|
|
533
533
|
shaka.media.SegmentIndex.assertCorrectReferences_ = (references) => {
|
|
@@ -555,7 +555,7 @@ if (goog.DEBUG) {
|
|
|
555
555
|
/**
|
|
556
556
|
* An iterator over a SegmentIndex's references.
|
|
557
557
|
*
|
|
558
|
-
* @implements {Iterator
|
|
558
|
+
* @implements {Iterator<shaka.media.SegmentReference>}
|
|
559
559
|
* @export
|
|
560
560
|
*/
|
|
561
561
|
shaka.media.SegmentIterator = class {
|
|
@@ -708,7 +708,7 @@ shaka.media.SegmentIterator = class {
|
|
|
708
708
|
*
|
|
709
709
|
* @extends shaka.media.SegmentIndex
|
|
710
710
|
* @implements {shaka.util.IReleasable}
|
|
711
|
-
* @implements {Iterable
|
|
711
|
+
* @implements {Iterable<!shaka.media.SegmentReference>}
|
|
712
712
|
* @export
|
|
713
713
|
*/
|
|
714
714
|
shaka.media.MetaSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
@@ -716,7 +716,7 @@ shaka.media.MetaSegmentIndex = class extends shaka.media.SegmentIndex {
|
|
|
716
716
|
constructor() {
|
|
717
717
|
super([]);
|
|
718
718
|
|
|
719
|
-
/** @private {!Array
|
|
719
|
+
/** @private {!Array<!shaka.media.SegmentIndex>} */
|
|
720
720
|
this.indexes_ = [];
|
|
721
721
|
}
|
|
722
722
|
|
|
@@ -40,15 +40,15 @@ shaka.media.SegmentPrefetch = class {
|
|
|
40
40
|
this.fetchDispatcher_ = fetchDispatcher;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* @private {!Map
|
|
44
|
-
* !
|
|
43
|
+
* @private {!Map<
|
|
44
|
+
* !shaka.media.SegmentReference,
|
|
45
45
|
* !shaka.media.SegmentPrefetchOperation>}
|
|
46
46
|
*/
|
|
47
47
|
this.segmentPrefetchMap_ = new Map();
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* @private {!Map
|
|
51
|
-
* !
|
|
50
|
+
* @private {!Map<
|
|
51
|
+
* !shaka.media.InitSegmentReference,
|
|
52
52
|
* !shaka.media.SegmentPrefetchOperation>}
|
|
53
53
|
*/
|
|
54
54
|
this.initSegmentPrefetchMap_ = new Map();
|
|
@@ -89,7 +89,7 @@ shaka.media.SegmentPrefetch = class {
|
|
|
89
89
|
}
|
|
90
90
|
if (!this.iterator_) {
|
|
91
91
|
this.iterator_ = this.stream_.segmentIndex.getIteratorForTime(
|
|
92
|
-
currTime, /*
|
|
92
|
+
currTime, /* allowNonIndependent= */ true, this.reverse_);
|
|
93
93
|
}
|
|
94
94
|
if (!this.iterator_) {
|
|
95
95
|
shaka.log.debug(logPrefix, 'missing iterator');
|
|
@@ -104,7 +104,7 @@ shaka.media.SegmentPrefetch = class {
|
|
|
104
104
|
if (!reference) {
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
|
-
// By default doesn't
|
|
107
|
+
// By default doesn't prefetch preload partial segments when using
|
|
108
108
|
// byterange
|
|
109
109
|
let prefetchAllowed = true;
|
|
110
110
|
if (reference.isPreload() && reference.endByte != null) {
|
|
@@ -173,8 +173,8 @@ shaka.media.SegmentPrefetch = class {
|
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* Get the result of prefetched segment if already exists.
|
|
176
|
-
* @param {!(shaka.media.SegmentReference|
|
|
177
|
-
*
|
|
176
|
+
* @param {!(shaka.media.SegmentReference|
|
|
177
|
+
* shaka.media.InitSegmentReference)} reference
|
|
178
178
|
* @param {?function(BufferSource):!Promise=} streamDataCallback
|
|
179
179
|
* @return {?shaka.net.NetworkingEngine.PendingRequest} op
|
|
180
180
|
* @public
|
|
@@ -225,6 +225,9 @@ shaka.media.SegmentPrefetch = class {
|
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
227
|
* Clear All Helper
|
|
228
|
+
* @param {!Map<T,
|
|
229
|
+
* !shaka.media.SegmentPrefetchOperation>} map
|
|
230
|
+
* @template T SegmentReference or InitSegmentReference
|
|
228
231
|
* @private
|
|
229
232
|
*/
|
|
230
233
|
clearMap_(map) {
|
|
@@ -355,8 +358,8 @@ shaka.media.SegmentPrefetch = class {
|
|
|
355
358
|
|
|
356
359
|
/**
|
|
357
360
|
* Remove a segment from prefetch map and abort it.
|
|
358
|
-
* @param {!(shaka.media.SegmentReference|
|
|
359
|
-
*
|
|
361
|
+
* @param {!(shaka.media.SegmentReference|
|
|
362
|
+
* shaka.media.InitSegmentReference)} reference
|
|
360
363
|
* @private
|
|
361
364
|
*/
|
|
362
365
|
abortPrefetchedSegment_(reference) {
|
|
@@ -384,6 +387,7 @@ shaka.media.SegmentPrefetch = class {
|
|
|
384
387
|
|
|
385
388
|
/**
|
|
386
389
|
* The prefix of the logs that are created in this class.
|
|
390
|
+
* @param {shaka.extern.Stream} stream
|
|
387
391
|
* @return {string}
|
|
388
392
|
* @private
|
|
389
393
|
*/
|
|
@@ -419,10 +423,10 @@ shaka.media.SegmentPrefetchOperation = class {
|
|
|
419
423
|
}
|
|
420
424
|
|
|
421
425
|
/**
|
|
422
|
-
* Fetch
|
|
426
|
+
* Fetch segments
|
|
423
427
|
*
|
|
424
|
-
* @param {!(shaka.media.SegmentReference|
|
|
425
|
-
*
|
|
428
|
+
* @param {!(shaka.media.SegmentReference|
|
|
429
|
+
* shaka.media.InitSegmentReference)} reference
|
|
426
430
|
* @param {!shaka.extern.Stream} stream
|
|
427
431
|
* @return {!Promise}
|
|
428
432
|
* @public
|
|
@@ -21,7 +21,7 @@ goog.require('shaka.util.BufferUtils');
|
|
|
21
21
|
*/
|
|
22
22
|
shaka.media.InitSegmentReference = class {
|
|
23
23
|
/**
|
|
24
|
-
* @param {function()
|
|
24
|
+
* @param {function(): !Array<string>} uris A function that creates the URIs
|
|
25
25
|
* of the resource containing the segment.
|
|
26
26
|
* @param {number} startByte The offset from the start of the resource to the
|
|
27
27
|
* start of the segment.
|
|
@@ -37,7 +37,7 @@ shaka.media.InitSegmentReference = class {
|
|
|
37
37
|
*/
|
|
38
38
|
constructor(uris, startByte, endByte, mediaQuality = null, timescale = null,
|
|
39
39
|
segmentData = null, aesKey = null) {
|
|
40
|
-
/** @type {function()
|
|
40
|
+
/** @type {function(): !Array<string>} */
|
|
41
41
|
this.getUris = uris;
|
|
42
42
|
|
|
43
43
|
/** @const {number} */
|
|
@@ -158,7 +158,7 @@ shaka.media.SegmentReference = class {
|
|
|
158
158
|
* @param {number} endTime The segment's end time in seconds. The segment
|
|
159
159
|
* ends the instant before this time, so |endTime| must be strictly greater
|
|
160
160
|
* than |startTime|.
|
|
161
|
-
* @param {function()
|
|
161
|
+
* @param {function(): !Array<string>} uris
|
|
162
162
|
* A function that creates the URIs of the resource containing the segment.
|
|
163
163
|
* @param {number} startByte The offset from the start of the resource to the
|
|
164
164
|
* start of the segment.
|
|
@@ -189,7 +189,7 @@ shaka.media.SegmentReference = class {
|
|
|
189
189
|
* The end of the append window for this reference, relative to the
|
|
190
190
|
* presentation. Any content from after this time will be removed by
|
|
191
191
|
* MediaSource.
|
|
192
|
-
* @param {!Array
|
|
192
|
+
* @param {!Array<!shaka.media.SegmentReference>=} partialReferences
|
|
193
193
|
* A list of SegmentReferences for the partial segments.
|
|
194
194
|
* @param {?string=} tilesLayout
|
|
195
195
|
* The value is a grid-item-dimension consisting of two positive decimal
|
|
@@ -237,7 +237,7 @@ shaka.media.SegmentReference = class {
|
|
|
237
237
|
*/
|
|
238
238
|
this.trueEndTime = endTime;
|
|
239
239
|
|
|
240
|
-
/** @type {function()
|
|
240
|
+
/** @type {function(): !Array<string>} */
|
|
241
241
|
this.getUrisInner = uris;
|
|
242
242
|
|
|
243
243
|
/** @const {number} */
|
|
@@ -258,7 +258,7 @@ shaka.media.SegmentReference = class {
|
|
|
258
258
|
/** @type {number} */
|
|
259
259
|
this.appendWindowEnd = appendWindowEnd;
|
|
260
260
|
|
|
261
|
-
/** @type {!Array
|
|
261
|
+
/** @type {!Array<!shaka.media.SegmentReference>} */
|
|
262
262
|
this.partialReferences = partialReferences;
|
|
263
263
|
|
|
264
264
|
/** @type {?string} */
|
|
@@ -331,7 +331,7 @@ shaka.media.SegmentReference = class {
|
|
|
331
331
|
/**
|
|
332
332
|
* Creates and returns the URIs of the resource containing the segment.
|
|
333
333
|
*
|
|
334
|
-
* @return {!Array
|
|
334
|
+
* @return {!Array<string>}
|
|
335
335
|
* @export
|
|
336
336
|
*/
|
|
337
337
|
getUris() {
|
|
@@ -463,8 +463,8 @@ shaka.media.SegmentUtils = class {
|
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
/**
|
|
466
|
-
* @param {!Array
|
|
467
|
-
* @return {!Array
|
|
466
|
+
* @param {!Array<string>} codecs
|
|
467
|
+
* @return {!Array<string>} codecs
|
|
468
468
|
*/
|
|
469
469
|
static codecsFiltering(codecs) {
|
|
470
470
|
const ContentType = shaka.util.ManifestParserUtils.ContentType;
|
|
@@ -487,8 +487,8 @@ shaka.media.SegmentUtils = class {
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
/**
|
|
490
|
-
* @param {!Array
|
|
491
|
-
* @return {!Array
|
|
490
|
+
* @param {!Array<string>} codecs
|
|
491
|
+
* @return {!Array<string>} codecs
|
|
492
492
|
* @private
|
|
493
493
|
*/
|
|
494
494
|
static filterDuplicateCodecs_(codecs) {
|
|
@@ -511,8 +511,8 @@ shaka.media.SegmentUtils = class {
|
|
|
511
511
|
* Prioritizes Dolby Vision if supported. This is necessary because with
|
|
512
512
|
* Dolby Vision we could have hvcC and dvcC boxes at the same time.
|
|
513
513
|
*
|
|
514
|
-
* @param {!Array
|
|
515
|
-
* @return {!Array
|
|
514
|
+
* @param {!Array<string>} codecs
|
|
515
|
+
* @return {!Array<string>} codecs
|
|
516
516
|
* @private
|
|
517
517
|
*/
|
|
518
518
|
static chooseBetterCodecs_(codecs) {
|
|
@@ -570,7 +570,7 @@ shaka.media.SegmentUtils = class {
|
|
|
570
570
|
* @param {!BufferSource} rawResult
|
|
571
571
|
* @param {shaka.extern.aesKey} aesKey
|
|
572
572
|
* @param {number} position
|
|
573
|
-
* @return {!Promise
|
|
573
|
+
* @return {!Promise<!BufferSource>}
|
|
574
574
|
*/
|
|
575
575
|
static async aesDecrypt(rawResult, aesKey, position) {
|
|
576
576
|
const key = aesKey;
|
|
@@ -619,7 +619,7 @@ shaka.media.SegmentUtils = class {
|
|
|
619
619
|
* width: ?string,
|
|
620
620
|
* channelCount: ?number,
|
|
621
621
|
* sampleRate: ?number,
|
|
622
|
-
* closedCaptions: Map
|
|
622
|
+
* closedCaptions: Map<string, string>,
|
|
623
623
|
* videoRange: ?string,
|
|
624
624
|
* colorGamut: ?string,
|
|
625
625
|
* frameRate: ?string
|
|
@@ -633,7 +633,7 @@ shaka.media.SegmentUtils = class {
|
|
|
633
633
|
* @property {?string} width
|
|
634
634
|
* @property {?number} channelCount
|
|
635
635
|
* @property {?number} sampleRate
|
|
636
|
-
* @property {Map
|
|
636
|
+
* @property {Map<string, string>} closedCaptions
|
|
637
637
|
* @property {?string} videoRange
|
|
638
638
|
* @property {?string} colorGamut
|
|
639
639
|
* @property {?string} frameRate
|
|
@@ -12,6 +12,7 @@ goog.provide('shaka.media.StreamingEngine');
|
|
|
12
12
|
|
|
13
13
|
goog.require('goog.asserts');
|
|
14
14
|
goog.require('shaka.log');
|
|
15
|
+
goog.require('shaka.media.Capabilities');
|
|
15
16
|
goog.require('shaka.media.InitSegmentReference');
|
|
16
17
|
goog.require('shaka.media.ManifestParser');
|
|
17
18
|
goog.require('shaka.media.MediaSourceEngine');
|
|
@@ -33,6 +34,7 @@ goog.require('shaka.util.MimeUtils');
|
|
|
33
34
|
goog.require('shaka.util.Mp4BoxParsers');
|
|
34
35
|
goog.require('shaka.util.Mp4Parser');
|
|
35
36
|
goog.require('shaka.util.Networking');
|
|
37
|
+
goog.require('shaka.util.Timer');
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
/**
|
|
@@ -76,7 +78,7 @@ shaka.media.StreamingEngine = class {
|
|
|
76
78
|
/**
|
|
77
79
|
* Retains a reference to the function used to close SegmentIndex objects
|
|
78
80
|
* for streams which were switched away from during an ongoing update_().
|
|
79
|
-
* @private {!Map
|
|
81
|
+
* @private {!Map<string, !function()>}
|
|
80
82
|
*/
|
|
81
83
|
this.deferredCloseSegmentIndex_ = new Map();
|
|
82
84
|
|
|
@@ -95,7 +97,7 @@ shaka.media.StreamingEngine = class {
|
|
|
95
97
|
/**
|
|
96
98
|
* Maps a content type, e.g., 'audio', 'video', or 'text', to a MediaState.
|
|
97
99
|
*
|
|
98
|
-
* @private {!Map
|
|
100
|
+
* @private {!Map<shaka.util.ManifestParserUtils.ContentType,
|
|
99
101
|
* !shaka.media.StreamingEngine.MediaState_>}
|
|
100
102
|
*/
|
|
101
103
|
this.mediaStates_ = new Map();
|
|
@@ -147,6 +149,30 @@ shaka.media.StreamingEngine = class {
|
|
|
147
149
|
|
|
148
150
|
/** @private {?shaka.media.StreamingEngine.MediaState_} */
|
|
149
151
|
this.lastTextMediaStateBeforeUnload_ = null;
|
|
152
|
+
|
|
153
|
+
/** @private {?shaka.util.Timer} */
|
|
154
|
+
this.updateLiveSeekableRangeTime_ = new shaka.util.Timer(() => {
|
|
155
|
+
if (!this.manifest_ || !this.playerInterface_) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!this.manifest_.presentationTimeline.isLive()) {
|
|
159
|
+
this.playerInterface_.mediaSourceEngine.clearLiveSeekableRange();
|
|
160
|
+
if (this.updateLiveSeekableRangeTime_) {
|
|
161
|
+
this.updateLiveSeekableRangeTime_.stop();
|
|
162
|
+
}
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const startTime = this.manifest_.presentationTimeline.getSeekRangeStart();
|
|
166
|
+
const endTime = this.manifest_.presentationTimeline.getSeekRangeEnd();
|
|
167
|
+
// Some older devices require the range to be greater than 1 or exceptions
|
|
168
|
+
// are thrown, due to an old and buggy implementation.
|
|
169
|
+
if (endTime - startTime > 1) {
|
|
170
|
+
this.playerInterface_.mediaSourceEngine.setLiveSeekableRange(
|
|
171
|
+
startTime, endTime);
|
|
172
|
+
} else {
|
|
173
|
+
this.playerInterface_.mediaSourceEngine.clearLiveSeekableRange();
|
|
174
|
+
}
|
|
175
|
+
});
|
|
150
176
|
}
|
|
151
177
|
|
|
152
178
|
/** @override */
|
|
@@ -181,6 +207,10 @@ shaka.media.StreamingEngine = class {
|
|
|
181
207
|
this.playerInterface_ = null;
|
|
182
208
|
this.manifest_ = null;
|
|
183
209
|
this.config_ = null;
|
|
210
|
+
if (this.updateLiveSeekableRangeTime_) {
|
|
211
|
+
this.updateLiveSeekableRangeTime_.stop();
|
|
212
|
+
}
|
|
213
|
+
this.updateLiveSeekableRangeTime_ = null;
|
|
184
214
|
}
|
|
185
215
|
|
|
186
216
|
/**
|
|
@@ -291,7 +321,7 @@ shaka.media.StreamingEngine = class {
|
|
|
291
321
|
* chosen by a prior call to switchTextStream(). Once the Promise resolves,
|
|
292
322
|
* switch*() may be called freely.
|
|
293
323
|
*
|
|
294
|
-
* @param {!Map
|
|
324
|
+
* @param {!Map<number, shaka.media.SegmentPrefetch>=} segmentPrefetchById
|
|
295
325
|
* If provided, segments prefetched for these streams will be used as needed
|
|
296
326
|
* during playback.
|
|
297
327
|
* @return {!Promise}
|
|
@@ -779,9 +809,7 @@ shaka.media.StreamingEngine = class {
|
|
|
779
809
|
// If the new segment can be finished in time without risking a buffer
|
|
780
810
|
// underflow, we should abort the old one and switch.
|
|
781
811
|
const bufferedAhead = (bufferEnd || 0) - presentationTime;
|
|
782
|
-
const safetyBuffer =
|
|
783
|
-
this.manifest_.minBufferTime || 0,
|
|
784
|
-
this.config_.rebufferingGoal);
|
|
812
|
+
const safetyBuffer = this.config_.rebufferingGoal;
|
|
785
813
|
const safeBufferedAhead = bufferedAhead - safetyBuffer;
|
|
786
814
|
if (timeToFetchNewSegment < safeBufferedAhead) {
|
|
787
815
|
return true;
|
|
@@ -933,7 +961,7 @@ shaka.media.StreamingEngine = class {
|
|
|
933
961
|
* Initializes the initial streams and media states. This will schedule
|
|
934
962
|
* updates for the given types.
|
|
935
963
|
*
|
|
936
|
-
* @param {!Map
|
|
964
|
+
* @param {!Map<number, shaka.media.SegmentPrefetch>} segmentPrefetchById
|
|
937
965
|
* @return {!Promise}
|
|
938
966
|
* @private
|
|
939
967
|
*/
|
|
@@ -952,11 +980,11 @@ shaka.media.StreamingEngine = class {
|
|
|
952
980
|
}
|
|
953
981
|
|
|
954
982
|
/**
|
|
955
|
-
* @type {!Map
|
|
983
|
+
* @type {!Map<shaka.util.ManifestParserUtils.ContentType,
|
|
956
984
|
* shaka.extern.Stream>}
|
|
957
985
|
*/
|
|
958
986
|
const streamsByType = new Map();
|
|
959
|
-
/** @type {!Set
|
|
987
|
+
/** @type {!Set<shaka.extern.Stream>} */
|
|
960
988
|
const streams = new Set();
|
|
961
989
|
|
|
962
990
|
if (this.currentVariant_.audio) {
|
|
@@ -1166,17 +1194,30 @@ shaka.media.StreamingEngine = class {
|
|
|
1166
1194
|
* Sets the MediaSource's duration.
|
|
1167
1195
|
*/
|
|
1168
1196
|
updateDuration() {
|
|
1197
|
+
const isInfiniteLiveStreamDurationSupported =
|
|
1198
|
+
shaka.media.Capabilities.isInfiniteLiveStreamDurationSupported();
|
|
1169
1199
|
const duration = this.manifest_.presentationTimeline.getDuration();
|
|
1170
1200
|
if (duration < Infinity) {
|
|
1201
|
+
if (isInfiniteLiveStreamDurationSupported) {
|
|
1202
|
+
if (this.updateLiveSeekableRangeTime_) {
|
|
1203
|
+
this.updateLiveSeekableRangeTime_.stop();
|
|
1204
|
+
}
|
|
1205
|
+
this.playerInterface_.mediaSourceEngine.clearLiveSeekableRange();
|
|
1206
|
+
}
|
|
1171
1207
|
this.playerInterface_.mediaSourceEngine.setDuration(duration);
|
|
1172
1208
|
} else {
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1209
|
+
// Set the media source live duration as Infinity if the platform supports
|
|
1210
|
+
// it.
|
|
1211
|
+
if (isInfiniteLiveStreamDurationSupported) {
|
|
1212
|
+
if (this.updateLiveSeekableRangeTime_) {
|
|
1213
|
+
this.updateLiveSeekableRangeTime_.tickEvery(/* seconds= */ 0.5);
|
|
1214
|
+
}
|
|
1215
|
+
this.playerInterface_.mediaSourceEngine.setDuration(Infinity);
|
|
1216
|
+
} else {
|
|
1217
|
+
// Not all platforms support infinite durations, so set a finite
|
|
1218
|
+
// duration so we can append segments and so the user agent can seek.
|
|
1219
|
+
this.playerInterface_.mediaSourceEngine.setDuration(Math.pow(2, 32));
|
|
1220
|
+
}
|
|
1180
1221
|
}
|
|
1181
1222
|
}
|
|
1182
1223
|
|
|
@@ -1246,7 +1287,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1246
1287
|
// Releases the segmentIndex of the old stream.
|
|
1247
1288
|
if (thisStream.closeSegmentIndex) {
|
|
1248
1289
|
goog.asserts.assert(!mediaState.stream.segmentIndex,
|
|
1249
|
-
'
|
|
1290
|
+
'mediaState.stream should not have segmentIndex yet.');
|
|
1250
1291
|
thisStream.closeSegmentIndex();
|
|
1251
1292
|
}
|
|
1252
1293
|
if (!mediaState.performingUpdate && !mediaState.updateTimer) {
|
|
@@ -1311,7 +1352,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1311
1352
|
|
|
1312
1353
|
const ContentType = shaka.util.ManifestParserUtils.ContentType;
|
|
1313
1354
|
|
|
1314
|
-
// Do not schedule update for closed captions text
|
|
1355
|
+
// Do not schedule update for closed captions text mediaState, since closed
|
|
1315
1356
|
// captions are embedded in video streams.
|
|
1316
1357
|
if (shaka.media.StreamingEngine.isEmbeddedText_(mediaState)) {
|
|
1317
1358
|
this.playerInterface_.mediaSourceEngine.setSelectedClosedCaptionId(
|
|
@@ -1366,9 +1407,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1366
1407
|
'bufferedAhead=' + bufferedAhead);
|
|
1367
1408
|
|
|
1368
1409
|
const unscaledBufferingGoal = Math.max(
|
|
1369
|
-
this.
|
|
1370
|
-
this.config_.rebufferingGoal,
|
|
1371
|
-
this.config_.bufferingGoal);
|
|
1410
|
+
this.config_.rebufferingGoal, this.config_.bufferingGoal);
|
|
1372
1411
|
|
|
1373
1412
|
const scaledBufferingGoal = Math.max(1,
|
|
1374
1413
|
unscaledBufferingGoal * this.bufferingScale_);
|
|
@@ -1536,7 +1575,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1536
1575
|
if (mediaState.stream.segmentIndex) {
|
|
1537
1576
|
mediaState.segmentIterator =
|
|
1538
1577
|
mediaState.stream.segmentIndex.getIteratorForTime(
|
|
1539
|
-
time, /*
|
|
1578
|
+
time, /* allowNonIndependent= */ false, reverse);
|
|
1540
1579
|
}
|
|
1541
1580
|
const ref = mediaState.segmentIterator &&
|
|
1542
1581
|
mediaState.segmentIterator.next().value;
|
|
@@ -1564,7 +1603,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1564
1603
|
if (mediaState.stream.segmentIndex) {
|
|
1565
1604
|
mediaState.segmentIterator =
|
|
1566
1605
|
mediaState.stream.segmentIndex.getIteratorForTime(
|
|
1567
|
-
lookupTime, /*
|
|
1606
|
+
lookupTime, /* allowNonIndependent= */ false, reverse);
|
|
1568
1607
|
}
|
|
1569
1608
|
ref = mediaState.segmentIterator &&
|
|
1570
1609
|
mediaState.segmentIterator.next().value;
|
|
@@ -1575,7 +1614,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1575
1614
|
if (mediaState.stream.segmentIndex) {
|
|
1576
1615
|
mediaState.segmentIterator =
|
|
1577
1616
|
mediaState.stream.segmentIndex.getIteratorForTime(
|
|
1578
|
-
presentationTime, /*
|
|
1617
|
+
presentationTime, /* allowNonIndependent= */ false, reverse);
|
|
1579
1618
|
}
|
|
1580
1619
|
ref = mediaState.segmentIterator &&
|
|
1581
1620
|
mediaState.segmentIterator.next().value;
|
|
@@ -1976,7 +2015,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1976
2015
|
const logPrefix = StreamingEngine.logPrefix_(mediaState);
|
|
1977
2016
|
const nullLastReferences = mediaState.lastSegmentReference == null;
|
|
1978
2017
|
|
|
1979
|
-
/** @type {!Array
|
|
2018
|
+
/** @type {!Array<!Promise>} */
|
|
1980
2019
|
const operations = [];
|
|
1981
2020
|
|
|
1982
2021
|
// Rounding issues can cause us to remove the first frame of a Period, so
|
|
@@ -2148,7 +2187,7 @@ shaka.media.StreamingEngine = class {
|
|
|
2148
2187
|
const bufferEnd =
|
|
2149
2188
|
this.playerInterface_.mediaSourceEngine.bufferEnd(mediaState.type);
|
|
2150
2189
|
if (bufferEnd != null) {
|
|
2151
|
-
// Adjust init segment
|
|
2190
|
+
// Adjust init segment append time if we have something in
|
|
2152
2191
|
// a buffer, i.e. due to running switchVariant() with non zero
|
|
2153
2192
|
// safe margin value.
|
|
2154
2193
|
initSegmentTime = bufferEnd;
|
|
@@ -2190,7 +2229,7 @@ shaka.media.StreamingEngine = class {
|
|
|
2190
2229
|
const ContentType = shaka.util.ManifestParserUtils.ContentType;
|
|
2191
2230
|
|
|
2192
2231
|
/**
|
|
2193
|
-
* @type {!Map
|
|
2232
|
+
* @type {!Map<shaka.util.ManifestParserUtils.ContentType,
|
|
2194
2233
|
* shaka.extern.Stream>}
|
|
2195
2234
|
*/
|
|
2196
2235
|
const streamsByType = new Map();
|
|
@@ -2425,11 +2464,11 @@ shaka.media.StreamingEngine = class {
|
|
|
2425
2464
|
* Fetches the given segment.
|
|
2426
2465
|
*
|
|
2427
2466
|
* @param {!shaka.media.StreamingEngine.MediaState_} mediaState
|
|
2428
|
-
* @param {(!shaka.media.InitSegmentReference
|
|
2429
|
-
*
|
|
2467
|
+
* @param {(!shaka.media.InitSegmentReference|
|
|
2468
|
+
* !shaka.media.SegmentReference)} reference
|
|
2430
2469
|
* @param {?function(BufferSource):!Promise=} streamDataCallback
|
|
2431
2470
|
*
|
|
2432
|
-
* @return {!Promise
|
|
2471
|
+
* @return {!Promise<BufferSource>}
|
|
2433
2472
|
* @private
|
|
2434
2473
|
*/
|
|
2435
2474
|
async fetch_(mediaState, reference, streamDataCallback) {
|
|
@@ -2466,9 +2505,9 @@ shaka.media.StreamingEngine = class {
|
|
|
2466
2505
|
/**
|
|
2467
2506
|
* Fetches the given segment.
|
|
2468
2507
|
*
|
|
2508
|
+
* @param {(!shaka.media.InitSegmentReference|
|
|
2509
|
+
* !shaka.media.SegmentReference)} reference
|
|
2469
2510
|
* @param {!shaka.extern.Stream} stream
|
|
2470
|
-
* @param {(!shaka.media.InitSegmentReference|!shaka.media.SegmentReference)}
|
|
2471
|
-
* reference
|
|
2472
2511
|
* @param {?function(BufferSource):!Promise=} streamDataCallback
|
|
2473
2512
|
* @param {boolean=} isPreload
|
|
2474
2513
|
*
|
|
@@ -2486,9 +2525,9 @@ shaka.media.StreamingEngine = class {
|
|
|
2486
2525
|
/**
|
|
2487
2526
|
* Fetches the given segment.
|
|
2488
2527
|
*
|
|
2528
|
+
* @param {(!shaka.media.InitSegmentReference|
|
|
2529
|
+
* !shaka.media.SegmentReference)} reference
|
|
2489
2530
|
* @param {!shaka.extern.Stream} stream
|
|
2490
|
-
* @param {(!shaka.media.InitSegmentReference|!shaka.media.SegmentReference)}
|
|
2491
|
-
* reference
|
|
2492
2531
|
* @param {?function(BufferSource):!Promise} streamDataCallback
|
|
2493
2532
|
* @param {shaka.extern.RetryParameters} retryParameters
|
|
2494
2533
|
* @param {!shaka.net.NetworkingEngine} netEngine
|
|
@@ -2717,7 +2756,7 @@ shaka.media.StreamingEngine = class {
|
|
|
2717
2756
|
* Reset Media Source
|
|
2718
2757
|
*
|
|
2719
2758
|
* @param {boolean=} force
|
|
2720
|
-
* @return {!Promise
|
|
2759
|
+
* @return {!Promise<boolean>}
|
|
2721
2760
|
*/
|
|
2722
2761
|
async resetMediaSource(force = false, clearBuffer = true) {
|
|
2723
2762
|
const now = (Date.now() / 1000);
|
|
@@ -2757,7 +2796,7 @@ shaka.media.StreamingEngine = class {
|
|
|
2757
2796
|
}
|
|
2758
2797
|
}
|
|
2759
2798
|
/**
|
|
2760
|
-
* @type {!Map
|
|
2799
|
+
* @type {!Map<shaka.util.ManifestParserUtils.ContentType,
|
|
2761
2800
|
* shaka.extern.Stream>}
|
|
2762
2801
|
*/
|
|
2763
2802
|
const streamsByType = new Map();
|
|
@@ -2873,8 +2912,8 @@ shaka.media.StreamingEngine = class {
|
|
|
2873
2912
|
* @property {function(!shaka.media.SegmentReference,
|
|
2874
2913
|
* !shaka.extern.Stream)} onSegmentAppended
|
|
2875
2914
|
* Called after a segment is successfully appended to a MediaSource.
|
|
2876
|
-
* @property
|
|
2877
|
-
*
|
|
2915
|
+
* @property {function(!number,
|
|
2916
|
+
* !shaka.media.InitSegmentReference)} onInitSegmentAppended
|
|
2878
2917
|
* Called when an init segment is appended to a MediaSource.
|
|
2879
2918
|
* @property {!function(shaka.util.ManifestParserUtils.ContentType,
|
|
2880
2919
|
* !BufferSource):Promise} beforeAppendSegment
|
|
@@ -28,7 +28,7 @@ shaka.media.VideoWrapper = class {
|
|
|
28
28
|
* @param {!HTMLMediaElement} video
|
|
29
29
|
* @param {function()} onSeek Called when the video seeks.
|
|
30
30
|
* @param {function(number)} onStarted Called when the video has started.
|
|
31
|
-
* @param {function():number} getStartTime
|
|
31
|
+
* @param {function():number} getStartTime Called to get the time to start at.
|
|
32
32
|
*/
|
|
33
33
|
constructor(video, onSeek, onStarted, getStartTime) {
|
|
34
34
|
/** @private {HTMLMediaElement} */
|
|
@@ -20,13 +20,13 @@ shaka.media.WebmSegmentIndexParser = class {
|
|
|
20
20
|
* Parses SegmentReferences from a WebM container.
|
|
21
21
|
* @param {BufferSource} cuesData The WebM container's "Cueing Data" section.
|
|
22
22
|
* @param {BufferSource} initData The WebM container's headers.
|
|
23
|
-
* @param {!Array
|
|
23
|
+
* @param {!Array<string>} uris The possible locations of the WebM file that
|
|
24
24
|
* contains the segments.
|
|
25
25
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
26
26
|
* @param {number} timestampOffset
|
|
27
27
|
* @param {number} appendWindowStart
|
|
28
28
|
* @param {number} appendWindowEnd
|
|
29
|
-
* @return {!Array
|
|
29
|
+
* @return {!Array<!shaka.media.SegmentReference>}
|
|
30
30
|
* @see http://www.matroska.org/technical/specs/index.html
|
|
31
31
|
* @see http://www.webmproject.org/docs/container/
|
|
32
32
|
*/
|
|
@@ -183,12 +183,12 @@ shaka.media.WebmSegmentIndexParser = class {
|
|
|
183
183
|
* @param {number} segmentOffset
|
|
184
184
|
* @param {number} timecodeScale
|
|
185
185
|
* @param {number} duration
|
|
186
|
-
* @param {!Array
|
|
186
|
+
* @param {!Array<string>} uris
|
|
187
187
|
* @param {shaka.media.InitSegmentReference} initSegmentReference
|
|
188
188
|
* @param {number} timestampOffset
|
|
189
189
|
* @param {number} appendWindowStart
|
|
190
190
|
* @param {number} appendWindowEnd
|
|
191
|
-
* @return {!Array
|
|
191
|
+
* @return {!Array<!shaka.media.SegmentReference>}
|
|
192
192
|
* @private
|
|
193
193
|
*/
|
|
194
194
|
static parseCues_(cuesElement, segmentOffset, timecodeScale, duration,
|