rx-player 4.3.0-dev.2025011000 → 4.3.0-dev.2025012900

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.
@@ -594,7 +594,7 @@ function loadOrReloadPreparedContent(
594
594
  );
595
595
 
596
596
  StreamOrchestrator(
597
- { initialPeriod: manifest.periods[0], manifest },
597
+ { initialPeriod, manifest },
598
598
  playbackObserver,
599
599
  representationEstimator,
600
600
  segmentSinksStore,
@@ -411,7 +411,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
411
411
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
412
412
  videoElement.preload = "auto";
413
413
 
414
- this.version = /* PLAYER_VERSION */ "4.3.0-dev.2025011000";
414
+ this.version = /* PLAYER_VERSION */ "4.3.0-dev.2025012900";
415
415
  this.log = log;
416
416
  this.state = "STOPPED";
417
417
  this.videoElement = videoElement;
@@ -3330,7 +3330,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
3330
3330
  }
3331
3331
  }
3332
3332
  }
3333
- Player.version = /* PLAYER_VERSION */ "4.3.0-dev.2025011000";
3333
+ Player.version = /* PLAYER_VERSION */ "4.3.0-dev.2025012900";
3334
3334
 
3335
3335
  /** Every events sent by the RxPlayer's public API. */
3336
3336
  interface IPublicAPIEvent {
@@ -171,15 +171,16 @@ export default class RebufferingController extends EventEmitter<IRebufferingCont
171
171
  if (position.isAwaitingFuturePosition()) {
172
172
  playbackRateUpdater.stopRebuffering();
173
173
  log.debug("Init: let rebuffering happen as we're awaiting a future position");
174
- this.trigger("stalled", stalledReason);
175
- return;
174
+ } else {
175
+ playbackRateUpdater.startRebuffering();
176
176
  }
177
177
 
178
- playbackRateUpdater.startRebuffering();
179
-
180
178
  if (
181
179
  this._manifest === null ||
182
180
  (isSeekingApproximate &&
181
+ // Don't handle discontinuities on devices with broken seeks before
182
+ // enough time have passed because seeking brings more risks to
183
+ // lead to a lengthy rebuffering-exiting process
183
184
  getMonotonicTimeStamp() - rebuffering.timestamp <= 1000)
184
185
  ) {
185
186
  this.trigger("stalled", stalledReason);
@@ -189,6 +190,16 @@ export default class RebufferingController extends EventEmitter<IRebufferingCont
189
190
  /** Position at which data is awaited. */
190
191
  const { position: stalledPosition } = rebuffering;
191
192
 
193
+ /**
194
+ * We may still be in the process of waiting for a position to be seeked
195
+ * to. When calculating a potential position to e.g. skip over
196
+ * discontinuities, we should compare it to that "target" position if
197
+ * one, not the one we're currently playing.
198
+ */
199
+ const targetTime = observation.position.isAwaitingFuturePosition()
200
+ ? observation.position.getWanted()
201
+ : this._playbackObserver.getCurrentTime();
202
+
192
203
  if (
193
204
  stalledPosition !== null &&
194
205
  stalledPosition !== undefined &&
@@ -201,10 +212,10 @@ export default class RebufferingController extends EventEmitter<IRebufferingCont
201
212
  );
202
213
  if (skippableDiscontinuity !== null) {
203
214
  const realSeekTime = skippableDiscontinuity + 0.001;
204
- if (realSeekTime <= this._playbackObserver.getCurrentTime()) {
215
+ if (realSeekTime <= targetTime) {
205
216
  log.info(
206
217
  "Init: position to seek already reached, no seeking",
207
- this._playbackObserver.getCurrentTime(),
218
+ targetTime,
208
219
  realSeekTime,
209
220
  );
210
221
  } else {
@@ -243,7 +254,7 @@ export default class RebufferingController extends EventEmitter<IRebufferingCont
243
254
  nextBufferRangeGap < BUFFER_DISCONTINUITY_THRESHOLD
244
255
  ) {
245
256
  const seekTo = positionBlockedAt + nextBufferRangeGap + EPSILON;
246
- if (this._playbackObserver.getCurrentTime() < seekTo) {
257
+ if (targetTime < seekTo) {
247
258
  log.warn(
248
259
  "Init: discontinuity encountered inferior to the threshold",
249
260
  positionBlockedAt,
@@ -266,8 +277,7 @@ export default class RebufferingController extends EventEmitter<IRebufferingCont
266
277
  if (period.end !== undefined && period.end <= positionBlockedAt) {
267
278
  if (
268
279
  this._manifest.periods[i + 1].start > positionBlockedAt &&
269
- this._manifest.periods[i + 1].start >
270
- this._playbackObserver.getCurrentTime()
280
+ this._manifest.periods[i + 1].start > targetTime
271
281
  ) {
272
282
  const nextPeriod = this._manifest.periods[i + 1];
273
283
  this._playbackObserver.setCurrentTime(nextPeriod.start);
package/vitest.config.mjs CHANGED
@@ -1,22 +1,4 @@
1
1
  import { defineConfig } from "vitest/config";
2
- import { promises as fs } from "fs";
3
-
4
- // https://github.com/tachibana-shin/vite-plugin-arraybuffer/blob/main/src/main.ts
5
- function vitePluginArraybuffer() {
6
- return {
7
- name: "array-buffer-loader",
8
- async load(id) {
9
- if (id.endsWith("?arraybuffer")) {
10
- const filePath = id.replace(/\?arraybuffer$/, "");
11
- const fileBuffer = await fs.readFile(filePath);
12
- return {
13
- code: `export default new Uint8Array([${new Uint8Array(fileBuffer).join(",")}]).buffer`,
14
- map: { mappings: "" },
15
- };
16
- }
17
- },
18
- };
19
- }
20
2
 
21
3
  function getBrowserConfig(browser) {
22
4
  switch (browser) {
@@ -69,7 +51,6 @@ function getBrowserConfig(browser) {
69
51
  }
70
52
 
71
53
  export default defineConfig({
72
- plugins: [vitePluginArraybuffer()],
73
54
  define: {
74
55
  // global variables
75
56
  __TEST_CONTENT_SERVER__: {