@inappstory/slide-api 0.1.43 → 0.1.45
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 +16 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2630,10 +2630,16 @@ const waitForImageHtmlElementLoad = async (nodeRef) => {
|
|
|
2630
2630
|
}));
|
|
2631
2631
|
}
|
|
2632
2632
|
nodeRef.removeEventListener("load", onLoad);
|
|
2633
|
+
nodeRef.removeEventListener("error", onError);
|
|
2634
|
+
};
|
|
2635
|
+
const onError = () => {
|
|
2636
|
+
nodeRef.removeEventListener("load", onLoad);
|
|
2637
|
+
nodeRef.removeEventListener("error", onError);
|
|
2638
|
+
reject(new Error(`Could not load (Network error) Image from URL: ${nodeRef.src}`));
|
|
2633
2639
|
};
|
|
2634
2640
|
nodeRef.addEventListener("load", onLoad);
|
|
2635
|
-
nodeRef.addEventListener("error",
|
|
2636
|
-
if (nodeRef.complete &&
|
|
2641
|
+
nodeRef.addEventListener("error", onError);
|
|
2642
|
+
if (nodeRef.complete && nodeRef.naturalHeight !== 0) {
|
|
2637
2643
|
if (nodeRef.decode != null) {
|
|
2638
2644
|
nodeRef.decode().then(() => resolve(nodeRef), reason => reject(reason));
|
|
2639
2645
|
}
|
|
@@ -2666,7 +2672,7 @@ const waitForImageHtmlElementLoad = async (nodeRef) => {
|
|
|
2666
2672
|
// };
|
|
2667
2673
|
const waitForVideoHtmlElementLoad = async (nodeRef) => {
|
|
2668
2674
|
return new Promise((resolve, reject) => {
|
|
2669
|
-
if (
|
|
2675
|
+
if (nodeRef.oncanplaythrough != null) {
|
|
2670
2676
|
const onCanplaythrough = () => {
|
|
2671
2677
|
requestAnimationFrame(() => {
|
|
2672
2678
|
requestAnimationFrame(() => {
|
|
@@ -2681,7 +2687,7 @@ const waitForVideoHtmlElementLoad = async (nodeRef) => {
|
|
|
2681
2687
|
nodeRef.load();
|
|
2682
2688
|
}
|
|
2683
2689
|
else {
|
|
2684
|
-
|
|
2690
|
+
const onCanPlay = () => {
|
|
2685
2691
|
requestAnimationFrame(() => {
|
|
2686
2692
|
requestAnimationFrame(() => {
|
|
2687
2693
|
// @ts-ignore
|
|
@@ -3044,11 +3050,12 @@ class Video {
|
|
|
3044
3050
|
return false;
|
|
3045
3051
|
}
|
|
3046
3052
|
start(muted = true, getIsLooped) {
|
|
3047
|
-
this._videoStartedPromise = new Promise(async (resolve) => {
|
|
3053
|
+
this._videoStartedPromise = new Promise(async (resolve, reject) => {
|
|
3048
3054
|
// invariant - always wait for mediaElementsLoadingPromises
|
|
3049
3055
|
// else call of _initVOD can start and onAllMediaLoaded failed
|
|
3050
3056
|
// TODO - add for all Elements state invariant protection
|
|
3051
|
-
Promise.all(this.mediaElementsLoadingPromises)
|
|
3057
|
+
Promise.all(this.mediaElementsLoadingPromises)
|
|
3058
|
+
.then(async () => {
|
|
3052
3059
|
if (this._video) {
|
|
3053
3060
|
if (this._isVOD && this._vodPlayerInstance === null) {
|
|
3054
3061
|
// console.log("_initVOD 5.1");
|
|
@@ -3095,7 +3102,8 @@ class Video {
|
|
|
3095
3102
|
getVideoCurrentTime: () => 0,
|
|
3096
3103
|
});
|
|
3097
3104
|
}
|
|
3098
|
-
})
|
|
3105
|
+
})
|
|
3106
|
+
.catch(reject);
|
|
3099
3107
|
});
|
|
3100
3108
|
return this._videoStartedPromise;
|
|
3101
3109
|
}
|
|
@@ -4862,7 +4870,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
4862
4870
|
});
|
|
4863
4871
|
}
|
|
4864
4872
|
catch (reason) {
|
|
4865
|
-
console.log("SlideInit, onAllMediaLoaded reject", reason);
|
|
4873
|
+
// console.log("SlideInit, onAllMediaLoaded reject", reason);
|
|
4866
4874
|
await slideBoxCb();
|
|
4867
4875
|
this.layoutService.env.setTimeout(() => {
|
|
4868
4876
|
slideReadyResolve();
|