eneim / toro

Video list auto playback made simple, specially built for RecyclerView
Apache License 2.0
1.42k stars 253 forks source link

Playback issue, playback info resets to previous value #328

Open prat-z opened 6 years ago

prat-z commented 6 years ago

Playback info is getting reset to previous value when setting the value in onActivityResult().

In my use case, I have 2 activities, one of them having a feed containing videos and other being the full screen video activity. When returning back from full screen to the feed, I want to save the playback info of the video. I am doing this in onActivityResult().

The problem is that the value gets rewritten to the old state, from tmpStates when onWindowVisibilityChanged is called for Container.java, which is after onActivityResult().

Am I using it the wrong way? If yes, whats the right to achieve this. If no, what is the workaround for this.

Thanks in advance.

eneim commented 6 years ago

@prat-z How you save and restore the PlaybackInfo using onActivityResult()? The tmpStates should do nothing related to the Activity I think.

prat-z commented 6 years ago

@eneim I am calling the method savePlaybackInfo() of Container class in onActivityResult(). The onWindowVisibilityChanged method of Container is called after that, which resets my change.

eneim commented 6 years ago

@prat-z Do you have orientation change during the transition?

I tried with my demo (the CustomLayoutActivity/CustomLayoutFragment) and it works fine, though the default behaviour doesn't have orientation change. Also, do you retain your Activity in config change? (by setting the flag 'configChange' in manifest).

prat-z commented 6 years ago

@eneim Yes, orientation change is happening in my case. The orientation of the next screen is fixed to Landscape, without setting flags 'configChange'.

eneim commented 6 years ago

@prat-z I see, so switching to full-screen = the App will switch to landscape mode? And if user turn off full-screen, does your app go back to portrait? Or it stays in landscape mode from there? Can you double check my CustomLayoutActivity demo? Of can you give a few lines of code of your Activity or Fragment where you start the full-screen? Especially the way you use onActivityResult. Will take some time on this asap.