@amazon/vinyl 1.2.1 → 1.2.2

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 (89) hide show
  1. package/dist/index.cjs +13 -4
  2. package/dist/index.cjs.map +2 -2
  3. package/dist/index.js +18 -9
  4. package/dist/index.js.map +3 -3
  5. package/dist/test/integ.es5.js +60 -60
  6. package/dist/test/integ.js +49 -4
  7. package/dist/test/integ.js.map +2 -2
  8. package/dist/types/current/ad/AdBreakInfo.d.ts.map +1 -1
  9. package/dist/types/current/ad/AdControllerImpl.d.ts +18 -2
  10. package/dist/types/current/ad/AdControllerImpl.d.ts.map +1 -1
  11. package/dist/types/current/ad/AdControllerImpl.js +58 -22
  12. package/dist/types/current/ad/discoverHlsInterstitials.d.ts.map +1 -1
  13. package/dist/types/current/ad/discoverHlsInterstitials.js +5 -3
  14. package/dist/types/current/drm/DrmControllerImpl.d.ts +6 -0
  15. package/dist/types/current/drm/DrmControllerImpl.d.ts.map +1 -1
  16. package/dist/types/current/drm/DrmControllerImpl.js +13 -1
  17. package/dist/types/current/playback/createStallDetector.d.ts +43 -0
  18. package/dist/types/current/playback/createStallDetector.d.ts.map +1 -0
  19. package/dist/types/current/playback/createStallDetector.js +101 -0
  20. package/dist/types/current/playback/createStallMonitor.d.ts +45 -0
  21. package/dist/types/current/playback/createStallMonitor.d.ts.map +1 -0
  22. package/dist/types/current/playback/createStallMonitor.js +99 -0
  23. package/dist/types/current/streaming/AudioOptions.d.ts +27 -0
  24. package/dist/types/current/streaming/AudioOptions.d.ts.map +1 -1
  25. package/dist/types/current/streaming/AudioOptions.js +5 -1
  26. package/dist/types/current/streaming/LoadMetric.d.ts +15 -1
  27. package/dist/types/current/streaming/LoadMetric.d.ts.map +1 -1
  28. package/dist/types/current/streaming/createTimelineContentTypesValue.d.ts +21 -0
  29. package/dist/types/current/streaming/createTimelineContentTypesValue.d.ts.map +1 -0
  30. package/dist/types/current/streaming/createTimelineContentTypesValue.js +25 -0
  31. package/dist/types/current/text/SidecarTextTrackLoader.d.ts.map +1 -1
  32. package/dist/types/current/text/SidecarTextTrackLoader.js +4 -4
  33. package/dist/types/current/text/TextTrack.d.ts.map +1 -1
  34. package/dist/types/current/text/discoverDashTextTracks.d.ts +2 -2
  35. package/dist/types/current/text/discoverDashTextTracks.js +4 -3
  36. package/dist/types/current/text/parseWebVtt.d.ts.map +1 -1
  37. package/dist/types/current/text/parseWebVtt.js +3 -2
  38. package/dist/types/current/track/mse/MseTrack.d.ts +0 -1
  39. package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
  40. package/dist/types/current/track/mse/MseTrack.js +4 -5
  41. package/dist/types/current/tsconfig.tsbuildinfo +1 -1
  42. package/dist/types/ts3.7/ad/AdControllerImpl.d.ts +18 -2
  43. package/dist/types/ts3.7/drm/DrmControllerImpl.d.ts +6 -0
  44. package/dist/types/ts3.7/playback/createStallDetector.d.ts +43 -0
  45. package/dist/types/ts3.7/playback/createStallMonitor.d.ts +45 -0
  46. package/dist/types/ts3.7/streaming/AudioOptions.d.ts +27 -0
  47. package/dist/types/ts3.7/streaming/LoadMetric.d.ts +15 -1
  48. package/dist/types/ts3.7/streaming/createTimelineContentTypesValue.d.ts +21 -0
  49. package/dist/types/ts3.7/text/discoverDashTextTracks.d.ts +2 -2
  50. package/dist/types/ts3.7/track/mse/MseTrack.d.ts +0 -1
  51. package/dist/types/ts4.1/ad/AdControllerImpl.d.ts +18 -2
  52. package/dist/types/ts4.1/drm/DrmControllerImpl.d.ts +6 -0
  53. package/dist/types/ts4.1/playback/createStallDetector.d.ts +43 -0
  54. package/dist/types/ts4.1/playback/createStallMonitor.d.ts +45 -0
  55. package/dist/types/ts4.1/streaming/AudioOptions.d.ts +27 -0
  56. package/dist/types/ts4.1/streaming/LoadMetric.d.ts +15 -1
  57. package/dist/types/ts4.1/streaming/createTimelineContentTypesValue.d.ts +21 -0
  58. package/dist/types/ts4.1/text/discoverDashTextTracks.d.ts +2 -2
  59. package/dist/types/ts4.1/track/mse/MseTrack.d.ts +0 -1
  60. package/dist/types/ts4.7/ad/AdControllerImpl.d.ts +18 -2
  61. package/dist/types/ts4.7/drm/DrmControllerImpl.d.ts +6 -0
  62. package/dist/types/ts4.7/playback/createStallDetector.d.ts +43 -0
  63. package/dist/types/ts4.7/playback/createStallMonitor.d.ts +45 -0
  64. package/dist/types/ts4.7/streaming/AudioOptions.d.ts +27 -0
  65. package/dist/types/ts4.7/streaming/LoadMetric.d.ts +15 -1
  66. package/dist/types/ts4.7/streaming/createTimelineContentTypesValue.d.ts +21 -0
  67. package/dist/types/ts4.7/text/discoverDashTextTracks.d.ts +2 -2
  68. package/dist/types/ts4.7/track/mse/MseTrack.d.ts +0 -1
  69. package/dist/unit/types/current/ad/AdControllerImpl.test.js +203 -5
  70. package/dist/unit/types/current/ad/discoverHlsInterstitials.test.js +2 -1
  71. package/dist/unit/types/current/drm/DrmControllerImpl.test.js +30 -1
  72. package/dist/unit/types/current/playback/createStallDetector.test.d.ts +2 -0
  73. package/dist/unit/types/current/playback/createStallDetector.test.d.ts.map +1 -0
  74. package/dist/unit/types/current/playback/createStallDetector.test.js +163 -0
  75. package/dist/unit/types/current/playback/createStallMonitor.test.d.ts +2 -0
  76. package/dist/unit/types/current/playback/createStallMonitor.test.d.ts.map +1 -0
  77. package/dist/unit/types/current/playback/createStallMonitor.test.js +163 -0
  78. package/dist/unit/types/current/streaming/MseTrack.test.js +15 -0
  79. package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.d.ts +2 -0
  80. package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.d.ts.map +1 -0
  81. package/dist/unit/types/current/streaming/createTimelineContentTypesValue.test.js +57 -0
  82. package/dist/unit/types/current/text/TextTrack.test.d.ts +2 -0
  83. package/dist/unit/types/current/text/TextTrack.test.d.ts.map +1 -0
  84. package/dist/unit/types/current/text/TextTrack.test.js +12 -0
  85. package/dist/unit/types/current/text/discoverDashTextTracks.test.js +17 -0
  86. package/dist/unit/types/current/text/parseWebVtt.test.js +26 -0
  87. package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
  88. package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
  89. package/package.json +9 -9
