mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
use encoded video path only at passing it to the mediaplayer
This commit is contained in:
parent
03be5504f4
commit
2b3223be08
1 changed files with 4 additions and 2 deletions
|
@ -47,6 +47,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||
private var mStoredExtendedDetails = 0
|
||||
private var mCurrTime = 0
|
||||
private var mDuration = 0
|
||||
private var mEncodedPath = ""
|
||||
|
||||
private var mTouchDownX = 0f
|
||||
private var mTouchDownY = 0f
|
||||
|
@ -416,9 +417,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||
return
|
||||
}
|
||||
|
||||
val mediumPath = if (wasEncoded) mEncodedPath else medium.path
|
||||
try {
|
||||
mMediaPlayer = MediaPlayer().apply {
|
||||
setDataSource(context, Uri.parse(medium.path))
|
||||
setDataSource(context, Uri.parse(mediumPath))
|
||||
setDisplay(mSurfaceHolder)
|
||||
setOnCompletionListener { videoCompleted() }
|
||||
setOnVideoSizeChangedListener({ mediaPlayer, width, height -> setVideoSize() })
|
||||
|
@ -427,7 +429,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||
prepare()
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
medium.path = Uri.encode(medium.path)
|
||||
mEncodedPath = Uri.encode(medium.path)
|
||||
if (wasEncoded) {
|
||||
releaseMediaPlayer()
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue