feat(tts): use default speed from settings in TTSControls

This commit is contained in:
Gigi
2025-10-20 22:05:04 +02:00
parent 177f8c1e70
commit b92f5716dc
2 changed files with 5 additions and 3 deletions

View File

@@ -781,7 +781,7 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
/> />
{isTextContent && articleText && ( {isTextContent && articleText && (
<div style={{ padding: '0 0.75rem 0.5rem 0.75rem' }}> <div style={{ padding: '0 0.75rem 0.5rem 0.75rem' }}>
<TTSControls text={articleText} defaultLang={navigator?.language} /> <TTSControls text={articleText} defaultLang={navigator?.language} settings={settings} />
</div> </div>
)} )}
{isExternalVideo ? ( {isExternalVideo ? (

View File

@@ -2,21 +2,23 @@ import React from 'react'
import { useTextToSpeech } from '../hooks/useTextToSpeech' import { useTextToSpeech } from '../hooks/useTextToSpeech'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faPlay, faPause, faGauge } from '@fortawesome/free-solid-svg-icons' import { faPlay, faPause, faGauge } from '@fortawesome/free-solid-svg-icons'
import { UserSettings } from '../services/settingsService'
interface Props { interface Props {
text: string text: string
defaultLang?: string defaultLang?: string
className?: string className?: string
settings?: UserSettings
} }
const SPEED_OPTIONS = [0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.1, 2.4, 2.8, 3] const SPEED_OPTIONS = [0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.1, 2.4, 2.8, 3]
const TTSControls: React.FC<Props> = ({ text, defaultLang, className }) => { const TTSControls: React.FC<Props> = ({ text, defaultLang, className, settings }) => {
const { const {
supported, speaking, paused, supported, speaking, paused,
speak, pause, resume, stop, speak, pause, resume, stop,
rate, setRate rate, setRate
} = useTextToSpeech({ defaultLang }) } = useTextToSpeech({ defaultLang, defaultRate: settings?.ttsDefaultSpeed })
const canPlay = supported && text?.trim().length > 0 const canPlay = supported && text?.trim().length > 0