Merge branch 'ii' into dev
This commit is contained in:
@@ -70,9 +70,6 @@ dependencies {
|
||||
}
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ import com.mogo.utils.TipDrawable;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
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.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.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
|
||||
@@ -204,7 +204,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
|
||||
|
||||
protected void initViews() {
|
||||
LayoutInflater.from(mContext).inflate(R.layout.tanlu_main_media_recycler_new, this);
|
||||
initVideo();
|
||||
// initVideo();
|
||||
mLoopRecyclerView = findViewById(R.id.tanlu_rloop_recycleview);
|
||||
mLoopRecyclerView.setHasFixedSize(true);
|
||||
mLoopRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
||||
@@ -845,7 +845,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
|
||||
public void releaseAction() {
|
||||
// EventBus.getDefault().unregister(this);
|
||||
mMogoRegisterCenter.unregisterMogoNaviListener(TanluConstants.MODEL_NAME);
|
||||
GSYVideoManager.releaseAllVideos();
|
||||
// GSYVideoManager.releaseAllVideos();
|
||||
if (mTanluSlideAdapter != null) {
|
||||
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.VoiceControlUpInfo;
|
||||
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.service.adas.IMogoADASControlStatusChangedListener;
|
||||
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.utils.TipToast;
|
||||
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.MogoDriverInfo;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
private TextView mAddressTv;
|
||||
private TextView mDistanceTv;
|
||||
private TextView mTimeTv;
|
||||
private SimpleCoverVideoPlayer simpleCoverVideoPlayer;
|
||||
// private SimpleCoverVideoPlayer simpleCoverVideoPlayer;
|
||||
private MogoImageView autoZoomInImageView;
|
||||
private MogoImageView mHeadImage;
|
||||
private ImageView mChatImage;
|
||||
@@ -88,7 +88,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
private ICarsChattingProvider mCarsChattingProvider;
|
||||
|
||||
//media
|
||||
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
// private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||
private String mVideoUrl = "";
|
||||
private String mImageUrl = "";
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
private IMogoAnalytics mAnalytics;
|
||||
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,
|
||||
@@ -129,7 +129,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
mAddressTv = holder.itemView.findViewById(R.id.tv_information_media_content);
|
||||
mDistanceTv = holder.itemView.findViewById(R.id.tv_information_media_distance);
|
||||
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);
|
||||
mHeadImage = holder.itemView.findViewById(R.id.tanlu_head_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);
|
||||
|
||||
list.put(position, simpleCoverVideoPlayer);
|
||||
// list.put(position, simpleCoverVideoPlayer);
|
||||
|
||||
mTypeTv.setText(getTypeName(markerExploreWay.getPoiType()));
|
||||
if (markerExploreWay.getPoiType().equals(TanluConstants.TANLU_ROAD_CURRENT)) {
|
||||
@@ -218,55 +218,55 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
}
|
||||
});
|
||||
|
||||
mLikeLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// mLikeLayout.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
//动画
|
||||
AnimatorSet animatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.anim.v2x_like_heart_animation);
|
||||
animatorSet.setTarget(mLikeImage);
|
||||
animatorSet.addListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
traceTypeData(markerExploreWay.getInfoId() == null ? "" : markerExploreWay.getInfoId(), "1", markerExploreWay.getSn() == null ? "" : markerExploreWay.getSn());
|
||||
if (TextUtils.isEmpty(markerExploreWay.getInfoId())) {
|
||||
TipToast.shortTip("点赞失败");
|
||||
return;
|
||||
}
|
||||
|
||||
mTanluModelData.thumbsUp(markerExploreWay, new IThumbsUpCallback() {
|
||||
@Override
|
||||
public void onThumbsUpSuccess() {
|
||||
TipToast.shortTip("点赞成功");
|
||||
Logger.d(TAG, "onThumbsUpSuccess -------->");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onThumbsUpFail() {
|
||||
TipToast.shortTip("点赞失败");
|
||||
Logger.e(TAG, "onThumbsUpFail -------->");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
|
||||
}
|
||||
});
|
||||
animatorSet.start();
|
||||
|
||||
}
|
||||
});
|
||||
// AnimatorSet animatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.anim.v2x_like_heart_animation);
|
||||
// animatorSet.setTarget(mLikeImage);
|
||||
// animatorSet.addListener(new Animator.AnimatorListener() {
|
||||
// @Override
|
||||
// public void onAnimationStart(Animator animation) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationEnd(Animator animation) {
|
||||
// traceTypeData(markerExploreWay.getInfoId() == null ? "" : markerExploreWay.getInfoId(), "1", markerExploreWay.getSn() == null ? "" : markerExploreWay.getSn());
|
||||
// if (TextUtils.isEmpty(markerExploreWay.getInfoId())) {
|
||||
// TipToast.shortTip("点赞失败");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// mTanluModelData.thumbsUp(markerExploreWay, new IThumbsUpCallback() {
|
||||
// @Override
|
||||
// public void onThumbsUpSuccess() {
|
||||
// TipToast.shortTip("点赞成功");
|
||||
// Logger.d(TAG, "onThumbsUpSuccess -------->");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onThumbsUpFail() {
|
||||
// TipToast.shortTip("点赞失败");
|
||||
// Logger.e(TAG, "onThumbsUpFail -------->");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationCancel(Animator animation) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationRepeat(Animator animation) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// animatorSet.start();
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
@@ -337,55 +337,55 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
* 刷新单个视频数据,更新位置positon
|
||||
*/
|
||||
private void refreshVideoData(MarkerExploreWay markerExploreWay) {
|
||||
if (markerExploreWay.getItems() == null) {
|
||||
showDefaultImage();
|
||||
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);
|
||||
// if (markerExploreWay.getItems() == null) {
|
||||
// showDefaultImage();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Glide.with(mContext)
|
||||
// .asBitmap()
|
||||
// .load(mImageUrl)
|
||||
// .apply(requestOptions)
|
||||
// .into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
|
||||
// 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)
|
||||
//// .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()));
|
||||
mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
||||
String imageUrl = markerExploreWay.getItems().get(0).getUrl();
|
||||
simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||
// simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||
Logger.d(TAG, "refreshPhotoData imageUrl = " + imageUrl);
|
||||
//加载图片
|
||||
@@ -426,7 +426,7 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
|
||||
|
||||
private void showDefaultImage() {
|
||||
simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||
// simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -484,20 +484,20 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onHandlePlay(final StartPlayInfo info) {
|
||||
int finalPosition = info.mPosition;
|
||||
Logger.d(TAG, "onHandlePlay size = " + list.size() + " >> info.mPosition = " + info.mPosition + " >> finalPosition = " + finalPosition);
|
||||
// if (list.size() > finalPosition) {
|
||||
SimpleCoverVideoPlayer coverVideoPlayer = list.get(finalPosition);
|
||||
coverVideoPlayer.release();
|
||||
coverVideoPlayer.getStartButton().performClick();
|
||||
traceVideoPlayStatusData();
|
||||
// int finalPosition = info.mPosition;
|
||||
// Logger.d(TAG, "onHandlePlay size = " + list.size() + " >> info.mPosition = " + info.mPosition + " >> finalPosition = " + finalPosition);
|
||||
//// if (list.size() > finalPosition) {
|
||||
// SimpleCoverVideoPlayer coverVideoPlayer = list.get(finalPosition);
|
||||
// coverVideoPlayer.release();
|
||||
// coverVideoPlayer.getStartButton().performClick();
|
||||
// traceVideoPlayStatusData();
|
||||
// }
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if (list != null) {
|
||||
list.clear();
|
||||
}
|
||||
// if (list != null) {
|
||||
// list.clear();
|
||||
// }
|
||||
}
|
||||
|
||||
private String getTypeName(String type) {
|
||||
|
||||
@@ -1,146 +1,146 @@
|
||||
package com.mogo.module.tanlu.video
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.mogo.module.tanlu.R
|
||||
import com.mogo.module.tanlu.util.HideControl
|
||||
import com.mogo.module.tanlu.util.formatDate
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import kotlinx.android.synthetic.main.tanlu_activity_media_full.*
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* 全屏显示适配
|
||||
*/
|
||||
|
||||
class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
||||
companion object {
|
||||
const val TAG = "FullMediaActivity"
|
||||
|
||||
const val PARAM_VIDEO_URL = "param_video_url"
|
||||
const val PARAM_THUMB_URL = "param_thumb_url"
|
||||
const val PARAM_ADDRESS = "param_address"
|
||||
const val PARAM_TIME = "generate_time"
|
||||
|
||||
|
||||
// fun launch(context: Activity, strategyInfo: List<Informations>, position: Int) {
|
||||
//package com.mogo.module.tanlu.video
|
||||
//
|
||||
//import android.app.Activity
|
||||
//import android.content.Intent
|
||||
//import android.os.Bundle
|
||||
//import android.util.Log
|
||||
//import android.view.View
|
||||
//import androidx.appcompat.app.AppCompatActivity
|
||||
//import com.mogo.module.tanlu.R
|
||||
//import com.mogo.module.tanlu.util.HideControl
|
||||
//import com.mogo.module.tanlu.util.formatDate
|
||||
//import com.mogo.utils.logger.Logger
|
||||
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
//import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
//import kotlinx.android.synthetic.main.tanlu_activity_media_full.*
|
||||
//import java.util.*
|
||||
//
|
||||
///**
|
||||
// * 全屏显示适配
|
||||
// */
|
||||
//
|
||||
//class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
||||
// companion object {
|
||||
// const val TAG = "FullMediaActivity"
|
||||
//
|
||||
// const val PARAM_VIDEO_URL = "param_video_url"
|
||||
// const val PARAM_THUMB_URL = "param_thumb_url"
|
||||
// const val PARAM_ADDRESS = "param_address"
|
||||
// const val PARAM_TIME = "generate_time"
|
||||
//
|
||||
//
|
||||
//// 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)
|
||||
// intent.putExtra(PARAM_MEDIA_POSITION, position)
|
||||
// // 使用全局静态对象代替,避免序列化开销
|
||||
// GlobalSharedInformation.informationList = strategyInfo as ArrayList<Informations>
|
||||
// context.startActivityForResult(intent, REQUESTCODE_MAINACTIVITY)
|
||||
// intent.putExtra(PARAM_VIDEO_URL, videoUrl)
|
||||
// intent.putExtra(PARAM_THUMB_URL, thumbnail)
|
||||
// intent.putExtra(PARAM_ADDRESS, address)
|
||||
// intent.putExtra(PARAM_TIME, generateTime)
|
||||
// context.startActivity(intent)
|
||||
// context.overridePendingTransition(0, 0)
|
||||
// }
|
||||
|
||||
fun launch(context: Activity, videoUrl: String, thumbnail: String, address: String, generateTime: Long) {
|
||||
val intent = Intent(context, FullMediaActivity::class.java)
|
||||
intent.putExtra(PARAM_VIDEO_URL, videoUrl)
|
||||
intent.putExtra(PARAM_THUMB_URL, thumbnail)
|
||||
intent.putExtra(PARAM_ADDRESS, address)
|
||||
intent.putExtra(PARAM_TIME, generateTime)
|
||||
context.startActivity(intent)
|
||||
context.overridePendingTransition(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
private var control = HideControl()
|
||||
private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
private var videoUrl: String? = null
|
||||
private var thumbUrl: String? = null
|
||||
private var address: String? = null
|
||||
private var generateTime: Long = 0
|
||||
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.tanlu_activity_media_full)
|
||||
handleIntent()
|
||||
setListener()
|
||||
}
|
||||
|
||||
private fun handleIntent() {
|
||||
var intent = intent
|
||||
|
||||
videoUrl = intent.getStringExtra(PARAM_VIDEO_URL)
|
||||
thumbUrl = intent.getStringExtra(PARAM_THUMB_URL)
|
||||
address = intent.getStringExtra(PARAM_ADDRESS)
|
||||
generateTime = intent.getLongExtra(PARAM_TIME, 0)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
updateInformation()
|
||||
GSYVideoManager.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
GSYVideoManager.onPause()
|
||||
}
|
||||
|
||||
//需要监听完成事件
|
||||
private fun setListener() {
|
||||
iv_media_back.setOnClickListener(this)
|
||||
//重置timer
|
||||
video_view.addSingleClickListener(object :
|
||||
MediaCoverVideoPlayer.SingleClickListener {
|
||||
override fun onClick() {
|
||||
control.resetHideTimer()
|
||||
}
|
||||
})
|
||||
|
||||
//视频播放完成
|
||||
video_view.onCompletionListener(object :
|
||||
MediaCoverVideoPlayer.CompletionListener {
|
||||
override fun onCompletion() {
|
||||
finish()
|
||||
}
|
||||
})
|
||||
|
||||
video_view
|
||||
video_view.loadCoverImage(thumbUrl!!)
|
||||
//设置url,点击播放
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(true)
|
||||
.setPlayTag(TAG).build(video_view)
|
||||
video_view.startButton.performClick()
|
||||
}
|
||||
|
||||
|
||||
private fun updateInformation() {
|
||||
tv_media_title_content.text = address
|
||||
tv_media_title_time.text = formatDate(generateTime)
|
||||
}
|
||||
|
||||
|
||||
override fun onClick(view: View) {
|
||||
view?.let {
|
||||
when (view) {
|
||||
iv_media_back -> {
|
||||
handleBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
overridePendingTransition(0, 0)
|
||||
}
|
||||
|
||||
private fun handleBack() {
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
super.onBackPressed()
|
||||
handleBack()
|
||||
}
|
||||
}
|
||||
// }
|
||||
//
|
||||
// private var control = HideControl()
|
||||
// private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
// private var videoUrl: String? = null
|
||||
// private var thumbUrl: String? = null
|
||||
// private var address: String? = null
|
||||
// private var generateTime: Long = 0
|
||||
//
|
||||
//
|
||||
//
|
||||
// override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// super.onCreate(savedInstanceState)
|
||||
// setContentView(R.layout.tanlu_activity_media_full)
|
||||
// handleIntent()
|
||||
// setListener()
|
||||
// }
|
||||
//
|
||||
// private fun handleIntent() {
|
||||
// var intent = intent
|
||||
//
|
||||
// videoUrl = intent.getStringExtra(PARAM_VIDEO_URL)
|
||||
// thumbUrl = intent.getStringExtra(PARAM_THUMB_URL)
|
||||
// address = intent.getStringExtra(PARAM_ADDRESS)
|
||||
// generateTime = intent.getLongExtra(PARAM_TIME, 0)
|
||||
// }
|
||||
//
|
||||
// override fun onResume() {
|
||||
// super.onResume()
|
||||
// updateInformation()
|
||||
// GSYVideoManager.onResume()
|
||||
// }
|
||||
//
|
||||
// override fun onPause() {
|
||||
// super.onPause()
|
||||
// GSYVideoManager.onPause()
|
||||
// }
|
||||
//
|
||||
// //需要监听完成事件
|
||||
// private fun setListener() {
|
||||
// iv_media_back.setOnClickListener(this)
|
||||
// //重置timer
|
||||
// video_view.addSingleClickListener(object :
|
||||
// MediaCoverVideoPlayer.SingleClickListener {
|
||||
// override fun onClick() {
|
||||
// control.resetHideTimer()
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// //视频播放完成
|
||||
// video_view.onCompletionListener(object :
|
||||
// MediaCoverVideoPlayer.CompletionListener {
|
||||
// override fun onCompletion() {
|
||||
// finish()
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// video_view
|
||||
// video_view.loadCoverImage(thumbUrl!!)
|
||||
// //设置url,点击播放
|
||||
// gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(true)
|
||||
// .setPlayTag(TAG).build(video_view)
|
||||
// video_view.startButton.performClick()
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private fun updateInformation() {
|
||||
// tv_media_title_content.text = address
|
||||
// tv_media_title_time.text = formatDate(generateTime)
|
||||
// }
|
||||
//
|
||||
//
|
||||
// override fun onClick(view: View) {
|
||||
// view?.let {
|
||||
// when (view) {
|
||||
// iv_media_back -> {
|
||||
// handleBack()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onDestroy() {
|
||||
// super.onDestroy()
|
||||
// GSYVideoManager.releaseAllVideos()
|
||||
// overridePendingTransition(0, 0)
|
||||
// }
|
||||
//
|
||||
// private fun handleBack() {
|
||||
// finish()
|
||||
// }
|
||||
//
|
||||
// override fun onBackPressed() {
|
||||
// super.onBackPressed()
|
||||
// handleBack()
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,162 +1,164 @@
|
||||
package com.mogo.module.tanlu.video
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.SeekBar
|
||||
import com.bumptech.glide.Glide
|
||||
import com.mogo.module.tanlu.R
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
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
|
||||
private lateinit var start: ImageView
|
||||
private lateinit var fullscreen: ImageView
|
||||
private lateinit var singleClickListener: SingleClickListener
|
||||
private lateinit var completionListener: CompletionListener
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||
|
||||
interface SingleClickListener {
|
||||
fun onClick()
|
||||
}
|
||||
|
||||
interface CompletionListener {
|
||||
fun onCompletion()
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
super.init(context)
|
||||
coverImage = findViewById(R.id.thumbImage)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
fun addSingleClickListener(singleClickListener: SingleClickListener) {
|
||||
this.singleClickListener = singleClickListener
|
||||
}
|
||||
|
||||
fun onCompletionListener(completionListener: CompletionListener) {
|
||||
this.completionListener = completionListener
|
||||
}
|
||||
|
||||
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 setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
||||
super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||
if (progress != 0) {
|
||||
mProgressBar.progress = progress
|
||||
}
|
||||
}
|
||||
|
||||
fun loadCoverImage(url: String) {
|
||||
Glide.with(context)
|
||||
.load(url)
|
||||
.into(coverImage)
|
||||
}
|
||||
|
||||
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 onClickUiToggle() {
|
||||
super.onClickUiToggle()
|
||||
singleClickListener.let {
|
||||
it.onClick()
|
||||
}
|
||||
}
|
||||
|
||||
override fun changeUiToCompleteShow() {
|
||||
super.changeUiToCompleteShow()
|
||||
// setViewShowState(mBottomContainer, View.INVISIBLE)
|
||||
}
|
||||
|
||||
override fun onAutoCompletion() {
|
||||
super.onAutoCompletion()
|
||||
mProgressBar.progress = 0
|
||||
|
||||
completionListener.let {
|
||||
it.onCompletion()
|
||||
}
|
||||
|
||||
Log.d("liyz", "MediaCoverVideoPlayer onAutoCompletion ------->")
|
||||
}
|
||||
|
||||
override fun showWifiDialog() {
|
||||
//直接播放,不显示WIFI对话框
|
||||
startPlayLogic()
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
super.onClick(v)
|
||||
v?.let {
|
||||
when (v) {
|
||||
start -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPrepared() {
|
||||
super.onPrepared()
|
||||
}
|
||||
|
||||
/**
|
||||
* 多次回调
|
||||
*/
|
||||
override fun onCompletion() {
|
||||
super.onCompletion()
|
||||
}
|
||||
|
||||
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
super.onProgressChanged(seekBar, progress, fromUser)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
mFullPauseBitmap?.let {
|
||||
if (!it.isRecycled) {
|
||||
it.recycle()
|
||||
}
|
||||
}
|
||||
mFullPauseBitmap = null
|
||||
}
|
||||
|
||||
}
|
||||
//package com.mogo.module.tanlu.video
|
||||
//
|
||||
//import android.content.Context
|
||||
//import android.util.AttributeSet
|
||||
//import android.util.Log
|
||||
//import android.view.View
|
||||
//import android.widget.ImageView
|
||||
//import android.widget.SeekBar
|
||||
//import com.bumptech.glide.Glide
|
||||
//import com.mogo.module.tanlu.R
|
||||
//import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
//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
|
||||
// private lateinit var start: ImageView
|
||||
// private lateinit var fullscreen: ImageView
|
||||
// private lateinit var singleClickListener: SingleClickListener
|
||||
// private lateinit var completionListener: CompletionListener
|
||||
//
|
||||
// constructor(context: Context?) : super(context)
|
||||
// constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
// constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
|
||||
//
|
||||
// interface SingleClickListener {
|
||||
// fun onClick()
|
||||
// }
|
||||
//
|
||||
// interface CompletionListener {
|
||||
// fun onCompletion()
|
||||
// }
|
||||
//
|
||||
// override fun init(context: Context) {
|
||||
// super.init(context)
|
||||
// coverImage = findViewById(R.id.thumbImage)
|
||||
// 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
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun addSingleClickListener(singleClickListener: SingleClickListener) {
|
||||
// this.singleClickListener = singleClickListener
|
||||
// }
|
||||
//
|
||||
// fun onCompletionListener(completionListener: CompletionListener) {
|
||||
// this.completionListener = completionListener
|
||||
// }
|
||||
//
|
||||
// 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 setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
||||
// super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||
// if (progress != 0) {
|
||||
// mProgressBar.progress = progress
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun loadCoverImage(url: String) {
|
||||
// Glide.with(context)
|
||||
// .load(url)
|
||||
// .into(coverImage)
|
||||
// }
|
||||
//
|
||||
// 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 onClickUiToggle() {
|
||||
// super.onClickUiToggle()
|
||||
// singleClickListener.let {
|
||||
// it.onClick()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun changeUiToCompleteShow() {
|
||||
// super.changeUiToCompleteShow()
|
||||
//// setViewShowState(mBottomContainer, View.INVISIBLE)
|
||||
// }
|
||||
//
|
||||
// override fun onAutoCompletion() {
|
||||
// super.onAutoCompletion()
|
||||
// mProgressBar.progress = 0
|
||||
//
|
||||
// completionListener.let {
|
||||
// it.onCompletion()
|
||||
// }
|
||||
//
|
||||
// Log.d("liyz", "MediaCoverVideoPlayer onAutoCompletion ------->")
|
||||
// }
|
||||
//
|
||||
// override fun showWifiDialog() {
|
||||
// //直接播放,不显示WIFI对话框
|
||||
// startPlayLogic()
|
||||
// }
|
||||
//
|
||||
// override fun onClick(v: View?) {
|
||||
// super.onClick(v)
|
||||
// v?.let {
|
||||
// when (v) {
|
||||
// start -> {
|
||||
//
|
||||
// }
|
||||
// else -> {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onPrepared() {
|
||||
// super.onPrepared()
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 多次回调
|
||||
// */
|
||||
// override fun onCompletion() {
|
||||
// super.onCompletion()
|
||||
// }
|
||||
//
|
||||
//
|
||||
// override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
// super.onProgressChanged(seekBar, progress, fromUser)
|
||||
// }
|
||||
//
|
||||
// override fun onDetachedFromWindow() {
|
||||
// super.onDetachedFromWindow()
|
||||
// mFullPauseBitmap?.let {
|
||||
// if (!it.isRecycled) {
|
||||
// it.recycle()
|
||||
// }
|
||||
// }
|
||||
// mFullPauseBitmap = null
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -1,194 +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.tanlu.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.thumbImage)
|
||||
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.tanlu_item_video_cover
|
||||
}
|
||||
|
||||
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.tanlu_normal_image)
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//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.tanlu.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.thumbImage)
|
||||
// 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.tanlu_item_video_cover
|
||||
// }
|
||||
//
|
||||
// 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.tanlu_normal_image)
|
||||
// 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
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,23 +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()
|
||||
}
|
||||
//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()
|
||||
//}
|
||||
@@ -15,12 +15,12 @@
|
||||
android:layout_marginBottom="@dimen/tanlu_module_card_margin_left"
|
||||
android:background="@drawable/shape_tanlu_top_bg">
|
||||
|
||||
<com.mogo.module.tanlu.video.SimpleCoverVideoPlayer
|
||||
android:id="@+id/video_player_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone" />
|
||||
<!-- <com.mogo.module.tanlu.video.SimpleCoverVideoPlayer-->
|
||||
<!-- android:id="@+id/video_player_main"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:layout_centerInParent="true"-->
|
||||
<!-- android:visibility="gone" />-->
|
||||
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/tanlu_photo_imageView"
|
||||
|
||||
@@ -61,6 +61,10 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxviewpager2
|
||||
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.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