@@ -13362,7 +13362,6 @@ ${(_a3 = this.failedResult.failedExpectations[0]) == null ? void 0 : _a3.message
13362
13362
  const deps = depsContainer.dependencies;
13363
13363
  super(uri, type, deps);
13364
13364
  __publicField(this, "streams", []);
13365
- __publicField(this, "disposeAbort", new Abort());
13366
13365
  __publicField(this, "lastPreloadOptions", null);
13367
13366
  __publicField(this, "activateOptions", null);
13368
13367
  __publicField(this, "allFetchedRanges", []);
@@ -13397,14 +13396,14 @@ ${(_a3 = this.failedResult.failedExpectations[0]) == null ? void 0 : _a3.message
13397
13396
  if (this.activateOptions) {
13398
13397
  this.deps.drmController.initializeForPlayback(
13399
13398
  event.current,
13400
- this.disposeAbort
13399
+ this.drmSessionAbort.value
13401
13400
  );
13402
13401
  }
13403
13402
  });
13404
13403
  this.on("bufferingQualityChange", (event) => {
13405
13404
  this.deps.drmController.setBufferingDrmInfo(
13406
13405
  event.current,
13407
- this.disposeAbort
13406
+ this.drmSessionAbort.value
13408
13407
  );
13409
13408
  });
