mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 14:28:00 +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() {
|
private fun setupTimer() {
|
||||||
activity!!.runOnUiThread(object : Runnable {
|
activity?.runOnUiThread(object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (mExoPlayer != null && !mIsDragged && mIsPlaying) {
|
if (mExoPlayer != null && !mIsDragged && mIsPlaying) {
|
||||||
mCurrTime = (mExoPlayer!!.currentPosition / 1000).toInt()
|
mCurrTime = (mExoPlayer!!.currentPosition / 1000).toInt()
|
||||||
|
@ -687,10 +687,14 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupVideoDuration() {
|
private fun setupVideoDuration() {
|
||||||
|
ensureBackgroundThread {
|
||||||
mDuration = mMedium.path.getVideoDuration()
|
mDuration = mMedium.path.getVideoDuration()
|
||||||
|
activity?.runOnUiThread {
|
||||||
setupTimeHolder()
|
setupTimeHolder()
|
||||||
setPosition(0)
|
setPosition(0)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun videoPrepared() {
|
private fun videoPrepared() {
|
||||||
if (mDuration == 0) {
|
if (mDuration == 0) {
|
||||||
|
|
Loading…
Reference in a new issue