Git Product home page Git Product logo

commerce-voice-search-asset's Introduction

Voice-Search-Asset

It provides the capability to search HCL Commerce Catalog using voice search on React Stores.

DISCLAIMER: This asset is being provided as-is to help accelerate your projects. As such, we are unable to provide official support for this asset. We have provided documentation as well as any needed code artifacts for your use.

Prerequisites: HCL Commerce V9.1.x / HCL Commerce React Storefront SDK

We have used following components to achieve the voice search

React Audio Analyser - Used to record audio.

Google Speech API - Used to convert audio to text.

Note

The library react-audio-analyser used for recording audio, doesn't support in IOS chrome and safari as this library uses HTML5 Media Recorder APIs “getUserMedia and MediaRecorder” which are not supported by chrome and safari in IOS. So we have hide voice search button for IOS.

Supported Browser are Windows (Chrome, Firefox), Mac (Chrome, Firefox), Android (Chrome)

If supports need to provide for iOS/Mac(safari), the Paid library(react-mic-gold) can be used for audio recording.

UI

Steps to include the Voice search in your project:

  1. You need to install the react audio anayser in your project as a dependency.

    npm install react-audio-analyser –save

    Once installation is done. Verify the entry in your package.json file. For icons used,install iconify icons

    npm install @iconify/react @iconify/icons-mdi

  2. In your Search Bar Widget,import the search-type.tsx and used it as component

    import { SearchTypes } from "../Search-types/search-types";

    <SearchTypes showSpeechToText={true} setSearchBoxVal={setInput} />

  3. We have created the firebase API to call the google speech API.The call to the firebase API is placed in the voiceImageTranscribeService Host the Node Code on the firebase and use the Firebase hosted URL for the API in voiceImageTranscribeService.ts const VOICE_URL = "Your Firebase API URL"

  4. Once All steps are done, Voice search will start working.

Node(Backend)

On the Firebase side, Google Speech API is used for converting audio(i.e wav file) to text.

For Google Speech API to Work,Follow these steps

-Need to create the project on "https://console.cloud.google.com/" -Enable Billing

-Enable Google Vision API

-setup autentication

-create service account

-User service key in firebase .env file

Once you get the Google Key,add it in .env file placed inside Node(backend)/functions folder

Reference

For more details,refer the voiceSearch_technical.docx file

commerce-voice-search-asset's People

Contributors

brianrossihcl avatar jamesspak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.