shaka-player 3.1.4 → 3.3.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/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
- package/.github/ISSUE_TEMPLATE/feature_request.md +1 -1
- package/.github/ISSUE_TEMPLATE/question.md +1 -1
- package/AUTHORS +6 -5
- package/CHANGELOG.md +363 -0
- package/CONTRIBUTORS +4 -2
- package/README.md +4 -4
- package/build/types/core +3 -0
- package/build/types/offline +1 -0
- package/build/types/polyfill +2 -0
- package/build/types/ui +2 -0
- package/demo/common/asset.js +9 -7
- package/demo/common/assets.js +28 -1
- package/demo/common/message_ids.js +15 -2
- package/demo/config.js +35 -2
- package/demo/index.html +1 -1
- package/demo/locales/en.json +14 -1
- package/demo/locales/source.json +56 -4
- package/demo/main.js +2 -1
- package/dist/controls.css +26 -2
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +24 -21
- package/dist/demo.compiled.debug.map +3 -3
- package/dist/demo.compiled.js +24 -21
- package/dist/demo.compiled.map +3 -3
- package/dist/deps.js +33 -25
- package/dist/locales.js +31 -29
- package/dist/receiver.compiled.debug.js +14 -12
- package/dist/receiver.compiled.debug.map +3 -3
- package/dist/receiver.compiled.js +14 -12
- package/dist/receiver.compiled.map +3 -3
- package/dist/shaka-player.compiled.d.ts +258 -20
- package/dist/shaka-player.compiled.debug.d.ts +258 -20
- package/dist/shaka-player.compiled.debug.externs.js +1005 -695
- package/dist/shaka-player.compiled.debug.js +720 -640
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +1005 -695
- package/dist/shaka-player.compiled.js +850 -817
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +274 -21
- package/dist/shaka-player.ui.debug.d.ts +274 -21
- package/dist/shaka-player.ui.debug.externs.js +766 -429
- package/dist/shaka-player.ui.debug.js +863 -765
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +766 -429
- package/dist/shaka-player.ui.js +1042 -996
- package/dist/shaka-player.ui.map +4 -4
- package/docs/design/bg-fetch-after.gv +29 -0
- package/docs/design/bg-fetch-after.gv.png +0 -0
- package/docs/design/bg-fetch-before.gv +18 -0
- package/docs/design/bg-fetch-before.gv.png +0 -0
- package/docs/design/bg-fetch.md +134 -0
- package/docs/tutorials/blob-url.md +15 -0
- package/docs/tutorials/index.json +1 -0
- package/docs/tutorials/ui-customization.md +66 -0
- package/docs/tutorials/ui.md +5 -5
- package/externs/aria.js +6 -0
- package/externs/ima.js +3 -0
- package/externs/shaka/ads.js +29 -1
- package/externs/shaka/manifest.js +18 -2
- package/externs/shaka/manifest_parser.js +10 -1
- package/externs/shaka/net.js +20 -4
- package/externs/shaka/offline.js +36 -2
- package/externs/shaka/player.js +182 -13
- package/externs/shaka/text.js +24 -10
- package/externs/texttrack.js +3 -0
- package/externs/webcrypto.js +18 -0
- package/lib/abr/ewma.js +14 -0
- package/lib/abr/ewma_bandwidth_estimator.js +16 -2
- package/lib/abr/simple_abr_manager.js +6 -0
- package/lib/ads/ad_manager.js +16 -15
- package/lib/ads/client_side_ad.js +8 -0
- package/lib/ads/client_side_ad_manager.js +14 -6
- package/lib/ads/server_side_ad.js +7 -0
- package/lib/ads/server_side_ad_manager.js +19 -2
- package/lib/cast/cast_proxy.js +8 -0
- package/lib/cast/cast_utils.js +7 -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 +53 -14
- package/lib/dash/segment_base.js +25 -1
- package/lib/dash/segment_list.js +18 -9
- package/lib/dash/segment_template.js +23 -10
- package/lib/hls/hls_parser.js +210 -30
- package/lib/media/closed_caption_parser.js +1 -2
- package/lib/media/drm_engine.js +162 -192
- package/lib/media/quality_observer.js +291 -0
- package/lib/media/segment_index.js +9 -1
- package/lib/media/segment_reference.js +37 -5
- package/lib/media/streaming_engine.js +48 -10
- package/lib/net/http_fetch_plugin.js +31 -11
- package/lib/net/http_plugin_utils.js +1 -0
- package/lib/net/http_xhr_plugin.js +40 -14
- package/lib/net/networking_engine.js +82 -18
- package/lib/offline/download_info.js +68 -0
- package/lib/offline/download_manager.js +14 -7
- package/lib/offline/indexeddb/base_storage_cell.js +35 -0
- package/lib/offline/indexeddb/storage_mechanism.js +1 -1
- package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
- package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
- package/lib/offline/indexeddb/v5_storage_cell.js +5 -0
- package/lib/offline/manifest_converter.js +3 -1
- package/lib/offline/storage.js +404 -297
- package/lib/offline/stored_content_utils.js +2 -0
- package/lib/player.js +622 -153
- package/lib/polyfill/aria.js +82 -0
- package/lib/polyfill/random_uuid.js +52 -0
- package/lib/routing/walker.js +2 -3
- package/lib/text/cue.js +12 -0
- package/lib/text/srt_text_parser.js +4 -4
- package/lib/text/text_engine.js +2 -2
- package/lib/text/ttml_text_parser.js +25 -2
- package/lib/text/ui_text_displayer.js +2 -2
- package/lib/text/vtt_text_parser.js +2 -2
- package/lib/text/web_vtt_generator.js +55 -12
- package/lib/util/cmcd_manager.js +826 -0
- package/lib/util/error.js +12 -0
- package/lib/util/language_utils.js +12 -0
- 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/mutex.js +52 -0
- package/lib/util/periods.js +98 -64
- package/lib/util/player_configuration.js +31 -1
- package/lib/util/stream_utils.js +140 -85
- package/lib/util/xml_utils.js +31 -12
- package/package.json +1 -1
- package/roadmap.md +24 -22
- package/shaka-player.uncompiled.js +4 -0
- package/test/cast/cast_utils_unit.js +1 -0
- 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_content_protection_unit.js +2 -0
- package/test/dash/dash_parser_live_unit.js +101 -1
- package/test/dash/dash_parser_manifest_unit.js +78 -2
- package/test/dash/dash_parser_segment_base_unit.js +2 -0
- package/test/dash/dash_parser_segment_list_unit.js +2 -1
- package/test/dash/dash_parser_segment_template_unit.js +2 -1
- package/test/hls/hls_live_unit.js +2 -0
- package/test/hls/hls_parser_unit.js +252 -0
- package/test/media/drm_engine_integration.js +86 -12
- package/test/media/drm_engine_unit.js +310 -450
- package/test/media/quality_observer_unit.js +139 -0
- package/test/media/segment_reference_unit.js +16 -1
- package/test/media/streaming_engine_integration.js +2 -1
- package/test/media/streaming_engine_unit.js +2 -0
- package/test/net/http_plugin_unit.js +20 -15
- package/test/offline/manifest_convert_unit.js +2 -0
- package/test/offline/storage_integration.js +117 -23
- package/test/player_integration.js +151 -0
- package/test/player_src_equals_integration.js +52 -0
- package/test/player_unit.js +11 -33
- 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/dash_parser_util.js +4 -0
- package/test/test/util/fake_ad.js +7 -0
- package/test/test/util/fake_ad_manager.js +7 -0
- package/test/test/util/fake_drm_engine.js +9 -2
- package/test/test/util/manifest_generator.js +5 -2
- package/test/test/util/manifest_parser_util.js +3 -1
- package/test/test/util/test_scheme.js +14 -1
- package/test/text/ttml_text_parser_unit.js +47 -0
- package/test/text/web_vtt_generator_unit.js +81 -7
- package/test/ui/ui_unit.js +250 -0
- package/test/util/cmcd_manager_unit.js +277 -0
- package/test/util/stream_utils_unit.js +118 -10
- package/ui/airplay_button.js +2 -1
- package/ui/audio_language_selection.js +9 -5
- package/ui/cast_button.js +5 -6
- package/ui/constants.js +0 -3
- package/ui/context_menu.js +109 -0
- package/ui/controls.js +41 -7
- package/ui/controls.less +1 -0
- package/ui/enums.js +4 -0
- package/ui/externs/ui.js +28 -1
- package/ui/fast_forward_button.js +16 -8
- package/ui/fullscreen_button.js +2 -3
- package/ui/language_utils.js +1 -1
- package/ui/less/buttons.less +0 -4
- package/ui/less/containers.less +74 -0
- package/ui/less/overflow_menu.less +0 -10
- package/ui/less/tooltip.less +97 -0
- package/ui/locales/en.json +1 -0
- package/ui/locales/source.json +4 -0
- package/ui/loop_button.js +6 -3
- package/ui/mute_button.js +3 -4
- package/ui/overflow_menu.js +7 -28
- package/ui/pip_button.js +10 -7
- package/ui/play_button.js +2 -2
- package/ui/playback_rate_selection.js +11 -15
- package/ui/presentation_time.js +1 -3
- package/ui/resolution_selection.js +11 -7
- package/ui/rewind_button.js +17 -9
- package/ui/seek_bar.js +6 -6
- package/ui/settings_menu.js +36 -4
- package/ui/small_play_button.js +1 -0
- package/ui/spacer.js +1 -1
- package/ui/statistics_button.js +253 -0
- package/ui/text_selection.js +19 -15
- package/ui/ui.js +30 -0
- package/ui/ui_utils.js +1 -1
- package/ui/volume_bar.js +2 -4
|
@@ -162,7 +162,7 @@ describe('DrmEngine', () => {
|
|
|
162
162
|
document.body.removeChild(video);
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
function
|
|
165
|
+
function checkTrueDrmSupport() {
|
|
166
166
|
if (shaka.util.Platform.isXboxOne()) {
|
|
167
167
|
// Axinom won't issue a license for an Xbox One. The error message from
|
|
168
168
|
// the license server says "Your DRM client's security level is 150, but
|
|
@@ -174,16 +174,11 @@ describe('DrmEngine', () => {
|
|
|
174
174
|
return support['com.widevine.alpha'] || support['com.microsoft.playready'];
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
filterDescribe('basic flow with MediaCapabilities ' + isEnabled,
|
|
180
|
-
checkSupport, () => {
|
|
181
|
-
testBasicFlow(useMediaCapabilities);
|
|
182
|
-
});
|
|
177
|
+
function checkClearKeySupport() {
|
|
178
|
+
return support['org.w3.clearkey'];
|
|
183
179
|
}
|
|
184
180
|
|
|
185
|
-
|
|
186
|
-
function testBasicFlow(useMediaCapabilities) {
|
|
181
|
+
filterDescribe('basic flow', checkTrueDrmSupport, () => {
|
|
187
182
|
drmIt('gets a license and can play encrypted segments', async () => {
|
|
188
183
|
// The error callback should not be invoked.
|
|
189
184
|
onErrorSpy.and.callFake(fail);
|
|
@@ -226,8 +221,7 @@ describe('DrmEngine', () => {
|
|
|
226
221
|
|
|
227
222
|
const variants = manifest.variants;
|
|
228
223
|
|
|
229
|
-
await drmEngine.initForPlayback(variants, manifest.offlineSessionIds
|
|
230
|
-
useMediaCapabilities);
|
|
224
|
+
await drmEngine.initForPlayback(variants, manifest.offlineSessionIds);
|
|
231
225
|
await drmEngine.attach(video);
|
|
232
226
|
await mediaSourceEngine.appendBuffer(
|
|
233
227
|
ContentType.VIDEO, videoInitSegment, null, null,
|
|
@@ -283,5 +277,85 @@ describe('DrmEngine', () => {
|
|
|
283
277
|
expect(video.readyState).toBeGreaterThan(1);
|
|
284
278
|
expect(video.currentTime).toBeGreaterThan(0);
|
|
285
279
|
});
|
|
286
|
-
} // describe('basic flow')
|
|
280
|
+
}); // describe('basic flow')
|
|
281
|
+
|
|
282
|
+
filterDescribe('ClearKey', checkClearKeySupport, () => {
|
|
283
|
+
drmIt('plays encrypted content with the ClearKey CDM', async () => {
|
|
284
|
+
// Configure DrmEngine for ClearKey playback.
|
|
285
|
+
const config = shaka.util.PlayerConfiguration.createDefault().drm;
|
|
286
|
+
config.clearKeys = {
|
|
287
|
+
// From https://github.com/Axinom/public-test-vectors/tree/conservative#v61-multidrm
|
|
288
|
+
'6e5a1d26275747d78046eaa5d1d34b5a': '197f26f572c864d2338b3ae5d114ea9c',
|
|
289
|
+
};
|
|
290
|
+
drmEngine.configure(config);
|
|
291
|
+
|
|
292
|
+
// The error callback should not be invoked.
|
|
293
|
+
onErrorSpy.and.callFake(fail);
|
|
294
|
+
|
|
295
|
+
/** @type {!shaka.util.PublicPromise} */
|
|
296
|
+
const encryptedEventSeen = new shaka.util.PublicPromise();
|
|
297
|
+
eventManager.listen(video, 'encrypted', () => {
|
|
298
|
+
encryptedEventSeen.resolve();
|
|
299
|
+
});
|
|
300
|
+
eventManager.listen(video, 'error', () => {
|
|
301
|
+
fail('MediaError code ' + video.error.code);
|
|
302
|
+
let extended = video.error.msExtendedCode;
|
|
303
|
+
if (extended) {
|
|
304
|
+
if (extended < 0) {
|
|
305
|
+
extended += Math.pow(2, 32);
|
|
306
|
+
}
|
|
307
|
+
fail('MediaError msExtendedCode ' + extended.toString(16));
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
/** @type {!shaka.util.PublicPromise} */
|
|
312
|
+
const keyStatusEventSeen = new shaka.util.PublicPromise();
|
|
313
|
+
onKeyStatusSpy.and.callFake(() => {
|
|
314
|
+
keyStatusEventSeen.resolve();
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const variants = manifest.variants;
|
|
318
|
+
|
|
319
|
+
await drmEngine.initForPlayback(variants, manifest.offlineSessionIds);
|
|
320
|
+
await drmEngine.attach(video);
|
|
321
|
+
await mediaSourceEngine.appendBuffer(
|
|
322
|
+
ContentType.VIDEO, videoInitSegment, null, null,
|
|
323
|
+
/* hasClosedCaptions= */ false);
|
|
324
|
+
await mediaSourceEngine.appendBuffer(
|
|
325
|
+
ContentType.AUDIO, audioInitSegment, null, null,
|
|
326
|
+
/* hasClosedCaptions= */ false);
|
|
327
|
+
await encryptedEventSeen;
|
|
328
|
+
|
|
329
|
+
// Some platforms (notably 2017 Tizen TVs) do not fire key status
|
|
330
|
+
// events.
|
|
331
|
+
const keyStatusTimeout = shaka.test.Util.delay(5);
|
|
332
|
+
await Promise.race([keyStatusTimeout, keyStatusEventSeen]);
|
|
333
|
+
|
|
334
|
+
const call = onKeyStatusSpy.calls.mostRecent();
|
|
335
|
+
if (call) {
|
|
336
|
+
const map = /** @type {!Object} */ (call.args[0]);
|
|
337
|
+
expect(Object.keys(map).length).not.toBe(0);
|
|
338
|
+
for (const k in map) {
|
|
339
|
+
expect(map[k]).toBe('usable');
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
await mediaSourceEngine.appendBuffer(
|
|
344
|
+
ContentType.VIDEO, videoSegment, 0, 10,
|
|
345
|
+
/* hasClosedCaptions= */ false);
|
|
346
|
+
await mediaSourceEngine.appendBuffer(
|
|
347
|
+
ContentType.AUDIO, audioSegment, 0, 10,
|
|
348
|
+
/* hasClosedCaptions= */ false);
|
|
349
|
+
|
|
350
|
+
expect(video.buffered.end(0)).toBeGreaterThan(0);
|
|
351
|
+
video.play();
|
|
352
|
+
|
|
353
|
+
const waiter = new shaka.test.Waiter(eventManager).timeoutAfter(15);
|
|
354
|
+
await waiter.waitForMovement(video);
|
|
355
|
+
|
|
356
|
+
// Something should have played by now.
|
|
357
|
+
expect(video.readyState).toBeGreaterThan(1);
|
|
358
|
+
expect(video.currentTime).toBeGreaterThan(0);
|
|
359
|
+
});
|
|
360
|
+
}); // describe('ClearKey')
|
|
287
361
|
});
|