spokestack / react-native-spokestack

Spokestack: give your React Native app a voice interface!
https://spokestack.io
Apache License 2.0
58 stars 13 forks source link

There is no transcript after an activate event occurs. #14

Closed dazzyjong closed 6 years ago

dazzyjong commented 6 years ago

There is no transcript after an activate event occurs.

[15:28:03] Object {
[15:28:03]   "event": "ACTIVATE",
[15:28:03]   "isActive": true,
[15:28:03]   "transcript": "",
[15:28:03] }
[15:28:04] Object {
[15:28:04]   "event": "DEACTIVATE",
[15:28:04]   "isActive": false,
[15:28:04]   "transcript": "",
[15:28:04] }
[15:28:05] Object {
[15:28:05]   "event": "ACTIVATE",
[15:28:05]   "isActive": true,
[15:28:05]   "transcript": "",
[15:28:05] }
[15:28:05] Object {
[15:28:05]   "event": "DEACTIVATE",
[15:28:05]   "isActive": false,
[15:28:05]   "transcript": "",
[15:28:05] }
[15:28:07] Object {
[15:28:07]   "event": "ACTIVATE",
[15:28:07]   "isActive": true,
[15:28:07]   "transcript": "",
[15:28:07] }
[15:28:08] Object {
[15:28:08]   "event": "DEACTIVATE",
[15:28:08]   "isActive": false,
[15:28:08]   "transcript": "",
[15:28:08] }

I used the below configuration.

      RNSpokestack.initialize({
        'input': 'com.pylon.spokestack.android.MicrophoneInput', // required, provides audio input into the stages
        'stages': [
          'com.pylon.spokestack.libfvad.VADTrigger', // enable voice activity detection. necessary to trigger speech recognition.
          'com.pylon.spokestack.google.GoogleSpeechRecognizer' // one of the two supplied speech recognition services
        ],
        'properties': {
          'locale': "en-US",
          'google-credentials': JSON.stringify(googleCredentials)
        }
      });

How can I make the device recognizable state?

dazzyjong commented 6 years ago

From the onError of ResponseObserver, I can see the UNAUTHENTICATED error message. Even I make Service account key as owner role, but it returns below error.

com.google.api.gax.rpc.UnauthenticatedException: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Credentials require channel with PRIVACY_AND_INTEGRITY security level. Observed security level: NONE

Anyway I think this is not your library's problem. Please ignore this issue.

dazzyjong commented 6 years ago

mmm...With the same credential json file, I can get the transcript through the python example and android example.

noelweichbrodt commented 6 years ago

@dazzyjong Good question, we're missing documentation on that. googleCredentials needs to be in the format of:

JSON.stringify({
      'type': 'service_account',
      'project_id': 'XXXXX',
      'private_key_id': 'XXXXX',
      'private_key': '-----BEGIN PRIVATE KEY-----\nXXXXX\n-----END PRIVATE KEY-----\n',
      'client_email': 'XXXXX',
      'client_id': 'XXXXX',
      'auth_uri': 'https://accounts.google.com/o/oauth2/auth',
      'token_uri': 'https://accounts.google.com/o/oauth2/token',
      'auth_provider_x509_cert_url': 'https://www.googleapis.com/oauth2/v1/certs',
      'client_x509_cert_url': 'XXXXX'
})

Note the explicit \n newlines for the private key lines.

dazzyjong commented 6 years ago

@dazzyjong Good question, we're missing documentation on that. googleCredentials needs to be in the format of:

JSON.stringify({
      'type': 'service_account',
      'project_id': 'XXXXX',
      'private_key_id': 'XXXXX',
      'private_key': '-----BEGIN PRIVATE KEY-----\nXXXXX\n-----END PRIVATE KEY-----\n',
      'client_email': 'XXXXX',
      'client_id': 'XXXXX',
      'auth_uri': 'https://accounts.google.com/o/oauth2/auth',
      'token_uri': 'https://accounts.google.com/o/oauth2/token',
      'auth_provider_x509_cert_url': 'https://www.googleapis.com/oauth2/v1/certs',
      'client_x509_cert_url': 'XXXXX'
})

Note the explicit \n newlines for the private key lines.

Thanks for reply. I changed the google credentials format as you mentioned, but it did not work with the same error. Can you please provide example application source?

rtmalone commented 6 years ago

@noel Maybe I can set up a publicly available example app using spokestack. Getting more practice with it never hurts.

rtmalone commented 6 years ago

@dazzyjong example app here

dazzyjong commented 6 years ago

After the dependencies are moved into android/build.gradle, the above issue is resolved.