Skip to content

dyte-io/google-transcription

Repository files navigation

Dyte's Google STT Transcription Package

Contents

  1. Introduction
  2. About This Repository
  3. Setting Up the Project
  4. Usage
  5. Contributing
  6. License

Introduction

Dyte is a technology company specializing in real-time communication solutions. Our products are designed to enable seamless and efficient video interactions in various applications, ranging from virtual meetings to interactive live streaming. The offerings are known for their robust performance, scalability, and ease of integration.

About This Repository

This package provides plug-and-play transcriptions.

Prerequisites

This package uses Google Speech-to-Text and translation services, which are paid services from Google.

Therefore, You must have a project & a service account in GCP (Google Cloud Platform). Make sure that the service account allows Google Speech-to-Text and Google Translation API.

Once done, download the keys for the service account.

It would look like:

{
  "type": "service_account",
  "project_id": "YOUR_GCP_PROJECT_ID",
  "private_key_id": "YOUR_GCP_PRIVATE_KEY_ID",
  "private_key": "-----BEGIN PRIVATE SOMETHING SOMETHING-----END PRIVATE KEY-----\n",
  "client_email": "xxxxxx@yyyyyy.iam.gserviceaccount.com",
  "client_id": "YOUR_GCP_CLIENT_ID",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/xxxxx%40yyyyy.iam.gserviceaccount.com"
}

Note: Without having this, it would not be feasible to use with the package.

How to use

  1. Go to server folder
cd server
  1. Replicate .env.example as .env
cp .env.example .env

Open the .env in your choice of Text File Editor and Edit it and Save it.

Note: PRIVATE_KEY should be in a single line. Try picking value from the service account's key's JSON file as is.

  1. Install packages
npm install
  1. Run the server
npm run dev

If successful, you will see the confirmation in Terminal that it is running on localhost:3001 or the PORT specified in the .env file.

  1. In a new terminal, go to the client folder from the root of this repository
cd client
  1. Install packages
npm install
  1. Replicate .env.example as .env
cp .env.example .env

Modify the port, if needed.

  1. Run the client
npm run dev
  1. Now open the following URL in a browser. (Change the port in the URL, if you have modified the port in .env of the client)
http://localhost:3000/?authToken=PUT_DYTE_PARTICIPANT_AUTH_TOKEN_HERE

In case you are still using v1 meetings, please use the following URL instead.

http://localhost:3000/?authToken=PUT_DYTE_PARTICIPANT_AUTH_TOKEN_HERE&roomName=PUT_DYTE_ROOM_NAME_HERE

Once the Dyte UI is loaded, please turn on the Mic and grant permissions, if asked. Post that, try speaking sentences in English (default) to see the transcriptions.

You will see the Dyte meeting loading on this page.

Turn the Mic on and Start Speaking and you should ideally start seeing transcriptions right away.

  1. Go through the client/demo/index.ts & server folder and take what is needed to integrate it into your product.

Note: Though this package takes the complexity away from you, We recommend that you put your own security practices & robustness around it and not treat these samples as production-grade copy-paste solutions.