diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-08-30 18:45:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-30 18:45:49 +0100 |
commit | c70ec1ce1aff6072934add1f543576d5200c1b02 (patch) | |
tree | afd3c400517202c513dbe8031799e3259a06b948 /src/state | |
parent | e7954e590b92b69dad8aabb0085a02e65024837d (diff) | |
download | voidsky-c70ec1ce1aff6072934add1f543576d5200c1b02.tar.zst |
[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
Diffstat (limited to 'src/state')
-rw-r--r-- | src/state/queries/video/video.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/state/queries/video/video.ts b/src/state/queries/video/video.ts index 035dc5081..f787a6af0 100644 --- a/src/state/queries/video/video.ts +++ b/src/state/queries/video/video.ts @@ -1,4 +1,4 @@ -import React from 'react' +import React, {useCallback} from 'react' import {ImagePickerAsset} from 'expo-image-picker' import {AppBskyVideoDefs, BlobRef} from '@atproto/api' import {msg} from '@lingui/macro' @@ -20,6 +20,7 @@ type Action = | {type: 'SetError'; error: string | undefined} | {type: 'Reset'} | {type: 'SetAsset'; asset: ImagePickerAsset} + | {type: 'SetDimensions'; width: number; height: number} | {type: 'SetVideo'; video: CompressedVideo} | {type: 'SetJobStatus'; jobStatus: AppBskyVideoDefs.JobStatus} | {type: 'SetBlobRef'; blobRef: BlobRef} @@ -58,6 +59,13 @@ function reducer(queryClient: QueryClient) { } } else if (action.type === 'SetAsset') { updatedState = {...state, asset: action.asset} + } else if (action.type === 'SetDimensions') { + updatedState = { + ...state, + asset: state.asset + ? {...state.asset, width: action.width, height: action.height} + : undefined, + } } else if (action.type === 'SetVideo') { updatedState = {...state, video: action.video} } else if (action.type === 'SetJobStatus') { @@ -178,11 +186,20 @@ export function useUploadVideo({ dispatch({type: 'Reset'}) } + const updateVideoDimensions = useCallback((width: number, height: number) => { + dispatch({ + type: 'SetDimensions', + width, + height, + }) + }, []) + return { state, dispatch, selectVideo, clearVideo, + updateVideoDimensions, } } |