Something went wrong. Try again.
Bluesky app fork with some witchin' additions 💫
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071import {View} from 'react-native'import {Pie as ProgressPie} from 'react-native-progress'import {type ImagePickerAsset} from 'expo-image-picker'
import {atoms as a, useTheme} from '#/alf'import {ConstrainedImage} from '#/components/images/AutoSizedImage'import {ExternalEmbedRemoveBtn} from '../ExternalEmbedRemoveBtn'import {VideoTranscodeBackdrop} from './VideoTranscodeBackdrop'
export function VideoTranscodeProgress({ asset, progress, clear,}: { asset: ImagePickerAsset progress: number clear: () => void}) { const t = useTheme()
let aspectRatio: number | undefined if (asset.width && asset.height) { const raw = asset.width / asset.height if (!Number.isNaN(raw)) { aspectRatio = raw } }
let constrained: number | undefined if (aspectRatio !== undefined) { const ratio = 1 / 2 // max of 1:2 ratio in feeds constrained = Math.max(aspectRatio, ratio) }
return ( <View style={[a.pt_xs]}> <ConstrainedImage aspectRatio={constrained || 1} minMobileAspectRatio={14 / 9}> <View style={[ a.flex_1, t.atoms.bg_contrast_50, a.rounded_md, a.overflow_hidden, ]}> <VideoTranscodeBackdrop uri={asset.uri} /> <View style={[ a.flex_1, a.align_center, a.justify_center, a.gap_lg, a.absolute, a.inset_0, ]}> <ProgressPie size={48} borderWidth={3} borderColor={t.atoms.text.color} color={t.atoms.text.color} progress={progress} /> </View> <ExternalEmbedRemoveBtn onRemove={clear} /> </View> </ConstrainedImage> </View> )}