Commit fcf26c9a authored by wangyue's avatar wangyue
Browse files

Merge branch 'develop' into 'master'

v_3.16.7版本

See merge request !3
parents 3c38712e 259d1a86
......@@ -61,7 +61,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.bokecc:CCVOD:3.16.6'
implementation 'com.bokecc:CCVOD:3.16.7'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.umeng.umsdk:common:9.4.0'
......
{
"title": "知识点",
"timeAxisStatus": true,
"pauseStatus": true,
"category": [
{
......
......@@ -48,6 +48,7 @@ public class HuoDeApplication extends MultiDexApplication {
UMConfigure.init(context, getString(R.string.umeng_app_key), "HuoDeVod", 0, null);
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO);
InitializeManager.getInstance(getContext()).initialize();
ApplicationData.isDebug(true);
}
public static Context getContext() {
......
......@@ -17,7 +17,7 @@ public class DanmuColorAdapter extends RecyclerView.Adapter<DanmuColorAdapter.Vi
private List<DanmuColorInfo> mData;
private boolean isPortrait = false;
private OnItemClickListener onItemClickListener;
private DanmuColorAdapter.OnItemClickListener onItemClickListener;
public DanmuColorAdapter(List<DanmuColorInfo> mData, boolean isPortrait) {
this.mData = mData;
......
......@@ -3,9 +3,7 @@ package com.bokecc.vod.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.text.Layout;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -17,7 +15,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import com.bokecc.vod.R;
import com.bokecc.vod.data.KnowledgeBean;
import com.bokecc.sdk.mobile.entry.KnowledgeBean;
import java.util.List;
......
......@@ -37,5 +37,5 @@ public interface AnswerSheetCallback {
* @param position 点击index
* @param select 是否选择
*/
void onMultipleChoiceOptions(int position, boolean select);
void onMultipleChoiceOptions(int position,boolean select);
}
......@@ -17,6 +17,6 @@ public interface ChoiceSelectListener {
* @param prePosition 上次的选择位置
* @param select 当前是否为选中状态
*/
void onChoiceSelectStateChange(List<AnswerSheetInfo.Answer> selectedAnswer, int currentPosition,
int prePosition, boolean select);
void onChoiceSelectStateChange(List<AnswerSheetInfo.Answer> selectedAnswer,int currentPosition ,
int prePosition,boolean select);
}
......@@ -3,5 +3,5 @@ package com.bokecc.vod.inter;
public interface ExercisesContinuePlay {
void continuePlay();
void backPlay(int backPlayTime, boolean isExerciseBackPlay, boolean isRemoveExercise);
void backPlay(int backPlayTime, boolean isExerciseBackPlay,boolean isRemoveExercise);
}
package com.bokecc.vod.inter;
public interface SelectDefinition {
void selectedDefinition(String definitionText, int definition);
void selectedDefinition(String definitionText,int definition);
}
package com.bokecc.vod.inter;
public interface SelectVideo {
void selectedVideo(String selectedVideoTitle, String selectedVideoId, String selectedVideoCover);
void selectedVideo(String selectedVideoTitle, String selectedVideoId,String selectedVideoCover);
}
......@@ -37,6 +37,7 @@ import android.os.IBinder;
import android.os.Message;
import android.os.Vibrator;
import android.text.TextUtils;
import android.util.Log;
import android.util.Rational;
import android.view.KeyEvent;
import android.view.MotionEvent;
......@@ -93,6 +94,7 @@ import com.bokecc.sdk.mobile.play.AnswerSheetListener;
import com.bokecc.sdk.mobile.play.DWMediaPlayer;
import com.bokecc.sdk.mobile.play.DanmuInfo;
import com.bokecc.sdk.mobile.play.HotSpotInfo;
import com.bokecc.sdk.mobile.play.KnowledgeListener;
import com.bokecc.sdk.mobile.play.MarqueeAction;
import com.bokecc.sdk.mobile.play.MarqueeInfo;
import com.bokecc.sdk.mobile.play.MarqueeView;
......@@ -120,7 +122,7 @@ import com.bokecc.vod.data.DanmuInfoParse;
import com.bokecc.vod.data.DataSet;
import com.bokecc.vod.data.Exercise;
import com.bokecc.vod.data.HuodeVideoInfo;
import com.bokecc.vod.data.KnowledgeBean;
import com.bokecc.sdk.mobile.entry.KnowledgeBean;
import com.bokecc.vod.data.LogoInfo;
import com.bokecc.vod.data.ObjectBox;
import com.bokecc.vod.data.Question;
......@@ -169,6 +171,7 @@ import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.google.gson.Gson;
import org.fourthline.cling.support.model.PositionInfo;
import org.json.JSONArray;
......@@ -198,13 +201,13 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
DWMediaPlayer.OnPreparedListener, DWMediaPlayer.OnInfoListener, DWMediaPlayer.OnBufferingUpdateListener,
DWMediaPlayer.OnCompletionListener, DWMediaPlayer.OnErrorListener, OnDreamWinErrorListener, SensorEventListener, ChoiceSelectListener {
private static final String TAG = MediaPlayActivity.class.getSimpleName();
/**
* 当出现错误时(OnError回调中),尝试自动重连的次数,可按需修改触发逻辑与次数
*/
private static final int ON_ERROR_RETRY_TIME = 3;
private static final int GET_DAN_MU_INTERVAL = 60 * 1000;
/**
* 是否展示课堂练习
*/
......@@ -418,21 +421,15 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
private long slideProgress;
private TextView tv_slide_progress;
private ImageView coverImage;
//跑马灯
private MarqueeView mv_video;
private ImageView iv_small_window_play;
private SmallWindowReceiver smallWindowReceiver;
private ArrayList<RemoteAction> actions;
private RemoteAction pauseRemoteAction, playRemoteAction;
private boolean isSmallWindow = false;
private PictureInPictureParams.Builder builder;
private ImageView iv_landscape_screenshot, iv_portrait_screenshot;
/**
* 选择题
*/
......@@ -445,7 +442,6 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
* 答题器容错ui
*/
private LinearLayout commitAnswerErrorLayout;
/**
* 答题器选择列表
*/
......@@ -510,7 +506,6 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
private List<VibrationInfo> vibrationInfoList;
private Vibrator vibrator;
private boolean isDynamicVideo;
/**
* 当前重试状态
*/
......@@ -519,7 +514,6 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
* 当前的重连次数
*/
private int retryPlayTimes = 0;
private long playedTime = 0;
private boolean isPlayCompleted;
//自定义logo
......@@ -530,7 +524,22 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
private final String logoUrl = "";
private String logoPath;
private String marqueeData;
/**
* 是否使用点播admin配置的知识点数据源
*/
private static final boolean SERVER_DATA_SOURCE = true;
/**
* 知识点按钮
*/
private TextView tvKnowledge;
/**
* 知识点Ui
*/
private KnowledgeDialog knowledgeDialog;
/**
* 知识点数据源
*/
private KnowledgeBean knowledgeBean;
/**
* 知识点结束时间点
*/
......@@ -583,7 +592,6 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
logoPath = getIntent().getStringExtra("logoPath");
isLocalPlay = getIntent().getBooleanExtra("isLocalPlay", false);
marqueeData = getIntent().getStringExtra("marqueeData");
boolean showKnowledge = getIntent().getBooleanExtra("showKnowledge", false);
iv_back = findViewById(R.id.iv_back);
iv_video_full_screen = findViewById(R.id.iv_video_full_screen);
iv_next_video = findViewById(R.id.iv_next_video);
......@@ -599,8 +607,7 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
tv_video_title = findViewById(R.id.tv_video_title);
tv_current_time = findViewById(R.id.tv_current_time);
tv_video_time = findViewById(R.id.tv_video_time);
TextView tvKnowledge = findViewById(R.id.tvKnowledge);
tvKnowledge.setVisibility(showKnowledge ? View.VISIBLE : View.GONE);
tvKnowledge = findViewById(R.id.tvKnowledge);
tv_play_definition = findViewById(R.id.tv_play_definition);
tv_video_select = findViewById(R.id.tv_video_select);
tv_error_info = findViewById(R.id.tv_error_info);
......@@ -782,13 +789,10 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
}
});
} else {
sb_progress.inKnowledgeRange(stopPosition);
player.seekTo(stopPosition);
seekToDanmu(stopPosition);
danMuSec = (stopPosition / GET_DAN_MU_INTERVAL) - 1;
if (!sb_progress.inKnowledgeRange(stopPosition)) {
sb_progress.resetKnowledgeRange();
knowledgePauseStatue = false;
}
player.seekTo(stopPosition);
seekToDanmu(stopPosition);
danMuSec = (stopPosition / GET_DAN_MU_INTERVAL) - 1;
......@@ -1053,10 +1057,7 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
//调节进度
tv_slide_progress.setVisibility(View.GONE);
if (!(slideProgress > playedTime && isForbidDragToUnPlayPart && !isPlayCompleted)) {
if (!sb_progress.inKnowledgeRange(slideProgress)) {
sb_progress.resetKnowledgeRange();
knowledgePauseStatue = false;
}
sb_progress.inKnowledgeRange(slideProgress);
player.seekTo((int) slideProgress);
seekToDanmu((int) slideProgress);
}
......@@ -1261,6 +1262,47 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
}
}
});
//知识点
if (SERVER_DATA_SOURCE) {
//使用点播admin配置的知识点相关信息
player.setKnowledgeListener(new KnowledgeListener() {
@Override
public void onKnowledge(final KnowledgeBean knowledgeBean) {
MediaPlayActivity.this.knowledgeBean = knowledgeBean;
runOnUiThread(new Runnable() {
@Override
public void run() {
sb_progress.setTimeAxisStatus(knowledgeBean.isTimeAxisStatus());
if (!TextUtils.isEmpty(knowledgeBean.getTitle())) {
tvKnowledge.setText(knowledgeBean.getTitle());
tvKnowledge.setVisibility(View.VISIBLE);
} else {
tvKnowledge.setVisibility(View.GONE);
}
}
});
}
@Override
public void onError(int errorCode, String errorMessage, String errorDetail) {
tvKnowledge.setVisibility(View.GONE);
Log.e(TAG, "onKnowledgeError,errorCode:" + errorCode + ",errorMessage:" + errorMessage + ",errorDetail:" + errorDetail);
}
});
} else {
//使用自定义数据源
String localJson = JsonUtil.getLocalJson(this, "knowledge.json");
this.knowledgeBean = new Gson().fromJson(localJson, KnowledgeBean.class);
if (knowledgeBean != null) {
if (!TextUtils.isEmpty(knowledgeBean.getTitle())) {
tvKnowledge.setVisibility(View.VISIBLE);
tvKnowledge.setText(knowledgeBean.getTitle());
} else {
tvKnowledge.setVisibility(View.GONE);
}
sb_progress.setTimeAxisStatus(knowledgeBean.isTimeAxisStatus());
}
}
//答题器相关数据
player.setOnAnswerSheetListener(new AnswerSheetListener() {
......@@ -1274,6 +1316,11 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
Collections.sort(sheetTimeList);
}
@Override
public void onError(int errorCode, String errorMessage, String errorDetail) {
}
@Override
public void onAnswerCommitSuccess(final List<AnswerCommitResult> commitResultList) {
runOnUiThread(new Runnable() {
......@@ -1911,6 +1958,11 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
case R.id.tvKnowledge:
//知识点
hideViews();
if (knowledgeBean == null) {
MultiUtils.showToast(activity, "无可用知识点相关数据");
return;
}
initKnowledgeDialog();
showKnowledgeDialog();
break;
case R.id.tv_play_definition:
......@@ -3123,44 +3175,45 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
}
}
KnowledgeDialog knowledgeDialog;
/**
* 知识点
* 初始化知识点ui
*/
private void showKnowledgeDialog() {
if (knowledgeDialog == null) {
knowledgeDialog = new KnowledgeDialog(activity);
knowledgeDialog.setKnowledgeCallback(new KnowledgeDialog.KnowledgeCallback() {
@Override
public void onKnowledgeClick(KnowledgeBean.Category.Info info, boolean pauseStatue) {
knowledgeStartTime = info.getStartTime();
knowledgeEndTime = info.getEndTime();
knowledgePauseStatue = pauseStatue;
String desc = info.getDesc();
if (player != null) {
player.seekTo(knowledgeStartTime * 1000);
if (!player.isPlaying()) {
player.start();
iv_play_pause.setImageResource(R.mipmap.iv_pause);
}
}
if (!TextUtils.isEmpty(desc) && desc != null) {
Toast.makeText(MediaPlayActivity.this, desc, Toast.LENGTH_SHORT).show();
}
sb_progress.resetKnowledgeRange();
if (knowledgeEndTime != 0) {
long duration = player.getDuration();
float startPosition = (float) knowledgeStartTime * 1000 / duration;
float endPosition = (float) knowledgeEndTime * 1000 / duration;
sb_progress.setKnowledgeTime(knowledgeStartTime, knowledgeEndTime);
sb_progress.setKnowledgeRange(startPosition, endPosition);
sb_progress.invalidate();
private void initKnowledgeDialog() {
knowledgeDialog = new KnowledgeDialog(activity, knowledgeBean);
knowledgeDialog.setKnowledgeCallback(new KnowledgeDialog.KnowledgeCallback() {
@Override
public void onKnowledgeClick(KnowledgeBean.Category.Info info, boolean pauseStatue) {
knowledgeStartTime = info.getStartTime();
knowledgeEndTime = info.getEndTime();
knowledgePauseStatue = pauseStatue;
String desc = info.getDesc();
if (player != null) {
player.seekTo(knowledgeStartTime * 1000);
if (!player.isPlaying()) {
player.start();
}
showOtherOperations();
}
});
}
if (!TextUtils.isEmpty(desc) && desc != null) {
Toast.makeText(MediaPlayActivity.this, desc, Toast.LENGTH_SHORT).show();
}
if (knowledgeEndTime != 0) {
long duration = player.getDuration();
float startPosition = (float) knowledgeStartTime * 1000 / duration;
float endPosition = (float) knowledgeEndTime * 1000 / duration;
sb_progress.setKnowledgeTime(knowledgeStartTime, knowledgeEndTime);
sb_progress.setKnowledgeRange(startPosition, endPosition);
sb_progress.invalidate();
}
showOtherOperations();
}
});
}
/**
* 知识点
*/
private void showKnowledgeDialog() {
knowledgeDialog.show();
hideOtherOperations();
}
......@@ -3176,6 +3229,22 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
resetInfo();
getAdInfo();
executeStatue = false;
//TODO 如果不使用admin配置的知识点相关数据,需在这里重新赋值knowledgeBean
if (!videoList.isEmpty() && !SERVER_DATA_SOURCE) {
if (TextUtils.equals(videoId, videoList.get(0).getVideoId())) {
String localJson = JsonUtil.getLocalJson(MediaPlayActivity.this, "knowledge.json");
knowledgeBean = new Gson().fromJson(localJson, KnowledgeBean.class);
if (knowledgeBean != null) {
if (!TextUtils.isEmpty(knowledgeBean.getTitle())) {
tvKnowledge.setVisibility(View.VISIBLE);
tvKnowledge.setText(knowledgeBean.getTitle());
} else {
tvKnowledge.setVisibility(View.GONE);
}
sb_progress.setTimeAxisStatus(knowledgeBean.isTimeAxisStatus());
}
}
}
}
});
selectVideoDialog.show();
......@@ -3572,7 +3641,7 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
@Override
public void onReceive(Context context, Intent intent) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifiInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo dataInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
......@@ -3783,13 +3852,10 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
currentPosition = 0;
playNextVideo();
}
}
});
}
}
} else {
currentPosition = 0;
playNextVideo();
......@@ -3826,6 +3892,9 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
}
private void resetInfo() {
tvKnowledge.setText("");
tvKnowledge.setVisibility(View.GONE);
knowledgeBean = null;
// 切换视频,重置questions
if (questions != null) {
questions.clear();
......@@ -4260,10 +4329,7 @@ public class MediaPlayActivity extends Activity implements View.OnClickListener,
}
return;
}
if (inKnowledgeRange) {
inKnowledgeRange = false;
sb_progress.resetKnowledgeRange();
}
sb_progress.inKnowledgeRange(currentPosition);
}
}
});
......
......@@ -93,6 +93,7 @@ import com.bokecc.sdk.mobile.play.AnswerSheetListener;
import com.bokecc.sdk.mobile.play.DWIjkMediaPlayer;
import com.bokecc.sdk.mobile.play.DanmuInfo;
import com.bokecc.sdk.mobile.play.HotSpotInfo;
import com.bokecc.sdk.mobile.play.KnowledgeListener;
import com.bokecc.sdk.mobile.play.MarqueeAction;
import com.bokecc.sdk.mobile.play.MarqueeInfo;
import com.bokecc.sdk.mobile.play.MarqueeView;
......@@ -118,9 +119,10 @@ import com.bokecc.vod.adapter.StatisticsAdapter;
import com.bokecc.vod.callback.ChoiceSelectListener;
import com.bokecc.vod.data.DanmuInfoParse;
import com.bokecc.vod.data.DataSet;
import com.bokecc.vod.data.DataUtil;
import com.bokecc.vod.data.Exercise;
import com.bokecc.vod.data.HuodeVideoInfo;
import com.bokecc.vod.data.KnowledgeBean;
import com.bokecc.sdk.mobile.entry.KnowledgeBean;
import com.bokecc.vod.data.LogoInfo;
import com.bokecc.vod.data.ObjectBox;
import com.bokecc.vod.data.Question;
......@@ -171,6 +173,7 @@ import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.google.gson.Gson;
import org.fourthline.cling.support.model.PositionInfo;
import org.json.JSONArray;
......@@ -196,12 +199,14 @@ import master.flame.danmaku.danmaku.model.DanmakuTimer;
import master.flame.danmaku.danmaku.model.IDisplayer;
import master.flame.danmaku.danmaku.model.android.DanmakuContext;
import tv.danmaku.ijk.media.player.IMediaPlayer;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
@SuppressLint("NonConstantResourceId")
public class SpeedPlayActivity extends Activity implements View.OnClickListener, TextureView.SurfaceTextureListener,
DWIjkMediaPlayer.OnPreparedListener, DWIjkMediaPlayer.OnInfoListener, DWIjkMediaPlayer.OnBufferingUpdateListener,
DWIjkMediaPlayer.OnCompletionListener, DWIjkMediaPlayer.OnErrorListener, OnDreamWinErrorListener, SensorEventListener, ChoiceSelectListener {
private static final String TAG = SpeedPlayActivity.class.getSimpleName();
/**
* 当出现错误时(OnError回调中),尝试自动重连的次数,可按需修改触发逻辑与次数
*/
......@@ -538,23 +543,31 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
* 跑马灯数据
*/
private String marqueeData;
/**
* 是否使用点播admin配置的知识点数据源
*/
private static final boolean SERVER_DATA_SOURCE = true;
/**
* 知识点按钮
*/
private TextView tvKnowledge;
/**
* 知识点Ui
*/
private KnowledgeDialog knowledgeDialog;
/**
* 知识点数据
*/
private KnowledgeBean knowledgeBean;
/**
* 知识点结束时间点
*/
private int knowledgeStartTime, knowledgeEndTime;
/**
* 当前知识点播放完毕后是否暂停
*/
private boolean knowledgePauseStatue;
/**
* 当前播放区域是否在选中的知识点内
*/
private boolean inKnowledgeRange;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -587,7 +600,6 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
logoPath = getIntent().getStringExtra("logoPath");
isLocalPlay = getIntent().getBooleanExtra("isLocalPlay", false);
marqueeData = getIntent().getStringExtra("marqueeData");
boolean showKnowledge = getIntent().getBooleanExtra("showKnowledge", false);
iv_back = findViewById(R.id.iv_back);
iv_video_full_screen = findViewById(R.id.iv_video_full_screen);
iv_next_video = findViewById(R.id.iv_next_video);
......@@ -604,8 +616,7 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
tv_current_time = findViewById(R.id.tv_current_time);
tv_video_time = findViewById(R.id.tv_video_time);
TextView tv_play_speed = findViewById(R.id.tv_play_speed);
TextView tvKnowledge = findViewById(R.id.tvKnowledge);
tvKnowledge.setVisibility(showKnowledge ? View.VISIBLE : View.GONE);
tvKnowledge = findViewById(R.id.tvKnowledge);
tv_play_definition = findViewById(R.id.tv_play_definition);
tv_video_select = findViewById(R.id.tv_video_select);
tv_error_info = findViewById(R.id.tv_error_info);
......@@ -788,10 +799,7 @@ public class SpeedPlayActivity extends Activity implements View.OnClickListener,
}
});
} else {
if (!sb_progress.inKnowledgeRange(stopPosition)) {