stormcloud-video-player 0.2.6 → 0.2.7
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/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +32 -13
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +32 -13
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +32 -13
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +32 -13
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +32 -13
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/ima.cjs +3 -3
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +32 -13
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/tracking.cjs +26 -7
- package/lib/utils/tracking.cjs.map +1 -1
- package/package.json +1 -1
package/lib/players/index.cjs
CHANGED
|
@@ -272,7 +272,7 @@ function createImaController(video, options) {
|
|
|
272
272
|
);
|
|
273
273
|
emit("ad_error");
|
|
274
274
|
if (!options?.continueLiveStreamDuringAds) {
|
|
275
|
-
video.play()
|
|
275
|
+
video.play()?.catch(() => {
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
278
|
}
|
|
@@ -307,7 +307,7 @@ function createImaController(video, options) {
|
|
|
307
307
|
if (adContainerEl)
|
|
308
308
|
adContainerEl.style.pointerEvents = "none";
|
|
309
309
|
if (!options?.continueLiveStreamDuringAds) {
|
|
310
|
-
video.play()
|
|
310
|
+
video.play()?.catch(() => {
|
|
311
311
|
});
|
|
312
312
|
console.log("[IMA] Video resumed (VOD mode)");
|
|
313
313
|
} else {
|
|
@@ -420,7 +420,7 @@ function createImaController(video, options) {
|
|
|
420
420
|
console.error("[IMA] Error starting ad playback:", error);
|
|
421
421
|
adPlaying = false;
|
|
422
422
|
if (!options?.continueLiveStreamDuringAds) {
|
|
423
|
-
video.play()
|
|
423
|
+
video.play()?.catch(() => {
|
|
424
424
|
});
|
|
425
425
|
}
|
|
426
426
|
return Promise.reject(error);
|
|
@@ -653,13 +653,32 @@ function getClientInfo() {
|
|
|
653
653
|
}
|
|
654
654
|
async function getBrowserID(clientInfo) {
|
|
655
655
|
const fingerprintString = JSON.stringify(clientInfo);
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
656
|
+
if (typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest) {
|
|
657
|
+
try {
|
|
658
|
+
const hashBuffer = await crypto.subtle.digest(
|
|
659
|
+
"SHA-256",
|
|
660
|
+
new TextEncoder().encode(fingerprintString)
|
|
661
|
+
);
|
|
662
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
663
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
664
|
+
return hashHex;
|
|
665
|
+
} catch (error) {
|
|
666
|
+
console.warn(
|
|
667
|
+
"[StormcloudVideoPlayer] crypto.subtle.digest failed, using fallback hash:",
|
|
668
|
+
error
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
let hash = 0;
|
|
673
|
+
for (let i = 0; i < fingerprintString.length; i++) {
|
|
674
|
+
const char = fingerprintString.charCodeAt(i);
|
|
675
|
+
hash = (hash << 5) - hash + char;
|
|
676
|
+
hash = hash & hash;
|
|
677
|
+
}
|
|
678
|
+
const fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
|
|
679
|
+
const timestamp = Date.now().toString(16).padStart(12, "0");
|
|
680
|
+
const random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
|
|
681
|
+
return (fallbackHash + timestamp + random).padEnd(64, "0");
|
|
663
682
|
}
|
|
664
683
|
async function sendInitialTracking(licenseKey) {
|
|
665
684
|
try {
|
|
@@ -777,7 +796,7 @@ var StormcloudVideoPlayer = class {
|
|
|
777
796
|
});
|
|
778
797
|
this.ima.initialize();
|
|
779
798
|
if (this.config.autoplay) {
|
|
780
|
-
await this.video.play()
|
|
799
|
+
await this.video.play()?.catch(() => {
|
|
781
800
|
});
|
|
782
801
|
}
|
|
783
802
|
return;
|
|
@@ -811,7 +830,7 @@ var StormcloudVideoPlayer = class {
|
|
|
811
830
|
});
|
|
812
831
|
this.ima.initialize();
|
|
813
832
|
if (this.config.autoplay) {
|
|
814
|
-
await this.video.play()
|
|
833
|
+
await this.video.play()?.catch(() => {
|
|
815
834
|
});
|
|
816
835
|
}
|
|
817
836
|
});
|
|
@@ -1624,7 +1643,7 @@ var StormcloudVideoPlayer = class {
|
|
|
1624
1643
|
this.currentAdIndex = 0;
|
|
1625
1644
|
this.totalAdsInBreak = 0;
|
|
1626
1645
|
if (this.video.paused) {
|
|
1627
|
-
this.video.play()
|
|
1646
|
+
this.video.play()?.catch(() => {
|
|
1628
1647
|
if (this.config.debugAdTiming) {
|
|
1629
1648
|
console.error(
|
|
1630
1649
|
"[StormcloudVideoPlayer] Failed to resume video after ad failure"
|