Hey everyone is Media3 Transformer viable right no...
# compose
o
Hey everyone is Media3 Transformer viable right now? I am not able to add a simple effect to a video for testing. I am trying to add this simple effect:
Copy code
val scalingEffect = ScaleAndRotateTransformation.Builder()
    .setRotationDegrees(50f)
    .build()
val testEffects = Effects(listOf(), listOf(scalingEffect))
val exoPlayer = remember(context) {
    ExoPlayer.Builder(context).build().also { exoPlayer->
        exoPlayer.setMediaItem(editedMediaItem.mediaItem)
        exoPlayer.setVideoEffects(testEffects.videoEffects)
        exoPlayer.playWhenReady = true
        exoPlayer.addListener(object : Player.Listener {
            @Deprecated("Deprecated in Java")
            override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) {
                Log.d("MyTag", "Player state: $playbackState, Play when ready: $playWhenReady")
            }
        })
        exoPlayer.prepare()
    }
}
but when I play this video and preview it using PlayerView, I am getting black screen. Without adding the effect, video works. But this simple effect for testing is not working properly.
Copy code
exoPlayer.setVideoEffects(effects.videoEffects)
this line is the problem maker. The video is playing in the background, but UI is completely black. Any ideas?
z
It seems odd that you’re creating the effects outside a
remember
, but I’m not sure how that would cause this issue. The analogous code works in views?
o
Just now I have checked it with creating effects inside of a
remember
but still I am getting a black screen while video is playing in the background. When I comment out exoPlayer.setVideoEffects, video is opening just fine. I am doing something wrong on creating effects but for now, not sure what.