mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
avoid intializing mediaplayer with invalid surface
This commit is contained in:
parent
a93d4be112
commit
671e10087a
1 changed files with 3 additions and 3 deletions
|
@ -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 a new issue