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/.csslintrc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "stylelint-config-standard",
|
|
3
|
+
"rules": {
|
|
4
|
+
"font-family-no-missing-generic-family-keyword": null,
|
|
5
|
+
"declaration-block-single-line-max-declarations": null,
|
|
6
|
+
"max-line-length": [ 80, {
|
|
7
|
+
ignorePattern: "/^@import\\s+/",
|
|
8
|
+
}],
|
|
9
|
+
"selector-list-comma-newline-after": "never-multi-line",
|
|
10
|
+
"selector-pseudo-element-colon-notation": "single",
|
|
11
|
+
"unit-whitelist": ["em", "%", "px", "s", "deg", "vmin", "ms", "vh"]
|
|
12
|
+
}
|
|
13
|
+
}
|
package/AUTHORS
CHANGED
|
@@ -32,7 +32,9 @@ Jonas Birmé <jonas.birme@eyevinn.se>
|
|
|
32
32
|
Jozef Chúťka <jozefchutka@gmail.com>
|
|
33
33
|
JW Player <*@jwplayer.com>
|
|
34
34
|
Lucas Gabriel Sánchez <unkiwii@gmail.com>
|
|
35
|
+
Matthias Van Parijs <matvp91@gmail.com>
|
|
35
36
|
Mattias Wadman <mattias.wadman@gmail.com>
|
|
37
|
+
Mohamed Rashid <ge_rashid@hotmail.co.uk>
|
|
36
38
|
Morten Hansen <mimo@mimo-design.com>
|
|
37
39
|
Nick Desaulniers <nick@mozilla.com>
|
|
38
40
|
Oskar Arvidsson <oskar@irock.se>
|
|
@@ -50,3 +52,4 @@ Tomas Tichy <mr.tichyt@gmail.com>
|
|
|
50
52
|
Toshihiro Suzuki <t.suzuki326@gmail.com>
|
|
51
53
|
uStudio Inc. <*@ustudio.com>
|
|
52
54
|
Verizon Digital Media Services <*@verizondigitalmedia.com>
|
|
55
|
+
Adrián Gómez Llorente <adgllorente@gmail.com>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,159 @@
|
|
|
1
|
+
## 2.5.5 (2019-08-23)
|
|
2
|
+
|
|
3
|
+
New Features:
|
|
4
|
+
- Conditionally remove FairPlay formatting
|
|
5
|
+
- https://github.com/google/shaka-player/issues/1951
|
|
6
|
+
- Add sessionId field to network request
|
|
7
|
+
- Make it easier to add custom overflow menu items
|
|
8
|
+
- https://github.com/google/shaka-player/issues/2091
|
|
9
|
+
- Add clearBufferOnQualityChange field to UI config
|
|
10
|
+
- https://github.com/google/shaka-player/issues/1733
|
|
11
|
+
- Allow filtering out failed HLS text tracks
|
|
12
|
+
- https://github.com/google/shaka-player/issues/2065
|
|
13
|
+
- Parse Accessibility tag into text "kind"
|
|
14
|
+
- https://github.com/google/shaka-player/issues/2060
|
|
15
|
+
- Re-add MediaSession API
|
|
16
|
+
- https://github.com/google/shaka-player/issues/1934
|
|
17
|
+
- Skip WebM streams in HLS instead of throwing
|
|
18
|
+
- https://github.com/google/shaka-player/issues/2108
|
|
19
|
+
- Convert `<mspr:pro>` elements to `pssh` init data
|
|
20
|
+
- https://github.com/google/shaka-player/pull/2106
|
|
21
|
+
- https://github.com/google/shaka-player/issues/2058
|
|
22
|
+
|
|
23
|
+
Bugfixes:
|
|
24
|
+
- Fix duplicate resolution entries in UI menu
|
|
25
|
+
- https://github.com/google/shaka-player/issues/2085
|
|
26
|
+
- Fix missing tracks, race on time during startup
|
|
27
|
+
- https://github.com/google/shaka-player/issues/2045
|
|
28
|
+
- Fix spinner position on IE11
|
|
29
|
+
- https://github.com/google/shaka-player/issues/2084
|
|
30
|
+
- Fix seek bar coloring when nothing buffered
|
|
31
|
+
- Fix scroll behavior on page load
|
|
32
|
+
- https://github.com/google/shaka-player/issues/2063
|
|
33
|
+
- Don't create a UI if the app already has one
|
|
34
|
+
- https://github.com/google/shaka-player/issues/2073
|
|
35
|
+
- Fix text display styling when fullscreen
|
|
36
|
+
- https://github.com/google/shaka-player/issues/2051
|
|
37
|
+
- Don't enter fullscreen on double click on bottom bar
|
|
38
|
+
- https://github.com/google/shaka-player/issues/2053
|
|
39
|
+
- Avoid errors when video ends
|
|
40
|
+
- https://github.com/google/shaka-player/issues/2050
|
|
41
|
+
- Fix fullscreen behavior on double click and rotate
|
|
42
|
+
- https://github.com/google/shaka-player/issues/2043
|
|
43
|
+
- Fix bug when clicking PIP button while casting
|
|
44
|
+
- https://github.com/google/shaka-player/issues/2044
|
|
45
|
+
- Fix CEA captions with multi-Period content
|
|
46
|
+
- https://github.com/google/shaka-player/issues/2075
|
|
47
|
+
- https://github.com/google/shaka-player/issues/2094
|
|
48
|
+
|
|
49
|
+
Demo App:
|
|
50
|
+
- Added more HLS demo assets
|
|
51
|
+
- https://github.com/google/shaka-player/issues/2035
|
|
52
|
+
- Exit PIP on unload in the demo
|
|
53
|
+
- https://github.com/google/shaka-player/issues/2055
|
|
54
|
+
- Re-added hidden 'noinput' param to demo
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## 2.5.4 (2019-07-19)
|
|
58
|
+
|
|
59
|
+
Bugfixes:
|
|
60
|
+
- Default to transparent SMPTE-TT subtitle background
|
|
61
|
+
- https://github.com/google/shaka-player/pull/2033
|
|
62
|
+
- Fix seek bar on iOS
|
|
63
|
+
- https://github.com/google/shaka-player/issues/1918
|
|
64
|
+
- https://github.com/google/shaka-player/pull/2036
|
|
65
|
+
- Allow whitespace in TTML subtitles
|
|
66
|
+
- https://github.com/google/shaka-player/issues/2028
|
|
67
|
+
- https://github.com/google/shaka-player/pull/2030
|
|
68
|
+
- Fix play button positioning on IE 11
|
|
69
|
+
- https://github.com/google/shaka-player/issues/2026
|
|
70
|
+
- Match UI style with Chrome's native controls
|
|
71
|
+
- Stop constant spurious time updates in UI
|
|
72
|
+
- Fix volume slider jumping around while casting
|
|
73
|
+
- https://github.com/google/shaka-player/issues/1913
|
|
74
|
+
- Fix missing seek bar in short VOD clips
|
|
75
|
+
- https://github.com/google/shaka-player/issues/2018
|
|
76
|
+
- Fix demo app in Firefox private mode
|
|
77
|
+
- https://github.com/google/shaka-player/issues/1926
|
|
78
|
+
- Ignore case in MIME type checks
|
|
79
|
+
- https://github.com/google/shaka-player/issues/1991
|
|
80
|
+
- Fix problems with casting
|
|
81
|
+
- https://github.com/google/shaka-player/issues/1948
|
|
82
|
+
|
|
83
|
+
New Features:
|
|
84
|
+
- Add command-line arg to change the test timeout.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## 2.5.3 (2019-07-03)
|
|
88
|
+
|
|
89
|
+
Bugfixes:
|
|
90
|
+
- Fix DASH bug when ignoring minBufferTime
|
|
91
|
+
- https://github.com/google/shaka-player/issues/2015
|
|
92
|
+
- Avoid changing variant when switching text lang
|
|
93
|
+
- https://github.com/google/shaka-player/issues/2010
|
|
94
|
+
- Work around platform bug when seeking to end
|
|
95
|
+
- https://github.com/google/shaka-player/issues/1967
|
|
96
|
+
- Allow apps to extend shaka.ui.Element
|
|
97
|
+
- https://github.com/google/shaka-player/issues/2011
|
|
98
|
+
- Fix bug when adding text streams while not streaming text
|
|
99
|
+
- https://github.com/google/shaka-player/issues/1938
|
|
100
|
+
- Fix edge case when switching text in multi-Period content
|
|
101
|
+
- https://github.com/google/shaka-player/issues/1774
|
|
102
|
+
- Fix playback rate bug on IE11
|
|
103
|
+
- Make fast forwarding work when video is paused
|
|
104
|
+
- https://github.com/google/shaka-player/issues/1801
|
|
105
|
+
- Fix stack overflow in StringUtils on some platforms
|
|
106
|
+
- https://github.com/google/shaka-player/issues/1985
|
|
107
|
+
- https://github.com/google/shaka-player/issues/1994
|
|
108
|
+
- Fix reading customData from standard Cast LOAD message
|
|
109
|
+
- https://github.com/google/shaka-player/issues/1989
|
|
110
|
+
|
|
111
|
+
Docs:
|
|
112
|
+
- Fix constant name in UI tutorials
|
|
113
|
+
- https://github.com/google/shaka-player/issues/2005
|
|
114
|
+
- Update build output name in docs
|
|
115
|
+
- https://github.com/google/shaka-player/issues/1929
|
|
116
|
+
|
|
117
|
+
New Features:
|
|
118
|
+
- Use trick play for fast forward when browser doesn't support high
|
|
119
|
+
playbackRate
|
|
120
|
+
- https://github.com/google/shaka-player/issues/1957
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
## 2.5.2 (2019-06-10)
|
|
124
|
+
|
|
125
|
+
Bugfixes:
|
|
126
|
+
- Avoid event listener leaks in the UI
|
|
127
|
+
- https://github.com/google/shaka-player/issues/1924
|
|
128
|
+
- Fix style errors in TextDisplayer
|
|
129
|
+
- https://github.com/google/shaka-player/issues/1852
|
|
130
|
+
- https://github.com/google/shaka-player/issues/1955
|
|
131
|
+
- Show spinner when buffering even if other controls are hidden
|
|
132
|
+
- https://github.com/google/shaka-player/issues/1921
|
|
133
|
+
- Don't recreate controls object on configure() calls
|
|
134
|
+
- https://github.com/google/shaka-player/issues/1948
|
|
135
|
+
- Fix UI compilation on Windows
|
|
136
|
+
- https://github.com/google/shaka-player/issues/1965
|
|
137
|
+
|
|
138
|
+
New Features:
|
|
139
|
+
- Add originalUri as a property on shaka.extern.Response
|
|
140
|
+
- https://github.com/google/shaka-player/issues/1971
|
|
141
|
+
- https://github.com/google/shaka-player/pull/1972
|
|
142
|
+
|
|
143
|
+
Demo App:
|
|
144
|
+
- Fix close button styling in compiled mode
|
|
145
|
+
- Fix config settings applied before playback begins
|
|
146
|
+
- https://github.com/google/shaka-player/issues/1976
|
|
147
|
+
- Change the style of the download/delete button
|
|
148
|
+
- Fix demo error display for large errors
|
|
149
|
+
- Improve cvox error check
|
|
150
|
+
- Switch to using tippy.js for tooltips
|
|
151
|
+
|
|
152
|
+
Docs:
|
|
153
|
+
- Add a public roadmap document
|
|
154
|
+
- https://github.com/google/shaka-player/blob/master/roadmap.md
|
|
155
|
+
|
|
156
|
+
|
|
1
157
|
## 2.5.1 (2019-05-20)
|
|
2
158
|
|
|
3
159
|
New Features:
|
package/CONTRIBUTORS
CHANGED
|
@@ -51,9 +51,11 @@ Jozef Chúťka <jozefchutka@gmail.com>
|
|
|
51
51
|
Leandro Ribeiro Moreira <leandro.ribeiro.moreira@gmail.com>
|
|
52
52
|
Lucas Gabriel Sánchez <unkiwii@gmail.com>
|
|
53
53
|
Matias Russitto <russitto@gmail.com>
|
|
54
|
+
Matthias Van Parijs <matvp91@gmail.com>
|
|
54
55
|
Mattias Wadman <mattias.wadman@gmail.com>
|
|
55
56
|
Michelle Zhuo <michellezhuo@google.com>
|
|
56
57
|
Miloš Rašić <milos.rasic@gmail.com>
|
|
58
|
+
Mohamed Rashid <ge_rashid@hotmail.co.uk>
|
|
57
59
|
Morten Hansen <mimo@mimo-design.com>
|
|
58
60
|
Natalie Harris <natalieharris@google.com>
|
|
59
61
|
Nick Desaulniers <nick@mozilla.com>
|
|
@@ -82,3 +84,4 @@ Toshihiro Suzuki <t.suzuki326@gmail.com>
|
|
|
82
84
|
Vasanth Polipelli <vasanthap@google.com>
|
|
83
85
|
Vignesh Venkatasubramanian <vigneshv@google.com>
|
|
84
86
|
Yohann Connell <robinconnell@google.com>
|
|
87
|
+
Adrián Gómez Llorente <adgllorente@gmail.com>
|
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ video and audio using modern browser technologies. We try to keep the library
|
|
|
14
14
|
light, simple, and free from third-party dependencies. Everything you need to
|
|
15
15
|
build and deploy is in the sources.
|
|
16
16
|
|
|
17
|
+
For details on what's coming next, see our [development roadmap](roadmap.md).
|
|
18
|
+
|
|
17
19
|
[DASH]: http://dashif.org/
|
|
18
20
|
[HLS]: https://developer.apple.com/streaming/
|
|
19
21
|
[MediaSource Extensions]: https://www.w3.org/TR/media-source/
|
|
@@ -164,6 +166,7 @@ attributes.
|
|
|
164
166
|
|
|
165
167
|
## Important Links ##
|
|
166
168
|
|
|
169
|
+
* [development roadmap](roadmap.md)
|
|
167
170
|
* [hosted demo](http://shaka-player-demo.appspot.com) (sources in `demo/`)
|
|
168
171
|
* [hosted builds on cdnjs](https://cdnjs.com/libraries/shaka-player)
|
|
169
172
|
* [hosted builds on Google Hosted Libraries](https://developers.google.com/speed/libraries/#shaka-player)
|
package/build/README.md
CHANGED
|
@@ -32,10 +32,10 @@ java -jar /path/to/shaka/third_party/closure/compiler.jar --language_in ...
|
|
|
32
32
|
|
|
33
33
|
`build.py` is used to compile the library and can also be used to produce
|
|
34
34
|
customized builds that contain only the features that your app requires.
|
|
35
|
-
`build.py` accepts an optional argument `--name` which will set the name of
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
`build.py` accepts an optional argument `--name` which will set the name of the
|
|
36
|
+
build, defaulting to `ui`. All other arguments are treated as commands
|
|
37
|
+
describing what to include in the build. If nothing is given, it will use
|
|
38
|
+
`+@complete`.
|
|
39
39
|
|
|
40
40
|
A command is either an addition or a subtraction. An addition is prefixed with
|
|
41
41
|
a `+`; a subtraction with a `-`. An addition will add the JavaScript file (or
|
|
@@ -108,7 +108,7 @@ used internally to determine dependencies and to determine the size of the
|
|
|
108
108
|
compiled library.
|
|
109
109
|
|
|
110
110
|
Before running the script, you have to compile it first. Then you need to pass
|
|
111
|
-
either the name of the build (e.g. `
|
|
111
|
+
either the name of the build (e.g. `ui`) or the path to the `.map` file.
|
|
112
112
|
You will also need to pass some arguments to determine the output you want.
|
|
113
113
|
You must pass exactly one of the following:
|
|
114
114
|
|
package/build/apps.py
CHANGED
|
@@ -53,6 +53,8 @@ def compile_demo(force, is_debug):
|
|
|
53
53
|
files.remove(os.path.join(base, 'demo', 'load.js'))
|
|
54
54
|
# Remove service_worker.js as well. This executes in a different context.
|
|
55
55
|
files.remove(os.path.join(base, 'demo', 'service_worker.js'))
|
|
56
|
+
# Don't compile in the uncompiled require file.
|
|
57
|
+
files.remove(os.path.join(base, 'demo', 'demo_uncompiled.js'))
|
|
56
58
|
# Add lib/debug/asserts.js, which is required for goog.assert.
|
|
57
59
|
# TODO: This file should be inside third_party/closure instead.
|
|
58
60
|
files.add(os.path.join(base, 'lib', 'debug', 'asserts.js'))
|
|
@@ -107,7 +109,6 @@ def compile_receiver(force, is_debug):
|
|
|
107
109
|
files = set(get('demo', 'common') +
|
|
108
110
|
get('demo', 'cast_receiver') +
|
|
109
111
|
get('externs') + get('ui', 'externs') +
|
|
110
|
-
get('lib', 'debug') +
|
|
111
112
|
get('third_party', 'closure'))
|
|
112
113
|
|
|
113
114
|
# Add in the generated externs, so that the receiver compilation knows the
|
|
@@ -116,6 +117,7 @@ def compile_receiver(force, is_debug):
|
|
|
116
117
|
else 'shaka-player.ui.externs.js')
|
|
117
118
|
|
|
118
119
|
files.add(os.path.join(base, 'dist', externs))
|
|
120
|
+
files.add(os.path.join(base, 'lib', 'debug', 'asserts.js'))
|
|
119
121
|
|
|
120
122
|
name = 'receiver.compiled' + ('.debug' if is_debug else '')
|
|
121
123
|
|
package/build/build.py
CHANGED
|
@@ -169,12 +169,14 @@ class Build(object):
|
|
|
169
169
|
core_files = core_build.include
|
|
170
170
|
if self.exclude & core_files:
|
|
171
171
|
logging.error('Cannot exclude files from core')
|
|
172
|
+
return False
|
|
172
173
|
self.include |= core_files
|
|
174
|
+
return True
|
|
173
175
|
|
|
174
176
|
def has_ui(self):
|
|
175
177
|
"""Returns True if the UI library is in the build."""
|
|
176
178
|
for path in self.include:
|
|
177
|
-
if '
|
|
179
|
+
if 'ui' in path.split(os.path.sep):
|
|
178
180
|
return True
|
|
179
181
|
return False
|
|
180
182
|
|
|
@@ -264,7 +266,8 @@ class Build(object):
|
|
|
264
266
|
True on success; False on failure.
|
|
265
267
|
"""
|
|
266
268
|
self.add_closure()
|
|
267
|
-
self.add_core()
|
|
269
|
+
if not self.add_core():
|
|
270
|
+
return False
|
|
268
271
|
if self.has_ui():
|
|
269
272
|
self.generate_localizations(locales, force)
|
|
270
273
|
|
package/build/check.py
CHANGED
|
@@ -54,6 +54,22 @@ def check_js_lint(args):
|
|
|
54
54
|
return linter.lint(fix=args.fix, force=args.force)
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
def check_css_lint(args):
|
|
58
|
+
"""Runs the CSS linter."""
|
|
59
|
+
logging.info('Linting CSS...')
|
|
60
|
+
|
|
61
|
+
match = re.compile(r'.*\.(less|css)$')
|
|
62
|
+
base = shakaBuildHelpers.get_source_base()
|
|
63
|
+
def get(*path_components):
|
|
64
|
+
return shakaBuildHelpers.get_all_files(
|
|
65
|
+
os.path.join(base, *path_components), match)
|
|
66
|
+
files = (get('ui') + get('demo'));
|
|
67
|
+
config_path = os.path.join(base, '.csslintrc')
|
|
68
|
+
|
|
69
|
+
linter = compiler.CssLinter(files, config_path)
|
|
70
|
+
return linter.lint(fix=args.fix, force=args.force)
|
|
71
|
+
|
|
72
|
+
|
|
57
73
|
def check_html_lint(args):
|
|
58
74
|
"""Runs the HTML linter."""
|
|
59
75
|
logging.info('Linting HTML...')
|
|
@@ -169,6 +185,7 @@ def main(args):
|
|
|
169
185
|
steps = [
|
|
170
186
|
check_js_lint,
|
|
171
187
|
check_html_lint,
|
|
188
|
+
check_css_lint,
|
|
172
189
|
check_complete,
|
|
173
190
|
check_tests,
|
|
174
191
|
]
|
package/build/compiler.py
CHANGED
|
@@ -21,6 +21,7 @@ import os
|
|
|
21
21
|
import re
|
|
22
22
|
import shutil
|
|
23
23
|
import subprocess
|
|
24
|
+
import sys
|
|
24
25
|
|
|
25
26
|
import generateLocalizations
|
|
26
27
|
import shakaBuildHelpers
|
|
@@ -55,6 +56,14 @@ def _must_build(output, source_files):
|
|
|
55
56
|
# Some input files have changed, so we should build again.
|
|
56
57
|
return True
|
|
57
58
|
|
|
59
|
+
# Look at all the Python modules that are loaded. If any of them have
|
|
60
|
+
# changed, it may affect the build.
|
|
61
|
+
this_path = os.path.dirname(os.path.abspath(__file__))
|
|
62
|
+
for module in sys.modules.values():
|
|
63
|
+
path = getattr(module, '__file__', None)
|
|
64
|
+
if path and os.path.exists(path) and os.path.getmtime(path) > build_time:
|
|
65
|
+
return True
|
|
66
|
+
|
|
58
67
|
logging.warning('No changes detected, skipping. Use --force to override.')
|
|
59
68
|
return False
|
|
60
69
|
|
|
@@ -297,6 +306,46 @@ class Linter(object):
|
|
|
297
306
|
return True
|
|
298
307
|
|
|
299
308
|
|
|
309
|
+
class CssLinter(object):
|
|
310
|
+
def __init__(self, source_files, config_path):
|
|
311
|
+
self.source_files = _canonicalize_source_files(source_files)
|
|
312
|
+
self.config_path = config_path
|
|
313
|
+
self.output = _get_source_path('dist/.csslintstamp')
|
|
314
|
+
|
|
315
|
+
def lint(self, fix=False, force=False):
|
|
316
|
+
"""Run CSS linter checks on the files in |self.source_files|.
|
|
317
|
+
|
|
318
|
+
Args:
|
|
319
|
+
fix: If True, ask the linter to fix what errors it can automatically.
|
|
320
|
+
force: Run linter checks even if the inputs have not changed.
|
|
321
|
+
|
|
322
|
+
Returns:
|
|
323
|
+
True on success; False on failure.
|
|
324
|
+
"""
|
|
325
|
+
deps = self.source_files + [self.config_path]
|
|
326
|
+
if not force and not _must_build(self.output, deps):
|
|
327
|
+
return True
|
|
328
|
+
|
|
329
|
+
stylelint = shakaBuildHelpers.get_node_binary('stylelint')
|
|
330
|
+
cmd_line = stylelint + ['--config', self.config_path] + self.source_files
|
|
331
|
+
# Disables globbing, since that messes up our nightly tests, and we don't
|
|
332
|
+
# use it anyway.
|
|
333
|
+
# This is currently a flag added in a fork we maintain, but there is a pull
|
|
334
|
+
# request in progress for this.
|
|
335
|
+
# See: https://github.com/stylelint/stylelint/issues/4193
|
|
336
|
+
cmd_line += ['--disable-globbing'];
|
|
337
|
+
|
|
338
|
+
if fix:
|
|
339
|
+
cmd_line += ['--fix']
|
|
340
|
+
|
|
341
|
+
if shakaBuildHelpers.execute_get_code(cmd_line) != 0:
|
|
342
|
+
return False
|
|
343
|
+
|
|
344
|
+
# Update the timestamp of the file that tracks when we last updated.
|
|
345
|
+
_update_timestamp(self.output)
|
|
346
|
+
return True
|
|
347
|
+
|
|
348
|
+
|
|
300
349
|
class HtmlLinter(object):
|
|
301
350
|
def __init__(self, source_files, config_path):
|
|
302
351
|
self.source_files = _canonicalize_source_files(source_files)
|
|
@@ -107,6 +107,7 @@ requirement: {
|
|
|
107
107
|
error_message: 'Using "console" is not allowed; '
|
|
108
108
|
'use shaka.log instead'
|
|
109
109
|
whitelist_regexp: 'demo/'
|
|
110
|
+
whitelist_regexp: 'lib/debug/log.js'
|
|
110
111
|
whitelist_regexp: 'third_party/closure/'
|
|
111
112
|
whitelist_regexp: 'test/test/boot.js'
|
|
112
113
|
}
|
package/build/docs.py
CHANGED
|
@@ -50,11 +50,5 @@ def main(args):
|
|
|
50
50
|
return 0
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
# TODO: Remove this alias. It is here for backward compatibility until private
|
|
54
|
-
# scripts depending on it can be updated.
|
|
55
|
-
def build_docs(args):
|
|
56
|
-
return main(args)
|
|
57
|
-
|
|
58
|
-
|
|
59
53
|
if __name__ == '__main__':
|
|
60
54
|
shakaBuildHelpers.run_main(main)
|
package/build/generateExterns.js
CHANGED
|
@@ -48,14 +48,6 @@ const fs = require('fs');
|
|
|
48
48
|
// The annotations we will consider "exporting" a symbol.
|
|
49
49
|
const EXPORT_REGEX = /@(?:export|exportInterface|expose)\b/;
|
|
50
50
|
|
|
51
|
-
// Install ES6/ES7 polyfills for old versions of nodejs.
|
|
52
|
-
if (!global.Set) {
|
|
53
|
-
require('es6-shim');
|
|
54
|
-
}
|
|
55
|
-
if (!Array.prototype.includes) {
|
|
56
|
-
require('array-includes').shim();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
51
|
|
|
60
52
|
/**
|
|
61
53
|
* Topological sort of general objects using a DFS approach.
|
|
@@ -370,9 +362,18 @@ function createExternFromExportNode(names, node) {
|
|
|
370
362
|
|
|
371
363
|
// Find this.foo = bar in the constructor, and potentially generate externs
|
|
372
364
|
// for that, too.
|
|
373
|
-
if (node.expression.type == 'AssignmentExpression'
|
|
374
|
-
|
|
375
|
-
|
|
365
|
+
if (node.expression.type == 'AssignmentExpression') {
|
|
366
|
+
const rightSide = node.expression.right;
|
|
367
|
+
|
|
368
|
+
if (rightSide.type == 'FunctionExpression' &&
|
|
369
|
+
comment.includes('@constructor')) {
|
|
370
|
+
externString += createExternsFromConstructor(name, rightSide);
|
|
371
|
+
} else if (rightSide.type == 'ClassExpression') {
|
|
372
|
+
const ctor = getClassConstructor(node.expression.right);
|
|
373
|
+
if (ctor) {
|
|
374
|
+
externString += createExternsFromConstructor(name, ctor);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
376
377
|
}
|
|
377
378
|
return externString;
|
|
378
379
|
}
|
|
@@ -393,18 +394,65 @@ function createExternMethod(node) {
|
|
|
393
394
|
// value: FunctionExpression,
|
|
394
395
|
// }
|
|
395
396
|
let comment = getLeadingBlockComment(node);
|
|
397
|
+
const id = getIdentifierString(node.key);
|
|
398
|
+
if (!comment) {
|
|
399
|
+
if (id == 'constructor') {
|
|
400
|
+
// ES6 constructors don't necessarily need comments; a comment along the
|
|
401
|
+
// lines of "Creates a Foo object." doesn't really add anything.
|
|
402
|
+
comment = '';
|
|
403
|
+
} else {
|
|
404
|
+
throw new Error('No leading block comment for: ' + id);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
396
407
|
comment = removeExportAnnotationsFromComment(comment);
|
|
397
408
|
|
|
398
409
|
const params = getFunctionParameters(node.value);
|
|
399
|
-
const id = getIdentifierString(node.key);
|
|
400
410
|
|
|
401
|
-
let methodString = ' ' + comment + '\n ';
|
|
402
|
-
if (node.static)
|
|
411
|
+
let methodString = (comment ? ' ' + comment + '\n' : '') + ' ';
|
|
412
|
+
if (node.static) {
|
|
413
|
+
methodString += 'static ';
|
|
414
|
+
}
|
|
403
415
|
methodString += id + '(' + params + ') {}';
|
|
404
416
|
return methodString;
|
|
405
417
|
}
|
|
406
418
|
|
|
407
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Find the constructor of an ES6 class, if it exists.
|
|
422
|
+
*
|
|
423
|
+
* @param {ASTNode} className
|
|
424
|
+
* @return {ASTNode}
|
|
425
|
+
*/
|
|
426
|
+
function getClassConstructor(classNode) {
|
|
427
|
+
// Example class node: {
|
|
428
|
+
// type: 'ClassExpression',
|
|
429
|
+
// body: {
|
|
430
|
+
// type: 'ClassBody',
|
|
431
|
+
// body: [ MethodDefinition, ... ],
|
|
432
|
+
// }
|
|
433
|
+
// }
|
|
434
|
+
//
|
|
435
|
+
// Example method node: {
|
|
436
|
+
// type: 'MethodDefinition',
|
|
437
|
+
// key: { type: 'Identifier', name: 'constructor' },
|
|
438
|
+
// value: {
|
|
439
|
+
// type: 'FunctionExpression',
|
|
440
|
+
// params: [ [Identifier], [Identifier], [Identifier] ],
|
|
441
|
+
// body: { type: 'BlockStatement', body: [Array] },
|
|
442
|
+
// }
|
|
443
|
+
|
|
444
|
+
console.assert(classNode.type == 'ClassExpression');
|
|
445
|
+
|
|
446
|
+
for (const member of classNode.body.body) {
|
|
447
|
+
if (member.type == 'MethodDefinition' && member.key.name == 'constructor') {
|
|
448
|
+
return member.value;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
|
|
408
456
|
/**
|
|
409
457
|
* @param {string} name The name of the thing we are assigning.
|
|
410
458
|
* @param {ASTNode} node An assignment node from the abstract syntax tree.
|
|
@@ -508,19 +556,23 @@ function createExternsFromConstructor(className, constructorNode) {
|
|
|
508
556
|
// /** @exportInterface @type {number} */
|
|
509
557
|
// FooLike.prototype.bar;
|
|
510
558
|
//
|
|
511
|
-
// /** @
|
|
512
|
-
// Foo
|
|
513
|
-
//
|
|
514
|
-
//
|
|
559
|
+
// /** @export @implements {FooLike} */
|
|
560
|
+
// class Foo {
|
|
561
|
+
// constructor() {
|
|
562
|
+
// /** @override @exportInterface */
|
|
563
|
+
// this.bar = 10;
|
|
564
|
+
// }
|
|
515
565
|
// };
|
|
516
566
|
//
|
|
517
567
|
// Example externs:
|
|
518
568
|
//
|
|
519
569
|
// /**
|
|
520
570
|
// * Generated by createExternFromExportNode:
|
|
521
|
-
// * @
|
|
571
|
+
// * @implements {FooLike}
|
|
522
572
|
// */
|
|
523
|
-
// Foo
|
|
573
|
+
// class Foo {
|
|
574
|
+
// constructor() {}
|
|
575
|
+
// }
|
|
524
576
|
//
|
|
525
577
|
// /**
|
|
526
578
|
// * Generated by createExternsFromConstructor:
|
|
@@ -56,11 +56,11 @@ sudo apt -y update
|
|
|
56
56
|
sudo apt -y install git python2.7 default-jre-headless apache2
|
|
57
57
|
|
|
58
58
|
# NodeJS in Ubuntu and Debian is often out of date, so we may need to grab a
|
|
59
|
-
# newer version. We require
|
|
59
|
+
# newer version. We require v8+.
|
|
60
60
|
|
|
61
|
-
if node --version 2>/dev/null | grep -q 'v\([
|
|
61
|
+
if node --version 2>/dev/null | grep -q 'v\([89]\|1[0-9]\)'; then
|
|
62
62
|
echo "*****" 1>&2
|
|
63
|
-
echo "NodeJS
|
|
63
|
+
echo "NodeJS v8+ detected. No update needed." 1>&2
|
|
64
64
|
echo "*****" 1>&2
|
|
65
65
|
else
|
|
66
66
|
if node --version &>/dev/null; then
|
|
@@ -99,7 +99,7 @@ else
|
|
|
99
99
|
fi
|
|
100
100
|
else
|
|
101
101
|
echo "*****" 1>&2
|
|
102
|
-
echo "You will need to upgrade NodeJS yourself to
|
|
102
|
+
echo "You will need to upgrade NodeJS yourself to v8+." 1>&2
|
|
103
103
|
echo "*****" 1>&2
|
|
104
104
|
exit 1
|
|
105
105
|
fi
|
|
@@ -20,6 +20,8 @@ This uses two environment variables to help with debugging the scripts:
|
|
|
20
20
|
RAISE_INTERRUPT - Will raise keyboard interrupts rather than swallowing them.
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
|
+
from __future__ import print_function
|
|
24
|
+
|
|
23
25
|
import errno
|
|
24
26
|
import json
|
|
25
27
|
import logging
|
|
@@ -286,7 +288,7 @@ def update_node_modules():
|
|
|
286
288
|
# Check the version of npm.
|
|
287
289
|
version = execute_get_output([cmd, '-v']).decode('utf8')
|
|
288
290
|
|
|
289
|
-
if _parse_version(version) < _parse_version('
|
|
291
|
+
if _parse_version(version) < _parse_version('5.0.0'):
|
|
290
292
|
logging.error('npm version is too old, please upgrade. e.g.:')
|
|
291
293
|
logging.error(' npm install -g npm')
|
|
292
294
|
return False
|
|
@@ -295,12 +297,9 @@ def update_node_modules():
|
|
|
295
297
|
# Actually change directories instead of using npm --prefix.
|
|
296
298
|
# See npm/npm#17027 and google/shaka-player#776 for more details.
|
|
297
299
|
with InDir(base):
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
execute_get_output([cmd, 'install'])
|
|
302
|
-
else:
|
|
303
|
-
execute_get_output([cmd, 'update'])
|
|
300
|
+
# npm update seems to be the wrong thing in npm v5, so use install.
|
|
301
|
+
# See google/shaka-player#854 for more details.
|
|
302
|
+
execute_get_output([cmd, 'install'])
|
|
304
303
|
|
|
305
304
|
# Update the timestamp of the file that tracks when we last updated.
|
|
306
305
|
open(_node_modules_last_update_path(), 'w').close()
|
|
@@ -324,6 +323,6 @@ def run_main(main):
|
|
|
324
323
|
except KeyboardInterrupt:
|
|
325
324
|
if os.environ.get('RAISE_INTERRUPT'):
|
|
326
325
|
raise
|
|
327
|
-
print
|
|
326
|
+
print(file=sys.stderr) # Clear the current line that has ^C on it.
|
|
328
327
|
logging.error('Keyboard interrupt')
|
|
329
328
|
sys.exit(1)
|