From c70ec1ce1aff6072934add1f543576d5200c1b02 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 30 Aug 2024 18:45:49 +0100 Subject: [Video] Captions and alt text (#5009) * video settings modal in composer * show done button on web * rm download options * fix logic for showing settings button * add language picker (wip) * subtitle list with language select * send captions & alt text with video when posting * style "ensure you have selected a language" text * include aspect ratio with video * filter out captions where the lang is not set * rm log * fix label and add hint * minor scrubber fix --- src/view/com/composer/Composer.tsx | 50 ++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) (limited to 'src/view/com/composer/Composer.tsx') diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 7c11f0a9a..f0b4ae754 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -108,6 +108,7 @@ import {TextInput, TextInputRef} from './text-input/TextInput' import {ThreadgateBtn} from './threadgate/ThreadgateBtn' import {useExternalLinkFetch} from './useExternalLinkFetch' import {SelectVideoBtn} from './videos/SelectVideoBtn' +import {SubtitleDialogBtn} from './videos/SubtitleDialog' import {VideoPreview} from './videos/VideoPreview' import {VideoTranscodeProgress} from './videos/VideoTranscodeProgress' @@ -172,10 +173,14 @@ export const ComposePost = observer(function ComposePost({ initQuote, ) + const [videoAltText, setVideoAltText] = useState('') + const [captions, setCaptions] = useState<{lang: string; file: File}[]>([]) + const { selectVideo, clearVideo, state: videoUploadState, + updateVideoDimensions, } = useUploadVideo({ setStatus: setProcessingState, onSuccess: () => { @@ -347,7 +352,19 @@ export const ComposePost = observer(function ComposePost({ postgate, onStateChange: setProcessingState, langs: toPostLanguages(langPrefs.postLanguage), - video: videoUploadState.blobRef, + video: videoUploadState.blobRef + ? { + blobRef: videoUploadState.blobRef, + altText: videoAltText, + captions: captions, + aspectRatio: videoUploadState.asset + ? { + width: videoUploadState.asset?.width, + height: videoUploadState.asset?.height, + } + : undefined, + } + : undefined, }) ).uri try { @@ -694,16 +711,29 @@ export const ComposePost = observer(function ComposePost({ )} ) : null} - {videoUploadState.status === 'compressing' && - videoUploadState.asset ? ( - + ) : videoUploadState.video ? ( + + ) : null)} + {(videoUploadState.asset || videoUploadState.video) && ( + - ) : videoUploadState.video ? ( - - ) : null} + )} -- cgit 1.4.1