-
-
Notifications
You must be signed in to change notification settings - Fork 132
Description
Current behavior
When using VideoCompressor.compress() with maxSize: 1080 on Android, the compressed video file becomes corrupted/unplayable. The compressed video:
- Shows a black screen when played with
react-native-video(ExoPlayer) - Throws
ExoPlaybackException: ERROR_CODE_PARSING_CONTAINER_UNSUPPORTEDerror - Results in error message: "None of the available extractors could read the stream."
- The file appears to exist and has a size of 28 (which is weird), but is not in a valid/playable format
This occurs specifically when the maxSize parameter is set. When maxSize is removed (using only bitrate and compressionMethod: 'manual'), compression works correctly.
Code example:
const compressedVideoUri = await VideoCompressor.compress(file.uri, {
compressionMethod: 'manual',
maxSize: 1080, // This causes corruption
minimumFileSizeForCompress: 15,
bitrate: 5_000_000,
});
Expected behavior
The compressed video should be playable with react-native-video on Android, maintaining proper container format and codec compatibility with ExoPlayer. The maxSize parameter should resize the video resolution without corrupting the file format.
Platform
- Android
- iOS
(Note: Issue confirmed on Android; iOS had no issues with the configuration, but used different videos, not sure if this can be the cause but don't think so)
React Native Version
0.75.4
React Native Compressor Version
1.13.0
Reproducible Steps And Demo
- Pick a video file from the device library using
react-native-image-picker - Compress the video using the configuration above with
maxSize: 1080 - Attempt to play the compressed video using
react-native-videoon Android - Observe: Black screen and ExoPlayer error
ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED
Workaround: Remove maxSize parameter, and compression works correctly (only using bitrate reduction).
Tested video files: MP4 format, various resolutions (1080p and above), file sizes > 15MB.