Skip to content

Commit

Permalink
修改了循环播放的问题 (2017-04-24)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Apr 24, 2017
1 parent 4cd9451 commit 387853a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ protected void onCreate(Bundle savedInstanceState) {
//String url = "http://hls.ciguang.tv/hdtv/video.m3u8";
//String url = "https://res.exexm.com/cw_145225549855002";
detailPlayer.setUp(url, false, null, "测试视频");

detailPlayer.setLooping(true);
/*VideoOptionModel videoOptionModel =
new VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 5);
List<VideoOptionModel> list = new ArrayList<>();
list.add(videoOptionModel);
GSYVideoManager.instance().setOptionModelList(list);*/

GSYVideoManager.instance().setTimeOut(4000, true);
//GSYVideoManager.instance().setTimeOut(4000, true);

//增加封面
ImageView imageView = new ImageView(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,21 +914,16 @@ public void onError(int what, int extra) {
public void onInfo(int what, int extra) {
if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START) {
mBackUpPlayingBufferState = mCurrentState;
if (mLooping && mHadPlay) {
//循环在播放的不显示loading
} else {
//避免在onPrepared之前就进入了buffering,导致一只loading
if (mHadPlay && mCurrentState != CURRENT_STATE_PREPAREING && mCurrentState > 0)
setStateAndUi(CURRENT_STATE_PLAYING_BUFFERING_START);
}
//避免在onPrepared之前就进入了buffering,导致一只loading
if (mHadPlay && mCurrentState != CURRENT_STATE_PREPAREING && mCurrentState > 0)
setStateAndUi(CURRENT_STATE_PLAYING_BUFFERING_START);

} else if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END) {
if (mBackUpPlayingBufferState != -1) {
if (mLooping && mHadPlay) {
//循环在播放的不显示
} else {
if (mHadPlay && mCurrentState != CURRENT_STATE_PREPAREING && mCurrentState > 0)
setStateAndUi(mBackUpPlayingBufferState);
}

if (mHadPlay && mCurrentState != CURRENT_STATE_PREPAREING && mCurrentState > 0)
setStateAndUi(mBackUpPlayingBufferState);

mBackUpPlayingBufferState = -1;
}
} else if (what == IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED) {
Expand Down

0 comments on commit 387853a

Please sign in to comment.