This commit is contained in:
liujing
2020-10-22 14:11:16 +08:00
parent 227d087c92
commit fddad1dd87
3 changed files with 98 additions and 19 deletions

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.TextureView;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
@@ -21,6 +22,7 @@ import com.mogo.utils.BitmapHelper;
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
import java.util.ArrayList;
import static com.mogo.module.v2x.VideoInitKt.initVideo;
@@ -53,22 +55,22 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
private void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.window_road_video, this);
initVideo();
simpleCoverVideoPlayer = findViewById(R.id.roadVideoView);/*播放器*/
simpleCoverVideoPlayer = this.findViewById(R.id.roadVideoView);/*播放器*/
TextureView textureView = findViewById(R.id.tex);
windowPalyImageView = findViewById(R.id.window_video_play);/*播放键*/
mThumbnailImageView = findViewById(R.id.thumbnail_image);/*第一帧图片*/
closeImage = findViewById(R.id.roadVideoClose);
closeImage.setOnClickListener(v -> {
close();
});
simpleCoverVideoPlayer.setOnClickListener(v -> {
mThumbnailImageView.setVisibility(View.GONE);
// if (simpleCoverVideoPlayer.isPlaying()) {
// videoPause();
// } else {
// videoResume();
// }
});
// closeImage = findViewById(R.id.roadVideoClose);
// closeImage.setOnClickListener(v -> {
// close();
// });
// simpleCoverVideoPlayer.setOnClickListener(v -> {
// mThumbnailImageView.setVisibility(View.GONE);
//// if (simpleCoverVideoPlayer.isPlaying()) {
//// videoPause();
//// } else {
//// videoResume();
//// }
// });
}
@Override
@@ -99,9 +101,10 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow, ID
* 视频开始播放
* */
private void videoViewStartWithPath(String path) {
initVideo();
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
//加载封面图
// simpleCoverVideoPlayer.loadCoverImage(path, getContext());
simpleCoverVideoPlayer.loadCoverImage(path, getContext());
gsyVideoOptionBuilder.setUrl(path).setCacheWithPlay(false).setPlayTag(TAG)
.build(simpleCoverVideoPlayer);
simpleCoverVideoPlayer.getStartButton().performClick();

View File

@@ -14,25 +14,32 @@
android:layout_margin="@dimen/dp_30"
app:roundLayoutRadius="@dimen/dp_28">
<com.mogo.module.tanlu.video.SimpleCoverVideoPlayer
<com.mogo.module.v2x.SimpleCoverVideoPlayer
android:id="@+id/roadVideoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="visible" />
<TextureView
android:id="@+id/tex"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/live_video_progress_bar_loading_color"
android:clickable="false"
android:layout_marginBottom="@dimen/dp_200"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</com.mogo.module.tanlu.video.SimpleCoverVideoPlayer>
</TextureView>
<com.mogo.service.imageloader.MogoImageView
android:id="@+id/thumbnail_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/v2x_bg_big_image_dark"
android:visibility="gone"
android:visibility="visible"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
@@ -43,7 +50,7 @@
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_centerInParent="true"
android:visibility="gone"
android:visibility="visible"
android:src="@drawable/v2x_icon_event_play"/>
</com.mogo.module.v2x.view.RoundLayout>
<ImageView
@@ -54,4 +61,11 @@
android:layout_alignRight="@+id/rlRoadEventList"
android:src="@drawable/v2x_panel_close" />
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/tanlu_rloop_recycleview"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- tools:listitem="@layout/tanlu_item_main_media_recycler_new"-->
<!-- />-->
</RelativeLayout>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mogo.module.v2x.view.RoundLayout
android:id="@+id/rlRoadEventList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/dp_30"
app:roundLayoutRadius="@dimen/dp_28">
<com.mogo.module.v2x.view.SimpleCoverVideoPlayer
android:id="@+id/roadVideoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="visible" />
<!-- <TextureView-->
<!-- android:id="@+id/roadVideoView"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@color/live_video_progress_bar_loading_color"-->
<!-- android:clickable="false"-->
<!-- android:layout_marginBottom="@dimen/dp_200"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->
<!-- </TextureView>-->
<com.mogo.service.imageloader.MogoImageView
android:id="@+id/thumbnail_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/v2x_bg_big_image_dark"
android:scaleType="fitXY"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/window_video_play"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:layout_centerInParent="true"
android:src="@drawable/v2x_icon_event_play"
android:visibility="visible" />
</com.mogo.module.v2x.view.RoundLayout>
<ImageView
android:id="@+id/roadVideoClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/rlRoadEventList"
android:layout_alignRight="@+id/rlRoadEventList"
android:src="@drawable/v2x_panel_close" />
</RelativeLayout>