mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2024-12-29 09:42:33 +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) {
|
||||
initMediaPlayer()
|
||||
|
||||
}
|
||||
|
||||
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
|
||||
|
||||
setVideoSize()
|
||||
}
|
||||
|
||||
override fun surfaceDestroyed(holder: SurfaceHolder) {
|
||||
@ -288,7 +288,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||
}
|
||||
|
||||
private fun setVideoSize() {
|
||||
if (activity == null)
|
||||
if (activity == null || !mSurfaceHolder!!.surface.isValid)
|
||||
return
|
||||
|
||||
initMediaPlayer()
|
||||
|
Loading…
Reference in New Issue
Block a user