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.js CHANGED
@@ -666,10 +666,18 @@ async function getBrowserID(clientInfo) {
666
666
  if (typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest) {
667
667
  try {
668
668
  await crypto.subtle.digest("SHA-256", new Uint8Array([1, 2, 3]));
669
- const hashBuffer = await crypto.subtle.digest(
670
- "SHA-256",
671
- new TextEncoder().encode(fingerprintString)
672
- );
669
+ let encodedData;
670
+ if (typeof TextEncoder !== "undefined") {
671
+ encodedData = new TextEncoder().encode(fingerprintString);
672
+ } else {
673
+ const utf8 = unescape(encodeURIComponent(fingerprintString));
674
+ const buffer = new Uint8Array(utf8.length);
675
+ for (let i = 0; i < utf8.length; i++) {
676
+ buffer[i] = utf8.charCodeAt(i);
677
+ }
678
+ encodedData = buffer;
679
+ }
680
+ const hashBuffer = await crypto.subtle.digest("SHA-256", encodedData);
673
681
  const hashArray = Array.from(new Uint8Array(hashBuffer));
674
682
  const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
675
683
  cachedBrowserId = hashHex;
@@ -3474,10 +3482,30 @@ var randomString = () => {
3474
3482
  };
3475
3483
  var parseQuery = (url) => {
3476
3484
  const query = {};
3477
- const params = new URLSearchParams(url.split("?")[1] || "");
3478
- params.forEach((value, key) => {
3479
- query[key] = value;
3480
- });
3485
+ const queryString = url.split("?")[1] || "";
3486
+ if (!queryString) return query;
3487
+ if (typeof URLSearchParams !== "undefined") {
3488
+ try {
3489
+ const params = new URLSearchParams(queryString);
3490
+ params.forEach((value, key) => {
3491
+ query[key] = value;
3492
+ });
3493
+ } catch (e) {
3494
+ queryString.split("&").forEach((param) => {
3495
+ const [key, value] = param.split("=");
3496
+ if (key) {
3497
+ query[decodeURIComponent(key)] = value ? decodeURIComponent(value) : "";
3498
+ }
3499
+ });
3500
+ }
3501
+ } else {
3502
+ queryString.split("&").forEach((param) => {
3503
+ const [key, value] = param.split("=");
3504
+ if (key) {
3505
+ query[decodeURIComponent(key)] = value ? decodeURIComponent(value) : "";
3506
+ }
3507
+ });
3508
+ }
3481
3509
  return query;
3482
3510
  };
3483
3511
  var merge = (target, ...sources) => {