Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other Fragment Got Blank when video is preparing to start or video is already start #87

Open
jeymsearchnative opened this issue Jul 12, 2018 · 14 comments

Comments

@jeymsearchnative
Copy link

I have Bottom navigation View and In First tab i have put your awesome video view library but whenever i am trying to switch the views when video is being start or playing the fragment got blank and application itself got blank. Can you suggest any thing about this?

@DotsquaresA
Copy link

Same problem i am facing in Menu navigation please suggest any thing about this.

@jeymsearchnative
Copy link
Author

Hello @DotsquaresA ,
I have solved the issue regarding blank screen. Please let me know if you did not get the solution.

@NarenderNagpal
Copy link

Still, I am facing the same issue. Can you please provide the solution??

@Kasun-Chinthaka-Piyarathna

e know if you did not get the solution.

Please let me know how to solve the issue regarding the blank screen?

@emailsubjekt
Copy link

I'm getting this same problem. When I scroll up and then pull again to go more up, the first video item turns blank (if recyclerView.setPlayOnlyFirstVideo(true); - then it's only 1 item that turns blank, if it's set to false, all items turn blank) - in both cases all other fragments turn blank. I get no error, other than something possibly connected with sound permissions but I doubt that's the problem. I have tried changing a variety of combinations in the settings when recyclerview is setup, but nothing. I have also used recyclerView.setHasFixedSize(true); , it didn't help, I have also used int itemViewType = 0; recyclerView.getRecycledViewPool().setMaxRecycledViews(itemViewType, 0); // also didn't help). Then I made a
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@OverRide
public void onScrolled(@nonnull RecyclerView recyclerView, int dx, int dy) {
LinearLayoutManager layoutManager=LinearLayoutManager.class.cast(recyclerView.getLayoutManager());
assert layoutManager != null;
int totalItemCount = layoutManager.getItemCount();
int lastVisible = layoutManager.findLastVisibleItemPosition();
int firstVisible = layoutManager.findFirstVisibleItemPosition();

if(dy < 1){
recyclerView.scrollTo(0,1);
}

It stopped going blank after scrolling to bottom and trying to scroll more down, although it's obvious that I'm trying to protect the top here as when it comes to top it's 0, but the listener doesn't report fast enough and sometimes go way below zero when you scroll all the way up and even with trying to catch it you can't because it surpasses it and then it send the signal (hey! I've passed it long time ago! - I mean what good is that? none). So I don't know dude, maybe you can somehow limit the vertical scroll in the library or fix it in some other way. Please let us know if we can somehow help, or revert to previous version that worked?

@emailsubjekt
Copy link

emailsubjekt commented Feb 9, 2019

I've solved this as a temporary fix

In fragment do this setUserVisibleHint

@OverRide
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);

    if (isVisibleToUser){
        Log.d("MyFragment", "Fragment is visible.");
    }else{
             if(navItemIndex == #ofFragment){
                 //RESTART FRAGMENT HOLDER (eg Intent) 
              }
    }

Listen to navItemIndex from Fragment Holding activity and when index is the same as the recyclerview fragment, if fragment is not showing, trigger an activity restart, it restarts everything, you can see the screen jump but it works. I really hope this will get fixed, I don't know if I'm gonna leave my application like this, I'm thinking about reverting back to images only because it's not really a smooth transition now. Can we get an update on this, what is causing this, when will it be solved? Thanks for the library either way!

@emailsubjekt
Copy link

Hello @DotsquaresA ,
I have solved the issue regarding blank screen. Please let me know if you did not get the solution.

Hi, can you please post the solution then?

@emailsubjekt
Copy link

I've come to realize it might be due to bigger mp4 files being used, such as a 1MB mp4, will try with smaller videos and report back later

@emailsubjekt
Copy link

emailsubjekt commented Feb 10, 2019

Nope, I've compressed mp4 to around 200kb, still causing the same issue, all fragments are still becoming completely blank. I've realized if I just go out to see what other apps are open in the phone and then come back to the app immediatelly the whole view refreshes and all the fragments have their screens back. Might try to do a fix that way.

@emailsubjekt
Copy link

Solved it

No wonder @DotsquaresA didn't post the answer. I had to take out all the code from the library and basically fix every part that was giving an error in fragments. The last part is not to use the onStart method in your fragment. Can you please fix this in the library, try it out in a fragment and you will see the library doesn't work in it's current form. If you scroll to the top and then try to scroll up more like doing a pull down to refresh, images or video will disappear in random positions and when you navigate to other fragments they will all be blank and without content even though there was content there before. This is a unique error that I have never encountered before in over 500 projects that it crahes all the fragments like that but you're still able to navigate through the app, just not seeing anything. You need to restart the app, basically go out and come back and all the views are there again. Other than that it works great! Thank you for this great work of art! Please fix the fragment problem when you have the time. Thanks!

@Simion777
Copy link

Simion777 commented Jun 26, 2019

give me please your code fixed or publish

@emailsubjekt
Copy link

give me please your code fixed or publish

I haven't solved it, we have an app in beta that still has empty image issues when scrolled 2 times to the top and back. I am trying to solve it right now since the maker of this library didn't respond since February and it's now July

@emailsubjekt
Copy link

Ok, I've just solved it yesterday, it's really complicated and the solution makes no sense but it works. I wouldn't advise trying if you're a beginner.

@Simion777
Copy link

Simion777 commented Jul 9, 2019

Ok, I've just solved it yesterday, it's really complicated and the solution makes no sense but it works. I wouldn't advise trying if you're a beginner.
For our solution I found a very good library https://github.com/eneim/toro and with cover photo see this issue https://github.com/eneim/toro/blob/dev-v3/demo-ads/src/main/java/toro/demo/ads/mopub/VideoViewHolder.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants