From f63a8eebac46b76c0b5871ab5211474fe647e8d4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Dec 2017 22:17:09 +0100 Subject: [PATCH] release video mediaplayer on a background thread --- .../simplemobiletools/gallery/fragments/VideoFragment.kt | 8 +++++--- 1 file changed, 5 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 7ee976475..4942ea351 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -467,9 +467,11 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } private fun releaseMediaPlayer() { - mMediaPlayer?.setSurface(null) - mMediaPlayer?.release() - mMediaPlayer = null + Thread { + mMediaPlayer?.setSurface(null) + mMediaPlayer?.release() + mMediaPlayer = null + }.start() } private fun videoPrepared(mediaPlayer: MediaPlayer) {