Handle web video duration

This commit is contained in:
Eric Bailey
2025-08-18 11:30:44 -05:00
parent 64851fcf7a
commit c6498b98ce
+15 -5
View File
@@ -89,6 +89,7 @@ const SUPPORTED_IMAGE_MIME_TYPES = (
'image/png', 'image/png',
'image/svg+xml', 'image/svg+xml',
'image/webp', 'image/webp',
'image/avif',
isNative && 'image/heic', isNative && 'image/heic',
] as const ] as const
).filter(Boolean) ).filter(Boolean)
@@ -324,11 +325,20 @@ async function processImagePickerAssets(
supportedAssets = supportedAssets.slice(0, 1) supportedAssets = supportedAssets.slice(0, 1)
} }
if ( if (supportedAssets[0].duration) {
supportedAssets[0].duration && if (isWeb) {
supportedAssets[0].duration > VIDEO_MAX_DURATION_MS /*
) { * Web reports duration as seconds
errors.add(SelectedAssetError.VideoTooLong) */
supportedAssets[0].duration = supportedAssets[0].duration * 1000
}
if (supportedAssets[0].duration > VIDEO_MAX_DURATION_MS) {
errors.add(SelectedAssetError.VideoTooLong)
supportedAssets = []
}
} else {
errors.add(SelectedAssetError.Unsupported)
supportedAssets = [] supportedAssets = []
} }
} else if (selectableAssetType === 'gif') { } else if (selectableAssetType === 'gif') {