File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/view/com/composer/videos Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 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,6 +22,7 @@ export function VideoPreview({
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,11 +36,19 @@ export function VideoPreview({
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
You can’t perform that action at this time.
0 commit comments