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 Compression Background Mode Expiration Limit #286

Open
Hosam-hsm opened this issue Apr 11, 2024 · 1 comment
Open

Video Compression Background Mode Expiration Limit #286

Hosam-hsm opened this issue Apr 11, 2024 · 1 comment

Comments

@Hosam-hsm
Copy link

Hosam-hsm commented Apr 11, 2024

Hi, Is it possible to increase the time limit of video background compression? Currently I'm unable to compress a video of size 1GB in background due this limitation. The task automatically expires after some time while the compression was only completed 70-80% done. Also is it normal that large video (4k, 1GB) takes more than 30 seconds to compress? I am using the latest expo sdk (50.0.14) and react-native-compressor (1.8.24).

This is how I'm using the library

try {
     const Compressor = isVideo ? VideoCompressor : ImageCompressor;

     await VideoCompressor.activateBackgroundTask((data) => {
       console.log("Background Mode Expired", data);
     });

     const compressed = await Compressor.compress(
       realPath,
       {
         progressDivider: 10,
         // compressionMethod: isVideo ? "manual" : "auto",
         // ...(isVideo && { bitrate: 3000000 }),
       },
       (p) => {
         console.log(
           `File ${fileIndex + 1} Compression: ${Math.ceil(p * 100)}% complete`,
         );
       },
     );

     const compressedMetaData = await getMetaData(compressed);
     metaData = compressedMetaData;
     fileSize = metaData.size;
     path = compressed;

     await VideoCompressor.deactivateBackgroundTask();
   } catch (error) {
     throw error;
   }
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant