shaka-player 3.1.3 → 3.2.2
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 +3 -0
- package/CHANGELOG.md +175 -3
- package/CONTRIBUTORS +3 -0
- package/README.md +4 -4
- package/build/generateExterns.js +1 -1
- package/build/types/polyfill +1 -0
- package/demo/common/asset.js +9 -7
- package/demo/common/assets.js +11 -2
- package/demo/common/message_ids.js +2 -1
- package/demo/config.js +5 -2
- package/demo/index.html +1 -1
- package/demo/locales/en.json +2 -1
- package/demo/locales/source.json +8 -4
- package/demo/main.js +2 -1
- package/dist/controls.css +2 -2
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +15 -15
- package/dist/demo.compiled.debug.map +2 -2
- package/dist/demo.compiled.js +15 -15
- package/dist/demo.compiled.map +2 -2
- package/dist/deps.js +22 -21
- package/dist/locales.js +36 -36
- package/dist/receiver.compiled.debug.js +9 -9
- package/dist/receiver.compiled.debug.map +2 -2
- package/dist/receiver.compiled.js +9 -9
- package/dist/receiver.compiled.map +2 -2
- package/dist/shaka-player.compiled.d.ts +58 -10
- package/dist/shaka-player.compiled.debug.d.ts +58 -10
- package/dist/shaka-player.compiled.debug.externs.js +777 -717
- package/dist/shaka-player.compiled.debug.js +639 -607
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +777 -717
- package/dist/shaka-player.compiled.js +826 -819
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +58 -10
- package/dist/shaka-player.ui.debug.d.ts +58 -10
- package/dist/shaka-player.ui.debug.externs.js +529 -469
- package/dist/shaka-player.ui.debug.js +676 -645
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +529 -469
- package/dist/shaka-player.ui.js +963 -955
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/fairplay.md +1 -1
- package/docs/tutorials/ui.md +5 -5
- package/externs/aria.js +6 -0
- package/externs/shaka/ads.js +24 -1
- package/externs/shaka/manifest.js +6 -1
- package/externs/shaka/offline.js +5 -0
- package/externs/shaka/player.js +53 -9
- package/externs/shaka/text.js +10 -10
- package/externs/texttrack.js +3 -0
- package/karma.conf.js +1 -0
- package/lib/ads/ad_manager.js +16 -15
- package/lib/ads/client_side_ad_manager.js +52 -88
- package/lib/ads/server_side_ad_manager.js +26 -12
- package/lib/cast/cast_proxy.js +11 -2
- package/lib/cast/cast_receiver.js +2 -1
- package/lib/cast/cast_sender.js +2 -2
- package/lib/cast/cast_utils.js +6 -1
- package/lib/cea/cea608_data_channel.js +56 -56
- package/lib/cea/cea608_memory.js +33 -33
- package/lib/cea/cea708_service.js +43 -43
- package/lib/cea/cea708_window.js +38 -38
- package/lib/cea/cea_decoder.js +13 -14
- package/lib/cea/cea_utils.js +23 -23
- package/lib/cea/dtvcc_packet_builder.js +7 -7
- package/lib/cea/i_caption_decoder.js +2 -3
- package/lib/cea/i_cea_parser.js +2 -2
- package/lib/cea/mp4_cea_parser.js +6 -6
- package/lib/dash/dash_parser.js +98 -2
- package/lib/dash/segment_list.js +1 -1
- package/lib/dash/segment_template.js +1 -1
- package/lib/hls/hls_parser.js +159 -29
- package/lib/media/closed_caption_parser.js +1 -2
- package/lib/media/drm_engine.js +169 -192
- package/lib/media/gap_jumping_controller.js +4 -2
- package/lib/media/media_source_engine.js +1 -2
- package/lib/media/segment_index.js +3 -1
- package/lib/media/segment_reference.js +19 -2
- package/lib/media/streaming_engine.js +8 -7
- package/lib/net/networking_engine.js +3 -1
- package/lib/offline/download_manager.js +1 -2
- package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
- package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
- package/lib/offline/manifest_converter.js +3 -1
- package/lib/offline/storage.js +12 -14
- package/lib/player.js +437 -167
- package/lib/polyfill/aria.js +82 -0
- package/lib/polyfill/media_capabilities.js +7 -1
- package/lib/polyfill/mediasource.js +6 -0
- package/lib/polyfill/orientation.js +1 -1
- package/lib/polyfill/patchedmediakeys_apple.js +4 -4
- package/lib/polyfill/patchedmediakeys_ms.js +4 -4
- package/lib/polyfill/patchedmediakeys_webkit.js +4 -4
- package/lib/routing/walker.js +2 -3
- package/lib/text/mp4_ttml_parser.js +3 -0
- package/lib/text/srt_text_parser.js +4 -4
- package/lib/text/text_engine.js +16 -4
- package/lib/text/ttml_text_parser.js +5 -0
- package/lib/text/ui_text_displayer.js +85 -37
- package/lib/text/vtt_text_parser.js +2 -2
- package/lib/text/web_vtt_generator.js +55 -12
- package/lib/util/error.js +6 -0
- package/lib/util/fake_event.js +53 -7
- package/lib/util/manifest_parser_utils.js +1 -0
- package/lib/util/mp4_box_parsers.js +20 -20
- package/lib/util/multi_map.js +8 -0
- package/lib/util/periods.js +4 -1
- package/lib/util/platform.js +13 -1
- package/lib/util/player_configuration.js +13 -1
- package/lib/util/stream_utils.js +153 -85
- package/lib/util/xml_utils.js +31 -12
- package/package.json +1 -1
- package/roadmap.md +24 -22
- package/shaka-player.uncompiled.js +1 -0
- package/test/cast/cast_proxy_unit.js +12 -6
- package/test/cast/cast_utils_unit.js +2 -1
- package/test/cea/cea608_memory_unit.js +1 -1
- package/test/cea/cea708_service_unit.js +8 -8
- package/test/cea/cea708_window_unit.js +6 -6
- package/test/cea/cea_decoder_unit.js +1 -1
- package/test/cea/dtvcc_packet_builder_unit.js +2 -2
- package/test/dash/dash_parser_manifest_unit.js +230 -2
- package/test/hls/hls_parser_unit.js +255 -1
- package/test/media/closed_caption_parser_unit.js +6 -1
- package/test/media/drm_engine_integration.js +86 -12
- package/test/media/drm_engine_unit.js +353 -450
- package/test/offline/manifest_convert_unit.js +2 -0
- package/test/offline/storage_integration.js +9 -19
- package/test/player_integration.js +90 -0
- package/test/player_src_equals_integration.js +52 -0
- package/test/player_unit.js +11 -33
- package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
- package/test/test/assets/3675/dash_0.mpd +30 -0
- package/test/test/assets/3675/dash_1.mpd +30 -0
- package/test/test/assets/3675/dash_2.mpd +30 -0
- package/test/test/assets/3675/dash_3.mpd +30 -0
- package/test/test/assets/3675/dash_4.mpd +30 -0
- package/test/test/assets/3675/dash_5.mpd +26 -0
- package/test/test/assets/3675/init-stream0.m4s +0 -0
- package/test/test/assets/chapters.srt +11 -0
- package/test/test/assets/chapters.vtt +10 -0
- package/test/test/util/cea_utils.js +12 -12
- package/test/test/util/fake_ad_manager.js +8 -1
- package/test/test/util/manifest_generator.js +2 -0
- package/test/test/util/manifest_parser_util.js +3 -1
- package/test/text/ttml_text_parser_unit.js +9 -0
- package/test/text/ui_text_displayer_unit.js +29 -17
- package/test/text/web_vtt_generator_unit.js +81 -7
- package/test/ui/localization_unit.js +15 -14
- package/test/ui/text_displayer_layout_unit.js +13 -1
- package/test/util/stream_utils_unit.js +153 -10
- package/ui/airplay_button.js +1 -1
- package/ui/audio_language_selection.js +2 -5
- package/ui/cast_button.js +6 -9
- package/ui/constants.js +0 -3
- package/ui/controls.js +4 -6
- package/ui/fast_forward_button.js +2 -3
- package/ui/fullscreen_button.js +1 -3
- package/ui/language_utils.js +1 -1
- package/ui/less/containers.less +3 -7
- package/ui/locales/ru.json +6 -6
- package/ui/localization.js +28 -51
- package/ui/loop_button.js +1 -3
- package/ui/mute_button.js +1 -3
- package/ui/overflow_menu.js +2 -3
- package/ui/pip_button.js +7 -10
- package/ui/playback_rate_selection.js +3 -6
- package/ui/presentation_time.js +1 -3
- package/ui/resolution_selection.js +4 -7
- package/ui/rewind_button.js +2 -3
- package/ui/seek_bar.js +2 -4
- package/ui/spacer.js +1 -1
- package/ui/text_selection.js +8 -11
- package/ui/ui_utils.js +1 -1
- package/ui/volume_bar.js +1 -3
|
@@ -135,12 +135,16 @@ shaka.media.SegmentReference = class {
|
|
|
135
135
|
* presentation. Any content from after this time will be removed by
|
|
136
136
|
* MediaSource.
|
|
137
137
|
* @param {!Array.<!shaka.media.SegmentReference>=} partialReferences
|
|
138
|
-
|
|
138
|
+
* A list of SegmentReferences for the partial segments.
|
|
139
|
+
* @param {?string=} tilesLayout
|
|
140
|
+
* The value is a grid-item-dimension consisting of two positive decimal
|
|
141
|
+
* integers in the format: column-x-row ('4x3'). It describes the
|
|
142
|
+
* arrangement of Images in a Grid. The minimum valid LAYOUT is '1x1'.
|
|
139
143
|
*/
|
|
140
144
|
constructor(
|
|
141
145
|
startTime, endTime, uris, startByte, endByte, initSegmentReference,
|
|
142
146
|
timestampOffset, appendWindowStart, appendWindowEnd,
|
|
143
|
-
partialReferences = []) {
|
|
147
|
+
partialReferences = [], tilesLayout = '') {
|
|
144
148
|
// A preload hinted Partial Segment has the same startTime and endTime.
|
|
145
149
|
goog.asserts.assert(startTime <= endTime,
|
|
146
150
|
'startTime must be less than or equal to endTime');
|
|
@@ -184,6 +188,9 @@ shaka.media.SegmentReference = class {
|
|
|
184
188
|
|
|
185
189
|
/** @type {!Array.<!shaka.media.SegmentReference>} */
|
|
186
190
|
this.partialReferences = partialReferences;
|
|
191
|
+
|
|
192
|
+
/** @type {?string} */
|
|
193
|
+
this.tilesLayout = tilesLayout;
|
|
187
194
|
}
|
|
188
195
|
|
|
189
196
|
/**
|
|
@@ -258,6 +265,16 @@ shaka.media.SegmentReference = class {
|
|
|
258
265
|
hasPartialSegments() {
|
|
259
266
|
return this.partialReferences.length > 0;
|
|
260
267
|
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Returns the segment's tiles layout. Only defined in image segments.
|
|
271
|
+
*
|
|
272
|
+
* @return {?string}
|
|
273
|
+
* @export
|
|
274
|
+
*/
|
|
275
|
+
getTilesLayout() {
|
|
276
|
+
return this.tilesLayout;
|
|
277
|
+
}
|
|
261
278
|
};
|
|
262
279
|
|
|
263
280
|
|
|
@@ -1001,10 +1001,10 @@ shaka.media.StreamingEngine = class {
|
|
|
1001
1001
|
if (bufferedAhead >= scaledBufferingGoal) {
|
|
1002
1002
|
shaka.log.v2(logPrefix, 'buffering goal met');
|
|
1003
1003
|
|
|
1004
|
-
// Do not try to predict the next update. Just poll
|
|
1005
|
-
// The playback rate can change at any time, so
|
|
1006
|
-
// could be terribly invalid soon.
|
|
1007
|
-
return
|
|
1004
|
+
// Do not try to predict the next update. Just poll according to
|
|
1005
|
+
// configuration (seconds). The playback rate can change at any time, so
|
|
1006
|
+
// any prediction we make now could be terribly invalid soon.
|
|
1007
|
+
return this.config_.updateIntervalSeconds / 2;
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
1010
|
const bufferEnd =
|
|
@@ -1016,7 +1016,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1016
1016
|
// In any case just try again... if the manifest is incomplete or is not
|
|
1017
1017
|
// being updated then we'll idle forever; otherwise, we'll end up getting
|
|
1018
1018
|
// a SegmentReference eventually.
|
|
1019
|
-
return
|
|
1019
|
+
return this.config_.updateIntervalSeconds;
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
1022
|
// Do not let any one stream get far ahead of any other.
|
|
@@ -1047,7 +1047,7 @@ shaka.media.StreamingEngine = class {
|
|
|
1047
1047
|
// For example, let video buffering catch up to audio buffering before
|
|
1048
1048
|
// fetching another audio segment.
|
|
1049
1049
|
shaka.log.v2(logPrefix, 'waiting for other streams to buffer');
|
|
1050
|
-
return
|
|
1050
|
+
return this.config_.updateIntervalSeconds;
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
1053
|
const p = this.fetchAndAppend_(mediaState, presentationTime, reference);
|
|
@@ -1662,7 +1662,8 @@ shaka.media.StreamingEngine = class {
|
|
|
1662
1662
|
|
|
1663
1663
|
// Dispatch an event to notify the application about the emsg box.
|
|
1664
1664
|
const eventName = shaka.Player.EventName.Emsg;
|
|
1665
|
-
const
|
|
1665
|
+
const data = (new Map()).set('detail', emsg);
|
|
1666
|
+
const event = new shaka.util.FakeEvent(eventName, data);
|
|
1666
1667
|
this.playerInterface_.onEvent(event);
|
|
1667
1668
|
}
|
|
1668
1669
|
}
|
|
@@ -544,7 +544,8 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
|
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
if (error.severity == shaka.util.Error.Severity.RECOVERABLE) {
|
|
547
|
-
const
|
|
547
|
+
const data = (new Map()).set('error', error);
|
|
548
|
+
const event = new shaka.util.FakeEvent('retry', data);
|
|
548
549
|
this.dispatchEvent(event);
|
|
549
550
|
|
|
550
551
|
// Move to the next URI.
|
|
@@ -706,6 +707,7 @@ shaka.net.NetworkingEngine.RequestType = {
|
|
|
706
707
|
'LICENSE': 2,
|
|
707
708
|
'APP': 3,
|
|
708
709
|
'TIMING': 4,
|
|
710
|
+
'SERVER_CERTIFICATE': 5,
|
|
709
711
|
};
|
|
710
712
|
|
|
711
713
|
|
|
@@ -44,9 +44,8 @@ shaka.offline.DownloadManager = class {
|
|
|
44
44
|
|
|
45
45
|
/** @private {!shaka.util.Destroyer} */
|
|
46
46
|
this.destroyer_ = new shaka.util.Destroyer(() => {
|
|
47
|
-
const promises = Array.from(this.groups_.values());
|
|
48
47
|
// Add a "catch" block to stop errors from being returned.
|
|
49
|
-
return
|
|
48
|
+
return this.abortAll().catch(() => {});
|
|
50
49
|
});
|
|
51
50
|
|
|
52
51
|
/**
|
|
@@ -229,7 +229,9 @@ shaka.offline.ManifestConverter = class {
|
|
|
229
229
|
initSegmentReference,
|
|
230
230
|
segmentDB.timestampOffset,
|
|
231
231
|
segmentDB.appendWindowStart,
|
|
232
|
-
segmentDB.appendWindowEnd
|
|
232
|
+
segmentDB.appendWindowEnd,
|
|
233
|
+
/* partialReferences= */ [],
|
|
234
|
+
segmentDB.tilesLayout || '');
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
/**
|
package/lib/offline/storage.js
CHANGED
|
@@ -484,25 +484,23 @@ shaka.offline.Storage = class {
|
|
|
484
484
|
const maxHwRes = {width: Infinity, height: Infinity};
|
|
485
485
|
StreamUtils.filterByRestrictions(manifest, config.restrictions, maxHwRes);
|
|
486
486
|
|
|
487
|
-
// Filter the manifest based on what we know
|
|
488
|
-
// play later (no point storing something we can't play).
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
manifest, config.offline.usePersistentLicense);
|
|
492
|
-
} else {
|
|
493
|
-
StreamUtils.filterManifestByMediaSource(manifest);
|
|
494
|
-
// Filter the manifest based on what we know our drm system will support
|
|
495
|
-
// playing later.
|
|
496
|
-
StreamUtils.filterManifestByDrm(manifest, drmEngine);
|
|
497
|
-
}
|
|
487
|
+
// Filter the manifest based on what we know MediaCapabilities will be able
|
|
488
|
+
// to play later (no point storing something we can't play).
|
|
489
|
+
StreamUtils.filterManifestByMediaCapabilities(
|
|
490
|
+
manifest, config.offline.usePersistentLicense);
|
|
498
491
|
|
|
499
492
|
// Gather all tracks.
|
|
500
493
|
const allTracks = [];
|
|
501
494
|
|
|
502
495
|
// Choose the codec that has the lowest average bandwidth.
|
|
503
496
|
const preferredAudioChannelCount = config.preferredAudioChannelCount;
|
|
497
|
+
const preferredDecodingAttributes = config.preferredDecodingAttributes;
|
|
498
|
+
const preferredVideoCodecs = config.preferredVideoCodecs;
|
|
499
|
+
const preferredAudioCodecs = config.preferredAudioCodecs;
|
|
500
|
+
|
|
504
501
|
StreamUtils.chooseCodecsAndFilterManifest(
|
|
505
|
-
manifest,
|
|
502
|
+
manifest, preferredVideoCodecs, preferredAudioCodecs,
|
|
503
|
+
preferredAudioChannelCount, preferredDecodingAttributes);
|
|
506
504
|
|
|
507
505
|
for (const variant of manifest.variants) {
|
|
508
506
|
goog.asserts.assert(
|
|
@@ -1001,8 +999,7 @@ shaka.offline.Storage = class {
|
|
|
1001
999
|
|
|
1002
1000
|
drmEngine.configure(config.drm);
|
|
1003
1001
|
await drmEngine.initForStorage(
|
|
1004
|
-
manifest.variants, config.offline.usePersistentLicense
|
|
1005
|
-
config.useMediaCapabilities);
|
|
1002
|
+
manifest.variants, config.offline.usePersistentLicense);
|
|
1006
1003
|
await drmEngine.setServerCertificate();
|
|
1007
1004
|
await drmEngine.createOrLoad();
|
|
1008
1005
|
|
|
@@ -1204,6 +1201,7 @@ shaka.offline.Storage = class {
|
|
|
1204
1201
|
appendWindowStart: segment.appendWindowStart,
|
|
1205
1202
|
appendWindowEnd: segment.appendWindowEnd,
|
|
1206
1203
|
timestampOffset: segment.timestampOffset,
|
|
1204
|
+
tilesLayout: segment.tilesLayout,
|
|
1207
1205
|
dataKey,
|
|
1208
1206
|
});
|
|
1209
1207
|
});
|