Open rahul-sysquare opened 1 month ago
@rahul-sysquare Instead of using com.google.android.exoplayer2.ui.AspectRatioFrameLayout
, try the PlayerView
.
@rahul-sysquare Instead of using
com.google.android.exoplayer2.ui.AspectRatioFrameLayout
, try thePlayerView
.
Ok I'll try that. Is there any possibility with FrameLayout to make a working news feed with Play/Pause, artwork, seek bar and some custom buttons on top of video like full screen or mute button? is there any sample code already available in your repo?
This is my updated XML layout for player using player view but it shows black screen when I hide artwork. Any fix for that?
Updated XML Layout
<FrameLayout
android:id="@+id/parent_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="vertical">
<include
layout="@layout/post_item_header"
app:avm="@{avm}" />
<com.buddynation.dronenation.view.custom.TextViewRegular
android:id="@+id/postText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/post_margin_left"
android:layout_marginRight="@dimen/post_margin_left"
android:layout_marginBottom="10dp"
android:paddingLeft="2dp"
android:textColor="@color/white"
android:textSize="@dimen/post_title_text_size" />
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id="@+id/playerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:minHeight="240dp"
app:resize_mode="fill">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/playerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
app:surface_type="texture_view"
android:backgroundTint="@android:color/black"
app:shutter_background_color="@android:color/black"
app:controller_layout_id="@layout/exo_playback_control_view"
app:player_layout_id="@layout/expo_player_view"
app:show_buffering="always"
app:setVideoViewHeight="@{avm.mediaPhoto}"/>
<RelativeLayout
android:id="@+id/postImageWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/postImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
app:loadMediaPhoto="@{avm.mediaPhoto}" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/muteButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:backgroundTint="@color/transparent"
android:padding="4dp"
android:src="@drawable/mute_unmute" />
<com.buddynation.dronenation.view.custom.TextViewRegular
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:visibility="@{avm.moreTextVisiblity}"
android:background="@drawable/see_more_bg"
android:padding="4dp"
android:textColor="@color/white"
android:onClick="@{avm.onPlusMoreClick ()}"
android:text="@{avm.mediaPhotoCount}"/>
</RelativeLayout>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/playIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:src="@mipmap/video_play_icon"
android:tint="@color/white"
android:visibility="gone" />
<ProgressBar
android:id="@+id/indeterminateBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:indeterminateTint="@color/yello"
android:visibility="gone" />
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
<include
layout="@layout/post_item_footer"
app:avm="@{avm}" />
<include
android:id="@+id/lastMessage"
layout="@layout/post_item_last_comment"
app:avm="@{avm}" />
<include
layout="@layout/post_item_write_comment"
app:avm="@{avm}" />
</LinearLayout>
</FrameLayout>
@eneim any hint for the above one?
There are many reasons a renderer shows black screen:
As you can see my time is really limited. To help with this, please do one of the following:
Thanks for the valuable insights. I'll update the thread with the code. Also, I'll try to create a sample code separate for you.
Hi all,
I'm using framelayout to show/render videos in my recyclerview. The issue is when I pause the video I'm getting a black screen over the video instead of video frame itself. Anyone knows any fix?
Here is the code
Here is the XML file code
Here are the screenshots
![Screenshot_1721319005](https://github.com/user-attachments/assets/72377d7b-3582-44b6-a04a-2a1d89cb5f86)