question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set Default height when AspectRatioFrameLayout couldn't load

See original GitHub issue

[REQUIRED] Searched documentation and issues

ExoPlayer Doc, github issues and stackOverFlow

[REQUIRED] Question

I want to show controller on player in portrait orientation like youtube. My AspectRatioFrameLayout placed in center of page and it didn’t have specific height. When there is no network to play video or it needs to be recalculate again , … the controller will shown as full screen.I want to know is there a way to set default height for AspectRatioFrameLayout or any other way to don’t show controller full page when AspectRatioFrameLayout couldn’t be calculate?

Exo version:2.10.0 Youtube player screenShot My layout when error occur and controller shown full page

XML code :

<androidx.coordinatorlayout.widget.CoordinatorLayout
 		 …>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:animateLayoutChanges="true">

        <com.google.android.exoplayer2.ui.AspectRatioFrameLayout
            android:id="@id/exo_content_frame"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center">
 		…
	 <View
                android:id="@id/exo_controller_placeholder"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </com.google.android.exoplayer2.ui.AspectRatioFrameLayout>

        </FrameLayout>
		…

    </FrameLayout>

    <include layout="@layout/bottom_sheet_layout” />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marcbaechingercommented, Mar 16, 2020

Closing due to inactivity. Please feel free to re-open if required.

0reactions
marcbaechingercommented, Feb 11, 2020

As a first try I’d use the PlayerView and customize its layout file. You can provide your own exo_player_view.xml and add your own elements within that.

The problem is when AspectRatioFrameLayout can’t be calculate, controller load as full screen

In case you want to continue with your approach, it seems that you need to calculate the dimensions yourself and set it programmatically.

Read more comments on GitHub >

github_iconTop Results From Across the Web

In Android, using exoplayer, how to fill surfaceview with a ...
Explanation: AspectRatioFrameLayout is setting the correct height of the view according to the real video ratio (calcuclating based on width, height and ...
Read more >
Setting Height And Width On Images Is Important Again
To prevent layout shifts and improve performance scores, we need to always set width and height attributes on our images.
Read more >
AspectRatioFrameLayout (ExoPlayer library)
Sets the aspect ratio that this view should satisfy. Parameters: widthHeightRatio - The width to height ratio. setAspectRatioListener. public void ...
Read more >
Exoplayer - How To Get Source Code For The Default Layout?
ExoPlayer Doc github issues and stackOverFlow want to know is there a way to set default height for AspectRatioFrameLayout or any other.
Read more >
Apply width and height attributes to allow responsive image ...
Why is Drupal core is not setting these attributes for lazy image loading which basically disable lazy loading for all responsive images? The ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found