mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +01:00
use a background thread for fetching video durations
This commit is contained in:
parent
f0736fe634
commit
a4c1da2ac6
1 changed files with 8 additions and 4 deletions
|
@ -330,7 +330,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
}
|
||||
|
||||
private fun setupTimer() {
|
||||
activity!!.runOnUiThread(object : Runnable {
|
||||
activity?.runOnUiThread(object : Runnable {
|
||||
override fun run() {
|
||||
if (mExoPlayer != null && !mIsDragged && mIsPlaying) {
|
||||
mCurrTime = (mExoPlayer!!.currentPosition / 1000).toInt()
|
||||
|
@ -687,10 +687,14 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
|||
}
|
||||
|
||||
private fun setupVideoDuration() {
|
||||
ensureBackgroundThread {
|
||||
mDuration = mMedium.path.getVideoDuration()
|
||||
activity?.runOnUiThread {
|
||||
setupTimeHolder()
|
||||
setPosition(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun videoPrepared() {
|
||||
if (mDuration == 0) {
|
||||
|
|
Loading…
Reference in a new issue