Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Video] TEMP disable skip compression #5271

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/lib/media/video/compress.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {getVideoMetaData, Video} from 'react-native-compressor'
import {ImagePickerAsset} from 'expo-image-picker'

import {SUPPORTED_MIME_TYPES, SupportedMimeTypes} from '#/lib/constants'
// import {SUPPORTED_MIME_TYPES, SupportedMimeTypes} from '#/lib/constants'
import {extToMime} from '#/state/queries/video/util'
import {CompressedVideo} from './types'

const MIN_SIZE_FOR_COMPRESSION = 1024 * 1024 * 25 // 25mb
// const MIN_SIZE_FOR_COMPRESSION = 1024 * 1024 * 25 // 25mb

export async function compressVideo(
file: ImagePickerAsset,
Expand All @@ -16,21 +16,21 @@ export async function compressVideo(
): Promise<CompressedVideo> {
const {onProgress, signal} = opts || {}

const isAcceptableFormat = SUPPORTED_MIME_TYPES.includes(
file.mimeType as SupportedMimeTypes,
)
// const isAcceptableFormat = SUPPORTED_MIME_TYPES.includes(
// file.mimeType as SupportedMimeTypes,
// )

const minimumFileSizeForCompress = isAcceptableFormat
? MIN_SIZE_FOR_COMPRESSION
: 0
// const minimumFileSizeForCompress = isAcceptableFormat
// ? MIN_SIZE_FOR_COMPRESSION
// : 0

const compressed = await Video.compress(
file.uri,
{
compressionMethod: 'manual',
bitrate: 3_000_000, // 3mbps
maxSize: 1920,
minimumFileSizeForCompress,
// minimumFileSizeForCompress,
getCancellationId: id => {
if (signal) {
signal.addEventListener('abort', () => {
Expand Down
Loading