shaka-player 2.5.1 → 2.5.5
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/.csslintrc +13 -0
- package/AUTHORS +3 -0
- package/CHANGELOG.md +156 -0
- package/CONTRIBUTORS +3 -0
- package/README.md +3 -0
- package/build/README.md +5 -5
- package/build/apps.py +3 -1
- package/build/build.py +5 -2
- package/build/check.py +17 -0
- package/build/compiler.py +49 -0
- package/build/conformance.textproto +1 -0
- package/build/docs.py +0 -6
- package/build/generateExterns.js +72 -20
- package/build/install-linux-prereqs.sh +4 -4
- package/build/shakaBuildHelpers.py +7 -8
- package/build/test.py +21 -9
- package/build/types/core +1 -0
- package/build/types/ui +6 -1
- package/demo/asset_card.js +129 -41
- package/demo/cast_receiver/receiver_app.css +27 -13
- package/demo/close_button.js +10 -15
- package/demo/common/asset.js +6 -6
- package/demo/common/assets.js +72 -14
- package/demo/config.js +28 -25
- package/demo/custom.js +20 -16
- package/demo/demo.less +107 -16
- package/demo/demo_uncompiled.js +33 -0
- package/demo/demo_utils.js +4 -3
- package/demo/front.js +12 -8
- package/demo/index.html +14 -17
- package/demo/input.js +30 -23
- package/demo/input_container.js +15 -11
- package/demo/load.js +5 -7
- package/demo/main.js +138 -49
- package/demo/search.js +40 -36
- package/demo/service_worker.js +1 -1
- package/demo/tooltip.js +16 -24
- package/dist/.csslintstamp +0 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +165 -152
- package/dist/demo.compiled.debug.map +4 -4
- package/dist/demo.compiled.js +165 -152
- package/dist/demo.compiled.map +4 -4
- package/dist/demo.css +1 -1
- package/dist/demo.css.map +1 -1
- package/dist/deps.js +28 -11
- package/dist/receiver.compiled.debug.js +11 -11
- package/dist/receiver.compiled.debug.map +3 -3
- package/dist/receiver.compiled.js +11 -11
- package/dist/receiver.compiled.map +3 -3
- package/dist/shaka-player.compiled.debug.externs.js +232 -102
- package/dist/shaka-player.compiled.debug.js +189 -165
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +232 -102
- package/dist/shaka-player.compiled.js +567 -553
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.debug.externs.js +338 -113
- package/dist/shaka-player.ui.debug.js +296 -276
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +338 -113
- package/dist/shaka-player.ui.js +685 -671
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/drm-config.md +1 -0
- package/docs/tutorials/fairplay.md +77 -0
- package/docs/tutorials/index.json +1 -0
- package/docs/tutorials/manifest-parser.md +1 -1
- package/docs/tutorials/ui-customization.md +5 -2
- package/docs/tutorials/ui.md +10 -4
- package/docs/tutorials/welcome.md +2 -2
- package/externs/mediasession.js +16 -1
- package/externs/shaka/net.js +14 -4
- package/externs/shaka/player.js +136 -90
- package/externs/tippy.js +30 -0
- package/externs/webkitmediakeys.js +4 -0
- package/karma.conf.js +30 -24
- package/lib/cast/cast_proxy.js +94 -23
- package/lib/cast/cast_receiver.js +8 -1
- package/lib/dash/content_protection.js +33 -1
- package/lib/dash/dash_parser.js +13 -5
- package/lib/hls/hls_parser.js +20 -4
- package/lib/media/drm_engine.js +29 -2
- package/lib/media/media_source_engine.js +9 -6
- package/lib/media/play_rate_controller.js +14 -3
- package/lib/media/playhead.js +8 -3
- package/lib/media/streaming_engine.js +68 -20
- package/lib/media/transmuxer.js +2 -2
- package/lib/media/video_wrapper.js +8 -3
- package/lib/net/data_uri_plugin.js +5 -2
- package/lib/net/http_fetch_plugin.js +3 -3
- package/lib/net/http_plugin_utils.js +2 -4
- package/lib/net/http_xhr_plugin.js +2 -2
- package/lib/net/networking_engine.js +1 -0
- package/lib/offline/offline_scheme.js +7 -2
- package/lib/player.js +18 -8
- package/lib/polyfill/input_event.js +7 -11
- package/lib/polyfill/mediasource.js +1 -1
- package/lib/polyfill/patchedmediakeys_apple.js +2 -72
- package/lib/text/cue.js +1 -1
- package/lib/text/ttml_text_parser.js +1 -1
- package/lib/util/config_utils.js +1 -0
- package/lib/util/error.js +45 -11
- package/lib/util/event_manager.js +211 -100
- package/lib/util/fairplay_utils.js +122 -0
- package/lib/util/i_releasable.js +1 -0
- package/lib/util/player_configuration.js +7 -0
- package/lib/util/pssh.js +41 -0
- package/lib/util/string_utils.js +42 -6
- package/lib/util/timer.js +1 -1
- package/package.json +33 -33
- package/roadmap.md +96 -0
- package/shaka-player.uncompiled.js +5 -1
- package/test/dash/dash_parser_content_protection_unit.js +35 -1
- package/test/dash/dash_parser_manifest_unit.js +60 -0
- package/test/hls/hls_live_unit.js +7 -1
- package/test/hls/hls_parser_unit.js +50 -0
- package/test/media/drm_engine_unit.js +10 -4
- package/test/media/media_source_engine_integration.js +12 -0
- package/test/media/media_source_engine_unit.js +3 -1
- package/test/media/playhead_unit.js +7 -5
- package/test/media/streaming_engine_unit.js +46 -1
- package/test/media/transmuxer_integration.js +13 -0
- package/test/net/data_uri_plugin_unit.js +13 -2
- package/test/net/http_plugin_unit.js +17 -12
- package/test/net/networking_engine_unit.js +17 -8
- package/test/offline/offline_scheme_unit.js +18 -8
- package/test/player_external.js +3 -2
- package/test/player_integration.js +94 -3
- package/test/player_src_equals_integration.js +2 -2
- package/test/player_unit.js +21 -8
- package/test/test/boot.js +20 -5
- package/test/test/externs/jasmine.js +48 -0
- package/test/test/util/expect_async_polyfill.js +145 -0
- package/test/test/util/fake_networking_engine.js +1 -0
- package/test/test/util/manifest_generator.js +2 -1
- package/test/test/util/test_scheme.js +34 -2
- package/test/test/util/ui_utils.js +41 -0
- package/test/test/util/util.js +16 -8
- package/test/ui/ui_unit.js +130 -4
- package/ui/audio_language_selection.js +17 -96
- package/ui/big_play_button.js +61 -0
- package/ui/controls.js +226 -335
- package/ui/controls.less +3 -5
- package/ui/element.js +24 -6
- package/ui/externs/ui.js +62 -9
- package/ui/fullscreen_button.js +2 -52
- package/ui/less/buttons.less +10 -16
- package/ui/less/containers.less +75 -20
- package/ui/less/general.less +18 -2
- package/ui/less/other_elements.less +2 -1
- package/ui/less/overflow_menu.less +11 -10
- package/ui/less/range_elements.less +12 -10
- package/ui/less/spinner.less +2 -0
- package/ui/overflow_menu.js +1 -1
- package/ui/pip_button.js +1 -1
- package/ui/{play_pause_button.js → play_button.js} +17 -47
- package/ui/presentation_time.js +17 -12
- package/ui/range_element.js +176 -0
- package/ui/resolution_selection.js +43 -106
- package/ui/seek_bar.js +204 -0
- package/ui/settings_menu.js +113 -0
- package/ui/small_play_button.js +73 -0
- package/ui/text_displayer.js +17 -14
- package/ui/text_selection.js +42 -107
- package/ui/ui.js +17 -40
- package/ui/volume_bar.js +40 -68
package/demo/common/assets.js
CHANGED
|
@@ -42,6 +42,8 @@ shakaAssets.Source = {
|
|
|
42
42
|
AZURE_MEDIA_SERVICES: 'Azure Media Services',
|
|
43
43
|
GPAC: 'GPAC',
|
|
44
44
|
UPLYNK: 'Verizon Digital Media Services',
|
|
45
|
+
APPLE: 'Apple',
|
|
46
|
+
IRT: 'IRT',
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
|
|
@@ -584,6 +586,17 @@ shakaAssets.testAssets = [
|
|
|
584
586
|
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
|
|
585
587
|
.addFeature(shakaAssets.Feature.MP4)
|
|
586
588
|
.addFeature(shakaAssets.Feature.OFFLINE),
|
|
589
|
+
new ShakaDemoAssetInfo(
|
|
590
|
+
/* name= */ 'Tears of Steel (HLS, Subtitles)',
|
|
591
|
+
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/tears_of_steel.png',
|
|
592
|
+
/* manifestUri= */ 'https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel-multiple-subtitles.ism/.m3u8',
|
|
593
|
+
/* source= */ shakaAssets.Source.UNIFIED_STREAMING)
|
|
594
|
+
.addFeature(shakaAssets.Feature.HLS)
|
|
595
|
+
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
|
|
596
|
+
.addFeature(shakaAssets.Feature.MP4)
|
|
597
|
+
.addFeature(shakaAssets.Feature.SUBTITLES)
|
|
598
|
+
.addFeature(shakaAssets.Feature.WEBVTT)
|
|
599
|
+
.addFeature(shakaAssets.Feature.OFFLINE),
|
|
587
600
|
new ShakaDemoAssetInfo(
|
|
588
601
|
/* name= */ 'Tears of Steel (Widevine)',
|
|
589
602
|
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/tears_of_steel.png',
|
|
@@ -948,19 +961,64 @@ shakaAssets.testAssets = [
|
|
|
948
961
|
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/sintel.png',
|
|
949
962
|
/* manifestUri= */ 'https://content.uplynk.com/1eb40d8e64234f5c9879db7045c3d48c.mpd?ad=cleardash&rays=cdefg',
|
|
950
963
|
/* source= */ shakaAssets.Source.UPLYNK)
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
964
|
+
// Disabled until we figure out the CORS errors and PlayReady status.
|
|
965
|
+
.markAsDisabled()
|
|
966
|
+
.addKeySystem(shakaAssets.KeySystem.WIDEVINE)
|
|
967
|
+
.addFeature(shakaAssets.Feature.DASH)
|
|
968
|
+
.addFeature(shakaAssets.Feature.MP4)
|
|
969
|
+
.addFeature(shakaAssets.Feature.MULTIPLE_LANGUAGES)
|
|
970
|
+
.addFeature(shakaAssets.Feature.MULTIPERIOD)
|
|
971
|
+
.addFeature(shakaAssets.Feature.MULTIKEY)
|
|
972
|
+
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
|
|
973
|
+
.addFeature(shakaAssets.Feature.AESCTR_16_BYTE_IV)
|
|
974
|
+
.addFeature(shakaAssets.Feature.ENCRYPTED_WITH_CLEAR)
|
|
975
|
+
.addLicenseServer('com.widevine.alpha', 'https://content.uplynk.com/wv')
|
|
976
|
+
.setRequestFilter(shakaAssets.UplynkRequestFilter)
|
|
977
|
+
.setResponseFilter(shakaAssets.UplynkResponseFilter),
|
|
978
|
+
// End Verizon Digital Media Services (VDMS) assets }}}
|
|
979
|
+
|
|
980
|
+
// Apple assets {{{
|
|
981
|
+
// Src: https://developer.apple.com/streaming/examples/
|
|
982
|
+
new ShakaDemoAssetInfo(
|
|
983
|
+
/* name= */ 'Apple Advanced HLS Stream (fMP4)',
|
|
984
|
+
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/apple_test_pattern.png',
|
|
985
|
+
/* manifestUri= */ 'https://storage.googleapis.com/shaka-demo-assets/apple-advanced-stream-fmp4/master.m3u8',
|
|
986
|
+
/* source= */ shakaAssets.Source.APPLE)
|
|
987
|
+
.addFeature(shakaAssets.Feature.HLS)
|
|
988
|
+
.addFeature(shakaAssets.Feature.MP4)
|
|
989
|
+
.addFeature(shakaAssets.Feature.CAPTIONS)
|
|
990
|
+
.addFeature(shakaAssets.Feature.WEBVTT)
|
|
991
|
+
.addFeature(shakaAssets.Feature.OFFLINE),
|
|
992
|
+
new ShakaDemoAssetInfo(
|
|
993
|
+
/* name= */ 'Apple Advanced HLS Stream (TS)',
|
|
994
|
+
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/apple_test_pattern.png',
|
|
995
|
+
/* manifestUri= */ 'https://storage.googleapis.com/shaka-demo-assets/apple-advanced-stream-ts/master.m3u8',
|
|
996
|
+
/* source= */ shakaAssets.Source.APPLE)
|
|
997
|
+
.addFeature(shakaAssets.Feature.HLS)
|
|
998
|
+
.addFeature(shakaAssets.Feature.MP2TS)
|
|
999
|
+
.addFeature(shakaAssets.Feature.CAPTIONS)
|
|
1000
|
+
.addFeature(shakaAssets.Feature.WEBVTT)
|
|
1001
|
+
.addFeature(shakaAssets.Feature.OFFLINE),
|
|
1002
|
+
// }}}
|
|
1003
|
+
|
|
1004
|
+
// IRT assets {{{
|
|
1005
|
+
// Src: http://subtitling.irt.de/cmaf/#urls
|
|
1006
|
+
// Note: According to the website, these assets may not be available 24/7.
|
|
1007
|
+
new ShakaDemoAssetInfo(
|
|
1008
|
+
/* name= */ 'Bayerischer Rundfunk Recorded Loop (DASH)',
|
|
1009
|
+
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/bayerischer_rundfunk.png',
|
|
1010
|
+
/* manifestUri= */ 'https://irtdashreference-i.akamaihd.net/dash/live/901161/keepixo1/manifestBR2.mpd',
|
|
1011
|
+
/* source= */ shakaAssets.Source.IRT)
|
|
1012
|
+
.addFeature(shakaAssets.Feature.DASH)
|
|
1013
|
+
.addFeature(shakaAssets.Feature.MP4)
|
|
1014
|
+
.addFeature(shakaAssets.Feature.LIVE),
|
|
1015
|
+
new ShakaDemoAssetInfo(
|
|
1016
|
+
/* name= */ 'Bayerischer Rundfunk Recorded Loop (HLS)',
|
|
1017
|
+
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/bayerischer_rundfunk.png',
|
|
1018
|
+
/* manifestUri= */ 'https://irtdashreference-i.akamaihd.net/dash/live/901161/keepixo1/playlistBR2.m3u8',
|
|
1019
|
+
/* source= */ shakaAssets.Source.IRT)
|
|
1020
|
+
.addFeature(shakaAssets.Feature.HLS)
|
|
1021
|
+
.addFeature(shakaAssets.Feature.MP4)
|
|
1022
|
+
.addFeature(shakaAssets.Feature.LIVE),
|
|
965
1023
|
// }}}
|
|
966
1024
|
];
|
package/demo/config.js
CHANGED
|
@@ -16,20 +16,23 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
goog.provide('shakaDemo.Config');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/** @type {?shakaDemo.Config} */
|
|
20
23
|
let shakaDemoConfig;
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Shaka Player demo, configuration page layout.
|
|
25
28
|
*/
|
|
26
|
-
class
|
|
29
|
+
shakaDemo.Config = class {
|
|
27
30
|
/**
|
|
28
31
|
* Register the page configuration.
|
|
29
32
|
*/
|
|
30
33
|
static init() {
|
|
31
34
|
const container = shakaDemoMain.getHamburgerMenu();
|
|
32
|
-
shakaDemoConfig = new
|
|
35
|
+
shakaDemoConfig = new shakaDemo.Config(container);
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
/** @param {!Element} container */
|
|
@@ -39,13 +42,13 @@ class ShakaDemoConfig {
|
|
|
39
42
|
|
|
40
43
|
/**
|
|
41
44
|
* A list of all sections.
|
|
42
|
-
* @private {!Array.<!
|
|
45
|
+
* @private {!Array.<!shakaDemo.InputContainer>}
|
|
43
46
|
*/
|
|
44
47
|
this.sections_ = [];
|
|
45
48
|
|
|
46
49
|
/**
|
|
47
50
|
* The input object for the control currently being constructed.
|
|
48
|
-
* @private {?
|
|
51
|
+
* @private {?shakaDemo.Input}
|
|
49
52
|
*/
|
|
50
53
|
this.latestInput_ = null;
|
|
51
54
|
|
|
@@ -133,7 +136,7 @@ class ShakaDemoConfig {
|
|
|
133
136
|
// All robustness fields of a given type are set at once.
|
|
134
137
|
this.addDatalistInput_(name, robustnessSuggestions, (input) => {
|
|
135
138
|
// Add in any common drmSystem not currently in advanced.
|
|
136
|
-
for (const drmSystem of
|
|
139
|
+
for (const drmSystem of shakaDemo.Main.commonDrmSystems) {
|
|
137
140
|
if (!(drmSystem in advanced)) {
|
|
138
141
|
advanced[drmSystem] = {
|
|
139
142
|
distinctiveIdentifierRequired: false,
|
|
@@ -393,14 +396,14 @@ class ShakaDemoConfig {
|
|
|
393
396
|
/**
|
|
394
397
|
* @param {string} name
|
|
395
398
|
* @param {?string} docLink
|
|
396
|
-
* @return {!
|
|
399
|
+
* @return {!shakaDemo.Config}
|
|
397
400
|
* @private
|
|
398
401
|
*/
|
|
399
402
|
addSection_(name, docLink) {
|
|
400
403
|
const style = name ?
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
this.sections_.push(new
|
|
404
|
+
shakaDemo.InputContainer.Style.ACCORDION :
|
|
405
|
+
shakaDemo.InputContainer.Style.VERTICAL;
|
|
406
|
+
this.sections_.push(new shakaDemo.InputContainer(
|
|
404
407
|
this.container_, name, style, docLink));
|
|
405
408
|
|
|
406
409
|
return this;
|
|
@@ -410,7 +413,7 @@ class ShakaDemoConfig {
|
|
|
410
413
|
* @param {string} name
|
|
411
414
|
* @param {string} valueName
|
|
412
415
|
* @param {string=} tooltipMessage
|
|
413
|
-
* @return {!
|
|
416
|
+
* @return {!shakaDemo.Config}
|
|
414
417
|
* @private
|
|
415
418
|
*/
|
|
416
419
|
addBoolInput_(name, valueName, tooltipMessage) {
|
|
@@ -430,12 +433,12 @@ class ShakaDemoConfig {
|
|
|
430
433
|
* @param {string} name
|
|
431
434
|
* @param {function(!Element)} onChange
|
|
432
435
|
* @param {string=} tooltipMessage
|
|
433
|
-
* @return {!
|
|
436
|
+
* @return {!shakaDemo.Config}
|
|
434
437
|
* @private
|
|
435
438
|
*/
|
|
436
439
|
addCustomBoolInput_(name, onChange, tooltipMessage) {
|
|
437
440
|
this.createRow_(name, tooltipMessage);
|
|
438
|
-
this.latestInput_ = new
|
|
441
|
+
this.latestInput_ = new shakaDemo.BoolInput(
|
|
439
442
|
this.getLatestSection_(), name, onChange);
|
|
440
443
|
return this;
|
|
441
444
|
}
|
|
@@ -444,7 +447,7 @@ class ShakaDemoConfig {
|
|
|
444
447
|
* @param {string} name
|
|
445
448
|
* @param {string} valueName
|
|
446
449
|
* @param {string=} tooltipMessage
|
|
447
|
-
* @return {!
|
|
450
|
+
* @return {!shakaDemo.Config}
|
|
448
451
|
* @private
|
|
449
452
|
*/
|
|
450
453
|
addTextInput_(name, valueName, tooltipMessage) {
|
|
@@ -463,12 +466,12 @@ class ShakaDemoConfig {
|
|
|
463
466
|
* @param {string} name
|
|
464
467
|
* @param {function(!Element)} onChange
|
|
465
468
|
* @param {string=} tooltipMessage
|
|
466
|
-
* @return {!
|
|
469
|
+
* @return {!shakaDemo.Config}
|
|
467
470
|
* @private
|
|
468
471
|
*/
|
|
469
472
|
addCustomTextInput_(name, onChange, tooltipMessage) {
|
|
470
473
|
this.createRow_(name, tooltipMessage);
|
|
471
|
-
this.latestInput_ = new
|
|
474
|
+
this.latestInput_ = new shakaDemo.TextInput(
|
|
472
475
|
this.getLatestSection_(), name, onChange);
|
|
473
476
|
return this;
|
|
474
477
|
}
|
|
@@ -480,7 +483,7 @@ class ShakaDemoConfig {
|
|
|
480
483
|
* @param {boolean=} canBeZero
|
|
481
484
|
* @param {boolean=} canBeUnset
|
|
482
485
|
* @param {string=} tooltipMessage
|
|
483
|
-
* @return {!
|
|
486
|
+
* @return {!shakaDemo.Config}
|
|
484
487
|
* @private
|
|
485
488
|
*/
|
|
486
489
|
addNumberInput_(name, valueName, canBeDecimal = false, canBeZero = true,
|
|
@@ -509,7 +512,7 @@ class ShakaDemoConfig {
|
|
|
509
512
|
}
|
|
510
513
|
};
|
|
511
514
|
this.createRow_(name, tooltipMessage);
|
|
512
|
-
this.latestInput_ = new
|
|
515
|
+
this.latestInput_ = new shakaDemo.NumberInput(
|
|
513
516
|
this.getLatestSection_(), name, onChange, canBeDecimal, canBeZero,
|
|
514
517
|
canBeUnset);
|
|
515
518
|
this.latestInput_.input().value =
|
|
@@ -526,12 +529,12 @@ class ShakaDemoConfig {
|
|
|
526
529
|
* @param {!Array.<string>} values
|
|
527
530
|
* @param {function(!Element)} onChange
|
|
528
531
|
* @param {string=} tooltipMessage
|
|
529
|
-
* @return {!
|
|
532
|
+
* @return {!shakaDemo.Config}
|
|
530
533
|
* @private
|
|
531
534
|
*/
|
|
532
535
|
addDatalistInput_(name, values, onChange, tooltipMessage) {
|
|
533
536
|
this.createRow_(name, tooltipMessage);
|
|
534
|
-
this.latestInput_ = new
|
|
537
|
+
this.latestInput_ = new shakaDemo.DatalistInput(
|
|
535
538
|
this.getLatestSection_(), name, onChange, values);
|
|
536
539
|
return this;
|
|
537
540
|
}
|
|
@@ -541,12 +544,12 @@ class ShakaDemoConfig {
|
|
|
541
544
|
* @param {!Object.<string, string>} values
|
|
542
545
|
* @param {function(!Element)} onChange
|
|
543
546
|
* @param {string=} tooltipMessage
|
|
544
|
-
* @return {!
|
|
547
|
+
* @return {!shakaDemo.Config}
|
|
545
548
|
* @private
|
|
546
549
|
*/
|
|
547
550
|
addSelectInput_(name, values, onChange, tooltipMessage) {
|
|
548
551
|
this.createRow_(name, tooltipMessage);
|
|
549
|
-
this.latestInput_ = new
|
|
552
|
+
this.latestInput_ = new shakaDemo.SelectInput(
|
|
550
553
|
this.getLatestSection_(), name, onChange, values);
|
|
551
554
|
return this;
|
|
552
555
|
}
|
|
@@ -605,7 +608,7 @@ class ShakaDemoConfig {
|
|
|
605
608
|
/**
|
|
606
609
|
* Gets the latest section. Results in a failed assert if there is no latest
|
|
607
610
|
* section.
|
|
608
|
-
* @return {!
|
|
611
|
+
* @return {!shakaDemo.InputContainer}
|
|
609
612
|
* @private
|
|
610
613
|
*/
|
|
611
614
|
getLatestSection_() {
|
|
@@ -613,7 +616,7 @@ class ShakaDemoConfig {
|
|
|
613
616
|
'Must have at least one section.');
|
|
614
617
|
return this.sections_[this.sections_.length - 1];
|
|
615
618
|
}
|
|
616
|
-
}
|
|
619
|
+
};
|
|
617
620
|
|
|
618
621
|
|
|
619
|
-
document.addEventListener('shaka-main-loaded',
|
|
622
|
+
document.addEventListener('shaka-main-loaded', shakaDemo.Config.init);
|
package/demo/custom.js
CHANGED
|
@@ -16,20 +16,23 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
goog.provide('shakaDemo.Custom');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/** @type {?shakaDemo.Custom} */
|
|
20
23
|
let shakaDemoCustom;
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Shaka Player demo, custom asset page layout.
|
|
25
28
|
*/
|
|
26
|
-
class
|
|
29
|
+
shakaDemo.Custom = class {
|
|
27
30
|
/**
|
|
28
31
|
* Register the page configuration.
|
|
29
32
|
*/
|
|
30
33
|
static init() {
|
|
31
34
|
const container = shakaDemoMain.addNavButton('custom');
|
|
32
|
-
shakaDemoCustom = new
|
|
35
|
+
shakaDemoCustom = new shakaDemo.Custom(container);
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
/** @param {!Element} container */
|
|
@@ -45,7 +48,7 @@ class ShakaDemoCustom {
|
|
|
45
48
|
/** @private {!Set.<!ShakaDemoAssetInfo>} */
|
|
46
49
|
this.assets_ = this.loadAssetInfos_();
|
|
47
50
|
|
|
48
|
-
/** @private {!Array.<!AssetCard>} */
|
|
51
|
+
/** @private {!Array.<!shakaDemo.AssetCard>} */
|
|
49
52
|
this.assetCards_ = [];
|
|
50
53
|
this.savedList_ = document.createElement('div');
|
|
51
54
|
container.appendChild(this.savedList_);
|
|
@@ -120,7 +123,7 @@ class ShakaDemoCustom {
|
|
|
120
123
|
if (licenseServerURL) {
|
|
121
124
|
// Make a license server entry for every common DRM plugin.
|
|
122
125
|
assetInProgress.licenseServers.clear();
|
|
123
|
-
for (const drmSystem of
|
|
126
|
+
for (const drmSystem of shakaDemo.Main.commonDrmSystems) {
|
|
124
127
|
assetInProgress.licenseServers.set(drmSystem, licenseServerURL);
|
|
125
128
|
}
|
|
126
129
|
if (customDRMSystem) {
|
|
@@ -132,8 +135,8 @@ class ShakaDemoCustom {
|
|
|
132
135
|
}
|
|
133
136
|
};
|
|
134
137
|
|
|
135
|
-
const containerStyle =
|
|
136
|
-
const container = new
|
|
138
|
+
const containerStyle = shakaDemo.InputContainer.Style.VERTICAL;
|
|
139
|
+
const container = new shakaDemo.InputContainer(
|
|
137
140
|
inputDiv, /* headerText = */ null, containerStyle,
|
|
138
141
|
/* docLink = */ null);
|
|
139
142
|
|
|
@@ -145,7 +148,7 @@ class ShakaDemoCustom {
|
|
|
145
148
|
*/
|
|
146
149
|
const makeField = (name, setup, onChange) => {
|
|
147
150
|
container.addRow(null, null);
|
|
148
|
-
const input = new
|
|
151
|
+
const input = new shakaDemo.TextInput(container, name, onChange);
|
|
149
152
|
input.extra().textContent = name;
|
|
150
153
|
setup(input.input(), input.container());
|
|
151
154
|
};
|
|
@@ -204,7 +207,7 @@ class ShakaDemoCustom {
|
|
|
204
207
|
customDrmSystemInput = input;
|
|
205
208
|
const drmSystems = assetInProgress.licenseServers.keys();
|
|
206
209
|
for (const drmSystem of drmSystems) {
|
|
207
|
-
if (!
|
|
210
|
+
if (!shakaDemo.Main.commonDrmSystems.includes(drmSystem)) {
|
|
208
211
|
input.value = drmSystem;
|
|
209
212
|
break;
|
|
210
213
|
}
|
|
@@ -300,7 +303,7 @@ class ShakaDemoCustom {
|
|
|
300
303
|
* @private
|
|
301
304
|
*/
|
|
302
305
|
loadAssetInfos_() {
|
|
303
|
-
const savedString = window.localStorage.getItem(
|
|
306
|
+
const savedString = window.localStorage.getItem(shakaDemo.Custom.saveId_);
|
|
304
307
|
if (savedString) {
|
|
305
308
|
const assets = JSON.parse(savedString);
|
|
306
309
|
return new Set(assets.map((json) => {
|
|
@@ -317,7 +320,7 @@ class ShakaDemoCustom {
|
|
|
317
320
|
* @private
|
|
318
321
|
*/
|
|
319
322
|
saveAssetInfos_(assetInfos) {
|
|
320
|
-
const saveId =
|
|
323
|
+
const saveId = shakaDemo.Custom.saveId_;
|
|
321
324
|
const assets = Array.from(assetInfos);
|
|
322
325
|
window.localStorage.setItem(saveId, JSON.stringify(assets));
|
|
323
326
|
}
|
|
@@ -352,12 +355,13 @@ class ShakaDemoCustom {
|
|
|
352
355
|
|
|
353
356
|
/**
|
|
354
357
|
* @param {!ShakaDemoAssetInfo} asset
|
|
355
|
-
* @return {!AssetCard}
|
|
358
|
+
* @return {!shakaDemo.AssetCard}
|
|
356
359
|
* @private
|
|
357
360
|
*/
|
|
358
361
|
createAssetCardFor_(asset) {
|
|
359
362
|
const savedList = this.savedList_;
|
|
360
|
-
|
|
363
|
+
const isFeatured = false;
|
|
364
|
+
return new shakaDemo.AssetCard(savedList, asset, isFeatured, (c) => {
|
|
361
365
|
c.addButton('Play', () => {
|
|
362
366
|
shakaDemoMain.loadAsset(asset);
|
|
363
367
|
this.updateSelected_();
|
|
@@ -417,7 +421,7 @@ class ShakaDemoCustom {
|
|
|
417
421
|
this.updateSelected_();
|
|
418
422
|
}
|
|
419
423
|
}
|
|
420
|
-
}
|
|
424
|
+
};
|
|
421
425
|
|
|
422
426
|
|
|
423
427
|
/**
|
|
@@ -425,7 +429,7 @@ class ShakaDemoCustom {
|
|
|
425
429
|
* custom assets.
|
|
426
430
|
* @const {string}
|
|
427
431
|
*/
|
|
428
|
-
|
|
432
|
+
shakaDemo.Custom.saveId_ = 'shakaPlayerDemoSavedAssets';
|
|
429
433
|
|
|
430
434
|
|
|
431
|
-
document.addEventListener('shaka-main-loaded',
|
|
435
|
+
document.addEventListener('shaka-main-loaded', shakaDemo.Custom.init);
|