android-video-trimmer icon indicating copy to clipboard operation
android-video-trimmer copied to clipboard

Fatal Exception: java.lang.IllegalArgumentException

Open shan-lak opened this issue 3 years ago • 1 comments

Library crash on Android 10 devices when going to trim videos in production mode, but it work fine in development mode. Also, the video cannot play on trim video screen. Only show a black screen with a play button in android 10. But above android 10, this issue not happen in both development and production. I'm using the following version. 'com.github.a914-gowtham:android-video-trimmer:1.7.3'

TrimVideo.activity(url) .setTitle("") .setCompressOption(CompressOption()) .setHideSeekBar(true) .setTrimType(TrimType.MIN_MAX_DURATION) .setMinToMax(1, 10) //seconds .start(this,startForResult)

How can i solve this issue?

java.lang.IllegalArgumentException android.media.MediaMetadataRetriever.setDataSource (MediaMetadataRetriever.java:85) com.gowtham.library.ui.ActVideoTrimmer.getCompressionCmd (ActVideoTrimmer.java:552) com.gowtham.library.ui.ActVideoTrimmer.trimVideo (ActVideoTrimmer.java:513) com.gowtham.library.ui.ActVideoTrimmer.onOptionsItemSelected (ActVideoTrimmer.java:497)

shan-lak avatar Sep 23 '22 07:09 shan-lak

Hi.

I discovered that android 9 and below devices have these issues. I found a solution by importing the project. here is my solution.

utils > fileUtils > getRealPath func

Cursor cursor = context.getContentResolver().query(uri,projection,nul,nul,nul);

change to

Cursor cursor = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,projection,nul,nul,nul);

I checked it on different android versions, it works for me

farukkyldzx avatar Jul 17 '23 16:07 farukkyldzx