stormcloud-video-player 0.2.11 → 0.2.12

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/lib/index.cjs CHANGED
@@ -725,10 +725,18 @@ async function getBrowserID(clientInfo) {
725
725
  if (typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest) {
726
726
  try {
727
727
  await crypto.subtle.digest("SHA-256", new Uint8Array([1, 2, 3]));
728
- const hashBuffer = await crypto.subtle.digest(
729
- "SHA-256",
730
- new TextEncoder().encode(fingerprintString)
731
- );
728
+ let encodedData;
729
+ if (typeof TextEncoder !== "undefined") {
730
+ encodedData = new TextEncoder().encode(fingerprintString);
731
+ } else {
732
+ const utf8 = unescape(encodeURIComponent(fingerprintString));
733
+ const buffer = new Uint8Array(utf8.length);
734
+ for (let i = 0; i < utf8.length; i++) {
735
+ buffer[i] = utf8.charCodeAt(i);
736
+ }
737
+ encodedData = buffer;
738
+ }
739
+ const hashBuffer = await crypto.subtle.digest("SHA-256", encodedData);
732
740
  const hashArray = Array.from(new Uint8Array(hashBuffer));
733
741
  const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
734
742
  cachedBrowserId = hashHex;
@@ -3524,10 +3532,30 @@ var randomString = () => {
3524
3532
  };
3525
3533
  var parseQuery = (url) => {
3526
3534
  const query = {};
3527
- const params = new URLSearchParams(url.split("?")[1] || "");
3528
- params.forEach((value, key) => {
3529
- query[key] = value;
3530
- });
3535
+ const queryString = url.split("?")[1] || "";
3536
+ if (!queryString) return query;
3537
+ if (typeof URLSearchParams !== "undefined") {
3538
+ try {
3539
+ const params = new URLSearchParams(queryString);
3540
+ params.forEach((value, key) => {
3541
+ query[key] = value;
3542
+ });
3543
+ } catch (e) {
3544
+ queryString.split("&").forEach((param) => {
3545
+ const [key, value] = param.split("=");
3546
+ if (key) {
3547
+ query[decodeURIComponent(key)] = value ? decodeURIComponent(value) : "";
3548
+ }
3549
+ });
3550
+ }
3551
+ } else {
3552
+ queryString.split("&").forEach((param) => {
3553
+ const [key, value] = param.split("=");
3554
+ if (key) {
3555
+ query[decodeURIComponent(key)] = value ? decodeURIComponent(value) : "";
3556
+ }
3557
+ });
3558
+ }
3531
3559
  return query;
3532
3560
  };
3533
3561
  var merge = (target, ...sources) => {