release video mediaplayer on a background thread

This commit is contained in:
tibbi 2017-12-29 22:17:09 +01:00
parent 46a143e4ac
commit f63a8eebac

View file

@ -467,9 +467,11 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
} }
private fun releaseMediaPlayer() { private fun releaseMediaPlayer() {
mMediaPlayer?.setSurface(null) Thread {
mMediaPlayer?.release() mMediaPlayer?.setSurface(null)
mMediaPlayer = null mMediaPlayer?.release()
mMediaPlayer = null
}.start()
} }
private fun videoPrepared(mediaPlayer: MediaPlayer) { private fun videoPrepared(mediaPlayer: MediaPlayer) {