Merge branch 'ii' into dev
This commit is contained in:
@@ -70,9 +70,6 @@ dependencies {
|
|||||||
}
|
}
|
||||||
compileOnly rootProject.ext.dependencies.carcallprovider
|
compileOnly rootProject.ext.dependencies.carcallprovider
|
||||||
|
|
||||||
implementation rootProject.ext.dependencies.videoarmv7
|
|
||||||
implementation rootProject.ext.dependencies.videoarm64
|
|
||||||
implementation rootProject.ext.dependencies.videojava
|
|
||||||
implementation rootProject.ext.dependencies.eventbus
|
implementation rootProject.ext.dependencies.eventbus
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ import com.mogo.utils.TipDrawable;
|
|||||||
import com.mogo.utils.TipToast;
|
import com.mogo.utils.TipToast;
|
||||||
import com.mogo.utils.WorkThreadHandler;
|
import com.mogo.utils.WorkThreadHandler;
|
||||||
import com.mogo.utils.logger.Logger;
|
import com.mogo.utils.logger.Logger;
|
||||||
import com.shuyu.gsyvideoplayer.GSYVideoManager;
|
//import com.shuyu.gsyvideoplayer.GSYVideoManager;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -127,7 +127,7 @@ import static com.mogo.module.tanlu.constant.ConstKt.VOICE_COMMAND_QUERY_TRAFFIC
|
|||||||
import static com.mogo.module.tanlu.constant.TanluConstants.PLAY_VIDEO_AWAKEN;
|
import static com.mogo.module.tanlu.constant.TanluConstants.PLAY_VIDEO_AWAKEN;
|
||||||
import static com.mogo.module.tanlu.constant.TanluConstants.SPECIFIEDROAD_SEARCH;
|
import static com.mogo.module.tanlu.constant.TanluConstants.SPECIFIEDROAD_SEARCH;
|
||||||
import static com.mogo.module.tanlu.constant.TanluConstants.TXZ_SPECIFIEDROAD_SEARCH;
|
import static com.mogo.module.tanlu.constant.TanluConstants.TXZ_SPECIFIEDROAD_SEARCH;
|
||||||
import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
//import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lixiaopeng
|
* @author lixiaopeng
|
||||||
@@ -204,7 +204,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
|
|||||||
|
|
||||||
protected void initViews() {
|
protected void initViews() {
|
||||||
LayoutInflater.from(mContext).inflate(R.layout.tanlu_main_media_recycler_new, this);
|
LayoutInflater.from(mContext).inflate(R.layout.tanlu_main_media_recycler_new, this);
|
||||||
initVideo();
|
// initVideo();
|
||||||
mLoopRecyclerView = findViewById(R.id.tanlu_rloop_recycleview);
|
mLoopRecyclerView = findViewById(R.id.tanlu_rloop_recycleview);
|
||||||
mLoopRecyclerView.setHasFixedSize(true);
|
mLoopRecyclerView.setHasFixedSize(true);
|
||||||
mLoopRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
mLoopRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
||||||
@@ -845,7 +845,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
|
|||||||
public void releaseAction() {
|
public void releaseAction() {
|
||||||
// EventBus.getDefault().unregister(this);
|
// EventBus.getDefault().unregister(this);
|
||||||
mMogoRegisterCenter.unregisterMogoNaviListener(TanluConstants.MODEL_NAME);
|
mMogoRegisterCenter.unregisterMogoNaviListener(TanluConstants.MODEL_NAME);
|
||||||
GSYVideoManager.releaseAllVideos();
|
// GSYVideoManager.releaseAllVideos();
|
||||||
if (mTanluSlideAdapter != null) {
|
if (mTanluSlideAdapter != null) {
|
||||||
mTanluSlideAdapter.release();
|
mTanluSlideAdapter.release();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import com.mogo.module.tanlu.model.event.ControlClickUpInfo;
|
|||||||
import com.mogo.module.tanlu.model.event.StartPlayInfo;
|
import com.mogo.module.tanlu.model.event.StartPlayInfo;
|
||||||
import com.mogo.module.tanlu.model.event.VoiceControlUpInfo;
|
import com.mogo.module.tanlu.model.event.VoiceControlUpInfo;
|
||||||
import com.mogo.module.tanlu.util.ChartUtil;
|
import com.mogo.module.tanlu.util.ChartUtil;
|
||||||
import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
|
//import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
|
||||||
import com.mogo.module.tanlu.view.RoundLayout;
|
import com.mogo.module.tanlu.view.RoundLayout;
|
||||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||||
import com.mogo.service.analytics.IMogoAnalytics;
|
import com.mogo.service.analytics.IMogoAnalytics;
|
||||||
@@ -43,7 +43,7 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
|||||||
import com.mogo.skin.support.SkinMode;
|
import com.mogo.skin.support.SkinMode;
|
||||||
import com.mogo.utils.TipToast;
|
import com.mogo.utils.TipToast;
|
||||||
import com.mogo.utils.logger.Logger;
|
import com.mogo.utils.logger.Logger;
|
||||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
//import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
|
||||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
private TextView mAddressTv;
|
private TextView mAddressTv;
|
||||||
private TextView mDistanceTv;
|
private TextView mDistanceTv;
|
||||||
private TextView mTimeTv;
|
private TextView mTimeTv;
|
||||||
private SimpleCoverVideoPlayer simpleCoverVideoPlayer;
|
// private SimpleCoverVideoPlayer simpleCoverVideoPlayer;
|
||||||
private MogoImageView autoZoomInImageView;
|
private MogoImageView autoZoomInImageView;
|
||||||
private MogoImageView mHeadImage;
|
private MogoImageView mHeadImage;
|
||||||
private ImageView mChatImage;
|
private ImageView mChatImage;
|
||||||
@@ -88,7 +88,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
private ICarsChattingProvider mCarsChattingProvider;
|
private ICarsChattingProvider mCarsChattingProvider;
|
||||||
|
|
||||||
//media
|
//media
|
||||||
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
// private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||||
private String mVideoUrl = "";
|
private String mVideoUrl = "";
|
||||||
private String mImageUrl = "";
|
private String mImageUrl = "";
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
private IMogoAnalytics mAnalytics;
|
private IMogoAnalytics mAnalytics;
|
||||||
private TanluModelData mTanluModelData;
|
private TanluModelData mTanluModelData;
|
||||||
|
|
||||||
private HashMap<Integer, SimpleCoverVideoPlayer> list = new HashMap<>();
|
// private HashMap<Integer, SimpleCoverVideoPlayer> list = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
public TanluSlideAdapterNew(Context context, IMogoAnalytics analytics, TanluModelData tanluModelData, IMogoImageloader mogoImageloader,
|
public TanluSlideAdapterNew(Context context, IMogoAnalytics analytics, TanluModelData tanluModelData, IMogoImageloader mogoImageloader,
|
||||||
@@ -129,7 +129,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
mAddressTv = holder.itemView.findViewById(R.id.tv_information_media_content);
|
mAddressTv = holder.itemView.findViewById(R.id.tv_information_media_content);
|
||||||
mDistanceTv = holder.itemView.findViewById(R.id.tv_information_media_distance);
|
mDistanceTv = holder.itemView.findViewById(R.id.tv_information_media_distance);
|
||||||
mTimeTv = holder.itemView.findViewById(R.id.tv_information_media_time);
|
mTimeTv = holder.itemView.findViewById(R.id.tv_information_media_time);
|
||||||
simpleCoverVideoPlayer = holder.itemView.findViewById(R.id.video_player_main);
|
// simpleCoverVideoPlayer = holder.itemView.findViewById(R.id.video_player_main);
|
||||||
autoZoomInImageView = holder.itemView.findViewById(R.id.tanlu_photo_imageView);
|
autoZoomInImageView = holder.itemView.findViewById(R.id.tanlu_photo_imageView);
|
||||||
mHeadImage = holder.itemView.findViewById(R.id.tanlu_head_imageView);
|
mHeadImage = holder.itemView.findViewById(R.id.tanlu_head_imageView);
|
||||||
mChatImage = holder.itemView.findViewById(R.id.tanlu_chat_imageView);
|
mChatImage = holder.itemView.findViewById(R.id.tanlu_chat_imageView);
|
||||||
@@ -147,10 +147,10 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
});
|
});
|
||||||
|
|
||||||
//有可能不是一个对象
|
//有可能不是一个对象
|
||||||
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
// simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||||
autoZoomInImageView.setVisibility(View.GONE);
|
autoZoomInImageView.setVisibility(View.GONE);
|
||||||
|
|
||||||
list.put(position, simpleCoverVideoPlayer);
|
// list.put(position, simpleCoverVideoPlayer);
|
||||||
|
|
||||||
mTypeTv.setText(getTypeName(markerExploreWay.getPoiType()));
|
mTypeTv.setText(getTypeName(markerExploreWay.getPoiType()));
|
||||||
if (markerExploreWay.getPoiType().equals(TanluConstants.TANLU_ROAD_CURRENT)) {
|
if (markerExploreWay.getPoiType().equals(TanluConstants.TANLU_ROAD_CURRENT)) {
|
||||||
@@ -218,55 +218,55 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mLikeLayout.setOnClickListener(new View.OnClickListener() {
|
// mLikeLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
// @Override
|
||||||
public void onClick(View v) {
|
// public void onClick(View v) {
|
||||||
//动画
|
//动画
|
||||||
AnimatorSet animatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.anim.v2x_like_heart_animation);
|
// AnimatorSet animatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.anim.v2x_like_heart_animation);
|
||||||
animatorSet.setTarget(mLikeImage);
|
// animatorSet.setTarget(mLikeImage);
|
||||||
animatorSet.addListener(new Animator.AnimatorListener() {
|
// animatorSet.addListener(new Animator.AnimatorListener() {
|
||||||
@Override
|
// @Override
|
||||||
public void onAnimationStart(Animator animation) {
|
// public void onAnimationStart(Animator animation) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
// public void onAnimationEnd(Animator animation) {
|
||||||
traceTypeData(markerExploreWay.getInfoId() == null ? "" : markerExploreWay.getInfoId(), "1", markerExploreWay.getSn() == null ? "" : markerExploreWay.getSn());
|
// traceTypeData(markerExploreWay.getInfoId() == null ? "" : markerExploreWay.getInfoId(), "1", markerExploreWay.getSn() == null ? "" : markerExploreWay.getSn());
|
||||||
if (TextUtils.isEmpty(markerExploreWay.getInfoId())) {
|
// if (TextUtils.isEmpty(markerExploreWay.getInfoId())) {
|
||||||
TipToast.shortTip("点赞失败");
|
// TipToast.shortTip("点赞失败");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
mTanluModelData.thumbsUp(markerExploreWay, new IThumbsUpCallback() {
|
// mTanluModelData.thumbsUp(markerExploreWay, new IThumbsUpCallback() {
|
||||||
@Override
|
// @Override
|
||||||
public void onThumbsUpSuccess() {
|
// public void onThumbsUpSuccess() {
|
||||||
TipToast.shortTip("点赞成功");
|
// TipToast.shortTip("点赞成功");
|
||||||
Logger.d(TAG, "onThumbsUpSuccess -------->");
|
// Logger.d(TAG, "onThumbsUpSuccess -------->");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onThumbsUpFail() {
|
// public void onThumbsUpFail() {
|
||||||
TipToast.shortTip("点赞失败");
|
// TipToast.shortTip("点赞失败");
|
||||||
Logger.e(TAG, "onThumbsUpFail -------->");
|
// Logger.e(TAG, "onThumbsUpFail -------->");
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onAnimationCancel(Animator animation) {
|
// public void onAnimationCancel(Animator animation) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onAnimationRepeat(Animator animation) {
|
// public void onAnimationRepeat(Animator animation) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
animatorSet.start();
|
// animatorSet.start();
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,55 +337,55 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
* 刷新单个视频数据,更新位置positon
|
* 刷新单个视频数据,更新位置positon
|
||||||
*/
|
*/
|
||||||
private void refreshVideoData(MarkerExploreWay markerExploreWay) {
|
private void refreshVideoData(MarkerExploreWay markerExploreWay) {
|
||||||
if (markerExploreWay.getItems() == null) {
|
// if (markerExploreWay.getItems() == null) {
|
||||||
showDefaultImage();
|
// showDefaultImage();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (markerExploreWay.getItems().size() == 0) {
|
|
||||||
showDefaultImage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String videoUrl = markerExploreWay.getItems().get(0).getUrl();
|
|
||||||
mImageUrl = markerExploreWay.getItems().get(0).getThumbnail();
|
|
||||||
Logger.d(TAG, "refreshVideoData mImageUrl = " + mImageUrl);
|
|
||||||
mAddressTv.setText(markerExploreWay.getAddr());
|
|
||||||
Logger.e(TAG, "refreshVideoData markerExploreWay.getAddr() = " + markerExploreWay.getAddr() + " >>>>videoUrl = " + videoUrl);
|
|
||||||
mDistanceTv.setText("距离" + handleDistance(markerExploreWay.getDistance()));
|
|
||||||
mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
|
||||||
//判断是图片还是视频,第一个时,上一个不可点击
|
|
||||||
autoZoomInImageView.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
//视频配置
|
|
||||||
mVideoUrl = videoUrl;
|
|
||||||
if (!TextUtils.isEmpty(videoUrl) && !TextUtils.isEmpty(mImageUrl)) {
|
|
||||||
autoZoomInImageView.setVisibility(View.GONE);
|
|
||||||
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
|
||||||
//加载封面图
|
|
||||||
simpleCoverVideoPlayer.loadCoverImage(mImageUrl, mContext);
|
|
||||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
|
||||||
.build(simpleCoverVideoPlayer);
|
|
||||||
simpleCoverVideoPlayer.getStartButton().performClick();
|
|
||||||
} else {
|
|
||||||
simpleCoverVideoPlayer.setVisibility(GONE);
|
|
||||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
|
||||||
//加载图片
|
|
||||||
// RequestOptions requestOptions = new RequestOptions()
|
|
||||||
// .placeholder(R.drawable.tanlu_normal_image)
|
|
||||||
// .error(R.drawable.tanlu_normal_image);
|
|
||||||
//
|
//
|
||||||
// Glide.with(mContext)
|
// if (markerExploreWay.getItems().size() == 0) {
|
||||||
// .asBitmap()
|
// showDefaultImage();
|
||||||
// .load(mImageUrl)
|
// return;
|
||||||
// .apply(requestOptions)
|
// }
|
||||||
// .into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
|
//
|
||||||
|
// String videoUrl = markerExploreWay.getItems().get(0).getUrl();
|
||||||
|
// mImageUrl = markerExploreWay.getItems().get(0).getThumbnail();
|
||||||
|
// Logger.d(TAG, "refreshVideoData mImageUrl = " + mImageUrl);
|
||||||
|
// mAddressTv.setText(markerExploreWay.getAddr());
|
||||||
|
// Logger.e(TAG, "refreshVideoData markerExploreWay.getAddr() = " + markerExploreWay.getAddr() + " >>>>videoUrl = " + videoUrl);
|
||||||
|
// mDistanceTv.setText("距离" + handleDistance(markerExploreWay.getDistance()));
|
||||||
|
// mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
||||||
|
// //判断是图片还是视频,第一个时,上一个不可点击
|
||||||
|
// autoZoomInImageView.setVisibility(View.GONE);
|
||||||
|
//
|
||||||
|
// //视频配置
|
||||||
|
// mVideoUrl = videoUrl;
|
||||||
|
// if (!TextUtils.isEmpty(videoUrl) && !TextUtils.isEmpty(mImageUrl)) {
|
||||||
|
// autoZoomInImageView.setVisibility(View.GONE);
|
||||||
|
// simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||||
|
// //加载封面图
|
||||||
|
// simpleCoverVideoPlayer.loadCoverImage(mImageUrl, mContext);
|
||||||
|
// gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||||
|
// .build(simpleCoverVideoPlayer);
|
||||||
|
// simpleCoverVideoPlayer.getStartButton().performClick();
|
||||||
|
// } else {
|
||||||
|
// simpleCoverVideoPlayer.setVisibility(GONE);
|
||||||
|
// autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||||
|
// //加载图片
|
||||||
|
//// RequestOptions requestOptions = new RequestOptions()
|
||||||
|
//// .placeholder(R.drawable.tanlu_normal_image)
|
||||||
|
//// .error(R.drawable.tanlu_normal_image);
|
||||||
|
////
|
||||||
|
//// Glide.with(mContext)
|
||||||
|
//// .asBitmap()
|
||||||
|
//// .load(mImageUrl)
|
||||||
|
//// .apply(requestOptions)
|
||||||
|
//// .into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
|
||||||
|
//
|
||||||
|
// mogoImageloader.displayImage(mImageUrl, autoZoomInImageView);
|
||||||
|
|
||||||
mogoImageloader.displayImage(mImageUrl, autoZoomInImageView);
|
// }
|
||||||
|
//
|
||||||
}
|
// traceVideoPlayStatusData();
|
||||||
|
|
||||||
traceVideoPlayStatusData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -408,7 +408,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
mDistanceTv.setText("距离 " + handleDistance(markerExploreWay.getDistance()));
|
mDistanceTv.setText("距离 " + handleDistance(markerExploreWay.getDistance()));
|
||||||
mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
||||||
String imageUrl = markerExploreWay.getItems().get(0).getUrl();
|
String imageUrl = markerExploreWay.getItems().get(0).getUrl();
|
||||||
simpleCoverVideoPlayer.setVisibility(View.GONE);
|
// simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||||
Logger.d(TAG, "refreshPhotoData imageUrl = " + imageUrl);
|
Logger.d(TAG, "refreshPhotoData imageUrl = " + imageUrl);
|
||||||
//加载图片
|
//加载图片
|
||||||
@@ -426,7 +426,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
|
|
||||||
|
|
||||||
private void showDefaultImage() {
|
private void showDefaultImage() {
|
||||||
simpleCoverVideoPlayer.setVisibility(View.GONE);
|
// simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,20 +484,20 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
|||||||
*/
|
*/
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onHandlePlay(final StartPlayInfo info) {
|
public void onHandlePlay(final StartPlayInfo info) {
|
||||||
int finalPosition = info.mPosition;
|
// int finalPosition = info.mPosition;
|
||||||
Logger.d(TAG, "onHandlePlay size = " + list.size() + " >> info.mPosition = " + info.mPosition + " >> finalPosition = " + finalPosition);
|
// Logger.d(TAG, "onHandlePlay size = " + list.size() + " >> info.mPosition = " + info.mPosition + " >> finalPosition = " + finalPosition);
|
||||||
// if (list.size() > finalPosition) {
|
//// if (list.size() > finalPosition) {
|
||||||
SimpleCoverVideoPlayer coverVideoPlayer = list.get(finalPosition);
|
// SimpleCoverVideoPlayer coverVideoPlayer = list.get(finalPosition);
|
||||||
coverVideoPlayer.release();
|
// coverVideoPlayer.release();
|
||||||
coverVideoPlayer.getStartButton().performClick();
|
// coverVideoPlayer.getStartButton().performClick();
|
||||||
traceVideoPlayStatusData();
|
// traceVideoPlayStatusData();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void release() {
|
public void release() {
|
||||||
if (list != null) {
|
// if (list != null) {
|
||||||
list.clear();
|
// list.clear();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTypeName(String type) {
|
private String getTypeName(String type) {
|
||||||
|
|||||||
@@ -1,146 +1,146 @@
|
|||||||
package com.mogo.module.tanlu.video
|
//package com.mogo.module.tanlu.video
|
||||||
|
//
|
||||||
import android.app.Activity
|
//import android.app.Activity
|
||||||
import android.content.Intent
|
//import android.content.Intent
|
||||||
import android.os.Bundle
|
//import android.os.Bundle
|
||||||
import android.util.Log
|
//import android.util.Log
|
||||||
import android.view.View
|
//import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
//import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.mogo.module.tanlu.R
|
//import com.mogo.module.tanlu.R
|
||||||
import com.mogo.module.tanlu.util.HideControl
|
//import com.mogo.module.tanlu.util.HideControl
|
||||||
import com.mogo.module.tanlu.util.formatDate
|
//import com.mogo.module.tanlu.util.formatDate
|
||||||
import com.mogo.utils.logger.Logger
|
//import com.mogo.utils.logger.Logger
|
||||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
//import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||||
import kotlinx.android.synthetic.main.tanlu_activity_media_full.*
|
//import kotlinx.android.synthetic.main.tanlu_activity_media_full.*
|
||||||
import java.util.*
|
//import java.util.*
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 全屏显示适配
|
// * 全屏显示适配
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
//class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
||||||
companion object {
|
// companion object {
|
||||||
const val TAG = "FullMediaActivity"
|
// const val TAG = "FullMediaActivity"
|
||||||
|
//
|
||||||
const val PARAM_VIDEO_URL = "param_video_url"
|
// const val PARAM_VIDEO_URL = "param_video_url"
|
||||||
const val PARAM_THUMB_URL = "param_thumb_url"
|
// const val PARAM_THUMB_URL = "param_thumb_url"
|
||||||
const val PARAM_ADDRESS = "param_address"
|
// const val PARAM_ADDRESS = "param_address"
|
||||||
const val PARAM_TIME = "generate_time"
|
// const val PARAM_TIME = "generate_time"
|
||||||
|
//
|
||||||
|
//
|
||||||
// fun launch(context: Activity, strategyInfo: List<Informations>, position: Int) {
|
//// fun launch(context: Activity, strategyInfo: List<Informations>, position: Int) {
|
||||||
|
//// val intent = Intent(context, FullMediaActivity::class.java)
|
||||||
|
//// intent.putExtra(PARAM_MEDIA_POSITION, position)
|
||||||
|
//// // 使用全局静态对象代替,避免序列化开销
|
||||||
|
//// GlobalSharedInformation.informationList = strategyInfo as ArrayList<Informations>
|
||||||
|
//// context.startActivityForResult(intent, REQUESTCODE_MAINACTIVITY)
|
||||||
|
//// context.overridePendingTransition(0, 0)
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// fun launch(context: Activity, videoUrl: String, thumbnail: String, address: String, generateTime: Long) {
|
||||||
// val intent = Intent(context, FullMediaActivity::class.java)
|
// val intent = Intent(context, FullMediaActivity::class.java)
|
||||||
// intent.putExtra(PARAM_MEDIA_POSITION, position)
|
// intent.putExtra(PARAM_VIDEO_URL, videoUrl)
|
||||||
// // 使用全局静态对象代替,避免序列化开销
|
// intent.putExtra(PARAM_THUMB_URL, thumbnail)
|
||||||
// GlobalSharedInformation.informationList = strategyInfo as ArrayList<Informations>
|
// intent.putExtra(PARAM_ADDRESS, address)
|
||||||
// context.startActivityForResult(intent, REQUESTCODE_MAINACTIVITY)
|
// intent.putExtra(PARAM_TIME, generateTime)
|
||||||
|
// context.startActivity(intent)
|
||||||
// context.overridePendingTransition(0, 0)
|
// context.overridePendingTransition(0, 0)
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
fun launch(context: Activity, videoUrl: String, thumbnail: String, address: String, generateTime: Long) {
|
//
|
||||||
val intent = Intent(context, FullMediaActivity::class.java)
|
// private var control = HideControl()
|
||||||
intent.putExtra(PARAM_VIDEO_URL, videoUrl)
|
// private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||||
intent.putExtra(PARAM_THUMB_URL, thumbnail)
|
// private var videoUrl: String? = null
|
||||||
intent.putExtra(PARAM_ADDRESS, address)
|
// private var thumbUrl: String? = null
|
||||||
intent.putExtra(PARAM_TIME, generateTime)
|
// private var address: String? = null
|
||||||
context.startActivity(intent)
|
// private var generateTime: Long = 0
|
||||||
context.overridePendingTransition(0, 0)
|
//
|
||||||
}
|
//
|
||||||
}
|
//
|
||||||
|
// override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
private var control = HideControl()
|
// super.onCreate(savedInstanceState)
|
||||||
private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
// setContentView(R.layout.tanlu_activity_media_full)
|
||||||
private var videoUrl: String? = null
|
// handleIntent()
|
||||||
private var thumbUrl: String? = null
|
// setListener()
|
||||||
private var address: String? = null
|
// }
|
||||||
private var generateTime: Long = 0
|
//
|
||||||
|
// private fun handleIntent() {
|
||||||
|
// var intent = intent
|
||||||
|
//
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
// videoUrl = intent.getStringExtra(PARAM_VIDEO_URL)
|
||||||
super.onCreate(savedInstanceState)
|
// thumbUrl = intent.getStringExtra(PARAM_THUMB_URL)
|
||||||
setContentView(R.layout.tanlu_activity_media_full)
|
// address = intent.getStringExtra(PARAM_ADDRESS)
|
||||||
handleIntent()
|
// generateTime = intent.getLongExtra(PARAM_TIME, 0)
|
||||||
setListener()
|
// }
|
||||||
}
|
//
|
||||||
|
// override fun onResume() {
|
||||||
private fun handleIntent() {
|
// super.onResume()
|
||||||
var intent = intent
|
// updateInformation()
|
||||||
|
// GSYVideoManager.onResume()
|
||||||
videoUrl = intent.getStringExtra(PARAM_VIDEO_URL)
|
// }
|
||||||
thumbUrl = intent.getStringExtra(PARAM_THUMB_URL)
|
//
|
||||||
address = intent.getStringExtra(PARAM_ADDRESS)
|
// override fun onPause() {
|
||||||
generateTime = intent.getLongExtra(PARAM_TIME, 0)
|
// super.onPause()
|
||||||
}
|
// GSYVideoManager.onPause()
|
||||||
|
// }
|
||||||
override fun onResume() {
|
//
|
||||||
super.onResume()
|
// //需要监听完成事件
|
||||||
updateInformation()
|
// private fun setListener() {
|
||||||
GSYVideoManager.onResume()
|
// iv_media_back.setOnClickListener(this)
|
||||||
}
|
// //重置timer
|
||||||
|
// video_view.addSingleClickListener(object :
|
||||||
override fun onPause() {
|
// MediaCoverVideoPlayer.SingleClickListener {
|
||||||
super.onPause()
|
// override fun onClick() {
|
||||||
GSYVideoManager.onPause()
|
// control.resetHideTimer()
|
||||||
}
|
// }
|
||||||
|
// })
|
||||||
//需要监听完成事件
|
//
|
||||||
private fun setListener() {
|
// //视频播放完成
|
||||||
iv_media_back.setOnClickListener(this)
|
// video_view.onCompletionListener(object :
|
||||||
//重置timer
|
// MediaCoverVideoPlayer.CompletionListener {
|
||||||
video_view.addSingleClickListener(object :
|
// override fun onCompletion() {
|
||||||
MediaCoverVideoPlayer.SingleClickListener {
|
// finish()
|
||||||
override fun onClick() {
|
// }
|
||||||
control.resetHideTimer()
|
// })
|
||||||
}
|
//
|
||||||
})
|
// video_view
|
||||||
|
// video_view.loadCoverImage(thumbUrl!!)
|
||||||
//视频播放完成
|
// //设置url,点击播放
|
||||||
video_view.onCompletionListener(object :
|
// gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(true)
|
||||||
MediaCoverVideoPlayer.CompletionListener {
|
// .setPlayTag(TAG).build(video_view)
|
||||||
override fun onCompletion() {
|
// video_view.startButton.performClick()
|
||||||
finish()
|
// }
|
||||||
}
|
//
|
||||||
})
|
//
|
||||||
|
// private fun updateInformation() {
|
||||||
video_view
|
// tv_media_title_content.text = address
|
||||||
video_view.loadCoverImage(thumbUrl!!)
|
// tv_media_title_time.text = formatDate(generateTime)
|
||||||
//设置url,点击播放
|
// }
|
||||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(true)
|
//
|
||||||
.setPlayTag(TAG).build(video_view)
|
//
|
||||||
video_view.startButton.performClick()
|
// override fun onClick(view: View) {
|
||||||
}
|
// view?.let {
|
||||||
|
// when (view) {
|
||||||
|
// iv_media_back -> {
|
||||||
private fun updateInformation() {
|
// handleBack()
|
||||||
tv_media_title_content.text = address
|
// }
|
||||||
tv_media_title_time.text = formatDate(generateTime)
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
override fun onClick(view: View) {
|
// override fun onDestroy() {
|
||||||
view?.let {
|
// super.onDestroy()
|
||||||
when (view) {
|
// GSYVideoManager.releaseAllVideos()
|
||||||
iv_media_back -> {
|
// overridePendingTransition(0, 0)
|
||||||
handleBack()
|
// }
|
||||||
}
|
//
|
||||||
}
|
// private fun handleBack() {
|
||||||
}
|
// finish()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onDestroy() {
|
// override fun onBackPressed() {
|
||||||
super.onDestroy()
|
// super.onBackPressed()
|
||||||
GSYVideoManager.releaseAllVideos()
|
// handleBack()
|
||||||
overridePendingTransition(0, 0)
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
private fun handleBack() {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBackPressed() {
|
|
||||||
super.onBackPressed()
|
|
||||||
handleBack()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,162 +1,164 @@
|
|||||||
package com.mogo.module.tanlu.video
|
package com.mogo.module.tanlu.video
|
||||||
|
|
||||||
import android.content.Context
|
//package com.mogo.module.tanlu.video
|
||||||
import android.util.AttributeSet
|
//
|
||||||
import android.util.Log
|
//import android.content.Context
|
||||||
import android.view.View
|
//import android.util.AttributeSet
|
||||||
import android.widget.ImageView
|
//import android.util.Log
|
||||||
import android.widget.SeekBar
|
//import android.view.View
|
||||||
import com.bumptech.glide.Glide
|
//import android.widget.ImageView
|
||||||
import com.mogo.module.tanlu.R
|
//import android.widget.SeekBar
|
||||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
//import com.bumptech.glide.Glide
|
||||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
//import com.mogo.module.tanlu.R
|
||||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
//import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||||
|
//import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||||
|
//import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||||
/**
|
//
|
||||||
* 全屏播放
|
//
|
||||||
*/
|
///**
|
||||||
class MediaCoverVideoPlayer : StandardGSYVideoPlayer {
|
// * 全屏播放
|
||||||
|
// */
|
||||||
private lateinit var coverImage: ImageView
|
//class MediaCoverVideoPlayer : StandardGSYVideoPlayer {
|
||||||
private lateinit var start: ImageView
|
//
|
||||||
private lateinit var fullscreen: ImageView
|
// private lateinit var coverImage: ImageView
|
||||||
private lateinit var singleClickListener: SingleClickListener
|
// private lateinit var start: ImageView
|
||||||
private lateinit var completionListener: CompletionListener
|
// private lateinit var fullscreen: ImageView
|
||||||
|
// private lateinit var singleClickListener: SingleClickListener
|
||||||
constructor(context: Context?) : super(context)
|
// private lateinit var completionListener: CompletionListener
|
||||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
//
|
||||||
constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
// constructor(context: Context?) : super(context)
|
||||||
|
// constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||||
interface SingleClickListener {
|
// constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||||
fun onClick()
|
//
|
||||||
}
|
// interface SingleClickListener {
|
||||||
|
// fun onClick()
|
||||||
interface CompletionListener {
|
// }
|
||||||
fun onCompletion()
|
//
|
||||||
}
|
// interface CompletionListener {
|
||||||
|
// fun onCompletion()
|
||||||
override fun init(context: Context) {
|
// }
|
||||||
super.init(context)
|
//
|
||||||
coverImage = findViewById(R.id.thumbImage)
|
// override fun init(context: Context) {
|
||||||
start = findViewById(R.id.start)
|
// super.init(context)
|
||||||
fullscreen = findViewById(R.id.fullscreen)
|
// coverImage = findViewById(R.id.thumbImage)
|
||||||
if (mThumbImageViewLayout != null
|
// start = findViewById(R.id.start)
|
||||||
&& (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
|
// fullscreen = findViewById(R.id.fullscreen)
|
||||||
) {
|
// if (mThumbImageViewLayout != null
|
||||||
mThumbImageViewLayout.visibility = View.VISIBLE
|
// && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
|
||||||
}
|
// ) {
|
||||||
}
|
// mThumbImageViewLayout.visibility = View.VISIBLE
|
||||||
|
// }
|
||||||
fun addSingleClickListener(singleClickListener: SingleClickListener) {
|
// }
|
||||||
this.singleClickListener = singleClickListener
|
//
|
||||||
}
|
// fun addSingleClickListener(singleClickListener: SingleClickListener) {
|
||||||
|
// this.singleClickListener = singleClickListener
|
||||||
fun onCompletionListener(completionListener: CompletionListener) {
|
// }
|
||||||
this.completionListener = completionListener
|
//
|
||||||
}
|
// fun onCompletionListener(completionListener: CompletionListener) {
|
||||||
|
// this.completionListener = completionListener
|
||||||
override fun getLayoutId(): Int {
|
// }
|
||||||
return R.layout.tanlu_item_video_cover_media
|
//
|
||||||
}
|
// override fun getLayoutId(): Int {
|
||||||
|
// return R.layout.tanlu_item_video_cover_media
|
||||||
override fun getGSYVideoManager(): GSYVideoViewBridge {
|
// }
|
||||||
GSYVideoManager.instance().initContext(context.applicationContext)
|
//
|
||||||
return GSYVideoManager.instance()
|
// override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||||
}
|
// GSYVideoManager.instance().initContext(context.applicationContext)
|
||||||
|
// return GSYVideoManager.instance()
|
||||||
override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
// }
|
||||||
super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
//
|
||||||
if (progress != 0) {
|
// override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
||||||
mProgressBar.progress = progress
|
// super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||||
}
|
// if (progress != 0) {
|
||||||
}
|
// mProgressBar.progress = progress
|
||||||
|
// }
|
||||||
fun loadCoverImage(url: String) {
|
// }
|
||||||
Glide.with(context)
|
//
|
||||||
.load(url)
|
// fun loadCoverImage(url: String) {
|
||||||
.into(coverImage)
|
// Glide.with(context)
|
||||||
}
|
// .load(url)
|
||||||
|
// .into(coverImage)
|
||||||
override fun updateStartImage() {
|
// }
|
||||||
when (mCurrentState) {
|
//
|
||||||
GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
|
// override fun updateStartImage() {
|
||||||
GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
|
// when (mCurrentState) {
|
||||||
else -> start.setImageResource(R.drawable.selector_bg_btn_play)
|
// GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
|
||||||
}
|
// GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
|
||||||
}
|
// else -> start.setImageResource(R.drawable.selector_bg_btn_play)
|
||||||
|
// }
|
||||||
fun setFullClickListener(listener: OnClickListener) {
|
// }
|
||||||
fullscreen.setOnClickListener(listener)
|
//
|
||||||
}
|
// fun setFullClickListener(listener: OnClickListener) {
|
||||||
|
// fullscreen.setOnClickListener(listener)
|
||||||
override fun onClickUiToggle() {
|
// }
|
||||||
super.onClickUiToggle()
|
//
|
||||||
singleClickListener.let {
|
// override fun onClickUiToggle() {
|
||||||
it.onClick()
|
// super.onClickUiToggle()
|
||||||
}
|
// singleClickListener.let {
|
||||||
}
|
// it.onClick()
|
||||||
|
// }
|
||||||
override fun changeUiToCompleteShow() {
|
// }
|
||||||
super.changeUiToCompleteShow()
|
//
|
||||||
// setViewShowState(mBottomContainer, View.INVISIBLE)
|
// override fun changeUiToCompleteShow() {
|
||||||
}
|
// super.changeUiToCompleteShow()
|
||||||
|
//// setViewShowState(mBottomContainer, View.INVISIBLE)
|
||||||
override fun onAutoCompletion() {
|
// }
|
||||||
super.onAutoCompletion()
|
//
|
||||||
mProgressBar.progress = 0
|
// override fun onAutoCompletion() {
|
||||||
|
// super.onAutoCompletion()
|
||||||
completionListener.let {
|
// mProgressBar.progress = 0
|
||||||
it.onCompletion()
|
//
|
||||||
}
|
// completionListener.let {
|
||||||
|
// it.onCompletion()
|
||||||
Log.d("liyz", "MediaCoverVideoPlayer onAutoCompletion ------->")
|
// }
|
||||||
}
|
//
|
||||||
|
// Log.d("liyz", "MediaCoverVideoPlayer onAutoCompletion ------->")
|
||||||
override fun showWifiDialog() {
|
// }
|
||||||
//直接播放,不显示WIFI对话框
|
//
|
||||||
startPlayLogic()
|
// override fun showWifiDialog() {
|
||||||
}
|
// //直接播放,不显示WIFI对话框
|
||||||
|
// startPlayLogic()
|
||||||
override fun onClick(v: View?) {
|
// }
|
||||||
super.onClick(v)
|
//
|
||||||
v?.let {
|
// override fun onClick(v: View?) {
|
||||||
when (v) {
|
// super.onClick(v)
|
||||||
start -> {
|
// v?.let {
|
||||||
|
// when (v) {
|
||||||
}
|
// start -> {
|
||||||
else -> {
|
//
|
||||||
|
// }
|
||||||
}
|
// else -> {
|
||||||
}
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
override fun onPrepared() {
|
// }
|
||||||
super.onPrepared()
|
//
|
||||||
}
|
// override fun onPrepared() {
|
||||||
|
// super.onPrepared()
|
||||||
/**
|
// }
|
||||||
* 多次回调
|
//
|
||||||
*/
|
// /**
|
||||||
override fun onCompletion() {
|
// * 多次回调
|
||||||
super.onCompletion()
|
// */
|
||||||
}
|
// override fun onCompletion() {
|
||||||
|
// super.onCompletion()
|
||||||
|
// }
|
||||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
//
|
||||||
super.onProgressChanged(seekBar, progress, fromUser)
|
//
|
||||||
}
|
// override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||||
|
// super.onProgressChanged(seekBar, progress, fromUser)
|
||||||
override fun onDetachedFromWindow() {
|
// }
|
||||||
super.onDetachedFromWindow()
|
//
|
||||||
mFullPauseBitmap?.let {
|
// override fun onDetachedFromWindow() {
|
||||||
if (!it.isRecycled) {
|
// super.onDetachedFromWindow()
|
||||||
it.recycle()
|
// mFullPauseBitmap?.let {
|
||||||
}
|
// if (!it.isRecycled) {
|
||||||
}
|
// it.recycle()
|
||||||
mFullPauseBitmap = null
|
// }
|
||||||
}
|
// }
|
||||||
|
// mFullPauseBitmap = null
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
@@ -1,194 +1,194 @@
|
|||||||
package com.mogo.module.tanlu.video
|
//package com.mogo.module.tanlu.video
|
||||||
|
//
|
||||||
import android.content.Context
|
//import android.content.Context
|
||||||
import android.util.AttributeSet
|
//import android.util.AttributeSet
|
||||||
import android.util.Log
|
//import android.util.Log
|
||||||
import android.view.Surface
|
//import android.view.Surface
|
||||||
import android.view.View
|
//import android.view.View
|
||||||
import android.widget.ImageView
|
//import android.widget.ImageView
|
||||||
import com.bumptech.glide.Glide
|
//import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.request.RequestOptions
|
//import com.bumptech.glide.request.RequestOptions
|
||||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget
|
//import com.mogo.module.common.glide.SkinAbleBitmapTarget
|
||||||
import com.mogo.module.tanlu.R
|
//import com.mogo.module.tanlu.R
|
||||||
import com.mogo.utils.logger.Logger
|
//import com.mogo.utils.logger.Logger
|
||||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
//import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
//import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
//import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
//import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||||
|
//
|
||||||
|
//
|
||||||
class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
|
//class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
|
||||||
private lateinit var coverImage: ImageView
|
// private lateinit var coverImage: ImageView
|
||||||
private lateinit var start: ImageView
|
// private lateinit var start: ImageView
|
||||||
private lateinit var fullscreen: ImageView
|
// private lateinit var fullscreen: ImageView
|
||||||
|
//
|
||||||
companion object {
|
// companion object {
|
||||||
@JvmField
|
// @JvmField
|
||||||
val TAG: String = "SimpleCoverVideoPlayer.kt"
|
// val TAG: String = "SimpleCoverVideoPlayer.kt"
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
constructor(context: Context?) : super(context)
|
// constructor(context: Context?) : super(context)
|
||||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
// constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||||
constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
// constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||||
|
//
|
||||||
override fun init(context: Context) {
|
// override fun init(context: Context) {
|
||||||
super.init(context)
|
// super.init(context)
|
||||||
coverImage = findViewById(R.id.thumbImage)
|
// coverImage = findViewById(R.id.thumbImage)
|
||||||
start = findViewById(R.id.start)
|
// start = findViewById(R.id.start)
|
||||||
fullscreen = findViewById(R.id.fullscreen)
|
// fullscreen = findViewById(R.id.fullscreen)
|
||||||
if (mThumbImageViewLayout != null
|
// if (mThumbImageViewLayout != null
|
||||||
&& (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
|
// && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
|
||||||
) {
|
// ) {
|
||||||
mThumbImageViewLayout.visibility = View.VISIBLE
|
// mThumbImageViewLayout.visibility = View.VISIBLE
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun getLayoutId(): Int {
|
// override fun getLayoutId(): Int {
|
||||||
return R.layout.tanlu_item_video_cover
|
// return R.layout.tanlu_item_video_cover
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun getGSYVideoManager(): GSYVideoViewBridge {
|
// override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||||
GSYVideoManager.instance().initContext(context.applicationContext)
|
// GSYVideoManager.instance().initContext(context.applicationContext)
|
||||||
return GSYVideoManager.instance()
|
// return GSYVideoManager.instance()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
// override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
||||||
super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
// super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||||
if (progress != 0) {
|
// if (progress != 0) {
|
||||||
// Log.d("liyz", "SimpleCoverVideoPlayer setProgressAndTime -----2---- $progress");
|
//// Log.d("liyz", "SimpleCoverVideoPlayer setProgressAndTime -----2---- $progress");
|
||||||
mProgressBar.progress = progress
|
// mProgressBar.progress = progress
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
fun loadCoverImage(url: String, mContext: Context) {
|
// fun loadCoverImage(url: String, mContext: Context) {
|
||||||
//加载图片
|
// //加载图片
|
||||||
val requestOptions = RequestOptions()
|
// val requestOptions = RequestOptions()
|
||||||
// .placeholder(R.drawable.tanlu_normal_image)
|
//// .placeholder(R.drawable.tanlu_normal_image)
|
||||||
.error(R.drawable.tanlu_normal_image)
|
// .error(R.drawable.tanlu_normal_image)
|
||||||
Glide.with(mContext).asBitmap()
|
// Glide.with(mContext).asBitmap()
|
||||||
.load(url)
|
// .load(url)
|
||||||
.apply(requestOptions)
|
// .apply(requestOptions)
|
||||||
.into(SkinAbleBitmapTarget(coverImage, requestOptions))
|
// .into(SkinAbleBitmapTarget(coverImage, requestOptions))
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun updateStartImage() {
|
// override fun updateStartImage() {
|
||||||
when (mCurrentState) {
|
// when (mCurrentState) {
|
||||||
// GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
|
//// GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
|
||||||
// GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
|
//// GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
|
||||||
// else -> start.setImageResource(R.drawable.selector_bg_btn_play)
|
//// else -> start.setImageResource(R.drawable.selector_bg_btn_play)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
fun setFullClickListener(listener: OnClickListener) {
|
// fun setFullClickListener(listener: OnClickListener) {
|
||||||
fullscreen.setOnClickListener(listener)
|
// fullscreen.setOnClickListener(listener)
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun changeUiToCompleteShow() {
|
// override fun changeUiToCompleteShow() {
|
||||||
super.changeUiToCompleteShow()
|
// super.changeUiToCompleteShow()
|
||||||
// setViewShowState(mBottomContainer, View.INVISIBLE)
|
//// setViewShowState(mBottomContainer, View.INVISIBLE)
|
||||||
mBottomContainer.visibility = View.INVISIBLE
|
// mBottomContainer.visibility = View.INVISIBLE
|
||||||
mProgressBar.visibility = View.GONE
|
// mProgressBar.visibility = View.GONE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun hideAllWidget() {
|
// override fun hideAllWidget() {
|
||||||
super.hideAllWidget()
|
// super.hideAllWidget()
|
||||||
mBottomContainer.visibility = View.INVISIBLE
|
// mBottomContainer.visibility = View.INVISIBLE
|
||||||
mProgressBar.visibility = View.GONE
|
// mProgressBar.visibility = View.GONE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun changeUiToPrepareingClear() {
|
// override fun changeUiToPrepareingClear() {
|
||||||
super.changeUiToPrepareingClear()
|
// super.changeUiToPrepareingClear()
|
||||||
mBottomContainer.visibility = View.INVISIBLE
|
// mBottomContainer.visibility = View.INVISIBLE
|
||||||
mProgressBar.visibility = View.GONE
|
// mProgressBar.visibility = View.GONE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun changeUiToPlayingBufferingClear() {
|
// override fun changeUiToPlayingBufferingClear() {
|
||||||
super.changeUiToPlayingBufferingClear()
|
// super.changeUiToPlayingBufferingClear()
|
||||||
mBottomContainer.visibility = View.INVISIBLE
|
// mBottomContainer.visibility = View.INVISIBLE
|
||||||
mProgressBar.visibility = View.GONE
|
// mProgressBar.visibility = View.GONE
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun changeUiToClear() {
|
// override fun changeUiToClear() {
|
||||||
super.changeUiToClear()
|
// super.changeUiToClear()
|
||||||
mBottomContainer.visibility = View.INVISIBLE
|
// mBottomContainer.visibility = View.INVISIBLE
|
||||||
mProgressBar.visibility = View.GONE
|
// mProgressBar.visibility = View.GONE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun changeUiToCompleteClear() {
|
// override fun changeUiToCompleteClear() {
|
||||||
super.changeUiToCompleteClear()
|
// super.changeUiToCompleteClear()
|
||||||
mBottomContainer.visibility = View.INVISIBLE
|
// mBottomContainer.visibility = View.INVISIBLE
|
||||||
mProgressBar.visibility = View.GONE
|
// mProgressBar.visibility = View.GONE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onAutoCompletion() {
|
// override fun onAutoCompletion() {
|
||||||
super.onAutoCompletion()
|
// super.onAutoCompletion()
|
||||||
mProgressBar.progress = 0
|
// mProgressBar.progress = 0
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun showWifiDialog() {
|
// override fun showWifiDialog() {
|
||||||
//直接播放,不显示WIFI对话框
|
// //直接播放,不显示WIFI对话框
|
||||||
startPlayLogic()
|
// startPlayLogic()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onDetachedFromWindow() {
|
// override fun onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow()
|
// super.onDetachedFromWindow()
|
||||||
mProgressBar.progress = 0
|
// mProgressBar.progress = 0
|
||||||
mFullPauseBitmap = null
|
// mFullPauseBitmap = null
|
||||||
if (mAudioManager != null) {
|
// if (mAudioManager != null) {
|
||||||
try {
|
// try {
|
||||||
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener)
|
// mAudioManager.abandonAudioFocus(onAudioFocusChangeListener)
|
||||||
} catch (e: Exception) {
|
// } catch (e: Exception) {
|
||||||
Logger.e(TAG, e, "onDetachedFromWindow - abandonAudioFocus")
|
// Logger.e(TAG, e, "onDetachedFromWindow - abandonAudioFocus")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onClick(v: View?) {
|
// override fun onClick(v: View?) {
|
||||||
super.onClick(v)
|
// super.onClick(v)
|
||||||
v?.let {
|
// v?.let {
|
||||||
when (v) {
|
// when (v) {
|
||||||
start -> {
|
// start -> {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
else -> {
|
// else -> {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onPrepared() {
|
// override fun onPrepared() {
|
||||||
super.onPrepared()
|
// super.onPrepared()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onCompletion() {
|
// override fun onCompletion() {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onSurfaceUpdated(surface: Surface) {
|
// override fun onSurfaceUpdated(surface: Surface) {
|
||||||
super.onSurfaceUpdated(surface)
|
// super.onSurfaceUpdated(surface)
|
||||||
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
// if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||||
mThumbImageViewLayout.visibility = View.INVISIBLE
|
// mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun setViewShowState(view: View?, visibility: Int) {
|
// override fun setViewShowState(view: View?, visibility: Int) {
|
||||||
if (view === mThumbImageViewLayout && visibility != View.VISIBLE) {
|
// if (view === mThumbImageViewLayout && visibility != View.VISIBLE) {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
super.setViewShowState(view, visibility)
|
// super.setViewShowState(view, visibility)
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun onSurfaceAvailable(surface: Surface) {
|
// override fun onSurfaceAvailable(surface: Surface) {
|
||||||
super.onSurfaceAvailable(surface)
|
// super.onSurfaceAvailable(surface)
|
||||||
mProgressBar.visibility = View.GONE
|
// mProgressBar.visibility = View.GONE
|
||||||
if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
|
// if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
|
||||||
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
// if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||||
mThumbImageViewLayout.visibility = View.INVISIBLE
|
// mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
package com.mogo.module.tanlu.video
|
//package com.mogo.module.tanlu.video
|
||||||
|
//
|
||||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||||
import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
//import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
||||||
import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
|
//import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
|
||||||
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
//import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||||
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
//import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||||
import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
//import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
//import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
//import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||||
|
//
|
||||||
|
//
|
||||||
fun initVideo() {
|
//fun initVideo() {
|
||||||
PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
|
// PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
|
||||||
CacheFactory.setCacheManager(ProxyCacheManager::class.java)
|
// CacheFactory.setCacheManager(ProxyCacheManager::class.java)
|
||||||
var list = mutableListOf<VideoOptionModel>()
|
// var list = mutableListOf<VideoOptionModel>()
|
||||||
list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1))
|
// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1))
|
||||||
list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "videotoolbox", 0))
|
// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "videotoolbox", 0))
|
||||||
// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1))
|
//// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1))
|
||||||
GSYVideoManager.instance().optionModelList = list
|
// GSYVideoManager.instance().optionModelList = list
|
||||||
GSYVideoType.enableMediaCodec()
|
// GSYVideoType.enableMediaCodec()
|
||||||
GSYVideoType.enableMediaCodecTexture()
|
// GSYVideoType.enableMediaCodecTexture()
|
||||||
}
|
//}
|
||||||
@@ -15,12 +15,12 @@
|
|||||||
android:layout_marginBottom="@dimen/tanlu_module_card_margin_left"
|
android:layout_marginBottom="@dimen/tanlu_module_card_margin_left"
|
||||||
android:background="@drawable/shape_tanlu_top_bg">
|
android:background="@drawable/shape_tanlu_top_bg">
|
||||||
|
|
||||||
<com.mogo.module.tanlu.video.SimpleCoverVideoPlayer
|
<!-- <com.mogo.module.tanlu.video.SimpleCoverVideoPlayer-->
|
||||||
android:id="@+id/video_player_main"
|
<!-- android:id="@+id/video_player_main"-->
|
||||||
android:layout_width="match_parent"
|
<!-- android:layout_width="match_parent"-->
|
||||||
android:layout_height="match_parent"
|
<!-- android:layout_height="match_parent"-->
|
||||||
android:layout_centerInParent="true"
|
<!-- android:layout_centerInParent="true"-->
|
||||||
android:visibility="gone" />
|
<!-- android:visibility="gone" />-->
|
||||||
|
|
||||||
<com.mogo.service.imageloader.MogoImageView
|
<com.mogo.service.imageloader.MogoImageView
|
||||||
android:id="@+id/tanlu_photo_imageView"
|
android:id="@+id/tanlu_photo_imageView"
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ dependencies {
|
|||||||
implementation rootProject.ext.dependencies.androidxviewpager2
|
implementation rootProject.ext.dependencies.androidxviewpager2
|
||||||
implementation rootProject.ext.dependencies.localbroadcastmanager
|
implementation rootProject.ext.dependencies.localbroadcastmanager
|
||||||
|
|
||||||
|
implementation rootProject.ext.dependencies.videoarmv7
|
||||||
|
implementation rootProject.ext.dependencies.videoarm64
|
||||||
|
implementation rootProject.ext.dependencies.videojava
|
||||||
|
|
||||||
kapt rootProject.ext.dependencies.roomAnnotationProcessor
|
kapt rootProject.ext.dependencies.roomAnnotationProcessor
|
||||||
kapt rootProject.ext.dependencies.aroutercompiler
|
kapt rootProject.ext.dependencies.aroutercompiler
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package com.mogo.module.tanlu.video
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.Surface
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
import com.bumptech.glide.request.RequestOptions
|
||||||
|
import com.mogo.module.common.glide.SkinAbleBitmapTarget
|
||||||
|
import com.mogo.module.v2x.R
|
||||||
|
import com.mogo.utils.logger.Logger
|
||||||
|
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||||
|
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||||
|
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||||
|
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||||
|
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||||
|
|
||||||
|
|
||||||
|
class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
|
||||||
|
private lateinit var coverImage: ImageView
|
||||||
|
private lateinit var start: ImageView
|
||||||
|
private lateinit var fullscreen: ImageView
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmField
|
||||||
|
val TAG: String = "SimpleCoverVideoPlayer.kt"
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(context: Context?) : super(context)
|
||||||
|
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||||
|
constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||||
|
|
||||||
|
override fun init(context: Context) {
|
||||||
|
super.init(context)
|
||||||
|
coverImage = findViewById(R.id.thumbnail_image)
|
||||||
|
start = findViewById(R.id.start)
|
||||||
|
fullscreen = findViewById(R.id.fullscreen)
|
||||||
|
if (mThumbImageViewLayout != null
|
||||||
|
&& (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
|
||||||
|
) {
|
||||||
|
mThumbImageViewLayout.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
return R.layout.window_road_video
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||||
|
GSYVideoManager.instance().initContext(context.applicationContext)
|
||||||
|
return GSYVideoManager.instance()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
||||||
|
super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||||
|
if (progress != 0) {
|
||||||
|
// Log.d("liyz", "SimpleCoverVideoPlayer setProgressAndTime -----2---- $progress");
|
||||||
|
mProgressBar.progress = progress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadCoverImage(url: String, mContext: Context) {
|
||||||
|
//加载图片
|
||||||
|
val requestOptions = RequestOptions()
|
||||||
|
// .placeholder(R.drawable.tanlu_normal_image)
|
||||||
|
.error(R.drawable.video_loading)
|
||||||
|
Glide.with(mContext).asBitmap()
|
||||||
|
.load(url)
|
||||||
|
.apply(requestOptions)
|
||||||
|
.into(SkinAbleBitmapTarget(coverImage, requestOptions))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateStartImage() {
|
||||||
|
when (mCurrentState) {
|
||||||
|
// GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
|
||||||
|
// GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
|
||||||
|
// else -> start.setImageResource(R.drawable.selector_bg_btn_play)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setFullClickListener(listener: OnClickListener) {
|
||||||
|
fullscreen.setOnClickListener(listener)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun changeUiToCompleteShow() {
|
||||||
|
super.changeUiToCompleteShow()
|
||||||
|
// setViewShowState(mBottomContainer, View.INVISIBLE)
|
||||||
|
mBottomContainer.visibility = View.INVISIBLE
|
||||||
|
mProgressBar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hideAllWidget() {
|
||||||
|
super.hideAllWidget()
|
||||||
|
mBottomContainer.visibility = View.INVISIBLE
|
||||||
|
mProgressBar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun changeUiToPrepareingClear() {
|
||||||
|
super.changeUiToPrepareingClear()
|
||||||
|
mBottomContainer.visibility = View.INVISIBLE
|
||||||
|
mProgressBar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun changeUiToPlayingBufferingClear() {
|
||||||
|
super.changeUiToPlayingBufferingClear()
|
||||||
|
mBottomContainer.visibility = View.INVISIBLE
|
||||||
|
mProgressBar.visibility = View.GONE
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun changeUiToClear() {
|
||||||
|
super.changeUiToClear()
|
||||||
|
mBottomContainer.visibility = View.INVISIBLE
|
||||||
|
mProgressBar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun changeUiToCompleteClear() {
|
||||||
|
super.changeUiToCompleteClear()
|
||||||
|
mBottomContainer.visibility = View.INVISIBLE
|
||||||
|
mProgressBar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAutoCompletion() {
|
||||||
|
super.onAutoCompletion()
|
||||||
|
mProgressBar.progress = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showWifiDialog() {
|
||||||
|
//直接播放,不显示WIFI对话框
|
||||||
|
startPlayLogic()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow()
|
||||||
|
mProgressBar.progress = 0
|
||||||
|
mFullPauseBitmap = null
|
||||||
|
if (mAudioManager != null) {
|
||||||
|
try {
|
||||||
|
mAudioManager.abandonAudioFocus(onAudioFocusChangeListener)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Logger.e(TAG, e, "onDetachedFromWindow - abandonAudioFocus")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(v: View?) {
|
||||||
|
super.onClick(v)
|
||||||
|
v?.let {
|
||||||
|
when (v) {
|
||||||
|
start -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPrepared() {
|
||||||
|
super.onPrepared()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCompletion() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSurfaceUpdated(surface: Surface) {
|
||||||
|
super.onSurfaceUpdated(surface)
|
||||||
|
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||||
|
mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setViewShowState(view: View?, visibility: Int) {
|
||||||
|
if (view === mThumbImageViewLayout && visibility != View.VISIBLE) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
super.setViewShowState(view, visibility)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSurfaceAvailable(surface: Surface) {
|
||||||
|
super.onSurfaceAvailable(surface)
|
||||||
|
mProgressBar.visibility = View.GONE
|
||||||
|
if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
|
||||||
|
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||||
|
mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.mogo.module.tanlu.video
|
||||||
|
|
||||||
|
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||||
|
import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
||||||
|
import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
|
||||||
|
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||||
|
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||||
|
import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||||
|
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||||
|
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||||
|
|
||||||
|
|
||||||
|
fun initVideo() {
|
||||||
|
PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
|
||||||
|
CacheFactory.setCacheManager(ProxyCacheManager::class.java)
|
||||||
|
var list = mutableListOf<VideoOptionModel>()
|
||||||
|
list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1))
|
||||||
|
list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "videotoolbox", 0))
|
||||||
|
// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1))
|
||||||
|
GSYVideoManager.instance().optionModelList = list
|
||||||
|
GSYVideoType.enableMediaCodec()
|
||||||
|
GSYVideoType.enableMediaCodecTexture()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user