diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-08-30 20:48:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-30 12:48:23 -0700 |
commit | ab260c3599294c7526a6d8cdf2657708e9b5a5c7 (patch) | |
tree | b86954337875455220bfaec060b9d1b73a231b42 /src/view/com/composer/videos/VideoTranscodeProgress.tsx | |
parent | 8647c8e9f589401b1763fa8af596a6fd12bad04e (diff) | |
download | voidsky-ab260c3599294c7526a6d8cdf2657708e9b5a5c7.tar.zst |
[Video] Minor player tweaks (#5044)
Diffstat (limited to 'src/view/com/composer/videos/VideoTranscodeProgress.tsx')
-rw-r--r-- | src/view/com/composer/videos/VideoTranscodeProgress.tsx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/view/com/composer/videos/VideoTranscodeProgress.tsx b/src/view/com/composer/videos/VideoTranscodeProgress.tsx index db6988092..3e26230ff 100644 --- a/src/view/com/composer/videos/VideoTranscodeProgress.tsx +++ b/src/view/com/composer/videos/VideoTranscodeProgress.tsx @@ -4,6 +4,7 @@ import {View} from 'react-native' import ProgressPie from 'react-native-progress/Pie' import {ImagePickerAsset} from 'expo-image-picker' +import {clamp} from '#/lib/numbers' import {isWeb} from '#/platform/detection' import {atoms as a, useTheme} from '#/alf' import {ExternalEmbedRemoveBtn} from '../ExternalEmbedRemoveBtn' @@ -20,10 +21,16 @@ export function VideoTranscodeProgress({ }) { const t = useTheme() - const aspectRatio = asset.width / asset.height - if (isWeb) return null + let aspectRatio = asset.width / asset.height + + if (isNaN(aspectRatio)) { + aspectRatio = 16 / 9 + } + + aspectRatio = clamp(aspectRatio, 1 / 1, 3 / 1) + return ( <View style={[ @@ -32,7 +39,7 @@ export function VideoTranscodeProgress({ t.atoms.bg_contrast_50, a.rounded_md, a.overflow_hidden, - {aspectRatio: isNaN(aspectRatio) ? 16 / 9 : aspectRatio}, + {aspectRatio}, ]}> <VideoTranscodeBackdrop uri={asset.uri} /> <View |