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
|
@@ -95,7 +95,7 @@ shaka.text.VttTextParser = class {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// Parse VTT regions.
|
|
98
|
-
/* !Array
|
|
98
|
+
/* !Array<!shaka.text.CueRegion> */
|
|
99
99
|
const regions = [];
|
|
100
100
|
for (const line of blocks[0].split('\n')) {
|
|
101
101
|
if (/^Region:/.test(line)) {
|
|
@@ -104,7 +104,7 @@ shaka.text.VttTextParser = class {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
/** @type {!Map
|
|
107
|
+
/** @type {!Map<string, !shaka.text.Cue>} */
|
|
108
108
|
const styles = new Map();
|
|
109
109
|
shaka.text.Cue.addDefaultTextColor(styles);
|
|
110
110
|
|
|
@@ -207,8 +207,8 @@ shaka.text.VttTextParser = class {
|
|
|
207
207
|
/**
|
|
208
208
|
* Parses a style block into a Cue object.
|
|
209
209
|
*
|
|
210
|
-
* @param {!Array
|
|
211
|
-
* @param {!Map
|
|
210
|
+
* @param {!Array<string>} text
|
|
211
|
+
* @param {!Map<string, !shaka.text.Cue>} styles
|
|
212
212
|
* @private
|
|
213
213
|
*/
|
|
214
214
|
static parseStyle_(text, styles) {
|
|
@@ -227,7 +227,7 @@ shaka.text.VttTextParser = class {
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
/** @type {!Array
|
|
230
|
+
/** @type {!Array<!Array<string>>} */
|
|
231
231
|
const styleBlocks = [];
|
|
232
232
|
let lastBlockIndex = -1;
|
|
233
233
|
for (let i = 1; i < text.length; i++) {
|
|
@@ -352,10 +352,10 @@ shaka.text.VttTextParser = class {
|
|
|
352
352
|
/**
|
|
353
353
|
* Parses a text block into a Cue object.
|
|
354
354
|
*
|
|
355
|
-
* @param {!Array
|
|
355
|
+
* @param {!Array<string>} text
|
|
356
356
|
* @param {number} timeOffset
|
|
357
|
-
* @param {!Array
|
|
358
|
-
* @param {!Map
|
|
357
|
+
* @param {!Array<!shaka.text.CueRegion>} regions
|
|
358
|
+
* @param {!Map<string, !shaka.text.Cue>} styles
|
|
359
359
|
* @return {shaka.text.Cue}
|
|
360
360
|
* @private
|
|
361
361
|
*/
|
|
@@ -437,7 +437,7 @@ shaka.text.VttTextParser = class {
|
|
|
437
437
|
*
|
|
438
438
|
* @param {!shaka.text.Cue} cue
|
|
439
439
|
* @param {string} word
|
|
440
|
-
* @param {!Array
|
|
440
|
+
* @param {!Array<!shaka.text.CueRegion>} regions
|
|
441
441
|
* @return {boolean} True on success.
|
|
442
442
|
*/
|
|
443
443
|
static parseCueSetting(cue, word, regions) {
|
|
@@ -471,7 +471,7 @@ shaka.text.VttTextParser = class {
|
|
|
471
471
|
|
|
472
472
|
/**
|
|
473
473
|
*
|
|
474
|
-
* @param {!Array
|
|
474
|
+
* @param {!Array<!shaka.text.CueRegion>} regions
|
|
475
475
|
* @param {string} id
|
|
476
476
|
* @return {?shaka.text.CueRegion}
|
|
477
477
|
* @private
|
|
@@ -16,8 +16,8 @@ goog.require('shaka.text.Utils');
|
|
|
16
16
|
*/
|
|
17
17
|
shaka.text.WebVttGenerator = class {
|
|
18
18
|
/**
|
|
19
|
-
* @param {!Array
|
|
20
|
-
* @param {!Array
|
|
19
|
+
* @param {!Array<!shaka.text.Cue>} cues
|
|
20
|
+
* @param {!Array<!shaka.extern.AdCuePoint>} adCuePoints
|
|
21
21
|
* @return {string}
|
|
22
22
|
*/
|
|
23
23
|
static convert(cues, adCuePoints) {
|
|
@@ -33,7 +33,7 @@ shaka.transmuxer.AacTransmuxer = class {
|
|
|
33
33
|
/** @private {number} */
|
|
34
34
|
this.frameIndex_ = 0;
|
|
35
35
|
|
|
36
|
-
/** @private {!Map
|
|
36
|
+
/** @private {!Map<string, !Uint8Array>} */
|
|
37
37
|
this.initSegments = new Map();
|
|
38
38
|
|
|
39
39
|
/** @private {?Uint8Array} */
|
|
@@ -150,7 +150,7 @@ shaka.transmuxer.AacTransmuxer = class {
|
|
|
150
150
|
stream.audioSamplingRate = info.sampleRate;
|
|
151
151
|
stream.channelsCount = info.channelCount;
|
|
152
152
|
|
|
153
|
-
/** @type {!Array
|
|
153
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
154
154
|
const samples = [];
|
|
155
155
|
|
|
156
156
|
while (offset < uint8ArrayData.length) {
|
|
@@ -32,7 +32,7 @@ shaka.transmuxer.Ac3Transmuxer = class {
|
|
|
32
32
|
/** @private {number} */
|
|
33
33
|
this.frameIndex_ = 0;
|
|
34
34
|
|
|
35
|
-
/** @private {!Map
|
|
35
|
+
/** @private {!Map<string, !Uint8Array>} */
|
|
36
36
|
this.initSegments = new Map();
|
|
37
37
|
|
|
38
38
|
/** @private {?Uint8Array} */
|
|
@@ -138,7 +138,7 @@ shaka.transmuxer.Ac3Transmuxer = class {
|
|
|
138
138
|
/** @type {!Uint8Array} */
|
|
139
139
|
let audioConfig = new Uint8Array([]);
|
|
140
140
|
|
|
141
|
-
/** @type {!Array
|
|
141
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
142
142
|
const samples = [];
|
|
143
143
|
|
|
144
144
|
while (offset < uint8ArrayData.length) {
|
package/lib/transmuxer/adts.js
CHANGED
package/lib/transmuxer/ec3.js
CHANGED
|
@@ -87,9 +87,9 @@ shaka.transmuxer.Ec3 = class {
|
|
|
87
87
|
* @return {boolean}
|
|
88
88
|
*/
|
|
89
89
|
static probe(data, offset) {
|
|
90
|
-
// search 16-bit 0x0B77
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
90
|
+
// search 16-bit 0x0B77 sync word
|
|
91
|
+
const syncWord = (data[offset] << 8) | (data[offset + 1] << 0);
|
|
92
|
+
if (syncWord === 0x0B77) {
|
|
93
93
|
return true;
|
|
94
94
|
} else {
|
|
95
95
|
return false;
|
|
@@ -32,7 +32,7 @@ shaka.transmuxer.Ec3Transmuxer = class {
|
|
|
32
32
|
/** @private {number} */
|
|
33
33
|
this.frameIndex_ = 0;
|
|
34
34
|
|
|
35
|
-
/** @private {!Map
|
|
35
|
+
/** @private {!Map<string, !Uint8Array>} */
|
|
36
36
|
this.initSegments = new Map();
|
|
37
37
|
|
|
38
38
|
/** @private {?Uint8Array} */
|
|
@@ -138,7 +138,7 @@ shaka.transmuxer.Ec3Transmuxer = class {
|
|
|
138
138
|
/** @type {!Uint8Array} */
|
|
139
139
|
let audioConfig = new Uint8Array([]);
|
|
140
140
|
|
|
141
|
-
/** @type {!Array
|
|
141
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
142
142
|
const samples = [];
|
|
143
143
|
|
|
144
144
|
while (offset < uint8ArrayData.length) {
|
package/lib/transmuxer/h264.js
CHANGED
|
@@ -19,7 +19,7 @@ shaka.transmuxer.H264 = class {
|
|
|
19
19
|
* properties. A sequence parameter set is the H264 metadata that
|
|
20
20
|
* describes the properties of upcoming video frames.
|
|
21
21
|
*
|
|
22
|
-
* @param {!Array
|
|
22
|
+
* @param {!Array<shaka.extern.VideoNalu>} nalus
|
|
23
23
|
* @return {?{height: number, width: number, videoConfig: !Uint8Array,
|
|
24
24
|
* hSpacing: number, vSpacing: number}}
|
|
25
25
|
*/
|
|
@@ -196,13 +196,13 @@ shaka.transmuxer.H264 = class {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
* @param {!Array
|
|
200
|
-
* @return {!Array
|
|
199
|
+
* @param {!Array<shaka.extern.MPEG_PES>} videoData
|
|
200
|
+
* @return {!Array<shaka.extern.VideoSample>}
|
|
201
201
|
*/
|
|
202
202
|
static getVideoSamples(videoData) {
|
|
203
203
|
const H264 = shaka.transmuxer.H264;
|
|
204
204
|
|
|
205
|
-
/** @type {!Array
|
|
205
|
+
/** @type {!Array<shaka.extern.VideoSample>} */
|
|
206
206
|
const videoSamples = [];
|
|
207
207
|
/** @type {?shaka.extern.VideoSample} */
|
|
208
208
|
let lastVideoSample = null;
|
|
@@ -418,7 +418,7 @@ shaka.transmuxer.H264.NALU_TYPE_FILLER_DATA_ = 0x0c;
|
|
|
418
418
|
* see Recommendation ITU-T H.264 (4/2013)
|
|
419
419
|
* 7.3.2.1.1 Sequence parameter set data syntax
|
|
420
420
|
*
|
|
421
|
-
* @const {!Array
|
|
421
|
+
* @const {!Array<number>}
|
|
422
422
|
* @private
|
|
423
423
|
*/
|
|
424
424
|
shaka.transmuxer.H264.PROFILES_WITH_OPTIONAL_SPS_DATA_ =
|
package/lib/transmuxer/h265.js
CHANGED
|
@@ -19,7 +19,7 @@ shaka.transmuxer.H265 = class {
|
|
|
19
19
|
* properties. A sequence parameter set is the H265 metadata that
|
|
20
20
|
* describes the properties of upcoming video frames.
|
|
21
21
|
*
|
|
22
|
-
* @param {!Array
|
|
22
|
+
* @param {!Array<shaka.extern.VideoNalu>} nalus
|
|
23
23
|
* @return {?{height: number, width: number, videoConfig: !Uint8Array,
|
|
24
24
|
* hSpacing: number, vSpacing: number}}
|
|
25
25
|
*/
|
|
@@ -139,7 +139,7 @@ shaka.transmuxer.H265 = class {
|
|
|
139
139
|
let bottomOffset = 0;
|
|
140
140
|
|
|
141
141
|
// SPS
|
|
142
|
-
gb.readBits(4); //
|
|
142
|
+
gb.readBits(4); // video_parameter_set_id
|
|
143
143
|
const maxSubLayersMinus1 = gb.readBits(3);
|
|
144
144
|
gb.readBoolean(); // temporal_id_nesting_flag
|
|
145
145
|
|
|
@@ -600,7 +600,7 @@ shaka.transmuxer.H265 = class {
|
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
/**
|
|
603
|
-
* @param {!Array
|
|
603
|
+
* @param {!Array<shaka.extern.VideoNalu>} nalus
|
|
604
604
|
* @return {?{data: !Uint8Array, isKeyframe: boolean}}
|
|
605
605
|
*/
|
|
606
606
|
static parseFrame(nalus) {
|
|
@@ -32,7 +32,7 @@ shaka.transmuxer.Mp3Transmuxer = class {
|
|
|
32
32
|
/** @private {number} */
|
|
33
33
|
this.frameIndex_ = 0;
|
|
34
34
|
|
|
35
|
-
/** @private {!Map
|
|
35
|
+
/** @private {!Map<string, !Uint8Array>} */
|
|
36
36
|
this.initSegments = new Map();
|
|
37
37
|
|
|
38
38
|
/** @private {?Uint8Array} */
|
|
@@ -122,7 +122,7 @@ shaka.transmuxer.Mp3Transmuxer = class {
|
|
|
122
122
|
const timescale = 90000;
|
|
123
123
|
let firstHeader;
|
|
124
124
|
|
|
125
|
-
/** @type {!Array
|
|
125
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
126
126
|
const samples = [];
|
|
127
127
|
|
|
128
128
|
while (offset < uint8ArrayData.length) {
|
|
@@ -40,7 +40,7 @@ shaka.transmuxer.MpegAudio = class {
|
|
|
40
40
|
columnInBitrates * 14 + bitRateIndex - 1] * 1000;
|
|
41
41
|
const columnInSampleRates =
|
|
42
42
|
mpegVersion === 3 ? 0 : mpegVersion === 2 ? 1 : 2;
|
|
43
|
-
const sampleRate = MpegAudio.
|
|
43
|
+
const sampleRate = MpegAudio.SAMPLING_RATE_MAP_[
|
|
44
44
|
columnInSampleRates * 3 + sampleRateIndex];
|
|
45
45
|
// If bits of channel mode are `11` then it is a single channel (Mono)
|
|
46
46
|
const channelCount = channelMode === 3 ? 1 : 2;
|
|
@@ -128,7 +128,7 @@ shaka.transmuxer.MpegAudio = class {
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* @private {!Array
|
|
131
|
+
* @private {!Array<number>}
|
|
132
132
|
*/
|
|
133
133
|
shaka.transmuxer.MpegAudio.BITRATES_MAP_ = [
|
|
134
134
|
32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56,
|
|
@@ -139,14 +139,14 @@ shaka.transmuxer.MpegAudio.BITRATES_MAP_ = [
|
|
|
139
139
|
];
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
|
-
* @private {!Array
|
|
142
|
+
* @private {!Array<number>}
|
|
143
143
|
*/
|
|
144
|
-
shaka.transmuxer.MpegAudio.
|
|
144
|
+
shaka.transmuxer.MpegAudio.SAMPLING_RATE_MAP_ = [
|
|
145
145
|
44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000,
|
|
146
146
|
];
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
|
-
* @private {!Array
|
|
149
|
+
* @private {!Array<!Array<number>>}
|
|
150
150
|
*/
|
|
151
151
|
shaka.transmuxer.MpegAudio.SAMPLES_COEFFICIENTS_ = [
|
|
152
152
|
// MPEG 2.5
|
|
@@ -181,7 +181,7 @@ shaka.transmuxer.MpegAudio.SAMPLES_COEFFICIENTS_ = [
|
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
|
-
* @private {!Array
|
|
184
|
+
* @private {!Array<number>}
|
|
185
185
|
*/
|
|
186
186
|
shaka.transmuxer.MpegAudio.BYTES_IN_SLOT_ = [
|
|
187
187
|
0, // Reserved
|
|
@@ -139,7 +139,7 @@ shaka.transmuxer.TransmuxerEngine.PluginObject;
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
|
-
* @private {!Object
|
|
142
|
+
* @private {!Object<string, !shaka.transmuxer.TransmuxerEngine.PluginObject>}
|
|
143
143
|
*/
|
|
144
144
|
shaka.transmuxer.TransmuxerEngine.transmuxerMap_ = {};
|
|
145
145
|
|
|
@@ -44,7 +44,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
44
44
|
/** @private {number} */
|
|
45
45
|
this.frameIndex_ = 0;
|
|
46
46
|
|
|
47
|
-
/** @private {!Map
|
|
47
|
+
/** @private {!Map<string, !Uint8Array>} */
|
|
48
48
|
this.initSegments = new Map();
|
|
49
49
|
|
|
50
50
|
/** @private {?shaka.util.TsParser} */
|
|
@@ -322,7 +322,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
322
322
|
const timescale = shaka.util.TsParser.Timescale;
|
|
323
323
|
const Uint8ArrayUtils = shaka.util.Uint8ArrayUtils;
|
|
324
324
|
|
|
325
|
-
/** @type {!Array
|
|
325
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
326
326
|
const samples = [];
|
|
327
327
|
|
|
328
328
|
let info;
|
|
@@ -509,7 +509,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
509
509
|
const Ac3 = shaka.transmuxer.Ac3;
|
|
510
510
|
const timescale = shaka.util.TsParser.Timescale;
|
|
511
511
|
|
|
512
|
-
/** @type {!Array
|
|
512
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
513
513
|
const samples = [];
|
|
514
514
|
|
|
515
515
|
/** @type {number} */
|
|
@@ -604,7 +604,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
604
604
|
const Ec3 = shaka.transmuxer.Ec3;
|
|
605
605
|
const timescale = shaka.util.TsParser.Timescale;
|
|
606
606
|
|
|
607
|
-
/** @type {!Array
|
|
607
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
608
608
|
const samples = [];
|
|
609
609
|
|
|
610
610
|
/** @type {number} */
|
|
@@ -699,7 +699,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
699
699
|
const MpegAudio = shaka.transmuxer.MpegAudio;
|
|
700
700
|
const timescale = shaka.util.TsParser.Timescale;
|
|
701
701
|
|
|
702
|
-
/** @type {!Array
|
|
702
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
703
703
|
const samples = [];
|
|
704
704
|
|
|
705
705
|
let firstHeader;
|
|
@@ -789,7 +789,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
789
789
|
const Opus = shaka.transmuxer.Opus;
|
|
790
790
|
const timescale = shaka.util.TsParser.Timescale;
|
|
791
791
|
|
|
792
|
-
/** @type {!Array
|
|
792
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
793
793
|
const samples = [];
|
|
794
794
|
|
|
795
795
|
let firstPts = null;
|
|
@@ -901,7 +901,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
901
901
|
const H264 = shaka.transmuxer.H264;
|
|
902
902
|
const timescale = shaka.util.TsParser.Timescale;
|
|
903
903
|
|
|
904
|
-
/** @type {!Array
|
|
904
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
905
905
|
const samples = [];
|
|
906
906
|
|
|
907
907
|
/** @type {?number} */
|
|
@@ -995,7 +995,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
995
995
|
const H265 = shaka.transmuxer.H265;
|
|
996
996
|
const timescale = shaka.util.TsParser.Timescale;
|
|
997
997
|
|
|
998
|
-
/** @type {!Array
|
|
998
|
+
/** @type {!Array<shaka.util.Mp4Generator.Mp4Sample>} */
|
|
999
999
|
const samples = [];
|
|
1000
1000
|
|
|
1001
1001
|
/** @type {?number} */
|
|
@@ -1083,7 +1083,7 @@ shaka.transmuxer.TsTransmuxer = class {
|
|
|
1083
1083
|
* Supported audio codecs.
|
|
1084
1084
|
*
|
|
1085
1085
|
* @private
|
|
1086
|
-
* @const {!Array
|
|
1086
|
+
* @const {!Array<string>}
|
|
1087
1087
|
*/
|
|
1088
1088
|
shaka.transmuxer.TsTransmuxer.SUPPORTED_AUDIO_CODECS_ = [
|
|
1089
1089
|
'aac',
|
|
@@ -1097,7 +1097,7 @@ shaka.transmuxer.TsTransmuxer.SUPPORTED_AUDIO_CODECS_ = [
|
|
|
1097
1097
|
* Supported audio codecs.
|
|
1098
1098
|
*
|
|
1099
1099
|
* @private
|
|
1100
|
-
* @const {!Array
|
|
1100
|
+
* @const {!Array<string>}
|
|
1101
1101
|
*/
|
|
1102
1102
|
shaka.transmuxer.TsTransmuxer.SUPPORTED_VIDEO_CODECS_ = [
|
|
1103
1103
|
'avc',
|
|
@@ -11,29 +11,29 @@ goog.require('shaka.util.PublicPromise');
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* A utility to wrap abortable operations. Note that these are not cancelable.
|
|
14
|
-
*
|
|
14
|
+
* Cancellation implies undoing what has been done so far, whereas aborting only
|
|
15
15
|
* means that further work is stopped.
|
|
16
16
|
*
|
|
17
|
-
* @implements {shaka.extern.IAbortableOperation
|
|
17
|
+
* @implements {shaka.extern.IAbortableOperation<T>}
|
|
18
18
|
* @template T
|
|
19
19
|
* @export
|
|
20
20
|
*/
|
|
21
21
|
shaka.util.AbortableOperation = class {
|
|
22
22
|
/**
|
|
23
|
-
* @param {!Promise
|
|
23
|
+
* @param {!Promise<T>} promise
|
|
24
24
|
* A Promise which represents the underlying operation. It is resolved when
|
|
25
25
|
* the operation is complete, and rejected if the operation fails or is
|
|
26
26
|
* aborted. Aborted operations should be rejected with a shaka.util.Error
|
|
27
27
|
* object using the error code OPERATION_ABORTED.
|
|
28
28
|
* @param {function():!Promise} onAbort
|
|
29
29
|
* Will be called by this object to abort the underlying operation.
|
|
30
|
-
* This is not
|
|
30
|
+
* This is not cancellation, and will not necessarily result in any work
|
|
31
31
|
* being undone. abort() should return a Promise which is resolved when the
|
|
32
32
|
* underlying operation has been aborted. The returned Promise should never
|
|
33
33
|
* be rejected.
|
|
34
34
|
*/
|
|
35
35
|
constructor(promise, onAbort) {
|
|
36
|
-
/** @const {!Promise
|
|
36
|
+
/** @const {!Promise<T>} */
|
|
37
37
|
this.promise = promise;
|
|
38
38
|
|
|
39
39
|
/** @private {function():!Promise} */
|
|
@@ -98,7 +98,7 @@ shaka.util.AbortableOperation = class {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
* @param {!Promise
|
|
101
|
+
* @param {!Promise<U>} promise
|
|
102
102
|
* @return {!shaka.util.AbortableOperation.<U>} An operation which cannot be
|
|
103
103
|
* aborted. It will be completed when the given Promise is resolved, or
|
|
104
104
|
* will be failed when the given Promise is rejected.
|
|
@@ -125,7 +125,7 @@ shaka.util.AbortableOperation = class {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* @param {!Array
|
|
128
|
+
* @param {!Array<!shaka.util.AbortableOperation>} operations
|
|
129
129
|
* @return {!shaka.util.AbortableOperation} An operation which is resolved
|
|
130
130
|
* when all operations are successful and fails when any operation fails.
|
|
131
131
|
* For this operation, abort() aborts all given operations.
|
|
@@ -149,7 +149,7 @@ shaka.util.AbortableOperation = class {
|
|
|
149
149
|
/**
|
|
150
150
|
* @param {(undefined|
|
|
151
151
|
* function(T):U|
|
|
152
|
-
* function(T):!Promise
|
|
152
|
+
* function(T):!Promise<U>|
|
|
153
153
|
* function(T):!shaka.util.AbortableOperation.<U>)} onSuccess
|
|
154
154
|
* A callback to be invoked after this operation is complete, to chain to
|
|
155
155
|
* another operation. The callback can return a plain value, a Promise to
|
|
@@ -212,7 +212,7 @@ shaka.util.AbortableOperation = class {
|
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
214
|
* @param {(function(T):U|
|
|
215
|
-
* function(T):!Promise
|
|
215
|
+
* function(T):!Promise<U>|
|
|
216
216
|
* function(T):!shaka.util.AbortableOperation.<U>|
|
|
217
217
|
* function(*))} callback
|
|
218
218
|
* A callback to be invoked with the given value.
|
|
@@ -254,7 +254,7 @@ shaka.util.AbortableOperation = class {
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
* @const {!Promise
|
|
257
|
+
* @const {!Promise<T>}
|
|
258
258
|
* @exportInterface
|
|
259
259
|
*/
|
|
260
260
|
// eslint-disable-next-line no-restricted-syntax
|
package/lib/util/array_utils.js
CHANGED
|
@@ -34,7 +34,7 @@ shaka.util.ArrayUtils = class {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Remove given element from array (assumes no duplicates).
|
|
37
|
-
* @param {!Array
|
|
37
|
+
* @param {!Array<T>} array
|
|
38
38
|
* @param {T} element
|
|
39
39
|
* @template T
|
|
40
40
|
*/
|
|
@@ -48,7 +48,7 @@ shaka.util.ArrayUtils = class {
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Count the number of items in the list that pass the check function.
|
|
51
|
-
* @param {!Array
|
|
51
|
+
* @param {!Array<T>} array
|
|
52
52
|
* @param {function(T):boolean} check
|
|
53
53
|
* @return {number}
|
|
54
54
|
* @template T
|
|
@@ -67,8 +67,8 @@ shaka.util.ArrayUtils = class {
|
|
|
67
67
|
/**
|
|
68
68
|
* Determines if the given arrays contain equal elements in any order.
|
|
69
69
|
*
|
|
70
|
-
* @param {!Array
|
|
71
|
-
* @param {!Array
|
|
70
|
+
* @param {!Array<T>} a
|
|
71
|
+
* @param {!Array<T>} b
|
|
72
72
|
* @param {function(T, T):boolean=} compareFn
|
|
73
73
|
* @return {boolean}
|
|
74
74
|
* @template T
|
|
@@ -100,8 +100,8 @@ shaka.util.ArrayUtils = class {
|
|
|
100
100
|
/**
|
|
101
101
|
* Determines if the given arrays contain equal elements in the same order.
|
|
102
102
|
*
|
|
103
|
-
* @param {!Array
|
|
104
|
-
* @param {!Array
|
|
103
|
+
* @param {!Array<T>} a
|
|
104
|
+
* @param {!Array<T>} b
|
|
105
105
|
* @param {function(T, T):boolean=} compareFn
|
|
106
106
|
* @return {boolean}
|
|
107
107
|
* @template T
|