rb-text-to-speech
Demo
See live demo here at codesandbox.
Installation
npm install --save rb-speech-to-text
or
yarn add rb-speech-to-text
Declaration
<script>
import RBSpeechToText from "@readybytes/rb-speech-to-text";
export default {
components: {
RBSpeechToText
}
}
<script>
Basic Usage
Example-1
<template>
<div>
<textarea v-model="body"></textarea>
<RBSpeechToText
:text="body"
@speechend="body = $event.text"
></RBSpeechToText>
</div>
<template>
<script>
export default {
name: "MyComponent",
data() {
return {
body: "Hello World",
};
},
}
</script>
Example-2
<template>
<div>
<textarea v-model="body"></textarea>
<RBSpeechToText
:text="body"
lang="fr-FR"
@speechend="body = $event.text"
></RBSpeechToText>
</div>
<template>
<script>
export default {
name: "MyComponent",
data() {
return {
body: "Bonjour le monde",
};
},
}
</script>
Properties
Name | Type | Required | Default Value | Support Values |
---|
text | String | Yes | - | any string |
lang | String | No | "en-US" | <languageCode-countryCode> . BCP-47 Languages Codes (Go to this link and search for BCP-47 language codes) |
Events
-
speechend
This event will fire when user stop speaking and save the content. i.e-
<template>
<RBSpeechToText
:text="text"
@speechend="onSpeechEnd"
>
</RBSpeechToText>
</template>
<script>
export default {
methods:{
onSpeechEnd(event) {
console.log(event)
}
}
}
</script>