Any idea on how to restore the embedded media play...
# compose-desktop
l
Any idea on how to restore the embedded media player after a rerender? I get the audio playing in background but the video is lost
j
Hard to know what's going on here without being able to examine your code, but it seems like the recomposition process failed to skip over your media player, which either means that one of your parameters changed or that we have a bug. When you say "video is lost", what are the symptoms? Does the widget still occupy space on the screen? Do you get a solid box (black/blue/something) instead? I'd suggest filing a bug at https://github.com/JetBrains/compose-jb/issues with a minimal repro of your bug so we can look into it further.
l
Well after a little tweaking I realized that I was passing to the video frame component the embedded media player component instead of a mutable state of it, now it works as spected.
j
Without being able to see your code and data types, I feel like that should still be fine, and would still encourage you to file a bug unless you're sure that it's entirely your fault.
l
Yes, I'm pretty sure it was my fault. I'm still figuring out how the rendering works but it makes sense to me that if don't use mutable states the component is reset in the next render, just like any other variable.
j
The thing is, that doesn't make sense to me. Recomposing the video player should not reset it (that would be a Compose bug) but... if one of your parents has an unstable key causing the entire subtree to get recreated each recomposition, or if you wrote a player widget that is not resilient to recomposition, those would be a bug in your code. Sounds like one of us has a bug, but based on your description thus far, it's unclear to me if it is our bug or your bug.
As a general rule: You should be able to recompose any widget at any time for any reason and it should NEVER have a negative impact on the behavior of your app.
l
Here is the code repo. The rerendering happens when I toggle the playlist panel.