((_: boolean) => {})
+
+export function Provider({children}: {children: React.ReactNode}) {
+ const [state, setState] = React.useState(
+ Boolean(persisted.get('subtitlesEnabled')),
+ )
+
+ const setStateWrapped = React.useCallback(
+ (subtitlesEnabled: persisted.Schema['subtitlesEnabled']) => {
+ setState(Boolean(subtitlesEnabled))
+ persisted.write('subtitlesEnabled', subtitlesEnabled)
+ },
+ [setState],
+ )
+
+ React.useEffect(() => {
+ return persisted.onUpdate(() => {
+ setState(Boolean(persisted.get('subtitlesEnabled')))
+ })
+ }, [setStateWrapped])
+
+ return (
+
+
+ {children}
+
+
+ )
+}
+
+export const useSubtitlesEnabled = () => React.useContext(stateContext)
+export const useSetSubtitlesEnabled = () => React.useContext(setContext)
diff --git a/src/view/com/util/post-embeds/VideoWebControls.web.tsx b/src/view/com/util/post-embeds/VideoWebControls.web.tsx
index 6b8489f74b..bbd6899f86 100644
--- a/src/view/com/util/post-embeds/VideoWebControls.web.tsx
+++ b/src/view/com/util/post-embeds/VideoWebControls.web.tsx
@@ -4,7 +4,11 @@ import Animated, {FadeIn, FadeOut} from 'react-native-reanimated'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
-import {useAutoplayDisabled} from '#/state/preferences'
+import {
+ useAutoplayDisabled,
+ useSetSubtitlesEnabled,
+ useSubtitlesEnabled,
+} from '#/state/preferences'
import {atoms as a, useTheme, web} from '#/alf'
import {Button} from '#/components/Button'
import {useInteractionState} from '#/components/hooks/useInteractionState'
@@ -12,6 +16,10 @@ import {
ArrowsDiagonalIn_Stroke2_Corner0_Rounded as ArrowsInIcon,
ArrowsDiagonalOut_Stroke2_Corner0_Rounded as ArrowsOutIcon,
} from '#/components/icons/ArrowsDiagonal'
+import {
+ CC_Filled_Corner0_Rounded as CCActiveIcon,
+ CC_Stroke2_Corner0_Rounded as CCInactiveIcon,
+} from '#/components/icons/CC'
import {Mute_Stroke2_Corner0_Rounded as MuteIcon} from '#/components/icons/Mute'
import {Pause_Filled_Corner0_Rounded as PauseIcon} from '#/components/icons/Pause'
import {Play_Filled_Corner0_Rounded as PlayIcon} from '#/components/icons/Play'
@@ -50,6 +58,8 @@ export function Controls({
} = useVideoUtils(videoRef)
const t = useTheme()
const {_} = useLingui()
+ const subtitlesEnabled = useSubtitlesEnabled()
+ const setSubtitlesEnabled = useSetSubtitlesEnabled()
const {
state: hovered,
onIn: onMouseEnter,
@@ -58,9 +68,11 @@ export function Controls({
const isFullscreen = useFullscreen()
const {state: hasFocus, onIn: onFocus, onOut: onBlur} = useInteractionState()
const [interactingViaKeypress, setInteractingViaKeypress] = useState(false)
+
const onKeyDown = useCallback(() => {
setInteractingViaKeypress(true)
}, [])
+
useEffect(() => {
if (interactingViaKeypress) {
document.addEventListener('click', () => setInteractingViaKeypress(false))
@@ -106,6 +118,9 @@ export function Controls({
const showControls =
(focused && !playing) || (interactingViaKeypress ? hasFocus : hovered)
+ // TODO: get from embed
+ const videoHasSubtitles = true
+
return (