@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 CHANGED
@@ -4296,7 +4296,7 @@ function configureVinylGlobal(options) {
4296
4296
  var import_vinyl_util32 = require("@amazon/vinyl-util");
4297
4297
  var vinylVersion = /* @__PURE__ */ (0, import_vinyl_util32.parseVersion)(
4298
4298
  /* istanbul ignore next */
4299
- "4.0.0"
4299
+ "4.1.0"
4300
4300
  );
4301
4301
 
4302
4302
  // src/global/globalRef.ts
@@ -4500,8 +4500,8 @@ function createStallMonitor(controller, callbacks, options = {}) {
4500
4500
  var _a, _b;
4501
4501
  const stallThresholdMs = ((_a = options.stallThreshold) != null ? _a : 1) * 1e3;
4502
4502
  const pollIntervalMs = ((_b = options.pollInterval) != null ? _b : 0.25) * 1e3;
4503
- let observedPlaying = false;
4504
4503
  let lastProgressAt = Date.now();
4504
+ let lastProgressPosition = controller.currentTime;
4505
4505
  let inStall = false;
4506
4506
  let pollId = null;
4507
4507
  const { add, dispose } = (0, import_vinyl_util35.createDisposer)();
@@ -4522,10 +4522,19 @@ function createStallMonitor(controller, callbacks, options = {}) {
4522
4522
  pollId = null;
4523
4523
  };
4524
4524
  add(stopPoll);
4525
+ const markProgress = () => {
4526
+ lastProgressAt = Date.now();
4527
+ lastProgressPosition = controller.currentTime;
4528
+ };
4525
4529
  const startPoll = () => {
4526
4530
  if (pollId != null) return;
4527
4531
  pollId = setInterval(() => {
4528
- if (inStall || !observedPlaying) return;
4532
+ if (controller.currentTime - lastProgressPosition > PROGRESS_EPSILON) {
4533
+ if (inStall) endStall("playing" /* PLAYING */);
4534
+ markProgress();
4535
+ return;
4536
+ }
4537
+ if (inStall) return;
4529
4538
  if (Date.now() - lastProgressAt >= stallThresholdMs) {
4530
4539
  inStall = true;
4531
4540
  callbacks.onStallEntered();
@@ -4534,14 +4543,12 @@ function createStallMonitor(controller, callbacks, options = {}) {
4534
4543
  };
4535
4544
  const suspend = (reason) => {
4536
4545
  endStall(reason);
4537
- observedPlaying = false;
4538
4546
  stopPoll();
4539
4547
  };
4540
4548
  add(
4541
4549
  controller.on("playing", () => {
4542
4550
  if (inStall) endStall("playing" /* PLAYING */);
4543
- lastProgressAt = Date.now();
4544
- observedPlaying = true;
4551
+ markProgress();
4545
4552
  startPoll();
4546
4553
  })
4547
4554
  );
@@ -4550,7 +4557,7 @@ function createStallMonitor(controller, callbacks, options = {}) {
4550
4557
  if (previous != null && current - previous <= PROGRESS_EPSILON)
4551
4558
  return;
4552
4559
  if (inStall) endStall("playing" /* PLAYING */);
4553
- lastProgressAt = Date.now();
4560
+ markProgress();
4554
4561
  })
4555
4562
  );
4556
4563
  add(controller.on("pause", () => suspend("pause" /* PAUSE */)));