start failed , promise reject
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 Thanks for opening your issue here! If you find this package useful hit the star🌟!
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.