fix #1765, properly handle videos at slideshows

This commit is contained in:
tibbi 2020-03-01 10:42:08 +01:00
parent ada0661d89
commit a16bbfbcf9
4 changed files with 14 additions and 4 deletions

View file

@ -359,4 +359,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
override fun goToNextItem() {} override fun goToNextItem() {}
override fun launchViewVideoIntent(path: String) {} override fun launchViewVideoIntent(path: String) {}
override fun isSlideShowActive() = false
} }

View file

@ -1185,6 +1185,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
return mIsSlideshowActive return mIsSlideshowActive
} }
override fun isSlideShowActive() = mIsSlideshowActive
override fun goToPrevItem() { override fun goToPrevItem() {
view_pager.setCurrentItem(view_pager.currentItem - 1, false) view_pager.setCurrentItem(view_pager.currentItem - 1, false)
checkOrientation() checkOrientation()

View file

@ -347,7 +347,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
mExoPlayer = ExoPlayerFactory.newSimpleInstance(context) mExoPlayer = ExoPlayerFactory.newSimpleInstance(context)
mExoPlayer!!.seekParameters = SeekParameters.CLOSEST_SYNC mExoPlayer!!.seekParameters = SeekParameters.CLOSEST_SYNC
if (mConfig.loopVideos) { if (mConfig.loopVideos && listener?.isSlideShowActive() == false) {
mExoPlayer?.repeatMode = Player.REPEAT_MODE_ONE mExoPlayer?.repeatMode = Player.REPEAT_MODE_ONE
} }
@ -722,10 +722,14 @@ 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()

View file

@ -31,6 +31,8 @@ abstract class ViewPagerFragment : Fragment() {
fun goToNextItem() fun goToNextItem()
fun launchViewVideoIntent(path: String) fun launchViewVideoIntent(path: String)
fun isSlideShowActive(): Boolean
} }
fun getMediumExtendedDetails(medium: Medium): String { fun getMediumExtendedDetails(medium: Medium): String {