move logic out of compressVideo

This commit is contained in:
Samuel Newman
2024-06-06 12:20:09 +03:00
parent 6a54959080
commit ed17e94cec
2 changed files with 6 additions and 10 deletions
+2 -2
View File
@@ -14,9 +14,9 @@ export function useVideoState({setError}: {setError: (error: string) => void}) {
const {mutate, data, isPending, isError, reset, variables} = useMutation({
mutationFn: async (asset: ImagePickerAsset) => {
const compressed = await compressVideo(asset.uri, {
onStatistics: async statistics => {
onProgress: progressMs => {
if (asset.duration) {
setProgress(statistics.getTime() / asset.duration)
setProgress(progressMs / asset.duration)
}
},
})