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.
@@ -739,10 +739,18 @@ async function getBrowserID(clientInfo) {
739
739
  if (typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest) {
740
740
  try {
741
741
  await crypto.subtle.digest("SHA-256", new Uint8Array([1, 2, 3]));
742
- const hashBuffer = await crypto.subtle.digest(
743
- "SHA-256",
744
- new TextEncoder().encode(fingerprintString)
745
- );
742
+ let encodedData;
743
+ if (typeof TextEncoder !== "undefined") {
744
+ encodedData = new TextEncoder().encode(fingerprintString);
745
+ } else {
746
+ const utf8 = unescape(encodeURIComponent(fingerprintString));
747
+ const buffer = new Uint8Array(utf8.length);
748
+ for (let i = 0; i < utf8.length; i++) {
749
+ buffer[i] = utf8.charCodeAt(i);
750
+ }
751
+ encodedData = buffer;
752
+ }
753
+ const hashBuffer = await crypto.subtle.digest("SHA-256", encodedData);
746
754
  const hashArray = Array.from(new Uint8Array(hashBuffer));
747
755
  const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
748
756
  cachedBrowserId = hashHex;