You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
}
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
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
The text was updated successfully, but these errors were encountered: