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.
@@ -700,10 +700,18 @@ async function getBrowserID(clientInfo) {
700
700
  if (typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest) {
701
701
  try {
702
702
  await crypto.subtle.digest("SHA-256", new Uint8Array([1, 2, 3]));
703
- const hashBuffer = await crypto.subtle.digest(
704
- "SHA-256",
705
- new TextEncoder().encode(fingerprintString)
706
- );
703
+ let encodedData;
704
+ if (typeof TextEncoder !== "undefined") {
705
+ encodedData = new TextEncoder().encode(fingerprintString);
706
+ } else {
707
+ const utf8 = unescape(encodeURIComponent(fingerprintString));
708
+ const buffer = new Uint8Array(utf8.length);
709
+ for (let i = 0; i < utf8.length; i++) {
710
+ buffer[i] = utf8.charCodeAt(i);
711
+ }
712
+ encodedData = buffer;
713
+ }
714
+ const hashBuffer = await crypto.subtle.digest("SHA-256", encodedData);
707
715
  const hashArray = Array.from(new Uint8Array(hashBuffer));
708
716
  const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
709
717
  cachedBrowserId = hashHex;