Halil Ozercan
08/25/2020, 2:50 PMppvi
08/25/2020, 3:34 PMHalil Ozercan
08/25/2020, 4:10 PMrememberSavedInstanceState
didn't work as I expected. I assumed it was going to hold on to the state as long as the composition didn't change order. However, LazyColumnFor
items are not able to preserve their state by using rememberSavedInstanceState
, maybe I did something wrong?
If I were to directly put VideoPlayer
composable in each item, it produced a high amount of lag. Scrolling dropped the FPS to almost 1~2. Instead, I had to use launchInComposition
to delay the actual composition while adding a placeholder with the same size.
Also ExoPlayer used a lot of memory initially, so I had many experiments to solve that but it isn't really related to Compose.
Since LazyColumnFor
still does not share its scroll state, I had to use onPositioned
to understand which item entered the view or left. I don't think it is the best option but it helped me to write a Coordinator
to manage which video should be played at any given scroll state.Andrey Kulikov
08/25/2020, 4:18 PMHalil Ozercan
08/25/2020, 4:20 PM