I'm using the exoplayer lib and a problem I have i...
# compose
z
I'm using the exoplayer lib and a problem I have is that fading doesn't work, so it just pops in and out. Is there some way to fix this?
Copy code
@Composable
fun Player(
    modifier: Modifier = Modifier,
    player: Player,
) = DisposableEffect(
    AndroidView(
        modifier = Modifier
            .aspectRatio(16f / 9f)
            .then(modifier),
        factory = { context ->
            PlayerView(context).apply {
                this.player = player
                useController = false
                useArtwork = true
                resizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT
            }
        }
    )
) {
    onDispose(player::release)
}
Whats weird is if I add
videoSurfaceView!!.alpha = 0.9f
in the apply block then the fade transition works
g
Maybe an optimization that view is not loaded when alpha==0.0f ? Have you tried to fade in from 0.00001f ?
m
i noticed this issue with maps as well. I don’t know if it is expected, but setting alpha on a map make it disappear. Maybe the same with video?
f
Have you tried setting
surface_type
to
texture_view
?
Copy code
app:surface_type="texture_view"