fix #428, try url encoding video path if it throws IOException
This commit is contained in:
parent
733e9403dd
commit
283121a046
2 changed files with 12 additions and 1 deletions
|
@ -37,7 +37,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.simplemobiletools:commons:2.35.8'
|
compile 'com.simplemobiletools:commons:2.35.10'
|
||||||
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
||||||
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
|
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
|
||||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.simplemobiletools.gallery.extensions.*
|
||||||
import com.simplemobiletools.gallery.helpers.MEDIUM
|
import com.simplemobiletools.gallery.helpers.MEDIUM
|
||||||
import com.simplemobiletools.gallery.models.Medium
|
import com.simplemobiletools.gallery.models.Medium
|
||||||
import kotlinx.android.synthetic.main.pager_video_item.view.*
|
import kotlinx.android.synthetic.main.pager_video_item.view.*
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener {
|
class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener {
|
||||||
private val CLICK_MAX_DURATION = 150
|
private val CLICK_MAX_DURATION = 150
|
||||||
|
@ -40,6 +41,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
private var mIsFragmentVisible = false
|
private var mIsFragmentVisible = false
|
||||||
private var mPlayOnPrepare = false
|
private var mPlayOnPrepare = false
|
||||||
private var mStoredShowExtendedDetails = false
|
private var mStoredShowExtendedDetails = false
|
||||||
|
private var wasEncoded = false
|
||||||
private var wasInit = false
|
private var wasInit = false
|
||||||
private var mStoredExtendedDetails = 0
|
private var mStoredExtendedDetails = 0
|
||||||
private var mCurrTime = 0
|
private var mCurrTime = 0
|
||||||
|
@ -424,6 +426,15 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
setAudioStreamType(AudioManager.STREAM_MUSIC)
|
setAudioStreamType(AudioManager.STREAM_MUSIC)
|
||||||
prepare()
|
prepare()
|
||||||
}
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
medium.path = Uri.encode(medium.path)
|
||||||
|
if (wasEncoded) {
|
||||||
|
releaseMediaPlayer()
|
||||||
|
} else {
|
||||||
|
wasEncoded = true
|
||||||
|
mMediaPlayer = null
|
||||||
|
initMediaPlayer()
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
releaseMediaPlayer()
|
releaseMediaPlayer()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue