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/demo.less
CHANGED
|
@@ -19,18 +19,17 @@
|
|
|
19
19
|
@import (css, inline) "../node_modules/material-design-lite/dist/material.indigo-blue.min.css";
|
|
20
20
|
@import (css, inline) "../node_modules/dialog-polyfill/dialog-polyfill.css";
|
|
21
21
|
@import (css, inline) "../node_modules/awesomplete/awesomplete.css";
|
|
22
|
+
@import (css, inline) "../node_modules/tippy.js/index.css";
|
|
22
23
|
|
|
23
24
|
@accent-border-color: #8080ff;
|
|
24
25
|
@error-color: #d84a38;
|
|
25
26
|
@drawer-width: 550px;
|
|
26
27
|
|
|
27
28
|
@mdl-footer-link-color: #9e9e9e; /* copied from MDL stylesheet */
|
|
28
|
-
@mdl-button-color: rgb(
|
|
29
|
+
@mdl-button-color: rgb(63,81,181); /* copied from MDL stylesheet */
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
color: darken(@mdl-button-color, 20%);
|
|
33
|
-
}
|
|
31
|
+
@progress-circle-size: 45px;
|
|
32
|
+
@progress-circle-thickness: 5px;
|
|
34
33
|
|
|
35
34
|
/* This is a less mixin only, rather than a CSS class. MDL has an equivalent
|
|
36
35
|
* class with the same name, which can be used in the application directly. */
|
|
@@ -47,11 +46,12 @@
|
|
|
47
46
|
text-align: center;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
.close-button {
|
|
49
|
+
.shaka-controls-button-panel > .close-button {
|
|
51
50
|
/* Move the button to the top-right. */
|
|
52
51
|
position: absolute;
|
|
53
52
|
top: 10px;
|
|
54
53
|
right: 10px;
|
|
54
|
+
|
|
55
55
|
/* Give the button a round background, meant to look like the play button. */
|
|
56
56
|
border-radius: 50%;
|
|
57
57
|
width: 32px;
|
|
@@ -66,11 +66,16 @@ html, body {
|
|
|
66
66
|
|
|
67
67
|
/* Give the FAB a drop shadow, that expands a little bit when moused over. */
|
|
68
68
|
.mdl-button--fab {
|
|
69
|
-
filter: drop-shadow(0 2px 5px #
|
|
69
|
+
filter: drop-shadow(0 2px 5px #333);
|
|
70
70
|
transition: 0.2s ease-in-out;
|
|
71
71
|
}
|
|
72
|
+
|
|
72
73
|
.mdl-button--fab:hover {
|
|
73
|
-
filter: drop-shadow(0 2px 8px #
|
|
74
|
+
filter: drop-shadow(0 2px 8px #333);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.input-container-label {
|
|
78
|
+
padding-right: 1em;
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
/* Remove vertical padding on MDL text fields, but only while they are in
|
|
@@ -80,22 +85,27 @@ html, body {
|
|
|
80
85
|
// The default width of 300px is a bit too wide for us.
|
|
81
86
|
width: 200px;
|
|
82
87
|
}
|
|
88
|
+
|
|
83
89
|
.hamburger-menu .mdl-textfield__label {
|
|
84
90
|
top: 4px;
|
|
85
91
|
}
|
|
92
|
+
|
|
86
93
|
.hamburger-menu .mdl-textfield__label:after {
|
|
87
94
|
bottom: 0;
|
|
88
95
|
}
|
|
96
|
+
|
|
89
97
|
.hamburger-menu .mdl-layout-title {
|
|
90
98
|
/* The line-height style in mdl-layout-title looks weird on narrow displays,
|
|
91
99
|
* so remove it in the hamburger menu. */
|
|
92
100
|
line-height: unset;
|
|
93
101
|
}
|
|
102
|
+
|
|
94
103
|
.hamburger-menu .input-container-label {
|
|
95
104
|
/* Give the labels for input rows a left margin. This keeps them from directly
|
|
96
105
|
* touching the left side of the screen, for improved readability. */
|
|
97
106
|
margin-left: 1em;
|
|
98
107
|
}
|
|
108
|
+
|
|
99
109
|
.hamburger-menu .mdl-button--raised {
|
|
100
110
|
/* Left-align the text content of the section header buttons. */
|
|
101
111
|
text-align: left;
|
|
@@ -108,11 +118,13 @@ html, body {
|
|
|
108
118
|
padding: 1em;
|
|
109
119
|
line-height: 2em;
|
|
110
120
|
text-align: center;
|
|
111
|
-
width: 100%;
|
|
112
121
|
}
|
|
113
122
|
|
|
114
123
|
#error-display-link {
|
|
115
124
|
color: white;
|
|
125
|
+
display: inline-block;
|
|
126
|
+
margin-left: auto;
|
|
127
|
+
margin-right: auto;
|
|
116
128
|
}
|
|
117
129
|
|
|
118
130
|
.input-disabled {
|
|
@@ -124,9 +136,10 @@ html, body {
|
|
|
124
136
|
color: white;
|
|
125
137
|
position: relative;
|
|
126
138
|
padding: 0 0;
|
|
127
|
-
top:
|
|
128
|
-
right:
|
|
139
|
+
top: 0;
|
|
140
|
+
right: 1em;
|
|
129
141
|
float: right;
|
|
142
|
+
font-size: 24px;
|
|
130
143
|
font-weight: bold;
|
|
131
144
|
text-decoration: none;
|
|
132
145
|
cursor: pointer;
|
|
@@ -137,6 +150,7 @@ html, body {
|
|
|
137
150
|
display: inline-block;
|
|
138
151
|
margin: 1em;
|
|
139
152
|
}
|
|
153
|
+
|
|
140
154
|
.asset-card-unsupported {
|
|
141
155
|
display: inline-block;
|
|
142
156
|
margin: 1em;
|
|
@@ -150,41 +164,53 @@ html, body {
|
|
|
150
164
|
background-size: contain;
|
|
151
165
|
background-repeat: no-repeat;
|
|
152
166
|
display: inline-block;
|
|
167
|
+
|
|
153
168
|
/* features */
|
|
154
169
|
&[icon="high_definition"] {
|
|
155
170
|
background-image: data-uri('icons/custom_high_definition.svg');
|
|
156
171
|
}
|
|
172
|
+
|
|
157
173
|
&[icon="ultra_high_definition"] {
|
|
158
174
|
background-image: data-uri('icons/custom_ultra_high_definition.svg');
|
|
159
175
|
}
|
|
176
|
+
|
|
160
177
|
&[icon="subtitles"] {
|
|
161
178
|
background-image: data-uri('icons/baseline-subtitles-24px.svg');
|
|
162
179
|
}
|
|
180
|
+
|
|
163
181
|
&[icon="closed_caption"] {
|
|
164
182
|
background-image: data-uri('icons/baseline-closed_caption-24px.svg');
|
|
165
183
|
}
|
|
184
|
+
|
|
166
185
|
&[icon="live"] {
|
|
167
186
|
background-image: data-uri('icons/baseline-live_tv-24px.svg');
|
|
168
187
|
}
|
|
188
|
+
|
|
169
189
|
&[icon="trick_mode"] {
|
|
170
190
|
background-image: data-uri('icons/baseline-fast_forward-24px.svg');
|
|
171
191
|
}
|
|
192
|
+
|
|
172
193
|
&[icon="surround_sound"] {
|
|
173
194
|
background-image: data-uri('icons/baseline-surround_sound-24px.svg');
|
|
174
195
|
}
|
|
196
|
+
|
|
175
197
|
&[icon="multiple_languages"] {
|
|
176
198
|
background-image: data-uri('icons/baseline-language-24px.svg');
|
|
177
199
|
}
|
|
200
|
+
|
|
178
201
|
&[icon="audio_only"] {
|
|
179
202
|
background-image: data-uri('icons/baseline-audiotrack-24px.svg');
|
|
180
203
|
}
|
|
204
|
+
|
|
181
205
|
/* key systems */
|
|
182
206
|
&[icon="widevine"] {
|
|
183
207
|
background-image: data-uri('icons/custom_widevine.svg');
|
|
184
208
|
}
|
|
209
|
+
|
|
185
210
|
&[icon="clear_key"] {
|
|
186
211
|
background-image: data-uri('icons/custom_clear_key.svg');
|
|
187
212
|
}
|
|
213
|
+
|
|
188
214
|
&[icon="playready"] {
|
|
189
215
|
background-image: data-uri('icons/custom_playready.svg');
|
|
190
216
|
}
|
|
@@ -205,6 +231,48 @@ html, body {
|
|
|
205
231
|
right: 5px;
|
|
206
232
|
}
|
|
207
233
|
|
|
234
|
+
.progress-circle {
|
|
235
|
+
position: absolute;
|
|
236
|
+
top: 0;
|
|
237
|
+
right: 14px;
|
|
238
|
+
width: @progress-circle-size;
|
|
239
|
+
height: @progress-circle-size;
|
|
240
|
+
|
|
241
|
+
/* This should be unclickable, so that you can click the button beneath. */
|
|
242
|
+
pointer-events: none;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.progress-circle-svg {
|
|
246
|
+
/* In rotation, 0 degrees is the right side. That means that the progress
|
|
247
|
+
* circle "starts at" the right side. Normally, you expect the circle to
|
|
248
|
+
* "start at" the top, like a clock; this rotates the circle, so it behaves
|
|
249
|
+
* thusly. */
|
|
250
|
+
transform: rotate(-90deg);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.progress-circle-circle() {
|
|
254
|
+
/* Set the position and radius of the circle, so it is in the center of the
|
|
255
|
+
* svg's canvas. */
|
|
256
|
+
cx: @progress-circle-size / 2;
|
|
257
|
+
cy: @progress-circle-size / 2;
|
|
258
|
+
r: (@progress-circle-size - @progress-circle-thickness) / 2;
|
|
259
|
+
fill: none;
|
|
260
|
+
stroke-width: @progress-circle-thickness;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.progress-circle-bar {
|
|
264
|
+
.progress-circle-circle();
|
|
265
|
+
|
|
266
|
+
stroke: @mdl-button-color;
|
|
267
|
+
stroke-linecap: round;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.progress-circle-back {
|
|
271
|
+
.progress-circle-circle();
|
|
272
|
+
|
|
273
|
+
stroke: #eee;
|
|
274
|
+
}
|
|
275
|
+
|
|
208
276
|
.asset-card .mdl-card__title {
|
|
209
277
|
/* The maximum width of the title should be narrower than the width of the
|
|
210
278
|
* card itself, so that the title doesn't overlap with the store button. */
|
|
@@ -220,9 +288,9 @@ html, body {
|
|
|
220
288
|
.asset-card img {
|
|
221
289
|
/* Icons are 300px by 210px (10:7 aspect ratio). */
|
|
222
290
|
width: 300px;
|
|
291
|
+
|
|
223
292
|
/* Constrain to space if necessary. */
|
|
224
293
|
max-width: 100%;
|
|
225
|
-
|
|
226
294
|
display: block;
|
|
227
295
|
margin-left: auto;
|
|
228
296
|
margin-right: auto;
|
|
@@ -251,6 +319,7 @@ html, body {
|
|
|
251
319
|
height: auto;
|
|
252
320
|
flex-wrap: wrap;
|
|
253
321
|
}
|
|
322
|
+
|
|
254
323
|
/* The spacer should be hidden in this mode, so that the version number is no
|
|
255
324
|
* longer being forced to the right. */
|
|
256
325
|
.app-header .mdl-layout-spacer {
|
|
@@ -293,6 +362,7 @@ footer .mdl-mega-footer__link-list {
|
|
|
293
362
|
/* The default color was low-contrast on this dark background. */
|
|
294
363
|
color: lighten(@mdl-footer-link-color, 20%);
|
|
295
364
|
}
|
|
365
|
+
|
|
296
366
|
a[disabled] {
|
|
297
367
|
/* Making the disabled version even darker would be even worse in terms of
|
|
298
368
|
* contrast, so use a strikethrough style instead. */
|
|
@@ -362,6 +432,7 @@ footer .mdl-mega-footer__link-list {
|
|
|
362
432
|
/* The video bar fills the horizontal space, but its height depends on the
|
|
363
433
|
* contents. */
|
|
364
434
|
width: 100%;
|
|
435
|
+
|
|
365
436
|
/* Add a little bit of padding on top, to make the video not look cropped. */
|
|
366
437
|
padding-top: 1em;
|
|
367
438
|
}
|
|
@@ -379,6 +450,24 @@ footer .mdl-mega-footer__link-list {
|
|
|
379
450
|
max-width: 100%;
|
|
380
451
|
}
|
|
381
452
|
|
|
453
|
+
#video-bar.no-input-sized {
|
|
454
|
+
/* Add some additional padding so that TV overscan doesn't cut off the version
|
|
455
|
+
* number or other information we might need. */
|
|
456
|
+
padding: 2.5em 2em;
|
|
457
|
+
|
|
458
|
+
/* Constrain the body to its size minus margin and padding, so that nested
|
|
459
|
+
* elements can constrain to the body. */
|
|
460
|
+
width: 100%;
|
|
461
|
+
width: calc(100% - 4em);
|
|
462
|
+
height: 100%;
|
|
463
|
+
height: calc(100% - 5em);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.video-container.no-input-sized {
|
|
467
|
+
width: 100%;
|
|
468
|
+
height: 100%;
|
|
469
|
+
}
|
|
470
|
+
|
|
382
471
|
#video {
|
|
383
472
|
/* Fill whatever space we're given, whether fullscreen or not. */
|
|
384
473
|
width: 100%;
|
|
@@ -396,26 +485,28 @@ footer .mdl-mega-footer__link-list {
|
|
|
396
485
|
.input-container-row {
|
|
397
486
|
display: inline-block;
|
|
398
487
|
}
|
|
488
|
+
|
|
399
489
|
.input-container-style-flex {
|
|
400
490
|
display: flex;
|
|
401
491
|
flex-wrap: wrap;
|
|
402
492
|
}
|
|
493
|
+
|
|
403
494
|
.input-container-style-vertical {
|
|
404
495
|
text-align: left;
|
|
405
496
|
}
|
|
497
|
+
|
|
406
498
|
.input-container-style-accordion {
|
|
407
499
|
text-align: left;
|
|
408
500
|
opacity: 0;
|
|
409
|
-
max-height:
|
|
501
|
+
max-height: 0;
|
|
410
502
|
transition: 0.3s ease-in-out;
|
|
411
503
|
}
|
|
504
|
+
|
|
412
505
|
.input-container-style-accordion.show {
|
|
413
506
|
opacity: 1;
|
|
507
|
+
|
|
414
508
|
/* If the max-height is too high (e.g. set to 100%), the "sliding out"
|
|
415
509
|
* animation is too fast to make out with the eye.
|
|
416
510
|
* So give it a fixed maximum instead. */
|
|
417
511
|
max-height: 1000px;
|
|
418
512
|
}
|
|
419
|
-
.input-container-label {
|
|
420
|
-
padding-right: 1em;
|
|
421
|
-
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2016 Google Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
goog.require('shakaDemo.AssetCard');
|
|
19
|
+
goog.require('shakaDemo.CloseButton');
|
|
20
|
+
goog.require('shakaDemo.Config');
|
|
21
|
+
goog.require('shakaDemo.Custom');
|
|
22
|
+
goog.require('shakaDemo.Utils');
|
|
23
|
+
goog.require('shakaDemo.Front');
|
|
24
|
+
goog.require('shakaDemo.BoolInput');
|
|
25
|
+
goog.require('shakaDemo.DatalistInput');
|
|
26
|
+
goog.require('shakaDemo.Input');
|
|
27
|
+
goog.require('shakaDemo.NumberInput');
|
|
28
|
+
goog.require('shakaDemo.SelectInput');
|
|
29
|
+
goog.require('shakaDemo.TextInput');
|
|
30
|
+
goog.require('shakaDemo.InputContainer');
|
|
31
|
+
goog.require('shakaDemo.Main');
|
|
32
|
+
goog.require('shakaDemo.Search');
|
|
33
|
+
goog.require('shakaDemo.Tooltips');
|
package/demo/demo_utils.js
CHANGED
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
goog.provide('shakaDemo.Utils');
|
|
18
19
|
|
|
19
20
|
/** @namespace */
|
|
20
|
-
|
|
21
|
+
shakaDemo.Utils = {};
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Goes through the various values in shaka.extern.PlayerConfiguration, and
|
|
@@ -32,7 +33,7 @@ let ShakaDemoUtils = {};
|
|
|
32
33
|
* checked only to determine the shape and structure of a PlayerConfiguration
|
|
33
34
|
* object.
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
+
shakaDemo.Utils.runThroughHashParams = (callback, config) => {
|
|
36
37
|
// Override the "natural" name for a config value in the hash.
|
|
37
38
|
// This exists for legacy reasons; the previous demo page had some hash values
|
|
38
39
|
// set to names that did not match the names of their corresponding config
|
|
@@ -107,7 +108,7 @@ ShakaDemoUtils.runThroughHashParams = (callback, config) => {
|
|
|
107
108
|
/**
|
|
108
109
|
* @return {boolean} True if the browser would support the uncompiled build.
|
|
109
110
|
*/
|
|
110
|
-
|
|
111
|
+
shakaDemo.Utils.browserSupportsUncompiledMode = () => {
|
|
111
112
|
// Check if ES6 arrow function syntax and ES7 async are usable. Both are
|
|
112
113
|
// needed for uncompiled builds to work.
|
|
113
114
|
try {
|
package/demo/front.js
CHANGED
|
@@ -16,25 +16,28 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
goog.provide('shakaDemo.Front');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/** @type {?shakaDemo.Front} */
|
|
20
23
|
let shakaDemoFront;
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Shaka Player demo, front page layout.
|
|
25
28
|
*/
|
|
26
|
-
class
|
|
29
|
+
shakaDemo.Front = class {
|
|
27
30
|
/**
|
|
28
31
|
* Register the page configuration.
|
|
29
32
|
*/
|
|
30
33
|
static init() {
|
|
31
34
|
const container = shakaDemoMain.addNavButton('front');
|
|
32
|
-
shakaDemoFront = new
|
|
35
|
+
shakaDemoFront = new shakaDemo.Front(container);
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
/** @param {!Element} container */
|
|
36
39
|
constructor(container) {
|
|
37
|
-
/** @private {!Array.<!AssetCard>} */
|
|
40
|
+
/** @private {!Array.<!shakaDemo.AssetCard>} */
|
|
38
41
|
this.assetCards_ = [];
|
|
39
42
|
|
|
40
43
|
/** @private {!Element} */
|
|
@@ -116,11 +119,12 @@ class ShakaDemoFront {
|
|
|
116
119
|
/**
|
|
117
120
|
* @param {!ShakaDemoAssetInfo} asset
|
|
118
121
|
* @param {!Element} container
|
|
119
|
-
* @return {!AssetCard}
|
|
122
|
+
* @return {!shakaDemo.AssetCard}
|
|
120
123
|
* @private
|
|
121
124
|
*/
|
|
122
125
|
createAssetCardFor_(asset, container) {
|
|
123
|
-
|
|
126
|
+
const isFeatured = true;
|
|
127
|
+
return new shakaDemo.AssetCard(container, asset, isFeatured, (c) => {
|
|
124
128
|
const unsupportedReason = shakaDemoMain.getAssetUnsupportedReason(
|
|
125
129
|
asset, /* needOffline= */ false);
|
|
126
130
|
if (unsupportedReason) {
|
|
@@ -154,7 +158,7 @@ class ShakaDemoFront {
|
|
|
154
158
|
card.selectByAsset(shakaDemoMain.selectedAsset);
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
|
-
}
|
|
161
|
+
};
|
|
158
162
|
|
|
159
163
|
|
|
160
|
-
document.addEventListener('shaka-main-loaded',
|
|
164
|
+
document.addEventListener('shaka-main-loaded', shakaDemo.Front.init);
|
package/demo/index.html
CHANGED
|
@@ -41,9 +41,13 @@
|
|
|
41
41
|
<!-- MDL is enabled by including this: -->
|
|
42
42
|
<script defer src="../node_modules/material-design-lite/dist/material.min.js"></script>
|
|
43
43
|
<!-- MDL modal dialogs are enabled by including these: -->
|
|
44
|
-
<script defer src="../node_modules/dialog-polyfill/dialog-polyfill.js"></script>
|
|
44
|
+
<script defer src="../node_modules/dialog-polyfill/dist/dialog-polyfill.js"></script>
|
|
45
45
|
<!-- Datalist-like fields are enabled by including these: -->
|
|
46
46
|
<script defer src="../node_modules/awesomplete/awesomplete.min.js"></script>
|
|
47
|
+
<!-- tippy.js requires popper.js to work properly: -->
|
|
48
|
+
<script defer src="../node_modules/popper.js/dist/umd/popper.min.js"></script>
|
|
49
|
+
<!-- Tooltips are made using tippy.js: -->
|
|
50
|
+
<script defer src="../node_modules/tippy.js/umd/index.min.js"></script>
|
|
47
51
|
|
|
48
52
|
<script>
|
|
49
53
|
COMPILED_JS = [
|
|
@@ -71,17 +75,7 @@ UNCOMPILED_JS = [
|
|
|
71
75
|
// These are the individual parts of the demo app.
|
|
72
76
|
'common/asset.js',
|
|
73
77
|
'common/assets.js',
|
|
74
|
-
'
|
|
75
|
-
'asset_card.js',
|
|
76
|
-
'close_button.js',
|
|
77
|
-
'input.js',
|
|
78
|
-
'input_container.js',
|
|
79
|
-
'tooltip.js',
|
|
80
|
-
'main.js',
|
|
81
|
-
'front.js',
|
|
82
|
-
'search.js',
|
|
83
|
-
'custom.js',
|
|
84
|
-
'config.js'
|
|
78
|
+
'demo_uncompiled.js',
|
|
85
79
|
];
|
|
86
80
|
</script>
|
|
87
81
|
|
|
@@ -90,18 +84,21 @@ UNCOMPILED_JS = [
|
|
|
90
84
|
</head>
|
|
91
85
|
<body>
|
|
92
86
|
<div id="main-layout" class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
|
|
93
|
-
<header class="app-header mdl-layout__header">
|
|
87
|
+
<header class="app-header mdl-layout__header should-hide-in-no-input-mode">
|
|
94
88
|
<header class="mdl-layout__header-row" id="nav-button-container">
|
|
95
89
|
<img alt="Shaka Player Logo" src="shaka_logo_trans.png" class="logo" />
|
|
96
90
|
<button id="nav-button-front" class="mdl-button mdl-js-button mdl-js-ripple-effect should-disable-on-fail" defaultselected>HOME</button>
|
|
97
91
|
<button id="nav-button-search" class="mdl-button mdl-js-button mdl-js-ripple-effect should-disable-on-fail">SEARCH</button>
|
|
98
92
|
<button id="nav-button-custom" class="mdl-button mdl-js-button mdl-js-ripple-effect should-disable-on-fail">CUSTOM CONTENT</button>
|
|
99
93
|
<div class="mdl-layout-spacer"></div>
|
|
100
|
-
<div
|
|
101
|
-
<span
|
|
94
|
+
<div class="version-block">
|
|
95
|
+
<span class="version-string"></span>
|
|
102
96
|
</div>
|
|
103
97
|
</header>
|
|
104
98
|
</header>
|
|
99
|
+
<div class="version-block hidden should-show-in-no-input-mode">
|
|
100
|
+
<span class="version-string"></span>
|
|
101
|
+
</div>
|
|
105
102
|
<div class="mdl-layout__drawer hamburger-menu">
|
|
106
103
|
<div id="hamburger-menu-title" class="mdl-layout-title">
|
|
107
104
|
Shaka Player Demo Config
|
|
@@ -121,8 +118,8 @@ UNCOMPILED_JS = [
|
|
|
121
118
|
<video data-shaka-player autoplay playsinline id="video"></video>
|
|
122
119
|
</div>
|
|
123
120
|
</div>
|
|
124
|
-
<div id="contents"></div>
|
|
125
|
-
<footer class="mdl-mega-footer">
|
|
121
|
+
<div id="contents" class="should-hide-in-no-input-mode"></div>
|
|
122
|
+
<footer class="mdl-mega-footer should-hide-in-no-input-mode">
|
|
126
123
|
<div class="mdl-mega-footer__middle-section">
|
|
127
124
|
|
|
128
125
|
<div class="mdl-mega-footer__drop-down-section">
|
package/demo/input.js
CHANGED
|
@@ -15,12 +15,19 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
goog.provide('shakaDemo.BoolInput');
|
|
19
|
+
goog.provide('shakaDemo.DatalistInput');
|
|
20
|
+
goog.provide('shakaDemo.Input');
|
|
21
|
+
goog.provide('shakaDemo.NumberInput');
|
|
22
|
+
goog.provide('shakaDemo.SelectInput');
|
|
23
|
+
goog.provide('shakaDemo.TextInput');
|
|
24
|
+
|
|
18
25
|
/**
|
|
19
26
|
* Creates and contains the MDL elements of a type of input.
|
|
20
27
|
*/
|
|
21
|
-
class
|
|
28
|
+
shakaDemo.Input = class {
|
|
22
29
|
/**
|
|
23
|
-
* @param {!
|
|
30
|
+
* @param {!shakaDemo.InputContainer} parentContainer
|
|
24
31
|
* @param {string} inputType The element type for the input object.
|
|
25
32
|
* @param {string} containerType The element type for the container containing
|
|
26
33
|
* the input object.
|
|
@@ -36,7 +43,7 @@ class ShakaDemoInput {
|
|
|
36
43
|
/** @private {!Element} */
|
|
37
44
|
this.input_ = document.createElement(inputType);
|
|
38
45
|
this.input_.onchange = () => { onChange(this.input_); };
|
|
39
|
-
this.input_.id =
|
|
46
|
+
this.input_.id = shakaDemo.Input.generateNewId_('input');
|
|
40
47
|
this.container_.appendChild(this.input_);
|
|
41
48
|
|
|
42
49
|
if (parentContainer.latestTooltip) {
|
|
@@ -46,7 +53,7 @@ class ShakaDemoInput {
|
|
|
46
53
|
const extraInfo = document.createElement('span');
|
|
47
54
|
extraInfo.textContent = parentContainer.latestTooltip;
|
|
48
55
|
extraInfo.classList.add('hidden');
|
|
49
|
-
extraInfo.id =
|
|
56
|
+
extraInfo.id = shakaDemo.Input.generateNewId_('extra-info');
|
|
50
57
|
this.container_.appendChild(extraInfo);
|
|
51
58
|
this.input_.setAttribute('aria-describedby', extraInfo.id);
|
|
52
59
|
}
|
|
@@ -85,23 +92,23 @@ class ShakaDemoInput {
|
|
|
85
92
|
* @private
|
|
86
93
|
*/
|
|
87
94
|
static generateNewId_(prefix) {
|
|
88
|
-
const idNumber =
|
|
89
|
-
|
|
95
|
+
const idNumber = shakaDemo.Input.lastId_;
|
|
96
|
+
shakaDemo.Input.lastId_ += 1;
|
|
90
97
|
return prefix + '-labeled-' + idNumber;
|
|
91
98
|
}
|
|
92
|
-
}
|
|
99
|
+
};
|
|
93
100
|
|
|
94
101
|
|
|
95
102
|
/** @private {number} */
|
|
96
|
-
|
|
103
|
+
shakaDemo.Input.lastId_ = 0;
|
|
97
104
|
|
|
98
105
|
|
|
99
106
|
/**
|
|
100
107
|
* Creates and contains the MDL elements of a select input.
|
|
101
108
|
*/
|
|
102
|
-
class
|
|
109
|
+
shakaDemo.SelectInput = class extends shakaDemo.Input {
|
|
103
110
|
/**
|
|
104
|
-
* @param {!
|
|
111
|
+
* @param {!shakaDemo.InputContainer} parentContainer
|
|
105
112
|
* @param {string} name
|
|
106
113
|
* @param {function(!Element)} onChange
|
|
107
114
|
* @param {!Object.<string, string>} values
|
|
@@ -121,15 +128,15 @@ class ShakaDemoSelectInput extends ShakaDemoInput {
|
|
|
121
128
|
this.input_.appendChild(option);
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
|
-
}
|
|
131
|
+
};
|
|
125
132
|
|
|
126
133
|
|
|
127
134
|
/**
|
|
128
135
|
* Creates and contains the MDL elements of a bool input.
|
|
129
136
|
*/
|
|
130
|
-
class
|
|
137
|
+
shakaDemo.BoolInput = class extends shakaDemo.Input {
|
|
131
138
|
/**
|
|
132
|
-
* @param {!
|
|
139
|
+
* @param {!shakaDemo.InputContainer} parentContainer
|
|
133
140
|
* @param {string} name
|
|
134
141
|
* @param {function(!Element)} onChange
|
|
135
142
|
*/
|
|
@@ -143,15 +150,15 @@ class ShakaDemoBoolInput extends ShakaDemoInput {
|
|
|
143
150
|
this.input_.classList.add('mdl-switch__input');
|
|
144
151
|
this.extra_.classList.add('mdl-switch__label');
|
|
145
152
|
}
|
|
146
|
-
}
|
|
153
|
+
};
|
|
147
154
|
|
|
148
155
|
|
|
149
156
|
/**
|
|
150
157
|
* Creates and contains the MDL elements of a text input.
|
|
151
158
|
*/
|
|
152
|
-
class
|
|
159
|
+
shakaDemo.TextInput = class extends shakaDemo.Input {
|
|
153
160
|
/**
|
|
154
|
-
* @param {!
|
|
161
|
+
* @param {!shakaDemo.InputContainer} parentContainer
|
|
155
162
|
* @param {string} name
|
|
156
163
|
* @param {function(!Element)} onChange
|
|
157
164
|
*/
|
|
@@ -164,15 +171,15 @@ class ShakaDemoTextInput extends ShakaDemoInput {
|
|
|
164
171
|
this.extra_.classList.add('mdl-textfield__label');
|
|
165
172
|
this.extra_.setAttribute('for', this.input_.id);
|
|
166
173
|
}
|
|
167
|
-
}
|
|
174
|
+
};
|
|
168
175
|
|
|
169
176
|
|
|
170
177
|
/**
|
|
171
178
|
* Creates and contains the MDL elements of a datalist input.
|
|
172
179
|
*/
|
|
173
|
-
class
|
|
180
|
+
shakaDemo.DatalistInput = class extends shakaDemo.TextInput {
|
|
174
181
|
/**
|
|
175
|
-
* @param {!
|
|
182
|
+
* @param {!shakaDemo.InputContainer} parentContainer
|
|
176
183
|
* @param {string} name
|
|
177
184
|
* @param {function(!Element)} onChange
|
|
178
185
|
* @param {!Array.<string>} values
|
|
@@ -193,15 +200,15 @@ class ShakaDemoDatalistInput extends ShakaDemoTextInput {
|
|
|
193
200
|
awesomplete.evaluate();
|
|
194
201
|
});
|
|
195
202
|
}
|
|
196
|
-
}
|
|
203
|
+
};
|
|
197
204
|
|
|
198
205
|
|
|
199
206
|
/**
|
|
200
207
|
* Creates and contains the MDL elements of a number input.
|
|
201
208
|
*/
|
|
202
|
-
class
|
|
209
|
+
shakaDemo.NumberInput = class extends shakaDemo.TextInput {
|
|
203
210
|
/**
|
|
204
|
-
* @param {!
|
|
211
|
+
* @param {!shakaDemo.InputContainer} parentContainer
|
|
205
212
|
* @param {string} name
|
|
206
213
|
* @param {function(!Element)} onChange
|
|
207
214
|
* @param {boolean} canBeDecimal
|
|
@@ -235,4 +242,4 @@ class ShakaDemoNumberInput extends ShakaDemoTextInput {
|
|
|
235
242
|
this.input_.pattern += '?';
|
|
236
243
|
}
|
|
237
244
|
}
|
|
238
|
-
}
|
|
245
|
+
};
|