Remove unreachable branches in video completion handling

It is never the case that `loopVideos == true` in the `videoCompleted` handler,
since enabling that preference sets `repeatMode`, which in turn prevents the
player from reaching `STATE_ENDED`. Thus, the branches are unreachable.
This commit is contained in:
ForgottenUmbrella 2020-01-27 02:13:25 +11:00
parent e83db406a9
commit 9877cbaf2c
2 changed files with 6 additions and 14 deletions

View file

@ -347,13 +347,9 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
clearLastVideoSavedProgress() clearLastVideoSavedProgress()
mCurrTime = (mExoPlayer!!.duration / 1000).toInt() mCurrTime = (mExoPlayer!!.duration / 1000).toInt()
if (config.loopVideos) { video_seekbar.progress = video_seekbar.max
resumeVideo() video_curr_time.text = mDuration.getFormattedDuration()
} else { pauseVideo()
video_seekbar.progress = video_seekbar.max
video_curr_time.text = mDuration.getFormattedDuration()
pauseVideo()
}
} }
private fun didVideoEnd(): Boolean { private fun didVideoEnd(): Boolean {

View file

@ -681,13 +681,9 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
} }
mCurrTime = (mExoPlayer!!.duration / 1000).toInt() mCurrTime = (mExoPlayer!!.duration / 1000).toInt()
if (listener?.videoEnded() == false && mConfig.loopVideos) { mSeekBar.progress = mSeekBar.max
playVideo() mCurrTimeView.text = mDuration.getFormattedDuration()
} else { pauseVideo()
mSeekBar.progress = mSeekBar.max
mCurrTimeView.text = mDuration.getFormattedDuration()
pauseVideo()
}
} }
private fun cleanup() { private fun cleanup() {