@shotstack/shotstack-studio 2.21.0 → 2.21.1
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/internal.es.js +28 -21
- package/dist/internal.umd.js +2 -2
- package/dist/shotstack-studio.es.js +29 -22
- package/dist/shotstack-studio.umd.js +3 -3
- package/package.json +1 -1
package/dist/internal.es.js
CHANGED
|
@@ -38405,6 +38405,7 @@ class Cl extends nr {
|
|
|
38405
38405
|
staticSprite = null;
|
|
38406
38406
|
hasTriggeredCapture = !1;
|
|
38407
38407
|
loadingGraphic = null;
|
|
38408
|
+
fallbackGraphic = null;
|
|
38408
38409
|
loadingSetProgress = null;
|
|
38409
38410
|
captureFramesDone = 0;
|
|
38410
38411
|
captureFramesTotal = 0;
|
|
@@ -38512,11 +38513,14 @@ ${e.stack}` : e), this.createFallbackGraphic();
|
|
|
38512
38513
|
this.mode = "editing", this.removeLoadingGraphic();
|
|
38513
38514
|
}
|
|
38514
38515
|
transitionToStale() {
|
|
38515
|
-
this.mode === "stale" || this.mode === "editing" || (this.playbackSprite && (this.contentContainer.removeChild(this.playbackSprite), this.playbackSprite.destroy(), this.playbackSprite = null), this.removeLoadingGraphic(), this.disposeCapturedFrames(), this.mode = "stale");
|
|
38516
|
+
this.mode === "stale" || this.mode === "editing" || (this.playbackSprite && (this.contentContainer.removeChild(this.playbackSprite), this.playbackSprite.destroy(), this.playbackSprite = null), this.removeLoadingGraphic(), this.removeFallbackGraphic(), this.disposeCapturedFrames(), this.mode = "stale");
|
|
38516
38517
|
}
|
|
38517
38518
|
transitionToCapturing() {
|
|
38518
38519
|
this.mode = "capturing", this.parkIframe(), this.mountLoadingGraphic(), this.emitCaptureStarted();
|
|
38519
38520
|
}
|
|
38521
|
+
transitionToFailed() {
|
|
38522
|
+
this.disposed || (this.mode = "failed", this.parkIframe(), this.removeLoadingGraphic(), this.createFallbackGraphic());
|
|
38523
|
+
}
|
|
38520
38524
|
// ─── capture pipeline ──────────────────────────────────────────────────────
|
|
38521
38525
|
async captureFrames() {
|
|
38522
38526
|
if (this.capturedFrames && this.capturedHash === this.contentHash)
|
|
@@ -38569,12 +38573,10 @@ ${e.stack}` : e), this.createFallbackGraphic();
|
|
|
38569
38573
|
}
|
|
38570
38574
|
captureIframeAsForeignObjectSvg(e, r) {
|
|
38571
38575
|
if (!this.iframe?.contentDocument) throw new Error("iframe not ready");
|
|
38572
|
-
const n = this.iframe.contentDocument, i = Array.from(n.querySelectorAll("style")).map((
|
|
38573
|
-
|
|
38574
|
-
const
|
|
38575
|
-
|
|
38576
|
-
const u = new XMLSerializer().serializeToString(s);
|
|
38577
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${r}"><foreignObject width="${e}" height="${r}">${i}${a}${u}</foreignObject></svg>`;
|
|
38576
|
+
const n = this.iframe.contentDocument, i = new XMLSerializer(), a = Array.from(n.querySelectorAll("style")).map((c) => i.serializeToString(c)).join(""), s = "<style>*,*::before,*::after{animation:none!important;transition:none!important}</style>", o = n.body.cloneNode(!0), u = o.getAttribute("style") ?? "";
|
|
38577
|
+
o.setAttribute("style", `width:${e}px;height:${r}px;margin:0;overflow:hidden;${u}`);
|
|
38578
|
+
const l = i.serializeToString(o);
|
|
38579
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${r}"><foreignObject width="${e}" height="${r}">${a}${s}${l}</foreignObject></svg>`;
|
|
38578
38580
|
}
|
|
38579
38581
|
async getDecodedFrame(e) {
|
|
38580
38582
|
if (!this.capturedFrames) return null;
|
|
@@ -38607,7 +38609,7 @@ ${e.stack}` : e), this.createFallbackGraphic();
|
|
|
38607
38609
|
*/
|
|
38608
38610
|
async prepareStaticRender() {
|
|
38609
38611
|
try {
|
|
38610
|
-
if (this.disposed || !this.iframe) return;
|
|
38612
|
+
if (this.disposed || !this.iframe || this.mode === "failed") return;
|
|
38611
38613
|
const e = await this.captureFrames();
|
|
38612
38614
|
if (this.disposed || !e || e.length === 0) return;
|
|
38613
38615
|
const r = Math.min(Math.max(0, Math.floor(this.getPlaybackTime() * this.captureFps)), e.length - 1), n = await this.getDecodedFrame(r);
|
|
@@ -38631,9 +38633,11 @@ ${e.stack}` : e), this.createFallbackGraphic();
|
|
|
38631
38633
|
if (e !== this.contentHash) {
|
|
38632
38634
|
this.contentHash = e, this.transitionToStale(), this.disposeCapturedFrames(), this.captureInFlight = null, this.hasTriggeredCapture = !1, this.seekErrorReported = !1, this.iframe.srcdoc = tg(this.asset);
|
|
38633
38635
|
try {
|
|
38634
|
-
await b1(this.iframe, void 0, !0), this.
|
|
38636
|
+
if (await b1(this.iframe, void 0, !0), this.disposed || this.contentHash !== e) return;
|
|
38637
|
+
this.beginCapture();
|
|
38635
38638
|
} catch (r) {
|
|
38636
|
-
|
|
38639
|
+
if (this.disposed || this.contentHash !== e) return;
|
|
38640
|
+
console.warn("[Html5Player] reload iframe load failed:", r), this.emitCaptureFailed(r, "static-placeholder"), this.transitionToFailed();
|
|
38637
38641
|
}
|
|
38638
38642
|
}
|
|
38639
38643
|
}
|
|
@@ -38642,31 +38646,34 @@ ${e.stack}` : e), this.createFallbackGraphic();
|
|
|
38642
38646
|
this.decodedFrames.clear(), this.capturedFrames = null, this.capturedHash = null, this.lastFrameIdx = -1, this.decodeInFlight = null;
|
|
38643
38647
|
}
|
|
38644
38648
|
createFallbackGraphic() {
|
|
38649
|
+
if (this.fallbackGraphic) return;
|
|
38645
38650
|
const e = this.clipConfiguration.width || this.edit.size.width, r = this.clipConfiguration.height || this.edit.size.height, n = Ho(e, r);
|
|
38646
|
-
this.renderedWidth = e, this.renderedHeight = r, this.contentContainer.addChild(n), this.configureKeyframes();
|
|
38651
|
+
this.fallbackGraphic = n, this.renderedWidth = e, this.renderedHeight = r, this.contentContainer.addChild(n), this.configureKeyframes();
|
|
38652
|
+
}
|
|
38653
|
+
removeFallbackGraphic() {
|
|
38654
|
+
this.fallbackGraphic && (this.contentContainer.removeChild(this.fallbackGraphic), this.fallbackGraphic.destroy(), this.fallbackGraphic = null);
|
|
38647
38655
|
}
|
|
38648
38656
|
update(e, r) {
|
|
38649
|
-
super.update(e, r), this.triggerCaptureIfNeeded(), this.mode === "playback" ? this.driveSpriteTextureSwap() : this.mode === "capturing" ? this.loadingSetProgress && this.captureFramesTotal > 0 && this.loadingSetProgress(this.captureFramesDone / this.captureFramesTotal) : this.iframe && (this.syncIframePosition(), this.isActive() && this.seekHarness(this.getPlaybackTime()));
|
|
38657
|
+
super.update(e, r), this.triggerCaptureIfNeeded(), this.mode === "playback" ? this.driveSpriteTextureSwap() : this.mode === "capturing" ? this.loadingSetProgress && this.captureFramesTotal > 0 && this.loadingSetProgress(this.captureFramesDone / this.captureFramesTotal) : this.iframe && this.mode !== "failed" && (this.syncIframePosition(), this.isActive() && this.seekHarness(this.getPlaybackTime()));
|
|
38650
38658
|
}
|
|
38651
38659
|
beginCapture() {
|
|
38652
38660
|
if (this.disposed || !this.iframe || this.mode === "capturing" || this.mode === "playback" || this.captureInFlight) return;
|
|
38661
|
+
const e = this.contentHash;
|
|
38653
38662
|
if (this.capturedFrames && this.capturedHash === this.contentHash) {
|
|
38654
38663
|
this.transitionToPlayback().catch((r) => {
|
|
38655
|
-
console.warn("[Html5Player] transitionToPlayback failed:", r), this.
|
|
38664
|
+
this.disposed || this.contentHash !== e || (console.warn("[Html5Player] transitionToPlayback failed:", r), this.emitCaptureFailed(r, "static-placeholder"), this.transitionToFailed());
|
|
38656
38665
|
});
|
|
38657
38666
|
return;
|
|
38658
38667
|
}
|
|
38659
|
-
this.transitionToCapturing()
|
|
38660
|
-
|
|
38661
|
-
|
|
38662
|
-
|
|
38663
|
-
if (!(!!r && r.length > 0 && this.capturedHash === e && this.contentHash === e)) {
|
|
38664
|
-
this.mode === "capturing" && this.transitionToEditing();
|
|
38668
|
+
this.transitionToCapturing(), this.captureFrames().then(async (r) => {
|
|
38669
|
+
if (this.disposed || this.contentHash !== e) return;
|
|
38670
|
+
if (!(!!r && r.length > 0 && this.capturedHash === e)) {
|
|
38671
|
+
this.mode === "capturing" && this.transitionToFailed();
|
|
38665
38672
|
return;
|
|
38666
38673
|
}
|
|
38667
38674
|
await this.transitionToPlayback();
|
|
38668
38675
|
}).catch((r) => {
|
|
38669
|
-
console.warn("[Html5Player] capture failed:", r), this.emitCaptureFailed(r, "
|
|
38676
|
+
this.disposed || this.contentHash !== e || (console.warn("[Html5Player] capture failed:", r), this.emitCaptureFailed(r, "static-placeholder"), this.mode === "capturing" && this.transitionToFailed());
|
|
38670
38677
|
});
|
|
38671
38678
|
}
|
|
38672
38679
|
triggerCaptureIfNeeded() {
|
|
@@ -38711,7 +38718,7 @@ ${e.stack}` : e), this.createFallbackGraphic();
|
|
|
38711
38718
|
k.left = `${b}px`, k.top = `${C}px`, k.width = `${n}px`, k.height = `${i}px`, k.transform = `scale(${I / n}, ${A / i})`, k.opacity = `${this.getOpacity()}`;
|
|
38712
38719
|
}
|
|
38713
38720
|
dispose() {
|
|
38714
|
-
this.disposed = !0, super.dispose(), this.iframe?.remove(), this.iframe = null, this.playbackSprite?.destroy(), this.playbackSprite = null, this.staticSprite?.destroy(), this.staticSprite = null, this.removeLoadingGraphic(), this.disposeCapturedFrames();
|
|
38721
|
+
this.disposed = !0, this.removeFallbackGraphic(), super.dispose(), this.iframe?.remove(), this.iframe = null, this.playbackSprite?.destroy(), this.playbackSprite = null, this.staticSprite?.destroy(), this.staticSprite = null, this.removeLoadingGraphic(), this.disposeCapturedFrames();
|
|
38715
38722
|
}
|
|
38716
38723
|
getSize() {
|
|
38717
38724
|
return this.clipConfiguration.width && this.clipConfiguration.height ? { width: this.clipConfiguration.width, height: this.clipConfiguration.height } : this.getContentSize();
|