GoogleCloudPlatform / ios-docs-samples

iOS samples that demonstrate APIs and services of Google Cloud Platform.
Apache License 2.0
326 stars 209 forks source link

Release version of Speech-to-Speech #124

Open YongHuiLuo opened 4 years ago

YongHuiLuo commented 4 years ago

development platform: xcode programming language: Swift use the main API: Make streaming gRPC connections to the Cloud Speech API` to recognize speech in recorded audio.

I used the code logic of Speech-to-Speech in the project to implement streaming real-time translation. The offline test is normal. Now I need to release Release. What do I need to do?especially about "Setup and Deploy the Firebase Function",This part seems to only be used with the Debug version.

Do I need to build a server program for Firebase Functions?

I hope to get your help as soon as possible, thank you very much.

santhoshvaddi commented 4 years ago

Hi @YongHuiLuo , The machine which hosts the API becomes the server, in current speech to speech we are deploying the functions and hosting them in local machine, so our machine would act as the server ... to make it work in release mode you should host the API from the server.

You don’t need to write any server program for firebase functions.. it’s already implemented and you can use the same code. Please find the server program for Firebase Functions here

To Setup and Deploy the Firebase Function:

Follow the steps in this guide for: "1. Set up Node.js and the Firebase CLI" "2. Initialize Firebase SDK for Cloud Functions". Replace index.js file with the provided index.js. Open index.js, go to function "generateAccessToken", and replace “SERVICE-ACCOUNT-NAME@YOUR_PROJECT_ID.iam.gserviceaccount.com” with your Service account name (example-client) and project id. Deploy getOAuthToken method by running command:

firebase deploy -—only functions

For your "App Engine Default Service Account" add the following IAM role: Service Account Token Creator . (For more info on: how to add roles to a Service Account)

For more info please follow README instructions

For more info on how to Setting up a token service for iOS apps.

YongHuiLuo commented 4 years ago

Thank you very much for your reply. We have successfully released it, but we have another problem. Speech to Speech is not available in China. How can I solve this problem? The reason for the unavailable is that the authentication request prompts a network error.

YongHuiLuo commented 4 years ago

@santhoshvaddi Can I use the API key to authenticate the Speech to Speech service? I will report an invalid key error when I use it.