Actually, you have to release the MediaPlayer in onDestroy() and onPause(), when the app exit. Or any other handling method, depends on your own case.
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
if (mediaPlayer != null) {
mediaPlayer.release();
mediaPlayer = null;
}
}
Next:
- Get video size for MediaPlayer by implementing onVideoSizeChanged()
Title: Release MediaPlayer in onDestroy() and onPause()
Rating: 100% based on 99998 ratings. 10 user reviews.
Post by 3:43 AM
Rating: 100% based on 99998 ratings. 10 user reviews.
Post by 3:43 AM
0 comments:
Post a Comment