You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.
I'm playing around with 1.2.6 and porting previous player from 1.2.1 to this new release and I have noticed that these lines of code in 1.2.1 are false and in 1.2.6 are true (i.e. the btoa and atob are undefined)
if (undefined === btoa) {
var btoa = BASE64.encode;
}
if (undefined === atob) {
var atob = BASE64.decode;
}
This results in btoa becoming BASE64.encode and this method creates wrong Base64 values. To test, take this Uin8Array
var arr = new Uint8Array([34, 108, 58, 142, 214, 53, 79, 38, 147, 249, 93, 97, 85, 57, 72, 44]);
Run it through this function
function bufferToBase64(buf) {
var binstr = Array.prototype.map.call(buf, function (ch) {
return String.fromCharCode(ch);
}).join('');
var x = BASE64.encode(binstr);
var z = window.btoa(binstr);
}
And compare X and Z.
What I currently did to fix the issue is changed the following code
if (undefined === this.btoa) {
var btoa = BASE64.encode;
}
if (undefined === this.atob) {
var atob = BASE64.decode;
}
to this
var btoa = this.btoa === undefined ? BASE64.encode : this.btoa;
var atob = this.atob === undefined ? BASE64.decode : this.atob;
Please, correct me if I'm wrong. Thank you.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
I'm playing around with 1.2.6 and porting previous player from 1.2.1 to this new release and I have noticed that these lines of code in 1.2.1 are false and in 1.2.6 are true (i.e. the btoa and atob are undefined)
This results in btoa becoming BASE64.encode and this method creates wrong Base64 values. To test, take this Uin8Array
Run it through this function
And compare X and Z.
What I currently did to fix the issue is changed the following code
to this
Please, correct me if I'm wrong. Thank you.
The text was updated successfully, but these errors were encountered: