3

As shown in the image and video, I am facing an issue while using styled player view.

I have set controllerShowTimeoutMs to 2 seconds, but I am getting results as shown in the below image... click to see image

Or as In this video... YouTube link

When the controller don't get any input for 2 seconds, the player's default timebar's visibility is changed.

Then again after 2 seconds all the controls visibility is changed.

I want to make all the controls disappear simultaneously in two seconds.

I tried to check many things but couldn't find the cause of the issue...

Below is the code for Exoplayer in XML

   <com.google.android.exoplayer2.ui.StyledPlayerView
    android:id="@+id/home_exoplayer_view"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:controller_layout_id="@layout/exo_control_layout_main"
    app:layout_constraintDimensionRatio="16:9"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:shutter_background_color="?colorTextBackgroundBlack"
    app:use_controller="true"
    app:show_buffering="always"
    app:player_layout_id="@layout/exo_player_layout_main"
    />

And in my fragment

//Autohide controller in below Mili seconds unless the user taps
        exoPlayerView.controllerShowTimeoutMs = 2000

//Don't show controller when playback starts
        exoPlayerView.controllerAutoShow = false
2
  • Have you found a solution yet?
    – Regex
    Commented Aug 29, 2022 at 1:55
  • Yes, the solution of @welcomeworld works well and now I have implemented it, but before that, I implemented a handler with the use of postDelayed to measure time in milliseconds and after my custom time has passed I could hide the controller manually using the player.hideController() method. You can try this way if you want to keep animations when the controller is shown. Commented Aug 31, 2022 at 8:27

1 Answer 1

7

The simple workaround is to disable the animation.Like this

    <com.google.android.exoplayer2.ui.StyledPlayerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:animation_enabled="false" />

More detail in StyledPlayerControlViewLayoutManager.hide()

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.