From 671e10087a5610c74501d64573564481ae651455 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 12 Apr 2017 21:35:51 +0200 Subject: [PATCH] avoid intializing mediaplayer with invalid surface --- .../simplemobiletools/gallery/fragments/VideoFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 2d67b38e4..b7be4d1b7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -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()