视频全屏

This commit is contained in:
liujing
2020-09-30 15:18:57 +08:00
parent f7113f56e3
commit 0bae46b652
5 changed files with 60 additions and 20 deletions

View File

@@ -287,11 +287,9 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
* V2XMessageEntity 三次封装(是否进行事件与本机连线 是否显示通话功能等)
* V2XEventShowEntity 包含V2XRoadEventEntity
* */
Log.d(TAG,"马上展示图片/视频资源");
Log.d(TAG,"马上展示图片/视频资源全屏");
V2XMessageEntity v2XMessageEntity = new V2XMessageEntity<>();
v2XMessageEntity.setContent(v2XEventShowEntity);
mV2XRoadVideoCarScenario = V2XRoadVideoCarScenario.getInstance();
mV2XRoadVideoCarScenario.init(v2XMessageEntity);
V2XRoadVideoCarScenario.getInstance().init(v2XMessageEntity);
}
}
/**

View File

@@ -87,8 +87,10 @@ public class V2XAnimationWindow extends ConstraintLayout implements IV2XWindow<V
default:
Logger.e(MODULE_NAME, "未定义的类型:" + entity.getSceneId());
}
String path = "https://v.youku.com/v_show/id_XNjAzNzI3MDA0.html";
if (videoUri != null) {
// vvCarAnimation.setVideoPath(path);
vvCarAnimation.setVideoURI(videoUri);
vvCarAnimation.setOnPreparedListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "场景动画准备。。。。。");

View File

@@ -11,6 +11,7 @@ import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.scenario.scene.animation.V2XAnimationWindow;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
@@ -59,23 +60,30 @@ public class V2XRoadVideoCarScenario extends AbsV2XScenario<V2XEventShowEntity>
V2XServiceManager
.getIMogoWindowManager()
.addView(getV2XWindow().getView(), 0, 0, false);
V2XServiceManager.getMoGoV2XStatusManager().setV2XRoadVideoWindowShow(TAG, true);
V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, true);
}
}
@Override
public void closeWindow() {
if (getV2XWindow() != null) {
getV2XWindow().close();
}
V2XServiceManager.getMoGoV2XStatusManager().setV2XRoadVideoWindowShow(TAG, false);
}
@Override
public void showButton() {
if (getV2XButton() != null) {
getV2XButton().show();
}
}
@Override
public void closeButton() {
if (getV2XButton() != null) {
getV2XButton().close();
}
}
@Override

View File

@@ -15,6 +15,11 @@ import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.view.TextureVideoView;
import com.mogo.utils.logger.Logger;
import retrofit2.http.Url;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow {
@@ -48,14 +53,29 @@ public class V2XRoadVideoWindow extends RelativeLayout implements IV2XWindow {
@Override
public void show(Object entity) {
mV2XMessageEntity = (V2XMessageEntity) entity;
// String path =
mVideoView.setVideoPath("https://haokan.baidu.com/v?vid=11239381022041270821&pd=bjh&fr=bjhauthor&type=video");
// mV2XMessageEntity = (V2XMessageEntity) entity;
String path = "http://vd4.bdstatic.com//mda-kh0ijgx47i3uu141//v1-cae//mda-kh0ijgx47i3uu141.mp4";
mVideoView.setVideoPath(path);
if (path != null) {
mVideoView.setOnPreparedListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "全屏准备。。。。。");
});
mVideoView.setOnCompletionListener(mediaPlayer -> {
Logger.w(MODULE_NAME, "全屏展示结束...");
if (mV2XWindowStatusListener != null) {
mV2XWindowStatusListener.onViewClose();
}
});
mVideoView.start();
}
}
@Override
public void close() {
//移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(this);
}
@Override

View File

@@ -1,18 +1,30 @@
<?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:id="@+id/window_road_video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/roadVideoLayout"
android:background="#000000">
android:background="#99000000"
android:paddingStart="@dimen/module_main_v2x_animation_width">
<com.mogo.module.v2x.view.TextureVideoView
android:id="@+id/roadVideoView"
<com.mogo.module.v2x.view.RoundLayout
android:id="@+id/rlRoadEventList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/live_video_progress_bar_loading_color"
android:padding="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_30">
android:layout_margin="@dimen/dp_30"
app:roundLayoutRadius="@dimen/dp_28">
</com.mogo.module.v2x.view.TextureVideoView>
<com.mogo.module.v2x.view.TextureVideoView
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"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</com.mogo.module.v2x.view.RoundLayout>
</RelativeLayout>