diff --git a/frontend/src/features/streaming/ChannelPlayer.tsx b/frontend/src/features/streaming/ChannelPlayer.tsx index d1e37da..ad87de1 100644 --- a/frontend/src/features/streaming/ChannelPlayer.tsx +++ b/frontend/src/features/streaming/ChannelPlayer.tsx @@ -20,6 +20,7 @@ export function ChannelPlayer({ const hlsRef = useRef(null) const [playing, setPlaying] = useState(false) const [muted, setMuted] = useState(true) + const [volume, setVolume] = useState(1) const seekToLiveEdge = useCallback(() => { const video = videoRef.current @@ -77,11 +78,26 @@ export function ChannelPlayer({ } } + // Установить громкость (0..1); 0 = mute, >0 запоминаем как последний уровень для «размьютить». + const applyVolume = (value: number) => { + const video = videoRef.current + if (!video) return + const clamped = Math.min(1, Math.max(0, value)) + video.volume = clamped + video.muted = clamped === 0 + setMuted(clamped === 0) + if (clamped > 0) setVolume(clamped) + } + const toggleMute = () => { const video = videoRef.current if (!video) return - video.muted = !video.muted - setMuted(video.muted) + if (video.muted || video.volume === 0) { + applyVolume(volume > 0 ? volume : 0.5) + } else { + video.muted = true + setMuted(true) + } } const toggleFullscreen = () => { @@ -110,9 +126,21 @@ export function ChannelPlayer({ - +
+ + applyVolume(Number(e.target.value))} + aria-label={t('air.volume')} + className="h-1 w-20 cursor-pointer accent-emerald-400" + /> +
diff --git a/frontend/src/shared/lib/i18n.ts b/frontend/src/shared/lib/i18n.ts index 200fac1..3694788 100644 --- a/frontend/src/shared/lib/i18n.ts +++ b/frontend/src/shared/lib/i18n.ts @@ -64,6 +64,7 @@ const resources = { bumper: 'Заставка', episode: 'Серия', live: 'В эфире', + volume: 'Громкость', noChannels: 'Пока нет доступных каналов. Загляните позже.', offline: 'Канал сейчас не в эфире', offlineHint: 'Нет расписания или контента. Загляните позже.', @@ -292,6 +293,7 @@ const resources = { ad: 'Ad', bumper: 'Bumper', episode: 'Episode', + volume: 'Volume', live: 'Live', noChannels: 'No channels available yet. Check back later.', offline: 'This channel is off the air',