fix [修复-视频问题]
This commit is contained in:
parent
326e376323
commit
10ea7d9735
@ -57,6 +57,15 @@ public class RouteUtil {
|
|||||||
public static final String PATH_USER_HOME = "/main/UserHomeActivity";
|
public static final String PATH_USER_HOME = "/main/UserHomeActivity";
|
||||||
public static final String PATH_VIDEO_PLAY = "/video/VideoPlayActivity";
|
public static final String PATH_VIDEO_PLAY = "/video/VideoPlayActivity";
|
||||||
|
|
||||||
|
public static final String PATH_VIDEO_NEW_PLAY = "/video/VideoPlayNewActivity";
|
||||||
|
|
||||||
|
/* public static void forwardVideoPlayActivity(ActiveBean bean) {
|
||||||
|
ARouter.getInstance().build(PATH_VIDEO_PLAY)
|
||||||
|
.withParcelable("ActiveBean", bean)
|
||||||
|
.withString(Constants.VIDEO_KEY, Constants.VIDEO_SINGLE)
|
||||||
|
.navigation();
|
||||||
|
}*/
|
||||||
|
|
||||||
public static void forwardUserHome(String uid) {
|
public static void forwardUserHome(String uid) {
|
||||||
ARouter.getInstance().build(PATH_USER_HOME)
|
ARouter.getInstance().build(PATH_USER_HOME)
|
||||||
.withString(Constants.TO_UID, uid)
|
.withString(Constants.TO_UID, uid)
|
||||||
@ -408,4 +417,5 @@ public class RouteUtil {
|
|||||||
.withString(Constants.VIDEO_KEY, Constants.VIDEO_SINGLE)
|
.withString(Constants.VIDEO_KEY, Constants.VIDEO_SINGLE)
|
||||||
.navigation();
|
.navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,12 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
android:background="@drawable/bg_item_comment"
|
android:background="@drawable/bg_item_comment"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="20dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
tools:ignore="MissingDefaultResource">
|
tools:ignore="MissingDefaultResource">
|
||||||
|
|
||||||
@ -14,12 +17,13 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.makeramen.roundedimageview.RoundedImageView
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
android:layout_width="30dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="50dp"
|
||||||
android:src="@mipmap/icon_data_empty"
|
android:src="@mipmap/icon_data_empty"
|
||||||
app:riv_oval="true" />
|
app:riv_oval="true" />
|
||||||
|
|
||||||
@ -73,7 +77,6 @@
|
|||||||
android:id="@+id/del"
|
android:id="@+id/del"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/delete"
|
android:text="@string/delete"
|
||||||
android:textColor="#777777"
|
android:textColor="#777777"
|
||||||
@ -84,7 +87,6 @@
|
|||||||
android:id="@+id/replyTextView"
|
android:id="@+id/replyTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/reply"
|
android:text="@string/reply"
|
||||||
android:textColor="#777777"
|
android:textColor="#777777"
|
||||||
@ -94,7 +96,6 @@
|
|||||||
android:id="@+id/report"
|
android:id="@+id/report"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="5dp"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/report"
|
android:text="@string/report"
|
||||||
@ -109,7 +110,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="50dp"
|
android:layout_marginLeft="50dp"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:background="@drawable/bg_item_comment"
|
android:background="@drawable/bg_item_comment"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/rt_main_tab"
|
android:id="@+id/rt_main_tab"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="55dp"
|
android:layout_height="60dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
android:paddingTop="5dp">
|
android:paddingTop="5dp">
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/bottom"
|
android:id="@+id/bottom"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="55dp"
|
android:layout_height="60dp"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_centerVertical="true">
|
android:layout_centerVertical="true">
|
||||||
|
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustNothing|stateAlwaysHidden"
|
android:windowSoftInputMode="adjustNothing|stateAlwaysHidden"
|
||||||
/>
|
/>
|
||||||
|
<activity
|
||||||
|
android:name="com.yunbao.video.activity.VideoPlayNewActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustNothing|stateAlwaysHidden"
|
||||||
|
/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.yunbao.video.activity.VideoChooseActivity"
|
android:name="com.yunbao.video.activity.VideoChooseActivity"
|
||||||
@ -27,6 +32,8 @@
|
|||||||
android:name="com.yunbao.video.activity.VideoReportActivity"
|
android:name="com.yunbao.video.activity.VideoReportActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
|
android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
|
||||||
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -0,0 +1,176 @@
|
|||||||
|
package com.yunbao.video.activity;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.binioter.guideview.Guide;
|
||||||
|
import com.binioter.guideview.GuideBuilder;
|
||||||
|
import com.yunbao.common.Constants;
|
||||||
|
import com.yunbao.common.bean.ActiveBean;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
|
import com.yunbao.common.utils.L;
|
||||||
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
|
import com.yunbao.common.utils.SpUtil;
|
||||||
|
import com.yunbao.video.R;
|
||||||
|
import com.yunbao.video.utils.LottieComponent;
|
||||||
|
import com.yunbao.video.utils.VideoStorge;
|
||||||
|
import com.yunbao.video.views.VideoScrollViewHolder;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cxf on 2018/11/26.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Route(path = RouteUtil.PATH_VIDEO_PLAY)
|
||||||
|
public class VideoPlayNewActivity extends AbsVideoPlayActivity {
|
||||||
|
|
||||||
|
private View viewBottom;
|
||||||
|
private ImageView btn_back;
|
||||||
|
|
||||||
|
public static void forward(Context context, int position, String videoKey, int page) {
|
||||||
|
Intent intent = new Intent(context, VideoPlayNewActivity.class);
|
||||||
|
intent.putExtra(Constants.VIDEO_POSITION, position);
|
||||||
|
intent.putExtra(Constants.VIDEO_KEY, videoKey);
|
||||||
|
intent.putExtra(Constants.VIDEO_PAGE, page);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void forwardSingle(Context context, ActiveBean videoBean) {
|
||||||
|
if (videoBean == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<ActiveBean> list = new ArrayList<>();
|
||||||
|
list.add(videoBean);
|
||||||
|
VideoStorge.getInstance().put(Constants.VIDEO_SINGLE, list);
|
||||||
|
Intent intent = new Intent(context, VideoPlayNewActivity.class);
|
||||||
|
intent.putExtra(Constants.VIDEO_POSITION, 0);
|
||||||
|
intent.putExtra(Constants.VIDEO_KEY, Constants.VIDEO_SINGLE);
|
||||||
|
intent.putExtra(Constants.VIDEO_PAGE, 1);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void forwardSingle(Context context, String id) {
|
||||||
|
LiveNetManager.get(context).getDynamicInfo(id, new com.yunbao.common.http.base.HttpCallback<ActiveBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ActiveBean data) {
|
||||||
|
List<ActiveBean> list = new ArrayList<>();
|
||||||
|
list.add(data);
|
||||||
|
VideoStorge.getInstance().put(Constants.VIDEO_SINGLE, list);
|
||||||
|
Intent intent = new Intent(context, VideoPlayNewActivity.class);
|
||||||
|
intent.putExtra(Constants.VIDEO_POSITION, 0);
|
||||||
|
intent.putExtra(Constants.VIDEO_KEY, Constants.VIDEO_SINGLE);
|
||||||
|
intent.putExtra(Constants.VIDEO_PAGE, 1);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.activity_video_play;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isStatusBarWhite() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void main() {
|
||||||
|
super.main();
|
||||||
|
Intent intent = getIntent();
|
||||||
|
mVideoKey = intent.getStringExtra(Constants.VIDEO_KEY);
|
||||||
|
if (TextUtils.isEmpty(mVideoKey)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ActiveBean bean=intent.getParcelableExtra("ActiveBean");
|
||||||
|
if(bean!=null){
|
||||||
|
List<ActiveBean> list = new ArrayList<>();
|
||||||
|
list.add(bean);
|
||||||
|
VideoStorge.getInstance().put(Constants.VIDEO_SINGLE, list);
|
||||||
|
}
|
||||||
|
int position = intent.getIntExtra(Constants.VIDEO_POSITION, 0);
|
||||||
|
int page = intent.getIntExtra(Constants.VIDEO_PAGE, 1);
|
||||||
|
mVideoScrollViewHolder = new VideoScrollViewHolder(mContext, (ViewGroup) findViewById(R.id.container), position, mVideoKey, page);
|
||||||
|
mVideoScrollViewHolder.addToParent();
|
||||||
|
mVideoScrollViewHolder.subscribeActivityLifeCycle();
|
||||||
|
viewBottom = findViewById(R.id.viewBottom);
|
||||||
|
viewBottom.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
boolean read = SpUtil.getInstance().getBooleanValue(SpUtil.READ_VIDEO_GUIDE);
|
||||||
|
if (!read) {
|
||||||
|
showGuideView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btn_back = findViewById(R.id.btn_back);
|
||||||
|
btn_back.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressLint("ResourceType")
|
||||||
|
public void showGuideView() {
|
||||||
|
final GuideBuilder builder1 = new GuideBuilder();
|
||||||
|
builder1.setTargetView(viewBottom)
|
||||||
|
.setAlpha(180)
|
||||||
|
.setHighTargetCorner(20)
|
||||||
|
.setHighTargetPadding(0)
|
||||||
|
.setExitAnimationId(android.R.anim.fade_out);
|
||||||
|
builder1.setOnVisibilityChangedListener(new GuideBuilder.OnVisibilityChangedListener() {
|
||||||
|
@Override
|
||||||
|
public void onShown() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss() {
|
||||||
|
SpUtil.getInstance().setBooleanValue(SpUtil.READ_VIDEO_GUIDE, true);
|
||||||
|
// Toast.makeText(VideoPlayActivity.this, "引导层消失了", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder1.addComponent(new LottieComponent());
|
||||||
|
Guide guide = builder1.createGuide();
|
||||||
|
guide.setShouldCheckLocInWindow(false);
|
||||||
|
guide.show(VideoPlayNewActivity.this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
release();
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
release();
|
||||||
|
super.onDestroy();
|
||||||
|
L.e("VideoPlayActivity------->onDestroy");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -27,7 +27,6 @@ import com.yunbao.common.adapter.CommentVideoAdapter;
|
|||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
import com.yunbao.common.bean.CommentBean;
|
import com.yunbao.common.bean.CommentBean;
|
||||||
import com.yunbao.common.custom.CommonRefreshView;
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
import com.yunbao.common.custom.ItemDecoration;
|
|
||||||
import com.yunbao.common.custom.MyLinearLayout3;
|
import com.yunbao.common.custom.MyLinearLayout3;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.CommonHttpUtil;
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
@ -36,7 +35,6 @@ import com.yunbao.common.utils.L;
|
|||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.views.AbsViewHolder;
|
import com.yunbao.common.views.AbsViewHolder;
|
||||||
import com.yunbao.common.views.TopGradual;
|
|
||||||
import com.yunbao.live.activity.LiveReportActivity;
|
import com.yunbao.live.activity.LiveReportActivity;
|
||||||
import com.yunbao.video.R;
|
import com.yunbao.video.R;
|
||||||
import com.yunbao.video.activity.AbsVideoCommentActivity;
|
import com.yunbao.video.activity.AbsVideoCommentActivity;
|
||||||
@ -129,8 +127,6 @@ public class VideoCommentViewHolder extends AbsViewHolder implements View.OnClic
|
|||||||
mCommentNum = (TextView) findViewById(R.id.comment_num);
|
mCommentNum = (TextView) findViewById(R.id.comment_num);
|
||||||
mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView);
|
mRefreshView = (CommonRefreshView) findViewById(R.id.refreshView);
|
||||||
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_comment);
|
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_comment);
|
||||||
ItemDecoration decoration = new ItemDecoration(mContext, 0x00000000, 5, 0);
|
|
||||||
mRefreshView.setItemDecoration(decoration);
|
|
||||||
mRefreshView.setLoadMoreEnable(false);
|
mRefreshView.setLoadMoreEnable(false);
|
||||||
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false) {
|
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,7 +46,6 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
|
|
||||||
public VideoPlayViewHolder(Context context, ViewGroup parentView) {
|
public VideoPlayViewHolder(Context context, ViewGroup parentView) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -58,7 +57,7 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
public void init() {
|
public void init() {
|
||||||
mCachePath = mContext.getCacheDir().getAbsolutePath();
|
mCachePath = mContext.getCacheDir().getAbsolutePath();
|
||||||
mTXCloudVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
mTXCloudVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||||
mTXCloudVideoView.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN);
|
mTXCloudVideoView.setRenderMode(TXLiveConstants.RENDER_ROTATION_PORTRAIT);
|
||||||
mPlayer = new TXVodPlayer(mContext);
|
mPlayer = new TXVodPlayer(mContext);
|
||||||
mTXVodPlayConfig = new TXVodPlayConfig();
|
mTXVodPlayConfig = new TXVodPlayConfig();
|
||||||
mTXVodPlayConfig.setMaxCacheItems(15);
|
mTXVodPlayConfig.setMaxCacheItems(15);
|
||||||
@ -87,6 +86,9 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
if (mActionListener != null) {
|
if (mActionListener != null) {
|
||||||
mActionListener.onPlayBegin(txVodPlayer.getDuration());
|
mActionListener.onPlayBegin(txVodPlayer.getDuration());
|
||||||
}
|
}
|
||||||
|
if (mActionListener != null) {
|
||||||
|
mActionListener.onFirstFrame();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TXLiveConstants.PLAY_EVT_PLAY_LOADING: //开始加载的回调
|
case TXLiveConstants.PLAY_EVT_PLAY_LOADING: //开始加载的回调
|
||||||
if (mActionListener != null) {
|
if (mActionListener != null) {
|
||||||
@ -111,7 +113,7 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION://获取到视频宽高回调
|
case TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION://获取到视频宽高回调
|
||||||
onVideoSizeChanged(bundle.getInt("EVT_PARAM1", 0), bundle.getInt("EVT_PARAM2", 0));
|
onVideoSizeChanged( bundle.getInt("EVT_PARAM2", 0),bundle.getInt("EVT_PARAM1", 0));
|
||||||
break;
|
break;
|
||||||
case TXLiveConstants.PLAY_EVT_PLAY_PROGRESS:
|
case TXLiveConstants.PLAY_EVT_PLAY_PROGRESS:
|
||||||
if (mActionListener != null) {
|
if (mActionListener != null) {
|
||||||
@ -133,9 +135,23 @@ public class VideoPlayViewHolder extends AbsViewHolder implements ITXVodPlayList
|
|||||||
*/
|
*/
|
||||||
public void onVideoSizeChanged(float videoWidth, float videoHeight) {
|
public void onVideoSizeChanged(float videoWidth, float videoHeight) {
|
||||||
if (mTXCloudVideoView != null && videoWidth > 0 && videoHeight > 0) {
|
if (mTXCloudVideoView != null && videoWidth > 0 && videoHeight > 0) {
|
||||||
|
|
||||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mTXCloudVideoView.getLayoutParams();
|
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mTXCloudVideoView.getLayoutParams();
|
||||||
|
/*
|
||||||
|
int videoViewHeight = params.height;
|
||||||
|
int videoViewWidth = params.width;
|
||||||
|
if (videoWidth < videoViewWidth && videoHeight >= videoViewHeight) {
|
||||||
|
params.width = (int) (videoViewHeight / (videoHeight / videoViewHeight));
|
||||||
|
} else if (videoWidth > videoViewWidth && videoHeight >= videoViewHeight) {
|
||||||
|
params.width = (int) (videoViewHeight / (videoHeight / videoWidth));
|
||||||
|
}
|
||||||
|
mTXCloudVideoView.requestLayout();
|
||||||
|
if (mVideoCover != null && mVideoCover.getVisibility() == View.VISIBLE) {
|
||||||
|
mVideoCover.setVisibility(View.INVISIBLE);
|
||||||
|
}*/
|
||||||
int targetH = 0;
|
int targetH = 0;
|
||||||
if (videoWidth / videoHeight > 0.5625f) {//横屏 9:16=0.5625
|
if (videoWidth / videoHeight > 0.5625f) {//横屏 9:16=0.5625
|
||||||
|
/*targetH = (int) (videoHeight*(videoWidth/videoHeight));*/
|
||||||
targetH = (int) (mTXCloudVideoView.getWidth() / videoWidth * videoHeight);
|
targetH = (int) (mTXCloudVideoView.getWidth() / videoWidth * videoHeight);
|
||||||
} else {
|
} else {
|
||||||
targetH = ViewGroup.LayoutParams.MATCH_PARENT;
|
targetH = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
|
Loading…
Reference in New Issue
Block a user