@amazon/vinyl 4.0.1-next.20261017024550 → 4.1.0
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 +14 -7
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +14 -7
- package/dist/index.js.map +2 -2
- package/dist/test/integ.es5.js +131 -131
- package/dist/test/integ.js +54 -8
- package/dist/test/integ.js.map +2 -2
- package/dist/types/current/playback/createStallMonitor.d.ts +11 -6
- package/dist/types/current/playback/createStallMonitor.d.ts.map +1 -1
- package/dist/types/current/playback/createStallMonitor.js +29 -11
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ts3.7/playback/createStallMonitor.d.ts +11 -6
- package/dist/types/ts4.1/playback/createStallMonitor.d.ts +11 -6
- package/dist/types/ts4.7/playback/createStallMonitor.d.ts +11 -6
- package/dist/unit/types/current/playback/createStallMonitor.test.js +43 -1
- 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.js
CHANGED
|
@@ -4105,7 +4105,7 @@ function configureVinylGlobal(options) {
|
|
|
4105
4105
|
import { parseVersion } from "@amazon/vinyl-util";
|
|
4106
4106
|
var vinylVersion = /* @__PURE__ */ parseVersion(
|
|
4107
4107
|
/* istanbul ignore next */
|
|
4108
|
-
"4.
|
|
4108
|
+
"4.1.0"
|
|
4109
4109
|
);
|
|
4110
4110
|
|
|
4111
4111
|
// src/global/globalRef.ts
|
|
@@ -4315,8 +4315,8 @@ function createStallMonitor(controller, callbacks, options = {}) {
|
|
|
4315
4315
|
var _a, _b;
|
|
4316
4316
|
const stallThresholdMs = ((_a = options.stallThreshold) != null ? _a : 1) * 1e3;
|
|
4317
4317
|
const pollIntervalMs = ((_b = options.pollInterval) != null ? _b : 0.25) * 1e3;
|
|
4318
|
-
let observedPlaying = false;
|
|
4319
4318
|
let lastProgressAt = Date.now();
|
|
4319
|
+
let lastProgressPosition = controller.currentTime;
|
|
4320
4320
|
let inStall = false;
|
|
4321
4321
|
let pollId = null;
|
|
4322
4322
|
const { add, dispose } = createDisposer4();
|
|
@@ -4337,10 +4337,19 @@ function createStallMonitor(controller, callbacks, options = {}) {
|
|
|
4337
4337
|
pollId = null;
|
|
4338
4338
|
};
|
|
4339
4339
|
add(stopPoll);
|
|
4340
|
+
const markProgress = () => {
|
|
4341
|
+
lastProgressAt = Date.now();
|
|
4342
|
+
lastProgressPosition = controller.currentTime;
|
|
4343
|
+
};
|
|
4340
4344
|
const startPoll = () => {
|
|
4341
4345
|
if (pollId != null) return;
|
|
4342
4346
|
pollId = setInterval(() => {
|
|
4343
|
-
if (
|
|
4347
|
+
if (controller.currentTime - lastProgressPosition > PROGRESS_EPSILON) {
|
|
4348
|
+
if (inStall) endStall("playing" /* PLAYING */);
|
|
4349
|
+
markProgress();
|
|
4350
|
+
return;
|
|
4351
|
+
}
|
|
4352
|
+
if (inStall) return;
|
|
4344
4353
|
if (Date.now() - lastProgressAt >= stallThresholdMs) {
|
|
4345
4354
|
inStall = true;
|
|
4346
4355
|
callbacks.onStallEntered();
|
|
@@ -4349,14 +4358,12 @@ function createStallMonitor(controller, callbacks, options = {}) {
|
|
|
4349
4358
|
};
|
|
4350
4359
|
const suspend = (reason) => {
|
|
4351
4360
|
endStall(reason);
|
|
4352
|
-
observedPlaying = false;
|
|
4353
4361
|
stopPoll();
|
|
4354
4362
|
};
|
|
4355
4363
|
add(
|
|
4356
4364
|
controller.on("playing", () => {
|
|
4357
4365
|
if (inStall) endStall("playing" /* PLAYING */);
|
|
4358
|
-
|
|
4359
|
-
observedPlaying = true;
|
|
4366
|
+
markProgress();
|
|
4360
4367
|
startPoll();
|
|
4361
4368
|
})
|
|
4362
4369
|
);
|
|
@@ -4365,7 +4372,7 @@ function createStallMonitor(controller, callbacks, options = {}) {
|
|
|
4365
4372
|
if (previous != null && current - previous <= PROGRESS_EPSILON)
|
|
4366
4373
|
return;
|
|
4367
4374
|
if (inStall) endStall("playing" /* PLAYING */);
|
|
4368
|
-
|
|
4375
|
+
markProgress();
|
|
4369
4376
|
})
|
|
4370
4377
|
);
|
|
4371
4378
|
add(controller.on("pause", () => suspend("pause" /* PAUSE */)));
|