shaka-player 4.0.2 → 4.0.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.
Files changed (162) hide show
  1. package/.github/workflows/build-and-test.yaml +67 -15
  2. package/.github/workflows/compute-incremental-coverage.py +251 -0
  3. package/.github/workflows/report-incremental-coverage.yaml +39 -0
  4. package/.github/workflows/selenium-lab-tests.yaml +44 -1
  5. package/AUTHORS +2 -0
  6. package/CHANGELOG.md +43 -0
  7. package/CONTRIBUTORS +4 -0
  8. package/README.md +20 -6
  9. package/demo/common/assets.js +1 -1
  10. package/demo/index.html +1 -3
  11. package/demo/main.js +3 -3
  12. package/dist/controls.css +1 -1
  13. package/dist/demo.compiled.debug.js +3 -3
  14. package/dist/demo.compiled.debug.map +2 -2
  15. package/dist/demo.compiled.js +3 -3
  16. package/dist/demo.compiled.map +2 -2
  17. package/dist/deps.js +3 -3
  18. package/dist/locales.js +29 -29
  19. package/dist/receiver.compiled.debug.js +1 -1
  20. package/dist/receiver.compiled.debug.map +1 -1
  21. package/dist/receiver.compiled.js +1 -1
  22. package/dist/receiver.compiled.map +1 -1
  23. package/dist/shaka-player.compiled.d.ts +12 -1
  24. package/dist/shaka-player.compiled.debug.d.ts +12 -1
  25. package/dist/shaka-player.compiled.debug.externs.js +52 -40
  26. package/dist/shaka-player.compiled.debug.js +269 -256
  27. package/dist/shaka-player.compiled.debug.map +4 -4
  28. package/dist/shaka-player.compiled.externs.js +52 -40
  29. package/dist/shaka-player.compiled.js +739 -730
  30. package/dist/shaka-player.compiled.map +4 -4
  31. package/dist/shaka-player.ui.d.ts +12 -1
  32. package/dist/shaka-player.ui.debug.d.ts +12 -1
  33. package/dist/shaka-player.ui.debug.externs.js +52 -40
  34. package/dist/shaka-player.ui.debug.js +296 -282
  35. package/dist/shaka-player.ui.debug.map +4 -4
  36. package/dist/shaka-player.ui.externs.js +52 -40
  37. package/dist/shaka-player.ui.js +885 -878
  38. package/dist/shaka-player.ui.map +4 -4
  39. package/docs/tutorials/ui.md +5 -5
  40. package/docs/tutorials/upgrade.md +1 -0
  41. package/docs/tutorials/welcome.md +6 -3
  42. package/externs/shaka/player.js +4 -2
  43. package/karma.conf.js +3 -11
  44. package/lib/ads/client_side_ad_manager.js +1 -1
  45. package/lib/dash/dash_parser.js +5 -0
  46. package/lib/hls/hls_parser.js +183 -70
  47. package/lib/media/drm_engine.js +1 -1
  48. package/lib/media/media_source_engine.js +57 -24
  49. package/lib/media/presentation_timeline.js +24 -1
  50. package/lib/media/segment_index.js +26 -1
  51. package/lib/media/segment_reference.js +10 -3
  52. package/lib/media/streaming_engine.js +4 -4
  53. package/lib/media/time_ranges_utils.js +46 -0
  54. package/lib/player.js +1 -6
  55. package/lib/polyfill/media_capabilities.js +9 -0
  56. package/lib/polyfill/videoplaybackquality.js +3 -1
  57. package/lib/text/cue.js +0 -5
  58. package/lib/text/simple_text_displayer.js +21 -9
  59. package/lib/text/ui_text_displayer.js +83 -19
  60. package/lib/util/buffer_utils.js +3 -0
  61. package/lib/util/object_utils.js +1 -0
  62. package/lib/util/platform.js +19 -1
  63. package/lib/util/stream_utils.js +24 -3
  64. package/lib/util/string_utils.js +102 -13
  65. package/maintained-branches.md +15 -0
  66. package/package.json +3 -5
  67. package/test/hls/hls_parser_unit.js +102 -8
  68. package/test/media/drm_engine_integration.js +24 -8
  69. package/test/media/media_source_engine_integration.js +24 -10
  70. package/test/media/media_source_engine_unit.js +53 -38
  71. package/test/media/streaming_engine_unit.js +28 -27
  72. package/test/test/util/fake_media_source_engine.js +10 -9
  73. package/test/text/simple_text_displayer_unit.js +27 -0
  74. package/test/text/ui_text_displayer_unit.js +65 -0
  75. package/test/util/string_utils_unit.js +46 -8
  76. package/ui/text_selection.js +2 -2
  77. package/app-engine/README.md +0 -9
  78. package/app-engine/demo-version-index/README.md +0 -14
  79. package/app-engine/demo-version-index/app.yaml +0 -28
  80. package/app-engine/demo-version-index/generate.py +0 -164
  81. package/app-engine/demo-version-index/main.py +0 -11
  82. package/app-engine/demo-version-index/requirements.txt +0 -5
  83. package/app-engine/demo-version-index/templates/index.html +0 -114
  84. package/app-engine/shaka-player-demo/README.md +0 -18
  85. package/app-engine/shaka-player-demo/app.yaml +0 -61
  86. package/app-engine/shaka-player-demo/main.py +0 -95
  87. package/app-engine/shaka-player-demo/posters/10yo.png +0 -0
  88. package/app-engine/shaka-player-demo/posters/10yo.xcf +0 -0
  89. package/app-engine/shaka-player-demo/posters/1yo.jpg +0 -0
  90. package/app-engine/shaka-player-demo/posters/2yo.png +0 -0
  91. package/app-engine/shaka-player-demo/posters/2yo.xcf +0 -0
  92. package/app-engine/shaka-player-demo/posters/3yo.png +0 -0
  93. package/app-engine/shaka-player-demo/posters/3yo.xcf +0 -0
  94. package/app-engine/shaka-player-demo/posters/4yo.png +0 -0
  95. package/app-engine/shaka-player-demo/posters/4yo.xcf +0 -0
  96. package/app-engine/shaka-player-demo/posters/5yo.png +0 -0
  97. package/app-engine/shaka-player-demo/posters/5yo.xcf +0 -0
  98. package/app-engine/shaka-player-demo/posters/6yo.png +0 -0
  99. package/app-engine/shaka-player-demo/posters/6yo.xcf +0 -0
  100. package/app-engine/shaka-player-demo/posters/7yo.png +0 -0
  101. package/app-engine/shaka-player-demo/posters/7yo.xcf +0 -0
  102. package/app-engine/shaka-player-demo/posters/8yo.png +0 -0
  103. package/app-engine/shaka-player-demo/posters/8yo.xcf +0 -0
  104. package/app-engine/shaka-player-demo/posters/9yo.png +0 -0
  105. package/app-engine/shaka-player-demo/posters/9yo.xcf +0 -0
  106. package/app-engine/shaka-player-demo/posters/audioOnly.gif +0 -0
  107. package/app-engine/shaka-player-demo/posters/audioRickRoll.gif +0 -0
  108. package/app-engine/shaka-player-demo/posters/colorbars.gif +0 -0
  109. package/app-engine/shaka-player-demo/posters/fireworks.jpg +0 -0
  110. package/app-engine/shaka-player-demo/posters/party-hat.png +0 -0
  111. package/app-engine/shaka-player-demo/posters/sources.txt +0 -46
  112. package/app-engine/shaka-player-demo/posters/standard.png +0 -0
  113. package/app-engine/shaka-player-demo/posters/trek.jpg +0 -0
  114. package/app-engine/shaka-player-demo/posters/valentines.png +0 -0
  115. package/app-engine/shaka-player-demo/posters/zombie.jpg +0 -0
  116. package/app-engine/shaka-player-demo/posters.py +0 -110
  117. package/app-engine/shaka-player-demo/requirements.txt +0 -5
  118. package/app-engine/shaka-player-demo/time.txt +0 -1
  119. package/build/README.md +0 -127
  120. package/build/__init__.py +0 -0
  121. package/build/all.py +0 -150
  122. package/build/apps.py +0 -186
  123. package/build/build.py +0 -392
  124. package/build/check.py +0 -354
  125. package/build/checkversion.py +0 -84
  126. package/build/compiler.py +0 -513
  127. package/build/conformance.textproto +0 -335
  128. package/build/docker/Dockerfile +0 -20
  129. package/build/docker/docker-compose.yml +0 -10
  130. package/build/docs.py +0 -54
  131. package/build/eslint-plugin-shaka-rules/arg-comment-spacing.js +0 -72
  132. package/build/eslint-plugin-shaka-rules/index.js +0 -24
  133. package/build/eslint-plugin-shaka-rules/package.json +0 -7
  134. package/build/eslint-plugin-shaka-rules/private.js +0 -109
  135. package/build/gendeps.py +0 -71
  136. package/build/generateExterns.js +0 -867
  137. package/build/generateLocalizations.py +0 -262
  138. package/build/generateTsDefs.py +0 -137
  139. package/build/install-linux-prereqs.sh +0 -136
  140. package/build/license-header +0 -5
  141. package/build/misspellings.txt +0 -39
  142. package/build/pixelsChanged.js +0 -35
  143. package/build/shaka-lab.yaml +0 -161
  144. package/build/shakaBuildHelpers.py +0 -356
  145. package/build/stats.py +0 -816
  146. package/build/subprocessWindowsPatch.py +0 -103
  147. package/build/test.py +0 -541
  148. package/build/types/ads +0 -8
  149. package/build/types/cast +0 -6
  150. package/build/types/cea +0 -13
  151. package/build/types/complete +0 -9
  152. package/build/types/core +0 -108
  153. package/build/types/dash +0 -8
  154. package/build/types/hls +0 -9
  155. package/build/types/manifests +0 -5
  156. package/build/types/networking +0 -6
  157. package/build/types/offline +0 -22
  158. package/build/types/polyfill +0 -18
  159. package/build/types/text +0 -11
  160. package/build/types/ui +0 -39
  161. package/build/updateScreenshots.py +0 -85
  162. package/build/wrapper.template.js +0 -52
@@ -1,103 +0,0 @@
1
- # Copyright 2021 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- """Monkeypatch subprocess on Windows to find .CMD scripts.
16
-
17
- Without this patch, subprocess fails to find .CMD scripts on Windows, even
18
- though these are executables and should be treated as such according to the
19
- PATHEXT environment variable.
20
-
21
- Many people "work around" this issue on Windows with subprocess's shell=True
22
- argument, but this comes with a risk of shell injection vulnerabilities.
23
-
24
- Another solution is to explicitly add ".CMD" to the end of some commands on
25
- Windows, but this breaks portability and requires "if windows" to be scattered
26
- around a codebase.
27
-
28
- This monkeypatch allows the caller of subprocess to stop worrying about Windows
29
- nuances and to go back to the security best practice of shell=False. Any .CMD
30
- script that would be found by the Windows shell will now be found by
31
- subprocess. And because we're using the standard Windows PATHEXT environment
32
- variable, this can be extended to other types of executable scripts, as well.
33
- """
34
-
35
- import os
36
- import subprocess
37
- import sys
38
-
39
-
40
- # NOTE: All of the higher-level methods eventually delegate to Popen, so we
41
- # only patch that one method.
42
- # run => Popen
43
- # call => Popen
44
- # check_call => call => Popen
45
- # check_output => run => Popen
46
-
47
- # These environment variables should almost certainly exist, but these are
48
- # defaults in case they are missing.
49
- DEFAULT_PATHEXT = '.COM;.EXE;.BAT;.CMD'
50
- DEFAULT_PATH = r'C:\WINDOWS\system32;C:\WINDOWS'
51
-
52
-
53
- def resolve(exe):
54
- """Resolve a command name into a full path to the executable."""
55
-
56
- if '/' in exe or '\\' in exe or ':' in exe:
57
- # This is a path, so don't modify it.
58
- return exe
59
-
60
- if '.' in exe:
61
- # This has an extension already. Don't search for an extension.
62
- exe_names = [exe]
63
- else:
64
- # This is a command name without an extension, so check for every extension
65
- # in PATHEXT.
66
- extensions = os.environ.get('PATHEXT', DEFAULT_PATHEXT).split(';')
67
- exe_names = [exe + ext for ext in extensions]
68
-
69
- exe_paths = os.environ.get('PATH', DEFAULT_PATH).split(';')
70
-
71
- for path in exe_paths:
72
- for name in exe_names:
73
- candidate = os.path.join(path, name)
74
- if os.access(candidate, os.X_OK): # If executable
75
- return candidate
76
-
77
- # Failed to resolve, so return the original name and let Popen fail with a
78
- # natural-looking error complaining that this command cannot be found.
79
- return exe
80
-
81
-
82
- real_Popen = subprocess.Popen
83
-
84
-
85
- def Popen(args, *more_args, **kwargs):
86
- """A patch to install over subprocess.Popen."""
87
-
88
- # If the first argument is a list, resolve the command name, which is the
89
- # first item in the list.
90
- if isinstance(args, list):
91
- args[0] = resolve(args[0])
92
-
93
- # Delegate to the real Popen implementation.
94
- return real_Popen(args, *more_args, **kwargs)
95
-
96
-
97
- # Only patch win32, but not cygwin. Cygwin works correctly already.
98
- if sys.platform == 'win32':
99
- # Patch over Popen.
100
- subprocess.Popen = Popen
101
- # Copy the docstring from the real Popen into the patch, so that
102
- # help(subprocess.Popen) is still relatively sane with this patch installed.
103
- Popen.__doc__ = real_Popen.__doc__
package/build/test.py DELETED
@@ -1,541 +0,0 @@
1
- #!/usr/bin/env python
2
- #
3
- # Copyright 2016 Google LLC
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
- """Runs unit and integrations tests on the library."""
18
-
19
- import argparse
20
- import json
21
- import logging
22
- import os
23
- import platform
24
- import re
25
-
26
- import build
27
- import gendeps
28
- import shakaBuildHelpers
29
-
30
-
31
- # Set a higher default for capture_timeout in grid mode. If the test gets
32
- # queued by the grid, this may prevent Karma from killing the session while
33
- # waiting.
34
- LOCAL_CAPTURE_TIMEOUT = 1 * 60 * 1000 # 1m in ms
35
- SELENIUM_CAPTURE_TIMEOUT = 10 * 60 * 1000 # 10m in ms
36
-
37
-
38
- class _HandleMixedListsAction(argparse.Action):
39
- '''Action to handle comma-separated and space-separated lists.
40
-
41
- When input can be given as a comma-separated list or a space-
42
- separated list, default actions and types don't work. For example
43
- if you had |'a,b,c' 'd'| you can get |['a,b,c', 'd']| or
44
- |[['a','b','c'], 'd']|.
45
-
46
- This action will expand the comma-separated lists and merge then with
47
- the space separated lists so you will get |['a', 'b', 'c', 'd']|.
48
- '''
49
-
50
- def __call__(self, parser, namespace, new_values, option_string=None):
51
- merged = getattr(namespace, self.dest) or []
52
- for value in new_values:
53
- merged += value.split(',')
54
- setattr(namespace, self.dest, merged)
55
-
56
-
57
- class _HandleKeyValuePairs(argparse.Action):
58
- '''Action to handle key-value pairs and convert to a dictionary.
59
-
60
- Input is a key-value pair separated by '='.
61
- These keys and values are stored in a dictionary which can accumulate
62
- multiple values from the command-line.
63
- '''
64
-
65
- def __call__(self, parser, namespace, new_argument, option_string=None):
66
- merged = getattr(namespace, self.dest) or {}
67
- key, value = new_argument.split('=', 1)
68
- merged[key] = value
69
- setattr(namespace, self.dest, merged)
70
-
71
- def _KeyValueValidator(argument):
72
- '''To validate the option has a key value pair format.
73
-
74
- When you forget to provide the option in key=value format,
75
- it reminds you by throwing an error before executing any tests.
76
- '''
77
-
78
- keyValuePair = [str for str in argument.split('=') if str != ''];
79
-
80
- if len(keyValuePair) == 2:
81
- return argument
82
- else:
83
- raise argparse.ArgumentTypeError(
84
- 'Received %s but expecting format of key=value' % argument
85
- )
86
-
87
- def _IntGreaterThanZero(x):
88
- i = int(x)
89
- if i <= 0:
90
- raise argparse.ArgumentTypeError('%s is not greater than zero' % x)
91
- return i
92
-
93
-
94
- def _GetDefaultBrowsers():
95
- """Use the platform name to get which browsers can be tested."""
96
-
97
- if shakaBuildHelpers.is_linux():
98
- # For MP4 support on Linux Firefox, install gstreamer1.0-libav.
99
- # Opera on Linux only supports MP4 for Ubuntu 15.04+, so it is not in the
100
- # default list of browsers for Linux at this time.
101
- return ['Chrome','Edge','Firefox']
102
-
103
- if shakaBuildHelpers.is_darwin():
104
- return ['Chrome','Edge','Firefox','Safari']
105
-
106
- if shakaBuildHelpers.is_windows() or shakaBuildHelpers.is_cygwin():
107
- return ['Chrome','Edge','Firefox','IE']
108
-
109
- raise Error('Unrecognized system: %s' % platform.uname()[0])
110
-
111
-
112
- # TODO(joeyparrish): When internal tools using this Launcher system are removed,
113
- # simplify this whole mess.
114
- class Launcher:
115
- """A stateful object for parsing arguments and running Karma commands.
116
-
117
- A launcher that holds the state of parsing arguments and builds and
118
- executes the resulting Karma command. The process is split into sections so
119
- that other scripts can inject their own logic between calls.
120
-
121
- For example:
122
- l = Launcher('Launch Karma tests')
123
- l.parser.add_argument('custom_flag')
124
- l.ParseArguments(args)
125
- l.ResolveBrowsers(['Chrome'])
126
- if l.parsed_args.custom_flag:
127
- do_custom_logic
128
- l.RunCommand(karma_conf_path)
129
- """
130
-
131
- def __init__(self, description):
132
- self.karma_config = {}
133
- self.parsed_args = None
134
- self.parser = argparse.ArgumentParser(
135
- description=description,
136
- formatter_class=argparse.RawDescriptionHelpFormatter)
137
-
138
- running_commands = self.parser.add_argument_group(
139
- 'Running',
140
- 'These commands affect how tests are run.')
141
- logging_commands = self.parser.add_argument_group(
142
- 'Logging',
143
- 'These commands affect what gets logged and how the logs will appear.')
144
- networking_commands = self.parser.add_argument_group(
145
- 'Networking',
146
- 'These commands affect how Karma works over a network.')
147
- pre_launch_commands = self.parser.add_argument_group(
148
- 'Pre-Launch',
149
- 'These commands are handled before the tests start running.')
150
-
151
-
152
- running_commands.add_argument(
153
- '--browsers',
154
- help='Specify which browsers to run tests on as a space-separated or '
155
- 'comma-separated list. Use "--browsers help" to see a list of '
156
- 'available browsers on this platform.',
157
- action=_HandleMixedListsAction,
158
- nargs='+')
159
- running_commands.add_argument(
160
- '--exclude-browsers',
161
- help='Browsers to skip as a comma-separated or space-separated list.',
162
- action=_HandleMixedListsAction,
163
- nargs='+')
164
- running_commands.add_argument(
165
- '--no-browsers',
166
- help='Instead of Karma starting browsers, Karma will wait for a '
167
- 'browser to connect to it.',
168
- action='store_true')
169
- running_commands.add_argument(
170
- '--single-run',
171
- help='Run the test when browsers capture and exit.',
172
- dest='single_run',
173
- action='store_true',
174
- default=True)
175
- running_commands.add_argument(
176
- '--no-single-run',
177
- help='Do not shut down Karma when tests are complete.',
178
- dest='single_run',
179
- action='store_false')
180
- running_commands.add_argument(
181
- '--random',
182
- help='Run the tests in a random order. This can be used with --seed '
183
- 'to control the random order. If used without --seed, a seed '
184
- 'will be generated.',
185
- action='store_true')
186
- running_commands.add_argument(
187
- '--seed',
188
- help='Set the seed that will be used by --random. If used without '
189
- '--random, this will have no effect.',
190
- type=int)
191
- running_commands.add_argument(
192
- '--filter',
193
- help='Specify a regular expression to limit which tests run.',
194
- type=str,
195
- dest='filter')
196
- running_commands.add_argument(
197
- '--use-xvfb',
198
- help='Run tests without opening browser windows. Requires Linux '
199
- 'and xvfb.',
200
- action='store_true')
201
- running_commands.add_argument(
202
- '--quick',
203
- help='Skip integration tests.',
204
- action='store_true')
205
- running_commands.add_argument(
206
- '--external',
207
- help='Run tests that require external resources. This will require a '
208
- 'fast connection to the open internet.',
209
- action='store_true')
210
- running_commands.add_argument(
211
- '--drm',
212
- help='Run tests that require DRM (on by default).',
213
- default=True,
214
- action='store_true')
215
- running_commands.add_argument(
216
- '--no-drm', '--nodrm',
217
- help='Skip tests that require DRM (opposite of --drm).',
218
- dest='drm',
219
- action='store_false')
220
- running_commands.add_argument(
221
- '--quarantined',
222
- help='Run tests that have been quarantined.',
223
- action='store_true')
224
- running_commands.add_argument(
225
- '--runs',
226
- help='Set the number of times each test should run. (default '
227
- '%(default)s) ',
228
- type=_IntGreaterThanZero,
229
- default=1,
230
- dest='runs')
231
- running_commands.add_argument(
232
- '--uncompiled',
233
- help='Use the uncompiled source code when running the tests. This can '
234
- 'be used to make debugging easier.',
235
- action='store_true')
236
- running_commands.add_argument(
237
- '--auto-watch',
238
- help='Auto watch source files and run on change.',
239
- dest='auto_watch',
240
- action='store_true',
241
- default=False)
242
- running_commands.add_argument(
243
- '--no-auto-watch',
244
- help='Do not watch source files',
245
- dest='auto_watch',
246
- action='store_false')
247
- running_commands.add_argument(
248
- '--capture-timeout',
249
- help='Kill the browser if it does not capture in the given time [ms]. '
250
- '(default {} for local, {} for Selenium)'.format(
251
- LOCAL_CAPTURE_TIMEOUT, SELENIUM_CAPTURE_TIMEOUT),
252
- type=int)
253
- running_commands.add_argument(
254
- '--delay-tests',
255
- help='Insert an artificial delay between tests, in seconds. '
256
- 'This can be helpful when tracking down asynchronous test '
257
- 'pollution, in which an async process belonging to one test may '
258
- 'trigger a failure after other tests have begun. '
259
- '(default %(const)s)',
260
- type=int,
261
- default=None,
262
- const=2,
263
- nargs='?')
264
- running_commands.add_argument(
265
- '--spec-hide-passed',
266
- help='If provided, configure the spec reporter to hide passing tests.',
267
- action='store_true',
268
- default=False)
269
- running_commands.add_argument(
270
- '--test-custom-asset',
271
- help='Run asset playback tests on a custom manifest URI.',
272
- type=str,
273
- default=None)
274
- running_commands.add_argument(
275
- '--test-custom-license-server',
276
- help='Configure license servers for the custom asset playback test. '
277
- 'May be specified multiple times to configure multiple key '
278
- 'systems.',
279
- type=_KeyValueValidator,
280
- metavar='KEY_SYSTEM_ID=LICENSE_SERVER_URI',
281
- action=_HandleKeyValuePairs)
282
- running_commands.add_argument(
283
- '--test-timeout',
284
- help='Sets the test timeout value [ms] (default %(default)s)',
285
- dest='test_timeout',
286
- default=120000,
287
- type=int)
288
- running_commands.add_argument(
289
- '--no-babel',
290
- help="Don't use Babel to convert ES6 to ES5.",
291
- dest='babel',
292
- action='store_false')
293
- running_commands.add_argument(
294
- '--grid-address',
295
- help='Address (hostname:port) of a Selenium grid to run tests on.')
296
- running_commands.add_argument(
297
- '--grid-config',
298
- help='Path to a yaml config defining Selenium grid browsers. '
299
- '(See docs/selenium-grid-config.md)')
300
-
301
-
302
- logging_commands.add_argument(
303
- '--colors',
304
- help='Use colors when reporting and printing logs.',
305
- action='store_true',
306
- dest='colors',
307
- default=True)
308
- logging_commands.add_argument(
309
- '--no-colors',
310
- help='Do not use colors when reporting or printing logs',
311
- action='store_false',
312
- dest='colors')
313
- logging_commands.add_argument(
314
- '--log-level',
315
- help='Set the type of log messages that Karma will print.',
316
- choices=['disable', 'error', 'warn', 'info', 'debug'],
317
- default='error')
318
- logging_commands.add_argument(
319
- '--html-coverage-report',
320
- help='Generate HTML-formatted code coverage reports in the "coverage" '
321
- 'folder.',
322
- action='store_true')
323
- logging_commands.add_argument(
324
- '--enable-logging',
325
- help='Print log messages from tests and limits the type of log '
326
- 'messages printed. If --enable-logging is not given, no logs '
327
- 'will be printed. (default %(const)s)',
328
- choices=['none', 'error', 'warning', 'info', 'debug', 'v1', 'v2'],
329
- default='none',
330
- const='info',
331
- dest='logging',
332
- nargs='?')
333
- logging_commands.add_argument(
334
- '--reporters',
335
- help='Specify which reporters to use as a space-separated or '
336
- 'comma-separated list. Possible options are dots, progress, '
337
- 'junit, growl, or coverage.',
338
- action=_HandleMixedListsAction,
339
- nargs='+')
340
- logging_commands.add_argument(
341
- '--report-slower-than',
342
- help='Report tests that are slower than the given time [ms].',
343
- type=int)
344
-
345
-
346
- networking_commands.add_argument(
347
- '--port',
348
- help='Port where the server is running.',
349
- type=int)
350
- networking_commands.add_argument(
351
- '--hostname',
352
- help='Specify the hostname to be used when capturing browsers. This '
353
- 'defaults to localhost.',
354
- default='localhost')
355
- networking_commands.add_argument(
356
- '--tls-key',
357
- help='Specify a TLS key to serve tests over HTTPs.')
358
- networking_commands.add_argument(
359
- '--tls-cert',
360
- help='Specify a TLS cert to serve tests over HTTPs.')
361
- networking_commands.add_argument(
362
- '--lets-encrypt-folder',
363
- help="Specify a Let's Encrypt folder to search for the latest key and "
364
- "cert, to serve tests over HTTPs. This overrides --tls-key and "
365
- "--tls-cert.")
366
-
367
-
368
- pre_launch_commands.add_argument(
369
- '--force',
370
- help='Force a rebuild of the project before running tests. This will '
371
- 'have no effect if --no-build is set.',
372
- action='store_true')
373
- pre_launch_commands.add_argument(
374
- '--no-build',
375
- help='Skip building the project before running tests.',
376
- action='store_false',
377
- dest='build',
378
- default=True)
379
- pre_launch_commands.add_argument(
380
- '--print-command',
381
- help='Print the command passed to Karma before passing it to Karma.',
382
- action='store_true')
383
-
384
-
385
- def ParseArguments(self, args):
386
- """Parse the given arguments.
387
-
388
- Uses the parser definition to parse |args| and populates
389
- |self.karma_config|.
390
- """
391
-
392
- self.parsed_args = self.parser.parse_args(args)
393
- self.karma_config = {}
394
-
395
- pass_through = [
396
- 'auto_watch',
397
- 'babel',
398
- 'browsers',
399
- 'capture_timeout',
400
- 'colors',
401
- 'delay_tests',
402
- 'drm',
403
- 'exclude_browsers',
404
- 'external',
405
- 'filter',
406
- 'grid_address',
407
- 'grid_config',
408
- 'hostname',
409
- 'html_coverage_report',
410
- 'log_level',
411
- 'logging',
412
- 'no_browsers',
413
- 'port',
414
- 'quarantined',
415
- 'quick',
416
- 'random',
417
- 'reporters',
418
- 'report_slower_than',
419
- 'seed',
420
- 'single_run',
421
- 'spec_hide_passed',
422
- 'test_custom_asset',
423
- 'test_custom_license_server',
424
- 'test_timeout',
425
- 'tls_key',
426
- 'tls_cert',
427
- 'uncompiled',
428
- ]
429
-
430
- # Check each value before setting it to avoid passing null values.
431
- for name in pass_through:
432
- value = getattr(self.parsed_args, name, None)
433
- if value is not None:
434
- self.karma_config[name] = value
435
-
436
- if not self.parsed_args.capture_timeout:
437
- # The default for capture_timeout depends on whether or not we are using
438
- # a Selenium grid.
439
- if self.parsed_args.grid_config:
440
- self.karma_config['capture_timeout'] = SELENIUM_CAPTURE_TIMEOUT
441
- else:
442
- self.karma_config['capture_timeout'] = LOCAL_CAPTURE_TIMEOUT
443
-
444
- self._HandleLetsEncryptConfig()
445
-
446
- def _HandleLetsEncryptConfig(self):
447
- folder = self.parsed_args.lets_encrypt_folder
448
- if not folder:
449
- return
450
-
451
- max_serial_number = 0
452
- # Go through the contents of the folder to find the latest key & cert.
453
- for file_name in os.listdir(folder):
454
- matches = re.match(r'(?:privkey|fullchain)(\d+).pem', file_name)
455
- if matches:
456
- serial_number = int(matches.group(1))
457
- max_serial_number = max(max_serial_number, serial_number)
458
-
459
- self.karma_config['tls_key'] = os.path.join(
460
- folder, 'privkey{}.pem'.format(max_serial_number))
461
- self.karma_config['tls_cert'] = os.path.join(
462
- folder, 'fullchain{}.pem'.format(max_serial_number))
463
-
464
- def ResolveBrowsers(self, default_browsers):
465
- """Decide what browsers we should use.
466
-
467
- This is separate from ParseArguments so that other tools can insert
468
- additional logic to derive a browser list from the parsed arguments.
469
- """
470
- assert(default_browsers and len(default_browsers))
471
- self.karma_config['default_browsers'] = default_browsers
472
-
473
- def RunCommand(self, karma_conf):
474
- """Build a command and send it to Karma for execution.
475
-
476
- Uses |self.parsed_args| and |self.karma_config| to build and run a Karma
477
- command.
478
- """
479
- if self.parsed_args.use_xvfb and not shakaBuildHelpers.is_linux():
480
- logging.error('xvfb can only be used on Linux')
481
- return 1
482
-
483
- if not shakaBuildHelpers.update_node_modules():
484
- logging.error('Failed to update node modules')
485
- return 1
486
-
487
- karma = shakaBuildHelpers.get_node_binary('karma')
488
- cmd = ['xvfb-run', '--auto-servernum'] if self.parsed_args.use_xvfb else []
489
- cmd += karma + ['start']
490
- cmd += [karma_conf] if karma_conf else []
491
- cmd += ['--settings', json.dumps(self.karma_config)]
492
-
493
- # There is no need to print a status here as the gendep and build
494
- # calls will print their own status updates.
495
- if self.parsed_args.build:
496
- if gendeps.main([]) != 0:
497
- logging.error('Failed to generate project dependencies')
498
- return 1
499
-
500
- if build.main(['--force'] if self.parsed_args.force else []) != 0:
501
- logging.error('Failed to build project')
502
- return 1
503
-
504
- # Before Running the command, print the command.
505
- if self.parsed_args.print_command:
506
- logging.info('Karma Run Command')
507
- logging.info('%s', cmd)
508
-
509
- # Run the command.
510
- results = []
511
- for run in range(self.parsed_args.runs):
512
- logging.info('Running test (%d / %d, %d failed so far)...',
513
- run + 1, self.parsed_args.runs, len(results) - results.count(0))
514
- results.append(shakaBuildHelpers.execute_get_code(cmd))
515
-
516
- # Print a summary of the results.
517
- if self.parsed_args.runs > 1:
518
- logging.info('All runs completed. %d / %d runs passed.',
519
- results.count(0),
520
- len(results))
521
- logging.info('Results (exit code): %r', results)
522
- else:
523
- logging.info('Run complete')
524
- logging.info('Result (exit code): %d', results[0])
525
-
526
- return 0 if all(result == 0 for result in results) else 1
527
-
528
-
529
- def Run(args):
530
- launcher = Launcher('Shaka Player Test Runner Script')
531
- launcher.ParseArguments(args)
532
- launcher.ResolveBrowsers(_GetDefaultBrowsers())
533
- return launcher.RunCommand(None)
534
-
535
-
536
- def main(args):
537
- return Run(args)
538
-
539
-
540
- if __name__ == '__main__':
541
- shakaBuildHelpers.run_main(main)
package/build/types/ads DELETED
@@ -1,8 +0,0 @@
1
- # Ad Insertion Functionality
2
-
3
- +../../lib/ads/ad_manager.js
4
- +../../lib/ads/ads_stats.js
5
- +../../lib/ads/client_side_ad.js
6
- +../../lib/ads/client_side_ad_manager.js
7
- +../../lib/ads/server_side_ad.js
8
- +../../lib/ads/server_side_ad_manager.js
package/build/types/cast DELETED
@@ -1,6 +0,0 @@
1
- # Cast support.
2
-
3
- +../../lib/cast/cast_proxy.js
4
- +../../lib/cast/cast_receiver.js
5
- +../../lib/cast/cast_sender.js
6
- +../../lib/cast/cast_utils.js
package/build/types/cea DELETED
@@ -1,13 +0,0 @@
1
- # Inband closed caption support.
2
-
3
- +../../lib/cea/cea_decoder.js
4
- +../../lib/cea/cea_utils.js
5
- +../../lib/cea/cea608_data_channel.js
6
- +../../lib/cea/cea608_memory.js
7
- +../../lib/cea/cea708_service.js
8
- +../../lib/cea/cea708_window.js
9
- +../../lib/cea/dtvcc_packet_builder.js
10
- +../../lib/cea/i_caption_decoder.js
11
- +../../lib/cea/i_cea_parser.js
12
- +../../lib/cea/mp4_cea_parser.js
13
- +../../lib/cea/sei_processor.js
@@ -1,9 +0,0 @@
1
- # The complete library, containing every available plugin.
2
-
3
- +@ads
4
- +@cast
5
- +@networking
6
- +@manifests
7
- +@polyfill
8
- +@text
9
- +@ui