shaka-player 4.0.3 → 4.0.4

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 (129) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/CONTRIBUTORS +2 -0
  3. package/README.md +20 -6
  4. package/demo/index.html +0 -2
  5. package/dist/controls.css +1 -1
  6. package/dist/deps.js +3 -3
  7. package/dist/locales.js +33 -33
  8. package/dist/shaka-player.compiled.d.ts +11 -0
  9. package/dist/shaka-player.compiled.debug.d.ts +11 -0
  10. package/dist/shaka-player.compiled.debug.externs.js +48 -37
  11. package/dist/shaka-player.compiled.debug.js +141 -137
  12. package/dist/shaka-player.compiled.debug.map +4 -4
  13. package/dist/shaka-player.compiled.externs.js +48 -37
  14. package/dist/shaka-player.compiled.js +774 -772
  15. package/dist/shaka-player.compiled.map +4 -4
  16. package/dist/shaka-player.ui.d.ts +11 -0
  17. package/dist/shaka-player.ui.debug.d.ts +11 -0
  18. package/dist/shaka-player.ui.debug.externs.js +48 -37
  19. package/dist/shaka-player.ui.debug.js +153 -149
  20. package/dist/shaka-player.ui.debug.map +4 -4
  21. package/dist/shaka-player.ui.externs.js +48 -37
  22. package/dist/shaka-player.ui.js +892 -890
  23. package/dist/shaka-player.ui.map +4 -4
  24. package/docs/tutorials/upgrade.md +1 -0
  25. package/docs/tutorials/welcome.md +6 -3
  26. package/lib/dash/dash_parser.js +5 -0
  27. package/lib/hls/hls_parser.js +6 -2
  28. package/lib/media/media_source_engine.js +57 -24
  29. package/lib/media/presentation_timeline.js +24 -1
  30. package/lib/media/streaming_engine.js +3 -4
  31. package/lib/media/time_ranges_utils.js +46 -0
  32. package/lib/player.js +1 -1
  33. package/lib/polyfill/media_capabilities.js +3 -0
  34. package/lib/polyfill/videoplaybackquality.js +3 -1
  35. package/lib/util/platform.js +19 -1
  36. package/lib/util/string_utils.js +56 -14
  37. package/maintained-branches.md +15 -0
  38. package/package.json +2 -4
  39. package/test/media/drm_engine_integration.js +24 -8
  40. package/test/media/media_source_engine_integration.js +24 -10
  41. package/test/media/media_source_engine_unit.js +53 -38
  42. package/test/media/streaming_engine_unit.js +28 -27
  43. package/test/test/util/fake_media_source_engine.js +10 -9
  44. package/app-engine/README.md +0 -9
  45. package/app-engine/demo-version-index/README.md +0 -14
  46. package/app-engine/demo-version-index/app.yaml +0 -28
  47. package/app-engine/demo-version-index/generate.py +0 -164
  48. package/app-engine/demo-version-index/main.py +0 -11
  49. package/app-engine/demo-version-index/requirements.txt +0 -5
  50. package/app-engine/demo-version-index/templates/index.html +0 -114
  51. package/app-engine/shaka-player-demo/README.md +0 -18
  52. package/app-engine/shaka-player-demo/app.yaml +0 -61
  53. package/app-engine/shaka-player-demo/main.py +0 -95
  54. package/app-engine/shaka-player-demo/posters/10yo.png +0 -0
  55. package/app-engine/shaka-player-demo/posters/10yo.xcf +0 -0
  56. package/app-engine/shaka-player-demo/posters/1yo.jpg +0 -0
  57. package/app-engine/shaka-player-demo/posters/2yo.png +0 -0
  58. package/app-engine/shaka-player-demo/posters/2yo.xcf +0 -0
  59. package/app-engine/shaka-player-demo/posters/3yo.png +0 -0
  60. package/app-engine/shaka-player-demo/posters/3yo.xcf +0 -0
  61. package/app-engine/shaka-player-demo/posters/4yo.png +0 -0
  62. package/app-engine/shaka-player-demo/posters/4yo.xcf +0 -0
  63. package/app-engine/shaka-player-demo/posters/5yo.png +0 -0
  64. package/app-engine/shaka-player-demo/posters/5yo.xcf +0 -0
  65. package/app-engine/shaka-player-demo/posters/6yo.png +0 -0
  66. package/app-engine/shaka-player-demo/posters/6yo.xcf +0 -0
  67. package/app-engine/shaka-player-demo/posters/7yo.png +0 -0
  68. package/app-engine/shaka-player-demo/posters/7yo.xcf +0 -0
  69. package/app-engine/shaka-player-demo/posters/8yo.png +0 -0
  70. package/app-engine/shaka-player-demo/posters/8yo.xcf +0 -0
  71. package/app-engine/shaka-player-demo/posters/9yo.png +0 -0
  72. package/app-engine/shaka-player-demo/posters/9yo.xcf +0 -0
  73. package/app-engine/shaka-player-demo/posters/audioOnly.gif +0 -0
  74. package/app-engine/shaka-player-demo/posters/audioRickRoll.gif +0 -0
  75. package/app-engine/shaka-player-demo/posters/colorbars.gif +0 -0
  76. package/app-engine/shaka-player-demo/posters/fireworks.jpg +0 -0
  77. package/app-engine/shaka-player-demo/posters/party-hat.png +0 -0
  78. package/app-engine/shaka-player-demo/posters/sources.txt +0 -46
  79. package/app-engine/shaka-player-demo/posters/standard.png +0 -0
  80. package/app-engine/shaka-player-demo/posters/trek.jpg +0 -0
  81. package/app-engine/shaka-player-demo/posters/valentines.png +0 -0
  82. package/app-engine/shaka-player-demo/posters/zombie.jpg +0 -0
  83. package/app-engine/shaka-player-demo/posters.py +0 -110
  84. package/app-engine/shaka-player-demo/requirements.txt +0 -5
  85. package/app-engine/shaka-player-demo/time.txt +0 -1
  86. package/build/README.md +0 -127
  87. package/build/__init__.py +0 -0
  88. package/build/all.py +0 -150
  89. package/build/apps.py +0 -186
  90. package/build/build.py +0 -392
  91. package/build/check.py +0 -354
  92. package/build/checkversion.py +0 -84
  93. package/build/compiler.py +0 -513
  94. package/build/conformance.textproto +0 -335
  95. package/build/docker/Dockerfile +0 -20
  96. package/build/docker/docker-compose.yml +0 -10
  97. package/build/docs.py +0 -54
  98. package/build/eslint-plugin-shaka-rules/arg-comment-spacing.js +0 -72
  99. package/build/eslint-plugin-shaka-rules/index.js +0 -24
  100. package/build/eslint-plugin-shaka-rules/package.json +0 -7
  101. package/build/eslint-plugin-shaka-rules/private.js +0 -109
  102. package/build/gendeps.py +0 -71
  103. package/build/generateExterns.js +0 -867
  104. package/build/generateLocalizations.py +0 -262
  105. package/build/generateTsDefs.py +0 -137
  106. package/build/install-linux-prereqs.sh +0 -136
  107. package/build/license-header +0 -5
  108. package/build/misspellings.txt +0 -39
  109. package/build/pixelsChanged.js +0 -35
  110. package/build/shaka-lab.yaml +0 -161
  111. package/build/shakaBuildHelpers.py +0 -356
  112. package/build/stats.py +0 -816
  113. package/build/subprocessWindowsPatch.py +0 -103
  114. package/build/test.py +0 -541
  115. package/build/types/ads +0 -8
  116. package/build/types/cast +0 -6
  117. package/build/types/cea +0 -13
  118. package/build/types/complete +0 -9
  119. package/build/types/core +0 -108
  120. package/build/types/dash +0 -8
  121. package/build/types/hls +0 -9
  122. package/build/types/manifests +0 -5
  123. package/build/types/networking +0 -6
  124. package/build/types/offline +0 -22
  125. package/build/types/polyfill +0 -18
  126. package/build/types/text +0 -11
  127. package/build/types/ui +0 -39
  128. package/build/updateScreenshots.py +0 -85
  129. package/build/wrapper.template.js +0 -52
