@amazon/vinyl 3.2.1 → 3.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.
- package/dist/index.cjs +36 -22
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +61 -46
- package/dist/index.js.map +3 -3
- package/dist/test/integ.es5.js +285 -281
- package/dist/test/integ.js +69 -22
- package/dist/test/integ.js.map +2 -2
- package/dist/types/current/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/current/drm/DrmControllerImpl.d.ts.map +1 -1
- package/dist/types/current/drm/DrmControllerImpl.js +11 -1
- package/dist/types/current/playback/PlaybackControllerImpl.d.ts +8 -2
- package/dist/types/current/playback/PlaybackControllerImpl.d.ts.map +1 -1
- package/dist/types/current/playback/PlaybackControllerImpl.js +38 -33
- package/dist/types/current/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/current/track/mse/MseTrack.d.ts.map +1 -1
- package/dist/types/current/track/mse/MseTrack.js +5 -6
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ts3.7/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts3.7/playback/PlaybackControllerImpl.d.ts +8 -2
- package/dist/types/ts3.7/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/ts4.1/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts4.1/playback/PlaybackControllerImpl.d.ts +8 -2
- package/dist/types/ts4.1/track/mse/MseTrack.d.ts +0 -1
- package/dist/types/ts4.7/drm/DrmControllerImpl.d.ts +6 -0
- package/dist/types/ts4.7/playback/PlaybackControllerImpl.d.ts +8 -2
- package/dist/types/ts4.7/track/mse/MseTrack.d.ts +0 -1
- package/dist/unit/types/current/drm/DrmControllerImpl.test.js +19 -1
- package/dist/unit/types/current/playback/PlaybackControllerImpl.test.js +15 -0
- package/dist/unit/types/current/streaming/MseTrack.test.js +15 -0
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,7 @@ __export(index_exports, {
|
|
|
67
67
|
DrmError: () => DrmError,
|
|
68
68
|
DrmKeySystem: () => DrmKeySystem,
|
|
69
69
|
DrmRobustness: () => DrmRobustness,
|
|
70
|
+
EXCESSIVE_SESSION_COUNT: () => EXCESSIVE_SESSION_COUNT,
|
|
70
71
|
FAIR_PLAY_KEY_SYSTEMS: () => FAIR_PLAY_KEY_SYSTEMS,
|
|
71
72
|
FixedPlaybackQuality: () => FixedPlaybackQuality,
|
|
72
73
|
HtmlTextTrackRenderer: () => HtmlTextTrackRenderer,
|
|
@@ -2098,6 +2099,7 @@ function createFairPlaySessionInitData(initData, contentId, certificateData) {
|
|
|
2098
2099
|
// src/drm/DrmControllerImpl.ts
|
|
2099
2100
|
var LICENSE_TIMEOUT = 90;
|
|
2100
2101
|
var LICENSE_TIMEOUT_MESSAGE = "License provider timed out after {time}s";
|
|
2102
|
+
var EXCESSIVE_SESSION_COUNT = 20;
|
|
2101
2103
|
var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
2102
2104
|
constructor(deps, options) {
|
|
2103
2105
|
super();
|
|
@@ -2314,6 +2316,13 @@ var DrmControllerImpl = class extends import_vinyl_util24.EventHostImpl {
|
|
|
2314
2316
|
trackUri
|
|
2315
2317
|
});
|
|
2316
2318
|
this.sessions.push(newSession);
|
|
2319
|
+
(0, import_vinyl_util24.logVerbose)(this, `total sessions: ${this.sessions.length}`);
|
|
2320
|
+
if (this.sessions.length === EXCESSIVE_SESSION_COUNT + 1) {
|
|
2321
|
+
(0, import_vinyl_util24.logWarn)(
|
|
2322
|
+
this,
|
|
2323
|
+
`${this.sessions.length} open key sessions exceeds ${EXCESSIVE_SESSION_COUNT}; sessions may be leaking (not closing on track deactivation)`
|
|
2324
|
+
);
|
|
2325
|
+
}
|
|
2317
2326
|
this.dispatch("sessionCreate", {
|
|
2318
2327
|
initDataType: newSession.initDataType,
|
|
2319
2328
|
mimeType: newSession.mimeType
|
|
@@ -2825,7 +2834,7 @@ function configureVinylGlobal(options) {
|
|
|
2825
2834
|
var import_vinyl_util27 = require("@amazon/vinyl-util");
|
|
2826
2835
|
var vinylVersion = /* @__PURE__ */ (0, import_vinyl_util27.parseVersion)(
|
|
2827
2836
|
/* istanbul ignore next */
|
|
2828
|
-
"3.2.
|
|
2837
|
+
"3.2.2"
|
|
2829
2838
|
);
|
|
2830
2839
|
|
|
2831
2840
|
// src/global/globalRef.ts
|
|
@@ -3378,15 +3387,13 @@ var PlaybackControllerImpl = class extends import_vinyl_util42.EventHostImpl {
|
|
|
3378
3387
|
__publicField(this, "_playing", false);
|
|
3379
3388
|
__publicField(this, "_seeking", false);
|
|
3380
3389
|
__publicField(this, "_waiting", false);
|
|
3381
|
-
|
|
3382
|
-
__publicField(this, "_seekId", 0);
|
|
3390
|
+
__publicField(this, "seekAbortSlot", /* @__PURE__ */ (0, import_vinyl_util42.createAbortSlot)());
|
|
3383
3391
|
// Stops the stall detector started after the last seek, if any.
|
|
3384
3392
|
__publicField(this, "stopStallDetection", null);
|
|
3385
3393
|
// default user volume (0.0 to 1.0 scale)
|
|
3386
3394
|
__publicField(this, "userVolume", 1);
|
|
3387
3395
|
__publicField(this, "_pendingPlay", null);
|
|
3388
3396
|
__publicField(this, "playAbort", null);
|
|
3389
|
-
__publicField(this, "disposeAbort", /* @__PURE__ */ new import_vinyl_util42.Abort());
|
|
3390
3397
|
__publicField(this, "options");
|
|
3391
3398
|
this.options = __spreadValues(__spreadProps(__spreadValues({}, defaultPlaybackControllerImplOptions), {
|
|
3392
3399
|
minSeekableBuffer: getMinSeekableBufferDefault()
|
|
@@ -3397,8 +3404,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util42.EventHostImpl {
|
|
|
3397
3404
|
const { add } = this.disposer;
|
|
3398
3405
|
add(() => {
|
|
3399
3406
|
var _a;
|
|
3400
|
-
this.
|
|
3401
|
-
this.disposeAbort.dispose();
|
|
3407
|
+
this.seekAbortSlot.abort();
|
|
3402
3408
|
(_a = this.stopStallDetection) == null ? void 0 : _a.call(this);
|
|
3403
3409
|
});
|
|
3404
3410
|
this.domEvents = add(
|
|
@@ -3811,14 +3817,10 @@ var PlaybackControllerImpl = class extends import_vinyl_util42.EventHostImpl {
|
|
|
3811
3817
|
async seekTo(time, tolerance = 0.5) {
|
|
3812
3818
|
var _a;
|
|
3813
3819
|
(0, import_vinyl_util42.logDebug)(this, `seekTo: ${time}`);
|
|
3814
|
-
const seekId = ++this._seekId;
|
|
3815
3820
|
(_a = this.stopStallDetection) == null ? void 0 : _a.call(this);
|
|
3816
3821
|
this.stopStallDetection = null;
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
(0, import_vinyl_util42.logDebug)(this, `seekTo: ${time} superseded by a newer seek`);
|
|
3820
|
-
return true;
|
|
3821
|
-
};
|
|
3822
|
+
this.seekAbortSlot.abort();
|
|
3823
|
+
const seekAbort = this.seekAbortSlot.value;
|
|
3822
3824
|
const nextEvent = (type, options) => {
|
|
3823
3825
|
var _a2;
|
|
3824
3826
|
return (0, import_vinyl_util42.nextEventAsPromise)(this, type, {
|
|
@@ -3826,12 +3828,25 @@ var PlaybackControllerImpl = class extends import_vinyl_util42.EventHostImpl {
|
|
|
3826
3828
|
timeoutMessage: `seek timed out on ${type} event after {time}s`,
|
|
3827
3829
|
timeoutOrigin: import_vinyl_util42.ErrorOrigin.INTERNAL,
|
|
3828
3830
|
timeoutLevel: import_vinyl_util42.ErrorLevel.WARN,
|
|
3829
|
-
abort:
|
|
3831
|
+
abort: seekAbort
|
|
3830
3832
|
});
|
|
3831
3833
|
};
|
|
3834
|
+
try {
|
|
3835
|
+
await this.doSeek(time, tolerance, seekAbort, nextEvent);
|
|
3836
|
+
} catch (error) {
|
|
3837
|
+
if (seekAbort.aborted() && !this.disposed) return;
|
|
3838
|
+
throw error;
|
|
3839
|
+
}
|
|
3840
|
+
}
|
|
3841
|
+
/**
|
|
3842
|
+
* The body of a single {@link seekTo} attempt. Extracted so {@link seekTo}
|
|
3843
|
+
* can wrap it with per-seek abort/supersession handling. `seekAbort` is
|
|
3844
|
+
* aborted when a newer seek supersedes this one (or on dispose).
|
|
3845
|
+
* @private
|
|
3846
|
+
*/
|
|
3847
|
+
async doSeek(time, tolerance, seekAbort, nextEvent) {
|
|
3832
3848
|
if (!this.hasMetadata) {
|
|
3833
3849
|
await nextEvent("loadedMetadata");
|
|
3834
|
-
if (superseded()) return;
|
|
3835
3850
|
}
|
|
3836
3851
|
const seekable = this.seekable;
|
|
3837
3852
|
const range = seekable.getRangeAt(
|
|
@@ -3862,7 +3877,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util42.EventHostImpl {
|
|
|
3862
3877
|
);
|
|
3863
3878
|
} else {
|
|
3864
3879
|
const nullIfStuck = (error) => {
|
|
3865
|
-
if (this.
|
|
3880
|
+
if (this.disposed) throw error;
|
|
3866
3881
|
return null;
|
|
3867
3882
|
};
|
|
3868
3883
|
const seekOnce = async (reSeeking) => {
|
|
@@ -3876,7 +3891,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util42.EventHostImpl {
|
|
|
3876
3891
|
}).catch(nullIfStuck);
|
|
3877
3892
|
};
|
|
3878
3893
|
let seekedEvent = await seekOnce(false);
|
|
3879
|
-
for (let attempt = 0; !
|
|
3894
|
+
for (let attempt = 0; !seekAbort.aborted() && attempt < SEEK_RETRY_LIMIT && (seekedEvent === null || seekedEvent.reason === "seeked" && !(0, import_vinyl_util42.closeTo)(clampedTime, this.currentTime, tolerance)); attempt++) {
|
|
3880
3895
|
if (seekedEvent === null) void this.media.play().catch(import_vinyl_util42.noop);
|
|
3881
3896
|
(0, import_vinyl_util42.logDebug)(this, `seekTo: re-seeking to ${clampedTime}`);
|
|
3882
3897
|
seekedEvent = await seekOnce(true);
|
|
@@ -3884,7 +3899,7 @@ var PlaybackControllerImpl = class extends import_vinyl_util42.EventHostImpl {
|
|
|
3884
3899
|
if ((seekedEvent == null ? void 0 : seekedEvent.reason) === "emptied") {
|
|
3885
3900
|
throw new import_vinyl_util42.AbortError();
|
|
3886
3901
|
}
|
|
3887
|
-
if (!this.paused) this.startStallDetection();
|
|
3902
|
+
if (!this.paused && !seekAbort.aborted()) this.startStallDetection();
|
|
3888
3903
|
}
|
|
3889
3904
|
}
|
|
3890
3905
|
/**
|
|
@@ -7993,7 +8008,6 @@ var MseTrack = class extends TrackBase {
|
|
|
7993
8008
|
const deps = depsContainer.dependencies;
|
|
7994
8009
|
super(uri, type, deps);
|
|
7995
8010
|
__publicField(this, "streams", []);
|
|
7996
|
-
__publicField(this, "disposeAbort", /* @__PURE__ */ new import_vinyl_util80.Abort());
|
|
7997
8011
|
__publicField(this, "lastPreloadOptions", null);
|
|
7998
8012
|
__publicField(this, "allFetchedRanges", []);
|
|
7999
8013
|
__publicField(this, "_fetchedRanges", /* @__PURE__ */ new import_vinyl_util80.IntersectionRanges(
|
|
@@ -8018,7 +8032,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8018
8032
|
if (this.active) {
|
|
8019
8033
|
this.deps.drmController.initializeForPlayback(event.current, {
|
|
8020
8034
|
trackUri: this.uri,
|
|
8021
|
-
abort: this.
|
|
8035
|
+
abort: this.drmSessionAbort.value
|
|
8022
8036
|
});
|
|
8023
8037
|
}
|
|
8024
8038
|
});
|
|
@@ -8026,7 +8040,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8026
8040
|
if (event.current == null) return;
|
|
8027
8041
|
this.deps.drmController.setBufferingDrmInfo(event.current, {
|
|
8028
8042
|
trackUri: this.uri,
|
|
8029
|
-
abort: this.
|
|
8043
|
+
abort: this.drmSessionAbort.value
|
|
8030
8044
|
});
|
|
8031
8045
|
});
|
|
8032
8046
|
add(
|
|
@@ -8264,7 +8278,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8264
8278
|
this.streams.forEach((stream) => {
|
|
8265
8279
|
this.deps.drmController.initializeForPlayback(
|
|
8266
8280
|
stream.streamingQuality,
|
|
8267
|
-
{ trackUri: this.uri, abort: this.
|
|
8281
|
+
{ trackUri: this.uri, abort: this.drmSessionAbort.value }
|
|
8268
8282
|
);
|
|
8269
8283
|
});
|
|
8270
8284
|
this.deps.playbackSource.src = this.deps.mediaSourceController.activate();
|
|
@@ -8290,7 +8304,7 @@ var MseTrack = class extends TrackBase {
|
|
|
8290
8304
|
this.callOnStreams("deactivate");
|
|
8291
8305
|
this.deps.drmController.setBufferingDrmInfo(null, {
|
|
8292
8306
|
trackUri: this.uri,
|
|
8293
|
-
abort: this.
|
|
8307
|
+
abort: this.drmSessionAbort.value
|
|
8294
8308
|
});
|
|
8295
8309
|
(_b = this.deps.textTrackController) == null ? void 0 : _b.deactivate();
|
|
8296
8310
|
this.deps.playbackSource.src = null;
|