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

Question: What was the reason to use electron? #750

Closed
timaschew opened this issue Aug 25, 2018 · 8 comments
Closed

Question: What was the reason to use electron? #750

timaschew opened this issue Aug 25, 2018 · 8 comments

Comments

@timaschew
Copy link

Probably very naive question:

I just wonder why not just running a webapp on Chrome/Chromium?

@Diesel5ohGaming
Copy link

i doubt there is a such thing as a naive question any more than there is a dumb one...

@justbill2020
Copy link
Collaborator

It was a simple framework to run it as a desktop app.

@timaschew
Copy link
Author

So the reason was to provide an executable to avoid users to install Node.js?

@evancohen
Copy link
Owner

I wrote a really detailed post about this decision on an issue somewhere this repo but can't find it, but long story short:

We use Electron because we "broke" webkitSpeechRecognition() in Chromium (yes, the mirror originaly ran in Chromium). We had loads of mirrors constantly streaming all of their audio to Google's servers. In the early days of the mirror it constantly streamed your audio to a recognition server (no keyword spotting). I can only assume Google didn't like that, we were using their resources for free, so they shut down the functionality for Chromium (still works in Chrome to date). The work-around for this was to use Electron with custom developer keys, which would give you 50 requests/day. Obviously you'd burn through these in a very short period of time, because the mirror was always streaming audio. After a substantial amount of head banging I created Sonus.

During the head-banging era, the smart mirror used to use a Python sub-process for keyword spotting, and then used webkitSpeechRecognition() within Electron for streaming recognition. This was done for increased privacy and to reduce the number of requests made so the mirror could funciton all day (instead of just for the first half or so). But that wasn't great either because you were still limeted to 50 requests/day. I managed to get into the Google Cloud Speech Pilot program and prototyped Sonus to deal with keyword spotting and streaming recognition (to make my life easier, but also because I figured other people would find it useful).

There are, of course, some complications with Electron...

For this reason, the smart mirror uses an IPC for Sonus (so it's is running on your local version of node, instead of with the version that's bundled with electron - it's a totally separate process).

As for your point about having an executable, that's a huge plus for Electron, but isn't something that's been implemented yet. I looked into it a while ago and concluded that it would require some centralized updating server and I think that's too much to maintain.

Anyway, that's probably more information than you were looking for, but now anyone else who is curious about how this all came to be can read this 😄

@timaschew
Copy link
Author

timaschew commented Aug 29, 2018

That was exactly what I wanted to hear (and it's very interesting!), thanks :)

So since you don't use Electron with custom developer keys anymore this is no longer an advantage. So the only reason now is to have something bundled as an executable (which has its own trade offs).

So a simple webapp with Node.js would work as well. Actually if snowboy would be available for the browser it could be even without any backend, right?

@justbill2020
Copy link
Collaborator

No, you still require custom developer keys. As @evancohen stated in his last comment

As for your point about having an executable, that's a huge plus for Electron, but isn't something that's been implemented yet. I looked into it a while ago and concluded that it would require some centralized updating server and I think that's too much to maintain.

An executable would require us to configure a config utility and maintain that code space. I started on a project similiar to this several months ago and decided that it would be contrary to the level of time and attention the main contributors could provide at this time.

@timaschew
Copy link
Author

timaschew commented Aug 29, 2018

Maybe I was wrong about the fact that these keys are needed for electron anyway?

Of course you need anyway keys for speech recognition API which each user needs to create. But those keys are not related to electron, right? You can use them in Node.js directly or even in the browser maybe.

Main question: the reason why electron was chosen is not valid anymore, right?

@evancohen
Copy link
Owner

@timaschew I'm still into Electron at the high level. It makes running, development, etc. a whole lot easier. Going to close out this issue, but feel free to ask more questions :)

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

4 participants