How to make a rounded Exoplayer PlayerView in Android

May be you can use CardView like this and PlayerView surface_type must be texture_view.

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardCornerRadius="8dp"
    app:cardElevation="0dp">

    <com.google.android.exoplayer2.ui.PlayerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:surface_type="texture_view" 
        app:use_controller="false" />

</android.support.v7.widget.CardView>

After a long search, I wasn't able to make rounded corners PlayerView or ImageView in xml only (I don't think it is possible). So I decided to do it in java. Below is the code:

playerView.setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 15);
            }
        });

        playerView.setClipToOutline(true);