5

I am using exoplayer2 via androidx.media3:media3-exoplayer:1.0.0-beta03. I have a androidx.media3.ui.PlayerView in my XML layout, and then in my code I am creating an Exoplayer with ExoPlayer.Builder and assigning it to playerView.setPlayer.

When the controls (PlayerControlView) are displayed, the entire video appears dark/dimmed. I don't want that, but I can't figure out how to disable it.

Searching Google I find references (link, link) to an old glitch involving backgroundDimEnabled. I don't think this is what I am seeing because (1) I don't find "backgroundDimEnabled" anywhere in our application (2) it happens on both dark and light themes, and (3) when I try the suggested workaround ((binding.videoView.getVideoSurfaceView() as SurfaceView).setZOrderOnTop(true);) the controls disappear, in other words z-order-on-top puts the video on top of the control view, which is not at all what I wanted. If there is somewhere I supposed to affirmatively set backgroundDimEnabled="false", I don't know what XML to put that on.

I am using Kotlin but that probably doesn't matter.

EDIT: Old appearance (good)
New appearance (dimmed)

mcc
  • 131
  • 1
  • 5

1 Answers1

2

Okay so as far as I can tell this turns out to be a Jetpack Media3-specific thing. If you replace exo_player_control_view.xml with one from the base Exoplayer library, the dim curtain goes away (but this will break other things).

So to undo it, what you need to do is copy exo_player_control_view.xml out of whatever version of

https://github.com/androidx/media/blob/release/libraries/ui/src/main/res/layout/exo_player_control_view.xml

...corresponds to your version of media3, and put it in your project at app/src/main/res/layout/exo_player_control_view.xml. Then edit this file to change @id/exo_controls_background so that android:background="@color/exo_black_opacity_60" becomes android:background="@android:color/transparent".

mcc
  • 131
  • 1
  • 5
  • 1
    By the way, if I am right that the jetpack/media3 and exoplayer distributions of exoplayer differ, then maybe there should be a jetpack-media3 tag on Stack Overflow. I don't know how to make that happen. – mcc Feb 21 '23 at 02:36