Closed MohamedFattah95 closed 4 years ago
Make sure you have to give video uri as String and try Logging your videoUri before call the below code
TrimVideo.activity(String.valueOf(videoUri)) .start(this);
Refer this
This is my video path as String
/storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20200507-WA0074.mp4
However it still not loading the video.
@a914-gowtham
Can u show me your builder code for opening the TrimmerActivity and OnActivityResult method
TrimVideo.activity(media.getPath()) .setAccurateCut(true) .setTrimType(TrimType.MIN_MAX_DURATION) .setMinToMax(1, 15) .start(this);
OnActivityResult:
if (requestCode == TrimVideo.VIDEO_TRIMMER_REQ_CODE && resultCode == RESULT_OK && data != null) { Uri uri = Uri.parse(TrimVideo.getTrimmedVideoPath(data)); Log.d("Trim", "Trimmed path:: " + uri); }
Don't put media.getPath just use media
TrimVideo.activity(media) .setAccurateCut(true) .setTrimType(TrimType.MIN_MAX_DURATION) .setMinToMax(1, 15) .start(this);
"media" is an object of an video picker, not a String
.
media.getPath()
returns /storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20200507-WA0074.mp4 as a String
.
W/System.err: java.lang.NullPointerException: uriString at android.net.Uri$StringUri.(Uri.java:496)
at android.net.Uri$StringUri.(Uri.java:486)
at android.net.Uri.parse(Uri.java:458)
at com.gowtham.library.ui.ActVideoTrimmer.setDataInView(ActVideoTrimmer.java:173)
at com.gowtham.library.ui.ActVideoTrimmer.onPostCreate(ActVideoTrimmer.java:143)
at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1381)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3322)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at
android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2017) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7403) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)The video is not imported and I'm getting a blank player.