shaka-player 4.2.10 → 4.2.12

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 (64) hide show
  1. package/.github/workflows/appspot.yaml +39 -0
  2. package/.github/workflows/demo-version-index.yaml +3 -3
  3. package/CHANGELOG.md +42 -0
  4. package/CONTRIBUTORS +1 -0
  5. package/README.md +3 -0
  6. package/demo/custom.js +1 -1
  7. package/demo/demo.less +1 -0
  8. package/dist/demo.compiled.debug.js +2 -2
  9. package/dist/demo.compiled.debug.map +2 -2
  10. package/dist/demo.compiled.js +2 -2
  11. package/dist/demo.compiled.map +2 -2
  12. package/dist/demo.css +1 -1
  13. package/dist/demo.css.map +1 -1
  14. package/dist/deps.js +2 -2
  15. package/dist/locales.js +31 -31
  16. package/dist/shaka-player.compiled.d.ts +30 -0
  17. package/dist/shaka-player.compiled.debug.d.ts +30 -0
  18. package/dist/shaka-player.compiled.debug.externs.js +9 -0
  19. package/dist/shaka-player.compiled.debug.js +250 -246
  20. package/dist/shaka-player.compiled.debug.map +3 -3
  21. package/dist/shaka-player.compiled.externs.js +9 -0
  22. package/dist/shaka-player.compiled.js +789 -787
  23. package/dist/shaka-player.compiled.map +4 -4
  24. package/dist/shaka-player.ui.d.ts +30 -0
  25. package/dist/shaka-player.ui.debug.d.ts +30 -0
  26. package/dist/shaka-player.ui.debug.externs.js +9 -0
  27. package/dist/shaka-player.ui.debug.js +290 -285
  28. package/dist/shaka-player.ui.debug.map +3 -3
  29. package/dist/shaka-player.ui.externs.js +9 -0
  30. package/dist/shaka-player.ui.js +943 -941
  31. package/dist/shaka-player.ui.map +4 -4
  32. package/docs/tutorials/drm-config.md +9 -6
  33. package/docs/tutorials/welcome.md +1 -1
  34. package/externs/ima.js +34 -0
  35. package/lib/abr/simple_abr_manager.js +1 -1
  36. package/lib/cea/mp4_cea_parser.js +30 -14
  37. package/lib/dash/dash_parser.js +18 -3
  38. package/lib/hls/hls_parser.js +19 -2
  39. package/lib/hls/manifest_text_parser.js +10 -1
  40. package/lib/media/drm_engine.js +23 -14
  41. package/lib/media/gap_jumping_controller.js +24 -2
  42. package/lib/media/media_source_engine.js +10 -6
  43. package/lib/media/playhead.js +11 -0
  44. package/lib/media/region_observer.js +19 -1
  45. package/lib/media/segment_reference.js +22 -0
  46. package/lib/media/streaming_engine.js +16 -7
  47. package/lib/media/video_wrapper.js +6 -1
  48. package/lib/player.js +13 -4
  49. package/lib/polyfill/abort_controller.js +7 -0
  50. package/lib/text/vtt_text_parser.js +2 -1
  51. package/lib/util/manifest_parser_utils.js +1 -1
  52. package/lib/util/mp4_box_parsers.js +8 -3
  53. package/lib/util/stream_utils.js +1 -0
  54. package/package.json +9 -4
  55. package/test/cea/mp4_cea_parser_unit.js +26 -3
  56. package/test/dash/dash_parser_manifest_unit.js +120 -0
  57. package/test/hls/hls_live_unit.js +3 -1
  58. package/test/hls/hls_parser_unit.js +150 -0
  59. package/test/media/media_source_engine_unit.js +31 -0
  60. package/test/media/region_observer_unit.js +2 -1
  61. package/test/test/assets/multiple-trun-init.mp4 +0 -0
  62. package/test/test/assets/multiple-trun-segment.mp4 +0 -0
  63. package/test/test/util/layout_tests.js +4 -3
  64. package/ui/resolution_selection.js +7 -1
