Skip to content

Latest commit

 

History

History
220 lines (196 loc) · 4.09 KB

README.md

File metadata and controls

220 lines (196 loc) · 4.09 KB

TextToSpeech

A TextToSpeech component will help to convert the text value in the voice. You will pass the text and your application will convert it in the sound.

Demo

A minimal Demo Link

Usage/Examples

Value Used as a Description
TextToSpeech ✅ Component Can be used as Component
textToSpeech ✅ Service Can be used as Service
1. Here"s an example of basic usage with Multiple Import: with Default Import:
// Default import will return TextToSpeech Component
import TextToSpeech from "fe-pilot/TextToSpeech";

<TextToSpeech /> // Used as a Component
2. Here"s an example of basic usage with Multiple Import: with Multiple Import:
import { TextToSpeech, textToSpeech } from "fe-pilot/TextToSpeech";

// Used as a Component
<TextToSpeech
  text={`Fe-pilot library offers component like
    scanner, voice search, autofill otp, phonebook,
    share and many more for a small/medium/large
    size web based applications`
  }
/>

// Used as a Service
textToSpeech({
  text={`Fe-pilot library offers component like
    scanner, voice search, autofill otp, phonebook,
    share and many more for a small/medium/large
    size web based applications`
  }
});
3. Here"s an example of a advanced usage:
import { TextToSpeech, TextToSpeechStart, TextToSpeechStop } from "fe-pilot/TextToSpeech";

const successCb = (response) => {
  console.log("success response:", response);
}

const failureCb = (response) => {
  console.log("failure response:", response);
}

return (
  <TextToSpeech
    text={`Fe-pilot library offers component like
      scanner, voice search, autofill otp, phonebook,
      share and many more for a small/medium/large
      size web based applications`
    }
    successCb={successCb}
    failureCb={failureCb}
  >
    <TextToSpeechStart>
      Start Icon/Text/Element
    </TextToSpeechStart>
    <TextToSpeechStop>
      Stop Icon/Text/Element
    </TextToSpeechStop>
  </TextToSpeech>
);

Props

Props Type Description Response
successCb Function It will be called on success
{
    data: "Can be array/object/string/number",
    msgType: "SUCCESSFUL",
    msg: "A success msg",
    status: "SUCCESS"
}
      
loadingCb Function It will be called before success/failure.
{
  msgType: "LOADING",
  msg: "LOADING...",
  status: "LOADING"
}
failureCb Function It will be called on failure
{
  msgType: "ERROR",
  msg: "A failed msg",
  status: "FAILURE"
}
       
Props Type Description Default Values
showForever Boolean To hide/remove unsupported feature, make it false. Default value is true.
text String Text that need to be convert in voice
---

Child Component

Child Type Description
TextToSpeechStart Element Speech will start onClick on start Icon/Text
TextToSpeechStop Element Speech will stop onClick on stop Icon/Text
graph TD;
    TextToSpeech--->TextToSpeechStart;
    TextToSpeech--->TextToSpeechStop;
Loading