mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-01-01 11:08:02 +01:00
avoid intializing mediaplayer with invalid surface
This commit is contained in:
parent
a93d4be112
commit
671e10087a
@ -275,11 +275,11 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun surfaceCreated(holder: SurfaceHolder) {
|
override fun surfaceCreated(holder: SurfaceHolder) {
|
||||||
initMediaPlayer()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
|
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
|
||||||
|
setVideoSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun surfaceDestroyed(holder: SurfaceHolder) {
|
override fun surfaceDestroyed(holder: SurfaceHolder) {
|
||||||
@ -288,7 +288,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setVideoSize() {
|
private fun setVideoSize() {
|
||||||
if (activity == null)
|
if (activity == null || !mSurfaceHolder!!.surface.isValid)
|
||||||
return
|
return
|
||||||
|
|
||||||
initMediaPlayer()
|
initMediaPlayer()
|
||||||
|
Loading…
Reference in New Issue
Block a user