a914-gowtham / android-video-trimmer

Helps to trim local videos with compress option on Android applications using Exoplayer 2 and FFmpeg.
Other
362 stars 115 forks source link

Fatal Exception: java.lang.IllegalArgumentException #89

Open shan-lak opened 1 year ago

shan-lak commented 1 year ago

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)

farukkyldzx commented 11 months ago

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