Open simahero opened 4 years ago
Thank you for your endorsement, and sorry for replying late.
I tried to run the test app and it works well on two of my phones. Did you grant the permission and pick the video? Could you give me more specific details so that I could help you?
Hi!
Also sorry for the late response, my PC got broken.
Whenever I use your trimmert GUI, all im getting is a black screen, but the trimmer is visible (no thumbnails). I logge if i have schosen a valid video, and its not an URI problem.
Also im using Java, but that shouldnt be a problem, right?
`<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".Fragments.CREATE.CutFragment">
<Button
android:id="@+id/button"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/ic_done_black_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/durationView"
android:layout_width="wrap_content"
android:textSize="12sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@+id/video_trimmer"
android:layout_marginBottom="12dp"
android:textColor="@android:color/white"
android:layout_height="wrap_content"/>
<idv.luchafang.videotrimmer.VideoTrimmerView
android:id="@+id/video_trimmer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="11dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:vtv_window_bar_width="10dp"
app:vtv_window_border_color="@android:color/white"
app:vtv_window_border_width="2dp"
app:vtv_window_left_bar="@drawable/trimmer_left_bar"
app:vtv_window_right_bar="@drawable/trimmer_right_bar" >
</idv.luchafang.videotrimmer.VideoTrimmerView>
<VideoView
android:id="@+id/videoView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>`
im setting the trimmer like this
videoTrimmerView.setVideo(new File(model.getCutVid().getValue().getPath())) .setMinDuration(0) .setMaxDuration(10000) .setFrameCountInWindow(8) .setOnSelectedRangeChangedListener(this) .show();
It looks good to me. Can you paste the error log? Also, correct me if I am wrong, it's a local video file and the read permission has already been granted?
There are no errors. It is loaded, but not working corretly.
Yes it is a local file, and permission are granted.
Btw inlike your work! Looks awesome!
whoopps, there is an error!
E/RecycleView: No adapter attached; skipping layout
Okay I guess I found the reason. Min duration cannot be 0 cause we can't cut video with no frames. I should throw out a log to warn it.
I have tried to set minduration, but still nothing happens :(
Can you check if all of the following condition are matched?
minDuration > 0L
maxDuration > 0L
maxDuration >= minDuration
videoLength >= minDuration
Same issue please provide a solution please
I have the same problem. Has anyone solved it? The sample app works fine. But using the library creates a problem.
I identified the problem.
It does not work if I use videoTrimmerView.show() directly from onCreate() after getting the filepath using Intent from another activity.
To use it directly in onCreate(), need to Handler().postDelayed about 100ms.
I am not even able to see the slider all, I see is blank space nothing else. even after postDelayed
in main looper
The problem seems to be that the presenter is instantiated in onAttachedToWindow
.
Do the show in a post
and it should work.
Waiting for a fix. :)
Running into the same issues, RecyclerView: No adapter attached; skipping layout
, I am using the library in my java project shouldn't be a problem right? The demo seems to work when I build it
It is working ? I have added a 2.5s delay. But it still does not work.
handler = trimmerView .setVideo(new File(file)) .setMaxDuration(info.getDuration()) // millis .setMinDuration(1000) // millis .setFrameCountInWindow(10) .setExtraDragSpace(10) // pixels .setOnSelectedRangeChangedListener(this); new Handler().postDelayed(new Runnable() { @Override public void run() { handler.show(); } }, 2500);
I identified the problem.
It does not work if I use videoTrimmerView.show() directly from onCreate() after getting the filepath using Intent from another activity.
To use it directly in onCreate(), need to Handler().postDelayed about 100ms.
thanks mate. this solved my issue ❤️
I solved this issue by removing code inside onAttachWindow to somewhere else.
Place below code inside initViews function private fun initViews() { videoFrameListView.layoutManager = LinearLayoutManager(context, HORIZONTAL, false) presenter = obtainVideoTrimmerPresenter() .apply { onViewAttached(this@VideoTrimmerView) } }
and one more change is add OnPresenterCreated inside the onShow()
fun show() { presenter?.show() onPresenterCreated() }
This is working for me.
I have the same issue. The demo projects working because it implements older constraint layout api i.e.
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
if I update this then it won't work in demo project also.
if anyone has solution please share. Thank you all.
@easedroid You can try the above solution https://github.com/freddyfang/android-video-trimmer/issues/1#issuecomment-722313725
and here is the output file
I solved this issue by removing code inside onAttachWindow to somewhere else.
Place below code inside initViews function private fun initViews() { videoFrameListView.layoutManager = LinearLayoutManager(context, HORIZONTAL, false) presenter = obtainVideoTrimmerPresenter() .apply { onViewAttached(this@VideoTrimmerView) } }
and one more change is add OnPresenterCreated inside the onShow()
fun show() { presenter?.show() onPresenterCreated() }
This is working for me.
I have tried and have changed only these two methods as you mentioned but no luck, are you using latest constraint layout api? if yes then can you share the complete block that you have changed.
yes i am using constraint layout 1.1.3
can you can share a sample project ?? so that we can fix this issue.
Hi guys this is my solution and its works wery well ..So you can update the last version of ConstraintLayout : 1- just change the ConstraintLayout to Relativelayout in layout_video_trimmer like this : <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="5dp" android:paddingBottom="5dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/videoFrameListView"
android:layout_width="wrap_content"
android:layout_height="43dp"
android:layout_gravity="center_vertical"
android:layout_centerInParent="true"
android:overScrollMode="never"
android:paddingTop="2dp"
android:paddingBottom="2dp"/>
<idv.luchafang.videotrimmer.slidingwindow.SlidingWindowView
android:id="@+id/slidingWindowView"
android:layout_width="wrap_content"
android:layout_height="43dp"
android:layout_marginStart="11dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="11dp"
android:layout_centerInParent="true" />
2- update the idv.luchafang.videotrimmer.VideoTrimmerView in main_layout like this : <idv.luchafang.videotrimmer.VideoTrimmerView android:id="@+id/videoTrimmerView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="70dp" app:layout_constraintBottom_toBottomOf="parent" app:vtv_window_bar_width="10dp" app:vtv_window_border_color="#FF0000" app:vtv_window_border_width="2dp" app:vtv_window_left_bar="@drawable/trimmer_left_bar" app:vtv_window_right_bar="@drawable/trimmer_right_bar" tools:layout_editor_absoluteX="0dp" />
hop that help you
@FuherProgramer Your solution is correct, only need to change Constraint Layout to RelativeLayout and i also change ConstraintLayout implementation to RelativeLayout in class VideoTrimmerView, Now its working fine
Hello, the views are not showing when using com.google.android.material:material:1.6.1 dependency.i have tried many solution but nothing worked. Please tell waht could be possible solution for that
Hello @Mohit-AppCrunk the above solution I posted is working fine, you can make changes in you file.
I forked it, updated the dependencies and gradle also fixed the blank VideoTrimmerView Error: https://github.com/MarvinStelter/android-video-trimmer
Hello!
I am trying to implement your lib (which looks awesome!).
However whenever i run the app, the slider is black, and also i can not drag it.