I use MediaPlayer
& TextureView
,Repeats the video. But within a short while the program crashed, cause by OOM. I called mediaPlayer.release()
in onSurfaceTextureDestroyed()
, but it still crashes.
Does any body has the same problem ?
This is my code :
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
surface=null;
stop();
try {
mediaPlayer.release();
}catch (Exception e){
}
return true;
}
private void stop(){
try {
if(!mediaPlayer.isPlaying()){
return;
}
mediaPlayer.stop();
}catch (Exception e){
}
}