Description
Issue
If you have a StyledPlayerView
with height=wrap_content
that is shown "inline" with other views, the Player takes over the entire screen whenever the controls are displayed, and does not honor the wrap_content
height. See below for a link to a github repo that contains a demo app that can be used to reproduce the issue
URI to test content for reproduction
Video URL: "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"
Demo App Github URL: https://github.com/Bradleycorn/InlineExoplayer
ExoPlayer version number: 2.13.2
Android version: 29
Android device: Pixel 4XL
I am new to ExoPlayer, so forgive me if there is some way to mitigate this problem. I could not find anything in the samples, guides, issues list, stackoverflow, etc.
Steps to Reproduce
- Create an app that uses the following layout, and wire it up to play a video in the
StyledPlayerView
when opened. (or use the demo app in the github repo linked above)
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.MainFragment">
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/video_view"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:background="#ff0000"
android:textColor="#ffffff"
android:text="Another View"
android:textAlignment="center"
android:gravity="center" />
</androidx.constraintlayout.widget.ConstraintLayout>
The desired result is a video that plays "inline", above some other content, as seen in this screen shot from the attached demo app. When the video is clicked to display it's controls, it should remain "inline" and the controls displayed without covering or obscuring the other screen content.
- When the video plays, click anywhere on the video to display the controls.
Actual Result
When the controls are displayed, the player view covers up the view below and seems to fill the entire screen. See the attached video that shows the problem:
Desired Result
When the app loads, the video should be displayed "inline" above the other content, and not take over the entire screen. Also, when the video is clicked and the controls are displayed, the video should remain "inline" above the other content on the screen, and show the controls over the playing video, without taking over the entire screen.
Activity