Closed AtulSalgaonkar closed 3 years ago
@AtulSalgaonkar thank you for opening this issue and for the provided details and the solution, I will look into it and release a bug fix. Could you please state the scenario led to this? and maybe the approach you're using to pick/record the video, and the devices used perhaps just to reproduce the issue and ensure it is fixed. Thank you.
This crash occurred in Sample code of repository, i have mentioned the device details early, i.e. Model Name: Redmi Note 3 Pro Android Version: 6.0.1 And this crack occurred every time after i select video, i have mentioned line no and class name where it crashes, other then that if you need any information then let me know
@AbedElazizShe I am experiencing the same problem and I can confirm that this is an Android 6 issue. The issue is in Compressor.setOutputFileParameters
when calling MediaCodecInfo.CodecCapabilities.createFromProfileLevel
. Based on the documentation on Android 6 any methods of MediaCodecList
must be called before calling createFromProfileLevel
.
You can see it here
@AtulSalgaonkar @gookman thank you so much for the details, I must've missed it, It's fixed, I will release a new version shortly.
Issue fixed in version 0.8.1. Please let me know if you still have the issue. You can close the task if the problem is solved.
After compressing video file size was 0b
and after debug found bellow error in logs of sample code, have used LOW Quality
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
Line No: 570 File Name: Compressor.kt
in MediaCodecInfo.CodecCapabilities.createFromProfileLevel
Model Name: Redmi Note 3 Pro Android Version: 6.0.1
Solution: var capabilities: MediaCodecInfo.CodecCapabilities? = null try { capabilities = MediaCodecInfo.CodecCapabilities.createFromProfileLevel( MIME_TYPE, profile, level ) } catch (e: Exception) { printException(e) }
Added try catch block in it and now its working, just letting you know that there is NullPointerException in code