mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2024-12-25 07:51:26 +01:00
clean up the mediaplayer at surface destroy, so its recreated
This commit is contained in:
parent
b1fcd36a0b
commit
301f14acdb
@ -218,11 +218,6 @@ public class VideoFragment extends ViewPagerFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void surfaceCreated(SurfaceHolder holder) {
|
|
||||||
initMediaPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initMediaPlayer() {
|
private void initMediaPlayer() {
|
||||||
if (mMediaPlayer != null)
|
if (mMediaPlayer != null)
|
||||||
return;
|
return;
|
||||||
@ -284,6 +279,11 @@ public class VideoFragment extends ViewPagerFragment
|
|||||||
mTimerHandler.removeCallbacksAndMessages(null);
|
mTimerHandler.removeCallbacksAndMessages(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceCreated(SurfaceHolder holder) {
|
||||||
|
initMediaPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||||
|
|
||||||
@ -291,7 +291,10 @@ public class VideoFragment extends ViewPagerFragment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||||
|
if (mMediaPlayer != null) {
|
||||||
|
mMediaPlayer.release();
|
||||||
|
mMediaPlayer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user