@f8team/reel-core 1.1.0 → 1.1.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/CHANGELOG.md +24 -0
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.cts
CHANGED
|
@@ -269,7 +269,7 @@ interface PlayerEvents {
|
|
|
269
269
|
* Time progress. Fires on every native `timeupdate`; plugins can throttle.
|
|
270
270
|
*
|
|
271
271
|
* - `currentTime` — wall-clock playback position.
|
|
272
|
-
* - `playedSeconds` — alias kept for parity with the
|
|
272
|
+
* - `playedSeconds` — alias kept for parity with the player F8 used before Reel.
|
|
273
273
|
* - `duration` — current duration (matches `state.duration`).
|
|
274
274
|
*/
|
|
275
275
|
timeupdate: {
|
package/dist/index.d.ts
CHANGED
|
@@ -269,7 +269,7 @@ interface PlayerEvents {
|
|
|
269
269
|
* Time progress. Fires on every native `timeupdate`; plugins can throttle.
|
|
270
270
|
*
|
|
271
271
|
* - `currentTime` — wall-clock playback position.
|
|
272
|
-
* - `playedSeconds` — alias kept for parity with the
|
|
272
|
+
* - `playedSeconds` — alias kept for parity with the player F8 used before Reel.
|
|
273
273
|
* - `duration` — current duration (matches `state.duration`).
|
|
274
274
|
*/
|
|
275
275
|
timeupdate: {
|
package/dist/index.js
CHANGED
|
@@ -398,6 +398,12 @@ var HlsLoader = class {
|
|
|
398
398
|
this.rejectAttach = null;
|
|
399
399
|
this.manifestTimeout = null;
|
|
400
400
|
this.aborted = false;
|
|
401
|
+
/**
|
|
402
|
+
* Bumped by every abort/detach. `detach()` clears `aborted` so the loader can be reused, so a
|
|
403
|
+
* source switch (abort, then detach) used to let an attach that was still awaiting the runtime
|
|
404
|
+
* carry on and bind a stale hls.js instance to the <video>. Each attach keeps its own value.
|
|
405
|
+
*/
|
|
406
|
+
this.generation = 0;
|
|
401
407
|
this.lastLoadingFragmentKey = null;
|
|
402
408
|
this.repeatedFragmentLoadCount = 0;
|
|
403
409
|
this.repeatedFragmentErrorFired = false;
|
|
@@ -416,11 +422,12 @@ var HlsLoader = class {
|
|
|
416
422
|
async attach(video, source) {
|
|
417
423
|
this.detach();
|
|
418
424
|
this.aborted = false;
|
|
425
|
+
const generation = this.generation;
|
|
419
426
|
this.video = video;
|
|
420
427
|
this.currentSource = source;
|
|
421
428
|
this.unauthorizedFired = false;
|
|
422
429
|
const Hls = await (this.options.loadRuntime ?? defaultLoad)();
|
|
423
|
-
if (this.aborted) {
|
|
430
|
+
if (this.aborted || generation !== this.generation) {
|
|
424
431
|
throw makeAbortError();
|
|
425
432
|
}
|
|
426
433
|
if (!Hls.isSupported()) {
|
|
@@ -731,6 +738,7 @@ var HlsLoader = class {
|
|
|
731
738
|
this.abortLiveXhrs();
|
|
732
739
|
}
|
|
733
740
|
abort() {
|
|
741
|
+
this.generation += 1;
|
|
734
742
|
if (this.aborted) return;
|
|
735
743
|
this.aborted = true;
|
|
736
744
|
this.clearManifestTimeout();
|
|
@@ -1064,17 +1072,24 @@ var YouTubeLoader = class {
|
|
|
1064
1072
|
this.duration = 0;
|
|
1065
1073
|
this.rejectAttach = null;
|
|
1066
1074
|
this.aborted = false;
|
|
1075
|
+
/**
|
|
1076
|
+
* Bumped by every abort/detach. `detach()` clears `aborted` so the loader can be reused, so a
|
|
1077
|
+
* source switch (abort, then detach) used to let an attach that was still awaiting the runtime
|
|
1078
|
+
* carry on and mount a second iframe. Each attach keeps the value it started with instead.
|
|
1079
|
+
*/
|
|
1080
|
+
this.generation = 0;
|
|
1067
1081
|
}
|
|
1068
1082
|
async attach(video, source) {
|
|
1069
1083
|
this.detach();
|
|
1070
1084
|
this.aborted = false;
|
|
1085
|
+
const generation = this.generation;
|
|
1071
1086
|
const id = extractYouTubeId(source.src);
|
|
1072
1087
|
if (!id) {
|
|
1073
1088
|
throw new Error(`Cannot extract YouTube videoId from "${source.src}"`);
|
|
1074
1089
|
}
|
|
1075
1090
|
this.video = video;
|
|
1076
1091
|
const YT = await (this.options.loadRuntime ?? defaultLoad2)();
|
|
1077
|
-
if (this.aborted) {
|
|
1092
|
+
if (this.aborted || generation !== this.generation) {
|
|
1078
1093
|
throw makeYtAbortError();
|
|
1079
1094
|
}
|
|
1080
1095
|
const parent = video.parentElement;
|
|
@@ -1170,6 +1185,7 @@ var YouTubeLoader = class {
|
|
|
1170
1185
|
});
|
|
1171
1186
|
}
|
|
1172
1187
|
abort() {
|
|
1188
|
+
this.generation += 1;
|
|
1173
1189
|
if (this.aborted) return;
|
|
1174
1190
|
this.aborted = true;
|
|
1175
1191
|
const reject = this.rejectAttach;
|