Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fail video if cannot load preview (#5138)

authored by

Samuel Newman and committed by
GitHub
515f87ed 3eef62d9

+13 -1
+13 -1
src/view/com/composer/videos/VideoPreview.web.tsx
··· 1 1 import React, {useEffect, useRef} from 'react' 2 2 import {View} from 'react-native' 3 3 import {ImagePickerAsset} from 'expo-image-picker' 4 + import {msg} from '@lingui/macro' 5 + import {useLingui} from '@lingui/react' 4 6 5 7 import {CompressedVideo} from '#/lib/media/video/types' 6 8 import {clamp} from '#/lib/numbers' 9 + import * as Toast from '#/view/com/util/Toast' 7 10 import {ExternalEmbedRemoveBtn} from 'view/com/composer/ExternalEmbedRemoveBtn' 8 11 import {atoms as a} from '#/alf' 9 12 ··· 19 22 clear: () => void 20 23 }) { 21 24 const ref = useRef<HTMLVideoElement>(null) 25 + const {_} = useLingui() 22 26 23 27 useEffect(() => { 24 28 if (!ref.current) return ··· 32 36 }, 33 37 {signal}, 34 38 ) 39 + ref.current.addEventListener( 40 + 'error', 41 + () => { 42 + Toast.show(_(msg`Could not process your video`)) 43 + clear() 44 + }, 45 + {signal}, 46 + ) 35 47 36 48 return () => { 37 49 abortController.abort() 38 50 } 39 - }, [setDimensions]) 51 + }, [setDimensions, _, clear]) 40 52 41 53 let aspectRatio = asset.width / asset.height 42 54