react-native-compressor icon indicating copy to clipboard operation
react-native-compressor copied to clipboard

start failed , promise reject

Open abdulragib opened this issue 1 year ago • 1 comments

Current behavior

when i try to do compression then it show unhandled promise reject , start failed, but when i restart app , compression works fine,

Expected behavior

it should be without any promise rejection

Platform

  • Android
  • [X] iOS

i did'nt check the on ios

React Native Version

0.74.0

React Native Compressor Version

1.8.25

Reproducible Steps And Demo

dont know how to reproduce same bcz sometime it error comes , it did'nt goes until i restart the app

import {VideoMetadata} from 'react-native-video'; import { Video as VideoCompressor, getVideoMetaData, } from 'react-native-compressor';

export const videoCompress = async (uri, bitrate, width) => { const videoCompressionLevel = 80; const originalVideoMetada: VideoMetadata = (await getVideoMetaData( uri, )) as VideoMetadata;

let targetBitrate: number = Math.round( (originalVideoMetada.size / ((originalVideoMetada.duration / 60) * 0.0075)) * (1 - videoCompressionLevel / 100), );

// Set a maximum bitrate to prevent excessive bitrate values const MAX_BITRATE = 1000000; // 1mbps bitrate

// Ensure that the bitrate is not higher than the maximum value if (targetBitrate > MAX_BITRATE) { targetBitrate = MAX_BITRATE; // Apply the cap on bitrate }

if (bitrate < MAX_BITRATE) { targetBitrate = bitrate; }

console.log('targetBitrate', targetBitrate);

const compressedVideo = await VideoCompressor.compress( uri, { progressDivider: 20, maxSize: 1280, bitrate: targetBitrate, compressionMethod: 'manual', }, progress => { console.log('Compression Progress: ', progress); }, );

return compressedVideo; };

i did'nt figure out earlier that it was compressor error until i check sentry

abdulragib avatar Nov 12 '24 17:11 abdulragib

👋 @abdulragib Thanks for opening your issue here! If you find this package useful hit the star🌟!

github-actions[bot] avatar Nov 12 '24 17:11 github-actions[bot]

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 13 '25 02:11 github-actions[bot]