Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS, Phonegap: Cannot find function atob. Works on Android #41

Open
AaronLlanos opened this issue Jun 15, 2016 · 2 comments
Open

iOS, Phonegap: Cannot find function atob. Works on Android #41

AaronLlanos opened this issue Jun 15, 2016 · 2 comments

Comments

@AaronLlanos
Copy link

Hello,

I am building a project using this tool which records a canvas. I import the Whammy script along with the CanvasRecorder script as specified here. The problem I am having is that whenever I call the function recorder.stop((blob) => {}), it uses the whammy library to convert each webP to base 64 and combine it to webM.

It is in this function where the problem occurs:

var webm = new ArrayToWebM(frames.map(function(frame) {
    var webp = parseWebP(parseRIFF(atob(frame.image.slice(23))));
    webp.duration = frame.duration;
    return webp;
}));

WhammyVideo.compile -> processInWebWorker -> whammyInWebWorker -> ArrayToWebM -> parseWebP -> parseRIFF -> atob

As stated above, on android web view through phonegap this works but on iOS it does not. I tried logging window and even tried polyfilling the function with a shim but nothing has worked so far. It seems as though the window variable is lost in the function:

function whammyInWebWorker(frames) {}

Maybe I am just thinking about this incorrectly but I think this library should be working across all devices especially iOS through Phonegap since it is a growing development community.

Best,
Aaron

@AaronLlanos
Copy link
Author

AaronLlanos commented Jun 15, 2016

After further researching this topic, it appears as though the answer above is coming from WebWorker operating on a seperate global scope.

iOS webworkers do not ship with atob defined on them. It may help to perform a check on the atob function within the webworker setup and assign it there if it does not exist. Furthermore, iOS does not setup Canvas Recorder properly to include RIFF or LIST from the decoded value.

@AramVave
Copy link

AramVave commented Mar 8, 2018

@AaronLlanos could you please provide your solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants