-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
翻訳ユースケース音声再生ボタン + レイアウト改善 #605
Conversation
tbrand
commented
Aug 13, 2024
•
edited
Loading
edited
- 現状英語に限定 (今後拡張していく)
- 初回再生時に最初の音声が途切れるが、原因不明 (Google 翻訳等でも同じ動作になるので現状修正しない方針ですが、解決策あればやります)
- 再生中にスピーカーボタン停止で再生ストップ (巻き戻し)
- 長い文章をパッと貼った時に実行ボタンが見えなくなってしまうので、「追加コンテキスト」と「実行ボタン・クリアボタン」を左右に分割しました。(下部画像)
@@ -283,7 +330,7 @@ const TranslatePage: React.FC = () => { | |||
</div> | |||
<div className="flex w-full flex-col lg:flex-row"> | |||
<div className="w-full lg:w-1/2"> | |||
<div className="flex items-center py-2.5"> | |||
<div className="flex h-12 items-center"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上部がずれていたので合うようにサイズ固定にしました
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1点ご確認をお願いします!
// 再生中の場合は止める | ||
if (isSpeachPlaying && audioRef.current) { | ||
audioRef.current.pause(); | ||
audioRef.current.currentTime = 0; | ||
setIsSpeachPlaying(false); | ||
return; | ||
} | ||
|
||
const speachUrl = await synthesizeSpeach(translatedSentence); | ||
|
||
setIsSpeachPlaying(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
スピーカーボタンを連打すると、重複してPollyが実行されて、音声が連打した分だけ再生されるので、ボタンを押した瞬間にフラグを更新した方が良さそうです!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!