@@ -165,9 +165,12 @@ describe('MediaSourceEngine', () => {
165
165
  describe('constructor', () => {
166
166
  const originalCreateObjectURL =
167
167
  shaka.media.MediaSourceEngine.createObjectURL;
168
+ const originalRevokeObjectURL = window.URL.revokeObjectURL;
168
169
  const originalMediaSource = window.MediaSource;
169
170
  /** @type {jasmine.Spy} */
170
171
  let createObjectURLSpy;
172
+ /** @type {jasmine.Spy} */
173
+ let revokeObjectURLSpy;
171
174
 
172
175
  beforeEach(async () => {
173
176
  // Mock out MediaSource so we can test the production version of
@@ -182,6 +185,9 @@ describe('MediaSourceEngine', () => {
182
185
  shaka.media.MediaSourceEngine.createObjectURL =
183
186
  Util.spyFunc(createObjectURLSpy);
184
187
 
188
+ revokeObjectURLSpy = jasmine.createSpy('revokeObjectURL');
189
+ window.URL.revokeObjectURL = Util.spyFunc(revokeObjectURLSpy);
190
+
185
191
  const mediaSourceSpy = jasmine.createSpy('MediaSource');
186
192
  // Because this is a fake constructor, it must be callable with "new".
187
193
  // This will cause jasmine to invoke the callback with "new" as well, so
@@ -199,6 +205,7 @@ describe('MediaSourceEngine', () => {
199
205
  afterAll(() => {
200
206
  shaka.media.MediaSourceEngine.createObjectURL = originalCreateObjectURL;
201
207
  window.MediaSource = originalMediaSource;
208
+ window.URL.revokeObjectURL = originalRevokeObjectURL;
202
209
  });
203
210
 
204
211
  it('creates a MediaSource object and sets video.src', () => {
@@ -211,6 +218,30 @@ describe('MediaSourceEngine', () => {
211
218
  expect(createObjectURLSpy).toHaveBeenCalled();
212
219
  expect(mockVideo.src).toBe('blob:foo');
213
220
  });
221
+
222
+ it('revokes object URL after MediaSource opens', () => {
223
+ let onSourceOpenListener;
224
+
225
+ mockMediaSource.addEventListener.and.callFake((event, callback, _) => {
226
+ if (event == 'sourceopen') {
227
+ onSourceOpenListener = callback;
228
+ }
229
+ });
230
+
231
+ mediaSourceEngine = new shaka.media.MediaSourceEngine(
232
+ video,
233
+ new shaka.test.FakeClosedCaptionParser(),
234
+ new shaka.test.FakeTextDisplayer());
235
+
236
+ expect(mockMediaSource.addEventListener).toHaveBeenCalledTimes(1);
237
+ expect(mockMediaSource.addEventListener.calls.mostRecent().args[0])
238
+ .toBe('sourceopen');
239
+ expect(typeof onSourceOpenListener).toBe(typeof Function);
240
+
241
+ onSourceOpenListener();
242
+
243
+ expect(revokeObjectURLSpy).toHaveBeenCalledWith('blob:foo');
244
+ });
214
245
  });
215
246
 
216
247
  describe('init', () => {
@@ -31,7 +31,8 @@ describe('RegionObserver', () => {
31
31
  timeline = new shaka.media.RegionTimeline(
32
32
  shaka.test.Util.spyFunc(onSeekRange));
33
33
 
34
- observer = new shaka.media.RegionObserver(timeline);
34
+ observer = new shaka.media.RegionObserver(
35
+ timeline, /* startsPastZero= */ false);
35
36
  observer.addEventListener('enter', (event) => {
36
37
  shaka.test.Util.spyFunc(onEnterRegion)(event['region'], event['seeking']);
37
38
  });
@@ -43,9 +43,10 @@ shaka.test.LayoutTests = class {
43
43
  });
44
44
  });
45
45
 
46
- // Wait one extra tick to make sure the font rendering on the page has been
47
- // updated. Without this, we saw some rare test flake in Firefox on Mac.
48
- await shaka.test.Util.shortDelay();
46
+ // Wait one extra second to make sure the font rendering on the page has
47
+ // been updated. Without this, we saw some rare test flake in Firefox on
48
+ // Mac.
49
+ await shaka.test.Util.delay(1);
49
50
  }
50
51
 
51
52
  /**
@@ -8,6 +8,7 @@
8
8
  goog.provide('shaka.ui.ResolutionSelection');
9
9
 
10
10
  goog.require('goog.asserts');
11
+ goog.require('shaka.Player');
11
12
  goog.require('shaka.ui.Controls');
12
13
  goog.require('shaka.ui.Enums');
13
14
  goog.require('shaka.ui.Locales');
@@ -67,7 +68,12 @@ shaka.ui.ResolutionSelection = class extends shaka.ui.SettingsMenu {
67
68
  /** @private */
68
69
  updateResolutionSelection_() {
69
70
  /** @type {!Array.<shaka.extern.Track>} */
70
- let tracks = this.player.getVariantTracks();
71
+ let tracks = [];
72
+ // When played with src=, the variant tracks available from
73
+ // player.getVariantTracks() represent languages, not resolutions.
74
+ if (this.player.getLoadMode() != shaka.Player.LoadMode.SRC_EQUALS) {
75
+ tracks = this.player.getVariantTracks();
76
+ }
71
77
 
72
78
  // If there is a selected variant track, then we filter out any tracks in
73
79
  // a different language. Then we use those remaining tracks to display the