package/build/build.py DELETED
@@ -1,392 +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
- """Creates a build from the given commands.
18
-
19
- A command is either an addition or a subtraction. An addition is prefixed with
20
- a +; a subtraction is when prefixed with a -. After the character, there is a
21
- name of a file or a @ sign and the name of a build file.
22
-
23
- Build files are the files found in build/types. These files are simply a
24
- newline separated list of commands to execute. So if the "+@complete" command
25
- is given, it will open the complete file and run it (which may in turn open
26
- other build files). Subtracting a build file will reverse all actions applied
27
- by the given file. So "-@networking" will remove all the networking plugins,
28
- and "-@ui" will remove the UI.
29
-
30
- The core library is always included so does not have to be listed. The default
31
- is to use the name 'ui'; if no commands are given, it will build the complete
32
- build, including the UI.
33
-
34
- Examples:
35
- # Equivalent to +@complete
36
- build.py
37
-
38
- build.py +@complete
39
- build.py +@complete -@networking
40
- build.py +@complete -@ui
41
- build.py --name custom +@manifests +@networking +../my_plugin.js
42
- """
43
-
44
- import argparse
45
- import logging
46
- import os
47
- import re
48
-
49
- import compiler
50
- import generateLocalizations
51
- import shakaBuildHelpers
52
-
53
-
54
- shaka_version = shakaBuildHelpers.calculate_version()
55
-
56
- common_closure_opts = [
57
- '--language_out', 'ECMASCRIPT3',
58
-
59
- '--jscomp_error=*',
60
-
61
- # Turn off complaints like:
62
- # "Private property foo_ is never modified, use the @const annotation"
63
- '--jscomp_off=jsdocMissingConst',
64
-
65
- # Turn off complaints like:
66
- # "Object is a reference type with no nullability modifier that is
67
- # explicitly set to null."
68
- # and:
69
- # "Property defineClass of type goog has been deprecated"
70
- # Even the Closure Library's base.js doesn't pass these checks yet as of
71
- # the 20200406 release.
72
- '--jscomp_off=lintChecks',
73
- '--jscomp_off=deprecated',
74
- # Turn off complaints like:
75
- # "Built-in 'Reflect.setPrototypeOf' not supported in output version es3."
76
- '--jscomp_off=missingPolyfill',
77
- '--extra_annotation_name=listens',
78
- '--extra_annotation_name=exportDoc',
79
- '--extra_annotation_name=exportInterface',
80
-
81
- '--conformance_configs',
82
- ('%s/build/conformance.textproto' %
83
- shakaBuildHelpers.cygwin_safe_path(shakaBuildHelpers.get_source_base())),
84
-
85
- '--generate_exports',
86
- ]
87
- common_closure_defines = [
88
- '-D', 'COMPILED=true',
89
- '-D', 'goog.ENABLE_DEBUG_LOADER=false',
90
- ]
91
-
92
- debug_closure_opts = [
93
- '-O', 'SIMPLE',
94
- ]
95
- debug_closure_defines = [
96
- '-D', 'goog.DEBUG=true',
97
- '-D', 'goog.asserts.ENABLE_ASSERTS=true',
98
- '-D', 'shaka.log.MAX_LOG_LEVEL=4', # shaka.log.Level.DEBUG
99
- '-D', 'shaka.Player.version="%s-debug"' % shaka_version,
100
- ]
101
-
102
- release_closure_opts = [
103
- '-O', 'ADVANCED',
104
- ]
105
- release_closure_defines = [
106
- '-D', 'goog.DEBUG=false',
107
- '-D', 'goog.asserts.ENABLE_ASSERTS=false',
108
- '-D', 'shaka.log.MAX_LOG_LEVEL=0',
109
- '-D', 'shaka.Player.version="%s"' % shaka_version,
110
- ]
111
-
112
-
113
- class Build(object):
114
- """Defines a build that has been parsed from a build file.
115
-
116
- This has exclude files even though it will not be used at the top-level. This
117
- allows combining builds. A file will only exist in at most one set.
118
-
119
- Members:
120
- include - A set of files to include.
121
- exclude - A set of files to remove.
122
- """
123
-
124
- def __init__(self, include=None, exclude=None):
125
- self.include = include or set()
126
- self.exclude = exclude or set()
127
-
128
- def _get_build_file_path(self, name, root):
129
- """Gets the full path to a build file, if it exists.
130
-
131
- Args:
132
- name: The string name to check.
133
- root: The full path to the base directory.
134
-
135
- Returns:
136
- The full path to the build file, or None if not found.
137
- """
138
- source_base = shakaBuildHelpers.get_source_base()
139
- local_path = os.path.join(root, name)
140
- build_path = os.path.join(source_base, 'build', 'types', name)
141
- if (os.path.isfile(local_path) and os.path.isfile(build_path)
142
- and local_path != build_path):
143
- logging.error('Build file "%s" is ambiguous', name)
144
- return None
145
- elif os.path.isfile(local_path):
146
- return local_path
147
- elif os.path.isfile(build_path):
148
- return build_path
149
- else:
150
- logging.error('Build file not found: %s', name)
151
- return None
152
-
153
- def _combine(self, other):
154
- include_all = self.include | other.include
155
- exclude_all = self.exclude | other.exclude
156
- self.include = include_all - exclude_all
157
- self.exclude = exclude_all - include_all
158
-
159
- def reverse(self):
160
- return Build(self.exclude, self.include)
161
-
162
- def add_closure(self):
163
- """Adds the closure library and externs."""
164
- # Add externs and closure dependencies.
165
- self.include |= set(
166
- [shakaBuildHelpers.get_closure_base_js_path()] +
167
- shakaBuildHelpers.get_all_js_files('externs'))
168
-
169
- def add_core(self):
170
- """Adds the core library."""
171
- # Check that there are no files in 'core' that are removed
172
- core_build = Build()
173
- core_build.parse_build(['+@core'], os.getcwd())
174
- core_files = core_build.include
175
- if self.exclude & core_files:
176
- logging.error('Cannot exclude files from core')
177
- return False
178
- self.include |= core_files
179
- return True
180
-
181
- def has_ui(self):
182
- """Returns True if the UI library is in the build."""
183
- for path in self.include:
184
- if 'ui' in path.split(os.path.sep):
185
- return True
186
- return False
187
-
188
- def generate_localizations(self, locales, force):
189
- localizations = compiler.GenerateLocalizations(locales)
190
- localizations.generate(force)
191
- self.include.add(os.path.abspath(localizations.output))
192
-
193
- def parse_build(self, lines, root):
194
- """Parses a Build object from the given lines of commands.
195
-
196
- This will recursively read and parse builds.
197
-
198
- Args:
199
- lines: An array of strings defining commands.
200
- root: The full path to the base directory.
201
-
202
- Returns:
203
- True on success, False otherwise.
204
- """
205
- for line in lines:
206
- # Strip comments
207
- try:
208
- line = line[:line.index('#')]
209
- except ValueError:
210
- pass
211
-
212
- # Strip whitespace and ignore empty lines.
213
- line = line.strip()
214
- if not line:
215
- continue
216
-
217
- if line[0] == '+':
218
- is_neg = False
219
- line = line[1:].strip()
220
- elif line[0] == '-':
221
- is_neg = True
222
- line = line[1:].strip()
223
- else:
224
- logging.error('Operation (+/-) required')
225
- return False
226
-
227
- if line[0] == '@':
228
- line = line[1:].strip()
229
-
230
- build_path = self._get_build_file_path(line, root)
231
- if not build_path:
232
- return False
233
- lines = shakaBuildHelpers.open_file(build_path).readlines()
234
- sub_root = os.path.dirname(build_path)
235
-
236
- # If this is a build file, then recurse and combine the builds.
237
- sub_build = Build()
238
- if not sub_build.parse_build(lines, sub_root):
239
- return False
240
-
241
- if is_neg:
242
- self._combine(sub_build.reverse())
243
- else:
244
- self._combine(sub_build)
245
- else:
246
- if not os.path.isabs(line):
247
- line = os.path.abspath(os.path.join(root, line))
248
- if not os.path.isfile(line):
249
- logging.error('Unable to find file: %s', line)
250
- return False
251
-
252
- if is_neg:
253
- self.include.discard(line)
254
- self.exclude.add(line)
255
- else:
256
- self.include.add(line)
257
- self.exclude.discard(line)
258
-
259
- return True
260
-
261
- def build_library(self, name, locales, force, is_debug):
262
- """Builds Shaka Player using the files in |self.include|.
263
-
264
- Args:
265
- name: The name of the build.
266
- locales: A list of strings of locale identifiers.
267
- force: True to rebuild, False to ignore if no changes are detected.
268
- is_debug: True to compile for debugging, false for release.
269
-
270
- Returns:
271
- True on success; False on failure.
272
- """
273
- self.add_closure()
274
- if not self.add_core():
275
- return False
276
- if self.has_ui():
277
- self.generate_localizations(locales, force)
278
-
279
- if is_debug:
280
- name += '.debug'
281
-
282
- build_name = 'shaka-player.' + name
283
- closure = compiler.ClosureCompiler(self.include, build_name)
284
-
285
- closure_opts = common_closure_opts + common_closure_defines
286
- if is_debug:
287
- closure_opts += debug_closure_opts + debug_closure_defines
288
- else:
289
- closure_opts += release_closure_opts + release_closure_defines
290
-
291
- if not closure.compile(closure_opts, force):
292
- return False
293
-
294
- # Don't pass local node modules to the extern generator. But don't simply
295
- # exclude the string 'node_modules', either, since Shaka Player could be
296
- # rebuilt after installing it as a node module.
297
- node_modules_path = os.path.join(
298
- shakaBuildHelpers.get_source_base(), 'node_modules')
299
- local_include = set([f for f in self.include if node_modules_path not in f])
300
- extern_generator = compiler.ExternGenerator(local_include, build_name)
301
-
302
- if not extern_generator.generate(force):
303
- return False
304
-
305
- generated_externs = [extern_generator.output]
306
- shaka_externs = shakaBuildHelpers.get_all_js_files('externs')
307
- if self.has_ui():
308
- shaka_externs += shakaBuildHelpers.get_all_js_files('ui/externs')
309
- ts_def_generator = compiler.TsDefGenerator(
310
- generated_externs + shaka_externs, build_name)
311
-
312
- if not ts_def_generator.generate(force):
313
- return False
314
-
315
- return True
316
-
317
-
318
- def main(args):
319
- parser = argparse.ArgumentParser(
320
- description=__doc__,
321
- formatter_class=argparse.RawDescriptionHelpFormatter)
322
-
323
- parser.add_argument(
324
- '--locales',
325
- type=str,
326
- nargs='+',
327
- default=generateLocalizations.DEFAULT_LOCALES,
328
- help='The list of locales to compile in (requires UI, default %(default)r)')
329
-
330
- parser.add_argument(
331
- '--force',
332
- '-f',
333
- help='Force building the library even if no files have changed.',
334
- action='store_true')
335
-
336
- parser.add_argument(
337
- '--mode',
338
- help='Specify which build mode to use.',
339
- choices=['debug', 'release'],
340
- default='release')
341
-
342
- parser.add_argument(
343
- '--debug',
344
- help='Same as using "--mode debug".',
345
- action='store_const',
346
- dest='mode',
347
- const='debug')
348
-
349
- parser.add_argument(
350
- '--name',
351
- help='Set the name of the build. Uses "ui" if not given.',
352
- type=str,
353
- default='ui')
354
-
355
- parsed_args, commands = parser.parse_known_args(args)
356
-
357
- # Make the dist/ folder, ignore errors.
358
- base = shakaBuildHelpers.get_source_base()
359
- try:
360
- os.mkdir(os.path.join(base, 'dist'))
361
- except OSError:
362
- pass
363
-
364
- # Update node modules if needed.
365
- if not shakaBuildHelpers.update_node_modules():
366
- return 1
367
-
368
- # If no commands are given then use complete by default.
369
- if len(commands) == 0:
370
- commands.append('+@complete')
371
-
372
- logging.info('Compiling the library (%s, %s)...',
373
- parsed_args.name, parsed_args.mode)
374
-
375
- custom_build = Build()
376
-
377
- if not custom_build.parse_build(commands, os.getcwd()):
378
- return 1
379
-
380
- name = parsed_args.name
381
- locales = parsed_args.locales
382
- force = parsed_args.force
383
- is_debug = parsed_args.mode == 'debug'
384
-
385
- if not custom_build.build_library(name, locales, force, is_debug):
386
- return 1
387
-
388
- return 0
389
-
390
-
391
- if __name__ == '__main__':
392
- shakaBuildHelpers.run_main(main)