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