react text to speech
1.0.0
Web Speech APIを活用してテキストをスピーチに変換する使いやすいReact.jsコンポーネント。
useSpeechフックでテキストを強調表示します。Speechコンポーネントを使用したテキストの強調表示。useSpeechフックでのエラー処理。Speechコンポーネントでのエラー処理。useSpeechフックを備えた複数のインスタンス。Speechコンポーネントを備えた複数のインスタンス。useSpeechフックのカスタマイズ。Speechコンポーネントのカスタマイズ。希望するパッケージマネージャーを使用して、 react-text-to-speechをインストールします。
# Using npm:
npm install react-text-to-speech --save
# Using Yarn:
yarn add react-text-to-speech
# Using pnpm:
pnpm add react-text-to-speech
# Using Bun:
bun add react-text-to-speechReact-Text-to-Speechは、 Text-to-Speech機能useSpeech React.jsアプリケーション<Speech>統合するための2つの主要な方法を提供します。
useSpeechフック import React from "react" ;
import { useSpeech } from "react-text-to-speech" ;
export default function App ( ) {
const {
Text , // Component that renders the processed text
speechStatus , // Current speech status
isInQueue , // Indicates if the speech is active or queued
start , // Starts or queues the speech
pause , // Pauses the speech
stop , // Stops or removes the speech from the queue
} = useSpeech ( { text : "This library is awesome!" } ) ;
return (
< div style = { { display : "flex" , flexDirection : "column" , rowGap : "1rem" } } >
< Text />
< div style = { { display : "flex" , columnGap : "0.5rem" } } >
{ speechStatus !== "started" ? < button onClick = { start } > Start </ button > : < button onClick = { pause } > Pause </ button > }
< button onClick = { stop } > Stop </ button >
</ div >
</ div >
) ;
} useSpeechフックの使用の詳細については、ドキュメントを参照してください。
<Speech>コンポーネント import React from "react" ;
import Speech from "react-text-to-speech" ;
export default function App ( ) {
return < Speech text = "This library is awesome!" /> ;
} <Speech>コンポーネントの使用の詳細については、ドキュメントを参照してください。
ライブデモをチェックして、それを実行しているのを見てください。
すぐに開始するためにドキュメントを調べてください。
githubで授与して、あなたの❤️とサポートを見せてください。また、Product Huntでプロジェクトを上昇させて共有することで、プロジェクトをサポートすることもできます。どんな提案も大歓迎です!寄稿ガイドをご覧ください。
このプロジェクトは、MITライセンスの下でライセンスされています。
反応音声のハイライト、テキストへの反応テキストは、オーディオファイル、テキストツースピーチAPI、およびWeb Speech Synthesis APIを使用して話されている単語と文をリアルタイムで強調表示します。また、多くのユースケースに対して強力で柔軟なプログラムAPIを提供します。