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,14 +347,10 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
clearLastVideoSavedProgress() clearLastVideoSavedProgress()
mCurrTime = (mExoPlayer!!.duration / 1000).toInt() mCurrTime = (mExoPlayer!!.duration / 1000).toInt()
if (config.loopVideos) {
resumeVideo()
} else {
video_seekbar.progress = video_seekbar.max video_seekbar.progress = video_seekbar.max
video_curr_time.text = mDuration.getFormattedDuration() video_curr_time.text = mDuration.getFormattedDuration()
pauseVideo() pauseVideo()
} }
}
private fun didVideoEnd(): Boolean { private fun didVideoEnd(): Boolean {
val currentPos = mExoPlayer?.currentPosition ?: 0 val currentPos = mExoPlayer?.currentPosition ?: 0

View file

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