mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

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

fix min size for compression (#5272)

authored by samuel.fm and committed by

GitHub f9432398 24b07c6c

+10 -9
+10 -9
src/lib/media/video/compress.ts
··· 1 1 import {getVideoMetaData, Video} from 'react-native-compressor' 2 2 import {ImagePickerAsset} from 'expo-image-picker' 3 3 4 - // import {SUPPORTED_MIME_TYPES, SupportedMimeTypes} from '#/lib/constants' 4 + import {SUPPORTED_MIME_TYPES, SupportedMimeTypes} from '#/lib/constants' 5 5 import {extToMime} from '#/state/queries/video/util' 6 6 import {CompressedVideo} from './types' 7 7 8 - // const MIN_SIZE_FOR_COMPRESSION = 1024 * 1024 * 25 // 25mb 8 + const MIN_SIZE_FOR_COMPRESSION = 25 // 25mb 9 9 10 10 export async function compressVideo( 11 11 file: ImagePickerAsset, ··· 16 16 ): Promise<CompressedVideo> { 17 17 const {onProgress, signal} = opts || {} 18 18 19 - // const isAcceptableFormat = SUPPORTED_MIME_TYPES.includes( 20 - // file.mimeType as SupportedMimeTypes, 21 - // ) 19 + const isAcceptableFormat = SUPPORTED_MIME_TYPES.includes( 20 + file.mimeType as SupportedMimeTypes, 21 + ) 22 22 23 - // const minimumFileSizeForCompress = isAcceptableFormat 24 - // ? MIN_SIZE_FOR_COMPRESSION 25 - // : 0 23 + const minimumFileSizeForCompress = isAcceptableFormat 24 + ? MIN_SIZE_FOR_COMPRESSION 25 + : 0 26 26 27 27 const compressed = await Video.compress( 28 28 file.uri, ··· 30 30 compressionMethod: 'manual', 31 31 bitrate: 3_000_000, // 3mbps 32 32 maxSize: 1920, 33 - // minimumFileSizeForCompress, 33 + // WARNING: this ONE SPECIFIC ARG is in MB -sfn 34 + minimumFileSizeForCompress, 34 35 getCancellationId: id => { 35 36 if (signal) { 36 37 signal.addEventListener('abort', () => {