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
|
@@ -233,7 +233,7 @@ function createImaController(video, options) {
|
|
|
233
233
|
);
|
|
234
234
|
emit("ad_error");
|
|
235
235
|
if (!options?.continueLiveStreamDuringAds) {
|
|
236
|
-
video.play()
|
|
236
|
+
video.play()?.catch(() => {
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
@@ -268,7 +268,7 @@ function createImaController(video, options) {
|
|
|
268
268
|
if (adContainerEl)
|
|
269
269
|
adContainerEl.style.pointerEvents = "none";
|
|
270
270
|
if (!options?.continueLiveStreamDuringAds) {
|
|
271
|
-
video.play()
|
|
271
|
+
video.play()?.catch(() => {
|
|
272
272
|
});
|
|
273
273
|
console.log("[IMA] Video resumed (VOD mode)");
|
|
274
274
|
} else {
|
|
@@ -381,7 +381,7 @@ function createImaController(video, options) {
|
|
|
381
381
|
console.error("[IMA] Error starting ad playback:", error);
|
|
382
382
|
adPlaying = false;
|
|
383
383
|
if (!options?.continueLiveStreamDuringAds) {
|
|
384
|
-
video.play()
|
|
384
|
+
video.play()?.catch(() => {
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
387
|
return Promise.reject(error);
|
|
@@ -614,13 +614,32 @@ function getClientInfo() {
|
|
|
614
614
|
}
|
|
615
615
|
async function getBrowserID(clientInfo) {
|
|
616
616
|
const fingerprintString = JSON.stringify(clientInfo);
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
617
|
+
if (typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest) {
|
|
618
|
+
try {
|
|
619
|
+
const hashBuffer = await crypto.subtle.digest(
|
|
620
|
+
"SHA-256",
|
|
621
|
+
new TextEncoder().encode(fingerprintString)
|
|
622
|
+
);
|
|
623
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
624
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
625
|
+
return hashHex;
|
|
626
|
+
} catch (error) {
|
|
627
|
+
console.warn(
|
|
628
|
+
"[StormcloudVideoPlayer] crypto.subtle.digest failed, using fallback hash:",
|
|
629
|
+
error
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
let hash = 0;
|
|
634
|
+
for (let i = 0; i < fingerprintString.length; i++) {
|
|
635
|
+
const char = fingerprintString.charCodeAt(i);
|
|
636
|
+
hash = (hash << 5) - hash + char;
|
|
637
|
+
hash = hash & hash;
|
|
638
|
+
}
|
|
639
|
+
const fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
|
|
640
|
+
const timestamp = Date.now().toString(16).padStart(12, "0");
|
|
641
|
+
const random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
|
|
642
|
+
return (fallbackHash + timestamp + random).padEnd(64, "0");
|
|
624
643
|
}
|
|
625
644
|
async function sendInitialTracking(licenseKey) {
|
|
626
645
|
try {
|
|
@@ -738,7 +757,7 @@ var StormcloudVideoPlayer = class {
|
|
|
738
757
|
});
|
|
739
758
|
this.ima.initialize();
|
|
740
759
|
if (this.config.autoplay) {
|
|
741
|
-
await this.video.play()
|
|
760
|
+
await this.video.play()?.catch(() => {
|
|
742
761
|
});
|
|
743
762
|
}
|
|
744
763
|
return;
|
|
@@ -772,7 +791,7 @@ var StormcloudVideoPlayer = class {
|
|
|
772
791
|
});
|
|
773
792
|
this.ima.initialize();
|
|
774
793
|
if (this.config.autoplay) {
|
|
775
|
-
await this.video.play()
|
|
794
|
+
await this.video.play()?.catch(() => {
|
|
776
795
|
});
|
|
777
796
|
}
|
|
778
797
|
});
|
|
@@ -1585,7 +1604,7 @@ var StormcloudVideoPlayer = class {
|
|
|
1585
1604
|
this.currentAdIndex = 0;
|
|
1586
1605
|
this.totalAdsInBreak = 0;
|
|
1587
1606
|
if (this.video.paused) {
|
|
1588
|
-
this.video.play()
|
|
1607
|
+
this.video.play()?.catch(() => {
|
|
1589
1608
|
if (this.config.debugAdTiming) {
|
|
1590
1609
|
console.error(
|
|
1591
1610
|
"[StormcloudVideoPlayer] Failed to resume video after ad failure"
|