13410
13409
  add(
@@ -13560,7 +13559,7 @@ ${(_a3 = this.failedResult.failedExpectations[0]) == null ? void 0 : _a3.message
13560
13559
  this.streams.forEach((stream) => {
13561
13560
  this.deps.drmController.initializeForPlayback(
13562
13561
  stream.streamingQuality,
13563
- this.disposeAbort
13562
+ this.drmSessionAbort.value
13564
13563
  );
13565
13564
  });
13566
13565
  this.deps.playbackSource.src = this.deps.mediaSourceController.createUrl();
@@ -20587,6 +20586,7 @@ ${(_a3 = this.failedResult.failedExpectations[0]) == null ? void 0 : _a3.message
20587
20586
  // src/drm/DrmControllerImpl.ts
20588
20587
  var LICENSE_TIMEOUT = 90;
20589
20588
  var LICENSE_TIMEOUT_MESSAGE = "License provider timed out after {time}s";
20589
+ var EXCESSIVE_SESSION_COUNT = 20;
20590
20590
  var DrmControllerImpl = class extends EventHostImpl {
20591
20591
  constructor(deps, options) {
20592
20592
  super();
@@ -20768,12 +20768,20 @@ ${(_a3 = this.failedResult.failedExpectations[0]) == null ? void 0 : _a3.message
20768
20768
  keySystemOptions == null ? void 0 : keySystemOptions.initDataTransformer
20769
20769
  );
20770
20770
  this.sessions.push(newSession);
20771
+ logVerbose(this, `total sessions: ${this.sessions.length}`);
20772
+ if (this.sessions.length === EXCESSIVE_SESSION_COUNT + 1) {
20773
+ logWarn(
20774
+ this,
20775
+ `${this.sessions.length} open key sessions exceeds ${EXCESSIVE_SESSION_COUNT}; sessions may be leaking (not closing on track deactivation)`
20776
+ );
20777
+ }
20771
20778
  this.dispatch("sessionCreate", {
20772
20779
  initDataType: newSession.initDataType,
20773
20780
  mimeType: newSession.mimeType
20774
20781
  });
20775
20782
  newSession.on("closed", () => this.closeSession(newSession));
20776
20783
  abort == null ? void 0 : abort.onAborted(() => {
20784
+ if (this.disposed) return;
20777
20785
  logDebug(this, "abort session");
20778
20786
  this.closeSession(newSession);
20779
20787
  });
@@ -34023,6 +34031,16 @@ ${(_a3 = this.failedResult.failedExpectations[0]) == null ? void 0 : _a3.message
34023
34031
  expect(deps.playbackSource.load).toHaveBeenCalledOnceWith();
34024
34032
  expect(deps.playbackController.pause).toHaveBeenCalledOnceWith();
34025
34033
  });
34034
+ it("aborts the drm session abort so key sessions close", async () => {
34035
+ track = createTrack();
34036
+ await awaitContentTypes();
34037
+ getAudioStream().streamingQuality = createEmptyMediaQualityMetadata();
34038
+ track.activate({});
34039
+ const abort = deps.drmController.initializeForPlayback.calls.mostRecent().args[1];
34040
+ expect(abort.aborted()).toBeFalse();
34041
+ track.deactivate();
34042
+ expect(abort.aborted()).toBeTrue();
34043
+ });
34026
34044
  });
34027
34045
  describe("error", () => {
34028
34046
  it("returns the first emitted error", async () => {
@@ -39601,6 +39619,16 @@ ${(_a3 = this.failedResult.failedExpectations[0]) == null ? void 0 : _a3.message
39601
39619
  ).toEqual([1, 1, 1, 1, 1, 1]);
39602
39620
  expect(drmController.activeSessions).toEqual(0);
39603
39621
  });
39622
+ it("does not close sessions again after dispose", async () => {
39623
+ const abort = new Abort();
39624
+ drmController.setBufferingDrmInfo(drmInfo, abort);
39625
+ await emitEncrypted();
39626
+ const session = mediaKeys.createSession.calls.mostRecent().returnValue;
39627
+ drmController.dispose();
39628
+ const disposeCount = session.dispose.calls.count();
39629
+ abort.abort();
39630
+ expect(session.dispose.calls.count()).toBe(disposeCount);
39631
+ });
39604
39632
  });
39605
39633
  });
39606
39634
  describe("when an encrypted event is observed", () => {
@@ -40436,6 +40464,23 @@ ${(_a3 = this.failedResult.failedExpectations[0]) == null ? void 0 : _a3.message
40436
40464
  expect(drmController.isEmeSupported()).toBeFalse();
40437
40465
  });
40438
40466
  });
40467
+ describe("excessive sessions", () => {
40468
+ it("warns once when the open session count exceeds the threshold", async () => {
40469
+ drmController.setBufferingDrmInfo(drmInfo);
40470
+ for (let i = 0; i < EXCESSIVE_SESSION_COUNT; i++) {
40471
+ await emitEncrypted(new Uint8Array([i]));
40472
+ }
40473
+ expect(drmController.activeSessions).toBe(EXCESSIVE_SESSION_COUNT);
40474
+ expect(logger.value.warn).not.toHaveBeenCalled();
40475
+ await emitEncrypted(new Uint8Array([EXCESSIVE_SESSION_COUNT]));
40476
+ expect(drmController.activeSessions).toBe(
40477
+ EXCESSIVE_SESSION_COUNT + 1
40478
+ );
40479
+ expect(logger.value.warn).toHaveBeenCalledTimes(1);
40480
+ await emitEncrypted(new Uint8Array([EXCESSIVE_SESSION_COUNT + 1]));
40481
+ expect(logger.value.warn).toHaveBeenCalledTimes(1);
40482
+ });
40483
+ });
40439
40484
  describe("closeSessions", () => {
40440
40485
  it("clears active sessions", async () => {
40441
40486
  const sessionCloseSpy = createEventSpy(