diff --git a/app/src/main/java/com/dueeeke/dkplayer/activity/extend/SwitchPlayerActivity.java b/app/src/main/java/com/dueeeke/dkplayer/activity/extend/SwitchPlayerActivity.java index 578cdbb9..d06af4ba 100644 --- a/app/src/main/java/com/dueeeke/dkplayer/activity/extend/SwitchPlayerActivity.java +++ b/app/src/main/java/com/dueeeke/dkplayer/activity/extend/SwitchPlayerActivity.java @@ -47,7 +47,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { ijkVideoView.setPlayerConfig(new PlayerConfig.Builder() .autoRotate()//自动旋转屏幕 // .usingSurfaceView()//使用SurfaceView - .enableCache() +// .enableCache() .build()); ijkVideoView.setUrl(URL); ijkVideoView.setVideoController(mController); diff --git a/app/src/main/java/com/dueeeke/dkplayer/player/ExoMediaPlayer.java b/app/src/main/java/com/dueeeke/dkplayer/player/ExoMediaPlayer.java index 49b18be6..7efc3b68 100644 --- a/app/src/main/java/com/dueeeke/dkplayer/player/ExoMediaPlayer.java +++ b/app/src/main/java/com/dueeeke/dkplayer/player/ExoMediaPlayer.java @@ -213,6 +213,8 @@ public void release() { mDataSource = null; mIsPreparing = true; mIsBuffering = false; + lastReportedPlaybackState = Player.STATE_IDLE; + lastReportedPlayWhenReady = false; } @Override @@ -319,10 +321,12 @@ public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { switch (playbackState) { case Player.STATE_BUFFERING: - if (mPlayerEventListener != null) { - mPlayerEventListener.onInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_START, mInternalPlayer.getBufferedPercentage()); + if (!mIsPreparing) { + if (mPlayerEventListener != null) { + mPlayerEventListener.onInfo(IMediaPlayer.MEDIA_INFO_BUFFERING_START, mInternalPlayer.getBufferedPercentage()); + } + mIsBuffering = true; } - mIsBuffering = true; break; case Player.STATE_READY: break;