|
@@ -62,11 +62,12 @@ public class SuperPlayerView extends RelativeLayout {
|
|
|
private SuperPlayerModel mCurrentSuperPlayerModel; // 当前正在播放的SuperPlayerModel
|
|
|
private int mPlayAction; // 播放模式
|
|
|
private int mPlayIndex; // 正在播放model的索引
|
|
|
- private boolean mIsLoopPlayList; // 是否循环
|
|
|
private List<SuperPlayerModel> mSuperPlayerModelList; // SuperPlayerModel列表
|
|
|
+
|
|
|
private long mDuration; // 时长
|
|
|
private long mProgress; // 进度
|
|
|
- private boolean mIsPlayInit; // 防止mSuperPlayer.stop()继续调用playNextVideo的变量
|
|
|
+
|
|
|
+ private boolean mIsPlayInit;
|
|
|
private boolean isCallResume = false; //resume方法时候被调用,在预加载模式使用
|
|
|
private ISuperPlayerListener mSuperPlayerListener;
|
|
|
|
|
@@ -171,21 +172,16 @@ public class SuperPlayerView extends RelativeLayout {
|
|
|
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 播放视频列表
|
|
|
- *
|
|
|
- * @param models superPlayerModel列表
|
|
|
- * @param isLoopPlayList 是否循环
|
|
|
- * @param index 开始播放的视频索引
|
|
|
- */
|
|
|
- public void playWithModelList(List<SuperPlayerModel> models, boolean isLoopPlayList, int index) {
|
|
|
+ public void setupModelList(List<SuperPlayerModel> models) {
|
|
|
mSuperPlayerModelList = models;
|
|
|
- mIsLoopPlayList = isLoopPlayList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void playIndexModel(int index) {
|
|
|
playModelInList(index);
|
|
|
}
|
|
|
|
|
|
private void playModelInList(int index) {
|
|
|
-// mIsPlayInit = false;
|
|
|
+ mIsPlayInit = false;
|
|
|
mSuperPlayer.stop();
|
|
|
mPlayIndex = index;
|
|
|
updateNextButton();
|
|
@@ -204,25 +200,6 @@ public class SuperPlayerView extends RelativeLayout {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 播放视频
|
|
|
- *
|
|
|
- * @param model
|
|
|
- */
|
|
|
- public void playWithModel(SuperPlayerModel model, boolean hasNext) {
|
|
|
- isCallResume = false;
|
|
|
- mIsPlayInit = false;
|
|
|
- mSuperPlayer.stop();
|
|
|
- mIsLoopPlayList = false;
|
|
|
- mWindowPlayer.setPlayNextButtonVisibility(hasNext);
|
|
|
- mFullScreenPlayer.setPlayNextButtonVisibility(hasNext);
|
|
|
- //防止点击循环列表后再次回到其他列表后依然循环
|
|
|
- mSuperPlayerModelList.clear();
|
|
|
- mCurrentSuperPlayerModel = model;
|
|
|
- playWithModelInner(mCurrentSuperPlayerModel);
|
|
|
- mIsPlayInit = true;
|
|
|
- }
|
|
|
-
|
|
|
private void playWithModelInner(SuperPlayerModel model) {
|
|
|
mPlayAction = mCurrentSuperPlayerModel.playAction;
|
|
|
if (mPlayAction == PLAY_ACTION_AUTO_PLAY || mPlayAction == PLAY_ACTION_PRELOAD) {
|
|
@@ -439,7 +416,7 @@ public class SuperPlayerView extends RelativeLayout {
|
|
|
}
|
|
|
|
|
|
private void playIndexVideo(int index) {
|
|
|
- if (!mIsLoopPlayList && (index >= mSuperPlayerModelList.size())) {
|
|
|
+ if ((index >= mSuperPlayerModelList.size())) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -560,17 +537,10 @@ public class SuperPlayerView extends RelativeLayout {
|
|
|
|
|
|
@Override
|
|
|
public void onPlayStop() {
|
|
|
- playNextVideo();
|
|
|
+ if (mIsPlayInit) {
|
|
|
+ playNextVideo();
|
|
|
+ }
|
|
|
|
|
|
-// if (mSuperPlayerModelList.size() >= 1 && mIsPlayInit && mIsLoopPlayList) {
|
|
|
-// } else {
|
|
|
-// mWindowPlayer.updatePlayState(SuperPlayerDef.PlayerState.END);
|
|
|
-// mFullScreenPlayer.updatePlayState(SuperPlayerDef.PlayerState.END);
|
|
|
-// // 清空关键帧和视频打点信息
|
|
|
-// if (mWatcher != null) {
|
|
|
-// mWatcher.stop();
|
|
|
-// }
|
|
|
-// }
|
|
|
notifyCallbackPlayEnd();
|
|
|
}
|
|
|
|