* Parses a Base64-encoded frame into an array of byte values. * * @param {string} frame - The Base64-encoded data from the data source * @returns {array} Array of byte values (0-255), or empty array on error
(frame)
| 54 | * @returns {array} Array of byte values (0-255), or empty array on error |
| 55 | */ |
| 56 | function parse(frame) { |
| 57 | try { |
| 58 | let binaryString = atob(frame); |
| 59 | return Array.from(binaryString).map(char => char.charCodeAt(0)); |
| 60 | } |
| 61 | catch (e) { |
| 62 | console.error("Base64 decode error:", e.message); |
| 63 | return []; |
| 64 | } |
| 65 | } |