@shotstack/shotstack-studio 2.19.4 → 2.19.5
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 +25 -8
- package/dist/internal.umd.js +23 -23
- package/dist/shotstack-studio.es.js +26 -9
- package/dist/shotstack-studio.umd.js +2 -2
- package/package.json +1 -1
package/dist/internal.es.js
CHANGED
|
@@ -42442,11 +42442,13 @@ class XL extends nr {
|
|
|
42442
42442
|
this.volumeKeyframeBuilder = new fa(n.volume ?? 1, this.getLength()), this.syncTimer = 0, this.activeSyncTimer = 0, this.skipVideoUpdate = !1;
|
|
42443
42443
|
}
|
|
42444
42444
|
async load() {
|
|
42445
|
-
await super.load();
|
|
42445
|
+
this.skipVideoUpdate = !0, await super.load();
|
|
42446
42446
|
try {
|
|
42447
42447
|
await this.loadVideo(), this.configureKeyframes();
|
|
42448
42448
|
} catch (e) {
|
|
42449
42449
|
console.warn(`[VideoPlayer.load] FAILED clipId=${this.clipId}:`, e), this.createFallbackGraphic();
|
|
42450
|
+
} finally {
|
|
42451
|
+
this.skipVideoUpdate = !1;
|
|
42450
42452
|
}
|
|
42451
42453
|
}
|
|
42452
42454
|
createFallbackGraphic() {
|
|
@@ -42456,10 +42458,10 @@ class XL extends nr {
|
|
|
42456
42458
|
update(e, r) {
|
|
42457
42459
|
if (super.update(e, r), this.skipVideoUpdate || (this.syncTimer += r, !this.texture))
|
|
42458
42460
|
return;
|
|
42459
|
-
const n = this.getAssetSpeed(), i = this.getSourceTime(), a = this.edit.isPlaying && this.isActive() && n > 0;
|
|
42460
|
-
a && (this.isPlaying || (this.isPlaying = !0, this.activeSyncTimer = 0, this.texture.source.resource.volume = this.getVolume(), this.texture.source.resource.currentTime = i, this.texture.source.resource.play().catch(console.error)), this.texture.source.resource.volume !== this.getVolume() && (this.texture.source.resource.volume = this.getVolume()), this.texture.source.resource.playbackRate !== n && (this.texture.source.resource.playbackRate = n), this.activeSyncTimer += r, this.activeSyncTimer > 1e3 && (this.activeSyncTimer = 0, Math.abs(this.texture.source.resource.currentTime - i) >
|
|
42461
|
-
const
|
|
42462
|
-
(!this.edit.isPlaying || n === 0) && this.isActive() &&
|
|
42461
|
+
const n = this.getAssetSpeed(), i = this.getSourceTime(), a = this.edit.isPlaying && this.isActive() && n > 0, s = 0.3;
|
|
42462
|
+
a && (this.isPlaying || (this.isPlaying = !0, this.activeSyncTimer = 0, this.texture.source.resource.volume = this.getVolume(), Math.abs(this.texture.source.resource.currentTime - i) > s && (this.texture.source.resource.currentTime = i), this.texture.source.resource.play().catch(console.error)), this.texture.source.resource.volume !== this.getVolume() && (this.texture.source.resource.volume = this.getVolume()), this.texture.source.resource.playbackRate !== n && (this.texture.source.resource.playbackRate = n), this.activeSyncTimer += r, this.activeSyncTimer > 1e3 && (this.activeSyncTimer = 0, Math.abs(this.texture.source.resource.currentTime - i) > s && (this.texture.source.resource.currentTime = i))), !a && this.isPlaying && (this.isPlaying = !1, this.texture.source.resource.pause());
|
|
42463
|
+
const o = this.syncTimer > 100;
|
|
42464
|
+
(this.edit.playbackTime < this.getStart() || (!this.edit.isPlaying || n === 0) && this.isActive() && o) && (this.syncTimer = 0, Math.abs(this.texture.source.resource.currentTime - i) > 0.01 && (this.texture.source.resource.currentTime = i));
|
|
42463
42465
|
}
|
|
42464
42466
|
dispose() {
|
|
42465
42467
|
this.disposeVideo(), this.clearPlaceholder(), super.dispose();
|
|
@@ -42500,12 +42502,27 @@ class XL extends nr {
|
|
|
42500
42502
|
throw new Error(`Invalid video source '${r}'.`);
|
|
42501
42503
|
this.clearPlaceholder(), a.source.alphaMode = "no-premultiply-alpha", this.texture = this.createCroppedTexture(a);
|
|
42502
42504
|
const s = this.texture.source.resource;
|
|
42503
|
-
s instanceof HTMLVideoElement && s.readyState < 2 && await new Promise((o) => {
|
|
42505
|
+
if (s instanceof HTMLVideoElement && s.readyState < 2 && await new Promise((o) => {
|
|
42504
42506
|
const u = () => {
|
|
42505
42507
|
s.removeEventListener("loadeddata", u), o();
|
|
42506
42508
|
};
|
|
42507
42509
|
s.addEventListener("loadeddata", u), s.readyState >= 2 && o();
|
|
42508
|
-
}),
|
|
42510
|
+
}), s instanceof HTMLVideoElement) {
|
|
42511
|
+
const o = this.getSourceTime();
|
|
42512
|
+
if (Math.abs(s.currentTime - o) > 0.01) {
|
|
42513
|
+
const u = await new Promise((l) => {
|
|
42514
|
+
const c = ["seeked", "abort", "emptied", "error"], h = (d) => {
|
|
42515
|
+
for (const m of c) s.removeEventListener(m, h);
|
|
42516
|
+
l(d?.type);
|
|
42517
|
+
};
|
|
42518
|
+
for (const d of c) s.addEventListener(d, h);
|
|
42519
|
+
s.currentTime = o, s.seeking || h();
|
|
42520
|
+
});
|
|
42521
|
+
if (this.texture?.source.resource !== s || u === "abort" || u === "emptied") return;
|
|
42522
|
+
if (u === "error") throw new Error("Video seeking failed.");
|
|
42523
|
+
}
|
|
42524
|
+
}
|
|
42525
|
+
this.sprite = new st.Sprite(this.texture), this.contentContainer.addChild(this.sprite), this.texture.source.resource.volume = this.getVolume(), this.texture.source.resource.preservesPitch = !1;
|
|
42509
42526
|
}
|
|
42510
42527
|
disposeVideo() {
|
|
42511
42528
|
this.texture?.source?.resource && (this.texture.source.resource.pause(), this.texture.source.resource.src = "", this.texture.source.resource.load()), this.sprite && (this.contentContainer.removeChild(this.sprite), this.sprite.destroy(), this.sprite = null), this.texture && (this.texture.destroy(!0), this.texture = null);
|
|
@@ -45024,7 +45041,7 @@ class tU {
|
|
|
45024
45041
|
if (h) {
|
|
45025
45042
|
const d = this.updatePlayer(h, l, s);
|
|
45026
45043
|
d === "recreate" ? (this.disposePlayer(c), r.push(this.createPlayer(l, c, s, u)), n.disposed.push(c), n.created.push(c)) : d && n.updated.push(c);
|
|
45027
|
-
} else this.enableCreation && (this.createPlayer(l, c, s, u), n.created.push(c));
|
|
45044
|
+
} else this.enableCreation && (r.push(this.createPlayer(l, c, s, u)), n.created.push(c));
|
|
45028
45045
|
}
|
|
45029
45046
|
}
|
|
45030
45047
|
}
|