use encoded video path only at passing it to the mediaplayer

This commit is contained in:
tibbi 2017-11-20 21:53:55 +01:00
parent 03be5504f4
commit 2b3223be08
1 changed files with 4 additions and 2 deletions

View File

@ -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 {