stormcloud-video-player 0.2.6 → 0.2.8
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/index.js
CHANGED
|
@@ -199,7 +199,7 @@ function createImaController(video, options) {
|
|
|
199
199
|
);
|
|
200
200
|
emit("ad_error");
|
|
201
201
|
if (!options?.continueLiveStreamDuringAds) {
|
|
202
|
-
video.play()
|
|
202
|
+
video.play()?.catch(() => {
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -234,7 +234,7 @@ function createImaController(video, options) {
|
|
|
234
234
|
if (adContainerEl)
|
|
235
235
|
adContainerEl.style.pointerEvents = "none";
|
|
236
236
|
if (!options?.continueLiveStreamDuringAds) {
|
|
237
|
-
video.play()
|
|
237
|
+
video.play()?.catch(() => {
|
|
238
238
|
});
|
|
239
239
|
console.log("[IMA] Video resumed (VOD mode)");
|
|
240
240
|
} else {
|
|
@@ -347,7 +347,7 @@ function createImaController(video, options) {
|
|
|
347
347
|
console.error("[IMA] Error starting ad playback:", error);
|
|
348
348
|
adPlaying = false;
|
|
349
349
|
if (!options?.continueLiveStreamDuringAds) {
|
|
350
|
-
video.play()
|
|
350
|
+
video.play()?.catch(() => {
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
353
|
return Promise.reject(error);
|
|
@@ -580,13 +580,32 @@ function getClientInfo() {
|
|
|
580
580
|
}
|
|
581
581
|
async function getBrowserID(clientInfo) {
|
|
582
582
|
const fingerprintString = JSON.stringify(clientInfo);
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
583
|
+
if (typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest) {
|
|
584
|
+
try {
|
|
585
|
+
await crypto.subtle.digest("SHA-256", new Uint8Array([1, 2, 3]));
|
|
586
|
+
const hashBuffer = await crypto.subtle.digest(
|
|
587
|
+
"SHA-256",
|
|
588
|
+
new TextEncoder().encode(fingerprintString)
|
|
589
|
+
);
|
|
590
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
591
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
592
|
+
return hashHex;
|
|
593
|
+
} catch (error) {
|
|
594
|
+
console.warn(
|
|
595
|
+
"[StormcloudVideoPlayer] crypto.subtle.digest not supported, using fallback hash"
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
let hash = 0;
|
|
600
|
+
for (let i = 0; i < fingerprintString.length; i++) {
|
|
601
|
+
const char = fingerprintString.charCodeAt(i);
|
|
602
|
+
hash = (hash << 5) - hash + char;
|
|
603
|
+
hash = hash & hash;
|
|
604
|
+
}
|
|
605
|
+
const fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
|
|
606
|
+
const timestamp = Date.now().toString(16).padStart(12, "0");
|
|
607
|
+
const random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
|
|
608
|
+
return (fallbackHash + timestamp + random).padEnd(64, "0");
|
|
590
609
|
}
|
|
591
610
|
async function sendInitialTracking(licenseKey) {
|
|
592
611
|
try {
|
|
@@ -704,7 +723,7 @@ var StormcloudVideoPlayer = class {
|
|
|
704
723
|
});
|
|
705
724
|
this.ima.initialize();
|
|
706
725
|
if (this.config.autoplay) {
|
|
707
|
-
await this.video.play()
|
|
726
|
+
await this.video.play()?.catch(() => {
|
|
708
727
|
});
|
|
709
728
|
}
|
|
710
729
|
return;
|
|
@@ -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
|
});
|
|
@@ -1551,7 +1570,7 @@ var StormcloudVideoPlayer = class {
|
|
|
1551
1570
|
this.currentAdIndex = 0;
|
|
1552
1571
|
this.totalAdsInBreak = 0;
|
|
1553
1572
|
if (this.video.paused) {
|
|
1554
|
-
this.video.play()
|
|
1573
|
+
this.video.play()?.catch(() => {
|
|
1555
1574
|
if (this.config.debugAdTiming) {
|
|
1556
1575
|
console.error(
|
|
1557
1576
|
"[StormcloudVideoPlayer] Failed to resume video after ad failure"
|