Colton Idle
05/31/2021, 7:04 PMremember
method appropriate to make sure the composable doesn't reload the video on every compostion?
2. LaunchedEffect (I haven't used it before) seems like an interesting use case to use to update the fact that the video url has changed. Maybe the fact that it's called "Effect" is throwing me off, but would there be any other way to do this?
3. How does one properly dispose of this video playback. Does the composable clean up the androidView inside of it when I don't show it on screen anymore?Colton Idle
05/31/2021, 7:08 PMSaiedmomen
05/31/2021, 8:12 PMremember(key1 = "url") {...}
if getting url is not async. launchedEffect otherwise.
3. There is a disposableEffect
API for clean up.Halil Ozercan
05/31/2021, 9:08 PMremember
call.
2. I thought of video URL as part of the state and ExoPlayer is surely not very compose friendly with its API. So, LaunchedEffect
is a good candidate to update your player instance with the latest URL.
3. If the composable that holds your AndroidView
leaves the composition, you can safely assume that AndroidView
is cleaned up after. You are responsible for clearing ExoPlayer side of things. DisposableEffect
should be enough.Colton Idle
05/31/2021, 9:15 PMHalil Ozercan
05/31/2021, 9:40 PM